Add test for checksummed addresses being valid inputs for tx origin when calling signTransactionAsync in the private key subprovider

This commit is contained in:
Brandon Chow
2019-07-15 18:33:33 -07:00
parent 6d6e7e1468
commit 43072ef80d
3 changed files with 17 additions and 0 deletions

View File

@@ -1,4 +1,14 @@
[
{
"version": "4.1.2",
"changes": [
{
"note": "Fix bug in Trezor subprovider causing Trezor response to not be hex encoded",
"pr": "WIP"
}
],
"timestamp": 1563240294
},
{
"version": "4.1.1",
"changes": [

View File

@@ -33,6 +33,11 @@ describe('PrivateKeyWalletSubprovider', () => {
const txHex = await subprovider.signTransactionAsync(fixtureData.TX_DATA);
expect(txHex).to.be.equal(fixtureData.TX_DATA_SIGNED_RESULT);
});
it('signs a transaction where the tx.origin is checksummed.', async () => {
const TX_DATA_CHECKSUMMED_ORIGIN = { ...fixtureData.TX_DATA, from: fixtureData.TEST_RPC_ACCOUNT_0_CHECKSUMMED };
const txHex = await subprovider.signTransactionAsync(TX_DATA_CHECKSUMMED_ORIGIN);
expect(txHex).to.be.equal(fixtureData.TX_DATA_SIGNED_RESULT);
});
it('signs an EIP712 sign typed data message', async () => {
const signature = await subprovider.signTypedDataAsync(
fixtureData.TEST_RPC_ACCOUNT_0,

View File

@@ -1,10 +1,12 @@
const TEST_RPC_ACCOUNT_0 = '0x5409ed021d9299bf6814279a6a1411a7e866a631';
const TEST_RPC_ACCOUNT_0_CHECKSUMMED = '0x5409ED021D9299bf6814279A6A1411A7e866A631';
const TEST_RPC_ACCOUNT_1 = '0x6ecbe1db9ef729cbe972c83fb886247691fb6beb';
const NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
const networkId = 42;
export const fixtureData = {
NULL_ADDRESS,
TEST_RPC_ACCOUNT_0,
TEST_RPC_ACCOUNT_0_CHECKSUMMED,
TEST_RPC_ACCOUNT_0_ACCOUNT_PRIVATE_KEY: 'F2F48EE19680706196E2E339E5DA3491186E0C4C5030670656B0E0164837257D',
TEST_RPC_ACCOUNT_1,
TEST_RPC_MNEMONIC: 'concert load couple harbor equip island argue ramp clarify fence smart topic',