@@ -50,7 +50,7 @@ import {
5050} from '../../sdk/src' ;
5151import { createInitializeConfidentialTransferMintInstruction } from './confidential-transfers' ;
5252import { Program , BN } from '@coral-xyz/anchor' ;
53- import { anchorProvider , keysFromEnv , NttManager } from './utils' ;
53+ import { anchorProvider , keysFromEnv , NttManager , updatePortalMint } from './utils' ;
5454import { MerkleTree } from '../../sdk/src/merkle' ;
5555import { bs58 } from '@coral-xyz/anchor/dist/cjs/utils/bytes' ;
5656import { sha256 } from '@noble/hashes/sha2' ;
@@ -84,7 +84,7 @@ async function main() {
8484 . command ( 'print-addresses' )
8585 . description ( 'Print the addresses of all the relevant programs and accounts' )
8686 . action ( ( ) => {
87- const [ mMint , wmMint , multisig ] = keysFromEnv ( [ 'M_MINT_KEYPAIR' , 'WM_MINT_KEYPAIR' , 'M_MINT_MULTISIG_KEYPAIR '] ) ;
87+ const [ mMint , wmMint ] = keysFromEnv ( [ 'M_MINT_KEYPAIR' , 'WM_MINT_KEYPAIR' ] ) ;
8888 const [ portalTokenAuthPda ] = PublicKey . findProgramAddressSync ( [ Buffer . from ( 'token_authority' ) ] , PROGRAMS . portal ) ;
8989 const [ earnTokenAuthPda ] = PublicKey . findProgramAddressSync ( [ Buffer . from ( 'token_authority' ) ] , PROGRAMS . earn ) ;
9090 const [ portalEmitter ] = PublicKey . findProgramAddressSync ( [ Buffer . from ( 'emitter' ) ] , PROGRAMS . portal ) ;
@@ -100,7 +100,6 @@ async function main() {
100100 'Earn Program' : PROGRAMS . earn ,
101101 'Swap Program' : PROGRAMS . swap ,
102102 'M Mint' : mMint . publicKey ,
103- 'M Mint Multisig' : multisig . publicKey ,
104103 'Portal Token Authority' : portalTokenAuthPda ,
105104 'Earn Token Authority' : earnTokenAuthPda ,
106105 'wM Mint' : wmMint . publicKey ,
@@ -367,92 +366,14 @@ async function main() {
367366
368367 program . command ( 'update-portal-mint' ) . action ( async ( ) => {
369368 const [ payer , mint ] = keysFromEnv ( [ 'PAYER_KEYPAIR' , 'M_MINT_KEYPAIR' ] ) ;
370- const admin = process . env . SQUADS_VAULT ? new PublicKey ( process . env . SQUADS_VAULT ) : payer . publicKey ;
371369 const { ntt } = NttManager ( connection , payer , mint . publicKey ) ;
372370
373- const tx = new Transaction ( ) . add (
374- new TransactionInstruction ( {
375- programId : PROGRAMS . portal ,
376- keys : [
377- {
378- pubkey : admin ,
379- isSigner : true ,
380- isWritable : false ,
381- } ,
382- {
383- pubkey : ntt . pdas . configAccount ( ) ,
384- isSigner : false ,
385- isWritable : true ,
386- } ,
387- {
388- pubkey : mint . publicKey ,
389- isSigner : false ,
390- isWritable : false ,
391- } ,
392- ] ,
393- data : Buffer . concat ( [ Buffer . from ( sha256 ( 'global:set_mint' ) . subarray ( 0 , 8 ) ) ] ) ,
394- } ) ,
395- ) ;
396-
397- tx . feePayer = admin ;
398- tx . recentBlockhash = ( await connection . getLatestBlockhash ( ) ) . blockhash ;
399-
371+ let owner = payer . publicKey ;
400372 if ( process . env . SQUADS_VAULT ) {
401- const b = tx . serialize ( { verifySignatures : false } ) ;
402- console . log ( 'Transaction:' , {
403- b64 : b . toString ( 'base64' ) ,
404- b58 : bs58 . encode ( b ) ,
405- } ) ;
406- } else {
407- const sig = await connection . sendTransaction ( tx , [ payer ] ) ;
408- console . log ( `Updated mint: ${ sig } ` ) ;
373+ owner = new PublicKey ( process . env . SQUADS_VAULT ) ;
409374 }
410- } ) ;
411-
412- program . command ( 'initialize-portal-resolver' ) . action ( async ( ) => {
413- const [ payer , mint ] = keysFromEnv ( [ 'PAYER_KEYPAIR' , 'M_MINT_KEYPAIR' ] ) ;
414- const admin = process . env . SQUADS_VAULT ? new PublicKey ( process . env . SQUADS_VAULT ) : payer . publicKey ;
415- const { ntt } = NttManager ( connection , payer , mint . publicKey ) ;
416- const swapLUT = new PublicKey ( '9JLRqBqkznKiSoNfotA4ywSRdnWb2fE76SiFrAfkaRCD' ) ;
417-
418- const tx = new Transaction ( ) . add (
419- new TransactionInstruction ( {
420- programId : PROGRAMS . portal ,
421- keys : [
422- {
423- pubkey : admin ,
424- isSigner : true ,
425- isWritable : true ,
426- } ,
427- {
428- pubkey : ntt . pdas . configAccount ( ) ,
429- isSigner : false ,
430- isWritable : true ,
431- } ,
432- {
433- pubkey : PublicKey . findProgramAddressSync (
434- [ Buffer . from ( 'executor-account-resolver:result' ) ] ,
435- PROGRAMS . portal ,
436- ) [ 0 ] ,
437- isSigner : false ,
438- isWritable : true ,
439- } ,
440- {
441- pubkey : SystemProgram . programId ,
442- isSigner : false ,
443- isWritable : false ,
444- } ,
445- ] ,
446- data : Buffer . concat ( [
447- Buffer . from ( sha256 ( 'global:initialize_resolver_accounts' ) . subarray ( 0 , 8 ) ) ,
448- Buffer . from ( [ 1 ] ) ,
449- swapLUT . toBuffer ( ) ,
450- ] ) ,
451- } ) ,
452- ) ;
453375
454- tx . feePayer = admin ;
455- tx . recentBlockhash = ( await connection . getLatestBlockhash ( ) ) . blockhash ;
376+ const tx = new Transaction ( ) . add ( updatePortalMint ( owner , ntt . pdas . configAccount ( ) , mint . publicKey ) ) ;
456377
457378 if ( process . env . SQUADS_VAULT ) {
458379 const b = tx . serialize ( { verifySignatures : false } ) ;
@@ -462,7 +383,7 @@ async function main() {
462383 } ) ;
463384 } else {
464385 const sig = await connection . sendTransaction ( tx , [ payer ] ) ;
465- console . log ( `Initialized resolver : ${ sig } ` ) ;
386+ console . log ( `Paused : ${ sig } ` ) ;
466387 }
467388 } ) ;
468389
@@ -588,6 +509,25 @@ async function main() {
588509 }
589510 } ) ;
590511
512+ program . command ( 'pause-bridging' ) . action ( async ( ) => {
513+ const [ payer , mint ] = keysFromEnv ( [ 'PAYER_KEYPAIR' , 'M_MINT_KEYPAIR' ] ) ;
514+ const { ntt, sender } = NttManager ( connection , payer , mint . publicKey ) ;
515+
516+ const pauseTxn = ( await ntt . pause ( sender ) . next ( ) ) . value as SolanaUnsignedTransaction < 'Mainnet' , 'Solana' > ;
517+ const tx = pauseTxn . transaction . transaction as Transaction ;
518+
519+ if ( process . env . SQUADS_VAULT ) {
520+ const b = tx . serialize ( { verifySignatures : false } ) ;
521+ console . log ( 'Transaction:' , {
522+ b64 : b . toString ( 'base64' ) ,
523+ b58 : bs58 . encode ( b ) ,
524+ } ) ;
525+ } else {
526+ const sig = await connection . sendTransaction ( tx , [ payer ] ) ;
527+ console . log ( `Paused: ${ sig } ` ) ;
528+ }
529+ } ) ;
530+
591531 program
592532 . command ( 'pause-bridging' )
593533 . option ( '-u, --unpause' , 'Unpause if already paused' )
0 commit comments