@scallop-io/sui-scallop-sdk 3.0.2 → 4.1.0

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 (283) hide show
  1. package/dist/Logger-Cg2iFdpH.d.ts +8 -0
  2. package/dist/builder.cjs +22 -0
  3. package/dist/builder.d.cts +28 -0
  4. package/dist/builder.d.ts +28 -0
  5. package/dist/builder.js +4 -0
  6. package/dist/chunk-33AK5RWM.js +15 -0
  7. package/dist/chunk-6UQ4NWEU.js +3 -0
  8. package/dist/chunk-DIC6P5HB.js +11 -0
  9. package/dist/chunk-S34VOEZN.js +3 -0
  10. package/dist/chunk-VTGQACWU.js +6 -0
  11. package/dist/client.cjs +21 -0
  12. package/dist/client.d.cts +401 -0
  13. package/dist/client.d.ts +401 -0
  14. package/dist/client.js +5 -0
  15. package/dist/errors.cjs +10 -0
  16. package/dist/errors.d.cts +32 -0
  17. package/dist/errors.d.ts +32 -0
  18. package/dist/errors.js +1 -0
  19. package/dist/index.cjs +51 -34
  20. package/dist/index.d.cts +130 -3145
  21. package/dist/index.d.ts +130 -3145
  22. package/dist/index.js +8 -12
  23. package/dist/logger.cjs +6 -0
  24. package/dist/logger.d.cts +7 -0
  25. package/dist/logger.d.ts +7 -0
  26. package/dist/logger.js +1 -0
  27. package/dist/query-DkitepDi.d.ts +3305 -0
  28. package/dist/query.cjs +19 -0
  29. package/dist/query.d.cts +9 -0
  30. package/dist/query.d.ts +9 -0
  31. package/dist/query.js +3 -0
  32. package/dist/types.cjs +2 -0
  33. package/dist/types.d.cts +90 -0
  34. package/dist/types.d.ts +90 -0
  35. package/dist/types.js +1 -0
  36. package/package.json +98 -56
  37. package/src/constants/api.ts +2 -0
  38. package/src/constants/coinType.ts +2 -0
  39. package/src/constants/common.ts +0 -7
  40. package/src/constants/index.ts +2 -0
  41. package/src/constants/queryKeys.ts +14 -7
  42. package/src/constants/testAddress.ts +1 -0
  43. package/src/datasources/api.ts +34 -0
  44. package/src/datasources/indexer.ts +8 -0
  45. package/src/datasources/onchain.ts +121 -0
  46. package/src/entries/builder.ts +5 -0
  47. package/src/entries/client.ts +3 -0
  48. package/src/entries/errors.ts +2 -0
  49. package/src/entries/index.ts +17 -0
  50. package/src/entries/logger.ts +2 -0
  51. package/src/entries/query.ts +6 -0
  52. package/src/entries/types.ts +2 -0
  53. package/src/errors/ScallopConfigError.ts +8 -0
  54. package/src/errors/ScallopError.ts +30 -0
  55. package/src/errors/ScallopIndexerError.ts +8 -0
  56. package/src/errors/ScallopParseError.ts +8 -0
  57. package/src/errors/ScallopRpcError.ts +8 -0
  58. package/src/errors/ScallopTransactionBuildError.ts +8 -0
  59. package/src/errors/index.ts +6 -0
  60. package/src/logger/Logger.ts +6 -0
  61. package/src/logger/consoleLogger.ts +13 -0
  62. package/src/logger/index.ts +3 -0
  63. package/src/logger/noopLogger.ts +8 -0
  64. package/src/mappers/index.ts +1 -0
  65. package/src/mappers/moveTypeMapper.ts +48 -0
  66. package/src/models/index.ts +8 -10
  67. package/src/models/interface.ts +9 -9
  68. package/src/models/scallop.ts +9 -16
  69. package/src/models/scallopAddress/const.ts +416 -0
  70. package/src/models/scallopAddress/index.ts +188 -0
  71. package/src/models/scallopAddress/types.ts +212 -0
  72. package/src/models/{scallopBuilder.ts → scallopBuilder/index.ts} +65 -29
  73. package/src/models/scallopBuilder/types.ts +37 -0
  74. package/src/models/{scallopClient.ts → scallopClient/index.ts} +157 -598
  75. package/src/models/scallopClient/types.ts +25 -0
  76. package/src/models/scallopConstants/config/AddressConfigSource.ts +13 -0
  77. package/src/models/scallopConstants/config/ConfigValidator.ts +70 -0
  78. package/src/models/scallopConstants/config/PoolAddressConfigSource.ts +12 -0
  79. package/src/models/scallopConstants/config/ScallopConfig.ts +80 -0
  80. package/src/models/scallopConstants/config/ScallopConfigSnapshot.ts +46 -0
  81. package/src/models/scallopConstants/config/WhitelistConfigSource.ts +16 -0
  82. package/src/models/scallopConstants/config/index.ts +6 -0
  83. package/src/models/scallopConstants/const.ts +19 -0
  84. package/src/models/scallopConstants/constantsSource.ts +98 -0
  85. package/src/models/scallopConstants/deriveConstants.ts +150 -0
  86. package/src/models/scallopConstants/index.ts +257 -0
  87. package/src/models/scallopConstants/loadConstantsState.ts +135 -0
  88. package/src/models/scallopConstants/types.ts +77 -0
  89. package/src/models/scallopConstants/utils.ts +69 -0
  90. package/src/models/scallopQuery/index.ts +1279 -0
  91. package/src/models/scallopQuery/types.ts +9 -0
  92. package/src/models/scallopQuery/utils.ts +13 -0
  93. package/src/models/scallopUtils/index.ts +505 -0
  94. package/src/models/scallopUtils/types.ts +30 -0
  95. package/src/models/transactionExecutor.ts +122 -0
  96. package/src/repositories/addressApi/helpers.ts +14 -0
  97. package/src/repositories/addressApi/index.ts +24 -0
  98. package/src/repositories/addressApi/schema.ts +0 -0
  99. package/src/repositories/addressApi/types.ts +177 -0
  100. package/src/repositories/base.ts +38 -0
  101. package/src/repositories/borrowIncentive/bcs.ts +11 -0
  102. package/src/repositories/borrowIncentive/helpers.ts +396 -0
  103. package/src/repositories/borrowIncentive/index.ts +52 -0
  104. package/src/{types/query/borrowIncentive.ts → repositories/borrowIncentive/types.ts} +69 -23
  105. package/src/repositories/borrowIncentive/utils.ts +234 -0
  106. package/src/repositories/cache.ts +4 -0
  107. package/src/repositories/coinBalance/helpers.ts +394 -0
  108. package/src/repositories/coinBalance/index.ts +69 -0
  109. package/src/repositories/coinBalance/types.ts +33 -0
  110. package/src/repositories/flashloan/const.ts +3 -0
  111. package/src/repositories/flashloan/helpers.ts +107 -0
  112. package/src/repositories/flashloan/index.ts +34 -0
  113. package/src/repositories/flashloan/types.ts +16 -0
  114. package/src/repositories/isolatedAssets/bcs.ts +4 -0
  115. package/src/repositories/isolatedAssets/const.ts +2 -0
  116. package/src/repositories/isolatedAssets/helpers.ts +91 -0
  117. package/src/repositories/isolatedAssets/index.ts +42 -0
  118. package/src/repositories/isolatedAssets/types.ts +35 -0
  119. package/src/repositories/loyaltyProgram/bcs.ts +7 -0
  120. package/src/repositories/loyaltyProgram/helpers.ts +117 -0
  121. package/src/repositories/loyaltyProgram/index.ts +28 -0
  122. package/src/repositories/loyaltyProgram/schema.ts +18 -0
  123. package/src/repositories/loyaltyProgram/types.ts +37 -0
  124. package/src/repositories/market/const.ts +6 -0
  125. package/src/repositories/market/helpers.ts +740 -0
  126. package/src/repositories/market/index.ts +137 -0
  127. package/src/repositories/market/mapper.ts +30 -0
  128. package/src/repositories/market/types.ts +443 -0
  129. package/src/repositories/market/utils.ts +285 -0
  130. package/src/repositories/obligation/helpers.ts +228 -0
  131. package/src/repositories/obligation/index.ts +51 -0
  132. package/src/repositories/obligation/types.ts +71 -0
  133. package/src/repositories/obligation/utils.ts +57 -0
  134. package/src/repositories/poolAddresses/const.ts +5 -0
  135. package/src/repositories/poolAddresses/helpers.ts +422 -0
  136. package/src/repositories/poolAddresses/index.ts +56 -0
  137. package/src/repositories/poolAddresses/schema.ts +34 -0
  138. package/src/repositories/poolAddresses/types.ts +69 -0
  139. package/src/repositories/price/const.ts +1 -0
  140. package/src/repositories/price/helpers.ts +237 -0
  141. package/src/repositories/price/index.ts +91 -0
  142. package/src/repositories/price/schema.ts +24 -0
  143. package/src/repositories/price/types.ts +56 -0
  144. package/src/repositories/price/utils.ts +21 -0
  145. package/src/repositories/referral/bcs.ts +3 -0
  146. package/src/repositories/referral/helper.ts +24 -0
  147. package/src/repositories/referral/index.ts +31 -0
  148. package/src/repositories/referral/types.ts +33 -0
  149. package/src/repositories/spool/const.ts +1 -0
  150. package/src/repositories/spool/helpers.ts +471 -0
  151. package/src/repositories/spool/index.ts +135 -0
  152. package/src/{types/query/spool.ts → repositories/spool/types.ts} +67 -2
  153. package/src/repositories/spool/utils.ts +215 -0
  154. package/src/repositories/types.ts +39 -0
  155. package/src/repositories/utils.ts +137 -0
  156. package/src/repositories/veSca/bcs.ts +6 -0
  157. package/src/repositories/veSca/helpers.ts +341 -0
  158. package/src/repositories/veSca/index.ts +57 -0
  159. package/src/repositories/veSca/types.ts +79 -0
  160. package/src/repositories/veScaLoyaltyProgram/bcs.ts +3 -0
  161. package/src/repositories/veScaLoyaltyProgram/helpers.ts +135 -0
  162. package/src/repositories/veScaLoyaltyProgram/index.ts +28 -0
  163. package/src/repositories/veScaLoyaltyProgram/schema.ts +15 -0
  164. package/src/repositories/veScaLoyaltyProgram/types.ts +47 -0
  165. package/src/repositories/wiring/datasources.ts +42 -0
  166. package/src/repositories/wiring/metadata.ts +292 -0
  167. package/src/repositories/wiring/registry.ts +194 -0
  168. package/src/repositories/wiring/source.ts +63 -0
  169. package/src/repositories/xOracle/bcs.ts +7 -0
  170. package/src/repositories/xOracle/const.ts +1 -0
  171. package/src/repositories/xOracle/helpers.ts +304 -0
  172. package/src/repositories/xOracle/index.ts +45 -0
  173. package/src/repositories/xOracle/types.ts +96 -0
  174. package/src/repositories/xOracle/utils.ts +3 -0
  175. package/src/services/client/BorrowService.ts +229 -0
  176. package/src/services/client/CollateralService.ts +76 -0
  177. package/src/services/client/LendingService.ts +75 -0
  178. package/src/services/client/ReferralService.ts +71 -0
  179. package/src/services/client/SpoolService.ts +170 -0
  180. package/src/services/client/VeScaService.ts +142 -0
  181. package/src/services/client/types.ts +44 -0
  182. package/src/services/index.ts +8 -0
  183. package/src/services/query/portfolioCalculations.ts +1171 -0
  184. package/src/txBuilders/borrowIncentive/index.ts +80 -0
  185. package/src/txBuilders/borrowIncentive/moveCalls.ts +124 -0
  186. package/src/txBuilders/borrowIncentive/quick.ts +207 -0
  187. package/src/txBuilders/context.ts +62 -0
  188. package/src/txBuilders/core/index.ts +95 -0
  189. package/src/txBuilders/core/moveCalls.ts +241 -0
  190. package/src/txBuilders/core/quick.ts +306 -0
  191. package/src/{builders → txBuilders}/index.ts +35 -9
  192. package/src/txBuilders/loyaltyProgram/index.ts +78 -0
  193. package/src/txBuilders/loyaltyProgram/moveCalls.ts +44 -0
  194. package/src/txBuilders/loyaltyProgram/quick.ts +58 -0
  195. package/src/txBuilders/manifest.ts +160 -0
  196. package/src/txBuilders/modules.ts +70 -0
  197. package/src/{builders → txBuilders}/oracles/index.ts +3 -2
  198. package/src/{builders → txBuilders}/oracles/pyth.ts +4 -3
  199. package/src/txBuilders/referral/index.ts +72 -0
  200. package/src/txBuilders/referral/moveCalls.ts +93 -0
  201. package/src/txBuilders/referral/quick.ts +57 -0
  202. package/src/txBuilders/sCoin/index.ts +72 -0
  203. package/src/txBuilders/sCoin/moveCalls.ts +36 -0
  204. package/src/txBuilders/sCoin/quick.ts +34 -0
  205. package/src/txBuilders/spool/index.ts +82 -0
  206. package/src/txBuilders/spool/moveCalls.ts +79 -0
  207. package/src/{builders/spoolBuilder.ts → txBuilders/spool/quick.ts} +22 -162
  208. package/src/txBuilders/utils.ts +36 -0
  209. package/src/txBuilders/verify.ts +45 -0
  210. package/src/txBuilders/vesca/index.ts +75 -0
  211. package/src/txBuilders/vesca/moveCalls.ts +147 -0
  212. package/src/{builders/vescaBuilder.ts → txBuilders/vesca/quick.ts} +85 -274
  213. package/src/types/address.ts +4 -178
  214. package/src/types/builder/borrowIncentive.ts +4 -3
  215. package/src/types/builder/core.ts +6 -33
  216. package/src/types/builder/index.ts +5 -1
  217. package/src/types/builder/loyaltyProgram.ts +4 -3
  218. package/src/types/builder/modules.ts +49 -0
  219. package/src/types/builder/referral.ts +5 -4
  220. package/src/types/builder/sCoin.ts +20 -2
  221. package/src/types/builder/spool.ts +22 -2
  222. package/src/types/builder/vesca.ts +4 -12
  223. package/src/types/constant/index.ts +3 -1
  224. package/src/types/constant/queryKeys.ts +15 -8
  225. package/src/types/index.ts +5 -6
  226. package/src/types/internal/dto.ts +46 -0
  227. package/src/types/internal/index.ts +2 -0
  228. package/src/types/internal/move.ts +13 -0
  229. package/src/types/public/index.ts +21 -0
  230. package/src/types/query/core.ts +0 -317
  231. package/src/types/query/index.ts +3 -4
  232. package/src/types/query/portfolio.ts +2 -15
  233. package/src/types/repositories/borrowIncentive.ts +12 -0
  234. package/src/types/repositories/index.ts +9 -0
  235. package/src/types/repositories/loyaltyProgram.ts +2 -0
  236. package/src/types/repositories/market.ts +13 -0
  237. package/src/types/repositories/spool.ts +21 -0
  238. package/src/types/repositories/veSca.ts +5 -0
  239. package/src/types/repositories/veScaLoyaltyProgram.ts +2 -0
  240. package/src/types/sui.ts +0 -1
  241. package/src/utils/array.ts +7 -0
  242. package/src/utils/cache.ts +17 -0
  243. package/src/utils/object.ts +30 -12
  244. package/src/utils/query.ts +9 -190
  245. package/src/utils/vesca.ts +0 -8
  246. package/src/builders/borrowIncentiveBuilder.ts +0 -372
  247. package/src/builders/coreBuilder.ts +0 -636
  248. package/src/builders/loyaltyProgramBuilder.ts +0 -142
  249. package/src/builders/referralBuilder.ts +0 -192
  250. package/src/builders/sCoinBuilder.ts +0 -124
  251. package/src/index.ts +0 -13
  252. package/src/models/scallopAddress.ts +0 -841
  253. package/src/models/scallopAxios.ts +0 -185
  254. package/src/models/scallopConstants.ts +0 -380
  255. package/src/models/scallopIndexer.ts +0 -226
  256. package/src/models/scallopQuery.ts +0 -974
  257. package/src/models/scallopQueryClient.ts +0 -29
  258. package/src/models/scallopSuiKit.ts +0 -480
  259. package/src/models/scallopUtils.ts +0 -734
  260. package/src/queries/borrowIncentiveQuery.ts +0 -361
  261. package/src/queries/borrowLimitQuery.ts +0 -33
  262. package/src/queries/coreQuery.ts +0 -1173
  263. package/src/queries/flashloanFeeQuery.ts +0 -92
  264. package/src/queries/index.ts +0 -15
  265. package/src/queries/isolatedAssetQuery.ts +0 -103
  266. package/src/queries/loyaltyProgramQuery.ts +0 -178
  267. package/src/queries/ownerQuery.ts +0 -32
  268. package/src/queries/poolAddressesQuery.ts +0 -340
  269. package/src/queries/portfolioQuery.ts +0 -1149
  270. package/src/queries/priceQuery.ts +0 -37
  271. package/src/queries/referralQuery.ts +0 -42
  272. package/src/queries/sCoinQuery.ts +0 -195
  273. package/src/queries/spoolQuery.ts +0 -542
  274. package/src/queries/supplyLimitQuery.ts +0 -32
  275. package/src/queries/switchboardQuery.ts +0 -65
  276. package/src/queries/vescaQuery.ts +0 -312
  277. package/src/queries/xOracleQuery.ts +0 -149
  278. package/src/types/constant/common.ts +0 -55
  279. package/src/types/query/loyaltyProgram.ts +0 -12
  280. package/src/types/query/vesca.ts +0 -27
  281. package/src/utils/index.ts +0 -7
  282. package/src/utils/indexer.ts +0 -47
  283. /package/src/{models → datasources}/rateLimiter.ts +0 -0
