@streamflow/distributor 7.5.3 → 8.0.0-alpha.p287.5172056
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 +3088 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.cts +10 -0
- package/dist/cjs/solana/descriptor/aligned_distributor.cjs +4 -0
- package/dist/cjs/solana/descriptor/aligned_distributor.cjs.map +1 -0
- package/dist/cjs/solana/descriptor/aligned_distributor.d.cts +932 -0
- package/dist/cjs/solana/descriptor/merkle_distributor.cjs +4 -0
- package/dist/cjs/solana/descriptor/merkle_distributor.cjs.map +1 -0
- package/dist/cjs/solana/descriptor/merkle_distributor.d.cts +1128 -0
- package/dist/cjs/solana/index.cjs +3082 -0
- package/dist/cjs/solana/index.cjs.map +1 -0
- package/dist/cjs/solana/index.d.cts +1485 -0
- package/dist/esm/index.d.ts +10 -1
- package/dist/esm/index.js +3062 -1
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/solana/descriptor/aligned_distributor.d.ts +3 -1
- package/dist/esm/solana/descriptor/aligned_distributor.js +3 -1
- package/dist/esm/solana/descriptor/aligned_distributor.js.map +1 -0
- package/dist/esm/solana/descriptor/idl/aligned_distributor.json +851 -1182
- package/dist/esm/solana/descriptor/idl/merkle_distributor.json +1030 -0
- package/dist/esm/solana/descriptor/merkle_distributor.d.ts +3 -1
- package/dist/esm/solana/descriptor/merkle_distributor.js +3 -1
- package/dist/esm/solana/descriptor/merkle_distributor.js.map +1 -0
- package/dist/esm/solana/index.d.ts +1485 -7
- package/dist/esm/solana/index.js +3034 -7
- package/dist/esm/solana/index.js.map +1 -0
- package/package.json +56 -20
- package/dist/cjs/index.js +0 -27
- package/dist/cjs/solana/clients/BaseDistributorClient.js +0 -276
- package/dist/cjs/solana/clients/SolanaAlignedDistributorClient.js +0 -116
- package/dist/cjs/solana/clients/SolanaDistributorClient.js +0 -17
- package/dist/cjs/solana/clients/index.js +0 -10
- package/dist/cjs/solana/constants.js +0 -28
- package/dist/cjs/solana/descriptor/aligned_distributor.js +0 -2
- package/dist/cjs/solana/descriptor/idl/aligned_distributor.json +0 -1255
- package/dist/cjs/solana/descriptor/merkle_distributor.js +0 -2
- package/dist/cjs/solana/generated/accounts/ClaimStatus.js +0 -135
- package/dist/cjs/solana/generated/accounts/MerkleDistributor.js +0 -215
- package/dist/cjs/solana/generated/accounts/index.js +0 -7
- package/dist/cjs/solana/generated/errors/anchor.js +0 -712
- package/dist/cjs/solana/generated/errors/custom.js +0 -321
- package/dist/cjs/solana/generated/errors/index.js +0 -64
- package/dist/cjs/solana/generated/instructions/claimLocked.js +0 -22
- package/dist/cjs/solana/generated/instructions/clawback.js +0 -21
- package/dist/cjs/solana/generated/instructions/closeClaim.js +0 -57
- package/dist/cjs/solana/generated/instructions/index.js +0 -17
- package/dist/cjs/solana/generated/instructions/newClaim.js +0 -59
- package/dist/cjs/solana/generated/instructions/newDistributor.js +0 -104
- package/dist/cjs/solana/generated/instructions/setAdmin.js +0 -17
- package/dist/cjs/solana/generated/instructions/setClawbackReceiver.js +0 -17
- package/dist/cjs/solana/generated/programId.js +0 -8
- package/dist/cjs/solana/index.js +0 -36
- package/dist/cjs/solana/types.js +0 -159
- package/dist/cjs/solana/utils.js +0 -75
- package/dist/esm/solana/clients/BaseDistributorClient.d.ts +0 -43
- package/dist/esm/solana/clients/BaseDistributorClient.js +0 -274
- package/dist/esm/solana/clients/SolanaAlignedDistributorClient.d.ts +0 -16
- package/dist/esm/solana/clients/SolanaAlignedDistributorClient.js +0 -111
- package/dist/esm/solana/clients/SolanaDistributorClient.d.ts +0 -8
- package/dist/esm/solana/clients/SolanaDistributorClient.js +0 -11
- package/dist/esm/solana/clients/index.d.ts +0 -2
- package/dist/esm/solana/clients/index.js +0 -2
- package/dist/esm/solana/constants.d.ts +0 -24
- package/dist/esm/solana/constants.js +0 -25
- package/dist/esm/solana/generated/accounts/ClaimStatus.d.ts +0 -83
- package/dist/esm/solana/generated/accounts/ClaimStatus.js +0 -127
- package/dist/esm/solana/generated/accounts/MerkleDistributor.d.ts +0 -179
- package/dist/esm/solana/generated/accounts/MerkleDistributor.js +0 -239
- package/dist/esm/solana/generated/accounts/index.d.ts +0 -4
- package/dist/esm/solana/generated/accounts/index.js +0 -2
- package/dist/esm/solana/generated/errors/anchor.d.ts +0 -434
- package/dist/esm/solana/generated/errors/anchor.js +0 -707
- package/dist/esm/solana/generated/errors/custom.d.ts +0 -194
- package/dist/esm/solana/generated/errors/custom.js +0 -317
- package/dist/esm/solana/generated/errors/index.d.ts +0 -5
- package/dist/esm/solana/generated/errors/index.js +0 -37
- package/dist/esm/solana/generated/instructions/claimLocked.d.ts +0 -23
- package/dist/esm/solana/generated/instructions/claimLocked.js +0 -19
- package/dist/esm/solana/generated/instructions/clawback.d.ts +0 -17
- package/dist/esm/solana/generated/instructions/clawback.js +0 -18
- package/dist/esm/solana/generated/instructions/closeClaim.d.ts +0 -22
- package/dist/esm/solana/generated/instructions/closeClaim.js +0 -30
- package/dist/esm/solana/generated/instructions/index.d.ts +0 -14
- package/dist/esm/solana/generated/instructions/index.js +0 -7
- package/dist/esm/solana/generated/instructions/newClaim.d.ts +0 -29
- package/dist/esm/solana/generated/instructions/newClaim.js +0 -32
- package/dist/esm/solana/generated/instructions/newDistributor.d.ts +0 -58
- package/dist/esm/solana/generated/instructions/newDistributor.js +0 -77
- package/dist/esm/solana/generated/instructions/setAdmin.d.ts +0 -10
- package/dist/esm/solana/generated/instructions/setAdmin.js +0 -14
- package/dist/esm/solana/generated/instructions/setClawbackReceiver.d.ts +0 -10
- package/dist/esm/solana/generated/instructions/setClawbackReceiver.js +0 -14
- package/dist/esm/solana/generated/programId.d.ts +0 -3
- package/dist/esm/solana/generated/programId.js +0 -5
- package/dist/esm/solana/types.d.ts +0 -258
- package/dist/esm/solana/types.js +0 -156
- package/dist/esm/solana/utils.d.ts +0 -14
- package/dist/esm/solana/utils.js +0 -65
package/dist/esm/index.js
CHANGED
|
@@ -1 +1,3062 @@
|
|
|
1
|
-
|
|
1
|
+
import { PublicKey, TransactionInstruction, Connection, SystemProgram } from '@solana/web3.js';
|
|
2
|
+
import '@solana/wallet-adapter-base';
|
|
3
|
+
import { ICluster, ContractError, divCeilN, invariant, getNumberFromBN, getBN } from '@streamflow/common';
|
|
4
|
+
import { signAndExecuteTransaction, buildSendThrottler, prepareBaseInstructions, getMintAndProgram, ata, prepareWrappedAccount, createAndEstimateTransaction, prepareTransaction, checkOrCreateAtaBatch, pk } from '@streamflow/common/solana';
|
|
5
|
+
import { Program } from '@coral-xyz/anchor';
|
|
6
|
+
import * as borsh8 from '@coral-xyz/borsh';
|
|
7
|
+
import { Buffer as Buffer$1 } from 'buffer';
|
|
8
|
+
import BN6 from 'bn.js';
|
|
9
|
+
import { NATIVE_MINT, getTransferFeeConfig, ASSOCIATED_TOKEN_PROGRAM_ID, createTransferCheckedWithFeeInstruction, createTransferCheckedInstruction } from '@solana/spl-token';
|
|
10
|
+
import bs58 from 'bs58';
|
|
11
|
+
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// solana/index.ts
|
|
19
|
+
var solana_exports = {};
|
|
20
|
+
__export(solana_exports, {
|
|
21
|
+
AnchorErrorCode: () => AnchorErrorCode,
|
|
22
|
+
ClaimStatus: () => ClaimStatus,
|
|
23
|
+
ContractErrorCode: () => ContractErrorCode,
|
|
24
|
+
MerkleDistributor: () => MerkleDistributor,
|
|
25
|
+
SolanaAlignedDistributorClient: () => SolanaAlignedDistributorClient,
|
|
26
|
+
SolanaDistributorClient: () => SolanaDistributorClient,
|
|
27
|
+
calculateAmountWithTransferFees: () => calculateAmountWithTransferFees,
|
|
28
|
+
claimLocked: () => claimLocked,
|
|
29
|
+
clawback: () => clawback,
|
|
30
|
+
closeClaim: () => closeClaim,
|
|
31
|
+
constants: () => constants_exports,
|
|
32
|
+
fromCode: () => fromCode3,
|
|
33
|
+
fromTxError: () => fromTxError,
|
|
34
|
+
getAlignedDistributorPda: () => getAlignedDistributorPda,
|
|
35
|
+
getClaimantStatusPda: () => getClaimantStatusPda,
|
|
36
|
+
getDistributorPda: () => getDistributorPda,
|
|
37
|
+
getEventAuthorityPda: () => getEventAuthorityPda,
|
|
38
|
+
getTestOraclePda: () => getTestOraclePda,
|
|
39
|
+
newClaim: () => newClaim,
|
|
40
|
+
newDistributor: () => newDistributor,
|
|
41
|
+
setAdmin: () => setAdmin,
|
|
42
|
+
setClawbackReceiver: () => setClawbackReceiver,
|
|
43
|
+
wrappedSignAndExecuteTransaction: () => wrappedSignAndExecuteTransaction
|
|
44
|
+
});
|
|
45
|
+
var AnchorErrorCode = /* @__PURE__ */ ((AnchorErrorCode2) => {
|
|
46
|
+
AnchorErrorCode2["InstructionMissing"] = "InstructionMissing";
|
|
47
|
+
AnchorErrorCode2["InstructionFallbackNotFound"] = "InstructionFallbackNotFound";
|
|
48
|
+
AnchorErrorCode2["InstructionDidNotDeserialize"] = "InstructionDidNotDeserialize";
|
|
49
|
+
AnchorErrorCode2["InstructionDidNotSerialize"] = "InstructionDidNotSerialize";
|
|
50
|
+
AnchorErrorCode2["IdlInstructionStub"] = "IdlInstructionStub";
|
|
51
|
+
AnchorErrorCode2["IdlInstructionInvalidProgram"] = "IdlInstructionInvalidProgram";
|
|
52
|
+
AnchorErrorCode2["ConstraintMut"] = "ConstraintMut";
|
|
53
|
+
AnchorErrorCode2["ConstraintHasOne"] = "ConstraintHasOne";
|
|
54
|
+
AnchorErrorCode2["ConstraintSigner"] = "ConstraintSigner";
|
|
55
|
+
AnchorErrorCode2["ConstraintRaw"] = "ConstraintRaw";
|
|
56
|
+
AnchorErrorCode2["ConstraintOwner"] = "ConstraintOwner";
|
|
57
|
+
AnchorErrorCode2["ConstraintRentExempt"] = "ConstraintRentExempt";
|
|
58
|
+
AnchorErrorCode2["ConstraintSeeds"] = "ConstraintSeeds";
|
|
59
|
+
AnchorErrorCode2["ConstraintExecutable"] = "ConstraintExecutable";
|
|
60
|
+
AnchorErrorCode2["ConstraintState"] = "ConstraintState";
|
|
61
|
+
AnchorErrorCode2["ConstraintAssociated"] = "ConstraintAssociated";
|
|
62
|
+
AnchorErrorCode2["ConstraintAssociatedInit"] = "ConstraintAssociatedInit";
|
|
63
|
+
AnchorErrorCode2["ConstraintClose"] = "ConstraintClose";
|
|
64
|
+
AnchorErrorCode2["ConstraintAddress"] = "ConstraintAddress";
|
|
65
|
+
AnchorErrorCode2["ConstraintZero"] = "ConstraintZero";
|
|
66
|
+
AnchorErrorCode2["ConstraintTokenMint"] = "ConstraintTokenMint";
|
|
67
|
+
AnchorErrorCode2["ConstraintTokenOwner"] = "ConstraintTokenOwner";
|
|
68
|
+
AnchorErrorCode2["ConstraintMintMintAuthority"] = "ConstraintMintMintAuthority";
|
|
69
|
+
AnchorErrorCode2["ConstraintMintFreezeAuthority"] = "ConstraintMintFreezeAuthority";
|
|
70
|
+
AnchorErrorCode2["ConstraintMintDecimals"] = "ConstraintMintDecimals";
|
|
71
|
+
AnchorErrorCode2["ConstraintSpace"] = "ConstraintSpace";
|
|
72
|
+
AnchorErrorCode2["ConstraintAccountIsNone"] = "ConstraintAccountIsNone";
|
|
73
|
+
AnchorErrorCode2["RequireViolated"] = "RequireViolated";
|
|
74
|
+
AnchorErrorCode2["RequireEqViolated"] = "RequireEqViolated";
|
|
75
|
+
AnchorErrorCode2["RequireKeysEqViolated"] = "RequireKeysEqViolated";
|
|
76
|
+
AnchorErrorCode2["RequireNeqViolated"] = "RequireNeqViolated";
|
|
77
|
+
AnchorErrorCode2["RequireKeysNeqViolated"] = "RequireKeysNeqViolated";
|
|
78
|
+
AnchorErrorCode2["RequireGtViolated"] = "RequireGtViolated";
|
|
79
|
+
AnchorErrorCode2["RequireGteViolated"] = "RequireGteViolated";
|
|
80
|
+
AnchorErrorCode2["AccountDiscriminatorAlreadySet"] = "AccountDiscriminatorAlreadySet";
|
|
81
|
+
AnchorErrorCode2["AccountDiscriminatorNotFound"] = "AccountDiscriminatorNotFound";
|
|
82
|
+
AnchorErrorCode2["AccountDiscriminatorMismatch"] = "AccountDiscriminatorMismatch";
|
|
83
|
+
AnchorErrorCode2["AccountDidNotDeserialize"] = "AccountDidNotDeserialize";
|
|
84
|
+
AnchorErrorCode2["AccountDidNotSerialize"] = "AccountDidNotSerialize";
|
|
85
|
+
AnchorErrorCode2["AccountNotEnoughKeys"] = "AccountNotEnoughKeys";
|
|
86
|
+
AnchorErrorCode2["AccountNotMutable"] = "AccountNotMutable";
|
|
87
|
+
AnchorErrorCode2["AccountOwnedByWrongProgram"] = "AccountOwnedByWrongProgram";
|
|
88
|
+
AnchorErrorCode2["InvalidProgramId"] = "InvalidProgramId";
|
|
89
|
+
AnchorErrorCode2["InvalidProgramExecutable"] = "InvalidProgramExecutable";
|
|
90
|
+
AnchorErrorCode2["AccountNotSigner"] = "AccountNotSigner";
|
|
91
|
+
AnchorErrorCode2["AccountNotSystemOwned"] = "AccountNotSystemOwned";
|
|
92
|
+
AnchorErrorCode2["AccountNotInitialized"] = "AccountNotInitialized";
|
|
93
|
+
AnchorErrorCode2["AccountNotProgramData"] = "AccountNotProgramData";
|
|
94
|
+
AnchorErrorCode2["AccountNotAssociatedTokenAccount"] = "AccountNotAssociatedTokenAccount";
|
|
95
|
+
AnchorErrorCode2["AccountSysvarMismatch"] = "AccountSysvarMismatch";
|
|
96
|
+
AnchorErrorCode2["AccountReallocExceedsLimit"] = "AccountReallocExceedsLimit";
|
|
97
|
+
AnchorErrorCode2["AccountDuplicateReallocs"] = "AccountDuplicateReallocs";
|
|
98
|
+
AnchorErrorCode2["DeclaredProgramIdMismatch"] = "DeclaredProgramIdMismatch";
|
|
99
|
+
AnchorErrorCode2["Deprecated"] = "Deprecated";
|
|
100
|
+
return AnchorErrorCode2;
|
|
101
|
+
})(AnchorErrorCode || {});
|
|
102
|
+
var ContractErrorCode = /* @__PURE__ */ ((ContractErrorCode2) => {
|
|
103
|
+
ContractErrorCode2["InsufficientUnlockedTokens"] = "InsufficientUnlockedTokens";
|
|
104
|
+
ContractErrorCode2["StartTooFarInFuture"] = "StartTooFarInFuture";
|
|
105
|
+
ContractErrorCode2["InvalidProof"] = "InvalidProof";
|
|
106
|
+
ContractErrorCode2["ExceededMaxClaim"] = "ExceededMaxClaim";
|
|
107
|
+
ContractErrorCode2["MaxNodesExceeded"] = "MaxNodesExceeded";
|
|
108
|
+
ContractErrorCode2["Unauthorized"] = "Unauthorized";
|
|
109
|
+
ContractErrorCode2["OwnerMismatch"] = "OwnerMismatch";
|
|
110
|
+
ContractErrorCode2["ClawbackBeforeVesting"] = "ClawbackBeforeVesting";
|
|
111
|
+
ContractErrorCode2["ClawbackBeforeStart"] = "ClawbackBeforeStart";
|
|
112
|
+
ContractErrorCode2["ClawbackAlreadyClaimed"] = "ClawbackAlreadyClaimed";
|
|
113
|
+
ContractErrorCode2["InsufficientClawbackDelay"] = "InsufficientClawbackDelay";
|
|
114
|
+
ContractErrorCode2["SameClawbackReceiver"] = "SameClawbackReceiver";
|
|
115
|
+
ContractErrorCode2["SameAdmin"] = "SameAdmin";
|
|
116
|
+
ContractErrorCode2["ClaimExpired"] = "ClaimExpired";
|
|
117
|
+
ContractErrorCode2["ArithmeticError"] = "ArithmeticError";
|
|
118
|
+
ContractErrorCode2["StartTimestampAfterEnd"] = "StartTimestampAfterEnd";
|
|
119
|
+
ContractErrorCode2["TimestampsNotInFuture"] = "TimestampsNotInFuture";
|
|
120
|
+
ContractErrorCode2["InvalidVersion"] = "InvalidVersion";
|
|
121
|
+
ContractErrorCode2["InvalidMint"] = "InvalidMint";
|
|
122
|
+
ContractErrorCode2["ClaimIsClosed"] = "ClaimIsClosed";
|
|
123
|
+
ContractErrorCode2["ClaimsAreNotClosable"] = "ClaimsAreNotClosable";
|
|
124
|
+
return ContractErrorCode2;
|
|
125
|
+
})(ContractErrorCode || {});
|
|
126
|
+
var PROGRAM_ID_CLI = new PublicKey("MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N");
|
|
127
|
+
var PROGRAM_ID = PROGRAM_ID_CLI;
|
|
128
|
+
|
|
129
|
+
// solana/generated/instructions/newDistributor.ts
|
|
130
|
+
var layout = borsh8.struct([
|
|
131
|
+
borsh8.u64("version"),
|
|
132
|
+
borsh8.array(borsh8.u8(), 32, "root"),
|
|
133
|
+
borsh8.u64("maxTotalClaim"),
|
|
134
|
+
borsh8.u64("maxNumNodes"),
|
|
135
|
+
borsh8.u64("unlockPeriod"),
|
|
136
|
+
borsh8.u64("startVestingTs"),
|
|
137
|
+
borsh8.u64("endVestingTs"),
|
|
138
|
+
borsh8.u64("clawbackStartTs"),
|
|
139
|
+
borsh8.bool("claimsClosableByAdmin"),
|
|
140
|
+
borsh8.option(borsh8.bool(), "canUpdateDuration"),
|
|
141
|
+
borsh8.option(borsh8.u64(), "totalAmountUnlocked"),
|
|
142
|
+
borsh8.option(borsh8.u64(), "totalAmountLocked"),
|
|
143
|
+
borsh8.option(borsh8.bool(), "claimsClosableByClaimant"),
|
|
144
|
+
borsh8.option(borsh8.u16(), "claimsLimit")
|
|
145
|
+
]);
|
|
146
|
+
function newDistributor(args, accounts, programId = PROGRAM_ID) {
|
|
147
|
+
const keys = [
|
|
148
|
+
{ pubkey: accounts.distributor, isSigner: false, isWritable: true },
|
|
149
|
+
{ pubkey: accounts.clawbackReceiver, isSigner: false, isWritable: true },
|
|
150
|
+
{ pubkey: accounts.mint, isSigner: false, isWritable: false },
|
|
151
|
+
{ pubkey: accounts.tokenVault, isSigner: false, isWritable: true },
|
|
152
|
+
{ pubkey: accounts.admin, isSigner: true, isWritable: true },
|
|
153
|
+
{ pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
|
|
154
|
+
{
|
|
155
|
+
pubkey: accounts.associatedTokenProgram,
|
|
156
|
+
isSigner: false,
|
|
157
|
+
isWritable: false
|
|
158
|
+
},
|
|
159
|
+
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false }
|
|
160
|
+
];
|
|
161
|
+
const identifier = Buffer$1.from([32, 139, 112, 171, 0, 2, 225, 155]);
|
|
162
|
+
const buffer = Buffer$1.alloc(1e3);
|
|
163
|
+
const len = layout.encode(
|
|
164
|
+
{
|
|
165
|
+
version: args.version,
|
|
166
|
+
root: args.root,
|
|
167
|
+
maxTotalClaim: args.maxTotalClaim,
|
|
168
|
+
maxNumNodes: args.maxNumNodes,
|
|
169
|
+
unlockPeriod: args.unlockPeriod,
|
|
170
|
+
startVestingTs: args.startVestingTs,
|
|
171
|
+
endVestingTs: args.endVestingTs,
|
|
172
|
+
clawbackStartTs: args.clawbackStartTs,
|
|
173
|
+
claimsClosableByAdmin: args.claimsClosableByAdmin,
|
|
174
|
+
canUpdateDuration: null,
|
|
175
|
+
totalAmountUnlocked: null,
|
|
176
|
+
totalAmountLocked: null,
|
|
177
|
+
claimsClosableByClaimant: args.claimsClosableByClaimant ?? null,
|
|
178
|
+
claimsLimit: args.claimsLimit ?? null
|
|
179
|
+
},
|
|
180
|
+
buffer
|
|
181
|
+
);
|
|
182
|
+
const data = Buffer$1.concat([identifier, buffer]).slice(0, 8 + len);
|
|
183
|
+
const ix = new TransactionInstruction({ keys, programId, data });
|
|
184
|
+
return ix;
|
|
185
|
+
}
|
|
186
|
+
var layout2 = borsh8.struct([
|
|
187
|
+
borsh8.u64("amountUnlocked"),
|
|
188
|
+
borsh8.u64("amountLocked"),
|
|
189
|
+
borsh8.vec(borsh8.array(borsh8.u8(), 32), "proof")
|
|
190
|
+
]);
|
|
191
|
+
function newClaim(args, accounts, programId = PROGRAM_ID) {
|
|
192
|
+
const keys = [
|
|
193
|
+
{ pubkey: accounts.distributor, isSigner: false, isWritable: true },
|
|
194
|
+
{ pubkey: accounts.claimStatus, isSigner: false, isWritable: true },
|
|
195
|
+
{ pubkey: accounts.from, isSigner: false, isWritable: true },
|
|
196
|
+
{ pubkey: accounts.to, isSigner: false, isWritable: true },
|
|
197
|
+
{ pubkey: accounts.claimant, isSigner: true, isWritable: true },
|
|
198
|
+
{ pubkey: accounts.mint, isSigner: false, isWritable: false },
|
|
199
|
+
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
|
|
200
|
+
{ pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
|
|
201
|
+
{ pubkey: accounts.eventAuthority, isSigner: false, isWritable: false },
|
|
202
|
+
{ pubkey: accounts.program, isSigner: false, isWritable: false }
|
|
203
|
+
];
|
|
204
|
+
const identifier = Buffer.from([78, 177, 98, 123, 210, 21, 187, 83]);
|
|
205
|
+
const buffer = Buffer.alloc(1e3);
|
|
206
|
+
const len = layout2.encode(
|
|
207
|
+
{
|
|
208
|
+
amountUnlocked: args.amountUnlocked,
|
|
209
|
+
amountLocked: args.amountLocked,
|
|
210
|
+
proof: args.proof
|
|
211
|
+
},
|
|
212
|
+
buffer
|
|
213
|
+
);
|
|
214
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len);
|
|
215
|
+
const ix = new TransactionInstruction({ keys, programId, data });
|
|
216
|
+
return ix;
|
|
217
|
+
}
|
|
218
|
+
function claimLocked(accounts, programId = PROGRAM_ID) {
|
|
219
|
+
const keys = [
|
|
220
|
+
{ pubkey: accounts.distributor, isSigner: false, isWritable: true },
|
|
221
|
+
{ pubkey: accounts.claimStatus, isSigner: false, isWritable: true },
|
|
222
|
+
{ pubkey: accounts.from, isSigner: false, isWritable: true },
|
|
223
|
+
{ pubkey: accounts.to, isSigner: false, isWritable: true },
|
|
224
|
+
{ pubkey: accounts.claimant, isSigner: true, isWritable: true },
|
|
225
|
+
{ pubkey: accounts.mint, isSigner: false, isWritable: false },
|
|
226
|
+
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
|
|
227
|
+
{ pubkey: accounts.eventAuthority, isSigner: false, isWritable: false },
|
|
228
|
+
{ pubkey: accounts.program, isSigner: false, isWritable: false }
|
|
229
|
+
];
|
|
230
|
+
const identifier = Buffer.from([34, 206, 181, 23, 11, 207, 147, 90]);
|
|
231
|
+
const data = identifier;
|
|
232
|
+
const ix = new TransactionInstruction({ keys, programId, data });
|
|
233
|
+
return ix;
|
|
234
|
+
}
|
|
235
|
+
function clawback(accounts, programId = PROGRAM_ID) {
|
|
236
|
+
const keys = [
|
|
237
|
+
{ pubkey: accounts.distributor, isSigner: false, isWritable: true },
|
|
238
|
+
{ pubkey: accounts.from, isSigner: false, isWritable: true },
|
|
239
|
+
{ pubkey: accounts.to, isSigner: false, isWritable: true },
|
|
240
|
+
{ pubkey: accounts.admin, isSigner: true, isWritable: true },
|
|
241
|
+
{ pubkey: accounts.mint, isSigner: false, isWritable: false },
|
|
242
|
+
{ pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
|
|
243
|
+
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false }
|
|
244
|
+
];
|
|
245
|
+
const identifier = Buffer$1.from([111, 92, 142, 79, 33, 234, 82, 27]);
|
|
246
|
+
const data = identifier;
|
|
247
|
+
const ix = new TransactionInstruction({ keys, programId, data });
|
|
248
|
+
return ix;
|
|
249
|
+
}
|
|
250
|
+
var layout3 = borsh8.struct([
|
|
251
|
+
borsh8.option(borsh8.u64(), "amountUnlocked"),
|
|
252
|
+
borsh8.option(borsh8.u64(), "amountLocked"),
|
|
253
|
+
borsh8.option(borsh8.vec(borsh8.array(borsh8.u8(), 32)), "proof")
|
|
254
|
+
]);
|
|
255
|
+
function closeClaim(args, accounts, programId = PROGRAM_ID) {
|
|
256
|
+
const keys = [
|
|
257
|
+
{ pubkey: accounts.distributor, isSigner: false, isWritable: true },
|
|
258
|
+
{ pubkey: accounts.adminOrClaimant, isSigner: true, isWritable: true },
|
|
259
|
+
{ pubkey: accounts.claimant, isSigner: false, isWritable: false },
|
|
260
|
+
{ pubkey: accounts.claimStatus, isSigner: false, isWritable: true },
|
|
261
|
+
{ pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
|
|
262
|
+
{ pubkey: accounts.eventAuthority, isSigner: false, isWritable: false },
|
|
263
|
+
{ pubkey: accounts.program, isSigner: false, isWritable: false }
|
|
264
|
+
];
|
|
265
|
+
const identifier = Buffer$1.from([42, 177, 165, 35, 213, 179, 211, 19]);
|
|
266
|
+
const buffer = Buffer$1.alloc(1e3);
|
|
267
|
+
const len = layout3.encode(
|
|
268
|
+
{
|
|
269
|
+
amountUnlocked: args.amountUnlocked ?? null,
|
|
270
|
+
amountLocked: args.amountLocked ?? null,
|
|
271
|
+
proof: args.proof ?? null
|
|
272
|
+
},
|
|
273
|
+
buffer
|
|
274
|
+
);
|
|
275
|
+
const data = Buffer$1.concat([identifier, buffer]).slice(0, 8 + len);
|
|
276
|
+
const ix = new TransactionInstruction({ keys, programId, data });
|
|
277
|
+
return ix;
|
|
278
|
+
}
|
|
279
|
+
function setClawbackReceiver(accounts, programId = PROGRAM_ID) {
|
|
280
|
+
const keys = [
|
|
281
|
+
{ pubkey: accounts.distributor, isSigner: false, isWritable: true },
|
|
282
|
+
{ pubkey: accounts.newClawbackAccount, isSigner: false, isWritable: false },
|
|
283
|
+
{ pubkey: accounts.admin, isSigner: true, isWritable: true }
|
|
284
|
+
];
|
|
285
|
+
const identifier = Buffer$1.from([153, 217, 34, 20, 19, 29, 229, 75]);
|
|
286
|
+
const data = identifier;
|
|
287
|
+
const ix = new TransactionInstruction({ keys, programId, data });
|
|
288
|
+
return ix;
|
|
289
|
+
}
|
|
290
|
+
function setAdmin(accounts, programId = PROGRAM_ID) {
|
|
291
|
+
const keys = [
|
|
292
|
+
{ pubkey: accounts.distributor, isSigner: false, isWritable: true },
|
|
293
|
+
{ pubkey: accounts.admin, isSigner: true, isWritable: true },
|
|
294
|
+
{ pubkey: accounts.newAdmin, isSigner: false, isWritable: true }
|
|
295
|
+
];
|
|
296
|
+
const identifier = Buffer$1.from([251, 163, 0, 52, 91, 194, 187, 92]);
|
|
297
|
+
const data = identifier;
|
|
298
|
+
const ix = new TransactionInstruction({ keys, programId, data });
|
|
299
|
+
return ix;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// solana/constants.ts
|
|
303
|
+
var constants_exports = {};
|
|
304
|
+
__export(constants_exports, {
|
|
305
|
+
AIRDROP_CLAIM_FEE: () => AIRDROP_CLAIM_FEE,
|
|
306
|
+
ALIGNED_DISTRIBUTOR_PREFIX: () => ALIGNED_DISTRIBUTOR_PREFIX,
|
|
307
|
+
ALIGNED_DISTRIBUTOR_PROGRAM_ID: () => ALIGNED_DISTRIBUTOR_PROGRAM_ID,
|
|
308
|
+
ALIGNED_PRECISION_FACTOR_POW: () => ALIGNED_PRECISION_FACTOR_POW,
|
|
309
|
+
ANCHOR_DISCRIMINATOR_OFFSET: () => ANCHOR_DISCRIMINATOR_OFFSET,
|
|
310
|
+
CLAIM_STATUS_PREFIX: () => CLAIM_STATUS_PREFIX,
|
|
311
|
+
DISTRIBUTOR_ADMIN_OFFSET: () => DISTRIBUTOR_ADMIN_OFFSET,
|
|
312
|
+
DISTRIBUTOR_MINT_OFFSET: () => DISTRIBUTOR_MINT_OFFSET,
|
|
313
|
+
DISTRIBUTOR_PREFIX: () => DISTRIBUTOR_PREFIX,
|
|
314
|
+
DISTRIBUTOR_PROGRAM_ID: () => DISTRIBUTOR_PROGRAM_ID,
|
|
315
|
+
ONE_IN_BASIS_POINTS: () => ONE_IN_BASIS_POINTS,
|
|
316
|
+
STREAMFLOW_TREASURY_PUBLIC_KEY: () => STREAMFLOW_TREASURY_PUBLIC_KEY,
|
|
317
|
+
TEST_ORACLE_PREFIX: () => TEST_ORACLE_PREFIX
|
|
318
|
+
});
|
|
319
|
+
var ANCHOR_DISCRIMINATOR_OFFSET = 8;
|
|
320
|
+
var DISTRIBUTOR_MINT_OFFSET = ANCHOR_DISCRIMINATOR_OFFSET + 41;
|
|
321
|
+
var DISTRIBUTOR_ADMIN_OFFSET = ANCHOR_DISCRIMINATOR_OFFSET + 201;
|
|
322
|
+
var DISTRIBUTOR_PREFIX = Buffer.from("MerkleDistributor", "utf-8");
|
|
323
|
+
var ALIGNED_DISTRIBUTOR_PREFIX = Buffer.from("aligned-distributor", "utf-8");
|
|
324
|
+
var TEST_ORACLE_PREFIX = Buffer.from("test-oracle", "utf-8");
|
|
325
|
+
var CLAIM_STATUS_PREFIX = Buffer.from("ClaimStatus", "utf-8");
|
|
326
|
+
var ALIGNED_PRECISION_FACTOR_POW = 9;
|
|
327
|
+
var AIRDROP_CLAIM_FEE = BigInt(52e5);
|
|
328
|
+
var STREAMFLOW_TREASURY_PUBLIC_KEY = new PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
|
|
329
|
+
var ONE_IN_BASIS_POINTS = BigInt(1e4);
|
|
330
|
+
var ALIGNED_DISTRIBUTOR_PROGRAM_ID = {
|
|
331
|
+
[ICluster.Devnet]: "aMERKpFAWoChCi5oZwPvgsSCoGpZKBiU7fi76bdZjt2",
|
|
332
|
+
[ICluster.Mainnet]: "aMERKpFAWoChCi5oZwPvgsSCoGpZKBiU7fi76bdZjt2",
|
|
333
|
+
[ICluster.Testnet]: "aMERKpFAWoChCi5oZwPvgsSCoGpZKBiU7fi76bdZjt2",
|
|
334
|
+
[ICluster.Local]: "aMERKpFAWoChCi5oZwPvgsSCoGpZKBiU7fi76bdZjt2"
|
|
335
|
+
};
|
|
336
|
+
var DISTRIBUTOR_PROGRAM_ID = {
|
|
337
|
+
[ICluster.Devnet]: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N",
|
|
338
|
+
[ICluster.Mainnet]: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N",
|
|
339
|
+
[ICluster.Testnet]: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N",
|
|
340
|
+
[ICluster.Local]: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N"
|
|
341
|
+
};
|
|
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
|
+
var _MerkleDistributor = class _MerkleDistributor {
|
|
444
|
+
constructor(fields) {
|
|
445
|
+
this.bump = fields.bump;
|
|
446
|
+
this.version = fields.version;
|
|
447
|
+
this.root = fields.root;
|
|
448
|
+
this.mint = fields.mint;
|
|
449
|
+
this.tokenVault = fields.tokenVault;
|
|
450
|
+
this.maxTotalClaim = fields.maxTotalClaim;
|
|
451
|
+
this.maxNumNodes = fields.maxNumNodes;
|
|
452
|
+
this.unlockPeriod = fields.unlockPeriod;
|
|
453
|
+
this.totalAmountClaimed = fields.totalAmountClaimed;
|
|
454
|
+
this.numNodesClaimed = fields.numNodesClaimed;
|
|
455
|
+
this.startTs = fields.startTs;
|
|
456
|
+
this.endTs = fields.endTs;
|
|
457
|
+
this.clawbackStartTs = fields.clawbackStartTs;
|
|
458
|
+
this.clawbackReceiver = fields.clawbackReceiver;
|
|
459
|
+
this.admin = fields.admin;
|
|
460
|
+
this.clawedBack = fields.clawedBack;
|
|
461
|
+
this.claimsClosableByAdmin = fields.claimsClosableByAdmin;
|
|
462
|
+
this.canUpdateDuration = fields.canUpdateDuration;
|
|
463
|
+
this.totalAmountUnlocked = fields.totalAmountUnlocked;
|
|
464
|
+
this.totalAmountLocked = fields.totalAmountLocked;
|
|
465
|
+
this.lastDurationUpdateTs = fields.lastDurationUpdateTs;
|
|
466
|
+
this.totalClaimablePreUpdate = fields.totalClaimablePreUpdate;
|
|
467
|
+
this.clawedBackTs = fields.clawedBackTs;
|
|
468
|
+
this.claimsClosableByClaimant = fields.claimsClosableByClaimant;
|
|
469
|
+
this.claimsLimit = fields.claimsLimit;
|
|
470
|
+
this.buffer2 = fields.buffer2;
|
|
471
|
+
this.buffer3 = fields.buffer3;
|
|
472
|
+
}
|
|
473
|
+
static async fetch(c, address, programId = PROGRAM_ID) {
|
|
474
|
+
const info = await c.getAccountInfo(address);
|
|
475
|
+
if (info === null) {
|
|
476
|
+
return null;
|
|
477
|
+
}
|
|
478
|
+
if (!info.owner.equals(programId)) {
|
|
479
|
+
throw new Error("account doesn't belong to this program");
|
|
480
|
+
}
|
|
481
|
+
return this.decode(info.data);
|
|
482
|
+
}
|
|
483
|
+
static async fetchMultiple(c, addresses, programId = PROGRAM_ID) {
|
|
484
|
+
const infos = await c.getMultipleAccountsInfo(addresses);
|
|
485
|
+
return infos.map((info) => {
|
|
486
|
+
if (info === null) {
|
|
487
|
+
return null;
|
|
488
|
+
}
|
|
489
|
+
if (!info.owner.equals(programId)) {
|
|
490
|
+
throw new Error("account doesn't belong to this program");
|
|
491
|
+
}
|
|
492
|
+
return this.decode(info.data);
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
static decode(data) {
|
|
496
|
+
if (!data.slice(0, 8).equals(_MerkleDistributor.discriminator)) {
|
|
497
|
+
throw new Error("invalid account discriminator");
|
|
498
|
+
}
|
|
499
|
+
const dec = _MerkleDistributor.layout.decode(data.slice(8));
|
|
500
|
+
return new _MerkleDistributor({
|
|
501
|
+
bump: dec.bump,
|
|
502
|
+
version: dec.version,
|
|
503
|
+
root: dec.root,
|
|
504
|
+
mint: dec.mint,
|
|
505
|
+
tokenVault: dec.tokenVault,
|
|
506
|
+
maxTotalClaim: dec.maxTotalClaim,
|
|
507
|
+
maxNumNodes: dec.maxNumNodes,
|
|
508
|
+
unlockPeriod: dec.unlockPeriod,
|
|
509
|
+
totalAmountClaimed: dec.totalAmountClaimed,
|
|
510
|
+
numNodesClaimed: dec.numNodesClaimed,
|
|
511
|
+
startTs: dec.startTs,
|
|
512
|
+
endTs: dec.endTs,
|
|
513
|
+
clawbackStartTs: dec.clawbackStartTs,
|
|
514
|
+
clawbackReceiver: dec.clawbackReceiver,
|
|
515
|
+
admin: dec.admin,
|
|
516
|
+
clawedBack: dec.clawedBack,
|
|
517
|
+
claimsClosableByAdmin: dec.claimsClosableByAdmin,
|
|
518
|
+
canUpdateDuration: dec.canUpdateDuration,
|
|
519
|
+
totalAmountUnlocked: dec.totalAmountUnlocked,
|
|
520
|
+
totalAmountLocked: dec.totalAmountLocked,
|
|
521
|
+
lastDurationUpdateTs: dec.lastDurationUpdateTs,
|
|
522
|
+
totalClaimablePreUpdate: dec.totalClaimablePreUpdate,
|
|
523
|
+
clawedBackTs: dec.clawedBackTs,
|
|
524
|
+
claimsClosableByClaimant: dec.claimsClosableByClaimant,
|
|
525
|
+
claimsLimit: dec.claimsLimit,
|
|
526
|
+
buffer2: dec.buffer2,
|
|
527
|
+
buffer3: dec.buffer3
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
toJSON() {
|
|
531
|
+
return {
|
|
532
|
+
bump: this.bump,
|
|
533
|
+
version: this.version.toString(),
|
|
534
|
+
root: this.root,
|
|
535
|
+
mint: this.mint.toString(),
|
|
536
|
+
tokenVault: this.tokenVault.toString(),
|
|
537
|
+
maxTotalClaim: this.maxTotalClaim.toString(),
|
|
538
|
+
maxNumNodes: this.maxNumNodes.toString(),
|
|
539
|
+
unlockPeriod: this.unlockPeriod.toString(),
|
|
540
|
+
totalAmountClaimed: this.totalAmountClaimed.toString(),
|
|
541
|
+
numNodesClaimed: this.numNodesClaimed.toString(),
|
|
542
|
+
startTs: this.startTs.toString(),
|
|
543
|
+
endTs: this.endTs.toString(),
|
|
544
|
+
clawbackStartTs: this.clawbackStartTs.toString(),
|
|
545
|
+
clawbackReceiver: this.clawbackReceiver.toString(),
|
|
546
|
+
admin: this.admin.toString(),
|
|
547
|
+
clawedBack: this.clawedBack,
|
|
548
|
+
claimsClosableByAdmin: this.claimsClosableByAdmin,
|
|
549
|
+
canUpdateDuration: this.canUpdateDuration,
|
|
550
|
+
totalAmountUnlocked: this.totalAmountUnlocked.toString(),
|
|
551
|
+
totalAmountLocked: this.totalAmountLocked.toString(),
|
|
552
|
+
lastDurationUpdateTs: this.lastDurationUpdateTs.toString(),
|
|
553
|
+
totalClaimablePreUpdate: this.totalClaimablePreUpdate.toString(),
|
|
554
|
+
clawedBackTs: this.clawedBackTs.toString(),
|
|
555
|
+
claimsClosableByClaimant: this.claimsClosableByClaimant,
|
|
556
|
+
claimsLimit: this.claimsLimit,
|
|
557
|
+
buffer2: this.buffer2,
|
|
558
|
+
buffer3: this.buffer3
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
static fromJSON(obj) {
|
|
562
|
+
return new _MerkleDistributor({
|
|
563
|
+
bump: obj.bump,
|
|
564
|
+
version: new BN6(obj.version),
|
|
565
|
+
root: obj.root,
|
|
566
|
+
mint: new PublicKey(obj.mint),
|
|
567
|
+
tokenVault: new PublicKey(obj.tokenVault),
|
|
568
|
+
maxTotalClaim: new BN6(obj.maxTotalClaim),
|
|
569
|
+
maxNumNodes: new BN6(obj.maxNumNodes),
|
|
570
|
+
unlockPeriod: new BN6(obj.unlockPeriod),
|
|
571
|
+
totalAmountClaimed: new BN6(obj.totalAmountClaimed),
|
|
572
|
+
numNodesClaimed: new BN6(obj.numNodesClaimed),
|
|
573
|
+
startTs: new BN6(obj.startTs),
|
|
574
|
+
endTs: new BN6(obj.endTs),
|
|
575
|
+
clawbackStartTs: new BN6(obj.clawbackStartTs),
|
|
576
|
+
clawbackReceiver: new PublicKey(obj.clawbackReceiver),
|
|
577
|
+
admin: new PublicKey(obj.admin),
|
|
578
|
+
clawedBack: obj.clawedBack,
|
|
579
|
+
claimsClosableByAdmin: obj.claimsClosableByAdmin,
|
|
580
|
+
canUpdateDuration: obj.canUpdateDuration,
|
|
581
|
+
totalAmountUnlocked: new BN6(obj.totalAmountUnlocked),
|
|
582
|
+
totalAmountLocked: new BN6(obj.totalAmountLocked),
|
|
583
|
+
lastDurationUpdateTs: new BN6(obj.lastDurationUpdateTs),
|
|
584
|
+
totalClaimablePreUpdate: new BN6(obj.totalClaimablePreUpdate),
|
|
585
|
+
clawedBackTs: new BN6(obj.clawedBackTs),
|
|
586
|
+
claimsClosableByClaimant: obj.claimsClosableByClaimant,
|
|
587
|
+
claimsLimit: obj.claimsLimit,
|
|
588
|
+
buffer2: obj.buffer2,
|
|
589
|
+
buffer3: obj.buffer3
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
_MerkleDistributor.discriminator = Buffer.from([77, 119, 139, 70, 84, 247, 12, 26]);
|
|
594
|
+
_MerkleDistributor.layout = borsh8.struct([
|
|
595
|
+
borsh8.u8("bump"),
|
|
596
|
+
borsh8.u64("version"),
|
|
597
|
+
borsh8.array(borsh8.u8(), 32, "root"),
|
|
598
|
+
borsh8.publicKey("mint"),
|
|
599
|
+
borsh8.publicKey("tokenVault"),
|
|
600
|
+
borsh8.u64("maxTotalClaim"),
|
|
601
|
+
borsh8.u64("maxNumNodes"),
|
|
602
|
+
borsh8.u64("unlockPeriod"),
|
|
603
|
+
borsh8.u64("totalAmountClaimed"),
|
|
604
|
+
borsh8.u64("numNodesClaimed"),
|
|
605
|
+
borsh8.u64("startTs"),
|
|
606
|
+
borsh8.u64("endTs"),
|
|
607
|
+
borsh8.u64("clawbackStartTs"),
|
|
608
|
+
borsh8.publicKey("clawbackReceiver"),
|
|
609
|
+
borsh8.publicKey("admin"),
|
|
610
|
+
borsh8.bool("clawedBack"),
|
|
611
|
+
borsh8.bool("claimsClosableByAdmin"),
|
|
612
|
+
borsh8.bool("canUpdateDuration"),
|
|
613
|
+
borsh8.u64("totalAmountUnlocked"),
|
|
614
|
+
borsh8.u64("totalAmountLocked"),
|
|
615
|
+
borsh8.u64("lastDurationUpdateTs"),
|
|
616
|
+
borsh8.u64("totalClaimablePreUpdate"),
|
|
617
|
+
borsh8.u64("clawedBackTs"),
|
|
618
|
+
borsh8.bool("claimsClosableByClaimant"),
|
|
619
|
+
borsh8.u16("claimsLimit"),
|
|
620
|
+
borsh8.array(borsh8.u8(), 20, "buffer2"),
|
|
621
|
+
borsh8.array(borsh8.u8(), 32, "buffer3")
|
|
622
|
+
]);
|
|
623
|
+
var MerkleDistributor = _MerkleDistributor;
|
|
624
|
+
|
|
625
|
+
// solana/generated/errors/anchor.ts
|
|
626
|
+
var InstructionMissing = class extends Error {
|
|
627
|
+
constructor(logs) {
|
|
628
|
+
super("100: 8 byte instruction identifier not provided");
|
|
629
|
+
this.logs = logs;
|
|
630
|
+
this.code = 100;
|
|
631
|
+
this.name = "InstructionMissing";
|
|
632
|
+
this.msg = "8 byte instruction identifier not provided";
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
InstructionMissing.code = 100;
|
|
636
|
+
var InstructionFallbackNotFound = class extends Error {
|
|
637
|
+
constructor(logs) {
|
|
638
|
+
super("101: Fallback functions are not supported");
|
|
639
|
+
this.logs = logs;
|
|
640
|
+
this.code = 101;
|
|
641
|
+
this.name = "InstructionFallbackNotFound";
|
|
642
|
+
this.msg = "Fallback functions are not supported";
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
InstructionFallbackNotFound.code = 101;
|
|
646
|
+
var InstructionDidNotDeserialize = class extends Error {
|
|
647
|
+
constructor(logs) {
|
|
648
|
+
super("102: The program could not deserialize the given instruction");
|
|
649
|
+
this.logs = logs;
|
|
650
|
+
this.code = 102;
|
|
651
|
+
this.name = "InstructionDidNotDeserialize";
|
|
652
|
+
this.msg = "The program could not deserialize the given instruction";
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
InstructionDidNotDeserialize.code = 102;
|
|
656
|
+
var InstructionDidNotSerialize = class extends Error {
|
|
657
|
+
constructor(logs) {
|
|
658
|
+
super("103: The program could not serialize the given instruction");
|
|
659
|
+
this.logs = logs;
|
|
660
|
+
this.code = 103;
|
|
661
|
+
this.name = "InstructionDidNotSerialize";
|
|
662
|
+
this.msg = "The program could not serialize the given instruction";
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
InstructionDidNotSerialize.code = 103;
|
|
666
|
+
var IdlInstructionStub = class extends Error {
|
|
667
|
+
constructor(logs) {
|
|
668
|
+
super("1000: The program was compiled without idl instructions");
|
|
669
|
+
this.logs = logs;
|
|
670
|
+
this.code = 1e3;
|
|
671
|
+
this.name = "IdlInstructionStub";
|
|
672
|
+
this.msg = "The program was compiled without idl instructions";
|
|
673
|
+
}
|
|
674
|
+
};
|
|
675
|
+
IdlInstructionStub.code = 1e3;
|
|
676
|
+
var IdlInstructionInvalidProgram = class extends Error {
|
|
677
|
+
constructor(logs) {
|
|
678
|
+
super("1001: The transaction was given an invalid program for the IDL instruction");
|
|
679
|
+
this.logs = logs;
|
|
680
|
+
this.code = 1001;
|
|
681
|
+
this.name = "IdlInstructionInvalidProgram";
|
|
682
|
+
this.msg = "The transaction was given an invalid program for the IDL instruction";
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
IdlInstructionInvalidProgram.code = 1001;
|
|
686
|
+
var ConstraintMut = class extends Error {
|
|
687
|
+
constructor(logs) {
|
|
688
|
+
super("2000: A mut constraint was violated");
|
|
689
|
+
this.logs = logs;
|
|
690
|
+
this.code = 2e3;
|
|
691
|
+
this.name = "ConstraintMut";
|
|
692
|
+
this.msg = "A mut constraint was violated";
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
ConstraintMut.code = 2e3;
|
|
696
|
+
var ConstraintHasOne = class extends Error {
|
|
697
|
+
constructor(logs) {
|
|
698
|
+
super("2001: A has one constraint was violated");
|
|
699
|
+
this.logs = logs;
|
|
700
|
+
this.code = 2001;
|
|
701
|
+
this.name = "ConstraintHasOne";
|
|
702
|
+
this.msg = "A has one constraint was violated";
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
ConstraintHasOne.code = 2001;
|
|
706
|
+
var ConstraintSigner = class extends Error {
|
|
707
|
+
constructor(logs) {
|
|
708
|
+
super("2002: A signer constraint was violated");
|
|
709
|
+
this.logs = logs;
|
|
710
|
+
this.code = 2002;
|
|
711
|
+
this.name = "ConstraintSigner";
|
|
712
|
+
this.msg = "A signer constraint was violated";
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
ConstraintSigner.code = 2002;
|
|
716
|
+
var ConstraintRaw = class extends Error {
|
|
717
|
+
constructor(logs) {
|
|
718
|
+
super("2003: A raw constraint was violated");
|
|
719
|
+
this.logs = logs;
|
|
720
|
+
this.code = 2003;
|
|
721
|
+
this.name = "ConstraintRaw";
|
|
722
|
+
this.msg = "A raw constraint was violated";
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
ConstraintRaw.code = 2003;
|
|
726
|
+
var ConstraintOwner = class extends Error {
|
|
727
|
+
constructor(logs) {
|
|
728
|
+
super("2004: An owner constraint was violated");
|
|
729
|
+
this.logs = logs;
|
|
730
|
+
this.code = 2004;
|
|
731
|
+
this.name = "ConstraintOwner";
|
|
732
|
+
this.msg = "An owner constraint was violated";
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
ConstraintOwner.code = 2004;
|
|
736
|
+
var ConstraintRentExempt = class extends Error {
|
|
737
|
+
constructor(logs) {
|
|
738
|
+
super("2005: A rent exemption constraint was violated");
|
|
739
|
+
this.logs = logs;
|
|
740
|
+
this.code = 2005;
|
|
741
|
+
this.name = "ConstraintRentExempt";
|
|
742
|
+
this.msg = "A rent exemption constraint was violated";
|
|
743
|
+
}
|
|
744
|
+
};
|
|
745
|
+
ConstraintRentExempt.code = 2005;
|
|
746
|
+
var ConstraintSeeds = class extends Error {
|
|
747
|
+
constructor(logs) {
|
|
748
|
+
super("2006: A seeds constraint was violated");
|
|
749
|
+
this.logs = logs;
|
|
750
|
+
this.code = 2006;
|
|
751
|
+
this.name = "ConstraintSeeds";
|
|
752
|
+
this.msg = "A seeds constraint was violated";
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
ConstraintSeeds.code = 2006;
|
|
756
|
+
var ConstraintExecutable = class extends Error {
|
|
757
|
+
constructor(logs) {
|
|
758
|
+
super("2007: An executable constraint was violated");
|
|
759
|
+
this.logs = logs;
|
|
760
|
+
this.code = 2007;
|
|
761
|
+
this.name = "ConstraintExecutable";
|
|
762
|
+
this.msg = "An executable constraint was violated";
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
ConstraintExecutable.code = 2007;
|
|
766
|
+
var ConstraintState = class extends Error {
|
|
767
|
+
constructor(logs) {
|
|
768
|
+
super("2008: Deprecated Error, feel free to replace with something else");
|
|
769
|
+
this.logs = logs;
|
|
770
|
+
this.code = 2008;
|
|
771
|
+
this.name = "ConstraintState";
|
|
772
|
+
this.msg = "Deprecated Error, feel free to replace with something else";
|
|
773
|
+
}
|
|
774
|
+
};
|
|
775
|
+
ConstraintState.code = 2008;
|
|
776
|
+
var ConstraintAssociated = class extends Error {
|
|
777
|
+
constructor(logs) {
|
|
778
|
+
super("2009: An associated constraint was violated");
|
|
779
|
+
this.logs = logs;
|
|
780
|
+
this.code = 2009;
|
|
781
|
+
this.name = "ConstraintAssociated";
|
|
782
|
+
this.msg = "An associated constraint was violated";
|
|
783
|
+
}
|
|
784
|
+
};
|
|
785
|
+
ConstraintAssociated.code = 2009;
|
|
786
|
+
var ConstraintAssociatedInit = class extends Error {
|
|
787
|
+
constructor(logs) {
|
|
788
|
+
super("2010: An associated init constraint was violated");
|
|
789
|
+
this.logs = logs;
|
|
790
|
+
this.code = 2010;
|
|
791
|
+
this.name = "ConstraintAssociatedInit";
|
|
792
|
+
this.msg = "An associated init constraint was violated";
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
ConstraintAssociatedInit.code = 2010;
|
|
796
|
+
var ConstraintClose = class extends Error {
|
|
797
|
+
constructor(logs) {
|
|
798
|
+
super("2011: A close constraint was violated");
|
|
799
|
+
this.logs = logs;
|
|
800
|
+
this.code = 2011;
|
|
801
|
+
this.name = "ConstraintClose";
|
|
802
|
+
this.msg = "A close constraint was violated";
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
ConstraintClose.code = 2011;
|
|
806
|
+
var ConstraintAddress = class extends Error {
|
|
807
|
+
constructor(logs) {
|
|
808
|
+
super("2012: An address constraint was violated");
|
|
809
|
+
this.logs = logs;
|
|
810
|
+
this.code = 2012;
|
|
811
|
+
this.name = "ConstraintAddress";
|
|
812
|
+
this.msg = "An address constraint was violated";
|
|
813
|
+
}
|
|
814
|
+
};
|
|
815
|
+
ConstraintAddress.code = 2012;
|
|
816
|
+
var ConstraintZero = class extends Error {
|
|
817
|
+
constructor(logs) {
|
|
818
|
+
super("2013: Expected zero account discriminant");
|
|
819
|
+
this.logs = logs;
|
|
820
|
+
this.code = 2013;
|
|
821
|
+
this.name = "ConstraintZero";
|
|
822
|
+
this.msg = "Expected zero account discriminant";
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
ConstraintZero.code = 2013;
|
|
826
|
+
var ConstraintTokenMint = class extends Error {
|
|
827
|
+
constructor(logs) {
|
|
828
|
+
super("2014: A token mint constraint was violated");
|
|
829
|
+
this.logs = logs;
|
|
830
|
+
this.code = 2014;
|
|
831
|
+
this.name = "ConstraintTokenMint";
|
|
832
|
+
this.msg = "A token mint constraint was violated";
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
ConstraintTokenMint.code = 2014;
|
|
836
|
+
var ConstraintTokenOwner = class extends Error {
|
|
837
|
+
constructor(logs) {
|
|
838
|
+
super("2015: A token owner constraint was violated");
|
|
839
|
+
this.logs = logs;
|
|
840
|
+
this.code = 2015;
|
|
841
|
+
this.name = "ConstraintTokenOwner";
|
|
842
|
+
this.msg = "A token owner constraint was violated";
|
|
843
|
+
}
|
|
844
|
+
};
|
|
845
|
+
ConstraintTokenOwner.code = 2015;
|
|
846
|
+
var ConstraintMintMintAuthority = class extends Error {
|
|
847
|
+
constructor(logs) {
|
|
848
|
+
super("2016: A mint mint authority constraint was violated");
|
|
849
|
+
this.logs = logs;
|
|
850
|
+
this.code = 2016;
|
|
851
|
+
this.name = "ConstraintMintMintAuthority";
|
|
852
|
+
this.msg = "A mint mint authority constraint was violated";
|
|
853
|
+
}
|
|
854
|
+
};
|
|
855
|
+
ConstraintMintMintAuthority.code = 2016;
|
|
856
|
+
var ConstraintMintFreezeAuthority = class extends Error {
|
|
857
|
+
constructor(logs) {
|
|
858
|
+
super("2017: A mint freeze authority constraint was violated");
|
|
859
|
+
this.logs = logs;
|
|
860
|
+
this.code = 2017;
|
|
861
|
+
this.name = "ConstraintMintFreezeAuthority";
|
|
862
|
+
this.msg = "A mint freeze authority constraint was violated";
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
ConstraintMintFreezeAuthority.code = 2017;
|
|
866
|
+
var ConstraintMintDecimals = class extends Error {
|
|
867
|
+
constructor(logs) {
|
|
868
|
+
super("2018: A mint decimals constraint was violated");
|
|
869
|
+
this.logs = logs;
|
|
870
|
+
this.code = 2018;
|
|
871
|
+
this.name = "ConstraintMintDecimals";
|
|
872
|
+
this.msg = "A mint decimals constraint was violated";
|
|
873
|
+
}
|
|
874
|
+
};
|
|
875
|
+
ConstraintMintDecimals.code = 2018;
|
|
876
|
+
var ConstraintSpace = class extends Error {
|
|
877
|
+
constructor(logs) {
|
|
878
|
+
super("2019: A space constraint was violated");
|
|
879
|
+
this.logs = logs;
|
|
880
|
+
this.code = 2019;
|
|
881
|
+
this.name = "ConstraintSpace";
|
|
882
|
+
this.msg = "A space constraint was violated";
|
|
883
|
+
}
|
|
884
|
+
};
|
|
885
|
+
ConstraintSpace.code = 2019;
|
|
886
|
+
var ConstraintAccountIsNone = class extends Error {
|
|
887
|
+
constructor(logs) {
|
|
888
|
+
super("2020: A required account for the constraint is None");
|
|
889
|
+
this.logs = logs;
|
|
890
|
+
this.code = 2020;
|
|
891
|
+
this.name = "ConstraintAccountIsNone";
|
|
892
|
+
this.msg = "A required account for the constraint is None";
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
ConstraintAccountIsNone.code = 2020;
|
|
896
|
+
var RequireViolated = class extends Error {
|
|
897
|
+
constructor(logs) {
|
|
898
|
+
super("2500: A require expression was violated");
|
|
899
|
+
this.logs = logs;
|
|
900
|
+
this.code = 2500;
|
|
901
|
+
this.name = "RequireViolated";
|
|
902
|
+
this.msg = "A require expression was violated";
|
|
903
|
+
}
|
|
904
|
+
};
|
|
905
|
+
RequireViolated.code = 2500;
|
|
906
|
+
var RequireEqViolated = class extends Error {
|
|
907
|
+
constructor(logs) {
|
|
908
|
+
super("2501: A require_eq expression was violated");
|
|
909
|
+
this.logs = logs;
|
|
910
|
+
this.code = 2501;
|
|
911
|
+
this.name = "RequireEqViolated";
|
|
912
|
+
this.msg = "A require_eq expression was violated";
|
|
913
|
+
}
|
|
914
|
+
};
|
|
915
|
+
RequireEqViolated.code = 2501;
|
|
916
|
+
var RequireKeysEqViolated = class extends Error {
|
|
917
|
+
constructor(logs) {
|
|
918
|
+
super("2502: A require_keys_eq expression was violated");
|
|
919
|
+
this.logs = logs;
|
|
920
|
+
this.code = 2502;
|
|
921
|
+
this.name = "RequireKeysEqViolated";
|
|
922
|
+
this.msg = "A require_keys_eq expression was violated";
|
|
923
|
+
}
|
|
924
|
+
};
|
|
925
|
+
RequireKeysEqViolated.code = 2502;
|
|
926
|
+
var RequireNeqViolated = class extends Error {
|
|
927
|
+
constructor(logs) {
|
|
928
|
+
super("2503: A require_neq expression was violated");
|
|
929
|
+
this.logs = logs;
|
|
930
|
+
this.code = 2503;
|
|
931
|
+
this.name = "RequireNeqViolated";
|
|
932
|
+
this.msg = "A require_neq expression was violated";
|
|
933
|
+
}
|
|
934
|
+
};
|
|
935
|
+
RequireNeqViolated.code = 2503;
|
|
936
|
+
var RequireKeysNeqViolated = class extends Error {
|
|
937
|
+
constructor(logs) {
|
|
938
|
+
super("2504: A require_keys_neq expression was violated");
|
|
939
|
+
this.logs = logs;
|
|
940
|
+
this.code = 2504;
|
|
941
|
+
this.name = "RequireKeysNeqViolated";
|
|
942
|
+
this.msg = "A require_keys_neq expression was violated";
|
|
943
|
+
}
|
|
944
|
+
};
|
|
945
|
+
RequireKeysNeqViolated.code = 2504;
|
|
946
|
+
var RequireGtViolated = class extends Error {
|
|
947
|
+
constructor(logs) {
|
|
948
|
+
super("2505: A require_gt expression was violated");
|
|
949
|
+
this.logs = logs;
|
|
950
|
+
this.code = 2505;
|
|
951
|
+
this.name = "RequireGtViolated";
|
|
952
|
+
this.msg = "A require_gt expression was violated";
|
|
953
|
+
}
|
|
954
|
+
};
|
|
955
|
+
RequireGtViolated.code = 2505;
|
|
956
|
+
var RequireGteViolated = class extends Error {
|
|
957
|
+
constructor(logs) {
|
|
958
|
+
super("2506: A require_gte expression was violated");
|
|
959
|
+
this.logs = logs;
|
|
960
|
+
this.code = 2506;
|
|
961
|
+
this.name = "RequireGteViolated";
|
|
962
|
+
this.msg = "A require_gte expression was violated";
|
|
963
|
+
}
|
|
964
|
+
};
|
|
965
|
+
RequireGteViolated.code = 2506;
|
|
966
|
+
var AccountDiscriminatorAlreadySet = class extends Error {
|
|
967
|
+
constructor(logs) {
|
|
968
|
+
super("3000: The account discriminator was already set on this account");
|
|
969
|
+
this.logs = logs;
|
|
970
|
+
this.code = 3e3;
|
|
971
|
+
this.name = "AccountDiscriminatorAlreadySet";
|
|
972
|
+
this.msg = "The account discriminator was already set on this account";
|
|
973
|
+
}
|
|
974
|
+
};
|
|
975
|
+
AccountDiscriminatorAlreadySet.code = 3e3;
|
|
976
|
+
var AccountDiscriminatorNotFound = class extends Error {
|
|
977
|
+
constructor(logs) {
|
|
978
|
+
super("3001: No 8 byte discriminator was found on the account");
|
|
979
|
+
this.logs = logs;
|
|
980
|
+
this.code = 3001;
|
|
981
|
+
this.name = "AccountDiscriminatorNotFound";
|
|
982
|
+
this.msg = "No 8 byte discriminator was found on the account";
|
|
983
|
+
}
|
|
984
|
+
};
|
|
985
|
+
AccountDiscriminatorNotFound.code = 3001;
|
|
986
|
+
var AccountDiscriminatorMismatch = class extends Error {
|
|
987
|
+
constructor(logs) {
|
|
988
|
+
super("3002: 8 byte discriminator did not match what was expected");
|
|
989
|
+
this.logs = logs;
|
|
990
|
+
this.code = 3002;
|
|
991
|
+
this.name = "AccountDiscriminatorMismatch";
|
|
992
|
+
this.msg = "8 byte discriminator did not match what was expected";
|
|
993
|
+
}
|
|
994
|
+
};
|
|
995
|
+
AccountDiscriminatorMismatch.code = 3002;
|
|
996
|
+
var AccountDidNotDeserialize = class extends Error {
|
|
997
|
+
constructor(logs) {
|
|
998
|
+
super("3003: Failed to deserialize the account");
|
|
999
|
+
this.logs = logs;
|
|
1000
|
+
this.code = 3003;
|
|
1001
|
+
this.name = "AccountDidNotDeserialize";
|
|
1002
|
+
this.msg = "Failed to deserialize the account";
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
AccountDidNotDeserialize.code = 3003;
|
|
1006
|
+
var AccountDidNotSerialize = class extends Error {
|
|
1007
|
+
constructor(logs) {
|
|
1008
|
+
super("3004: Failed to serialize the account");
|
|
1009
|
+
this.logs = logs;
|
|
1010
|
+
this.code = 3004;
|
|
1011
|
+
this.name = "AccountDidNotSerialize";
|
|
1012
|
+
this.msg = "Failed to serialize the account";
|
|
1013
|
+
}
|
|
1014
|
+
};
|
|
1015
|
+
AccountDidNotSerialize.code = 3004;
|
|
1016
|
+
var AccountNotEnoughKeys = class extends Error {
|
|
1017
|
+
constructor(logs) {
|
|
1018
|
+
super("3005: Not enough account keys given to the instruction");
|
|
1019
|
+
this.logs = logs;
|
|
1020
|
+
this.code = 3005;
|
|
1021
|
+
this.name = "AccountNotEnoughKeys";
|
|
1022
|
+
this.msg = "Not enough account keys given to the instruction";
|
|
1023
|
+
}
|
|
1024
|
+
};
|
|
1025
|
+
AccountNotEnoughKeys.code = 3005;
|
|
1026
|
+
var AccountNotMutable = class extends Error {
|
|
1027
|
+
constructor(logs) {
|
|
1028
|
+
super("3006: The given account is not mutable");
|
|
1029
|
+
this.logs = logs;
|
|
1030
|
+
this.code = 3006;
|
|
1031
|
+
this.name = "AccountNotMutable";
|
|
1032
|
+
this.msg = "The given account is not mutable";
|
|
1033
|
+
}
|
|
1034
|
+
};
|
|
1035
|
+
AccountNotMutable.code = 3006;
|
|
1036
|
+
var AccountOwnedByWrongProgram = class extends Error {
|
|
1037
|
+
constructor(logs) {
|
|
1038
|
+
super("3007: The given account is owned by a different program than expected");
|
|
1039
|
+
this.logs = logs;
|
|
1040
|
+
this.code = 3007;
|
|
1041
|
+
this.name = "AccountOwnedByWrongProgram";
|
|
1042
|
+
this.msg = "The given account is owned by a different program than expected";
|
|
1043
|
+
}
|
|
1044
|
+
};
|
|
1045
|
+
AccountOwnedByWrongProgram.code = 3007;
|
|
1046
|
+
var InvalidProgramId = class extends Error {
|
|
1047
|
+
constructor(logs) {
|
|
1048
|
+
super("3008: Program ID was not as expected");
|
|
1049
|
+
this.logs = logs;
|
|
1050
|
+
this.code = 3008;
|
|
1051
|
+
this.name = "InvalidProgramId";
|
|
1052
|
+
this.msg = "Program ID was not as expected";
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
InvalidProgramId.code = 3008;
|
|
1056
|
+
var InvalidProgramExecutable = class extends Error {
|
|
1057
|
+
constructor(logs) {
|
|
1058
|
+
super("3009: Program account is not executable");
|
|
1059
|
+
this.logs = logs;
|
|
1060
|
+
this.code = 3009;
|
|
1061
|
+
this.name = "InvalidProgramExecutable";
|
|
1062
|
+
this.msg = "Program account is not executable";
|
|
1063
|
+
}
|
|
1064
|
+
};
|
|
1065
|
+
InvalidProgramExecutable.code = 3009;
|
|
1066
|
+
var AccountNotSigner = class extends Error {
|
|
1067
|
+
constructor(logs) {
|
|
1068
|
+
super("3010: The given account did not sign");
|
|
1069
|
+
this.logs = logs;
|
|
1070
|
+
this.code = 3010;
|
|
1071
|
+
this.name = "AccountNotSigner";
|
|
1072
|
+
this.msg = "The given account did not sign";
|
|
1073
|
+
}
|
|
1074
|
+
};
|
|
1075
|
+
AccountNotSigner.code = 3010;
|
|
1076
|
+
var AccountNotSystemOwned = class extends Error {
|
|
1077
|
+
constructor(logs) {
|
|
1078
|
+
super("3011: The given account is not owned by the system program");
|
|
1079
|
+
this.logs = logs;
|
|
1080
|
+
this.code = 3011;
|
|
1081
|
+
this.name = "AccountNotSystemOwned";
|
|
1082
|
+
this.msg = "The given account is not owned by the system program";
|
|
1083
|
+
}
|
|
1084
|
+
};
|
|
1085
|
+
AccountNotSystemOwned.code = 3011;
|
|
1086
|
+
var AccountNotInitialized = class extends Error {
|
|
1087
|
+
constructor(logs) {
|
|
1088
|
+
super("3012: The program expected this account to be already initialized");
|
|
1089
|
+
this.logs = logs;
|
|
1090
|
+
this.code = 3012;
|
|
1091
|
+
this.name = "AccountNotInitialized";
|
|
1092
|
+
this.msg = "The program expected this account to be already initialized";
|
|
1093
|
+
}
|
|
1094
|
+
};
|
|
1095
|
+
AccountNotInitialized.code = 3012;
|
|
1096
|
+
var AccountNotProgramData = class extends Error {
|
|
1097
|
+
constructor(logs) {
|
|
1098
|
+
super("3013: The given account is not a program data account");
|
|
1099
|
+
this.logs = logs;
|
|
1100
|
+
this.code = 3013;
|
|
1101
|
+
this.name = "AccountNotProgramData";
|
|
1102
|
+
this.msg = "The given account is not a program data account";
|
|
1103
|
+
}
|
|
1104
|
+
};
|
|
1105
|
+
AccountNotProgramData.code = 3013;
|
|
1106
|
+
var AccountNotAssociatedTokenAccount = class extends Error {
|
|
1107
|
+
constructor(logs) {
|
|
1108
|
+
super("3014: The given account is not the associated token account");
|
|
1109
|
+
this.logs = logs;
|
|
1110
|
+
this.code = 3014;
|
|
1111
|
+
this.name = "AccountNotAssociatedTokenAccount";
|
|
1112
|
+
this.msg = "The given account is not the associated token account";
|
|
1113
|
+
}
|
|
1114
|
+
};
|
|
1115
|
+
AccountNotAssociatedTokenAccount.code = 3014;
|
|
1116
|
+
var AccountSysvarMismatch = class extends Error {
|
|
1117
|
+
constructor(logs) {
|
|
1118
|
+
super("3015: The given public key does not match the required sysvar");
|
|
1119
|
+
this.logs = logs;
|
|
1120
|
+
this.code = 3015;
|
|
1121
|
+
this.name = "AccountSysvarMismatch";
|
|
1122
|
+
this.msg = "The given public key does not match the required sysvar";
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1125
|
+
AccountSysvarMismatch.code = 3015;
|
|
1126
|
+
var AccountReallocExceedsLimit = class extends Error {
|
|
1127
|
+
constructor(logs) {
|
|
1128
|
+
super("3016: The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit");
|
|
1129
|
+
this.logs = logs;
|
|
1130
|
+
this.code = 3016;
|
|
1131
|
+
this.name = "AccountReallocExceedsLimit";
|
|
1132
|
+
this.msg = "The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit";
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
AccountReallocExceedsLimit.code = 3016;
|
|
1136
|
+
var AccountDuplicateReallocs = class extends Error {
|
|
1137
|
+
constructor(logs) {
|
|
1138
|
+
super("3017: The account was duplicated for more than one reallocation");
|
|
1139
|
+
this.logs = logs;
|
|
1140
|
+
this.code = 3017;
|
|
1141
|
+
this.name = "AccountDuplicateReallocs";
|
|
1142
|
+
this.msg = "The account was duplicated for more than one reallocation";
|
|
1143
|
+
}
|
|
1144
|
+
};
|
|
1145
|
+
AccountDuplicateReallocs.code = 3017;
|
|
1146
|
+
var DeclaredProgramIdMismatch = class extends Error {
|
|
1147
|
+
constructor(logs) {
|
|
1148
|
+
super("4100: The declared program id does not match the actual program id");
|
|
1149
|
+
this.logs = logs;
|
|
1150
|
+
this.code = 4100;
|
|
1151
|
+
this.name = "DeclaredProgramIdMismatch";
|
|
1152
|
+
this.msg = "The declared program id does not match the actual program id";
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
DeclaredProgramIdMismatch.code = 4100;
|
|
1156
|
+
var Deprecated = class extends Error {
|
|
1157
|
+
constructor(logs) {
|
|
1158
|
+
super("5000: The API being used is deprecated and should no longer be used");
|
|
1159
|
+
this.logs = logs;
|
|
1160
|
+
this.code = 5e3;
|
|
1161
|
+
this.name = "Deprecated";
|
|
1162
|
+
this.msg = "The API being used is deprecated and should no longer be used";
|
|
1163
|
+
}
|
|
1164
|
+
};
|
|
1165
|
+
Deprecated.code = 5e3;
|
|
1166
|
+
function fromCode(code, logs) {
|
|
1167
|
+
switch (code) {
|
|
1168
|
+
case 100:
|
|
1169
|
+
return new InstructionMissing(logs);
|
|
1170
|
+
case 101:
|
|
1171
|
+
return new InstructionFallbackNotFound(logs);
|
|
1172
|
+
case 102:
|
|
1173
|
+
return new InstructionDidNotDeserialize(logs);
|
|
1174
|
+
case 103:
|
|
1175
|
+
return new InstructionDidNotSerialize(logs);
|
|
1176
|
+
case 1e3:
|
|
1177
|
+
return new IdlInstructionStub(logs);
|
|
1178
|
+
case 1001:
|
|
1179
|
+
return new IdlInstructionInvalidProgram(logs);
|
|
1180
|
+
case 2e3:
|
|
1181
|
+
return new ConstraintMut(logs);
|
|
1182
|
+
case 2001:
|
|
1183
|
+
return new ConstraintHasOne(logs);
|
|
1184
|
+
case 2002:
|
|
1185
|
+
return new ConstraintSigner(logs);
|
|
1186
|
+
case 2003:
|
|
1187
|
+
return new ConstraintRaw(logs);
|
|
1188
|
+
case 2004:
|
|
1189
|
+
return new ConstraintOwner(logs);
|
|
1190
|
+
case 2005:
|
|
1191
|
+
return new ConstraintRentExempt(logs);
|
|
1192
|
+
case 2006:
|
|
1193
|
+
return new ConstraintSeeds(logs);
|
|
1194
|
+
case 2007:
|
|
1195
|
+
return new ConstraintExecutable(logs);
|
|
1196
|
+
case 2008:
|
|
1197
|
+
return new ConstraintState(logs);
|
|
1198
|
+
case 2009:
|
|
1199
|
+
return new ConstraintAssociated(logs);
|
|
1200
|
+
case 2010:
|
|
1201
|
+
return new ConstraintAssociatedInit(logs);
|
|
1202
|
+
case 2011:
|
|
1203
|
+
return new ConstraintClose(logs);
|
|
1204
|
+
case 2012:
|
|
1205
|
+
return new ConstraintAddress(logs);
|
|
1206
|
+
case 2013:
|
|
1207
|
+
return new ConstraintZero(logs);
|
|
1208
|
+
case 2014:
|
|
1209
|
+
return new ConstraintTokenMint(logs);
|
|
1210
|
+
case 2015:
|
|
1211
|
+
return new ConstraintTokenOwner(logs);
|
|
1212
|
+
case 2016:
|
|
1213
|
+
return new ConstraintMintMintAuthority(logs);
|
|
1214
|
+
case 2017:
|
|
1215
|
+
return new ConstraintMintFreezeAuthority(logs);
|
|
1216
|
+
case 2018:
|
|
1217
|
+
return new ConstraintMintDecimals(logs);
|
|
1218
|
+
case 2019:
|
|
1219
|
+
return new ConstraintSpace(logs);
|
|
1220
|
+
case 2020:
|
|
1221
|
+
return new ConstraintAccountIsNone(logs);
|
|
1222
|
+
case 2500:
|
|
1223
|
+
return new RequireViolated(logs);
|
|
1224
|
+
case 2501:
|
|
1225
|
+
return new RequireEqViolated(logs);
|
|
1226
|
+
case 2502:
|
|
1227
|
+
return new RequireKeysEqViolated(logs);
|
|
1228
|
+
case 2503:
|
|
1229
|
+
return new RequireNeqViolated(logs);
|
|
1230
|
+
case 2504:
|
|
1231
|
+
return new RequireKeysNeqViolated(logs);
|
|
1232
|
+
case 2505:
|
|
1233
|
+
return new RequireGtViolated(logs);
|
|
1234
|
+
case 2506:
|
|
1235
|
+
return new RequireGteViolated(logs);
|
|
1236
|
+
case 3e3:
|
|
1237
|
+
return new AccountDiscriminatorAlreadySet(logs);
|
|
1238
|
+
case 3001:
|
|
1239
|
+
return new AccountDiscriminatorNotFound(logs);
|
|
1240
|
+
case 3002:
|
|
1241
|
+
return new AccountDiscriminatorMismatch(logs);
|
|
1242
|
+
case 3003:
|
|
1243
|
+
return new AccountDidNotDeserialize(logs);
|
|
1244
|
+
case 3004:
|
|
1245
|
+
return new AccountDidNotSerialize(logs);
|
|
1246
|
+
case 3005:
|
|
1247
|
+
return new AccountNotEnoughKeys(logs);
|
|
1248
|
+
case 3006:
|
|
1249
|
+
return new AccountNotMutable(logs);
|
|
1250
|
+
case 3007:
|
|
1251
|
+
return new AccountOwnedByWrongProgram(logs);
|
|
1252
|
+
case 3008:
|
|
1253
|
+
return new InvalidProgramId(logs);
|
|
1254
|
+
case 3009:
|
|
1255
|
+
return new InvalidProgramExecutable(logs);
|
|
1256
|
+
case 3010:
|
|
1257
|
+
return new AccountNotSigner(logs);
|
|
1258
|
+
case 3011:
|
|
1259
|
+
return new AccountNotSystemOwned(logs);
|
|
1260
|
+
case 3012:
|
|
1261
|
+
return new AccountNotInitialized(logs);
|
|
1262
|
+
case 3013:
|
|
1263
|
+
return new AccountNotProgramData(logs);
|
|
1264
|
+
case 3014:
|
|
1265
|
+
return new AccountNotAssociatedTokenAccount(logs);
|
|
1266
|
+
case 3015:
|
|
1267
|
+
return new AccountSysvarMismatch(logs);
|
|
1268
|
+
case 3016:
|
|
1269
|
+
return new AccountReallocExceedsLimit(logs);
|
|
1270
|
+
case 3017:
|
|
1271
|
+
return new AccountDuplicateReallocs(logs);
|
|
1272
|
+
case 4100:
|
|
1273
|
+
return new DeclaredProgramIdMismatch(logs);
|
|
1274
|
+
case 5e3:
|
|
1275
|
+
return new Deprecated(logs);
|
|
1276
|
+
}
|
|
1277
|
+
return null;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
// solana/generated/errors/custom.ts
|
|
1281
|
+
var InsufficientUnlockedTokens = class extends Error {
|
|
1282
|
+
constructor(logs) {
|
|
1283
|
+
super("6000: Insufficient unlocked tokens");
|
|
1284
|
+
this.logs = logs;
|
|
1285
|
+
this.code = 6e3;
|
|
1286
|
+
this.name = "InsufficientUnlockedTokens";
|
|
1287
|
+
this.msg = "Insufficient unlocked tokens";
|
|
1288
|
+
}
|
|
1289
|
+
};
|
|
1290
|
+
InsufficientUnlockedTokens.code = 6e3;
|
|
1291
|
+
var InvalidProof = class extends Error {
|
|
1292
|
+
constructor(logs) {
|
|
1293
|
+
super("6001: Invalid Merkle proof");
|
|
1294
|
+
this.logs = logs;
|
|
1295
|
+
this.code = 6001;
|
|
1296
|
+
this.name = "InvalidProof";
|
|
1297
|
+
this.msg = "Invalid Merkle proof";
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1300
|
+
InvalidProof.code = 6001;
|
|
1301
|
+
var ExceededMaxClaim = class extends Error {
|
|
1302
|
+
constructor(logs) {
|
|
1303
|
+
super("6002: Exceeded maximum claim amount");
|
|
1304
|
+
this.logs = logs;
|
|
1305
|
+
this.code = 6002;
|
|
1306
|
+
this.name = "ExceededMaxClaim";
|
|
1307
|
+
this.msg = "Exceeded maximum claim amount";
|
|
1308
|
+
}
|
|
1309
|
+
};
|
|
1310
|
+
ExceededMaxClaim.code = 6002;
|
|
1311
|
+
var MaxNodesExceeded = class extends Error {
|
|
1312
|
+
constructor(logs) {
|
|
1313
|
+
super("6003: Exceeded maximum node count");
|
|
1314
|
+
this.logs = logs;
|
|
1315
|
+
this.code = 6003;
|
|
1316
|
+
this.name = "MaxNodesExceeded";
|
|
1317
|
+
this.msg = "Exceeded maximum node count";
|
|
1318
|
+
}
|
|
1319
|
+
};
|
|
1320
|
+
MaxNodesExceeded.code = 6003;
|
|
1321
|
+
var Unauthorized = class extends Error {
|
|
1322
|
+
constructor(logs) {
|
|
1323
|
+
super("6004: Account is not authorized to execute this instruction");
|
|
1324
|
+
this.logs = logs;
|
|
1325
|
+
this.code = 6004;
|
|
1326
|
+
this.name = "Unauthorized";
|
|
1327
|
+
this.msg = "Account is not authorized to execute this instruction";
|
|
1328
|
+
}
|
|
1329
|
+
};
|
|
1330
|
+
Unauthorized.code = 6004;
|
|
1331
|
+
var OwnerMismatch = class extends Error {
|
|
1332
|
+
constructor(logs) {
|
|
1333
|
+
super("6005: Token account owner did not match intended owner");
|
|
1334
|
+
this.logs = logs;
|
|
1335
|
+
this.code = 6005;
|
|
1336
|
+
this.name = "OwnerMismatch";
|
|
1337
|
+
this.msg = "Token account owner did not match intended owner";
|
|
1338
|
+
}
|
|
1339
|
+
};
|
|
1340
|
+
OwnerMismatch.code = 6005;
|
|
1341
|
+
var ClawbackBeforeStart = class extends Error {
|
|
1342
|
+
constructor(logs) {
|
|
1343
|
+
super("6006: Attempted clawback before start");
|
|
1344
|
+
this.logs = logs;
|
|
1345
|
+
this.code = 6006;
|
|
1346
|
+
this.name = "ClawbackBeforeStart";
|
|
1347
|
+
this.msg = "Attempted clawback before start";
|
|
1348
|
+
}
|
|
1349
|
+
};
|
|
1350
|
+
ClawbackBeforeStart.code = 6006;
|
|
1351
|
+
var ClawbackAlreadyClaimed = class extends Error {
|
|
1352
|
+
constructor(logs) {
|
|
1353
|
+
super("6007: Clawback already claimed");
|
|
1354
|
+
this.logs = logs;
|
|
1355
|
+
this.code = 6007;
|
|
1356
|
+
this.name = "ClawbackAlreadyClaimed";
|
|
1357
|
+
this.msg = "Clawback already claimed";
|
|
1358
|
+
}
|
|
1359
|
+
};
|
|
1360
|
+
ClawbackAlreadyClaimed.code = 6007;
|
|
1361
|
+
var SameClawbackReceiver = class extends Error {
|
|
1362
|
+
constructor(logs) {
|
|
1363
|
+
super("6008: New and old Clawback receivers are identical");
|
|
1364
|
+
this.logs = logs;
|
|
1365
|
+
this.code = 6008;
|
|
1366
|
+
this.name = "SameClawbackReceiver";
|
|
1367
|
+
this.msg = "New and old Clawback receivers are identical";
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
1370
|
+
SameClawbackReceiver.code = 6008;
|
|
1371
|
+
var ClawbackReceiverIsTokenVault = class extends Error {
|
|
1372
|
+
constructor(logs) {
|
|
1373
|
+
super("6009: Clawback receiver can not be the Token Vault");
|
|
1374
|
+
this.logs = logs;
|
|
1375
|
+
this.code = 6009;
|
|
1376
|
+
this.name = "ClawbackReceiverIsTokenVault";
|
|
1377
|
+
this.msg = "Clawback receiver can not be the Token Vault";
|
|
1378
|
+
}
|
|
1379
|
+
};
|
|
1380
|
+
ClawbackReceiverIsTokenVault.code = 6009;
|
|
1381
|
+
var SameAdmin = class extends Error {
|
|
1382
|
+
constructor(logs) {
|
|
1383
|
+
super("6010: New and old admin are identical");
|
|
1384
|
+
this.logs = logs;
|
|
1385
|
+
this.code = 6010;
|
|
1386
|
+
this.name = "SameAdmin";
|
|
1387
|
+
this.msg = "New and old admin are identical";
|
|
1388
|
+
}
|
|
1389
|
+
};
|
|
1390
|
+
SameAdmin.code = 6010;
|
|
1391
|
+
var ClaimExpired = class extends Error {
|
|
1392
|
+
constructor(logs) {
|
|
1393
|
+
super("6011: Claim window expired");
|
|
1394
|
+
this.logs = logs;
|
|
1395
|
+
this.code = 6011;
|
|
1396
|
+
this.name = "ClaimExpired";
|
|
1397
|
+
this.msg = "Claim window expired";
|
|
1398
|
+
}
|
|
1399
|
+
};
|
|
1400
|
+
ClaimExpired.code = 6011;
|
|
1401
|
+
var ArithmeticError = class extends Error {
|
|
1402
|
+
constructor(logs) {
|
|
1403
|
+
super("6012: Arithmetic Error (overflow/underflow)");
|
|
1404
|
+
this.logs = logs;
|
|
1405
|
+
this.code = 6012;
|
|
1406
|
+
this.name = "ArithmeticError";
|
|
1407
|
+
this.msg = "Arithmetic Error (overflow/underflow)";
|
|
1408
|
+
}
|
|
1409
|
+
};
|
|
1410
|
+
ArithmeticError.code = 6012;
|
|
1411
|
+
var StartTimestampAfterEnd = class extends Error {
|
|
1412
|
+
constructor(logs) {
|
|
1413
|
+
super("6013: Start Timestamp cannot be after end Timestamp");
|
|
1414
|
+
this.logs = logs;
|
|
1415
|
+
this.code = 6013;
|
|
1416
|
+
this.name = "StartTimestampAfterEnd";
|
|
1417
|
+
this.msg = "Start Timestamp cannot be after end Timestamp";
|
|
1418
|
+
}
|
|
1419
|
+
};
|
|
1420
|
+
StartTimestampAfterEnd.code = 6013;
|
|
1421
|
+
var TimestampsNotInFuture = class extends Error {
|
|
1422
|
+
constructor(logs) {
|
|
1423
|
+
super("6014: Timestamps cannot be in the past");
|
|
1424
|
+
this.logs = logs;
|
|
1425
|
+
this.code = 6014;
|
|
1426
|
+
this.name = "TimestampsNotInFuture";
|
|
1427
|
+
this.msg = "Timestamps cannot be in the past";
|
|
1428
|
+
}
|
|
1429
|
+
};
|
|
1430
|
+
TimestampsNotInFuture.code = 6014;
|
|
1431
|
+
var InvalidMint = class extends Error {
|
|
1432
|
+
constructor(logs) {
|
|
1433
|
+
super("6015: Invalid Mint");
|
|
1434
|
+
this.logs = logs;
|
|
1435
|
+
this.code = 6015;
|
|
1436
|
+
this.name = "InvalidMint";
|
|
1437
|
+
this.msg = "Invalid Mint";
|
|
1438
|
+
}
|
|
1439
|
+
};
|
|
1440
|
+
InvalidMint.code = 6015;
|
|
1441
|
+
var ClaimIsClosed = class extends Error {
|
|
1442
|
+
constructor(logs) {
|
|
1443
|
+
super("6016: Claim is closed");
|
|
1444
|
+
this.logs = logs;
|
|
1445
|
+
this.code = 6016;
|
|
1446
|
+
this.name = "ClaimIsClosed";
|
|
1447
|
+
this.msg = "Claim is closed";
|
|
1448
|
+
}
|
|
1449
|
+
};
|
|
1450
|
+
ClaimIsClosed.code = 6016;
|
|
1451
|
+
var ClaimsAreNotClosable = class extends Error {
|
|
1452
|
+
constructor(logs) {
|
|
1453
|
+
super("6017: Claims are not closable");
|
|
1454
|
+
this.logs = logs;
|
|
1455
|
+
this.code = 6017;
|
|
1456
|
+
this.name = "ClaimsAreNotClosable";
|
|
1457
|
+
this.msg = "Claims are not closable";
|
|
1458
|
+
}
|
|
1459
|
+
};
|
|
1460
|
+
ClaimsAreNotClosable.code = 6017;
|
|
1461
|
+
var InvalidUnlockPeriod = class extends Error {
|
|
1462
|
+
constructor(logs) {
|
|
1463
|
+
super("6018: Invalid unlock period");
|
|
1464
|
+
this.logs = logs;
|
|
1465
|
+
this.code = 6018;
|
|
1466
|
+
this.name = "InvalidUnlockPeriod";
|
|
1467
|
+
this.msg = "Invalid unlock period";
|
|
1468
|
+
}
|
|
1469
|
+
};
|
|
1470
|
+
InvalidUnlockPeriod.code = 6018;
|
|
1471
|
+
var DurationUpdateNotAllowed = class extends Error {
|
|
1472
|
+
constructor(logs) {
|
|
1473
|
+
super("6019: Duration update is not allowed");
|
|
1474
|
+
this.logs = logs;
|
|
1475
|
+
this.code = 6019;
|
|
1476
|
+
this.name = "DurationUpdateNotAllowed";
|
|
1477
|
+
this.msg = "Duration update is not allowed";
|
|
1478
|
+
}
|
|
1479
|
+
};
|
|
1480
|
+
DurationUpdateNotAllowed.code = 6019;
|
|
1481
|
+
var NoVestingAmount = class extends Error {
|
|
1482
|
+
constructor(logs) {
|
|
1483
|
+
super("6020: Vesting amounts are not set");
|
|
1484
|
+
this.logs = logs;
|
|
1485
|
+
this.code = 6020;
|
|
1486
|
+
this.name = "NoVestingAmount";
|
|
1487
|
+
this.msg = "Vesting amounts are not set";
|
|
1488
|
+
}
|
|
1489
|
+
};
|
|
1490
|
+
NoVestingAmount.code = 6020;
|
|
1491
|
+
var VestingAlreadyFinished = class extends Error {
|
|
1492
|
+
constructor(logs) {
|
|
1493
|
+
super("6021: Vesting already finished");
|
|
1494
|
+
this.logs = logs;
|
|
1495
|
+
this.code = 6021;
|
|
1496
|
+
this.name = "VestingAlreadyFinished";
|
|
1497
|
+
this.msg = "Vesting already finished";
|
|
1498
|
+
}
|
|
1499
|
+
};
|
|
1500
|
+
VestingAlreadyFinished.code = 6021;
|
|
1501
|
+
var InvalidAmounts = class extends Error {
|
|
1502
|
+
constructor(logs) {
|
|
1503
|
+
super("6022: Provided amounts are invalid");
|
|
1504
|
+
this.logs = logs;
|
|
1505
|
+
this.code = 6022;
|
|
1506
|
+
this.name = "InvalidAmounts";
|
|
1507
|
+
this.msg = "Provided amounts are invalid";
|
|
1508
|
+
}
|
|
1509
|
+
};
|
|
1510
|
+
InvalidAmounts.code = 6022;
|
|
1511
|
+
var ClaimsLimitReached = class extends Error {
|
|
1512
|
+
constructor(logs) {
|
|
1513
|
+
super("6023: Claims limit has been reached");
|
|
1514
|
+
this.logs = logs;
|
|
1515
|
+
this.code = 6023;
|
|
1516
|
+
this.name = "ClaimsLimitReached";
|
|
1517
|
+
this.msg = "Claims limit has been reached";
|
|
1518
|
+
}
|
|
1519
|
+
};
|
|
1520
|
+
ClaimsLimitReached.code = 6023;
|
|
1521
|
+
function fromCode2(code, logs) {
|
|
1522
|
+
switch (code) {
|
|
1523
|
+
case 6e3:
|
|
1524
|
+
return new InsufficientUnlockedTokens(logs);
|
|
1525
|
+
case 6001:
|
|
1526
|
+
return new InvalidProof(logs);
|
|
1527
|
+
case 6002:
|
|
1528
|
+
return new ExceededMaxClaim(logs);
|
|
1529
|
+
case 6003:
|
|
1530
|
+
return new MaxNodesExceeded(logs);
|
|
1531
|
+
case 6004:
|
|
1532
|
+
return new Unauthorized(logs);
|
|
1533
|
+
case 6005:
|
|
1534
|
+
return new OwnerMismatch(logs);
|
|
1535
|
+
case 6006:
|
|
1536
|
+
return new ClawbackBeforeStart(logs);
|
|
1537
|
+
case 6007:
|
|
1538
|
+
return new ClawbackAlreadyClaimed(logs);
|
|
1539
|
+
case 6008:
|
|
1540
|
+
return new SameClawbackReceiver(logs);
|
|
1541
|
+
case 6009:
|
|
1542
|
+
return new ClawbackReceiverIsTokenVault(logs);
|
|
1543
|
+
case 6010:
|
|
1544
|
+
return new SameAdmin(logs);
|
|
1545
|
+
case 6011:
|
|
1546
|
+
return new ClaimExpired(logs);
|
|
1547
|
+
case 6012:
|
|
1548
|
+
return new ArithmeticError(logs);
|
|
1549
|
+
case 6013:
|
|
1550
|
+
return new StartTimestampAfterEnd(logs);
|
|
1551
|
+
case 6014:
|
|
1552
|
+
return new TimestampsNotInFuture(logs);
|
|
1553
|
+
case 6015:
|
|
1554
|
+
return new InvalidMint(logs);
|
|
1555
|
+
case 6016:
|
|
1556
|
+
return new ClaimIsClosed(logs);
|
|
1557
|
+
case 6017:
|
|
1558
|
+
return new ClaimsAreNotClosable(logs);
|
|
1559
|
+
case 6018:
|
|
1560
|
+
return new InvalidUnlockPeriod(logs);
|
|
1561
|
+
case 6019:
|
|
1562
|
+
return new DurationUpdateNotAllowed(logs);
|
|
1563
|
+
case 6020:
|
|
1564
|
+
return new NoVestingAmount(logs);
|
|
1565
|
+
case 6021:
|
|
1566
|
+
return new VestingAlreadyFinished(logs);
|
|
1567
|
+
case 6022:
|
|
1568
|
+
return new InvalidAmounts(logs);
|
|
1569
|
+
case 6023:
|
|
1570
|
+
return new ClaimsLimitReached(logs);
|
|
1571
|
+
}
|
|
1572
|
+
return null;
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
// solana/generated/errors/index.ts
|
|
1576
|
+
function fromCode3(code, logs) {
|
|
1577
|
+
return code >= 6e3 ? fromCode2(code, logs) : fromCode(code, logs);
|
|
1578
|
+
}
|
|
1579
|
+
function hasOwnProperty(obj, prop) {
|
|
1580
|
+
return Object.hasOwnProperty.call(obj, prop);
|
|
1581
|
+
}
|
|
1582
|
+
var errorRe = /Program (\w+) failed: custom program error: (\w+)/;
|
|
1583
|
+
function fromTxError(err, programId = PROGRAM_ID) {
|
|
1584
|
+
if (typeof err !== "object" || err === null || !hasOwnProperty(err, "logs") || !Array.isArray(err.logs)) {
|
|
1585
|
+
return null;
|
|
1586
|
+
}
|
|
1587
|
+
let firstMatch = null;
|
|
1588
|
+
for (const logLine of err.logs) {
|
|
1589
|
+
firstMatch = errorRe.exec(logLine);
|
|
1590
|
+
if (firstMatch !== null) {
|
|
1591
|
+
break;
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
if (firstMatch === null) {
|
|
1595
|
+
return null;
|
|
1596
|
+
}
|
|
1597
|
+
const [programIdRaw, codeRaw] = firstMatch.slice(1);
|
|
1598
|
+
if (programIdRaw !== programId.toString()) {
|
|
1599
|
+
return null;
|
|
1600
|
+
}
|
|
1601
|
+
let errorCode;
|
|
1602
|
+
try {
|
|
1603
|
+
errorCode = parseInt(codeRaw, 16);
|
|
1604
|
+
} catch (parseErr) {
|
|
1605
|
+
return null;
|
|
1606
|
+
}
|
|
1607
|
+
return fromCode3(errorCode, err.logs);
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
// solana/utils.ts
|
|
1611
|
+
var getAlignedDistributorPda = (programId, distributor) => {
|
|
1612
|
+
return PublicKey.findProgramAddressSync([ALIGNED_DISTRIBUTOR_PREFIX, distributor.toBuffer()], programId)[0];
|
|
1613
|
+
};
|
|
1614
|
+
var getTestOraclePda = (programId, mint, creator) => {
|
|
1615
|
+
return PublicKey.findProgramAddressSync([TEST_ORACLE_PREFIX, mint.toBuffer(), creator.toBuffer()], programId)[0];
|
|
1616
|
+
};
|
|
1617
|
+
function getDistributorPda(programId, mint, version) {
|
|
1618
|
+
const seeds = [
|
|
1619
|
+
DISTRIBUTOR_PREFIX,
|
|
1620
|
+
mint.toBuffer(),
|
|
1621
|
+
Buffer$1.from(new Uint8Array(new BigUint64Array([BigInt(version)]).buffer))
|
|
1622
|
+
];
|
|
1623
|
+
return PublicKey.findProgramAddressSync(seeds, programId)[0];
|
|
1624
|
+
}
|
|
1625
|
+
function getClaimantStatusPda(programId, distributor, claimant) {
|
|
1626
|
+
const seeds = [CLAIM_STATUS_PREFIX, claimant.toBuffer(), distributor.toBuffer()];
|
|
1627
|
+
return PublicKey.findProgramAddressSync(seeds, programId)[0];
|
|
1628
|
+
}
|
|
1629
|
+
function getEventAuthorityPda(programId) {
|
|
1630
|
+
const seeds = [Buffer$1.from("__event_authority")];
|
|
1631
|
+
return PublicKey.findProgramAddressSync(seeds, programId)[0];
|
|
1632
|
+
}
|
|
1633
|
+
async function wrappedSignAndExecuteTransaction(connection, invoker, tx, confirmationParams, throttleParams) {
|
|
1634
|
+
try {
|
|
1635
|
+
return await signAndExecuteTransaction(connection, invoker, tx, confirmationParams, throttleParams);
|
|
1636
|
+
} catch (err) {
|
|
1637
|
+
if (err instanceof Error) {
|
|
1638
|
+
const parsed = fromTxError(err);
|
|
1639
|
+
if (parsed) {
|
|
1640
|
+
throw new ContractError(err, parsed.name, parsed.msg);
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
throw err;
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
async function calculateAmountWithTransferFees(connection, transferFeeConfig, transferAmount) {
|
|
1647
|
+
const epoch = await connection.getEpochInfo();
|
|
1648
|
+
const transferFee = epoch.epoch >= transferFeeConfig.newerTransferFee.epoch ? transferFeeConfig.newerTransferFee : transferFeeConfig.olderTransferFee;
|
|
1649
|
+
const transferFeeBasisPoints = BigInt(transferFee.transferFeeBasisPoints);
|
|
1650
|
+
let feeCharged = BigInt(0);
|
|
1651
|
+
if (transferFeeBasisPoints !== BigInt(0)) {
|
|
1652
|
+
const numerator = transferAmount * ONE_IN_BASIS_POINTS;
|
|
1653
|
+
const denominator = ONE_IN_BASIS_POINTS - transferFeeBasisPoints;
|
|
1654
|
+
const rawPreFeeAmount = divCeilN(numerator, denominator);
|
|
1655
|
+
const fee = rawPreFeeAmount - transferAmount;
|
|
1656
|
+
transferAmount = rawPreFeeAmount;
|
|
1657
|
+
feeCharged = fee > transferFee.maximumFee ? transferFee.maximumFee : fee;
|
|
1658
|
+
}
|
|
1659
|
+
return { transferAmount, feeCharged };
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
// solana/clients/BaseDistributorClient.ts
|
|
1663
|
+
var BaseDistributorClient = class {
|
|
1664
|
+
constructor({
|
|
1665
|
+
clusterUrl,
|
|
1666
|
+
cluster = ICluster.Mainnet,
|
|
1667
|
+
commitment = "confirmed",
|
|
1668
|
+
programId = "",
|
|
1669
|
+
sendRate = 1,
|
|
1670
|
+
sendThrottler
|
|
1671
|
+
}) {
|
|
1672
|
+
this.commitment = commitment;
|
|
1673
|
+
this.connection = new Connection(clusterUrl, this.commitment);
|
|
1674
|
+
this.programId = programId !== "" ? new PublicKey(programId) : new PublicKey(DISTRIBUTOR_PROGRAM_ID[cluster]);
|
|
1675
|
+
this.sendThrottler = sendThrottler ?? buildSendThrottler(sendRate);
|
|
1676
|
+
}
|
|
1677
|
+
getConnection() {
|
|
1678
|
+
return this.connection;
|
|
1679
|
+
}
|
|
1680
|
+
getCommitment() {
|
|
1681
|
+
return typeof this.commitment == "string" ? this.commitment : this.commitment.commitment;
|
|
1682
|
+
}
|
|
1683
|
+
getDistributorProgramId() {
|
|
1684
|
+
return this.programId;
|
|
1685
|
+
}
|
|
1686
|
+
async prepareCreateInstructions(data, extParams) {
|
|
1687
|
+
if (!extParams.invoker.publicKey) {
|
|
1688
|
+
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
1689
|
+
}
|
|
1690
|
+
const { version, mint } = data;
|
|
1691
|
+
const ixs = prepareBaseInstructions(this.connection, extParams);
|
|
1692
|
+
const mintPublicKey = extParams.isNative ? NATIVE_MINT : new PublicKey(mint);
|
|
1693
|
+
const { mint: mintAccount, tokenProgramId } = await getMintAndProgram(this.connection, mintPublicKey);
|
|
1694
|
+
const transferFeeConfig = getTransferFeeConfig(mintAccount);
|
|
1695
|
+
const distributorPublicKey = getDistributorPda(this.programId, mintPublicKey, version);
|
|
1696
|
+
const tokenVault = await ata(mintPublicKey, distributorPublicKey, tokenProgramId);
|
|
1697
|
+
const senderTokens = await ata(mintPublicKey, extParams.invoker.publicKey, tokenProgramId);
|
|
1698
|
+
const accounts = {
|
|
1699
|
+
distributor: distributorPublicKey,
|
|
1700
|
+
clawbackReceiver: senderTokens,
|
|
1701
|
+
mint: mintPublicKey,
|
|
1702
|
+
tokenVault,
|
|
1703
|
+
admin: extParams.invoker.publicKey,
|
|
1704
|
+
systemProgram: SystemProgram.programId,
|
|
1705
|
+
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
1706
|
+
tokenProgram: tokenProgramId
|
|
1707
|
+
};
|
|
1708
|
+
if (extParams.isNative) {
|
|
1709
|
+
ixs.push(
|
|
1710
|
+
...await prepareWrappedAccount(this.connection, extParams.invoker.publicKey, new BN6(data.maxTotalClaim))
|
|
1711
|
+
);
|
|
1712
|
+
}
|
|
1713
|
+
const newDistributorInstruction = await this.getNewDistributorInstruction(data, accounts);
|
|
1714
|
+
ixs.push(newDistributorInstruction);
|
|
1715
|
+
if (transferFeeConfig) {
|
|
1716
|
+
const { transferAmount, feeCharged } = await calculateAmountWithTransferFees(
|
|
1717
|
+
this.connection,
|
|
1718
|
+
transferFeeConfig,
|
|
1719
|
+
BigInt(data.maxTotalClaim.toString())
|
|
1720
|
+
);
|
|
1721
|
+
ixs.push(
|
|
1722
|
+
createTransferCheckedWithFeeInstruction(
|
|
1723
|
+
senderTokens,
|
|
1724
|
+
mintPublicKey,
|
|
1725
|
+
tokenVault,
|
|
1726
|
+
extParams.invoker.publicKey,
|
|
1727
|
+
transferAmount,
|
|
1728
|
+
mintAccount.decimals,
|
|
1729
|
+
feeCharged,
|
|
1730
|
+
void 0,
|
|
1731
|
+
tokenProgramId
|
|
1732
|
+
)
|
|
1733
|
+
);
|
|
1734
|
+
} else {
|
|
1735
|
+
ixs.push(
|
|
1736
|
+
createTransferCheckedInstruction(
|
|
1737
|
+
senderTokens,
|
|
1738
|
+
mintPublicKey,
|
|
1739
|
+
tokenVault,
|
|
1740
|
+
extParams.invoker.publicKey,
|
|
1741
|
+
BigInt(data.maxTotalClaim.toString()),
|
|
1742
|
+
mintAccount.decimals,
|
|
1743
|
+
void 0,
|
|
1744
|
+
tokenProgramId
|
|
1745
|
+
)
|
|
1746
|
+
);
|
|
1747
|
+
}
|
|
1748
|
+
return { distributorPublicKey, ixs };
|
|
1749
|
+
}
|
|
1750
|
+
async create(data, extParams) {
|
|
1751
|
+
const invoker = extParams.invoker.publicKey;
|
|
1752
|
+
invariant(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
1753
|
+
const { ixs, distributorPublicKey } = await createAndEstimateTransaction(
|
|
1754
|
+
(params) => this.prepareCreateInstructions(data, { ...params, invoker: extParams.invoker }),
|
|
1755
|
+
extParams,
|
|
1756
|
+
(q) => q.ixs
|
|
1757
|
+
);
|
|
1758
|
+
const { tx, hash, context } = await prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
1759
|
+
const signature = await wrappedSignAndExecuteTransaction(
|
|
1760
|
+
this.connection,
|
|
1761
|
+
extParams.invoker,
|
|
1762
|
+
tx,
|
|
1763
|
+
{
|
|
1764
|
+
hash,
|
|
1765
|
+
context,
|
|
1766
|
+
commitment: this.getCommitment()
|
|
1767
|
+
},
|
|
1768
|
+
{ sendThrottler: this.sendThrottler }
|
|
1769
|
+
);
|
|
1770
|
+
return {
|
|
1771
|
+
ixs,
|
|
1772
|
+
txId: signature,
|
|
1773
|
+
metadataId: distributorPublicKey.toBase58()
|
|
1774
|
+
};
|
|
1775
|
+
}
|
|
1776
|
+
async claim(data, extParams) {
|
|
1777
|
+
const ixs = await createAndEstimateTransaction(
|
|
1778
|
+
(params) => this.prepareClaimInstructions(data, { ...params, invoker: extParams.invoker }),
|
|
1779
|
+
extParams
|
|
1780
|
+
);
|
|
1781
|
+
const { tx, hash, context } = await prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
1782
|
+
const signature = await wrappedSignAndExecuteTransaction(
|
|
1783
|
+
this.connection,
|
|
1784
|
+
extParams.invoker,
|
|
1785
|
+
tx,
|
|
1786
|
+
{
|
|
1787
|
+
hash,
|
|
1788
|
+
context,
|
|
1789
|
+
commitment: this.getCommitment()
|
|
1790
|
+
},
|
|
1791
|
+
{ sendThrottler: this.sendThrottler }
|
|
1792
|
+
);
|
|
1793
|
+
return { ixs, txId: signature };
|
|
1794
|
+
}
|
|
1795
|
+
async prepareClaimInstructions(data, extParams) {
|
|
1796
|
+
if (!extParams.invoker.publicKey) {
|
|
1797
|
+
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
1798
|
+
}
|
|
1799
|
+
const distributorPublicKey = new PublicKey(data.id);
|
|
1800
|
+
const distributor = await MerkleDistributor.fetch(this.connection, distributorPublicKey);
|
|
1801
|
+
if (!distributor) {
|
|
1802
|
+
throw new Error("Couldn't get account info");
|
|
1803
|
+
}
|
|
1804
|
+
const { tokenProgramId } = await getMintAndProgram(this.connection, distributor.mint);
|
|
1805
|
+
const ixs = prepareBaseInstructions(this.connection, extParams);
|
|
1806
|
+
ixs.push(
|
|
1807
|
+
...await checkOrCreateAtaBatch(
|
|
1808
|
+
this.connection,
|
|
1809
|
+
[extParams.invoker.publicKey],
|
|
1810
|
+
distributor.mint,
|
|
1811
|
+
extParams.invoker,
|
|
1812
|
+
tokenProgramId
|
|
1813
|
+
)
|
|
1814
|
+
);
|
|
1815
|
+
const invokerTokens = await ata(distributor.mint, extParams.invoker.publicKey, tokenProgramId);
|
|
1816
|
+
const claimStatusPublicKey = getClaimantStatusPda(
|
|
1817
|
+
this.programId,
|
|
1818
|
+
distributorPublicKey,
|
|
1819
|
+
extParams.invoker.publicKey
|
|
1820
|
+
);
|
|
1821
|
+
const eventAuthorityPublicKey = getEventAuthorityPda(this.programId);
|
|
1822
|
+
const claimStatus = await ClaimStatus.fetch(this.connection, claimStatusPublicKey);
|
|
1823
|
+
const accounts = {
|
|
1824
|
+
distributor: distributorPublicKey,
|
|
1825
|
+
claimStatus: claimStatusPublicKey,
|
|
1826
|
+
from: distributor.tokenVault,
|
|
1827
|
+
to: invokerTokens,
|
|
1828
|
+
claimant: extParams.invoker.publicKey,
|
|
1829
|
+
mint: distributor.mint,
|
|
1830
|
+
tokenProgram: tokenProgramId,
|
|
1831
|
+
systemProgram: SystemProgram.programId,
|
|
1832
|
+
eventAuthority: eventAuthorityPublicKey,
|
|
1833
|
+
program: this.programId
|
|
1834
|
+
};
|
|
1835
|
+
if (!claimStatus) {
|
|
1836
|
+
const args = {
|
|
1837
|
+
amountLocked: new BN6(data.amountLocked),
|
|
1838
|
+
amountUnlocked: new BN6(data.amountUnlocked),
|
|
1839
|
+
proof: data.proof
|
|
1840
|
+
};
|
|
1841
|
+
ixs.push(newClaim(args, accounts, this.programId));
|
|
1842
|
+
}
|
|
1843
|
+
const nowTs = new BN6(Math.floor(Date.now() / 1e3));
|
|
1844
|
+
if (claimStatus || new BN6(data.amountLocked).gtn(0) && nowTs.sub(distributor.startTs).gte(distributor.unlockPeriod)) {
|
|
1845
|
+
ixs.push(claimLocked(accounts, this.programId));
|
|
1846
|
+
}
|
|
1847
|
+
ixs.push(this.prepareClaimFeeInstruction(extParams.invoker.publicKey));
|
|
1848
|
+
return ixs;
|
|
1849
|
+
}
|
|
1850
|
+
async closeClaim(data, extParams) {
|
|
1851
|
+
const ixs = await createAndEstimateTransaction(
|
|
1852
|
+
(params) => this.prepareCloseClaimInstructions(data, { ...params, invoker: extParams.invoker }),
|
|
1853
|
+
extParams
|
|
1854
|
+
);
|
|
1855
|
+
const { tx, hash, context } = await prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
1856
|
+
const signature = await wrappedSignAndExecuteTransaction(
|
|
1857
|
+
this.connection,
|
|
1858
|
+
extParams.invoker,
|
|
1859
|
+
tx,
|
|
1860
|
+
{
|
|
1861
|
+
hash,
|
|
1862
|
+
context,
|
|
1863
|
+
commitment: this.getCommitment()
|
|
1864
|
+
},
|
|
1865
|
+
{ sendThrottler: this.sendThrottler }
|
|
1866
|
+
);
|
|
1867
|
+
return { ixs, txId: signature };
|
|
1868
|
+
}
|
|
1869
|
+
async prepareCloseClaimInstructions(data, extParams) {
|
|
1870
|
+
if (!extParams.invoker.publicKey) {
|
|
1871
|
+
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
1872
|
+
}
|
|
1873
|
+
const distributorPublicKey = new PublicKey(data.id);
|
|
1874
|
+
const distributor = await MerkleDistributor.fetch(this.connection, distributorPublicKey);
|
|
1875
|
+
const claimantPublicKey = pk(data.claimant);
|
|
1876
|
+
if (!distributor) {
|
|
1877
|
+
throw new Error("Couldn't get distributor account info");
|
|
1878
|
+
}
|
|
1879
|
+
const ixs = prepareBaseInstructions(this.connection, extParams);
|
|
1880
|
+
const claimStatusPublicKey = getClaimantStatusPda(this.programId, distributorPublicKey, claimantPublicKey);
|
|
1881
|
+
const eventAuthorityPublicKey = getEventAuthorityPda(this.programId);
|
|
1882
|
+
const closeClaimAccounts = {
|
|
1883
|
+
adminOrClaimant: extParams.invoker.publicKey,
|
|
1884
|
+
distributor: distributorPublicKey,
|
|
1885
|
+
claimStatus: claimStatusPublicKey,
|
|
1886
|
+
claimant: claimantPublicKey,
|
|
1887
|
+
systemProgram: SystemProgram.programId,
|
|
1888
|
+
eventAuthority: eventAuthorityPublicKey,
|
|
1889
|
+
program: this.programId
|
|
1890
|
+
};
|
|
1891
|
+
const closeClaimArgs = {
|
|
1892
|
+
amountLocked: data.amountLocked ? new BN6(data.amountLocked) : void 0,
|
|
1893
|
+
amountUnlocked: data.amountUnlocked ? new BN6(data.amountUnlocked) : void 0,
|
|
1894
|
+
proof: data.proof
|
|
1895
|
+
};
|
|
1896
|
+
ixs.push(closeClaim(closeClaimArgs, closeClaimAccounts, this.programId));
|
|
1897
|
+
return ixs;
|
|
1898
|
+
}
|
|
1899
|
+
async prepareClawbackInstructions(data, extParams) {
|
|
1900
|
+
if (!extParams.invoker.publicKey) {
|
|
1901
|
+
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
1902
|
+
}
|
|
1903
|
+
const distributorPublicKey = new PublicKey(data.id);
|
|
1904
|
+
const distributor = await MerkleDistributor.fetch(this.connection, distributorPublicKey);
|
|
1905
|
+
if (!distributor) {
|
|
1906
|
+
throw new Error("Couldn't get account info");
|
|
1907
|
+
}
|
|
1908
|
+
const { tokenProgramId } = await getMintAndProgram(this.connection, distributor.mint);
|
|
1909
|
+
const ixs = prepareBaseInstructions(this.connection, extParams);
|
|
1910
|
+
ixs.push(
|
|
1911
|
+
...await checkOrCreateAtaBatch(
|
|
1912
|
+
this.connection,
|
|
1913
|
+
[extParams.invoker.publicKey],
|
|
1914
|
+
distributor.mint,
|
|
1915
|
+
extParams.invoker,
|
|
1916
|
+
tokenProgramId
|
|
1917
|
+
)
|
|
1918
|
+
);
|
|
1919
|
+
const accounts = {
|
|
1920
|
+
distributor: distributorPublicKey,
|
|
1921
|
+
from: distributor.tokenVault,
|
|
1922
|
+
to: distributor.clawbackReceiver,
|
|
1923
|
+
admin: extParams.invoker.publicKey,
|
|
1924
|
+
mint: distributor.mint,
|
|
1925
|
+
systemProgram: SystemProgram.programId,
|
|
1926
|
+
tokenProgram: tokenProgramId
|
|
1927
|
+
};
|
|
1928
|
+
const clawbackInstruction = await this.getClawbackInstruction(accounts);
|
|
1929
|
+
ixs.push(clawbackInstruction);
|
|
1930
|
+
return ixs;
|
|
1931
|
+
}
|
|
1932
|
+
async clawback(data, extParams) {
|
|
1933
|
+
const ixs = await createAndEstimateTransaction(
|
|
1934
|
+
(params) => this.prepareClawbackInstructions(data, { ...params, invoker: extParams.invoker }),
|
|
1935
|
+
extParams
|
|
1936
|
+
);
|
|
1937
|
+
const { tx, hash, context } = await prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
1938
|
+
const signature = await wrappedSignAndExecuteTransaction(
|
|
1939
|
+
this.connection,
|
|
1940
|
+
extParams.invoker,
|
|
1941
|
+
tx,
|
|
1942
|
+
{
|
|
1943
|
+
hash,
|
|
1944
|
+
context,
|
|
1945
|
+
commitment: this.getCommitment()
|
|
1946
|
+
},
|
|
1947
|
+
{ sendThrottler: this.sendThrottler }
|
|
1948
|
+
);
|
|
1949
|
+
return { ixs, txId: signature };
|
|
1950
|
+
}
|
|
1951
|
+
async getClaims(data) {
|
|
1952
|
+
const claimStatusPublicKeys = data.map(({ id, recipient }) => {
|
|
1953
|
+
return getClaimantStatusPda(this.programId, new PublicKey(id), new PublicKey(recipient));
|
|
1954
|
+
});
|
|
1955
|
+
return ClaimStatus.fetchMultiple(this.connection, claimStatusPublicKeys, this.programId);
|
|
1956
|
+
}
|
|
1957
|
+
async getDistributors(data) {
|
|
1958
|
+
const distributorPublicKeys = data.ids.map((distributorId) => new PublicKey(distributorId));
|
|
1959
|
+
return MerkleDistributor.fetchMultiple(this.connection, distributorPublicKeys, this.programId);
|
|
1960
|
+
}
|
|
1961
|
+
async searchDistributors(data) {
|
|
1962
|
+
const filters = [{ memcmp: { offset: 0, bytes: bs58.encode(MerkleDistributor.discriminator) } }];
|
|
1963
|
+
if (data.mint) {
|
|
1964
|
+
filters.push({
|
|
1965
|
+
memcmp: {
|
|
1966
|
+
offset: DISTRIBUTOR_MINT_OFFSET,
|
|
1967
|
+
bytes: data.mint
|
|
1968
|
+
}
|
|
1969
|
+
});
|
|
1970
|
+
}
|
|
1971
|
+
if (data.admin) {
|
|
1972
|
+
filters.push({
|
|
1973
|
+
memcmp: {
|
|
1974
|
+
offset: DISTRIBUTOR_ADMIN_OFFSET,
|
|
1975
|
+
bytes: data.admin
|
|
1976
|
+
}
|
|
1977
|
+
});
|
|
1978
|
+
}
|
|
1979
|
+
const accounts = await this.connection.getProgramAccounts(this.programId, { filters });
|
|
1980
|
+
return accounts.map(({ pubkey, account }) => ({
|
|
1981
|
+
publicKey: pubkey,
|
|
1982
|
+
account: MerkleDistributor.decode(account.data)
|
|
1983
|
+
}));
|
|
1984
|
+
}
|
|
1985
|
+
prepareClaimFeeInstruction(payer) {
|
|
1986
|
+
return SystemProgram.transfer({
|
|
1987
|
+
fromPubkey: payer,
|
|
1988
|
+
toPubkey: STREAMFLOW_TREASURY_PUBLIC_KEY,
|
|
1989
|
+
lamports: AIRDROP_CLAIM_FEE
|
|
1990
|
+
});
|
|
1991
|
+
}
|
|
1992
|
+
getNewDistributorArgs(data) {
|
|
1993
|
+
const args = {
|
|
1994
|
+
version: new BN6(data.version),
|
|
1995
|
+
root: data.root,
|
|
1996
|
+
maxTotalClaim: new BN6(data.maxTotalClaim),
|
|
1997
|
+
maxNumNodes: new BN6(data.maxNumNodes),
|
|
1998
|
+
unlockPeriod: new BN6(data.unlockPeriod),
|
|
1999
|
+
startVestingTs: new BN6(data.startVestingTs),
|
|
2000
|
+
endVestingTs: new BN6(data.endVestingTs),
|
|
2001
|
+
clawbackStartTs: new BN6(data.clawbackStartTs),
|
|
2002
|
+
claimsClosableByAdmin: data.claimsClosableByAdmin,
|
|
2003
|
+
claimsClosableByClaimant: data.claimsClosableByClaimant,
|
|
2004
|
+
claimsLimit: data.claimsLimit
|
|
2005
|
+
};
|
|
2006
|
+
const nowTs = new BN6(Math.floor(Date.now() / 1e3));
|
|
2007
|
+
const endVestingTs = args.endVestingTs.isZero() ? nowTs : args.endVestingTs;
|
|
2008
|
+
const startVestingTs = args.startVestingTs.isZero() ? nowTs : args.startVestingTs;
|
|
2009
|
+
if (endVestingTs.gt(startVestingTs) && endVestingTs.sub(startVestingTs).lt(args.unlockPeriod)) {
|
|
2010
|
+
throw new Error("The unlock period cannot be longer than the total vesting duration!");
|
|
2011
|
+
}
|
|
2012
|
+
return args;
|
|
2013
|
+
}
|
|
2014
|
+
};
|
|
2015
|
+
|
|
2016
|
+
// solana/clients/SolanaDistributorClient.ts
|
|
2017
|
+
var SolanaDistributorClient = class extends BaseDistributorClient {
|
|
2018
|
+
async getNewDistributorInstruction(data, accounts) {
|
|
2019
|
+
const args = this.getNewDistributorArgs(data);
|
|
2020
|
+
return newDistributor(args, accounts, this.programId);
|
|
2021
|
+
}
|
|
2022
|
+
async getClawbackInstruction(accounts) {
|
|
2023
|
+
return clawback(accounts, this.programId);
|
|
2024
|
+
}
|
|
2025
|
+
};
|
|
2026
|
+
|
|
2027
|
+
// solana/descriptor/idl/aligned_distributor.json
|
|
2028
|
+
var aligned_distributor_default = {
|
|
2029
|
+
address: "aMERKpFAWoChCi5oZwPvgsSCoGpZKBiU7fi76bdZjt2",
|
|
2030
|
+
metadata: {
|
|
2031
|
+
name: "aligned_distributor",
|
|
2032
|
+
version: "1.3.2",
|
|
2033
|
+
spec: "0.1.0",
|
|
2034
|
+
description: "Proxy for merkle distributor that updates Vesting duration according to token market performance."
|
|
2035
|
+
},
|
|
2036
|
+
instructions: [
|
|
2037
|
+
{
|
|
2038
|
+
name: "change_oracle",
|
|
2039
|
+
discriminator: [177, 227, 230, 103, 13, 72, 141, 248],
|
|
2040
|
+
accounts: [
|
|
2041
|
+
{
|
|
2042
|
+
name: "aligned_distributor",
|
|
2043
|
+
docs: ["The [MerkleDistributor]."],
|
|
2044
|
+
writable: true
|
|
2045
|
+
},
|
|
2046
|
+
{
|
|
2047
|
+
name: "admin",
|
|
2048
|
+
docs: ["Admin signer"],
|
|
2049
|
+
writable: true,
|
|
2050
|
+
signer: true
|
|
2051
|
+
},
|
|
2052
|
+
{
|
|
2053
|
+
name: "new_price_oracle"
|
|
2054
|
+
}
|
|
2055
|
+
],
|
|
2056
|
+
args: [
|
|
2057
|
+
{
|
|
2058
|
+
name: "ix",
|
|
2059
|
+
type: {
|
|
2060
|
+
defined: {
|
|
2061
|
+
name: "ChangeOracleParams"
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
]
|
|
2066
|
+
},
|
|
2067
|
+
{
|
|
2068
|
+
name: "clawback",
|
|
2069
|
+
discriminator: [111, 92, 142, 79, 33, 234, 82, 27],
|
|
2070
|
+
accounts: [
|
|
2071
|
+
{
|
|
2072
|
+
name: "aligned_distributor",
|
|
2073
|
+
docs: ["The [AlignedDistributor]."],
|
|
2074
|
+
writable: true,
|
|
2075
|
+
pda: {
|
|
2076
|
+
seeds: [
|
|
2077
|
+
{
|
|
2078
|
+
kind: "const",
|
|
2079
|
+
value: [97, 108, 105, 103, 110, 101, 100, 45, 100, 105, 115, 116, 114, 105, 98, 117, 116, 111, 114]
|
|
2080
|
+
},
|
|
2081
|
+
{
|
|
2082
|
+
kind: "account",
|
|
2083
|
+
path: "distributor"
|
|
2084
|
+
}
|
|
2085
|
+
]
|
|
2086
|
+
}
|
|
2087
|
+
},
|
|
2088
|
+
{
|
|
2089
|
+
name: "distributor",
|
|
2090
|
+
docs: ["The [MerkleDistributor]."],
|
|
2091
|
+
writable: true
|
|
2092
|
+
},
|
|
2093
|
+
{
|
|
2094
|
+
name: "from",
|
|
2095
|
+
docs: ["Distributor ATA containing the tokens to distribute."],
|
|
2096
|
+
writable: true
|
|
2097
|
+
},
|
|
2098
|
+
{
|
|
2099
|
+
name: "to",
|
|
2100
|
+
docs: ["The Clawback token account."],
|
|
2101
|
+
writable: true
|
|
2102
|
+
},
|
|
2103
|
+
{
|
|
2104
|
+
name: "admin",
|
|
2105
|
+
docs: ["Only Admin can trigger the clawback of funds"],
|
|
2106
|
+
writable: true,
|
|
2107
|
+
signer: true
|
|
2108
|
+
},
|
|
2109
|
+
{
|
|
2110
|
+
name: "mint"
|
|
2111
|
+
},
|
|
2112
|
+
{
|
|
2113
|
+
name: "distributor_program",
|
|
2114
|
+
address: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N"
|
|
2115
|
+
},
|
|
2116
|
+
{
|
|
2117
|
+
name: "system_program",
|
|
2118
|
+
docs: ["The [System] program."],
|
|
2119
|
+
address: "11111111111111111111111111111111"
|
|
2120
|
+
},
|
|
2121
|
+
{
|
|
2122
|
+
name: "token_program",
|
|
2123
|
+
docs: ["SPL [Token] program."]
|
|
2124
|
+
}
|
|
2125
|
+
],
|
|
2126
|
+
args: []
|
|
2127
|
+
},
|
|
2128
|
+
{
|
|
2129
|
+
name: "create_test_oracle",
|
|
2130
|
+
discriminator: [183, 110, 4, 11, 131, 220, 84, 12],
|
|
2131
|
+
accounts: [
|
|
2132
|
+
{
|
|
2133
|
+
name: "creator",
|
|
2134
|
+
writable: true,
|
|
2135
|
+
signer: true
|
|
2136
|
+
},
|
|
2137
|
+
{
|
|
2138
|
+
name: "mint"
|
|
2139
|
+
},
|
|
2140
|
+
{
|
|
2141
|
+
name: "test_oracle",
|
|
2142
|
+
writable: true,
|
|
2143
|
+
pda: {
|
|
2144
|
+
seeds: [
|
|
2145
|
+
{
|
|
2146
|
+
kind: "const",
|
|
2147
|
+
value: [116, 101, 115, 116, 45, 111, 114, 97, 99, 108, 101]
|
|
2148
|
+
},
|
|
2149
|
+
{
|
|
2150
|
+
kind: "account",
|
|
2151
|
+
path: "mint"
|
|
2152
|
+
},
|
|
2153
|
+
{
|
|
2154
|
+
kind: "account",
|
|
2155
|
+
path: "creator"
|
|
2156
|
+
}
|
|
2157
|
+
]
|
|
2158
|
+
}
|
|
2159
|
+
},
|
|
2160
|
+
{
|
|
2161
|
+
name: "system_program",
|
|
2162
|
+
address: "11111111111111111111111111111111"
|
|
2163
|
+
}
|
|
2164
|
+
],
|
|
2165
|
+
args: [
|
|
2166
|
+
{
|
|
2167
|
+
name: "ix",
|
|
2168
|
+
type: {
|
|
2169
|
+
defined: {
|
|
2170
|
+
name: "CreateTestOracleParams"
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
]
|
|
2175
|
+
},
|
|
2176
|
+
{
|
|
2177
|
+
name: "new_distributor",
|
|
2178
|
+
discriminator: [32, 139, 112, 171, 0, 2, 225, 155],
|
|
2179
|
+
accounts: [
|
|
2180
|
+
{
|
|
2181
|
+
name: "aligned_distributor",
|
|
2182
|
+
writable: true,
|
|
2183
|
+
pda: {
|
|
2184
|
+
seeds: [
|
|
2185
|
+
{
|
|
2186
|
+
kind: "const",
|
|
2187
|
+
value: [97, 108, 105, 103, 110, 101, 100, 45, 100, 105, 115, 116, 114, 105, 98, 117, 116, 111, 114]
|
|
2188
|
+
},
|
|
2189
|
+
{
|
|
2190
|
+
kind: "account",
|
|
2191
|
+
path: "distributor"
|
|
2192
|
+
}
|
|
2193
|
+
]
|
|
2194
|
+
}
|
|
2195
|
+
},
|
|
2196
|
+
{
|
|
2197
|
+
name: "price_oracle"
|
|
2198
|
+
},
|
|
2199
|
+
{
|
|
2200
|
+
name: "withdrawor",
|
|
2201
|
+
writable: true,
|
|
2202
|
+
address: "wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u"
|
|
2203
|
+
},
|
|
2204
|
+
{
|
|
2205
|
+
name: "clawback_receiver",
|
|
2206
|
+
docs: ["Clawback receiver token account"],
|
|
2207
|
+
writable: true
|
|
2208
|
+
},
|
|
2209
|
+
{
|
|
2210
|
+
name: "mint",
|
|
2211
|
+
docs: ["The mint to distribute."]
|
|
2212
|
+
},
|
|
2213
|
+
{
|
|
2214
|
+
name: "distributor",
|
|
2215
|
+
writable: true
|
|
2216
|
+
},
|
|
2217
|
+
{
|
|
2218
|
+
name: "token_vault",
|
|
2219
|
+
writable: true
|
|
2220
|
+
},
|
|
2221
|
+
{
|
|
2222
|
+
name: "admin",
|
|
2223
|
+
docs: [
|
|
2224
|
+
"Original Admin wallet, responsible for creating the distributor and paying for the transaction.",
|
|
2225
|
+
"Also has the authority to set the clawback receiver and change itself."
|
|
2226
|
+
],
|
|
2227
|
+
writable: true,
|
|
2228
|
+
signer: true
|
|
2229
|
+
},
|
|
2230
|
+
{
|
|
2231
|
+
name: "distributor_program",
|
|
2232
|
+
docs: ["MerkleDistributor program"],
|
|
2233
|
+
address: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N"
|
|
2234
|
+
},
|
|
2235
|
+
{
|
|
2236
|
+
name: "system_program",
|
|
2237
|
+
docs: ["The [System] program."],
|
|
2238
|
+
address: "11111111111111111111111111111111"
|
|
2239
|
+
},
|
|
2240
|
+
{
|
|
2241
|
+
name: "associated_token_program",
|
|
2242
|
+
docs: ["The [Associated Token] program."],
|
|
2243
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
2244
|
+
},
|
|
2245
|
+
{
|
|
2246
|
+
name: "token_program",
|
|
2247
|
+
docs: ["The [Token] program."]
|
|
2248
|
+
}
|
|
2249
|
+
],
|
|
2250
|
+
args: [
|
|
2251
|
+
{
|
|
2252
|
+
name: "ix",
|
|
2253
|
+
type: {
|
|
2254
|
+
defined: {
|
|
2255
|
+
name: "NewDistributorIx"
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
]
|
|
2260
|
+
},
|
|
2261
|
+
{
|
|
2262
|
+
name: "set_admin",
|
|
2263
|
+
discriminator: [251, 163, 0, 52, 91, 194, 187, 92],
|
|
2264
|
+
accounts: [
|
|
2265
|
+
{
|
|
2266
|
+
name: "aligned_distributor",
|
|
2267
|
+
docs: ["The [MerkleDistributor]."],
|
|
2268
|
+
writable: true
|
|
2269
|
+
},
|
|
2270
|
+
{
|
|
2271
|
+
name: "admin",
|
|
2272
|
+
docs: ["Admin signer"],
|
|
2273
|
+
writable: true,
|
|
2274
|
+
signer: true
|
|
2275
|
+
},
|
|
2276
|
+
{
|
|
2277
|
+
name: "new_admin",
|
|
2278
|
+
docs: ["New admin account"],
|
|
2279
|
+
writable: true
|
|
2280
|
+
}
|
|
2281
|
+
],
|
|
2282
|
+
args: []
|
|
2283
|
+
},
|
|
2284
|
+
{
|
|
2285
|
+
name: "set_test_oracle_authority",
|
|
2286
|
+
discriminator: [26, 66, 233, 99, 38, 118, 181, 247],
|
|
2287
|
+
accounts: [
|
|
2288
|
+
{
|
|
2289
|
+
name: "authority",
|
|
2290
|
+
writable: true,
|
|
2291
|
+
signer: true
|
|
2292
|
+
},
|
|
2293
|
+
{
|
|
2294
|
+
name: "test_oracle",
|
|
2295
|
+
writable: true
|
|
2296
|
+
},
|
|
2297
|
+
{
|
|
2298
|
+
name: "new_authority"
|
|
2299
|
+
}
|
|
2300
|
+
],
|
|
2301
|
+
args: []
|
|
2302
|
+
},
|
|
2303
|
+
{
|
|
2304
|
+
name: "update_duration",
|
|
2305
|
+
discriminator: [69, 126, 172, 250, 164, 14, 10, 161],
|
|
2306
|
+
accounts: [
|
|
2307
|
+
{
|
|
2308
|
+
name: "authority",
|
|
2309
|
+
docs: ["Wallet authorised to call this method"],
|
|
2310
|
+
writable: true,
|
|
2311
|
+
signer: true
|
|
2312
|
+
},
|
|
2313
|
+
{
|
|
2314
|
+
name: "aligned_distributor",
|
|
2315
|
+
docs: ["The account holding the proxy parameters."],
|
|
2316
|
+
writable: true,
|
|
2317
|
+
pda: {
|
|
2318
|
+
seeds: [
|
|
2319
|
+
{
|
|
2320
|
+
kind: "const",
|
|
2321
|
+
value: [97, 108, 105, 103, 110, 101, 100, 45, 100, 105, 115, 116, 114, 105, 98, 117, 116, 111, 114]
|
|
2322
|
+
},
|
|
2323
|
+
{
|
|
2324
|
+
kind: "account",
|
|
2325
|
+
path: "distributor"
|
|
2326
|
+
}
|
|
2327
|
+
]
|
|
2328
|
+
}
|
|
2329
|
+
},
|
|
2330
|
+
{
|
|
2331
|
+
name: "distributor",
|
|
2332
|
+
docs: ["The account holding the vesting parameters."],
|
|
2333
|
+
writable: true
|
|
2334
|
+
},
|
|
2335
|
+
{
|
|
2336
|
+
name: "price_oracle",
|
|
2337
|
+
relations: ["aligned_distributor"]
|
|
2338
|
+
},
|
|
2339
|
+
{
|
|
2340
|
+
name: "distributor_program",
|
|
2341
|
+
docs: ["MerkleDistributor program"],
|
|
2342
|
+
address: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N"
|
|
2343
|
+
},
|
|
2344
|
+
{
|
|
2345
|
+
name: "system_program",
|
|
2346
|
+
address: "11111111111111111111111111111111"
|
|
2347
|
+
}
|
|
2348
|
+
],
|
|
2349
|
+
args: []
|
|
2350
|
+
},
|
|
2351
|
+
{
|
|
2352
|
+
name: "update_test_oracle",
|
|
2353
|
+
discriminator: [158, 147, 215, 74, 34, 123, 80, 76],
|
|
2354
|
+
accounts: [
|
|
2355
|
+
{
|
|
2356
|
+
name: "authority",
|
|
2357
|
+
writable: true,
|
|
2358
|
+
signer: true
|
|
2359
|
+
},
|
|
2360
|
+
{
|
|
2361
|
+
name: "test_oracle",
|
|
2362
|
+
writable: true
|
|
2363
|
+
}
|
|
2364
|
+
],
|
|
2365
|
+
args: [
|
|
2366
|
+
{
|
|
2367
|
+
name: "ix",
|
|
2368
|
+
type: {
|
|
2369
|
+
defined: {
|
|
2370
|
+
name: "UpdateTestOracleParams"
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
]
|
|
2375
|
+
}
|
|
2376
|
+
],
|
|
2377
|
+
accounts: [
|
|
2378
|
+
{
|
|
2379
|
+
name: "AlignedDistributor",
|
|
2380
|
+
discriminator: [128, 76, 80, 203, 248, 175, 3, 43]
|
|
2381
|
+
},
|
|
2382
|
+
{
|
|
2383
|
+
name: "MerkleDistributor",
|
|
2384
|
+
discriminator: [77, 119, 139, 70, 84, 247, 12, 26]
|
|
2385
|
+
},
|
|
2386
|
+
{
|
|
2387
|
+
name: "TestOracle",
|
|
2388
|
+
discriminator: [198, 49, 63, 134, 232, 251, 168, 28]
|
|
2389
|
+
}
|
|
2390
|
+
],
|
|
2391
|
+
errors: [
|
|
2392
|
+
{
|
|
2393
|
+
code: 6e3,
|
|
2394
|
+
name: "Unauthorized",
|
|
2395
|
+
msg: "Account is not authorized to execute this instruction"
|
|
2396
|
+
},
|
|
2397
|
+
{
|
|
2398
|
+
code: 6001,
|
|
2399
|
+
name: "ArithmeticError",
|
|
2400
|
+
msg: "Arithmetic error"
|
|
2401
|
+
},
|
|
2402
|
+
{
|
|
2403
|
+
code: 6002,
|
|
2404
|
+
name: "NoLockedAmount",
|
|
2405
|
+
msg: "Provided Distributor has no locked amount"
|
|
2406
|
+
},
|
|
2407
|
+
{
|
|
2408
|
+
code: 6003,
|
|
2409
|
+
name: "InvalidUpdatePeriod",
|
|
2410
|
+
msg: "Provided is invalid, should be equal or more than 30 seconds and unlock_period"
|
|
2411
|
+
},
|
|
2412
|
+
{
|
|
2413
|
+
code: 6004,
|
|
2414
|
+
name: "InvalidTickSize",
|
|
2415
|
+
msg: "Provided percentage tick size is invalid"
|
|
2416
|
+
},
|
|
2417
|
+
{
|
|
2418
|
+
code: 6005,
|
|
2419
|
+
name: "InvalidPercentageBoundaries",
|
|
2420
|
+
msg: "Provided percentage bounds are invalid"
|
|
2421
|
+
},
|
|
2422
|
+
{
|
|
2423
|
+
code: 6006,
|
|
2424
|
+
name: "InvalidPriceBoundaries",
|
|
2425
|
+
msg: "Provided price bounds are invalid"
|
|
2426
|
+
},
|
|
2427
|
+
{
|
|
2428
|
+
code: 6007,
|
|
2429
|
+
name: "UnsupportedOracle",
|
|
2430
|
+
msg: "Unsupported price oracle"
|
|
2431
|
+
},
|
|
2432
|
+
{
|
|
2433
|
+
code: 6008,
|
|
2434
|
+
name: "InvalidOracleAccount",
|
|
2435
|
+
msg: "Invalid oracle account"
|
|
2436
|
+
},
|
|
2437
|
+
{
|
|
2438
|
+
code: 6009,
|
|
2439
|
+
name: "InvalidOraclePrice",
|
|
2440
|
+
msg: "Invalid oracle price"
|
|
2441
|
+
},
|
|
2442
|
+
{
|
|
2443
|
+
code: 6010,
|
|
2444
|
+
name: "DurationAlreadyUpdated",
|
|
2445
|
+
msg: "Duration has been already updated in this period"
|
|
2446
|
+
},
|
|
2447
|
+
{
|
|
2448
|
+
code: 6011,
|
|
2449
|
+
name: "VestingAlreadyFinished",
|
|
2450
|
+
msg: "Vesting already finished"
|
|
2451
|
+
},
|
|
2452
|
+
{
|
|
2453
|
+
code: 6012,
|
|
2454
|
+
name: "SameAdmin",
|
|
2455
|
+
msg: "New and old admin are identical"
|
|
2456
|
+
},
|
|
2457
|
+
{
|
|
2458
|
+
code: 6013,
|
|
2459
|
+
name: "InvalidMint",
|
|
2460
|
+
msg: "Invalid Mint"
|
|
2461
|
+
}
|
|
2462
|
+
],
|
|
2463
|
+
types: [
|
|
2464
|
+
{
|
|
2465
|
+
name: "AlignedDistributor",
|
|
2466
|
+
docs: ["State for the account which distributes tokens."],
|
|
2467
|
+
type: {
|
|
2468
|
+
kind: "struct",
|
|
2469
|
+
fields: [
|
|
2470
|
+
{
|
|
2471
|
+
name: "bump",
|
|
2472
|
+
docs: ["Bump seed."],
|
|
2473
|
+
type: "u8"
|
|
2474
|
+
},
|
|
2475
|
+
{
|
|
2476
|
+
name: "distributor",
|
|
2477
|
+
docs: ["[Mint] of the token to be distributed."],
|
|
2478
|
+
type: "pubkey"
|
|
2479
|
+
},
|
|
2480
|
+
{
|
|
2481
|
+
name: "admin",
|
|
2482
|
+
docs: ["Admin wallet"],
|
|
2483
|
+
type: "pubkey"
|
|
2484
|
+
},
|
|
2485
|
+
{
|
|
2486
|
+
name: "price_oracle_type",
|
|
2487
|
+
docs: ["Type of the Oracle used to derive Token Price"],
|
|
2488
|
+
type: {
|
|
2489
|
+
defined: {
|
|
2490
|
+
name: "OracleType"
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
},
|
|
2494
|
+
{
|
|
2495
|
+
name: "price_oracle",
|
|
2496
|
+
docs: ["Address of the Price Oracle"],
|
|
2497
|
+
type: "pubkey"
|
|
2498
|
+
},
|
|
2499
|
+
{
|
|
2500
|
+
name: "update_period",
|
|
2501
|
+
docs: ["Period of updates, can be different from unlock period if needed"],
|
|
2502
|
+
type: "u64"
|
|
2503
|
+
},
|
|
2504
|
+
{
|
|
2505
|
+
name: "min_price",
|
|
2506
|
+
docs: ["Min price boundary"],
|
|
2507
|
+
type: "u64"
|
|
2508
|
+
},
|
|
2509
|
+
{
|
|
2510
|
+
name: "max_price",
|
|
2511
|
+
docs: ["Max price boundary"],
|
|
2512
|
+
type: "u64"
|
|
2513
|
+
},
|
|
2514
|
+
{
|
|
2515
|
+
name: "min_percentage",
|
|
2516
|
+
docs: ["Min percentage boundary, can be 0 that equals 1 Raw Token"],
|
|
2517
|
+
type: "u64"
|
|
2518
|
+
},
|
|
2519
|
+
{
|
|
2520
|
+
name: "max_percentage",
|
|
2521
|
+
docs: ["Max percentage boundary"],
|
|
2522
|
+
type: "u64"
|
|
2523
|
+
},
|
|
2524
|
+
{
|
|
2525
|
+
name: "tick_size",
|
|
2526
|
+
docs: ["Ticket size for percentage boundaries"],
|
|
2527
|
+
type: "u64"
|
|
2528
|
+
},
|
|
2529
|
+
{
|
|
2530
|
+
name: "start_ts",
|
|
2531
|
+
docs: ["Copy start ts from the Distributor to be used in the worker"],
|
|
2532
|
+
type: "u64"
|
|
2533
|
+
},
|
|
2534
|
+
{
|
|
2535
|
+
name: "end_ts",
|
|
2536
|
+
docs: ["Copy end ts from the Distributor to be used in the worker"],
|
|
2537
|
+
type: "u64"
|
|
2538
|
+
},
|
|
2539
|
+
{
|
|
2540
|
+
name: "last_duration_update_ts",
|
|
2541
|
+
docs: [
|
|
2542
|
+
"Copy last_duration_update_ts from Distributor for our worker to be able to fetch it in one call with the proxy"
|
|
2543
|
+
],
|
|
2544
|
+
type: "u64"
|
|
2545
|
+
},
|
|
2546
|
+
{
|
|
2547
|
+
name: "last_price",
|
|
2548
|
+
docs: ["Price used on last amount calculation"],
|
|
2549
|
+
type: "u64"
|
|
2550
|
+
},
|
|
2551
|
+
{
|
|
2552
|
+
name: "initial_duration",
|
|
2553
|
+
docs: ["Initial Airdrop Vesting duration"],
|
|
2554
|
+
type: "u64"
|
|
2555
|
+
},
|
|
2556
|
+
{
|
|
2557
|
+
name: "initial_price",
|
|
2558
|
+
docs: ["Initial token price at the time of Contract creation"],
|
|
2559
|
+
type: "u64"
|
|
2560
|
+
},
|
|
2561
|
+
{
|
|
2562
|
+
name: "distributor_clawed_back",
|
|
2563
|
+
docs: ["Whether distributor was clawed backed"],
|
|
2564
|
+
type: "bool"
|
|
2565
|
+
},
|
|
2566
|
+
{
|
|
2567
|
+
name: "mint",
|
|
2568
|
+
docs: ["Mint for which the distributor was created"],
|
|
2569
|
+
type: "pubkey"
|
|
2570
|
+
},
|
|
2571
|
+
{
|
|
2572
|
+
name: "buffer_2",
|
|
2573
|
+
docs: ["Buffer for additional fields"],
|
|
2574
|
+
type: {
|
|
2575
|
+
array: ["u8", 32]
|
|
2576
|
+
}
|
|
2577
|
+
},
|
|
2578
|
+
{
|
|
2579
|
+
name: "buffer_3",
|
|
2580
|
+
docs: ["Buffer for additional fields"],
|
|
2581
|
+
type: {
|
|
2582
|
+
array: ["u8", 32]
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
]
|
|
2586
|
+
}
|
|
2587
|
+
},
|
|
2588
|
+
{
|
|
2589
|
+
name: "ChangeOracleParams",
|
|
2590
|
+
type: {
|
|
2591
|
+
kind: "struct",
|
|
2592
|
+
fields: [
|
|
2593
|
+
{
|
|
2594
|
+
name: "oracle_type",
|
|
2595
|
+
type: {
|
|
2596
|
+
defined: {
|
|
2597
|
+
name: "OracleType"
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
]
|
|
2602
|
+
}
|
|
2603
|
+
},
|
|
2604
|
+
{
|
|
2605
|
+
name: "CreateTestOracleParams",
|
|
2606
|
+
type: {
|
|
2607
|
+
kind: "struct",
|
|
2608
|
+
fields: [
|
|
2609
|
+
{
|
|
2610
|
+
name: "price",
|
|
2611
|
+
type: "u64"
|
|
2612
|
+
},
|
|
2613
|
+
{
|
|
2614
|
+
name: "expo",
|
|
2615
|
+
type: "i32"
|
|
2616
|
+
},
|
|
2617
|
+
{
|
|
2618
|
+
name: "conf",
|
|
2619
|
+
type: "u64"
|
|
2620
|
+
},
|
|
2621
|
+
{
|
|
2622
|
+
name: "publish_time",
|
|
2623
|
+
type: "i64"
|
|
2624
|
+
}
|
|
2625
|
+
]
|
|
2626
|
+
}
|
|
2627
|
+
},
|
|
2628
|
+
{
|
|
2629
|
+
name: "MerkleDistributor",
|
|
2630
|
+
docs: ["State for the account which distributes tokens."],
|
|
2631
|
+
type: {
|
|
2632
|
+
kind: "struct",
|
|
2633
|
+
fields: [
|
|
2634
|
+
{
|
|
2635
|
+
name: "bump",
|
|
2636
|
+
docs: ["Bump seed."],
|
|
2637
|
+
type: "u8"
|
|
2638
|
+
},
|
|
2639
|
+
{
|
|
2640
|
+
name: "version",
|
|
2641
|
+
docs: ["Version of the airdrop"],
|
|
2642
|
+
type: "u64"
|
|
2643
|
+
},
|
|
2644
|
+
{
|
|
2645
|
+
name: "root",
|
|
2646
|
+
docs: ["The 256-bit merkle root."],
|
|
2647
|
+
type: {
|
|
2648
|
+
array: ["u8", 32]
|
|
2649
|
+
}
|
|
2650
|
+
},
|
|
2651
|
+
{
|
|
2652
|
+
name: "mint",
|
|
2653
|
+
docs: ["[Mint] of the token to be distributed."],
|
|
2654
|
+
type: "pubkey"
|
|
2655
|
+
},
|
|
2656
|
+
{
|
|
2657
|
+
name: "token_vault",
|
|
2658
|
+
docs: ["Token Address of the vault"],
|
|
2659
|
+
type: "pubkey"
|
|
2660
|
+
},
|
|
2661
|
+
{
|
|
2662
|
+
name: "max_total_claim",
|
|
2663
|
+
docs: ["Maximum number of tokens that can ever be claimed from this [MerkleDistributor]."],
|
|
2664
|
+
type: "u64"
|
|
2665
|
+
},
|
|
2666
|
+
{
|
|
2667
|
+
name: "max_num_nodes",
|
|
2668
|
+
docs: ["Maximum number of nodes in [MerkleDistributor]."],
|
|
2669
|
+
type: "u64"
|
|
2670
|
+
},
|
|
2671
|
+
{
|
|
2672
|
+
name: "unlock_period",
|
|
2673
|
+
docs: ["Time step (period) in seconds per which the unlock occurs"],
|
|
2674
|
+
type: "u64"
|
|
2675
|
+
},
|
|
2676
|
+
{
|
|
2677
|
+
name: "total_amount_claimed",
|
|
2678
|
+
docs: ["Total amount of tokens that have been claimed."],
|
|
2679
|
+
type: "u64"
|
|
2680
|
+
},
|
|
2681
|
+
{
|
|
2682
|
+
name: "num_nodes_claimed",
|
|
2683
|
+
docs: ["Number of nodes that have been claimed."],
|
|
2684
|
+
type: "u64"
|
|
2685
|
+
},
|
|
2686
|
+
{
|
|
2687
|
+
name: "start_ts",
|
|
2688
|
+
docs: ["Lockup time start (Unix Timestamp)"],
|
|
2689
|
+
type: "u64"
|
|
2690
|
+
},
|
|
2691
|
+
{
|
|
2692
|
+
name: "end_ts",
|
|
2693
|
+
docs: ["Lockup time end (Unix Timestamp)"],
|
|
2694
|
+
type: "u64"
|
|
2695
|
+
},
|
|
2696
|
+
{
|
|
2697
|
+
name: "clawback_start_ts",
|
|
2698
|
+
docs: ["Clawback start (Unix Timestamp)"],
|
|
2699
|
+
type: "u64"
|
|
2700
|
+
},
|
|
2701
|
+
{
|
|
2702
|
+
name: "clawback_receiver",
|
|
2703
|
+
docs: ["Clawback receiver"],
|
|
2704
|
+
type: "pubkey"
|
|
2705
|
+
},
|
|
2706
|
+
{
|
|
2707
|
+
name: "admin",
|
|
2708
|
+
docs: ["Admin wallet"],
|
|
2709
|
+
type: "pubkey"
|
|
2710
|
+
},
|
|
2711
|
+
{
|
|
2712
|
+
name: "clawed_back",
|
|
2713
|
+
docs: ["Whether or not the distributor has been clawed back"],
|
|
2714
|
+
type: "bool"
|
|
2715
|
+
},
|
|
2716
|
+
{
|
|
2717
|
+
name: "claims_closable_by_admin",
|
|
2718
|
+
docs: ["Whether claims are closable by the admin or not"],
|
|
2719
|
+
type: "bool"
|
|
2720
|
+
},
|
|
2721
|
+
{
|
|
2722
|
+
name: "can_update_duration",
|
|
2723
|
+
docs: ["Whether admin can update vesting duration"],
|
|
2724
|
+
type: "bool"
|
|
2725
|
+
},
|
|
2726
|
+
{
|
|
2727
|
+
name: "total_amount_unlocked",
|
|
2728
|
+
docs: ["Total amount of funds unlocked (cliff/instant)"],
|
|
2729
|
+
type: "u64"
|
|
2730
|
+
},
|
|
2731
|
+
{
|
|
2732
|
+
name: "total_amount_locked",
|
|
2733
|
+
docs: ["Total amount of funds locked (vested)"],
|
|
2734
|
+
type: "u64"
|
|
2735
|
+
},
|
|
2736
|
+
{
|
|
2737
|
+
name: "last_duration_update_ts",
|
|
2738
|
+
docs: ["Timestamp when update was last called"],
|
|
2739
|
+
type: "u64"
|
|
2740
|
+
},
|
|
2741
|
+
{
|
|
2742
|
+
name: "total_claimable_pre_update",
|
|
2743
|
+
docs: [
|
|
2744
|
+
"Total amount of locked amount claimable as of last duration update, ever increasing total, accumulates with each update"
|
|
2745
|
+
],
|
|
2746
|
+
type: "u64"
|
|
2747
|
+
},
|
|
2748
|
+
{
|
|
2749
|
+
name: "clawed_back_ts",
|
|
2750
|
+
docs: ["Timestamp when funds were clawed back"],
|
|
2751
|
+
type: "u64"
|
|
2752
|
+
},
|
|
2753
|
+
{
|
|
2754
|
+
name: "claims_closable_by_claimant",
|
|
2755
|
+
docs: ["Whether claims are closable by claimant or not"],
|
|
2756
|
+
type: "bool"
|
|
2757
|
+
},
|
|
2758
|
+
{
|
|
2759
|
+
name: "claims_limit",
|
|
2760
|
+
docs: ["Limit number of claims"],
|
|
2761
|
+
type: "u16"
|
|
2762
|
+
},
|
|
2763
|
+
{
|
|
2764
|
+
name: "buffer_2",
|
|
2765
|
+
docs: ["Buffer for additional fields"],
|
|
2766
|
+
type: {
|
|
2767
|
+
array: ["u8", 20]
|
|
2768
|
+
}
|
|
2769
|
+
},
|
|
2770
|
+
{
|
|
2771
|
+
name: "buffer_3",
|
|
2772
|
+
docs: ["Buffer for additional fields"],
|
|
2773
|
+
type: {
|
|
2774
|
+
array: ["u8", 32]
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
]
|
|
2778
|
+
}
|
|
2779
|
+
},
|
|
2780
|
+
{
|
|
2781
|
+
name: "NewDistributorIx",
|
|
2782
|
+
type: {
|
|
2783
|
+
kind: "struct",
|
|
2784
|
+
fields: [
|
|
2785
|
+
{
|
|
2786
|
+
name: "version",
|
|
2787
|
+
type: "u64"
|
|
2788
|
+
},
|
|
2789
|
+
{
|
|
2790
|
+
name: "root",
|
|
2791
|
+
type: {
|
|
2792
|
+
array: ["u8", 32]
|
|
2793
|
+
}
|
|
2794
|
+
},
|
|
2795
|
+
{
|
|
2796
|
+
name: "max_total_claim",
|
|
2797
|
+
type: "u64"
|
|
2798
|
+
},
|
|
2799
|
+
{
|
|
2800
|
+
name: "max_num_nodes",
|
|
2801
|
+
type: "u64"
|
|
2802
|
+
},
|
|
2803
|
+
{
|
|
2804
|
+
name: "unlock_period",
|
|
2805
|
+
type: "u64"
|
|
2806
|
+
},
|
|
2807
|
+
{
|
|
2808
|
+
name: "start_vesting_ts",
|
|
2809
|
+
type: "u64"
|
|
2810
|
+
},
|
|
2811
|
+
{
|
|
2812
|
+
name: "end_vesting_ts",
|
|
2813
|
+
type: "u64"
|
|
2814
|
+
},
|
|
2815
|
+
{
|
|
2816
|
+
name: "clawback_start_ts",
|
|
2817
|
+
type: "u64"
|
|
2818
|
+
},
|
|
2819
|
+
{
|
|
2820
|
+
name: "claims_closable",
|
|
2821
|
+
type: "bool"
|
|
2822
|
+
},
|
|
2823
|
+
{
|
|
2824
|
+
name: "total_amount_unlocked",
|
|
2825
|
+
type: "u64"
|
|
2826
|
+
},
|
|
2827
|
+
{
|
|
2828
|
+
name: "total_amount_locked",
|
|
2829
|
+
type: "u64"
|
|
2830
|
+
},
|
|
2831
|
+
{
|
|
2832
|
+
name: "update_period",
|
|
2833
|
+
type: "u64"
|
|
2834
|
+
},
|
|
2835
|
+
{
|
|
2836
|
+
name: "oracle_type",
|
|
2837
|
+
type: {
|
|
2838
|
+
defined: {
|
|
2839
|
+
name: "OracleType"
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
},
|
|
2843
|
+
{
|
|
2844
|
+
name: "min_price",
|
|
2845
|
+
type: "u64"
|
|
2846
|
+
},
|
|
2847
|
+
{
|
|
2848
|
+
name: "max_price",
|
|
2849
|
+
type: "u64"
|
|
2850
|
+
},
|
|
2851
|
+
{
|
|
2852
|
+
name: "min_percentage",
|
|
2853
|
+
type: "u64"
|
|
2854
|
+
},
|
|
2855
|
+
{
|
|
2856
|
+
name: "max_percentage",
|
|
2857
|
+
type: "u64"
|
|
2858
|
+
},
|
|
2859
|
+
{
|
|
2860
|
+
name: "tick_size",
|
|
2861
|
+
type: "u64"
|
|
2862
|
+
},
|
|
2863
|
+
{
|
|
2864
|
+
name: "skip_initial",
|
|
2865
|
+
type: "bool"
|
|
2866
|
+
}
|
|
2867
|
+
]
|
|
2868
|
+
}
|
|
2869
|
+
},
|
|
2870
|
+
{
|
|
2871
|
+
name: "OracleType",
|
|
2872
|
+
type: {
|
|
2873
|
+
kind: "enum",
|
|
2874
|
+
variants: [
|
|
2875
|
+
{
|
|
2876
|
+
name: "None"
|
|
2877
|
+
},
|
|
2878
|
+
{
|
|
2879
|
+
name: "Test"
|
|
2880
|
+
},
|
|
2881
|
+
{
|
|
2882
|
+
name: "Pyth"
|
|
2883
|
+
},
|
|
2884
|
+
{
|
|
2885
|
+
name: "Switchboard"
|
|
2886
|
+
}
|
|
2887
|
+
]
|
|
2888
|
+
}
|
|
2889
|
+
},
|
|
2890
|
+
{
|
|
2891
|
+
name: "TestOracle",
|
|
2892
|
+
type: {
|
|
2893
|
+
kind: "struct",
|
|
2894
|
+
fields: [
|
|
2895
|
+
{
|
|
2896
|
+
name: "price",
|
|
2897
|
+
type: "u64"
|
|
2898
|
+
},
|
|
2899
|
+
{
|
|
2900
|
+
name: "expo",
|
|
2901
|
+
type: "i32"
|
|
2902
|
+
},
|
|
2903
|
+
{
|
|
2904
|
+
name: "conf",
|
|
2905
|
+
type: "u64"
|
|
2906
|
+
},
|
|
2907
|
+
{
|
|
2908
|
+
name: "publish_time",
|
|
2909
|
+
type: "i64"
|
|
2910
|
+
},
|
|
2911
|
+
{
|
|
2912
|
+
name: "creator",
|
|
2913
|
+
type: "pubkey"
|
|
2914
|
+
},
|
|
2915
|
+
{
|
|
2916
|
+
name: "authority",
|
|
2917
|
+
type: "pubkey"
|
|
2918
|
+
},
|
|
2919
|
+
{
|
|
2920
|
+
name: "mint",
|
|
2921
|
+
type: "pubkey"
|
|
2922
|
+
}
|
|
2923
|
+
]
|
|
2924
|
+
}
|
|
2925
|
+
},
|
|
2926
|
+
{
|
|
2927
|
+
name: "UpdateTestOracleParams",
|
|
2928
|
+
type: {
|
|
2929
|
+
kind: "struct",
|
|
2930
|
+
fields: [
|
|
2931
|
+
{
|
|
2932
|
+
name: "price",
|
|
2933
|
+
type: "u64"
|
|
2934
|
+
},
|
|
2935
|
+
{
|
|
2936
|
+
name: "expo",
|
|
2937
|
+
type: "i32"
|
|
2938
|
+
},
|
|
2939
|
+
{
|
|
2940
|
+
name: "conf",
|
|
2941
|
+
type: "u64"
|
|
2942
|
+
},
|
|
2943
|
+
{
|
|
2944
|
+
name: "publish_time",
|
|
2945
|
+
type: "i64"
|
|
2946
|
+
}
|
|
2947
|
+
]
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
]
|
|
2951
|
+
};
|
|
2952
|
+
|
|
2953
|
+
// solana/clients/SolanaAlignedDistributorClient.ts
|
|
2954
|
+
var SolanaAlignedDistributorClient = class extends BaseDistributorClient {
|
|
2955
|
+
constructor({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler }) {
|
|
2956
|
+
super({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler });
|
|
2957
|
+
const alignedAirdropsProgram = {
|
|
2958
|
+
...aligned_distributor_default
|
|
2959
|
+
};
|
|
2960
|
+
this.alignedProxyProgram = new Program(alignedAirdropsProgram, { connection: this.connection });
|
|
2961
|
+
}
|
|
2962
|
+
getAlignedDistributorProgramId() {
|
|
2963
|
+
return this.alignedProxyProgram.programId;
|
|
2964
|
+
}
|
|
2965
|
+
getAlignedDistributorAddress(distributorAddress) {
|
|
2966
|
+
const distributorKey = new PublicKey(distributorAddress);
|
|
2967
|
+
return getAlignedDistributorPda(this.alignedProxyProgram.programId, distributorKey);
|
|
2968
|
+
}
|
|
2969
|
+
async getAlignedDistributorData(distributorAddress) {
|
|
2970
|
+
const alignedDistributorKey = this.getAlignedDistributorAddress(distributorAddress);
|
|
2971
|
+
const alignedProxy = await this.alignedProxyProgram.account.alignedDistributor.fetch(alignedDistributorKey);
|
|
2972
|
+
invariant(alignedProxy, "Aligned Distributor proxy account not found");
|
|
2973
|
+
const oracleType = Object.keys(alignedProxy.priceOracleType).find((key) => !!key);
|
|
2974
|
+
return {
|
|
2975
|
+
oracleType,
|
|
2976
|
+
minPrice: getNumberFromBN(alignedProxy.minPrice, ALIGNED_PRECISION_FACTOR_POW),
|
|
2977
|
+
maxPrice: getNumberFromBN(alignedProxy.maxPrice, ALIGNED_PRECISION_FACTOR_POW),
|
|
2978
|
+
minPercentage: getNumberFromBN(alignedProxy.minPercentage, ALIGNED_PRECISION_FACTOR_POW),
|
|
2979
|
+
maxPercentage: getNumberFromBN(alignedProxy.maxPercentage, ALIGNED_PRECISION_FACTOR_POW),
|
|
2980
|
+
priceOracle: oracleType === "none" ? void 0 : alignedProxy.priceOracle.toBase58(),
|
|
2981
|
+
sender: alignedProxy.admin.toBase58(),
|
|
2982
|
+
updatePeriod: getNumberFromBN(alignedProxy.updatePeriod, ALIGNED_PRECISION_FACTOR_POW),
|
|
2983
|
+
clawedBack: alignedProxy.distributorClawedBack,
|
|
2984
|
+
initialDuration: alignedProxy.initialDuration.toNumber(),
|
|
2985
|
+
initialPrice: getNumberFromBN(alignedProxy.initialPrice, ALIGNED_PRECISION_FACTOR_POW),
|
|
2986
|
+
lastPrice: getNumberFromBN(alignedProxy.lastPrice, ALIGNED_PRECISION_FACTOR_POW),
|
|
2987
|
+
lastDurationUpdateTs: alignedProxy.lastDurationUpdateTs.toNumber()
|
|
2988
|
+
};
|
|
2989
|
+
}
|
|
2990
|
+
async getNewDistributorInstruction(data, accounts) {
|
|
2991
|
+
const { distributor, mint, clawbackReceiver, tokenProgram, tokenVault, admin } = accounts;
|
|
2992
|
+
const baseArgs = this.getNewDistributorArgs(data);
|
|
2993
|
+
const alignedArgs = this.getNewAlignedDistributorArgs(data);
|
|
2994
|
+
const oracle = data.oracleAddress ? new PublicKey(data.oracleAddress) : getTestOraclePda(this.alignedProxyProgram.programId, mint, admin);
|
|
2995
|
+
const newDistributorIx = await this.alignedProxyProgram.methods.newDistributor({
|
|
2996
|
+
claimsClosable: baseArgs.claimsClosableByAdmin,
|
|
2997
|
+
version: baseArgs.version,
|
|
2998
|
+
root: baseArgs.root,
|
|
2999
|
+
maxTotalClaim: baseArgs.maxTotalClaim,
|
|
3000
|
+
maxNumNodes: baseArgs.maxNumNodes,
|
|
3001
|
+
unlockPeriod: baseArgs.unlockPeriod,
|
|
3002
|
+
startVestingTs: baseArgs.startVestingTs,
|
|
3003
|
+
endVestingTs: baseArgs.endVestingTs,
|
|
3004
|
+
clawbackStartTs: baseArgs.clawbackStartTs,
|
|
3005
|
+
...alignedArgs
|
|
3006
|
+
}).accounts({
|
|
3007
|
+
admin,
|
|
3008
|
+
tokenVault,
|
|
3009
|
+
distributor,
|
|
3010
|
+
clawbackReceiver,
|
|
3011
|
+
mint,
|
|
3012
|
+
tokenProgram,
|
|
3013
|
+
priceOracle: oracle
|
|
3014
|
+
}).instruction();
|
|
3015
|
+
return newDistributorIx;
|
|
3016
|
+
}
|
|
3017
|
+
async getClawbackInstruction(accounts) {
|
|
3018
|
+
const { distributor, from, to, mint, tokenProgram, admin } = accounts;
|
|
3019
|
+
const alignedDistributorKey = getAlignedDistributorPda(this.alignedProxyProgram.programId, distributor);
|
|
3020
|
+
const alignedProxy = await this.alignedProxyProgram.account.alignedDistributor.fetch(alignedDistributorKey);
|
|
3021
|
+
invariant(alignedProxy, "Aligned Distributor proxy account not found");
|
|
3022
|
+
const clawbackInstruction = await this.alignedProxyProgram.methods.clawback().accounts({
|
|
3023
|
+
admin,
|
|
3024
|
+
distributor,
|
|
3025
|
+
from,
|
|
3026
|
+
to,
|
|
3027
|
+
mint,
|
|
3028
|
+
tokenProgram
|
|
3029
|
+
}).instruction();
|
|
3030
|
+
return clawbackInstruction;
|
|
3031
|
+
}
|
|
3032
|
+
getNewAlignedDistributorArgs(data) {
|
|
3033
|
+
const {
|
|
3034
|
+
oracleType,
|
|
3035
|
+
minPrice,
|
|
3036
|
+
maxPrice,
|
|
3037
|
+
minPercentage,
|
|
3038
|
+
maxPercentage,
|
|
3039
|
+
tickSize,
|
|
3040
|
+
skipInitial,
|
|
3041
|
+
totalAmountLocked,
|
|
3042
|
+
totalAmountUnlocked,
|
|
3043
|
+
unlockPeriod
|
|
3044
|
+
} = data;
|
|
3045
|
+
return {
|
|
3046
|
+
totalAmountLocked: new BN6(totalAmountLocked),
|
|
3047
|
+
totalAmountUnlocked: new BN6(totalAmountUnlocked),
|
|
3048
|
+
oracleType: !!oracleType ? { [oracleType]: {} } : { none: {} },
|
|
3049
|
+
minPrice: getBN(minPrice, ALIGNED_PRECISION_FACTOR_POW),
|
|
3050
|
+
maxPrice: getBN(maxPrice, ALIGNED_PRECISION_FACTOR_POW),
|
|
3051
|
+
minPercentage: getBN(minPercentage, ALIGNED_PRECISION_FACTOR_POW),
|
|
3052
|
+
maxPercentage: getBN(maxPercentage, ALIGNED_PRECISION_FACTOR_POW),
|
|
3053
|
+
tickSize: new BN6(tickSize || 1),
|
|
3054
|
+
skipInitial: skipInitial ?? false,
|
|
3055
|
+
updatePeriod: unlockPeriod < 30 ? new BN6(30) : new BN6(unlockPeriod)
|
|
3056
|
+
};
|
|
3057
|
+
}
|
|
3058
|
+
};
|
|
3059
|
+
|
|
3060
|
+
export { solana_exports as StreamflowDistributorSolana };
|
|
3061
|
+
//# sourceMappingURL=index.js.map
|
|
3062
|
+
//# sourceMappingURL=index.js.map
|