diff --git a/src/abis/core-mx-life-bonding-sc.abi.json b/src/abis/core-mx-life-bonding-sc.abi.json index bd64756..056fe21 100644 --- a/src/abis/core-mx-life-bonding-sc.abi.json +++ b/src/abis/core-mx-life-bonding-sc.abi.json @@ -185,6 +185,22 @@ } ] }, + { + "name": "getCompensationBlacklist", + "mutability": "readonly", + "inputs": [ + { + "name": "compensation_id", + "type": "u64" + } + ], + "outputs": [ + { + "type": "variadic
", + "multi_result": true + } + ] + }, { "name": "getBond", "mutability": "readonly", @@ -369,6 +385,38 @@ } ] }, + { + "name": "setBlacklist", + "mutability": "mutable", + "inputs": [ + { + "name": "compensation_id", + "type": "u64" + }, + { + "name": "addresses", + "type": "variadic
", + "multi_arg": true + } + ], + "outputs": [] + }, + { + "name": "removeBlacklist", + "mutability": "mutable", + "inputs": [ + { + "name": "compensation_id", + "type": "u64" + }, + { + "name": "addresses", + "type": "variadic
", + "multi_arg": true + } + ], + "outputs": [] + }, { "name": "initiateRefund", "mutability": "mutable", diff --git a/src/bond.ts b/src/bond.ts index 4cf676b..7881de3 100644 --- a/src/bond.ts +++ b/src/bond.ts @@ -106,6 +106,34 @@ export class BondContract extends Contract { } } + /** + * Returns a list of addresses that are blacklisted from claiming compensations + * @param compensationId compensaton id to query + * @returns + */ + async viewCompensationBlacklist(compensationId: number): Promise { + const interaction = this.contract.methodsExplicit.getCompensationBlacklist([ + new U64Value(compensationId) + ]); + const query = interaction.buildQuery(); + const queryResponse = await this.networkProvider.queryContract(query); + const endpointDefinition = interaction.getEndpoint(); + const { firstValue, returnCode } = new ResultsParser().parseQueryResponse( + queryResponse, + endpointDefinition + ); + if (returnCode.isSuccess()) { + return firstValue + ?.valueOf() + .map((address: any) => new Address(address).bech32()); + } else { + throw new ErrContractQuery( + 'viewCompensationBlacklist', + returnCode.toString() + ); + } + } + /** * Returns the contract lock periods and bond amounts */ @@ -503,6 +531,14 @@ export class BondContract extends Contract { throw new Error('Not implemented'); } + setBlacklist(senderAddress: IAddress, addresses: IAddress[]) { + throw new Error('Not implemented'); + } + + removeBlacklist(senderAddress: IAddress, addresses: IAddress[]) { + throw new Error('Not implemented'); + } + removeAcceptedCallers(senderAddress: IAddress, addresses: IAddress[]) { throw new Error('Not implemented'); }