@7kprotocol/sdk-ts 3.6.1-beta.0 → 3.6.1-beta.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.
Files changed (234) hide show
  1. package/README.md +13 -10
  2. package/dist/bluefin7k-I6ZCDWDN.js +2 -0
  3. package/dist/bluefin7k-I6ZCDWDN.js.map +1 -0
  4. package/dist/bluefin7k-TERLUCNL.mjs +2 -0
  5. package/dist/bluefin7k-TERLUCNL.mjs.map +1 -0
  6. package/dist/cetus-AU3OMWOY.mjs +2 -0
  7. package/dist/cetus-AU3OMWOY.mjs.map +1 -0
  8. package/dist/cetus-SIPX6FYL.js +2 -0
  9. package/dist/cetus-SIPX6FYL.js.map +1 -0
  10. package/dist/chunk-ETQEI4QC.mjs +2 -0
  11. package/dist/chunk-ETQEI4QC.mjs.map +1 -0
  12. package/dist/chunk-KVGSSW22.js +2 -0
  13. package/dist/chunk-KVGSSW22.js.map +1 -0
  14. package/dist/flowx-6M54WFWO.js +2 -0
  15. package/dist/flowx-6M54WFWO.js.map +1 -0
  16. package/dist/flowx-OXZZX5FD.mjs +2 -0
  17. package/dist/flowx-OXZZX5FD.mjs.map +1 -0
  18. package/dist/index.d.mts +536 -0
  19. package/dist/index.d.ts +536 -0
  20. package/dist/index.js +2 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/index.mjs +2 -0
  23. package/dist/index.mjs.map +1 -0
  24. package/package.json +12 -20
  25. package/lib/cjs/config/fetchClient.js +0 -12
  26. package/lib/cjs/constants/_7k.js +0 -20
  27. package/lib/cjs/constants/apiEndpoints.js +0 -9
  28. package/lib/cjs/constants/sui.js +0 -4
  29. package/lib/cjs/constants/tokens.js +0 -7
  30. package/lib/cjs/features/limitDca/cancelDcaOrder.js +0 -14
  31. package/lib/cjs/features/limitDca/cancelLimitOrder.js +0 -14
  32. package/lib/cjs/features/limitDca/claimExpiredLimitOrder.js +0 -14
  33. package/lib/cjs/features/limitDca/constants.js +0 -13
  34. package/lib/cjs/features/limitDca/getClosedDcaOrders.js +0 -23
  35. package/lib/cjs/features/limitDca/getClosedLimitOrders.js +0 -22
  36. package/lib/cjs/features/limitDca/getDcaOrderExecutions.js +0 -23
  37. package/lib/cjs/features/limitDca/getOpenDcaOrders.js +0 -22
  38. package/lib/cjs/features/limitDca/getOpenLimitOrders.js +0 -22
  39. package/lib/cjs/features/limitDca/index.js +0 -26
  40. package/lib/cjs/features/limitDca/placeDcaOrder.js +0 -33
  41. package/lib/cjs/features/limitDca/placeLimitOrder.js +0 -27
  42. package/lib/cjs/features/limitDca/types.js +0 -16
  43. package/lib/cjs/features/metaAg/common.js +0 -103
  44. package/lib/cjs/features/metaAg/error.js +0 -31
  45. package/lib/cjs/features/metaAg/index.js +0 -268
  46. package/lib/cjs/features/metaAg/providers/bluefin7k.js +0 -57
  47. package/lib/cjs/features/metaAg/providers/cetus.js +0 -59
  48. package/lib/cjs/features/metaAg/providers/flowx.js +0 -52
  49. package/lib/cjs/features/metaAg/providers/okx.js +0 -182
  50. package/lib/cjs/features/prices/index.js +0 -99
  51. package/lib/cjs/index.js +0 -55
  52. package/lib/cjs/libs/url.js +0 -17
  53. package/lib/cjs/types/config/fetchClient.d.ts +0 -2
  54. package/lib/cjs/types/config/fetchClient.d.ts.map +0 -1
  55. package/lib/cjs/types/constants/_7k.d.ts +0 -6
  56. package/lib/cjs/types/constants/_7k.d.ts.map +0 -1
  57. package/lib/cjs/types/constants/apiEndpoints.d.ts +0 -7
  58. package/lib/cjs/types/constants/apiEndpoints.d.ts.map +0 -1
  59. package/lib/cjs/types/constants/sui.d.ts +0 -2
  60. package/lib/cjs/types/constants/sui.d.ts.map +0 -1
  61. package/lib/cjs/types/constants/tokens.d.ts +0 -5
  62. package/lib/cjs/types/constants/tokens.d.ts.map +0 -1
  63. package/lib/cjs/types/features/limitDca/cancelDcaOrder.d.ts +0 -9
  64. package/lib/cjs/types/features/limitDca/cancelDcaOrder.d.ts.map +0 -1
  65. package/lib/cjs/types/features/limitDca/cancelLimitOrder.d.ts +0 -9
  66. package/lib/cjs/types/features/limitDca/cancelLimitOrder.d.ts.map +0 -1
  67. package/lib/cjs/types/features/limitDca/claimExpiredLimitOrder.d.ts +0 -9
  68. package/lib/cjs/types/features/limitDca/claimExpiredLimitOrder.d.ts.map +0 -1
  69. package/lib/cjs/types/features/limitDca/constants.d.ts +0 -10
  70. package/lib/cjs/types/features/limitDca/constants.d.ts.map +0 -1
  71. package/lib/cjs/types/features/limitDca/getClosedDcaOrders.d.ts +0 -10
  72. package/lib/cjs/types/features/limitDca/getClosedDcaOrders.d.ts.map +0 -1
  73. package/lib/cjs/types/features/limitDca/getClosedLimitOrders.d.ts +0 -10
  74. package/lib/cjs/types/features/limitDca/getClosedLimitOrders.d.ts.map +0 -1
  75. package/lib/cjs/types/features/limitDca/getDcaOrderExecutions.d.ts +0 -10
  76. package/lib/cjs/types/features/limitDca/getDcaOrderExecutions.d.ts.map +0 -1
  77. package/lib/cjs/types/features/limitDca/getOpenDcaOrders.d.ts +0 -10
  78. package/lib/cjs/types/features/limitDca/getOpenDcaOrders.d.ts.map +0 -1
  79. package/lib/cjs/types/features/limitDca/getOpenLimitOrders.d.ts +0 -10
  80. package/lib/cjs/types/features/limitDca/getOpenLimitOrders.d.ts.map +0 -1
  81. package/lib/cjs/types/features/limitDca/index.d.ts +0 -11
  82. package/lib/cjs/types/features/limitDca/index.d.ts.map +0 -1
  83. package/lib/cjs/types/features/limitDca/placeDcaOrder.d.ts +0 -14
  84. package/lib/cjs/types/features/limitDca/placeDcaOrder.d.ts.map +0 -1
  85. package/lib/cjs/types/features/limitDca/placeLimitOrder.d.ts +0 -13
  86. package/lib/cjs/types/features/limitDca/placeLimitOrder.d.ts.map +0 -1
  87. package/lib/cjs/types/features/limitDca/types.d.ts +0 -98
  88. package/lib/cjs/types/features/limitDca/types.d.ts.map +0 -1
  89. package/lib/cjs/types/features/metaAg/common.d.ts +0 -24
  90. package/lib/cjs/types/features/metaAg/common.d.ts.map +0 -1
  91. package/lib/cjs/types/features/metaAg/error.d.ts +0 -54
  92. package/lib/cjs/types/features/metaAg/error.d.ts.map +0 -1
  93. package/lib/cjs/types/features/metaAg/index.d.ts +0 -42
  94. package/lib/cjs/types/features/metaAg/index.d.ts.map +0 -1
  95. package/lib/cjs/types/features/metaAg/providers/bluefin7k.d.ts +0 -11
  96. package/lib/cjs/types/features/metaAg/providers/bluefin7k.d.ts.map +0 -1
  97. package/lib/cjs/types/features/metaAg/providers/cetus.d.ts +0 -11
  98. package/lib/cjs/types/features/metaAg/providers/cetus.d.ts.map +0 -1
  99. package/lib/cjs/types/features/metaAg/providers/flowx.d.ts +0 -13
  100. package/lib/cjs/types/features/metaAg/providers/flowx.d.ts.map +0 -1
  101. package/lib/cjs/types/features/metaAg/providers/okx.d.ts +0 -21
  102. package/lib/cjs/types/features/metaAg/providers/okx.d.ts.map +0 -1
  103. package/lib/cjs/types/features/prices/index.d.ts +0 -18
  104. package/lib/cjs/types/features/prices/index.d.ts.map +0 -1
  105. package/lib/cjs/types/index.d.ts +0 -23
  106. package/lib/cjs/types/index.d.ts.map +0 -1
  107. package/lib/cjs/types/libs/url.d.ts +0 -2
  108. package/lib/cjs/types/libs/url.d.ts.map +0 -1
  109. package/lib/cjs/types/metaAg.js +0 -16
  110. package/lib/cjs/types/okx.js +0 -6
  111. package/lib/cjs/types/types/metaAg.d.ts +0 -165
  112. package/lib/cjs/types/types/metaAg.d.ts.map +0 -1
  113. package/lib/cjs/types/types/okx.d.ts +0 -206
  114. package/lib/cjs/types/types/okx.d.ts.map +0 -1
  115. package/lib/cjs/types/utils/ObjectCache.d.ts +0 -87
  116. package/lib/cjs/types/utils/ObjectCache.d.ts.map +0 -1
  117. package/lib/cjs/types/utils/SuiClientUtils.d.ts +0 -15
  118. package/lib/cjs/types/utils/SuiClientUtils.d.ts.map +0 -1
  119. package/lib/cjs/types/utils/sui.d.ts +0 -27
  120. package/lib/cjs/types/utils/sui.d.ts.map +0 -1
  121. package/lib/cjs/types/utils/swap.d.ts +0 -15
  122. package/lib/cjs/types/utils/swap.d.ts.map +0 -1
  123. package/lib/cjs/types/utils/token.d.ts +0 -4
  124. package/lib/cjs/types/utils/token.d.ts.map +0 -1
  125. package/lib/cjs/utils/ObjectCache.js +0 -273
  126. package/lib/cjs/utils/SuiClientUtils.js +0 -50
  127. package/lib/cjs/utils/sui.js +0 -92
  128. package/lib/cjs/utils/swap.js +0 -37
  129. package/lib/cjs/utils/token.js +0 -15
  130. package/lib/esm/config/fetchClient.js +0 -9
  131. package/lib/esm/constants/_7k.js +0 -17
  132. package/lib/esm/constants/apiEndpoints.js +0 -6
  133. package/lib/esm/constants/sui.js +0 -1
  134. package/lib/esm/constants/tokens.js +0 -4
  135. package/lib/esm/features/limitDca/cancelDcaOrder.js +0 -11
  136. package/lib/esm/features/limitDca/cancelLimitOrder.js +0 -11
  137. package/lib/esm/features/limitDca/claimExpiredLimitOrder.js +0 -11
  138. package/lib/esm/features/limitDca/constants.js +0 -10
  139. package/lib/esm/features/limitDca/getClosedDcaOrders.js +0 -20
  140. package/lib/esm/features/limitDca/getClosedLimitOrders.js +0 -19
  141. package/lib/esm/features/limitDca/getDcaOrderExecutions.js +0 -20
  142. package/lib/esm/features/limitDca/getOpenDcaOrders.js +0 -19
  143. package/lib/esm/features/limitDca/getOpenLimitOrders.js +0 -19
  144. package/lib/esm/features/limitDca/index.js +0 -10
  145. package/lib/esm/features/limitDca/placeDcaOrder.js +0 -30
  146. package/lib/esm/features/limitDca/placeLimitOrder.js +0 -24
  147. package/lib/esm/features/limitDca/types.js +0 -13
  148. package/lib/esm/features/metaAg/common.js +0 -96
  149. package/lib/esm/features/metaAg/error.js +0 -29
  150. package/lib/esm/features/metaAg/index.js +0 -234
  151. package/lib/esm/features/metaAg/providers/bluefin7k.js +0 -55
  152. package/lib/esm/features/metaAg/providers/cetus.js +0 -57
  153. package/lib/esm/features/metaAg/providers/flowx.js +0 -51
  154. package/lib/esm/features/metaAg/providers/okx.js +0 -147
  155. package/lib/esm/features/prices/index.js +0 -94
  156. package/lib/esm/index.mjs +0 -31
  157. package/lib/esm/libs/url.js +0 -14
  158. package/lib/esm/types/config/fetchClient.d.ts +0 -2
  159. package/lib/esm/types/config/fetchClient.d.ts.map +0 -1
  160. package/lib/esm/types/constants/_7k.d.ts +0 -6
  161. package/lib/esm/types/constants/_7k.d.ts.map +0 -1
  162. package/lib/esm/types/constants/apiEndpoints.d.ts +0 -7
  163. package/lib/esm/types/constants/apiEndpoints.d.ts.map +0 -1
  164. package/lib/esm/types/constants/sui.d.ts +0 -2
  165. package/lib/esm/types/constants/sui.d.ts.map +0 -1
  166. package/lib/esm/types/constants/tokens.d.ts +0 -5
  167. package/lib/esm/types/constants/tokens.d.ts.map +0 -1
  168. package/lib/esm/types/features/limitDca/cancelDcaOrder.d.ts +0 -9
  169. package/lib/esm/types/features/limitDca/cancelDcaOrder.d.ts.map +0 -1
  170. package/lib/esm/types/features/limitDca/cancelLimitOrder.d.ts +0 -9
  171. package/lib/esm/types/features/limitDca/cancelLimitOrder.d.ts.map +0 -1
  172. package/lib/esm/types/features/limitDca/claimExpiredLimitOrder.d.ts +0 -9
  173. package/lib/esm/types/features/limitDca/claimExpiredLimitOrder.d.ts.map +0 -1
  174. package/lib/esm/types/features/limitDca/constants.d.ts +0 -10
  175. package/lib/esm/types/features/limitDca/constants.d.ts.map +0 -1
  176. package/lib/esm/types/features/limitDca/getClosedDcaOrders.d.ts +0 -10
  177. package/lib/esm/types/features/limitDca/getClosedDcaOrders.d.ts.map +0 -1
  178. package/lib/esm/types/features/limitDca/getClosedLimitOrders.d.ts +0 -10
  179. package/lib/esm/types/features/limitDca/getClosedLimitOrders.d.ts.map +0 -1
  180. package/lib/esm/types/features/limitDca/getDcaOrderExecutions.d.ts +0 -10
  181. package/lib/esm/types/features/limitDca/getDcaOrderExecutions.d.ts.map +0 -1
  182. package/lib/esm/types/features/limitDca/getOpenDcaOrders.d.ts +0 -10
  183. package/lib/esm/types/features/limitDca/getOpenDcaOrders.d.ts.map +0 -1
  184. package/lib/esm/types/features/limitDca/getOpenLimitOrders.d.ts +0 -10
  185. package/lib/esm/types/features/limitDca/getOpenLimitOrders.d.ts.map +0 -1
  186. package/lib/esm/types/features/limitDca/index.d.ts +0 -11
  187. package/lib/esm/types/features/limitDca/index.d.ts.map +0 -1
  188. package/lib/esm/types/features/limitDca/placeDcaOrder.d.ts +0 -14
  189. package/lib/esm/types/features/limitDca/placeDcaOrder.d.ts.map +0 -1
  190. package/lib/esm/types/features/limitDca/placeLimitOrder.d.ts +0 -13
  191. package/lib/esm/types/features/limitDca/placeLimitOrder.d.ts.map +0 -1
  192. package/lib/esm/types/features/limitDca/types.d.ts +0 -98
  193. package/lib/esm/types/features/limitDca/types.d.ts.map +0 -1
  194. package/lib/esm/types/features/metaAg/common.d.ts +0 -24
  195. package/lib/esm/types/features/metaAg/common.d.ts.map +0 -1
  196. package/lib/esm/types/features/metaAg/error.d.ts +0 -54
  197. package/lib/esm/types/features/metaAg/error.d.ts.map +0 -1
  198. package/lib/esm/types/features/metaAg/index.d.ts +0 -42
  199. package/lib/esm/types/features/metaAg/index.d.ts.map +0 -1
  200. package/lib/esm/types/features/metaAg/providers/bluefin7k.d.ts +0 -11
  201. package/lib/esm/types/features/metaAg/providers/bluefin7k.d.ts.map +0 -1
  202. package/lib/esm/types/features/metaAg/providers/cetus.d.ts +0 -11
  203. package/lib/esm/types/features/metaAg/providers/cetus.d.ts.map +0 -1
  204. package/lib/esm/types/features/metaAg/providers/flowx.d.ts +0 -13
  205. package/lib/esm/types/features/metaAg/providers/flowx.d.ts.map +0 -1
  206. package/lib/esm/types/features/metaAg/providers/okx.d.ts +0 -21
  207. package/lib/esm/types/features/metaAg/providers/okx.d.ts.map +0 -1
  208. package/lib/esm/types/features/prices/index.d.ts +0 -18
  209. package/lib/esm/types/features/prices/index.d.ts.map +0 -1
  210. package/lib/esm/types/index.d.ts +0 -23
  211. package/lib/esm/types/index.d.ts.map +0 -1
  212. package/lib/esm/types/libs/url.d.ts +0 -2
  213. package/lib/esm/types/libs/url.d.ts.map +0 -1
  214. package/lib/esm/types/metaAg.js +0 -11
  215. package/lib/esm/types/okx.js +0 -5
  216. package/lib/esm/types/types/metaAg.d.ts +0 -165
  217. package/lib/esm/types/types/metaAg.d.ts.map +0 -1
  218. package/lib/esm/types/types/okx.d.ts +0 -206
  219. package/lib/esm/types/types/okx.d.ts.map +0 -1
  220. package/lib/esm/types/utils/ObjectCache.d.ts +0 -87
  221. package/lib/esm/types/utils/ObjectCache.d.ts.map +0 -1
  222. package/lib/esm/types/utils/SuiClientUtils.d.ts +0 -15
  223. package/lib/esm/types/utils/SuiClientUtils.d.ts.map +0 -1
  224. package/lib/esm/types/utils/sui.d.ts +0 -27
  225. package/lib/esm/types/utils/sui.d.ts.map +0 -1
  226. package/lib/esm/types/utils/swap.d.ts +0 -15
  227. package/lib/esm/types/utils/swap.d.ts.map +0 -1
  228. package/lib/esm/types/utils/token.d.ts +0 -4
  229. package/lib/esm/types/utils/token.d.ts.map +0 -1
  230. package/lib/esm/utils/ObjectCache.js +0 -250
  231. package/lib/esm/utils/SuiClientUtils.js +0 -34
  232. package/lib/esm/utils/sui.js +0 -88
  233. package/lib/esm/utils/swap.js +0 -33
  234. package/lib/esm/utils/token.js +0 -10
