Cater for signature over hash (with version checks) (#655)

* Cater for signature over hash (with version checks)

* Allow Submittable signAndSend

* isUndefined for nonce check

* .sign with backwards compat

* e2e tests started

* Work around optional callback for Promise

* Commit actual e2e test

* Promise allows for submitExtrinsic

* e2e tests are passing

* Bump version, update CHANGELOG
This commit is contained in:
Jaco Greeff
2019-01-31 18:01:14 +01:00
committed by GitHub
parent 8da2b1c451
commit c1a6f0230c
23 changed files with 153 additions and 66 deletions
@@ -21,7 +21,7 @@ async function main () {
const api = await ApiPromise.create();
// get the nonce for the admin key
const aliceNonce = await api.query.system.accountNonce(ALICE);
const nonce = await api.query.system.accountNonce(ALICE);
// find the actual keypair in the keyring
const alicePair = keyring.getPair(ALICE);
@@ -34,7 +34,7 @@ async function main () {
// Do the transfer and track the actual status
api.tx.balances
.transfer(recipient, AMOUNT)
.sign(alicePair, aliceNonce)
.sign(alicePair, { nonce })
.send(({ events = [], status, type }) => {
console.log('Transaction status:', type);