aboutsummaryrefslogtreecommitdiffstats
path: root/packages/base-contract
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-07-27 05:32:52 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-08-09 05:27:30 +0800
commit6a6739ebbec291b61226c047fde7b3d0bb4a7250 (patch)
tree4f46c2cd8c14b972497134a7e7342d0a28c0b407 /packages/base-contract
parent6a5965d73bb542634631d7af76c150795d899744 (diff)
downloaddexon-sol-tools-6a6739ebbec291b61226c047fde7b3d0bb4a7250.tar
dexon-sol-tools-6a6739ebbec291b61226c047fde7b3d0bb4a7250.tar.gz
dexon-sol-tools-6a6739ebbec291b61226c047fde7b3d0bb4a7250.tar.bz2
dexon-sol-tools-6a6739ebbec291b61226c047fde7b3d0bb4a7250.tar.lz
dexon-sol-tools-6a6739ebbec291b61226c047fde7b3d0bb4a7250.tar.xz
dexon-sol-tools-6a6739ebbec291b61226c047fde7b3d0bb4a7250.tar.zst
dexon-sol-tools-6a6739ebbec291b61226c047fde7b3d0bb4a7250.zip
Apply prettier
Diffstat (limited to 'packages/base-contract')
-rw-r--r--packages/base-contract/src/index.ts6
-rw-r--r--packages/base-contract/test/base_contract_test.ts30
2 files changed, 22 insertions, 14 deletions
diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts
index e354f109e..31d2e4019 100644
--- a/packages/base-contract/src/index.ts
+++ b/packages/base-contract/src/index.ts
@@ -95,7 +95,11 @@ export class BaseContract {
const original = args[i];
const decoded = rawDecoded[i];
if (!abiUtils.isAbiDataEqual(params.names[i], params.types[i], original, decoded)) {
- throw new Error(`Cannot safely encode argument: ${params.names[i]} (${original}) of type ${params.types[i]}. (Possible type overflow or other encoding error)`);
+ throw new Error(
+ `Cannot safely encode argument: ${params.names[i]} (${original}) of type ${
+ params.types[i]
+ }. (Possible type overflow or other encoding error)`,
+ );
}
}
}
diff --git a/packages/base-contract/test/base_contract_test.ts b/packages/base-contract/test/base_contract_test.ts
index 57aacdc8a..2c31d1f11 100644
--- a/packages/base-contract/test/base_contract_test.ts
+++ b/packages/base-contract/test/base_contract_test.ts
@@ -8,20 +8,20 @@ const { expect } = chai;
describe('BaseContract', () => {
describe('strictArgumentEncodingCheck', () => {
it('works for simple types', () => {
- BaseContract.strictArgumentEncodingCheck([{ name: 'to', type: 'address' }], ['0xe834ec434daba538cd1b9fe1582052b880bd7e63']);
+ BaseContract.strictArgumentEncodingCheck(
+ [{ name: 'to', type: 'address' }],
+ ['0xe834ec434daba538cd1b9fe1582052b880bd7e63'],
+ );
});
it('works for array types', () => {
- const inputAbi = [{
- name: 'takerAssetFillAmounts',
- type: 'uint256[]',
- }];
+ const inputAbi = [
+ {
+ name: 'takerAssetFillAmounts',
+ type: 'uint256[]',
+ },
+ ];
const args = [
- [
- '9000000000000000000',
- '79000000000000000000',
- '979000000000000000000',
- '7979000000000000000000',
- ],
+ ['9000000000000000000', '79000000000000000000', '979000000000000000000', '7979000000000000000000'],
];
BaseContract.strictArgumentEncodingCheck(inputAbi, args);
});
@@ -101,10 +101,14 @@ describe('BaseContract', () => {
BaseContract.strictArgumentEncodingCheck(inputAbi, args);
});
it('throws for integer overflows', () => {
- expect(() => BaseContract.strictArgumentEncodingCheck([{ name: 'amount', type: 'uint8' }], ['256'])).to.throw();
+ expect(() =>
+ BaseContract.strictArgumentEncodingCheck([{ name: 'amount', type: 'uint8' }], ['256']),
+ ).to.throw();
});
it('throws for fixed byte array overflows', () => {
- expect(() => BaseContract.strictArgumentEncodingCheck([{ name: 'hash', type: 'bytes8' }], ['0x001122334455667788'])).to.throw();
+ expect(() =>
+ BaseContract.strictArgumentEncodingCheck([{ name: 'hash', type: 'bytes8' }], ['0x001122334455667788']),
+ ).to.throw();
});
});
});