@streamflow/distributor 7.0.0-alpha.1 → 7.0.0-alpha.2

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 CHANGED
@@ -24,7 +24,6 @@ API Documentation available here: [docs site →](https://streamflow-finance.git
24
24
  Most common imports:
25
25
 
26
26
  ```javascript
27
- import { BN } from "bn.js";
28
27
  import { ICluster } from "@streamflow/common";
29
28
  import { SolanaDistributorClient } from "@streamflow/distributor/solana";
30
29
  ```
@@ -60,8 +59,8 @@ const res = await client.create(
60
59
  54, 218, 49, 68, 131, 214, 250, 113, 37, 143, 167, 73, 17, 54, 233, 26, 141, 93, 28, 186, 137, 211, 251, 205,
61
60
  240, 192, 134, 208, 108, 246, 0, 191,
62
61
  ], // Merkle root
63
- maxNumNodes: new BN("4"), // Number of recipients
64
- maxTotalClaim: new BN("4000000000"), // Total amount to distribute
62
+ maxNumNodes: 4, // Number of recipients
63
+ maxTotalClaim: "4000000000", // Total amount to distribute
65
64
  unlockPeriod: 1, // Unlock period in seconds
66
65
  startVestingTs: 0, // Timestamp when Airdrop starts
67
66
  endVestingTs: now + 3600 * 24 * 7, // Timestamp when Airdrop ends
@@ -92,8 +91,8 @@ const claimRes = await client.claim(
92
91
  43, 104, 75, 183, 12, 38, 37, 153,
93
92
  ],
94
93
  ], // Merkle Proof used to verify claim
95
- amountUnlocked: new BN("0"), // Total amount unlocked for a Recipient
96
- amountLocked: new BN("1000000000"), // Total amount locked for a Recipient
94
+ amountUnlocked: "0", // Total amount unlocked for a Recipient
95
+ amountLocked: "1000000000", // Total amount locked for a Recipient
97
96
  },
98
97
  solanaParams,
99
98
  );
@@ -64,7 +64,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
64
64
  return (mod && mod.__esModule) ? mod : { "default": mod };
65
65
  };
66
66
  Object.defineProperty(exports, "__esModule", { value: true });
67
- var bn_js_1 = __importDefault(require("bn.js"));
67
+ var bignumber_js_1 = __importDefault(require("bignumber.js"));
68
68
  var spl_token_1 = require("@solana/spl-token");
69
69
  var web3_js_1 = require("@solana/web3.js");
70
70
  var common_1 = require("@streamflow/common");
