@picon-finance/dlmm-sdk 1.0.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 (386) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +48 -0
  3. package/dist/actions/accept_admin_authority.d.ts +13 -0
  4. package/dist/actions/accept_admin_authority.d.ts.map +1 -0
  5. package/dist/actions/accept_admin_authority.js +7 -0
  6. package/dist/actions/claim_fee.d.ts +21 -0
  7. package/dist/actions/claim_fee.d.ts.map +1 -0
  8. package/dist/actions/claim_fee.js +40 -0
  9. package/dist/actions/claim_multiple_fees.d.ts +19 -0
  10. package/dist/actions/claim_multiple_fees.d.ts.map +1 -0
  11. package/dist/actions/claim_multiple_fees.js +81 -0
  12. package/dist/actions/claim_protocol_fee.d.ts +18 -0
  13. package/dist/actions/claim_protocol_fee.d.ts.map +1 -0
  14. package/dist/actions/claim_protocol_fee.js +33 -0
  15. package/dist/actions/close_position.d.ts +14 -0
  16. package/dist/actions/close_position.d.ts.map +1 -0
  17. package/dist/actions/close_position.js +14 -0
  18. package/dist/actions/create_admin_config.d.ts +15 -0
  19. package/dist/actions/create_admin_config.d.ts.map +1 -0
  20. package/dist/actions/create_admin_config.js +30 -0
  21. package/dist/actions/create_bin_array.d.ts +16 -0
  22. package/dist/actions/create_bin_array.d.ts.map +1 -0
  23. package/dist/actions/create_bin_array.js +10 -0
  24. package/dist/actions/create_pool.d.ts +21 -0
  25. package/dist/actions/create_pool.d.ts.map +1 -0
  26. package/dist/actions/create_pool.js +22 -0
  27. package/dist/actions/delete_bin_array.d.ts +16 -0
  28. package/dist/actions/delete_bin_array.d.ts.map +1 -0
  29. package/dist/actions/delete_bin_array.js +13 -0
  30. package/dist/actions/deposit_by_weight.d.ts +27 -0
  31. package/dist/actions/deposit_by_weight.d.ts.map +1 -0
  32. package/dist/actions/deposit_by_weight.js +52 -0
  33. package/dist/actions/get_admin_config.d.ts +4 -0
  34. package/dist/actions/get_admin_config.d.ts.map +1 -0
  35. package/dist/actions/get_admin_config.js +7 -0
  36. package/dist/actions/get_bin_arrays_by_indices.d.ts +5 -0
  37. package/dist/actions/get_bin_arrays_by_indices.d.ts.map +1 -0
  38. package/dist/actions/get_bin_arrays_by_indices.js +6 -0
  39. package/dist/actions/get_pool.d.ts +4 -0
  40. package/dist/actions/get_pool.d.ts.map +1 -0
  41. package/dist/actions/get_pool.js +5 -0
  42. package/dist/actions/get_position.d.ts +4 -0
  43. package/dist/actions/get_position.d.ts.map +1 -0
  44. package/dist/actions/get_position.js +5 -0
  45. package/dist/actions/get_position_by_position_mint.d.ts +4 -0
  46. package/dist/actions/get_position_by_position_mint.d.ts.map +1 -0
  47. package/dist/actions/get_position_by_position_mint.js +6 -0
  48. package/dist/actions/get_positions_by_owner.d.ts +5 -0
  49. package/dist/actions/get_positions_by_owner.d.ts.map +1 -0
  50. package/dist/actions/get_positions_by_owner.js +33 -0
  51. package/dist/actions/get_positions_by_position_mints.d.ts +5 -0
  52. package/dist/actions/get_positions_by_position_mints.d.ts.map +1 -0
  53. package/dist/actions/get_positions_by_position_mints.js +9 -0
  54. package/dist/actions/helpers/build_swap_transaction_message.d.ts +22 -0
  55. package/dist/actions/helpers/build_swap_transaction_message.d.ts.map +1 -0
  56. package/dist/actions/helpers/build_swap_transaction_message.js +50 -0
  57. package/dist/actions/helpers/build_transaction_message.d.ts +20 -0
  58. package/dist/actions/helpers/build_transaction_message.d.ts.map +1 -0
  59. package/dist/actions/helpers/build_transaction_message.js +5 -0
  60. package/dist/actions/helpers/index.d.ts +8 -0
  61. package/dist/actions/helpers/index.d.ts.map +1 -0
  62. package/dist/actions/helpers/index.js +7 -0
  63. package/dist/actions/helpers/resolve_active_bin_and_mints.d.ts +12 -0
  64. package/dist/actions/helpers/resolve_active_bin_and_mints.d.ts.map +1 -0
  65. package/dist/actions/helpers/resolve_active_bin_and_mints.js +13 -0
  66. package/dist/actions/helpers/resolve_admin_config_address.d.ts +3 -0
  67. package/dist/actions/helpers/resolve_admin_config_address.d.ts.map +1 -0
  68. package/dist/actions/helpers/resolve_admin_config_address.js +9 -0
  69. package/dist/actions/helpers/resolve_mint_info.d.ts +10 -0
  70. package/dist/actions/helpers/resolve_mint_info.d.ts.map +1 -0
  71. package/dist/actions/helpers/resolve_mint_info.js +20 -0
  72. package/dist/actions/helpers/resolve_position_range.d.ts +12 -0
  73. package/dist/actions/helpers/resolve_position_range.d.ts.map +1 -0
  74. package/dist/actions/helpers/resolve_position_range.js +12 -0
  75. package/dist/actions/helpers/resolve_token_mints_and_programs.d.ts +15 -0
  76. package/dist/actions/helpers/resolve_token_mints_and_programs.d.ts.map +1 -0
  77. package/dist/actions/helpers/resolve_token_mints_and_programs.js +29 -0
  78. package/dist/actions/index.d.ts +31 -0
  79. package/dist/actions/index.d.ts.map +1 -0
  80. package/dist/actions/index.js +28 -0
  81. package/dist/actions/is_admin_config_active.d.ts +4 -0
  82. package/dist/actions/is_admin_config_active.d.ts.map +1 -0
  83. package/dist/actions/is_admin_config_active.js +7 -0
  84. package/dist/actions/on_event.d.ts +11 -0
  85. package/dist/actions/on_event.d.ts.map +1 -0
  86. package/dist/actions/on_event.js +50 -0
  87. package/dist/actions/open_position.d.ts +17 -0
  88. package/dist/actions/open_position.d.ts.map +1 -0
  89. package/dist/actions/open_position.js +31 -0
  90. package/dist/actions/quote.d.ts +13 -0
  91. package/dist/actions/quote.d.ts.map +1 -0
  92. package/dist/actions/quote.js +43 -0
  93. package/dist/actions/set_metadata_update_authority.d.ts +14 -0
  94. package/dist/actions/set_metadata_update_authority.d.ts.map +1 -0
  95. package/dist/actions/set_metadata_update_authority.js +7 -0
  96. package/dist/actions/set_pool_dynamic_fee_config.d.ts +16 -0
  97. package/dist/actions/set_pool_dynamic_fee_config.d.ts.map +1 -0
  98. package/dist/actions/set_pool_dynamic_fee_config.js +7 -0
  99. package/dist/actions/set_pool_protocol_share.d.ts +15 -0
  100. package/dist/actions/set_pool_protocol_share.d.ts.map +1 -0
  101. package/dist/actions/set_pool_protocol_share.js +7 -0
  102. package/dist/actions/swap.d.ts +22 -0
  103. package/dist/actions/swap.d.ts.map +1 -0
  104. package/dist/actions/swap.js +19 -0
  105. package/dist/actions/sync_pool.d.ts +15 -0
  106. package/dist/actions/sync_pool.d.ts.map +1 -0
  107. package/dist/actions/sync_pool.js +26 -0
  108. package/dist/actions/transfer_admin_authority.d.ts +14 -0
  109. package/dist/actions/transfer_admin_authority.d.ts.map +1 -0
  110. package/dist/actions/transfer_admin_authority.js +7 -0
  111. package/dist/actions/withdraw.d.ts +22 -0
  112. package/dist/actions/withdraw.d.ts.map +1 -0
  113. package/dist/actions/withdraw.js +41 -0
  114. package/dist/events.d.ts +93 -0
  115. package/dist/events.d.ts.map +1 -0
  116. package/dist/events.js +166 -0
  117. package/dist/generated/accounts/adminConfig.d.ts +35 -0
  118. package/dist/generated/accounts/adminConfig.d.ts.map +1 -0
  119. package/dist/generated/accounts/adminConfig.js +60 -0
  120. package/dist/generated/accounts/binArray.d.ts +40 -0
  121. package/dist/generated/accounts/binArray.d.ts.map +1 -0
  122. package/dist/generated/accounts/binArray.js +65 -0
  123. package/dist/generated/accounts/index.d.ts +12 -0
  124. package/dist/generated/accounts/index.d.ts.map +1 -0
  125. package/dist/generated/accounts/index.js +11 -0
  126. package/dist/generated/accounts/pool.d.ts +54 -0
  127. package/dist/generated/accounts/pool.d.ts.map +1 -0
  128. package/dist/generated/accounts/pool.js +79 -0
  129. package/dist/generated/accounts/position.d.ts +42 -0
  130. package/dist/generated/accounts/position.d.ts.map +1 -0
  131. package/dist/generated/accounts/position.js +67 -0
  132. package/dist/generated/errors/index.d.ts +9 -0
  133. package/dist/generated/errors/index.d.ts.map +1 -0
  134. package/dist/generated/errors/index.js +8 -0
  135. package/dist/generated/errors/piconDlmm.d.ts +58 -0
  136. package/dist/generated/errors/piconDlmm.d.ts.map +1 -0
  137. package/dist/generated/errors/piconDlmm.js +80 -0
  138. package/dist/generated/index.d.ts +14 -0
  139. package/dist/generated/index.d.ts.map +1 -0
  140. package/dist/generated/index.js +13 -0
  141. package/dist/generated/instructions/acceptAdminAuthority.d.ts +47 -0
  142. package/dist/generated/instructions/acceptAdminAuthority.d.ts.map +1 -0
  143. package/dist/generated/instructions/acceptAdminAuthority.js +99 -0
  144. package/dist/generated/instructions/claimFee.d.ts +83 -0
  145. package/dist/generated/instructions/claimFee.d.ts.map +1 -0
  146. package/dist/generated/instructions/claimFee.js +127 -0
  147. package/dist/generated/instructions/claimProtocolFee.d.ts +83 -0
  148. package/dist/generated/instructions/claimProtocolFee.d.ts.map +1 -0
  149. package/dist/generated/instructions/claimProtocolFee.js +147 -0
  150. package/dist/generated/instructions/closePosition.d.ts +59 -0
  151. package/dist/generated/instructions/closePosition.d.ts.map +1 -0
  152. package/dist/generated/instructions/closePosition.js +124 -0
  153. package/dist/generated/instructions/createAdminConfig.d.ts +68 -0
  154. package/dist/generated/instructions/createAdminConfig.d.ts.map +1 -0
  155. package/dist/generated/instructions/createAdminConfig.js +132 -0
  156. package/dist/generated/instructions/createBinArray.d.ts +64 -0
  157. package/dist/generated/instructions/createBinArray.d.ts.map +1 -0
  158. package/dist/generated/instructions/createBinArray.js +122 -0
  159. package/dist/generated/instructions/createPool.d.ts +100 -0
  160. package/dist/generated/instructions/createPool.d.ts.map +1 -0
  161. package/dist/generated/instructions/createPool.js +202 -0
  162. package/dist/generated/instructions/deleteBinArray.d.ts +68 -0
  163. package/dist/generated/instructions/deleteBinArray.d.ts.map +1 -0
  164. package/dist/generated/instructions/deleteBinArray.js +130 -0
  165. package/dist/generated/instructions/depositByWeight.d.ts +99 -0
  166. package/dist/generated/instructions/depositByWeight.d.ts.map +1 -0
  167. package/dist/generated/instructions/depositByWeight.js +136 -0
  168. package/dist/generated/instructions/index.d.ts +25 -0
  169. package/dist/generated/instructions/index.d.ts.map +1 -0
  170. package/dist/generated/instructions/index.js +24 -0
  171. package/dist/generated/instructions/openPosition.d.ts +88 -0
  172. package/dist/generated/instructions/openPosition.d.ts.map +1 -0
  173. package/dist/generated/instructions/openPosition.js +200 -0
  174. package/dist/generated/instructions/setMetadataUpdateAuthority.d.ts +52 -0
  175. package/dist/generated/instructions/setMetadataUpdateAuthority.d.ts.map +1 -0
  176. package/dist/generated/instructions/setMetadataUpdateAuthority.js +98 -0
  177. package/dist/generated/instructions/setPoolDynamicFeeConfig.d.ts +57 -0
  178. package/dist/generated/instructions/setPoolDynamicFeeConfig.d.ts.map +1 -0
  179. package/dist/generated/instructions/setPoolDynamicFeeConfig.js +107 -0
  180. package/dist/generated/instructions/setPoolProtocolShare.d.ts +56 -0
  181. package/dist/generated/instructions/setPoolProtocolShare.d.ts.map +1 -0
  182. package/dist/generated/instructions/setPoolProtocolShare.js +106 -0
  183. package/dist/generated/instructions/swap.d.ts +74 -0
  184. package/dist/generated/instructions/swap.d.ts.map +1 -0
  185. package/dist/generated/instructions/swap.js +108 -0
  186. package/dist/generated/instructions/syncPool.d.ts +44 -0
  187. package/dist/generated/instructions/syncPool.d.ts.map +1 -0
  188. package/dist/generated/instructions/syncPool.js +71 -0
  189. package/dist/generated/instructions/transferAdminAuthority.d.ts +52 -0
  190. package/dist/generated/instructions/transferAdminAuthority.d.ts.map +1 -0
  191. package/dist/generated/instructions/transferAdminAuthority.js +98 -0
  192. package/dist/generated/instructions/withdraw.d.ts +86 -0
  193. package/dist/generated/instructions/withdraw.d.ts.map +1 -0
  194. package/dist/generated/instructions/withdraw.js +129 -0
  195. package/dist/generated/pdas/adminConfig.d.ts +12 -0
  196. package/dist/generated/pdas/adminConfig.d.ts.map +1 -0
  197. package/dist/generated/pdas/adminConfig.js +19 -0
  198. package/dist/generated/pdas/binArray.d.ts +16 -0
  199. package/dist/generated/pdas/binArray.d.ts.map +1 -0
  200. package/dist/generated/pdas/binArray.js +19 -0
  201. package/dist/generated/pdas/index.d.ts +12 -0
  202. package/dist/generated/pdas/index.d.ts.map +1 -0
  203. package/dist/generated/pdas/index.js +11 -0
  204. package/dist/generated/pdas/pool.d.ts +18 -0
  205. package/dist/generated/pdas/pool.d.ts.map +1 -0
  206. package/dist/generated/pdas/pool.js +21 -0
  207. package/dist/generated/pdas/position.d.ts +15 -0
  208. package/dist/generated/pdas/position.d.ts.map +1 -0
  209. package/dist/generated/pdas/position.js +18 -0
  210. package/dist/generated/programs/index.d.ts +9 -0
  211. package/dist/generated/programs/index.d.ts.map +1 -0
  212. package/dist/generated/programs/index.js +8 -0
  213. package/dist/generated/programs/piconDlmm.d.ts +126 -0
  214. package/dist/generated/programs/piconDlmm.d.ts.map +1 -0
  215. package/dist/generated/programs/piconDlmm.js +285 -0
  216. package/dist/generated/types/bin.d.ts +28 -0
  217. package/dist/generated/types/bin.d.ts.map +1 -0
  218. package/dist/generated/types/bin.js +31 -0
  219. package/dist/generated/types/distributionMode.d.ts +19 -0
  220. package/dist/generated/types/distributionMode.d.ts.map +1 -0
  221. package/dist/generated/types/distributionMode.js +24 -0
  222. package/dist/generated/types/dynamicFeeConfig.d.ts +29 -0
  223. package/dist/generated/types/dynamicFeeConfig.d.ts.map +1 -0
  224. package/dist/generated/types/dynamicFeeConfig.js +29 -0
  225. package/dist/generated/types/dynamicFeeState.d.ts +27 -0
  226. package/dist/generated/types/dynamicFeeState.d.ts.map +1 -0
  227. package/dist/generated/types/dynamicFeeState.js +30 -0
  228. package/dist/generated/types/feeState.d.ts +26 -0
  229. package/dist/generated/types/feeState.d.ts.map +1 -0
  230. package/dist/generated/types/feeState.js +29 -0
  231. package/dist/generated/types/index.d.ts +13 -0
  232. package/dist/generated/types/index.d.ts.map +1 -0
  233. package/dist/generated/types/index.js +12 -0
  234. package/dist/index.d.ts +5 -0
  235. package/dist/index.d.ts.map +1 -0
  236. package/dist/index.js +4 -0
  237. package/dist/picon_dlmm.json +2378 -0
  238. package/dist/program_addresses.d.ts +4 -0
  239. package/dist/program_addresses.d.ts.map +1 -0
  240. package/dist/program_addresses.js +8 -0
  241. package/dist/quote/index.d.ts +4 -0
  242. package/dist/quote/index.d.ts.map +1 -0
  243. package/dist/quote/index.js +5 -0
  244. package/dist/quote/wasm-node/picon_dlmm_quote.d.ts +6 -0
  245. package/dist/quote/wasm-node/picon_dlmm_quote.d.ts.map +1 -0
  246. package/dist/quote/wasm-node/picon_dlmm_quote.js +398 -0
  247. package/dist/quote/wasm-node/picon_dlmm_quote_bg.wasm +0 -0
  248. package/dist/quote/wasm-node-loader.d.ts +4 -0
  249. package/dist/quote/wasm-node-loader.d.ts.map +1 -0
  250. package/dist/quote/wasm-node-loader.js +7 -0
  251. package/dist/quote/wasm-web/picon_dlmm_quote.d.ts +9 -0
  252. package/dist/quote/wasm-web/picon_dlmm_quote.d.ts.map +1 -0
  253. package/dist/quote/wasm-web/picon_dlmm_quote.js +486 -0
  254. package/dist/quote/wasm-web/picon_dlmm_quote_bg.wasm +0 -0
  255. package/dist/quote/wasm-web-loader.d.ts +4 -0
  256. package/dist/quote/wasm-web-loader.d.ts.map +1 -0
  257. package/dist/quote/wasm-web-loader.js +12 -0
  258. package/dist/utils/admin_config.d.ts +3 -0
  259. package/dist/utils/admin_config.d.ts.map +1 -0
  260. package/dist/utils/admin_config.js +4 -0
  261. package/dist/utils/ata.d.ts +49 -0
  262. package/dist/utils/ata.d.ts.map +1 -0
  263. package/dist/utils/ata.js +113 -0
  264. package/dist/utils/bin_array.d.ts +8 -0
  265. package/dist/utils/bin_array.d.ts.map +1 -0
  266. package/dist/utils/bin_array.js +29 -0
  267. package/dist/utils/bin_location.d.ts +11 -0
  268. package/dist/utils/bin_location.d.ts.map +1 -0
  269. package/dist/utils/bin_location.js +55 -0
  270. package/dist/utils/chunk.d.ts +2 -0
  271. package/dist/utils/chunk.d.ts.map +1 -0
  272. package/dist/utils/chunk.js +7 -0
  273. package/dist/utils/compute_budget.d.ts +11 -0
  274. package/dist/utils/compute_budget.d.ts.map +1 -0
  275. package/dist/utils/compute_budget.js +22 -0
  276. package/dist/utils/constants.d.ts +12 -0
  277. package/dist/utils/constants.d.ts.map +1 -0
  278. package/dist/utils/constants.js +20 -0
  279. package/dist/utils/transfer_fee.d.ts +4 -0
  280. package/dist/utils/transfer_fee.d.ts.map +1 -0
  281. package/dist/utils/transfer_fee.js +21 -0
  282. package/dist/utils/type_guards.d.ts +2 -0
  283. package/dist/utils/type_guards.d.ts.map +1 -0
  284. package/dist/utils/type_guards.js +3 -0
  285. package/package.json +59 -0
  286. package/src/actions/accept_admin_authority.ts +17 -0
  287. package/src/actions/claim_fee.ts +84 -0
  288. package/src/actions/claim_multiple_fees.ts +123 -0
  289. package/src/actions/claim_protocol_fee.ts +68 -0
  290. package/src/actions/close_position.ts +21 -0
  291. package/src/actions/create_admin_config.ts +50 -0
  292. package/src/actions/create_bin_array.ts +30 -0
  293. package/src/actions/create_pool.ts +49 -0
  294. package/src/actions/delete_bin_array.ts +33 -0
  295. package/src/actions/deposit_by_weight.ts +107 -0
  296. package/src/actions/get_admin_config.ts +13 -0
  297. package/src/actions/get_bin_arrays_by_indices.ts +15 -0
  298. package/src/actions/get_pool.ts +8 -0
  299. package/src/actions/get_position.ts +8 -0
  300. package/src/actions/get_position_by_position_mint.ts +14 -0
  301. package/src/actions/get_positions_by_owner.ts +48 -0
  302. package/src/actions/get_positions_by_position_mints.ts +21 -0
  303. package/src/actions/helpers/build_swap_transaction_message.ts +86 -0
  304. package/src/actions/helpers/build_transaction_message.ts +45 -0
  305. package/src/actions/helpers/index.ts +7 -0
  306. package/src/actions/helpers/resolve_active_bin_and_mints.ts +21 -0
  307. package/src/actions/helpers/resolve_admin_config_address.ts +11 -0
  308. package/src/actions/helpers/resolve_mint_info.ts +36 -0
  309. package/src/actions/helpers/resolve_position_range.ts +21 -0
  310. package/src/actions/helpers/resolve_token_mints_and_programs.ts +56 -0
  311. package/src/actions/index.ts +34 -0
  312. package/src/actions/is_admin_config_active.ts +14 -0
  313. package/src/actions/on_event.ts +78 -0
  314. package/src/actions/open_position.ts +66 -0
  315. package/src/actions/quote.ts +70 -0
  316. package/src/actions/set_metadata_update_authority.ts +17 -0
  317. package/src/actions/set_pool_dynamic_fee_config.ts +17 -0
  318. package/src/actions/set_pool_protocol_share.ts +17 -0
  319. package/src/actions/swap.ts +56 -0
  320. package/src/actions/sync_pool.ts +35 -0
  321. package/src/actions/transfer_admin_authority.ts +17 -0
  322. package/src/actions/withdraw.ts +87 -0
  323. package/src/events.ts +279 -0
  324. package/src/generated/accounts/adminConfig.ts +147 -0
  325. package/src/generated/accounts/binArray.ts +155 -0
  326. package/src/generated/accounts/index.ts +12 -0
  327. package/src/generated/accounts/pool.ts +192 -0
  328. package/src/generated/accounts/position.ts +164 -0
  329. package/src/generated/errors/index.ts +9 -0
  330. package/src/generated/errors/piconDlmm.ts +124 -0
  331. package/src/generated/index.ts +14 -0
  332. package/src/generated/instructions/acceptAdminAuthority.ts +262 -0
  333. package/src/generated/instructions/claimFee.ts +395 -0
  334. package/src/generated/instructions/claimProtocolFee.ts +462 -0
  335. package/src/generated/instructions/closePosition.ts +342 -0
  336. package/src/generated/instructions/createAdminConfig.ts +369 -0
  337. package/src/generated/instructions/createBinArray.ts +344 -0
  338. package/src/generated/instructions/createPool.ts +582 -0
  339. package/src/generated/instructions/deleteBinArray.ts +365 -0
  340. package/src/generated/instructions/depositByWeight.ts +435 -0
  341. package/src/generated/instructions/index.ts +25 -0
  342. package/src/generated/instructions/openPosition.ts +547 -0
  343. package/src/generated/instructions/setMetadataUpdateAuthority.ts +274 -0
  344. package/src/generated/instructions/setPoolDynamicFeeConfig.ts +304 -0
  345. package/src/generated/instructions/setPoolProtocolShare.ts +298 -0
  346. package/src/generated/instructions/swap.ts +336 -0
  347. package/src/generated/instructions/syncPool.ts +189 -0
  348. package/src/generated/instructions/transferAdminAuthority.ts +271 -0
  349. package/src/generated/instructions/withdraw.ts +402 -0
  350. package/src/generated/pdas/adminConfig.ts +32 -0
  351. package/src/generated/pdas/binArray.ts +40 -0
  352. package/src/generated/pdas/index.ts +12 -0
  353. package/src/generated/pdas/pool.ts +43 -0
  354. package/src/generated/pdas/position.ts +37 -0
  355. package/src/generated/programs/index.ts +9 -0
  356. package/src/generated/programs/piconDlmm.ts +803 -0
  357. package/src/generated/types/bin.ts +64 -0
  358. package/src/generated/types/distributionMode.ts +43 -0
  359. package/src/generated/types/dynamicFeeConfig.ts +69 -0
  360. package/src/generated/types/dynamicFeeState.ts +71 -0
  361. package/src/generated/types/feeState.ts +60 -0
  362. package/src/generated/types/index.ts +13 -0
  363. package/src/index.ts +4 -0
  364. package/src/picon_dlmm.json +2378 -0
  365. package/src/program_addresses.ts +10 -0
  366. package/src/quote/index.ts +14 -0
  367. package/src/quote/wasm-node/package.json +4 -0
  368. package/src/quote/wasm-node/picon_dlmm_quote.d.ts +64 -0
  369. package/src/quote/wasm-node/picon_dlmm_quote.js +407 -0
  370. package/src/quote/wasm-node/picon_dlmm_quote_bg.wasm +0 -0
  371. package/src/quote/wasm-node/picon_dlmm_quote_bg.wasm.d.ts +11 -0
  372. package/src/quote/wasm-node-loader.ts +11 -0
  373. package/src/quote/wasm-web/picon_dlmm_quote.d.ts +100 -0
  374. package/src/quote/wasm-web/picon_dlmm_quote.js +500 -0
  375. package/src/quote/wasm-web/picon_dlmm_quote_bg.wasm +0 -0
  376. package/src/quote/wasm-web/picon_dlmm_quote_bg.wasm.d.ts +11 -0
  377. package/src/quote/wasm-web-loader.ts +17 -0
  378. package/src/utils/admin_config.ts +6 -0
  379. package/src/utils/ata.ts +213 -0
  380. package/src/utils/bin_array.ts +45 -0
  381. package/src/utils/bin_location.ts +79 -0
  382. package/src/utils/chunk.ts +7 -0
  383. package/src/utils/compute_budget.ts +58 -0
  384. package/src/utils/constants.ts +24 -0
  385. package/src/utils/transfer_fee.ts +29 -0
  386. package/src/utils/type_guards.ts +3 -0
