Skip to content

Commit e09ef93

Browse files
committed
Update token-wrap escrow docs
1 parent d47d589 commit e09ef93

File tree

1 file changed

+36
-42
lines changed

1 file changed

+36
-42
lines changed

docs/content/docs/token-wrap.mdx

Lines changed: 36 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ address of the original *unwrapped* token mint. This allows anyone to easily det
3131
corresponding to a wrapped token, facilitating unwrapping.
3232

3333
2. **`Wrap`:** This operation accepts deposits of unwrapped tokens and mints wrapped tokens.
34-
* Unwrapped tokens are transferred from the user's account to an escrow account owned by the wrapped mint authority (different for every mint). Any unwrapped token account whose owner is a PDA controlled by the Token Wrap program can be used.
34+
* Unwrapped tokens are transferred from the user's account to a specific escrow Associated Token Account (ATA). This ATA is for the unwrapped mint, and its authority is a Program Derived Address (PDA) controlled by the Token Wrap program (unique for each wrapped mint).
3535
* An equivalent amount of wrapped tokens is minted to the user's wrapped token account.
3636

3737
3. **`Unwrap`:** This operation burns wrapped tokens and releases unwrapped token deposits.
@@ -192,13 +192,15 @@ To interact with wrapped tokens, you need to know the PDAs (Program Derived Addr
192192
<Tab value="CLI">
193193
```console
194194
$ UNWRAPPED_MINT_ADDRESS=BVpjjYmSgSPZbFGTXe52NYXApsDNQJRe2qQF1hQft85e
195+
$ UNWRAPPED_TOKEN_PROGRAM=TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
195196
$ WRAPPED_TOKEN_PROGRAM=TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb
196197

197-
$ spl-token-wrap find-pdas $UNWRAPPED_MINT_ADDRESS $WRAPPED_TOKEN_PROGRAM
198+
$ spl-token-wrap find-pdas $UNWRAPPED_MINT_ADDRESS $UNWRAPPED_TOKEN_PROGRAM $WRAPPED_TOKEN_PROGRAM
198199

199200
Wrapped mint address: B8HbxGU4npjgjMX5xJFR2FYkgvAHdZqyVb8MyFvdsuNM
200201
Wrapped mint authority: 8WdYPmtq8c6ZfmHMZUwCQL2E8qVHEV8rG9MXkyax3joR
201202
Wrapped backpointer address: CNjr898vsBdzWxrJApMSAQac4A7o7qLRcSseTb56X7C9
203+
Unwrapped escrow address: QrzXtFZedQmg8AGu6AnUkPgmsLnR9ErsjNRLdCrRVWw
202204
```
203205
</Tab>
204206

@@ -210,7 +212,8 @@ To interact with wrapped tokens, you need to know the PDAs (Program Derived Addr
210212
findWrappedMintAuthorityPda,
211213
findWrappedMintPda,
212214
} from '@solana-program/token-wrap';
213-
import { TOKEN_2022_PROGRAM_ADDRESS } from '@solana-program/token-2022';
215+
import { findAssociatedTokenPda, TOKEN_2022_PROGRAM_ADDRESS } from '@solana-program/token-2022';
216+
import { TOKEN_PROGRAM_ADDRESS } from '@solana-program/token';
214217

215218
const UNWRAPPED_MINT_ADDRESS = address('5StBUZ2w8ShDN9iF7NkGpDNNH2wv9jK7zhArmVRpwrCt');
216219

@@ -222,19 +225,28 @@ To interact with wrapped tokens, you need to know the PDAs (Program Derived Addr
222225
const [backpointer] = await findBackpointerPda({ wrappedMint });
223226
const [wrappedMintAuthority] = await findWrappedMintAuthorityPda({ wrappedMint });
224227

228+
const [escrowAccount] = await findAssociatedTokenPda({
229+
owner: wrappedMintAuthority,
230+
mint: UNWRAPPED_MINT_ADDRESS,
231+
tokenProgram: TOKEN_PROGRAM_ADDRESS,
232+
});
233+
225234
console.log('WRAPPED_MINT_ADDRESS', wrappedMint);
226235
console.log('BACKPOINTER', backpointer);
227236
console.log('WRAPPED_MINT_AUTHORITY', wrappedMintAuthority);
237+
console.log('ESCROW_ACCOUNT', escrowAccount);
228238
}
229239

230240
void main();
241+
231242
```
232243
</Tab>
233244
</Tabs>
234245

235246
### Create escrow account
236247

237-
Before wrapping tokens, you need to create an account to hold the unwrapped tokens. The escrow account's owner must be the correct PDA (see `find-pdas` command above). There is also a helper to create this account:
248+
Before wrapping tokens, if you are the first to do so for this wrapped mint, you may need to initialize the escrow account to custody the unwrapped tokens.
249+
The account must be an ATA whose owner is the mint authority PDA (see `find-pdas` command above). There is also a helper to initialize this account:
238250

239251
<Tabs groupId="language" items={['CLI', 'JS']}>
240252
<Tab value="CLI">
@@ -284,10 +296,12 @@ Before wrapping tokens, you need to create an account to hold the unwrapped toke
284296
unwrappedMint: UNWRAPPED_MINT_ADDRESS,
285297
wrappedTokenProgram: TOKEN_2022_PROGRAM_ADDRESS,
286298
});
287-
const signedCreateEscrowTx = await signTransactionMessageWithSigners(createEscrowMessage.tx);
288-
await sendAndConfirm(signedCreateEscrowTx, { commitment: 'confirmed' });
299+
if (!createEscrowMessage.exists) {
300+
const signedCreateEscrowTx = await signTransactionMessageWithSigners(createEscrowMessage.tx);
301+
await sendAndConfirm(signedCreateEscrowTx, { commitment: 'confirmed' });
302+
}
289303

290-
console.log('ESCROW_ADDRESS', createEscrowMessage.keyPair.address);
304+
console.log('ESCROW_ADDRESS', createEscrowMessage.address);
291305
}
292306

293307
void main();
@@ -304,10 +318,9 @@ Escrows unwrapped tokens and mints wrapped tokens to recipient account.
304318
<Tab value="CLI">
305319
```console
306320
$ UNWRAPPED_TOKEN_ACCOUNT=DKFjYKEFS4tkXjamwkuiGf555Lww3eRSWwNTbue9x14
307-
$ ESCROW_ACCOUNT=4NoeQJKuH8fu1Pqk5k8BJpNu4wA7T8K6QABJxjTWoHs3
308321
$ WRAPPED_TOKEN_PROGRAM=TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb
309322

310-
$ spl-token-wrap wrap $UNWRAPPED_TOKEN_ACCOUNT $ESCROW_ACCOUNT $WRAPPED_TOKEN_PROGRAM 100
323+
$ spl-token-wrap wrap $UNWRAPPED_TOKEN_ACCOUNT $WRAPPED_TOKEN_PROGRAM 100
311324

312325
Wrapping 100 tokens from mint BVpjjYmSgSPZbFGTXe52NYXApsDNQJRe2qQF1hQft85e
313326
Unwrapped mint address: BVpjjYmSgSPZbFGTXe52NYXApsDNQJRe2qQF1hQft85e
@@ -323,7 +336,7 @@ Escrows unwrapped tokens and mints wrapped tokens to recipient account.
323336
You can specify a recipient token account with the `--recipient-token-account` option. If not provided, the associated token account of the fee payer will be used or created if it doesn't exist.
324337

325338
```console
326-
$ spl-token-wrap wrap $UNWRAPPED_TOKEN_ACCOUNT $ESCROW_ACCOUNT $WRAPPED_TOKEN_PROGRAM 100 \
339+
$ spl-token-wrap wrap $UNWRAPPED_TOKEN_ACCOUNT $WRAPPED_TOKEN_PROGRAM 100 \
327340
--recipient-token-account $RECIPIENT_WRAPPED_TOKEN_ACCOUNT
328341
```
329342
</Tab>
@@ -344,7 +357,6 @@ Escrows unwrapped tokens and mints wrapped tokens to recipient account.
344357

345358
// Replace these consts with your own
346359
const PRIVATE_KEY_PAIR = new Uint8Array([242, 30, 38, 177, 152, 71, ... ]);
347-
const ESCROW_ACCOUNT = address('4NoeQJKuH8fu1Pqk5k8BJpNu4wA7T8K6QABJxjTWoHs3');
348360
const UNWRAPPED_TOKEN_ACCOUNT = address('CbuRmvG3frMoPFnsKfC2t8jTUHFjtnrKZBt2aqdqH4PG');
349361
const RECIPIENT = address('HKHfad5Rx7Vv1iWzPiQhx3cnXpbVfDonYRRo1e16x5Bt');
350362
const AMOUNT_TO_WRAP = 100n;
@@ -362,7 +374,6 @@ Escrows unwrapped tokens and mints wrapped tokens to recipient account.
362374
blockhash,
363375
payer,
364376
unwrappedTokenAccount: UNWRAPPED_TOKEN_ACCOUNT,
365-
escrowAccount: ESCROW_ACCOUNT,
366377
wrappedTokenProgram: TOKEN_2022_PROGRAM_ADDRESS,
367378
recipientWrappedTokenAccount: RECIPIENT,
368379
amount: AMOUNT_TO_WRAP,
@@ -416,11 +427,10 @@ An example wrapping tokens whose origin is a token account owned by an SPL Token
416427
$ MULTISIG_ADDRESS=mgnqjedikMKaRtS5wrhVttuA12JaPXiqY619Gfef5eh
417428
$ RECIPIENT_ACCOUNT=HKHfad5Rx7Vv1iWzPiQhx3cnXpbVfDonYRRo1e16x5Bt
418429
$ UNWRAPPED_MINT=BVpjjYmSgSPZbFGTXe52NYXApsDNQJRe2qQF1hQft85e
419-
$ ESCROW_ACCOUNT=4NoeQJKuH8fu1Pqk5k8BJpNu4wA7T8K6QABJxjTWoHs3
420430
$ UNWRAPPED_TOKEN_PROGRAM=TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
421431
$ WRAPPED_TOKEN_PROGRAM=TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb
422432

423-
$ spl-token-wrap wrap $UNWRAPPED_TOKEN_ACCOUNT $ESCROW_ACCOUNT $WRAPPED_TOKEN_PROGRAM 23 \
433+
$ spl-token-wrap wrap $UNWRAPPED_TOKEN_ACCOUNT $WRAPPED_TOKEN_PROGRAM 23 \
424434
--transfer-authority $MULTISIG_ADDRESS \
425435
--recipient-token-account $RECIPIENT_ACCOUNT \
426436
--unwrapped-mint $UNWRAPPED_MINT \
@@ -451,11 +461,10 @@ An example wrapping tokens whose origin is a token account owned by an SPL Token
451461
$ MULTISIG_ADDRESS=mgnqjedikMKaRtS5wrhVttuA12JaPXiqY619Gfef5eh
452462
$ RECIPIENT_ACCOUNT=HKHfad5Rx7Vv1iWzPiQhx3cnXpbVfDonYRRo1e16x5Bt
453463
$ UNWRAPPED_MINT=BVpjjYmSgSPZbFGTXe52NYXApsDNQJRe2qQF1hQft85e
454-
$ ESCROW_ACCOUNT=4NoeQJKuH8fu1Pqk5k8BJpNu4wA7T8K6QABJxjTWoHs3
455464
$ UNWRAPPED_TOKEN_PROGRAM=TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
456465
$ WRAPPED_TOKEN_PROGRAM=TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb
457466

458-
$ spl-token-wrap wrap $UNWRAPPED_TOKEN_ACCOUNT $ESCROW_ACCOUNT $WRAPPED_TOKEN_PROGRAM 23 \
467+
$ spl-token-wrap wrap $UNWRAPPED_TOKEN_ACCOUNT $WRAPPED_TOKEN_PROGRAM 23 \
459468
--transfer-authority $MULTISIG_ADDRESS \
460469
--recipient-token-account $RECIPIENT_ACCOUNT \
461470
--unwrapped-mint $UNWRAPPED_MINT \
@@ -487,11 +496,10 @@ An example wrapping tokens whose origin is a token account owned by an SPL Token
487496
$ MULTISIG_ADDRESS=mgnqjedikMKaRtS5wrhVttuA12JaPXiqY619Gfef5eh
488497
$ RECIPIENT_ACCOUNT=HKHfad5Rx7Vv1iWzPiQhx3cnXpbVfDonYRRo1e16x5Bt
489498
$ UNWRAPPED_MINT=BVpjjYmSgSPZbFGTXe52NYXApsDNQJRe2qQF1hQft85e
490-
$ ESCROW_ACCOUNT=4NoeQJKuH8fu1Pqk5k8BJpNu4wA7T8K6QABJxjTWoHs3
491499
$ UNWRAPPED_TOKEN_PROGRAM=TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
492500
$ WRAPPED_TOKEN_PROGRAM=TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb
493501

494-
$ spl-token-wrap wrap $UNWRAPPED_TOKEN_ACCOUNT $ESCROW_ACCOUNT $WRAPPED_TOKEN_PROGRAM 23 \
502+
$ spl-token-wrap wrap $UNWRAPPED_TOKEN_ACCOUNT $WRAPPED_TOKEN_PROGRAM 23 \
495503
--transfer-authority $MULTISIG_ADDRESS \
496504
--recipient-token-account $RECIPIENT_ACCOUNT \
497505
--unwrapped-mint $UNWRAPPED_MINT \
@@ -547,7 +555,6 @@ An example wrapping tokens whose origin is a token account owned by an SPL Token
547555
const UNWRAPPED_MINT_ADDRESS = address('E8r9ixwg7QYr6xCh4tSdHErZ6CUxQhVGHqF5bRoZXyyV');
548556
const UNWRAPPED_TOKEN_ACCOUNT = address('DGNyuKAWP3susy6XMbVsYHy2AMrrKmh8pXM3WpQUeyL2'); // Must be owned by multisig account
549557
const UNWRAPPED_TOKEN_PROGRAM = address('TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb');
550-
const ESCROW = address('4NoeQJKuH8fu1Pqk5k8BJpNu4wA7T8K6QABJxjTWoHs3');
551558
const RECIPIENT = address('HKHfad5Rx7Vv1iWzPiQhx3cnXpbVfDonYRRo1e16x5Bt');
552559
const AMOUNT_TO_WRAP = 100n;
553560

@@ -566,10 +573,9 @@ An example wrapping tokens whose origin is a token account owned by an SPL Token
566573

567574
// Two signers and the payer sign the transaction independently
568575

569-
const wrapTxA = multisigOfflineSignWrapTx({
576+
const wrapTxA = await multisigOfflineSignWrapTx({
570577
payer: createNoopSigner(payer.address),
571578
unwrappedTokenAccount: UNWRAPPED_TOKEN_ACCOUNT,
572-
escrowAccount: ESCROW,
573579
wrappedTokenProgram: TOKEN_2022_PROGRAM_ADDRESS,
574580
amount: AMOUNT_TO_WRAP,
575581
unwrappedMint: UNWRAPPED_MINT_ADDRESS,
@@ -583,10 +589,9 @@ An example wrapping tokens whose origin is a token account owned by an SPL Token
583589
});
584590
const signedWrapTxA = await partiallySignTransactionMessageWithSigners(wrapTxA);
585591

586-
const wrapTxB = multisigOfflineSignWrapTx({
592+
const wrapTxB = await multisigOfflineSignWrapTx({
587593
payer: createNoopSigner(payer.address),
588594
unwrappedTokenAccount: UNWRAPPED_TOKEN_ACCOUNT,
589-
escrowAccount: ESCROW,
590595
wrappedTokenProgram: TOKEN_2022_PROGRAM_ADDRESS,
591596
amount: AMOUNT_TO_WRAP,
592597
unwrappedMint: UNWRAPPED_MINT_ADDRESS,
@@ -600,10 +605,9 @@ An example wrapping tokens whose origin is a token account owned by an SPL Token
600605
});
601606
const signedWrapTxB = await partiallySignTransactionMessageWithSigners(wrapTxB);
602607

603-
const wrapTxC = multisigOfflineSignWrapTx({
608+
const wrapTxC = await multisigOfflineSignWrapTx({
604609
payer,
605610
unwrappedTokenAccount: UNWRAPPED_TOKEN_ACCOUNT,
606-
escrowAccount: ESCROW,
607611
wrappedTokenProgram: TOKEN_2022_PROGRAM_ADDRESS,
608612
amount: AMOUNT_TO_WRAP,
609613
unwrappedMint: UNWRAPPED_MINT_ADDRESS,
@@ -647,11 +651,10 @@ Burns wrapped tokens and releases unwrapped tokens from escrow.
647651
<Tabs groupId="language" items={['CLI', 'JS']}>
648652
<Tab value="CLI">
649653
```console
650-
$ ESCROW_ACCOUNT=4NoeQJKuH8fu1Pqk5k8BJpNu4wA7T8K6QABJxjTWoHs3
651654
$ WRAPPED_TOKEN_ACCOUNT=HKHfad5Rx7Vv1iWzPiQhx3cnXpbVfDonYRRo1e16x5Bt
652655
$ UNWRAPPED_TOKEN_RECIPIENT=DKFjYKEFS4tkXjamwkuiGf555Lww3eRSWwNTbue9x14
653656

654-
$ spl-token-wrap unwrap $WRAPPED_TOKEN_ACCOUNT $ESCROW_ACCOUNT $UNWRAPPED_TOKEN_RECIPIENT 50
657+
$ spl-token-wrap unwrap $WRAPPED_TOKEN_ACCOUNT $UNWRAPPED_TOKEN_RECIPIENT 50
655658

656659
Unwrapping 50 tokens from mint BVpjjYmSgSPZbFGTXe52NYXApsDNQJRe2qQF1hQft85e
657660
Unwrapped token program: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
@@ -679,7 +682,6 @@ Burns wrapped tokens and releases unwrapped tokens from escrow.
679682
// Replace these consts with your own
680683
const PRIVATE_KEY_PAIR = new Uint8Array([242, 30, 38, 177, 152, 71, ... ]);
681684
const WRAPPED_TOKEN_ACCOUNT = address('HKHfad5Rx7Vv1iWzPiQhx3cnXpbVfDonYRRo1e16x5Bt');
682-
const ESCROW = address('4NoeQJKuH8fu1Pqk5k8BJpNu4wA7T8K6QABJxjTWoHs3');
683685
const RECIPIENT = address('DKFjYKEFS4tkXjamwkuiGf555Lww3eRSWwNTbue9x14');
684686
const AMOUNT_TO_WRAP = 100n;
685687

@@ -696,7 +698,6 @@ Burns wrapped tokens and releases unwrapped tokens from escrow.
696698
blockhash,
697699
payer,
698700
wrappedTokenAccount: WRAPPED_TOKEN_ACCOUNT,
699-
unwrappedEscrow: ESCROW,
700701
amount: AMOUNT_TO_WRAP,
701702
recipientUnwrappedToken: RECIPIENT,
702703
});
@@ -748,11 +749,10 @@ An example unwrapping tokens whose origin is a token account owned by an SPL Tok
748749
$ MULTISIG_ADDRESS=FFQvYvhaWnHeGsCMfixccUMdnXPgDrkG3KkGzpfBHFPb # note this should have the same program-id as wrapped token account
749750
$ UNWRAPPED_TOKEN_RECIPIENT=DKFjYKEFS4tkXjamwkuiGf555Lww3eRSWwNTbue9x14
750751
$ UNWRAPPED_MINT=BVpjjYmSgSPZbFGTXe52NYXApsDNQJRe2qQF1hQft85e
751-
$ ESCROW_ACCOUNT=4NoeQJKuH8fu1Pqk5k8BJpNu4wA7T8K6QABJxjTWoHs3
752752
$ UNWRAPPED_TOKEN_PROGRAM=TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
753753
$ WRAPPED_TOKEN_PROGRAM=TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb
754754

755-
$ spl-token-wrap unwrap $WRAPPED_TOKEN_ACCOUNT $ESCROW_ACCOUNT $UNWRAPPED_TOKEN_RECIPIENT 5 \
755+
$ spl-token-wrap unwrap $WRAPPED_TOKEN_ACCOUNT $UNWRAPPED_TOKEN_RECIPIENT 5 \
756756
--transfer-authority $MULTISIG_ADDRESS \
757757
--fee-payer $FEE_PAYER \
758758
--unwrapped-mint $UNWRAPPED_MINT \
@@ -777,11 +777,10 @@ An example unwrapping tokens whose origin is a token account owned by an SPL Tok
777777
$ MULTISIG_ADDRESS=FFQvYvhaWnHeGsCMfixccUMdnXPgDrkG3KkGzpfBHFPb
778778
$ UNWRAPPED_TOKEN_RECIPIENT=DKFjYKEFS4tkXjamwkuiGf555Lww3eRSWwNTbue9x14
779779
$ UNWRAPPED_MINT=BVpjjYmSgSPZbFGTXe52NYXApsDNQJRe2qQF1hQft85e
780-
$ ESCROW_ACCOUNT=4NoeQJKuH8fu1Pqk5k8BJpNu4wA7T8K6QABJxjTWoHs3
781780
$ UNWRAPPED_TOKEN_PROGRAM=TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
782781
$ WRAPPED_TOKEN_PROGRAM=TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb
783782

784-
$ spl-token-wrap unwrap $WRAPPED_TOKEN_ACCOUNT $ESCROW_ACCOUNT $UNWRAPPED_TOKEN_RECIPIENT 5 \
783+
$ spl-token-wrap unwrap $WRAPPED_TOKEN_ACCOUNT $UNWRAPPED_TOKEN_RECIPIENT 5 \
785784
--transfer-authority $MULTISIG_ADDRESS \
786785
--fee-payer $FEE_PAYER \
787786
--unwrapped-mint $UNWRAPPED_MINT \
@@ -807,11 +806,10 @@ An example unwrapping tokens whose origin is a token account owned by an SPL Tok
807806
$ MULTISIG_ADDRESS=FFQvYvhaWnHeGsCMfixccUMdnXPgDrkG3KkGzpfBHFPb
808807
$ UNWRAPPED_TOKEN_RECIPIENT=DKFjYKEFS4tkXjamwkuiGf555Lww3eRSWwNTbue9x14
809808
$ UNWRAPPED_MINT=BVpjjYmSgSPZbFGTXe52NYXApsDNQJRe2qQF1hQft85e
810-
$ ESCROW_ACCOUNT=4NoeQJKuH8fu1Pqk5k8BJpNu4wA7T8K6QABJxjTWoHs3
811809
$ UNWRAPPED_TOKEN_PROGRAM=TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
812810
$ WRAPPED_TOKEN_PROGRAM=TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb
813811

814-
$ spl-token-wrap unwrap $WRAPPED_TOKEN_ACCOUNT $ESCROW_ACCOUNT $UNWRAPPED_TOKEN_RECIPIENT 5 \
812+
$ spl-token-wrap unwrap $WRAPPED_TOKEN_ACCOUNT $UNWRAPPED_TOKEN_RECIPIENT 5 \
815813
--transfer-authority $MULTISIG_ADDRESS \
816814
--fee-payer $FEE_PAYER \
817815
--unwrapped-mint $UNWRAPPED_MINT \
@@ -865,7 +863,6 @@ An example unwrapping tokens whose origin is a token account owned by an SPL Tok
865863
const UNWRAPPED_MINT_ADDRESS = address('E8r9ixwg7QYr6xCh4tSdHErZ6CUxQhVGHqF5bRoZXyyV');
866864
const UNWRAPPED_TOKEN_ACCOUNT = address('DGNyuKAWP3susy6XMbVsYHy2AMrrKmh8pXM3WpQUeyL2'); // Must be owned by multisig account
867865
const UNWRAPPED_TOKEN_PROGRAM = address('TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb');
868-
const ESCROW = address('4NoeQJKuH8fu1Pqk5k8BJpNu4wA7T8K6QABJxjTWoHs3');
869866
const RECIPIENT = address('HKHfad5Rx7Vv1iWzPiQhx3cnXpbVfDonYRRo1e16x5Bt');
870867
const AMOUNT_TO_WRAP = 100n;
871868

@@ -884,9 +881,8 @@ An example unwrapping tokens whose origin is a token account owned by an SPL Tok
884881

885882
const { value: unwrapBlockhash } = await rpc.getLatestBlockhash().send();
886883

887-
const unwrapTxA = multisigOfflineSignUnwrap({
884+
const unwrapTxA = await multisigOfflineSignUnwrap({
888885
payer: createNoopSigner(payer.address),
889-
unwrappedEscrow: ESCROW,
890886
wrappedTokenProgram: TOKEN_2022_PROGRAM_ADDRESS,
891887
amount: AMOUNT_TO_WRAP,
892888
unwrappedMint: UNWRAPPED_MINT_ADDRESS,
@@ -901,9 +897,8 @@ An example unwrapping tokens whose origin is a token account owned by an SPL Tok
901897
});
902898
const signedUnwrapTxA = await partiallySignTransactionMessageWithSigners(unwrapTxA);
903899

904-
const unwrapTxB = multisigOfflineSignUnwrap({
900+
const unwrapTxB = await multisigOfflineSignUnwrap({
905901
payer: createNoopSigner(payer.address),
906-
unwrappedEscrow: ESCROW,
907902
wrappedTokenProgram: TOKEN_2022_PROGRAM_ADDRESS,
908903
amount: AMOUNT_TO_WRAP,
909904
unwrappedMint: UNWRAPPED_MINT_ADDRESS,
@@ -918,9 +913,8 @@ An example unwrapping tokens whose origin is a token account owned by an SPL Tok
918913
});
919914
const signedUnwrapTxB = await partiallySignTransactionMessageWithSigners(unwrapTxB);
920915

921-
const unwrapTxC = multisigOfflineSignUnwrap({
916+
const unwrapTxC = await multisigOfflineSignUnwrap({
922917
payer: payer,
923-
unwrappedEscrow: ESCROW,
924918
wrappedTokenProgram: TOKEN_2022_PROGRAM_ADDRESS,
925919
amount: AMOUNT_TO_WRAP,
926920
unwrappedMint: UNWRAPPED_MINT_ADDRESS,

0 commit comments

Comments
 (0)