@streamflow/stream 7.0.0-alpha.12 → 7.0.0-alpha.14

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 (37) hide show
  1. package/README.md +10 -5
  2. package/dist/cjs/common/constants.js +2 -1
  3. package/dist/cjs/common/contractUtils.js +17 -1
  4. package/dist/cjs/common/types.js +30 -1
  5. package/dist/cjs/solana/StreamClient.js +290 -139
  6. package/dist/cjs/solana/constants.js +29 -1
  7. package/dist/cjs/solana/descriptor/idl/streamflow_aligned_unlocks.json +1471 -0
  8. package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.js +2 -0
  9. package/dist/cjs/solana/index.js +2 -1
  10. package/dist/cjs/solana/lib/derive-accounts.js +17 -0
  11. package/dist/cjs/solana/{utils.js → lib/utils.js} +2 -2
  12. package/dist/cjs/solana/types.js +25 -2
  13. package/dist/esm/aptos/types.d.ts +2 -2
  14. package/dist/esm/common/constants.d.ts +1 -0
  15. package/dist/esm/common/constants.js +1 -0
  16. package/dist/esm/common/contractUtils.d.ts +4 -1
  17. package/dist/esm/common/contractUtils.js +13 -0
  18. package/dist/esm/common/types.d.ts +104 -49
  19. package/dist/esm/common/types.js +29 -0
  20. package/dist/esm/evm/types.d.ts +2 -2
  21. package/dist/esm/solana/StreamClient.d.ts +22 -16
  22. package/dist/esm/solana/StreamClient.js +293 -141
  23. package/dist/esm/solana/constants.d.ts +14 -0
  24. package/dist/esm/solana/constants.js +29 -1
  25. package/dist/esm/solana/descriptor/idl/streamflow_aligned_unlocks.json +1471 -0
  26. package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.d.ts +1272 -0
  27. package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.js +1 -0
  28. package/dist/esm/solana/index.d.ts +2 -1
  29. package/dist/esm/solana/index.js +2 -1
  30. package/dist/esm/solana/lib/derive-accounts.d.ts +4 -0
  31. package/dist/esm/solana/lib/derive-accounts.js +11 -0
  32. package/dist/esm/solana/{utils.d.ts → lib/utils.d.ts} +1 -1
  33. package/dist/esm/solana/{utils.js → lib/utils.js} +2 -2
  34. package/dist/esm/solana/types.d.ts +31 -3
  35. package/dist/esm/solana/types.js +30 -2
  36. package/dist/esm/sui/types.d.ts +2 -2
  37. package/package.json +5 -4
@@ -1,10 +1,12 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
2
  import { Buffer } from "buffer";
3
- import { ICluster, SolanaContractErrorCode } from "../common/types.js";
3
+ import { ICluster, SolanaContractErrorCode, SolanaAlignedProxyErrorCode } from "../common/types.js";
4
4
  export const TX_FINALITY_CONFIRMED = "confirmed";
5
+ export const ORIGINAL_CONTRACT_SENDER_OFFSET = 9;
5
6
  export const STREAM_STRUCT_OFFSET_SENDER = 49;
6
7
  export const STREAM_STRUCT_OFFSET_RECIPIENT = 113;
7
8
  export const STREAM_STRUCT_OFFSET_MINT = 177;
9
+ export const ALIGNED_PRECISION_FACTOR_POW = 9;
8
10
  export const STREAM_STRUCT_OFFSETS = {
9
11
  mint: STREAM_STRUCT_OFFSET_MINT,
10
12
  recipient: STREAM_STRUCT_OFFSET_RECIPIENT,
@@ -18,6 +20,19 @@ export const PROGRAM_ID = {
18
20
  [ICluster.Testnet]: "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
19
21
  [ICluster.Local]: "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
20
22
  };
23
+ export const ALIGNED_UNLOCKS_PROGRAM_ID = {
24
+ [ICluster.Devnet]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
25
+ [ICluster.Mainnet]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
26
+ [ICluster.Testnet]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
27
+ [ICluster.Local]: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
28
+ };
29
+ // Aligned Unlocks Program transactions require a higher comput limit
30
+ export const ALIGNED_COMPUTE_LIMIT = 300000;
31
+ export const CONTRACT_DISCRIMINATOR = [172, 138, 115, 242, 121, 67, 183, 26];
32
+ export const TEST_ORACLE_DISCRIMINATOR = [198, 49, 63, 134, 232, 251, 168, 28];
33
+ export const CONTRACT_SEED = Buffer.from("contract", "utf-8");
34
+ export const ESCROW_SEED = Buffer.from("strm", "utf-8");
35
+ export const TEST_ORACLE_SEED = Buffer.from("test-oracle", "utf-8");
21
36
  export const PARTNER_ORACLE_PROGRAM_ID = "pardpVtPjC8nLj1Dwncew62mUzfChdCX1EaoZe8oCAa";
22
37
  export const STREAMFLOW_TREASURY_PUBLIC_KEY = new PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
23
38
  export const WITHDRAWOR_PUBLIC_KEY = new PublicKey("wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u");
@@ -59,4 +74,17 @@ export const SOLANA_ERROR_MAP = {
59
74
  0x85: SolanaContractErrorCode.AlreadyPaused,
60
75
  0x86: SolanaContractErrorCode.NotPaused,
61
76
  0x87: SolanaContractErrorCode.MetadataNotRentExempt,
77
+ 0x1770: SolanaAlignedProxyErrorCode.Unauthorized,
78
+ 0x1771: SolanaAlignedProxyErrorCode.ArithmeticError,
79
+ 0x1772: SolanaAlignedProxyErrorCode.UnsupportedTokenExtensions,
80
+ 0x1773: SolanaAlignedProxyErrorCode.PeriodTooShort,
81
+ 0x1774: SolanaAlignedProxyErrorCode.InvalidTickSize,
82
+ 0x1775: SolanaAlignedProxyErrorCode.InvalidPercentageBoundaries,
83
+ 0x1776: SolanaAlignedProxyErrorCode.InvalidPriceBoundaries,
84
+ 0x1777: SolanaAlignedProxyErrorCode.UnsupportedOracle,
85
+ 0x1778: SolanaAlignedProxyErrorCode.InvalidOracleAccount,
86
+ 0x1779: SolanaAlignedProxyErrorCode.InvalidOraclePrice,
87
+ 0x177a: SolanaAlignedProxyErrorCode.InvalidStreamMetadata,
88
+ 0x177b: SolanaAlignedProxyErrorCode.AmountAlreadyUpdated,
89
+ 0x177c: SolanaAlignedProxyErrorCode.AllFundsUnlocked,
62
90
  };