@streamflow/distributor 7.0.0-alpha.14 → 7.0.0-alpha.16

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.
@@ -41,7 +41,7 @@ class ClaimStatus {
41
41
  this.lastClaimTs = fields.lastClaimTs;
42
42
  this.lastAmountPerUnlock = fields.lastAmountPerUnlock;
43
43
  this.closed = fields.closed;
44
- this.buffer1 = fields.buffer1;
44
+ this.distributor = fields.distributor;
45
45
  this.buffer2 = fields.buffer2;
46
46
  }
47
47
  static async fetch(c, address, programId = programId_1.PROGRAM_ID) {
@@ -79,7 +79,7 @@ class ClaimStatus {
79
79
  lastClaimTs: dec.lastClaimTs,
80
80
  lastAmountPerUnlock: dec.lastAmountPerUnlock,
81
81
  closed: dec.closed,
82
- buffer1: dec.buffer1,
82
+ distributor: dec.distributor,
83
83
  buffer2: dec.buffer2,
84
84
  });
85
85
  }
@@ -92,7 +92,7 @@ class ClaimStatus {
92
92
  lastClaimTs: this.lastClaimTs.toString(),
93
93
  lastAmountPerUnlock: this.lastAmountPerUnlock.toString(),
94
94
  closed: this.closed,
95
- buffer1: this.buffer1,
95
+ distributor: this.distributor.toString(),
96
96
  buffer2: this.buffer2,
97
97
  };
98
98
  }
@@ -105,7 +105,7 @@ class ClaimStatus {
105
105
  lastClaimTs: new bn_js_1.default(obj.lastClaimTs),
106
106
  lastAmountPerUnlock: new bn_js_1.default(obj.lastAmountPerUnlock),
107
107
  closed: obj.closed,
108
- buffer1: obj.buffer1,
108
+ distributor: new web3_js_1.PublicKey(obj.distributor),
109
109
  buffer2: obj.buffer2,
110
110
  });
111
111
  }
@@ -120,6 +120,6 @@ ClaimStatus.layout = borsh.struct([
120
120
  borsh.u64("lastClaimTs"),
121
121
  borsh.u64("lastAmountPerUnlock"),
122
122
  borsh.bool("closed"),
123
- borsh.array(borsh.u8(), 32, "buffer1"),
123
+ borsh.publicKey("distributor"),
124
124
  borsh.array(borsh.u8(), 32, "buffer2"),
125
125
  ]);
@@ -51,7 +51,12 @@ class MerkleDistributor {
51
51
  this.admin = fields.admin;
52
52
  this.clawedBack = fields.clawedBack;
53
53
  this.claimsClosable = fields.claimsClosable;
54
- this.buffer1 = fields.buffer1;
54
+ this.canUpdateDuration = fields.canUpdateDuration;
55
+ this.totalAmountUnlocked = fields.totalAmountUnlocked;
56
+ this.totalAmountLocked = fields.totalAmountLocked;
57
+ this.lastDurationUpdateTs = fields.lastDurationUpdateTs;
58
+ this.totalClaimablePreUpdate = fields.totalClaimablePreUpdate;
59
+ this.clawedBackTs = fields.clawedBackTs;
55
60
  this.buffer2 = fields.buffer2;
56
61
  this.buffer3 = fields.buffer3;
57
62
  }
@@ -100,7 +105,12 @@ class MerkleDistributor {
100
105
  admin: dec.admin,
101
106
  clawedBack: dec.clawedBack,
102
107
  claimsClosable: dec.claimsClosable,
103
- buffer1: dec.buffer1,
108
+ canUpdateDuration: dec.canUpdateDuration,
109
+ totalAmountUnlocked: dec.totalAmountUnlocked,
110
+ totalAmountLocked: dec.totalAmountLocked,
111
+ lastDurationUpdateTs: dec.lastDurationUpdateTs,
112
+ totalClaimablePreUpdate: dec.totalClaimablePreUpdate,
113
+ clawedBackTs: dec.clawedBackTs,
104
114
  buffer2: dec.buffer2,
105
115
  buffer3: dec.buffer3,
106
116
  });
