From 6c08efc17496ce5cada164d7de440c9f39a9f512 Mon Sep 17 00:00:00 2001 From: Arno Simon Date: Thu, 1 Feb 2024 15:37:41 +0100 Subject: [PATCH] add cosmos chains restake-rewards functions --- src/services/atom.ts | 23 +++++++++++++++++++++++ src/services/dydx.ts | 23 +++++++++++++++++++++++ src/services/osmo.ts | 23 +++++++++++++++++++++++ src/services/tia.ts | 23 +++++++++++++++++++++++ 4 files changed, 92 insertions(+) diff --git a/src/services/atom.ts b/src/services/atom.ts index a9ddd54..ba9365f 100644 --- a/src/services/atom.ts +++ b/src/services/atom.ts @@ -67,6 +67,29 @@ export class AtomService extends Service { } + /** + * Craft atom restake rewards transaction + * @param pubkey wallet pubkey, this is different from the wallet address + * @param validatorAccount validator account address (wallet controlling the validator) + * @param validatorAddress validator address to which the delegation has been made + */ + async craftRestakeRewardsTx( + pubkey: string, + validatorAccount: string, + validatorAddress: string, + ): Promise { + + const { data } = await api.post( + `/v1/atom/transaction/restake-rewards`, + { + pubkey: pubkey, + validator_account: validatorAccount, + validator_address: validatorAddress, + }); + return data; + + } + /** * Craft atom unstaking transaction * @param pubkey wallet pubkey, this is different from the wallet address diff --git a/src/services/dydx.ts b/src/services/dydx.ts index 560ca91..3d02875 100644 --- a/src/services/dydx.ts +++ b/src/services/dydx.ts @@ -66,6 +66,29 @@ export class DydxService extends Service { } + /** + * Craft dydx restake rewards transaction + * @param pubkey wallet pubkey, this is different from the wallet address + * @param validatorAccount validator account address (wallet controlling the validator) + * @param validatorAddress validator address to which the delegation has been made + */ + async craftRestakeRewardsTx( + pubkey: string, + validatorAccount: string, + validatorAddress: string, + ): Promise { + + const { data } = await api.post( + `/v1/dydx/transaction/restake-rewards`, + { + pubkey: pubkey, + validator_account: validatorAccount, + validator_address: validatorAddress, + }); + return data; + + } + /** * Craft dydx unstaking transaction * @param pubkey wallet pubkey, this is different from the wallet address diff --git a/src/services/osmo.ts b/src/services/osmo.ts index 00ae1ba..9a8ad00 100644 --- a/src/services/osmo.ts +++ b/src/services/osmo.ts @@ -70,6 +70,29 @@ export class OsmoService extends Service { } + /** + * Craft osmo restake rewards transaction + * @param pubkey wallet pubkey, this is different from the wallet address + * @param validatorAccount validator account address (wallet controlling the validator) + * @param validatorAddress validator address to which the delegation has been made + */ + async craftRestakeRewardsTx( + pubkey: string, + validatorAccount: string, + validatorAddress: string, + ): Promise { + + const { data } = await api.post( + `/v1/osmo/transaction/restake-rewards`, + { + pubkey: pubkey, + validator_account: validatorAccount, + validator_address: validatorAddress, + }); + return data; + + } + /** * Craft osmo unstaking transaction * @param pubkey wallet pubkey, this is different from the wallet address diff --git a/src/services/tia.ts b/src/services/tia.ts index ad826e7..08bde02 100644 --- a/src/services/tia.ts +++ b/src/services/tia.ts @@ -66,6 +66,29 @@ export class TiaService extends Service { } + /** + * Craft tia restake rewards transaction + * @param pubkey wallet pubkey, this is different from the wallet address + * @param validatorAccount validator account address (wallet controlling the validator) + * @param validatorAddress validator address to which the delegation has been made + */ + async craftRestakeRewardsTx( + pubkey: string, + validatorAccount: string, + validatorAddress: string, + ): Promise { + + const { data } = await api.post( + `/v1/tia/transaction/restake-rewards`, + { + pubkey: pubkey, + validator_account: validatorAccount, + validator_address: validatorAddress, + }); + return data; + + } + /** * Craft tia unstaking transaction * @param pubkey wallet pubkey, this is different from the wallet address