Skip to content

Commit 5995ae6

Browse files
authored
feat: Add rc endpoints for transaction suite (#1798)
* Thread api instance into service * Add new rc transaction controllers * Add new api threading * add exports and chains-config * Update docs
1 parent 994558a commit 5995ae6

27 files changed

Lines changed: 889 additions & 31 deletions

docs-v2/dist/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs-v2/openapi-v1.yaml

Lines changed: 170 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4000,7 +4000,176 @@ paths:
40004000
application/json:
40014001
schema:
40024002
$ref: '#/components/schemas/Error'
4003-
4003+
4004+
/rc/transaction:
4005+
post:
4006+
tags:
4007+
- rc transaction
4008+
summary: Submit a transaction to the relay chain node's transaction pool.
4009+
description: Accepts a valid signed extrinsic for the relay chain. Replaces `/tx` from versions
4010+
< v1.0.0.
4011+
operationId: submitRcTransaction
4012+
requestBody:
4013+
$ref: '#/components/requestBodies/Transaction'
4014+
responses:
4015+
"200":
4016+
description: successful operation
4017+
content:
4018+
application/json:
4019+
schema:
4020+
$ref: '#/components/schemas/TransactionSuccess'
4021+
"400":
4022+
description: failed to parse or submit transaction
4023+
content:
4024+
application/json:
4025+
schema:
4026+
$ref: '#/components/schemas/TransactionFailure'
4027+
/rc/transaction/dry-run:
4028+
post:
4029+
tags:
4030+
- rc transaction
4031+
summary: Dry run an extrinsic on the relay chain.
4032+
description: Use the `dryRun` call to simulate the submission of a transaction
4033+
to the relay chain without executing it so that you can check for potential errors and
4034+
validate the expected outcome.
4035+
operationId: dryrunRcTransaction
4036+
requestBody:
4037+
$ref: '#/components/requestBodies/TransactionDryRun'
4038+
responses:
4039+
"200":
4040+
description: successful operation
4041+
content:
4042+
application/json:
4043+
schema:
4044+
$ref: '#/components/schemas/TransactionDryRun'
4045+
"400":
4046+
description: failed to dry-run transaction
4047+
content:
4048+
application/json:
4049+
schema:
4050+
$ref: '#/components/schemas/TransactionFailure'
4051+
/rc/transaction/fee-estimate:
4052+
post:
4053+
tags:
4054+
- rc transaction
4055+
summary: Receive a fee estimate for a relay chain transaction.
4056+
description: >-
4057+
Send a serialized transaction and receive back a naive fee estimate for the relay chain.
4058+
Note: `partialFee` does not include any tips that you may add to increase
4059+
a transaction's priority. See the reference on `compute_fee`.
4060+
Replaces `/tx/fee-estimate` from versions < v1.0.0.
4061+
Substrate Reference:
4062+
- `RuntimeDispatchInfo`: https://crates.parity.io/pallet_transaction_payment_rpc_runtime_api/struct.RuntimeDispatchInfo.html
4063+
- `query_info`: https://crates.parity.io/pallet_transaction_payment/struct.Module.html#method.query_info
4064+
- `compute_fee`: https://crates.parity.io/pallet_transaction_payment/struct.Module.html#method.compute_fee
4065+
operationId: feeEstimateRcTransaction
4066+
requestBody:
4067+
$ref: '#/components/requestBodies/Transaction'
4068+
responses:
4069+
"200":
4070+
description: successful operation
4071+
content:
4072+
application/json:
4073+
schema:
4074+
$ref: '#/components/schemas/TransactionFeeEstimate'
4075+
"400":
4076+
description: fee estimation failure
4077+
content:
4078+
application/json:
4079+
schema:
4080+
$ref: '#/components/schemas/TransactionFeeEstimateFailure'
4081+
/rc/transaction/material:
4082+
get:
4083+
tags:
4084+
- rc transaction
4085+
summary: Get all the relay chain network information needed to construct a transaction offline.
4086+
description: Returns the material that is universal to constructing any
4087+
signed transaction offline for the relay chain. Replaces `/tx/artifacts` from versions < v1.0.0.
4088+
operationId: getRcTransactionMaterial
4089+
parameters:
4090+
- name: at
4091+
in: query
4092+
description: Block at which to retrieve the transaction construction
4093+
material from the relay chain.
4094+
required: false
4095+
schema:
4096+
type: string
4097+
description: Block identifier, as the block height or block hash.
4098+
format: unsignedInteger or $hex
4099+
- name: noMeta
4100+
in: query
4101+
description: DEPRECATED! This is no longer supported
4102+
schema:
4103+
type: boolean
4104+
default: false
4105+
- name: metadata
4106+
in: query
4107+
description: Specifies the format of the metadata to be returned. Accepted values are
4108+
'json', and 'scale'. 'json' being the decoded metadata, and 'scale' being the SCALE encoded metadata.
4109+
When `metadata` is not inputted, the `metadata` field will be absent.
4110+
schema:
4111+
type: string
4112+
responses:
4113+
"200":
4114+
description: successful operation
4115+
content:
4116+
application/json:
4117+
schema:
4118+
$ref: '#/components/schemas/TransactionMaterial'
4119+
"400":
4120+
description: invalid blockId supplied for at query param
4121+
content:
4122+
application/json:
4123+
schema:
4124+
$ref: '#/components/schemas/Error'
4125+
/rc/transaction/material/{metadataVersion}:
4126+
get:
4127+
tags:
4128+
- rc transaction
4129+
summary: Get all the relay chain network information needed to construct a transaction offline and
4130+
the version of metadata specified in `metadataVersion`.
4131+
description: Returns all the materials necessary for constructing any signed transactions
4132+
offline for the relay chain.
4133+
operationId: getRcTransactionMaterialwithVersionedMetadata
4134+
parameters:
4135+
- name: metadataVersion
4136+
in: path
4137+
description: The version of metadata. The input is expected in a `vX` format, where `X`
4138+
represents the version number (e.g. `v14`, `v15`). By default, metadata is outputted
4139+
in 'json' format, unless the `metadata` query parameter is provided, in which case it
4140+
can be either in 'json' or 'scale' format.
4141+
required: true
4142+
schema:
4143+
type: string
4144+
- name: at
4145+
in: query
4146+
description: Block at which to retrieve the transaction construction
4147+
material from the relay chain.
4148+
required: false
4149+
schema:
4150+
type: string
4151+
description: Block identifier, as the block height or block hash.
4152+
format: unsignedInteger or $hex
4153+
- name: metadata
4154+
in: query
4155+
description: Specifies the format of the metadata to be returned. Accepted values are
4156+
'json', and 'scale'. 'json' being the decoded metadata, and 'scale' being the SCALE encoded metadata.
4157+
schema:
4158+
type: string
4159+
responses:
4160+
"200":
4161+
description: successful operation
4162+
content:
4163+
application/json:
4164+
schema:
4165+
$ref: '#/components/schemas/TransactionMaterial'
4166+
"400":
4167+
description: invalid blockId supplied for at query param
4168+
content:
4169+
application/json:
4170+
schema:
4171+
$ref: '#/components/schemas/Error'
4172+
40044173
/pallets/{palletId}/storage:
40054174
get:
40064175
tags:

docs/dist/app.bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/src/openapi-v1.yaml

Lines changed: 170 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4000,7 +4000,176 @@ paths:
40004000
application/json:
40014001
schema:
40024002
$ref: '#/components/schemas/Error'
4003-
4003+
4004+
/rc/transaction:
4005+
post:
4006+
tags:
4007+
- rc transaction
4008+
summary: Submit a transaction to the relay chain node's transaction pool.
4009+
description: Accepts a valid signed extrinsic for the relay chain. Replaces `/tx` from versions
4010+
< v1.0.0.
4011+
operationId: submitRcTransaction
4012+
requestBody:
4013+
$ref: '#/components/requestBodies/Transaction'
4014+
responses:
4015+
"200":
4016+
description: successful operation
4017+
content:
4018+
application/json:
4019+
schema:
4020+
$ref: '#/components/schemas/TransactionSuccess'
4021+
"400":
4022+
description: failed to parse or submit transaction
4023+
content:
4024+
application/json:
4025+
schema:
4026+
$ref: '#/components/schemas/TransactionFailure'
4027+
/rc/transaction/dry-run:
4028+
post:
4029+
tags:
4030+
- rc transaction
4031+
summary: Dry run an extrinsic on the relay chain.
4032+
description: Use the `dryRun` call to simulate the submission of a transaction
4033+
to the relay chain without executing it so that you can check for potential errors and
4034+
validate the expected outcome.
4035+
operationId: dryrunRcTransaction
4036+
requestBody:
4037+
$ref: '#/components/requestBodies/TransactionDryRun'
4038+
responses:
4039+
"200":
4040+
description: successful operation
4041+
content:
4042+
application/json:
4043+
schema:
4044+
$ref: '#/components/schemas/TransactionDryRun'
4045+
"400":
4046+
description: failed to dry-run transaction
4047+
content:
4048+
application/json:
4049+
schema:
4050+
$ref: '#/components/schemas/TransactionFailure'
4051+
/rc/transaction/fee-estimate:
4052+
post:
4053+
tags:
4054+
- rc transaction
4055+
summary: Receive a fee estimate for a relay chain transaction.
4056+
description: >-
4057+
Send a serialized transaction and receive back a naive fee estimate for the relay chain.
4058+
Note: `partialFee` does not include any tips that you may add to increase
4059+
a transaction's priority. See the reference on `compute_fee`.
4060+
Replaces `/tx/fee-estimate` from versions < v1.0.0.
4061+
Substrate Reference:
4062+
- `RuntimeDispatchInfo`: https://crates.parity.io/pallet_transaction_payment_rpc_runtime_api/struct.RuntimeDispatchInfo.html
4063+
- `query_info`: https://crates.parity.io/pallet_transaction_payment/struct.Module.html#method.query_info
4064+
- `compute_fee`: https://crates.parity.io/pallet_transaction_payment/struct.Module.html#method.compute_fee
4065+
operationId: feeEstimateRcTransaction
4066+
requestBody:
4067+
$ref: '#/components/requestBodies/Transaction'
4068+
responses:
4069+
"200":
4070+
description: successful operation
4071+
content:
4072+
application/json:
4073+
schema:
4074+
$ref: '#/components/schemas/TransactionFeeEstimate'
4075+
"400":
4076+
description: fee estimation failure
4077+
content:
4078+
application/json:
4079+
schema:
4080+
$ref: '#/components/schemas/TransactionFeeEstimateFailure'
4081+
/rc/transaction/material:
4082+
get:
4083+
tags:
4084+
- rc transaction
4085+
summary: Get all the relay chain network information needed to construct a transaction offline.
4086+
description: Returns the material that is universal to constructing any
4087+
signed transaction offline for the relay chain. Replaces `/tx/artifacts` from versions < v1.0.0.
4088+
operationId: getRcTransactionMaterial
4089+
parameters:
4090+
- name: at
4091+
in: query
4092+
description: Block at which to retrieve the transaction construction
4093+
material from the relay chain.
4094+
required: false
4095+
schema:
4096+
type: string
4097+
description: Block identifier, as the block height or block hash.
4098+
format: unsignedInteger or $hex
4099+
- name: noMeta
4100+
in: query
4101+
description: DEPRECATED! This is no longer supported
4102+
schema:
4103+
type: boolean
4104+
default: false
4105+
- name: metadata
4106+
in: query
4107+
description: Specifies the format of the metadata to be returned. Accepted values are
4108+
'json', and 'scale'. 'json' being the decoded metadata, and 'scale' being the SCALE encoded metadata.
4109+
When `metadata` is not inputted, the `metadata` field will be absent.
4110+
schema:
4111+
type: string
4112+
responses:
4113+
"200":
4114+
description: successful operation
4115+
content:
4116+
application/json:
4117+
schema:
4118+
$ref: '#/components/schemas/TransactionMaterial'
4119+
"400":
4120+
description: invalid blockId supplied for at query param
4121+
content:
4122+
application/json:
4123+
schema:
4124+
$ref: '#/components/schemas/Error'
4125+
/rc/transaction/material/{metadataVersion}:
4126+
get:
4127+
tags:
4128+
- rc transaction
4129+
summary: Get all the relay chain network information needed to construct a transaction offline and
4130+
the version of metadata specified in `metadataVersion`.
4131+
description: Returns all the materials necessary for constructing any signed transactions
4132+
offline for the relay chain.
4133+
operationId: getRcTransactionMaterialwithVersionedMetadata
4134+
parameters:
4135+
- name: metadataVersion
4136+
in: path
4137+
description: The version of metadata. The input is expected in a `vX` format, where `X`
4138+
represents the version number (e.g. `v14`, `v15`). By default, metadata is outputted
4139+
in 'json' format, unless the `metadata` query parameter is provided, in which case it
4140+
can be either in 'json' or 'scale' format.
4141+
required: true
4142+
schema:
4143+
type: string
4144+
- name: at
4145+
in: query
4146+
description: Block at which to retrieve the transaction construction
4147+
material from the relay chain.
4148+
required: false
4149+
schema:
4150+
type: string
4151+
description: Block identifier, as the block height or block hash.
4152+
format: unsignedInteger or $hex
4153+
- name: metadata
4154+
in: query
4155+
description: Specifies the format of the metadata to be returned. Accepted values are
4156+
'json', and 'scale'. 'json' being the decoded metadata, and 'scale' being the SCALE encoded metadata.
4157+
schema:
4158+
type: string
4159+
responses:
4160+
"200":
4161+
description: successful operation
4162+
content:
4163+
application/json:
4164+
schema:
4165+
$ref: '#/components/schemas/TransactionMaterial'
4166+
"400":
4167+
description: invalid blockId supplied for at query param
4168+
content:
4169+
application/json:
4170+
schema:
4171+
$ref: '#/components/schemas/Error'
4172+
40044173
/pallets/{palletId}/storage:
40054174
get:
40064175
tags:

src/chains-config/assetHubKusamaControllers.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ export const assetHubKusamaControllers: ControllerConfig = {
7777
'RcNodeNetwork',
7878
'RcNodeTransactionPool',
7979
'RcNodeVersion',
80+
'RcTransactionDryRun',
81+
'RcTransactionFeeEstimate',
82+
'RcTransactionMaterial',
83+
'RcTransactionSubmit',
8084
'RuntimeCode',
8185
'RuntimeMetadata',
8286
'RuntimeSpec',

src/chains-config/assetHubNextWestendControllers.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ export const assetHubNextWestendControllers: ControllerConfig = {
7575
'RcNodeNetwork',
7676
'RcNodeTransactionPool',
7777
'RcNodeVersion',
78+
'RcTransactionDryRun',
79+
'RcTransactionFeeEstimate',
80+
'RcTransactionMaterial',
81+
'RcTransactionSubmit',
7882
'RuntimeCode',
7983
'RuntimeMetadata',
8084
'RuntimeSpec',

src/chains-config/assetHubPolkadotControllers.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ export const assetHubPolkadotControllers: ControllerConfig = {
6565
'RcNodeNetwork',
6666
'RcNodeTransactionPool',
6767
'RcNodeVersion',
68+
'RcTransactionDryRun',
69+
'RcTransactionFeeEstimate',
70+
'RcTransactionMaterial',
71+
'RcTransactionSubmit',
6872
'RuntimeCode',
6973
'RuntimeMetadata',
7074
'RuntimeSpec',

src/chains-config/assetHubWestendControllers.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ export const assetHubWestendControllers: ControllerConfig = {
7676
'RcNodeNetwork',
7777
'RcNodeTransactionPool',
7878
'RcNodeVersion',
79+
'RcTransactionDryRun',
80+
'RcTransactionFeeEstimate',
81+
'RcTransactionMaterial',
82+
'RcTransactionSubmit',
7983
'RuntimeCode',
8084
'RuntimeMetadata',
8185
'RuntimeSpec',

0 commit comments

Comments
 (0)