@@ -44,6 +44,7 @@ import {
44
44
} from "@pythnetwork/pyth-solana-receiver" ;
45
45
46
46
import { LedgerNodeWallet } from "./ledger" ;
47
+ import { DEFAULT_PRIORITY_FEE_CONFIG } from "@pythnetwork/solana-utils" ;
47
48
48
49
export async function loadHotWalletOrLedger (
49
50
wallet : string ,
@@ -74,7 +75,7 @@ async function loadVaultFromOptions(options: any): Promise<MultisigVault> {
74
75
const vault : PublicKey = new PublicKey ( options . vault ) ;
75
76
76
77
const squad = SquadsMesh . endpoint (
77
- getPythClusterApiUrl ( multisigCluster ) ,
78
+ options . rpcUrlOverride ?? getPythClusterApiUrl ( multisigCluster ) ,
78
79
wallet
79
80
) ;
80
81
@@ -101,6 +102,10 @@ const multisigCommand = (name: string, description: string) =>
101
102
. option (
102
103
"-ldc, --ledger-derivation-change <number>" ,
103
104
"ledger derivation change to use"
105
+ )
106
+ . option (
107
+ "-u, --rpc-url-override <string>" ,
108
+ "RPC URL to override the default for the cluster. Make sure this is an RPC URL of the cluster where the multisig lives. For Pythnet proposals it should be a Solana Mainnet RPC URL."
104
109
) ;
105
110
106
111
program
@@ -154,7 +159,11 @@ multisigCommand(
154
159
} )
155
160
. instruction ( ) ;
156
161
157
- await vault . proposeInstructions ( [ proposalInstruction ] , targetCluster ) ;
162
+ await vault . proposeInstructions (
163
+ [ proposalInstruction ] ,
164
+ targetCluster ,
165
+ DEFAULT_PRIORITY_FEE_CONFIG
166
+ ) ;
158
167
} ) ;
159
168
160
169
multisigCommand (
@@ -178,7 +187,11 @@ multisigCommand(
178
187
} )
179
188
. instruction ( ) ;
180
189
181
- await vault . proposeInstructions ( [ proposalInstruction ] , targetCluster ) ;
190
+ await vault . proposeInstructions (
191
+ [ proposalInstruction ] ,
192
+ targetCluster ,
193
+ DEFAULT_PRIORITY_FEE_CONFIG
194
+ ) ;
182
195
} ) ;
183
196
184
197
multisigCommand (
@@ -209,7 +222,11 @@ multisigCommand(
209
222
} )
210
223
. instruction ( ) ;
211
224
212
- await vault . proposeInstructions ( [ proposalInstruction ] , targetCluster ) ;
225
+ await vault . proposeInstructions (
226
+ [ proposalInstruction ] ,
227
+ targetCluster ,
228
+ DEFAULT_PRIORITY_FEE_CONFIG
229
+ ) ;
213
230
} ) ;
214
231
215
232
multisigCommand ( "upgrade-program" , "Upgrade a program from a buffer" )
@@ -250,7 +267,11 @@ multisigCommand("upgrade-program", "Upgrade a program from a buffer")
250
267
] ,
251
268
} ;
252
269
253
- await vault . proposeInstructions ( [ proposalInstruction ] , cluster ) ;
270
+ await vault . proposeInstructions (
271
+ [ proposalInstruction ] ,
272
+ cluster ,
273
+ DEFAULT_PRIORITY_FEE_CONFIG
274
+ ) ;
254
275
} ) ;
255
276
256
277
multisigCommand (
@@ -286,7 +307,11 @@ multisigCommand(
286
307
] ,
287
308
} ;
288
309
289
- await vault . proposeInstructions ( [ proposalInstruction ] , cluster ) ;
310
+ await vault . proposeInstructions (
311
+ [ proposalInstruction ] ,
312
+ cluster ,
313
+ DEFAULT_PRIORITY_FEE_CONFIG
314
+ ) ;
290
315
} ) ;
291
316
292
317
multisigCommand (
@@ -315,7 +340,40 @@ multisigCommand(
315
340
[ ]
316
341
) ;
317
342
318
- await vault . proposeInstructions ( instructions , cluster ) ;
343
+ await vault . proposeInstructions (
344
+ instructions ,
345
+ cluster ,
346
+ DEFAULT_PRIORITY_FEE_CONFIG
347
+ ) ;
348
+ } ) ;
349
+
350
+ multisigCommand (
351
+ "delegate-stake" ,
352
+ "Delegate a stake account to the given vote account"
353
+ )
354
+ . requiredOption ( "-s, --stake-account <pubkey>" , "stake account to delegate" )
355
+ . requiredOption ( "-d, --vote-account <pubkey>" , "vote account to delegate to" )
356
+ . action ( async ( options : any ) => {
357
+ const vault = await loadVaultFromOptions ( options ) ;
358
+ const cluster : PythCluster = options . cluster ;
359
+ const authorizedPubkey : PublicKey = await vault . getVaultAuthorityPDA (
360
+ cluster
361
+ ) ;
362
+
363
+ const stakeAccount : PublicKey = new PublicKey ( options . stakeAccount ) ;
364
+ const voteAccount : PublicKey = new PublicKey ( options . voteAccount ) ;
365
+
366
+ const instructions = StakeProgram . delegate ( {
367
+ stakePubkey : stakeAccount ,
368
+ authorizedPubkey,
369
+ votePubkey : voteAccount ,
370
+ } ) . instructions ;
371
+
372
+ await vault . proposeInstructions (
373
+ instructions ,
374
+ cluster ,
375
+ DEFAULT_PRIORITY_FEE_CONFIG
376
+ ) ;
319
377
} ) ;
320
378
321
379
multisigCommand (
@@ -340,7 +398,11 @@ multisigCommand(
340
398
priceAccount,
341
399
} )
342
400
. instruction ( ) ;
343
- await vault . proposeInstructions ( [ proposalInstruction ] , cluster ) ;
401
+ await vault . proposeInstructions (
402
+ [ proposalInstruction ] ,
403
+ cluster ,
404
+ DEFAULT_PRIORITY_FEE_CONFIG
405
+ ) ;
344
406
} ) ;
345
407
346
408
program
@@ -431,7 +493,11 @@ multisigCommand("propose-token-transfer", "Propose token transfer")
431
493
BigInt ( amount ) * BigInt ( 10 ) ** BigInt ( mintAccount . decimals )
432
494
) ;
433
495
434
- await vault . proposeInstructions ( [ proposalInstruction ] , cluster ) ;
496
+ await vault . proposeInstructions (
497
+ [ proposalInstruction ] ,
498
+ cluster ,
499
+ DEFAULT_PRIORITY_FEE_CONFIG
500
+ ) ;
435
501
} ) ;
436
502
437
503
multisigCommand ( "propose-sol-transfer" , "Propose sol transfer" )
@@ -450,7 +516,11 @@ multisigCommand("propose-sol-transfer", "Propose sol transfer")
450
516
lamports : amount * LAMPORTS_PER_SOL ,
451
517
} ) ;
452
518
453
- await vault . proposeInstructions ( [ proposalInstruction ] , cluster ) ;
519
+ await vault . proposeInstructions (
520
+ [ proposalInstruction ] ,
521
+ cluster ,
522
+ DEFAULT_PRIORITY_FEE_CONFIG
523
+ ) ;
454
524
} ) ;
455
525
456
526
multisigCommand ( "propose-arbitrary-payload" , "Propose arbitrary payload" )
@@ -524,7 +594,11 @@ multisigCommand("add-and-delete", "Change the roster of the multisig")
524
594
}
525
595
}
526
596
527
- vault . proposeInstructions ( proposalInstructions , options . cluster ) ;
597
+ vault . proposeInstructions (
598
+ proposalInstructions ,
599
+ options . cluster ,
600
+ DEFAULT_PRIORITY_FEE_CONFIG
601
+ ) ;
528
602
} ) ;
529
603
530
604
/**
0 commit comments