@streamflow/distributor 7.5.3 → 8.0.0-alpha.p287.39c8818

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.
Files changed (98) hide show
  1. package/dist/cjs/index.cjs +3101 -0
  2. package/dist/cjs/index.cjs.map +1 -0
  3. package/dist/cjs/index.d.cts +10 -0
  4. package/dist/cjs/solana/descriptor/aligned_distributor.cjs +4 -0
  5. package/dist/cjs/solana/descriptor/aligned_distributor.cjs.map +1 -0
  6. package/dist/cjs/solana/descriptor/aligned_distributor.d.cts +932 -0
  7. package/dist/cjs/solana/descriptor/merkle_distributor.cjs +4 -0
  8. package/dist/cjs/solana/descriptor/merkle_distributor.cjs.map +1 -0
  9. package/dist/cjs/solana/descriptor/merkle_distributor.d.cts +1128 -0
  10. package/dist/cjs/solana/index.cjs +3095 -0
  11. package/dist/cjs/solana/index.cjs.map +1 -0
  12. package/dist/cjs/solana/index.d.cts +1486 -0
  13. package/dist/esm/index.d.ts +10 -1
  14. package/dist/esm/index.js +3075 -1
  15. package/dist/esm/index.js.map +1 -0
  16. package/dist/esm/solana/descriptor/aligned_distributor.d.ts +3 -1
  17. package/dist/esm/solana/descriptor/aligned_distributor.js +3 -1
  18. package/dist/esm/solana/descriptor/aligned_distributor.js.map +1 -0
  19. package/dist/esm/solana/descriptor/idl/aligned_distributor.json +851 -1182
  20. package/dist/esm/solana/descriptor/idl/merkle_distributor.json +1030 -0
  21. package/dist/esm/solana/descriptor/merkle_distributor.d.ts +3 -1
  22. package/dist/esm/solana/descriptor/merkle_distributor.js +3 -1
  23. package/dist/esm/solana/descriptor/merkle_distributor.js.map +1 -0
  24. package/dist/esm/solana/index.d.ts +1486 -7
  25. package/dist/esm/solana/index.js +3047 -7
  26. package/dist/esm/solana/index.js.map +1 -0
  27. package/package.json +56 -20
  28. package/dist/cjs/index.js +0 -27
  29. package/dist/cjs/solana/clients/BaseDistributorClient.js +0 -276
  30. package/dist/cjs/solana/clients/SolanaAlignedDistributorClient.js +0 -116
  31. package/dist/cjs/solana/clients/SolanaDistributorClient.js +0 -17
  32. package/dist/cjs/solana/clients/index.js +0 -10
  33. package/dist/cjs/solana/constants.js +0 -28
  34. package/dist/cjs/solana/descriptor/aligned_distributor.js +0 -2
  35. package/dist/cjs/solana/descriptor/idl/aligned_distributor.json +0 -1255
  36. package/dist/cjs/solana/descriptor/merkle_distributor.js +0 -2
  37. package/dist/cjs/solana/generated/accounts/ClaimStatus.js +0 -135
  38. package/dist/cjs/solana/generated/accounts/MerkleDistributor.js +0 -215
  39. package/dist/cjs/solana/generated/accounts/index.js +0 -7
  40. package/dist/cjs/solana/generated/errors/anchor.js +0 -712
  41. package/dist/cjs/solana/generated/errors/custom.js +0 -321
  42. package/dist/cjs/solana/generated/errors/index.js +0 -64
  43. package/dist/cjs/solana/generated/instructions/claimLocked.js +0 -22
  44. package/dist/cjs/solana/generated/instructions/clawback.js +0 -21
  45. package/dist/cjs/solana/generated/instructions/closeClaim.js +0 -57
  46. package/dist/cjs/solana/generated/instructions/index.js +0 -17
  47. package/dist/cjs/solana/generated/instructions/newClaim.js +0 -59
  48. package/dist/cjs/solana/generated/instructions/newDistributor.js +0 -104
  49. package/dist/cjs/solana/generated/instructions/setAdmin.js +0 -17
  50. package/dist/cjs/solana/generated/instructions/setClawbackReceiver.js +0 -17
  51. package/dist/cjs/solana/generated/programId.js +0 -8
  52. package/dist/cjs/solana/index.js +0 -36
  53. package/dist/cjs/solana/types.js +0 -159
  54. package/dist/cjs/solana/utils.js +0 -75
  55. package/dist/esm/solana/clients/BaseDistributorClient.d.ts +0 -43
  56. package/dist/esm/solana/clients/BaseDistributorClient.js +0 -274
  57. package/dist/esm/solana/clients/SolanaAlignedDistributorClient.d.ts +0 -16
  58. package/dist/esm/solana/clients/SolanaAlignedDistributorClient.js +0 -111
  59. package/dist/esm/solana/clients/SolanaDistributorClient.d.ts +0 -8
  60. package/dist/esm/solana/clients/SolanaDistributorClient.js +0 -11
  61. package/dist/esm/solana/clients/index.d.ts +0 -2
  62. package/dist/esm/solana/clients/index.js +0 -2
  63. package/dist/esm/solana/constants.d.ts +0 -24
  64. package/dist/esm/solana/constants.js +0 -25
  65. package/dist/esm/solana/generated/accounts/ClaimStatus.d.ts +0 -83
  66. package/dist/esm/solana/generated/accounts/ClaimStatus.js +0 -127
  67. package/dist/esm/solana/generated/accounts/MerkleDistributor.d.ts +0 -179
  68. package/dist/esm/solana/generated/accounts/MerkleDistributor.js +0 -239
  69. package/dist/esm/solana/generated/accounts/index.d.ts +0 -4
  70. package/dist/esm/solana/generated/accounts/index.js +0 -2
  71. package/dist/esm/solana/generated/errors/anchor.d.ts +0 -434
  72. package/dist/esm/solana/generated/errors/anchor.js +0 -707
  73. package/dist/esm/solana/generated/errors/custom.d.ts +0 -194
  74. package/dist/esm/solana/generated/errors/custom.js +0 -317
  75. package/dist/esm/solana/generated/errors/index.d.ts +0 -5
  76. package/dist/esm/solana/generated/errors/index.js +0 -37
  77. package/dist/esm/solana/generated/instructions/claimLocked.d.ts +0 -23
  78. package/dist/esm/solana/generated/instructions/claimLocked.js +0 -19
  79. package/dist/esm/solana/generated/instructions/clawback.d.ts +0 -17
  80. package/dist/esm/solana/generated/instructions/clawback.js +0 -18
  81. package/dist/esm/solana/generated/instructions/closeClaim.d.ts +0 -22
  82. package/dist/esm/solana/generated/instructions/closeClaim.js +0 -30
  83. package/dist/esm/solana/generated/instructions/index.d.ts +0 -14
  84. package/dist/esm/solana/generated/instructions/index.js +0 -7
  85. package/dist/esm/solana/generated/instructions/newClaim.d.ts +0 -29
  86. package/dist/esm/solana/generated/instructions/newClaim.js +0 -32
  87. package/dist/esm/solana/generated/instructions/newDistributor.d.ts +0 -58
  88. package/dist/esm/solana/generated/instructions/newDistributor.js +0 -77
  89. package/dist/esm/solana/generated/instructions/setAdmin.d.ts +0 -10
  90. package/dist/esm/solana/generated/instructions/setAdmin.js +0 -14
  91. package/dist/esm/solana/generated/instructions/setClawbackReceiver.d.ts +0 -10
  92. package/dist/esm/solana/generated/instructions/setClawbackReceiver.js +0 -14
  93. package/dist/esm/solana/generated/programId.d.ts +0 -3
  94. package/dist/esm/solana/generated/programId.js +0 -5
  95. package/dist/esm/solana/types.d.ts +0 -258
  96. package/dist/esm/solana/types.js +0 -156
  97. package/dist/esm/solana/utils.d.ts +0 -14
  98. package/dist/esm/solana/utils.js +0 -65
