@streamflow/distributor 8.0.1 → 8.0.2-alpha.p287.46f7492
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 +1576 -214
- 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 +1576 -214
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +41 -96
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1575 -213
- 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 +41 -96
- package/dist/esm/solana/index.js +1575 -213
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import { Keypair, PublicKey, TransactionInstruction, Connection, Commitment, ConnectionConfig
|
|
1
|
+
import { Keypair, PublicKey, TransactionInstruction, Connection, Commitment, ConnectionConfig } from '@solana/web3.js';
|
|
2
2
|
import { SignerWalletAdapter } from '@solana/wallet-adapter-base';
|
|
3
3
|
import { ITransactionResult, ICluster } from '@streamflow/common';
|
|
4
|
-
import { ITransactionSolanaExt, IProgramAccount,
|
|
4
|
+
import { ITransactionSolanaExt, ITransactionSolanaExtResolved, IProgramAccount, unwrapExecutionParams, signAndExecuteTransaction } from '@streamflow/common/solana';
|
|
5
5
|
import BN from 'bn.js';
|
|
6
6
|
import { IdlTypes, Program } from '@coral-xyz/anchor';
|
|
7
7
|
import { AlignedDistributor } from './descriptor/aligned_distributor.js';
|
|
8
|
+
import { MerkleDistributor as MerkleDistributor$1 } from './descriptor/merkle_distributor.js';
|
|
8
9
|
import PQueue from 'p-queue';
|
|
9
10
|
import { TransferFeeConfig } from '@solana/spl-token';
|
|
10
11
|
|
|
12
|
+
type MerkleDistributorAccountTypes = IdlTypes<MerkleDistributor$1>;
|
|
13
|
+
type ClaimStatus = MerkleDistributorAccountTypes["claimStatus"];
|
|
14
|
+
type CompressedClaimStatus = MerkleDistributorAccountTypes["compressedClaimStatus"];
|
|
15
|
+
type AnyClaimStatus = ClaimStatus | CompressedClaimStatus;
|
|
11
16
|
type OracleType = IdlTypes<AlignedDistributor>["oracleType"];
|
|
12
17
|
type OracleTypeName = "none" | "pyth" | "switchboard" | "test";
|
|
13
18
|
interface IInteractSolanaExt extends ITransactionSolanaExt {
|
|
@@ -423,88 +428,6 @@ interface SetAdminAccounts {
|
|
|
423
428
|
}
|
|
424
429
|
declare function setAdmin(accounts: SetAdminAccounts, programId?: PublicKey): TransactionInstruction;
|
|
425
430
|
|
|
426
|
-
interface ClaimStatusFields {
|
|
427
|
-
/** Authority that claimed the tokens. */
|
|
428
|
-
claimant: PublicKey;
|
|
429
|
-
/** Locked amount */
|
|
430
|
-
lockedAmount: BN;
|
|
431
|
-
/** Locked amount withdrawn */
|
|
432
|
-
lockedAmountWithdrawn: BN;
|
|
433
|
-
/** Unlocked amount */
|
|
434
|
-
unlockedAmount: BN;
|
|
435
|
-
/** Last claim time */
|
|
436
|
-
lastClaimTs: BN;
|
|
437
|
-
/** Track amount per unlock, can be useful for non-linear vesting */
|
|
438
|
-
lastAmountPerUnlock: BN;
|
|
439
|
-
/** Whether claim is closed */
|
|
440
|
-
closed: boolean;
|
|
441
|
-
/** Distributor account for which ClaimStatus was created, useful to filter by in get_program_accounts */
|
|
442
|
-
distributor: PublicKey;
|
|
443
|
-
/** Number of time amount has been claimed */
|
|
444
|
-
claimsCount: number;
|
|
445
|
-
/** Time when claim was closed */
|
|
446
|
-
closedTs: BN;
|
|
447
|
-
/** Buffer for additional fields */
|
|
448
|
-
buffer2: Array<number>;
|
|
449
|
-
}
|
|
450
|
-
interface ClaimStatusJSON {
|
|
451
|
-
/** Authority that claimed the tokens. */
|
|
452
|
-
claimant: string;
|
|
453
|
-
/** Locked amount */
|
|
454
|
-
lockedAmount: string;
|
|
455
|
-
/** Locked amount withdrawn */
|
|
456
|
-
lockedAmountWithdrawn: string;
|
|
457
|
-
/** Unlocked amount */
|
|
458
|
-
unlockedAmount: string;
|
|
459
|
-
/** Last claim time */
|
|
460
|
-
lastClaimTs: string;
|
|
461
|
-
/** Track amount per unlock, can be useful for non-linear vesting */
|
|
462
|
-
lastAmountPerUnlock: string;
|
|
463
|
-
/** Whether claim is closed */
|
|
464
|
-
closed: boolean;
|
|
465
|
-
/** Distributor account for which ClaimStatus was created, useful to filter by in get_program_accounts */
|
|
466
|
-
distributor: string;
|
|
467
|
-
/** Number of time amount has been claimed */
|
|
468
|
-
claimsCount: number;
|
|
469
|
-
/** Time when claim was closed */
|
|
470
|
-
closedTs: string;
|
|
471
|
-
/** Buffer for additional fields */
|
|
472
|
-
buffer2: Array<number>;
|
|
473
|
-
}
|
|
474
|
-
/** Holds whether or not a claimant has claimed tokens. */
|
|
475
|
-
declare class ClaimStatus {
|
|
476
|
-
/** Authority that claimed the tokens. */
|
|
477
|
-
readonly claimant: PublicKey;
|
|
478
|
-
/** Locked amount */
|
|
479
|
-
readonly lockedAmount: BN;
|
|
480
|
-
/** Locked amount withdrawn */
|
|
481
|
-
readonly lockedAmountWithdrawn: BN;
|
|
482
|
-
/** Unlocked amount */
|
|
483
|
-
readonly unlockedAmount: BN;
|
|
484
|
-
/** Last claim time */
|
|
485
|
-
readonly lastClaimTs: BN;
|
|
486
|
-
/** Track amount per unlock, can be useful for non-linear vesting */
|
|
487
|
-
readonly lastAmountPerUnlock: BN;
|
|
488
|
-
/** Whether claim is closed */
|
|
489
|
-
readonly closed: boolean;
|
|
490
|
-
/** Distributor account for which ClaimStatus was created, useful to filter by in get_program_accounts */
|
|
491
|
-
readonly distributor: PublicKey;
|
|
492
|
-
/** Number of time amount has been claimed */
|
|
493
|
-
readonly claimsCount: number;
|
|
494
|
-
/** Time when claim was closed */
|
|
495
|
-
readonly closedTs: BN;
|
|
496
|
-
/** Buffer for additional fields */
|
|
497
|
-
readonly buffer2: Array<number>;
|
|
498
|
-
static readonly discriminator: Buffer;
|
|
499
|
-
static readonly layout: any;
|
|
500
|
-
constructor(fields: ClaimStatusFields);
|
|
501
|
-
static fetch(c: Connection, address: PublicKey, programId?: PublicKey): Promise<ClaimStatus | null>;
|
|
502
|
-
static fetchMultiple(c: Connection, addresses: PublicKey[], programId?: PublicKey): Promise<Array<ClaimStatus | null>>;
|
|
503
|
-
static decode(data: Buffer): ClaimStatus;
|
|
504
|
-
toJSON(): ClaimStatusJSON;
|
|
505
|
-
static fromJSON(obj: ClaimStatusJSON): ClaimStatus;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
431
|
interface MerkleDistributorFields {
|
|
509
432
|
/** Bump seed. */
|
|
510
433
|
bump: number;
|
|
@@ -696,28 +619,48 @@ declare abstract class BaseDistributorClient {
|
|
|
696
619
|
protected programId: PublicKey;
|
|
697
620
|
protected commitment: Commitment | ConnectionConfig;
|
|
698
621
|
protected sendThrottler: PQueue;
|
|
622
|
+
merkleDistributorProgram: Program<MerkleDistributor$1>;
|
|
699
623
|
constructor({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler, }: IInitOptions);
|
|
700
624
|
protected abstract getNewDistributorInstruction(data: ICreateDistributorData | ICreateAlignedDistributorData, accounts: NewDistributorAccounts): Promise<TransactionInstruction>;
|
|
701
625
|
protected abstract getClawbackInstruction(account: ClawbackAccounts): Promise<TransactionInstruction>;
|
|
702
626
|
getConnection(): Connection;
|
|
703
627
|
getCommitment(): Commitment | undefined;
|
|
704
628
|
getDistributorProgramId(): PublicKey;
|
|
705
|
-
prepareCreateInstructions(data: ICreateDistributorData | ICreateAlignedDistributorData, extParams: ICreateSolanaExt): Promise<{
|
|
629
|
+
prepareCreateInstructions(data: ICreateDistributorData | ICreateAlignedDistributorData, extParams: ITransactionSolanaExtResolved<ICreateSolanaExt>): Promise<{
|
|
706
630
|
distributorPublicKey: PublicKey;
|
|
707
631
|
ixs: TransactionInstruction[];
|
|
708
632
|
}>;
|
|
709
633
|
create(data: ICreateDistributorData | ICreateAlignedDistributorData, extParams: ICreateSolanaExt): Promise<ICreateDistributorResult>;
|
|
634
|
+
/**
|
|
635
|
+
* @public
|
|
636
|
+
* @overload
|
|
637
|
+
*/
|
|
710
638
|
claim(data: IClaimData, extParams: IInteractSolanaExt): Promise<ITransactionResult>;
|
|
711
|
-
|
|
639
|
+
/**
|
|
640
|
+
* @internal
|
|
641
|
+
*/
|
|
642
|
+
claim(data: IClaimData, extParams: IInteractSolanaExt, _serviceTransfer?: unknown): Promise<ITransactionResult>;
|
|
643
|
+
/**
|
|
644
|
+
* @public
|
|
645
|
+
* @overload
|
|
646
|
+
*/
|
|
647
|
+
prepareClaimInstructions(data: IClaimData, extParams: ITransactionSolanaExtResolved<IInteractSolanaExt>): Promise<TransactionInstruction[]>;
|
|
648
|
+
/**
|
|
649
|
+
* @internal
|
|
650
|
+
*/
|
|
651
|
+
prepareClaimInstructions(data: IClaimData, extParams: ITransactionSolanaExtResolved<IInteractSolanaExt>, _serviceTransfer?: unknown): Promise<TransactionInstruction[]>;
|
|
712
652
|
closeClaim(data: ICloseClaimData, extParams: IInteractSolanaExt): Promise<ITransactionResult>;
|
|
713
|
-
prepareCloseClaimInstructions(data: ICloseClaimData, extParams: IInteractSolanaExt): Promise<TransactionInstruction[]>;
|
|
714
|
-
prepareClawbackInstructions(data: IClawbackData, extParams: IInteractSolanaExt): Promise<TransactionInstruction[]>;
|
|
653
|
+
prepareCloseClaimInstructions(data: ICloseClaimData, extParams: ITransactionSolanaExtResolved<IInteractSolanaExt>): Promise<TransactionInstruction[]>;
|
|
654
|
+
prepareClawbackInstructions(data: IClawbackData, extParams: ITransactionSolanaExtResolved<IInteractSolanaExt>): Promise<TransactionInstruction[]>;
|
|
715
655
|
clawback(data: IClawbackData, extParams: IInteractSolanaExt): Promise<ITransactionResult>;
|
|
716
|
-
|
|
656
|
+
getClaim(claimStatus: string | PublicKey): Promise<MerkleDistributorAccountTypes["claimStatus"] | MerkleDistributorAccountTypes["compressedClaimStatus"] | null>;
|
|
657
|
+
getClaims(data: IGetClaimData[]): Promise<(MerkleDistributorAccountTypes["claimStatus"] | MerkleDistributorAccountTypes["compressedClaimStatus"] | null)[]>;
|
|
717
658
|
getDistributors(data: IGetDistributors): Promise<(MerkleDistributor | null)[]>;
|
|
718
659
|
searchDistributors(data: ISearchDistributors): Promise<IProgramAccount<MerkleDistributor>[]>;
|
|
719
|
-
protected prepareClaimFeeInstruction(payer: PublicKey): TransactionInstruction;
|
|
660
|
+
protected prepareClaimFeeInstruction(payer: PublicKey, fee?: bigint): TransactionInstruction;
|
|
720
661
|
protected getNewDistributorArgs(data: ICreateDistributorData): NewDistributorArgs;
|
|
662
|
+
protected unwrapExecutionParams<T extends IInteractSolanaExt>(extParams: T): ReturnType<typeof unwrapExecutionParams<T>>;
|
|
663
|
+
private decodeClaimStatus;
|
|
721
664
|
}
|
|
722
665
|
|
|
723
666
|
declare class SolanaDistributorClient extends BaseDistributorClient {
|
|
@@ -1372,7 +1315,8 @@ declare const getTestOraclePda: (programId: PublicKey, mint: PublicKey, creator:
|
|
|
1372
1315
|
declare function getDistributorPda(programId: PublicKey, mint: PublicKey, version: number): PublicKey;
|
|
1373
1316
|
declare function getClaimantStatusPda(programId: PublicKey, distributor: PublicKey, claimant: PublicKey): PublicKey;
|
|
1374
1317
|
declare function getEventAuthorityPda(programId: PublicKey): PublicKey;
|
|
1375
|
-
declare
|
|
1318
|
+
declare const isCompressedClaimStatus: (status?: AnyClaimStatus | null) => status is CompressedClaimStatus;
|
|
1319
|
+
declare function wrappedSignAndExecuteTransaction(...args: Parameters<typeof signAndExecuteTransaction>): Promise<string>;
|
|
1376
1320
|
declare function calculateAmountWithTransferFees(connection: Connection, transferFeeConfig: TransferFeeConfig, transferAmount: bigint): Promise<{
|
|
1377
1321
|
transferAmount: bigint;
|
|
1378
1322
|
feeCharged: bigint;
|
|
@@ -1422,13 +1366,12 @@ declare namespace constants {
|
|
|
1422
1366
|
type index_AlignedDistributorData = AlignedDistributorData;
|
|
1423
1367
|
type index_AnchorErrorCode = AnchorErrorCode;
|
|
1424
1368
|
declare const index_AnchorErrorCode: typeof AnchorErrorCode;
|
|
1369
|
+
type index_AnyClaimStatus = AnyClaimStatus;
|
|
1425
1370
|
type index_ClaimLockedAccounts = ClaimLockedAccounts;
|
|
1426
1371
|
type index_ClaimStatus = ClaimStatus;
|
|
1427
|
-
declare const index_ClaimStatus: typeof ClaimStatus;
|
|
1428
|
-
type index_ClaimStatusFields = ClaimStatusFields;
|
|
1429
|
-
type index_ClaimStatusJSON = ClaimStatusJSON;
|
|
1430
1372
|
type index_ClawbackAccounts = ClawbackAccounts;
|
|
1431
1373
|
type index_CloseClaimAccounts = CloseClaimAccounts;
|
|
1374
|
+
type index_CompressedClaimStatus = CompressedClaimStatus;
|
|
1432
1375
|
type index_ContractErrorCode = ContractErrorCode;
|
|
1433
1376
|
declare const index_ContractErrorCode: typeof ContractErrorCode;
|
|
1434
1377
|
type index_IClaimData = IClaimData;
|
|
@@ -1446,6 +1389,7 @@ type index_ISetClawbackReceiverData = ISetClawbackReceiverData;
|
|
|
1446
1389
|
type index_ISetDataAdmin = ISetDataAdmin;
|
|
1447
1390
|
type index_MerkleDistributor = MerkleDistributor;
|
|
1448
1391
|
declare const index_MerkleDistributor: typeof MerkleDistributor;
|
|
1392
|
+
type index_MerkleDistributorAccountTypes = MerkleDistributorAccountTypes;
|
|
1449
1393
|
type index_MerkleDistributorFields = MerkleDistributorFields;
|
|
1450
1394
|
type index_MerkleDistributorJSON = MerkleDistributorJSON;
|
|
1451
1395
|
type index_NewAlignedDistributorArgs = NewAlignedDistributorArgs;
|
|
@@ -1473,13 +1417,14 @@ declare const index_getClaimantStatusPda: typeof getClaimantStatusPda;
|
|
|
1473
1417
|
declare const index_getDistributorPda: typeof getDistributorPda;
|
|
1474
1418
|
declare const index_getEventAuthorityPda: typeof getEventAuthorityPda;
|
|
1475
1419
|
declare const index_getTestOraclePda: typeof getTestOraclePda;
|
|
1420
|
+
declare const index_isCompressedClaimStatus: typeof isCompressedClaimStatus;
|
|
1476
1421
|
declare const index_newClaim: typeof newClaim;
|
|
1477
1422
|
declare const index_newDistributor: typeof newDistributor;
|
|
1478
1423
|
declare const index_setAdmin: typeof setAdmin;
|
|
1479
1424
|
declare const index_setClawbackReceiver: typeof setClawbackReceiver;
|
|
1480
1425
|
declare const index_wrappedSignAndExecuteTransaction: typeof wrappedSignAndExecuteTransaction;
|
|
1481
1426
|
declare namespace index {
|
|
1482
|
-
export { type index_AlignedDistributorData as AlignedDistributorData, index_AnchorErrorCode as AnchorErrorCode, type
|
|
1427
|
+
export { type index_AlignedDistributorData as AlignedDistributorData, index_AnchorErrorCode as AnchorErrorCode, type index_AnyClaimStatus as AnyClaimStatus, type index_ClaimLockedAccounts as ClaimLockedAccounts, type index_ClaimStatus as ClaimStatus, type index_ClawbackAccounts as ClawbackAccounts, type index_CloseClaimAccounts as CloseClaimAccounts, type index_CompressedClaimStatus as CompressedClaimStatus, index_ContractErrorCode as ContractErrorCode, type index_IClaimData as IClaimData, type index_IClawbackData as IClawbackData, type index_ICloseClaimData as ICloseClaimData, type index_ICreateAlignedDistributorData as ICreateAlignedDistributorData, type index_ICreateDistributorData as ICreateDistributorData, type index_ICreateDistributorResult as ICreateDistributorResult, type index_ICreateSolanaExt as ICreateSolanaExt, type index_IGetClaimData as IGetClaimData, type index_IGetDistributors as IGetDistributors, type index_IInteractSolanaExt as IInteractSolanaExt, type index_ISearchDistributors as ISearchDistributors, type index_ISetClawbackReceiverData as ISetClawbackReceiverData, type index_ISetDataAdmin as ISetDataAdmin, index_MerkleDistributor as MerkleDistributor, type index_MerkleDistributorAccountTypes as MerkleDistributorAccountTypes, type index_MerkleDistributorFields as MerkleDistributorFields, type index_MerkleDistributorJSON as MerkleDistributorJSON, type index_NewAlignedDistributorArgs as NewAlignedDistributorArgs, type index_NewClaimAccounts as NewClaimAccounts, type index_NewClaimArgs as NewClaimArgs, type index_NewDistributorAccounts as NewDistributorAccounts, type index_NewDistributorArgs as NewDistributorArgs, type index_OracleType as OracleType, type index_OracleTypeName as OracleTypeName, type index_SetAdminAccounts as SetAdminAccounts, type index_SetClawbackReceiverAccounts as SetClawbackReceiverAccounts, index_SolanaAlignedDistributorClient as SolanaAlignedDistributorClient, index_SolanaDistributorClient as SolanaDistributorClient, index_calculateAmountWithTransferFees as calculateAmountWithTransferFees, index_claimLocked as claimLocked, index_clawback as clawback, index_closeClaim as closeClaim, index_constants as constants, index_fromCode as fromCode, index_fromTxError as fromTxError, index_getAlignedDistributorPda as getAlignedDistributorPda, index_getClaimantStatusPda as getClaimantStatusPda, index_getDistributorPda as getDistributorPda, index_getEventAuthorityPda as getEventAuthorityPda, index_getTestOraclePda as getTestOraclePda, index_isCompressedClaimStatus as isCompressedClaimStatus, index_newClaim as newClaim, index_newDistributor as newDistributor, index_setAdmin as setAdmin, index_setClawbackReceiver as setClawbackReceiver, index_wrappedSignAndExecuteTransaction as wrappedSignAndExecuteTransaction };
|
|
1483
1428
|
}
|
|
1484
1429
|
|
|
1485
|
-
export { type AlignedDistributorData, AnchorErrorCode, type
|
|
1430
|
+
export { type AlignedDistributorData, AnchorErrorCode, type AnyClaimStatus, type ClaimLockedAccounts, type ClaimStatus, type ClawbackAccounts, type CloseClaimAccounts, type CompressedClaimStatus, ContractErrorCode, type IClaimData, type IClawbackData, type ICloseClaimData, type ICreateAlignedDistributorData, type ICreateDistributorData, type ICreateDistributorResult, type ICreateSolanaExt, type IGetClaimData, type IGetDistributors, type IInteractSolanaExt, type ISearchDistributors, type ISetClawbackReceiverData, type ISetDataAdmin, MerkleDistributor, type MerkleDistributorAccountTypes, type MerkleDistributorFields, type MerkleDistributorJSON, type NewAlignedDistributorArgs, type NewClaimAccounts, type NewClaimArgs, type NewDistributorAccounts, type NewDistributorArgs, type OracleType, type OracleTypeName, type SetAdminAccounts, type SetClawbackReceiverAccounts, SolanaAlignedDistributorClient, SolanaDistributorClient, calculateAmountWithTransferFees, claimLocked, clawback, closeClaim, constants, fromCode, fromTxError, getAlignedDistributorPda, getClaimantStatusPda, getDistributorPda, getEventAuthorityPda, getTestOraclePda, index as i, isCompressedClaimStatus, newClaim, newDistributor, setAdmin, setClawbackReceiver, wrappedSignAndExecuteTransaction };
|