Skip to content

Commit

Permalink
[SOF-2886] add cosmos chains restake-rewards functions (#88)
Browse files Browse the repository at this point in the history
* add cosmos chains restake-rewards functions

* no restake rewards on dydx
  • Loading branch information
nooxx authored Feb 1, 2024
1 parent 222094e commit 44ea124
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/services/atom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<CosmosTx> {

const { data } = await api.post<CosmosTx>(
`/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
Expand Down
23 changes: 23 additions & 0 deletions src/services/osmo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<CosmosTx> {

const { data } = await api.post<CosmosTx>(
`/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
Expand Down
23 changes: 23 additions & 0 deletions src/services/tia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<CosmosTx> {

const { data } = await api.post<CosmosTx>(
`/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
Expand Down

0 comments on commit 44ea124

Please sign in to comment.