@@ -1,156 +0,0 @@
1
- export var AnchorErrorCode;
2
- (function (AnchorErrorCode) {
3
- /** 8 byte instruction identifier not provided */
4
- AnchorErrorCode["InstructionMissing"] = "InstructionMissing";
5
- /** Fallback functions are not supported */
6
- AnchorErrorCode["InstructionFallbackNotFound"] = "InstructionFallbackNotFound";
7
- /** The program could not deserialize the given instruction */
8
- AnchorErrorCode["InstructionDidNotDeserialize"] = "InstructionDidNotDeserialize";
9
- /** The program could not serialize the given instruction */
10
- AnchorErrorCode["InstructionDidNotSerialize"] = "InstructionDidNotSerialize";
11
- /** The program was compiled without idl instructions */
12
- AnchorErrorCode["IdlInstructionStub"] = "IdlInstructionStub";
13
- /** The transaction was given an invalid program for the IDL instruction */
14
- AnchorErrorCode["IdlInstructionInvalidProgram"] = "IdlInstructionInvalidProgram";
15
- /** A mut constraint was violated */
16
- AnchorErrorCode["ConstraintMut"] = "ConstraintMut";
17
- /** A has one constraint was violated */
18
- AnchorErrorCode["ConstraintHasOne"] = "ConstraintHasOne";
19
- /** A signer constraint was violated */
20
- AnchorErrorCode["ConstraintSigner"] = "ConstraintSigner";
21
- /** A raw constraint was violated */
22
- AnchorErrorCode["ConstraintRaw"] = "ConstraintRaw";
23
- /** An owner constraint was violated */
24
- AnchorErrorCode["ConstraintOwner"] = "ConstraintOwner";
25
- /** A rent exemption constraint was violated */
26
- AnchorErrorCode["ConstraintRentExempt"] = "ConstraintRentExempt";
27
- /** A seeds constraint was violated */
28
- AnchorErrorCode["ConstraintSeeds"] = "ConstraintSeeds";
29
- /** An executable constraint was violated */
30
- AnchorErrorCode["ConstraintExecutable"] = "ConstraintExecutable";
31
- /** Deprecated Error, feel free to replace with something else */
32
- AnchorErrorCode["ConstraintState"] = "ConstraintState";
33
- /** An associated constraint was violated */
34
- AnchorErrorCode["ConstraintAssociated"] = "ConstraintAssociated";
35
- /** An associated init constraint was violated */
36
- AnchorErrorCode["ConstraintAssociatedInit"] = "ConstraintAssociatedInit";
37
- /** A close constraint was violated */
38
- AnchorErrorCode["ConstraintClose"] = "ConstraintClose";
39
- /** An address constraint was violated */
40
- AnchorErrorCode["ConstraintAddress"] = "ConstraintAddress";
41
- /** Expected zero account discriminant */
42
- AnchorErrorCode["ConstraintZero"] = "ConstraintZero";
43
- /** A token mint constraint was violated */
44
- AnchorErrorCode["ConstraintTokenMint"] = "ConstraintTokenMint";
45
- /** A token owner constraint was violated */
46
- AnchorErrorCode["ConstraintTokenOwner"] = "ConstraintTokenOwner";
47
- /** A mint mint authority constraint was violated */
48
- AnchorErrorCode["ConstraintMintMintAuthority"] = "ConstraintMintMintAuthority";
49
- /** A mint freeze authority constraint was violated */
50
- AnchorErrorCode["ConstraintMintFreezeAuthority"] = "ConstraintMintFreezeAuthority";
51
- /** A mint decimals constraint was violated */
52
- AnchorErrorCode["ConstraintMintDecimals"] = "ConstraintMintDecimals";
53
- /** A space constraint was violated */
54
- AnchorErrorCode["ConstraintSpace"] = "ConstraintSpace";
55
- /** A required account for the constraint is None */
56
- AnchorErrorCode["ConstraintAccountIsNone"] = "ConstraintAccountIsNone";
57
- /** A require expression was violated */
58
- AnchorErrorCode["RequireViolated"] = "RequireViolated";
59
- /** A require_eq expression was violated */
60
- AnchorErrorCode["RequireEqViolated"] = "RequireEqViolated";
61
- /** A require_keys_eq expression was violated */
62
- AnchorErrorCode["RequireKeysEqViolated"] = "RequireKeysEqViolated";
63
- /** A require_neq expression was violated */
64
- AnchorErrorCode["RequireNeqViolated"] = "RequireNeqViolated";
65
- /** A require_keys_neq expression was violated */
66
- AnchorErrorCode["RequireKeysNeqViolated"] = "RequireKeysNeqViolated";
67
- /** A require_gt expression was violated */
68
- AnchorErrorCode["RequireGtViolated"] = "RequireGtViolated";
69
- /** A require_gte expression was violated */
70
- AnchorErrorCode["RequireGteViolated"] = "RequireGteViolated";
71
- /** The account discriminator was already set on this account */
72
- AnchorErrorCode["AccountDiscriminatorAlreadySet"] = "AccountDiscriminatorAlreadySet";
73
- /** No 8 byte discriminator was found on the account */
74
- AnchorErrorCode["AccountDiscriminatorNotFound"] = "AccountDiscriminatorNotFound";
75
- /** 8 byte discriminator did not match what was expected */
76
- AnchorErrorCode["AccountDiscriminatorMismatch"] = "AccountDiscriminatorMismatch";
77
- /** Failed to deserialize the account */
78
- AnchorErrorCode["AccountDidNotDeserialize"] = "AccountDidNotDeserialize";
79
- /** Failed to serialize the account */
80
- AnchorErrorCode["AccountDidNotSerialize"] = "AccountDidNotSerialize";
81
- /** Not enough account keys given to the instruction */
82
- AnchorErrorCode["AccountNotEnoughKeys"] = "AccountNotEnoughKeys";
83
- /** The given account is not mutable */
84
- AnchorErrorCode["AccountNotMutable"] = "AccountNotMutable";
85
- /** The given account is owned by a different program than expected */
86
- AnchorErrorCode["AccountOwnedByWrongProgram"] = "AccountOwnedByWrongProgram";
87
- /** Program ID was not as expected */
88
- AnchorErrorCode["InvalidProgramId"] = "InvalidProgramId";
89
- /** Program account is not executable */
90
- AnchorErrorCode["InvalidProgramExecutable"] = "InvalidProgramExecutable";
91
- /** The given account did not sign */
92
- AnchorErrorCode["AccountNotSigner"] = "AccountNotSigner";
93
- /** The given account is not owned by the system program */
94
- AnchorErrorCode["AccountNotSystemOwned"] = "AccountNotSystemOwned";
95
- /** The program expected this account to be already initialized */
96
- AnchorErrorCode["AccountNotInitialized"] = "AccountNotInitialized";
97
- /** The given account is not a program data account */
98
- AnchorErrorCode["AccountNotProgramData"] = "AccountNotProgramData";
99
- /** The given account is not the associated token account */
100
- AnchorErrorCode["AccountNotAssociatedTokenAccount"] = "AccountNotAssociatedTokenAccount";
101
- /** The given public key does not match the required sysvar */
102
- AnchorErrorCode["AccountSysvarMismatch"] = "AccountSysvarMismatch";
103
- /** The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit */
104
- AnchorErrorCode["AccountReallocExceedsLimit"] = "AccountReallocExceedsLimit";
105
- /** The account was duplicated for more than one reallocation */
106
- AnchorErrorCode["AccountDuplicateReallocs"] = "AccountDuplicateReallocs";
107
- /** The declared program id does not match the actual program id */
108
- AnchorErrorCode["DeclaredProgramIdMismatch"] = "DeclaredProgramIdMismatch";
109
- /** The API being used is deprecated and should no longer be used */
110
- AnchorErrorCode["Deprecated"] = "Deprecated";
111
- })(AnchorErrorCode || (AnchorErrorCode = {}));
112
- export var ContractErrorCode;
113
- (function (ContractErrorCode) {
114
- /** Insufficient unlocked tokens */
115
- ContractErrorCode["InsufficientUnlockedTokens"] = "InsufficientUnlockedTokens";
116
- /** Deposit Start too far in future */
117
- ContractErrorCode["StartTooFarInFuture"] = "StartTooFarInFuture";
118
- /** Invalid Merkle proof */
119
- ContractErrorCode["InvalidProof"] = "InvalidProof";
120
- /** Exceeded maximum claim amount */
121
- ContractErrorCode["ExceededMaxClaim"] = "ExceededMaxClaim";
122
- /** Exceeded maximum node count */
123
- ContractErrorCode["MaxNodesExceeded"] = "MaxNodesExceeded";
124
- /** Account is not authorized to execute this instruction */
125
- ContractErrorCode["Unauthorized"] = "Unauthorized";
126
- /** Token account owner did not match intended owner */
127
- ContractErrorCode["OwnerMismatch"] = "OwnerMismatch";
128
- /** Clawback cannot be before vesting starts */
129
- ContractErrorCode["ClawbackBeforeVesting"] = "ClawbackBeforeVesting";
130
- /** Attempted clawback before start */
131
- ContractErrorCode["ClawbackBeforeStart"] = "ClawbackBeforeStart";
132
- /** Clawback already claimed */
133
- ContractErrorCode["ClawbackAlreadyClaimed"] = "ClawbackAlreadyClaimed";
134
- /** Clawback start must be at least one day after vesting end */
135
- ContractErrorCode["InsufficientClawbackDelay"] = "InsufficientClawbackDelay";
136
- /** New and old Clawback receivers are identical */
137
- ContractErrorCode["SameClawbackReceiver"] = "SameClawbackReceiver";
138
- /** New and old admin are identical */
139
- ContractErrorCode["SameAdmin"] = "SameAdmin";
140
- /** Claim window expired */
141
- ContractErrorCode["ClaimExpired"] = "ClaimExpired";
142
- /** Arithmetic Error (overflow/underflow) */
143
- ContractErrorCode["ArithmeticError"] = "ArithmeticError";
144
- /** Start Timestamp cannot be after end Timestamp */
145
- ContractErrorCode["StartTimestampAfterEnd"] = "StartTimestampAfterEnd";
146
- /** Timestamps cannot be in the past */
147
- ContractErrorCode["TimestampsNotInFuture"] = "TimestampsNotInFuture";
148
- /** Airdrop Version Mismatch */
149
- ContractErrorCode["InvalidVersion"] = "InvalidVersion";
150
- /** Invalid Mint */
151
- ContractErrorCode["InvalidMint"] = "InvalidMint";
152
- /** Claim is closed */
153
- ContractErrorCode["ClaimIsClosed"] = "ClaimIsClosed";
154
- /** Claims are not closable */
155
- ContractErrorCode["ClaimsAreNotClosable"] = "ClaimsAreNotClosable";
156
- })(ContractErrorCode || (ContractErrorCode = {}));
@@ -1,14 +0,0 @@
1
- import { TransferFeeConfig } from "@solana/spl-token";
2
- import { SignerWalletAdapter } from "@solana/wallet-adapter-base";
3
- import { Connection, Keypair, PublicKey, Transaction, VersionedTransaction } from "@solana/web3.js";
4
- import { ConfirmationParams, ThrottleParams } from "@streamflow/common/solana";
5
- export declare const getAlignedDistributorPda: (programId: PublicKey, distributor: PublicKey) => PublicKey;
6
- export declare const getTestOraclePda: (programId: PublicKey, mint: PublicKey, creator: PublicKey) => PublicKey;
7
- export declare function getDistributorPda(programId: PublicKey, mint: PublicKey, version: number): PublicKey;
8
- export declare function getClaimantStatusPda(programId: PublicKey, distributor: PublicKey, claimant: PublicKey): PublicKey;
9
- export declare function getEventAuthorityPda(programId: PublicKey): PublicKey;
10
- export declare function wrappedSignAndExecuteTransaction(connection: Connection, invoker: Keypair | SignerWalletAdapter, tx: Transaction | VersionedTransaction, confirmationParams: ConfirmationParams, throttleParams: ThrottleParams): Promise<string>;
11
- export declare function calculateAmountWithTransferFees(connection: Connection, transferFeeConfig: TransferFeeConfig, transferAmount: bigint): Promise<{
12
- transferAmount: bigint;
13
- feeCharged: bigint;
14
- }>;
@@ -1,65 +0,0 @@
1
- import { Buffer } from "buffer";
2
- import { PublicKey } from "@solana/web3.js";
3
- import { ContractError, divCeilN } from "@streamflow/common";
4
- import { signAndExecuteTransaction } from "@streamflow/common/solana";
5
- import { fromTxError } from "./generated/errors/index.js";
6
- import { ONE_IN_BASIS_POINTS, ALIGNED_DISTRIBUTOR_PREFIX, TEST_ORACLE_PREFIX, DISTRIBUTOR_PREFIX, CLAIM_STATUS_PREFIX, } from "./constants.js";
7
- export const getAlignedDistributorPda = (programId, distributor) => {
8
- return PublicKey.findProgramAddressSync([ALIGNED_DISTRIBUTOR_PREFIX, distributor.toBuffer()], programId)[0];
9
- };
10
- export const getTestOraclePda = (programId, mint, creator) => {
11
- return PublicKey.findProgramAddressSync([TEST_ORACLE_PREFIX, mint.toBuffer(), creator.toBuffer()], programId)[0];
12
- };
13
- export function getDistributorPda(programId, mint, version) {
14
- // Constructing the seed for the PDA
15
- const seeds = [
16
- DISTRIBUTOR_PREFIX,
17
- mint.toBuffer(),
18
- Buffer.from(new Uint8Array(new BigUint64Array([BigInt(version)]).buffer)),
19
- ];
20
- // Finding the PDA
21
- return PublicKey.findProgramAddressSync(seeds, programId)[0];
22
- }
23
- export function getClaimantStatusPda(programId, distributor, claimant) {
24
- // Constructing the seed for the PDA
25
- const seeds = [CLAIM_STATUS_PREFIX, claimant.toBuffer(), distributor.toBuffer()];
26
- // Finding the PDA
27
- return PublicKey.findProgramAddressSync(seeds, programId)[0];
28
- }
29
- export function getEventAuthorityPda(programId) {
30
- // Constructing the seed for the PDA
31
- const seeds = [Buffer.from("__event_authority")];
32
- // Finding the PDA
33
- return PublicKey.findProgramAddressSync(seeds, programId)[0];
34
- }
35
- export async function wrappedSignAndExecuteTransaction(connection, invoker, tx, confirmationParams, throttleParams) {
36
- try {
37
- return await signAndExecuteTransaction(connection, invoker, tx, confirmationParams, throttleParams);
38
- }
39
- catch (err) {
40
- if (err instanceof Error) {
41
- const parsed = fromTxError(err);
42
- if (parsed) {
43
- throw new ContractError(err, parsed.name, parsed.msg);
44
- }
45
- }
46
- throw err;
47
- }
48
- }
49
- export async function calculateAmountWithTransferFees(connection, transferFeeConfig, transferAmount) {
50
- const epoch = await connection.getEpochInfo();
51
- const transferFee = epoch.epoch >= transferFeeConfig.newerTransferFee.epoch
52
- ? transferFeeConfig.newerTransferFee
53
- : transferFeeConfig.olderTransferFee;
54
- const transferFeeBasisPoints = BigInt(transferFee.transferFeeBasisPoints);
55
- let feeCharged = BigInt(0);
56
- if (transferFeeBasisPoints !== BigInt(0)) {
57
- const numerator = transferAmount * ONE_IN_BASIS_POINTS;
58
- const denominator = ONE_IN_BASIS_POINTS - transferFeeBasisPoints;
59
- const rawPreFeeAmount = divCeilN(numerator, denominator);
60
- const fee = rawPreFeeAmount - transferAmount;
61
- transferAmount = rawPreFeeAmount;
62
- feeCharged = fee > transferFee.maximumFee ? transferFee.maximumFee : fee;
63
- }
64
- return { transferAmount, feeCharged };
65
- }