aboutsummaryrefslogtreecommitdiffstats
path: root/packages/subproviders/test
diff options
context:
space:
mode:
authorJacob Evans <jacob@dekz.net>2018-04-11 10:56:52 +0800
committerJacob Evans <jacob@dekz.net>2018-04-11 10:56:52 +0800
commit65b2c936abdf3a67d471cd17eeed5069825ac3d4 (patch)
treecdf8a2d570809fce6a7daac9790000ee99f86b83 /packages/subproviders/test
parenteee190826a44dfe5444f15165577ea73b4f78c2f (diff)
downloaddexon-sol-tools-65b2c936abdf3a67d471cd17eeed5069825ac3d4.tar
dexon-sol-tools-65b2c936abdf3a67d471cd17eeed5069825ac3d4.tar.gz
dexon-sol-tools-65b2c936abdf3a67d471cd17eeed5069825ac3d4.tar.bz2
dexon-sol-tools-65b2c936abdf3a67d471cd17eeed5069825ac3d4.tar.lz
dexon-sol-tools-65b2c936abdf3a67d471cd17eeed5069825ac3d4.tar.xz
dexon-sol-tools-65b2c936abdf3a67d471cd17eeed5069825ac3d4.tar.zst
dexon-sol-tools-65b2c936abdf3a67d471cd17eeed5069825ac3d4.zip
Tests for signed transactions and multiple accounts
Diffstat (limited to 'packages/subproviders/test')
-rw-r--r--packages/subproviders/test/integration/ledger_subprovider_test.ts5
-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, 12 insertions, 0 deletions
diff --git a/packages/subproviders/test/integration/ledger_subprovider_test.ts b/packages/subproviders/test/integration/ledger_subprovider_test.ts
index ea5010696..2db4befb3 100644
--- a/packages/subproviders/test/integration/ledger_subprovider_test.ts
+++ b/packages/subproviders/test/integration/ledger_subprovider_test.ts
@@ -73,6 +73,11 @@ describe('LedgerSubprovider', () => {
const txHex = await ledgerSubprovider.signTransactionAsync(fixtureData.TX_DATA);
expect(txHex).to.be.equal(fixtureData.TX_DATA_SIGNED_RESULT);
});
+ it('signs a transaction with the second address', async () => {
+ const txData = { ...fixtureData.TX_DATA, from: fixtureData.TEST_RPC_ACCOUNT_1 };
+ const txHex = await ledgerSubprovider.signTransactionAsync(txData);
+ expect(txHex).to.be.equal(fixtureData.TX_DATA_ACCOUNT_1_SIGNED_RESULT);
+ });
});
describe('calls through a provider', () => {
let defaultProvider: Web3ProviderEngine;
diff --git a/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts b/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts
index aacaef9f4..2bc84abc1 100644
--- a/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts
+++ b/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts
@@ -48,6 +48,11 @@ describe('MnemonicWalletSubprovider', () => {
const txHex = await subprovider.signTransactionAsync(fixtureData.TX_DATA);
expect(txHex).to.be.equal(fixtureData.TX_DATA_SIGNED_RESULT);
});
+ it('signs a transaction with the second address', async () => {
+ const txData = { ...fixtureData.TX_DATA, from: fixtureData.TEST_RPC_ACCOUNT_1 };
+ const txHex = await subprovider.signTransactionAsync(txData);
+ expect(txHex).to.be.equal(fixtureData.TX_DATA_ACCOUNT_1_SIGNED_RESULT);
+ });
});
describe('failure cases', () => {
it('throws an error if account cannot be found', async () => {
diff --git a/packages/subproviders/test/utils/fixture_data.ts b/packages/subproviders/test/utils/fixture_data.ts
index f47fbd428..57b69b2f8 100644
--- a/packages/subproviders/test/utils/fixture_data.ts
+++ b/packages/subproviders/test/utils/fixture_data.ts
@@ -26,4 +26,6 @@ export const fixtureData = {
// This is the signed result of the abouve Transaction Data
TX_DATA_SIGNED_RESULT:
'0xf85f8080822710940000000000000000000000000000000000000000808078a0712854c73c69445cc1b22a7c3d7312ff9a97fe4ffba35fd636e8236b211b6e7ca0647cee031615e52d916c7c707025bc64ad525d8f1b9876c3435a863b42743178',
+ TX_DATA_ACCOUNT_1_SIGNED_RESULT:
+ '0xf85f8080822710940000000000000000000000000000000000000000808078a04b02af7ff3f18ce114b601542cc8ebdc50921354f75dd510d31793453a0710e6a0540082a01e475465801b8186a2edc79ec1a2dcf169b9781c25a58a417023c9ca',
};