@@ -0,0 +1,155 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+
9
+ import {
10
+ assertAccountExists,
11
+ assertAccountsExist,
12
+ combineCodec,
13
+ decodeAccount,
14
+ fetchEncodedAccount,
15
+ fetchEncodedAccounts,
16
+ fixDecoderSize,
17
+ fixEncoderSize,
18
+ getAddressDecoder,
19
+ getAddressEncoder,
20
+ getArrayDecoder,
21
+ getArrayEncoder,
22
+ getBytesDecoder,
23
+ getBytesEncoder,
24
+ getI32Decoder,
25
+ getI32Encoder,
26
+ getStructDecoder,
27
+ getStructEncoder,
28
+ transformEncoder,
29
+ type Account,
30
+ type Address,
31
+ type EncodedAccount,
32
+ type FetchAccountConfig,
33
+ type FetchAccountsConfig,
34
+ type FixedSizeCodec,
35
+ type FixedSizeDecoder,
36
+ type FixedSizeEncoder,
37
+ type MaybeAccount,
38
+ type MaybeEncodedAccount,
39
+ type ReadonlyUint8Array,
40
+ } from "@solana/kit";
41
+ import { getBinDecoder, getBinEncoder, type Bin, type BinArgs } from "../types";
42
+
43
+ export const BIN_ARRAY_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([
44
+ 92, 142, 92, 220, 5, 148, 70, 181,
45
+ ]);
46
+
47
+ export function getBinArrayDiscriminatorBytes(): ReadonlyUint8Array {
48
+ return fixEncoderSize(getBytesEncoder(), 8).encode(BIN_ARRAY_DISCRIMINATOR);
49
+ }
50
+
51
+ export type BinArray = {
52
+ discriminator: ReadonlyUint8Array;
53
+ index: number;
54
+ pool: Address;
55
+ payer: Address;
56
+ padding: ReadonlyUint8Array;
57
+ bins: Array<Bin>;
58
+ };
59
+
60
+ export type BinArrayArgs = {
61
+ index: number;
62
+ pool: Address;
63
+ payer: Address;
64
+ padding: ReadonlyUint8Array;
65
+ bins: Array<BinArgs>;
66
+ };
67
+
68
+ /** Gets the encoder for {@link BinArrayArgs} account data. */
69
+ export function getBinArrayEncoder(): FixedSizeEncoder<BinArrayArgs> {
70
+ return transformEncoder(
71
+ getStructEncoder([
72
+ ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
73
+ ["index", getI32Encoder()],
74
+ ["pool", getAddressEncoder()],
75
+ ["payer", getAddressEncoder()],
76
+ ["padding", fixEncoderSize(getBytesEncoder(), 12)],
77
+ ["bins", getArrayEncoder(getBinEncoder(), { size: 100 })],
78
+ ]),
79
+ (value) => ({ ...value, discriminator: BIN_ARRAY_DISCRIMINATOR }),
80
+ );
81
+ }
82
+
83
+ /** Gets the decoder for {@link BinArray} account data. */
84
+ export function getBinArrayDecoder(): FixedSizeDecoder<BinArray> {
85
+ return getStructDecoder([
86
+ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
87
+ ["index", getI32Decoder()],
88
+ ["pool", getAddressDecoder()],
89
+ ["payer", getAddressDecoder()],
90
+ ["padding", fixDecoderSize(getBytesDecoder(), 12)],
91
+ ["bins", getArrayDecoder(getBinDecoder(), { size: 100 })],
92
+ ]);
93
+ }
94
+
95
+ /** Gets the codec for {@link BinArray} account data. */
96
+ export function getBinArrayCodec(): FixedSizeCodec<BinArrayArgs, BinArray> {
97
+ return combineCodec(getBinArrayEncoder(), getBinArrayDecoder());
98
+ }
99
+
100
+ export function decodeBinArray<TAddress extends string = string>(
101
+ encodedAccount: EncodedAccount<TAddress>,
102
+ ): Account<BinArray, TAddress>;
103
+ export function decodeBinArray<TAddress extends string = string>(
104
+ encodedAccount: MaybeEncodedAccount<TAddress>,
105
+ ): MaybeAccount<BinArray, TAddress>;
106
+ export function decodeBinArray<TAddress extends string = string>(
107
+ encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress>,
108
+ ): Account<BinArray, TAddress> | MaybeAccount<BinArray, TAddress> {
109
+ return decodeAccount(
110
+ encodedAccount as MaybeEncodedAccount<TAddress>,
111
+ getBinArrayDecoder(),
112
+ );
113
+ }
114
+
115
+ export async function fetchBinArray<TAddress extends string = string>(
116
+ rpc: Parameters<typeof fetchEncodedAccount>[0],
117
+ address: Address<TAddress>,
118
+ config?: FetchAccountConfig,
119
+ ): Promise<Account<BinArray, TAddress>> {
120
+ const maybeAccount = await fetchMaybeBinArray(rpc, address, config);
121
+ assertAccountExists(maybeAccount);
122
+ return maybeAccount;
123
+ }
124
+
125
+ export async function fetchMaybeBinArray<TAddress extends string = string>(
126
+ rpc: Parameters<typeof fetchEncodedAccount>[0],
127
+ address: Address<TAddress>,
128
+ config?: FetchAccountConfig,
129
+ ): Promise<MaybeAccount<BinArray, TAddress>> {
130
+ const maybeAccount = await fetchEncodedAccount(rpc, address, config);
131
+ return decodeBinArray(maybeAccount);
132
+ }
133
+
134
+ export async function fetchAllBinArray(
135
+ rpc: Parameters<typeof fetchEncodedAccounts>[0],
136
+ addresses: Array<Address>,
137
+ config?: FetchAccountsConfig,
138
+ ): Promise<Account<BinArray>[]> {
139
+ const maybeAccounts = await fetchAllMaybeBinArray(rpc, addresses, config);
140
+ assertAccountsExist(maybeAccounts);
141
+ return maybeAccounts;
142
+ }
143
+
144
+ export async function fetchAllMaybeBinArray(
145
+ rpc: Parameters<typeof fetchEncodedAccounts>[0],
146
+ addresses: Array<Address>,
147
+ config?: FetchAccountsConfig,
148
+ ): Promise<MaybeAccount<BinArray>[]> {
149
+ const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
150
+ return maybeAccounts.map((maybeAccount) => decodeBinArray(maybeAccount));
151
+ }
152
+
153
+ export function getBinArraySize(): number {
154
+ return 8088;
155
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+
9
+ export * from "./adminConfig";
10
+ export * from "./binArray";
11
+ export * from "./pool";
12
+ export * from "./position";
@@ -0,0 +1,192 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+
9
+ import {
10
+ assertAccountExists,
11
+ assertAccountsExist,
12
+ combineCodec,
13
+ decodeAccount,
14
+ fetchEncodedAccount,
15
+ fetchEncodedAccounts,
16
+ fixDecoderSize,
17
+ fixEncoderSize,
18
+ getAddressDecoder,
19
+ getAddressEncoder,
20
+ getBytesDecoder,
21
+ getBytesEncoder,
22
+ getI32Decoder,
23
+ getI32Encoder,
24
+ getStructDecoder,
25
+ getStructEncoder,
26
+ getU16Decoder,
27
+ getU16Encoder,
28
+ getU32Decoder,
29
+ getU32Encoder,
30
+ getU64Decoder,
31
+ getU64Encoder,
32
+ transformEncoder,
33
+ type Account,
34
+ type Address,
35
+ type EncodedAccount,
36
+ type FetchAccountConfig,
37
+ type FetchAccountsConfig,
38
+ type FixedSizeCodec,
39
+ type FixedSizeDecoder,
40
+ type FixedSizeEncoder,
41
+ type MaybeAccount,
42
+ type MaybeEncodedAccount,
43
+ type ReadonlyUint8Array,
44
+ } from "@solana/kit";
45
+ import {
46
+ getDynamicFeeStateDecoder,
47
+ getDynamicFeeStateEncoder,
48
+ type DynamicFeeState,
49
+ type DynamicFeeStateArgs,
50
+ } from "../types";
51
+
52
+ export const POOL_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([
53
+ 241, 154, 109, 4, 17, 177, 109, 188,
54
+ ]);
55
+
56
+ export function getPoolDiscriminatorBytes(): ReadonlyUint8Array {
57
+ return fixEncoderSize(getBytesEncoder(), 8).encode(POOL_DISCRIMINATOR);
58
+ }
59
+
60
+ export type Pool = {
61
+ discriminator: ReadonlyUint8Array;
62
+ binStep: number;
63
+ feeRate: number;
64
+ protocolShare: number;
65
+ bump: ReadonlyUint8Array;
66
+ activeBinId: number;
67
+ dynamicFeeState: DynamicFeeState;
68
+ tokenMintX: Address;
69
+ tokenMintY: Address;
70
+ tokenVaultX: Address;
71
+ tokenVaultY: Address;
72
+ protocolFeeX: bigint;
73
+ protocolFeeY: bigint;
74
+ };
75
+
76
+ export type PoolArgs = {
77
+ binStep: number;
78
+ feeRate: number;
79
+ protocolShare: number;
80
+ bump: ReadonlyUint8Array;
81
+ activeBinId: number;
82
+ dynamicFeeState: DynamicFeeStateArgs;
83
+ tokenMintX: Address;
84
+ tokenMintY: Address;
85
+ tokenVaultX: Address;
86
+ tokenVaultY: Address;
87
+ protocolFeeX: number | bigint;
88
+ protocolFeeY: number | bigint;
89
+ };
90
+
91
+ /** Gets the encoder for {@link PoolArgs} account data. */
92
+ export function getPoolEncoder(): FixedSizeEncoder<PoolArgs> {
93
+ return transformEncoder(
94
+ getStructEncoder([
95
+ ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
96
+ ["binStep", getU16Encoder()],
97
+ ["feeRate", getU32Encoder()],
98
+ ["protocolShare", getU16Encoder()],
99
+ ["bump", fixEncoderSize(getBytesEncoder(), 1)],
100
+ ["activeBinId", getI32Encoder()],
101
+ ["dynamicFeeState", getDynamicFeeStateEncoder()],
102
+ ["tokenMintX", getAddressEncoder()],
103
+ ["tokenMintY", getAddressEncoder()],
104
+ ["tokenVaultX", getAddressEncoder()],
105
+ ["tokenVaultY", getAddressEncoder()],
106
+ ["protocolFeeX", getU64Encoder()],
107
+ ["protocolFeeY", getU64Encoder()],
108
+ ]),
109
+ (value) => ({ ...value, discriminator: POOL_DISCRIMINATOR }),
110
+ );
111
+ }
112
+
113
+ /** Gets the decoder for {@link Pool} account data. */
114
+ export function getPoolDecoder(): FixedSizeDecoder<Pool> {
115
+ return getStructDecoder([
116
+ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
117
+ ["binStep", getU16Decoder()],
118
+ ["feeRate", getU32Decoder()],
119
+ ["protocolShare", getU16Decoder()],
120
+ ["bump", fixDecoderSize(getBytesDecoder(), 1)],
121
+ ["activeBinId", getI32Decoder()],
122
+ ["dynamicFeeState", getDynamicFeeStateDecoder()],
123
+ ["tokenMintX", getAddressDecoder()],
124
+ ["tokenMintY", getAddressDecoder()],
125
+ ["tokenVaultX", getAddressDecoder()],
126
+ ["tokenVaultY", getAddressDecoder()],
127
+ ["protocolFeeX", getU64Decoder()],
128
+ ["protocolFeeY", getU64Decoder()],
129
+ ]);
130
+ }
131
+
132
+ /** Gets the codec for {@link Pool} account data. */
133
+ export function getPoolCodec(): FixedSizeCodec<PoolArgs, Pool> {
134
+ return combineCodec(getPoolEncoder(), getPoolDecoder());
135
+ }
136
+
137
+ export function decodePool<TAddress extends string = string>(
138
+ encodedAccount: EncodedAccount<TAddress>,
139
+ ): Account<Pool, TAddress>;
140
+ export function decodePool<TAddress extends string = string>(
141
+ encodedAccount: MaybeEncodedAccount<TAddress>,
142
+ ): MaybeAccount<Pool, TAddress>;
143
+ export function decodePool<TAddress extends string = string>(
144
+ encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress>,
145
+ ): Account<Pool, TAddress> | MaybeAccount<Pool, TAddress> {
146
+ return decodeAccount(
147
+ encodedAccount as MaybeEncodedAccount<TAddress>,
148
+ getPoolDecoder(),
149
+ );
150
+ }
151
+
152
+ export async function fetchPool<TAddress extends string = string>(
153
+ rpc: Parameters<typeof fetchEncodedAccount>[0],
154
+ address: Address<TAddress>,
155
+ config?: FetchAccountConfig,
156
+ ): Promise<Account<Pool, TAddress>> {
157
+ const maybeAccount = await fetchMaybePool(rpc, address, config);
158
+ assertAccountExists(maybeAccount);
159
+ return maybeAccount;
160
+ }
161
+
162
+ export async function fetchMaybePool<TAddress extends string = string>(
163
+ rpc: Parameters<typeof fetchEncodedAccount>[0],
164
+ address: Address<TAddress>,
165
+ config?: FetchAccountConfig,
166
+ ): Promise<MaybeAccount<Pool, TAddress>> {
167
+ const maybeAccount = await fetchEncodedAccount(rpc, address, config);
168
+ return decodePool(maybeAccount);
169
+ }
170
+
171
+ export async function fetchAllPool(
172
+ rpc: Parameters<typeof fetchEncodedAccounts>[0],
173
+ addresses: Array<Address>,
174
+ config?: FetchAccountsConfig,
175
+ ): Promise<Account<Pool>[]> {
176
+ const maybeAccounts = await fetchAllMaybePool(rpc, addresses, config);
177
+ assertAccountsExist(maybeAccounts);
178
+ return maybeAccounts;
179
+ }
180
+
181
+ export async function fetchAllMaybePool(
182
+ rpc: Parameters<typeof fetchEncodedAccounts>[0],
183
+ addresses: Array<Address>,
184
+ config?: FetchAccountsConfig,
185
+ ): Promise<MaybeAccount<Pool>[]> {
186
+ const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
187
+ return maybeAccounts.map((maybeAccount) => decodePool(maybeAccount));
188
+ }
189
+
190
+ export function getPoolSize(): number {
191
+ return 203;
192
+ }
@@ -0,0 +1,164 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+
9
+ import {
10
+ assertAccountExists,
11
+ assertAccountsExist,
12
+ combineCodec,
13
+ decodeAccount,
14
+ fetchEncodedAccount,
15
+ fetchEncodedAccounts,
16
+ fixDecoderSize,
17
+ fixEncoderSize,
18
+ getAddressDecoder,
19
+ getAddressEncoder,
20
+ getArrayDecoder,
21
+ getArrayEncoder,
22
+ getBytesDecoder,
23
+ getBytesEncoder,
24
+ getI32Decoder,
25
+ getI32Encoder,
26
+ getStructDecoder,
27
+ getStructEncoder,
28
+ transformEncoder,
29
+ type Account,
30
+ type Address,
31
+ type EncodedAccount,
32
+ type FetchAccountConfig,
33
+ type FetchAccountsConfig,
34
+ type FixedSizeCodec,
35
+ type FixedSizeDecoder,
36
+ type FixedSizeEncoder,
37
+ type MaybeAccount,
38
+ type MaybeEncodedAccount,
39
+ type ReadonlyUint8Array,
40
+ } from "@solana/kit";
41
+ import {
42
+ getFeeStateDecoder,
43
+ getFeeStateEncoder,
44
+ type FeeState,
45
+ type FeeStateArgs,
46
+ } from "../types";
47
+
48
+ export const POSITION_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([
49
+ 170, 188, 143, 228, 122, 64, 247, 208,
50
+ ]);
51
+
52
+ export function getPositionDiscriminatorBytes(): ReadonlyUint8Array {
53
+ return fixEncoderSize(getBytesEncoder(), 8).encode(POSITION_DISCRIMINATOR);
54
+ }
55
+
56
+ export type Position = {
57
+ discriminator: ReadonlyUint8Array;
58
+ pool: Address;
59
+ positionMint: Address;
60
+ lowerBinId: number;
61
+ upperBinId: number;
62
+ padding: ReadonlyUint8Array;
63
+ feeStates: Array<FeeState>;
64
+ };
65
+
66
+ export type PositionArgs = {
67
+ pool: Address;
68
+ positionMint: Address;
69
+ lowerBinId: number;
70
+ upperBinId: number;
71
+ padding: ReadonlyUint8Array;
72
+ feeStates: Array<FeeStateArgs>;
73
+ };
74
+
75
+ /** Gets the encoder for {@link PositionArgs} account data. */
76
+ export function getPositionEncoder(): FixedSizeEncoder<PositionArgs> {
77
+ return transformEncoder(
78
+ getStructEncoder([
79
+ ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
80
+ ["pool", getAddressEncoder()],
81
+ ["positionMint", getAddressEncoder()],
82
+ ["lowerBinId", getI32Encoder()],
83
+ ["upperBinId", getI32Encoder()],
84
+ ["padding", fixEncoderSize(getBytesEncoder(), 8)],
85
+ ["feeStates", getArrayEncoder(getFeeStateEncoder(), { size: 100 })],
86
+ ]),
87
+ (value) => ({ ...value, discriminator: POSITION_DISCRIMINATOR }),
88
+ );
89
+ }
90
+
91
+ /** Gets the decoder for {@link Position} account data. */
92
+ export function getPositionDecoder(): FixedSizeDecoder<Position> {
93
+ return getStructDecoder([
94
+ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
95
+ ["pool", getAddressDecoder()],
96
+ ["positionMint", getAddressDecoder()],
97
+ ["lowerBinId", getI32Decoder()],
98
+ ["upperBinId", getI32Decoder()],
99
+ ["padding", fixDecoderSize(getBytesDecoder(), 8)],
100
+ ["feeStates", getArrayDecoder(getFeeStateDecoder(), { size: 100 })],
101
+ ]);
102
+ }
103
+
104
+ /** Gets the codec for {@link Position} account data. */
105
+ export function getPositionCodec(): FixedSizeCodec<PositionArgs, Position> {
106
+ return combineCodec(getPositionEncoder(), getPositionDecoder());
107
+ }
108
+
109
+ export function decodePosition<TAddress extends string = string>(
110
+ encodedAccount: EncodedAccount<TAddress>,
111
+ ): Account<Position, TAddress>;
112
+ export function decodePosition<TAddress extends string = string>(
113
+ encodedAccount: MaybeEncodedAccount<TAddress>,
114
+ ): MaybeAccount<Position, TAddress>;
115
+ export function decodePosition<TAddress extends string = string>(
116
+ encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress>,
117
+ ): Account<Position, TAddress> | MaybeAccount<Position, TAddress> {
118
+ return decodeAccount(
119
+ encodedAccount as MaybeEncodedAccount<TAddress>,
120
+ getPositionDecoder(),
121
+ );
122
+ }
123
+
124
+ export async function fetchPosition<TAddress extends string = string>(
125
+ rpc: Parameters<typeof fetchEncodedAccount>[0],
126
+ address: Address<TAddress>,
127
+ config?: FetchAccountConfig,
128
+ ): Promise<Account<Position, TAddress>> {
129
+ const maybeAccount = await fetchMaybePosition(rpc, address, config);
130
+ assertAccountExists(maybeAccount);
131
+ return maybeAccount;
132
+ }
133
+
134
+ export async function fetchMaybePosition<TAddress extends string = string>(
135
+ rpc: Parameters<typeof fetchEncodedAccount>[0],
136
+ address: Address<TAddress>,
137
+ config?: FetchAccountConfig,
138
+ ): Promise<MaybeAccount<Position, TAddress>> {
139
+ const maybeAccount = await fetchEncodedAccount(rpc, address, config);
140
+ return decodePosition(maybeAccount);
141
+ }
142
+
143
+ export async function fetchAllPosition(
144
+ rpc: Parameters<typeof fetchEncodedAccounts>[0],
145
+ addresses: Array<Address>,
146
+ config?: FetchAccountsConfig,
147
+ ): Promise<Account<Position>[]> {
148
+ const maybeAccounts = await fetchAllMaybePosition(rpc, addresses, config);
149
+ assertAccountsExist(maybeAccounts);
150
+ return maybeAccounts;
151
+ }
152
+
153
+ export async function fetchAllMaybePosition(
154
+ rpc: Parameters<typeof fetchEncodedAccounts>[0],
155
+ addresses: Array<Address>,
156
+ config?: FetchAccountsConfig,
157
+ ): Promise<MaybeAccount<Position>[]> {
158
+ const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
159
+ return maybeAccounts.map((maybeAccount) => decodePosition(maybeAccount));
160
+ }
161
+
162
+ export function getPositionSize(): number {
163
+ return 6488;
164
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+
9
+ export * from "./piconDlmm";
@@ -0,0 +1,124 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+
9
+ import {
10
+ isProgramError,
11
+ type Address,
12
+ type SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM,
13
+ type SolanaError,
14
+ } from "@solana/kit";
15
+ import { PICON_DLMM_PROGRAM_ADDRESS } from "../programs";
16
+
17
+ /** LiquidityError: Liquidity error */
18
+ export const PICON_DLMM_ERROR__LIQUIDITY_ERROR = 0x1770; // 6000
19
+ /** InvalidBinArray: Invalid bin array */
20
+ export const PICON_DLMM_ERROR__INVALID_BIN_ARRAY = 0x1771; // 6001
21
+ /** BinArrayNotEmpty: Bin array is not empty */
22
+ export const PICON_DLMM_ERROR__BIN_ARRAY_NOT_EMPTY = 0x1772; // 6002
23
+ /** UnsupportedBinStep: Unsupported bin step */
24
+ export const PICON_DLMM_ERROR__UNSUPPORTED_BIN_STEP = 0x1773; // 6003
25
+ /** UnsupportedFeeRate: Unsupported fee rate */
26
+ export const PICON_DLMM_ERROR__UNSUPPORTED_FEE_RATE = 0x1774; // 6004
27
+ /** InvalidProtocolShare: Invalid protocol share */
28
+ export const PICON_DLMM_ERROR__INVALID_PROTOCOL_SHARE = 0x1775; // 6005
29
+ /** InvalidActiveBin: Invalid active bin */
30
+ export const PICON_DLMM_ERROR__INVALID_ACTIVE_BIN = 0x1776; // 6006
31
+ /** UnsupportedMintExtension: Unsupported mint extension */
32
+ export const PICON_DLMM_ERROR__UNSUPPORTED_MINT_EXTENSION = 0x1777; // 6007
33
+ /** InvalidDynamicFeeConfig: Invalid dynamic fee config */
34
+ export const PICON_DLMM_ERROR__INVALID_DYNAMIC_FEE_CONFIG = 0x1778; // 6008
35
+ /** InvalidBinRange: Invalid bin range */
36
+ export const PICON_DLMM_ERROR__INVALID_BIN_RANGE = 0x1779; // 6009
37
+ /** InvalidPositionOwner: Invalid position token owner */
38
+ export const PICON_DLMM_ERROR__INVALID_POSITION_OWNER = 0x177a; // 6010
39
+ /** InvalidBinWeights: Invalid bin weights */
40
+ export const PICON_DLMM_ERROR__INVALID_BIN_WEIGHTS = 0x177b; // 6011
41
+ /** InvalidBps: Invalid bps */
42
+ export const PICON_DLMM_ERROR__INVALID_BPS = 0x177c; // 6012
43
+ /** PositionNotEmpty: Position is not empty */
44
+ export const PICON_DLMM_ERROR__POSITION_NOT_EMPTY = 0x177d; // 6013
45
+ /** ExceededBinSlippageTolerance: Exceeded bin slippage tolerance */
46
+ export const PICON_DLMM_ERROR__EXCEEDED_BIN_SLIPPAGE_TOLERANCE = 0x177e; // 6014
47
+ /** ZeroSwapAmount: Swap amount is zero */
48
+ export const PICON_DLMM_ERROR__ZERO_SWAP_AMOUNT = 0x177f; // 6015
49
+ /** InsufficientLiquidity: Insufficient liquidity for swap */
50
+ export const PICON_DLMM_ERROR__INSUFFICIENT_LIQUIDITY = 0x1780; // 6016
51
+ /** ExceededSwapSlippageTolerance: Exceeded swap slippage tolerance */
52
+ export const PICON_DLMM_ERROR__EXCEEDED_SWAP_SLIPPAGE_TOLERANCE = 0x1781; // 6017
53
+ /** InvalidPendingAuthority: Signer is not the pending authority */
54
+ export const PICON_DLMM_ERROR__INVALID_PENDING_AUTHORITY = 0x1782; // 6018
55
+
56
+ export type PiconDlmmError =
57
+ | typeof PICON_DLMM_ERROR__BIN_ARRAY_NOT_EMPTY
58
+ | typeof PICON_DLMM_ERROR__EXCEEDED_BIN_SLIPPAGE_TOLERANCE
59
+ | typeof PICON_DLMM_ERROR__EXCEEDED_SWAP_SLIPPAGE_TOLERANCE
60
+ | typeof PICON_DLMM_ERROR__INSUFFICIENT_LIQUIDITY
61
+ | typeof PICON_DLMM_ERROR__INVALID_ACTIVE_BIN
62
+ | typeof PICON_DLMM_ERROR__INVALID_BIN_ARRAY
63
+ | typeof PICON_DLMM_ERROR__INVALID_BIN_RANGE
64
+ | typeof PICON_DLMM_ERROR__INVALID_BIN_WEIGHTS
65
+ | typeof PICON_DLMM_ERROR__INVALID_BPS
66
+ | typeof PICON_DLMM_ERROR__INVALID_DYNAMIC_FEE_CONFIG
67
+ | typeof PICON_DLMM_ERROR__INVALID_PENDING_AUTHORITY
68
+ | typeof PICON_DLMM_ERROR__INVALID_POSITION_OWNER
69
+ | typeof PICON_DLMM_ERROR__INVALID_PROTOCOL_SHARE
70
+ | typeof PICON_DLMM_ERROR__LIQUIDITY_ERROR
71
+ | typeof PICON_DLMM_ERROR__POSITION_NOT_EMPTY
72
+ | typeof PICON_DLMM_ERROR__UNSUPPORTED_BIN_STEP
73
+ | typeof PICON_DLMM_ERROR__UNSUPPORTED_FEE_RATE
74
+ | typeof PICON_DLMM_ERROR__UNSUPPORTED_MINT_EXTENSION
75
+ | typeof PICON_DLMM_ERROR__ZERO_SWAP_AMOUNT;
76
+
77
+ let piconDlmmErrorMessages: Record<PiconDlmmError, string> | undefined;
78
+ if (process.env["NODE_ENV"] !== "production") {
79
+ piconDlmmErrorMessages = {
80
+ [PICON_DLMM_ERROR__BIN_ARRAY_NOT_EMPTY]: `Bin array is not empty`,
81
+ [PICON_DLMM_ERROR__EXCEEDED_BIN_SLIPPAGE_TOLERANCE]: `Exceeded bin slippage tolerance`,
82
+ [PICON_DLMM_ERROR__EXCEEDED_SWAP_SLIPPAGE_TOLERANCE]: `Exceeded swap slippage tolerance`,
83
+ [PICON_DLMM_ERROR__INSUFFICIENT_LIQUIDITY]: `Insufficient liquidity for swap`,
84
+ [PICON_DLMM_ERROR__INVALID_ACTIVE_BIN]: `Invalid active bin`,
85
+ [PICON_DLMM_ERROR__INVALID_BIN_ARRAY]: `Invalid bin array`,
86
+ [PICON_DLMM_ERROR__INVALID_BIN_RANGE]: `Invalid bin range`,
87
+ [PICON_DLMM_ERROR__INVALID_BIN_WEIGHTS]: `Invalid bin weights`,
88
+ [PICON_DLMM_ERROR__INVALID_BPS]: `Invalid bps`,
89
+ [PICON_DLMM_ERROR__INVALID_DYNAMIC_FEE_CONFIG]: `Invalid dynamic fee config`,
90
+ [PICON_DLMM_ERROR__INVALID_PENDING_AUTHORITY]: `Signer is not the pending authority`,
91
+ [PICON_DLMM_ERROR__INVALID_POSITION_OWNER]: `Invalid position token owner`,
92
+ [PICON_DLMM_ERROR__INVALID_PROTOCOL_SHARE]: `Invalid protocol share`,
93
+ [PICON_DLMM_ERROR__LIQUIDITY_ERROR]: `Liquidity error`,
94
+ [PICON_DLMM_ERROR__POSITION_NOT_EMPTY]: `Position is not empty`,
95
+ [PICON_DLMM_ERROR__UNSUPPORTED_BIN_STEP]: `Unsupported bin step`,
96
+ [PICON_DLMM_ERROR__UNSUPPORTED_FEE_RATE]: `Unsupported fee rate`,
97
+ [PICON_DLMM_ERROR__UNSUPPORTED_MINT_EXTENSION]: `Unsupported mint extension`,
98
+ [PICON_DLMM_ERROR__ZERO_SWAP_AMOUNT]: `Swap amount is zero`,
99
+ };
100
+ }
101
+
102
+ export function getPiconDlmmErrorMessage(code: PiconDlmmError): string {
103
+ if (process.env["NODE_ENV"] !== "production") {
104
+ return (piconDlmmErrorMessages as Record<PiconDlmmError, string>)[code];
105
+ }
106
+
107
+ return "Error message not available in production bundles.";
108
+ }
109
+
110
+ export function isPiconDlmmError<TProgramErrorCode extends PiconDlmmError>(
111
+ error: unknown,
112
+ transactionMessage: {
113
+ instructions: Record<number, { programAddress: Address }>;
114
+ },
115
+ code?: TProgramErrorCode,
116
+ ): error is SolanaError<typeof SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM> &
117
+ Readonly<{ context: Readonly<{ code: TProgramErrorCode }> }> {
118
+ return isProgramError<TProgramErrorCode>(
119
+ error,
120
+ transactionMessage,
121
+ PICON_DLMM_PROGRAM_ADDRESS,
122
+ code,
123
+ );
124
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+
9
+ export * from "./accounts";
10
+ export * from "./errors";
11
+ export * from "./instructions";
12
+ export * from "./pdas";
13
+ export * from "./programs";
14
+ export * from "./types";