Skip to content

Commit 245a40b

Browse files
api, api-{augment, base, contract, derive}, rpc-{augment, core, provider}, types, types-{augment, codec, create, known} 12.0.2
1 parent d2257b5 commit 245a40b

File tree

25 files changed

+126
-20
lines changed

25 files changed

+126
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## master
44

5+
- api, api-{augment, base, contract, derive}, rpc-{augment, core, provider}, types, types-{augment, codec, create, known} 12.0.2
56
- phishing 0.22.10
67
- api, api-{augment, base, contract, derive}, rpc-{augment, core, provider}, types, types-{augment, codec, create, known} 12.0.1
78
- phishing 0.22.9

api-augment/packageInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22

3-
export const packageInfo = { name: '@polkadot/api-augment', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.0.1' };
3+
export const packageInfo = { name: '@polkadot/api-augment', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.0.2' };

api-base/packageInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22

3-
export const packageInfo = { name: '@polkadot/api-base', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.0.1' };
3+
export const packageInfo = { name: '@polkadot/api-base', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.0.2' };

api-base/types/submittable.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface SignerOptions {
1717
assetId?: AnyNumber | object;
1818
mode?: AnyNumber;
1919
metadataHash?: AnyU8a;
20+
withSignedTransaction?: boolean;
2021
}
2122

2223
export type SubmittableDryRunResult<ApiType extends ApiTypes> =
@@ -64,6 +65,15 @@ export interface SubmittableExtrinsic<ApiType extends ApiTypes, R extends ISubmi
6465

6566
send (statusCb: Callback<R>): SubmittableResultSubscription<ApiType, R>;
6667

68+
/**
69+
* @description Sign and broadcast the constructued transaction.
70+
*
71+
* Note for injected signers:
72+
* As of v12.0.2 and up the `SignerResult` return type for `signPayload` allows for the `signedTransaction` field.
73+
* This allows the signer to input a signed transaction that will modify the payload. This
74+
* The api will ensure that the Call Data is not changed. This allows for the signer to modify the payload to add
75+
* things like `mode`, and `metadataHash` for signedExtensions such as `CheckMetadataHash`.
76+
*/
6777
signAsync (account: AddressOrPair, _options?: Partial<SignerOptions>): PromiseOrObs<ApiType, this>;
6878

6979
/**

api-contract/packageInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22

3-
export const packageInfo = { name: '@polkadot/api-contract', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.0.1' };
3+
export const packageInfo = { name: '@polkadot/api-contract', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.0.2' };

api-derive/packageInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22

3-
export const packageInfo = { name: '@polkadot/api-derive', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.0.1' };
3+
export const packageInfo = { name: '@polkadot/api-derive', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.0.2' };

api/packageInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22

3-
export const packageInfo = { name: '@polkadot/api', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.0.1' };
3+
export const packageInfo = { name: '@polkadot/api', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.0.2' };

api/submittable/createClass.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,16 +338,37 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, blockHas
338338
if (isFunction(signer.signPayload)) {
339339
result = await signer.signPayload(payload.toPayload());
340340

341-
// When the signedTransaction is included by the signer, we no longer add
342-
// the signature to the parent class, but instead broadcast the signed transaction directly.
343-
if (result.signedTransaction) {
341+
if (result.signedTransaction && !options.withSignedTransaction) {
342+
throw new Error('The `signedTransaction` field may not be submitted when `withSignedTransaction` is disabled');
343+
}
344+
345+
if (result.signedTransaction && options.withSignedTransaction) {
344346
const ext = this.registry.createTypeUnsafe<Extrinsic>('Extrinsic', [result.signedTransaction]);
347+
const newSignerPayload = this.registry.createTypeUnsafe<SignerPayload>('SignerPayload', [objectSpread({}, {
348+
address,
349+
assetId: ext.assetId ? ext.assetId.toHex() : null,
350+
blockHash: payload.blockHash,
351+
blockNumber: header ? header.number : 0,
352+
era: ext.era.toHex(),
353+
genesisHash: payload.genesisHash,
354+
metadataHash: ext.metadataHash ? ext.metadataHash.toHex() : null,
355+
method: ext.method.toHex(),
356+
mode: ext.mode ? ext.mode.toHex() : null,
357+
nonce: ext.nonce.toHex(),
358+
runtimeVersion: payload.runtimeVersion,
359+
signedExtensions: payload.signedExtensions,
360+
tip: ext.tip.toHex(),
361+
version: payload.version
362+
})]);
345363

346364
if (!ext.isSigned) {
347365
throw new Error(`When using the signedTransaction field, the transaction must be signed. Recieved isSigned: ${ext.isSigned}`);
348366
}
349367

350368
this.#validateSignedTransaction(payload, ext);
369+
// This is only used for signAsync - signAndSend does not need to adjust the super payload or
370+
// add the signature.
371+
super.addSignature(address, result.signature, newSignerPayload.toPayload());
351372

352373
return { id: result.id, signedTransaction: result.signedTransaction };
353374
}

rpc-augment/packageInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22

3-
export const packageInfo = { name: '@polkadot/rpc-augment', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.0.1' };
3+
export const packageInfo = { name: '@polkadot/rpc-augment', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.0.2' };

rpc-core/packageInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22

3-
export const packageInfo = { name: '@polkadot/rpc-core', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.0.1' };
3+
export const packageInfo = { name: '@polkadot/rpc-core', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.0.2' };

0 commit comments

Comments
 (0)