@@ -124,7 +134,12 @@ class MerkleDistributor {
124
134
  admin: this.admin.toString(),
125
135
  clawedBack: this.clawedBack,
126
136
  claimsClosable: this.claimsClosable,
127
- buffer1: this.buffer1,
137
+ canUpdateDuration: this.canUpdateDuration,
138
+ totalAmountUnlocked: this.totalAmountUnlocked.toString(),
139
+ totalAmountLocked: this.totalAmountLocked.toString(),
140
+ lastDurationUpdateTs: this.lastDurationUpdateTs.toString(),
141
+ totalClaimablePreUpdate: this.totalClaimablePreUpdate.toString(),
142
+ clawedBackTs: this.clawedBackTs.toString(),
128
143
  buffer2: this.buffer2,
129
144
  buffer3: this.buffer3,
130
145
  };
@@ -148,7 +163,12 @@ class MerkleDistributor {
148
163
  admin: new web3_js_1.PublicKey(obj.admin),
149
164
  clawedBack: obj.clawedBack,
150
165
  claimsClosable: obj.claimsClosable,
151
- buffer1: obj.buffer1,
166
+ canUpdateDuration: obj.canUpdateDuration,
167
+ totalAmountUnlocked: new bn_js_1.default(obj.totalAmountUnlocked),
168
+ totalAmountLocked: new bn_js_1.default(obj.totalAmountLocked),
169
+ lastDurationUpdateTs: new bn_js_1.default(obj.lastDurationUpdateTs),
170
+ totalClaimablePreUpdate: new bn_js_1.default(obj.totalClaimablePreUpdate),
171
+ clawedBackTs: new bn_js_1.default(obj.clawedBackTs),
152
172
  buffer2: obj.buffer2,
153
173
  buffer3: obj.buffer3,
154
174
  });
@@ -174,7 +194,12 @@ MerkleDistributor.layout = borsh.struct([
174
194
  borsh.publicKey("admin"),
175
195
  borsh.bool("clawedBack"),
176
196
  borsh.bool("claimsClosable"),
177
- borsh.array(borsh.u8(), 32, "buffer1"),
178
- borsh.array(borsh.u8(), 32, "buffer2"),
197
+ borsh.bool("canUpdateDuration"),
198
+ borsh.u64("totalAmountUnlocked"),
199
+ borsh.u64("totalAmountLocked"),
200
+ borsh.u64("lastDurationUpdateTs"),
201
+ borsh.u64("totalClaimablePreUpdate"),
202
+ borsh.u64("clawedBackTs"),
203
+ borsh.array(borsh.u8(), 23, "buffer2"),
179
204
  borsh.array(borsh.u8(), 32, "buffer3"),
180
205
  ]);
@@ -16,8 +16,8 @@ export interface ClaimStatusFields {
16
16
  lastAmountPerUnlock: BN;
17
17
  /** Whether claim is closed */
18
18
  closed: boolean;
19
- /** Buffer for additional fields */
20
- buffer1: Array<number>;
19
+ /** Distributor account for which ClaimStatus was created, useful to filter by in get_program_accounts */
20
+ distributor: PublicKey;
21
21
  /** Buffer for additional fields */
22
22
  buffer2: Array<number>;
23
23
  }
@@ -36,8 +36,8 @@ export interface ClaimStatusJSON {
36
36
  lastAmountPerUnlock: string;
37
37
  /** Whether claim is closed */
38
38
  closed: boolean;
39
- /** Buffer for additional fields */
40
- buffer1: Array<number>;
39
+ /** Distributor account for which ClaimStatus was created, useful to filter by in get_program_accounts */
40
+ distributor: string;
41
41
  /** Buffer for additional fields */
42
42
  buffer2: Array<number>;
43
43
  }
