@streamflow/distributor 8.0.0 → 8.0.1-alpha.p287.54fe41f
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/cjs/index.cjs +1573 -215
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -0
- package/dist/cjs/solana/descriptor/aligned_distributor.d.cts +962 -505
- package/dist/cjs/solana/descriptor/merkle_distributor.d.cts +1272 -560
- package/dist/cjs/solana/index.cjs +1573 -215
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +37 -96
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1572 -214
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/descriptor/aligned_distributor.d.ts +962 -505
- package/dist/esm/solana/descriptor/idl/aligned_distributor.json +86 -2
- package/dist/esm/solana/descriptor/idl/merkle_distributor.json +194 -6
- package/dist/esm/solana/descriptor/merkle_distributor.d.ts +1272 -560
- package/dist/esm/solana/index.d.ts +37 -96
- package/dist/esm/solana/index.js +1573 -214
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -4
package/dist/esm/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { PublicKey, TransactionInstruction, Connection, SystemProgram } from '@solana/web3.js';
|
|
2
2
|
import '@solana/wallet-adapter-base';
|
|
3
3
|
import { ICluster, ContractError, divCeilN, invariant, getNumberFromBN, getBN } from '@streamflow/common';
|
|
4
|
-
import { signAndExecuteTransaction, buildSendThrottler, prepareBaseInstructions, getMintAndProgram, ata, prepareWrappedAccount, prepareTransaction, checkOrCreateAtaBatch, pk } from '@streamflow/common/solana';
|
|
4
|
+
import { signAndExecuteTransaction, buildSendThrottler, prepareBaseInstructions, getMintAndProgram, ata, prepareWrappedAccount, createAndEstimateTransaction, prepareTransaction, checkOrCreateAtaBatch, pk, unwrapExecutionParams } from '@streamflow/common/solana';
|
|
5
5
|
import { Program } from '@coral-xyz/anchor';
|
|
6
|
-
import * as
|
|
6
|
+
import * as borsh7 from '@coral-xyz/borsh';
|
|
7
7
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
8
|
-
import
|
|
8
|
+
import BN5 from 'bn.js';
|
|
9
9
|
import { NATIVE_MINT, getTransferFeeConfig, ASSOCIATED_TOKEN_PROGRAM_ID, createTransferCheckedWithFeeInstruction, createTransferCheckedInstruction } from '@solana/spl-token';
|
|
10
10
|
import bs58 from 'bs58';
|
|
11
11
|
|
|
@@ -19,7 +19,6 @@ var __export = (target, all) => {
|
|
|
19
19
|
var solana_exports = {};
|
|
20
20
|
__export(solana_exports, {
|
|
21
21
|
AnchorErrorCode: () => AnchorErrorCode,
|
|
22
|
-
ClaimStatus: () => ClaimStatus,
|
|
23
22
|
ContractErrorCode: () => ContractErrorCode,
|
|
24
23
|
MerkleDistributor: () => MerkleDistributor,
|
|
25
24
|
SolanaAlignedDistributorClient: () => SolanaAlignedDistributorClient,
|
|
@@ -127,21 +126,21 @@ var PROGRAM_ID_CLI = new PublicKey("MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N"
|
|
|
127
126
|
var PROGRAM_ID = PROGRAM_ID_CLI;
|
|
128
127
|
|
|
129
128
|
// solana/generated/instructions/newDistributor.ts
|
|
130
|
-
var layout =
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
129
|
+
var layout = borsh7.struct([
|
|
130
|
+
borsh7.u64("version"),
|
|
131
|
+
borsh7.array(borsh7.u8(), 32, "root"),
|
|
132
|
+
borsh7.u64("maxTotalClaim"),
|
|
133
|
+
borsh7.u64("maxNumNodes"),
|
|
134
|
+
borsh7.u64("unlockPeriod"),
|
|
135
|
+
borsh7.u64("startVestingTs"),
|
|
136
|
+
borsh7.u64("endVestingTs"),
|
|
137
|
+
borsh7.u64("clawbackStartTs"),
|
|
138
|
+
borsh7.bool("claimsClosableByAdmin"),
|
|
139
|
+
borsh7.option(borsh7.bool(), "canUpdateDuration"),
|
|
140
|
+
borsh7.option(borsh7.u64(), "totalAmountUnlocked"),
|
|
141
|
+
borsh7.option(borsh7.u64(), "totalAmountLocked"),
|
|
142
|
+
borsh7.option(borsh7.bool(), "claimsClosableByClaimant"),
|
|
143
|
+
borsh7.option(borsh7.u16(), "claimsLimit")
|
|
145
144
|
]);
|
|
146
145
|
function newDistributor(args, accounts, programId = PROGRAM_ID) {
|
|
147
146
|
const keys = [
|
|
@@ -183,10 +182,10 @@ function newDistributor(args, accounts, programId = PROGRAM_ID) {
|
|
|
183
182
|
const ix = new TransactionInstruction({ keys, programId, data });
|
|
184
183
|
return ix;
|
|
185
184
|
}
|
|
186
|
-
var layout2 =
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
185
|
+
var layout2 = borsh7.struct([
|
|
186
|
+
borsh7.u64("amountUnlocked"),
|
|
187
|
+
borsh7.u64("amountLocked"),
|
|
188
|
+
borsh7.vec(borsh7.array(borsh7.u8(), 32), "proof")
|
|
190
189
|
]);
|
|
191
190
|
function newClaim(args, accounts, programId = PROGRAM_ID) {
|
|
192
191
|
const keys = [
|
|
@@ -247,10 +246,10 @@ function clawback(accounts, programId = PROGRAM_ID) {
|
|
|
247
246
|
const ix = new TransactionInstruction({ keys, programId, data });
|
|
248
247
|
return ix;
|
|
249
248
|
}
|
|
250
|
-
var layout3 =
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
249
|
+
var layout3 = borsh7.struct([
|
|
250
|
+
borsh7.option(borsh7.u64(), "amountUnlocked"),
|
|
251
|
+
borsh7.option(borsh7.u64(), "amountLocked"),
|
|
252
|
+
borsh7.option(borsh7.vec(borsh7.array(borsh7.u8(), 32)), "proof")
|
|
254
253
|
]);
|
|
255
254
|
function closeClaim(args, accounts, programId = PROGRAM_ID) {
|
|
256
255
|
const keys = [
|
|
@@ -299,6 +298,1316 @@ function setAdmin(accounts, programId = PROGRAM_ID) {
|
|
|
299
298
|
return ix;
|
|
300
299
|
}
|
|
301
300
|
|
|
301
|
+
// solana/descriptor/idl/merkle_distributor.json
|
|
302
|
+
var merkle_distributor_default = {
|
|
303
|
+
address: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N",
|
|
304
|
+
metadata: {
|
|
305
|
+
name: "merkle_distributor",
|
|
306
|
+
version: "1.5.0",
|
|
307
|
+
spec: "0.1.0",
|
|
308
|
+
description: "A Solana program for distributing tokens according to a Merkle root.",
|
|
309
|
+
repository: "https://github.com/streamflow-finance/distributor"
|
|
310
|
+
},
|
|
311
|
+
instructions: [
|
|
312
|
+
{
|
|
313
|
+
name: "_expose_claim",
|
|
314
|
+
discriminator: [103, 233, 83, 69, 115, 199, 128, 249],
|
|
315
|
+
accounts: [
|
|
316
|
+
{
|
|
317
|
+
name: "distributor",
|
|
318
|
+
docs: ["The [MerkleDistributor]."]
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
name: "claim_status",
|
|
322
|
+
docs: ["Claim Status PDA"],
|
|
323
|
+
optional: true,
|
|
324
|
+
pda: {
|
|
325
|
+
seeds: [
|
|
326
|
+
{
|
|
327
|
+
kind: "const",
|
|
328
|
+
value: [67, 108, 97, 105, 109, 83, 116, 97, 116, 117, 115]
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
kind: "account",
|
|
332
|
+
path: "claimant"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
kind: "account",
|
|
336
|
+
path: "distributor"
|
|
337
|
+
}
|
|
338
|
+
]
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
name: "compressed_claim_status",
|
|
343
|
+
docs: ["Compress Claim Status PDA"],
|
|
344
|
+
optional: true,
|
|
345
|
+
pda: {
|
|
346
|
+
seeds: [
|
|
347
|
+
{
|
|
348
|
+
kind: "const",
|
|
349
|
+
value: [67, 108, 97, 105, 109, 83, 116, 97, 116, 117, 115]
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
kind: "account",
|
|
353
|
+
path: "claimant"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
kind: "account",
|
|
357
|
+
path: "distributor"
|
|
358
|
+
}
|
|
359
|
+
]
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
name: "claimant",
|
|
364
|
+
docs: ["Who is claiming the tokens."],
|
|
365
|
+
signer: true
|
|
366
|
+
}
|
|
367
|
+
],
|
|
368
|
+
args: []
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
name: "claim_locked",
|
|
372
|
+
discriminator: [34, 206, 181, 23, 11, 207, 147, 90],
|
|
373
|
+
accounts: [
|
|
374
|
+
{
|
|
375
|
+
name: "distributor",
|
|
376
|
+
docs: ["The [MerkleDistributor]."],
|
|
377
|
+
writable: true
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
name: "claim_status",
|
|
381
|
+
writable: true,
|
|
382
|
+
pda: {
|
|
383
|
+
seeds: [
|
|
384
|
+
{
|
|
385
|
+
kind: "const",
|
|
386
|
+
value: [67, 108, 97, 105, 109, 83, 116, 97, 116, 117, 115]
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
kind: "account",
|
|
390
|
+
path: "claimant"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
kind: "account",
|
|
394
|
+
path: "distributor"
|
|
395
|
+
}
|
|
396
|
+
]
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
name: "from",
|
|
401
|
+
docs: ["Distributor ATA containing the tokens to distribute."],
|
|
402
|
+
writable: true,
|
|
403
|
+
pda: {
|
|
404
|
+
seeds: [
|
|
405
|
+
{
|
|
406
|
+
kind: "account",
|
|
407
|
+
path: "distributor"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
kind: "account",
|
|
411
|
+
path: "token_program"
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
kind: "account",
|
|
415
|
+
path: "distributor.mint",
|
|
416
|
+
account: "MerkleDistributor"
|
|
417
|
+
}
|
|
418
|
+
],
|
|
419
|
+
program: {
|
|
420
|
+
kind: "const",
|
|
421
|
+
value: [
|
|
422
|
+
140,
|
|
423
|
+
151,
|
|
424
|
+
37,
|
|
425
|
+
143,
|
|
426
|
+
78,
|
|
427
|
+
36,
|
|
428
|
+
137,
|
|
429
|
+
241,
|
|
430
|
+
187,
|
|
431
|
+
61,
|
|
432
|
+
16,
|
|
433
|
+
41,
|
|
434
|
+
20,
|
|
435
|
+
142,
|
|
436
|
+
13,
|
|
437
|
+
131,
|
|
438
|
+
11,
|
|
439
|
+
90,
|
|
440
|
+
19,
|
|
441
|
+
153,
|
|
442
|
+
218,
|
|
443
|
+
255,
|
|
444
|
+
16,
|
|
445
|
+
132,
|
|
446
|
+
4,
|
|
447
|
+
142,
|
|
448
|
+
123,
|
|
449
|
+
216,
|
|
450
|
+
219,
|
|
451
|
+
233,
|
|
452
|
+
248,
|
|
453
|
+
89
|
|
454
|
+
]
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
name: "to",
|
|
460
|
+
docs: [
|
|
461
|
+
"Account to send the claimed tokens to.",
|
|
462
|
+
"Claimant must sign the transaction and can only claim on behalf of themself"
|
|
463
|
+
],
|
|
464
|
+
writable: true
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
name: "claimant",
|
|
468
|
+
docs: ["Who is claiming the tokens."],
|
|
469
|
+
writable: true,
|
|
470
|
+
signer: true
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
name: "mint",
|
|
474
|
+
docs: ["The mint to claim."],
|
|
475
|
+
relations: ["distributor"]
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
name: "token_program",
|
|
479
|
+
docs: ["SPL [Token] program."]
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
name: "event_authority",
|
|
483
|
+
pda: {
|
|
484
|
+
seeds: [
|
|
485
|
+
{
|
|
486
|
+
kind: "const",
|
|
487
|
+
value: [95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121]
|
|
488
|
+
}
|
|
489
|
+
]
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
name: "program"
|
|
494
|
+
}
|
|
495
|
+
],
|
|
496
|
+
args: []
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
name: "clawback",
|
|
500
|
+
discriminator: [111, 92, 142, 79, 33, 234, 82, 27],
|
|
501
|
+
accounts: [
|
|
502
|
+
{
|
|
503
|
+
name: "distributor",
|
|
504
|
+
docs: ["The [MerkleDistributor]."],
|
|
505
|
+
writable: true
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
name: "from",
|
|
509
|
+
docs: ["Distributor ATA containing the tokens to distribute."],
|
|
510
|
+
writable: true
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
name: "to",
|
|
514
|
+
docs: ["The Clawback token account."],
|
|
515
|
+
writable: true
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
name: "admin",
|
|
519
|
+
docs: ["Only Admin can trigger the clawback of funds"],
|
|
520
|
+
writable: true,
|
|
521
|
+
signer: true
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
name: "mint"
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
name: "system_program",
|
|
528
|
+
docs: ["The [System] program."],
|
|
529
|
+
address: "11111111111111111111111111111111"
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
name: "token_program",
|
|
533
|
+
docs: ["SPL [Token] program."]
|
|
534
|
+
}
|
|
535
|
+
],
|
|
536
|
+
args: []
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
name: "close_claim",
|
|
540
|
+
discriminator: [42, 177, 165, 35, 213, 179, 211, 19],
|
|
541
|
+
accounts: [
|
|
542
|
+
{
|
|
543
|
+
name: "distributor",
|
|
544
|
+
docs: ["The [MerkleDistributor]."],
|
|
545
|
+
writable: true
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
name: "admin_or_claimant",
|
|
549
|
+
docs: ["Admin signer"],
|
|
550
|
+
writable: true,
|
|
551
|
+
signer: true
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
name: "claimant",
|
|
555
|
+
writable: true
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
name: "claim_status",
|
|
559
|
+
writable: true,
|
|
560
|
+
pda: {
|
|
561
|
+
seeds: [
|
|
562
|
+
{
|
|
563
|
+
kind: "const",
|
|
564
|
+
value: [67, 108, 97, 105, 109, 83, 116, 97, 116, 117, 115]
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
kind: "account",
|
|
568
|
+
path: "claimant"
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
kind: "account",
|
|
572
|
+
path: "distributor"
|
|
573
|
+
}
|
|
574
|
+
]
|
|
575
|
+
}
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
name: "system_program",
|
|
579
|
+
docs: ["The [System] program."],
|
|
580
|
+
address: "11111111111111111111111111111111"
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
name: "event_authority",
|
|
584
|
+
pda: {
|
|
585
|
+
seeds: [
|
|
586
|
+
{
|
|
587
|
+
kind: "const",
|
|
588
|
+
value: [95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121]
|
|
589
|
+
}
|
|
590
|
+
]
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
name: "program"
|
|
595
|
+
}
|
|
596
|
+
],
|
|
597
|
+
args: [
|
|
598
|
+
{
|
|
599
|
+
name: "amount_unlocked",
|
|
600
|
+
type: {
|
|
601
|
+
option: "u64"
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
name: "amount_locked",
|
|
606
|
+
type: {
|
|
607
|
+
option: "u64"
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
name: "proof",
|
|
612
|
+
type: {
|
|
613
|
+
option: {
|
|
614
|
+
vec: {
|
|
615
|
+
array: ["u8", 32]
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
]
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
name: "compress_claim",
|
|
624
|
+
discriminator: [219, 45, 247, 134, 71, 119, 125, 89],
|
|
625
|
+
accounts: [
|
|
626
|
+
{
|
|
627
|
+
name: "distributor",
|
|
628
|
+
docs: ["The [MerkleDistributor]."],
|
|
629
|
+
writable: true
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
name: "claim_status",
|
|
633
|
+
writable: true,
|
|
634
|
+
pda: {
|
|
635
|
+
seeds: [
|
|
636
|
+
{
|
|
637
|
+
kind: "const",
|
|
638
|
+
value: [67, 108, 97, 105, 109, 83, 116, 97, 116, 117, 115]
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
kind: "account",
|
|
642
|
+
path: "claimant"
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
kind: "account",
|
|
646
|
+
path: "distributor"
|
|
647
|
+
}
|
|
648
|
+
]
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
name: "signer",
|
|
653
|
+
docs: ["Signer account"],
|
|
654
|
+
writable: true,
|
|
655
|
+
signer: true
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
name: "claimant"
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
name: "system_program",
|
|
662
|
+
docs: ["The [System] program."],
|
|
663
|
+
address: "11111111111111111111111111111111"
|
|
664
|
+
}
|
|
665
|
+
],
|
|
666
|
+
args: []
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
name: "new_claim",
|
|
670
|
+
discriminator: [78, 177, 98, 123, 210, 21, 187, 83],
|
|
671
|
+
accounts: [
|
|
672
|
+
{
|
|
673
|
+
name: "distributor",
|
|
674
|
+
docs: ["The [MerkleDistributor]."],
|
|
675
|
+
writable: true
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
name: "claim_status",
|
|
679
|
+
writable: true,
|
|
680
|
+
pda: {
|
|
681
|
+
seeds: [
|
|
682
|
+
{
|
|
683
|
+
kind: "const",
|
|
684
|
+
value: [67, 108, 97, 105, 109, 83, 116, 97, 116, 117, 115]
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
kind: "account",
|
|
688
|
+
path: "claimant"
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
kind: "account",
|
|
692
|
+
path: "distributor"
|
|
693
|
+
}
|
|
694
|
+
]
|
|
695
|
+
}
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
name: "from",
|
|
699
|
+
docs: ["Distributor ATA containing the tokens to distribute."],
|
|
700
|
+
writable: true,
|
|
701
|
+
pda: {
|
|
702
|
+
seeds: [
|
|
703
|
+
{
|
|
704
|
+
kind: "account",
|
|
705
|
+
path: "distributor"
|
|
706
|
+
},
|
|
707
|
+
{
|
|
708
|
+
kind: "account",
|
|
709
|
+
path: "token_program"
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
kind: "account",
|
|
713
|
+
path: "distributor.mint",
|
|
714
|
+
account: "MerkleDistributor"
|
|
715
|
+
}
|
|
716
|
+
],
|
|
717
|
+
program: {
|
|
718
|
+
kind: "const",
|
|
719
|
+
value: [
|
|
720
|
+
140,
|
|
721
|
+
151,
|
|
722
|
+
37,
|
|
723
|
+
143,
|
|
724
|
+
78,
|
|
725
|
+
36,
|
|
726
|
+
137,
|
|
727
|
+
241,
|
|
728
|
+
187,
|
|
729
|
+
61,
|
|
730
|
+
16,
|
|
731
|
+
41,
|
|
732
|
+
20,
|
|
733
|
+
142,
|
|
734
|
+
13,
|
|
735
|
+
131,
|
|
736
|
+
11,
|
|
737
|
+
90,
|
|
738
|
+
19,
|
|
739
|
+
153,
|
|
740
|
+
218,
|
|
741
|
+
255,
|
|
742
|
+
16,
|
|
743
|
+
132,
|
|
744
|
+
4,
|
|
745
|
+
142,
|
|
746
|
+
123,
|
|
747
|
+
216,
|
|
748
|
+
219,
|
|
749
|
+
233,
|
|
750
|
+
248,
|
|
751
|
+
89
|
|
752
|
+
]
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
name: "to",
|
|
758
|
+
docs: ["Account to send the claimed tokens to."],
|
|
759
|
+
writable: true
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
name: "claimant",
|
|
763
|
+
docs: ["Who is claiming the tokens."],
|
|
764
|
+
writable: true,
|
|
765
|
+
signer: true
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
name: "mint",
|
|
769
|
+
docs: ["The mint to claim."],
|
|
770
|
+
relations: ["distributor"]
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
name: "token_program",
|
|
774
|
+
docs: ["SPL [Token] program."]
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
name: "system_program",
|
|
778
|
+
docs: ["The [System] program."],
|
|
779
|
+
address: "11111111111111111111111111111111"
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
name: "event_authority",
|
|
783
|
+
pda: {
|
|
784
|
+
seeds: [
|
|
785
|
+
{
|
|
786
|
+
kind: "const",
|
|
787
|
+
value: [95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121]
|
|
788
|
+
}
|
|
789
|
+
]
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
name: "program"
|
|
794
|
+
}
|
|
795
|
+
],
|
|
796
|
+
args: [
|
|
797
|
+
{
|
|
798
|
+
name: "amount_unlocked",
|
|
799
|
+
type: "u64"
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
name: "amount_locked",
|
|
803
|
+
type: "u64"
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
name: "proof",
|
|
807
|
+
type: {
|
|
808
|
+
vec: {
|
|
809
|
+
array: ["u8", 32]
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
]
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
name: "new_distributor",
|
|
817
|
+
docs: [
|
|
818
|
+
"READ THE FOLLOWING:",
|
|
819
|
+
"",
|
|
820
|
+
"This instruction is susceptible to frontrunning that could result in loss of funds if not handled properly.",
|
|
821
|
+
"",
|
|
822
|
+
"An attack could look like:",
|
|
823
|
+
"- A legitimate user opens a new distributor.",
|
|
824
|
+
"- Someone observes the call to this instruction.",
|
|
825
|
+
"- They replace the clawback_receiver, admin, or time parameters with their own.",
|
|
826
|
+
"",
|
|
827
|
+
"One situation that could happen here is the attacker replaces the admin and clawback_receiver with their own",
|
|
828
|
+
"and sets the clawback_start_ts with the minimal time allowed. After clawback_start_ts has elapsed,",
|
|
829
|
+
"the attacker can steal all funds from the distributor to their own clawback_receiver account.",
|
|
830
|
+
"",
|
|
831
|
+
"HOW TO AVOID:",
|
|
832
|
+
"- When you call into this instruction, ensure your transaction succeeds.",
|
|
833
|
+
"- To be extra safe, after your transaction succeeds, read back the state of the created MerkleDistributor account and",
|
|
834
|
+
"assert the parameters are what you expect, most importantly the clawback_receiver and admin.",
|
|
835
|
+
"- If your transaction fails, double check the value on-chain matches what you expect."
|
|
836
|
+
],
|
|
837
|
+
discriminator: [32, 139, 112, 171, 0, 2, 225, 155],
|
|
838
|
+
accounts: [
|
|
839
|
+
{
|
|
840
|
+
name: "distributor",
|
|
841
|
+
docs: ["[MerkleDistributor]."],
|
|
842
|
+
writable: true,
|
|
843
|
+
pda: {
|
|
844
|
+
seeds: [
|
|
845
|
+
{
|
|
846
|
+
kind: "const",
|
|
847
|
+
value: [77, 101, 114, 107, 108, 101, 68, 105, 115, 116, 114, 105, 98, 117, 116, 111, 114]
|
|
848
|
+
},
|
|
849
|
+
{
|
|
850
|
+
kind: "account",
|
|
851
|
+
path: "mint"
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
kind: "arg",
|
|
855
|
+
path: "version"
|
|
856
|
+
}
|
|
857
|
+
]
|
|
858
|
+
}
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
name: "clawback_receiver",
|
|
862
|
+
docs: ["Clawback receiver token account"],
|
|
863
|
+
writable: true
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
name: "mint",
|
|
867
|
+
docs: ["The mint to distribute."]
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
name: "token_vault",
|
|
871
|
+
docs: ["Token vault"],
|
|
872
|
+
writable: true,
|
|
873
|
+
pda: {
|
|
874
|
+
seeds: [
|
|
875
|
+
{
|
|
876
|
+
kind: "account",
|
|
877
|
+
path: "distributor"
|
|
878
|
+
},
|
|
879
|
+
{
|
|
880
|
+
kind: "account",
|
|
881
|
+
path: "token_program"
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
kind: "account",
|
|
885
|
+
path: "mint"
|
|
886
|
+
}
|
|
887
|
+
],
|
|
888
|
+
program: {
|
|
889
|
+
kind: "const",
|
|
890
|
+
value: [
|
|
891
|
+
140,
|
|
892
|
+
151,
|
|
893
|
+
37,
|
|
894
|
+
143,
|
|
895
|
+
78,
|
|
896
|
+
36,
|
|
897
|
+
137,
|
|
898
|
+
241,
|
|
899
|
+
187,
|
|
900
|
+
61,
|
|
901
|
+
16,
|
|
902
|
+
41,
|
|
903
|
+
20,
|
|
904
|
+
142,
|
|
905
|
+
13,
|
|
906
|
+
131,
|
|
907
|
+
11,
|
|
908
|
+
90,
|
|
909
|
+
19,
|
|
910
|
+
153,
|
|
911
|
+
218,
|
|
912
|
+
255,
|
|
913
|
+
16,
|
|
914
|
+
132,
|
|
915
|
+
4,
|
|
916
|
+
142,
|
|
917
|
+
123,
|
|
918
|
+
216,
|
|
919
|
+
219,
|
|
920
|
+
233,
|
|
921
|
+
248,
|
|
922
|
+
89
|
|
923
|
+
]
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
},
|
|
927
|
+
{
|
|
928
|
+
name: "admin",
|
|
929
|
+
docs: [
|
|
930
|
+
"Admin wallet, responsible for creating the distributor and paying for the transaction.",
|
|
931
|
+
"Also has the authority to set the clawback receiver and change itself."
|
|
932
|
+
],
|
|
933
|
+
writable: true,
|
|
934
|
+
signer: true
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
name: "system_program",
|
|
938
|
+
docs: ["The [System] program."],
|
|
939
|
+
address: "11111111111111111111111111111111"
|
|
940
|
+
},
|
|
941
|
+
{
|
|
942
|
+
name: "associated_token_program",
|
|
943
|
+
docs: ["The [Associated Token] program."],
|
|
944
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
name: "token_program",
|
|
948
|
+
docs: ["The [Token] program."]
|
|
949
|
+
}
|
|
950
|
+
],
|
|
951
|
+
args: [
|
|
952
|
+
{
|
|
953
|
+
name: "version",
|
|
954
|
+
type: "u64"
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
name: "root",
|
|
958
|
+
type: {
|
|
959
|
+
array: ["u8", 32]
|
|
960
|
+
}
|
|
961
|
+
},
|
|
962
|
+
{
|
|
963
|
+
name: "max_total_claim",
|
|
964
|
+
type: "u64"
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
name: "max_num_nodes",
|
|
968
|
+
type: "u64"
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
name: "unlock_period",
|
|
972
|
+
type: "u64"
|
|
973
|
+
},
|
|
974
|
+
{
|
|
975
|
+
name: "start_vesting_ts",
|
|
976
|
+
type: "u64"
|
|
977
|
+
},
|
|
978
|
+
{
|
|
979
|
+
name: "end_vesting_ts",
|
|
980
|
+
type: "u64"
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
name: "clawback_start_ts",
|
|
984
|
+
type: "u64"
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
name: "claims_closable_by_admin",
|
|
988
|
+
type: "bool"
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
name: "can_update_duration",
|
|
992
|
+
type: {
|
|
993
|
+
option: "bool"
|
|
994
|
+
}
|
|
995
|
+
},
|
|
996
|
+
{
|
|
997
|
+
name: "total_amount_unlocked",
|
|
998
|
+
type: {
|
|
999
|
+
option: "u64"
|
|
1000
|
+
}
|
|
1001
|
+
},
|
|
1002
|
+
{
|
|
1003
|
+
name: "total_amount_locked",
|
|
1004
|
+
type: {
|
|
1005
|
+
option: "u64"
|
|
1006
|
+
}
|
|
1007
|
+
},
|
|
1008
|
+
{
|
|
1009
|
+
name: "claims_closable_by_claimant",
|
|
1010
|
+
type: {
|
|
1011
|
+
option: "bool"
|
|
1012
|
+
}
|
|
1013
|
+
},
|
|
1014
|
+
{
|
|
1015
|
+
name: "claims_limit",
|
|
1016
|
+
type: {
|
|
1017
|
+
option: "u16"
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
]
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
name: "refund_claim",
|
|
1024
|
+
discriminator: [157, 23, 164, 146, 176, 53, 147, 143],
|
|
1025
|
+
accounts: [
|
|
1026
|
+
{
|
|
1027
|
+
name: "distributor",
|
|
1028
|
+
docs: ["The [MerkleDistributor]."],
|
|
1029
|
+
writable: true
|
|
1030
|
+
},
|
|
1031
|
+
{
|
|
1032
|
+
name: "claim_status",
|
|
1033
|
+
writable: true,
|
|
1034
|
+
pda: {
|
|
1035
|
+
seeds: [
|
|
1036
|
+
{
|
|
1037
|
+
kind: "const",
|
|
1038
|
+
value: [67, 108, 97, 105, 109, 83, 116, 97, 116, 117, 115]
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
kind: "account",
|
|
1042
|
+
path: "claimant"
|
|
1043
|
+
},
|
|
1044
|
+
{
|
|
1045
|
+
kind: "account",
|
|
1046
|
+
path: "distributor"
|
|
1047
|
+
}
|
|
1048
|
+
]
|
|
1049
|
+
}
|
|
1050
|
+
},
|
|
1051
|
+
{
|
|
1052
|
+
name: "signer",
|
|
1053
|
+
docs: ["Signer account"],
|
|
1054
|
+
writable: true,
|
|
1055
|
+
signer: true
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
name: "claimant"
|
|
1059
|
+
},
|
|
1060
|
+
{
|
|
1061
|
+
name: "streamflow_treasury",
|
|
1062
|
+
writable: true,
|
|
1063
|
+
address: "5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw"
|
|
1064
|
+
},
|
|
1065
|
+
{
|
|
1066
|
+
name: "system_program",
|
|
1067
|
+
docs: ["The [System] program."],
|
|
1068
|
+
address: "11111111111111111111111111111111"
|
|
1069
|
+
}
|
|
1070
|
+
],
|
|
1071
|
+
args: []
|
|
1072
|
+
},
|
|
1073
|
+
{
|
|
1074
|
+
name: "set_admin",
|
|
1075
|
+
discriminator: [251, 163, 0, 52, 91, 194, 187, 92],
|
|
1076
|
+
accounts: [
|
|
1077
|
+
{
|
|
1078
|
+
name: "distributor",
|
|
1079
|
+
docs: ["The [MerkleDistributor]."],
|
|
1080
|
+
writable: true
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
name: "admin",
|
|
1084
|
+
docs: ["Admin signer"],
|
|
1085
|
+
writable: true,
|
|
1086
|
+
signer: true
|
|
1087
|
+
},
|
|
1088
|
+
{
|
|
1089
|
+
name: "new_admin",
|
|
1090
|
+
docs: ["New admin account"],
|
|
1091
|
+
writable: true
|
|
1092
|
+
}
|
|
1093
|
+
],
|
|
1094
|
+
args: []
|
|
1095
|
+
},
|
|
1096
|
+
{
|
|
1097
|
+
name: "set_clawback_receiver",
|
|
1098
|
+
discriminator: [153, 217, 34, 20, 19, 29, 229, 75],
|
|
1099
|
+
accounts: [
|
|
1100
|
+
{
|
|
1101
|
+
name: "distributor",
|
|
1102
|
+
docs: ["The [MerkleDistributor]."],
|
|
1103
|
+
writable: true
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
name: "new_clawback_account",
|
|
1107
|
+
docs: ["New clawback account"]
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
name: "admin",
|
|
1111
|
+
docs: ["Admin signer"],
|
|
1112
|
+
writable: true,
|
|
1113
|
+
signer: true
|
|
1114
|
+
}
|
|
1115
|
+
],
|
|
1116
|
+
args: []
|
|
1117
|
+
},
|
|
1118
|
+
{
|
|
1119
|
+
name: "update",
|
|
1120
|
+
discriminator: [219, 200, 88, 176, 158, 63, 253, 127],
|
|
1121
|
+
accounts: [
|
|
1122
|
+
{
|
|
1123
|
+
name: "distributor",
|
|
1124
|
+
docs: ["The [MerkleDistributor]."],
|
|
1125
|
+
writable: true
|
|
1126
|
+
},
|
|
1127
|
+
{
|
|
1128
|
+
name: "admin",
|
|
1129
|
+
docs: ["Only Admin can trigger the clawback of funds"],
|
|
1130
|
+
writable: true,
|
|
1131
|
+
signer: true
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
name: "system_program",
|
|
1135
|
+
docs: ["The [System] program."],
|
|
1136
|
+
address: "11111111111111111111111111111111"
|
|
1137
|
+
}
|
|
1138
|
+
],
|
|
1139
|
+
args: [
|
|
1140
|
+
{
|
|
1141
|
+
name: "end_ts",
|
|
1142
|
+
type: {
|
|
1143
|
+
option: "u64"
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
]
|
|
1147
|
+
}
|
|
1148
|
+
],
|
|
1149
|
+
accounts: [
|
|
1150
|
+
{
|
|
1151
|
+
name: "ClaimStatus",
|
|
1152
|
+
discriminator: [22, 183, 249, 157, 247, 95, 150, 96]
|
|
1153
|
+
},
|
|
1154
|
+
{
|
|
1155
|
+
name: "CompressedClaimStatus",
|
|
1156
|
+
discriminator: [53, 68, 161, 131, 212, 106, 98, 48]
|
|
1157
|
+
},
|
|
1158
|
+
{
|
|
1159
|
+
name: "MerkleDistributor",
|
|
1160
|
+
discriminator: [77, 119, 139, 70, 84, 247, 12, 26]
|
|
1161
|
+
}
|
|
1162
|
+
],
|
|
1163
|
+
events: [
|
|
1164
|
+
{
|
|
1165
|
+
name: "ClaimClosedEvent",
|
|
1166
|
+
discriminator: [139, 166, 215, 195, 184, 233, 26, 217]
|
|
1167
|
+
},
|
|
1168
|
+
{
|
|
1169
|
+
name: "ClaimedEvent",
|
|
1170
|
+
discriminator: [144, 172, 209, 86, 144, 87, 84, 115]
|
|
1171
|
+
},
|
|
1172
|
+
{
|
|
1173
|
+
name: "NewClaimEvent",
|
|
1174
|
+
discriminator: [244, 3, 231, 151, 60, 101, 55, 55]
|
|
1175
|
+
}
|
|
1176
|
+
],
|
|
1177
|
+
errors: [
|
|
1178
|
+
{
|
|
1179
|
+
code: 6e3,
|
|
1180
|
+
name: "InsufficientUnlockedTokens",
|
|
1181
|
+
msg: "Insufficient unlocked tokens"
|
|
1182
|
+
},
|
|
1183
|
+
{
|
|
1184
|
+
code: 6001,
|
|
1185
|
+
name: "InvalidProof",
|
|
1186
|
+
msg: "Invalid Merkle proof"
|
|
1187
|
+
},
|
|
1188
|
+
{
|
|
1189
|
+
code: 6002,
|
|
1190
|
+
name: "ExceededMaxClaim",
|
|
1191
|
+
msg: "Exceeded maximum claim amount"
|
|
1192
|
+
},
|
|
1193
|
+
{
|
|
1194
|
+
code: 6003,
|
|
1195
|
+
name: "MaxNodesExceeded",
|
|
1196
|
+
msg: "Exceeded maximum node count"
|
|
1197
|
+
},
|
|
1198
|
+
{
|
|
1199
|
+
code: 6004,
|
|
1200
|
+
name: "Unauthorized",
|
|
1201
|
+
msg: "Account is not authorized to execute this instruction"
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
code: 6005,
|
|
1205
|
+
name: "OwnerMismatch",
|
|
1206
|
+
msg: "Token account owner did not match intended owner"
|
|
1207
|
+
},
|
|
1208
|
+
{
|
|
1209
|
+
code: 6006,
|
|
1210
|
+
name: "ClawbackBeforeStart",
|
|
1211
|
+
msg: "Attempted clawback before start"
|
|
1212
|
+
},
|
|
1213
|
+
{
|
|
1214
|
+
code: 6007,
|
|
1215
|
+
name: "ClawbackAlreadyClaimed",
|
|
1216
|
+
msg: "Clawback already claimed"
|
|
1217
|
+
},
|
|
1218
|
+
{
|
|
1219
|
+
code: 6008,
|
|
1220
|
+
name: "SameClawbackReceiver",
|
|
1221
|
+
msg: "New and old Clawback receivers are identical"
|
|
1222
|
+
},
|
|
1223
|
+
{
|
|
1224
|
+
code: 6009,
|
|
1225
|
+
name: "ClawbackReceiverIsTokenVault",
|
|
1226
|
+
msg: "Clawback receiver can not be the Token Vault"
|
|
1227
|
+
},
|
|
1228
|
+
{
|
|
1229
|
+
code: 6010,
|
|
1230
|
+
name: "SameAdmin",
|
|
1231
|
+
msg: "New and old admin are identical"
|
|
1232
|
+
},
|
|
1233
|
+
{
|
|
1234
|
+
code: 6011,
|
|
1235
|
+
name: "ClaimExpired",
|
|
1236
|
+
msg: "Claim window expired"
|
|
1237
|
+
},
|
|
1238
|
+
{
|
|
1239
|
+
code: 6012,
|
|
1240
|
+
name: "ArithmeticError",
|
|
1241
|
+
msg: "Arithmetic Error (overflow/underflow)"
|
|
1242
|
+
},
|
|
1243
|
+
{
|
|
1244
|
+
code: 6013,
|
|
1245
|
+
name: "StartTimestampAfterEnd",
|
|
1246
|
+
msg: "Start Timestamp cannot be after end Timestamp"
|
|
1247
|
+
},
|
|
1248
|
+
{
|
|
1249
|
+
code: 6014,
|
|
1250
|
+
name: "TimestampsNotInFuture",
|
|
1251
|
+
msg: "Timestamps cannot be in the past"
|
|
1252
|
+
},
|
|
1253
|
+
{
|
|
1254
|
+
code: 6015,
|
|
1255
|
+
name: "InvalidMint",
|
|
1256
|
+
msg: "Invalid Mint"
|
|
1257
|
+
},
|
|
1258
|
+
{
|
|
1259
|
+
code: 6016,
|
|
1260
|
+
name: "ClaimIsClosed",
|
|
1261
|
+
msg: "Claim is closed"
|
|
1262
|
+
},
|
|
1263
|
+
{
|
|
1264
|
+
code: 6017,
|
|
1265
|
+
name: "ClaimsAreNotClosable",
|
|
1266
|
+
msg: "Claims are not closable"
|
|
1267
|
+
},
|
|
1268
|
+
{
|
|
1269
|
+
code: 6018,
|
|
1270
|
+
name: "InvalidUnlockPeriod",
|
|
1271
|
+
msg: "Invalid unlock period"
|
|
1272
|
+
},
|
|
1273
|
+
{
|
|
1274
|
+
code: 6019,
|
|
1275
|
+
name: "DurationUpdateNotAllowed",
|
|
1276
|
+
msg: "Duration update is not allowed"
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
code: 6020,
|
|
1280
|
+
name: "NoVestingAmount",
|
|
1281
|
+
msg: "Vesting amounts are not set"
|
|
1282
|
+
},
|
|
1283
|
+
{
|
|
1284
|
+
code: 6021,
|
|
1285
|
+
name: "VestingAlreadyFinished",
|
|
1286
|
+
msg: "Vesting already finished"
|
|
1287
|
+
},
|
|
1288
|
+
{
|
|
1289
|
+
code: 6022,
|
|
1290
|
+
name: "InvalidAmounts",
|
|
1291
|
+
msg: "Provided amounts are invalid"
|
|
1292
|
+
},
|
|
1293
|
+
{
|
|
1294
|
+
code: 6023,
|
|
1295
|
+
name: "ClaimsLimitReached",
|
|
1296
|
+
msg: "Claims limit has been reached"
|
|
1297
|
+
}
|
|
1298
|
+
],
|
|
1299
|
+
types: [
|
|
1300
|
+
{
|
|
1301
|
+
name: "ClaimClosedEvent",
|
|
1302
|
+
docs: ["Emitted when a new claim is created."],
|
|
1303
|
+
type: {
|
|
1304
|
+
kind: "struct",
|
|
1305
|
+
fields: [
|
|
1306
|
+
{
|
|
1307
|
+
name: "claimant",
|
|
1308
|
+
docs: ["User that claimed."],
|
|
1309
|
+
type: "pubkey"
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
name: "timestamp",
|
|
1313
|
+
docs: ["Timestamp."],
|
|
1314
|
+
type: "u64"
|
|
1315
|
+
}
|
|
1316
|
+
]
|
|
1317
|
+
}
|
|
1318
|
+
},
|
|
1319
|
+
{
|
|
1320
|
+
name: "ClaimStatus",
|
|
1321
|
+
docs: ["Holds whether or not a claimant has claimed tokens."],
|
|
1322
|
+
type: {
|
|
1323
|
+
kind: "struct",
|
|
1324
|
+
fields: [
|
|
1325
|
+
{
|
|
1326
|
+
name: "claimant",
|
|
1327
|
+
docs: ["Authority that claimed the tokens."],
|
|
1328
|
+
type: "pubkey"
|
|
1329
|
+
},
|
|
1330
|
+
{
|
|
1331
|
+
name: "locked_amount",
|
|
1332
|
+
docs: ["Locked amount"],
|
|
1333
|
+
type: "u64"
|
|
1334
|
+
},
|
|
1335
|
+
{
|
|
1336
|
+
name: "locked_amount_withdrawn",
|
|
1337
|
+
docs: ["Locked amount withdrawn"],
|
|
1338
|
+
type: "u64"
|
|
1339
|
+
},
|
|
1340
|
+
{
|
|
1341
|
+
name: "unlocked_amount",
|
|
1342
|
+
docs: ["Unlocked amount"],
|
|
1343
|
+
type: "u64"
|
|
1344
|
+
},
|
|
1345
|
+
{
|
|
1346
|
+
name: "last_claim_ts",
|
|
1347
|
+
docs: ["Last claim time"],
|
|
1348
|
+
type: "u64"
|
|
1349
|
+
},
|
|
1350
|
+
{
|
|
1351
|
+
name: "last_amount_per_unlock",
|
|
1352
|
+
docs: ["Track amount per unlock, can be useful for non-linear vesting"],
|
|
1353
|
+
type: "u64"
|
|
1354
|
+
},
|
|
1355
|
+
{
|
|
1356
|
+
name: "closed",
|
|
1357
|
+
docs: ["Whether claim is closed"],
|
|
1358
|
+
type: "bool"
|
|
1359
|
+
},
|
|
1360
|
+
{
|
|
1361
|
+
name: "distributor",
|
|
1362
|
+
docs: [
|
|
1363
|
+
"Distributor account for which ClaimStatus was created, useful to filter by in get_program_accounts"
|
|
1364
|
+
],
|
|
1365
|
+
type: "pubkey"
|
|
1366
|
+
},
|
|
1367
|
+
{
|
|
1368
|
+
name: "claims_count",
|
|
1369
|
+
docs: ["Number of time amount has been claimed"],
|
|
1370
|
+
type: "u16"
|
|
1371
|
+
},
|
|
1372
|
+
{
|
|
1373
|
+
name: "closed_ts",
|
|
1374
|
+
docs: ["Time when claim has been closed"],
|
|
1375
|
+
type: "u64"
|
|
1376
|
+
},
|
|
1377
|
+
{
|
|
1378
|
+
name: "buffer_2",
|
|
1379
|
+
docs: ["Buffer for additional fields"],
|
|
1380
|
+
type: {
|
|
1381
|
+
array: ["u8", 22]
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
]
|
|
1385
|
+
}
|
|
1386
|
+
},
|
|
1387
|
+
{
|
|
1388
|
+
name: "ClaimedEvent",
|
|
1389
|
+
docs: ["Emitted when tokens are claimed."],
|
|
1390
|
+
type: {
|
|
1391
|
+
kind: "struct",
|
|
1392
|
+
fields: [
|
|
1393
|
+
{
|
|
1394
|
+
name: "claimant",
|
|
1395
|
+
docs: ["User that claimed."],
|
|
1396
|
+
type: "pubkey"
|
|
1397
|
+
},
|
|
1398
|
+
{
|
|
1399
|
+
name: "amount",
|
|
1400
|
+
docs: ["Amount of tokens to distribute."],
|
|
1401
|
+
type: "u64"
|
|
1402
|
+
}
|
|
1403
|
+
]
|
|
1404
|
+
}
|
|
1405
|
+
},
|
|
1406
|
+
{
|
|
1407
|
+
name: "CompressedClaimStatus",
|
|
1408
|
+
docs: ["Holds whether or not a claimant has claimed tokens."],
|
|
1409
|
+
type: {
|
|
1410
|
+
kind: "struct",
|
|
1411
|
+
fields: [
|
|
1412
|
+
{
|
|
1413
|
+
name: "state",
|
|
1414
|
+
type: {
|
|
1415
|
+
defined: {
|
|
1416
|
+
name: "State"
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
]
|
|
1421
|
+
}
|
|
1422
|
+
},
|
|
1423
|
+
{
|
|
1424
|
+
name: "MerkleDistributor",
|
|
1425
|
+
docs: ["State for the account which distributes tokens."],
|
|
1426
|
+
type: {
|
|
1427
|
+
kind: "struct",
|
|
1428
|
+
fields: [
|
|
1429
|
+
{
|
|
1430
|
+
name: "bump",
|
|
1431
|
+
docs: ["Bump seed."],
|
|
1432
|
+
type: "u8"
|
|
1433
|
+
},
|
|
1434
|
+
{
|
|
1435
|
+
name: "version",
|
|
1436
|
+
docs: ["Version of the airdrop"],
|
|
1437
|
+
type: "u64"
|
|
1438
|
+
},
|
|
1439
|
+
{
|
|
1440
|
+
name: "root",
|
|
1441
|
+
docs: ["The 256-bit merkle root."],
|
|
1442
|
+
type: {
|
|
1443
|
+
array: ["u8", 32]
|
|
1444
|
+
}
|
|
1445
|
+
},
|
|
1446
|
+
{
|
|
1447
|
+
name: "mint",
|
|
1448
|
+
docs: ["[Mint] of the token to be distributed."],
|
|
1449
|
+
type: "pubkey"
|
|
1450
|
+
},
|
|
1451
|
+
{
|
|
1452
|
+
name: "token_vault",
|
|
1453
|
+
docs: ["Token Address of the vault"],
|
|
1454
|
+
type: "pubkey"
|
|
1455
|
+
},
|
|
1456
|
+
{
|
|
1457
|
+
name: "max_total_claim",
|
|
1458
|
+
docs: ["Maximum number of tokens that can ever be claimed from this [MerkleDistributor]."],
|
|
1459
|
+
type: "u64"
|
|
1460
|
+
},
|
|
1461
|
+
{
|
|
1462
|
+
name: "max_num_nodes",
|
|
1463
|
+
docs: ["Maximum number of nodes in [MerkleDistributor]."],
|
|
1464
|
+
type: "u64"
|
|
1465
|
+
},
|
|
1466
|
+
{
|
|
1467
|
+
name: "unlock_period",
|
|
1468
|
+
docs: ["Time step (period) in seconds per which the unlock occurs"],
|
|
1469
|
+
type: "u64"
|
|
1470
|
+
},
|
|
1471
|
+
{
|
|
1472
|
+
name: "total_amount_claimed",
|
|
1473
|
+
docs: ["Total amount of tokens that have been claimed."],
|
|
1474
|
+
type: "u64"
|
|
1475
|
+
},
|
|
1476
|
+
{
|
|
1477
|
+
name: "num_nodes_claimed",
|
|
1478
|
+
docs: ["Number of nodes that have been claimed."],
|
|
1479
|
+
type: "u64"
|
|
1480
|
+
},
|
|
1481
|
+
{
|
|
1482
|
+
name: "start_ts",
|
|
1483
|
+
docs: ["Lockup time start (Unix Timestamp)"],
|
|
1484
|
+
type: "u64"
|
|
1485
|
+
},
|
|
1486
|
+
{
|
|
1487
|
+
name: "end_ts",
|
|
1488
|
+
docs: ["Lockup time end (Unix Timestamp)"],
|
|
1489
|
+
type: "u64"
|
|
1490
|
+
},
|
|
1491
|
+
{
|
|
1492
|
+
name: "clawback_start_ts",
|
|
1493
|
+
docs: ["Clawback start (Unix Timestamp)"],
|
|
1494
|
+
type: "u64"
|
|
1495
|
+
},
|
|
1496
|
+
{
|
|
1497
|
+
name: "clawback_receiver",
|
|
1498
|
+
docs: ["Clawback receiver"],
|
|
1499
|
+
type: "pubkey"
|
|
1500
|
+
},
|
|
1501
|
+
{
|
|
1502
|
+
name: "admin",
|
|
1503
|
+
docs: ["Admin wallet"],
|
|
1504
|
+
type: "pubkey"
|
|
1505
|
+
},
|
|
1506
|
+
{
|
|
1507
|
+
name: "clawed_back",
|
|
1508
|
+
docs: ["Whether or not the distributor has been clawed back"],
|
|
1509
|
+
type: "bool"
|
|
1510
|
+
},
|
|
1511
|
+
{
|
|
1512
|
+
name: "claims_closable_by_admin",
|
|
1513
|
+
docs: ["Whether claims are closable by the admin or not"],
|
|
1514
|
+
type: "bool"
|
|
1515
|
+
},
|
|
1516
|
+
{
|
|
1517
|
+
name: "can_update_duration",
|
|
1518
|
+
docs: ["Whether admin can update vesting duration"],
|
|
1519
|
+
type: "bool"
|
|
1520
|
+
},
|
|
1521
|
+
{
|
|
1522
|
+
name: "total_amount_unlocked",
|
|
1523
|
+
docs: ["Total amount of funds unlocked (cliff/instant)"],
|
|
1524
|
+
type: "u64"
|
|
1525
|
+
},
|
|
1526
|
+
{
|
|
1527
|
+
name: "total_amount_locked",
|
|
1528
|
+
docs: ["Total amount of funds locked (vested)"],
|
|
1529
|
+
type: "u64"
|
|
1530
|
+
},
|
|
1531
|
+
{
|
|
1532
|
+
name: "last_duration_update_ts",
|
|
1533
|
+
docs: ["Timestamp when update was last called"],
|
|
1534
|
+
type: "u64"
|
|
1535
|
+
},
|
|
1536
|
+
{
|
|
1537
|
+
name: "total_claimable_pre_update",
|
|
1538
|
+
docs: [
|
|
1539
|
+
"Total amount of locked amount claimable as of last duration update, ever increasing total, accumulates with each update"
|
|
1540
|
+
],
|
|
1541
|
+
type: "u64"
|
|
1542
|
+
},
|
|
1543
|
+
{
|
|
1544
|
+
name: "clawed_back_ts",
|
|
1545
|
+
docs: ["Timestamp when funds were clawed back"],
|
|
1546
|
+
type: "u64"
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
name: "claims_closable_by_claimant",
|
|
1550
|
+
docs: ["Whether claims are closable by claimant or not"],
|
|
1551
|
+
type: "bool"
|
|
1552
|
+
},
|
|
1553
|
+
{
|
|
1554
|
+
name: "claims_limit",
|
|
1555
|
+
docs: ["Limit number of claims"],
|
|
1556
|
+
type: "u16"
|
|
1557
|
+
},
|
|
1558
|
+
{
|
|
1559
|
+
name: "buffer_2",
|
|
1560
|
+
docs: ["Buffer for additional fields"],
|
|
1561
|
+
type: {
|
|
1562
|
+
array: ["u8", 20]
|
|
1563
|
+
}
|
|
1564
|
+
},
|
|
1565
|
+
{
|
|
1566
|
+
name: "buffer_3",
|
|
1567
|
+
docs: ["Buffer for additional fields"],
|
|
1568
|
+
type: {
|
|
1569
|
+
array: ["u8", 32]
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
]
|
|
1573
|
+
}
|
|
1574
|
+
},
|
|
1575
|
+
{
|
|
1576
|
+
name: "NewClaimEvent",
|
|
1577
|
+
docs: ["Emitted when a new claim is created."],
|
|
1578
|
+
type: {
|
|
1579
|
+
kind: "struct",
|
|
1580
|
+
fields: [
|
|
1581
|
+
{
|
|
1582
|
+
name: "claimant",
|
|
1583
|
+
docs: ["User that claimed."],
|
|
1584
|
+
type: "pubkey"
|
|
1585
|
+
},
|
|
1586
|
+
{
|
|
1587
|
+
name: "timestamp",
|
|
1588
|
+
docs: ["Timestamp."],
|
|
1589
|
+
type: "u64"
|
|
1590
|
+
}
|
|
1591
|
+
]
|
|
1592
|
+
}
|
|
1593
|
+
},
|
|
1594
|
+
{
|
|
1595
|
+
name: "State",
|
|
1596
|
+
type: {
|
|
1597
|
+
kind: "enum",
|
|
1598
|
+
variants: [
|
|
1599
|
+
{
|
|
1600
|
+
name: "Claimed"
|
|
1601
|
+
},
|
|
1602
|
+
{
|
|
1603
|
+
name: "Closed"
|
|
1604
|
+
}
|
|
1605
|
+
]
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
]
|
|
1609
|
+
};
|
|
1610
|
+
|
|
302
1611
|
// solana/constants.ts
|
|
303
1612
|
var constants_exports = {};
|
|
304
1613
|
__export(constants_exports, {
|
|
@@ -324,7 +1633,7 @@ var ALIGNED_DISTRIBUTOR_PREFIX = Buffer.from("aligned-distributor", "utf-8");
|
|
|
324
1633
|
var TEST_ORACLE_PREFIX = Buffer.from("test-oracle", "utf-8");
|
|
325
1634
|
var CLAIM_STATUS_PREFIX = Buffer.from("ClaimStatus", "utf-8");
|
|
326
1635
|
var ALIGNED_PRECISION_FACTOR_POW = 9;
|
|
327
|
-
var AIRDROP_CLAIM_FEE = BigInt(
|
|
1636
|
+
var AIRDROP_CLAIM_FEE = BigInt(1e7);
|
|
328
1637
|
var STREAMFLOW_TREASURY_PUBLIC_KEY = new PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
|
|
329
1638
|
var ONE_IN_BASIS_POINTS = BigInt(1e4);
|
|
330
1639
|
var ALIGNED_DISTRIBUTOR_PROGRAM_ID = {
|
|
@@ -339,107 +1648,6 @@ var DISTRIBUTOR_PROGRAM_ID = {
|
|
|
339
1648
|
[ICluster.Testnet]: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N",
|
|
340
1649
|
[ICluster.Local]: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N"
|
|
341
1650
|
};
|
|
342
|
-
var _ClaimStatus = class _ClaimStatus {
|
|
343
|
-
constructor(fields) {
|
|
344
|
-
this.claimant = fields.claimant;
|
|
345
|
-
this.lockedAmount = fields.lockedAmount;
|
|
346
|
-
this.lockedAmountWithdrawn = fields.lockedAmountWithdrawn;
|
|
347
|
-
this.unlockedAmount = fields.unlockedAmount;
|
|
348
|
-
this.lastClaimTs = fields.lastClaimTs;
|
|
349
|
-
this.lastAmountPerUnlock = fields.lastAmountPerUnlock;
|
|
350
|
-
this.closed = fields.closed;
|
|
351
|
-
this.distributor = fields.distributor;
|
|
352
|
-
this.claimsCount = fields.claimsCount;
|
|
353
|
-
this.closedTs = fields.closedTs;
|
|
354
|
-
this.buffer2 = fields.buffer2;
|
|
355
|
-
}
|
|
356
|
-
static async fetch(c, address, programId = PROGRAM_ID) {
|
|
357
|
-
const info = await c.getAccountInfo(address);
|
|
358
|
-
if (info === null) {
|
|
359
|
-
return null;
|
|
360
|
-
}
|
|
361
|
-
if (!info.owner.equals(programId)) {
|
|
362
|
-
throw new Error("account doesn't belong to this program");
|
|
363
|
-
}
|
|
364
|
-
return this.decode(info.data);
|
|
365
|
-
}
|
|
366
|
-
static async fetchMultiple(c, addresses, programId = PROGRAM_ID) {
|
|
367
|
-
const infos = await c.getMultipleAccountsInfo(addresses);
|
|
368
|
-
return infos.map((info) => {
|
|
369
|
-
if (info === null) {
|
|
370
|
-
return null;
|
|
371
|
-
}
|
|
372
|
-
if (!info.owner.equals(programId)) {
|
|
373
|
-
throw new Error("account doesn't belong to this program");
|
|
374
|
-
}
|
|
375
|
-
return this.decode(info.data);
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
static decode(data) {
|
|
379
|
-
if (!data.slice(0, 8).equals(_ClaimStatus.discriminator)) {
|
|
380
|
-
throw new Error("invalid account discriminator");
|
|
381
|
-
}
|
|
382
|
-
const dec = _ClaimStatus.layout.decode(data.slice(8));
|
|
383
|
-
return new _ClaimStatus({
|
|
384
|
-
claimant: dec.claimant,
|
|
385
|
-
lockedAmount: dec.lockedAmount,
|
|
386
|
-
lockedAmountWithdrawn: dec.lockedAmountWithdrawn,
|
|
387
|
-
unlockedAmount: dec.unlockedAmount,
|
|
388
|
-
lastClaimTs: dec.lastClaimTs,
|
|
389
|
-
lastAmountPerUnlock: dec.lastAmountPerUnlock,
|
|
390
|
-
closed: dec.closed,
|
|
391
|
-
distributor: dec.distributor,
|
|
392
|
-
claimsCount: dec.claimsCount,
|
|
393
|
-
closedTs: dec.closedTs,
|
|
394
|
-
buffer2: dec.buffer2
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
toJSON() {
|
|
398
|
-
return {
|
|
399
|
-
claimant: this.claimant.toString(),
|
|
400
|
-
lockedAmount: this.lockedAmount.toString(),
|
|
401
|
-
lockedAmountWithdrawn: this.lockedAmountWithdrawn.toString(),
|
|
402
|
-
unlockedAmount: this.unlockedAmount.toString(),
|
|
403
|
-
lastClaimTs: this.lastClaimTs.toString(),
|
|
404
|
-
lastAmountPerUnlock: this.lastAmountPerUnlock.toString(),
|
|
405
|
-
closed: this.closed,
|
|
406
|
-
distributor: this.distributor.toString(),
|
|
407
|
-
claimsCount: this.claimsCount,
|
|
408
|
-
closedTs: this.closedTs.toString(),
|
|
409
|
-
buffer2: this.buffer2
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
static fromJSON(obj) {
|
|
413
|
-
return new _ClaimStatus({
|
|
414
|
-
claimant: new PublicKey(obj.claimant),
|
|
415
|
-
lockedAmount: new BN6(obj.lockedAmount),
|
|
416
|
-
lockedAmountWithdrawn: new BN6(obj.lockedAmountWithdrawn),
|
|
417
|
-
unlockedAmount: new BN6(obj.unlockedAmount),
|
|
418
|
-
lastClaimTs: new BN6(obj.lastClaimTs),
|
|
419
|
-
lastAmountPerUnlock: new BN6(obj.lastAmountPerUnlock),
|
|
420
|
-
closed: obj.closed,
|
|
421
|
-
distributor: new PublicKey(obj.distributor),
|
|
422
|
-
claimsCount: obj.claimsCount,
|
|
423
|
-
closedTs: new BN6(obj.closedTs),
|
|
424
|
-
buffer2: obj.buffer2
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
};
|
|
428
|
-
_ClaimStatus.discriminator = Buffer.from([22, 183, 249, 157, 247, 95, 150, 96]);
|
|
429
|
-
_ClaimStatus.layout = borsh8.struct([
|
|
430
|
-
borsh8.publicKey("claimant"),
|
|
431
|
-
borsh8.u64("lockedAmount"),
|
|
432
|
-
borsh8.u64("lockedAmountWithdrawn"),
|
|
433
|
-
borsh8.u64("unlockedAmount"),
|
|
434
|
-
borsh8.u64("lastClaimTs"),
|
|
435
|
-
borsh8.u64("lastAmountPerUnlock"),
|
|
436
|
-
borsh8.bool("closed"),
|
|
437
|
-
borsh8.publicKey("distributor"),
|
|
438
|
-
borsh8.u16("claimsCount"),
|
|
439
|
-
borsh8.u64("closedTs"),
|
|
440
|
-
borsh8.array(borsh8.u8(), 22, "buffer2")
|
|
441
|
-
]);
|
|
442
|
-
var ClaimStatus = _ClaimStatus;
|
|
443
1651
|
var _MerkleDistributor = class _MerkleDistributor {
|
|
444
1652
|
constructor(fields) {
|
|
445
1653
|
this.bump = fields.bump;
|
|
@@ -561,28 +1769,28 @@ var _MerkleDistributor = class _MerkleDistributor {
|
|
|
561
1769
|
static fromJSON(obj) {
|
|
562
1770
|
return new _MerkleDistributor({
|
|
563
1771
|
bump: obj.bump,
|
|
564
|
-
version: new
|
|
1772
|
+
version: new BN5(obj.version),
|
|
565
1773
|
root: obj.root,
|
|
566
1774
|
mint: new PublicKey(obj.mint),
|
|
567
1775
|
tokenVault: new PublicKey(obj.tokenVault),
|
|
568
|
-
maxTotalClaim: new
|
|
569
|
-
maxNumNodes: new
|
|
570
|
-
unlockPeriod: new
|
|
571
|
-
totalAmountClaimed: new
|
|
572
|
-
numNodesClaimed: new
|
|
573
|
-
startTs: new
|
|
574
|
-
endTs: new
|
|
575
|
-
clawbackStartTs: new
|
|
1776
|
+
maxTotalClaim: new BN5(obj.maxTotalClaim),
|
|
1777
|
+
maxNumNodes: new BN5(obj.maxNumNodes),
|
|
1778
|
+
unlockPeriod: new BN5(obj.unlockPeriod),
|
|
1779
|
+
totalAmountClaimed: new BN5(obj.totalAmountClaimed),
|
|
1780
|
+
numNodesClaimed: new BN5(obj.numNodesClaimed),
|
|
1781
|
+
startTs: new BN5(obj.startTs),
|
|
1782
|
+
endTs: new BN5(obj.endTs),
|
|
1783
|
+
clawbackStartTs: new BN5(obj.clawbackStartTs),
|
|
576
1784
|
clawbackReceiver: new PublicKey(obj.clawbackReceiver),
|
|
577
1785
|
admin: new PublicKey(obj.admin),
|
|
578
1786
|
clawedBack: obj.clawedBack,
|
|
579
1787
|
claimsClosableByAdmin: obj.claimsClosableByAdmin,
|
|
580
1788
|
canUpdateDuration: obj.canUpdateDuration,
|
|
581
|
-
totalAmountUnlocked: new
|
|
582
|
-
totalAmountLocked: new
|
|
583
|
-
lastDurationUpdateTs: new
|
|
584
|
-
totalClaimablePreUpdate: new
|
|
585
|
-
clawedBackTs: new
|
|
1789
|
+
totalAmountUnlocked: new BN5(obj.totalAmountUnlocked),
|
|
1790
|
+
totalAmountLocked: new BN5(obj.totalAmountLocked),
|
|
1791
|
+
lastDurationUpdateTs: new BN5(obj.lastDurationUpdateTs),
|
|
1792
|
+
totalClaimablePreUpdate: new BN5(obj.totalClaimablePreUpdate),
|
|
1793
|
+
clawedBackTs: new BN5(obj.clawedBackTs),
|
|
586
1794
|
claimsClosableByClaimant: obj.claimsClosableByClaimant,
|
|
587
1795
|
claimsLimit: obj.claimsLimit,
|
|
588
1796
|
buffer2: obj.buffer2,
|
|
@@ -591,34 +1799,34 @@ var _MerkleDistributor = class _MerkleDistributor {
|
|
|
591
1799
|
}
|
|
592
1800
|
};
|
|
593
1801
|
_MerkleDistributor.discriminator = Buffer.from([77, 119, 139, 70, 84, 247, 12, 26]);
|
|
594
|
-
_MerkleDistributor.layout =
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
1802
|
+
_MerkleDistributor.layout = borsh7.struct([
|
|
1803
|
+
borsh7.u8("bump"),
|
|
1804
|
+
borsh7.u64("version"),
|
|
1805
|
+
borsh7.array(borsh7.u8(), 32, "root"),
|
|
1806
|
+
borsh7.publicKey("mint"),
|
|
1807
|
+
borsh7.publicKey("tokenVault"),
|
|
1808
|
+
borsh7.u64("maxTotalClaim"),
|
|
1809
|
+
borsh7.u64("maxNumNodes"),
|
|
1810
|
+
borsh7.u64("unlockPeriod"),
|
|
1811
|
+
borsh7.u64("totalAmountClaimed"),
|
|
1812
|
+
borsh7.u64("numNodesClaimed"),
|
|
1813
|
+
borsh7.u64("startTs"),
|
|
1814
|
+
borsh7.u64("endTs"),
|
|
1815
|
+
borsh7.u64("clawbackStartTs"),
|
|
1816
|
+
borsh7.publicKey("clawbackReceiver"),
|
|
1817
|
+
borsh7.publicKey("admin"),
|
|
1818
|
+
borsh7.bool("clawedBack"),
|
|
1819
|
+
borsh7.bool("claimsClosableByAdmin"),
|
|
1820
|
+
borsh7.bool("canUpdateDuration"),
|
|
1821
|
+
borsh7.u64("totalAmountUnlocked"),
|
|
1822
|
+
borsh7.u64("totalAmountLocked"),
|
|
1823
|
+
borsh7.u64("lastDurationUpdateTs"),
|
|
1824
|
+
borsh7.u64("totalClaimablePreUpdate"),
|
|
1825
|
+
borsh7.u64("clawedBackTs"),
|
|
1826
|
+
borsh7.bool("claimsClosableByClaimant"),
|
|
1827
|
+
borsh7.u16("claimsLimit"),
|
|
1828
|
+
borsh7.array(borsh7.u8(), 20, "buffer2"),
|
|
1829
|
+
borsh7.array(borsh7.u8(), 32, "buffer3")
|
|
622
1830
|
]);
|
|
623
1831
|
var MerkleDistributor = _MerkleDistributor;
|
|
624
1832
|
|
|
@@ -1630,9 +2838,9 @@ function getEventAuthorityPda(programId) {
|
|
|
1630
2838
|
const seeds = [Buffer$1.from("__event_authority")];
|
|
1631
2839
|
return PublicKey.findProgramAddressSync(seeds, programId)[0];
|
|
1632
2840
|
}
|
|
1633
|
-
async function wrappedSignAndExecuteTransaction(
|
|
2841
|
+
async function wrappedSignAndExecuteTransaction(...args) {
|
|
1634
2842
|
try {
|
|
1635
|
-
return await signAndExecuteTransaction(
|
|
2843
|
+
return await signAndExecuteTransaction(...args);
|
|
1636
2844
|
} catch (err) {
|
|
1637
2845
|
if (err instanceof Error) {
|
|
1638
2846
|
const parsed = fromTxError(err);
|
|
@@ -1673,6 +2881,10 @@ var BaseDistributorClient = class {
|
|
|
1673
2881
|
this.connection = new Connection(clusterUrl, this.commitment);
|
|
1674
2882
|
this.programId = programId !== "" ? new PublicKey(programId) : new PublicKey(DISTRIBUTOR_PROGRAM_ID[cluster]);
|
|
1675
2883
|
this.sendThrottler = sendThrottler ?? buildSendThrottler(sendRate);
|
|
2884
|
+
const merkleDistributorProgram = {
|
|
2885
|
+
...merkle_distributor_default
|
|
2886
|
+
};
|
|
2887
|
+
this.merkleDistributorProgram = new Program(merkleDistributorProgram, { connection: this.connection });
|
|
1676
2888
|
}
|
|
1677
2889
|
getConnection() {
|
|
1678
2890
|
return this.connection;
|
|
@@ -1707,7 +2919,7 @@ var BaseDistributorClient = class {
|
|
|
1707
2919
|
};
|
|
1708
2920
|
if (extParams.isNative) {
|
|
1709
2921
|
ixs.push(
|
|
1710
|
-
...await prepareWrappedAccount(this.connection, extParams.invoker.publicKey, new
|
|
2922
|
+
...await prepareWrappedAccount(this.connection, extParams.invoker.publicKey, new BN5(data.maxTotalClaim))
|
|
1711
2923
|
);
|
|
1712
2924
|
}
|
|
1713
2925
|
const newDistributorInstruction = await this.getNewDistributorInstruction(data, accounts);
|
|
@@ -1748,7 +2960,14 @@ var BaseDistributorClient = class {
|
|
|
1748
2960
|
return { distributorPublicKey, ixs };
|
|
1749
2961
|
}
|
|
1750
2962
|
async create(data, extParams) {
|
|
1751
|
-
const
|
|
2963
|
+
const invoker = extParams.invoker.publicKey;
|
|
2964
|
+
invariant(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
2965
|
+
const executionParams = this.unwrapExecutionParams(extParams);
|
|
2966
|
+
const { ixs, distributorPublicKey } = await createAndEstimateTransaction(
|
|
2967
|
+
(params) => this.prepareCreateInstructions(data, params),
|
|
2968
|
+
executionParams,
|
|
2969
|
+
(q) => q.ixs
|
|
2970
|
+
);
|
|
1752
2971
|
const { tx, hash, context } = await prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
1753
2972
|
const signature = await wrappedSignAndExecuteTransaction(
|
|
1754
2973
|
this.connection,
|
|
@@ -1759,7 +2978,7 @@ var BaseDistributorClient = class {
|
|
|
1759
2978
|
context,
|
|
1760
2979
|
commitment: this.getCommitment()
|
|
1761
2980
|
},
|
|
1762
|
-
{ sendThrottler: this.sendThrottler }
|
|
2981
|
+
{ sendThrottler: this.sendThrottler, skipSimulation: executionParams.skipSimulation }
|
|
1763
2982
|
);
|
|
1764
2983
|
return {
|
|
1765
2984
|
ixs,
|
|
@@ -1767,23 +2986,29 @@ var BaseDistributorClient = class {
|
|
|
1767
2986
|
metadataId: distributorPublicKey.toBase58()
|
|
1768
2987
|
};
|
|
1769
2988
|
}
|
|
1770
|
-
async claim(data, extParams) {
|
|
1771
|
-
const
|
|
1772
|
-
const
|
|
2989
|
+
async claim(data, extParams, _serviceTransfer) {
|
|
2990
|
+
const executionParams = this.unwrapExecutionParams(extParams);
|
|
2991
|
+
const invoker = executionParams.invoker.publicKey;
|
|
2992
|
+
invariant(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
2993
|
+
const ixs = await createAndEstimateTransaction(
|
|
2994
|
+
(params) => this.prepareClaimInstructions(data, params, _serviceTransfer),
|
|
2995
|
+
executionParams
|
|
2996
|
+
);
|
|
2997
|
+
const { tx, hash, context } = await prepareTransaction(this.connection, ixs, invoker);
|
|
1773
2998
|
const signature = await wrappedSignAndExecuteTransaction(
|
|
1774
2999
|
this.connection,
|
|
1775
|
-
|
|
3000
|
+
executionParams.invoker,
|
|
1776
3001
|
tx,
|
|
1777
3002
|
{
|
|
1778
3003
|
hash,
|
|
1779
3004
|
context,
|
|
1780
3005
|
commitment: this.getCommitment()
|
|
1781
3006
|
},
|
|
1782
|
-
{ sendThrottler: this.sendThrottler }
|
|
3007
|
+
{ sendThrottler: this.sendThrottler, skipSimulation: executionParams.skipSimulation }
|
|
1783
3008
|
);
|
|
1784
3009
|
return { ixs, txId: signature };
|
|
1785
3010
|
}
|
|
1786
|
-
async prepareClaimInstructions(data, extParams) {
|
|
3011
|
+
async prepareClaimInstructions(data, extParams, _serviceTransfer) {
|
|
1787
3012
|
if (!extParams.invoker.publicKey) {
|
|
1788
3013
|
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
1789
3014
|
}
|
|
@@ -1810,7 +3035,7 @@ var BaseDistributorClient = class {
|
|
|
1810
3035
|
extParams.invoker.publicKey
|
|
1811
3036
|
);
|
|
1812
3037
|
const eventAuthorityPublicKey = getEventAuthorityPda(this.programId);
|
|
1813
|
-
const claimStatus = await
|
|
3038
|
+
const claimStatus = await this.getClaim(claimStatusPublicKey);
|
|
1814
3039
|
const accounts = {
|
|
1815
3040
|
distributor: distributorPublicKey,
|
|
1816
3041
|
claimStatus: claimStatusPublicKey,
|
|
@@ -1825,32 +3050,43 @@ var BaseDistributorClient = class {
|
|
|
1825
3050
|
};
|
|
1826
3051
|
if (!claimStatus) {
|
|
1827
3052
|
const args = {
|
|
1828
|
-
amountLocked: new
|
|
1829
|
-
amountUnlocked: new
|
|
3053
|
+
amountLocked: new BN5(data.amountLocked),
|
|
3054
|
+
amountUnlocked: new BN5(data.amountUnlocked),
|
|
1830
3055
|
proof: data.proof
|
|
1831
3056
|
};
|
|
1832
3057
|
ixs.push(newClaim(args, accounts, this.programId));
|
|
1833
3058
|
}
|
|
1834
|
-
const nowTs = new
|
|
1835
|
-
if (claimStatus || new
|
|
3059
|
+
const nowTs = new BN5(Math.floor(Date.now() / 1e3));
|
|
3060
|
+
if (claimStatus || new BN5(data.amountLocked).gtn(0) && nowTs.sub(distributor.startTs).gte(distributor.unlockPeriod)) {
|
|
1836
3061
|
ixs.push(claimLocked(accounts, this.programId));
|
|
1837
3062
|
}
|
|
1838
|
-
ixs.push(
|
|
3063
|
+
ixs.push(
|
|
3064
|
+
this.prepareClaimFeeInstruction(
|
|
3065
|
+
extParams.invoker.publicKey,
|
|
3066
|
+
typeof _serviceTransfer === "bigint" ? _serviceTransfer : void 0
|
|
3067
|
+
)
|
|
3068
|
+
);
|
|
1839
3069
|
return ixs;
|
|
1840
3070
|
}
|
|
1841
3071
|
async closeClaim(data, extParams) {
|
|
1842
|
-
const
|
|
1843
|
-
const
|
|
3072
|
+
const executionParams = this.unwrapExecutionParams(extParams);
|
|
3073
|
+
const invoker = executionParams.invoker.publicKey;
|
|
3074
|
+
invariant(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
3075
|
+
const ixs = await createAndEstimateTransaction(
|
|
3076
|
+
(params) => this.prepareCloseClaimInstructions(data, params),
|
|
3077
|
+
executionParams
|
|
3078
|
+
);
|
|
3079
|
+
const { tx, hash, context } = await prepareTransaction(this.connection, ixs, invoker);
|
|
1844
3080
|
const signature = await wrappedSignAndExecuteTransaction(
|
|
1845
3081
|
this.connection,
|
|
1846
|
-
|
|
3082
|
+
executionParams.invoker,
|
|
1847
3083
|
tx,
|
|
1848
3084
|
{
|
|
1849
3085
|
hash,
|
|
1850
3086
|
context,
|
|
1851
3087
|
commitment: this.getCommitment()
|
|
1852
3088
|
},
|
|
1853
|
-
{ sendThrottler: this.sendThrottler }
|
|
3089
|
+
{ sendThrottler: this.sendThrottler, skipSimulation: executionParams.skipSimulation }
|
|
1854
3090
|
);
|
|
1855
3091
|
return { ixs, txId: signature };
|
|
1856
3092
|
}
|
|
@@ -1877,8 +3113,8 @@ var BaseDistributorClient = class {
|
|
|
1877
3113
|
program: this.programId
|
|
1878
3114
|
};
|
|
1879
3115
|
const closeClaimArgs = {
|
|
1880
|
-
amountLocked: data.amountLocked ? new
|
|
1881
|
-
amountUnlocked: data.amountUnlocked ? new
|
|
3116
|
+
amountLocked: data.amountLocked ? new BN5(data.amountLocked) : void 0,
|
|
3117
|
+
amountUnlocked: data.amountUnlocked ? new BN5(data.amountUnlocked) : void 0,
|
|
1882
3118
|
proof: data.proof
|
|
1883
3119
|
};
|
|
1884
3120
|
ixs.push(closeClaim(closeClaimArgs, closeClaimAccounts, this.programId));
|
|
@@ -1918,26 +3154,37 @@ var BaseDistributorClient = class {
|
|
|
1918
3154
|
return ixs;
|
|
1919
3155
|
}
|
|
1920
3156
|
async clawback(data, extParams) {
|
|
1921
|
-
const
|
|
1922
|
-
const
|
|
3157
|
+
const executionParams = this.unwrapExecutionParams(extParams);
|
|
3158
|
+
const invoker = executionParams.invoker.publicKey;
|
|
3159
|
+
invariant(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
3160
|
+
const ixs = await createAndEstimateTransaction(
|
|
3161
|
+
(params) => this.prepareClawbackInstructions(data, params),
|
|
3162
|
+
executionParams
|
|
3163
|
+
);
|
|
3164
|
+
const { tx, hash, context } = await prepareTransaction(this.connection, ixs, invoker);
|
|
1923
3165
|
const signature = await wrappedSignAndExecuteTransaction(
|
|
1924
3166
|
this.connection,
|
|
1925
|
-
|
|
3167
|
+
executionParams.invoker,
|
|
1926
3168
|
tx,
|
|
1927
3169
|
{
|
|
1928
3170
|
hash,
|
|
1929
3171
|
context,
|
|
1930
3172
|
commitment: this.getCommitment()
|
|
1931
3173
|
},
|
|
1932
|
-
{ sendThrottler: this.sendThrottler }
|
|
3174
|
+
{ sendThrottler: this.sendThrottler, skipSimulation: executionParams.skipSimulation }
|
|
1933
3175
|
);
|
|
1934
3176
|
return { ixs, txId: signature };
|
|
1935
3177
|
}
|
|
3178
|
+
async getClaim(claimStatus) {
|
|
3179
|
+
return this.connection.getAccountInfo(pk(claimStatus)).then((account) => this.decodeClaimStatus(account));
|
|
3180
|
+
}
|
|
1936
3181
|
async getClaims(data) {
|
|
1937
3182
|
const claimStatusPublicKeys = data.map(({ id, recipient }) => {
|
|
1938
3183
|
return getClaimantStatusPda(this.programId, new PublicKey(id), new PublicKey(recipient));
|
|
1939
3184
|
});
|
|
1940
|
-
return
|
|
3185
|
+
return this.connection.getMultipleAccountsInfo(claimStatusPublicKeys).then((accounts) => {
|
|
3186
|
+
return accounts.map((account) => this.decodeClaimStatus(account));
|
|
3187
|
+
});
|
|
1941
3188
|
}
|
|
1942
3189
|
async getDistributors(data) {
|
|
1943
3190
|
const distributorPublicKeys = data.ids.map((distributorId) => new PublicKey(distributorId));
|
|
@@ -1967,28 +3214,28 @@ var BaseDistributorClient = class {
|
|
|
1967
3214
|
account: MerkleDistributor.decode(account.data)
|
|
1968
3215
|
}));
|
|
1969
3216
|
}
|
|
1970
|
-
prepareClaimFeeInstruction(payer) {
|
|
3217
|
+
prepareClaimFeeInstruction(payer, fee = AIRDROP_CLAIM_FEE) {
|
|
1971
3218
|
return SystemProgram.transfer({
|
|
1972
3219
|
fromPubkey: payer,
|
|
1973
3220
|
toPubkey: STREAMFLOW_TREASURY_PUBLIC_KEY,
|
|
1974
|
-
lamports:
|
|
3221
|
+
lamports: fee
|
|
1975
3222
|
});
|
|
1976
3223
|
}
|
|
1977
3224
|
getNewDistributorArgs(data) {
|
|
1978
3225
|
const args = {
|
|
1979
|
-
version: new
|
|
3226
|
+
version: new BN5(data.version),
|
|
1980
3227
|
root: data.root,
|
|
1981
|
-
maxTotalClaim: new
|
|
1982
|
-
maxNumNodes: new
|
|
1983
|
-
unlockPeriod: new
|
|
1984
|
-
startVestingTs: new
|
|
1985
|
-
endVestingTs: new
|
|
1986
|
-
clawbackStartTs: new
|
|
3228
|
+
maxTotalClaim: new BN5(data.maxTotalClaim),
|
|
3229
|
+
maxNumNodes: new BN5(data.maxNumNodes),
|
|
3230
|
+
unlockPeriod: new BN5(data.unlockPeriod),
|
|
3231
|
+
startVestingTs: new BN5(data.startVestingTs),
|
|
3232
|
+
endVestingTs: new BN5(data.endVestingTs),
|
|
3233
|
+
clawbackStartTs: new BN5(data.clawbackStartTs),
|
|
1987
3234
|
claimsClosableByAdmin: data.claimsClosableByAdmin,
|
|
1988
3235
|
claimsClosableByClaimant: data.claimsClosableByClaimant,
|
|
1989
3236
|
claimsLimit: data.claimsLimit
|
|
1990
3237
|
};
|
|
1991
|
-
const nowTs = new
|
|
3238
|
+
const nowTs = new BN5(Math.floor(Date.now() / 1e3));
|
|
1992
3239
|
const endVestingTs = args.endVestingTs.isZero() ? nowTs : args.endVestingTs;
|
|
1993
3240
|
const startVestingTs = args.startVestingTs.isZero() ? nowTs : args.startVestingTs;
|
|
1994
3241
|
if (endVestingTs.gt(startVestingTs) && endVestingTs.sub(startVestingTs).lt(args.unlockPeriod)) {
|
|
@@ -1996,7 +3243,34 @@ var BaseDistributorClient = class {
|
|
|
1996
3243
|
}
|
|
1997
3244
|
return args;
|
|
1998
3245
|
}
|
|
3246
|
+
unwrapExecutionParams(extParams) {
|
|
3247
|
+
return unwrapExecutionParams(extParams, this.connection);
|
|
3248
|
+
}
|
|
3249
|
+
decodeClaimStatus(account) {
|
|
3250
|
+
if (!account) {
|
|
3251
|
+
return account;
|
|
3252
|
+
}
|
|
3253
|
+
try {
|
|
3254
|
+
return decode(this.merkleDistributorProgram, "claimStatus", account.data);
|
|
3255
|
+
} catch (baseClaimStatusError) {
|
|
3256
|
+
try {
|
|
3257
|
+
return decode(this.merkleDistributorProgram, "compressedClaimStatus", account.data);
|
|
3258
|
+
} catch (compressedClaimStatusError) {
|
|
3259
|
+
throw new Error("Couldn't decode claim status");
|
|
3260
|
+
}
|
|
3261
|
+
}
|
|
3262
|
+
}
|
|
1999
3263
|
};
|
|
3264
|
+
function decode(program, accountName, accInfo, programKey) {
|
|
3265
|
+
const programId = program.programId?.toBase58() ?? "N/A";
|
|
3266
|
+
invariant(program, `Decoding program with key ${programId} is not available`);
|
|
3267
|
+
const accountEntity = program.idl.accounts?.find((acc) => acc.name === accountName);
|
|
3268
|
+
invariant(
|
|
3269
|
+
!!accountEntity,
|
|
3270
|
+
`Decoding program with key ${programId} doesn't specify account with name ${String(accountName)}`
|
|
3271
|
+
);
|
|
3272
|
+
return program.coder.accounts.decode(accountName, accInfo);
|
|
3273
|
+
}
|
|
2000
3274
|
|
|
2001
3275
|
// solana/clients/SolanaDistributorClient.ts
|
|
2002
3276
|
var SolanaDistributorClient = class extends BaseDistributorClient {
|
|
@@ -2014,7 +3288,7 @@ var aligned_distributor_default = {
|
|
|
2014
3288
|
address: "aMERKpFAWoChCi5oZwPvgsSCoGpZKBiU7fi76bdZjt2",
|
|
2015
3289
|
metadata: {
|
|
2016
3290
|
name: "aligned_distributor",
|
|
2017
|
-
version: "1.
|
|
3291
|
+
version: "1.5.0",
|
|
2018
3292
|
spec: "0.1.0",
|
|
2019
3293
|
description: "Proxy for merkle distributor that updates Vesting duration according to token market performance."
|
|
2020
3294
|
},
|
|
@@ -2158,6 +3432,48 @@ var aligned_distributor_default = {
|
|
|
2158
3432
|
}
|
|
2159
3433
|
]
|
|
2160
3434
|
},
|
|
3435
|
+
{
|
|
3436
|
+
name: "migrate_test_oracle",
|
|
3437
|
+
discriminator: [203, 254, 19, 3, 172, 185, 85, 190],
|
|
3438
|
+
accounts: [
|
|
3439
|
+
{
|
|
3440
|
+
name: "payer",
|
|
3441
|
+
writable: true,
|
|
3442
|
+
signer: true
|
|
3443
|
+
},
|
|
3444
|
+
{
|
|
3445
|
+
name: "mint"
|
|
3446
|
+
},
|
|
3447
|
+
{
|
|
3448
|
+
name: "creator"
|
|
3449
|
+
},
|
|
3450
|
+
{
|
|
3451
|
+
name: "test_oracle",
|
|
3452
|
+
writable: true,
|
|
3453
|
+
pda: {
|
|
3454
|
+
seeds: [
|
|
3455
|
+
{
|
|
3456
|
+
kind: "const",
|
|
3457
|
+
value: [116, 101, 115, 116, 45, 111, 114, 97, 99, 108, 101]
|
|
3458
|
+
},
|
|
3459
|
+
{
|
|
3460
|
+
kind: "account",
|
|
3461
|
+
path: "mint"
|
|
3462
|
+
},
|
|
3463
|
+
{
|
|
3464
|
+
kind: "account",
|
|
3465
|
+
path: "creator"
|
|
3466
|
+
}
|
|
3467
|
+
]
|
|
3468
|
+
}
|
|
3469
|
+
},
|
|
3470
|
+
{
|
|
3471
|
+
name: "system_program",
|
|
3472
|
+
address: "11111111111111111111111111111111"
|
|
3473
|
+
}
|
|
3474
|
+
],
|
|
3475
|
+
args: []
|
|
3476
|
+
},
|
|
2161
3477
|
{
|
|
2162
3478
|
name: "new_distributor",
|
|
2163
3479
|
discriminator: [32, 139, 112, 171, 0, 2, 225, 155],
|
|
@@ -2243,6 +3559,48 @@ var aligned_distributor_default = {
|
|
|
2243
3559
|
}
|
|
2244
3560
|
]
|
|
2245
3561
|
},
|
|
3562
|
+
{
|
|
3563
|
+
name: "realloc_test_oracle",
|
|
3564
|
+
discriminator: [234, 221, 116, 4, 198, 251, 244, 206],
|
|
3565
|
+
accounts: [
|
|
3566
|
+
{
|
|
3567
|
+
name: "payer",
|
|
3568
|
+
writable: true,
|
|
3569
|
+
signer: true
|
|
3570
|
+
},
|
|
3571
|
+
{
|
|
3572
|
+
name: "mint"
|
|
3573
|
+
},
|
|
3574
|
+
{
|
|
3575
|
+
name: "creator"
|
|
3576
|
+
},
|
|
3577
|
+
{
|
|
3578
|
+
name: "test_oracle",
|
|
3579
|
+
writable: true,
|
|
3580
|
+
pda: {
|
|
3581
|
+
seeds: [
|
|
3582
|
+
{
|
|
3583
|
+
kind: "const",
|
|
3584
|
+
value: [116, 101, 115, 116, 45, 111, 114, 97, 99, 108, 101]
|
|
3585
|
+
},
|
|
3586
|
+
{
|
|
3587
|
+
kind: "account",
|
|
3588
|
+
path: "mint"
|
|
3589
|
+
},
|
|
3590
|
+
{
|
|
3591
|
+
kind: "account",
|
|
3592
|
+
path: "creator"
|
|
3593
|
+
}
|
|
3594
|
+
]
|
|
3595
|
+
}
|
|
3596
|
+
},
|
|
3597
|
+
{
|
|
3598
|
+
name: "system_program",
|
|
3599
|
+
address: "11111111111111111111111111111111"
|
|
3600
|
+
}
|
|
3601
|
+
],
|
|
3602
|
+
args: []
|
|
3603
|
+
},
|
|
2246
3604
|
{
|
|
2247
3605
|
name: "set_admin",
|
|
2248
3606
|
discriminator: [251, 163, 0, 52, 91, 194, 187, 92],
|
|
@@ -3028,16 +4386,16 @@ var SolanaAlignedDistributorClient = class extends BaseDistributorClient {
|
|
|
3028
4386
|
unlockPeriod
|
|
3029
4387
|
} = data;
|
|
3030
4388
|
return {
|
|
3031
|
-
totalAmountLocked: new
|
|
3032
|
-
totalAmountUnlocked: new
|
|
4389
|
+
totalAmountLocked: new BN5(totalAmountLocked),
|
|
4390
|
+
totalAmountUnlocked: new BN5(totalAmountUnlocked),
|
|
3033
4391
|
oracleType: !!oracleType ? { [oracleType]: {} } : { none: {} },
|
|
3034
4392
|
minPrice: getBN(minPrice, ALIGNED_PRECISION_FACTOR_POW),
|
|
3035
4393
|
maxPrice: getBN(maxPrice, ALIGNED_PRECISION_FACTOR_POW),
|
|
3036
4394
|
minPercentage: getBN(minPercentage, ALIGNED_PRECISION_FACTOR_POW),
|
|
3037
4395
|
maxPercentage: getBN(maxPercentage, ALIGNED_PRECISION_FACTOR_POW),
|
|
3038
|
-
tickSize: new
|
|
4396
|
+
tickSize: new BN5(tickSize || 1),
|
|
3039
4397
|
skipInitial: skipInitial ?? false,
|
|
3040
|
-
updatePeriod: unlockPeriod < 30 ? new
|
|
4398
|
+
updatePeriod: unlockPeriod < 30 ? new BN5(30) : new BN5(unlockPeriod)
|
|
3041
4399
|
};
|
|
3042
4400
|
}
|
|
3043
4401
|
};
|