aboutsummaryrefslogtreecommitdiffstats
path: root/packages/subproviders/test/integration
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-12-28 17:28:27 +0800
committerFabio Berger <me@fabioberger.com>2017-12-28 17:28:27 +0800
commitf2976af734a9c9dfdbac16b22040e8bdd97aa426 (patch)
treebbe99ba9dded45c7f7409bff3a13bbf6c30f80b8 /packages/subproviders/test/integration
parentee463058f153fa7de7e7dc9fbe160999cbbb5b11 (diff)
downloaddexon-0x-contracts-f2976af734a9c9dfdbac16b22040e8bdd97aa426.tar.gz
dexon-0x-contracts-f2976af734a9c9dfdbac16b22040e8bdd97aa426.tar.zst
dexon-0x-contracts-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.ts22
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',