@streamflow/distributor 7.0.0-alpha.1 → 7.0.0-alpha.11
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/README.md +20 -5
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/solana/client.js +199 -347
- package/dist/cjs/solana/constants.js +11 -9
- package/dist/cjs/solana/generated/accounts/ClaimStatus.js +52 -110
- package/dist/cjs/solana/generated/accounts/MerkleDistributor.js +67 -125
- package/dist/cjs/solana/generated/errors/anchor.js +540 -717
- package/dist/cjs/solana/generated/errors/custom.js +171 -243
- package/dist/cjs/solana/generated/errors/index.js +12 -51
- package/dist/cjs/solana/generated/instructions/claimLocked.js +7 -8
- package/dist/cjs/solana/generated/instructions/clawback.js +8 -9
- package/dist/cjs/solana/generated/instructions/closeClaim.js +8 -9
- package/dist/cjs/solana/generated/instructions/newClaim.js +10 -11
- package/dist/cjs/solana/generated/instructions/newDistributor.js +17 -12
- package/dist/cjs/solana/generated/instructions/setAdmin.js +8 -9
- package/dist/cjs/solana/generated/instructions/setClawbackReceiver.js +8 -9
- package/dist/cjs/solana/generated/programId.js +1 -1
- package/dist/cjs/solana/index.js +6 -6
- package/dist/cjs/solana/utils.js +38 -92
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/solana/client.d.ts +3 -1
- package/dist/esm/solana/client.js +44 -18
- package/dist/esm/solana/constants.d.ts +3 -0
- package/dist/esm/solana/constants.js +3 -0
- package/dist/esm/solana/generated/accounts/ClaimStatus.d.ts +11 -11
- package/dist/esm/solana/generated/accounts/ClaimStatus.js +6 -6
- package/dist/esm/solana/generated/accounts/MerkleDistributor.d.ts +19 -19
- package/dist/esm/solana/generated/accounts/MerkleDistributor.js +10 -10
- package/dist/esm/solana/generated/instructions/newClaim.d.ts +3 -3
- package/dist/esm/solana/generated/instructions/newDistributor.d.ts +8 -8
- package/dist/esm/solana/generated/instructions/newDistributor.js +6 -0
- package/dist/esm/solana/index.d.ts +6 -6
- package/dist/esm/solana/index.js +6 -6
- package/dist/esm/solana/types.d.ts +9 -5
- package/package.json +7 -8
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { PublicKey, Connection } from "@solana/web3.js";
|
|
3
|
-
import
|
|
3
|
+
import BigNumber from "bignumber.js";
|
|
4
4
|
export interface MerkleDistributorFields {
|
|
5
5
|
/** Bump seed. */
|
|
6
6
|
bump: number;
|
|
7
7
|
/** Version of the airdrop */
|
|
8
|
-
version:
|
|
8
|
+
version: BigNumber;
|
|
9
9
|
/** The 256-bit merkle root. */
|
|
10
10
|
root: Array<number>;
|
|
11
11
|
/** [Mint] of the token to be distributed. */
|
|
@@ -13,21 +13,21 @@ export interface MerkleDistributorFields {
|
|
|
13
13
|
/** Token Address of the vault */
|
|
14
14
|
tokenVault: PublicKey;
|
|
15
15
|
/** Maximum number of tokens that can ever be claimed from this [MerkleDistributor]. */
|
|
16
|
-
maxTotalClaim:
|
|
16
|
+
maxTotalClaim: BigNumber;
|
|
17
17
|
/** Maximum number of nodes in [MerkleDistributor]. */
|
|
18
|
-
maxNumNodes:
|
|
18
|
+
maxNumNodes: BigNumber;
|
|
19
19
|
/** Time step (period) in seconds per which the unlock occurs */
|
|
20
|
-
unlockPeriod:
|
|
20
|
+
unlockPeriod: BigNumber;
|
|
21
21
|
/** Total amount of tokens that have been claimed. */
|
|
22
|
-
totalAmountClaimed:
|
|
22
|
+
totalAmountClaimed: BigNumber;
|
|
23
23
|
/** Number of nodes that have been claimed. */
|
|
24
|
-
numNodesClaimed:
|
|
24
|
+
numNodesClaimed: BigNumber;
|
|
25
25
|
/** Lockup time start (Unix Timestamp) */
|
|
26
|
-
startTs:
|
|
26
|
+
startTs: BigNumber;
|
|
27
27
|
/** Lockup time end (Unix Timestamp) */
|
|
28
|
-
endTs:
|
|
28
|
+
endTs: BigNumber;
|
|
29
29
|
/** Clawback start (Unix Timestamp) */
|
|
30
|
-
clawbackStartTs:
|
|
30
|
+
clawbackStartTs: BigNumber;
|
|
31
31
|
/** Clawback receiver */
|
|
32
32
|
clawbackReceiver: PublicKey;
|
|
33
33
|
/** Admin wallet */
|
|
@@ -90,7 +90,7 @@ export declare class MerkleDistributor {
|
|
|
90
90
|
/** Bump seed. */
|
|
91
91
|
readonly bump: number;
|
|
92
92
|
/** Version of the airdrop */
|
|
93
|
-
readonly version:
|
|
93
|
+
readonly version: BigNumber;
|
|
94
94
|
/** The 256-bit merkle root. */
|
|
95
95
|
readonly root: Array<number>;
|
|
96
96
|
/** [Mint] of the token to be distributed. */
|
|
@@ -98,21 +98,21 @@ export declare class MerkleDistributor {
|
|
|
98
98
|
/** Token Address of the vault */
|
|
99
99
|
readonly tokenVault: PublicKey;
|
|
100
100
|
/** Maximum number of tokens that can ever be claimed from this [MerkleDistributor]. */
|
|
101
|
-
readonly maxTotalClaim:
|
|
101
|
+
readonly maxTotalClaim: BigNumber;
|
|
102
102
|
/** Maximum number of nodes in [MerkleDistributor]. */
|
|
103
|
-
readonly maxNumNodes:
|
|
103
|
+
readonly maxNumNodes: BigNumber;
|
|
104
104
|
/** Time step (period) in seconds per which the unlock occurs */
|
|
105
|
-
readonly unlockPeriod:
|
|
105
|
+
readonly unlockPeriod: BigNumber;
|
|
106
106
|
/** Total amount of tokens that have been claimed. */
|
|
107
|
-
readonly totalAmountClaimed:
|
|
107
|
+
readonly totalAmountClaimed: BigNumber;
|
|
108
108
|
/** Number of nodes that have been claimed. */
|
|
109
|
-
readonly numNodesClaimed:
|
|
109
|
+
readonly numNodesClaimed: BigNumber;
|
|
110
110
|
/** Lockup time start (Unix Timestamp) */
|
|
111
|
-
readonly startTs:
|
|
111
|
+
readonly startTs: BigNumber;
|
|
112
112
|
/** Lockup time end (Unix Timestamp) */
|
|
113
|
-
readonly endTs:
|
|
113
|
+
readonly endTs: BigNumber;
|
|
114
114
|
/** Clawback start (Unix Timestamp) */
|
|
115
|
-
readonly clawbackStartTs:
|
|
115
|
+
readonly clawbackStartTs: BigNumber;
|
|
116
116
|
/** Clawback receiver */
|
|
117
117
|
readonly clawbackReceiver: PublicKey;
|
|
118
118
|
/** Admin wallet */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
|
2
|
-
import
|
|
2
|
+
import BigNumber from "bignumber.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
3
|
import * as borsh from "@coral-xyz/borsh"; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
4
|
import { PROGRAM_ID } from "../programId";
|
|
5
5
|
/** State for the account which distributes tokens. */
|
|
@@ -166,18 +166,18 @@ export class MerkleDistributor {
|
|
|
166
166
|
static fromJSON(obj) {
|
|
167
167
|
return new MerkleDistributor({
|
|
168
168
|
bump: obj.bump,
|
|
169
|
-
version:
|
|
169
|
+
version: BigNumber(obj.version),
|
|
170
170
|
root: obj.root,
|
|
171
171
|
mint: new PublicKey(obj.mint),
|
|
172
172
|
tokenVault: new PublicKey(obj.tokenVault),
|
|
173
|
-
maxTotalClaim:
|
|
174
|
-
maxNumNodes:
|
|
175
|
-
unlockPeriod:
|
|
176
|
-
totalAmountClaimed:
|
|
177
|
-
numNodesClaimed:
|
|
178
|
-
startTs:
|
|
179
|
-
endTs:
|
|
180
|
-
clawbackStartTs:
|
|
173
|
+
maxTotalClaim: BigNumber(obj.maxTotalClaim),
|
|
174
|
+
maxNumNodes: BigNumber(obj.maxNumNodes),
|
|
175
|
+
unlockPeriod: BigNumber(obj.unlockPeriod),
|
|
176
|
+
totalAmountClaimed: BigNumber(obj.totalAmountClaimed),
|
|
177
|
+
numNodesClaimed: BigNumber(obj.numNodesClaimed),
|
|
178
|
+
startTs: BigNumber(obj.startTs),
|
|
179
|
+
endTs: BigNumber(obj.endTs),
|
|
180
|
+
clawbackStartTs: BigNumber(obj.clawbackStartTs),
|
|
181
181
|
clawbackReceiver: new PublicKey(obj.clawbackReceiver),
|
|
182
182
|
admin: new PublicKey(obj.admin),
|
|
183
183
|
clawedBack: obj.clawedBack,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TransactionInstruction, PublicKey } from "@solana/web3.js";
|
|
2
|
-
import
|
|
2
|
+
import BigNumber from "bignumber.js";
|
|
3
3
|
export interface NewClaimArgs {
|
|
4
|
-
amountUnlocked:
|
|
5
|
-
amountLocked:
|
|
4
|
+
amountUnlocked: BigNumber;
|
|
5
|
+
amountLocked: BigNumber;
|
|
6
6
|
proof: Array<Array<number>>;
|
|
7
7
|
}
|
|
8
8
|
export interface NewClaimAccounts {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { TransactionInstruction, PublicKey } from "@solana/web3.js";
|
|
2
|
-
import
|
|
2
|
+
import BigNumber from "bignumber.js";
|
|
3
3
|
export interface NewDistributorArgs {
|
|
4
|
-
version:
|
|
4
|
+
version: BigNumber;
|
|
5
5
|
root: Array<number>;
|
|
6
|
-
maxTotalClaim:
|
|
7
|
-
maxNumNodes:
|
|
8
|
-
unlockPeriod:
|
|
9
|
-
startVestingTs:
|
|
10
|
-
endVestingTs:
|
|
11
|
-
clawbackStartTs:
|
|
6
|
+
maxTotalClaim: BigNumber;
|
|
7
|
+
maxNumNodes: BigNumber;
|
|
8
|
+
unlockPeriod: BigNumber;
|
|
9
|
+
startVestingTs: BigNumber;
|
|
10
|
+
endVestingTs: BigNumber;
|
|
11
|
+
clawbackStartTs: BigNumber;
|
|
12
12
|
claimsClosable: boolean;
|
|
13
13
|
}
|
|
14
14
|
export interface NewDistributorAccounts {
|
|
@@ -12,6 +12,9 @@ export const layout = borsh.struct([
|
|
|
12
12
|
borsh.u64("endVestingTs"),
|
|
13
13
|
borsh.u64("clawbackStartTs"),
|
|
14
14
|
borsh.bool("claimsClosable"),
|
|
15
|
+
borsh.option(borsh.bool(), "canUpdateDuration"),
|
|
16
|
+
borsh.option(borsh.u64(), "totalAmountUnlocked"),
|
|
17
|
+
borsh.option(borsh.u64(), "totalAmountLocked"),
|
|
15
18
|
]);
|
|
16
19
|
/**
|
|
17
20
|
* READ THE FOLLOWING:
|
|
@@ -60,6 +63,9 @@ export function newDistributor(args, accounts, programId = PROGRAM_ID) {
|
|
|
60
63
|
endVestingTs: args.endVestingTs,
|
|
61
64
|
clawbackStartTs: args.clawbackStartTs,
|
|
62
65
|
claimsClosable: args.claimsClosable,
|
|
66
|
+
canUpdateDuration: null,
|
|
67
|
+
totalAmountUnlocked: null,
|
|
68
|
+
totalAmountLocked: null,
|
|
63
69
|
}, buffer);
|
|
64
70
|
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len);
|
|
65
71
|
const ix = new TransactionInstruction({ keys, programId, data });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { default as SolanaDistributorClient } from "./client";
|
|
2
|
-
export * from "./generated/accounts";
|
|
3
|
-
export * from "./generated/errors";
|
|
4
|
-
export * from "./generated/instructions";
|
|
5
|
-
export * from "./utils";
|
|
6
|
-
export * from "./types";
|
|
7
|
-
export * as constants from "./constants";
|
|
2
|
+
export * from "./generated/accounts/index.js";
|
|
3
|
+
export * from "./generated/errors/index.js";
|
|
4
|
+
export * from "./generated/instructions/index.js";
|
|
5
|
+
export * from "./utils.js";
|
|
6
|
+
export * from "./types.js";
|
|
7
|
+
export * as constants from "./constants.js";
|
package/dist/esm/solana/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { default as SolanaDistributorClient } from "./client";
|
|
2
|
-
export * from "./generated/accounts";
|
|
3
|
-
export * from "./generated/errors";
|
|
4
|
-
export * from "./generated/instructions";
|
|
5
|
-
export * from "./utils";
|
|
6
|
-
export * from "./types";
|
|
7
|
-
export * as constants from "./constants";
|
|
2
|
+
export * from "./generated/accounts/index.js";
|
|
3
|
+
export * from "./generated/errors/index.js";
|
|
4
|
+
export * from "./generated/instructions/index.js";
|
|
5
|
+
export * from "./utils.js";
|
|
6
|
+
export * from "./types.js";
|
|
7
|
+
export * as constants from "./constants.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import BN from "bn.js";
|
|
2
1
|
import { SignerWalletAdapter } from "@solana/wallet-adapter-base";
|
|
3
2
|
import { Keypair } from "@solana/web3.js";
|
|
4
3
|
import { ITransactionResult } from "@streamflow/common";
|
|
5
4
|
import { ITransactionSolanaExt } from "@streamflow/common/solana";
|
|
5
|
+
import BigNumber from "bignumber.js";
|
|
6
6
|
export interface IInteractSolanaExt extends ITransactionSolanaExt {
|
|
7
7
|
invoker: SignerWalletAdapter | Keypair;
|
|
8
8
|
}
|
|
@@ -13,8 +13,8 @@ export interface ICreateDistributorData {
|
|
|
13
13
|
mint: string;
|
|
14
14
|
version: number;
|
|
15
15
|
root: Array<number>;
|
|
16
|
-
maxTotalClaim:
|
|
17
|
-
maxNumNodes:
|
|
16
|
+
maxTotalClaim: BigNumber;
|
|
17
|
+
maxNumNodes: number | string;
|
|
18
18
|
unlockPeriod: number;
|
|
19
19
|
startVestingTs: number;
|
|
20
20
|
endVestingTs: number;
|
|
@@ -23,8 +23,8 @@ export interface ICreateDistributorData {
|
|
|
23
23
|
}
|
|
24
24
|
export interface IClaimData {
|
|
25
25
|
id: string;
|
|
26
|
-
amountUnlocked:
|
|
27
|
-
amountLocked:
|
|
26
|
+
amountUnlocked: BigNumber;
|
|
27
|
+
amountLocked: BigNumber;
|
|
28
28
|
proof: Array<Array<number>>;
|
|
29
29
|
}
|
|
30
30
|
export interface IClawbackData {
|
|
@@ -37,6 +37,10 @@ export interface IGetClaimData {
|
|
|
37
37
|
export interface IGetDistributors {
|
|
38
38
|
ids: string[];
|
|
39
39
|
}
|
|
40
|
+
export interface ISearchDistributors {
|
|
41
|
+
mint?: string;
|
|
42
|
+
admin?: string;
|
|
43
|
+
}
|
|
40
44
|
export interface ISetDataAdmin {
|
|
41
45
|
id: string;
|
|
42
46
|
newAdmin: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamflow/distributor",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.11",
|
|
4
4
|
"description": "JavaScript SDK to interact with Streamflow Airdrop protocol.",
|
|
5
5
|
"homepage": "https://github.com/streamflow-finance/js-sdk/",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -26,21 +26,20 @@
|
|
|
26
26
|
"lint": "eslint --fix .",
|
|
27
27
|
"prepublishOnly": "npm run lint && npm run build"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "679b809cff3ff71f90122bbe985da3f35834452e",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@streamflow/eslint-config": "7.0.0-alpha.
|
|
32
|
-
"@types/bn.js": "5.1.1",
|
|
31
|
+
"@streamflow/eslint-config": "7.0.0-alpha.11",
|
|
33
32
|
"date-fns": "2.28.0",
|
|
34
33
|
"typescript": "^4.9.5"
|
|
35
34
|
},
|
|
36
35
|
"dependencies": {
|
|
37
|
-
"@coral-xyz/borsh": "
|
|
36
|
+
"@coral-xyz/borsh": "0.30.1",
|
|
38
37
|
"@solana/buffer-layout": "4.0.1 ",
|
|
39
38
|
"@solana/spl-token": "0.3.6",
|
|
40
39
|
"@solana/wallet-adapter-base": "0.9.19",
|
|
41
|
-
"@solana/web3.js": "1.
|
|
42
|
-
"@streamflow/common": "7.0.0-alpha.
|
|
43
|
-
"
|
|
40
|
+
"@solana/web3.js": "1.90.2",
|
|
41
|
+
"@streamflow/common": "7.0.0-alpha.11",
|
|
42
|
+
"bignumber.js": "^9.1.2",
|
|
44
43
|
"borsh": "^2.0.0",
|
|
45
44
|
"bs58": "5.0.0",
|
|
46
45
|
"p-queue": "^8.0.1"
|