@streamflow/distributor 8.0.1-alpha.p287.54fe41f → 8.0.1
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 +214 -1572
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +0 -1
- package/dist/cjs/solana/descriptor/aligned_distributor.d.cts +505 -962
- package/dist/cjs/solana/descriptor/merkle_distributor.d.cts +560 -1272
- package/dist/cjs/solana/index.cjs +214 -1572
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +96 -37
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +213 -1571
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/descriptor/aligned_distributor.d.ts +505 -962
- package/dist/esm/solana/descriptor/idl/aligned_distributor.json +2 -86
- package/dist/esm/solana/descriptor/idl/merkle_distributor.json +6 -194
- package/dist/esm/solana/descriptor/merkle_distributor.d.ts +560 -1272
- package/dist/esm/solana/index.d.ts +96 -37
- package/dist/esm/solana/index.js +213 -1572
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import { Keypair, PublicKey, TransactionInstruction, Connection, Commitment, ConnectionConfig } from '@solana/web3.js';
|
|
1
|
+
import { Keypair, PublicKey, TransactionInstruction, Connection, Commitment, ConnectionConfig, Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
2
2
|
import { SignerWalletAdapter } from '@solana/wallet-adapter-base';
|
|
3
3
|
import { ITransactionResult, ICluster } from '@streamflow/common';
|
|
4
|
-
import { ITransactionSolanaExt,
|
|
4
|
+
import { ITransactionSolanaExt, IProgramAccount, ConfirmationParams, ThrottleParams } 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';
|
|
9
8
|
import PQueue from 'p-queue';
|
|
10
9
|
import { TransferFeeConfig } from '@solana/spl-token';
|
|
11
10
|
|
|
12
|
-
type MerkleDistributorAccountTypes = IdlTypes<MerkleDistributor$1>;
|
|
13
|
-
type ClaimStatus = MerkleDistributorAccountTypes["claimStatus"];
|
|
14
|
-
type CompressedClaimStatus = MerkleDistributorAccountTypes["compressedClaimStatus"];
|
|
15
11
|
type OracleType = IdlTypes<AlignedDistributor>["oracleType"];
|
|
16
12
|
type OracleTypeName = "none" | "pyth" | "switchboard" | "test";
|
|
17
13
|
interface IInteractSolanaExt extends ITransactionSolanaExt {
|
|
@@ -427,6 +423,88 @@ interface SetAdminAccounts {
|
|
|
427
423
|
}
|
|
428
424
|
declare function setAdmin(accounts: SetAdminAccounts, programId?: PublicKey): TransactionInstruction;
|
|
429
425
|
|
|
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
|
+
|
|
430
508
|
interface MerkleDistributorFields {
|
|
431
509
|
/** Bump seed. */
|
|
432
510
|
bump: number;
|
|
@@ -618,48 +696,28 @@ declare abstract class BaseDistributorClient {
|
|
|
618
696
|
protected programId: PublicKey;
|
|
619
697
|
protected commitment: Commitment | ConnectionConfig;
|
|
620
698
|
protected sendThrottler: PQueue;
|
|
621
|
-
merkleDistributorProgram: Program<MerkleDistributor$1>;
|
|
622
699
|
constructor({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler, }: IInitOptions);
|
|
623
700
|
protected abstract getNewDistributorInstruction(data: ICreateDistributorData | ICreateAlignedDistributorData, accounts: NewDistributorAccounts): Promise<TransactionInstruction>;
|
|
624
701
|
protected abstract getClawbackInstruction(account: ClawbackAccounts): Promise<TransactionInstruction>;
|
|
625
702
|
getConnection(): Connection;
|
|
626
703
|
getCommitment(): Commitment | undefined;
|
|
627
704
|
getDistributorProgramId(): PublicKey;
|
|
628
|
-
prepareCreateInstructions(data: ICreateDistributorData | ICreateAlignedDistributorData, extParams:
|
|
705
|
+
prepareCreateInstructions(data: ICreateDistributorData | ICreateAlignedDistributorData, extParams: ICreateSolanaExt): Promise<{
|
|
629
706
|
distributorPublicKey: PublicKey;
|
|
630
707
|
ixs: TransactionInstruction[];
|
|
631
708
|
}>;
|
|
632
709
|
create(data: ICreateDistributorData | ICreateAlignedDistributorData, extParams: ICreateSolanaExt): Promise<ICreateDistributorResult>;
|
|
633
|
-
/**
|
|
634
|
-
* @public
|
|
635
|
-
* @overload
|
|
636
|
-
*/
|
|
637
710
|
claim(data: IClaimData, extParams: IInteractSolanaExt): Promise<ITransactionResult>;
|
|
638
|
-
|
|
639
|
-
* @internal
|
|
640
|
-
*/
|
|
641
|
-
claim(data: IClaimData, extParams: IInteractSolanaExt, _serviceTransfer?: unknown): Promise<ITransactionResult>;
|
|
642
|
-
/**
|
|
643
|
-
* @public
|
|
644
|
-
* @overload
|
|
645
|
-
*/
|
|
646
|
-
prepareClaimInstructions(data: IClaimData, extParams: ITransactionSolanaExtResolved<IInteractSolanaExt>): Promise<TransactionInstruction[]>;
|
|
647
|
-
/**
|
|
648
|
-
* @internal
|
|
649
|
-
*/
|
|
650
|
-
prepareClaimInstructions(data: IClaimData, extParams: ITransactionSolanaExtResolved<IInteractSolanaExt>, _serviceTransfer?: unknown): Promise<TransactionInstruction[]>;
|
|
711
|
+
prepareClaimInstructions(data: IClaimData, extParams: IInteractSolanaExt): Promise<TransactionInstruction[]>;
|
|
651
712
|
closeClaim(data: ICloseClaimData, extParams: IInteractSolanaExt): Promise<ITransactionResult>;
|
|
652
|
-
prepareCloseClaimInstructions(data: ICloseClaimData, extParams:
|
|
653
|
-
prepareClawbackInstructions(data: IClawbackData, extParams:
|
|
713
|
+
prepareCloseClaimInstructions(data: ICloseClaimData, extParams: IInteractSolanaExt): Promise<TransactionInstruction[]>;
|
|
714
|
+
prepareClawbackInstructions(data: IClawbackData, extParams: IInteractSolanaExt): Promise<TransactionInstruction[]>;
|
|
654
715
|
clawback(data: IClawbackData, extParams: IInteractSolanaExt): Promise<ITransactionResult>;
|
|
655
|
-
|
|
656
|
-
getClaims(data: IGetClaimData[]): Promise<(MerkleDistributorAccountTypes["claimStatus"] | MerkleDistributorAccountTypes["compressedClaimStatus"] | null)[]>;
|
|
716
|
+
getClaims(data: IGetClaimData[]): Promise<(ClaimStatus | null)[]>;
|
|
657
717
|
getDistributors(data: IGetDistributors): Promise<(MerkleDistributor | null)[]>;
|
|
658
718
|
searchDistributors(data: ISearchDistributors): Promise<IProgramAccount<MerkleDistributor>[]>;
|
|
659
|
-
protected prepareClaimFeeInstruction(payer: PublicKey
|
|
719
|
+
protected prepareClaimFeeInstruction(payer: PublicKey): TransactionInstruction;
|
|
660
720
|
protected getNewDistributorArgs(data: ICreateDistributorData): NewDistributorArgs;
|
|
661
|
-
protected unwrapExecutionParams<T extends IInteractSolanaExt>(extParams: T): ReturnType<typeof unwrapExecutionParams<T>>;
|
|
662
|
-
private decodeClaimStatus;
|
|
663
721
|
}
|
|
664
722
|
|
|
665
723
|
declare class SolanaDistributorClient extends BaseDistributorClient {
|
|
@@ -1314,7 +1372,7 @@ declare const getTestOraclePda: (programId: PublicKey, mint: PublicKey, creator:
|
|
|
1314
1372
|
declare function getDistributorPda(programId: PublicKey, mint: PublicKey, version: number): PublicKey;
|
|
1315
1373
|
declare function getClaimantStatusPda(programId: PublicKey, distributor: PublicKey, claimant: PublicKey): PublicKey;
|
|
1316
1374
|
declare function getEventAuthorityPda(programId: PublicKey): PublicKey;
|
|
1317
|
-
declare function wrappedSignAndExecuteTransaction(
|
|
1375
|
+
declare function wrappedSignAndExecuteTransaction(connection: Connection, invoker: Keypair | SignerWalletAdapter, tx: Transaction | VersionedTransaction, confirmationParams: ConfirmationParams, throttleParams: ThrottleParams): Promise<string>;
|
|
1318
1376
|
declare function calculateAmountWithTransferFees(connection: Connection, transferFeeConfig: TransferFeeConfig, transferAmount: bigint): Promise<{
|
|
1319
1377
|
transferAmount: bigint;
|
|
1320
1378
|
feeCharged: bigint;
|
|
@@ -1366,9 +1424,11 @@ type index_AnchorErrorCode = AnchorErrorCode;
|
|
|
1366
1424
|
declare const index_AnchorErrorCode: typeof AnchorErrorCode;
|
|
1367
1425
|
type index_ClaimLockedAccounts = ClaimLockedAccounts;
|
|
1368
1426
|
type index_ClaimStatus = ClaimStatus;
|
|
1427
|
+
declare const index_ClaimStatus: typeof ClaimStatus;
|
|
1428
|
+
type index_ClaimStatusFields = ClaimStatusFields;
|
|
1429
|
+
type index_ClaimStatusJSON = ClaimStatusJSON;
|
|
1369
1430
|
type index_ClawbackAccounts = ClawbackAccounts;
|
|
1370
1431
|
type index_CloseClaimAccounts = CloseClaimAccounts;
|
|
1371
|
-
type index_CompressedClaimStatus = CompressedClaimStatus;
|
|
1372
1432
|
type index_ContractErrorCode = ContractErrorCode;
|
|
1373
1433
|
declare const index_ContractErrorCode: typeof ContractErrorCode;
|
|
1374
1434
|
type index_IClaimData = IClaimData;
|
|
@@ -1386,7 +1446,6 @@ type index_ISetClawbackReceiverData = ISetClawbackReceiverData;
|
|
|
1386
1446
|
type index_ISetDataAdmin = ISetDataAdmin;
|
|
1387
1447
|
type index_MerkleDistributor = MerkleDistributor;
|
|
1388
1448
|
declare const index_MerkleDistributor: typeof MerkleDistributor;
|
|
1389
|
-
type index_MerkleDistributorAccountTypes = MerkleDistributorAccountTypes;
|
|
1390
1449
|
type index_MerkleDistributorFields = MerkleDistributorFields;
|
|
1391
1450
|
type index_MerkleDistributorJSON = MerkleDistributorJSON;
|
|
1392
1451
|
type index_NewAlignedDistributorArgs = NewAlignedDistributorArgs;
|
|
@@ -1420,7 +1479,7 @@ declare const index_setAdmin: typeof setAdmin;
|
|
|
1420
1479
|
declare const index_setClawbackReceiver: typeof setClawbackReceiver;
|
|
1421
1480
|
declare const index_wrappedSignAndExecuteTransaction: typeof wrappedSignAndExecuteTransaction;
|
|
1422
1481
|
declare namespace index {
|
|
1423
|
-
export { type index_AlignedDistributorData as AlignedDistributorData, index_AnchorErrorCode as AnchorErrorCode, type index_ClaimLockedAccounts as ClaimLockedAccounts,
|
|
1482
|
+
export { type index_AlignedDistributorData as AlignedDistributorData, index_AnchorErrorCode as AnchorErrorCode, type index_ClaimLockedAccounts as ClaimLockedAccounts, index_ClaimStatus as ClaimStatus, type index_ClaimStatusFields as ClaimStatusFields, type index_ClaimStatusJSON as ClaimStatusJSON, type index_ClawbackAccounts as ClawbackAccounts, type index_CloseClaimAccounts as CloseClaimAccounts, 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_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_newClaim as newClaim, index_newDistributor as newDistributor, index_setAdmin as setAdmin, index_setClawbackReceiver as setClawbackReceiver, index_wrappedSignAndExecuteTransaction as wrappedSignAndExecuteTransaction };
|
|
1424
1483
|
}
|
|
1425
1484
|
|
|
1426
|
-
export { type AlignedDistributorData, AnchorErrorCode, type ClaimLockedAccounts, type
|
|
1485
|
+
export { type AlignedDistributorData, AnchorErrorCode, type ClaimLockedAccounts, ClaimStatus, type ClaimStatusFields, type ClaimStatusJSON, type ClawbackAccounts, type CloseClaimAccounts, 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 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, newClaim, newDistributor, setAdmin, setClawbackReceiver, wrappedSignAndExecuteTransaction };
|