From 2d0ab5ed80ca7e87ffcccd4ec8253de494964805 Mon Sep 17 00:00:00 2001 From: Denys S <150304777+dssei@users.noreply.github.com> Date: Tue, 4 Jun 2024 14:30:18 -0700 Subject: [PATCH] Adding withdrawMultipleDelegationRewards to distribution precompile (#182) * add withdrawMultipleDelegationRewards to distribution precompile * changeset --- .changeset/gentle-singers-run.md | 5 +++++ packages/evm/README.md | 7 ++++--- packages/evm/src/precompiles/distribution.ts | 16 +++++++++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 .changeset/gentle-singers-run.md diff --git a/.changeset/gentle-singers-run.md b/.changeset/gentle-singers-run.md new file mode 100644 index 00000000..a0e99cdb --- /dev/null +++ b/.changeset/gentle-singers-run.md @@ -0,0 +1,5 @@ +--- +"@sei-js/evm": minor +--- + +add withdrawMultipleDelegationRewards method to distribution precompile diff --git a/packages/evm/README.md b/packages/evm/README.md index fcba3691..ca6a1b5c 100644 --- a/packages/evm/README.md +++ b/packages/evm/README.md @@ -145,10 +145,11 @@ The Distribution precompile contract facilitates operations related to rewards w #### Functions -| Function Name | Input Parameters | Return Value | Description | -|---------------------------------------------------------------------------------------------------------------------------|------------------------------|------------------------|-----------------------------------------------------| -| [`setWithdrawAddress`](/sei-js/docs/interfaces/evm.DistributionPrecompileFunctions.html#setWithdrawAddress) | `withdrawAddress: ` `string` | `{ success: boolean }` | Sets the withdrawal address for rewards. | +| Function Name | Input Parameters | Return Value | Description | +|--------------------------------------------------------------------------------------------------|------------------------------|------------------------|-----------------------------------------------------| +| [`setWithdrawAddress`](/sei-js/docs/interfaces/evm.DistributionPrecompileFunctions.html#setWithdrawAddress) | `withdrawAddress: ` `string` | `{ success: boolean }` | Sets the withdrawal address for rewards. | | [`withdrawDelegationRewards`](/sei-js/docs/interfaces/evm.DistributionPrecompileFunctions.html#withdrawDelegationRewards) | `validator: ` `string` | `{ success: boolean }` | Withdraws delegation rewards for a given validator. | +| [`withdrawMultipleDelegationRewards`](/sei-js/docs/interfaces/evm.DistributionPrecompileFunctions.html#withdrawMultipleDelegationRewards) | `validators: ` `string[]` | `{ success: boolean }` | Withdraws delegation rewards for given validators. | #### Precompile Addresses 0x0000000000000000000000000000000000001007 diff --git a/packages/evm/src/precompiles/distribution.ts b/packages/evm/src/precompiles/distribution.ts index a7772c86..64940a02 100644 --- a/packages/evm/src/precompiles/distribution.ts +++ b/packages/evm/src/precompiles/distribution.ts @@ -21,6 +21,13 @@ export interface DistributionPrecompileFunctions { * @category Cosmos Interoperability */ withdrawDelegationRewards(validator: string): Promise<{ success: boolean }>; + /** + * Withdraws delegation rewards for a given validators. + * @param validators The validators for which to withdraw delegation rewards. + * @returns A Promise resolving to an object indicating the success of the transaction. + * @category Cosmos Interoperability + */ + withdrawMultipleDelegationRewards(validators: string[]): Promise<{ success: boolean }>; } /** Represents the typed contract instance for the DISTRIBUTION precompile contract. @@ -112,7 +119,14 @@ export const DISTRIBUTION_PRECOMPILE_ABI: Abi = [ outputs: [{ internalType: 'bool', name: 'success', type: 'bool' }], stateMutability: 'nonpayable', type: 'function' - } + }, + { + inputs: [{ internalType: 'string[]', name: 'validators', type: 'string[]' }], + name: 'withdrawMultipleDelegationRewards', + outputs: [{ internalType: 'bool', name: 'success', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function' + } ]; /**