aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Evans <jacob@dekz.net>2018-04-11 10:51:57 +0800
committerJacob Evans <jacob@dekz.net>2018-04-11 10:51:57 +0800
commiteee190826a44dfe5444f15165577ea73b4f78c2f (patch)
tree75545d1ed9639cd9d8d083644cc7fa1dff720b8f
parent20a1deb187d8fb38a42ae87fc8f046dff4b4ba61 (diff)
downloaddexon-sol-tools-eee190826a44dfe5444f15165577ea73b4f78c2f.tar.gz
dexon-sol-tools-eee190826a44dfe5444f15165577ea73b4f78c2f.tar.zst
dexon-sol-tools-eee190826a44dfe5444f15165577ea73b4f78c2f.zip
Test signed messages with the second account
-rw-r--r--packages/subproviders/test/integration/ledger_subprovider_test.ts9
-rw-r--r--packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts5
-rw-r--r--packages/subproviders/test/utils/fixture_data.ts2
3 files changed, 15 insertions, 1 deletions
diff --git a/packages/subproviders/test/integration/ledger_subprovider_test.ts b/packages/subproviders/test/integration/ledger_subprovider_test.ts
index 4a831af67..ea5010696 100644
--- a/packages/subproviders/test/integration/ledger_subprovider_test.ts
+++ b/packages/subproviders/test/integration/ledger_subprovider_test.ts
@@ -59,9 +59,16 @@ describe('LedgerSubprovider', () => {
data,
fixtureData.TEST_RPC_ACCOUNT_0,
);
- expect(ecSignatureHex.length).to.be.equal(132);
expect(ecSignatureHex).to.be.equal(fixtureData.PERSONAL_MESSAGE_SIGNED_RESULT);
});
+ it('signs a personal message with second address', async () => {
+ const data = ethUtils.bufferToHex(ethUtils.toBuffer(fixtureData.PERSONAL_MESSAGE_STRING));
+ const ecSignatureHex = await ledgerSubprovider.signPersonalMessageAsync(
+ data,
+ fixtureData.TEST_RPC_ACCOUNT_1,
+ );
+ expect(ecSignatureHex).to.be.equal(fixtureData.PERSONAL_MESSAGE_ACCOUNT_1_SIGNED_RESULT);
+ });
it('signs a transaction', async () => {
const txHex = await ledgerSubprovider.signTransactionAsync(fixtureData.TX_DATA);
expect(txHex).to.be.equal(fixtureData.TX_DATA_SIGNED_RESULT);
diff --git a/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts b/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts
index a1a5a2296..aacaef9f4 100644
--- a/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts
+++ b/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts
@@ -39,6 +39,11 @@ describe('MnemonicWalletSubprovider', () => {
const ecSignatureHex = await subprovider.signPersonalMessageAsync(data, fixtureData.TEST_RPC_ACCOUNT_0);
expect(ecSignatureHex).to.be.equal(fixtureData.PERSONAL_MESSAGE_SIGNED_RESULT);
});
+ it('signs a personal message with second address', async () => {
+ const data = ethUtils.bufferToHex(ethUtils.toBuffer(fixtureData.PERSONAL_MESSAGE_STRING));
+ const ecSignatureHex = await subprovider.signPersonalMessageAsync(data, fixtureData.TEST_RPC_ACCOUNT_1);
+ expect(ecSignatureHex).to.be.equal(fixtureData.PERSONAL_MESSAGE_ACCOUNT_1_SIGNED_RESULT);
+ });
it('signs a transaction', async () => {
const txHex = await subprovider.signTransactionAsync(fixtureData.TX_DATA);
expect(txHex).to.be.equal(fixtureData.TX_DATA_SIGNED_RESULT);
diff --git a/packages/subproviders/test/utils/fixture_data.ts b/packages/subproviders/test/utils/fixture_data.ts
index 62b76e132..f47fbd428 100644
--- a/packages/subproviders/test/utils/fixture_data.ts
+++ b/packages/subproviders/test/utils/fixture_data.ts
@@ -10,6 +10,8 @@ export const fixtureData = {
PERSONAL_MESSAGE_STRING: 'hello world',
PERSONAL_MESSAGE_SIGNED_RESULT:
'0x1b0ec5e2908e993d0c8ab6b46da46be2688fdf03c7ea6686075de37392e50a7d7fcc531446699132fbda915bd989882e0064d417018773a315fb8d43ed063c9b00',
+ PERSONAL_MESSAGE_ACCOUNT_1_SIGNED_RESULT:
+ '0xe7ae0c21d02eb38f2c2a20d9d7876a98cc7ef035b7a4559d49375e2ec735e06f0d0ab0ff92ee56c5ffc28d516e6ed0692d0270feae8796408dbef060c6c7100f01',
TESTRPC_DERIVATION_PATH: `m/44'/60'/0'/0`,
NETWORK_ID: networkId,
TX_DATA: {