Skip to content

Commit 4161e18

Browse files
authored
add TON whitelist and send from vesting contract (#103)
* add TON whitelist and send from vesting contract * nit
1 parent 8fd62df commit 4161e18

File tree

1 file changed

+49
-8
lines changed

1 file changed

+49
-8
lines changed

src/services/ton.ts

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ export class TonService extends Service {
1313
/**
1414
* Craft TON staking transaction to a single nomination pool
1515
* @param accountId id of the kiln account to use for the stake transaction
16-
* @param walletAddress used to create the stake account and retrieve rewards in the future
17-
* @param poolAddress vote account address of the validator that you wish to delegate to
16+
* @param walletAddress sender of the transaction
17+
* @param poolAddress single nomination pool address
1818
* @param amountTon how much to stake in TON
1919
*/
2020
async craftStakeSingleNominationPoolTx(
@@ -35,8 +35,8 @@ export class TonService extends Service {
3535
/**
3636
* Craft TON staking transaction to a nomination pool
3737
* @param accountId id of the kiln account to use for the stake transaction
38-
* @param walletAddress used to create the stake account and retrieve rewards in the future
39-
* @param poolAddress vote account address of the validator that you wish to delegate to
38+
* @param walletAddress sender of the transaction
39+
* @param poolAddress nomination pool address
4040
* @param amountTon how much to stake in TON
4141
*/
4242
async craftStakeNominationPoolTx(
@@ -56,8 +56,8 @@ export class TonService extends Service {
5656

5757
/**
5858
* Craft TON unstake transaction from a single nomination pool
59-
* @param walletAddress used to create the stake account and retrieve rewards in the future
60-
* @param poolAddress vote account address of the validator that you wish to delegate to
59+
* @param walletAddress sender of the transaction
60+
* @param poolAddress single nomination pool address
6161
* @param amountTon how much to stake in TON
6262
*/
6363
async craftUnstakeSingleNominationPoolTx(
@@ -75,8 +75,8 @@ export class TonService extends Service {
7575

7676
/**
7777
* Craft TON unstake transaction from a nomination pool
78-
* @param walletAddress used to create the stake account and retrieve rewards in the future
79-
* @param poolAddress vote account address of the validator that you wish to delegate to
78+
* @param walletAddress sender of the transaction
79+
* @param poolAddress nomination pool address
8080
*/
8181
async craftUnstakeNominationPoolTx(walletAddress: string, poolAddress: string): Promise<TonTx> {
8282
const { data } = await api.post<TonTx>(`/v1/ton/transaction/unstake-nomination-pool`, {
@@ -86,6 +86,47 @@ export class TonService extends Service {
8686
return data;
8787
}
8888

89+
/**
90+
* Craft TON whitelist tx for vesting contract
91+
* @param walletAddress sender of the transaction
92+
* @param vestingContractAddress vesting contract address
93+
* @param addresses addresses to whitelist
94+
*/
95+
async craftWhitelistVestingContractTx(
96+
walletAddress: string,
97+
vestingContractAddress: string,
98+
addresses: string[],
99+
): Promise<TonTx> {
100+
const { data } = await api.post<TonTx>(`/v1/ton/transaction/whitelist-vesting-contract`, {
101+
wallet: walletAddress,
102+
vesting_contract_address: vestingContractAddress,
103+
addresses: addresses,
104+
});
105+
return data;
106+
}
107+
108+
/**
109+
* Craft TON send from a vesting contract tx
110+
* @param walletAddress sender of the transaction
111+
* @param vestingContractAddress vesting contract address
112+
* @param destinationAddress the destination to which the TON will be sent to
113+
* @param amountTon the amount of TON to send
114+
*/
115+
async craftSendFromVestingContractTx(
116+
walletAddress: string,
117+
vestingContractAddress: string,
118+
destinationAddress: string,
119+
amountTon: number,
120+
): Promise<TonTx> {
121+
const { data } = await api.post<TonTx>(`/v1/ton/transaction/send-from-vesting-contract`, {
122+
wallet: walletAddress,
123+
vesting_contract_address: vestingContractAddress,
124+
destination_address: destinationAddress,
125+
amount_nanoton: this.tonToNanoTon(amountTon.toString()),
126+
});
127+
return data;
128+
}
129+
89130
/**
90131
* Sign transaction with given integration
91132
* @param integration custody solution to sign with

0 commit comments

Comments
 (0)