@@ -1,178 +1,4 @@
1
- import { _SUPPORT_ORACLES, SupportOracleType } from './constant/xOracle.js';
2
-
3
- export interface AddressesInterface {
4
- id?: string;
5
- core: {
6
- version: string;
7
- versionCap: string;
8
- object: string;
9
- market: string;
10
- adminCap: string;
11
- coinDecimalsRegistry: string;
12
- obligationAccessStore: string;
13
- coins: Partial<
14
- Record<
15
- string,
16
- {
17
- id: string;
18
- treasury: string;
19
- metaData: string;
20
- coinType: string;
21
- symbol: string;
22
- decimals: number;
23
- oracle: {
24
- [K in SupportOracleType]: K extends (typeof _SUPPORT_ORACLES)[0]
25
- ? string
26
- : K extends (typeof _SUPPORT_ORACLES)[1]
27
- ? string
28
- : K extends (typeof _SUPPORT_ORACLES)[2]
29
- ? {
30
- feed: string;
31
- feedObject: string;
32
- }
33
- : never;
34
- };
35
- }
36
- >
37
- >;
38
- oracles: {
39
- [K in SupportOracleType]: K extends (typeof _SUPPORT_ORACLES)[0]
40
- ? {
41
- registry: string;
42
- registryCap: string;
43
- holder: string;
44
- }
45
- : K extends (typeof _SUPPORT_ORACLES)[1]
46
- ? {
47
- registry: string;
48
- registryCap: string;
49
- registryTableId: string;
50
- state: string;
51
- }
52
- : K extends (typeof _SUPPORT_ORACLES)[2]
53
- ? {
54
- registry: string;
55
- registryCap: string;
56
- state: string;
57
- wormhole: string;
58
- wormholeState: string;
59
- }
60
- : never;
61
- } & {
62
- xOracle: string;
63
- xOracleCap: string;
64
- primaryPriceUpdatePolicyObject: string;
65
- secondaryPriceUpdatePolicyObject: string;
66
- primaryPriceUpdatePolicyVecsetId: string;
67
- secondaryPriceUpdatePolicyVecsetId: string;
68
- };
69
- packages: Partial<
70
- Record<
71
- string,
72
- {
73
- id: string;
74
- object?: string;
75
- upgradeCap: string;
76
- }
77
- >
78
- >;
79
- };
80
- spool: {
81
- id: string;
82
- adminCap: string;
83
- object: string;
84
- config: string;
85
- pools: Partial<
86
- Record<
87
- string,
88
- {
89
- id: string;
90
- rewardPoolId: string;
91
- }
92
- >
93
- >;
94
- };
95
- borrowIncentive: {
96
- id: string;
97
- adminCap: string;
98
- object: string;
99
- query: string;
100
- config: string;
101
- incentivePools: string;
102
- incentiveAccounts: string;
103
- };
104
- vesca: {
105
- id: string;
106
- object: string;
107
- adminCap: string;
108
- tableId: string;
109
- table: string;
110
- treasury: string;
111
- config: string;
112
- subsTable: string;
113
- subsTableId: string;
114
- subsWhitelist: string;
115
- };
116
- referral: {
117
- id: string;
118
- version: string;
119
- object: string;
120
- adminCap: string;
121
- referralBindings: string;
122
- bindingTableId: string;
123
- referralRevenuePool: string;
124
- revenueTableId: string;
125
- referralTiers: string;
126
- tiersTableId: string;
127
- authorizedWitnessList: string;
128
- };
129
- loyaltyProgram: {
130
- id: string;
131
- adminCap?: string;
132
- object: string;
133
- rewardPool: string;
134
- userRewardTableId: string;
135
- };
136
- veScaLoyaltyProgram: {
137
- id: string;
138
- adminCap?: string;
139
- object: string;
140
- veScaRewardPool: string;
141
- veScaRewardTableId: string;
142
- };
143
- scoin: {
144
- id: string;
145
- coins: Partial<
146
- Record<
147
- string,
148
- {
149
- coinType: string;
150
- symbol: string;
151
- treasury: string;
152
- metaData: string;
153
- }
154
- >
155
- >;
156
- };
157
- }
158
-
159
- type AddressPathsProps<T> = T extends string
160
- ? []
161
- : {
162
- [K in Extract<keyof T, string>]: [K, ...AddressPathsProps<T[K]>];
163
- }[Extract<keyof T, string>];
164
-
165
- type Join<T extends string[], D extends string> = T extends []
166
- ? never
167
- : T extends [infer F]
168
- ? F
169
- : T extends [infer F, ...infer R]
170
- ? F extends string
171
- ? `${F}${D}${Join<Extract<R, string[]>, D>}`
172
- : never
173
- : string;
174
-
175
- export type AddressStringPath = Join<
176
- AddressPathsProps<AddressesInterface>,
177
- '.'
178
- >;
1
+ export type {
2
+ AddressesInterface,
3
+ AddressStringPath,
4
+ } from 'src/models/scallopAddress/types.js';
@@ -3,7 +3,8 @@ import type {
3
3
  SuiObjectArg,
4
4
  } from '@scallop-io/sui-kit';
