diff options
author | Fabio Berger <me@fabioberger.com> | 2017-12-28 17:28:27 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-12-28 17:28:27 +0800 |
commit | f2976af734a9c9dfdbac16b22040e8bdd97aa426 (patch) | |
tree | bbe99ba9dded45c7f7409bff3a13bbf6c30f80b8 /packages/subproviders/test/integration | |
parent | ee463058f153fa7de7e7dc9fbe160999cbbb5b11 (diff) | |
download | dexon-sol-tools-f2976af734a9c9dfdbac16b22040e8bdd97aa426.tar dexon-sol-tools-f2976af734a9c9dfdbac16b22040e8bdd97aa426.tar.gz dexon-sol-tools-f2976af734a9c9dfdbac16b22040e8bdd97aa426.tar.bz2 dexon-sol-tools-f2976af734a9c9dfdbac16b22040e8bdd97aa426.tar.lz dexon-sol-tools-f2976af734a9c9dfdbac16b22040e8bdd97aa426.tar.xz dexon-sol-tools-f2976af734a9c9dfdbac16b22040e8bdd97aa426.tar.zst dexon-sol-tools-f2976af734a9c9dfdbac16b22040e8bdd97aa426.zip |
Support both personal_sign and eth_sign
Diffstat (limited to 'packages/subproviders/test/integration')
-rw-r--r-- | packages/subproviders/test/integration/ledger_subprovider_test.ts | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/packages/subproviders/test/integration/ledger_subprovider_test.ts b/packages/subproviders/test/integration/ledger_subprovider_test.ts index 169e15504..7f319ed4e 100644 --- a/packages/subproviders/test/integration/ledger_subprovider_test.ts +++ b/packages/subproviders/test/integration/ledger_subprovider_test.ts @@ -85,7 +85,7 @@ describe('LedgerSubprovider', () => { }); ledgerProvider.sendAsync(payload, callback); }); - it('signs a personal message', (done: DoneCallback) => { + it('signs a personal message with eth_sign', (done: DoneCallback) => { (async () => { const messageHex = ethUtils.bufferToHex(ethUtils.toBuffer('hello world')); const accounts = await ledgerSubprovider.getAccountsAsync(); @@ -105,6 +105,26 @@ describe('LedgerSubprovider', () => { ledgerProvider.sendAsync(payload, callback); })().catch(done); }); + it('signs a personal message with personal_sign', (done: DoneCallback) => { + (async () => { + const messageHex = ethUtils.bufferToHex(ethUtils.toBuffer('hello world')); + const accounts = await ledgerSubprovider.getAccountsAsync(); + const signer = accounts[0]; + const payload = { + jsonrpc: '2.0', + method: 'personal_sign', + params: [messageHex, signer], + id: 1, + }; + const callback = reportCallbackErrors(done)((err: Error, response: Web3.JSONRPCResponsePayload) => { + expect(err).to.be.a('null'); + expect(response.result.length).to.be.equal(132); + expect(response.result.substr(0, 2)).to.be.equal('0x'); + done(); + }); + ledgerProvider.sendAsync(payload, callback); + })().catch(done); + }); it('signs a transaction', (done: DoneCallback) => { const tx = { to: '0xafa3f8684e54059998bc3a7b0d2b0da075154d66', |