@gala-chain/launchpad-sdk 3.31.2 → 4.0.1-beta.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 (369) hide show
  1. package/API.md +525 -5
  2. package/CHANGELOG.md +101 -9
  3. package/EXAMPLES.md +923 -0
  4. package/README.md +539 -15
  5. package/dist/index.cjs.js +1 -1
  6. package/dist/index.d.ts +37 -27
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.esm.js +1 -1
  9. package/dist/index.js +1 -1
  10. package/dist/{LaunchpadSDK.d.ts → src/LaunchpadSDK.d.ts} +1333 -37
  11. package/dist/src/LaunchpadSDK.d.ts.map +1 -0
  12. package/dist/src/api/LaunchpadAPI.d.ts.map +1 -0
  13. package/dist/src/api/dto/BondingCurveDTOs.d.ts.map +1 -0
  14. package/dist/src/api/dto/LockTokenDto.d.ts +97 -0
  15. package/dist/src/api/dto/LockTokenDto.d.ts.map +1 -0
  16. package/dist/src/api/dto/TransferTokenDto.d.ts.map +1 -0
  17. package/dist/src/api/dto/UnlockTokenDto.d.ts +86 -0
  18. package/dist/src/api/dto/UnlockTokenDto.d.ts.map +1 -0
  19. package/dist/src/auth/SignatureAuth.d.ts.map +1 -0
  20. package/dist/src/auth/types.d.ts.map +1 -0
  21. package/dist/src/config/environments.d.ts.map +1 -0
  22. package/dist/src/constants/bondingCurve.d.ts.map +1 -0
  23. package/dist/src/constants/config.d.ts.map +1 -0
  24. package/dist/src/constants/counts.d.ts.map +1 -0
  25. package/dist/src/constants/decimals.d.ts.map +1 -0
  26. package/dist/src/constants/endpoints.d.ts.map +1 -0
  27. package/dist/src/constants/enums.d.ts.map +1 -0
  28. package/dist/src/constants/error-messages.d.ts.map +1 -0
  29. package/dist/src/constants/pagination.d.ts.map +1 -0
  30. package/dist/src/constants/query-fields.d.ts.map +1 -0
  31. package/dist/src/constants/version.d.ts.map +1 -0
  32. package/dist/{constants → src/constants}/version.generated.d.ts +1 -1
  33. package/dist/src/constants/version.generated.d.ts.map +1 -0
  34. package/dist/src/helpers/sdk.d.ts.map +1 -0
  35. package/dist/src/helpers/wallet.d.ts.map +1 -0
  36. package/dist/src/index.d.ts +51 -0
  37. package/dist/src/index.d.ts.map +1 -0
  38. package/dist/src/polyfills/file-global.d.ts.map +1 -0
  39. package/dist/src/schemas/files.d.ts.map +1 -0
  40. package/dist/src/schemas/index.d.ts.map +1 -0
  41. package/dist/src/schemas/launchpad.d.ts.map +1 -0
  42. package/dist/src/schemas/pagination.d.ts.map +1 -0
  43. package/dist/src/schemas/primitives.d.ts.map +1 -0
  44. package/dist/src/schemas/trade.d.ts.map +1 -0
  45. package/dist/src/schemas/user.d.ts.map +1 -0
  46. package/dist/src/schemas/validators.d.ts.map +1 -0
  47. package/dist/src/services/BaseService.d.ts.map +1 -0
  48. package/dist/src/services/BundleService.d.ts.map +1 -0
  49. package/dist/src/services/CommentService.d.ts.map +1 -0
  50. package/dist/src/services/DexBackendClient.d.ts +46 -0
  51. package/dist/src/services/DexBackendClient.d.ts.map +1 -0
  52. package/dist/src/services/DexPoolService.d.ts +137 -0
  53. package/dist/src/services/DexPoolService.d.ts.map +1 -0
  54. package/dist/src/services/DexQuoteService.d.ts +288 -0
  55. package/dist/src/services/DexQuoteService.d.ts.map +1 -0
  56. package/dist/{services → src/services}/DexService.d.ts +83 -9
  57. package/dist/src/services/DexService.d.ts.map +1 -0
  58. package/dist/src/services/FaucetService.d.ts.map +1 -0
  59. package/dist/src/services/GSwapService.d.ts +817 -0
  60. package/dist/src/services/GSwapService.d.ts.map +1 -0
  61. package/dist/src/services/GalaChainGatewayClient.d.ts +98 -0
  62. package/dist/src/services/GalaChainGatewayClient.d.ts.map +1 -0
  63. package/dist/{services → src/services}/GalaChainService.d.ts +99 -4
  64. package/dist/src/services/GalaChainService.d.ts.map +1 -0
  65. package/dist/src/services/ImageService.d.ts.map +1 -0
  66. package/dist/src/services/LaunchpadService.d.ts.map +1 -0
  67. package/dist/src/services/MultiPoolStateManager.d.ts +284 -0
  68. package/dist/src/services/MultiPoolStateManager.d.ts.map +1 -0
  69. package/dist/src/services/PoolCacheManager.d.ts +171 -0
  70. package/dist/src/services/PoolCacheManager.d.ts.map +1 -0
  71. package/dist/src/services/PoolService.d.ts.map +1 -0
  72. package/dist/src/services/PoolStateManager.d.ts +176 -0
  73. package/dist/src/services/PoolStateManager.d.ts.map +1 -0
  74. package/dist/{services → src/services}/PriceHistoryService.d.ts +5 -5
  75. package/dist/src/services/PriceHistoryService.d.ts.map +1 -0
  76. package/dist/{services → src/services}/SignatureService.d.ts +13 -35
  77. package/dist/src/services/SignatureService.d.ts.map +1 -0
  78. package/dist/src/services/SwapEventQueue.d.ts +123 -0
  79. package/dist/src/services/SwapEventQueue.d.ts.map +1 -0
  80. package/dist/src/services/TokenClassKeyService.d.ts.map +1 -0
  81. package/dist/{services → src/services}/TokenMetadataCache.d.ts +5 -5
  82. package/dist/src/services/TokenMetadataCache.d.ts.map +1 -0
  83. package/dist/{services → src/services}/TokenMetadataService.d.ts +3 -3
  84. package/dist/src/services/TokenMetadataService.d.ts.map +1 -0
  85. package/dist/src/services/TokenResolverService.d.ts.map +1 -0
  86. package/dist/src/services/TradeService.d.ts.map +1 -0
  87. package/dist/src/services/UserService.d.ts.map +1 -0
  88. package/dist/src/services/WebSocketManager.d.ts.map +1 -0
  89. package/dist/src/services/WebSocketService.d.ts +183 -0
  90. package/dist/src/services/WebSocketService.d.ts.map +1 -0
  91. package/dist/src/services/__mocks__/logger.mock.d.ts +17 -0
  92. package/dist/src/services/__mocks__/logger.mock.d.ts.map +1 -0
  93. package/dist/{setup.d.ts.map → src/setup.d.ts.map} +1 -1
  94. package/dist/{types → src/types}/backend-responses.d.ts +17 -0
  95. package/dist/src/types/backend-responses.d.ts.map +1 -0
  96. package/dist/src/types/comment.dto.d.ts.map +1 -0
  97. package/dist/{types → src/types}/common.d.ts +2 -0
  98. package/dist/src/types/common.d.ts.map +1 -0
  99. package/dist/src/types/composite-pool.dto.d.ts +103 -0
  100. package/dist/src/types/composite-pool.dto.d.ts.map +1 -0
  101. package/dist/{types → src/types}/dex-pool.dto.d.ts +56 -5
  102. package/dist/src/types/dex-pool.dto.d.ts.map +1 -0
  103. package/dist/{types → src/types}/dto.d.ts +6 -6
  104. package/dist/src/types/dto.d.ts.map +1 -0
  105. package/dist/src/types/eip712-types.d.ts +140 -0
  106. package/dist/src/types/eip712-types.d.ts.map +1 -0
  107. package/dist/src/types/galachain-api.types.d.ts +216 -0
  108. package/dist/src/types/galachain-api.types.d.ts.map +1 -0
  109. package/dist/src/types/gswap-responses.types.d.ts +366 -0
  110. package/dist/src/types/gswap-responses.types.d.ts.map +1 -0
  111. package/dist/{types → src/types}/gswap.dto.d.ts +58 -3
  112. package/dist/src/types/gswap.dto.d.ts.map +1 -0
  113. package/dist/{types → src/types}/launchpad.dto.d.ts +232 -0
  114. package/dist/src/types/launchpad.dto.d.ts.map +1 -0
  115. package/dist/src/types/launchpad.validation.d.ts.map +1 -0
  116. package/dist/src/types/liquidity-monitor.dto.d.ts +177 -0
  117. package/dist/src/types/liquidity-monitor.dto.d.ts.map +1 -0
  118. package/dist/src/types/lock.dto.d.ts +146 -0
  119. package/dist/src/types/lock.dto.d.ts.map +1 -0
  120. package/dist/src/types/options.dto.d.ts.map +1 -0
  121. package/dist/src/types/pool-state-delta.dto.d.ts +246 -0
  122. package/dist/src/types/pool-state-delta.dto.d.ts.map +1 -0
  123. package/dist/src/types/pool-state-manager-config.dto.d.ts +103 -0
  124. package/dist/src/types/pool-state-manager-config.dto.d.ts.map +1 -0
  125. package/dist/{types → src/types}/priceHistory.dto.d.ts +4 -4
  126. package/dist/src/types/priceHistory.dto.d.ts.map +1 -0
  127. package/dist/src/types/result.types.d.ts.map +1 -0
  128. package/dist/src/types/swap-monitor.dto.d.ts +256 -0
  129. package/dist/src/types/swap-monitor.dto.d.ts.map +1 -0
  130. package/dist/src/types/trade.dto.d.ts.map +1 -0
  131. package/dist/src/types/transfer.dto.d.ts.map +1 -0
  132. package/dist/src/types/user.dto.d.ts.map +1 -0
  133. package/dist/src/types/websocket-data.types.d.ts.map +1 -0
  134. package/dist/src/types/websocket.types.d.ts.map +1 -0
  135. package/dist/src/utils/LiquidityEventExtractor.d.ts +99 -0
  136. package/dist/src/utils/LiquidityEventExtractor.d.ts.map +1 -0
  137. package/dist/src/utils/Logger.d.ts.map +1 -0
  138. package/dist/src/utils/MonitoringMetrics.d.ts +152 -0
  139. package/dist/src/utils/MonitoringMetrics.d.ts.map +1 -0
  140. package/dist/src/utils/PoolKeyNormalizer.d.ts +135 -0
  141. package/dist/src/utils/PoolKeyNormalizer.d.ts.map +1 -0
  142. package/dist/{utils → src/utils}/SignatureHelper.d.ts +38 -0
  143. package/dist/src/utils/SignatureHelper.d.ts.map +1 -0
  144. package/dist/src/utils/SwapEventExtractor.d.ts +152 -0
  145. package/dist/src/utils/SwapEventExtractor.d.ts.map +1 -0
  146. package/dist/src/utils/adapters.d.ts.map +1 -0
  147. package/dist/src/utils/agent-config.d.ts.map +1 -0
  148. package/dist/{utils → src/utils}/auto-pagination.d.ts +75 -1
  149. package/dist/src/utils/auto-pagination.d.ts.map +1 -0
  150. package/dist/{utils → src/utils}/bignumber-helpers.d.ts +79 -3
  151. package/dist/src/utils/bignumber-helpers.d.ts.map +1 -0
  152. package/dist/src/utils/bignumber-pool-cache.d.ts +169 -0
  153. package/dist/src/utils/bignumber-pool-cache.d.ts.map +1 -0
  154. package/dist/src/utils/bondingCurveCalculations.d.ts.map +1 -0
  155. package/dist/src/utils/cacheWarmingHelpers.d.ts.map +1 -0
  156. package/dist/src/utils/composite-pool-converter.d.ts +121 -0
  157. package/dist/src/utils/composite-pool-converter.d.ts.map +1 -0
  158. package/dist/src/utils/date-utils.d.ts.map +1 -0
  159. package/dist/src/utils/error-factories.d.ts.map +1 -0
  160. package/dist/src/utils/error-utils.d.ts.map +1 -0
  161. package/dist/{utils → src/utils}/errors.d.ts +86 -0
  162. package/dist/src/utils/errors.d.ts.map +1 -0
  163. package/dist/src/utils/http.d.ts.map +1 -0
  164. package/dist/src/utils/load-env.d.ts +31 -0
  165. package/dist/src/utils/load-env.d.ts.map +1 -0
  166. package/dist/src/utils/multipart-helpers.d.ts.map +1 -0
  167. package/dist/{utils → src/utils}/multipart.d.ts +2 -2
  168. package/dist/src/utils/multipart.d.ts.map +1 -0
  169. package/dist/src/utils/number-utils.d.ts.map +1 -0
  170. package/dist/src/utils/pool-pair-parser.d.ts +55 -0
  171. package/dist/src/utils/pool-pair-parser.d.ts.map +1 -0
  172. package/dist/src/utils/pool-state-validator.d.ts +207 -0
  173. package/dist/src/utils/pool-state-validator.d.ts.map +1 -0
  174. package/dist/src/utils/position-filters.d.ts +253 -0
  175. package/dist/src/utils/position-filters.d.ts.map +1 -0
  176. package/dist/src/utils/precision-math.d.ts.map +1 -0
  177. package/dist/{utils → src/utils}/query-params.d.ts +2 -2
  178. package/dist/src/utils/query-params.d.ts.map +1 -0
  179. package/dist/src/utils/response-handlers.d.ts.map +1 -0
  180. package/dist/src/utils/response-normalizers.d.ts.map +1 -0
  181. package/dist/src/utils/slippage-utils.d.ts.map +1 -0
  182. package/dist/src/utils/swap-delta-calculator.d.ts +231 -0
  183. package/dist/src/utils/swap-delta-calculator.d.ts.map +1 -0
  184. package/dist/src/utils/tick-crossing-handler.d.ts +250 -0
  185. package/dist/src/utils/tick-crossing-handler.d.ts.map +1 -0
  186. package/dist/{utils → src/utils}/token-format-converter.d.ts +18 -11
  187. package/dist/src/utils/token-format-converter.d.ts.map +1 -0
  188. package/dist/src/utils/token-parser.d.ts +235 -0
  189. package/dist/src/utils/token-parser.d.ts.map +1 -0
  190. package/dist/src/utils/tokenNormalizer.d.ts.map +1 -0
  191. package/dist/src/utils/trade-transformers.d.ts.map +1 -0
  192. package/dist/src/utils/transfer-validation.d.ts.map +1 -0
  193. package/dist/{utils → src/utils}/validation-helpers.d.ts +1 -1
  194. package/dist/src/utils/validation-helpers.d.ts.map +1 -0
  195. package/dist/src/utils/validation.d.ts.map +1 -0
  196. package/dist/src/utils/wallet.d.ts.map +1 -0
  197. package/dist/src/utils/websocket-errors.d.ts.map +1 -0
  198. package/dist/src/utils/websocket-validators.d.ts.map +1 -0
  199. package/package.json +73 -19
  200. package/dist/LaunchpadSDK.d.ts.map +0 -1
  201. package/dist/api/LaunchpadAPI.d.ts.map +0 -1
  202. package/dist/api/dto/BondingCurveDTOs.d.ts.map +0 -1
  203. package/dist/api/dto/TransferTokenDto.d.ts.map +0 -1
  204. package/dist/auth/SignatureAuth.d.ts.map +0 -1
  205. package/dist/auth/types.d.ts.map +0 -1
  206. package/dist/config/environments.d.ts.map +0 -1
  207. package/dist/constants/bondingCurve.d.ts.map +0 -1
  208. package/dist/constants/config.d.ts.map +0 -1
  209. package/dist/constants/counts.d.ts.map +0 -1
  210. package/dist/constants/decimals.d.ts.map +0 -1
  211. package/dist/constants/endpoints.d.ts.map +0 -1
  212. package/dist/constants/enums.d.ts.map +0 -1
  213. package/dist/constants/error-messages.d.ts.map +0 -1
  214. package/dist/constants/pagination.d.ts.map +0 -1
  215. package/dist/constants/query-fields.d.ts.map +0 -1
  216. package/dist/constants/version.d.ts.map +0 -1
  217. package/dist/constants/version.generated.d.ts.map +0 -1
  218. package/dist/helpers/sdk.d.ts.map +0 -1
  219. package/dist/helpers/wallet.d.ts.map +0 -1
  220. package/dist/polyfills/file-global.d.ts.map +0 -1
  221. package/dist/schemas/files.d.ts.map +0 -1
  222. package/dist/schemas/index.d.ts.map +0 -1
  223. package/dist/schemas/launchpad.d.ts.map +0 -1
  224. package/dist/schemas/pagination.d.ts.map +0 -1
  225. package/dist/schemas/primitives.d.ts.map +0 -1
  226. package/dist/schemas/trade.d.ts.map +0 -1
  227. package/dist/schemas/user.d.ts.map +0 -1
  228. package/dist/schemas/validators.d.ts.map +0 -1
  229. package/dist/services/BaseService.d.ts.map +0 -1
  230. package/dist/services/BundleService.d.ts.map +0 -1
  231. package/dist/services/CommentService.d.ts.map +0 -1
  232. package/dist/services/DexPoolService.d.ts +0 -95
  233. package/dist/services/DexPoolService.d.ts.map +0 -1
  234. package/dist/services/DexService.d.ts.map +0 -1
  235. package/dist/services/FaucetService.d.ts.map +0 -1
  236. package/dist/services/GSwapService.d.ts +0 -315
  237. package/dist/services/GSwapService.d.ts.map +0 -1
  238. package/dist/services/GalaChainService.d.ts.map +0 -1
  239. package/dist/services/ImageService.d.ts.map +0 -1
  240. package/dist/services/LaunchpadService.d.ts.map +0 -1
  241. package/dist/services/PoolService.d.ts.map +0 -1
  242. package/dist/services/PriceHistoryService.d.ts.map +0 -1
  243. package/dist/services/SignatureService.d.ts.map +0 -1
  244. package/dist/services/TokenClassKeyService.d.ts.map +0 -1
  245. package/dist/services/TokenMetadataCache.d.ts.map +0 -1
  246. package/dist/services/TokenMetadataService.d.ts.map +0 -1
  247. package/dist/services/TokenResolverService.d.ts.map +0 -1
  248. package/dist/services/TradeService.d.ts.map +0 -1
  249. package/dist/services/UserService.d.ts.map +0 -1
  250. package/dist/services/WebSocketManager.d.ts.map +0 -1
  251. package/dist/services/WebSocketService.d.ts +0 -85
  252. package/dist/services/WebSocketService.d.ts.map +0 -1
  253. package/dist/types/backend-responses.d.ts.map +0 -1
  254. package/dist/types/comment.dto.d.ts.map +0 -1
  255. package/dist/types/common.d.ts.map +0 -1
  256. package/dist/types/dex-pool.dto.d.ts.map +0 -1
  257. package/dist/types/dto.d.ts.map +0 -1
  258. package/dist/types/gswap.dto.d.ts.map +0 -1
  259. package/dist/types/launchpad.dto.d.ts.map +0 -1
  260. package/dist/types/launchpad.validation.d.ts.map +0 -1
  261. package/dist/types/options.dto.d.ts.map +0 -1
  262. package/dist/types/priceHistory.dto.d.ts.map +0 -1
  263. package/dist/types/result.types.d.ts.map +0 -1
  264. package/dist/types/trade.dto.d.ts.map +0 -1
  265. package/dist/types/transfer.dto.d.ts.map +0 -1
  266. package/dist/types/user.dto.d.ts.map +0 -1
  267. package/dist/types/websocket-data.types.d.ts.map +0 -1
  268. package/dist/types/websocket.types.d.ts.map +0 -1
  269. package/dist/utils/Logger.d.ts.map +0 -1
  270. package/dist/utils/SignatureHelper.d.ts.map +0 -1
  271. package/dist/utils/adapters.d.ts.map +0 -1
  272. package/dist/utils/agent-config.d.ts.map +0 -1
  273. package/dist/utils/auto-pagination.d.ts.map +0 -1
  274. package/dist/utils/bignumber-helpers.d.ts.map +0 -1
  275. package/dist/utils/bondingCurveCalculations.d.ts.map +0 -1
  276. package/dist/utils/cacheWarmingHelpers.d.ts.map +0 -1
  277. package/dist/utils/date-utils.d.ts.map +0 -1
  278. package/dist/utils/error-factories.d.ts.map +0 -1
  279. package/dist/utils/error-utils.d.ts.map +0 -1
  280. package/dist/utils/errors.d.ts.map +0 -1
  281. package/dist/utils/http.d.ts.map +0 -1
  282. package/dist/utils/multipart-helpers.d.ts.map +0 -1
  283. package/dist/utils/multipart.d.ts.map +0 -1
  284. package/dist/utils/number-utils.d.ts.map +0 -1
  285. package/dist/utils/precision-math.d.ts.map +0 -1
  286. package/dist/utils/query-params.d.ts.map +0 -1
  287. package/dist/utils/response-handlers.d.ts.map +0 -1
  288. package/dist/utils/response-normalizers.d.ts.map +0 -1
  289. package/dist/utils/slippage-utils.d.ts.map +0 -1
  290. package/dist/utils/token-format-converter.d.ts.map +0 -1
  291. package/dist/utils/tokenNormalizer.d.ts.map +0 -1
  292. package/dist/utils/trade-transformers.d.ts.map +0 -1
  293. package/dist/utils/transfer-validation.d.ts.map +0 -1
  294. package/dist/utils/validation-helpers.d.ts.map +0 -1
  295. package/dist/utils/validation.d.ts.map +0 -1
  296. package/dist/utils/wallet.d.ts.map +0 -1
  297. package/dist/utils/websocket-errors.d.ts.map +0 -1
  298. package/dist/utils/websocket-validators.d.ts.map +0 -1
  299. /package/dist/{api → src/api}/LaunchpadAPI.d.ts +0 -0
  300. /package/dist/{api → src/api}/dto/BondingCurveDTOs.d.ts +0 -0
  301. /package/dist/{api → src/api}/dto/TransferTokenDto.d.ts +0 -0
  302. /package/dist/{auth → src/auth}/SignatureAuth.d.ts +0 -0
  303. /package/dist/{auth → src/auth}/types.d.ts +0 -0
  304. /package/dist/{config → src/config}/environments.d.ts +0 -0
  305. /package/dist/{constants → src/constants}/bondingCurve.d.ts +0 -0
  306. /package/dist/{constants → src/constants}/config.d.ts +0 -0
  307. /package/dist/{constants → src/constants}/counts.d.ts +0 -0
  308. /package/dist/{constants → src/constants}/decimals.d.ts +0 -0
  309. /package/dist/{constants → src/constants}/endpoints.d.ts +0 -0
  310. /package/dist/{constants → src/constants}/enums.d.ts +0 -0
  311. /package/dist/{constants → src/constants}/error-messages.d.ts +0 -0
  312. /package/dist/{constants → src/constants}/pagination.d.ts +0 -0
  313. /package/dist/{constants → src/constants}/query-fields.d.ts +0 -0
  314. /package/dist/{constants → src/constants}/version.d.ts +0 -0
  315. /package/dist/{helpers → src/helpers}/sdk.d.ts +0 -0
  316. /package/dist/{helpers → src/helpers}/wallet.d.ts +0 -0
  317. /package/dist/{polyfills → src/polyfills}/file-global.d.ts +0 -0
  318. /package/dist/{schemas → src/schemas}/files.d.ts +0 -0
  319. /package/dist/{schemas → src/schemas}/index.d.ts +0 -0
  320. /package/dist/{schemas → src/schemas}/launchpad.d.ts +0 -0
  321. /package/dist/{schemas → src/schemas}/pagination.d.ts +0 -0
  322. /package/dist/{schemas → src/schemas}/primitives.d.ts +0 -0
  323. /package/dist/{schemas → src/schemas}/trade.d.ts +0 -0
  324. /package/dist/{schemas → src/schemas}/user.d.ts +0 -0
  325. /package/dist/{schemas → src/schemas}/validators.d.ts +0 -0
  326. /package/dist/{services → src/services}/BaseService.d.ts +0 -0
  327. /package/dist/{services → src/services}/BundleService.d.ts +0 -0
  328. /package/dist/{services → src/services}/CommentService.d.ts +0 -0
  329. /package/dist/{services → src/services}/FaucetService.d.ts +0 -0
  330. /package/dist/{services → src/services}/ImageService.d.ts +0 -0
  331. /package/dist/{services → src/services}/LaunchpadService.d.ts +0 -0
  332. /package/dist/{services → src/services}/PoolService.d.ts +0 -0
  333. /package/dist/{services → src/services}/TokenClassKeyService.d.ts +0 -0
  334. /package/dist/{services → src/services}/TokenResolverService.d.ts +0 -0
  335. /package/dist/{services → src/services}/TradeService.d.ts +0 -0
  336. /package/dist/{services → src/services}/UserService.d.ts +0 -0
  337. /package/dist/{services → src/services}/WebSocketManager.d.ts +0 -0
  338. /package/dist/{setup.d.ts → src/setup.d.ts} +0 -0
  339. /package/dist/{types → src/types}/comment.dto.d.ts +0 -0
  340. /package/dist/{types → src/types}/launchpad.validation.d.ts +0 -0
  341. /package/dist/{types → src/types}/options.dto.d.ts +0 -0
  342. /package/dist/{types → src/types}/result.types.d.ts +0 -0
  343. /package/dist/{types → src/types}/trade.dto.d.ts +0 -0
  344. /package/dist/{types → src/types}/transfer.dto.d.ts +0 -0
  345. /package/dist/{types → src/types}/user.dto.d.ts +0 -0
  346. /package/dist/{types → src/types}/websocket-data.types.d.ts +0 -0
  347. /package/dist/{types → src/types}/websocket.types.d.ts +0 -0
  348. /package/dist/{utils → src/utils}/Logger.d.ts +0 -0
  349. /package/dist/{utils → src/utils}/adapters.d.ts +0 -0
  350. /package/dist/{utils → src/utils}/agent-config.d.ts +0 -0
  351. /package/dist/{utils → src/utils}/bondingCurveCalculations.d.ts +0 -0
  352. /package/dist/{utils → src/utils}/cacheWarmingHelpers.d.ts +0 -0
  353. /package/dist/{utils → src/utils}/date-utils.d.ts +0 -0
  354. /package/dist/{utils → src/utils}/error-factories.d.ts +0 -0
  355. /package/dist/{utils → src/utils}/error-utils.d.ts +0 -0
  356. /package/dist/{utils → src/utils}/http.d.ts +0 -0
  357. /package/dist/{utils → src/utils}/multipart-helpers.d.ts +0 -0
  358. /package/dist/{utils → src/utils}/number-utils.d.ts +0 -0
  359. /package/dist/{utils → src/utils}/precision-math.d.ts +0 -0
  360. /package/dist/{utils → src/utils}/response-handlers.d.ts +0 -0
  361. /package/dist/{utils → src/utils}/response-normalizers.d.ts +0 -0
  362. /package/dist/{utils → src/utils}/slippage-utils.d.ts +0 -0
  363. /package/dist/{utils → src/utils}/tokenNormalizer.d.ts +0 -0
  364. /package/dist/{utils → src/utils}/trade-transformers.d.ts +0 -0
  365. /package/dist/{utils → src/utils}/transfer-validation.d.ts +0 -0
  366. /package/dist/{utils → src/utils}/validation.d.ts +0 -0
  367. /package/dist/{utils → src/utils}/wallet.d.ts +0 -0
  368. /package/dist/{utils → src/utils}/websocket-errors.d.ts +0 -0
  369. /package/dist/{utils → src/utils}/websocket-validators.d.ts +0 -0
