1
1
// Usage: npx ts-node app/deploy/devnet/vesting/transferVesting.ts
2
2
3
3
import { Wallet , AnchorProvider } from "@coral-xyz/anchor" ;
4
- import { Connection , PublicKey , SystemProgram , Transaction } from "@solana/web3.js" ;
4
+ import {
5
+ Connection ,
6
+ PublicKey ,
7
+ SystemProgram ,
8
+ Transaction ,
9
+ } from "@solana/web3.js" ;
5
10
import {
6
11
VESTING_ADMIN_KEYPAIR ,
7
12
USER_AUTHORITY_KEYPAIR ,
8
13
USER2_AUTHORITY_KEYPAIR ,
9
14
WORMHOLE_TOKEN ,
10
15
RPC_NODE ,
11
16
} from "../constants" ;
12
- import { StakeAccountMetadata , StakeConnection } from "../../../StakeConnection" ;
17
+ import {
18
+ StakeAccountMetadata ,
19
+ StakeConnection ,
20
+ } from "../../../StakeConnection" ;
13
21
import BN from "bn.js" ;
14
22
import * as wasm from "@wormhole/staking-wasm" ;
15
23
import {
@@ -106,20 +114,19 @@ async function main() {
106
114
) [ 0 ] ;
107
115
108
116
let stakeAccountMetadataAddress =
109
- await vesterStakeConnection . getStakeMetadataAddress (
110
- vester . publicKey
111
- ) ;
112
- // console.log("stakeAccountMetadataAddress:", stakeAccountMetadataAddress)
117
+ await vesterStakeConnection . getStakeMetadataAddress ( vester . publicKey ) ;
118
+ // console.log("stakeAccountMetadataAddress:", stakeAccountMetadataAddress)
113
119
let newStakeAccountMetadataAddress =
114
- await vesterStakeConnection . getStakeMetadataAddress (
115
- newVester . publicKey ,
116
- ) ;
120
+ await vesterStakeConnection . getStakeMetadataAddress ( newVester . publicKey ) ;
117
121
118
122
let vestingBalanceAccount =
119
123
await vesterStakeConnection . program . account . vestingBalance . fetch (
120
124
vestingBalance ,
121
125
) ;
122
- console . log ( "vestingBalanceAccount.totalVestingBalance: " , vestingBalanceAccount . totalVestingBalance . toString ( ) )
126
+ console . log (
127
+ "vestingBalanceAccount.totalVestingBalance: " ,
128
+ vestingBalanceAccount . totalVestingBalance . toString ( ) ,
129
+ ) ;
123
130
124
131
let vesterDelegateStakeAccountOwner = await vesterStakeConnection . delegates (
125
132
vester . publicKey ,
@@ -157,7 +164,8 @@ async function main() {
157
164
vestingBalance,
158
165
newVestingBalance,
159
166
globalConfig : vesterStakeConnection . configAddress ,
160
- delegateStakeAccountCheckpoints : newVesterDelegateStakeAccountCheckpointsAddress ,
167
+ delegateStakeAccountCheckpoints :
168
+ newVesterDelegateStakeAccountCheckpointsAddress ,
161
169
delegateStakeAccountMetadata : newVesterDelegateStakeAccountMetadataAddress ,
162
170
stakeAccountMetadata : stakeAccountMetadataAddress ,
163
171
newStakeAccountMetadata : null ,
@@ -209,35 +217,35 @@ async function main() {
209
217
await vesterStakeConnection . provider . sendAndConfirm ( tx , [ vester ] ) ;
210
218
console . log ( "transferVesting completed successfully." ) ;
211
219
212
- // console.log(`Delegate WH tokens with vests`);
213
- // await vesterStakeConnection.delegateWithVest(
214
- // newVesterDelegateStakeAccountOwner,
215
- // WHTokenBalance.fromString("0"),
216
- // true,
217
- // config,
218
- // );
219
- // console.log(`WH tokens with vests successfully delegated`);
220
- // await sleep(3000);
221
- //
222
- // console.log("Starting transferVesting...");
223
- // await vesterStakeConnection.program.methods
224
- // .transferVesting()
225
- // .accountsPartial({
226
- // ...accounts
227
- // })
228
- // .rpc()
229
- // .then(confirm);
230
- // console.log("transferVesting completed successfully.");
231
- // await sleep(3000);
232
- //
233
- // console.log(`Delegate WH tokens with vests`);
234
- // await vesterStakeConnection.delegateWithVest(
235
- // vesterDelegateStakeAccountOwner,
236
- // WHTokenBalance.fromString("0"),
237
- // true,
238
- // config,
239
- // );
240
- // console.log(`WH tokens with vests successfully delegated`);
220
+ // console.log(`Delegate WH tokens with vests`);
221
+ // await vesterStakeConnection.delegateWithVest(
222
+ // newVesterDelegateStakeAccountOwner,
223
+ // WHTokenBalance.fromString("0"),
224
+ // true,
225
+ // config,
226
+ // );
227
+ // console.log(`WH tokens with vests successfully delegated`);
228
+ // await sleep(3000);
229
+ //
230
+ // console.log("Starting transferVesting...");
231
+ // await vesterStakeConnection.program.methods
232
+ // .transferVesting()
233
+ // .accountsPartial({
234
+ // ...accounts
235
+ // })
236
+ // .rpc()
237
+ // .then(confirm);
238
+ // console.log("transferVesting completed successfully.");
239
+ // await sleep(3000);
240
+ //
241
+ // console.log(`Delegate WH tokens with vests`);
242
+ // await vesterStakeConnection.delegateWithVest(
243
+ // vesterDelegateStakeAccountOwner,
244
+ // WHTokenBalance.fromString("0"),
245
+ // true,
246
+ // config,
247
+ // );
248
+ // console.log(`WH tokens with vests successfully delegated`);
241
249
242
250
vestingBalanceAccount =
243
251
await vesterStakeConnection . program . account . vestingBalance . fetch (
@@ -247,8 +255,14 @@ async function main() {
247
255
await vesterStakeConnection . program . account . vestingBalance . fetch (
248
256
newVestingBalance ,
249
257
) ;
250
- console . log ( "vestingBalanceAccount.totalVestingBalance: " , vestingBalanceAccount . totalVestingBalance . toString ( ) )
251
- console . log ( "newVestingBalanceAccount.totalVestingBalance: " , newVestingBalanceAccount . totalVestingBalance . toString ( ) )
258
+ console . log (
259
+ "vestingBalanceAccount.totalVestingBalance: " ,
260
+ vestingBalanceAccount . totalVestingBalance . toString ( ) ,
261
+ ) ;
262
+ console . log (
263
+ "newVestingBalanceAccount.totalVestingBalance: " ,
264
+ newVestingBalanceAccount . totalVestingBalance . toString ( ) ,
265
+ ) ;
252
266
253
267
let vesterStakeMetadata : StakeAccountMetadata =
254
268
await vesterStakeConnection . fetchStakeAccountMetadata ( vester . publicKey ) ;
@@ -258,8 +272,14 @@ async function main() {
258
272
false ,
259
273
) ;
260
274
261
- console . log ( "vesterStakeMetadata.recordedVestingBalance: " , vesterStakeMetadata . recordedVestingBalance . toString ( ) )
262
- console . log ( "vesterStakeMetadata.recordedBalance: " , vesterStakeMetadata . recordedBalance . toString ( ) )
275
+ console . log (
276
+ "vesterStakeMetadata.recordedVestingBalance: " ,
277
+ vesterStakeMetadata . recordedVestingBalance . toString ( ) ,
278
+ ) ;
279
+ console . log (
280
+ "vesterStakeMetadata.recordedBalance: " ,
281
+ vesterStakeMetadata . recordedBalance . toString ( ) ,
282
+ ) ;
263
283
}
264
284
265
285
main ( ) ;
0 commit comments