Provide genesisHash & version to signer (#941)

* Provide genesisHash & version to signer

* Remove runtimeVersion (until needed, supplied anyway)
This commit is contained in:
Jaco Greeff
2019-06-12 16:45:45 +12:00
committed by Ian He
parent 3cce0902de
commit 62e7fe8623
2 changed files with 9 additions and 5 deletions
+4 -4
View File
@@ -197,10 +197,10 @@ export default function createSubmittableExtrinsic<CodecResult, SubscriptionResu
} else {
assert(api.signer, 'no signer exists');
updateId = await (api.signer as Signer).sign(_extrinsic, address, expandOptions({
...options,
nonce
}));
updateId = await (api.signer as Signer).sign(_extrinsic, address, {
...expandOptions({ ...options, nonce }),
genesisHash: api.genesisHash
});
}
}),
switchMap(() => {
+5 -1
View File
@@ -189,11 +189,15 @@ export interface ApiBaseInterface<CodecResult, SubscriptionResult> extends Reado
once: (type: ApiInterface$Events, handler: (...args: Array<any>) => any) => this;
}
export type SignerOptions = SignatureOptions & {
genesisHash: Hash
};
export interface Signer {
/**
* @description Signs an extrinsic, returning an id (>0) that can be used to retrieve updates
*/
sign (extrinsic: IExtrinsic, address: string, options: SignatureOptions): Promise<number>;
sign (extrinsic: IExtrinsic, address: string, options: SignerOptions): Promise<number>;
/**
* @description Receives an update for the extrinsic signed by a `signer.sign`