Update contract' gas to Weight type (#5324)
* Update contract' gas to Weight type * Make Contracts Runtime Calls support WeightV2 * fix gasConsumed & gasConsumed type * Regenerate contracts types * Correct ContractCallOutcome * `gasLimit` are optional * Apply suggestion * Add ContractCallRequestV1 and specify old rpc use that * Add back getGas * Port jg-ContractsApi-v2 (#5330) * Run yarn build:metadata * There is no 'ContractCallRequestV1', only 'ContractCallRequest' * api.tx.contracts.call.meta no version field, _isOldWeight still work?
This commit is contained in:
@@ -12,12 +12,13 @@ import type { BabeEquivocationProof, BabeGenesisConfiguration, Epoch, OpaqueKeyO
|
|||||||
import type { CheckInherentsResult, InherentData } from '@polkadot/types/interfaces/blockbuilder';
|
import type { CheckInherentsResult, InherentData } from '@polkadot/types/interfaces/blockbuilder';
|
||||||
import type { BlockHash } from '@polkadot/types/interfaces/chain';
|
import type { BlockHash } from '@polkadot/types/interfaces/chain';
|
||||||
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
|
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
|
||||||
|
import type { CodeSource, CodeUploadResult, ContractExecResult, ContractInstantiateResult } from '@polkadot/types/interfaces/contracts';
|
||||||
import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
|
import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
|
||||||
import type { AuthorityList, GrandpaEquivocationProof, SetId } from '@polkadot/types/interfaces/grandpa';
|
import type { AuthorityList, GrandpaEquivocationProof, SetId } from '@polkadot/types/interfaces/grandpa';
|
||||||
import type { OpaqueMetadata } from '@polkadot/types/interfaces/metadata';
|
import type { OpaqueMetadata } from '@polkadot/types/interfaces/metadata';
|
||||||
import type { MmrBatchProof, MmrEncodableOpaqueLeaf, MmrError, MmrLeafIndex, MmrProof } from '@polkadot/types/interfaces/mmr';
|
import type { MmrBatchProof, MmrEncodableOpaqueLeaf, MmrError, MmrLeafIndex, MmrProof } from '@polkadot/types/interfaces/mmr';
|
||||||
import type { FeeDetails, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
|
import type { FeeDetails, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
|
||||||
import type { AccountId, Balance, Block, Call, Hash, Header, Index, KeyTypeId, Slot } from '@polkadot/types/interfaces/runtime';
|
import type { AccountId, Balance, Block, Call, Hash, Header, Index, KeyTypeId, Slot, WeightV2 } from '@polkadot/types/interfaces/runtime';
|
||||||
import type { RuntimeVersion } from '@polkadot/types/interfaces/state';
|
import type { RuntimeVersion } from '@polkadot/types/interfaces/state';
|
||||||
import type { ApplyExtrinsicResult } from '@polkadot/types/interfaces/system';
|
import type { ApplyExtrinsicResult } from '@polkadot/types/interfaces/system';
|
||||||
import type { TransactionSource, TransactionValidity } from '@polkadot/types/interfaces/txqueue';
|
import type { TransactionSource, TransactionValidity } from '@polkadot/types/interfaces/txqueue';
|
||||||
@@ -104,6 +105,29 @@ declare module '@polkadot/api-base/types/calls' {
|
|||||||
**/
|
**/
|
||||||
[key: string]: DecoratedCallBase<ApiType>;
|
[key: string]: DecoratedCallBase<ApiType>;
|
||||||
};
|
};
|
||||||
|
/** 0x68b66ba122c93fa7/2 */
|
||||||
|
contractsApi: {
|
||||||
|
/**
|
||||||
|
* Perform a call from a specified account to a given contract.
|
||||||
|
**/
|
||||||
|
call: AugmentedCall<ApiType, (origin: AccountId | string | Uint8Array, dest: AccountId | string | Uint8Array, value: Balance | AnyNumber | Uint8Array, gasLimit: Option<WeightV2> | null | Uint8Array | WeightV2 | { refTime?: any; proofSize?: any } | string, storageDepositLimit: Option<Balance> | null | Uint8Array | Balance | AnyNumber, inputData: Bytes | string | Uint8Array) => Observable<ContractExecResult>>;
|
||||||
|
/**
|
||||||
|
* Query a given storage key in a given contract.
|
||||||
|
**/
|
||||||
|
getStorage: AugmentedCall<ApiType, (address: AccountId | string | Uint8Array, key: Bytes | string | Uint8Array) => Observable<Option<Bytes>>>;
|
||||||
|
/**
|
||||||
|
* Instantiate a new contract.
|
||||||
|
**/
|
||||||
|
instantiate: AugmentedCall<ApiType, (origin: AccountId | string | Uint8Array, value: Balance | AnyNumber | Uint8Array, gasLimit: Option<WeightV2> | null | Uint8Array | WeightV2 | { refTime?: any; proofSize?: any } | string, storageDepositLimit: Option<Balance> | null | Uint8Array | Balance | AnyNumber, code: CodeSource | { Upload: any } | { Existing: any } | string | Uint8Array, data: Bytes | string | Uint8Array, salt: Bytes | string | Uint8Array) => Observable<ContractInstantiateResult>>;
|
||||||
|
/**
|
||||||
|
* Upload new code without instantiating a contract from it.
|
||||||
|
**/
|
||||||
|
uploadCode: AugmentedCall<ApiType, (origin: AccountId | string | Uint8Array, code: Bytes | string | Uint8Array, storageDepositLimit: Option<Balance> | null | Uint8Array | Balance | AnyNumber) => Observable<CodeUploadResult>>;
|
||||||
|
/**
|
||||||
|
* Generic call
|
||||||
|
**/
|
||||||
|
[key: string]: DecoratedCallBase<ApiType>;
|
||||||
|
};
|
||||||
/** 0xdf6acb689907609b/4 */
|
/** 0xdf6acb689907609b/4 */
|
||||||
core: {
|
core: {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -142,8 +142,10 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
|
|||||||
origin,
|
origin,
|
||||||
this.address,
|
this.address,
|
||||||
value,
|
value,
|
||||||
// the runtime interface still used u64 inputs
|
this._isOldWeight
|
||||||
this.#getGas(gasLimit, true).v1Weight,
|
// jiggle v1 weights, metadata points to latest
|
||||||
|
? this.#getGas(gasLimit, true).v1Weight as unknown as WeightAll['v2Weight']
|
||||||
|
: this.#getGas(gasLimit, true).v2Weight,
|
||||||
storageDepositLimit,
|
storageDepositLimit,
|
||||||
message.toU8a(params)
|
message.toU8a(params)
|
||||||
).pipe(
|
).pipe(
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
import type { ApiBase } from '@polkadot/api/base';
|
import type { ApiBase } from '@polkadot/api/base';
|
||||||
import type { ApiTypes } from '@polkadot/api/types';
|
import type { ApiTypes } from '@polkadot/api/types';
|
||||||
import type { Text, u64 } from '@polkadot/types';
|
import type { Text } from '@polkadot/types';
|
||||||
import type { ContractExecResultResult, ContractSelector, StorageDeposit, WeightV2 } from '@polkadot/types/interfaces';
|
import type { ContractExecResultResult, ContractSelector, StorageDeposit, Weight, WeightV2 } from '@polkadot/types/interfaces';
|
||||||
import type { Codec, TypeDef } from '@polkadot/types/types';
|
import type { Codec, TypeDef } from '@polkadot/types/types';
|
||||||
import type { BN } from '@polkadot/util';
|
import type { BN } from '@polkadot/util';
|
||||||
import type { Abi } from '.';
|
import type { Abi } from '.';
|
||||||
@@ -55,8 +55,8 @@ export interface InterfaceContractCalls {
|
|||||||
|
|
||||||
export interface ContractCallOutcome {
|
export interface ContractCallOutcome {
|
||||||
debugMessage: Text;
|
debugMessage: Text;
|
||||||
gasConsumed: u64;
|
gasConsumed: Weight;
|
||||||
gasRequired: u64;
|
gasRequired: Weight;
|
||||||
output: Codec | null;
|
output: Codec | null;
|
||||||
result: ContractExecResultResult;
|
result: ContractExecResultResult;
|
||||||
storageDeposit: StorageDeposit;
|
storageDeposit: StorageDeposit;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import type { BeefySignedCommitment } from '@polkadot/types/interfaces/beefy';
|
|||||||
import type { BlockHash } from '@polkadot/types/interfaces/chain';
|
import type { BlockHash } from '@polkadot/types/interfaces/chain';
|
||||||
import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
|
import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
|
||||||
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
|
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
|
||||||
import type { CodeUploadRequest, CodeUploadResult, ContractCallRequest, ContractExecResult, ContractInstantiateResult, InstantiateRequest } from '@polkadot/types/interfaces/contracts';
|
import type { CodeUploadRequest, CodeUploadResult, ContractCallRequest, ContractExecResult, ContractInstantiateResult, InstantiateRequestV1 } from '@polkadot/types/interfaces/contracts';
|
||||||
import type { BlockStats } from '@polkadot/types/interfaces/dev';
|
import type { BlockStats } from '@polkadot/types/interfaces/dev';
|
||||||
import type { CreatedBlock } from '@polkadot/types/interfaces/engine';
|
import type { CreatedBlock } from '@polkadot/types/interfaces/engine';
|
||||||
import type { EthAccount, EthCallRequest, EthFeeHistory, EthFilter, EthFilterChanges, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth';
|
import type { EthAccount, EthCallRequest, EthFeeHistory, EthFilter, EthFilterChanges, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth';
|
||||||
@@ -155,7 +155,7 @@ declare module '@polkadot/rpc-core/types/jsonrpc' {
|
|||||||
* @deprecated Use the runtime interface `api.call.contractsApi.instantiate` instead
|
* @deprecated Use the runtime interface `api.call.contractsApi.instantiate` instead
|
||||||
* Instantiate a new contract
|
* Instantiate a new contract
|
||||||
**/
|
**/
|
||||||
instantiate: AugmentedRpc<(request: InstantiateRequest | { origin?: any; value?: any; gasLimit?: any; storageDepositLimit?: any; code?: any; data?: any; salt?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<ContractInstantiateResult>>;
|
instantiate: AugmentedRpc<(request: InstantiateRequestV1 | { origin?: any; value?: any; gasLimit?: any; code?: any; data?: any; salt?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<ContractInstantiateResult>>;
|
||||||
/**
|
/**
|
||||||
* @deprecated Not available in newer versions of the contracts interfaces
|
* @deprecated Not available in newer versions of the contracts interfaces
|
||||||
* Returns the projected time a given contract will be able to sustain paying its rent
|
* Returns the projected time a given contract will be able to sustain paying its rent
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
|
|||||||
import type { StatementKind } from '@polkadot/types/interfaces/claims';
|
import type { StatementKind } from '@polkadot/types/interfaces/claims';
|
||||||
import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';
|
import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';
|
||||||
import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
|
import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
|
||||||
import type { AliveContractInfo, CodeHash, CodeSource, CodeUploadRequest, CodeUploadResult, CodeUploadResultValue, ContractCallFlags, ContractCallRequest, ContractExecResult, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractExecResultTo267, ContractInfo, ContractInstantiateResult, ContractInstantiateResultTo267, ContractInstantiateResultTo299, ContractReturnFlags, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateRequestV1, InstantiateRequestV2, InstantiateReturnValue, InstantiateReturnValueOk, InstantiateReturnValueTo267, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, StorageDeposit, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
|
import type { AliveContractInfo, CodeHash, CodeSource, CodeUploadRequest, CodeUploadResult, CodeUploadResultValue, ContractCallFlags, ContractCallRequest, ContractExecResult, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractExecResultTo267, ContractExecResultU64, ContractInfo, ContractInstantiateResult, ContractInstantiateResultTo267, ContractInstantiateResultTo299, ContractInstantiateResultU64, ContractReturnFlags, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateRequestV1, InstantiateRequestV2, InstantiateReturnValue, InstantiateReturnValueOk, InstantiateReturnValueTo267, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, StorageDeposit, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
|
||||||
import type { ContractConstructorSpecLatest, ContractConstructorSpecV0, ContractConstructorSpecV1, ContractConstructorSpecV2, ContractConstructorSpecV3, ContractContractSpecV0, ContractContractSpecV1, ContractContractSpecV2, ContractContractSpecV3, ContractContractSpecV4, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpecLatest, ContractEventParamSpecV0, ContractEventParamSpecV2, ContractEventSpecLatest, ContractEventSpecV0, ContractEventSpecV1, ContractEventSpecV2, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpecLatest, ContractMessageParamSpecV0, ContractMessageParamSpecV2, ContractMessageSpecLatest, ContractMessageSpecV0, ContractMessageSpecV1, ContractMessageSpecV2, ContractMetadata, ContractMetadataLatest, ContractMetadataV0, ContractMetadataV1, ContractMetadataV2, ContractMetadataV3, ContractMetadataV4, ContractProject, ContractProjectContract, ContractProjectInfo, ContractProjectSource, ContractProjectV0, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi';
|
import type { ContractConstructorSpecLatest, ContractConstructorSpecV0, ContractConstructorSpecV1, ContractConstructorSpecV2, ContractConstructorSpecV3, ContractContractSpecV0, ContractContractSpecV1, ContractContractSpecV2, ContractContractSpecV3, ContractContractSpecV4, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpecLatest, ContractEventParamSpecV0, ContractEventParamSpecV2, ContractEventSpecLatest, ContractEventSpecV0, ContractEventSpecV1, ContractEventSpecV2, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpecLatest, ContractMessageParamSpecV0, ContractMessageParamSpecV2, ContractMessageSpecLatest, ContractMessageSpecV0, ContractMessageSpecV1, ContractMessageSpecV2, ContractMetadata, ContractMetadataLatest, ContractMetadataV0, ContractMetadataV1, ContractMetadataV2, ContractMetadataV3, ContractMetadataV4, ContractProject, ContractProjectContract, ContractProjectInfo, ContractProjectSource, ContractProjectV0, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi';
|
||||||
import type { FundIndex, FundInfo, LastContribution, TrieIndex } from '@polkadot/types/interfaces/crowdloan';
|
import type { FundIndex, FundInfo, LastContribution, TrieIndex } from '@polkadot/types/interfaces/crowdloan';
|
||||||
import type { CollationInfo, CollationInfoV1, ConfigData, MessageId, OverweightIndex, PageCounter, PageIndexData } from '@polkadot/types/interfaces/cumulus';
|
import type { CollationInfo, CollationInfoV1, ConfigData, MessageId, OverweightIndex, PageCounter, PageIndexData } from '@polkadot/types/interfaces/cumulus';
|
||||||
@@ -272,10 +272,12 @@ declare module '@polkadot/types/types/registry' {
|
|||||||
ContractExecResultTo255: ContractExecResultTo255;
|
ContractExecResultTo255: ContractExecResultTo255;
|
||||||
ContractExecResultTo260: ContractExecResultTo260;
|
ContractExecResultTo260: ContractExecResultTo260;
|
||||||
ContractExecResultTo267: ContractExecResultTo267;
|
ContractExecResultTo267: ContractExecResultTo267;
|
||||||
|
ContractExecResultU64: ContractExecResultU64;
|
||||||
ContractInfo: ContractInfo;
|
ContractInfo: ContractInfo;
|
||||||
ContractInstantiateResult: ContractInstantiateResult;
|
ContractInstantiateResult: ContractInstantiateResult;
|
||||||
ContractInstantiateResultTo267: ContractInstantiateResultTo267;
|
ContractInstantiateResultTo267: ContractInstantiateResultTo267;
|
||||||
ContractInstantiateResultTo299: ContractInstantiateResultTo299;
|
ContractInstantiateResultTo299: ContractInstantiateResultTo299;
|
||||||
|
ContractInstantiateResultU64: ContractInstantiateResultU64;
|
||||||
ContractLayoutArray: ContractLayoutArray;
|
ContractLayoutArray: ContractLayoutArray;
|
||||||
ContractLayoutCell: ContractLayoutCell;
|
ContractLayoutCell: ContractLayoutCell;
|
||||||
ContractLayoutEnum: ContractLayoutEnum;
|
ContractLayoutEnum: ContractLayoutEnum;
|
||||||
|
|||||||
@@ -81,6 +81,13 @@ export default {
|
|||||||
result: 'ContractExecResultResult'
|
result: 'ContractExecResultResult'
|
||||||
},
|
},
|
||||||
ContractExecResult: {
|
ContractExecResult: {
|
||||||
|
gasConsumed: 'Weight',
|
||||||
|
gasRequired: 'Weight',
|
||||||
|
storageDeposit: 'StorageDeposit',
|
||||||
|
debugMessage: 'Text',
|
||||||
|
result: 'ContractExecResultResult'
|
||||||
|
},
|
||||||
|
ContractExecResultU64: {
|
||||||
gasConsumed: 'u64',
|
gasConsumed: 'u64',
|
||||||
gasRequired: 'u64',
|
gasRequired: 'u64',
|
||||||
storageDeposit: 'StorageDeposit',
|
storageDeposit: 'StorageDeposit',
|
||||||
@@ -250,6 +257,15 @@ export default {
|
|||||||
ContractInstantiateResultTo267: 'Result<InstantiateReturnValueTo267, Null>',
|
ContractInstantiateResultTo267: 'Result<InstantiateReturnValueTo267, Null>',
|
||||||
ContractInstantiateResultTo299: 'Result<InstantiateReturnValueOk, Null>',
|
ContractInstantiateResultTo299: 'Result<InstantiateReturnValueOk, Null>',
|
||||||
ContractInstantiateResult: {
|
ContractInstantiateResult: {
|
||||||
|
gasConsumed: 'WeightV2',
|
||||||
|
gasRequired: 'WeightV2',
|
||||||
|
storageDeposit: 'StorageDeposit',
|
||||||
|
debugMessage: 'Text',
|
||||||
|
result: 'InstantiateReturnValue'
|
||||||
|
},
|
||||||
|
ContractInstantiateResultU64: {
|
||||||
|
// only this one can fail, the current version (above) _should_ be correctly
|
||||||
|
// versioned now, aka no more deprecated RPCs involved, only runtime calls
|
||||||
_fallback: 'ContractInstantiateResultTo299',
|
_fallback: 'ContractInstantiateResultTo299',
|
||||||
gasConsumed: 'u64',
|
gasConsumed: 'u64',
|
||||||
gasRequired: 'u64',
|
gasRequired: 'u64',
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export const rpc: DefinitionsRpc = {
|
|||||||
params: [
|
params: [
|
||||||
{
|
{
|
||||||
name: 'request',
|
name: 'request',
|
||||||
type: 'InstantiateRequest'
|
type: 'InstantiateRequestV1'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
isHistoric: true,
|
isHistoric: true,
|
||||||
|
|||||||
@@ -1,12 +1,118 @@
|
|||||||
// Copyright 2017-2022 @polkadot/types authors & contributors
|
// Copyright 2017-2022 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { DefinitionsCall } from '../../types';
|
import type { DefinitionCall, DefinitionsCall } from '../../types';
|
||||||
|
|
||||||
|
import { objectSpread } from '@polkadot/util';
|
||||||
|
|
||||||
|
const SHARED_V1_V2: Record<string, DefinitionCall> = {
|
||||||
|
get_storage: {
|
||||||
|
description: 'Query a given storage key in a given contract.',
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
name: 'address',
|
||||||
|
type: 'AccountId'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
type: 'Bytes'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
type: 'Option<Bytes>'
|
||||||
|
},
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const runtime: DefinitionsCall = {
|
export const runtime: DefinitionsCall = {
|
||||||
ContractsApi: [
|
ContractsApi: [
|
||||||
{
|
{
|
||||||
methods: {
|
methods: objectSpread({
|
||||||
|
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: 'Option<WeightV2>'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'storageDepositLimit',
|
||||||
|
type: 'Option<Balance>'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'inputData',
|
||||||
|
type: 'Vec<u8>'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
type: 'ContractExecResult'
|
||||||
|
},
|
||||||
|
instantiate: {
|
||||||
|
description: 'Instantiate a new contract.',
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
name: 'origin',
|
||||||
|
type: 'AccountId'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'value',
|
||||||
|
type: 'Balance'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'gasLimit',
|
||||||
|
type: 'Option<WeightV2>'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'storageDepositLimit',
|
||||||
|
type: 'Option<Balance>'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'code',
|
||||||
|
type: 'CodeSource'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'data',
|
||||||
|
type: 'Bytes'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'salt',
|
||||||
|
type: 'Bytes'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
type: 'ContractInstantiateResult'
|
||||||
|
}
|
||||||
|
}, SHARED_V1_V2),
|
||||||
|
version: 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
methods: objectSpread({
|
||||||
call: {
|
call: {
|
||||||
description: 'Perform a call from a specified account to a given contract.',
|
description: 'Perform a call from a specified account to a given contract.',
|
||||||
params: [
|
params: [
|
||||||
@@ -35,21 +141,7 @@ export const runtime: DefinitionsCall = {
|
|||||||
type: 'Vec<u8>'
|
type: 'Vec<u8>'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
type: 'ContractExecResult'
|
type: 'ContractExecResultU64'
|
||||||
},
|
|
||||||
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: {
|
instantiate: {
|
||||||
description: 'Instantiate a new contract.',
|
description: 'Instantiate a new contract.',
|
||||||
@@ -83,27 +175,9 @@ export const runtime: DefinitionsCall = {
|
|||||||
type: 'Bytes'
|
type: 'Bytes'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
type: 'ContractInstantiateResult'
|
type: 'ContractInstantiateResultU64'
|
||||||
},
|
|
||||||
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'
|
|
||||||
}
|
}
|
||||||
},
|
}, SHARED_V1_V2),
|
||||||
version: 1
|
version: 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
|
||||||
import type { Bytes, Compact, Enum, Null, Option, Raw, Result, Set, Struct, Text, U8aFixed, bool, u32, u64, u8 } from '@polkadot/types-codec';
|
import type { Bytes, Compact, Enum, Null, Option, Raw, Result, Set, Struct, Text, U8aFixed, bool, u32, u64, u8 } from '@polkadot/types-codec';
|
||||||
import type { AccountId, Balance, BlockNumber, Hash, Weight } from '@polkadot/types/interfaces/runtime';
|
import type { AccountId, Balance, BlockNumber, Hash, Weight, WeightV2 } from '@polkadot/types/interfaces/runtime';
|
||||||
import type { DispatchError } from '@polkadot/types/interfaces/system';
|
import type { DispatchError } from '@polkadot/types/interfaces/system';
|
||||||
|
|
||||||
/** @name AliveContractInfo */
|
/** @name AliveContractInfo */
|
||||||
@@ -71,8 +71,8 @@ export interface ContractCallRequest extends Struct {
|
|||||||
|
|
||||||
/** @name ContractExecResult */
|
/** @name ContractExecResult */
|
||||||
export interface ContractExecResult extends Struct {
|
export interface ContractExecResult extends Struct {
|
||||||
readonly gasConsumed: u64;
|
readonly gasConsumed: Weight;
|
||||||
readonly gasRequired: u64;
|
readonly gasRequired: Weight;
|
||||||
readonly storageDeposit: StorageDeposit;
|
readonly storageDeposit: StorageDeposit;
|
||||||
readonly debugMessage: Text;
|
readonly debugMessage: Text;
|
||||||
readonly result: ContractExecResultResult;
|
readonly result: ContractExecResultResult;
|
||||||
@@ -128,6 +128,15 @@ export interface ContractExecResultTo267 extends Struct {
|
|||||||
readonly result: ContractExecResultResult;
|
readonly result: ContractExecResultResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @name ContractExecResultU64 */
|
||||||
|
export interface ContractExecResultU64 extends Struct {
|
||||||
|
readonly gasConsumed: u64;
|
||||||
|
readonly gasRequired: u64;
|
||||||
|
readonly storageDeposit: StorageDeposit;
|
||||||
|
readonly debugMessage: Text;
|
||||||
|
readonly result: ContractExecResultResult;
|
||||||
|
}
|
||||||
|
|
||||||
/** @name ContractInfo */
|
/** @name ContractInfo */
|
||||||
export interface ContractInfo extends Enum {
|
export interface ContractInfo extends Enum {
|
||||||
readonly isAlive: boolean;
|
readonly isAlive: boolean;
|
||||||
@@ -139,8 +148,8 @@ export interface ContractInfo extends Enum {
|
|||||||
|
|
||||||
/** @name ContractInstantiateResult */
|
/** @name ContractInstantiateResult */
|
||||||
export interface ContractInstantiateResult extends Struct {
|
export interface ContractInstantiateResult extends Struct {
|
||||||
readonly gasConsumed: u64;
|
readonly gasConsumed: WeightV2;
|
||||||
readonly gasRequired: u64;
|
readonly gasRequired: WeightV2;
|
||||||
readonly storageDeposit: StorageDeposit;
|
readonly storageDeposit: StorageDeposit;
|
||||||
readonly debugMessage: Text;
|
readonly debugMessage: Text;
|
||||||
readonly result: InstantiateReturnValue;
|
readonly result: InstantiateReturnValue;
|
||||||
@@ -160,6 +169,15 @@ export interface ContractInstantiateResultTo299 extends Result<InstantiateReturn
|
|||||||
readonly asOk: InstantiateReturnValueOk;
|
readonly asOk: InstantiateReturnValueOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @name ContractInstantiateResultU64 */
|
||||||
|
export interface ContractInstantiateResultU64 extends Struct {
|
||||||
|
readonly gasConsumed: u64;
|
||||||
|
readonly gasRequired: u64;
|
||||||
|
readonly storageDeposit: StorageDeposit;
|
||||||
|
readonly debugMessage: Text;
|
||||||
|
readonly result: InstantiateReturnValue;
|
||||||
|
}
|
||||||
|
|
||||||
/** @name ContractReturnFlags */
|
/** @name ContractReturnFlags */
|
||||||
export interface ContractReturnFlags extends Set {
|
export interface ContractReturnFlags extends Set {
|
||||||
readonly isRevert: boolean;
|
readonly isRevert: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user