Cater for TransactionPaymentApi/2 runtime calls (#5326)

This commit is contained in:
Jaco
2022-11-11 08:32:46 +02:00
committed by GitHub
parent 135e2b2ccc
commit 744a2f7325
4 changed files with 487 additions and 452 deletions
+11
View File
@@ -1,5 +1,16 @@
# CHANGELOG
## master
Contributed:
- Params encoding fix for `api.rpc(...)` (Thanks to https://github.com/xlc)
Changes:
- Cater for `TransactionPaymentApi/2` runtime calls
## 9.7.1 Nov 6, 2022
Contributed:
+1 -1
View File
@@ -39,7 +39,7 @@
"@babel/core": "^7.20.2",
"@babel/register": "^7.18.9",
"@babel/runtime": "^7.20.1",
"@polkadot/dev": "^0.67.154",
"@polkadot/dev": "^0.67.155",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^29.2.2",
"copyfiles": "^2.4.1"
@@ -1,76 +1,93 @@
// Copyright 2017-2022 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DefinitionsCall } from '../../types';
import type { DefinitionCall, DefinitionsCall } from '../../types';
import { objectSpread } from '@polkadot/util';
const V1_V2_SHARED_PAY: Record<string, DefinitionCall> = {
query_fee_details: {
description: 'The transaction fee details',
params: [
{
name: 'uxt',
type: 'Extrinsic'
},
{
name: 'len',
type: 'u32'
}
],
type: 'FeeDetails'
},
query_info: {
description: 'The transaction info',
params: [
{
name: 'uxt',
type: 'Extrinsic'
},
{
name: 'len',
type: 'u32'
}
],
// NOTE: Since we detect the Weight type based on the runtime, we can have the same
// result for V1 & V2 (additionally, the v2 API came a bit later, so we don't want
// to fix this to V1 weights, since _some_ chains may be incorrect)
type: 'RuntimeDispatchInfo'
}
};
const V1_V2_SHARED_CALL: Record<string, DefinitionCall> = {
query_call_fee_details: {
description: 'The call fee details',
params: [
{
name: 'call',
type: 'Call'
},
{
name: 'len',
type: 'u32'
}
],
type: 'FeeDetails'
},
query_call_info: {
description: 'The call info',
params: [
{
name: 'call',
type: 'Call'
},
{
name: 'len',
type: 'u32'
}
],
type: 'RuntimeDispatchInfo'
}
};
export const runtime: DefinitionsCall = {
TransactionPaymentApi: [
{
methods: {
query_fee_details: {
description: 'The transaction fee details',
params: [
{
name: 'uxt',
type: 'Extrinsic'
},
{
name: 'len',
type: 'u32'
}
],
type: 'FeeDetails'
},
query_info: {
description: 'The transaction info',
params: [
{
name: 'uxt',
type: 'Extrinsic'
},
{
name: 'len',
type: 'u32'
}
],
type: 'RuntimeDispatchInfo'
}
},
methods: objectSpread({}, V1_V2_SHARED_PAY),
version: 2
},
{
methods: objectSpread({}, V1_V2_SHARED_PAY),
version: 1
}
],
TransactionPaymentCallApi: [
{
methods: {
query_call_fee_details: {
description: 'The call fee details',
params: [
{
name: 'call',
type: 'Call'
},
{
name: 'len',
type: 'u32'
}
],
type: 'FeeDetails'
},
query_call_info: {
description: 'The call info',
params: [
{
name: 'call',
type: 'Call'
},
{
name: 'len',
type: 'u32'
}
],
type: 'RuntimeDispatchInfo'
}
},
methods: objectSpread({}, V1_V2_SHARED_CALL),
version: 2
},
{
methods: objectSpread({}, V1_V2_SHARED_CALL),
version: 1
}
]
+397 -390
View File
File diff suppressed because it is too large Load Diff