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:
@@ -142,8 +142,10 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
origin,
|
||||
this.address,
|
||||
value,
|
||||
// the runtime interface still used u64 inputs
|
||||
this.#getGas(gasLimit, true).v1Weight,
|
||||
this._isOldWeight
|
||||
// jiggle v1 weights, metadata points to latest
|
||||
? this.#getGas(gasLimit, true).v1Weight as unknown as WeightAll['v2Weight']
|
||||
: this.#getGas(gasLimit, true).v2Weight,
|
||||
storageDepositLimit,
|
||||
message.toU8a(params)
|
||||
).pipe(
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
import type { ApiBase } from '@polkadot/api/base';
|
||||
import type { ApiTypes } from '@polkadot/api/types';
|
||||
import type { Text, u64 } from '@polkadot/types';
|
||||
import type { ContractExecResultResult, ContractSelector, StorageDeposit, WeightV2 } from '@polkadot/types/interfaces';
|
||||
import type { Text } from '@polkadot/types';
|
||||
import type { ContractExecResultResult, ContractSelector, StorageDeposit, Weight, WeightV2 } from '@polkadot/types/interfaces';
|
||||
import type { Codec, TypeDef } from '@polkadot/types/types';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { Abi } from '.';
|
||||
@@ -55,8 +55,8 @@ export interface InterfaceContractCalls {
|
||||
|
||||
export interface ContractCallOutcome {
|
||||
debugMessage: Text;
|
||||
gasConsumed: u64;
|
||||
gasRequired: u64;
|
||||
gasConsumed: Weight;
|
||||
gasRequired: Weight;
|
||||
output: Codec | null;
|
||||
result: ContractExecResultResult;
|
||||
storageDeposit: StorageDeposit;
|
||||
|
||||
Reference in New Issue
Block a user