@picon-finance/dlmm-sdk 1.2.0 → 1.4.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 (221) hide show
  1. package/README.md +115 -16
  2. package/dist/entities/admin_config.d.ts +23 -0
  3. package/dist/entities/admin_config.d.ts.map +1 -0
  4. package/dist/entities/admin_config.js +54 -0
  5. package/dist/entities/bin_array.d.ts +37 -0
  6. package/dist/entities/bin_array.d.ts.map +1 -0
  7. package/dist/entities/bin_array.js +63 -0
  8. package/dist/entities/dlmm_program.d.ts +50 -0
  9. package/dist/entities/dlmm_program.d.ts.map +1 -0
  10. package/dist/entities/dlmm_program.js +73 -0
  11. package/dist/entities/index.d.ts +7 -0
  12. package/dist/entities/index.d.ts.map +1 -0
  13. package/dist/entities/index.js +6 -0
  14. package/dist/entities/pool.d.ts +71 -0
  15. package/dist/entities/pool.d.ts.map +1 -0
  16. package/dist/entities/pool.js +189 -0
  17. package/dist/entities/position.d.ts +55 -0
  18. package/dist/entities/position.d.ts.map +1 -0
  19. package/dist/entities/position.js +277 -0
  20. package/dist/entities/position_pool.d.ts +7 -0
  21. package/dist/entities/position_pool.d.ts.map +1 -0
  22. package/dist/entities/position_pool.js +30 -0
  23. package/dist/entities/types.d.ts +5 -0
  24. package/dist/entities/types.d.ts.map +1 -0
  25. package/dist/entities/types.js +0 -0
  26. package/dist/events.d.ts +9 -1
  27. package/dist/events.d.ts.map +1 -1
  28. package/dist/events.js +48 -0
  29. package/dist/index.d.ts +2 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +1 -1
  32. package/dist/program_addresses.d.ts.map +1 -1
  33. package/dist/program_addresses.js +0 -5
  34. package/dist/utils/assert.d.ts +9 -0
  35. package/dist/utils/assert.d.ts.map +1 -0
  36. package/dist/utils/assert.js +10 -0
  37. package/dist/utils/bin_location.d.ts +4 -0
  38. package/dist/utils/bin_location.d.ts.map +1 -1
  39. package/dist/utils/bin_location.js +0 -12
  40. package/dist/utils/chunk.d.ts +1 -0
  41. package/dist/utils/chunk.d.ts.map +1 -1
  42. package/dist/utils/chunk.js +4 -0
  43. package/dist/utils/type_guards.d.ts +2 -0
  44. package/dist/utils/type_guards.d.ts.map +1 -1
  45. package/dist/utils/type_guards.js +7 -0
  46. package/package.json +1 -2
  47. package/src/entities/admin_config.ts +122 -0
  48. package/src/entities/bin_array.ts +157 -0
  49. package/src/entities/dlmm_program.ts +210 -0
  50. package/src/entities/index.ts +6 -0
  51. package/src/entities/pool.ts +392 -0
  52. package/src/entities/position.ts +481 -0
  53. package/src/entities/position_pool.ts +68 -0
  54. package/src/entities/types.ts +3 -0
  55. package/src/events.ts +77 -0
  56. package/src/index.ts +2 -1
  57. package/src/program_addresses.ts +0 -6
  58. package/src/utils/assert.ts +25 -0
  59. package/src/utils/bin_location.ts +5 -12
  60. package/src/utils/chunk.ts +9 -0
  61. package/src/utils/type_guards.ts +12 -0
  62. package/dist/actions/accept_admin_authority.d.ts +0 -13
  63. package/dist/actions/accept_admin_authority.d.ts.map +0 -1
  64. package/dist/actions/accept_admin_authority.js +0 -7
  65. package/dist/actions/claim_fee.d.ts +0 -21
  66. package/dist/actions/claim_fee.d.ts.map +0 -1
  67. package/dist/actions/claim_fee.js +0 -40
  68. package/dist/actions/claim_multiple_fees.d.ts +0 -19
  69. package/dist/actions/claim_multiple_fees.d.ts.map +0 -1
  70. package/dist/actions/claim_multiple_fees.js +0 -81
  71. package/dist/actions/claim_protocol_fee.d.ts +0 -18
  72. package/dist/actions/claim_protocol_fee.d.ts.map +0 -1
  73. package/dist/actions/claim_protocol_fee.js +0 -33
  74. package/dist/actions/close_position.d.ts +0 -14
  75. package/dist/actions/close_position.d.ts.map +0 -1
  76. package/dist/actions/close_position.js +0 -14
  77. package/dist/actions/create_admin_config.d.ts +0 -15
  78. package/dist/actions/create_admin_config.d.ts.map +0 -1
  79. package/dist/actions/create_admin_config.js +0 -30
  80. package/dist/actions/create_bin_array.d.ts +0 -16
  81. package/dist/actions/create_bin_array.d.ts.map +0 -1
  82. package/dist/actions/create_bin_array.js +0 -10
  83. package/dist/actions/create_pool.d.ts +0 -21
  84. package/dist/actions/create_pool.d.ts.map +0 -1
  85. package/dist/actions/create_pool.js +0 -22
  86. package/dist/actions/delete_bin_array.d.ts +0 -16
  87. package/dist/actions/delete_bin_array.d.ts.map +0 -1
  88. package/dist/actions/delete_bin_array.js +0 -13
  89. package/dist/actions/deposit_by_weight.d.ts +0 -27
  90. package/dist/actions/deposit_by_weight.d.ts.map +0 -1
  91. package/dist/actions/deposit_by_weight.js +0 -52
  92. package/dist/actions/get_admin_config.d.ts +0 -4
  93. package/dist/actions/get_admin_config.d.ts.map +0 -1
  94. package/dist/actions/get_admin_config.js +0 -7
  95. package/dist/actions/get_bin_arrays_by_indices.d.ts +0 -5
  96. package/dist/actions/get_bin_arrays_by_indices.d.ts.map +0 -1
  97. package/dist/actions/get_bin_arrays_by_indices.js +0 -6
  98. package/dist/actions/get_pool.d.ts +0 -4
  99. package/dist/actions/get_pool.d.ts.map +0 -1
  100. package/dist/actions/get_pool.js +0 -5
  101. package/dist/actions/get_position.d.ts +0 -4
  102. package/dist/actions/get_position.d.ts.map +0 -1
  103. package/dist/actions/get_position.js +0 -5
  104. package/dist/actions/get_position_by_position_mint.d.ts +0 -4
  105. package/dist/actions/get_position_by_position_mint.d.ts.map +0 -1
  106. package/dist/actions/get_position_by_position_mint.js +0 -6
  107. package/dist/actions/get_positions_by_owner.d.ts +0 -5
  108. package/dist/actions/get_positions_by_owner.d.ts.map +0 -1
  109. package/dist/actions/get_positions_by_owner.js +0 -33
  110. package/dist/actions/get_positions_by_position_mints.d.ts +0 -5
  111. package/dist/actions/get_positions_by_position_mints.d.ts.map +0 -1
  112. package/dist/actions/get_positions_by_position_mints.js +0 -9
  113. package/dist/actions/helpers/build_swap_transaction_message.d.ts +0 -22
  114. package/dist/actions/helpers/build_swap_transaction_message.d.ts.map +0 -1
  115. package/dist/actions/helpers/build_swap_transaction_message.js +0 -50
  116. package/dist/actions/helpers/build_transaction_message.d.ts +0 -20
  117. package/dist/actions/helpers/build_transaction_message.d.ts.map +0 -1
  118. package/dist/actions/helpers/build_transaction_message.js +0 -5
  119. package/dist/actions/helpers/index.d.ts +0 -8
  120. package/dist/actions/helpers/index.d.ts.map +0 -1
  121. package/dist/actions/helpers/index.js +0 -7
  122. package/dist/actions/helpers/resolve_active_bin_and_mints.d.ts +0 -12
  123. package/dist/actions/helpers/resolve_active_bin_and_mints.d.ts.map +0 -1
  124. package/dist/actions/helpers/resolve_active_bin_and_mints.js +0 -13
  125. package/dist/actions/helpers/resolve_admin_config_address.d.ts +0 -3
  126. package/dist/actions/helpers/resolve_admin_config_address.d.ts.map +0 -1
  127. package/dist/actions/helpers/resolve_admin_config_address.js +0 -9
  128. package/dist/actions/helpers/resolve_mint_info.d.ts +0 -10
  129. package/dist/actions/helpers/resolve_mint_info.d.ts.map +0 -1
  130. package/dist/actions/helpers/resolve_mint_info.js +0 -20
  131. package/dist/actions/helpers/resolve_position_range.d.ts +0 -12
  132. package/dist/actions/helpers/resolve_position_range.d.ts.map +0 -1
  133. package/dist/actions/helpers/resolve_position_range.js +0 -12
  134. package/dist/actions/helpers/resolve_token_mints_and_programs.d.ts +0 -15
  135. package/dist/actions/helpers/resolve_token_mints_and_programs.d.ts.map +0 -1
  136. package/dist/actions/helpers/resolve_token_mints_and_programs.js +0 -29
  137. package/dist/actions/index.d.ts +0 -31
  138. package/dist/actions/index.d.ts.map +0 -1
  139. package/dist/actions/index.js +0 -28
  140. package/dist/actions/is_admin_config_active.d.ts +0 -4
  141. package/dist/actions/is_admin_config_active.d.ts.map +0 -1
  142. package/dist/actions/is_admin_config_active.js +0 -7
  143. package/dist/actions/on_event.d.ts +0 -11
  144. package/dist/actions/on_event.d.ts.map +0 -1
  145. package/dist/actions/on_event.js +0 -50
  146. package/dist/actions/open_position.d.ts +0 -17
  147. package/dist/actions/open_position.d.ts.map +0 -1
  148. package/dist/actions/open_position.js +0 -31
  149. package/dist/actions/quote.d.ts +0 -13
  150. package/dist/actions/quote.d.ts.map +0 -1
  151. package/dist/actions/quote.js +0 -43
  152. package/dist/actions/set_metadata_update_authority.d.ts +0 -14
  153. package/dist/actions/set_metadata_update_authority.d.ts.map +0 -1
  154. package/dist/actions/set_metadata_update_authority.js +0 -7
  155. package/dist/actions/set_pool_dynamic_fee_config.d.ts +0 -16
  156. package/dist/actions/set_pool_dynamic_fee_config.d.ts.map +0 -1
  157. package/dist/actions/set_pool_dynamic_fee_config.js +0 -7
  158. package/dist/actions/set_pool_protocol_share.d.ts +0 -15
  159. package/dist/actions/set_pool_protocol_share.d.ts.map +0 -1
  160. package/dist/actions/set_pool_protocol_share.js +0 -7
  161. package/dist/actions/swap.d.ts +0 -22
  162. package/dist/actions/swap.d.ts.map +0 -1
  163. package/dist/actions/swap.js +0 -19
  164. package/dist/actions/sync_pool.d.ts +0 -15
  165. package/dist/actions/sync_pool.d.ts.map +0 -1
  166. package/dist/actions/sync_pool.js +0 -26
  167. package/dist/actions/transfer_admin_authority.d.ts +0 -14
  168. package/dist/actions/transfer_admin_authority.d.ts.map +0 -1
  169. package/dist/actions/transfer_admin_authority.js +0 -7
  170. package/dist/actions/withdraw.d.ts +0 -22
  171. package/dist/actions/withdraw.d.ts.map +0 -1
  172. package/dist/actions/withdraw.js +0 -41
  173. package/dist/utils/admin_config.d.ts +0 -3
  174. package/dist/utils/admin_config.d.ts.map +0 -1
  175. package/dist/utils/admin_config.js +0 -4
  176. package/dist/utils/bin_array.d.ts +0 -8
  177. package/dist/utils/bin_array.d.ts.map +0 -1
  178. package/dist/utils/bin_array.js +0 -29
  179. package/dist/utils/compute_budget.d.ts +0 -11
  180. package/dist/utils/compute_budget.d.ts.map +0 -1
  181. package/dist/utils/compute_budget.js +0 -22
  182. package/src/actions/accept_admin_authority.ts +0 -17
  183. package/src/actions/claim_fee.ts +0 -84
  184. package/src/actions/claim_multiple_fees.ts +0 -123
  185. package/src/actions/claim_protocol_fee.ts +0 -68
  186. package/src/actions/close_position.ts +0 -21
  187. package/src/actions/create_admin_config.ts +0 -51
  188. package/src/actions/create_bin_array.ts +0 -30
  189. package/src/actions/create_pool.ts +0 -49
  190. package/src/actions/delete_bin_array.ts +0 -33
  191. package/src/actions/deposit_by_weight.ts +0 -107
  192. package/src/actions/get_admin_config.ts +0 -13
  193. package/src/actions/get_bin_arrays_by_indices.ts +0 -15
  194. package/src/actions/get_pool.ts +0 -8
  195. package/src/actions/get_position.ts +0 -8
  196. package/src/actions/get_position_by_position_mint.ts +0 -14
  197. package/src/actions/get_positions_by_owner.ts +0 -48
  198. package/src/actions/get_positions_by_position_mints.ts +0 -21
  199. package/src/actions/helpers/build_swap_transaction_message.ts +0 -86
  200. package/src/actions/helpers/build_transaction_message.ts +0 -45
  201. package/src/actions/helpers/index.ts +0 -7
  202. package/src/actions/helpers/resolve_active_bin_and_mints.ts +0 -21
  203. package/src/actions/helpers/resolve_admin_config_address.ts +0 -11
  204. package/src/actions/helpers/resolve_mint_info.ts +0 -36
  205. package/src/actions/helpers/resolve_position_range.ts +0 -21
  206. package/src/actions/helpers/resolve_token_mints_and_programs.ts +0 -56
  207. package/src/actions/index.ts +0 -34
  208. package/src/actions/is_admin_config_active.ts +0 -14
  209. package/src/actions/on_event.ts +0 -78
  210. package/src/actions/open_position.ts +0 -66
  211. package/src/actions/quote.ts +0 -70
  212. package/src/actions/set_metadata_update_authority.ts +0 -17
  213. package/src/actions/set_pool_dynamic_fee_config.ts +0 -17
  214. package/src/actions/set_pool_protocol_share.ts +0 -17
  215. package/src/actions/swap.ts +0 -56
  216. package/src/actions/sync_pool.ts +0 -35
  217. package/src/actions/transfer_admin_authority.ts +0 -17
  218. package/src/actions/withdraw.ts +0 -87
  219. package/src/utils/admin_config.ts +0 -6
  220. package/src/utils/bin_array.ts +0 -45
  221. package/src/utils/compute_budget.ts +0 -58
