@streamflow/stream 7.0.0-alpha.11 → 7.0.0-alpha.13

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.
Files changed (56) hide show
  1. package/README.md +22 -17
  2. package/dist/cjs/__tests__/aptos/streamClient.spec.js +4 -4
  3. package/dist/cjs/aptos/types.js +12 -12
  4. package/dist/cjs/common/constants.js +4 -3
  5. package/dist/cjs/common/contractUtils.js +23 -7
  6. package/dist/cjs/common/types.js +30 -1
  7. package/dist/cjs/common/utils.js +22 -19
  8. package/dist/cjs/evm/StreamClient.js +7 -7
  9. package/dist/cjs/evm/types.js +12 -12
  10. package/dist/cjs/solana/StreamClient.js +256 -111
  11. package/dist/cjs/solana/constants.js +29 -1
  12. package/dist/cjs/solana/descriptor/idl/streamflow_aligned_unlocks.json +1471 -0
  13. package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.js +2 -0
  14. package/dist/cjs/solana/index.js +2 -1
  15. package/dist/cjs/solana/instructions.js +18 -19
  16. package/dist/cjs/solana/lib/derive-accounts.js +17 -0
  17. package/dist/cjs/solana/{utils.js → lib/utils.js} +29 -36
  18. package/dist/cjs/solana/types.js +26 -3
  19. package/dist/cjs/sui/StreamClient.js +1 -1
  20. package/dist/cjs/sui/types.js +12 -12
  21. package/dist/esm/__tests__/aptos/streamClient.spec.js +4 -4
  22. package/dist/esm/aptos/types.d.ts +14 -14
  23. package/dist/esm/aptos/types.js +13 -13
  24. package/dist/esm/common/constants.d.ts +3 -2
  25. package/dist/esm/common/constants.js +3 -2
  26. package/dist/esm/common/contractUtils.d.ts +18 -15
  27. package/dist/esm/common/contractUtils.js +19 -6
  28. package/dist/esm/common/types.d.ts +112 -57
  29. package/dist/esm/common/types.js +29 -0
  30. package/dist/esm/common/utils.d.ts +11 -11
  31. package/dist/esm/common/utils.js +19 -16
  32. package/dist/esm/evm/StreamClient.d.ts +2 -2
  33. package/dist/esm/evm/StreamClient.js +7 -7
  34. package/dist/esm/evm/types.d.ts +14 -14
  35. package/dist/esm/evm/types.js +13 -13
  36. package/dist/esm/solana/StreamClient.d.ts +20 -14
  37. package/dist/esm/solana/StreamClient.js +259 -113
  38. package/dist/esm/solana/constants.d.ts +14 -0
  39. package/dist/esm/solana/constants.js +29 -1
  40. package/dist/esm/solana/descriptor/idl/streamflow_aligned_unlocks.json +1471 -0
  41. package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.d.ts +1272 -0
  42. package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.js +1 -0
  43. package/dist/esm/solana/index.d.ts +2 -1
  44. package/dist/esm/solana/index.js +2 -1
  45. package/dist/esm/solana/instructions.d.ts +17 -17
  46. package/dist/esm/solana/instructions.js +18 -19
  47. package/dist/esm/solana/lib/derive-accounts.d.ts +4 -0
  48. package/dist/esm/solana/lib/derive-accounts.js +11 -0
  49. package/dist/esm/solana/{utils.d.ts → lib/utils.d.ts} +1 -3
  50. package/dist/esm/solana/{utils.js → lib/utils.js} +28 -34
  51. package/dist/esm/solana/types.d.ts +67 -39
  52. package/dist/esm/solana/types.js +32 -4
  53. package/dist/esm/sui/StreamClient.js +1 -1
  54. package/dist/esm/sui/types.d.ts +14 -14
  55. package/dist/esm/sui/types.js +13 -13
  56. package/package.json +7 -5
@@ -1,6 +1,6 @@
1
- import BigNumber from "bignumber.js";
1
+ import BN from "bn.js";
2
2
  import { buildStreamType, calculateUnlockedAmount } from "../common/contractUtils.js";
3
- import { getNumberFromBigNumber } from "../common/utils.js";
3
+ import { getNumberFromBN } from "../common/utils.js";
4
4
  export class Contract {
5
5
  magic;
6
6
  version;
@@ -51,7 +51,7 @@ export class Contract {
51
51
  this.magic = 0;
52
52
  this.version = parseInt(stream.version);
53
53
  this.createdAt = parseInt(stream.created);
54
- this.withdrawnAmount = BigNumber(stream.withdrawn);
54
+ this.withdrawnAmount = new BN(stream.withdrawn);
55
55
  this.canceledAt = parseInt(stream.canceled_at);
56
56
  this.end = parseInt(stream.end);
57
57
  this.lastWithdrawnAt = parseInt(stream.last_withdrawn_at);
@@ -63,20 +63,20 @@ export class Contract {
63
63
  this.escrowTokens = "";
64
64
  this.streamflowTreasury = "";
65
65
  this.streamflowTreasuryTokens = "";
66
- this.streamflowFeeTotal = BigNumber(0);
67
- this.streamflowFeeWithdrawn = BigNumber(0);
66
+ this.streamflowFeeTotal = new BN(0);
67
+ this.streamflowFeeWithdrawn = new BN(0);
68
68
  this.streamflowFeePercent = parseInt(fees.streamflow_fee_percentage) / 10000;
69
- this.partnerFeeTotal = BigNumber(0);
70
- this.partnerFeeWithdrawn = BigNumber(0);
69
+ this.partnerFeeTotal = new BN(0);
70
+ this.partnerFeeWithdrawn = new BN(0);
71
71
  this.partnerFeePercent = parseInt(fees.partner_fee_percentage) / 10000;
72
72
  this.partner = stream.partner;
73
73
  this.partnerTokens = "";
74
74
  this.start = parseInt(stream.start);
75
- this.depositedAmount = BigNumber(stream.amount);
75
+ this.depositedAmount = new BN(stream.amount);
76
76
  this.period = parseInt(stream.period);
77
- this.amountPerPeriod = BigNumber(stream.amount_per_period);
77
+ this.amountPerPeriod = new BN(stream.amount_per_period);
78
78
  this.cliff = parseInt(stream.start);
79
- this.cliffAmount = BigNumber(stream.cliff_amount);
79
+ this.cliffAmount = new BN(stream.cliff_amount);
80
80
  this.cancelableBySender = meta.cancelable_by_sender;
81
81
  this.cancelableByRecipient = meta.cancelable_by_recipient;
82
82
  this.automaticWithdrawal = meta.automatic_withdrawal;
@@ -87,9 +87,9 @@ export class Contract {
87
87
  this.withdrawalFrequency = parseInt(meta.withdrawal_frequency);
88
88
  this.closed = stream.closed;
89
89
  this.currentPauseStart = parseInt(stream.current_pause_start);
90
- this.pauseCumulative = BigNumber(stream.pause_cumulative);
90
+ this.pauseCumulative = new BN(stream.pause_cumulative);
91
91
  this.lastRateChangeTime = parseInt(stream.last_rate_change_time);
92
- this.fundsUnlockedAtLastRateChange = BigNumber(stream.funds_unlocked_at_last_rate_change);
92
+ this.fundsUnlockedAtLastRateChange = new BN(stream.funds_unlocked_at_last_rate_change);
93
93
  this.type = buildStreamType(this);
94
94
  }
95
95
  unlocked(currentTimestamp) {
@@ -99,6 +99,6 @@ export class Contract {
99
99
  });
100
100
  }
101
101
  remaining(decimals) {
102
- return getNumberFromBigNumber(this.depositedAmount.minus(this.withdrawnAmount), decimals);
102
+ return getNumberFromBN(this.depositedAmount.sub(this.withdrawnAmount), decimals);
103
103
  }
104
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/stream",
3
- "version": "7.0.0-alpha.11",
3
+ "version": "7.0.0-alpha.13",
4
4
  "description": "JavaScript SDK to interact with Streamflow protocol.",
5
5
  "homepage": "https://github.com/streamflow-finance/js-sdk/",
6
6
  "main": "./dist/esm/index.js",
@@ -42,14 +42,16 @@
42
42
  "lint": "eslint --fix .",
43
43
  "prepublishOnly": "npm run lint && npm test && npm run build"
44
44
  },
45
- "gitHead": "679b809cff3ff71f90122bbe985da3f35834452e",
45
+ "gitHead": "1fe1f2d828e28cfd9e842bb4dd47c9756a39404f",
46
46
  "devDependencies": {
47
- "@streamflow/eslint-config": "7.0.0-alpha.11",
47
+ "@streamflow/eslint-config": "7.0.0-alpha.13",
48
+ "@types/bn.js": "5.1.1",
48
49
  "@types/ethereum-checksum-address": "^0.0.0",
49
50
  "date-fns": "2.28.0",
50
51
  "typescript": "^5.3.3"
51
52
  },
52
53
  "dependencies": {
54
+ "@coral-xyz/anchor": "^0.30.0",
53
55
  "@coral-xyz/borsh": "0.30.1",
54
56
  "@manahippo/aptos-wallet-adapter": "1.0.10",
55
57
  "@mysten/sui.js": "0.54.1",
@@ -57,10 +59,10 @@
57
59
  "@solana/spl-token": "0.3.6",
58
60
  "@solana/wallet-adapter-base": "0.9.19",
59
61
  "@solana/web3.js": "1.90.2",
60
- "@streamflow/common": "7.0.0-alpha.11",
62
+ "@streamflow/common": "7.0.0-alpha.13",
61
63
  "@suiet/wallet-kit": "0.2.22",
62
64
  "aptos": "1.21.0",
63
- "bignumber.js": "^9.1.2",
65
+ "bn.js": "5.2.1",
64
66
  "borsh": "^2.0.0",
65
67
  "bs58": "5.0.0",
66
68
  "ethereum-checksum-address": "0.0.8",