@@ -28,6 +28,10 @@ const PAYER_KEYPAIR = Keypair.fromSecretKey(
28
28
const mintAddress = MINT_ADDRESS ;
29
29
const payer = PAYER_KEYPAIR ;
30
30
31
+ const amount = bn ( 333 ) ; // each recipient will receive 111 tokens
32
+ const recipients = [ "GMPWaPPrCeZPse5kwSR3WUrqYAPrVZBSVwymqh7auNW7" ] . map (
33
+ ( address ) => new PublicKey ( address )
34
+ ) ;
31
35
const activeStateTrees = await connection . getCachedActiveStateTreeInfo ( ) ;
32
36
33
37
/// Pick a new tree for each transaction!
@@ -45,11 +49,7 @@ const PAYER_KEYPAIR = Keypair.fromSecretKey(
45
49
// Airdrop to example recipients addresses
46
50
// 1 recipient = 120_000 CU
47
51
// 5 recipients = 170_000 CU
48
- const airDropAddresses = [
49
- "GMPWaPPrCeZPse5kwSR3WUrqYAPrVZBSVwymqh7auNW7" ,
50
- ] . map ( ( address ) => new web3 . PublicKey ( address ) ) ;
51
52
52
- const amount = bn ( 111 ) ; // each recipient will receive 111 tokens
53
53
const instructions : web3 . TransactionInstruction [ ] = [ ] ;
54
54
55
55
instructions . push (
@@ -64,8 +64,8 @@ const PAYER_KEYPAIR = Keypair.fromSecretKey(
64
64
payer : payer . publicKey ,
65
65
owner : payer . publicKey ,
66
66
source : sourceTokenAccount . address , // here, the owner of this account is also the payer.
67
- toAddress : airDropAddresses ,
68
- amount : airDropAddresses . map ( ( ) => amount ) ,
67
+ toAddress : recipients ,
68
+ amount : recipients . map ( ( ) => amount ) ,
69
69
mint : mintAddress ,
70
70
outputStateTree : tree ,
71
71
} ) ;
@@ -74,8 +74,8 @@ const PAYER_KEYPAIR = Keypair.fromSecretKey(
74
74
// Use zk-compression LUT for your network
75
75
// https://www.zkcompression.com/developers/protocol-addresses-and-urls#lookup-tables
76
76
const lookupTableAddress = new web3 . PublicKey (
77
- // "9NYFyEqPkyXUhkerbGHXUXkvb4qpzeEdHuGpgbgpH1NJ" // mainnet
78
- "qAJZMgnQJ8G6vA3WRcjD9Jan1wtKkaCFWLWskxJrR5V" // devnet
77
+ "9NYFyEqPkyXUhkerbGHXUXkvb4qpzeEdHuGpgbgpH1NJ" // mainnet
78
+ // "qAJZMgnQJ8G6vA3WRcjD9Jan1wtKkaCFWLWskxJrR5V" // devnet
79
79
) ;
80
80
81
81
// Get the lookup table account state
@@ -97,15 +97,9 @@ const PAYER_KEYPAIR = Keypair.fromSecretKey(
97
97
[ lookupTableAccount ]
98
98
) ;
99
99
100
- const simulate = await connection . simulateTransaction ( tx ) ;
101
- if ( simulate . value . err ) {
102
- console . error ( "Simulation failed" , simulate ) ;
103
- } else {
104
- console . log ( "Simulation successful" , simulate ) ;
105
- }
106
100
// Uncomment to send the transaction.
107
- // const txId = await sendAndConfirmTx(connection, tx);
108
- // console.log(`txId: ${txId}`);
101
+ const txId = await sendAndConfirmTx ( connection , tx ) ;
102
+ console . log ( `txId: ${ txId } ` ) ;
109
103
} catch ( e ) {
110
104
console . error ( `Compression failed:` , e ) ;
111
105
}
0 commit comments