diff --git a/src/tokens/tokens.interfaces.ts b/src/tokens/tokens.interfaces.ts index fe6e648..9701e4b 100644 --- a/src/tokens/tokens.interfaces.ts +++ b/src/tokens/tokens.interfaces.ts @@ -224,7 +224,7 @@ export class TokenInterface { @ApiProperty({ isArray: true }) @IsDefined() - abi: IAbiMethod[]; + methods: IAbiMethod[]; } export class CheckInterfaceRequest extends TokenInterface { diff --git a/src/tokens/tokens.service.ts b/src/tokens/tokens.service.ts index 4a76efe..10cada5 100644 --- a/src/tokens/tokens.service.ts +++ b/src/tokens/tokens.service.ts @@ -320,14 +320,14 @@ export class TokensService { checkInterface(dto: CheckInterfaceRequest): CheckInterfaceResponse { const wrapMethods = (methods: IAbiMethod[]): TokenInterface => { - return { format: InterfaceFormat.ABI, abi: methods }; + return { format: InterfaceFormat.ABI, methods }; }; return { - approval: wrapMethods(this.mapper.getAllMethods(dto.abi, DynamicMethods.approval)), - burn: wrapMethods(this.mapper.getAllMethods(dto.abi, DynamicMethods.burn)), - mint: wrapMethods(this.mapper.getAllMethods(dto.abi, DynamicMethods.mint)), - transfer: wrapMethods(this.mapper.getAllMethods(dto.abi, DynamicMethods.transfer)), + approval: wrapMethods(this.mapper.getAllMethods(dto.methods, DynamicMethods.approval)), + burn: wrapMethods(this.mapper.getAllMethods(dto.methods, DynamicMethods.burn)), + mint: wrapMethods(this.mapper.getAllMethods(dto.methods, DynamicMethods.mint)), + transfer: wrapMethods(this.mapper.getAllMethods(dto.methods, DynamicMethods.transfer)), }; } @@ -339,7 +339,7 @@ export class TokensService { async mint(dto: TokenMint): Promise { const poolLocator = unpackPoolLocator(dto.poolLocator); const address = poolLocator.address ?? (await this.getContractAddress()); - const abi = dto.interface?.abi || (await this.getAbiForMint(address, dto)); + const abi = dto.interface?.methods || (await this.getAbiForMint(address, dto)); const { method, params } = this.mapper.getMethodAndParams(abi, poolLocator, 'mint', dto); const response = await this.blockchain.sendTransaction( dto.signer, @@ -354,7 +354,7 @@ export class TokensService { async transfer(dto: TokenTransfer): Promise { const poolLocator = unpackPoolLocator(dto.poolLocator); const address = poolLocator.address ?? (await this.getContractAddress()); - const abi = dto.interface?.abi || this.mapper.getAbi(); + const abi = dto.interface?.methods || this.mapper.getAbi(); const { method, params } = this.mapper.getMethodAndParams(abi, poolLocator, 'transfer', dto); const response = await this.blockchain.sendTransaction( dto.signer, @@ -369,7 +369,7 @@ export class TokensService { async burn(dto: TokenBurn): Promise { const poolLocator = unpackPoolLocator(dto.poolLocator); const address = poolLocator.address ?? (await this.getContractAddress()); - const abi = dto.interface?.abi || this.mapper.getAbi(); + const abi = dto.interface?.methods || this.mapper.getAbi(); const { method, params } = this.mapper.getMethodAndParams(abi, poolLocator, 'burn', dto); const response = await this.blockchain.sendTransaction( dto.signer, @@ -385,7 +385,7 @@ export class TokensService { async approval(dto: TokenApproval): Promise { const poolLocator = unpackPoolLocator(dto.poolLocator); const address = poolLocator.address ?? (await this.getContractAddress()); - const abi = dto.interface?.abi || this.mapper.getAbi(); + const abi = dto.interface?.methods || this.mapper.getAbi(); const { method, params } = this.mapper.getMethodAndParams(abi, poolLocator, 'approval', dto); const response = await this.blockchain.sendTransaction( dto.signer, diff --git a/test/suites/api.ts b/test/suites/api.ts index 2e17b1b..6920a3d 100644 --- a/test/suites/api.ts +++ b/test/suites/api.ts @@ -365,24 +365,24 @@ export default (context: TestContext) => { const request: CheckInterfaceRequest = { poolLocator: 'F1', format: InterfaceFormat.ABI, - abi: ERC1155MixedFungibleAbi, + methods: ERC1155MixedFungibleAbi, }; const response: CheckInterfaceResponse = { approval: { format: InterfaceFormat.ABI, - abi: [ + methods: [ ...ERC1155MixedFungibleAbi.filter(m => m.name === 'setApprovalForAllWithData'), ...ERC1155MixedFungibleAbi.filter(m => m.name === 'setApprovalForAll'), ], }, burn: { format: InterfaceFormat.ABI, - abi: ERC1155MixedFungibleAbi.filter(m => m.name === 'burn'), + methods: ERC1155MixedFungibleAbi.filter(m => m.name === 'burn'), }, mint: { format: InterfaceFormat.ABI, - abi: [ + methods: [ ...ERC1155MixedFungibleAbi.filter(m => m.name === 'mintFungible'), ...ERC1155MixedFungibleAbi.filter(m => m.name === 'mintNonFungibleWithURI'), ...ERC1155MixedFungibleAbi.filter(m => m.name === 'mintNonFungible'), @@ -390,7 +390,7 @@ export default (context: TestContext) => { }, transfer: { format: InterfaceFormat.ABI, - abi: ERC1155MixedFungibleAbi.filter(m => m.name === 'safeTransferFrom'), + methods: ERC1155MixedFungibleAbi.filter(m => m.name === 'safeTransferFrom'), }, };