@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.
- package/README.md +115 -16
- package/dist/entities/admin_config.d.ts +23 -0
- package/dist/entities/admin_config.d.ts.map +1 -0
- package/dist/entities/admin_config.js +54 -0
- package/dist/entities/bin_array.d.ts +37 -0
- package/dist/entities/bin_array.d.ts.map +1 -0
- package/dist/entities/bin_array.js +63 -0
- package/dist/entities/dlmm_program.d.ts +50 -0
- package/dist/entities/dlmm_program.d.ts.map +1 -0
- package/dist/entities/dlmm_program.js +73 -0
- package/dist/entities/index.d.ts +7 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +6 -0
- package/dist/entities/pool.d.ts +71 -0
- package/dist/entities/pool.d.ts.map +1 -0
- package/dist/entities/pool.js +189 -0
- package/dist/entities/position.d.ts +55 -0
- package/dist/entities/position.d.ts.map +1 -0
- package/dist/entities/position.js +277 -0
- package/dist/entities/position_pool.d.ts +7 -0
- package/dist/entities/position_pool.d.ts.map +1 -0
- package/dist/entities/position_pool.js +30 -0
- package/dist/entities/types.d.ts +5 -0
- package/dist/entities/types.d.ts.map +1 -0
- package/dist/entities/types.js +0 -0
- package/dist/events.d.ts +9 -1
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +48 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/program_addresses.d.ts.map +1 -1
- package/dist/program_addresses.js +0 -5
- package/dist/utils/assert.d.ts +9 -0
- package/dist/utils/assert.d.ts.map +1 -0
- package/dist/utils/assert.js +10 -0
- package/dist/utils/bin_location.d.ts +4 -0
- package/dist/utils/bin_location.d.ts.map +1 -1
- package/dist/utils/bin_location.js +0 -12
- package/dist/utils/chunk.d.ts +1 -0
- package/dist/utils/chunk.d.ts.map +1 -1
- package/dist/utils/chunk.js +4 -0
- package/dist/utils/type_guards.d.ts +2 -0
- package/dist/utils/type_guards.d.ts.map +1 -1
- package/dist/utils/type_guards.js +7 -0
- package/package.json +1 -2
- package/src/entities/admin_config.ts +122 -0
- package/src/entities/bin_array.ts +157 -0
- package/src/entities/dlmm_program.ts +210 -0
- package/src/entities/index.ts +6 -0
- package/src/entities/pool.ts +392 -0
- package/src/entities/position.ts +481 -0
- package/src/entities/position_pool.ts +68 -0
- package/src/entities/types.ts +3 -0
- package/src/events.ts +77 -0
- package/src/index.ts +2 -1
- package/src/program_addresses.ts +0 -6
- package/src/utils/assert.ts +25 -0
- package/src/utils/bin_location.ts +5 -12
- package/src/utils/chunk.ts +9 -0
- package/src/utils/type_guards.ts +12 -0
- package/dist/actions/accept_admin_authority.d.ts +0 -13
- package/dist/actions/accept_admin_authority.d.ts.map +0 -1
- package/dist/actions/accept_admin_authority.js +0 -7
- package/dist/actions/claim_fee.d.ts +0 -21
- package/dist/actions/claim_fee.d.ts.map +0 -1
- package/dist/actions/claim_fee.js +0 -40
- package/dist/actions/claim_multiple_fees.d.ts +0 -19
- package/dist/actions/claim_multiple_fees.d.ts.map +0 -1
- package/dist/actions/claim_multiple_fees.js +0 -81
- package/dist/actions/claim_protocol_fee.d.ts +0 -18
- package/dist/actions/claim_protocol_fee.d.ts.map +0 -1
- package/dist/actions/claim_protocol_fee.js +0 -33
- package/dist/actions/close_position.d.ts +0 -14
- package/dist/actions/close_position.d.ts.map +0 -1
- package/dist/actions/close_position.js +0 -14
- package/dist/actions/create_admin_config.d.ts +0 -15
- package/dist/actions/create_admin_config.d.ts.map +0 -1
- package/dist/actions/create_admin_config.js +0 -30
- package/dist/actions/create_bin_array.d.ts +0 -16
- package/dist/actions/create_bin_array.d.ts.map +0 -1
- package/dist/actions/create_bin_array.js +0 -10
- package/dist/actions/create_pool.d.ts +0 -21
- package/dist/actions/create_pool.d.ts.map +0 -1
- package/dist/actions/create_pool.js +0 -22
- package/dist/actions/delete_bin_array.d.ts +0 -16
- package/dist/actions/delete_bin_array.d.ts.map +0 -1
- package/dist/actions/delete_bin_array.js +0 -13
- package/dist/actions/deposit_by_weight.d.ts +0 -27
- package/dist/actions/deposit_by_weight.d.ts.map +0 -1
- package/dist/actions/deposit_by_weight.js +0 -52
- package/dist/actions/get_admin_config.d.ts +0 -4
- package/dist/actions/get_admin_config.d.ts.map +0 -1
- package/dist/actions/get_admin_config.js +0 -7
- package/dist/actions/get_bin_arrays_by_indices.d.ts +0 -5
- package/dist/actions/get_bin_arrays_by_indices.d.ts.map +0 -1
- package/dist/actions/get_bin_arrays_by_indices.js +0 -6
- package/dist/actions/get_pool.d.ts +0 -4
- package/dist/actions/get_pool.d.ts.map +0 -1
- package/dist/actions/get_pool.js +0 -5
- package/dist/actions/get_position.d.ts +0 -4
- package/dist/actions/get_position.d.ts.map +0 -1
- package/dist/actions/get_position.js +0 -5
- package/dist/actions/get_position_by_position_mint.d.ts +0 -4
- package/dist/actions/get_position_by_position_mint.d.ts.map +0 -1
- package/dist/actions/get_position_by_position_mint.js +0 -6
- package/dist/actions/get_positions_by_owner.d.ts +0 -5
- package/dist/actions/get_positions_by_owner.d.ts.map +0 -1
- package/dist/actions/get_positions_by_owner.js +0 -33
- package/dist/actions/get_positions_by_position_mints.d.ts +0 -5
- package/dist/actions/get_positions_by_position_mints.d.ts.map +0 -1
- package/dist/actions/get_positions_by_position_mints.js +0 -9
- package/dist/actions/helpers/build_swap_transaction_message.d.ts +0 -22
- package/dist/actions/helpers/build_swap_transaction_message.d.ts.map +0 -1
- package/dist/actions/helpers/build_swap_transaction_message.js +0 -50
- package/dist/actions/helpers/build_transaction_message.d.ts +0 -20
- package/dist/actions/helpers/build_transaction_message.d.ts.map +0 -1
- package/dist/actions/helpers/build_transaction_message.js +0 -5
- package/dist/actions/helpers/index.d.ts +0 -8
- package/dist/actions/helpers/index.d.ts.map +0 -1
- package/dist/actions/helpers/index.js +0 -7
- package/dist/actions/helpers/resolve_active_bin_and_mints.d.ts +0 -12
- package/dist/actions/helpers/resolve_active_bin_and_mints.d.ts.map +0 -1
- package/dist/actions/helpers/resolve_active_bin_and_mints.js +0 -13
- package/dist/actions/helpers/resolve_admin_config_address.d.ts +0 -3
- package/dist/actions/helpers/resolve_admin_config_address.d.ts.map +0 -1
- package/dist/actions/helpers/resolve_admin_config_address.js +0 -9
- package/dist/actions/helpers/resolve_mint_info.d.ts +0 -10
- package/dist/actions/helpers/resolve_mint_info.d.ts.map +0 -1
- package/dist/actions/helpers/resolve_mint_info.js +0 -20
- package/dist/actions/helpers/resolve_position_range.d.ts +0 -12
- package/dist/actions/helpers/resolve_position_range.d.ts.map +0 -1
- package/dist/actions/helpers/resolve_position_range.js +0 -12
- package/dist/actions/helpers/resolve_token_mints_and_programs.d.ts +0 -15
- package/dist/actions/helpers/resolve_token_mints_and_programs.d.ts.map +0 -1
- package/dist/actions/helpers/resolve_token_mints_and_programs.js +0 -29
- package/dist/actions/index.d.ts +0 -31
- package/dist/actions/index.d.ts.map +0 -1
- package/dist/actions/index.js +0 -28
- package/dist/actions/is_admin_config_active.d.ts +0 -4
- package/dist/actions/is_admin_config_active.d.ts.map +0 -1
- package/dist/actions/is_admin_config_active.js +0 -7
- package/dist/actions/on_event.d.ts +0 -11
- package/dist/actions/on_event.d.ts.map +0 -1
- package/dist/actions/on_event.js +0 -50
- package/dist/actions/open_position.d.ts +0 -17
- package/dist/actions/open_position.d.ts.map +0 -1
- package/dist/actions/open_position.js +0 -31
- package/dist/actions/quote.d.ts +0 -13
- package/dist/actions/quote.d.ts.map +0 -1
- package/dist/actions/quote.js +0 -43
- package/dist/actions/set_metadata_update_authority.d.ts +0 -14
- package/dist/actions/set_metadata_update_authority.d.ts.map +0 -1
- package/dist/actions/set_metadata_update_authority.js +0 -7
- package/dist/actions/set_pool_dynamic_fee_config.d.ts +0 -16
- package/dist/actions/set_pool_dynamic_fee_config.d.ts.map +0 -1
- package/dist/actions/set_pool_dynamic_fee_config.js +0 -7
- package/dist/actions/set_pool_protocol_share.d.ts +0 -15
- package/dist/actions/set_pool_protocol_share.d.ts.map +0 -1
- package/dist/actions/set_pool_protocol_share.js +0 -7
- package/dist/actions/swap.d.ts +0 -22
- package/dist/actions/swap.d.ts.map +0 -1
- package/dist/actions/swap.js +0 -19
- package/dist/actions/sync_pool.d.ts +0 -15
- package/dist/actions/sync_pool.d.ts.map +0 -1
- package/dist/actions/sync_pool.js +0 -26
- package/dist/actions/transfer_admin_authority.d.ts +0 -14
- package/dist/actions/transfer_admin_authority.d.ts.map +0 -1
- package/dist/actions/transfer_admin_authority.js +0 -7
- package/dist/actions/withdraw.d.ts +0 -22
- package/dist/actions/withdraw.d.ts.map +0 -1
- package/dist/actions/withdraw.js +0 -41
- package/dist/utils/admin_config.d.ts +0 -3
- package/dist/utils/admin_config.d.ts.map +0 -1
- package/dist/utils/admin_config.js +0 -4
- package/dist/utils/bin_array.d.ts +0 -8
- package/dist/utils/bin_array.d.ts.map +0 -1
- package/dist/utils/bin_array.js +0 -29
- package/dist/utils/compute_budget.d.ts +0 -11
- package/dist/utils/compute_budget.d.ts.map +0 -1
- package/dist/utils/compute_budget.js +0 -22
- package/src/actions/accept_admin_authority.ts +0 -17
- package/src/actions/claim_fee.ts +0 -84
- package/src/actions/claim_multiple_fees.ts +0 -123
- package/src/actions/claim_protocol_fee.ts +0 -68
- package/src/actions/close_position.ts +0 -21
- package/src/actions/create_admin_config.ts +0 -51
- package/src/actions/create_bin_array.ts +0 -30
- package/src/actions/create_pool.ts +0 -49
- package/src/actions/delete_bin_array.ts +0 -33
- package/src/actions/deposit_by_weight.ts +0 -107
- package/src/actions/get_admin_config.ts +0 -13
- package/src/actions/get_bin_arrays_by_indices.ts +0 -15
- package/src/actions/get_pool.ts +0 -8
- package/src/actions/get_position.ts +0 -8
- package/src/actions/get_position_by_position_mint.ts +0 -14
- package/src/actions/get_positions_by_owner.ts +0 -48
- package/src/actions/get_positions_by_position_mints.ts +0 -21
- package/src/actions/helpers/build_swap_transaction_message.ts +0 -86
- package/src/actions/helpers/build_transaction_message.ts +0 -45
- package/src/actions/helpers/index.ts +0 -7
- package/src/actions/helpers/resolve_active_bin_and_mints.ts +0 -21
- package/src/actions/helpers/resolve_admin_config_address.ts +0 -11
- package/src/actions/helpers/resolve_mint_info.ts +0 -36
- package/src/actions/helpers/resolve_position_range.ts +0 -21
- package/src/actions/helpers/resolve_token_mints_and_programs.ts +0 -56
- package/src/actions/index.ts +0 -34
- package/src/actions/is_admin_config_active.ts +0 -14
- package/src/actions/on_event.ts +0 -78
- package/src/actions/open_position.ts +0 -66
- package/src/actions/quote.ts +0 -70
- package/src/actions/set_metadata_update_authority.ts +0 -17
- package/src/actions/set_pool_dynamic_fee_config.ts +0 -17
- package/src/actions/set_pool_protocol_share.ts +0 -17
- package/src/actions/swap.ts +0 -56
- package/src/actions/sync_pool.ts +0 -35
- package/src/actions/transfer_admin_authority.ts +0 -17
- package/src/actions/withdraw.ts +0 -87
- package/src/utils/admin_config.ts +0 -6
- package/src/utils/bin_array.ts +0 -45
- package/src/utils/compute_budget.ts +0 -58
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { PICON_DLMM_PROGRAM_ADDRESS, findPositionPda, getDepositByWeightInstruction } from "../generated";
|
|
2
|
-
import { findPositionBinArrayAddresses } from "../utils/bin_array";
|
|
3
|
-
import { processAssociatedTokenAccountPair, findPositionTokenAccount, findPoolTokenVaults } from "../utils/ata";
|
|
4
|
-
import { isUndefined } from "../utils/type_guards";
|
|
5
|
-
import { getPositionByPositionMint } from "./get_position_by_position_mint";
|
|
6
|
-
import { resolveActiveBinAndMints, resolveTokenMintsAndPrograms, buildTransactionMessage, } from "./helpers";
|
|
7
|
-
export async function depositByWeight(rpc, { owner, positionMint, activeBinId, amountX, amountY, lowerBinId, binWeights, maxActiveBinSlippage, distributionMode, pool, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, }, programAddress = PICON_DLMM_PROGRAM_ADDRESS, options = {}) {
|
|
8
|
-
if (isUndefined(pool)) {
|
|
9
|
-
const positionData = await getPositionByPositionMint(rpc, positionMint, programAddress, options);
|
|
10
|
-
pool = positionData.pool;
|
|
11
|
-
}
|
|
12
|
-
({ activeBinId, tokenMintX, tokenMintY } = await resolveActiveBinAndMints(rpc, pool, { activeBinId, tokenMintX, tokenMintY }, options));
|
|
13
|
-
const tokenMintsAndPrograms = await resolveTokenMintsAndPrograms(rpc, {
|
|
14
|
-
pool,
|
|
15
|
-
tokenMintX,
|
|
16
|
-
tokenMintY,
|
|
17
|
-
tokenProgramX,
|
|
18
|
-
tokenProgramY,
|
|
19
|
-
}, options);
|
|
20
|
-
const upperBinId = lowerBinId + binWeights.length - 1;
|
|
21
|
-
const [position] = await findPositionPda({ positionMint }, { programAddress });
|
|
22
|
-
const positionTokenAccount = await findPositionTokenAccount({ owner: owner.address, positionMint });
|
|
23
|
-
const { tokenVaultX, tokenVaultY } = await findPoolTokenVaults({ pool, ...tokenMintsAndPrograms });
|
|
24
|
-
const { ataX: tokenOwnerAccountX, ataY: tokenOwnerAccountY, preInstructions: preInstructionsAta, postInstructions: postInstructionsAta, } = await processAssociatedTokenAccountPair({ owner, ...tokenMintsAndPrograms, amountX, amountY });
|
|
25
|
-
const { lowerBinArray, upperBinArray } = await findPositionBinArrayAddresses(pool, lowerBinId, upperBinId, programAddress);
|
|
26
|
-
const depositByWeightIx = getDepositByWeightInstruction({
|
|
27
|
-
owner,
|
|
28
|
-
pool,
|
|
29
|
-
position,
|
|
30
|
-
positionTokenAccount,
|
|
31
|
-
...tokenMintsAndPrograms,
|
|
32
|
-
tokenOwnerAccountX,
|
|
33
|
-
tokenOwnerAccountY,
|
|
34
|
-
tokenVaultX,
|
|
35
|
-
tokenVaultY,
|
|
36
|
-
lowerBinArray,
|
|
37
|
-
upperBinArray,
|
|
38
|
-
amountX,
|
|
39
|
-
amountY,
|
|
40
|
-
activeBinId,
|
|
41
|
-
maxActiveBinSlippage,
|
|
42
|
-
distributionMode,
|
|
43
|
-
lowerBinId,
|
|
44
|
-
binWeights,
|
|
45
|
-
}, { programAddress });
|
|
46
|
-
const instructions = [
|
|
47
|
-
...preInstructionsAta,
|
|
48
|
-
depositByWeightIx,
|
|
49
|
-
...postInstructionsAta,
|
|
50
|
-
];
|
|
51
|
-
return await buildTransactionMessage(rpc, { feePayer: owner, instructions }, options);
|
|
52
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Address } from "@solana/kit";
|
|
2
|
-
import { type Rpc, type TransactionMessageOptions } from "./helpers";
|
|
3
|
-
export declare function getAdminConfig(rpc: Rpc, programAddress?: Address, options?: TransactionMessageOptions): Promise<import("../generated").AdminConfig>;
|
|
4
|
-
//# sourceMappingURL=get_admin_config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_admin_config.d.ts","sourceRoot":"","sources":["../../src/actions/get_admin_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAA6B,KAAK,GAAG,EAAE,KAAK,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAEhG,wBAAsB,cAAc,CAClC,GAAG,EAAE,GAAG,EACR,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B,+CAKxC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { PICON_DLMM_PROGRAM_ADDRESS, fetchAdminConfig } from "../generated";
|
|
2
|
-
import { resolveAdminConfigAddress } from "./helpers";
|
|
3
|
-
export async function getAdminConfig(rpc, programAddress = PICON_DLMM_PROGRAM_ADDRESS, options = {}) {
|
|
4
|
-
const adminConfig = await resolveAdminConfigAddress(programAddress);
|
|
5
|
-
const { data } = await fetchAdminConfig(rpc, adminConfig, options);
|
|
6
|
-
return data;
|
|
7
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Address, Account } from "@solana/kit";
|
|
2
|
-
import { type BinArray } from "../generated";
|
|
3
|
-
import type { Rpc, TransactionMessageOptions } from "./helpers";
|
|
4
|
-
export declare function getBinArraysByIndices(rpc: Rpc, pool: Address, indices: number[], programAddress?: Address, options?: TransactionMessageOptions): Promise<Account<BinArray>[]>;
|
|
5
|
-
//# sourceMappingURL=get_bin_arrays_by_indices.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_bin_arrays_by_indices.d.ts","sourceRoot":"","sources":["../../src/actions/get_bin_arrays_by_indices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAA8B,KAAK,QAAQ,EAAoB,MAAM,cAAc,CAAC;AAE3F,OAAO,KAAK,EAAE,GAAG,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAEhE,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,EAAE,EACjB,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAG9B"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PICON_DLMM_PROGRAM_ADDRESS, fetchAllBinArray } from "../generated";
|
|
2
|
-
import { findBinArrayAddresses } from "../utils/bin_array";
|
|
3
|
-
export async function getBinArraysByIndices(rpc, pool, indices, programAddress = PICON_DLMM_PROGRAM_ADDRESS, options = {}) {
|
|
4
|
-
const binArrayAddresses = await findBinArrayAddresses(pool, indices, programAddress);
|
|
5
|
-
return await fetchAllBinArray(rpc, binArrayAddresses, options);
|
|
6
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Address } from "@solana/kit";
|
|
2
|
-
import type { Rpc, TransactionMessageOptions } from "./helpers";
|
|
3
|
-
export declare function getPool(rpc: Rpc, pool: Address, options?: TransactionMessageOptions): Promise<import("../generated").Pool>;
|
|
4
|
-
//# sourceMappingURL=get_pool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_pool.d.ts","sourceRoot":"","sources":["../../src/actions/get_pool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,EAAE,GAAG,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAEhE,wBAAsB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,GAAE,yBAA8B,wCAG7F"}
|
package/dist/actions/get_pool.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Address } from "@solana/kit";
|
|
2
|
-
import type { Rpc, TransactionMessageOptions } from "./helpers";
|
|
3
|
-
export declare function getPosition(rpc: Rpc, position: Address, options?: TransactionMessageOptions): Promise<import("../generated").Position>;
|
|
4
|
-
//# sourceMappingURL=get_position.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_position.d.ts","sourceRoot":"","sources":["../../src/actions/get_position.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,EAAE,GAAG,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAEhE,wBAAsB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAE,yBAA8B,4CAGrG"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Address } from "@solana/kit";
|
|
2
|
-
import type { Rpc, TransactionMessageOptions } from "./helpers";
|
|
3
|
-
export declare function getPositionByPositionMint(rpc: Rpc, positionMint: Address, programAddress?: Address, options?: TransactionMessageOptions): Promise<import("../generated").Position>;
|
|
4
|
-
//# sourceMappingURL=get_position_by_position_mint.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_position_by_position_mint.d.ts","sourceRoot":"","sources":["../../src/actions/get_position_by_position_mint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,KAAK,EAAE,GAAG,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAEhE,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,GAAG,EACR,YAAY,EAAE,OAAO,EACrB,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B,4CAIxC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PICON_DLMM_PROGRAM_ADDRESS, findPositionPda } from "../generated";
|
|
2
|
-
import { getPosition } from "./get_position";
|
|
3
|
-
export async function getPositionByPositionMint(rpc, positionMint, programAddress = PICON_DLMM_PROGRAM_ADDRESS, options = {}) {
|
|
4
|
-
const [position] = await findPositionPda({ positionMint }, { programAddress });
|
|
5
|
-
return await getPosition(rpc, position, options);
|
|
6
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type Address } from "@solana/kit";
|
|
2
|
-
import { type Position } from "../generated";
|
|
3
|
-
import type { Rpc, TransactionMessageOptions } from "./helpers";
|
|
4
|
-
export declare function getPositionsByOwner(rpc: Rpc, owner: Address, programAddress?: Address, { commitment, minContextSlot, abortSignal }?: TransactionMessageOptions): Promise<Map<Address, Position[]>>;
|
|
5
|
-
//# sourceMappingURL=get_positions_by_owner.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_positions_by_owner.d.ts","sourceRoot":"","sources":["../../src/actions/get_positions_by_owner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAyB,MAAM,aAAa,CAAC;AAElE,OAAO,EAA8B,KAAK,QAAQ,EAA0C,MAAM,cAAc,CAAC;AAGjH,OAAO,KAAK,EAAE,GAAG,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAEhE,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,OAAO,EACd,cAAc,GAAE,OAAoC,EACpD,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,GAAE,yBAA8B,GAC1E,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,CAmCnC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { parseBase64RpcAccount } from "@solana/kit";
|
|
2
|
-
import { getTokenDecoder, TOKEN_2022_PROGRAM_ADDRESS } from "@solana-program/token-2022";
|
|
3
|
-
import { PICON_DLMM_PROGRAM_ADDRESS, findPositionPda, fetchAllMaybePosition } from "../generated";
|
|
4
|
-
import { chunk } from "../utils/chunk";
|
|
5
|
-
import { MAX_ACCOUNTS_PER_RPC_BATCH } from "../utils/constants";
|
|
6
|
-
export async function getPositionsByOwner(rpc, owner, programAddress = PICON_DLMM_PROGRAM_ADDRESS, { commitment, minContextSlot, abortSignal } = {}) {
|
|
7
|
-
const { value: tokenAccounts } = await rpc
|
|
8
|
-
.getTokenAccountsByOwner(owner, { programId: TOKEN_2022_PROGRAM_ADDRESS }, { commitment, minContextSlot, encoding: "base64" })
|
|
9
|
-
.send({ abortSignal });
|
|
10
|
-
const tokenDecoder = getTokenDecoder();
|
|
11
|
-
const candidateMints = tokenAccounts
|
|
12
|
-
.map(({ pubkey, account }) => tokenDecoder.decode(parseBase64RpcAccount(pubkey, account).data))
|
|
13
|
-
.filter(token => token.amount === 1n)
|
|
14
|
-
.map(token => token.mint);
|
|
15
|
-
const positionsByPool = new Map();
|
|
16
|
-
if (candidateMints.length === 0) {
|
|
17
|
-
return positionsByPool;
|
|
18
|
-
}
|
|
19
|
-
const positionAddresses = await Promise.all(candidateMints.map(async (positionMint) => (await findPositionPda({ positionMint }, { programAddress }))[0]));
|
|
20
|
-
// getMultipleAccounts caps out at MAX_ACCOUNTS_PER_RPC_BATCH addresses per request.
|
|
21
|
-
const maybePositionChunks = await Promise.all(chunk(positionAddresses, MAX_ACCOUNTS_PER_RPC_BATCH).map(addresses => fetchAllMaybePosition(rpc, addresses, { commitment, minContextSlot, abortSignal })));
|
|
22
|
-
const maybePositions = maybePositionChunks.flat();
|
|
23
|
-
for (const maybePosition of maybePositions) {
|
|
24
|
-
if (!maybePosition.exists) {
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
const position = maybePosition.data;
|
|
28
|
-
const positions = positionsByPool.get(position.pool) ?? [];
|
|
29
|
-
positions.push(position);
|
|
30
|
-
positionsByPool.set(position.pool, positions);
|
|
31
|
-
}
|
|
32
|
-
return positionsByPool;
|
|
33
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Address, Account } from "@solana/kit";
|
|
2
|
-
import { type Position } from "../generated";
|
|
3
|
-
import type { Rpc, TransactionMessageOptions } from "./helpers";
|
|
4
|
-
export declare function getPositionsByPositionMints(rpc: Rpc, positionMints: Address[], programAddress?: Address, options?: TransactionMessageOptions): Promise<Account<Position>[]>;
|
|
5
|
-
//# sourceMappingURL=get_positions_by_position_mints.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_positions_by_position_mints.d.ts","sourceRoot":"","sources":["../../src/actions/get_positions_by_position_mints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAA8B,KAAK,QAAQ,EAAqC,MAAM,cAAc,CAAC;AAG5G,OAAO,KAAK,EAAE,GAAG,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAEhE,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,OAAO,EAAE,EACxB,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAS9B"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { PICON_DLMM_PROGRAM_ADDRESS, findPositionPda, fetchAllPosition } from "../generated";
|
|
2
|
-
import { chunk } from "../utils/chunk";
|
|
3
|
-
import { MAX_ACCOUNTS_PER_RPC_BATCH } from "../utils/constants";
|
|
4
|
-
export async function getPositionsByPositionMints(rpc, positionMints, programAddress = PICON_DLMM_PROGRAM_ADDRESS, options = {}) {
|
|
5
|
-
const positionAddresses = await Promise.all(positionMints.map(async (positionMint) => (await findPositionPda({ positionMint }, { programAddress }))[0]));
|
|
6
|
-
// getMultipleAccounts caps out at MAX_ACCOUNTS_PER_RPC_BATCH addresses per request.
|
|
7
|
-
const positionChunks = await Promise.all(chunk(positionAddresses, MAX_ACCOUNTS_PER_RPC_BATCH).map(addresses => fetchAllPosition(rpc, addresses, options)));
|
|
8
|
-
return positionChunks.flat();
|
|
9
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type Address, type TransactionSigner } from "@solana/kit";
|
|
2
|
-
import { type TransactionMessageOptions, type Rpc } from "./build_transaction_message";
|
|
3
|
-
export declare function buildSwapTransactionMessage(rpc: Rpc, { user, pool, xToY, amountIn, minAmountOut, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, binArrayAddresses, }: {
|
|
4
|
-
user: TransactionSigner;
|
|
5
|
-
pool: Address;
|
|
6
|
-
xToY: boolean;
|
|
7
|
-
amountIn: bigint;
|
|
8
|
-
minAmountOut: bigint;
|
|
9
|
-
tokenMintX: Address;
|
|
10
|
-
tokenMintY: Address;
|
|
11
|
-
tokenProgramX: Address;
|
|
12
|
-
tokenProgramY: Address;
|
|
13
|
-
binArrayAddresses: Address[];
|
|
14
|
-
}, programAddress?: Address, options?: TransactionMessageOptions): Promise<Omit<Omit<Omit<import("@solana/transaction-messages").ExcludeTransactionMessageWithinSizeLimit<Omit<Readonly<{
|
|
15
|
-
instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
|
|
16
|
-
version: 0;
|
|
17
|
-
}>, "instructions"> & import("@solana/transaction-messages").TransactionMessageWithinSizeLimit & {
|
|
18
|
-
instructions: readonly [];
|
|
19
|
-
}>, "instructions"> & {
|
|
20
|
-
readonly instructions: readonly import("@solana/instructions").Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
|
|
21
|
-
}, "feePayer"> & import("@solana/signers").TransactionMessageWithFeePayerSigner<string, TransactionSigner<string>>, "lifetimeConstraint"> & import("@solana/transaction-messages").TransactionMessageWithBlockhashLifetime>;
|
|
22
|
-
//# sourceMappingURL=build_swap_transaction_message.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build_swap_transaction_message.d.ts","sourceRoot":"","sources":["../../../src/actions/helpers/build_swap_transaction_message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,iBAAiB,EAAe,MAAM,aAAa,CAAC;AAGhF,OAAO,EAA2B,KAAK,yBAAyB,EAAE,KAAK,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAShH,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,EACE,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,EACb,iBAAiB,GAClB,EAAE;IACD,IAAI,EAAE,iBAAiB,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,iBAAiB,EAAE,OAAO,EAAE,CAAC;CAC9B,EACD,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B;;;;;;;4NA+CxC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { AccountRole } from "@solana/kit";
|
|
2
|
-
import { PICON_DLMM_PROGRAM_ADDRESS, getSwapInstruction } from "../../generated";
|
|
3
|
-
import { processAssociatedTokenAccountPair, findPoolTokenVaults } from "../../utils/ata";
|
|
4
|
-
import { buildTransactionMessage } from "./build_transaction_message";
|
|
5
|
-
// Pure tx builder: every account is already resolved by the caller (`swap`, or `quote`'s
|
|
6
|
-
// returned closure reusing the accounts its own quote was computed against) — no RPC calls,
|
|
7
|
-
// no derivation beyond ATA/vault lookups, no fallbacks.
|
|
8
|
-
//
|
|
9
|
-
// The bin arrays are Anchor `remaining_accounts`, not part of the typed account list, so
|
|
10
|
-
// they're appended manually here — writable, since swap mutates bins via `load_mut` (unlike
|
|
11
|
-
// sync_pool's read-only remaining accounts). `binArrayAddresses` is caller-resolved.
|
|
12
|
-
export async function buildSwapTransactionMessage(rpc, { user, pool, xToY, amountIn, minAmountOut, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, binArrayAddresses, }, programAddress = PICON_DLMM_PROGRAM_ADDRESS, options = {}) {
|
|
13
|
-
const { tokenVaultX, tokenVaultY } = await findPoolTokenVaults({ pool, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY });
|
|
14
|
-
// Only the input side needs `amount` (to actually wrap/transfer in); the output side is
|
|
15
|
-
// receive-only, same as claim_fee/withdraw's ATAs.
|
|
16
|
-
const { ataX: tokenUserAccountX, ataY: tokenUserAccountY, preInstructions: preInstructionsAta, postInstructions: postInstructionsAta, } = await processAssociatedTokenAccountPair({
|
|
17
|
-
owner: user,
|
|
18
|
-
tokenMintX,
|
|
19
|
-
tokenMintY,
|
|
20
|
-
tokenProgramX,
|
|
21
|
-
tokenProgramY,
|
|
22
|
-
amountX: xToY ? amountIn : undefined,
|
|
23
|
-
amountY: xToY ? undefined : amountIn,
|
|
24
|
-
});
|
|
25
|
-
const swapIx = getSwapInstruction({
|
|
26
|
-
user,
|
|
27
|
-
pool,
|
|
28
|
-
tokenMintX,
|
|
29
|
-
tokenMintY,
|
|
30
|
-
tokenUserAccountX,
|
|
31
|
-
tokenUserAccountY,
|
|
32
|
-
tokenVaultX,
|
|
33
|
-
tokenVaultY,
|
|
34
|
-
tokenProgramX,
|
|
35
|
-
tokenProgramY,
|
|
36
|
-
amountIn,
|
|
37
|
-
minAmountOut,
|
|
38
|
-
xToY,
|
|
39
|
-
}, { programAddress });
|
|
40
|
-
const remainingAccounts = binArrayAddresses.map(address => ({
|
|
41
|
-
address,
|
|
42
|
-
role: AccountRole.WRITABLE,
|
|
43
|
-
}));
|
|
44
|
-
const instructions = [
|
|
45
|
-
...preInstructionsAta,
|
|
46
|
-
{ ...swapIx, accounts: [...swapIx.accounts, ...remainingAccounts] },
|
|
47
|
-
...postInstructionsAta,
|
|
48
|
-
];
|
|
49
|
-
return await buildTransactionMessage(rpc, { feePayer: user, instructions }, options);
|
|
50
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type Slot, type Commitment, type Instruction, type TransactionSigner, type createSolanaRpc, type BlockhashLifetimeConstraint } from "@solana/kit";
|
|
2
|
-
export type Rpc = ReturnType<typeof createSolanaRpc>;
|
|
3
|
-
export interface TransactionMessageOptions {
|
|
4
|
-
commitment?: Commitment;
|
|
5
|
-
minContextSlot?: Slot;
|
|
6
|
-
abortSignal?: AbortSignal;
|
|
7
|
-
}
|
|
8
|
-
export declare function buildTransactionMessage(rpc: Rpc, { feePayer, instructions, latestBlockhash, }: {
|
|
9
|
-
feePayer: TransactionSigner;
|
|
10
|
-
instructions: Instruction[];
|
|
11
|
-
latestBlockhash?: BlockhashLifetimeConstraint;
|
|
12
|
-
}, { commitment, minContextSlot, abortSignal }?: TransactionMessageOptions): Promise<Omit<Omit<Omit<import("@solana/transaction-messages").ExcludeTransactionMessageWithinSizeLimit<Omit<Readonly<{
|
|
13
|
-
instructions: readonly Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
|
|
14
|
-
version: 0;
|
|
15
|
-
}>, "instructions"> & import("@solana/transaction-messages").TransactionMessageWithinSizeLimit & {
|
|
16
|
-
instructions: readonly [];
|
|
17
|
-
}>, "instructions"> & {
|
|
18
|
-
readonly instructions: readonly Instruction<string, readonly (import("@solana/instructions").AccountLookupMeta<string, string> | import("@solana/instructions").AccountMeta<string>)[]>[];
|
|
19
|
-
}, "feePayer"> & import("@solana/signers").TransactionMessageWithFeePayerSigner<string, TransactionSigner<string>>, "lifetimeConstraint"> & import("@solana/transaction-messages").TransactionMessageWithBlockhashLifetime>;
|
|
20
|
-
//# sourceMappingURL=build_transaction_message.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build_transaction_message.d.ts","sourceRoot":"","sources":["../../../src/actions/helpers/build_transaction_message.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,2BAA2B,EACjC,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAIrD,MAAM,WAAW,yBAAyB;IACxC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,GAAG,EACR,EACE,QAAQ,EACR,YAAY,EACZ,eAAe,GAChB,EAAE;IACD,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,eAAe,CAAC,EAAE,2BAA2B,CAAC;CAC/C,EACD,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,GAAE,yBAA8B;;;;;;;4NAS5E"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { pipe, createTransactionMessage, setTransactionMessageFeePayerSigner, appendTransactionMessageInstructions, setTransactionMessageLifetimeUsingBlockhash, } from "@solana/kit";
|
|
2
|
-
export async function buildTransactionMessage(rpc, { feePayer, instructions, latestBlockhash, }, { commitment, minContextSlot, abortSignal } = {}) {
|
|
3
|
-
latestBlockhash ??= (await rpc.getLatestBlockhash({ commitment, minContextSlot }).send({ abortSignal })).value;
|
|
4
|
-
return pipe(createTransactionMessage({ version: 0 }), msg => appendTransactionMessageInstructions(instructions, msg), msg => setTransactionMessageFeePayerSigner(feePayer, msg), msg => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, msg));
|
|
5
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { buildTransactionMessage, type TransactionMessageOptions, type Rpc } from "./build_transaction_message";
|
|
2
|
-
export { buildSwapTransactionMessage } from "./build_swap_transaction_message";
|
|
3
|
-
export { resolveTokenMintsAndPrograms } from "./resolve_token_mints_and_programs";
|
|
4
|
-
export { resolveActiveBinAndMints } from "./resolve_active_bin_and_mints";
|
|
5
|
-
export { resolveMintInfo } from "./resolve_mint_info";
|
|
6
|
-
export { resolvePositionRange } from "./resolve_position_range";
|
|
7
|
-
export { resolveAdminConfigAddress } from "./resolve_admin_config_address";
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/actions/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,KAAK,yBAAyB,EAAE,KAAK,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAChH,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { buildTransactionMessage } from "./build_transaction_message";
|
|
2
|
-
export { buildSwapTransactionMessage } from "./build_swap_transaction_message";
|
|
3
|
-
export { resolveTokenMintsAndPrograms } from "./resolve_token_mints_and_programs";
|
|
4
|
-
export { resolveActiveBinAndMints } from "./resolve_active_bin_and_mints";
|
|
5
|
-
export { resolveMintInfo } from "./resolve_mint_info";
|
|
6
|
-
export { resolvePositionRange } from "./resolve_position_range";
|
|
7
|
-
export { resolveAdminConfigAddress } from "./resolve_admin_config_address";
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Address } from "@solana/kit";
|
|
2
|
-
import type { Rpc, TransactionMessageOptions } from "./build_transaction_message";
|
|
3
|
-
export declare function resolveActiveBinAndMints(rpc: Rpc, pool: Address, { activeBinId, tokenMintX, tokenMintY }: {
|
|
4
|
-
activeBinId?: number;
|
|
5
|
-
tokenMintX?: Address;
|
|
6
|
-
tokenMintY?: Address;
|
|
7
|
-
}, options?: TransactionMessageOptions): Promise<{
|
|
8
|
-
activeBinId: number;
|
|
9
|
-
tokenMintX: Address;
|
|
10
|
-
tokenMintY: Address;
|
|
11
|
-
}>;
|
|
12
|
-
//# sourceMappingURL=resolve_active_bin_and_mints.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve_active_bin_and_mints.d.ts","sourceRoot":"","sources":["../../../src/actions/helpers/resolve_active_bin_and_mints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,KAAK,EAAE,GAAG,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAIlF,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,OAAO,EACb,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,EAC7G,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC,CAQ5E"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { getPool } from "../get_pool";
|
|
2
|
-
import { isUndefined } from "../../utils/type_guards";
|
|
3
|
-
// No programAddress here — this only ever reads an already-known pool account by its explicit
|
|
4
|
-
// address (getPool), no PDA derivation, so there's nothing for it to affect.
|
|
5
|
-
export async function resolveActiveBinAndMints(rpc, pool, { activeBinId, tokenMintX, tokenMintY }, options = {}) {
|
|
6
|
-
if (isUndefined(activeBinId) || isUndefined(tokenMintX) || isUndefined(tokenMintY)) {
|
|
7
|
-
const poolData = await getPool(rpc, pool, options);
|
|
8
|
-
activeBinId ??= poolData.activeBinId;
|
|
9
|
-
tokenMintX ??= poolData.tokenMintX;
|
|
10
|
-
tokenMintY ??= poolData.tokenMintY;
|
|
11
|
-
}
|
|
12
|
-
return { activeBinId, tokenMintX, tokenMintY };
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve_admin_config_address.d.ts","sourceRoot":"","sources":["../../../src/actions/helpers/resolve_admin_config_address.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAO3C,wBAAsB,yBAAyB,CAAC,cAAc,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAGzF"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { findAdminConfigPda } from "../../generated";
|
|
2
|
-
// The generated instruction builders' own default resolution for the `adminConfig` account
|
|
3
|
-
// (every instruction that touches it) always derives against the mainnet
|
|
4
|
-
// PICON_DLMM_PROGRAM_ADDRESS baked in at codegen time, ignoring that call's own `programAddress`
|
|
5
|
-
// argument — so every action passes this explicitly instead of relying on the generated default.
|
|
6
|
-
export async function resolveAdminConfigAddress(programAddress) {
|
|
7
|
-
const [adminConfig] = await findAdminConfigPda({ programAddress });
|
|
8
|
-
return adminConfig;
|
|
9
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Address } from "@solana/kit";
|
|
2
|
-
import type { TransferFee } from "../../quote";
|
|
3
|
-
import type { Rpc, TransactionMessageOptions } from "./build_transaction_message";
|
|
4
|
-
export declare function resolveMintInfo(rpc: Rpc, tokenMintX: Address, tokenMintY: Address, { commitment, minContextSlot, abortSignal }?: TransactionMessageOptions): Promise<{
|
|
5
|
-
transferFeeX?: TransferFee;
|
|
6
|
-
transferFeeY?: TransferFee;
|
|
7
|
-
tokenProgramX: Address;
|
|
8
|
-
tokenProgramY: Address;
|
|
9
|
-
}>;
|
|
10
|
-
//# sourceMappingURL=resolve_mint_info.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve_mint_info.d.ts","sourceRoot":"","sources":["../../../src/actions/helpers/resolve_mint_info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,GAAG,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAElF,wBAAsB,eAAe,CACnC,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,OAAO,EACnB,UAAU,EAAE,OAAO,EACnB,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,GAAE,yBAA8B,GAC1E,OAAO,CAAC;IACT,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,CAmBD"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { fetchAllMaybeMint } from "@solana-program/token-2022";
|
|
2
|
-
import { resolveTransferFee } from "../../utils/transfer_fee";
|
|
3
|
-
export async function resolveMintInfo(rpc, tokenMintX, tokenMintY, { commitment, minContextSlot, abortSignal } = {}) {
|
|
4
|
-
const [{ epoch }, [maybeMintX, maybeMintY]] = await Promise.all([
|
|
5
|
-
rpc.getEpochInfo({ commitment, minContextSlot }).send({ abortSignal }),
|
|
6
|
-
fetchAllMaybeMint(rpc, [tokenMintX, tokenMintY], { commitment, minContextSlot, abortSignal }),
|
|
7
|
-
]);
|
|
8
|
-
if (!maybeMintX.exists) {
|
|
9
|
-
throw new Error(`Mint account not found: ${tokenMintX}`);
|
|
10
|
-
}
|
|
11
|
-
if (!maybeMintY.exists) {
|
|
12
|
-
throw new Error(`Mint account not found: ${tokenMintY}`);
|
|
13
|
-
}
|
|
14
|
-
return {
|
|
15
|
-
transferFeeX: resolveTransferFee(maybeMintX.data, epoch),
|
|
16
|
-
transferFeeY: resolveTransferFee(maybeMintY.data, epoch),
|
|
17
|
-
tokenProgramX: maybeMintX.programAddress,
|
|
18
|
-
tokenProgramY: maybeMintY.programAddress,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Address } from "@solana/kit";
|
|
2
|
-
import type { Rpc, TransactionMessageOptions } from "./build_transaction_message";
|
|
3
|
-
export declare function resolvePositionRange(rpc: Rpc, positionMint: Address, { pool, lowerBinId, upperBinId }: {
|
|
4
|
-
pool?: Address;
|
|
5
|
-
lowerBinId?: number;
|
|
6
|
-
upperBinId?: number;
|
|
7
|
-
}, programAddress?: Address, options?: TransactionMessageOptions): Promise<{
|
|
8
|
-
pool: Address;
|
|
9
|
-
lowerBinId: number;
|
|
10
|
-
upperBinId: number;
|
|
11
|
-
}>;
|
|
12
|
-
//# sourceMappingURL=resolve_position_range.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve_position_range.d.ts","sourceRoot":"","sources":["../../../src/actions/helpers/resolve_position_range.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAI3C,OAAO,KAAK,EAAE,GAAG,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAElF,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,GAAG,EACR,YAAY,EAAE,OAAO,EACrB,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EAC9F,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAQpE"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PICON_DLMM_PROGRAM_ADDRESS } from "../../generated";
|
|
2
|
-
import { getPositionByPositionMint } from "../get_position_by_position_mint";
|
|
3
|
-
import { isUndefined } from "../../utils/type_guards";
|
|
4
|
-
export async function resolvePositionRange(rpc, positionMint, { pool, lowerBinId, upperBinId }, programAddress = PICON_DLMM_PROGRAM_ADDRESS, options = {}) {
|
|
5
|
-
if (isUndefined(pool) || isUndefined(lowerBinId) || isUndefined(upperBinId)) {
|
|
6
|
-
const positionData = await getPositionByPositionMint(rpc, positionMint, programAddress, options);
|
|
7
|
-
pool ??= positionData.pool;
|
|
8
|
-
lowerBinId ??= positionData.lowerBinId;
|
|
9
|
-
upperBinId ??= positionData.upperBinId;
|
|
10
|
-
}
|
|
11
|
-
return { pool, lowerBinId, upperBinId };
|
|
12
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Address } from "@solana/kit";
|
|
2
|
-
import type { Rpc, TransactionMessageOptions } from "./build_transaction_message";
|
|
3
|
-
export declare function resolveTokenMintsAndPrograms(rpc: Rpc, { pool, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, }: {
|
|
4
|
-
pool: Address;
|
|
5
|
-
tokenMintX?: Address;
|
|
6
|
-
tokenMintY?: Address;
|
|
7
|
-
tokenProgramX?: Address;
|
|
8
|
-
tokenProgramY?: Address;
|
|
9
|
-
}, options?: TransactionMessageOptions): Promise<{
|
|
10
|
-
tokenMintX: Address;
|
|
11
|
-
tokenMintY: Address;
|
|
12
|
-
tokenProgramX: Address;
|
|
13
|
-
tokenProgramY: Address;
|
|
14
|
-
}>;
|
|
15
|
-
//# sourceMappingURL=resolve_token_mints_and_programs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve_token_mints_and_programs.d.ts","sourceRoot":"","sources":["../../../src/actions/helpers/resolve_token_mints_and_programs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAI3C,OAAO,KAAK,EAAE,GAAG,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAIlF,wBAAsB,4BAA4B,CAChD,GAAG,EAAE,GAAG,EACR,EACE,IAAI,EACJ,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,GACd,EAAE;IACD,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,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC;IACT,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,CA0BD"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { fetchAllMaybeMint } from "@solana-program/token-2022";
|
|
2
|
-
import { getPool } from "../get_pool";
|
|
3
|
-
import { isUndefined } from "../../utils/type_guards";
|
|
4
|
-
// No programAddress here — this only ever reads an already-known pool account by its explicit
|
|
5
|
-
// address (getPool), no PDA derivation, so there's nothing for it to affect.
|
|
6
|
-
export async function resolveTokenMintsAndPrograms(rpc, { pool, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY, }, options = {}) {
|
|
7
|
-
if (isUndefined(tokenMintX) || isUndefined(tokenMintY)) {
|
|
8
|
-
const poolData = await getPool(rpc, pool, options);
|
|
9
|
-
tokenMintX ??= poolData.tokenMintX;
|
|
10
|
-
tokenMintY ??= poolData.tokenMintY;
|
|
11
|
-
}
|
|
12
|
-
if (tokenProgramX !== undefined && tokenProgramY !== undefined) {
|
|
13
|
-
return { tokenMintX, tokenMintY, tokenProgramX, tokenProgramY };
|
|
14
|
-
}
|
|
15
|
-
// One batched getMultipleAccounts instead of up to two separate getAccountInfo requests.
|
|
16
|
-
const [maybeMintX, maybeMintY] = await fetchAllMaybeMint(rpc, [tokenMintX, tokenMintY], options);
|
|
17
|
-
if (!maybeMintX.exists) {
|
|
18
|
-
throw new Error(`Mint account not found: ${tokenMintX}`);
|
|
19
|
-
}
|
|
20
|
-
if (!maybeMintY.exists) {
|
|
21
|
-
throw new Error(`Mint account not found: ${tokenMintY}`);
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
tokenMintX,
|
|
25
|
-
tokenMintY,
|
|
26
|
-
tokenProgramX: tokenProgramX ?? maybeMintX.programAddress,
|
|
27
|
-
tokenProgramY: tokenProgramY ?? maybeMintY.programAddress,
|
|
28
|
-
};
|
|
29
|
-
}
|
package/dist/actions/index.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export { type TransactionMessageOptions, type Rpc } from "./helpers";
|
|
2
|
-
export type { QuoteInput, QuoteOutput, PoolState, TransferFee } from "../quote";
|
|
3
|
-
export { getPool } from "./get_pool";
|
|
4
|
-
export { getAdminConfig } from "./get_admin_config";
|
|
5
|
-
export { isAdminConfigActive } from "./is_admin_config_active";
|
|
6
|
-
export { getPosition } from "./get_position";
|
|
7
|
-
export { getPositionByPositionMint } from "./get_position_by_position_mint";
|
|
8
|
-
export { getPositionsByPositionMints } from "./get_positions_by_position_mints";
|
|
9
|
-
export { getBinArraysByIndices } from "./get_bin_arrays_by_indices";
|
|
10
|
-
export { getPositionsByOwner } from "./get_positions_by_owner";
|
|
11
|
-
export { createPool } from "./create_pool";
|
|
12
|
-
export { syncPool } from "./sync_pool";
|
|
13
|
-
export { openPosition } from "./open_position";
|
|
14
|
-
export { closePosition } from "./close_position";
|
|
15
|
-
export { withdraw } from "./withdraw";
|
|
16
|
-
export { claimFee } from "./claim_fee";
|
|
17
|
-
export { claimMultipleFees } from "./claim_multiple_fees";
|
|
18
|
-
export { depositByWeight } from "./deposit_by_weight";
|
|
19
|
-
export { swap } from "./swap";
|
|
20
|
-
export { quote } from "./quote";
|
|
21
|
-
export { createAdminConfig } from "./create_admin_config";
|
|
22
|
-
export { transferAdminAuthority } from "./transfer_admin_authority";
|
|
23
|
-
export { acceptAdminAuthority } from "./accept_admin_authority";
|
|
24
|
-
export { setMetadataUpdateAuthority } from "./set_metadata_update_authority";
|
|
25
|
-
export { claimProtocolFee } from "./claim_protocol_fee";
|
|
26
|
-
export { setPoolDynamicFeeConfig } from "./set_pool_dynamic_fee_config";
|
|
27
|
-
export { setPoolProtocolShare } from "./set_pool_protocol_share";
|
|
28
|
-
export { createBinArray } from "./create_bin_array";
|
|
29
|
-
export { deleteBinArray } from "./delete_bin_array";
|
|
30
|
-
export { onEvent } from "./on_event";
|
|
31
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,yBAAyB,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AACrE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEhF,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/actions/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export { getPool } from "./get_pool";
|
|
2
|
-
export { getAdminConfig } from "./get_admin_config";
|
|
3
|
-
export { isAdminConfigActive } from "./is_admin_config_active";
|
|
4
|
-
export { getPosition } from "./get_position";
|
|
5
|
-
export { getPositionByPositionMint } from "./get_position_by_position_mint";
|
|
6
|
-
export { getPositionsByPositionMints } from "./get_positions_by_position_mints";
|
|
7
|
-
export { getBinArraysByIndices } from "./get_bin_arrays_by_indices";
|
|
8
|
-
export { getPositionsByOwner } from "./get_positions_by_owner";
|
|
9
|
-
export { createPool } from "./create_pool";
|
|
10
|
-
export { syncPool } from "./sync_pool";
|
|
11
|
-
export { openPosition } from "./open_position";
|
|
12
|
-
export { closePosition } from "./close_position";
|
|
13
|
-
export { withdraw } from "./withdraw";
|
|
14
|
-
export { claimFee } from "./claim_fee";
|
|
15
|
-
export { claimMultipleFees } from "./claim_multiple_fees";
|
|
16
|
-
export { depositByWeight } from "./deposit_by_weight";
|
|
17
|
-
export { swap } from "./swap";
|
|
18
|
-
export { quote } from "./quote";
|
|
19
|
-
export { createAdminConfig } from "./create_admin_config";
|
|
20
|
-
export { transferAdminAuthority } from "./transfer_admin_authority";
|
|
21
|
-
export { acceptAdminAuthority } from "./accept_admin_authority";
|
|
22
|
-
export { setMetadataUpdateAuthority } from "./set_metadata_update_authority";
|
|
23
|
-
export { claimProtocolFee } from "./claim_protocol_fee";
|
|
24
|
-
export { setPoolDynamicFeeConfig } from "./set_pool_dynamic_fee_config";
|
|
25
|
-
export { setPoolProtocolShare } from "./set_pool_protocol_share";
|
|
26
|
-
export { createBinArray } from "./create_bin_array";
|
|
27
|
-
export { deleteBinArray } from "./delete_bin_array";
|
|
28
|
-
export { onEvent } from "./on_event";
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Address } from "@solana/kit";
|
|
2
|
-
import type { Rpc, TransactionMessageOptions } from "./helpers";
|
|
3
|
-
export declare function isAdminConfigActive(rpc: Rpc, programAddress?: Address, options?: TransactionMessageOptions): Promise<boolean>;
|
|
4
|
-
//# sourceMappingURL=is_admin_config_active.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is_admin_config_active.d.ts","sourceRoot":"","sources":["../../src/actions/is_admin_config_active.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,KAAK,EAAE,GAAG,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAEhE,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,GAAG,EACR,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,OAAO,CAAC,CAIlB"}
|