From 44ea1248e36dde21d504466ce75c5c336e3fccaa Mon Sep 17 00:00:00 2001 From: Arno Simon Date: Thu, 1 Feb 2024 17:15:50 +0100 Subject: [PATCH] [SOF-2886] add cosmos chains restake-rewards functions (#88) * add cosmos chains restake-rewards functions * no restake rewards on dydx --- src/services/atom.ts | 23 +++++++++++++++++++++++ src/services/osmo.ts | 23 +++++++++++++++++++++++ src/services/tia.ts | 23 +++++++++++++++++++++++ 3 files changed, 69 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/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