-
Notifications
You must be signed in to change notification settings - Fork 375
Closed
Labels
BugTracks issues causing errors or unintended behavior, critical to fix for reliability.Tracks issues causing errors or unintended behavior, critical to fix for reliability.
Description
Goal:
Update signAsync
to make the second argument optional, and default to {}
Background:
Currently this code will crash:
const signed = await api.system.remark().signAsync(pair, options);
when options
is undefined
, it gives this error
(node:78914) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'nonce' of undefined
at Submittable.value (/Users/xiliangchen/projects/playground/node_modules/@polkadot/api/submittable/createClass.js:59:42)
at Submittable.value (/Users/xiliangchen/projects/playground/node_modules/@polkadot/api/submittable/createClass.js:129:99)
at /Users/xiliangchen/projects/playground/node_modules/@polkadot/api/submittable/createClass.js:251:110
at /Users/xiliangchen/projects/playground/node_modules/@polkadot/api/promise/Api.js:78:14
at Submittable.signAsync (/Users/xiliangchen/projects/playground/node_modules/@polkadot/api/submittable/createClass.js:251:170)
at /Users/xiliangchen/projects/playground/index.ts:28:33
at step (/Users/xiliangchen/projects/playground/index.ts:33:23)
at Object.next (/Users/xiliangchen/projects/playground/index.ts:14:53)
at /Users/xiliangchen/projects/playground/index.ts:8:71
at new Promise (<anonymous>)
Actions:
Make second argument optional
public signAsync (account: AddressOrPair, optionsOrNonce: Partial<SignerOptions>): SubmittableThis<ApiType, this> { |
Update interface
api/packages/api/src/submittable/types.ts
Line 55 in e77050b
signAsync(account: AddressOrPair, _options: Partial<SignatureOptions>): SubmittableThis<ApiType, this>; |
Provide appropriate unit tests.
@jacogr please tag this if you are happy about this.
Tags:
bounty-awaiting-approval
bounty-XS
Metadata
Metadata
Assignees
Labels
BugTracks issues causing errors or unintended behavior, critical to fix for reliability.Tracks issues causing errors or unintended behavior, critical to fix for reliability.