@@ -1,5 +1,10 @@
1
1
  import { BINS_PER_BIN_ARRAY } from "./constants";
2
2
 
3
+ export type BinIdRange = {
4
+ lowerBinId: number,
5
+ upperBinId: number,
6
+ };
7
+
3
8
  export function getBinArrayIndex(binId: number): number {
4
9
  return Math.floor(binId / BINS_PER_BIN_ARRAY);
5
10
  }
@@ -22,10 +27,6 @@ export function getBinArrayIndexSequence(
22
27
  );
23
28
  }
24
29
 
25
- // A position spans at most MAX_BIN_ARRAYS_PER_POSITION (2) bin arrays — the lower and
26
- // (only if distinct) upper one covering its range. Shared by every position-scoped
27
- // instruction that needs to enumerate exactly those arrays (open_position's bin-array
28
- // bootstrap, withdraw/claim_fee's account derivation).
29
30
  export function getPositionBinArrayIndices(
30
31
  lowerBinId: number,
31
32
  upperBinId: number,
@@ -37,9 +38,6 @@ export function getPositionBinArrayIndices(
37
38
  : { lowerBinArrayIndex, upperBinArrayIndex };
38
39
  }
39
40
 
40
- // One bin array of margin is kept on the opposite side of travel: if the live active bin
41
- // drifts one array against the expected direction between quote time and execution (e.g. a
42
- // competing swap lands first), it's still covered by this range instead of reverting.
43
41
  export function generateBinArrayIndicesForSwap(
44
42
  activeBinId: number,
45
43
  xToY: boolean,
@@ -52,11 +50,6 @@ export function generateBinArrayIndicesForSwap(
52
50
  return getBinArrayIndexSequence(lowerBinArrayIndex, upperBinArrayIndex);
53
51
  }
54
52
 
55
- // Spans from the live `activeBinId` to the caller's exact `desiredBinId` target, plus one
56
- // bin array of margin beyond the active end (the side subject to drift — `desiredBinId` is
57
- // a fixed target, but the live active bin could move further away from it before this tx
58
- // lands). Capped at `maxBinArrays`, trimming from the `desiredBinId` end so the active+margin
59
- // anchor stays intact — a sync toward a distant target simply converges partially in that case.
60
53
  export function generateBinArrayIndicesForSync(
61
54
  activeBinId: number,
62
55
  desiredBinId: number,
@@ -5,3 +5,12 @@ export function chunk<T>(items: T[], size: number): T[][] {
5
5
  }
6
6
  return chunks;
7
7
  }
8
+
9
+ export async function fetchInChunks<T, R>(
10
+ items: T[],
11
+ size: number,
12
+ fetcher: (chunkItems: T[]) => Promise<R[]>,
13
+ ): Promise<R[]> {
14
+ const chunks = await Promise.all(chunk(items, size).map(fetcher));
15
+ return chunks.flat();
16
+ }
@@ -1,3 +1,15 @@
1
+ import { type Account } from "@solana/kit";
2
+
1
3
  export function isUndefined<T>(value: T | undefined): value is undefined {
2
4
  return value === undefined;
3
5
  }
6
+
7
+ export function isAccount<TData extends object>(value: any): value is Account<TData> {
8
+ return (
9
+ typeof value === "object" &&
10
+ value !== null &&
11
+ "address" in value &&
12
+ "data" in value &&
13
+ "executable" in value
14
+ );
15
+ }
@@ -1,13 +0,0 @@
1
- import type { Address, TransactionSigner } from "@solana/kit";
2
- import { type TransactionMessageOptions, type Rpc } from "./helpers";
3
- export declare function acceptAdminAuthority(rpc: Rpc, { pendingAuthority }: {
4
- pendingAuthority: TransactionSigner;
5
- }, programAddress?: Address, options?: TransactionMessageOptions): Promise<Omit<Omit<Omit<import("@solana/transaction-messages").ExcludeTransactionMessageWithinSizeLimit<Omit<Readonly<{
6
- instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
7
- version: 0;
8
- }>, "instructions"> & import("@solana/transaction-messages").TransactionMessageWithinSizeLimit & {
9
- instructions: readonly [];
10
- }>, "instructions"> & {
11
- readonly instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
12
- }, "feePayer"> & import("@solana/signers").TransactionMessageWithFeePayerSigner<string, TransactionSigner<string>>, "lifetimeConstraint"> & import("@solana/transaction-messages").TransactionMessageWithBlockhashLifetime>;
13
- //# sourceMappingURL=accept_admin_authority.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"accept_admin_authority.d.ts","sourceRoot":"","sources":["../../src/actions/accept_admin_authority.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EAAsD,KAAK,yBAAyB,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AAEzH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,GAAG,EACR,EAAE,gBAAgB,EAAE,EAAE;IAAE,gBAAgB,EAAE,iBAAiB,CAAA;CAAE,EAC7D,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B;;;;;;;4NAQxC"}
@@ -1,7 +0,0 @@
1
- import { PICON_DLMM_PROGRAM_ADDRESS, getAcceptAdminAuthorityInstructionAsync } from "../generated";
2
- import { buildTransactionMessage, resolveAdminConfigAddress } from "./helpers";
3
- export async function acceptAdminAuthority(rpc, { pendingAuthority }, programAddress = PICON_DLMM_PROGRAM_ADDRESS, options = {}) {
4
- const adminConfig = await resolveAdminConfigAddress(programAddress);
5
- const instruction = await getAcceptAdminAuthorityInstructionAsync({ pendingAuthority, adminConfig }, { programAddress });
6
- return await buildTransactionMessage(rpc, { feePayer: pendingAuthority, instructions: [instruction] }, options);
7
- }
@@ -1,21 +0,0 @@
1
- import type { Address, TransactionSigner } from "@solana/kit";
2
- import { type TransactionMessageOptions, type Rpc } from "./helpers";
3
- export declare function claimFee(rpc: Rpc, { owner, positionMint, lowerBinId, upperBinId, pool, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, }: {
4
- owner: TransactionSigner;
5
- positionMint: Address;
6
- lowerBinId?: number;
7
- upperBinId?: number;
8
- pool?: Address;
9
- tokenMintX?: Address;
10
- tokenMintY?: Address;
11
- tokenProgramX?: Address;
12
- tokenProgramY?: Address;
13
- }, programAddress?: Address, options?: TransactionMessageOptions): Promise<Omit<Omit<Omit<import("@solana/transaction-messages").ExcludeTransactionMessageWithinSizeLimit<Omit<Readonly<{
14
- instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
15
- version: 0;
16
- }>, "instructions"> & import("@solana/transaction-messages").TransactionMessageWithinSizeLimit & {
17
- instructions: readonly [];
18
- }>, "instructions"> & {
19
- readonly instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
20
- }, "feePayer"> & import("@solana/signers").TransactionMessageWithFeePayerSigner<string, TransactionSigner<string>>, "lifetimeConstraint"> & import("@solana/transaction-messages").TransactionMessageWithBlockhashLifetime>;
21
- //# sourceMappingURL=claim_fee.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"claim_fee.d.ts","sourceRoot":"","sources":["../../src/actions/claim_fee.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAI9D,OAAO,EAIL,KAAK,yBAAyB,EAC9B,KAAK,GAAG,EACT,MAAM,WAAW,CAAC;AAEnB,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,GAAG,EACR,EACE,KAAK,EACL,YAAY,EACZ,UAAU,EACV,UAAU,EACV,IAAI,EACJ,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,GACd,EAAE;IACD,KAAK,EAAE,iBAAiB,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,EACD,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B;;;;;;;4NA+CxC"}
@@ -1,40 +0,0 @@
1
- import { PICON_DLMM_PROGRAM_ADDRESS, findPositionPda, getClaimFeeInstruction } from "../generated";
2
- import { findPositionBinArrayAddresses } from "../utils/bin_array";
3
- import { findPoolTokenVaults, findPositionTokenAccount, processAssociatedTokenAccountPair } from "../utils/ata";
4
- import { resolvePositionRange, resolveTokenMintsAndPrograms, buildTransactionMessage, } from "./helpers";
5
- export async function claimFee(rpc, { owner, positionMint, lowerBinId, upperBinId, pool, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, }, programAddress = PICON_DLMM_PROGRAM_ADDRESS, options = {}) {
6
- ({ pool, lowerBinId, upperBinId } = await resolvePositionRange(rpc, positionMint, { pool, lowerBinId, upperBinId }, programAddress, options));
7
- const tokenMintsAndPrograms = await resolveTokenMintsAndPrograms(rpc, {
8
- pool,
9
- tokenMintX,
10
- tokenMintY,
11
- tokenProgramX,
12
- tokenProgramY,
13
- }, options);
14
- const [position] = await findPositionPda({ positionMint }, { programAddress });
15
- const positionTokenAccount = await findPositionTokenAccount({ owner: owner.address, positionMint });
16
- const { tokenVaultX, tokenVaultY } = await findPoolTokenVaults({ pool, ...tokenMintsAndPrograms });
17
- const { ataX: tokenOwnerAccountX, ataY: tokenOwnerAccountY, preInstructions: preInstructionsAta, postInstructions: postInstructionsAta, } = await processAssociatedTokenAccountPair({ owner, ...tokenMintsAndPrograms });
18
- const { lowerBinArray, upperBinArray } = await findPositionBinArrayAddresses(pool, lowerBinId, upperBinId, programAddress);
19
- const claimFeeIx = getClaimFeeInstruction({
20
- owner,
21
- pool,
22
- position,
23
- positionTokenAccount,
24
- ...tokenMintsAndPrograms,
25
- tokenOwnerAccountX,
26
- tokenOwnerAccountY,
27
- tokenVaultX,
28
- tokenVaultY,
29
- lowerBinArray,
30
- upperBinArray,
31
- lowerBinId,
32
- upperBinId,
33
- }, { programAddress });
34
- const instructions = [
35
- ...preInstructionsAta,
36
- claimFeeIx,
37
- ...postInstructionsAta,
38
- ];
39
- return await buildTransactionMessage(rpc, { feePayer: owner, instructions }, options);
40
- }
@@ -1,19 +0,0 @@
1
- import type { Address, TransactionSigner } from "@solana/kit";
2
- import { type TransactionMessageOptions, type Rpc } from "./helpers";
3
- export declare function claimMultipleFees(rpc: Rpc, { owner, positionMints, pool, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, }: {
4
- owner: TransactionSigner;
5
- positionMints: Address[];
6
- pool?: Address;
7
- tokenMintX?: Address;
8
- tokenMintY?: Address;
9
- tokenProgramX?: Address;
10
- tokenProgramY?: Address;
11
- }, programAddress?: Address, options?: TransactionMessageOptions): Promise<(() => Promise<Omit<Omit<Omit<import("@solana/transaction-messages").ExcludeTransactionMessageWithinSizeLimit<Omit<Readonly<{
12
- instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
13
- version: 0;
14
- }>, "instructions"> & import("@solana/transaction-messages").TransactionMessageWithinSizeLimit & {
15
- instructions: readonly [];
16
- }>, "instructions"> & {
17
- readonly instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
18
- }, "feePayer"> & import("@solana/signers").TransactionMessageWithFeePayerSigner<string, TransactionSigner<string>>, "lifetimeConstraint"> & import("@solana/transaction-messages").TransactionMessageWithBlockhashLifetime>)[]>;
19
- //# sourceMappingURL=claim_multiple_fees.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"claim_multiple_fees.d.ts","sourceRoot":"","sources":["../../src/actions/claim_multiple_fees.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAO9D,OAAO,EAGL,KAAK,yBAAyB,EAC9B,KAAK,GAAG,EACT,MAAM,WAAW,CAAC;AAWnB,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,GAAG,EACR,EACE,KAAK,EACL,aAAa,EACb,IAAI,EACJ,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,GACd,EAAE;IACD,KAAK,EAAE,iBAAiB,CAAC;IACzB,aAAa,EAAE,OAAO,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,EACD,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B;;;;;;;gOA+ExC"}
@@ -1,81 +0,0 @@
1
- import { PICON_DLMM_PROGRAM_ADDRESS, getClaimFeeInstruction } from "../generated";
2
- import { findPositionTokenAccount, processAssociatedTokenAccountPair, findPoolTokenVaults } from "../utils/ata";
3
- import { findPositionBinArrayAddresses } from "../utils/bin_array";
4
- import { isUndefined } from "../utils/type_guards";
5
- import { MAX_POSITIONS_PER_CLAIM } from "../utils/constants";
6
- import { getPositionsByPositionMints } from "./get_positions_by_position_mints";
7
- import { resolveTokenMintsAndPrograms, buildTransactionMessage, } from "./helpers";
8
- // No on-chain batch claim_fee — this chunks positions into multiple transactions bounded
9
- // by MAX_POSITIONS_PER_CLAIM, deduplicating the owner's ATAs and any shared bin arrays
10
- // within each chunk. All positions must belong to the same pool, since a single transaction
11
- // can only touch one pool's vaults.
12
- //
13
- // Returns one builder per chunk (not pre-built messages): only the first tx creates the
14
- // owner's ATAs (and only the last unwraps WSOL), so the chunks aren't independent — the
15
- // caller must call each builder and submit+confirm its transaction in order before calling
16
- // the next, since a later chunk's claim_fee assumes the first chunk's ATA already landed.
17
- export async function claimMultipleFees(rpc, { owner, positionMints, pool, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, }, programAddress = PICON_DLMM_PROGRAM_ADDRESS, options = {}) {
18
- if (positionMints.length === 0) {
19
- return [];
20
- }
21
- const positions = await getPositionsByPositionMints(rpc, positionMints, programAddress, options);
22
- const actualPool = positions[0].data.pool;
23
- if (positions.some(({ data }) => data.pool !== actualPool)) {
24
- throw new Error("claimMultipleFees: all positions must belong to the same pool");
25
- }
26
- if (!isUndefined(pool) && pool !== actualPool) {
27
- throw new Error("claimMultipleFees: provided pool does not match the positions' pool");
28
- }
29
- pool = actualPool;
30
- const tokenMintsAndPrograms = await resolveTokenMintsAndPrograms(rpc, {
31
- pool,
32
- tokenMintX,
33
- tokenMintY,
34
- tokenProgramX,
35
- tokenProgramY,
36
- }, options);
37
- // ATAs are persistent accounts: only the first tx needs to create them (and wrap WSOL,
38
- // though claim's ATAs are receive-only so there's nothing to transfer in), and only the
39
- // last needs to unwrap WSOL back to native SOL, once every chunk has landed in it.
40
- const { ataX: tokenOwnerAccountX, ataY: tokenOwnerAccountY, preInstructions: preInstructionsAta, postInstructions: postInstructionsAta, } = await processAssociatedTokenAccountPair({ owner, ...tokenMintsAndPrograms });
41
- const { tokenVaultX, tokenVaultY } = await findPoolTokenVaults({ pool, ...tokenMintsAndPrograms });
42
- const chunks = [];
43
- for (let i = 0; i < positions.length; i += MAX_POSITIONS_PER_CLAIM) {
44
- chunks.push(positions.slice(i, i + MAX_POSITIONS_PER_CLAIM));
45
- }
46
- // Returns one builder per chunk instead of pre-built messages: the caller submits and
47
- // confirms chunks strictly in order (see the contract above), and confirmation takes real
48
- // wall-clock time, so a blockhash fetched once up front for every chunk can outlive its
49
- // ~60-90s validity window before later chunks are ever submitted. Each builder fetches its
50
- // own blockhash (via buildTransactionMessage's default) at the moment it's actually called,
51
- // right before that chunk is submitted.
52
- return chunks.map((chunkPositions, i) => async () => {
53
- // One claim_fee per position in this chunk — deliberately excludes the owner's ATA
54
- // setup/teardown, which is account-level, not chunk-level (handled above/below instead).
55
- const coreInstructions = await Promise.all(chunkPositions.map(async ({ address: position, data }) => {
56
- const positionTokenAccount = await findPositionTokenAccount({ owner: owner.address, positionMint: data.positionMint });
57
- const { lowerBinArray, upperBinArray } = await findPositionBinArrayAddresses(pool, data.lowerBinId, data.upperBinId, programAddress);
58
- return getClaimFeeInstruction({
59
- owner,
60
- pool,
61
- position,
62
- positionTokenAccount,
63
- ...tokenMintsAndPrograms,
64
- tokenOwnerAccountX,
65
- tokenOwnerAccountY,
66
- tokenVaultX,
67
- tokenVaultY,
68
- lowerBinArray,
69
- upperBinArray,
70
- lowerBinId: data.lowerBinId,
71
- upperBinId: data.upperBinId,
72
- }, { programAddress });
73
- }));
74
- const instructions = [
75
- ...(i === 0 ? preInstructionsAta : []),
76
- ...coreInstructions,
77
- ...(i === chunks.length - 1 ? postInstructionsAta : []),
78
- ];
79
- return await buildTransactionMessage(rpc, { feePayer: owner, instructions }, options);
80
- });
81
- }
@@ -1,18 +0,0 @@
1
- import type { Address, TransactionSigner } from "@solana/kit";
2
- import { type TransactionMessageOptions, type Rpc } from "./helpers";
3
- export declare function claimProtocolFee(rpc: Rpc, { authority, pool, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, }: {
4
- authority: TransactionSigner;
5
- pool: Address;
6
- tokenMintX?: Address;
7
- tokenMintY?: Address;
8
- tokenProgramX?: Address;
9
- tokenProgramY?: Address;
10
- }, programAddress?: Address, options?: TransactionMessageOptions): Promise<Omit<Omit<Omit<import("@solana/transaction-messages").ExcludeTransactionMessageWithinSizeLimit<Omit<Readonly<{
11
- instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
12
- version: 0;
13
- }>, "instructions"> & import("@solana/transaction-messages").TransactionMessageWithinSizeLimit & {
14
- instructions: readonly [];
15
- }>, "instructions"> & {
16
- readonly instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
17
- }, "feePayer"> & import("@solana/signers").TransactionMessageWithFeePayerSigner<string, TransactionSigner<string>>, "lifetimeConstraint"> & import("@solana/transaction-messages").TransactionMessageWithBlockhashLifetime>;
18
- //# sourceMappingURL=claim_protocol_fee.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"claim_protocol_fee.d.ts","sourceRoot":"","sources":["../../src/actions/claim_protocol_fee.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG9D,OAAO,EAIL,KAAK,yBAAyB,EAC9B,KAAK,GAAG,EACT,MAAM,WAAW,CAAC;AAEnB,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,GAAG,EACR,EACE,SAAS,EACT,IAAI,EACJ,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,GACd,EAAE;IACD,SAAS,EAAE,iBAAiB,CAAC;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,EACD,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B;;;;;;;4NAsCxC"}
@@ -1,33 +0,0 @@
1
- import { PICON_DLMM_PROGRAM_ADDRESS, getClaimProtocolFeeInstructionAsync } from "../generated";
2
- import { findPoolTokenVaults, processAssociatedTokenAccountPair } from "../utils/ata";
3
- import { resolveTokenMintsAndPrograms, resolveAdminConfigAddress, buildTransactionMessage, } from "./helpers";
4
- export async function claimProtocolFee(rpc, { authority, pool, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, }, programAddress = PICON_DLMM_PROGRAM_ADDRESS, options = {}) {
5
- const [tokenMintsAndPrograms, adminConfig] = await Promise.all([
6
- resolveTokenMintsAndPrograms(rpc, {
7
- pool,
8
- tokenMintX,
9
- tokenMintY,
10
- tokenProgramX,
11
- tokenProgramY,
12
- }, options),
13
- resolveAdminConfigAddress(programAddress),
14
- ]);
15
- const { tokenVaultX, tokenVaultY } = await findPoolTokenVaults({ pool, ...tokenMintsAndPrograms });
16
- const { ataX: tokenAdminAccountX, ataY: tokenAdminAccountY, preInstructions: preInstructionsAta, postInstructions: postInstructionsAta, } = await processAssociatedTokenAccountPair({ owner: authority, ...tokenMintsAndPrograms });
17
- const claimProtocolFeeIx = await getClaimProtocolFeeInstructionAsync({
18
- authority,
19
- pool,
20
- adminConfig,
21
- ...tokenMintsAndPrograms,
22
- tokenVaultX,
23
- tokenVaultY,
24
- tokenAdminAccountX,
25
- tokenAdminAccountY,
26
- }, { programAddress });
27
- const instructions = [
28
- ...preInstructionsAta,
29
- claimProtocolFeeIx,
30
- ...postInstructionsAta,
31
- ];
32
- return await buildTransactionMessage(rpc, { feePayer: authority, instructions }, options);
33
- }
@@ -1,14 +0,0 @@
1
- import type { Address, TransactionSigner } from "@solana/kit";
2
- import { type TransactionMessageOptions, type Rpc } from "./helpers";
3
- export declare function closePosition(rpc: Rpc, { owner, positionMint }: {
4
- owner: TransactionSigner;
5
- positionMint: Address;
6
- }, programAddress?: Address, options?: TransactionMessageOptions): Promise<Omit<Omit<Omit<import("@solana/transaction-messages").ExcludeTransactionMessageWithinSizeLimit<Omit<Readonly<{
7
- instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
8
- version: 0;
9
- }>, "instructions"> & import("@solana/transaction-messages").TransactionMessageWithinSizeLimit & {
10
- instructions: readonly [];
11
- }>, "instructions"> & {
12
- readonly instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
13
- }, "feePayer"> & import("@solana/signers").TransactionMessageWithFeePayerSigner<string, TransactionSigner<string>>, "lifetimeConstraint"> & import("@solana/transaction-messages").TransactionMessageWithBlockhashLifetime>;
14
- //# sourceMappingURL=close_position.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"close_position.d.ts","sourceRoot":"","sources":["../../src/actions/close_position.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG9D,OAAO,EAA2B,KAAK,yBAAyB,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AAE9F,wBAAsB,aAAa,CACjC,GAAG,EAAE,GAAG,EACR,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE;IAAE,KAAK,EAAE,iBAAiB,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,EAC5E,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B;;;;;;;4NAWxC"}
@@ -1,14 +0,0 @@
1
- import { PICON_DLMM_PROGRAM_ADDRESS, findPositionPda, getClosePositionInstructionAsync } from "../generated";
2
- import { findPositionTokenAccount } from "../utils/ata";
3
- import { buildTransactionMessage } from "./helpers";
4
- export async function closePosition(rpc, { owner, positionMint }, programAddress = PICON_DLMM_PROGRAM_ADDRESS, options = {}) {
5
- const [position] = await findPositionPda({ positionMint }, { programAddress });
6
- const positionTokenAccount = await findPositionTokenAccount({ owner: owner.address, positionMint });
7
- const closePositionIx = await getClosePositionInstructionAsync({
8
- owner,
9
- positionMint,
10
- position,
11
- positionTokenAccount,
12
- }, { programAddress });
13
- return await buildTransactionMessage(rpc, { feePayer: owner, instructions: [closePositionIx] }, options);
14
- }
@@ -1,15 +0,0 @@
1
- import { type Address, type TransactionSigner } from "@solana/kit";
2
- import { type TransactionMessageOptions, type Rpc } from "./helpers";
3
- export declare function createAdminConfig(rpc: Rpc, { deployer, authority, metadataUpdateAuthority, }: {
4
- deployer: TransactionSigner;
5
- authority: Address;
6
- metadataUpdateAuthority?: Address;
7
- }, programAddress?: Address, options?: TransactionMessageOptions): Promise<Omit<Omit<Omit<import("@solana/transaction-messages").ExcludeTransactionMessageWithinSizeLimit<Omit<Readonly<{
8
- instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
9
- version: 0;
10
- }>, "instructions"> & import("@solana/transaction-messages").TransactionMessageWithinSizeLimit & {
11
- instructions: readonly [];
12
- }>, "instructions"> & {
13
- readonly instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
14
- }, "feePayer"> & import("@solana/signers").TransactionMessageWithFeePayerSigner<string, TransactionSigner<string>>, "lifetimeConstraint"> & import("@solana/transaction-messages").TransactionMessageWithBlockhashLifetime>;
15
- //# sourceMappingURL=create_admin_config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create_admin_config.d.ts","sourceRoot":"","sources":["../../src/actions/create_admin_config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,iBAAiB,EAGvB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAsD,KAAK,yBAAyB,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AAYzH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,GAAG,EACR,EACE,QAAQ,EACR,SAAS,EACT,uBAAuB,GACxB,EAAE;IACD,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,EACD,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B;;;;;;;4NAmBxC"}
@@ -1,30 +0,0 @@
1
- import { getAddressEncoder, getProgramDerivedAddress, } from "@solana/kit";
2
- import { PICON_DLMM_PROGRAM_ADDRESS, getCreateAdminConfigInstructionAsync } from "../generated";
3
- import { buildTransactionMessage, resolveAdminConfigAddress } from "./helpers";
4
- const LOADER_V3_PROGRAM_ADDRESS = "BPFLoaderUpgradeab1e11111111111111111111111";
5
- async function findProgramDataAddress(programAddress) {
6
- const [programData] = await getProgramDerivedAddress({
7
- programAddress: LOADER_V3_PROGRAM_ADDRESS,
8
- seeds: [getAddressEncoder().encode(programAddress)],
9
- });
10
- return programData;
11
- }
12
- export async function createAdminConfig(rpc, { deployer, authority, metadataUpdateAuthority, }, programAddress = PICON_DLMM_PROGRAM_ADDRESS, options = {}) {
13
- // The generated builder's default account resolution for `adminConfig`/`program` doesn't
14
- // honor this call's `programAddress` argument (always resolves against the mainnet
15
- // PICON_DLMM_PROGRAM_ADDRESS baked in at codegen time) — both are derived and passed
16
- // explicitly here instead.
17
- const [adminConfig, programData] = await Promise.all([
18
- resolveAdminConfigAddress(programAddress),
19
- findProgramDataAddress(programAddress),
20
- ]);
21
- const createAdminConfigIx = await getCreateAdminConfigInstructionAsync({
22
- deployer,
23
- authority,
24
- metadataUpdateAuthority: metadataUpdateAuthority ?? null,
25
- adminConfig,
26
- program: programAddress,
27
- programData,
28
- }, { programAddress });
29
- return await buildTransactionMessage(rpc, { feePayer: deployer, instructions: [createAdminConfigIx] }, options);
30
- }
@@ -1,16 +0,0 @@
1
- import type { Address, TransactionSigner } from "@solana/kit";
2
- import { type TransactionMessageOptions, type Rpc } from "./helpers";
3
- export declare function createBinArray(rpc: Rpc, { payer, pool, index, idempotent, }: {
4
- payer: TransactionSigner;
5
- pool: Address;
6
- index: number;
7
- idempotent?: boolean;
8
- }, programAddress?: Address, options?: TransactionMessageOptions): Promise<Omit<Omit<Omit<import("@solana/transaction-messages").ExcludeTransactionMessageWithinSizeLimit<Omit<Readonly<{
9
- instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
10
- version: 0;
11
- }>, "instructions"> & import("@solana/transaction-messages").TransactionMessageWithinSizeLimit & {
12
- instructions: readonly [];
13
- }>, "instructions"> & {
14
- readonly instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
15
- }, "feePayer"> & import("@solana/signers").TransactionMessageWithFeePayerSigner<string, TransactionSigner<string>>, "lifetimeConstraint"> & import("@solana/transaction-messages").TransactionMessageWithBlockhashLifetime>;
16
- //# sourceMappingURL=create_bin_array.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create_bin_array.d.ts","sourceRoot":"","sources":["../../src/actions/create_bin_array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EAA2B,KAAK,yBAAyB,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AAK9F,wBAAsB,cAAc,CAClC,GAAG,EAAE,GAAG,EACR,EACE,KAAK,EACL,IAAI,EACJ,KAAK,EACL,UAAiB,GAClB,EAAE;IACD,KAAK,EAAE,iBAAiB,CAAC;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,EACD,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B;;;;;;;4NAQxC"}
@@ -1,10 +0,0 @@
1
- import { PICON_DLMM_PROGRAM_ADDRESS, findBinArrayPda, getCreateBinArrayInstructionAsync } from "../generated";
2
- import { buildTransactionMessage } from "./helpers";
3
- // Standalone escape hatch for manually recreating a bin array — e.g. restoring one an
4
- // admin deleted while a position still had unclaimed fee or an untouched share in it.
5
- // Idempotent by default: harmless no-op if the array is already alive.
6
- export async function createBinArray(rpc, { payer, pool, index, idempotent = true, }, programAddress = PICON_DLMM_PROGRAM_ADDRESS, options = {}) {
7
- const [binArray] = await findBinArrayPda({ pool, index }, { programAddress });
8
- const instruction = await getCreateBinArrayInstructionAsync({ payer, pool, index, idempotent, binArray }, { programAddress });
9
- return await buildTransactionMessage(rpc, { feePayer: payer, instructions: [instruction] }, options);
10
- }
@@ -1,21 +0,0 @@
1
- import type { Address, TransactionSigner } from "@solana/kit";
2
- import { type TransactionMessageOptions, type Rpc } from "./helpers";
3
- export declare function createPool(rpc: Rpc, { authority, binStep, feeRate, protocolShare, activeBinId, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, }: {
4
- authority: TransactionSigner;
5
- binStep: number;
6
- feeRate: number;
7
- protocolShare: number;
8
- activeBinId: number;
9
- tokenMintX: Address;
10
- tokenMintY: Address;
11
- tokenProgramX: Address;
12
- tokenProgramY: Address;
13
- }, programAddress?: Address, options?: TransactionMessageOptions): Promise<Omit<Omit<Omit<import("@solana/transaction-messages").ExcludeTransactionMessageWithinSizeLimit<Omit<Readonly<{
14
- instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
15
- version: 0;
16
- }>, "instructions"> & import("@solana/transaction-messages").TransactionMessageWithinSizeLimit & {
17
- instructions: readonly [];
18
- }>, "instructions"> & {
19
- readonly instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
20
- }, "feePayer"> & import("@solana/signers").TransactionMessageWithFeePayerSigner<string, TransactionSigner<string>>, "lifetimeConstraint"> & import("@solana/transaction-messages").TransactionMessageWithBlockhashLifetime>;
21
- //# sourceMappingURL=create_pool.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create_pool.d.ts","sourceRoot":"","sources":["../../src/actions/create_pool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EAAsD,KAAK,yBAAyB,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AAEzH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,GAAG,EACR,EACE,SAAS,EACT,OAAO,EACP,OAAO,EACP,aAAa,EACb,WAAW,EACX,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,GACd,EAAE;IACD,SAAS,EAAE,iBAAiB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CACxB,EACD,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B;;;;;;;4NAoBxC"}
@@ -1,22 +0,0 @@
1
- import { PICON_DLMM_PROGRAM_ADDRESS, findPoolPda, getCreatePoolInstructionAsync } from "../generated";
2
- import { buildTransactionMessage, resolveAdminConfigAddress } from "./helpers";
3
- export async function createPool(rpc, { authority, binStep, feeRate, protocolShare, activeBinId, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, }, programAddress = PICON_DLMM_PROGRAM_ADDRESS, options = {}) {
4
- const [[pool], adminConfig] = await Promise.all([
5
- findPoolPda({ tokenMintX, tokenMintY, binStep, feeRate }, { programAddress }),
6
- resolveAdminConfigAddress(programAddress),
7
- ]);
8
- const instruction = await getCreatePoolInstructionAsync({
9
- authority,
10
- pool,
11
- adminConfig,
12
- binStep,
13
- feeRate,
14
- protocolShare,
15
- activeBinId,
16
- tokenMintX,
17
- tokenMintY,
18
- tokenProgramX,
19
- tokenProgramY,
20
- }, { programAddress });
21
- return await buildTransactionMessage(rpc, { feePayer: authority, instructions: [instruction] }, options);
22
- }
@@ -1,16 +0,0 @@
1
- import type { Address, TransactionSigner } from "@solana/kit";
2
- import { type TransactionMessageOptions, type Rpc } from "./helpers";
3
- export declare function deleteBinArray(rpc: Rpc, { authority, pool, index, receiver, }: {
4
- authority: TransactionSigner;
5
- pool: Address;
6
- index: number;
7
- receiver?: Address;
8
- }, programAddress?: Address, options?: TransactionMessageOptions): Promise<Omit<Omit<Omit<import("@solana/transaction-messages").ExcludeTransactionMessageWithinSizeLimit<Omit<Readonly<{
9
- instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
10
- version: 0;
11
- }>, "instructions"> & import("@solana/transaction-messages").TransactionMessageWithinSizeLimit & {
12
- instructions: readonly [];
13
- }>, "instructions"> & {
14
- readonly instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
15
- }, "feePayer"> & import("@solana/signers").TransactionMessageWithFeePayerSigner<string, TransactionSigner<string>>, "lifetimeConstraint"> & import("@solana/transaction-messages").TransactionMessageWithBlockhashLifetime>;
16
- //# sourceMappingURL=delete_bin_array.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete_bin_array.d.ts","sourceRoot":"","sources":["../../src/actions/delete_bin_array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG9D,OAAO,EAAsD,KAAK,yBAAyB,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AAEzH,wBAAsB,cAAc,CAClC,GAAG,EAAE,GAAG,EACR,EACE,SAAS,EACT,IAAI,EACJ,KAAK,EACL,QAAQ,GACT,EAAE;IACD,SAAS,EAAE,iBAAiB,CAAC;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,EACD,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B;;;;;;;4NAaxC"}
@@ -1,13 +0,0 @@
1
- import { PICON_DLMM_PROGRAM_ADDRESS, fetchBinArray, findBinArrayPda, getDeleteBinArrayInstructionAsync } from "../generated";
2
- import { isUndefined } from "../utils/type_guards";
3
- import { buildTransactionMessage, resolveAdminConfigAddress } from "./helpers";
4
- export async function deleteBinArray(rpc, { authority, pool, index, receiver, }, programAddress = PICON_DLMM_PROGRAM_ADDRESS, options = {}) {
5
- const [binArray] = await findBinArrayPda({ pool, index }, { programAddress });
6
- if (isUndefined(receiver)) {
7
- const { data } = await fetchBinArray(rpc, binArray, options);
8
- receiver = data.payer;
9
- }
10
- const adminConfig = await resolveAdminConfigAddress(programAddress);
11
- const instruction = await getDeleteBinArrayInstructionAsync({ authority, pool, index, receiver, binArray, adminConfig }, { programAddress });
12
- return await buildTransactionMessage(rpc, { feePayer: authority, instructions: [instruction] }, options);
13
- }
@@ -1,27 +0,0 @@
1
- import type { Address, TransactionSigner } from "@solana/kit";
2
- import { type DistributionMode } from "../generated";
3
- import { type TransactionMessageOptions, type Rpc } from "./helpers";
4
- export declare function depositByWeight(rpc: Rpc, { owner, positionMint, activeBinId, amountX, amountY, lowerBinId, binWeights, maxActiveBinSlippage, distributionMode, pool, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, }: {
5
- owner: TransactionSigner;
6
- positionMint: Address;
7
- activeBinId?: number;
8
- amountX: bigint;
9
- amountY: bigint;
10
- lowerBinId: number;
11
- binWeights: number[];
12
- maxActiveBinSlippage: number;
13
- distributionMode: DistributionMode;
14
- pool?: Address;
15
- tokenMintX?: Address;
16
- tokenMintY?: Address;
17
- tokenProgramX?: Address;
18
- tokenProgramY?: Address;
19
- }, programAddress?: Address, options?: TransactionMessageOptions): Promise<Omit<Omit<Omit<import("@solana/transaction-messages").ExcludeTransactionMessageWithinSizeLimit<Omit<Readonly<{
20
- instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
21
- version: 0;
22
- }>, "instructions"> & import("@solana/transaction-messages").TransactionMessageWithinSizeLimit & {
23
- instructions: readonly [];
24
- }>, "instructions"> & {
25
- readonly instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
26
- }, "feePayer"> & import("@solana/signers").TransactionMessageWithFeePayerSigner<string, TransactionSigner<string>>, "lifetimeConstraint"> & import("@solana/transaction-messages").TransactionMessageWithBlockhashLifetime>;
27
- //# sourceMappingURL=deposit_by_weight.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deposit_by_weight.d.ts","sourceRoot":"","sources":["../../src/actions/deposit_by_weight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAA8B,KAAK,gBAAgB,EAAkD,MAAM,cAAc,CAAC;AAKjI,OAAO,EAIL,KAAK,yBAAyB,EAC9B,KAAK,GAAG,EACT,MAAM,WAAW,CAAC;AAEnB,wBAAsB,eAAe,CACnC,GAAG,EAAE,GAAG,EACR,EACE,KAAK,EACL,YAAY,EACZ,WAAW,EACX,OAAO,EACP,OAAO,EACP,UAAU,EACV,UAAU,EACV,oBAAoB,EACpB,gBAAgB,EAChB,IAAI,EACJ,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,GACd,EAAE;IACD,KAAK,EAAE,iBAAiB,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,EACD,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B;;;;;;;4NA0DxC"}