-
Couldn't load subscription status.
- Fork 376
Closed
Description
As a dapp, it doesn't always have access to key pair. Key pairs could be managed in a browser extension or hardware wallet. So I propose to introduce signer to api and let it do the signing. This will allow our browser extension to work with the api by exposing a signer into browser's global.
export interface Signer {
sign(extrinsic: Extrinsic, opt: {from: string} & SignatureOptions): Promise<void>;
}
signAndSend is the place to use the signer. I prefer to changing the signature to below which looks more neat
signAndSend (options: SignAndSendOptions)
signAndSend (options: SignAndSendOptions, statusCb: StatusCb)
signAndSend (options: SignAndSendOptions, statusCb?: StatusCb)
interface SignAndSendOptions extends Partial<SignatureOptions> {
from: string | KeyringPair
}
though to keep backward compatible, it could also be like:
signAndSend (account: KeyringPair | string, _options?: Partial<SignatureOptionsPartial> | StatusCb, statusCb?: StatusCb)
I would like to hear from you if it's the right direction before submitting my PR.
Metadata
Metadata
Assignees
Labels
No labels