Skip to content

Commit 44ea124

Browse files
authored
[SOF-2886] add cosmos chains restake-rewards functions (#88)
* add cosmos chains restake-rewards functions * no restake rewards on dydx
1 parent 222094e commit 44ea124

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

src/services/atom.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,29 @@ export class AtomService extends Service {
6767

6868
}
6969

70+
/**
71+
* Craft atom restake rewards transaction
72+
* @param pubkey wallet pubkey, this is different from the wallet address
73+
* @param validatorAccount validator account address (wallet controlling the validator)
74+
* @param validatorAddress validator address to which the delegation has been made
75+
*/
76+
async craftRestakeRewardsTx(
77+
pubkey: string,
78+
validatorAccount: string,
79+
validatorAddress: string,
80+
): Promise<CosmosTx> {
81+
82+
const { data } = await api.post<CosmosTx>(
83+
`/v1/atom/transaction/restake-rewards`,
84+
{
85+
pubkey: pubkey,
86+
validator_account: validatorAccount,
87+
validator_address: validatorAddress,
88+
});
89+
return data;
90+
91+
}
92+
7093
/**
7194
* Craft atom unstaking transaction
7295
* @param pubkey wallet pubkey, this is different from the wallet address

src/services/osmo.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,29 @@ export class OsmoService extends Service {
7070

7171
}
7272

73+
/**
74+
* Craft osmo restake rewards transaction
75+
* @param pubkey wallet pubkey, this is different from the wallet address
76+
* @param validatorAccount validator account address (wallet controlling the validator)
77+
* @param validatorAddress validator address to which the delegation has been made
78+
*/
79+
async craftRestakeRewardsTx(
80+
pubkey: string,
81+
validatorAccount: string,
82+
validatorAddress: string,
83+
): Promise<CosmosTx> {
84+
85+
const { data } = await api.post<CosmosTx>(
86+
`/v1/osmo/transaction/restake-rewards`,
87+
{
88+
pubkey: pubkey,
89+
validator_account: validatorAccount,
90+
validator_address: validatorAddress,
91+
});
92+
return data;
93+
94+
}
95+
7396
/**
7497
* Craft osmo unstaking transaction
7598
* @param pubkey wallet pubkey, this is different from the wallet address

src/services/tia.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,29 @@ export class TiaService extends Service {
6666

6767
}
6868

69+
/**
70+
* Craft tia restake rewards transaction
71+
* @param pubkey wallet pubkey, this is different from the wallet address
72+
* @param validatorAccount validator account address (wallet controlling the validator)
73+
* @param validatorAddress validator address to which the delegation has been made
74+
*/
75+
async craftRestakeRewardsTx(
76+
pubkey: string,
77+
validatorAccount: string,
78+
validatorAddress: string,
79+
): Promise<CosmosTx> {
80+
81+
const { data } = await api.post<CosmosTx>(
82+
`/v1/tia/transaction/restake-rewards`,
83+
{
84+
pubkey: pubkey,
85+
validator_account: validatorAccount,
86+
validator_address: validatorAddress,
87+
});
88+
return data;
89+
90+
}
91+
6992
/**
7093
* Craft tia unstaking transaction
7194
* @param pubkey wallet pubkey, this is different from the wallet address

0 commit comments

Comments
 (0)