@dropsy/airdrop 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +156 -148
- package/dist/index.d.ts +156 -148
- package/dist/index.js +534 -590
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +325 -386
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -473,13 +473,11 @@ function getAirdropMasterEncoder() {
|
|
|
473
473
|
["bitmapCreated", getU64Encoder5()],
|
|
474
474
|
["maxBitmapAllowed", getU64Encoder5()],
|
|
475
475
|
["airdropCreationFee", getU64Encoder5()],
|
|
476
|
+
["bitmapCreationFee", getU64Encoder5()],
|
|
476
477
|
["airdropUpdateFee", getU64Encoder5()],
|
|
477
|
-
["airdropCloseFee", getU64Encoder5()],
|
|
478
478
|
["airdropClaimFee", getU64Encoder5()],
|
|
479
479
|
["airdropDelegateFee", getU64Encoder5()],
|
|
480
480
|
["airdropDepositFee", getU64Encoder5()],
|
|
481
|
-
["bitmapCreationFee", getU64Encoder5()],
|
|
482
|
-
["bitmapCloseFee", getU64Encoder5()],
|
|
483
481
|
["bump", getU8Encoder5()],
|
|
484
482
|
["padding", fixEncoderSize5(getBytesEncoder5(), 7)]
|
|
485
483
|
]),
|
|
@@ -497,13 +495,11 @@ function getAirdropMasterDecoder() {
|
|
|
497
495
|
["bitmapCreated", getU64Decoder5()],
|
|
498
496
|
["maxBitmapAllowed", getU64Decoder5()],
|
|
499
497
|
["airdropCreationFee", getU64Decoder5()],
|
|
498
|
+
["bitmapCreationFee", getU64Decoder5()],
|
|
500
499
|
["airdropUpdateFee", getU64Decoder5()],
|
|
501
|
-
["airdropCloseFee", getU64Decoder5()],
|
|
502
500
|
["airdropClaimFee", getU64Decoder5()],
|
|
503
501
|
["airdropDelegateFee", getU64Decoder5()],
|
|
504
502
|
["airdropDepositFee", getU64Decoder5()],
|
|
505
|
-
["bitmapCreationFee", getU64Decoder5()],
|
|
506
|
-
["bitmapCloseFee", getU64Decoder5()],
|
|
507
503
|
["bump", getU8Decoder5()],
|
|
508
504
|
["padding", fixDecoderSize5(getBytesDecoder5(), 7)]
|
|
509
505
|
]);
|
|
@@ -540,7 +536,7 @@ async function fetchAllMaybeAirdropMaster(rpc, addresses, config) {
|
|
|
540
536
|
return maybeAccounts.map((maybeAccount) => decodeAirdropMaster(maybeAccount));
|
|
541
537
|
}
|
|
542
538
|
function getAirdropMasterSize() {
|
|
543
|
-
return
|
|
539
|
+
return 192;
|
|
544
540
|
}
|
|
545
541
|
|
|
546
542
|
// src/accounts/claimMap.ts
|
|
@@ -1184,11 +1180,7 @@ async function getClaimAirdropInstructionAsync(input, config) {
|
|
|
1184
1180
|
master: { value: input.master ?? null, isWritable: false },
|
|
1185
1181
|
config: { value: input.config ?? null, isWritable: false },
|
|
1186
1182
|
treasury: { value: input.treasury ?? null, isWritable: true },
|
|
1187
|
-
airdropMaster: { value: input.airdropMaster ?? null, isWritable:
|
|
1188
|
-
airdropMasterAuthority: {
|
|
1189
|
-
value: input.airdropMasterAuthority ?? null,
|
|
1190
|
-
isWritable: false
|
|
1191
|
-
},
|
|
1183
|
+
airdropMaster: { value: input.airdropMaster ?? null, isWritable: true },
|
|
1192
1184
|
affiliate: { value: input.affiliate ?? null, isWritable: true },
|
|
1193
1185
|
sourceTokenAccount: {
|
|
1194
1186
|
value: input.sourceTokenAccount ?? null,
|
|
@@ -1245,34 +1237,6 @@ async function getClaimAirdropInstructionAsync(input, config) {
|
|
|
1245
1237
|
]
|
|
1246
1238
|
});
|
|
1247
1239
|
}
|
|
1248
|
-
if (!accounts.airdropMaster.value) {
|
|
1249
|
-
accounts.airdropMaster.value = await getProgramDerivedAddress({
|
|
1250
|
-
programAddress,
|
|
1251
|
-
seeds: [
|
|
1252
|
-
getBytesEncoder9().encode(
|
|
1253
|
-
new Uint8Array([
|
|
1254
|
-
97,
|
|
1255
|
-
105,
|
|
1256
|
-
114,
|
|
1257
|
-
100,
|
|
1258
|
-
114,
|
|
1259
|
-
111,
|
|
1260
|
-
112,
|
|
1261
|
-
95,
|
|
1262
|
-
109,
|
|
1263
|
-
97,
|
|
1264
|
-
115,
|
|
1265
|
-
116,
|
|
1266
|
-
101,
|
|
1267
|
-
114
|
|
1268
|
-
])
|
|
1269
|
-
),
|
|
1270
|
-
getAddressEncoder7().encode(
|
|
1271
|
-
expectAddress(accounts.airdropMasterAuthority.value)
|
|
1272
|
-
)
|
|
1273
|
-
]
|
|
1274
|
-
});
|
|
1275
|
-
}
|
|
1276
1240
|
if (!accounts.tokenProgram.value) {
|
|
1277
1241
|
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1278
1242
|
}
|
|
@@ -1311,7 +1275,6 @@ async function getClaimAirdropInstructionAsync(input, config) {
|
|
|
1311
1275
|
getAccountMeta(accounts.config),
|
|
1312
1276
|
getAccountMeta(accounts.treasury),
|
|
1313
1277
|
getAccountMeta(accounts.airdropMaster),
|
|
1314
|
-
getAccountMeta(accounts.airdropMasterAuthority),
|
|
1315
1278
|
getAccountMeta(accounts.affiliate),
|
|
1316
1279
|
getAccountMeta(accounts.sourceTokenAccount),
|
|
1317
1280
|
getAccountMeta(accounts.destinationTokenAccount),
|
|
@@ -1336,11 +1299,7 @@ function getClaimAirdropInstruction(input, config) {
|
|
|
1336
1299
|
master: { value: input.master ?? null, isWritable: false },
|
|
1337
1300
|
config: { value: input.config ?? null, isWritable: false },
|
|
1338
1301
|
treasury: { value: input.treasury ?? null, isWritable: true },
|
|
1339
|
-
airdropMaster: { value: input.airdropMaster ?? null, isWritable:
|
|
1340
|
-
airdropMasterAuthority: {
|
|
1341
|
-
value: input.airdropMasterAuthority ?? null,
|
|
1342
|
-
isWritable: false
|
|
1343
|
-
},
|
|
1302
|
+
airdropMaster: { value: input.airdropMaster ?? null, isWritable: true },
|
|
1344
1303
|
affiliate: { value: input.affiliate ?? null, isWritable: true },
|
|
1345
1304
|
sourceTokenAccount: {
|
|
1346
1305
|
value: input.sourceTokenAccount ?? null,
|
|
@@ -1380,7 +1339,6 @@ function getClaimAirdropInstruction(input, config) {
|
|
|
1380
1339
|
getAccountMeta(accounts.config),
|
|
1381
1340
|
getAccountMeta(accounts.treasury),
|
|
1382
1341
|
getAccountMeta(accounts.airdropMaster),
|
|
1383
|
-
getAccountMeta(accounts.airdropMasterAuthority),
|
|
1384
1342
|
getAccountMeta(accounts.affiliate),
|
|
1385
1343
|
getAccountMeta(accounts.sourceTokenAccount),
|
|
1386
1344
|
getAccountMeta(accounts.destinationTokenAccount),
|
|
@@ -1400,7 +1358,7 @@ function getClaimAirdropInstruction(input, config) {
|
|
|
1400
1358
|
});
|
|
1401
1359
|
}
|
|
1402
1360
|
function parseClaimAirdropInstruction(instruction) {
|
|
1403
|
-
if (instruction.accounts.length <
|
|
1361
|
+
if (instruction.accounts.length < 15) {
|
|
1404
1362
|
throw new Error("Not enough accounts");
|
|
1405
1363
|
}
|
|
1406
1364
|
let accountIndex = 0;
|
|
@@ -1420,7 +1378,6 @@ function parseClaimAirdropInstruction(instruction) {
|
|
|
1420
1378
|
config: getNextAccount(),
|
|
1421
1379
|
treasury: getNextAccount(),
|
|
1422
1380
|
airdropMaster: getNextAccount(),
|
|
1423
|
-
airdropMasterAuthority: getNextAccount(),
|
|
1424
1381
|
affiliate: getNextOptionalAccount(),
|
|
1425
1382
|
sourceTokenAccount: getNextAccount(),
|
|
1426
1383
|
destinationTokenAccount: getNextAccount(),
|
|
@@ -1443,20 +1400,184 @@ import {
|
|
|
1443
1400
|
fixDecoderSize as fixDecoderSize9,
|
|
1444
1401
|
fixEncoderSize as fixEncoderSize10,
|
|
1445
1402
|
getAddressDecoder as getAddressDecoder7,
|
|
1446
|
-
getAddressEncoder as
|
|
1403
|
+
getAddressEncoder as getAddressEncoder9,
|
|
1447
1404
|
getBytesDecoder as getBytesDecoder9,
|
|
1448
1405
|
getBytesEncoder as getBytesEncoder10,
|
|
1449
1406
|
getI64Decoder as getI64Decoder3,
|
|
1450
1407
|
getI64Encoder as getI64Encoder3,
|
|
1451
1408
|
getOptionDecoder,
|
|
1452
1409
|
getOptionEncoder,
|
|
1453
|
-
getProgramDerivedAddress as
|
|
1410
|
+
getProgramDerivedAddress as getProgramDerivedAddress3,
|
|
1454
1411
|
getStructDecoder as getStructDecoder9,
|
|
1455
1412
|
getStructEncoder as getStructEncoder9,
|
|
1456
1413
|
getU8Decoder as getU8Decoder8,
|
|
1457
1414
|
getU8Encoder as getU8Encoder8,
|
|
1458
1415
|
transformEncoder as transformEncoder9
|
|
1459
1416
|
} from "@solana/kit";
|
|
1417
|
+
|
|
1418
|
+
// src/constants/index.ts
|
|
1419
|
+
import { address } from "@solana/kit";
|
|
1420
|
+
var DROPSY_MASTER_SEED = "master";
|
|
1421
|
+
var AIRDROP_CONFIG_SEED = "airdrop_config";
|
|
1422
|
+
var AFFILIATE_MASTER_SEED = "affiliate_master";
|
|
1423
|
+
var AIRDROP_MASTER_SEED = "airdrop_master";
|
|
1424
|
+
var AIRDROP_SEED = "airdrop";
|
|
1425
|
+
var AFFILIATE_SEED = "affiliate";
|
|
1426
|
+
var BITMAP_SEED = "bitmap";
|
|
1427
|
+
var VESTING_SEED = "vesting";
|
|
1428
|
+
var PRESALE_SEED = "presale";
|
|
1429
|
+
var VAULT_SEED = "vault";
|
|
1430
|
+
var ADMIN = address("8mtUD2XrkNnTxnjCehZ4DEtTXeGR1yrepSEGhCaSj2kT");
|
|
1431
|
+
var DROPSY_TREASURY = address("8mtUD2XrkNnTxnjCehZ4DEtTXeGR1yrepSEGhCaSj2kT");
|
|
1432
|
+
var DEFAULT_MASTER_PDA = address("8mtUD2XrkNnTxnjCehZ4DEtTXeGR1yrepSEGhCaSj2kT");
|
|
1433
|
+
var DEFAULT_MASTER_PDA_AUTHORITY = address("8mtUD2XrkNnTxnjCehZ4DEtTXeGR1yrepSEGhCaSj2kT");
|
|
1434
|
+
var BITMAP_SIZE = 8e3;
|
|
1435
|
+
var MAX_BITMAP_CLAIM = BITMAP_SIZE * 8;
|
|
1436
|
+
var VERSION_BASIC = 0;
|
|
1437
|
+
var VERSION_VESTED = 1;
|
|
1438
|
+
var STATE_INITIALIZED = 0;
|
|
1439
|
+
var STATE_DELEGATED = 1;
|
|
1440
|
+
var STATE_REDEEMED = 2;
|
|
1441
|
+
var MUTABLE_NONE = 0;
|
|
1442
|
+
|
|
1443
|
+
// src/utils/client.ts
|
|
1444
|
+
import {
|
|
1445
|
+
airdropFactory,
|
|
1446
|
+
appendTransactionMessageInstructions,
|
|
1447
|
+
createSolanaRpc,
|
|
1448
|
+
createSolanaRpcSubscriptions,
|
|
1449
|
+
createTransactionMessage,
|
|
1450
|
+
generateKeyPairSigner,
|
|
1451
|
+
lamports,
|
|
1452
|
+
pipe,
|
|
1453
|
+
setTransactionMessageFeePayerSigner,
|
|
1454
|
+
setTransactionMessageLifetimeUsingBlockhash
|
|
1455
|
+
} from "@solana/kit";
|
|
1456
|
+
var generateKeyPairSignerWithSol = async (rpcClient, putativeLamports = 1000000000n) => {
|
|
1457
|
+
const signer = await generateKeyPairSigner();
|
|
1458
|
+
await airdropFactory(rpcClient)({
|
|
1459
|
+
recipientAddress: signer.address,
|
|
1460
|
+
lamports: lamports(putativeLamports),
|
|
1461
|
+
commitment: "confirmed"
|
|
1462
|
+
});
|
|
1463
|
+
return signer;
|
|
1464
|
+
};
|
|
1465
|
+
var createDefaultSolanaClient = () => {
|
|
1466
|
+
const rpc = createSolanaRpc("https://api.devnet.solana.com");
|
|
1467
|
+
const rpcSubscriptions = createSolanaRpcSubscriptions(
|
|
1468
|
+
"wss://api.devnet.solana.com"
|
|
1469
|
+
);
|
|
1470
|
+
return { rpc, rpcSubscriptions };
|
|
1471
|
+
};
|
|
1472
|
+
var createTransactionMessageFromInstructions = async (rpc, signer, instruction) => {
|
|
1473
|
+
const { value: latestBlockhash } = await rpc.getLatestBlockhash().send();
|
|
1474
|
+
return pipe(
|
|
1475
|
+
createTransactionMessage({ version: 0 }),
|
|
1476
|
+
(tx) => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx),
|
|
1477
|
+
(tx) => setTransactionMessageFeePayerSigner(signer, tx),
|
|
1478
|
+
(tx) => appendTransactionMessageInstructions(instruction, tx)
|
|
1479
|
+
);
|
|
1480
|
+
};
|
|
1481
|
+
|
|
1482
|
+
// src/utils/derive.ts
|
|
1483
|
+
import {
|
|
1484
|
+
getAddressEncoder as getAddressEncoder8,
|
|
1485
|
+
getProgramDerivedAddress as getProgramDerivedAddress2
|
|
1486
|
+
} from "@solana/kit";
|
|
1487
|
+
async function getDropsyDerivedAddress(seeds) {
|
|
1488
|
+
return await getProgramDerivedAddress2({
|
|
1489
|
+
seeds,
|
|
1490
|
+
programAddress: DROPSY_PROGRAM_ADDRESS
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1493
|
+
async function getMasterDerivedAddress() {
|
|
1494
|
+
return await getDropsyDerivedAddress([DROPSY_MASTER_SEED]);
|
|
1495
|
+
}
|
|
1496
|
+
async function getAirdropConfigDerivedAddress() {
|
|
1497
|
+
return await getDropsyDerivedAddress([AIRDROP_CONFIG_SEED]);
|
|
1498
|
+
}
|
|
1499
|
+
async function getAirdropMasterDerivedAddress(authority) {
|
|
1500
|
+
const seeds = [
|
|
1501
|
+
AIRDROP_MASTER_SEED,
|
|
1502
|
+
getAddressEncoder8().encode(authority)
|
|
1503
|
+
];
|
|
1504
|
+
return await getDropsyDerivedAddress(seeds);
|
|
1505
|
+
}
|
|
1506
|
+
async function getAffiliateDerivedAddress(authority) {
|
|
1507
|
+
const seeds = [
|
|
1508
|
+
AFFILIATE_SEED,
|
|
1509
|
+
getAddressEncoder8().encode(authority)
|
|
1510
|
+
];
|
|
1511
|
+
return await getDropsyDerivedAddress(seeds);
|
|
1512
|
+
}
|
|
1513
|
+
async function getAirdropDerivedAddress(authority, mint) {
|
|
1514
|
+
const seeds = [
|
|
1515
|
+
AIRDROP_SEED,
|
|
1516
|
+
getAddressEncoder8().encode(mint),
|
|
1517
|
+
getAddressEncoder8().encode(authority)
|
|
1518
|
+
];
|
|
1519
|
+
return await getDropsyDerivedAddress(seeds);
|
|
1520
|
+
}
|
|
1521
|
+
async function getClaimMapDerivedAddress(airdrop, id) {
|
|
1522
|
+
const idBuffer = Buffer.alloc(2);
|
|
1523
|
+
idBuffer.writeUInt16LE(id);
|
|
1524
|
+
const seeds = [
|
|
1525
|
+
BITMAP_SEED,
|
|
1526
|
+
getAddressEncoder8().encode(airdrop),
|
|
1527
|
+
idBuffer
|
|
1528
|
+
];
|
|
1529
|
+
return await getDropsyDerivedAddress(seeds);
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
// src/utils/helper.ts
|
|
1533
|
+
function toUnixTimestamp(date) {
|
|
1534
|
+
if (!date) return null;
|
|
1535
|
+
return Math.floor(date.getTime() / 1e3);
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
// src/utils/merkle.ts
|
|
1539
|
+
import { createHash } from "crypto";
|
|
1540
|
+
import MerkleTree from "merkletreejs";
|
|
1541
|
+
function hashLeaf(index, address2, amount) {
|
|
1542
|
+
const data = `${index}:${address2}:${amount.toString()}`;
|
|
1543
|
+
return createHash("sha256").update(data).digest();
|
|
1544
|
+
}
|
|
1545
|
+
function hashAddress(address2) {
|
|
1546
|
+
return createHash("sha256").update(address2).digest();
|
|
1547
|
+
}
|
|
1548
|
+
var createWLMerkleTree = (wallets) => {
|
|
1549
|
+
const leaves = wallets.map((address2) => hashAddress(address2));
|
|
1550
|
+
return new MerkleTree(
|
|
1551
|
+
leaves,
|
|
1552
|
+
(data) => createHash("sha256").update(data).digest(),
|
|
1553
|
+
{ sortPairs: true }
|
|
1554
|
+
);
|
|
1555
|
+
};
|
|
1556
|
+
var getSimpleMerkleProof = (merkleTree, address2) => {
|
|
1557
|
+
const leaf = hashAddress(address2);
|
|
1558
|
+
return merkleTree.getProof(leaf).map((p) => p.data);
|
|
1559
|
+
};
|
|
1560
|
+
var getMerkleRootArray = (merkleTree) => {
|
|
1561
|
+
const root = merkleTree.getRoot();
|
|
1562
|
+
if (root.length !== 32) {
|
|
1563
|
+
throw new Error("Merkle root must be 32 bytes");
|
|
1564
|
+
}
|
|
1565
|
+
const uint8Root = new Uint8Array(root);
|
|
1566
|
+
return uint8Root;
|
|
1567
|
+
};
|
|
1568
|
+
var createMerkleTree = (claimList) => {
|
|
1569
|
+
const leaves = claimList.map(
|
|
1570
|
+
({ index, address: address2, amount }) => hashLeaf(index, address2, amount)
|
|
1571
|
+
);
|
|
1572
|
+
const merkleTree = new MerkleTree(
|
|
1573
|
+
leaves,
|
|
1574
|
+
(data) => createHash("sha256").update(data).digest(),
|
|
1575
|
+
{ sortPairs: true }
|
|
1576
|
+
);
|
|
1577
|
+
return merkleTree;
|
|
1578
|
+
};
|
|
1579
|
+
|
|
1580
|
+
// src/instructions/createAirdrop.ts
|
|
1460
1581
|
var CREATE_AIRDROP_DISCRIMINATOR = new Uint8Array([
|
|
1461
1582
|
227,
|
|
1462
1583
|
135,
|
|
@@ -1481,7 +1602,7 @@ function getCreateAirdropInstructionDataEncoder() {
|
|
|
1481
1602
|
["endsAt", getOptionEncoder(getI64Encoder3())],
|
|
1482
1603
|
["version", getOptionEncoder(getU8Encoder8())],
|
|
1483
1604
|
["mutable", getOptionEncoder(getU8Encoder8())],
|
|
1484
|
-
["delegateAuthority", getOptionEncoder(
|
|
1605
|
+
["delegateAuthority", getOptionEncoder(getAddressEncoder9())],
|
|
1485
1606
|
["delegatePermissions", getOptionEncoder(getU8Encoder8())]
|
|
1486
1607
|
]),
|
|
1487
1608
|
(value) => ({ ...value, discriminator: CREATE_AIRDROP_DISCRIMINATOR })
|
|
@@ -1512,10 +1633,6 @@ async function getCreateAirdropInstructionAsync(input, config) {
|
|
|
1512
1633
|
config: { value: input.config ?? null, isWritable: false },
|
|
1513
1634
|
treasury: { value: input.treasury ?? null, isWritable: true },
|
|
1514
1635
|
airdropMaster: { value: input.airdropMaster ?? null, isWritable: true },
|
|
1515
|
-
airdropMasterAuthority: {
|
|
1516
|
-
value: input.airdropMasterAuthority ?? null,
|
|
1517
|
-
isWritable: false
|
|
1518
|
-
},
|
|
1519
1636
|
affiliate: { value: input.affiliate ?? null, isWritable: true },
|
|
1520
1637
|
airdrop: { value: input.airdrop ?? null, isWritable: true },
|
|
1521
1638
|
mint: { value: input.mint ?? null, isWritable: false },
|
|
@@ -1525,7 +1642,7 @@ async function getCreateAirdropInstructionAsync(input, config) {
|
|
|
1525
1642
|
const accounts = originalAccounts;
|
|
1526
1643
|
const args = { ...input };
|
|
1527
1644
|
if (!accounts.master.value) {
|
|
1528
|
-
accounts.master.value = await
|
|
1645
|
+
accounts.master.value = await getProgramDerivedAddress3({
|
|
1529
1646
|
programAddress,
|
|
1530
1647
|
seeds: [
|
|
1531
1648
|
getBytesEncoder10().encode(new Uint8Array([109, 97, 115, 116, 101, 114]))
|
|
@@ -1533,7 +1650,7 @@ async function getCreateAirdropInstructionAsync(input, config) {
|
|
|
1533
1650
|
});
|
|
1534
1651
|
}
|
|
1535
1652
|
if (!accounts.config.value) {
|
|
1536
|
-
accounts.config.value = await
|
|
1653
|
+
accounts.config.value = await getProgramDerivedAddress3({
|
|
1537
1654
|
programAddress,
|
|
1538
1655
|
seeds: [
|
|
1539
1656
|
getBytesEncoder10().encode(
|
|
@@ -1557,43 +1674,15 @@ async function getCreateAirdropInstructionAsync(input, config) {
|
|
|
1557
1674
|
]
|
|
1558
1675
|
});
|
|
1559
1676
|
}
|
|
1560
|
-
if (!accounts.airdropMaster.value) {
|
|
1561
|
-
accounts.airdropMaster.value = await getProgramDerivedAddress2({
|
|
1562
|
-
programAddress,
|
|
1563
|
-
seeds: [
|
|
1564
|
-
getBytesEncoder10().encode(
|
|
1565
|
-
new Uint8Array([
|
|
1566
|
-
97,
|
|
1567
|
-
105,
|
|
1568
|
-
114,
|
|
1569
|
-
100,
|
|
1570
|
-
114,
|
|
1571
|
-
111,
|
|
1572
|
-
112,
|
|
1573
|
-
95,
|
|
1574
|
-
109,
|
|
1575
|
-
97,
|
|
1576
|
-
115,
|
|
1577
|
-
116,
|
|
1578
|
-
101,
|
|
1579
|
-
114
|
|
1580
|
-
])
|
|
1581
|
-
),
|
|
1582
|
-
getAddressEncoder8().encode(
|
|
1583
|
-
expectAddress(accounts.airdropMasterAuthority.value)
|
|
1584
|
-
)
|
|
1585
|
-
]
|
|
1586
|
-
});
|
|
1587
|
-
}
|
|
1588
1677
|
if (!accounts.airdrop.value) {
|
|
1589
|
-
accounts.airdrop.value = await
|
|
1678
|
+
accounts.airdrop.value = await getProgramDerivedAddress3({
|
|
1590
1679
|
programAddress,
|
|
1591
1680
|
seeds: [
|
|
1592
1681
|
getBytesEncoder10().encode(
|
|
1593
1682
|
new Uint8Array([97, 105, 114, 100, 114, 111, 112])
|
|
1594
1683
|
),
|
|
1595
|
-
|
|
1596
|
-
|
|
1684
|
+
getAddressEncoder9().encode(expectAddress(accounts.mint.value)),
|
|
1685
|
+
getAddressEncoder9().encode(expectAddress(accounts.authority.value))
|
|
1597
1686
|
]
|
|
1598
1687
|
});
|
|
1599
1688
|
}
|
|
@@ -1607,7 +1696,6 @@ async function getCreateAirdropInstructionAsync(input, config) {
|
|
|
1607
1696
|
getAccountMeta(accounts.config),
|
|
1608
1697
|
getAccountMeta(accounts.treasury),
|
|
1609
1698
|
getAccountMeta(accounts.airdropMaster),
|
|
1610
|
-
getAccountMeta(accounts.airdropMasterAuthority),
|
|
1611
1699
|
getAccountMeta(accounts.affiliate),
|
|
1612
1700
|
getAccountMeta(accounts.airdrop),
|
|
1613
1701
|
getAccountMeta(accounts.mint),
|
|
@@ -1626,11 +1714,7 @@ function getCreateAirdropInstruction(input, config) {
|
|
|
1626
1714
|
master: { value: input.master ?? null, isWritable: false },
|
|
1627
1715
|
config: { value: input.config ?? null, isWritable: false },
|
|
1628
1716
|
treasury: { value: input.treasury ?? null, isWritable: true },
|
|
1629
|
-
airdropMaster: { value: input.airdropMaster ?? null, isWritable:
|
|
1630
|
-
airdropMasterAuthority: {
|
|
1631
|
-
value: input.airdropMasterAuthority ?? null,
|
|
1632
|
-
isWritable: false
|
|
1633
|
-
},
|
|
1717
|
+
airdropMaster: { value: input.airdropMaster ?? null, isWritable: true },
|
|
1634
1718
|
affiliate: { value: input.affiliate ?? null, isWritable: true },
|
|
1635
1719
|
airdrop: { value: input.airdrop ?? null, isWritable: true },
|
|
1636
1720
|
mint: { value: input.mint ?? null, isWritable: false },
|
|
@@ -1649,7 +1733,6 @@ function getCreateAirdropInstruction(input, config) {
|
|
|
1649
1733
|
getAccountMeta(accounts.config),
|
|
1650
1734
|
getAccountMeta(accounts.treasury),
|
|
1651
1735
|
getAccountMeta(accounts.airdropMaster),
|
|
1652
|
-
getAccountMeta(accounts.airdropMasterAuthority),
|
|
1653
1736
|
getAccountMeta(accounts.affiliate),
|
|
1654
1737
|
getAccountMeta(accounts.airdrop),
|
|
1655
1738
|
getAccountMeta(accounts.mint),
|
|
@@ -1663,7 +1746,7 @@ function getCreateAirdropInstruction(input, config) {
|
|
|
1663
1746
|
});
|
|
1664
1747
|
}
|
|
1665
1748
|
function parseCreateAirdropInstruction(instruction) {
|
|
1666
|
-
if (instruction.accounts.length <
|
|
1749
|
+
if (instruction.accounts.length < 9) {
|
|
1667
1750
|
throw new Error("Not enough accounts");
|
|
1668
1751
|
}
|
|
1669
1752
|
let accountIndex = 0;
|
|
@@ -1683,7 +1766,6 @@ function parseCreateAirdropInstruction(instruction) {
|
|
|
1683
1766
|
config: getNextAccount(),
|
|
1684
1767
|
treasury: getNextAccount(),
|
|
1685
1768
|
airdropMaster: getNextAccount(),
|
|
1686
|
-
airdropMasterAuthority: getNextAccount(),
|
|
1687
1769
|
affiliate: getNextOptionalAccount(),
|
|
1688
1770
|
airdrop: getNextAccount(),
|
|
1689
1771
|
mint: getNextAccount(),
|
|
@@ -1695,14 +1777,14 @@ function parseCreateAirdropInstruction(instruction) {
|
|
|
1695
1777
|
}
|
|
1696
1778
|
async function getCreateAirdropV0Instruction(input) {
|
|
1697
1779
|
return await getCreateAirdropInstructionAsync({
|
|
1698
|
-
|
|
1699
|
-
treasury:
|
|
1780
|
+
airdropMaster: input.airdropMaster ?? DEFAULT_MASTER_PDA,
|
|
1781
|
+
treasury: DROPSY_TREASURY,
|
|
1700
1782
|
airdrop: input.airdrop,
|
|
1701
1783
|
mint: input.mint,
|
|
1702
1784
|
authority: input.authority,
|
|
1703
1785
|
merkleRoot: input.merkleRoot ?? null,
|
|
1704
|
-
startsAt: input.startsAt
|
|
1705
|
-
endsAt: input.endsAt
|
|
1786
|
+
startsAt: toUnixTimestamp(input.startsAt),
|
|
1787
|
+
endsAt: toUnixTimestamp(input.endsAt),
|
|
1706
1788
|
version: 0,
|
|
1707
1789
|
mutable: null,
|
|
1708
1790
|
delegateAuthority: null,
|
|
@@ -1715,10 +1797,10 @@ import {
|
|
|
1715
1797
|
combineCodec as combineCodec10,
|
|
1716
1798
|
fixDecoderSize as fixDecoderSize10,
|
|
1717
1799
|
fixEncoderSize as fixEncoderSize11,
|
|
1718
|
-
getAddressEncoder as
|
|
1800
|
+
getAddressEncoder as getAddressEncoder10,
|
|
1719
1801
|
getBytesDecoder as getBytesDecoder10,
|
|
1720
1802
|
getBytesEncoder as getBytesEncoder11,
|
|
1721
|
-
getProgramDerivedAddress as
|
|
1803
|
+
getProgramDerivedAddress as getProgramDerivedAddress4,
|
|
1722
1804
|
getStructDecoder as getStructDecoder10,
|
|
1723
1805
|
getStructEncoder as getStructEncoder10,
|
|
1724
1806
|
getU16Decoder as getU16Decoder5,
|
|
@@ -1772,10 +1854,6 @@ async function getCreateClaimMapInstructionAsync(input, config) {
|
|
|
1772
1854
|
config: { value: input.config ?? null, isWritable: false },
|
|
1773
1855
|
treasury: { value: input.treasury ?? null, isWritable: true },
|
|
1774
1856
|
airdropMaster: { value: input.airdropMaster ?? null, isWritable: true },
|
|
1775
|
-
airdropMasterAuthority: {
|
|
1776
|
-
value: input.airdropMasterAuthority ?? null,
|
|
1777
|
-
isWritable: false
|
|
1778
|
-
},
|
|
1779
1857
|
affiliate: { value: input.affiliate ?? null, isWritable: true },
|
|
1780
1858
|
airdrop: { value: input.airdrop ?? null, isWritable: true },
|
|
1781
1859
|
mint: { value: input.mint ?? null, isWritable: false },
|
|
@@ -1786,7 +1864,7 @@ async function getCreateClaimMapInstructionAsync(input, config) {
|
|
|
1786
1864
|
const accounts = originalAccounts;
|
|
1787
1865
|
const args = { ...input };
|
|
1788
1866
|
if (!accounts.master.value) {
|
|
1789
|
-
accounts.master.value = await
|
|
1867
|
+
accounts.master.value = await getProgramDerivedAddress4({
|
|
1790
1868
|
programAddress,
|
|
1791
1869
|
seeds: [
|
|
1792
1870
|
getBytesEncoder11().encode(new Uint8Array([109, 97, 115, 116, 101, 114]))
|
|
@@ -1794,7 +1872,7 @@ async function getCreateClaimMapInstructionAsync(input, config) {
|
|
|
1794
1872
|
});
|
|
1795
1873
|
}
|
|
1796
1874
|
if (!accounts.config.value) {
|
|
1797
|
-
accounts.config.value = await
|
|
1875
|
+
accounts.config.value = await getProgramDerivedAddress4({
|
|
1798
1876
|
programAddress,
|
|
1799
1877
|
seeds: [
|
|
1800
1878
|
getBytesEncoder11().encode(
|
|
@@ -1818,52 +1896,24 @@ async function getCreateClaimMapInstructionAsync(input, config) {
|
|
|
1818
1896
|
]
|
|
1819
1897
|
});
|
|
1820
1898
|
}
|
|
1821
|
-
if (!accounts.airdropMaster.value) {
|
|
1822
|
-
accounts.airdropMaster.value = await getProgramDerivedAddress3({
|
|
1823
|
-
programAddress,
|
|
1824
|
-
seeds: [
|
|
1825
|
-
getBytesEncoder11().encode(
|
|
1826
|
-
new Uint8Array([
|
|
1827
|
-
97,
|
|
1828
|
-
105,
|
|
1829
|
-
114,
|
|
1830
|
-
100,
|
|
1831
|
-
114,
|
|
1832
|
-
111,
|
|
1833
|
-
112,
|
|
1834
|
-
95,
|
|
1835
|
-
109,
|
|
1836
|
-
97,
|
|
1837
|
-
115,
|
|
1838
|
-
116,
|
|
1839
|
-
101,
|
|
1840
|
-
114
|
|
1841
|
-
])
|
|
1842
|
-
),
|
|
1843
|
-
getAddressEncoder9().encode(
|
|
1844
|
-
expectAddress(accounts.airdropMasterAuthority.value)
|
|
1845
|
-
)
|
|
1846
|
-
]
|
|
1847
|
-
});
|
|
1848
|
-
}
|
|
1849
1899
|
if (!accounts.airdrop.value) {
|
|
1850
|
-
accounts.airdrop.value = await
|
|
1900
|
+
accounts.airdrop.value = await getProgramDerivedAddress4({
|
|
1851
1901
|
programAddress,
|
|
1852
1902
|
seeds: [
|
|
1853
1903
|
getBytesEncoder11().encode(
|
|
1854
1904
|
new Uint8Array([97, 105, 114, 100, 114, 111, 112])
|
|
1855
1905
|
),
|
|
1856
|
-
|
|
1857
|
-
|
|
1906
|
+
getAddressEncoder10().encode(expectAddress(accounts.mint.value)),
|
|
1907
|
+
getAddressEncoder10().encode(expectAddress(accounts.authority.value))
|
|
1858
1908
|
]
|
|
1859
1909
|
});
|
|
1860
1910
|
}
|
|
1861
1911
|
if (!accounts.bitmap.value) {
|
|
1862
|
-
accounts.bitmap.value = await
|
|
1912
|
+
accounts.bitmap.value = await getProgramDerivedAddress4({
|
|
1863
1913
|
programAddress,
|
|
1864
1914
|
seeds: [
|
|
1865
1915
|
getBytesEncoder11().encode(new Uint8Array([98, 105, 116, 109, 97, 112])),
|
|
1866
|
-
|
|
1916
|
+
getAddressEncoder10().encode(expectAddress(accounts.airdrop.value)),
|
|
1867
1917
|
getU16Encoder5().encode(expectSome(args.id))
|
|
1868
1918
|
]
|
|
1869
1919
|
});
|
|
@@ -1878,7 +1928,6 @@ async function getCreateClaimMapInstructionAsync(input, config) {
|
|
|
1878
1928
|
getAccountMeta(accounts.config),
|
|
1879
1929
|
getAccountMeta(accounts.treasury),
|
|
1880
1930
|
getAccountMeta(accounts.airdropMaster),
|
|
1881
|
-
getAccountMeta(accounts.airdropMasterAuthority),
|
|
1882
1931
|
getAccountMeta(accounts.affiliate),
|
|
1883
1932
|
getAccountMeta(accounts.airdrop),
|
|
1884
1933
|
getAccountMeta(accounts.mint),
|
|
@@ -1899,10 +1948,6 @@ function getCreateClaimMapInstruction(input, config) {
|
|
|
1899
1948
|
config: { value: input.config ?? null, isWritable: false },
|
|
1900
1949
|
treasury: { value: input.treasury ?? null, isWritable: true },
|
|
1901
1950
|
airdropMaster: { value: input.airdropMaster ?? null, isWritable: true },
|
|
1902
|
-
airdropMasterAuthority: {
|
|
1903
|
-
value: input.airdropMasterAuthority ?? null,
|
|
1904
|
-
isWritable: false
|
|
1905
|
-
},
|
|
1906
1951
|
affiliate: { value: input.affiliate ?? null, isWritable: true },
|
|
1907
1952
|
airdrop: { value: input.airdrop ?? null, isWritable: true },
|
|
1908
1953
|
mint: { value: input.mint ?? null, isWritable: false },
|
|
@@ -1922,7 +1967,6 @@ function getCreateClaimMapInstruction(input, config) {
|
|
|
1922
1967
|
getAccountMeta(accounts.config),
|
|
1923
1968
|
getAccountMeta(accounts.treasury),
|
|
1924
1969
|
getAccountMeta(accounts.airdropMaster),
|
|
1925
|
-
getAccountMeta(accounts.airdropMasterAuthority),
|
|
1926
1970
|
getAccountMeta(accounts.affiliate),
|
|
1927
1971
|
getAccountMeta(accounts.airdrop),
|
|
1928
1972
|
getAccountMeta(accounts.mint),
|
|
@@ -1937,7 +1981,7 @@ function getCreateClaimMapInstruction(input, config) {
|
|
|
1937
1981
|
});
|
|
1938
1982
|
}
|
|
1939
1983
|
function parseCreateClaimMapInstruction(instruction) {
|
|
1940
|
-
if (instruction.accounts.length <
|
|
1984
|
+
if (instruction.accounts.length < 10) {
|
|
1941
1985
|
throw new Error("Not enough accounts");
|
|
1942
1986
|
}
|
|
1943
1987
|
let accountIndex = 0;
|
|
@@ -1957,7 +2001,6 @@ function parseCreateClaimMapInstruction(instruction) {
|
|
|
1957
2001
|
config: getNextAccount(),
|
|
1958
2002
|
treasury: getNextAccount(),
|
|
1959
2003
|
airdropMaster: getNextAccount(),
|
|
1960
|
-
airdropMasterAuthority: getNextAccount(),
|
|
1961
2004
|
affiliate: getNextOptionalAccount(),
|
|
1962
2005
|
airdrop: getNextAccount(),
|
|
1963
2006
|
mint: getNextAccount(),
|
|
@@ -1968,16 +2011,28 @@ function parseCreateClaimMapInstruction(instruction) {
|
|
|
1968
2011
|
data: getCreateClaimMapInstructionDataDecoder().decode(instruction.data)
|
|
1969
2012
|
};
|
|
1970
2013
|
}
|
|
2014
|
+
async function getCreateClaimMapV0Instruction(input) {
|
|
2015
|
+
return await getCreateClaimMapInstructionAsync({
|
|
2016
|
+
airdropMaster: input.airdropMaster ?? DEFAULT_MASTER_PDA,
|
|
2017
|
+
treasury: DROPSY_TREASURY,
|
|
2018
|
+
airdrop: input.airdrop,
|
|
2019
|
+
bitmap: input.claimMap,
|
|
2020
|
+
mint: input.mint,
|
|
2021
|
+
authority: input.authority,
|
|
2022
|
+
id: input.id ?? 0,
|
|
2023
|
+
total: input.total ?? MAX_BITMAP_CLAIM
|
|
2024
|
+
});
|
|
2025
|
+
}
|
|
1971
2026
|
|
|
1972
2027
|
// src/instructions/depositTokens.ts
|
|
1973
2028
|
import {
|
|
1974
2029
|
combineCodec as combineCodec11,
|
|
1975
2030
|
fixDecoderSize as fixDecoderSize11,
|
|
1976
2031
|
fixEncoderSize as fixEncoderSize12,
|
|
1977
|
-
getAddressEncoder as
|
|
2032
|
+
getAddressEncoder as getAddressEncoder11,
|
|
1978
2033
|
getBytesDecoder as getBytesDecoder11,
|
|
1979
2034
|
getBytesEncoder as getBytesEncoder12,
|
|
1980
|
-
getProgramDerivedAddress as
|
|
2035
|
+
getProgramDerivedAddress as getProgramDerivedAddress5,
|
|
1981
2036
|
getStructDecoder as getStructDecoder11,
|
|
1982
2037
|
getStructEncoder as getStructEncoder11,
|
|
1983
2038
|
getU64Decoder as getU64Decoder8,
|
|
@@ -2026,11 +2081,7 @@ async function getDepositTokensInstructionAsync(input, config) {
|
|
|
2026
2081
|
master: { value: input.master ?? null, isWritable: false },
|
|
2027
2082
|
config: { value: input.config ?? null, isWritable: false },
|
|
2028
2083
|
treasury: { value: input.treasury ?? null, isWritable: true },
|
|
2029
|
-
airdropMaster: { value: input.airdropMaster ?? null, isWritable:
|
|
2030
|
-
airdropMasterAuthority: {
|
|
2031
|
-
value: input.airdropMasterAuthority ?? null,
|
|
2032
|
-
isWritable: false
|
|
2033
|
-
},
|
|
2084
|
+
airdropMaster: { value: input.airdropMaster ?? null, isWritable: true },
|
|
2034
2085
|
affiliate: { value: input.affiliate ?? null, isWritable: true },
|
|
2035
2086
|
sourceTokenAccount: {
|
|
2036
2087
|
value: input.sourceTokenAccount ?? null,
|
|
@@ -2053,7 +2104,7 @@ async function getDepositTokensInstructionAsync(input, config) {
|
|
|
2053
2104
|
const accounts = originalAccounts;
|
|
2054
2105
|
const args = { ...input };
|
|
2055
2106
|
if (!accounts.master.value) {
|
|
2056
|
-
accounts.master.value = await
|
|
2107
|
+
accounts.master.value = await getProgramDerivedAddress5({
|
|
2057
2108
|
programAddress,
|
|
2058
2109
|
seeds: [
|
|
2059
2110
|
getBytesEncoder12().encode(new Uint8Array([109, 97, 115, 116, 101, 114]))
|
|
@@ -2061,7 +2112,7 @@ async function getDepositTokensInstructionAsync(input, config) {
|
|
|
2061
2112
|
});
|
|
2062
2113
|
}
|
|
2063
2114
|
if (!accounts.config.value) {
|
|
2064
|
-
accounts.config.value = await
|
|
2115
|
+
accounts.config.value = await getProgramDerivedAddress5({
|
|
2065
2116
|
programAddress,
|
|
2066
2117
|
seeds: [
|
|
2067
2118
|
getBytesEncoder12().encode(
|
|
@@ -2086,42 +2137,20 @@ async function getDepositTokensInstructionAsync(input, config) {
|
|
|
2086
2137
|
});
|
|
2087
2138
|
}
|
|
2088
2139
|
if (!accounts.airdropMaster.value) {
|
|
2089
|
-
accounts.airdropMaster.value =
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
new Uint8Array([
|
|
2094
|
-
97,
|
|
2095
|
-
105,
|
|
2096
|
-
114,
|
|
2097
|
-
100,
|
|
2098
|
-
114,
|
|
2099
|
-
111,
|
|
2100
|
-
112,
|
|
2101
|
-
95,
|
|
2102
|
-
109,
|
|
2103
|
-
97,
|
|
2104
|
-
115,
|
|
2105
|
-
116,
|
|
2106
|
-
101,
|
|
2107
|
-
114
|
|
2108
|
-
])
|
|
2109
|
-
),
|
|
2110
|
-
getAddressEncoder10().encode(
|
|
2111
|
-
expectAddress(accounts.airdropMasterAuthority.value)
|
|
2112
|
-
)
|
|
2113
|
-
]
|
|
2114
|
-
});
|
|
2140
|
+
accounts.airdropMaster.value = DEFAULT_MASTER_PDA;
|
|
2141
|
+
}
|
|
2142
|
+
if (!accounts.treasury.value) {
|
|
2143
|
+
accounts.treasury.value = DROPSY_TREASURY;
|
|
2115
2144
|
}
|
|
2116
2145
|
if (!accounts.airdrop.value) {
|
|
2117
|
-
accounts.airdrop.value = await
|
|
2146
|
+
accounts.airdrop.value = await getProgramDerivedAddress5({
|
|
2118
2147
|
programAddress,
|
|
2119
2148
|
seeds: [
|
|
2120
2149
|
getBytesEncoder12().encode(
|
|
2121
2150
|
new Uint8Array([97, 105, 114, 100, 114, 111, 112])
|
|
2122
2151
|
),
|
|
2123
|
-
|
|
2124
|
-
|
|
2152
|
+
getAddressEncoder11().encode(expectAddress(accounts.mint.value)),
|
|
2153
|
+
getAddressEncoder11().encode(expectAddress(accounts.authority.value))
|
|
2125
2154
|
]
|
|
2126
2155
|
});
|
|
2127
2156
|
}
|
|
@@ -2129,12 +2158,12 @@ async function getDepositTokensInstructionAsync(input, config) {
|
|
|
2129
2158
|
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
2130
2159
|
}
|
|
2131
2160
|
if (!accounts.destinationTokenAccount.value) {
|
|
2132
|
-
accounts.destinationTokenAccount.value = await
|
|
2161
|
+
accounts.destinationTokenAccount.value = await getProgramDerivedAddress5({
|
|
2133
2162
|
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
2134
2163
|
seeds: [
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2164
|
+
getAddressEncoder11().encode(expectAddress(accounts.airdrop.value)),
|
|
2165
|
+
getAddressEncoder11().encode(expectAddress(accounts.tokenProgram.value)),
|
|
2166
|
+
getAddressEncoder11().encode(expectAddress(accounts.mint.value))
|
|
2138
2167
|
]
|
|
2139
2168
|
});
|
|
2140
2169
|
}
|
|
@@ -2151,7 +2180,6 @@ async function getDepositTokensInstructionAsync(input, config) {
|
|
|
2151
2180
|
getAccountMeta(accounts.config),
|
|
2152
2181
|
getAccountMeta(accounts.treasury),
|
|
2153
2182
|
getAccountMeta(accounts.airdropMaster),
|
|
2154
|
-
getAccountMeta(accounts.airdropMasterAuthority),
|
|
2155
2183
|
getAccountMeta(accounts.affiliate),
|
|
2156
2184
|
getAccountMeta(accounts.sourceTokenAccount),
|
|
2157
2185
|
getAccountMeta(accounts.destinationTokenAccount),
|
|
@@ -2174,11 +2202,7 @@ function getDepositTokensInstruction(input, config) {
|
|
|
2174
2202
|
master: { value: input.master ?? null, isWritable: false },
|
|
2175
2203
|
config: { value: input.config ?? null, isWritable: false },
|
|
2176
2204
|
treasury: { value: input.treasury ?? null, isWritable: true },
|
|
2177
|
-
airdropMaster: { value: input.airdropMaster ?? null, isWritable:
|
|
2178
|
-
airdropMasterAuthority: {
|
|
2179
|
-
value: input.airdropMasterAuthority ?? null,
|
|
2180
|
-
isWritable: false
|
|
2181
|
-
},
|
|
2205
|
+
airdropMaster: { value: input.airdropMaster ?? null, isWritable: true },
|
|
2182
2206
|
affiliate: { value: input.affiliate ?? null, isWritable: true },
|
|
2183
2207
|
sourceTokenAccount: {
|
|
2184
2208
|
value: input.sourceTokenAccount ?? null,
|
|
@@ -2216,7 +2240,6 @@ function getDepositTokensInstruction(input, config) {
|
|
|
2216
2240
|
getAccountMeta(accounts.config),
|
|
2217
2241
|
getAccountMeta(accounts.treasury),
|
|
2218
2242
|
getAccountMeta(accounts.airdropMaster),
|
|
2219
|
-
getAccountMeta(accounts.airdropMasterAuthority),
|
|
2220
2243
|
getAccountMeta(accounts.affiliate),
|
|
2221
2244
|
getAccountMeta(accounts.sourceTokenAccount),
|
|
2222
2245
|
getAccountMeta(accounts.destinationTokenAccount),
|
|
@@ -2234,7 +2257,7 @@ function getDepositTokensInstruction(input, config) {
|
|
|
2234
2257
|
});
|
|
2235
2258
|
}
|
|
2236
2259
|
function parseDepositTokensInstruction(instruction) {
|
|
2237
|
-
if (instruction.accounts.length <
|
|
2260
|
+
if (instruction.accounts.length < 13) {
|
|
2238
2261
|
throw new Error("Not enough accounts");
|
|
2239
2262
|
}
|
|
2240
2263
|
let accountIndex = 0;
|
|
@@ -2254,7 +2277,6 @@ function parseDepositTokensInstruction(instruction) {
|
|
|
2254
2277
|
config: getNextAccount(),
|
|
2255
2278
|
treasury: getNextAccount(),
|
|
2256
2279
|
airdropMaster: getNextAccount(),
|
|
2257
|
-
airdropMasterAuthority: getNextAccount(),
|
|
2258
2280
|
affiliate: getNextOptionalAccount(),
|
|
2259
2281
|
sourceTokenAccount: getNextAccount(),
|
|
2260
2282
|
destinationTokenAccount: getNextAccount(),
|
|
@@ -2274,12 +2296,18 @@ import {
|
|
|
2274
2296
|
combineCodec as combineCodec27,
|
|
2275
2297
|
fixDecoderSize as fixDecoderSize14,
|
|
2276
2298
|
fixEncoderSize as fixEncoderSize15,
|
|
2277
|
-
getAddressEncoder as
|
|
2299
|
+
getAddressEncoder as getAddressEncoder22,
|
|
2300
|
+
getArrayDecoder as getArrayDecoder2,
|
|
2301
|
+
getArrayEncoder as getArrayEncoder2,
|
|
2278
2302
|
getBytesDecoder as getBytesDecoder14,
|
|
2279
2303
|
getBytesEncoder as getBytesEncoder15,
|
|
2280
|
-
|
|
2304
|
+
getOptionDecoder as getOptionDecoder4,
|
|
2305
|
+
getOptionEncoder as getOptionEncoder4,
|
|
2306
|
+
getProgramDerivedAddress as getProgramDerivedAddress6,
|
|
2281
2307
|
getStructDecoder as getStructDecoder27,
|
|
2282
2308
|
getStructEncoder as getStructEncoder27,
|
|
2309
|
+
getU64Decoder as getU64Decoder15,
|
|
2310
|
+
getU64Encoder as getU64Encoder15,
|
|
2283
2311
|
transformEncoder as transformEncoder12
|
|
2284
2312
|
} from "@solana/kit";
|
|
2285
2313
|
|
|
@@ -2316,7 +2344,7 @@ function getAdvancedFeeConfigCodec() {
|
|
|
2316
2344
|
import {
|
|
2317
2345
|
combineCodec as combineCodec13,
|
|
2318
2346
|
getAddressDecoder as getAddressDecoder8,
|
|
2319
|
-
getAddressEncoder as
|
|
2347
|
+
getAddressEncoder as getAddressEncoder12,
|
|
2320
2348
|
getI64Decoder as getI64Decoder4,
|
|
2321
2349
|
getI64Encoder as getI64Encoder4,
|
|
2322
2350
|
getStructDecoder as getStructDecoder13,
|
|
@@ -2326,8 +2354,8 @@ import {
|
|
|
2326
2354
|
} from "@solana/kit";
|
|
2327
2355
|
function getAirdropBoostedEncoder() {
|
|
2328
2356
|
return getStructEncoder13([
|
|
2329
|
-
["airdrop",
|
|
2330
|
-
["boostedBy",
|
|
2357
|
+
["airdrop", getAddressEncoder12()],
|
|
2358
|
+
["boostedBy", getAddressEncoder12()],
|
|
2331
2359
|
["boostAmount", getU64Encoder10()],
|
|
2332
2360
|
["timestamp", getI64Encoder4()]
|
|
2333
2361
|
]);
|
|
@@ -2348,7 +2376,7 @@ function getAirdropBoostedCodec() {
|
|
|
2348
2376
|
import {
|
|
2349
2377
|
combineCodec as combineCodec14,
|
|
2350
2378
|
getAddressDecoder as getAddressDecoder9,
|
|
2351
|
-
getAddressEncoder as
|
|
2379
|
+
getAddressEncoder as getAddressEncoder13,
|
|
2352
2380
|
getI64Decoder as getI64Decoder5,
|
|
2353
2381
|
getI64Encoder as getI64Encoder5,
|
|
2354
2382
|
getStructDecoder as getStructDecoder14,
|
|
@@ -2356,8 +2384,8 @@ import {
|
|
|
2356
2384
|
} from "@solana/kit";
|
|
2357
2385
|
function getAirdropClosedEncoder() {
|
|
2358
2386
|
return getStructEncoder14([
|
|
2359
|
-
["airdrop",
|
|
2360
|
-
["authority",
|
|
2387
|
+
["airdrop", getAddressEncoder13()],
|
|
2388
|
+
["authority", getAddressEncoder13()],
|
|
2361
2389
|
["timestamp", getI64Encoder5()]
|
|
2362
2390
|
]);
|
|
2363
2391
|
}
|
|
@@ -2376,7 +2404,7 @@ function getAirdropClosedCodec() {
|
|
|
2376
2404
|
import {
|
|
2377
2405
|
combineCodec as combineCodec15,
|
|
2378
2406
|
getAddressDecoder as getAddressDecoder10,
|
|
2379
|
-
getAddressEncoder as
|
|
2407
|
+
getAddressEncoder as getAddressEncoder14,
|
|
2380
2408
|
getStructDecoder as getStructDecoder15,
|
|
2381
2409
|
getStructEncoder as getStructEncoder15,
|
|
2382
2410
|
getU8Decoder as getU8Decoder9,
|
|
@@ -2384,9 +2412,9 @@ import {
|
|
|
2384
2412
|
} from "@solana/kit";
|
|
2385
2413
|
function getAirdropDelegatedEncoder() {
|
|
2386
2414
|
return getStructEncoder15([
|
|
2387
|
-
["airdrop",
|
|
2388
|
-
["authority",
|
|
2389
|
-
["delegate",
|
|
2415
|
+
["airdrop", getAddressEncoder14()],
|
|
2416
|
+
["authority", getAddressEncoder14()],
|
|
2417
|
+
["delegate", getAddressEncoder14()],
|
|
2390
2418
|
["permissions", getU8Encoder9()]
|
|
2391
2419
|
]);
|
|
2392
2420
|
}
|
|
@@ -2411,7 +2439,7 @@ import {
|
|
|
2411
2439
|
fixDecoderSize as fixDecoderSize12,
|
|
2412
2440
|
fixEncoderSize as fixEncoderSize13,
|
|
2413
2441
|
getAddressDecoder as getAddressDecoder11,
|
|
2414
|
-
getAddressEncoder as
|
|
2442
|
+
getAddressEncoder as getAddressEncoder15,
|
|
2415
2443
|
getBytesDecoder as getBytesDecoder12,
|
|
2416
2444
|
getBytesEncoder as getBytesEncoder13,
|
|
2417
2445
|
getI64Decoder as getI64Decoder6,
|
|
@@ -2421,10 +2449,10 @@ import {
|
|
|
2421
2449
|
} from "@solana/kit";
|
|
2422
2450
|
function getAirdropInitializedEncoder() {
|
|
2423
2451
|
return getStructEncoder16([
|
|
2424
|
-
["airdrop",
|
|
2425
|
-
["mint",
|
|
2426
|
-
["authority",
|
|
2427
|
-
["controller",
|
|
2452
|
+
["airdrop", getAddressEncoder15()],
|
|
2453
|
+
["mint", getAddressEncoder15()],
|
|
2454
|
+
["authority", getAddressEncoder15()],
|
|
2455
|
+
["controller", getAddressEncoder15()],
|
|
2428
2456
|
["merkleRoot", fixEncoderSize13(getBytesEncoder13(), 32)],
|
|
2429
2457
|
["startTime", getI64Encoder6()],
|
|
2430
2458
|
["endTime", getI64Encoder6()],
|
|
@@ -2454,14 +2482,14 @@ function getAirdropInitializedCodec() {
|
|
|
2454
2482
|
import {
|
|
2455
2483
|
combineCodec as combineCodec17,
|
|
2456
2484
|
getAddressDecoder as getAddressDecoder12,
|
|
2457
|
-
getAddressEncoder as
|
|
2485
|
+
getAddressEncoder as getAddressEncoder16,
|
|
2458
2486
|
getStructDecoder as getStructDecoder17,
|
|
2459
2487
|
getStructEncoder as getStructEncoder17
|
|
2460
2488
|
} from "@solana/kit";
|
|
2461
2489
|
function getAirdropUpdatedEncoder() {
|
|
2462
2490
|
return getStructEncoder17([
|
|
2463
|
-
["airdrop",
|
|
2464
|
-
["updatedBy",
|
|
2491
|
+
["airdrop", getAddressEncoder16()],
|
|
2492
|
+
["updatedBy", getAddressEncoder16()]
|
|
2465
2493
|
]);
|
|
2466
2494
|
}
|
|
2467
2495
|
function getAirdropUpdatedDecoder() {
|
|
@@ -2564,15 +2592,15 @@ function getBaseFeeConfigCodec() {
|
|
|
2564
2592
|
import {
|
|
2565
2593
|
combineCodec as combineCodec21,
|
|
2566
2594
|
getAddressDecoder as getAddressDecoder13,
|
|
2567
|
-
getAddressEncoder as
|
|
2595
|
+
getAddressEncoder as getAddressEncoder17,
|
|
2568
2596
|
getStructDecoder as getStructDecoder21,
|
|
2569
2597
|
getStructEncoder as getStructEncoder21
|
|
2570
2598
|
} from "@solana/kit";
|
|
2571
2599
|
function getClaimMapClosedEncoder() {
|
|
2572
2600
|
return getStructEncoder21([
|
|
2573
|
-
["airdrop",
|
|
2574
|
-
["bitmap",
|
|
2575
|
-
["authority",
|
|
2601
|
+
["airdrop", getAddressEncoder17()],
|
|
2602
|
+
["bitmap", getAddressEncoder17()],
|
|
2603
|
+
["authority", getAddressEncoder17()]
|
|
2576
2604
|
]);
|
|
2577
2605
|
}
|
|
2578
2606
|
function getClaimMapClosedDecoder() {
|
|
@@ -2590,7 +2618,7 @@ function getClaimMapClosedCodec() {
|
|
|
2590
2618
|
import {
|
|
2591
2619
|
combineCodec as combineCodec22,
|
|
2592
2620
|
getAddressDecoder as getAddressDecoder14,
|
|
2593
|
-
getAddressEncoder as
|
|
2621
|
+
getAddressEncoder as getAddressEncoder18,
|
|
2594
2622
|
getI64Decoder as getI64Decoder8,
|
|
2595
2623
|
getI64Encoder as getI64Encoder8,
|
|
2596
2624
|
getStructDecoder as getStructDecoder22,
|
|
@@ -2600,8 +2628,8 @@ import {
|
|
|
2600
2628
|
} from "@solana/kit";
|
|
2601
2629
|
function getClaimMapInitializedEncoder() {
|
|
2602
2630
|
return getStructEncoder22([
|
|
2603
|
-
["airdrop",
|
|
2604
|
-
["bitmap",
|
|
2631
|
+
["airdrop", getAddressEncoder18()],
|
|
2632
|
+
["bitmap", getAddressEncoder18()],
|
|
2605
2633
|
["bitmapId", getU16Encoder6()],
|
|
2606
2634
|
["timestamp", getI64Encoder8()]
|
|
2607
2635
|
]);
|
|
@@ -2664,7 +2692,7 @@ function getInitAirdropConfigArgsCodec() {
|
|
|
2664
2692
|
import {
|
|
2665
2693
|
combineCodec as combineCodec24,
|
|
2666
2694
|
getAddressDecoder as getAddressDecoder15,
|
|
2667
|
-
getAddressEncoder as
|
|
2695
|
+
getAddressEncoder as getAddressEncoder19,
|
|
2668
2696
|
getI64Decoder as getI64Decoder9,
|
|
2669
2697
|
getI64Encoder as getI64Encoder9,
|
|
2670
2698
|
getStructDecoder as getStructDecoder24,
|
|
@@ -2672,9 +2700,9 @@ import {
|
|
|
2672
2700
|
} from "@solana/kit";
|
|
2673
2701
|
function getMasterInitializedEncoder() {
|
|
2674
2702
|
return getStructEncoder24([
|
|
2675
|
-
["address",
|
|
2676
|
-
["authority",
|
|
2677
|
-
["treasury",
|
|
2703
|
+
["address", getAddressEncoder19()],
|
|
2704
|
+
["authority", getAddressEncoder19()],
|
|
2705
|
+
["treasury", getAddressEncoder19()],
|
|
2678
2706
|
["timestamp", getI64Encoder9()]
|
|
2679
2707
|
]);
|
|
2680
2708
|
}
|
|
@@ -2697,7 +2725,7 @@ function getMasterInitializedCodec() {
|
|
|
2697
2725
|
import {
|
|
2698
2726
|
combineCodec as combineCodec25,
|
|
2699
2727
|
getAddressDecoder as getAddressDecoder16,
|
|
2700
|
-
getAddressEncoder as
|
|
2728
|
+
getAddressEncoder as getAddressEncoder20,
|
|
2701
2729
|
getI64Decoder as getI64Decoder10,
|
|
2702
2730
|
getI64Encoder as getI64Encoder10,
|
|
2703
2731
|
getStructDecoder as getStructDecoder25,
|
|
@@ -2707,10 +2735,10 @@ import {
|
|
|
2707
2735
|
} from "@solana/kit";
|
|
2708
2736
|
function getTokensDepositedEncoder() {
|
|
2709
2737
|
return getStructEncoder25([
|
|
2710
|
-
["airdrop",
|
|
2738
|
+
["airdrop", getAddressEncoder20()],
|
|
2711
2739
|
["amount", getU64Encoder14()],
|
|
2712
2740
|
["newSupply", getU64Encoder14()],
|
|
2713
|
-
["depositor",
|
|
2741
|
+
["depositor", getAddressEncoder20()],
|
|
2714
2742
|
["timestamp", getI64Encoder10()]
|
|
2715
2743
|
]);
|
|
2716
2744
|
}
|
|
@@ -2731,7 +2759,7 @@ function getTokensDepositedCodec() {
|
|
|
2731
2759
|
import {
|
|
2732
2760
|
combineCodec as combineCodec26,
|
|
2733
2761
|
getAddressDecoder as getAddressDecoder17,
|
|
2734
|
-
getAddressEncoder as
|
|
2762
|
+
getAddressEncoder as getAddressEncoder21,
|
|
2735
2763
|
getI64Decoder as getI64Decoder11,
|
|
2736
2764
|
getI64Encoder as getI64Encoder11,
|
|
2737
2765
|
getStructDecoder as getStructDecoder26,
|
|
@@ -2739,8 +2767,8 @@ import {
|
|
|
2739
2767
|
} from "@solana/kit";
|
|
2740
2768
|
function getTokensRedeemedEncoder() {
|
|
2741
2769
|
return getStructEncoder26([
|
|
2742
|
-
["airdrop",
|
|
2743
|
-
["authority",
|
|
2770
|
+
["airdrop", getAddressEncoder21()],
|
|
2771
|
+
["authority", getAddressEncoder21()],
|
|
2744
2772
|
["timestamp", getI64Encoder11()]
|
|
2745
2773
|
]);
|
|
2746
2774
|
}
|
|
@@ -2775,10 +2803,17 @@ function getInitializeAirdropMasterInstructionDataEncoder() {
|
|
|
2775
2803
|
return transformEncoder12(
|
|
2776
2804
|
getStructEncoder27([
|
|
2777
2805
|
["discriminator", fixEncoderSize15(getBytesEncoder15(), 8)],
|
|
2778
|
-
["merkleRoot", fixEncoderSize15(getBytesEncoder15(), 32)],
|
|
2779
|
-
["
|
|
2780
|
-
["
|
|
2781
|
-
["
|
|
2806
|
+
["merkleRoot", getOptionEncoder4(fixEncoderSize15(getBytesEncoder15(), 32))],
|
|
2807
|
+
["airdropCreateFee", getOptionEncoder4(getU64Encoder15())],
|
|
2808
|
+
["airdropUpdateFee", getOptionEncoder4(getU64Encoder15())],
|
|
2809
|
+
["bitmapCreateFee", getOptionEncoder4(getU64Encoder15())],
|
|
2810
|
+
["advancedConfig", getOptionEncoder4(getAdvancedFeeConfigEncoder())],
|
|
2811
|
+
[
|
|
2812
|
+
"wlProof",
|
|
2813
|
+
getOptionEncoder4(
|
|
2814
|
+
getArrayEncoder2(fixEncoderSize15(getBytesEncoder15(), 32))
|
|
2815
|
+
)
|
|
2816
|
+
]
|
|
2782
2817
|
]),
|
|
2783
2818
|
(value) => ({
|
|
2784
2819
|
...value,
|
|
@@ -2789,10 +2824,15 @@ function getInitializeAirdropMasterInstructionDataEncoder() {
|
|
|
2789
2824
|
function getInitializeAirdropMasterInstructionDataDecoder() {
|
|
2790
2825
|
return getStructDecoder27([
|
|
2791
2826
|
["discriminator", fixDecoderSize14(getBytesDecoder14(), 8)],
|
|
2792
|
-
["merkleRoot", fixDecoderSize14(getBytesDecoder14(), 32)],
|
|
2793
|
-
["
|
|
2794
|
-
["
|
|
2795
|
-
["
|
|
2827
|
+
["merkleRoot", getOptionDecoder4(fixDecoderSize14(getBytesDecoder14(), 32))],
|
|
2828
|
+
["airdropCreateFee", getOptionDecoder4(getU64Decoder15())],
|
|
2829
|
+
["airdropUpdateFee", getOptionDecoder4(getU64Decoder15())],
|
|
2830
|
+
["bitmapCreateFee", getOptionDecoder4(getU64Decoder15())],
|
|
2831
|
+
["advancedConfig", getOptionDecoder4(getAdvancedFeeConfigDecoder())],
|
|
2832
|
+
[
|
|
2833
|
+
"wlProof",
|
|
2834
|
+
getOptionDecoder4(getArrayDecoder2(fixDecoderSize14(getBytesDecoder14(), 32)))
|
|
2835
|
+
]
|
|
2796
2836
|
]);
|
|
2797
2837
|
}
|
|
2798
2838
|
function getInitializeAirdropMasterInstructionDataCodec() {
|
|
@@ -2818,7 +2858,7 @@ async function getInitializeAirdropMasterInstructionAsync(input, config) {
|
|
|
2818
2858
|
const accounts = originalAccounts;
|
|
2819
2859
|
const args = { ...input };
|
|
2820
2860
|
if (!accounts.master.value) {
|
|
2821
|
-
accounts.master.value = await
|
|
2861
|
+
accounts.master.value = await getProgramDerivedAddress6({
|
|
2822
2862
|
programAddress,
|
|
2823
2863
|
seeds: [
|
|
2824
2864
|
getBytesEncoder15().encode(new Uint8Array([109, 97, 115, 116, 101, 114]))
|
|
@@ -2826,7 +2866,7 @@ async function getInitializeAirdropMasterInstructionAsync(input, config) {
|
|
|
2826
2866
|
});
|
|
2827
2867
|
}
|
|
2828
2868
|
if (!accounts.config.value) {
|
|
2829
|
-
accounts.config.value = await
|
|
2869
|
+
accounts.config.value = await getProgramDerivedAddress6({
|
|
2830
2870
|
programAddress,
|
|
2831
2871
|
seeds: [
|
|
2832
2872
|
getBytesEncoder15().encode(
|
|
@@ -2851,7 +2891,7 @@ async function getInitializeAirdropMasterInstructionAsync(input, config) {
|
|
|
2851
2891
|
});
|
|
2852
2892
|
}
|
|
2853
2893
|
if (!accounts.airdropMaster.value) {
|
|
2854
|
-
accounts.airdropMaster.value = await
|
|
2894
|
+
accounts.airdropMaster.value = await getProgramDerivedAddress6({
|
|
2855
2895
|
programAddress,
|
|
2856
2896
|
seeds: [
|
|
2857
2897
|
getBytesEncoder15().encode(
|
|
@@ -2872,7 +2912,7 @@ async function getInitializeAirdropMasterInstructionAsync(input, config) {
|
|
|
2872
2912
|
114
|
|
2873
2913
|
])
|
|
2874
2914
|
),
|
|
2875
|
-
|
|
2915
|
+
getAddressEncoder22().encode(expectAddress(accounts.authority.value))
|
|
2876
2916
|
]
|
|
2877
2917
|
});
|
|
2878
2918
|
}
|
|
@@ -2970,11 +3010,11 @@ import {
|
|
|
2970
3010
|
fixEncoderSize as fixEncoderSize16,
|
|
2971
3011
|
getBytesDecoder as getBytesDecoder15,
|
|
2972
3012
|
getBytesEncoder as getBytesEncoder16,
|
|
2973
|
-
getProgramDerivedAddress as
|
|
3013
|
+
getProgramDerivedAddress as getProgramDerivedAddress7,
|
|
2974
3014
|
getStructDecoder as getStructDecoder28,
|
|
2975
3015
|
getStructEncoder as getStructEncoder28,
|
|
2976
|
-
getU64Decoder as
|
|
2977
|
-
getU64Encoder as
|
|
3016
|
+
getU64Decoder as getU64Decoder16,
|
|
3017
|
+
getU64Encoder as getU64Encoder16,
|
|
2978
3018
|
transformEncoder as transformEncoder13
|
|
2979
3019
|
} from "@solana/kit";
|
|
2980
3020
|
var INITIALIZE_MASTER_DISCRIMINATOR = new Uint8Array([
|
|
@@ -2997,7 +3037,7 @@ function getInitializeMasterInstructionDataEncoder() {
|
|
|
2997
3037
|
getStructEncoder28([
|
|
2998
3038
|
["discriminator", fixEncoderSize16(getBytesEncoder16(), 8)],
|
|
2999
3039
|
["airdropConfig", getInitAirdropConfigArgsEncoder()],
|
|
3000
|
-
["protocolFee",
|
|
3040
|
+
["protocolFee", getU64Encoder16()]
|
|
3001
3041
|
]),
|
|
3002
3042
|
(value) => ({ ...value, discriminator: INITIALIZE_MASTER_DISCRIMINATOR })
|
|
3003
3043
|
);
|
|
@@ -3006,7 +3046,7 @@ function getInitializeMasterInstructionDataDecoder() {
|
|
|
3006
3046
|
return getStructDecoder28([
|
|
3007
3047
|
["discriminator", fixDecoderSize15(getBytesDecoder15(), 8)],
|
|
3008
3048
|
["airdropConfig", getInitAirdropConfigArgsDecoder()],
|
|
3009
|
-
["protocolFee",
|
|
3049
|
+
["protocolFee", getU64Decoder16()]
|
|
3010
3050
|
]);
|
|
3011
3051
|
}
|
|
3012
3052
|
function getInitializeMasterInstructionDataCodec() {
|
|
@@ -3028,7 +3068,7 @@ async function getInitializeMasterInstructionAsync(input, config) {
|
|
|
3028
3068
|
const accounts = originalAccounts;
|
|
3029
3069
|
const args = { ...input };
|
|
3030
3070
|
if (!accounts.master.value) {
|
|
3031
|
-
accounts.master.value = await
|
|
3071
|
+
accounts.master.value = await getProgramDerivedAddress7({
|
|
3032
3072
|
programAddress,
|
|
3033
3073
|
seeds: [
|
|
3034
3074
|
getBytesEncoder16().encode(new Uint8Array([109, 97, 115, 116, 101, 114]))
|
|
@@ -3036,7 +3076,7 @@ async function getInitializeMasterInstructionAsync(input, config) {
|
|
|
3036
3076
|
});
|
|
3037
3077
|
}
|
|
3038
3078
|
if (!accounts.config.value) {
|
|
3039
|
-
accounts.config.value = await
|
|
3079
|
+
accounts.config.value = await getProgramDerivedAddress7({
|
|
3040
3080
|
programAddress,
|
|
3041
3081
|
seeds: [
|
|
3042
3082
|
getBytesEncoder16().encode(
|
|
@@ -3149,10 +3189,10 @@ import {
|
|
|
3149
3189
|
combineCodec as combineCodec29,
|
|
3150
3190
|
fixDecoderSize as fixDecoderSize16,
|
|
3151
3191
|
fixEncoderSize as fixEncoderSize17,
|
|
3152
|
-
getAddressEncoder as
|
|
3192
|
+
getAddressEncoder as getAddressEncoder23,
|
|
3153
3193
|
getBytesDecoder as getBytesDecoder16,
|
|
3154
3194
|
getBytesEncoder as getBytesEncoder17,
|
|
3155
|
-
getProgramDerivedAddress as
|
|
3195
|
+
getProgramDerivedAddress as getProgramDerivedAddress8,
|
|
3156
3196
|
getStructDecoder as getStructDecoder29,
|
|
3157
3197
|
getStructEncoder as getStructEncoder29,
|
|
3158
3198
|
transformEncoder as transformEncoder14
|
|
@@ -3198,11 +3238,7 @@ async function getRedeemAirdropTokensInstructionAsync(input, config) {
|
|
|
3198
3238
|
master: { value: input.master ?? null, isWritable: false },
|
|
3199
3239
|
config: { value: input.config ?? null, isWritable: false },
|
|
3200
3240
|
treasury: { value: input.treasury ?? null, isWritable: true },
|
|
3201
|
-
airdropMaster: { value: input.airdropMaster ?? null, isWritable:
|
|
3202
|
-
airdropMasterAuthority: {
|
|
3203
|
-
value: input.airdropMasterAuthority ?? null,
|
|
3204
|
-
isWritable: false
|
|
3205
|
-
},
|
|
3241
|
+
airdropMaster: { value: input.airdropMaster ?? null, isWritable: true },
|
|
3206
3242
|
affiliate: { value: input.affiliate ?? null, isWritable: true },
|
|
3207
3243
|
sourceTokenAccount: {
|
|
3208
3244
|
value: input.sourceTokenAccount ?? null,
|
|
@@ -3224,7 +3260,7 @@ async function getRedeemAirdropTokensInstructionAsync(input, config) {
|
|
|
3224
3260
|
};
|
|
3225
3261
|
const accounts = originalAccounts;
|
|
3226
3262
|
if (!accounts.master.value) {
|
|
3227
|
-
accounts.master.value = await
|
|
3263
|
+
accounts.master.value = await getProgramDerivedAddress8({
|
|
3228
3264
|
programAddress,
|
|
3229
3265
|
seeds: [
|
|
3230
3266
|
getBytesEncoder17().encode(new Uint8Array([109, 97, 115, 116, 101, 114]))
|
|
@@ -3232,7 +3268,7 @@ async function getRedeemAirdropTokensInstructionAsync(input, config) {
|
|
|
3232
3268
|
});
|
|
3233
3269
|
}
|
|
3234
3270
|
if (!accounts.config.value) {
|
|
3235
|
-
accounts.config.value = await
|
|
3271
|
+
accounts.config.value = await getProgramDerivedAddress8({
|
|
3236
3272
|
programAddress,
|
|
3237
3273
|
seeds: [
|
|
3238
3274
|
getBytesEncoder17().encode(
|
|
@@ -3256,43 +3292,15 @@ async function getRedeemAirdropTokensInstructionAsync(input, config) {
|
|
|
3256
3292
|
]
|
|
3257
3293
|
});
|
|
3258
3294
|
}
|
|
3259
|
-
if (!accounts.airdropMaster.value) {
|
|
3260
|
-
accounts.airdropMaster.value = await getProgramDerivedAddress7({
|
|
3261
|
-
programAddress,
|
|
3262
|
-
seeds: [
|
|
3263
|
-
getBytesEncoder17().encode(
|
|
3264
|
-
new Uint8Array([
|
|
3265
|
-
97,
|
|
3266
|
-
105,
|
|
3267
|
-
114,
|
|
3268
|
-
100,
|
|
3269
|
-
114,
|
|
3270
|
-
111,
|
|
3271
|
-
112,
|
|
3272
|
-
95,
|
|
3273
|
-
109,
|
|
3274
|
-
97,
|
|
3275
|
-
115,
|
|
3276
|
-
116,
|
|
3277
|
-
101,
|
|
3278
|
-
114
|
|
3279
|
-
])
|
|
3280
|
-
),
|
|
3281
|
-
getAddressEncoder22().encode(
|
|
3282
|
-
expectAddress(accounts.airdropMasterAuthority.value)
|
|
3283
|
-
)
|
|
3284
|
-
]
|
|
3285
|
-
});
|
|
3286
|
-
}
|
|
3287
3295
|
if (!accounts.airdrop.value) {
|
|
3288
|
-
accounts.airdrop.value = await
|
|
3296
|
+
accounts.airdrop.value = await getProgramDerivedAddress8({
|
|
3289
3297
|
programAddress,
|
|
3290
3298
|
seeds: [
|
|
3291
3299
|
getBytesEncoder17().encode(
|
|
3292
3300
|
new Uint8Array([97, 105, 114, 100, 114, 111, 112])
|
|
3293
3301
|
),
|
|
3294
|
-
|
|
3295
|
-
|
|
3302
|
+
getAddressEncoder23().encode(expectAddress(accounts.mint.value)),
|
|
3303
|
+
getAddressEncoder23().encode(expectAddress(accounts.authority.value))
|
|
3296
3304
|
]
|
|
3297
3305
|
});
|
|
3298
3306
|
}
|
|
@@ -3300,12 +3308,12 @@ async function getRedeemAirdropTokensInstructionAsync(input, config) {
|
|
|
3300
3308
|
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
3301
3309
|
}
|
|
3302
3310
|
if (!accounts.destinationTokenAccount.value) {
|
|
3303
|
-
accounts.destinationTokenAccount.value = await
|
|
3311
|
+
accounts.destinationTokenAccount.value = await getProgramDerivedAddress8({
|
|
3304
3312
|
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
3305
3313
|
seeds: [
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3314
|
+
getAddressEncoder23().encode(expectAddress(accounts.airdrop.value)),
|
|
3315
|
+
getAddressEncoder23().encode(expectAddress(accounts.tokenProgram.value)),
|
|
3316
|
+
getAddressEncoder23().encode(expectAddress(accounts.mint.value))
|
|
3309
3317
|
]
|
|
3310
3318
|
});
|
|
3311
3319
|
}
|
|
@@ -3322,7 +3330,6 @@ async function getRedeemAirdropTokensInstructionAsync(input, config) {
|
|
|
3322
3330
|
getAccountMeta(accounts.config),
|
|
3323
3331
|
getAccountMeta(accounts.treasury),
|
|
3324
3332
|
getAccountMeta(accounts.airdropMaster),
|
|
3325
|
-
getAccountMeta(accounts.airdropMasterAuthority),
|
|
3326
3333
|
getAccountMeta(accounts.affiliate),
|
|
3327
3334
|
getAccountMeta(accounts.sourceTokenAccount),
|
|
3328
3335
|
getAccountMeta(accounts.destinationTokenAccount),
|
|
@@ -3343,11 +3350,7 @@ function getRedeemAirdropTokensInstruction(input, config) {
|
|
|
3343
3350
|
master: { value: input.master ?? null, isWritable: false },
|
|
3344
3351
|
config: { value: input.config ?? null, isWritable: false },
|
|
3345
3352
|
treasury: { value: input.treasury ?? null, isWritable: true },
|
|
3346
|
-
airdropMaster: { value: input.airdropMaster ?? null, isWritable:
|
|
3347
|
-
airdropMasterAuthority: {
|
|
3348
|
-
value: input.airdropMasterAuthority ?? null,
|
|
3349
|
-
isWritable: false
|
|
3350
|
-
},
|
|
3353
|
+
airdropMaster: { value: input.airdropMaster ?? null, isWritable: true },
|
|
3351
3354
|
affiliate: { value: input.affiliate ?? null, isWritable: true },
|
|
3352
3355
|
sourceTokenAccount: {
|
|
3353
3356
|
value: input.sourceTokenAccount ?? null,
|
|
@@ -3384,7 +3387,6 @@ function getRedeemAirdropTokensInstruction(input, config) {
|
|
|
3384
3387
|
getAccountMeta(accounts.config),
|
|
3385
3388
|
getAccountMeta(accounts.treasury),
|
|
3386
3389
|
getAccountMeta(accounts.airdropMaster),
|
|
3387
|
-
getAccountMeta(accounts.airdropMasterAuthority),
|
|
3388
3390
|
getAccountMeta(accounts.affiliate),
|
|
3389
3391
|
getAccountMeta(accounts.sourceTokenAccount),
|
|
3390
3392
|
getAccountMeta(accounts.destinationTokenAccount),
|
|
@@ -3400,7 +3402,7 @@ function getRedeemAirdropTokensInstruction(input, config) {
|
|
|
3400
3402
|
});
|
|
3401
3403
|
}
|
|
3402
3404
|
function parseRedeemAirdropTokensInstruction(instruction) {
|
|
3403
|
-
if (instruction.accounts.length <
|
|
3405
|
+
if (instruction.accounts.length < 13) {
|
|
3404
3406
|
throw new Error("Not enough accounts");
|
|
3405
3407
|
}
|
|
3406
3408
|
let accountIndex = 0;
|
|
@@ -3420,7 +3422,6 @@ function parseRedeemAirdropTokensInstruction(instruction) {
|
|
|
3420
3422
|
config: getNextAccount(),
|
|
3421
3423
|
treasury: getNextAccount(),
|
|
3422
3424
|
airdropMaster: getNextAccount(),
|
|
3423
|
-
airdropMasterAuthority: getNextAccount(),
|
|
3424
3425
|
affiliate: getNextOptionalAccount(),
|
|
3425
3426
|
sourceTokenAccount: getNextAccount(),
|
|
3426
3427
|
destinationTokenAccount: getNextAccount(),
|
|
@@ -3436,80 +3437,6 @@ function parseRedeemAirdropTokensInstruction(instruction) {
|
|
|
3436
3437
|
)
|
|
3437
3438
|
};
|
|
3438
3439
|
}
|
|
3439
|
-
|
|
3440
|
-
// src/utils/derive.ts
|
|
3441
|
-
import {
|
|
3442
|
-
getAddressEncoder as getAddressEncoder23,
|
|
3443
|
-
getProgramDerivedAddress as getProgramDerivedAddress8
|
|
3444
|
-
} from "@solana/kit";
|
|
3445
|
-
|
|
3446
|
-
// src/constants/index.ts
|
|
3447
|
-
import { address } from "@solana/kit";
|
|
3448
|
-
var DROPSY_MASTER_SEED = "master";
|
|
3449
|
-
var AIRDROP_CONFIG_SEED = "airdrop_config";
|
|
3450
|
-
var AFFILIATE_MASTER_SEED = "affiliate_master";
|
|
3451
|
-
var AIRDROP_MASTER_SEED = "airdrop_master";
|
|
3452
|
-
var AIRDROP_SEED = "airdrop";
|
|
3453
|
-
var AFFILIATE_SEED = "affiliate";
|
|
3454
|
-
var BITMAP_SEED = "bitmap";
|
|
3455
|
-
var VESTING_SEED = "vesting";
|
|
3456
|
-
var PRESALE_SEED = "presale";
|
|
3457
|
-
var VAULT_SEED = "vault";
|
|
3458
|
-
var ADMIN = address("8mtUD2XrkNnTxnjCehZ4DEtTXeGR1yrepSEGhCaSj2kT");
|
|
3459
|
-
var BITMAP_SIZE = 8e3;
|
|
3460
|
-
var MAX_BITMAP_CLAIM = BITMAP_SIZE * 8;
|
|
3461
|
-
var VERSION_BASIC = 0;
|
|
3462
|
-
var VERSION_VESTED = 1;
|
|
3463
|
-
var STATE_INITIALIZED = 0;
|
|
3464
|
-
var STATE_DELEGATED = 1;
|
|
3465
|
-
var STATE_REDEEMED = 2;
|
|
3466
|
-
var MUTABLE_NONE = 0;
|
|
3467
|
-
|
|
3468
|
-
// src/utils/derive.ts
|
|
3469
|
-
async function getDropsyDerivedAddress(seeds) {
|
|
3470
|
-
return await getProgramDerivedAddress8({
|
|
3471
|
-
seeds,
|
|
3472
|
-
programAddress: DROPSY_PROGRAM_ADDRESS
|
|
3473
|
-
});
|
|
3474
|
-
}
|
|
3475
|
-
async function getMasterDerivedAddress() {
|
|
3476
|
-
return await getDropsyDerivedAddress([DROPSY_MASTER_SEED]);
|
|
3477
|
-
}
|
|
3478
|
-
async function getAirdropConfigDerivedAddress() {
|
|
3479
|
-
return await getDropsyDerivedAddress([AIRDROP_CONFIG_SEED]);
|
|
3480
|
-
}
|
|
3481
|
-
async function getAirdropMasterDerivedAddress(authority) {
|
|
3482
|
-
const seeds = [
|
|
3483
|
-
AIRDROP_MASTER_SEED,
|
|
3484
|
-
getAddressEncoder23().encode(authority)
|
|
3485
|
-
];
|
|
3486
|
-
return await getDropsyDerivedAddress(seeds);
|
|
3487
|
-
}
|
|
3488
|
-
async function getAffiliateDerivedAddress(authority) {
|
|
3489
|
-
const seeds = [
|
|
3490
|
-
AFFILIATE_SEED,
|
|
3491
|
-
getAddressEncoder23().encode(authority)
|
|
3492
|
-
];
|
|
3493
|
-
return await getDropsyDerivedAddress(seeds);
|
|
3494
|
-
}
|
|
3495
|
-
async function getAirdropDerivedAddress(authority, mint) {
|
|
3496
|
-
const seeds = [
|
|
3497
|
-
AIRDROP_SEED,
|
|
3498
|
-
getAddressEncoder23().encode(mint),
|
|
3499
|
-
getAddressEncoder23().encode(authority)
|
|
3500
|
-
];
|
|
3501
|
-
return await getDropsyDerivedAddress(seeds);
|
|
3502
|
-
}
|
|
3503
|
-
async function getClaimMapDerivedAddress(airdrop, id) {
|
|
3504
|
-
const idBuffer = Buffer.alloc(2);
|
|
3505
|
-
idBuffer.writeUInt16LE(id);
|
|
3506
|
-
const seeds = [
|
|
3507
|
-
BITMAP_SEED,
|
|
3508
|
-
getAddressEncoder23().encode(airdrop),
|
|
3509
|
-
idBuffer
|
|
3510
|
-
];
|
|
3511
|
-
return await getDropsyDerivedAddress(seeds);
|
|
3512
|
-
}
|
|
3513
3440
|
export {
|
|
3514
3441
|
ADMIN,
|
|
3515
3442
|
AFFILIATE_DISCRIMINATOR,
|
|
@@ -3528,6 +3455,8 @@ export {
|
|
|
3528
3455
|
CLAIM_MAP_DISCRIMINATOR,
|
|
3529
3456
|
CREATE_AIRDROP_DISCRIMINATOR,
|
|
3530
3457
|
CREATE_CLAIM_MAP_DISCRIMINATOR,
|
|
3458
|
+
DEFAULT_MASTER_PDA,
|
|
3459
|
+
DEFAULT_MASTER_PDA_AUTHORITY,
|
|
3531
3460
|
DEPOSIT_TOKENS_DISCRIMINATOR,
|
|
3532
3461
|
DROPSY_ERROR__ACTIVE_BITMAPS_EXIST,
|
|
3533
3462
|
DROPSY_ERROR__AIRDROP_ENDED,
|
|
@@ -3606,6 +3535,7 @@ export {
|
|
|
3606
3535
|
DROPSY_ERROR__VESTING_ACCOUNT_REQUIRED,
|
|
3607
3536
|
DROPSY_MASTER_SEED,
|
|
3608
3537
|
DROPSY_PROGRAM_ADDRESS,
|
|
3538
|
+
DROPSY_TREASURY,
|
|
3609
3539
|
DropsyAccount,
|
|
3610
3540
|
DropsyInstruction,
|
|
3611
3541
|
INITIALIZE_AIRDROP_MASTER_DISCRIMINATOR,
|
|
@@ -3622,6 +3552,10 @@ export {
|
|
|
3622
3552
|
VERSION_BASIC,
|
|
3623
3553
|
VERSION_VESTED,
|
|
3624
3554
|
VESTING_SEED,
|
|
3555
|
+
createDefaultSolanaClient,
|
|
3556
|
+
createMerkleTree,
|
|
3557
|
+
createTransactionMessageFromInstructions,
|
|
3558
|
+
createWLMerkleTree,
|
|
3625
3559
|
decodeAffiliate,
|
|
3626
3560
|
decodeAffiliateMaster,
|
|
3627
3561
|
decodeAirdrop,
|
|
@@ -3657,6 +3591,7 @@ export {
|
|
|
3657
3591
|
fetchMaybeAirdropMaster,
|
|
3658
3592
|
fetchMaybeClaimMap,
|
|
3659
3593
|
fetchMaybeMaster,
|
|
3594
|
+
generateKeyPairSignerWithSol,
|
|
3660
3595
|
getAdvancedFeeConfigCodec,
|
|
3661
3596
|
getAdvancedFeeConfigDecoder,
|
|
3662
3597
|
getAdvancedFeeConfigEncoder,
|
|
@@ -3744,6 +3679,7 @@ export {
|
|
|
3744
3679
|
getCreateClaimMapInstructionDataCodec,
|
|
3745
3680
|
getCreateClaimMapInstructionDataDecoder,
|
|
3746
3681
|
getCreateClaimMapInstructionDataEncoder,
|
|
3682
|
+
getCreateClaimMapV0Instruction,
|
|
3747
3683
|
getDepositTokensDiscriminatorBytes,
|
|
3748
3684
|
getDepositTokensInstruction,
|
|
3749
3685
|
getDepositTokensInstructionAsync,
|
|
@@ -3776,12 +3712,14 @@ export {
|
|
|
3776
3712
|
getMasterInitializedDecoder,
|
|
3777
3713
|
getMasterInitializedEncoder,
|
|
3778
3714
|
getMasterSize,
|
|
3715
|
+
getMerkleRootArray,
|
|
3779
3716
|
getRedeemAirdropTokensDiscriminatorBytes,
|
|
3780
3717
|
getRedeemAirdropTokensInstruction,
|
|
3781
3718
|
getRedeemAirdropTokensInstructionAsync,
|
|
3782
3719
|
getRedeemAirdropTokensInstructionDataCodec,
|
|
3783
3720
|
getRedeemAirdropTokensInstructionDataDecoder,
|
|
3784
3721
|
getRedeemAirdropTokensInstructionDataEncoder,
|
|
3722
|
+
getSimpleMerkleProof,
|
|
3785
3723
|
getTokensDepositedCodec,
|
|
3786
3724
|
getTokensDepositedDecoder,
|
|
3787
3725
|
getTokensDepositedEncoder,
|
|
@@ -3797,6 +3735,7 @@ export {
|
|
|
3797
3735
|
parseDepositTokensInstruction,
|
|
3798
3736
|
parseInitializeAirdropMasterInstruction,
|
|
3799
3737
|
parseInitializeMasterInstruction,
|
|
3800
|
-
parseRedeemAirdropTokensInstruction
|
|
3738
|
+
parseRedeemAirdropTokensInstruction,
|
|
3739
|
+
toUnixTimestamp
|
|
3801
3740
|
};
|
|
3802
3741
|
//# sourceMappingURL=index.mjs.map
|