fix issue with tx config getting copied
MODIFY
src/utils/base_token.ts
src/utils/base_token.ts
@@ -168,7 +168,7 @@ export class BaseToken<T_CLIENT_CONFIG> {
protected async createTransactionConfig({ txConfig, method, isParent, isWrite }: ITransactionConfigParam) {
const defaultConfig = isParent ? this.parentDefaultConfig : this.childDefaultConfig;
- txConfig = Object.assign(defaultConfig, (txConfig || {}));
+ txConfig = merge(defaultConfig, (txConfig || {}));
this.client.logger.log("txConfig", txConfig, "onRoot", isParent, "isWrite", isWrite);
const client = isParent ? this.client.parent :
this.client.child;
@@ -184,6 +184,8 @@ export class BaseToken<T_CLIENT_CONFIG> {
const isMaxFeeProvided = (maxFeePerGas || maxPriorityFeePerGas);
if (!isEIP1559Supported && isMaxFeeProvided) {
+ // tslint:disable-next-line
+ debugger;
this.client.logger.error(ERROR_TYPE.EIP1559NotSupported, isParent).throw();
}

MODIFY
test/specs/erc20.spec.ts
test/specs/erc20.spec.ts
@@ -62,17 +62,28 @@ describe('ERC20', () => {
}
});
+ it('child transfer returnTransaction', async () => {
+ const amount = 10;
+ const result = await erc20Child.transfer(to, amount, {
+ returnTransaction: true
+ });
+ console.log('result', result);
+ expect(result).to.have.not.property('maxFeePerGas')
+ expect(result).to.have.not.property('maxPriorityFeePerGas')
+ expect(result).to.have.property('gasPrice')
+ });
+
it('parent transfer returnTransaction with erp1159', async () => {
const amount = 10;
const result = await erc20Parent.transfer(to, amount, {
- maxFeePerGas: 10,
- maxPriorityFeePerGas: 10,
+ maxFeePerGas: 20,
+ maxPriorityFeePerGas: 20,
returnTransaction: true
});
console.log('result', result);
- expect(result).to.have.property('maxFeePerGas', 10)
- expect(result).to.have.property('maxPriorityFeePerGas', 10)
+ expect(result).to.have.property('maxFeePerGas', 20)
+ expect(result).to.have.property('maxPriorityFeePerGas', 20)
expect(result).to.have.not.property('gasPrice')
});
@@ -121,30 +132,27 @@ describe('ERC20', () => {
)
});
+ if (process.env.NODE_ENV !== 'test_all') return;
+ it('approve', async () => {
+ const result = await erc20Parent.approve('10');
- if (process.env.NODE_ENV === 'test_all') {
-
-
- // it('approve', async () => {
- // const result = await erc20Parent.approve('10');
+ const txHash = await result.getTransactionHash();
+ expect(txHash).to.be.an('string');
- // const txHash = await result.getTransactionHash();
- // expect(txHash).to.be.an('string');
+ const txReceipt = await result.getReceipt();
+ console.log("txReceipt", txReceipt);
+ expect(txReceipt.type).equal('0x0');
+ });
- // const txReceipt = await result.getReceipt();
- // console.log("txReceipt", txReceipt);
- // expect(txReceipt.type).equal('0x0');
- // });
+ it('deposit', async () => {
+ const result = await erc20Parent.deposit('10', from);
- // it('deposit', async () => {
- // const result = await erc20Parent.deposit('10', from);
+ const txHash = await result.getTransactionHash();
+ expect(txHash).to.be.an('string');
- // const txHash = await result.getTransactionHash();
- // expect(txHash).to.be.an('string');
+ const txReceipt = await result.getReceipt();
+ expect(txReceipt).to.be.an('object');
+ });
- // const txReceipt = await result.getReceipt();
- // expect(txReceipt).to.be.an('object');
- // });
- }
});
\ No newline at end of file

MODIFY
test/specs/index.ts
test/specs/index.ts
@@ -8,5 +8,5 @@ console.log('process.env.NODE_ENV', process.env.NODE_ENV);
import './map_promise.spec'
import './erc20.spec'
-// import './erc721.spec'
+import './erc721.spec'
// import './pos_bridge'

fix issue with tx config getting copied