@@ -1,206 +0,0 @@
1
- /**
2
- * OKX DEX Swap API Types
3
- * Documentation: https://web3.okx.com/vi/build/dev-docs/wallet-api/dex-swap
4
- */
5
- /**
6
- * Gas level options for swap transactions
7
- */
8
- export type GasLevel = "average" | "fast" | "slow";
9
- /**
10
- * Swap mode options
11
- */
12
- export type SwapMode = "exactIn" | "exactOut";
13
- /**
14
- * Swap API Request Parameters (v6)
15
- */
16
- export interface OkxSwapRequest {
17
- /** Unique identifier for the chain */
18
- chainIndex?: string;
19
- /** The input amount of a token to be sold (set in minimal divisible units, e.g., 1.00 USDT set as 1000000) */
20
- amount: string;
21
- /** Swap mode: "exactIn" or "exactOut" (default: "exactIn"). exactOut only supports Ethereum, Base, BSC, Arbitrum chains and Uni v3 protocols */
22
- swapMode?: SwapMode;
23
- /** The contract address of a token you want to send (e.g., 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee for native token) */
24
- fromTokenAddress: string;
25
- /** The contract address of a token you want to receive */
26
- toTokenAddress: string;
27
- /** Slippage limit. For EVM: 0-100. For Solana: 0-less than 100 (e.g., 0.5 means 0.5%) */
28
- slippagePercent: string;
29
- /** User's wallet address */
30
- userWalletAddress: string;
31
- /** Recipient address of a purchased token (if not set, userWalletAddress will receive the token) */
32
- swapReceiverAddress?: string;
33
- /** The percentage of fromTokenAmount sent to referrer. Min > 0, max 10 for Solana, 3 for all other chains. Maximum of nine decimal places */
34
- feePercent?: string;
35
- /** Wallet address to receive commission fee for fromToken. Must set feePercent together. Can only choose either fromToken or toToken commission per transaction */
36
- fromTokenReferrerWalletAddress?: string;
37
- /** Wallet address to receive commission fee for toToken. Must set feePercent together. Can only choose either fromToken or toToken commission per transaction */
38
- toTokenReferrerWalletAddress?: string;
39
- /** Positive slippage percentage (0-10, max 1 decimal point). Solana only, whitelist/enterprise clients only */
40
- positiveSlippagePercent?: string;
41
- /** Wallet address that receives positive slippage. Must set positiveSlippagePercent together. Solana only, whitelist/enterprise clients only */
42
- positiveSlippageFeeAddress?: string;
43
- /** The gas (in wei) for the swap transaction. EVM only. If too low, an error will be returned */
44
- gasLimit?: string;
45
- /** Target gas price level (defaults to "average"). EVM only */
46
- gasLevel?: GasLevel;
47
- /** Used for Solana transactions, similar to gasPrice on Ethereum. Determines transaction priority */
48
- computeUnitPrice?: string;
49
- /** Used for Solana transactions, similar to gasLimit on Ethereum. If tips is not 0, computeUnitPrice should be set to 0 */
50
- computeUnitLimit?: string;
51
- /** Jito tips in SOL. Maximum is "2", minimum is "0.0000000001". Used for MEV protection. Solana only */
52
- tips?: string;
53
- /** DexId of liquidity pool for limited quotes, multiple separated by comma (e.g., "1,50,180") */
54
- dexIds?: string;
55
- }
56
- /**
57
- * Token information
58
- */
59
- export interface OkxTokenInfo {
60
- /** Token contract address */
61
- tokenContractAddress: string;
62
- /** Token symbol (e.g., "USDC") */
63
- tokenSymbol: string;
64
- /** Token unit price in USD (may be null for special cases) */
65
- tokenUnitPrice: string | null;
66
- /** Decimal number defining smallest unit */
67
- decimal: string;
68
- /** Whether the token is a honeypot token */
69
- isHoneyPot: boolean;
70
- /** Token tax rate (0-1, where 0.01 = 1%) */
71
- taxRate: string;
72
- }
73
- /**
74
- * DEX Protocol information
75
- */
76
- export interface OkxDexProtocol {
77
- /** Name of the liquidity protocol (e.g., "Uniswap V3") */
78
- dexName: string;
79
- /** Percentage of assets handled by the protocol */
80
- percent: string;
81
- }
82
- /**
83
- * Sub-router information
84
- */
85
- export interface OkxSubRouter {
86
- /** Liquidity protocol used on the path */
87
- dexProtocol: OkxDexProtocol;
88
- /** Index of the from token */
89
- fromTokenIndex: string;
90
- /** Index of the to token */
91
- toTokenIndex: string;
92
- /** Information of token to be sold */
93
- fromToken: OkxTokenInfo;
94
- /** Information of token to be bought */
95
- toToken: OkxTokenInfo;
96
- }
97
- /**
98
- * Main router information (deprecated in v6, kept for backward compatibility)
99
- * In v6, dexRouterList is an array of OkxSubRouter directly
100
- */
101
- export interface OkxRouter {
102
- /** One of the main paths for the token swap */
103
- router: string;
104
- /** Percentage of assets handled by the main path */
105
- routerPercent: string;
106
- /** Quote path sub data set */
107
- subRouterList: OkxSubRouter[];
108
- }
109
- /**
110
- * Quote comparison information
111
- */
112
- export interface OkxQuoteCompare {
113
- /** DEX name of the quote route */
114
- dexName: string;
115
- /** DEX logo of the quote route */
116
- dexLogo: string;
117
- /** Estimated network fee (USD) of the quote route */
118
- tradeFee: string;
119
- /** Received amount of the quote route */
120
- amountOut: string;
121
- /** Price impact percentage */
122
- priceImpactPercentage: string;
123
- }
124
- /**
125
- * Transaction data model
126
- */
127
- export interface OkxTransactionData {
128
- /** Additional signing data (if required). When tips is specified, represents calldata of jito tips transfer */
129
- signatureData?: string[];
130
- /** User's wallet address */
131
- from: string;
132
- /** Estimated amount of the gas limit (increase by 50% for accurate data) */
133
- gas: string;
134
- /** Gas price in wei */
135
- gasPrice?: string;
136
- /** EIP-1559: Recommended priority cost of gas per unit */
137
- maxPriorityFeePerGas?: string;
138
- /** The contract address of OKX DEX router */
139
- to: string;
140
- /** The amount of native tokens (in wei) to be sent to the contract */
141
- value: string;
142
- /** The maximum amount of a token to spend when price reaches upper limit of slippage (applies to exactOut mode) */
143
- maxSpendAmount?: string;
144
- /** The minimum amount of a token to buy when price reaches upper limit of slippage */
145
- minReceiveAmount: string;
146
- /** Call data */
147
- data: string;
148
- /** Current transaction slippage value */
149
- slippagePercent: string;
150
- }
151
- /**
152
- * Router result data
153
- */
154
- export interface OkxRouterResult {
155
- /** Unique identifier for the chain */
156
- chainIndex: string;
157
- /** Context slot (for Solana) */
158
- contextSlot?: number;
159
- /** Quote path data set - array of sub-routers */
160
- dexRouterList: OkxSubRouter[];
161
- /** Estimated gas consumption in smallest units (e.g., wei) */
162
- estimateGasFee: string;
163
- /** Information of token to be sold */
164
- fromToken: OkxTokenInfo;
165
- /** The input amount of a token to be sold */
166
- fromTokenAmount: string;
167
- /** Price impact percentage = (Received value – Paid value) / Paid value. Can be positive if received value exceeds paid value */
168
- priceImpactPercent: string;
169
- /** Router identifier */
170
- router: string;
171
- /** Swap mode: "exactIn" or "exactOut" */
172
- swapMode: SwapMode;
173
- /** Information of token to be bought */
174
- toToken: OkxTokenInfo;
175
- /** The resulting amount of a token to be bought */
176
- toTokenAmount: string;
177
- /** Estimated network fee (USD) of the quote route */
178
- tradeFee: string;
179
- /** Comparison of quote routes */
180
- quoteCompareList?: OkxQuoteCompare[];
181
- }
182
- /**
183
- * Swap API Response Data
184
- */
185
- export interface OkxSwapResponseData {
186
- /** Quote path data */
187
- routerResult: OkxRouterResult;
188
- /** Contract data model */
189
- tx: OkxTransactionData;
190
- }
191
- /**
192
- * OKX API Standard Response Wrapper
193
- */
194
- export interface OkxApiResponse<T> {
195
- /** Response code ("0" indicates success) */
196
- code: string;
197
- /** Response data array */
198
- data: T[];
199
- /** Response message */
200
- msg: string;
201
- }
202
- /**
203
- * Complete Swap API Response
204
- */
205
- export type OkxSwapResponse = OkxApiResponse<OkxSwapResponseData>;
206
- //# sourceMappingURL=okx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"okx.d.ts","sourceRoot":"","sources":["../../../../src/types/okx.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8GAA8G;IAC9G,MAAM,EAAE,MAAM,CAAC;IACf,gJAAgJ;IAChJ,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,2HAA2H;IAC3H,gBAAgB,EAAE,MAAM,CAAC;IACzB,0DAA0D;IAC1D,cAAc,EAAE,MAAM,CAAC;IACvB,yFAAyF;IACzF,eAAe,EAAE,MAAM,CAAC;IACxB,4BAA4B;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oGAAoG;IACpG,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,6IAA6I;IAC7I,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mKAAmK;IACnK,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,iKAAiK;IACjK,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,+GAA+G;IAC/G,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,gJAAgJ;IAChJ,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,iGAAiG;IACjG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+DAA+D;IA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CAAC;IACnB,wCAAwC;IACxC,OAAO,EAAE,YAAY,CAAC;IACtB,mDAAmD;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,sBAAsB;IACtB,YAAY,EAAE,eAAe,CAAC;IAC9B,0BAA0B;IAC1B,EAAE,EAAE,kBAAkB,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,uBAAuB;IACvB,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,mBAAmB,CAAC,CAAC"}
@@ -1,87 +0,0 @@
1
- import { bcs } from "@mysten/sui/bcs";
2
- import { SuiClient } from "@mysten/sui/client";
3
- import { OpenMoveTypeSignature, TransactionPlugin } from "@mysten/sui/transactions";
4
- export interface ObjectCacheEntry {
5
- objectId: string;
6
- version: string;
7
- digest: string;
8
- owner: string | null;
9
- initialSharedVersion: string | null;
10
- }
11
- export interface MoveFunctionCacheEntry {
12
- package: string;
13
- module: string;
14
- function: string;
15
- parameters: OpenMoveTypeSignature[];
16
- }
17
- export interface CacheEntryTypes {
18
- OwnedObject: ObjectCacheEntry;
19
- SharedOrImmutableObject: ObjectCacheEntry;
20
- MoveFunction: MoveFunctionCacheEntry;
21
- Custom: unknown;
22
- }
23
- export declare abstract class AsyncCache {
24
- protected abstract get<T extends keyof CacheEntryTypes>(type: T, key: string): Promise<CacheEntryTypes[T] | null>;
25
- protected abstract set<T extends keyof CacheEntryTypes>(type: T, key: string, value: CacheEntryTypes[T]): Promise<void>;
26
- protected abstract delete<T extends keyof CacheEntryTypes>(type: T, key: string): Promise<void>;
27
- abstract clear<T extends keyof CacheEntryTypes>(type?: T): Promise<void>;
28
- getObject(id: string): Promise<ObjectCacheEntry | null>;
29
- getObjects(ids: string[]): Promise<(ObjectCacheEntry | null)[]>;
30
- addObject(object: ObjectCacheEntry): Promise<ObjectCacheEntry>;
31
- addObjects(objects: ObjectCacheEntry[]): Promise<void>;
32
- deleteObject(id: string): Promise<void>;
33
- deleteObjects(ids: string[]): Promise<void>;
34
- getMoveFunctionDefinition(ref: {
35
- package: string;
36
- module: string;
37
- function: string;
38
- }): Promise<MoveFunctionCacheEntry | null>;
39
- addMoveFunctionDefinition(functionEntry: MoveFunctionCacheEntry): Promise<{
40
- package: string;
41
- module: string;
42
- function: string;
43
- parameters: OpenMoveTypeSignature[];
44
- }>;
45
- deleteMoveFunctionDefinition(ref: {
46
- package: string;
47
- module: string;
48
- function: string;
49
- }): Promise<void>;
50
- getCustom<T>(key: string): Promise<T | null>;
51
- setCustom<T>(key: string, value: T): Promise<void>;
52
- deleteCustom(key: string): Promise<void>;
53
- }
54
- export declare class InMemoryObjectCache extends AsyncCache {
55
- #private;
56
- protected get<T extends keyof CacheEntryTypes>(type: T, key: string): Promise<NonNullable<CacheEntryTypes[T]> | null>;
57
- protected set<T extends keyof CacheEntryTypes>(type: T, key: string, value: CacheEntryTypes[T]): Promise<void>;
58
- protected delete<T extends keyof CacheEntryTypes>(type: T, key: string): Promise<void>;
59
- clear<T extends keyof CacheEntryTypes>(type?: T): Promise<void>;
60
- }
61
- export interface ObjectCacheOptions {
62
- cache?: AsyncCache;
63
- client: SuiClient;
64
- onEffects?: (effects: typeof bcs.TransactionEffects.$inferType) => Promise<void>;
65
- }
66
- export declare class CustomObjectCache {
67
- #private;
68
- constructor({ cache, onEffects, client, }: ObjectCacheOptions);
69
- private applyCache;
70
- private resolveObjects;
71
- asPlugin(): TransactionPlugin;
72
- clear(): Promise<void>;
73
- getMoveFunctionDefinition(ref: {
74
- package: string;
75
- module: string;
76
- function: string;
77
- }): Promise<MoveFunctionCacheEntry | null>;
78
- getObjects(ids: string[]): Promise<(ObjectCacheEntry | null)[]>;
79
- deleteObjects(ids: string[]): Promise<void>;
80
- clearOwnedObjects(): Promise<void>;
81
- clearCustom(): Promise<void>;
82
- getCustom<T>(key: string): Promise<T | null>;
83
- setCustom<T>(key: string, value: T): Promise<void>;
84
- deleteCustom(key: string): Promise<void>;
85
- applyEffects(effects: typeof bcs.TransactionEffects.$inferType): Promise<void>;
86
- }
87
- //# sourceMappingURL=ObjectCache.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ObjectCache.d.ts","sourceRoot":"","sources":["../../../../src/utils/ObjectCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACL,qBAAqB,EAErB,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,qBAAqB,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,gBAAgB,CAAC;IAC9B,uBAAuB,EAAE,gBAAgB,CAAC;IAC1C,YAAY,EAAE,sBAAsB,CAAC;IACrC,MAAM,EAAE,OAAO,CAAC;CACjB;AACD,8BAAsB,UAAU;IAC9B,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,MAAM,eAA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AE,CAAC;IAIlC,YAAY,CAAC,GAAG,EAAE,MAAM;IAIxB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,CAAC,kBAAkB,CAAC,UAAU;CAkCrE"}
@@ -1,15 +0,0 @@
1
- import { DevInspectTransactionBlockParams, SuiClient } from "@mysten/sui/client";
2
- /**
3
- * Utility class for interacting with Sui blockchain coins
4
- */
5
- export declare class SuiClientUtils {
6
- #private;
7
- private client;
8
- /**
9
- * Creates a new instance of SuiClientUtils
10
- * @param client - The Sui client instance to use for blockchain interactions
11
- */
12
- constructor(client: SuiClient);
13
- devInspectTransactionBlock: (params: DevInspectTransactionBlockParams) => Promise<import("@mysten/sui/client").DevInspectResults>;
14
- }
15
- //# sourceMappingURL=SuiClientUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SuiClientUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/SuiClientUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,SAAS,EACV,MAAM,oBAAoB,CAAC;AAI5B;;GAEG;AACH,qBAAa,cAAc;;IAMb,OAAO,CAAC,MAAM;IAJ1B;;;OAGG;gBACiB,MAAM,EAAE,SAAS;IAIrC,0BAA0B,GACxB,QAAQ,gCAAgC,6DAexC;CACH"}
@@ -1,27 +0,0 @@
1
- import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
2
- export declare const SuiUtils: {
3
- getSuiCoin(amount: bigint | TransactionArgument, txb: Transaction): TransactionArgument;
4
- getCoinValue(coinType: string, coinObject: string | TransactionArgument, txb: Transaction): TransactionArgument;
5
- isValidStructTag(value: string): boolean;
6
- zeroBalance(tx: Transaction, coinType: string): {
7
- $kind: "NestedResult";
8
- NestedResult: [number, number];
9
- };
10
- zeroCoin(tx: Transaction, coinType: string): {
11
- $kind: "NestedResult";
12
- NestedResult: [number, number];
13
- };
14
- coinIntoBalance(tx: Transaction, coinType: string, coinObject: TransactionArgument): {
15
- $kind: "NestedResult";
16
- NestedResult: [number, number];
17
- };
18
- coinFromBalance(tx: Transaction, coinType: string, balance: TransactionArgument): {
19
- $kind: "NestedResult";
20
- NestedResult: [number, number];
21
- };
22
- balanceDestroyZero(tx: Transaction, coinType: string, balance: TransactionArgument): void;
23
- collectDust(tx: Transaction, coinType: string, coin: TransactionArgument): void;
24
- transferOrDestroyZeroCoin(tx: Transaction, coinType: string, coin: TransactionArgument, address: string): void;
25
- };
26
- export declare const isSystemAddress: (address: string) => boolean;
27
- //# sourceMappingURL=sui.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../../../src/utils/sui.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AA6B5E,eAAO,MAAM,QAAQ;uBAET,MAAM,GAAG,mBAAmB,OAC/B,WAAW,GACf,mBAAmB;2BAMV,MAAM,cACJ,MAAM,GAAG,mBAAmB,OACnC,WAAW,GACf,mBAAmB;4BAWE,MAAM;oBAQd,WAAW,YAAY,MAAM;;;;iBAQhC,WAAW,YAAY,MAAM;;;;wBASpC,WAAW,YACL,MAAM,cACJ,mBAAmB;;;;wBAU3B,WAAW,YACL,MAAM,WACP,mBAAmB;;;;2BAUxB,WAAW,YACL,MAAM,WACP,mBAAmB;oBASd,WAAW,YAAY,MAAM,QAAQ,mBAAmB;kCASlE,WAAW,YACL,MAAM,QACV,mBAAmB,WAChB,MAAM;CAQlB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,YAY9C,CAAC"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Calculate expected return amount after applying slippage, commission, and tip
3
- * @param returnAmount - The raw return amount (with decimals)
4
- * @param slippageBps - Slippage in basis points (1 bps = 0.01%)
5
- * @param commissionBps - Commission in basis points
6
- * @param tipBps - Tip in basis points (default: 0)
7
- * @returns Object containing tipAmount, minAmount, commissionAmount, and expectedAmount
8
- */
9
- export declare const getExpectedReturn: (returnAmount: string, slippageBps: number, commissionBps: number, tipBps?: number) => {
10
- tipAmount: bigint;
11
- minAmount: bigint;
12
- commissionAmount: bigint;
13
- expectedAmount: string;
14
- };
15
- //# sourceMappingURL=swap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../../../src/utils/swap.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAC5B,cAAc,MAAM,EACpB,aAAa,MAAM,EACnB,eAAe,MAAM,EACrB,SAAQ,MAAU;;;;;CA8BnB,CAAC"}
@@ -1,4 +0,0 @@
1
- export declare function normalizeTokenType(type: string): string;
2
- export declare function denormalizeTokenType(type: string): string;
3
- export declare function checkIsSui(type: string): type is "0x2::sui::SUI" | "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";
4
- //# sourceMappingURL=token.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../../src/utils/token.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,UAE9C;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,UAEhD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,4GAEtC"}
@@ -1,273 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
- };
7
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
- if (kind === "m") throw new TypeError("Private method is not writable");
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
- };
13
- var _InMemoryObjectCache_caches, _CustomObjectCache_client, _CustomObjectCache_cache, _CustomObjectCache_onEffects;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.CustomObjectCache = exports.InMemoryObjectCache = exports.AsyncCache = void 0;
16
- const utils_1 = require("@mysten/sui/utils");
17
- class AsyncCache {
18
- async getObject(id) {
19
- const [owned, shared] = await Promise.all([
20
- this.get("OwnedObject", id),
21
- this.get("SharedOrImmutableObject", id),
22
- ]);
23
- return owned ?? shared ?? null;
24
- }
25
- async getObjects(ids) {
26
- return Promise.all(ids.map((id) => this.getObject(id)));
27
- }
28
- async addObject(object) {
29
- if (object.owner) {
30
- await this.set("OwnedObject", object.objectId, object);
31
- }
32
- else {
33
- await this.set("SharedOrImmutableObject", object.objectId, object);
34
- }
35
- return object;
36
- }
37
- async addObjects(objects) {
38
- await Promise.all(objects.map(async (object) => this.addObject(object)));
39
- }
40
- async deleteObject(id) {
41
- await Promise.all([
42
- this.delete("OwnedObject", id),
43
- this.delete("SharedOrImmutableObject", id),
44
- ]);
45
- }
46
- async deleteObjects(ids) {
47
- await Promise.all(ids.map((id) => this.deleteObject(id)));
48
- }
49
- async getMoveFunctionDefinition(ref) {
50
- const functionName = `${(0, utils_1.normalizeSuiAddress)(ref.package)}::${ref.module}::${ref.function}`;
51
- return this.get("MoveFunction", functionName);
52
- }
53
- async addMoveFunctionDefinition(functionEntry) {
54
- const pkg = (0, utils_1.normalizeSuiAddress)(functionEntry.package);
55
- const functionName = `${pkg}::${functionEntry.module}::${functionEntry.function}`;
56
- const entry = {
57
- ...functionEntry,
58
- package: pkg,
59
- };
60
- await this.set("MoveFunction", functionName, entry);
61
- return entry;
62
- }
63
- async deleteMoveFunctionDefinition(ref) {
64
- const functionName = `${(0, utils_1.normalizeSuiAddress)(ref.package)}::${ref.module}::${ref.function}`;
65
- await this.delete("MoveFunction", functionName);
66
- }
67
- async getCustom(key) {
68
- return this.get("Custom", key);
69
- }
70
- async setCustom(key, value) {
71
- return this.set("Custom", key, value);
72
- }
73
- async deleteCustom(key) {
74
- return this.delete("Custom", key);
75
- }
76
- }
77
- exports.AsyncCache = AsyncCache;
78
- class InMemoryObjectCache extends AsyncCache {
79
- constructor() {
80
- super(...arguments);
81
- _InMemoryObjectCache_caches.set(this, {
82
- OwnedObject: new Map(),
83
- SharedOrImmutableObject: new Map(),
84
- MoveFunction: new Map(),
85
- Custom: new Map(),
86
- });
87
- }
88
- async get(type, key) {
89
- return __classPrivateFieldGet(this, _InMemoryObjectCache_caches, "f")[type].get(key) ?? null;
90
- }
91
- async set(type, key, value) {
92
- __classPrivateFieldGet(this, _InMemoryObjectCache_caches, "f")[type].set(key, value);
93
- }
94
- async delete(type, key) {
95
- __classPrivateFieldGet(this, _InMemoryObjectCache_caches, "f")[type].delete(key);
96
- }
97
- async clear(type) {
98
- if (type) {
99
- __classPrivateFieldGet(this, _InMemoryObjectCache_caches, "f")[type].clear();
100
- }
101
- else {
102
- for (const cache of Object.values(__classPrivateFieldGet(this, _InMemoryObjectCache_caches, "f"))) {
103
- cache.clear();
104
- }
105
- }
106
- }
107
- }
108
- exports.InMemoryObjectCache = InMemoryObjectCache;
109
- _InMemoryObjectCache_caches = new WeakMap();
110
- class CustomObjectCache {
111
- constructor({ cache = new InMemoryObjectCache(), onEffects, client, }) {
112
- _CustomObjectCache_client.set(this, void 0);
113
- _CustomObjectCache_cache.set(this, void 0);
114
- _CustomObjectCache_onEffects.set(this, void 0);
115
- __classPrivateFieldSet(this, _CustomObjectCache_client, client, "f");
116
- __classPrivateFieldSet(this, _CustomObjectCache_cache, cache, "f");
117
- __classPrivateFieldSet(this, _CustomObjectCache_onEffects, onEffects, "f");
118
- }
119
- async applyCache(transactionData, unresolvedObjects) {
120
- const cached = (await __classPrivateFieldGet(this, _CustomObjectCache_cache, "f").getObjects(unresolvedObjects)).filter((obj) => obj !== null);
121
- const byId = new Map(cached.map((obj) => [obj.objectId, obj]));
122
- const unresolved = [];
123
- for (const input of transactionData.inputs) {
124
- if (!input.UnresolvedObject) {
125
- continue;
126
- }
127
- const cached = byId.get(input.UnresolvedObject.objectId);
128
- if (!cached) {
129
- unresolved.push(input.UnresolvedObject.objectId);
130
- continue;
131
- }
132
- if (cached.initialSharedVersion &&
133
- !input.UnresolvedObject.initialSharedVersion) {
134
- input.UnresolvedObject.initialSharedVersion =
135
- cached.initialSharedVersion;
136
- }
137
- else {
138
- if (cached.version && !input.UnresolvedObject.version) {
139
- input.UnresolvedObject.version = cached.version;
140
- }
141
- if (cached.digest && !input.UnresolvedObject.digest) {
142
- input.UnresolvedObject.digest = cached.digest;
143
- }
144
- }
145
- }
146
- return unresolved;
147
- }
148
- async resolveObjects(transactionData, unresolved) {
149
- const unresolvedObjects = await this.applyCache(transactionData, unresolved);
150
- if (unresolvedObjects.length === 0) {
151
- return [];
152
- }
153
- const dedup = [...new Set(unresolvedObjects)];
154
- const res = await __classPrivateFieldGet(this, _CustomObjectCache_client, "f").multiGetObjects({
155
- ids: dedup,
156
- options: {
157
- showOwner: true,
158
- },
159
- });
160
- const objects = [];
161
- for (const obj of res || []) {
162
- if (!obj.data) {
163
- continue;
164
- }
165
- const owner = obj.data.owner;
166
- const initialSharedVersion = owner && typeof owner === "object" && "Shared" in owner
167
- ? owner.Shared.initial_shared_version
168
- : null;
169
- const ownerAddress = owner && typeof owner === "object" && "AddressOwner" in owner
170
- ? owner.AddressOwner
171
- : null;
172
- const cached = {
173
- objectId: obj.data.objectId,
174
- version: obj.data.version,
175
- digest: obj.data.digest,
176
- initialSharedVersion,
177
- owner: ownerAddress,
178
- };
179
- objects.push(cached);
180
- }
181
- await __classPrivateFieldGet(this, _CustomObjectCache_cache, "f").addObjects(objects);
182
- return await this.applyCache(transactionData, unresolvedObjects);
183
- }
184
- asPlugin() {
185
- return async (transactionData, _options, next) => {
186
- const unresolvedObjects = transactionData.inputs
187
- .filter((input) => input.UnresolvedObject)
188
- .map((input) => input.UnresolvedObject.objectId);
189
- // if object is not in cache yet, fetch from RPC and save to cache and resolve all objects
190
- await this.resolveObjects(transactionData, unresolvedObjects);
191
- await Promise.all(transactionData.commands.map(async (commands) => {
192
- if (commands.MoveCall) {
193
- const def = await this.getMoveFunctionDefinition({
194
- package: commands.MoveCall.package,
195
- module: commands.MoveCall.module,
196
- function: commands.MoveCall.function,
197
- });
198
- if (def) {
199
- commands.MoveCall._argumentTypes = def.parameters;
200
- }
201
- }
202
- }));
203
- await next();
204
- await Promise.all(transactionData.commands.map(async (commands) => {
205
- if (commands.MoveCall?._argumentTypes) {
206
- await __classPrivateFieldGet(this, _CustomObjectCache_cache, "f").addMoveFunctionDefinition({
207
- package: commands.MoveCall.package,
208
- module: commands.MoveCall.module,
209
- function: commands.MoveCall.function,
210
- parameters: commands.MoveCall._argumentTypes,
211
- });
212
- }
213
- }));
214
- };
215
- }
216
- async clear() {
217
- await __classPrivateFieldGet(this, _CustomObjectCache_cache, "f").clear();
218
- }
219
- async getMoveFunctionDefinition(ref) {
220
- return __classPrivateFieldGet(this, _CustomObjectCache_cache, "f").getMoveFunctionDefinition(ref);
221
- }
222
- async getObjects(ids) {
223
- return __classPrivateFieldGet(this, _CustomObjectCache_cache, "f").getObjects(ids);
224
- }
225
- async deleteObjects(ids) {
226
- return __classPrivateFieldGet(this, _CustomObjectCache_cache, "f").deleteObjects(ids);
227
- }
228
- async clearOwnedObjects() {
229
- await __classPrivateFieldGet(this, _CustomObjectCache_cache, "f").clear("OwnedObject");
230
- }
231
- async clearCustom() {
232
- await __classPrivateFieldGet(this, _CustomObjectCache_cache, "f").clear("Custom");
233
- }
234
- async getCustom(key) {
235
- return __classPrivateFieldGet(this, _CustomObjectCache_cache, "f").getCustom(key);
236
- }
237
- async setCustom(key, value) {
238
- return __classPrivateFieldGet(this, _CustomObjectCache_cache, "f").setCustom(key, value);
239
- }
240
- async deleteCustom(key) {
241
- return __classPrivateFieldGet(this, _CustomObjectCache_cache, "f").deleteCustom(key);
242
- }
243
- async applyEffects(effects) {
244
- if (!effects.V2) {
245
- throw new Error(`Unsupported transaction effects version ${effects.$kind}`);
246
- }
247
- const { lamportVersion, changedObjects } = effects.V2;
248
- const deletedIds = [];
249
- const addedObjects = [];
250
- changedObjects.forEach(([id, change]) => {
251
- if (change.outputState.NotExist) {
252
- deletedIds.push(id);
253
- }
254
- else if (change.outputState.ObjectWrite) {
255
- const [digest, owner] = change.outputState.ObjectWrite;
256
- addedObjects.push({
257
- objectId: id,
258
- digest,
259
- version: lamportVersion,
260
- owner: owner.AddressOwner ?? owner.ObjectOwner ?? null,
261
- initialSharedVersion: owner.Shared?.initialSharedVersion ?? null,
262
- });
263
- }
264
- });
265
- await Promise.all([
266
- __classPrivateFieldGet(this, _CustomObjectCache_cache, "f").addObjects(addedObjects),
267
- __classPrivateFieldGet(this, _CustomObjectCache_cache, "f").deleteObjects(deletedIds),
268
- __classPrivateFieldGet(this, _CustomObjectCache_onEffects, "f")?.call(this, effects),
269
- ]);
270
- }
271
- }
272
- exports.CustomObjectCache = CustomObjectCache;
273
- _CustomObjectCache_client = new WeakMap(), _CustomObjectCache_cache = new WeakMap(), _CustomObjectCache_onEffects = new WeakMap();