@@ -57,8 +57,8 @@ export declare class ClaimStatus {
57
57
  readonly lastAmountPerUnlock: BN;
58
58
  /** Whether claim is closed */
59
59
  readonly closed: boolean;
60
- /** Buffer for additional fields */
61
- readonly buffer1: Array<number>;
60
+ /** Distributor account for which ClaimStatus was created, useful to filter by in get_program_accounts */
61
+ readonly distributor: PublicKey;
62
62
  /** Buffer for additional fields */
63
63
  readonly buffer2: Array<number>;
64
64
  static readonly discriminator: Buffer;
@@ -18,8 +18,8 @@ export class ClaimStatus {
18
18
  lastAmountPerUnlock;
19
19
  /** Whether claim is closed */
20
20
  closed;
21
- /** Buffer for additional fields */
22
- buffer1;
21
+ /** Distributor account for which ClaimStatus was created, useful to filter by in get_program_accounts */
22
+ distributor;
23
23
  /** Buffer for additional fields */
24
24
  buffer2;
25
25
  static discriminator = Buffer.from([22, 183, 249, 157, 247, 95, 150, 96]);
@@ -31,7 +31,7 @@ export class ClaimStatus {
31
31
  borsh.u64("lastClaimTs"),
32
32
  borsh.u64("lastAmountPerUnlock"),
33
33
  borsh.bool("closed"),
34
- borsh.array(borsh.u8(), 32, "buffer1"),
34
+ borsh.publicKey("distributor"),
35
35
  borsh.array(borsh.u8(), 32, "buffer2"),
36
36
  ]);
37
37
  constructor(fields) {
@@ -42,7 +42,7 @@ export class ClaimStatus {
42
42
  this.lastClaimTs = fields.lastClaimTs;
43
43
  this.lastAmountPerUnlock = fields.lastAmountPerUnlock;
44
44
  this.closed = fields.closed;
45
- this.buffer1 = fields.buffer1;
45
+ this.distributor = fields.distributor;
46
46
  this.buffer2 = fields.buffer2;
47
47
  }
48
48
  static async fetch(c, address, programId = PROGRAM_ID) {
@@ -80,7 +80,7 @@ export class ClaimStatus {
80
80
  lastClaimTs: dec.lastClaimTs,
81
81
  lastAmountPerUnlock: dec.lastAmountPerUnlock,
82
82
  closed: dec.closed,
83
- buffer1: dec.buffer1,
83
+ distributor: dec.distributor,
84
84
  buffer2: dec.buffer2,
85
85
  });
86
86
  }
@@ -93,7 +93,7 @@ export class ClaimStatus {
93
93
  lastClaimTs: this.lastClaimTs.toString(),
94
94
  lastAmountPerUnlock: this.lastAmountPerUnlock.toString(),
95
95
  closed: this.closed,
96
- buffer1: this.buffer1,
96
+ distributor: this.distributor.toString(),
97
97
  buffer2: this.buffer2,
98
98
  };
99
99
  }
@@ -106,7 +106,7 @@ export class ClaimStatus {
106
106
  lastClaimTs: new BN(obj.lastClaimTs),
107
107
  lastAmountPerUnlock: new BN(obj.lastAmountPerUnlock),
108
108
  closed: obj.closed,
109
- buffer1: obj.buffer1,
109
+ distributor: new PublicKey(obj.distributor),
110
110
  buffer2: obj.buffer2,
111
111
  });
112
112
  }
