Skip to content

Commit 9167cb6

Browse files
committed
feat(tx): add customSignedExtensions explanation
1 parent 083e677 commit 9167cb6

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

docs/pages/typed/tx.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -131,29 +131,28 @@ const encodedTx = tx.getEncodedData(compatibilityToken)
131131
All the methods that will follow sign the transaction (or fake-sign in the case of `getEncodedFees`). When signing a transaction, some optional `TxOptions` could be passed. Every one of them as a default, so it's not needed to pass them. Let's see and discuss them one by one:
132132

133133
```ts
134-
type TxOptions<Asset> = Partial<
135-
void extends Asset
136-
? {
137-
at: HexString | "best" | "finalized"
138-
tip: bigint
139-
mortality: { mortal: false } | { mortal: true; period: number }
140-
nonce: number
141-
}
142-
: {
143-
at: HexString | "best" | "finalized"
144-
tip: bigint
145-
mortality: { mortal: false } | { mortal: true; period: number }
146-
asset: Asset
147-
nonce: number
148-
}
149-
>
134+
type TxOptions<Asset> = Partial<{
135+
at: HexString | "best" | "finalized"
136+
tip: bigint
137+
mortality: { mortal: false } | { mortal: true; period: number }
138+
asset: Asset
139+
nonce: number
140+
customSignedExtensions: Record<
141+
string,
142+
{
143+
value?: any
144+
additionalSigned?: any
145+
}
146+
>
147+
}>
150148
```
151149
152150
- `at`: gives the option to choose which block to target when creating the transaction. Default: `finalized`
153151
- `mortality`: gives the option to choose the mortality for the transaction. Default: `{ mortal: true, period: 64 }`
154152
- `nonce`: this is meant for advanced users that submit several transactions in a row, it allows to modify the default `nonce`. Default: latest nonce from `finalized` block
155153
- `tip`: add tip to transaction. Default: `0`
156154
- `asset`: there're several chains that allow you to choose which asset to use to pay for the fees and tip. This field will be strongly typed as well and will adapt to every chain used in the `dApp`. Default: `undefined`. This means to use the native token from the chain.
155+
- `customSignedExtensions`: gives the option to define the value of "custom" signed extensions, understood as signed extensions that PAPI is not aware of. One can define either one of `value` or `additionalSigned`, or both of them. Their type should be either SCALE-encoded `Uint8Array` or the JS type that PAPI's dynamic codecs infer. The default behaviour for unknown signed extensions is to throw an error, unless the type of it is an `Option`, in that case the default is `None`.
157156
158157
### `getEstimatedFees`
159158

0 commit comments

Comments
 (0)