@@ -137,14 +137,14 @@ var SolanaDistributorClient = /** @class */ (function () {
137
137
  case 3:
138
138
  senderTokens = _g.sent();
139
139
  args = {
140
- version: new bn_js_1.default(data.version, 10),
140
+ version: (0, bignumber_js_1.default)(data.version),
141
141
  root: data.root,
142
- maxTotalClaim: data.maxTotalClaim,
143
- maxNumNodes: data.maxNumNodes,
144
- unlockPeriod: new bn_js_1.default(data.unlockPeriod, 10),
145
- startVestingTs: new bn_js_1.default(data.startVestingTs, 10),
146
- endVestingTs: new bn_js_1.default(data.endVestingTs, 10),
147
- clawbackStartTs: new bn_js_1.default(data.clawbackStartTs, 10),
142
+ maxTotalClaim: (0, bignumber_js_1.default)(data.maxTotalClaim),
143
+ maxNumNodes: (0, bignumber_js_1.default)(data.maxNumNodes),
144
+ unlockPeriod: (0, bignumber_js_1.default)(data.unlockPeriod),
145
+ startVestingTs: (0, bignumber_js_1.default)(data.startVestingTs),
146
+ endVestingTs: (0, bignumber_js_1.default)(data.endVestingTs),
147
+ clawbackStartTs: (0, bignumber_js_1.default)(data.clawbackStartTs),
148
148
  claimsClosable: data.claimsClosable,
149
149
  };
150
150
  accounts = {
@@ -161,15 +161,15 @@ var SolanaDistributorClient = /** @class */ (function () {
161
161
  _c = (_b = ixs.push).apply;
162
162
  _d = [ixs];
163
163
  _e = [[]];
164
- return [4 /*yield*/, (0, solana_1.prepareWrappedAccount)(this.connection, extParams.invoker.publicKey, data.maxTotalClaim)];
164
+ return [4 /*yield*/, (0, solana_1.prepareWrappedAccount)(this.connection, extParams.invoker.publicKey, (0, bignumber_js_1.default)(data.maxTotalClaim))];
165
165
  case 4:
166
166
  _c.apply(_b, _d.concat([__spreadArray.apply(void 0, _e.concat([__read.apply(void 0, [(_g.sent())]), false]))]));
167
167
  _g.label = 5;
168
168
  case 5:
169
- nowTs = new bn_js_1.default(Math.floor(Date.now() / 1000));
170
- endVestingTs = args.endVestingTs.eqn(0) ? nowTs : args.endVestingTs;
171
- startVestingTs = args.startVestingTs.eqn(0) ? nowTs : args.startVestingTs;
172
- if (endVestingTs.gt(startVestingTs) && endVestingTs.sub(startVestingTs).lt(args.unlockPeriod)) {
169
+ nowTs = (0, bignumber_js_1.default)(Math.floor(Date.now() / 1000));
170
+ endVestingTs = args.endVestingTs.isZero() ? nowTs : args.endVestingTs;
171
+ startVestingTs = args.startVestingTs.isZero() ? nowTs : args.startVestingTs;
172
+ if (endVestingTs.gt(startVestingTs) && endVestingTs.minus(startVestingTs).lt(args.unlockPeriod)) {
173
173
  throw new Error("The unlock period cannot be longer than the total vesting duration!");
174
174
  }
175
175
  ixs.push((0, instructions_1.newDistributor)(args, accounts, this.programId));
@@ -258,14 +258,15 @@ var SolanaDistributorClient = /** @class */ (function () {
258
258
  };
259
259
  if (!claimStatus) {
260
260
  args = {
261
- amountLocked: data.amountLocked,
262
- amountUnlocked: data.amountUnlocked,
261
+ amountLocked: (0, bignumber_js_1.default)(data.amountLocked),
262
+ amountUnlocked: (0, bignumber_js_1.default)(data.amountUnlocked),
263
263
  proof: data.proof,
264
264
  };
265
265
  ixs.push((0, instructions_1.newClaim)(args, accounts, this.programId));
266
266
  }
267
- nowTs = new bn_js_1.default(Math.floor(Date.now() / 1000));
268
- if (claimStatus || (data.amountLocked.gtn(0) && nowTs.sub(distributor.startTs).gte(distributor.unlockPeriod))) {
267
+ nowTs = (0, bignumber_js_1.default)(Math.floor(Date.now() / 1000));
268
+ if (claimStatus ||
269
+ ((0, bignumber_js_1.default)(data.amountLocked).gt(0) && nowTs.minus(distributor.startTs).gte(distributor.unlockPeriod))) {
269
270
  ixs.push((0, instructions_1.claimLocked)(accounts, this.programId));
270
271
  }
271
272
  return [2 /*return*/, ixs];
@@ -64,7 +64,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
64
64
  Object.defineProperty(exports, "__esModule", { value: true });
65
65
  exports.ClaimStatus = void 0;
66
66
  var web3_js_1 = require("@solana/web3.js");
67
- var bn_js_1 = __importDefault(require("bn.js")); // eslint-disable-line @typescript-eslint/no-unused-vars
67
+ var bignumber_js_1 = __importDefault(require("bignumber.js")); // eslint-disable-line @typescript-eslint/no-unused-vars
68
68
  var borsh = __importStar(require("@coral-xyz/borsh")); // eslint-disable-line @typescript-eslint/no-unused-vars
69
69
  var programId_1 = require("../programId");
70
70
  /** Holds whether or not a claimant has claimed tokens. */
@@ -156,11 +156,11 @@ var ClaimStatus = /** @class */ (function () {
156
156
  ClaimStatus.fromJSON = function (obj) {
157
157
  return new ClaimStatus({
158
158
  claimant: new web3_js_1.PublicKey(obj.claimant),
159
- lockedAmount: new bn_js_1.default(obj.lockedAmount),
160
- lockedAmountWithdrawn: new bn_js_1.default(obj.lockedAmountWithdrawn),
161
- unlockedAmount: new bn_js_1.default(obj.unlockedAmount),
162
- lastClaimTs: new bn_js_1.default(obj.lastClaimTs),
163
- lastAmountPerUnlock: new bn_js_1.default(obj.lastAmountPerUnlock),
159
+ lockedAmount: (0, bignumber_js_1.default)(obj.lockedAmount),
160
+ lockedAmountWithdrawn: (0, bignumber_js_1.default)(obj.lockedAmountWithdrawn),
161
+ unlockedAmount: (0, bignumber_js_1.default)(obj.unlockedAmount),
162
+ lastClaimTs: (0, bignumber_js_1.default)(obj.lastClaimTs),
163
+ lastAmountPerUnlock: (0, bignumber_js_1.default)(obj.lastAmountPerUnlock),
164
164
  closed: obj.closed,
165
165
  buffer1: obj.buffer1,
166
166
  buffer2: obj.buffer2,
@@ -64,7 +64,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
64
64
  Object.defineProperty(exports, "__esModule", { value: true });
65
65
  exports.MerkleDistributor = void 0;
66
66
  var web3_js_1 = require("@solana/web3.js");
67
- var bn_js_1 = __importDefault(require("bn.js")); // eslint-disable-line @typescript-eslint/no-unused-vars
67
+ var bignumber_js_1 = __importDefault(require("bignumber.js")); // eslint-disable-line @typescript-eslint/no-unused-vars
68
68
  var borsh = __importStar(require("@coral-xyz/borsh")); // eslint-disable-line @typescript-eslint/no-unused-vars
69
69
  var programId_1 = require("../programId");
70
70
  /** State for the account which distributes tokens. */
@@ -189,18 +189,18 @@ var MerkleDistributor = /** @class */ (function () {
189
189
  MerkleDistributor.fromJSON = function (obj) {
190
190
  return new MerkleDistributor({
191
191
  bump: obj.bump,
192
- version: new bn_js_1.default(obj.version),
192
+ version: (0, bignumber_js_1.default)(obj.version),
193
193
  root: obj.root,
194
194
  mint: new web3_js_1.PublicKey(obj.mint),
195
195
  tokenVault: new web3_js_1.PublicKey(obj.tokenVault),
196
- maxTotalClaim: new bn_js_1.default(obj.maxTotalClaim),
197
- maxNumNodes: new bn_js_1.default(obj.maxNumNodes),
198
- unlockPeriod: new bn_js_1.default(obj.unlockPeriod),
199
- totalAmountClaimed: new bn_js_1.default(obj.totalAmountClaimed),
200
- numNodesClaimed: new bn_js_1.default(obj.numNodesClaimed),
201
- startTs: new bn_js_1.default(obj.startTs),
202
- endTs: new bn_js_1.default(obj.endTs),
203
- clawbackStartTs: new bn_js_1.default(obj.clawbackStartTs),
196
+ maxTotalClaim: (0, bignumber_js_1.default)(obj.maxTotalClaim),
197
+ maxNumNodes: (0, bignumber_js_1.default)(obj.maxNumNodes),
198
+ unlockPeriod: (0, bignumber_js_1.default)(obj.unlockPeriod),
199
+ totalAmountClaimed: (0, bignumber_js_1.default)(obj.totalAmountClaimed),
200
+ numNodesClaimed: (0, bignumber_js_1.default)(obj.numNodesClaimed),
201
+ startTs: (0, bignumber_js_1.default)(obj.startTs),
202
+ endTs: (0, bignumber_js_1.default)(obj.endTs),
203
+ clawbackStartTs: (0, bignumber_js_1.default)(obj.clawbackStartTs),
204
204
  clawbackReceiver: new web3_js_1.PublicKey(obj.clawbackReceiver),
205
205
  admin: new web3_js_1.PublicKey(obj.admin),
206
206
  clawedBack: obj.clawedBack,
@@ -1,4 +1,4 @@
1
- import BN from "bn.js";
1
+ import BigNumber from "bignumber.js";
2
2
  import { ASSOCIATED_TOKEN_PROGRAM_ID, NATIVE_MINT, createTransferCheckedInstruction, createTransferCheckedWithFeeInstruction, getTransferFeeConfig, } from "@solana/spl-token";
3
3
  import { Connection, PublicKey, SystemProgram, } from "@solana/web3.js";
4
4
  import { ICluster } from "@streamflow/common";
@@ -50,14 +50,14 @@ export default class SolanaDistributorClient {
50
50
  const tokenVault = await ata(mint, distributorPublicKey, tokenProgramId);
51
51
  const senderTokens = await ata(mint, extParams.invoker.publicKey, tokenProgramId);
52
52
  const args = {
53
- version: new BN(data.version, 10),
53
+ version: BigNumber(data.version),
54
54
  root: data.root,
55
- maxTotalClaim: data.maxTotalClaim,
56
- maxNumNodes: data.maxNumNodes,
57
- unlockPeriod: new BN(data.unlockPeriod, 10),
58
- startVestingTs: new BN(data.startVestingTs, 10),
59
- endVestingTs: new BN(data.endVestingTs, 10),
60
- clawbackStartTs: new BN(data.clawbackStartTs, 10),
55
+ maxTotalClaim: BigNumber(data.maxTotalClaim),
56
+ maxNumNodes: BigNumber(data.maxNumNodes),
57
+ unlockPeriod: BigNumber(data.unlockPeriod),
58
+ startVestingTs: BigNumber(data.startVestingTs),
59
+ endVestingTs: BigNumber(data.endVestingTs),
60
+ clawbackStartTs: BigNumber(data.clawbackStartTs),
61
61
  claimsClosable: data.claimsClosable,
62
62
  };
63
63
  const accounts = {
@@ -71,12 +71,12 @@ export default class SolanaDistributorClient {
71
71
  tokenProgram: tokenProgramId,
72
72
  };
73
73
  if (extParams.isNative) {
74
- ixs.push(...(await prepareWrappedAccount(this.connection, extParams.invoker.publicKey, data.maxTotalClaim)));
74
+ ixs.push(...(await prepareWrappedAccount(this.connection, extParams.invoker.publicKey, BigNumber(data.maxTotalClaim))));
75
75
  }
76
- const nowTs = new BN(Math.floor(Date.now() / 1000));
77
- const endVestingTs = args.endVestingTs.eqn(0) ? nowTs : args.endVestingTs;
78
- const startVestingTs = args.startVestingTs.eqn(0) ? nowTs : args.startVestingTs;
79
- if (endVestingTs.gt(startVestingTs) && endVestingTs.sub(startVestingTs).lt(args.unlockPeriod)) {
76
+ const nowTs = BigNumber(Math.floor(Date.now() / 1000));
77
+ const endVestingTs = args.endVestingTs.isZero() ? nowTs : args.endVestingTs;
78
+ const startVestingTs = args.startVestingTs.isZero() ? nowTs : args.startVestingTs;
79
+ if (endVestingTs.gt(startVestingTs) && endVestingTs.minus(startVestingTs).lt(args.unlockPeriod)) {
80
80
  throw new Error("The unlock period cannot be longer than the total vesting duration!");
81
81
  }
82
82
  ixs.push(newDistributor(args, accounts, this.programId));
@@ -129,14 +129,15 @@ export default class SolanaDistributorClient {
129
129
  };
130
130
  if (!claimStatus) {
131
131
  const args = {
132
- amountLocked: data.amountLocked,
133
- amountUnlocked: data.amountUnlocked,
132
+ amountLocked: BigNumber(data.amountLocked),
133
+ amountUnlocked: BigNumber(data.amountUnlocked),
134
134
  proof: data.proof,
135
135
  };
136
136
  ixs.push(newClaim(args, accounts, this.programId));
137
137
  }
138
- const nowTs = new BN(Math.floor(Date.now() / 1000));
139
- if (claimStatus || (data.amountLocked.gtn(0) && nowTs.sub(distributor.startTs).gte(distributor.unlockPeriod))) {
138
+ const nowTs = BigNumber(Math.floor(Date.now() / 1000));
139
+ if (claimStatus ||
140
+ (BigNumber(data.amountLocked).gt(0) && nowTs.minus(distributor.startTs).gte(distributor.unlockPeriod))) {
140
141
  ixs.push(claimLocked(accounts, this.programId));
141
142
  }
142
143
  return ixs;
@@ -1,19 +1,19 @@
1
1
  /// <reference types="node" />
2
2
  import { PublicKey, Connection } from "@solana/web3.js";
3
- import BN from "bn.js";
3
+ import BigNumber from "bignumber.js";
4
4
  export interface ClaimStatusFields {
5
5
  /** Authority that claimed the tokens. */
6
6
  claimant: PublicKey;
7
7
  /** Locked amount */
8
- lockedAmount: BN;
8
+ lockedAmount: BigNumber;
9
9
  /** Locked amount withdrawn */
10
- lockedAmountWithdrawn: BN;
10
+ lockedAmountWithdrawn: BigNumber;
11
11
  /** Unlocked amount */
12
- unlockedAmount: BN;
12
+ unlockedAmount: BigNumber;
13
13
  /** Last claim time */
14
- lastClaimTs: BN;
14
+ lastClaimTs: BigNumber;
15
15
  /** Track amount per unlock, can be useful for non-linear vesting */
16
- lastAmountPerUnlock: BN;
16
+ lastAmountPerUnlock: BigNumber;
17
17
  /** Whether claim is closed */
18
18
  closed: boolean;
19
19
  /** Buffer for additional fields */
@@ -46,15 +46,15 @@ export declare class ClaimStatus {
46
46
  /** Authority that claimed the tokens. */
47
47
  readonly claimant: PublicKey;
48
48
  /** Locked amount */
49
- readonly lockedAmount: BN;
49
+ readonly lockedAmount: BigNumber;
50
50
  /** Locked amount withdrawn */
51
- readonly lockedAmountWithdrawn: BN;
51
+ readonly lockedAmountWithdrawn: BigNumber;
52
52
  /** Unlocked amount */
53
- readonly unlockedAmount: BN;
53
+ readonly unlockedAmount: BigNumber;
54
54
  /** Last claim time */
55
- readonly lastClaimTs: BN;
55
+ readonly lastClaimTs: BigNumber;
56
56
  /** Track amount per unlock, can be useful for non-linear vesting */
57
- readonly lastAmountPerUnlock: BN;
57
+ readonly lastAmountPerUnlock: BigNumber;
58
58
  /** Whether claim is closed */
59
59
  readonly closed: boolean;
60
60
  /** Buffer for additional fields */
@@ -1,5 +1,5 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
- import BN from "bn.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
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
  /** Holds whether or not a claimant has claimed tokens. */
@@ -100,11 +100,11 @@ export class ClaimStatus {
100
100
  static fromJSON(obj) {
101
101
  return new ClaimStatus({
102
102
  claimant: new PublicKey(obj.claimant),
103
- lockedAmount: new BN(obj.lockedAmount),
104
- lockedAmountWithdrawn: new BN(obj.lockedAmountWithdrawn),
105
- unlockedAmount: new BN(obj.unlockedAmount),
106
- lastClaimTs: new BN(obj.lastClaimTs),
107
- lastAmountPerUnlock: new BN(obj.lastAmountPerUnlock),
103
+ lockedAmount: BigNumber(obj.lockedAmount),
104
+ lockedAmountWithdrawn: BigNumber(obj.lockedAmountWithdrawn),
105
+ unlockedAmount: BigNumber(obj.unlockedAmount),
106
+ lastClaimTs: BigNumber(obj.lastClaimTs),
107
+ lastAmountPerUnlock: BigNumber(obj.lastAmountPerUnlock),
108
108
  closed: obj.closed,
109
109
  buffer1: obj.buffer1,
110
110
  buffer2: obj.buffer2,
@@ -1,11 +1,11 @@
1
1
  /// <reference types="node" />
2
2
  import { PublicKey, Connection } from "@solana/web3.js";
3
- import BN from "bn.js";
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: BN;
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: BN;
16
+ maxTotalClaim: BigNumber;
17
17
  /** Maximum number of nodes in [MerkleDistributor]. */
18
- maxNumNodes: BN;
18
+ maxNumNodes: BigNumber;
19
19
  /** Time step (period) in seconds per which the unlock occurs */
20
- unlockPeriod: BN;
20
+ unlockPeriod: BigNumber;
21
21
  /** Total amount of tokens that have been claimed. */
22
- totalAmountClaimed: BN;
22
+ totalAmountClaimed: BigNumber;
23
23
  /** Number of nodes that have been claimed. */
24
- numNodesClaimed: BN;
24
+ numNodesClaimed: BigNumber;
25
25
  /** Lockup time start (Unix Timestamp) */
26
- startTs: BN;
26
+ startTs: BigNumber;
27
27
  /** Lockup time end (Unix Timestamp) */
28
- endTs: BN;
28
+ endTs: BigNumber;
29
29
  /** Clawback start (Unix Timestamp) */
30
- clawbackStartTs: BN;
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: BN;
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: BN;
101
+ readonly maxTotalClaim: BigNumber;
102
102
  /** Maximum number of nodes in [MerkleDistributor]. */
103
- readonly maxNumNodes: BN;
103
+ readonly maxNumNodes: BigNumber;
104
104
  /** Time step (period) in seconds per which the unlock occurs */
105
- readonly unlockPeriod: BN;
105
+ readonly unlockPeriod: BigNumber;
106
106
  /** Total amount of tokens that have been claimed. */
107
- readonly totalAmountClaimed: BN;
107
+ readonly totalAmountClaimed: BigNumber;
108
108
  /** Number of nodes that have been claimed. */
109
- readonly numNodesClaimed: BN;
109
+ readonly numNodesClaimed: BigNumber;
110
110
  /** Lockup time start (Unix Timestamp) */
111
- readonly startTs: BN;
111
+ readonly startTs: BigNumber;
112
112
  /** Lockup time end (Unix Timestamp) */
113
- readonly endTs: BN;
113
+ readonly endTs: BigNumber;
114
114
  /** Clawback start (Unix Timestamp) */
115
- readonly clawbackStartTs: BN;
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 BN from "bn.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
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: new BN(obj.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: new BN(obj.maxTotalClaim),
174
- maxNumNodes: new BN(obj.maxNumNodes),
175
- unlockPeriod: new BN(obj.unlockPeriod),
176
- totalAmountClaimed: new BN(obj.totalAmountClaimed),
177
- numNodesClaimed: new BN(obj.numNodesClaimed),
178
- startTs: new BN(obj.startTs),
179
- endTs: new BN(obj.endTs),
180
- clawbackStartTs: new BN(obj.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 BN from "bn.js";
2
+ import BigNumber from "bignumber.js";
3
3
  export interface NewClaimArgs {
4
- amountUnlocked: BN;
5
- amountLocked: BN;
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 BN from "bn.js";
2
+ import BigNumber from "bignumber.js";
3
3
  export interface NewDistributorArgs {
4
- version: BN;
4
+ version: BigNumber;
5
5
  root: Array<number>;
6
- maxTotalClaim: BN;
7
- maxNumNodes: BN;
8
- unlockPeriod: BN;
9
- startVestingTs: BN;
10
- endVestingTs: BN;
11
- clawbackStartTs: BN;
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 {
@@ -1,4 +1,3 @@
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";
@@ -13,8 +12,8 @@ export interface ICreateDistributorData {
13
12
  mint: string;
14
13
  version: number;
15
14
  root: Array<number>;
16
- maxTotalClaim: BN;
17
- maxNumNodes: BN;
15
+ maxTotalClaim: number | string;
16
+ maxNumNodes: number | string;
18
17
  unlockPeriod: number;
19
18
  startVestingTs: number;
20
19
  endVestingTs: number;
@@ -23,8 +22,8 @@ export interface ICreateDistributorData {
23
22
  }
24
23
  export interface IClaimData {
25
24
  id: string;
26
- amountUnlocked: BN;
27
- amountLocked: BN;
25
+ amountUnlocked: number | string;
26
+ amountLocked: number | string;
28
27
  proof: Array<Array<number>>;
29
28
  }
30
29
  export interface IClawbackData {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/distributor",
3
- "version": "7.0.0-alpha.1",
3
+ "version": "7.0.0-alpha.2",
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,10 +26,9 @@
26
26
  "lint": "eslint --fix .",
27
27
  "prepublishOnly": "npm run lint && npm run build"
28
28
  },
29
- "gitHead": "8b2be143ac1bfeaca3bcecc11eb5fa1e81f2ffb7",
29
+ "gitHead": "64926e169007ef5a65c5342a57d8e37047831015",
30
30
  "devDependencies": {
31
- "@streamflow/eslint-config": "7.0.0-alpha.1",
32
- "@types/bn.js": "5.1.1",
31
+ "@streamflow/eslint-config": "7.0.0-alpha.2",
33
32
  "date-fns": "2.28.0",
34
33
  "typescript": "^4.9.5"
35
34
  },
@@ -39,8 +38,8 @@
39
38
  "@solana/spl-token": "0.3.6",
40
39
  "@solana/wallet-adapter-base": "0.9.19",
41
40
  "@solana/web3.js": "1.70.1",
42
- "@streamflow/common": "7.0.0-alpha.1",
43
- "bn.js": "5.2.1",
41
+ "@streamflow/common": "7.0.0-alpha.2",
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"