Check against runtime for calls generation (#4990)

* Check against runtime for calls generation

* No default augmentation
This commit is contained in:
Jaco
2022-06-29 17:34:11 +03:00
committed by GitHub
parent 74e1442343
commit 9ea866815b
22 changed files with 603 additions and 78 deletions
@@ -7,10 +7,17 @@
import type { Definitions } from '../../types';
import { rpc } from './rpc';
import { runtime } from './runtime';
export default {
rpc,
runtime,
types: {
BeefyAuthoritySet: {
id: 'u64',
len: 'u32',
root: 'H256'
},
BeefyCommitment: {
payload: 'BeefyPayload',
blockNumber: 'BlockNumber',
@@ -0,0 +1,23 @@
// Copyright 2017-2022 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DefinitionsCall } from '../../types';
export const runtime: DefinitionsCall = {
BeefyMmrApi: [
{
methods: {
authority_set_proof: {
description: 'Return the currently active BEEFY authority set proof.',
params: [],
type: 'BeefyAuthoritySet'
},
next_authority_set_proof: {
description: 'Return the next/queued BEEFY authority set proof.',
params: [],
type: 'BeefyNextAuthoritySet'
}
}
}
]
};
@@ -6,6 +6,13 @@ import type { ITuple } from '@polkadot/types-codec/types';
import type { EcdsaSignature } from '@polkadot/types/interfaces/extrinsics';
import type { BlockNumber, H256 } from '@polkadot/types/interfaces/runtime';
/** @name BeefyAuthoritySet */
export interface BeefyAuthoritySet extends Struct {
readonly id: u64;
readonly len: u32;
readonly root: H256;
}
/** @name BeefyCommitment */
export interface BeefyCommitment extends Struct {
readonly payload: BeefyPayload;
@@ -6,10 +6,12 @@
import type { Definitions } from '../../types';
import rpc from './rpc';
import { rpc } from './rpc';
import { runtime } from './runtime';
export default {
rpc,
runtime,
types: {
AliveContractInfo: {
trieId: 'TrieId',
+46 -49
View File
@@ -1,12 +1,9 @@
// Copyright 2017-2022 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
// order important in structs... :)
/* eslint-disable sort-keys */
import type { DefinitionsRpc } from '../../types';
export default {
export const rpc: DefinitionsRpc = {
call: {
description: 'Executes a call to a contract',
params: [
@@ -15,49 +12,14 @@ export default {
type: 'ContractCallRequest'
},
{
name: 'at',
type: 'BlockHash',
isHistoric: true,
isOptional: true
isOptional: true,
name: 'at',
type: 'BlockHash'
}
],
type: 'ContractExecResult'
},
instantiate: {
description: 'Instantiate a new contract',
params: [
{
name: 'request',
type: 'InstantiateRequest'
},
{
name: 'at',
type: 'BlockHash',
isHstoric: true,
isOptional: true
}
],
type: 'ContractInstantiateResult'
},
uploadCode: {
// The RPC here is terribly misnamed - somebody forgot how the RPCs
// are actually done, ie. <module>_<camelCasedMethod>
endpoint: 'contracts_upload_code',
description: 'Upload new code without instantiating a contract from it',
params: [
{
name: 'uploadRequest',
type: 'CodeUploadRequest'
},
{
name: 'at',
type: 'BlockHash',
isHstoric: true,
isOptional: true
}
],
type: 'CodeUploadResult'
},
getStorage: {
description: 'Returns the value under a specified storage key in a contract',
params: [
@@ -70,14 +32,30 @@ export default {
type: 'H256'
},
{
name: 'at',
type: 'BlockHash',
isHistoric: true,
isOptional: true
isOptional: true,
name: 'at',
type: 'BlockHash'
}
],
type: 'Option<Bytes>'
},
instantiate: {
description: 'Instantiate a new contract',
params: [
{
name: 'request',
type: 'InstantiateRequest'
},
{
isHistoric: true,
isOptional: true,
name: 'at',
type: 'BlockHash'
}
],
type: 'ContractInstantiateResult'
},
rentProjection: {
description: 'Returns the projected time a given contract will be able to sustain paying its rent',
params: [
@@ -86,12 +64,31 @@ export default {
type: 'AccountId'
},
{
name: 'at',
type: 'BlockHash',
isHistoric: true,
isOptional: true
isOptional: true,
name: 'at',
type: 'BlockHash'
}
],
type: 'Option<BlockNumber>'
},
uploadCode: {
description: 'Upload new code without instantiating a contract from it',
// The RPC here is terribly misnamed - somebody forgot how the RPCs
// are actually done, ie. <module>_<camelCasedMethod>
endpoint: 'contracts_upload_code',
params: [
{
name: 'uploadRequest',
type: 'CodeUploadRequest'
},
{
isHistoric: true,
isOptional: true,
name: 'at',
type: 'BlockHash'
}
],
type: 'CodeUploadResult'
}
} as DefinitionsRpc;
};
@@ -0,0 +1,109 @@
// Copyright 2017-2022 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DefinitionsCall } from '../../types';
export const runtime: DefinitionsCall = {
ContractsApi: [
{
methods: {
call: {
description: 'Perform a call from a specified account to a given contract.',
params: [
{
name: 'origin',
type: 'AccountId'
},
{
name: 'dest',
type: 'AccountId'
},
{
name: 'value',
type: 'Balance'
},
{
name: 'gasLimit',
type: 'u64'
},
{
name: 'storageDepositLimit',
type: 'Option<Balance>'
},
{
name: 'inputData',
type: 'Vec<u8>'
}
],
type: 'ContractExecResult'
},
get_storage: {
description: 'Query a given storage key in a given contract.',
params: [
{
name: 'address',
type: 'AccountId'
},
{
name: 'key',
type: 'Bytes'
}
],
type: 'Option<Bytes>'
},
instantiate: {
description: 'Instantiate a new contract.',
params: [
{
name: 'origin',
type: 'AccountId'
},
{
name: 'value',
type: 'Balance'
},
{
name: 'gasLimit',
type: 'u64'
},
{
name: 'storageDepositLimit',
type: 'Option<Balance>'
},
{
name: 'code',
type: 'Bytes'
},
{
name: 'data',
type: 'Bytes'
},
{
name: 'salt',
type: 'Bytes'
}
],
type: 'ContractInstantiateResult'
},
upload_code: {
description: 'Upload new code without instantiating a contract from it.',
params: [
{
name: 'origin',
type: 'AccountId'
},
{
name: 'code',
type: 'Bytes'
},
{
name: 'storageDepositLimit',
type: 'Option<Balance>'
}
],
type: 'CodeUploadResult'
}
}
}
]
};
@@ -7,9 +7,11 @@
import type { Definitions } from '../../types';
import { rpc } from './rpc';
import { runtime } from './runtime';
export default {
rpc,
runtime,
types: {
FeeDetails: {
inclusionFee: 'Option<InclusionFee>'
@@ -0,0 +1,41 @@
// Copyright 2017-2022 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DefinitionsCall } from '../../types';
export const runtime: DefinitionsCall = {
TransactionPaymentApi: [
{
methods: {
query_fee_details: {
description: 'The transaction fee details',
params: [
{
name: 'uxt',
type: 'Bytes'
},
{
name: 'len',
type: 'u32'
}
],
type: 'FeeDetails'
},
query_info: {
description: 'The transaction info',
params: [
{
name: 'uxt',
type: 'Bytes'
},
{
name: 'len',
type: 'u32'
}
],
type: 'RuntimeDispatchInfo'
}
}
}
]
};