@streamflow/distributor 7.5.3-alpha.cffa362.20250508190445 → 7.5.3-alpha.p284.166b142
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 +41 -41
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/solana/index.cjs +41 -41
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/esm/index.js +40 -40
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.js +40 -40
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +12 -4
package/dist/cjs/index.cjs
CHANGED
|
@@ -4,10 +4,10 @@ var web3_js = require('@solana/web3.js');
|
|
|
4
4
|
require('@solana/wallet-adapter-base');
|
|
5
5
|
var common = require('@streamflow/common');
|
|
6
6
|
var solana = require('@streamflow/common/solana');
|
|
7
|
-
var BN10 = require('bn.js');
|
|
8
7
|
var anchor = require('@coral-xyz/anchor');
|
|
9
8
|
var borsh8 = require('@coral-xyz/borsh');
|
|
10
9
|
var buffer = require('buffer');
|
|
10
|
+
var BN6 = require('bn.js');
|
|
11
11
|
var splToken = require('@solana/spl-token');
|
|
12
12
|
var bs58 = require('bs58');
|
|
13
13
|
|
|
@@ -31,8 +31,8 @@ function _interopNamespace(e) {
|
|
|
31
31
|
return Object.freeze(n);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
var BN10__default = /*#__PURE__*/_interopDefault(BN10);
|
|
35
34
|
var borsh8__namespace = /*#__PURE__*/_interopNamespace(borsh8);
|
|
35
|
+
var BN6__default = /*#__PURE__*/_interopDefault(BN6);
|
|
36
36
|
var bs58__default = /*#__PURE__*/_interopDefault(bs58);
|
|
37
37
|
|
|
38
38
|
var __defProp = Object.defineProperty;
|
|
@@ -438,15 +438,15 @@ var _ClaimStatus = class _ClaimStatus {
|
|
|
438
438
|
static fromJSON(obj) {
|
|
439
439
|
return new _ClaimStatus({
|
|
440
440
|
claimant: new web3_js.PublicKey(obj.claimant),
|
|
441
|
-
lockedAmount: new
|
|
442
|
-
lockedAmountWithdrawn: new
|
|
443
|
-
unlockedAmount: new
|
|
444
|
-
lastClaimTs: new
|
|
445
|
-
lastAmountPerUnlock: new
|
|
441
|
+
lockedAmount: new BN6__default.default(obj.lockedAmount),
|
|
442
|
+
lockedAmountWithdrawn: new BN6__default.default(obj.lockedAmountWithdrawn),
|
|
443
|
+
unlockedAmount: new BN6__default.default(obj.unlockedAmount),
|
|
444
|
+
lastClaimTs: new BN6__default.default(obj.lastClaimTs),
|
|
445
|
+
lastAmountPerUnlock: new BN6__default.default(obj.lastAmountPerUnlock),
|
|
446
446
|
closed: obj.closed,
|
|
447
447
|
distributor: new web3_js.PublicKey(obj.distributor),
|
|
448
448
|
claimsCount: obj.claimsCount,
|
|
449
|
-
closedTs: new
|
|
449
|
+
closedTs: new BN6__default.default(obj.closedTs),
|
|
450
450
|
buffer2: obj.buffer2
|
|
451
451
|
});
|
|
452
452
|
}
|
|
@@ -587,28 +587,28 @@ var _MerkleDistributor = class _MerkleDistributor {
|
|
|
587
587
|
static fromJSON(obj) {
|
|
588
588
|
return new _MerkleDistributor({
|
|
589
589
|
bump: obj.bump,
|
|
590
|
-
version: new
|
|
590
|
+
version: new BN6__default.default(obj.version),
|
|
591
591
|
root: obj.root,
|
|
592
592
|
mint: new web3_js.PublicKey(obj.mint),
|
|
593
593
|
tokenVault: new web3_js.PublicKey(obj.tokenVault),
|
|
594
|
-
maxTotalClaim: new
|
|
595
|
-
maxNumNodes: new
|
|
596
|
-
unlockPeriod: new
|
|
597
|
-
totalAmountClaimed: new
|
|
598
|
-
numNodesClaimed: new
|
|
599
|
-
startTs: new
|
|
600
|
-
endTs: new
|
|
601
|
-
clawbackStartTs: new
|
|
594
|
+
maxTotalClaim: new BN6__default.default(obj.maxTotalClaim),
|
|
595
|
+
maxNumNodes: new BN6__default.default(obj.maxNumNodes),
|
|
596
|
+
unlockPeriod: new BN6__default.default(obj.unlockPeriod),
|
|
597
|
+
totalAmountClaimed: new BN6__default.default(obj.totalAmountClaimed),
|
|
598
|
+
numNodesClaimed: new BN6__default.default(obj.numNodesClaimed),
|
|
599
|
+
startTs: new BN6__default.default(obj.startTs),
|
|
600
|
+
endTs: new BN6__default.default(obj.endTs),
|
|
601
|
+
clawbackStartTs: new BN6__default.default(obj.clawbackStartTs),
|
|
602
602
|
clawbackReceiver: new web3_js.PublicKey(obj.clawbackReceiver),
|
|
603
603
|
admin: new web3_js.PublicKey(obj.admin),
|
|
604
604
|
clawedBack: obj.clawedBack,
|
|
605
605
|
claimsClosableByAdmin: obj.claimsClosableByAdmin,
|
|
606
606
|
canUpdateDuration: obj.canUpdateDuration,
|
|
607
|
-
totalAmountUnlocked: new
|
|
608
|
-
totalAmountLocked: new
|
|
609
|
-
lastDurationUpdateTs: new
|
|
610
|
-
totalClaimablePreUpdate: new
|
|
611
|
-
clawedBackTs: new
|
|
607
|
+
totalAmountUnlocked: new BN6__default.default(obj.totalAmountUnlocked),
|
|
608
|
+
totalAmountLocked: new BN6__default.default(obj.totalAmountLocked),
|
|
609
|
+
lastDurationUpdateTs: new BN6__default.default(obj.lastDurationUpdateTs),
|
|
610
|
+
totalClaimablePreUpdate: new BN6__default.default(obj.totalClaimablePreUpdate),
|
|
611
|
+
clawedBackTs: new BN6__default.default(obj.clawedBackTs),
|
|
612
612
|
claimsClosableByClaimant: obj.claimsClosableByClaimant,
|
|
613
613
|
claimsLimit: obj.claimsLimit,
|
|
614
614
|
buffer2: obj.buffer2,
|
|
@@ -1733,7 +1733,7 @@ var BaseDistributorClient = class {
|
|
|
1733
1733
|
};
|
|
1734
1734
|
if (extParams.isNative) {
|
|
1735
1735
|
ixs.push(
|
|
1736
|
-
...await solana.prepareWrappedAccount(this.connection, extParams.invoker.publicKey, new
|
|
1736
|
+
...await solana.prepareWrappedAccount(this.connection, extParams.invoker.publicKey, new BN6__default.default(data.maxTotalClaim))
|
|
1737
1737
|
);
|
|
1738
1738
|
}
|
|
1739
1739
|
const newDistributorInstruction = await this.getNewDistributorInstruction(data, accounts);
|
|
@@ -1851,14 +1851,14 @@ var BaseDistributorClient = class {
|
|
|
1851
1851
|
};
|
|
1852
1852
|
if (!claimStatus) {
|
|
1853
1853
|
const args = {
|
|
1854
|
-
amountLocked: new
|
|
1855
|
-
amountUnlocked: new
|
|
1854
|
+
amountLocked: new BN6__default.default(data.amountLocked),
|
|
1855
|
+
amountUnlocked: new BN6__default.default(data.amountUnlocked),
|
|
1856
1856
|
proof: data.proof
|
|
1857
1857
|
};
|
|
1858
1858
|
ixs.push(newClaim(args, accounts, this.programId));
|
|
1859
1859
|
}
|
|
1860
|
-
const nowTs = new
|
|
1861
|
-
if (claimStatus || new
|
|
1860
|
+
const nowTs = new BN6__default.default(Math.floor(Date.now() / 1e3));
|
|
1861
|
+
if (claimStatus || new BN6__default.default(data.amountLocked).gtn(0) && nowTs.sub(distributor.startTs).gte(distributor.unlockPeriod)) {
|
|
1862
1862
|
ixs.push(claimLocked(accounts, this.programId));
|
|
1863
1863
|
}
|
|
1864
1864
|
ixs.push(this.prepareClaimFeeInstruction(extParams.invoker.publicKey));
|
|
@@ -1903,8 +1903,8 @@ var BaseDistributorClient = class {
|
|
|
1903
1903
|
program: this.programId
|
|
1904
1904
|
};
|
|
1905
1905
|
const closeClaimArgs = {
|
|
1906
|
-
amountLocked: data.amountLocked ? new
|
|
1907
|
-
amountUnlocked: data.amountUnlocked ? new
|
|
1906
|
+
amountLocked: data.amountLocked ? new BN6__default.default(data.amountLocked) : void 0,
|
|
1907
|
+
amountUnlocked: data.amountUnlocked ? new BN6__default.default(data.amountUnlocked) : void 0,
|
|
1908
1908
|
proof: data.proof
|
|
1909
1909
|
};
|
|
1910
1910
|
ixs.push(closeClaim(closeClaimArgs, closeClaimAccounts, this.programId));
|
|
@@ -2002,19 +2002,19 @@ var BaseDistributorClient = class {
|
|
|
2002
2002
|
}
|
|
2003
2003
|
getNewDistributorArgs(data) {
|
|
2004
2004
|
const args = {
|
|
2005
|
-
version: new
|
|
2005
|
+
version: new BN6__default.default(data.version),
|
|
2006
2006
|
root: data.root,
|
|
2007
|
-
maxTotalClaim: new
|
|
2008
|
-
maxNumNodes: new
|
|
2009
|
-
unlockPeriod: new
|
|
2010
|
-
startVestingTs: new
|
|
2011
|
-
endVestingTs: new
|
|
2012
|
-
clawbackStartTs: new
|
|
2007
|
+
maxTotalClaim: new BN6__default.default(data.maxTotalClaim),
|
|
2008
|
+
maxNumNodes: new BN6__default.default(data.maxNumNodes),
|
|
2009
|
+
unlockPeriod: new BN6__default.default(data.unlockPeriod),
|
|
2010
|
+
startVestingTs: new BN6__default.default(data.startVestingTs),
|
|
2011
|
+
endVestingTs: new BN6__default.default(data.endVestingTs),
|
|
2012
|
+
clawbackStartTs: new BN6__default.default(data.clawbackStartTs),
|
|
2013
2013
|
claimsClosableByAdmin: data.claimsClosableByAdmin,
|
|
2014
2014
|
claimsClosableByClaimant: data.claimsClosableByClaimant,
|
|
2015
2015
|
claimsLimit: data.claimsLimit
|
|
2016
2016
|
};
|
|
2017
|
-
const nowTs = new
|
|
2017
|
+
const nowTs = new BN6__default.default(Math.floor(Date.now() / 1e3));
|
|
2018
2018
|
const endVestingTs = args.endVestingTs.isZero() ? nowTs : args.endVestingTs;
|
|
2019
2019
|
const startVestingTs = args.startVestingTs.isZero() ? nowTs : args.startVestingTs;
|
|
2020
2020
|
if (endVestingTs.gt(startVestingTs) && endVestingTs.sub(startVestingTs).lt(args.unlockPeriod)) {
|
|
@@ -3054,16 +3054,16 @@ var SolanaAlignedDistributorClient = class extends BaseDistributorClient {
|
|
|
3054
3054
|
unlockPeriod
|
|
3055
3055
|
} = data;
|
|
3056
3056
|
return {
|
|
3057
|
-
totalAmountLocked: new
|
|
3058
|
-
totalAmountUnlocked: new
|
|
3057
|
+
totalAmountLocked: new BN6__default.default(totalAmountLocked),
|
|
3058
|
+
totalAmountUnlocked: new BN6__default.default(totalAmountUnlocked),
|
|
3059
3059
|
oracleType: !!oracleType ? { [oracleType]: {} } : { none: {} },
|
|
3060
3060
|
minPrice: common.getBN(minPrice, ALIGNED_PRECISION_FACTOR_POW),
|
|
3061
3061
|
maxPrice: common.getBN(maxPrice, ALIGNED_PRECISION_FACTOR_POW),
|
|
3062
3062
|
minPercentage: common.getBN(minPercentage, ALIGNED_PRECISION_FACTOR_POW),
|
|
3063
3063
|
maxPercentage: common.getBN(maxPercentage, ALIGNED_PRECISION_FACTOR_POW),
|
|
3064
|
-
tickSize: new
|
|
3064
|
+
tickSize: new BN6__default.default(tickSize || 1),
|
|
3065
3065
|
skipInitial: skipInitial ?? false,
|
|
3066
|
-
updatePeriod: unlockPeriod < 30 ? new
|
|
3066
|
+
updatePeriod: unlockPeriod < 30 ? new BN6__default.default(30) : new BN6__default.default(unlockPeriod)
|
|
3067
3067
|
};
|
|
3068
3068
|
}
|
|
3069
3069
|
};
|