Skip to content

Commit 9840226

Browse files
authored
cosmos - support grantee address for restaking (#111)
1 parent d0fd577 commit 9840226

File tree

7 files changed

+37
-7
lines changed

7 files changed

+37
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kilnfi/sdk",
3-
"version": "2.18.1",
3+
"version": "2.19.0",
44
"autor": "Kiln <[email protected]> (https://kiln.fi)",
55
"license": "BUSL-1.1",
66
"description": "JavaScript sdk for Kiln API",

src/services/atom.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,23 @@ export class AtomService extends Service {
2828
* @param validatorAddress validator address to delegate to
2929
* @param amountAtom how many tokens to stake in ATOM
3030
* @param restakeRewards If enabled, the rewards will be automatically restaked
31+
* @param granteeAddress validator grantee address
3132
*/
3233
async craftStakeTx(
3334
accountId: string,
3435
pubkey: string,
3536
validatorAddress: string,
3637
amountAtom: number,
3738
restakeRewards: boolean = false,
39+
granteeAddress?: string,
3840
): Promise<CosmosTx> {
3941
const { data } = await api.post<CosmosTx>(`/v1/atom/transaction/stake`, {
4042
account_id: accountId,
4143
pubkey: pubkey,
4244
validator: validatorAddress,
4345
amount_uatom: this.atomToUatom(amountAtom.toString()),
4446
restake_rewards: restakeRewards,
47+
grantee_address: granteeAddress,
4548
});
4649
return data;
4750
}
@@ -63,11 +66,13 @@ export class AtomService extends Service {
6366
* Craft atom restake rewards transaction
6467
* @param pubkey wallet pubkey, this is different from the wallet address
6568
* @param validatorAddress validator address to which the delegation has been made
69+
* @param granteeAddress validator grantee address
6670
*/
67-
async craftRestakeRewardsTx(pubkey: string, validatorAddress: string): Promise<CosmosTx> {
71+
async craftRestakeRewardsTx(pubkey: string, validatorAddress: string, granteeAddress: string): Promise<CosmosTx> {
6872
const { data } = await api.post<CosmosTx>(`/v1/atom/transaction/restake-rewards`, {
6973
pubkey: pubkey,
7074
validator_address: validatorAddress,
75+
grantee_address: granteeAddress,
7176
});
7277
return data;
7378
}

src/services/fet.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,23 @@ export class FetService extends Service {
2828
* @param validatorAddress validator address to delegate to
2929
* @param amountFet how many tokens to stake in FET
3030
* @param restakeRewards If enabled, the rewards will be automatically restaked
31+
* @param granteeAddress validator grantee address
3132
*/
3233
async craftStakeTx(
3334
accountId: string,
3435
pubkey: string,
3536
validatorAddress: string,
3637
amountFet: number,
3738
restakeRewards: boolean = false,
39+
granteeAddress?: string,
3840
): Promise<CosmosTx> {
3941
const { data } = await api.post<CosmosTx>(`/v1/fet/transaction/stake`, {
4042
account_id: accountId,
4143
pubkey: pubkey,
4244
validator: validatorAddress,
4345
amount_afet: this.fetToAfet(amountFet.toString()),
4446
restake_rewards: restakeRewards,
47+
grantee_address: granteeAddress,
4548
});
4649
return data;
4750
}
@@ -63,11 +66,13 @@ export class FetService extends Service {
6366
* Craft fetch.ai restake rewards transaction
6467
* @param pubkey wallet pubkey, this is different from the wallet address
6568
* @param validatorAddress validator address to which the delegation has been made
69+
* @param granteeAddress validator grantee address
6670
*/
67-
async craftRestakeRewardsTx(pubkey: string, validatorAddress: string): Promise<CosmosTx> {
71+
async craftRestakeRewardsTx(pubkey: string, validatorAddress: string, granteeAddress: string): Promise<CosmosTx> {
6872
const { data } = await api.post<CosmosTx>(`/v1/fet/transaction/restake-rewards`, {
6973
pubkey: pubkey,
7074
validator_address: validatorAddress,
75+
grantee_address: granteeAddress,
7176
});
7277
return data;
7378
}

src/services/inj.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,23 @@ export class InjService extends Service {
2727
* @param validatorAddress validator address to delegate to
2828
* @param amountInj how many tokens to stake in INJ
2929
* @param restakeRewards If enabled, the rewards will be automatically restaked
30+
* @param granteeAddress validator grantee address
3031
*/
3132
async craftStakeTx(
3233
accountId: string,
3334
pubkey: string,
3435
validatorAddress: string,
3536
amountInj: number,
3637
restakeRewards: boolean = false,
38+
granteeAddress?: string,
3739
): Promise<CosmosTx> {
3840
const { data } = await api.post<CosmosTx>(`/v1/inj/transaction/stake`, {
3941
account_id: accountId,
4042
pubkey: pubkey,
4143
validator: validatorAddress,
4244
amount_inj: this.injToAinj(amountInj.toString()),
4345
restake_rewards: restakeRewards,
46+
grantee_address: granteeAddress,
4447
});
4548
return data;
4649
}
@@ -62,11 +65,13 @@ export class InjService extends Service {
6265
* Craft inj restake rewards transaction
6366
* @param pubkey wallet pubkey, this is different from the wallet address
6467
* @param validatorAddress validator address to which the delegation has been made
68+
* @param granteeAddress validator grantee address
6569
*/
66-
async craftRestakeRewardsTx(pubkey: string, validatorAddress: string): Promise<CosmosTx> {
70+
async craftRestakeRewardsTx(pubkey: string, validatorAddress: string, granteeAddress: string): Promise<CosmosTx> {
6771
const { data } = await api.post<CosmosTx>(`/v1/inj/transaction/restake-rewards`, {
6872
pubkey: pubkey,
6973
validator_address: validatorAddress,
74+
grantee_address: granteeAddress,
7075
});
7176
return data;
7277
}

src/services/osmo.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,23 @@ export class OsmoService extends Service {
2828
* @param validatorAddress validator address to delegate to
2929
* @param amountOsmo how many tokens to stake in OSMO
3030
* @param restakeRewards If enabled, the rewards will be automatically restaked
31+
* @param granteeAddress validator grantee address
3132
*/
3233
async craftStakeTx(
3334
accountId: string,
3435
pubkey: string,
3536
validatorAddress: string,
3637
amountOsmo: number,
3738
restakeRewards: boolean = false,
39+
granteeAddress?: string,
3840
): Promise<CosmosTx> {
3941
const { data } = await api.post<CosmosTx>(`/v1/osmo/transaction/stake`, {
4042
account_id: accountId,
4143
pubkey: pubkey,
4244
validator: validatorAddress,
4345
amount_uosmo: this.osmoToUosmo(amountOsmo.toString()),
4446
restake_rewards: restakeRewards,
47+
grantee_address: granteeAddress,
4548
});
4649
return data;
4750
}
@@ -63,11 +66,13 @@ export class OsmoService extends Service {
6366
* Craft osmo restake rewards transaction
6467
* @param pubkey wallet pubkey, this is different from the wallet address
6568
* @param validatorAddress validator address to which the delegation has been made
69+
* @param granteeAddress validator grantee address
6670
*/
67-
async craftRestakeRewardsTx(pubkey: string, validatorAddress: string): Promise<CosmosTx> {
71+
async craftRestakeRewardsTx(pubkey: string, validatorAddress: string, granteeAddress: string): Promise<CosmosTx> {
6872
const { data } = await api.post<CosmosTx>(`/v1/osmo/transaction/restake-rewards`, {
6973
pubkey: pubkey,
7074
validator_address: validatorAddress,
75+
grantee_address: granteeAddress,
7176
});
7277
return data;
7378
}

src/services/tia.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,23 @@ export class TiaService extends Service {
2727
* @param validatorAddress validator address to delegate to
2828
* @param amountTia how many tokens to stake in TIA
2929
* @param restakeRewards If enabled, the rewards will be automatically restaked
30+
* @param granteeAddress validator grantee address
3031
*/
3132
async craftStakeTx(
3233
accountId: string,
3334
pubkey: string,
3435
validatorAddress: string,
3536
amountTia: number,
3637
restakeRewards: boolean = false,
38+
granteeAddress?: string,
3739
): Promise<CosmosTx> {
3840
const { data } = await api.post<CosmosTx>(`/v1/tia/transaction/stake`, {
3941
account_id: accountId,
4042
pubkey: pubkey,
4143
validator: validatorAddress,
4244
amount_utia: this.tiaToUtia(amountTia.toString()),
4345
restake_rewards: restakeRewards,
46+
grantee_address: granteeAddress,
4447
});
4548
return data;
4649
}
@@ -62,11 +65,13 @@ export class TiaService extends Service {
6265
* Craft tia restake rewards transaction
6366
* @param pubkey wallet pubkey, this is different from the wallet address
6467
* @param validatorAddress validator address to which the delegation has been made
68+
* @param granteeAddress validator grantee address
6569
*/
66-
async craftRestakeRewardsTx(pubkey: string, validatorAddress: string): Promise<CosmosTx> {
70+
async craftRestakeRewardsTx(pubkey: string, validatorAddress: string, granteeAddress: string): Promise<CosmosTx> {
6771
const { data } = await api.post<CosmosTx>(`/v1/tia/transaction/restake-rewards`, {
6872
pubkey: pubkey,
6973
validator_address: validatorAddress,
74+
grantee_address: granteeAddress,
7075
});
7176
return data;
7277
}

src/services/zeta.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,23 @@ export class ZetaService extends Service {
2828
* @param validatorAddress validator address to delegate to
2929
* @param amountZeta how many tokens to stake in ZETA
3030
* @param restakeRewards If enabled, the rewards will be automatically restaked
31+
* @param granteeAddress validator grantee address
3132
*/
3233
async craftStakeTx(
3334
accountId: string,
3435
pubkey: string,
3536
validatorAddress: string,
3637
amountZeta: number,
3738
restakeRewards: boolean = false,
39+
granteeAddress?: string,
3840
): Promise<CosmosTx> {
3941
const { data } = await api.post<CosmosTx>(`/v1/zeta/transaction/stake`, {
4042
account_id: accountId,
4143
pubkey: pubkey,
4244
validator: validatorAddress,
4345
amount_azeta: this.zetaToAZeta(amountZeta.toString()),
4446
restake_rewards: restakeRewards,
47+
grantee_address: granteeAddress,
4548
});
4649
return data;
4750
}
@@ -63,11 +66,13 @@ export class ZetaService extends Service {
6366
* Craft a Zetachain restake rewards transaction
6467
* @param pubkey wallet pubkey, this is different from the wallet address
6568
* @param validatorAddress validator address to which the delegation has been made
69+
* @param granteeAddress validator grantee address
6670
*/
67-
async craftRestakeRewardsTx(pubkey: string, validatorAddress: string): Promise<CosmosTx> {
71+
async craftRestakeRewardsTx(pubkey: string, validatorAddress: string, granteeAddress: string): Promise<CosmosTx> {
6872
const { data } = await api.post<CosmosTx>(`/v1/zeta/transaction/restake-rewards`, {
6973
pubkey: pubkey,
7074
validator_address: validatorAddress,
75+
grantee_address: granteeAddress,
7176
});
7277
return data;
7378
}

0 commit comments

Comments
 (0)