5
5
  import type { TransactionResult } from '@mysten/sui/transactions';
6
- import type { ScallopBuilder } from '../../models/index.js';
6
+ import type { MoveCallContext } from 'src/txBuilders/context.js';
7
+ import type { BorrowIncentiveActionContext } from 'src/txBuilders/borrowIncentive/quick.js';
7
8
 
8
9
  export type BorrowIncentiveIds = {
9
10
  borrowIncentivePkg: string;
@@ -64,11 +65,11 @@ export type BorrowIncentiveTxBlock =
64
65
  SuiTxBlockWithBorrowIncentiveNormalMethods & BorrowIncentiveQuickMethods;
65
66
 
66
67
  export type GenerateBorrowIncentiveNormalMethod = (params: {
67
- builder: ScallopBuilder;
68
+ ctx: MoveCallContext;
68
69
  txBlock: SuiKitTxBlock;
69
70
  }) => BorrowIncentiveNormalMethods;
70
71
 
71
72
  export type GenerateBorrowIncentiveQuickMethod = (params: {
72
- builder: ScallopBuilder;
73
+ ctx: BorrowIncentiveActionContext;
73
74
  txBlock: SuiTxBlockWithBorrowIncentiveNormalMethods;
74
75
  }) => BorrowIncentiveQuickMethods;
@@ -9,7 +9,10 @@ import type {
9
9
  Transaction,
10
10
  } from '@mysten/sui/transactions';
11
11
  import { SuiTxBlockWithSpool } from './index.js';
12
- import { ScallopBuilder } from 'src/models/index.js';
12
+ import type {
13
+ CoreActionContext,
14
+ MoveCallContext,
15
+ } from 'src/txBuilders/context.js';
13
16
 
14
17
  export type CoreIds = {
15
18
  protocolPkg: string;
@@ -36,14 +39,6 @@ export type CoreNormalMethods = {
36
39
  obligationHotPotato: SuiObjectArg
37
40
  ) => void;
38
41
  openObligationEntry: () => void;
39
- /**
40
- * @deprecated Use {@link depositCollateral} instead.
41
- */
42
- addCollateral: (
43
- obligation: SuiObjectArg,
44
- coin: SuiObjectArg,
45
- collateralCoinName: string
46
- ) => void;
47
42
  depositCollateral: (
48
43
  obligation: SuiObjectArg,
49
44
  coin: SuiObjectArg,
@@ -55,10 +50,6 @@ export type CoreNormalMethods = {
55
50
  amount: number,
56
51
  collateralCoinName: string
57
52
  ) => TransactionResult;
58
- /**
59
- * @deprecated Use {@link supply} instead.
60
- */
61
- deposit: (coin: SuiObjectArg, poolCoinName: string) => TransactionResult;
62
53
  supply: (coin: SuiObjectArg, poolCoinName: string) => TransactionResult;
63
54
  depositEntry: (coin: SuiObjectArg, poolCoinName: string) => TransactionResult;
64
55
  withdraw: (
@@ -111,15 +102,6 @@ export type CoreNormalMethods = {
111
102
  };
112
103
 
113
104
  export type CoreQuickMethods = {
114
- /**
115
- * @deprecated Use {@link depositCollateralQuick} instead.
116
- */
117
- addCollateralQuick: (
118
- amount: number,
119
- collateralCoinName: string,
120
- obligationId?: SuiObjectArg,
121
- isSponsoredTx?: boolean
122
- ) => Promise<void>;
123
105
  depositCollateralQuick: (
124
106
  amount: number,
125
107
  collateralCoinName: string,
@@ -163,15 +145,6 @@ export type CoreQuickMethods = {
163
145
  isSponsoredTx?: boolean;
164
146
  }
165
147
  ) => Promise<TransactionResult>;
166
- /**
167
- * @deprecated Use {@link supplyQuick} instead.
168
- */
169
- depositQuick: (
170
- amount: number,
171
- poolCoinName: string,
172
- returnSCoin?: boolean,
173
- isSponsoredTx?: boolean
174
- ) => Promise<TransactionResult>;
175
148
  supplyQuick: (
176
149
  amount: number,
177
150
  poolCoinName: string,
@@ -218,11 +191,11 @@ export type SuiTxBlockWithCoreNormalMethods = SuiKitTxBlock &
218
191
  export type CoreTxBlock = SuiTxBlockWithCoreNormalMethods & CoreQuickMethods;
219
192
 
220
193
  export type GenerateCoreNormalMethod = (params: {
221
- builder: ScallopBuilder;
194
+ ctx: MoveCallContext;
222
195
  txBlock: SuiKitTxBlock;
223
196
  }) => CoreNormalMethods;
224
197
 
225
198
  export type GenerateCoreQuickMethod = (params: {
226
- builder: ScallopBuilder;
199
+ ctx: CoreActionContext;
227
200
  txBlock: SuiTxBlockWithCoreNormalMethods;
228
201
  }) => CoreQuickMethods;
@@ -5,6 +5,7 @@ import type { VeScaTxBlock } from './vesca.js';
5
5
  import type { ReferralTxBlock } from './referral.js';
6
6
  import { LoyaltyProgramTxBlock } from './loyaltyProgram.js';
7
7
  import { SCoinTxBlock } from './sCoin.js';
8
+ import type { ScallopTxBlockModules } from './modules.js';
8
9
 
9
10
  export type * from './core.js';
10
11
  export type * from './spool.js';
@@ -12,6 +13,7 @@ export type * from './borrowIncentive.js';
12
13
  export type * from './vesca.js';
13
14
  export type * from './loyaltyProgram.js';
14
15
  export type * from './sCoin.js';
16
+ export type * from './modules.js';
15
17
 
16
18
  export type BaseScallopTxBlock = ReferralTxBlock &
17
19
  LoyaltyProgramTxBlock &
@@ -20,4 +22,6 @@ export type BaseScallopTxBlock = ReferralTxBlock &
20
22
 
21
23
  export type SuiTxBlockWithSCoin = BaseScallopTxBlock & SCoinTxBlock;
22
24
  export type SuiTxBlockWithSpool = SuiTxBlockWithSCoin & SpoolTxBlock;
23
- export type ScallopTxBlock = SuiTxBlockWithSpool & CoreTxBlock;
25
+ export type ScallopTxBlock = SuiTxBlockWithSpool &
26
+ CoreTxBlock &
27
+ ScallopTxBlockModules;
@@ -3,7 +3,8 @@ import {
3
3
  SuiTxBlock as SuiKitTxBlock,
4
4
  TransactionResult,
5
5
  } from '@scallop-io/sui-kit';
6
- import { type ScallopBuilder } from 'src/models/index.js';
6
+ import type { MoveCallContext } from 'src/txBuilders/context.js';
7
+ import type { LoyaltyProgramActionContext } from 'src/txBuilders/loyaltyProgram/quick.js';
7
8
 
8
9
  export type LoyaltyProgramNormalMethods = {
9
10
  claimLoyaltyRevenue: (veScaKey: SuiObjectArg) => TransactionResult;
@@ -21,11 +22,11 @@ export type LoyaltyProgramTxBlock = SuiTxBlockWithLoyaltyProgramNormalMethods &
21
22
  LoyaltyProgramQuickMethods;
22
23
 
23
24
  export type GenerateLoyaltyProgramNormalMethod = (params: {
24
- builder: ScallopBuilder;
25
+ ctx: MoveCallContext;
25
26
  txBlock: SuiKitTxBlock;
26
27
  }) => LoyaltyProgramNormalMethods;
27
28
 
28
29
  export type GenerateLoyaltyProgramQuickMethod = (params: {
29
- builder: ScallopBuilder;
30
+ ctx: LoyaltyProgramActionContext;
30
31
  txBlock: SuiTxBlockWithLoyaltyProgramNormalMethods;
31
32
  }) => LoyaltyProgramQuickMethods;
@@ -0,0 +1,49 @@
1
+ import type { CoreNormalMethods, CoreQuickMethods } from './core.js';
2
+ import type { SpoolNormalMethods, SpoolQuickMethods } from './spool.js';
3
+ import type {
4
+ BorrowIncentiveNormalMethods,
5
+ BorrowIncentiveQuickMethods,
6
+ } from './borrowIncentive.js';
7
+ import type { VeScaNormalMethods, VeScaQuickMethods } from './vesca.js';
8
+ import type {
9
+ ReferralNormalMethods,
10
+ ReferralQuickMethods,
11
+ } from './referral.js';
12
+ import type {
13
+ LoyaltyProgramNormalMethods,
14
+ LoyaltyProgramQuickMethods,
15
+ } from './loyaltyProgram.js';
16
+ import type { sCoinNormalMethods, sCoinQuickMethods } from './sCoin.js';
17
+
18
+ /**
19
+ * Per-domain method bundles. Each bundle is the union of a module's normal
20
+ * and quick methods, without SuiTxBlock/runtime-proxy noise.
21
+ *
22
+ * Used by the explicit composite API on `ScallopTxBlock`:
23
+ *
24
+ * tx.core.supply(...)
25
+ * tx.spool.stake(...)
26
+ * tx.vesca.lockSca(...)
27
+ *
28
+ * The flat methods (`tx.supply`, `tx.stake`, …) remain available as a
29
+ * compatibility layer.
30
+ */
31
+ export type CoreModule = CoreNormalMethods & CoreQuickMethods;
32
+ export type SpoolModule = SpoolNormalMethods & SpoolQuickMethods;
33
+ export type BorrowIncentiveModule = BorrowIncentiveNormalMethods &
34
+ BorrowIncentiveQuickMethods;
35
+ export type VeScaModule = VeScaNormalMethods & VeScaQuickMethods;
36
+ export type ReferralModule = ReferralNormalMethods & ReferralQuickMethods;
37
+ export type LoyaltyModule = LoyaltyProgramNormalMethods &
38
+ LoyaltyProgramQuickMethods;
39
+ export type SCoinModule = sCoinNormalMethods & sCoinQuickMethods;
40
+
41
+ export interface ScallopTxBlockModules {
42
+ readonly core: CoreModule;
43
+ readonly spool: SpoolModule;
44
+ readonly borrowIncentive: BorrowIncentiveModule;
45
+ readonly vesca: VeScaModule;
46
+ readonly referral: ReferralModule;
47
+ readonly loyalty: LoyaltyModule;
48
+ readonly sCoin: SCoinModule;
49
+ }
@@ -3,7 +3,8 @@ import {
3
3
  TransactionResult,
4
4
  SuiTxBlock as SuiKitTxBlock,
5
5
  } from '@scallop-io/sui-kit';
6
- import { ScallopBuilder } from 'src/models/index.js';
6
+ import type { MoveCallContext } from 'src/txBuilders/context.js';
7
+ import type { ReferralActionContext } from 'src/txBuilders/referral/quick.js';
7
8
 
8
9
  export type ReferralIds = {
9
10
  referralPgkId: string;
@@ -28,7 +29,7 @@ export type ReferralNormalMethods = {
28
29
  export type ReferralQuickMethods = {
29
30
  claimReferralRevenueQuick: (
30
31
  veScaKey: SuiObjectArg,
31
- coinNames: string[]
32
+ coinNames?: string[]
32
33
  ) => Promise<void>;
33
34
  };
34
35
 
@@ -38,11 +39,11 @@ export type ReferralTxBlock = SuiTxBlockWithReferralNormalMethods &
38
39
  ReferralQuickMethods;
39
40
 
40
41
  export type GenerateReferralNormalMethod = (params: {
41
- builder: ScallopBuilder;
42
+ ctx: MoveCallContext;
42
43
  txBlock: SuiKitTxBlock;
43
44
  }) => ReferralNormalMethods;
44
45
 
45
46
  export type GenerateReferralQuickMethod = (params: {
46
- builder: ScallopBuilder;
47
+ ctx: ReferralActionContext;
47
48
  txBlock: SuiTxBlockWithReferralNormalMethods;
48
49
  }) => ReferralQuickMethods;
@@ -5,11 +5,29 @@ import {
5
5
  } from '@scallop-io/sui-kit';
6
6
  import { ScallopBuilder } from 'src/models/index.js';
7
7
  import { BaseScallopTxBlock } from './index.js';
8
+ import type { MoveCallContext } from 'src/txBuilders/context.js';
8
9
 
9
10
  export type sCoinPkgIds = {
10
11
  pkgId: string;
11
12
  };
12
13
 
14
+ /**
15
+ * The explicit orchestration toolkit an sCoin quick method needs.
16
+ *
17
+ * @description
18
+ * Narrow context injected into {@link generateSCoinQuickMethod}. Built once from
19
+ * `builder` in the factory and passed (instead of `builder`) into the quick
20
+ * generator. Method signatures are taken via indexed-access types so they stay
21
+ * in sync with `ScallopBuilder`.
22
+ */
23
+ export type SCoinActionContext = {
24
+ utils: ScallopBuilder['utils'];
25
+ coins: {
26
+ selectMarketCoin: ScallopBuilder['selectMarketCoin'];
27
+ selectSCoin: ScallopBuilder['selectSCoin'];
28
+ };
29
+ };
30
+
13
31
  export type sCoinNormalMethods = {
14
32
  /**
15
33
  * Lock marketCoin and return sCoin
@@ -47,11 +65,11 @@ export type SuiTxBlockWithSCoinNormalMethods = SuiKitTxBlock &
47
65
  export type SCoinTxBlock = SuiTxBlockWithSCoinNormalMethods & sCoinQuickMethods;
48
66
 
49
67
  export type GenerateSCoinNormalMethod = (params: {
50
- builder: ScallopBuilder;
68
+ ctx: MoveCallContext;
51
69
  txBlock: SuiKitTxBlock;
52
70
  }) => sCoinNormalMethods;
53
71
 
54
72
  export type GenerateSCoinQuickMethod = (params: {
55
- builder: ScallopBuilder;
73
+ ctx: SCoinActionContext;
56
74
  txBlock: SuiTxBlockWithSCoinNormalMethods;
57
75
  }) => sCoinQuickMethods;
@@ -5,12 +5,32 @@ import type {
5
5
  } from '@scallop-io/sui-kit';
6
6
  import type { TransactionResult } from '@mysten/sui/transactions';
7
7
  import type { ScallopBuilder } from '../../models/index.js';
8
+ import type { MoveCallContext } from '../../txBuilders/context.js';
8
9
  import { SuiTxBlockWithSCoin } from './index.js';
9
10
 
10
11
  export type SpoolIds = {
11
12
  spoolPkg: string;
12
13
  };
13
14
 
15
+ /**
16
+ * The explicit orchestration toolkit a spool quick method needs.
17
+ *
18
+ * @description
19
+ * Narrow context injected into {@link GenerateSpoolQuickMethod}. Built once from
20
+ * `builder` in the factory and passed (instead of `builder`) into the quick
21
+ * generator. Method signatures are taken via indexed-access types so they stay
22
+ * in sync with `ScallopBuilder`.
23
+ */
24
+ export type SpoolActionContext = {
25
+ reads: {
26
+ getAllStakeAccounts: ScallopBuilder['query']['getAllStakeAccounts'];
27
+ };
28
+ coins: {
29
+ selectMarketCoin: ScallopBuilder['selectMarketCoin'];
30
+ selectSCoin: ScallopBuilder['selectSCoin'];
31
+ };
32
+ };
33
+
14
34
  export type SpoolNormalMethods = {
15
35
  createStakeAccount: (stakeMarketCoinName: string) => TransactionResult;
16
36
  stake: (
@@ -54,11 +74,11 @@ export type SuiTxBlockWithSpoolNormalMethods = SuiKitTxBlock &
54
74
  export type SpoolTxBlock = SuiTxBlockWithSpoolNormalMethods & SpoolQuickMethods;
55
75
 
56
76
  export type GenerateSpoolNormalMethod = (params: {
57
- builder: ScallopBuilder;
77
+ ctx: MoveCallContext;
58
78
  txBlock: SuiKitTxBlock;
59
79
  }) => SpoolNormalMethods;
60
80
 
61
81
  export type GenerateSpoolQuickMethod = (params: {
62
- builder: ScallopBuilder;
82
+ ctx: SpoolActionContext;
63
83
  txBlock: SuiTxBlockWithSpoolNormalMethods;
64
84
  }) => SpoolQuickMethods;
@@ -1,17 +1,9 @@
1
1
  import { SuiTxBlock as SuiKitTxBlock, SuiObjectArg } from '@scallop-io/sui-kit';
2
2
  import type { TransactionResult } from '@mysten/sui/transactions';
3
- import { ScallopBuilder } from 'src/models/index.js';
3
+ import type { MoveCallContext } from 'src/txBuilders/context.js';
4
+ import type { VeScaActionContext } from 'src/txBuilders/vesca/quick.js';
4
5
  import type { SuiObjectData } from '../sui.js';
5
6
 
6
- /** Dynamic field response structure from queryGetDynamicFieldObject (subs table) - SDK v2 */
7
- export type DynamicFieldResponseWithContents = {
8
- object?: {
9
- json?: {
10
- value?: { contents?: unknown[] };
11
- };
12
- };
13
- };
14
-
15
7
  export type VeScaNormalMethods = {
16
8
  lockSca: (
17
9
  scaCoin: SuiObjectArg,
@@ -103,11 +95,11 @@ export type SuiTxBlockWithVeScaNormalMethods = SuiKitTxBlock &
103
95
  export type VeScaTxBlock = SuiTxBlockWithVeScaNormalMethods & VeScaQuickMethods;
104
96
 
105
97
  export type GenerateVeScaNormalMethod = (params: {
106
- builder: ScallopBuilder;
98
+ ctx: MoveCallContext;
107
99
  txBlock: SuiKitTxBlock;
108
100
  }) => VeScaNormalMethods;
109
101
 
110
102
  export type GenerateVeScaQuickMethod = (params: {
111
- builder: ScallopBuilder;
103
+ ctx: VeScaActionContext;
112
104
  txBlock: SuiTxBlockWithVeScaNormalMethods;
113
105
  }) => VeScaQuickMethods;
@@ -1,3 +1,5 @@
1
- export type * from './common.js';
2
1
  export type * from './enum.js';
3
2
  export type * from './xOracle.js';
3
+ export type { PoolAddress } from 'src/repositories/poolAddresses/types.js';
4
+ export type { CoinWrappedType } from 'src/models/scallopUtils/types.js';
5
+ export type { Whitelist } from 'src/models/scallopConstants/types.js';
@@ -1,14 +1,14 @@
1
+ import { SuiClientTypes } from '@mysten/sui/client';
1
2
  import type {
2
3
  SuiAmountsArg,
3
4
  SuiObjectArg,
4
5
  SuiTxArg,
5
6
  } from '@scallop-io/sui-kit';
6
7
  import type {
7
- SuiObjectData,
8
- SuiObjectDataOptions,
9
8
  GetDynamicFieldObjectParams,
10
9
  GetDynamicFieldsParams,
11
- GetOwnedObjectsParams,
10
+ SuiObjectData,
11
+ SuiObjectDataOptions,
12
12
  } from '../sui.js';
13
13
 
14
14
  export namespace QueryKeys {
@@ -26,21 +26,24 @@ export namespace QueryKeys {
26
26
  queryTarget?: string;
27
27
  args?: SuiObjectArg[];
28
28
  typeArgs?: any[];
29
+ include?: SuiClientTypes.SimulateTransactionInclude;
29
30
  };
30
31
  export type GetObject = BaseType & {
31
32
  objectId?: string;
32
- options?: SuiObjectDataOptions;
33
+ include?: SuiObjectDataOptions;
33
34
  };
34
- export type GetObjects = BaseType & {
35
- objectIds?: string[];
35
+ export type GetSharedObject = BaseType & {
36
+ objectId?: string;
36
37
  };
37
- export type GetOwnedObjects = BaseType & Partial<GetOwnedObjectsParams>;
38
+ export type GetObjects = BaseType & SuiClientTypes.GetObjectsOptions;
39
+ export type GetOwnedObjects = BaseType &
40
+ Partial<SuiClientTypes.ListOwnedObjectsOptions>;
38
41
  export type GetDynamicFields = BaseType & Partial<GetDynamicFieldsParams>;
39
42
  export type GetDynamicFieldObject = BaseType &
40
43
  Partial<GetDynamicFieldObjectParams>;
41
44
  export type getTotalVeScaTreasuryAmount = BaseType & {
42
45
  refreshArgs?: any[];
43
- vescaAmountArgs?: (
46
+ veScaAmountArgs?: (
44
47
  | string
45
48
  | SuiObjectData
46
49
  | SuiTxArg
@@ -48,6 +51,10 @@ export namespace QueryKeys {
48
51
  | SuiObjectArg
49
52
  )[];
50
53
  };
54
+ export type GetCoinBalance = BaseType & {
55
+ address?: string;
56
+ coinType?: string;
57
+ };
51
58
  export type GetAllCoinBalances = BaseType & {
52
59
  activeAddress?: string;
53
60
  };
@@ -1,6 +1,5 @@
1
- export type * from './sui.js';
2
- export type * from './builder/index.js';
3
- export type * from './constant/index.js';
4
- export type * from './query/index.js';
5
- export type * from './address.js';
6
- export type * from './utils.js';
1
+ // Root types barrel. Delegates to the public surface for back-compat — every
2
+ // type previously reachable from `src/types/index.js` is still reachable here.
3
+ // Internal-only types live under `src/types/internal/` and are intentionally
4
+ // not re-exported via this barrel.
5
+ export type * from './public/index.js';
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Internal-only DTO types — raw on-chain JSON shapes and the
3
+ * intermediate parsed / calculated views built from them.
4
+ *
5
+ * Re-exported from their current `src/types/query/*` locations to establish
6
+ * a single internal import path. Public-surface back-compat is preserved
7
+ * via the existing exports in `src/types/query/*` (they continue to be
8
+ * re-exported through `src/types/public/index.ts`). Internal code should
9
+ * prefer `import { ... } from 'src/types/internal/index.js'` (or the more
10
+ * specific `'src/types/internal/dto.js'`) to keep the boundary visible.
11
+ *
12
+ * Anything reachable from here is NOT governed by semver — these shapes
13
+ * track on-chain payloads and parser internals and may change without a
14
+ * major bump. Consumers that want to do their own parsing should rely on
15
+ * the higher-level types in `src/types/query/*` or on the mapper output
16
+ * types directly.
17
+ */
18
+ export type {
19
+ OriginMarketPoolData,
20
+ ParsedMarketPoolData,
21
+ CalculatedMarketPoolData,
22
+ OriginMarketCollateralData,
23
+ ParsedMarketCollateralData,
24
+ CalculatedMarketCollateralData,
25
+ } from '../../repositories/market/types.js';
26
+
27
+ export type {
28
+ OriginSpoolData,
29
+ ParsedSpoolData,
30
+ CalculatedSpoolData,
31
+ OriginSpoolRewardPoolData,
32
+ ParsedSpoolRewardPoolData,
33
+ CalculatedSpoolRewardPoolData,
34
+ } from '../../repositories/spool/types.js';
35
+
36
+ export type {
37
+ OriginBorrowIncentivePoolPointData,
38
+ OriginBorrowIncentivePoolData,
39
+ ParsedBorrowIncentivePoolPointData,
40
+ ParsedBorrowIncentivePoolData,
41
+ CalculatedBorrowIncentivePoolPointData,
42
+ OriginBorrowIncentiveAccountPoolData,
43
+ OriginBorrowIncentiveAccountData,
44
+ ParsedBorrowIncentiveAccountPoolData,
45
+ ParsedBorrowIncentiveAccountData,
46
+ } from '../../repositories/borrowIncentive/types.js';
@@ -0,0 +1,2 @@
1
+ export type * from './move.js';
2
+ export type * from './dto.js';