Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/sdk-coin-eth/src/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ export class Eth extends AbstractEthLikeNewCoins {
nonce:
params.signingKeyNonce !== undefined ? params.signingKeyNonce : params.txPrebuild.halfSigned?.backupKeyNonce,
value: 0,
gasPrice: new optionalDeps.ethUtil.BN(txPrebuild.gasPrice),
gasPrice: txPrebuild.eip1559 ? undefined : new optionalDeps.ethUtil.BN(txPrebuild.gasPrice),
gasLimit: new optionalDeps.ethUtil.BN(txPrebuild.gasLimit),
data: sendData,
};
Expand Down
27 changes: 27 additions & 0 deletions modules/sdk-coin-eth/test/fixtures/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,33 @@ module.exports.WRWUnsignedSweepETHTx = {
nextContractSequenceId: 1,
};

module.exports.WRWUnsignedSweepEIP1559ETHTx = {
tx: 'f9012b808504a817c8008307a12094fd12f1d563650fbdd9314dce06992159778f634380b9010439125215000000000000000000000000a98fdfc2c711260cd665a3884b509b4a5ad6f4e80000000000000000000000000000000000000000000000003782dace9d90000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000005f6a471c000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c8080',
userKey:
'xpub661MyMwAqRbcFcNDKt46HgPAJTfNyQUS6M7i8jUwZKHz9wZGaK1XdQuT8XU5PkFfbrfoGXc1C4QD9PDJ7zhpu52rLzzynovwgcXh7NtDbH9',
backupKey:
'xpub661MyMwAqRbcGUJYcAgycBqG5HrQoUJAvBv7PEbvjGGffdtMP8hx3DX9AwzaY4vA7ynqHfxzRTRLwS2E9DH1HRPG8u7kWXd4JMCNgonGGnk',
coin: 'teth',
eip1559: { maxFeePerGas: '40000000000', maxPriorityFeePerGas: '2000000000' },
gasLimit: '500000',
recipients: [
{
address: '0xa98fdfc2c711260cd665a3884b509b4a5ad6f4e8',
amount: '4000000000000000000',
},
],
walletContractAddress: '0xfd12f1d563650fbdd9314dce06992159778f6343',
amount: '4000000000000000000',
backupKeyNonce: 0,
recipient: {
address: '0xa98fdfc2c711260cd665a3884b509b4a5ad6f4e8',
amount: '4000000000000000000',
},
expireTime: 1600800540,
contractSequenceId: 1,
nextContractSequenceId: 1,
};

module.exports.WRWUnsignedSweepERC20Tx = {
tx: 'f9010a808504a817c8008307a12094df07117705a9f8dc4c2a78de66b7f1797dba9d4e80b8e40dcd7a6c00000000000000000000000052c8b29ab8b0a49a01c2b75f8e7f11b23e0e37820000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000004f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa00000000000000000000000000000000000000000000000000000000611fb4330000000000000000000000000000000000000000000000000000000000002a7f00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000001c8080',
userKey:
Expand Down
26 changes: 26 additions & 0 deletions modules/sdk-coin-eth/test/unit/ethWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,4 +485,30 @@ describe('final-sign transaction from WRW', function () {
outputs[0].address.should.equal(fixtures.WRWUnsignedSweepERC20Tx.recipient.address);
outputs[0].amount.should.equal(fixtures.WRWUnsignedSweepERC20Tx.recipient.amount);
});

it('should add a second EIP-1559 signature to unsigned sweep for teth without throwing when gasPrice is absent', async function () {
const bitgo = TestBitGo.decorate(BitGoAPI, { env: 'test' });
bitgo.safeRegister('teth', Teth.createInstance);
const basecoin: any = bitgo.coin('teth');
const gasLimit = 500000;
const prv =
'xprv9s21ZrQH143K3D8TXfvAJgHVfTEeQNW5Ys9wZtnUZkqPzFzSjbEJrWC1vZ4GnXCvR7rQL2UFX3RSuYeU9MrERm1XBvACow7c36vnz5iYyj2';
const tx = {
txPrebuild: fixtures.WRWUnsignedSweepEIP1559ETHTx,
prv,
};
const halfSigned = await basecoin.signTransaction(tx);

const wrapper = {} as SignTransactionOptions;
wrapper.txPrebuild = halfSigned;
wrapper.txPrebuild.recipients = halfSigned.halfSigned.recipients;
wrapper.txPrebuild.eip1559 = fixtures.WRWUnsignedSweepEIP1559ETHTx.eip1559;
wrapper.txPrebuild.gasLimit = gasLimit.toString();
wrapper.isLastSignature = true;
wrapper.walletContractAddress = fixtures.WRWUnsignedSweepEIP1559ETHTx.walletContractAddress;
wrapper.prv = prv;

const finalSignedTx = await basecoin.signTransaction(wrapper);
finalSignedTx.should.have.property('txHex');
});
});
Loading