@@ -36,8 +36,18 @@ export interface MerkleDistributorFields {
36
36
  clawedBack: boolean;
37
37
  /** Whether claims are closable by the admin or not */
38
38
  claimsClosable: boolean;
39
- /** Buffer for additional fields */
40
- buffer1: Array<number>;
39
+ /** Whether admin can update vesting duration */
40
+ canUpdateDuration: boolean;
41
+ /** Total amount of funds unlocked (cliff/instant) */
42
+ totalAmountUnlocked: BN;
43
+ /** Total amount of funds locked (vested) */
44
+ totalAmountLocked: BN;
45
+ /** Timestamp when update was last called */
46
+ lastDurationUpdateTs: BN;
47
+ /** Total amount of locked amount claimable as of last duration update, ever increasing total, accumulates with each update */
48
+ totalClaimablePreUpdate: BN;
49
+ /** Timestamp when funds were clawed back */
50
+ clawedBackTs: BN;
41
51
  /** Buffer for additional fields */
42
52
  buffer2: Array<number>;
43
53
  /** Buffer for additional fields */
@@ -78,8 +88,18 @@ export interface MerkleDistributorJSON {
78
88
  clawedBack: boolean;
79
89
  /** Whether claims are closable by the admin or not */
80
90
  claimsClosable: boolean;
81
- /** Buffer for additional fields */
82
- buffer1: Array<number>;
91
+ /** Whether admin can update vesting duration */
92
+ canUpdateDuration: boolean;
93
+ /** Total amount of funds unlocked (cliff/instant) */
94
+ totalAmountUnlocked: string;
95
+ /** Total amount of funds locked (vested) */
96
+ totalAmountLocked: string;
97
+ /** Timestamp when update was last called */
98
+ lastDurationUpdateTs: string;
99
+ /** Total amount of locked amount claimable as of last duration update, ever increasing total, accumulates with each update */
100
+ totalClaimablePreUpdate: string;
101
+ /** Timestamp when funds were clawed back */
102
+ clawedBackTs: string;
83
103
  /** Buffer for additional fields */
84
104
  buffer2: Array<number>;
85
105
  /** Buffer for additional fields */
@@ -121,8 +141,18 @@ export declare class MerkleDistributor {
121
141
  readonly clawedBack: boolean;
122
142
  /** Whether claims are closable by the admin or not */
123
143
  readonly claimsClosable: boolean;
124
- /** Buffer for additional fields */
125
- readonly buffer1: Array<number>;
144
+ /** Whether admin can update vesting duration */
145
+ readonly canUpdateDuration: boolean;
146
+ /** Total amount of funds unlocked (cliff/instant) */
147
+ readonly totalAmountUnlocked: BN;
148
+ /** Total amount of funds locked (vested) */
149
+ readonly totalAmountLocked: BN;
150
+ /** Timestamp when update was last called */
151
+ readonly lastDurationUpdateTs: BN;
152
+ /** Total amount of locked amount claimable as of last duration update, ever increasing total, accumulates with each update */
153
+ readonly totalClaimablePreUpdate: BN;
154
+ /** Timestamp when funds were clawed back */
155
+ readonly clawedBackTs: BN;
126
156
  /** Buffer for additional fields */
127
157
  readonly buffer2: Array<number>;
128
158
  /** Buffer for additional fields */
@@ -38,8 +38,18 @@ export class MerkleDistributor {
38
38
  clawedBack;
39
39
  /** Whether claims are closable by the admin or not */
40
40
  claimsClosable;
41
- /** Buffer for additional fields */
42
- buffer1;
41
+ /** Whether admin can update vesting duration */
42
+ canUpdateDuration;
43
+ /** Total amount of funds unlocked (cliff/instant) */
44
+ totalAmountUnlocked;
45
+ /** Total amount of funds locked (vested) */
46
+ totalAmountLocked;
47
+ /** Timestamp when update was last called */
48
+ lastDurationUpdateTs;
49
+ /** Total amount of locked amount claimable as of last duration update, ever increasing total, accumulates with each update */
50
+ totalClaimablePreUpdate;
51
+ /** Timestamp when funds were clawed back */
52
+ clawedBackTs;
43
53
  /** Buffer for additional fields */
44
54
  buffer2;
45
55
  /** Buffer for additional fields */
@@ -63,8 +73,13 @@ export class MerkleDistributor {
63
73
  borsh.publicKey("admin"),
64
74
  borsh.bool("clawedBack"),
65
75
  borsh.bool("claimsClosable"),
66
- borsh.array(borsh.u8(), 32, "buffer1"),
67
- borsh.array(borsh.u8(), 32, "buffer2"),
76
+ borsh.bool("canUpdateDuration"),
77
+ borsh.u64("totalAmountUnlocked"),
78
+ borsh.u64("totalAmountLocked"),
79
+ borsh.u64("lastDurationUpdateTs"),
80
+ borsh.u64("totalClaimablePreUpdate"),
81
+ borsh.u64("clawedBackTs"),
82
+ borsh.array(borsh.u8(), 23, "buffer2"),
68
83
  borsh.array(borsh.u8(), 32, "buffer3"),
69
84
  ]);
70
85
  constructor(fields) {
@@ -85,7 +100,12 @@ export class MerkleDistributor {
85
100
  this.admin = fields.admin;
86
101
  this.clawedBack = fields.clawedBack;
87
102
  this.claimsClosable = fields.claimsClosable;
88
- this.buffer1 = fields.buffer1;
103
+ this.canUpdateDuration = fields.canUpdateDuration;
104
+ this.totalAmountUnlocked = fields.totalAmountUnlocked;
105
+ this.totalAmountLocked = fields.totalAmountLocked;
106
+ this.lastDurationUpdateTs = fields.lastDurationUpdateTs;
107
+ this.totalClaimablePreUpdate = fields.totalClaimablePreUpdate;
108
+ this.clawedBackTs = fields.clawedBackTs;
89
109
  this.buffer2 = fields.buffer2;
90
110
  this.buffer3 = fields.buffer3;
91
111
  }
@@ -134,7 +154,12 @@ export class MerkleDistributor {
134
154
  admin: dec.admin,
135
155
  clawedBack: dec.clawedBack,
136
156
  claimsClosable: dec.claimsClosable,
137
- buffer1: dec.buffer1,
157
+ canUpdateDuration: dec.canUpdateDuration,
158
+ totalAmountUnlocked: dec.totalAmountUnlocked,
159
+ totalAmountLocked: dec.totalAmountLocked,
160
+ lastDurationUpdateTs: dec.lastDurationUpdateTs,
161
+ totalClaimablePreUpdate: dec.totalClaimablePreUpdate,
162
+ clawedBackTs: dec.clawedBackTs,
138
163
  buffer2: dec.buffer2,
139
164
  buffer3: dec.buffer3,
140
165
  });
@@ -158,7 +183,12 @@ export class MerkleDistributor {
158
183
  admin: this.admin.toString(),
159
184
  clawedBack: this.clawedBack,
160
185
  claimsClosable: this.claimsClosable,
161
- buffer1: this.buffer1,
186
+ canUpdateDuration: this.canUpdateDuration,
187
+ totalAmountUnlocked: this.totalAmountUnlocked.toString(),
188
+ totalAmountLocked: this.totalAmountLocked.toString(),
189
+ lastDurationUpdateTs: this.lastDurationUpdateTs.toString(),
190
+ totalClaimablePreUpdate: this.totalClaimablePreUpdate.toString(),
191
+ clawedBackTs: this.clawedBackTs.toString(),
162
192
  buffer2: this.buffer2,
163
193
  buffer3: this.buffer3,
164
194
  };
@@ -182,7 +212,12 @@ export class MerkleDistributor {
182
212
  admin: new PublicKey(obj.admin),
183
213
  clawedBack: obj.clawedBack,
184
214
  claimsClosable: obj.claimsClosable,
185
- buffer1: obj.buffer1,
215
+ canUpdateDuration: obj.canUpdateDuration,
216
+ totalAmountUnlocked: new BN(obj.totalAmountUnlocked),
217
+ totalAmountLocked: new BN(obj.totalAmountLocked),
218
+ lastDurationUpdateTs: new BN(obj.lastDurationUpdateTs),
219
+ totalClaimablePreUpdate: new BN(obj.totalClaimablePreUpdate),
220
+ clawedBackTs: new BN(obj.clawedBackTs),
186
221
  buffer2: obj.buffer2,
187
222
  buffer3: obj.buffer3,
188
223
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/distributor",
3
- "version": "7.0.0-alpha.14",
3
+ "version": "7.0.0-alpha.16",
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,9 +26,9 @@
26
26
  "lint": "eslint --fix .",
27
27
  "prepublishOnly": "npm run lint && npm run build"
28
28
  },
29
- "gitHead": "ce9df65df6f69ceac7a2ae4f3404060659ada89b",
29
+ "gitHead": "4c1a6ee9889046e8bf0cb928931bf0e530b3cac9",
30
30
  "devDependencies": {
31
- "@streamflow/eslint-config": "7.0.0-alpha.14",
31
+ "@streamflow/eslint-config": "7.0.0-alpha.16",
32
32
  "@types/bn.js": "5.1.1",
33
33
  "date-fns": "2.28.0",
34
34
  "typescript": "^4.9.5"
@@ -39,7 +39,7 @@
39
39
  "@solana/spl-token": "0.3.6",
40
40
  "@solana/wallet-adapter-base": "0.9.19",
41
41
  "@solana/web3.js": "1.90.2",
42
- "@streamflow/common": "7.0.0-alpha.14",
42
+ "@streamflow/common": "7.0.0-alpha.16",
43
43
  "bn.js": "5.2.1",
44
44
  "borsh": "^2.0.0",
45
45
  "bs58": "5.0.0",