package/README.md CHANGED
@@ -2,9 +2,12 @@
2
2
 
3
3
  A comprehensive TypeScript SDK for the Gala Launchpad Backend API, providing type-safe authentication, trading, and real-time features for DeFi applications.
4
4
 
5
+ > **⚠️ BREAKING CHANGE (v3.33.0+)**: Token format parsing now **ONLY accepts delimited formats** (`GALA|Unit|none|none` or `GALA$Unit$none$none`). Plain token strings (`'GALA'`, `'GUSDC'`) are **permanently rejected** for security. See [Migration Guide](#token-format-migration-v330) below.
6
+
5
7
  [![npm version](https://badge.fury.io/js/@gala-chain%2Flaunchpad-sdk.svg)](https://badge.fury.io/js/@gala-chain%2Flaunchpad-sdk)
6
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
9
  [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
10
+ [![Documentation Coverage](https://img.shields.io/badge/Documentation%20Coverage-100%25-success)](./docs/API-REFERENCE.md)
8
11
 
9
12
  ## Features
10
13
 
@@ -63,7 +66,7 @@ console.log(pools.hasNext); // Computed convenience properties
63
66
  - **Token Trading**: Buy and sell tokens with slippage protection via GalaChain
64
67
  - **DEX Pool Discovery**: Discover and explore GalaSwap liquidity pools with filtering, sorting, and pagination
65
68
  - **DEX Trading**: Real-time token swaps on GalaSwap DEX with quote generation and slippage protection
66
- - **Liquidity Management**: Manage liquidity positions on GalaSwap (add, remove, collect fees)
69
+ - **Liquidity Management**: Manage liquidity positions on GalaSwap (add, remove, collect fees) with filtering and organization utilities
67
70
  - **Token Transfers**: Transfer GALA and launchpad tokens between wallets with EIP-712 signatures
68
71
  - **User Operations**: Portfolio management, token balances, and account management
69
72
  - **Comment System**: Post and retrieve comments on token pools
@@ -292,6 +295,245 @@ const result = await sdk.buy({
292
295
  - ✅ Missing wallet throws `ValidationError` with code `WALLET_REQUIRED`
293
296
  - ⚠️ Only methods that sign transactions require a wallet
294
297
 
298
+ ## Environment Configuration
299
+
300
+ The SDK supports multiple environments (STAGE and PROD). All demo scripts and examples use a **centralized environment configuration pattern** via `.env` file.
301
+
302
+ ### Quick Setup
303
+
304
+ Create/edit `.env` in the repository root:
305
+
306
+ ```bash
307
+ # .env
308
+ ENVIRONMENT=STAGE # Switch between STAGE and PROD
309
+ WALLET_PRIVATE_KEY=0x... # Your wallet private key (optional)
310
+ ```
311
+
312
+ All demo scripts automatically read from this `.env` file:
313
+
314
+ ```bash
315
+ npm run demo:read-only # Uses ENVIRONMENT from .env
316
+ npm run demo:dex # Uses ENVIRONMENT from .env
317
+ npm run demo:liquidity # Uses ENVIRONMENT from .env
318
+ ```
319
+
320
+ ### Environment Values
321
+
322
+ | Value | Accepts | Use Case |
323
+ |-------|---------|----------|
324
+ | `STAGE` | `STAGE`, `STAGING` | Development/staging |
325
+ | `PROD` | `PROD`, `PRODUCTION` | Production |
326
+ | Default | (if not set) | Defaults to `STAGE` with warning |
327
+
328
+ ### SDK Initialization
329
+
330
+ When using demo scripts or examples, the environment is automatically loaded:
331
+
332
+ ```typescript
333
+ import { getEnvironment } from './examples/utils/get-environment';
334
+
335
+ const environment = getEnvironment(); // Reads from .env
336
+ const sdk = new LaunchpadSDK({
337
+ env: environment,
338
+ wallet: undefined // Optional
339
+ });
340
+ ```
341
+
342
+ ### Validation
343
+
344
+ Prevent hardcoded environment values:
345
+
346
+ ```bash
347
+ npm run validate:env # Validates no hardcoded 'STAGE' or 'PROD'
348
+ ```
349
+
350
+ ### Full Documentation
351
+
352
+ See [docs/ENVIRONMENT_CONFIGURATION.md](./docs/ENVIRONMENT_CONFIGURATION.md) for:
353
+ - Architecture and implementation details
354
+ - Pattern for adding new scripts
355
+ - Troubleshooting guide
356
+ - Migration guide for existing scripts
357
+
358
+ ## Token Format Migration (v3.33.0)
359
+
360
+ ### Breaking Change: Strict Token Format Enforcement
361
+
362
+ **v3.33.0 removes support for plain token strings** and requires all tokens to use **delimited format**.
363
+
364
+ #### Old Behavior (v3.32.x and below) - DEPRECATED
365
+
366
+ Plain token strings were accepted:
367
+ ```typescript
368
+ // ❌ NO LONGER WORKS (v3.33.0+)
369
+ await sdk.addSwapLiquidityByPrice({
370
+ token0: 'GALA', // Plain string
371
+ token1: 'GUSDC', // Plain string
372
+ fee: 3000,
373
+ minPrice: '0.95',
374
+ maxPrice: '1.05',
375
+ amount0Desired: '100',
376
+ amount1Desired: '100'
377
+ });
378
+ ```
379
+
380
+ #### New Behavior (v3.33.0+) - REQUIRED
381
+
382
+ All tokens must use **pipe-delimited** (`|`) or **dollar-delimited** (`$`) format:
383
+
384
+ ```typescript
385
+ // ✅ REQUIRED FORMAT (v3.33.0+)
386
+ await sdk.addSwapLiquidityByPrice({
387
+ token0: 'GALA|Unit|none|none', // Delimited format
388
+ token1: 'GUSDC|Unit|none|none', // Delimited format
389
+ fee: 3000,
390
+ minPrice: '0.95',
391
+ maxPrice: '1.05',
392
+ amount0Desired: '100',
393
+ amount1Desired: '100'
394
+ });
395
+ ```
396
+
397
+ #### Format Options
398
+
399
+ **Pipe-Delimited (Recommended):**
400
+ ```typescript
401
+ 'GALA|Unit|none|none'
402
+ 'GUSDC|Unit|none|none'
403
+ 'MYTOKEN|Unit|none|none'
404
+ ```
405
+
406
+ **Dollar-Delimited (Alternative):**
407
+ ```typescript
408
+ 'GALA$Unit$none$none'
409
+ 'GUSDC$Unit$none$none'
410
+ 'MYTOKEN$Unit$none$none'
411
+ ```
412
+
413
+ #### Migration Checklist
414
+
415
+ - [ ] Search codebase for plain token strings: `'GALA'`, `'GUSDC'`, etc.
416
+ - [ ] Replace with delimited format: `'GALA|Unit|none|none'`, `'GUSDC|Unit|none|none'`
417
+ - [ ] Update all SDK method calls that pass token parameters
418
+ - [ ] Test thoroughly - TypeScript strict mode will catch most issues
419
+ - [ ] Update internal token handling code
420
+
421
+ #### Affected Methods
422
+
423
+ The following methods now require delimited token format:
424
+ - `getSwapQuoteExactInput(token0, token1, amount)`
425
+ - `getSwapQuoteExactOutput(token0, token1, amount)`
426
+ - `executeSwap(token0, token1, ...)`
427
+ - `addSwapLiquidityByPrice({token0, token1, ...})`
428
+ - `addSwapLiquidityByTicks({token0, token1, ...})`
429
+ - `removeSwapLiquidity({token0, token1, ...})`
430
+ - `getSwapPoolInfo(token0, token1)`
431
+
432
+ #### Security Rationale
433
+
434
+ This breaking change enforces **strict token format validation** to:
435
+ - ✅ **Prevent injection attacks** via token string manipulation
436
+ - ✅ **Ensure deterministic parsing** with no ambiguous fallbacks
437
+ - ✅ **Eliminate security gaps** from loose string handling
438
+ - ✅ **Force explicit token specification** with full TokenClassKey structure
439
+
440
+ Plain string support created a dangerous "escape hatch" where ambiguous token identifiers could be accepted. v3.33.0 eliminates this by requiring all tokens be properly delimited.
441
+
442
+ ## Upgrading to v4.0.0
443
+
444
+ ### Breaking Changes: Removed Deprecated Methods
445
+
446
+ **v4.0.0 removes one deprecated method** that was superseded in v3.22.7. This is a clean removal with **minimal migration effort** - most users will not be affected.
447
+
448
+ #### Removed Method: `fetchLaunchpadTokenSpotPrice()`
449
+
450
+ This method was deprecated in v3.22.7 in favor of the more flexible `fetchTokenPrice()` method.
451
+
452
+ **Old Code (v3.35.x and below) - NO LONGER WORKS:**
453
+ ```typescript
454
+ // ❌ REMOVED in v4.0.0
455
+ const price = await sdk.fetchLaunchpadTokenSpotPrice('anime');
456
+ console.log(`Price: ${price} USD`);
457
+ ```
458
+
459
+ **New Code (v4.0.0+) - REQUIRED:**
460
+ ```typescript
461
+ // ✅ REQUIRED - Works for both launchpad and DEX tokens
462
+ const price = await sdk.fetchTokenPrice('anime');
463
+ console.log(`Price: ${price} USD`);
464
+ ```
465
+
466
+ #### Why This Change?
467
+
468
+ The new `fetchTokenPrice()` method:
469
+ - ✅ **Unified pricing** - Works for both launchpad tokens and DEX-graduated tokens
470
+ - ✅ **Automatic routing** - Detects token type and fetches from correct backend
471
+ - ✅ **Better performance** - Single method instead of specialized variants
472
+ - ✅ **Cleaner API** - Less method duplication in SDK
473
+
474
+ #### Migration Checklist
475
+
476
+ - [ ] Search codebase for `fetchLaunchpadTokenSpotPrice(`
477
+ - [ ] Replace all occurrences with `fetchTokenPrice(`
478
+ - [ ] Test with both launchpad tokens (e.g., `'anime'`) and DEX tokens
479
+ - [ ] Verify price results haven't changed (same calculation logic)
480
+
481
+ #### Impact Assessment
482
+
483
+ **Affected Users:**
484
+ - ⚠️ **Only if you explicitly called** `fetchLaunchpadTokenSpotPrice()`
485
+ - ✅ **Not affected if you** used `fetchTokenPrice()` or `fetchTokenSpotPrice()` methods
486
+ - ✅ **Not affected if you** never queried token prices
487
+
488
+ **Migration Effort:**
489
+ - ⏱️ **5 minutes** - Simple find/replace across codebase
490
+ - ⚙️ **Zero logic changes** - Functionality remains identical
491
+ - 🎯 **Low risk** - Price calculation algorithm unchanged
492
+
493
+ ### New Features: Service Clients Documentation
494
+
495
+ v4.0.0 adds internal service client documentation for advanced users who need direct access to underlying blockchain services.
496
+
497
+ ```typescript
498
+ import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
499
+
500
+ const sdk = createLaunchpadSDK({
501
+ wallet: 'your-private-key'
502
+ });
503
+
504
+ // Advanced: Direct access to DEX Backend API
505
+ // Use case: Custom swap parameters or debugging
506
+ const quote = await sdk.dexBackendClient.querySwapQuote({
507
+ orderedTokens: [...],
508
+ zeroForOne: false,
509
+ inputAmount: '10',
510
+ // ... additional parameters
511
+ });
512
+
513
+ // Advanced: Direct access to GalaChain Gateway
514
+ // Use case: Custom transaction building
515
+ const result = await sdk.galaChainGatewayClient.callContract({
516
+ address: 'contract-address',
517
+ method: 'transfer',
518
+ // ... parameters
519
+ });
520
+ ```
521
+
522
+ **⚠️ Important:** Service clients are internal implementation details. For standard operations, always use public SDK methods:
523
+ - ✅ Use `sdk.buy()` instead of `sdk.galaChainGatewayClient`
524
+ - ✅ Use `sdk.executeSwap()` instead of `sdk.dexBackendClient`
525
+ - ✅ These public methods provide better error handling and validation
526
+
527
+ For detailed service client documentation, see [docs/API-REFERENCE.md#service-clients](./docs/API-REFERENCE.md#service-clients).
528
+
529
+ ### Migration Summary
530
+
531
+ **For Most Users:** Nothing to do! v4.0.0 is backward compatible except for the removal of `fetchLaunchpadTokenSpotPrice()`.
532
+
533
+ **If You Used `fetchLaunchpadTokenSpotPrice()`:** Replace with `fetchTokenPrice()` - identical functionality, better flexibility.
534
+
535
+ **If You Need Service Client Access:** They're now documented and available for advanced use cases, but use public SDK methods when possible.
536
+
295
537
  ## DEX Pool Discovery & Analysis
296
538
 
297
539
  ### Overview
@@ -932,6 +1174,62 @@ console.log(`Status: ${tokenTransfer.status}`);
932
1174
  - **GalaChain Integration**: Direct transfers via GalaChain gateway
933
1175
  - **Error Handling**: Detailed error types for different failure scenarios
934
1176
 
1177
+ ## Lock/Unlock Operations
1178
+
1179
+ Lock and unlock tokens on GalaChain for staking, escrow, and vesting mechanisms:
1180
+
1181
+ ```typescript
1182
+ import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
1183
+
1184
+ const sdk = createLaunchpadSDK({
1185
+ wallet: 'your-private-key-or-mnemonic'
1186
+ });
1187
+
1188
+ // Lock tokens - caller becomes lock authority by default
1189
+ const lockResult = await sdk.lockToken({
1190
+ tokenName: 'tinyevil',
1191
+ amount: '1000' // Token amount in smallest unit
1192
+ });
1193
+
1194
+ console.log(`Locked tokens, tx: ${lockResult.transactionId}`);
1195
+
1196
+ // Lock with custom authority and expiration
1197
+ const escrowLock = await sdk.lockToken({
1198
+ tokenName: 'tinyevil',
1199
+ amount: '5000',
1200
+ lockAuthority: 'eth|0xEscrowContract...', // Third party can unlock
1201
+ expires: Date.now() + 7 * 24 * 60 * 60 * 1000, // Auto-release in 1 week
1202
+ name: 'escrow-deal-123' // Named lock for matching
1203
+ });
1204
+
1205
+ // Unlock tokens - must be called by lock authority
1206
+ const unlockResult = await sdk.unlockToken({
1207
+ tokenName: 'tinyevil',
1208
+ amount: '1000'
1209
+ });
1210
+
1211
+ console.log(`Unlocked tokens, tx: ${unlockResult.transactionId}`);
1212
+
1213
+ // Unlock specific named lock
1214
+ await sdk.unlockToken({
1215
+ tokenName: 'tinyevil',
1216
+ amount: '5000',
1217
+ name: 'escrow-deal-123' // Must match lock name
1218
+ });
1219
+ ```
1220
+
1221
+ ### Lock Features
1222
+ - **Lock Authority**: Specify who can unlock (defaults to caller)
1223
+ - **Expiration**: Optional auto-release timestamp
1224
+ - **Named Locks**: Identify locks by name for targeted unlocks
1225
+ - **EIP-712 Signatures**: Secure blockchain transactions
1226
+ - **Idempotency**: Optional unique keys prevent duplicate operations
1227
+
1228
+ ### Use Cases
1229
+ - **Staking**: Lock tokens for reward programs
1230
+ - **Escrow**: Third-party holds tokens until conditions met
1231
+ - **Vesting**: Time-locked token releases with expiration
1232
+
935
1233
  ## Multi-Wallet Support
936
1234
 
937
1235
  The SDK supports **per-operation wallet overrides** for testing multi-wallet workflows without creating new SDK instances. This is ideal for:
@@ -1126,7 +1424,7 @@ fetchPoolDetails(tokenName): Promise<PoolDetailsData>
1126
1424
 
1127
1425
  fetchTokenDetails(tokenId): Promise<TokenDetails>
1128
1426
  // Returns: { symbol, decimals, name, image, verified, network, chainId, contractAddress, tradingEnabled, ... }
1129
- // Supports flexible tokenId: string ('Token|Unit|GUSDC|eth:0x...') or object format
1427
+ // Supports flexible tokenId: string ('GUSDC|Unit|none|eth:0x...') or object format
1130
1428
 
1131
1429
  fetchVolumeData(options): Promise<GraphDataResult>
1132
1430
  // Returns: { dataPoints }
@@ -1847,7 +2145,7 @@ getSwapPoolInfo(tokenA, tokenB): Promise<PoolInfo>
1847
2145
  ```
1848
2146
 
1849
2147
  **Key Features:**
1850
- - ✅ **Multi-format token support**: Use simple symbols ('GALA', 'GUSDC') or structured format ('GALA|Unit|none|none')
2148
+ - ✅ **Strict token format enforcement** (v3.33.0+): All tokens require delimited format (`'GALA|Unit|none|none'` or `'GALA$Unit$none$none'`)
1851
2149
  - ✅ **Quote pattern**: Always get quote before executing swap for accurate slippage calculations
1852
2150
  - ✅ **Unified WebSocket**: Real-time transaction monitoring via shared LaunchpadSDK WebSocket connection
1853
2151
  - ✅ **Environment alignment**: Automatic STAGE/PROD configuration matching
@@ -2071,6 +2369,54 @@ const testSDK = createTestLaunchpadSDK({
2071
2369
  });
2072
2370
  ```
2073
2371
 
2372
+ ### **Position Filter Utilities**
2373
+
2374
+ Helpers for organizing and filtering liquidity positions by various criteria:
2375
+
2376
+ ```typescript
2377
+ import {
2378
+ filterByLiquidity, // Remove positions with zero liquidity
2379
+ filterByMinLiquidity, // Keep positions >= threshold
2380
+ filterByTokenPair, // Match specific token pair
2381
+ filterByToken, // Find positions containing a token
2382
+ filterByFeeTier, // Filter by fee tier (500, 3000, 10000)
2383
+ filterByPoolKey, // Match specific pool (token pair + fee)
2384
+ sortByLiquidity, // Sort positions by liquidity amount
2385
+ groupByTokenPair, // Group by "TOKEN0/TOKEN1"
2386
+ groupByFeeTier, // Group by fee tier
2387
+ groupByPoolKey, // Group by "TOKEN0|TOKEN1|FEETIER"
2388
+ } from '@gala-chain/launchpad-sdk';
2389
+
2390
+ // Example: Find active GALA/GUSDC positions and sort by size
2391
+ const allPositions = await sdk.getAllSwapUserLiquidityPositions(address);
2392
+ const active = filterByLiquidity(allPositions); // Remove zero-liquidity
2393
+ const galaPositions = filterByTokenPair(active, 'GALA', 'GUSDC'); // GALA/GUSDC only
2394
+ const sorted = sortByLiquidity(galaPositions, 'desc'); // Largest first
2395
+
2396
+ // Group positions by token pair for portfolio analysis
2397
+ const grouped = groupByTokenPair(active);
2398
+ grouped.forEach((positions, pair) => {
2399
+ console.log(`${pair}: ${positions.length} positions`);
2400
+ });
2401
+
2402
+ // Find positions with significant liquidity
2403
+ const large = filterByMinLiquidity(active, '1000');
2404
+
2405
+ // Organize by pool (pair + fee tier) for advanced analysis
2406
+ const byPool = groupByPoolKey(active);
2407
+ byPool.forEach((positions, poolKey) => {
2408
+ console.log(`Pool ${poolKey}: ${positions.length} LPs`);
2409
+ });
2410
+ ```
2411
+
2412
+ **Use Cases:**
2413
+ - Organize positions by token pair or pool
2414
+ - Filter for active positions (non-zero liquidity)
2415
+ - Find positions above minimum liquidity threshold
2416
+ - Analyze portfolio distribution by token or fee tier
2417
+ - Identify opportunities for fee collection
2418
+ - Locate positions in specific pools
2419
+
2074
2420
  ## Testing
2075
2421
 
2076
2422
  ```bash
@@ -2092,7 +2438,7 @@ npm run lint
2092
2438
  - [SDK Method Reference](./SDK-METHOD-GRAPH.md) - Complete flat API reference
2093
2439
  - [Clean Result Types Migration Guide](./docs/CLEAN_RESULT_TYPES_MIGRATION.md) - Migration guide for clean result types
2094
2440
  - [Service Architecture Migration Guide](./docs/SERVICE_ARCHITECTURE_MIGRATION.md) - Guide for v3.1.0 service-based architecture
2095
- - [API Documentation](../../API.md) - Detailed API documentation
2441
+ - [API Reference](./docs/API-REFERENCE.md) - Complete reference for all 72 SDK methods with examples
2096
2442
  - [Examples](./examples/) - Code examples and demos
2097
2443
 
2098
2444
  ### GSwap Liquidity Operations
@@ -2103,24 +2449,202 @@ npm run lint
2103
2449
 
2104
2450
  ### Demo Scripts
2105
2451
 
2106
- **Liquidity Operations:**
2452
+ The SDK includes 36 comprehensive demo scripts organized into logical categories for easy discovery and learning.
2453
+
2454
+ #### Organized Directory Structure
2455
+
2456
+ ```
2457
+ examples/
2458
+ ├── core/ # SDK fundamentals and authentication patterns
2459
+ ├── liquidity/ # GalaSwap liquidity position management (9 demos)
2460
+ ├── bonding-curve/ # Token bonding curve trading operations
2461
+ ├── dex/ # DEX trading and pool discovery (6 demos)
2462
+ ├── fees/ # Fee generation and collection workflows (5 demos)
2463
+ ├── monitoring/ # Real-time event watching (2 demos)
2464
+ ├── utilities/ # Balance checks, cache, token supply (5 demos)
2465
+ └── debug/ # Development and troubleshooting tools
2466
+ ```
2467
+
2468
+ #### Quick Start Examples
2469
+
2470
+ **Core SDK Operations:**
2471
+ ```bash
2472
+ # Complete SDK feature demonstration
2473
+ npm run demo
2474
+
2475
+ # Read-only operations (no wallet required)
2476
+ npm run demo:read-only
2477
+
2478
+ # Authenticated operations (wallet required)
2479
+ npm run demo:authenticated
2480
+
2481
+ # Multi-wallet private key override pattern
2482
+ npm run demo:privatekey-override
2483
+ ```
2484
+
2485
+ #### Liquidity Position Management (9 Demos)
2486
+
2487
+ Comprehensive liquidity provision workflows for GalaSwap DEX:
2488
+
2489
+ ```bash
2490
+ # Interactive CLI for position management
2491
+ npm run demo:liquidity
2492
+
2493
+ # Run all 9 liquidity demos sequentially
2494
+ npm run demo:liquidity:all
2495
+
2496
+ # Individual demos
2497
+ npm run demo:liquidity:detailed # Detailed position lifecycle
2498
+ npm run demo:liquidity:ticks # Advanced tick-based positions
2499
+ npm run demo:liquidity:portfolio # Multi-position portfolio management
2500
+ npm run demo:liquidity:apr # APR calculation for LP positions
2501
+ npm run demo:liquidity:errors # Error handling patterns
2502
+ npm run demo:liquidity:fetch-all # Fetch all positions with pagination
2503
+ npm run demo:liquidity:positions-with-prices # Position pricing enrichment
2504
+
2505
+ # Complete roundtrip workflow (legacy, use orchestrator instead)
2506
+ npm run demo:dex:roundtrip
2507
+ ```
2508
+
2509
+ **Orchestrator Pattern:**
2510
+ The liquidity orchestrator (`npm run demo:liquidity:all`) runs all demos with intelligent error handling:
2511
+ - Skip individual demos: `--skip=detailed,ticks`
2512
+ - Run specific demos only: `--only=portfolio,apr`
2513
+ - See all available demos: `npm run demo:liquidity:all --help`
2514
+
2515
+ #### Bonding Curve Trading (Launchpad Tokens)
2516
+
2517
+ Pre-graduation token trading on bonding curve pools:
2518
+
2519
+ ```bash
2520
+ # Basic buy/sell operations with slippage protection
2521
+ npm run demo:trades
2522
+ ```
2523
+
2524
+ **Bonding Curve Focus:**
2525
+ 8 additional bonding curve demos are available through the orchestrator (in development):
2526
+ - Pool discovery and filtering
2527
+ - Price calculation methods
2528
+ - Graduation simulation
2529
+ - Multi-token analysis
2530
+ - Fee structure exploration
2531
+ - Slippage testing scenarios
2532
+
2533
+ #### DEX Trading Operations (6 Demos)
2534
+
2535
+ Graduated token trading on GalaSwap DEX with full liquidity pool support:
2536
+
2107
2537
  ```bash
2108
- # View all liquidity positions
2109
- npm run demo:liquidity view
2538
+ # DEX swap workflow (quote → execute → confirm)
2539
+ npm run demo:dex
2110
2540
 
2111
- # Add liquidity to GALA/GUSDC pool
2112
- npm run demo:liquidity add
2541
+ # Pool discovery and metrics
2542
+ npm run demo:dex:pools
2113
2543
 
2114
- # Collect fees from a position
2115
- npm run demo:liquidity collect <position-id>
2544
+ # Pool pricing and TVL analysis
2545
+ npm run demo:dex:pricing
2116
2546
 
2117
- # Remove liquidity (100% or partial percentage)
2118
- npm run demo:liquidity remove <position-id> [percentage]
2547
+ # Quote comparison (exact input vs exact output)
2548
+ npm run demo:dex:quotes
2119
2549
 
2120
- # Show detailed transaction responses (multiple swaps)
2121
- npm run demo:liquidity:detailed
2550
+ # Complete swap roundtrip (buy → sell → verify)
2551
+ npm run demo:roundtrip:swap
2122
2552
  ```
2123
2553
 
2554
+ #### Fee Generation and Collection (5 Demos)
2555
+
2556
+ Liquidity provider fee workflows with multi-wallet testing:
2557
+
2558
+ ```bash
2559
+ # Basic fee generation and collection
2560
+ npm run demo:fees
2561
+
2562
+ # High-volume trading fee accumulation
2563
+ npm run demo:fees:high-volume
2564
+
2565
+ # Complete fee lifecycle test suite
2566
+ npm run demo:fees:test
2567
+
2568
+ # Trade and collect fees in single workflow
2569
+ npm run demo:fees:trade-collect
2570
+ ```
2571
+
2572
+ **Note:** `demo-multi-wallet-fee-generation.ts` is available but not exposed in npm scripts (advanced usage).
2573
+
2574
+ #### Real-Time Monitoring (2 Demos)
2575
+
2576
+ WebSocket-based event watchers for pool and token creation:
2577
+
2578
+ ```bash
2579
+ # Watch for new DEX pool creation
2580
+ npm run demo:watch
2581
+
2582
+ # Watch for new launchpad token launches
2583
+ npm run demo:watch:tokens
2584
+ ```
2585
+
2586
+ #### Utility Operations (5 Demos)
2587
+
2588
+ Balance queries, caching, and token supply information:
2589
+
2590
+ ```bash
2591
+ # Metadata cache warming and performance testing
2592
+ npm run demo:cache
2593
+
2594
+ # Token supply metrics from GalaChain
2595
+ npm run demo:token-supply
2596
+ ```
2597
+
2598
+ **Additional utilities:**
2599
+ - `balances.ts` - Multi-token balance queries
2600
+ - `balance.ts` - Single token balance check
2601
+ - `price-history.ts` - Historical price data (Node.js only)
2602
+
2603
+ #### Debug and Development Tools
2604
+
2605
+ Advanced troubleshooting and environment testing:
2606
+
2607
+ ```bash
2608
+ # Environment alignment verification
2609
+ tsx examples/debug/test-env-alignment.ts
2610
+
2611
+ # Slot0 data debugging
2612
+ tsx examples/debug/debug-getslot0-test.ts
2613
+
2614
+ # DEX simulation with monkey patching
2615
+ tsx examples/debug/demo-dex-monkey-patch-simulation.ts
2616
+ ```
2617
+
2618
+ #### Demo Statistics
2619
+
2620
+ - **Total Demos:** 36 working examples
2621
+ - **npm Scripts:** 25 convenient shortcuts
2622
+ - **Categories:** 8 organized directories
2623
+ - **Coverage:** All major SDK features demonstrated
2624
+
2625
+ #### Recommended Learning Path
2626
+
2627
+ 1. **Start Here:** `npm run demo` - Complete SDK overview
2628
+ 2. **Liquidity Basics:** `npm run demo:liquidity` - Interactive CLI
2629
+ 3. **DEX Trading:** `npm run demo:dex` - Swap workflow
2630
+ 4. **Fee Management:** `npm run demo:fees` - LP fee collection
2631
+ 5. **Advanced:** Explore individual demos by category
2632
+
2633
+ #### Migration Notes
2634
+
2635
+ **Removed Scripts (v3.32.0+):**
2636
+ - `demo:liquidity:simple` - Merged into `demo:liquidity`
2637
+ - `demo:liquidity:workflow` - Replaced by orchestrator pattern
2638
+ - `demo:dex:swap` - Renamed to `demo:dex` for consistency
2639
+
2640
+ **New in v3.32.0+:**
2641
+ - Organized directory structure with 8 categories
2642
+ - Bonding curve orchestrator (in development)
2643
+ - Fee demo npm scripts now exposed
2644
+ - Symmetry: Both bonding-curve and dex have pool discovery demos
2645
+
2646
+ For detailed migration guide, see [docs/DEMO_MIGRATION_GUIDE.md](./docs/DEMO_MIGRATION_GUIDE.md).
2647
+
2124
2648
  ## Architecture
2125
2649
 
2126
2650
  The SDK uses a **service-based architecture** with backend-aligned services: