diff --git a/src/contract.ts b/src/contract.ts index e155cbb..b7ff4f4 100644 --- a/src/contract.ts +++ b/src/contract.ts @@ -38,7 +38,7 @@ export class Contract { } function toFragment(abi: JsonFragment[] | string[] | Fragment[]): Fragment[] { - return abi.map((item: JsonFragment | string | Fragment) => Fragment.from(item)); + return abi.map((item: JsonFragment | string | Fragment) => Fragment.from(item)).filter(fragment => fragment !== null); } function makeCallFunction(contract: Contract, name: string) { diff --git a/test/index.test.ts b/test/index.test.ts index d315e26..3cf6f6d 100755 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -38,6 +38,10 @@ it('json abi', async () => { payable: false, stateMutability: 'view', type: 'function' + }, + { + stateMutability: 'payable', + type: 'receive' } ]; const addresses = [