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:
Jun Jiang
2022-11-13 08:30:33 +02:00
committed by GitHub
parent dd6dd83af7
commit cad2b0fefe
9 changed files with 189 additions and 53 deletions
+4 -2
View File
@@ -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(