@picon-finance/dlmm-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +48 -0
- package/dist/actions/accept_admin_authority.d.ts +13 -0
- package/dist/actions/accept_admin_authority.d.ts.map +1 -0
- package/dist/actions/accept_admin_authority.js +7 -0
- package/dist/actions/claim_fee.d.ts +21 -0
- package/dist/actions/claim_fee.d.ts.map +1 -0
- package/dist/actions/claim_fee.js +40 -0
- package/dist/actions/claim_multiple_fees.d.ts +19 -0
- package/dist/actions/claim_multiple_fees.d.ts.map +1 -0
- package/dist/actions/claim_multiple_fees.js +81 -0
- package/dist/actions/claim_protocol_fee.d.ts +18 -0
- package/dist/actions/claim_protocol_fee.d.ts.map +1 -0
- package/dist/actions/claim_protocol_fee.js +33 -0
- package/dist/actions/close_position.d.ts +14 -0
- package/dist/actions/close_position.d.ts.map +1 -0
- package/dist/actions/close_position.js +14 -0
- package/dist/actions/create_admin_config.d.ts +15 -0
- package/dist/actions/create_admin_config.d.ts.map +1 -0
- package/dist/actions/create_admin_config.js +30 -0
- package/dist/actions/create_bin_array.d.ts +16 -0
- package/dist/actions/create_bin_array.d.ts.map +1 -0
- package/dist/actions/create_bin_array.js +10 -0
- package/dist/actions/create_pool.d.ts +21 -0
- package/dist/actions/create_pool.d.ts.map +1 -0
- package/dist/actions/create_pool.js +22 -0
- package/dist/actions/delete_bin_array.d.ts +16 -0
- package/dist/actions/delete_bin_array.d.ts.map +1 -0
- package/dist/actions/delete_bin_array.js +13 -0
- package/dist/actions/deposit_by_weight.d.ts +27 -0
- package/dist/actions/deposit_by_weight.d.ts.map +1 -0
- package/dist/actions/deposit_by_weight.js +52 -0
- package/dist/actions/get_admin_config.d.ts +4 -0
- package/dist/actions/get_admin_config.d.ts.map +1 -0
- package/dist/actions/get_admin_config.js +7 -0
- package/dist/actions/get_bin_arrays_by_indices.d.ts +5 -0
- package/dist/actions/get_bin_arrays_by_indices.d.ts.map +1 -0
- package/dist/actions/get_bin_arrays_by_indices.js +6 -0
- package/dist/actions/get_pool.d.ts +4 -0
- package/dist/actions/get_pool.d.ts.map +1 -0
- package/dist/actions/get_pool.js +5 -0
- package/dist/actions/get_position.d.ts +4 -0
- package/dist/actions/get_position.d.ts.map +1 -0
- package/dist/actions/get_position.js +5 -0
- package/dist/actions/get_position_by_position_mint.d.ts +4 -0
- package/dist/actions/get_position_by_position_mint.d.ts.map +1 -0
- package/dist/actions/get_position_by_position_mint.js +6 -0
- package/dist/actions/get_positions_by_owner.d.ts +5 -0
- package/dist/actions/get_positions_by_owner.d.ts.map +1 -0
- package/dist/actions/get_positions_by_owner.js +33 -0
- package/dist/actions/get_positions_by_position_mints.d.ts +5 -0
- package/dist/actions/get_positions_by_position_mints.d.ts.map +1 -0
- package/dist/actions/get_positions_by_position_mints.js +9 -0
- package/dist/actions/helpers/build_swap_transaction_message.d.ts +22 -0
- package/dist/actions/helpers/build_swap_transaction_message.d.ts.map +1 -0
- package/dist/actions/helpers/build_swap_transaction_message.js +50 -0
- package/dist/actions/helpers/build_transaction_message.d.ts +20 -0
- package/dist/actions/helpers/build_transaction_message.d.ts.map +1 -0
- package/dist/actions/helpers/build_transaction_message.js +5 -0
- package/dist/actions/helpers/index.d.ts +8 -0
- package/dist/actions/helpers/index.d.ts.map +1 -0
- package/dist/actions/helpers/index.js +7 -0
- package/dist/actions/helpers/resolve_active_bin_and_mints.d.ts +12 -0
- package/dist/actions/helpers/resolve_active_bin_and_mints.d.ts.map +1 -0
- package/dist/actions/helpers/resolve_active_bin_and_mints.js +13 -0
- package/dist/actions/helpers/resolve_admin_config_address.d.ts +3 -0
- package/dist/actions/helpers/resolve_admin_config_address.d.ts.map +1 -0
- package/dist/actions/helpers/resolve_admin_config_address.js +9 -0
- package/dist/actions/helpers/resolve_mint_info.d.ts +10 -0
- package/dist/actions/helpers/resolve_mint_info.d.ts.map +1 -0
- package/dist/actions/helpers/resolve_mint_info.js +20 -0
- package/dist/actions/helpers/resolve_position_range.d.ts +12 -0
- package/dist/actions/helpers/resolve_position_range.d.ts.map +1 -0
- package/dist/actions/helpers/resolve_position_range.js +12 -0
- package/dist/actions/helpers/resolve_token_mints_and_programs.d.ts +15 -0
- package/dist/actions/helpers/resolve_token_mints_and_programs.d.ts.map +1 -0
- package/dist/actions/helpers/resolve_token_mints_and_programs.js +29 -0
- package/dist/actions/index.d.ts +31 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +28 -0
- package/dist/actions/is_admin_config_active.d.ts +4 -0
- package/dist/actions/is_admin_config_active.d.ts.map +1 -0
- package/dist/actions/is_admin_config_active.js +7 -0
- package/dist/actions/on_event.d.ts +11 -0
- package/dist/actions/on_event.d.ts.map +1 -0
- package/dist/actions/on_event.js +50 -0
- package/dist/actions/open_position.d.ts +17 -0
- package/dist/actions/open_position.d.ts.map +1 -0
- package/dist/actions/open_position.js +31 -0
- package/dist/actions/quote.d.ts +13 -0
- package/dist/actions/quote.d.ts.map +1 -0
- package/dist/actions/quote.js +43 -0
- package/dist/actions/set_metadata_update_authority.d.ts +14 -0
- package/dist/actions/set_metadata_update_authority.d.ts.map +1 -0
- package/dist/actions/set_metadata_update_authority.js +7 -0
- package/dist/actions/set_pool_dynamic_fee_config.d.ts +16 -0
- package/dist/actions/set_pool_dynamic_fee_config.d.ts.map +1 -0
- package/dist/actions/set_pool_dynamic_fee_config.js +7 -0
- package/dist/actions/set_pool_protocol_share.d.ts +15 -0
- package/dist/actions/set_pool_protocol_share.d.ts.map +1 -0
- package/dist/actions/set_pool_protocol_share.js +7 -0
- package/dist/actions/swap.d.ts +22 -0
- package/dist/actions/swap.d.ts.map +1 -0
- package/dist/actions/swap.js +19 -0
- package/dist/actions/sync_pool.d.ts +15 -0
- package/dist/actions/sync_pool.d.ts.map +1 -0
- package/dist/actions/sync_pool.js +26 -0
- package/dist/actions/transfer_admin_authority.d.ts +14 -0
- package/dist/actions/transfer_admin_authority.d.ts.map +1 -0
- package/dist/actions/transfer_admin_authority.js +7 -0
- package/dist/actions/withdraw.d.ts +22 -0
- package/dist/actions/withdraw.d.ts.map +1 -0
- package/dist/actions/withdraw.js +41 -0
- package/dist/events.d.ts +93 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +166 -0
- package/dist/generated/accounts/adminConfig.d.ts +35 -0
- package/dist/generated/accounts/adminConfig.d.ts.map +1 -0
- package/dist/generated/accounts/adminConfig.js +60 -0
- package/dist/generated/accounts/binArray.d.ts +40 -0
- package/dist/generated/accounts/binArray.d.ts.map +1 -0
- package/dist/generated/accounts/binArray.js +65 -0
- package/dist/generated/accounts/index.d.ts +12 -0
- package/dist/generated/accounts/index.d.ts.map +1 -0
- package/dist/generated/accounts/index.js +11 -0
- package/dist/generated/accounts/pool.d.ts +54 -0
- package/dist/generated/accounts/pool.d.ts.map +1 -0
- package/dist/generated/accounts/pool.js +79 -0
- package/dist/generated/accounts/position.d.ts +42 -0
- package/dist/generated/accounts/position.d.ts.map +1 -0
- package/dist/generated/accounts/position.js +67 -0
- package/dist/generated/errors/index.d.ts +9 -0
- package/dist/generated/errors/index.d.ts.map +1 -0
- package/dist/generated/errors/index.js +8 -0
- package/dist/generated/errors/piconDlmm.d.ts +58 -0
- package/dist/generated/errors/piconDlmm.d.ts.map +1 -0
- package/dist/generated/errors/piconDlmm.js +80 -0
- package/dist/generated/index.d.ts +14 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +13 -0
- package/dist/generated/instructions/acceptAdminAuthority.d.ts +47 -0
- package/dist/generated/instructions/acceptAdminAuthority.d.ts.map +1 -0
- package/dist/generated/instructions/acceptAdminAuthority.js +99 -0
- package/dist/generated/instructions/claimFee.d.ts +83 -0
- package/dist/generated/instructions/claimFee.d.ts.map +1 -0
- package/dist/generated/instructions/claimFee.js +127 -0
- package/dist/generated/instructions/claimProtocolFee.d.ts +83 -0
- package/dist/generated/instructions/claimProtocolFee.d.ts.map +1 -0
- package/dist/generated/instructions/claimProtocolFee.js +147 -0
- package/dist/generated/instructions/closePosition.d.ts +59 -0
- package/dist/generated/instructions/closePosition.d.ts.map +1 -0
- package/dist/generated/instructions/closePosition.js +124 -0
- package/dist/generated/instructions/createAdminConfig.d.ts +68 -0
- package/dist/generated/instructions/createAdminConfig.d.ts.map +1 -0
- package/dist/generated/instructions/createAdminConfig.js +132 -0
- package/dist/generated/instructions/createBinArray.d.ts +64 -0
- package/dist/generated/instructions/createBinArray.d.ts.map +1 -0
- package/dist/generated/instructions/createBinArray.js +122 -0
- package/dist/generated/instructions/createPool.d.ts +100 -0
- package/dist/generated/instructions/createPool.d.ts.map +1 -0
- package/dist/generated/instructions/createPool.js +202 -0
- package/dist/generated/instructions/deleteBinArray.d.ts +68 -0
- package/dist/generated/instructions/deleteBinArray.d.ts.map +1 -0
- package/dist/generated/instructions/deleteBinArray.js +130 -0
- package/dist/generated/instructions/depositByWeight.d.ts +99 -0
- package/dist/generated/instructions/depositByWeight.d.ts.map +1 -0
- package/dist/generated/instructions/depositByWeight.js +136 -0
- package/dist/generated/instructions/index.d.ts +25 -0
- package/dist/generated/instructions/index.d.ts.map +1 -0
- package/dist/generated/instructions/index.js +24 -0
- package/dist/generated/instructions/openPosition.d.ts +88 -0
- package/dist/generated/instructions/openPosition.d.ts.map +1 -0
- package/dist/generated/instructions/openPosition.js +200 -0
- package/dist/generated/instructions/setMetadataUpdateAuthority.d.ts +52 -0
- package/dist/generated/instructions/setMetadataUpdateAuthority.d.ts.map +1 -0
- package/dist/generated/instructions/setMetadataUpdateAuthority.js +98 -0
- package/dist/generated/instructions/setPoolDynamicFeeConfig.d.ts +57 -0
- package/dist/generated/instructions/setPoolDynamicFeeConfig.d.ts.map +1 -0
- package/dist/generated/instructions/setPoolDynamicFeeConfig.js +107 -0
- package/dist/generated/instructions/setPoolProtocolShare.d.ts +56 -0
- package/dist/generated/instructions/setPoolProtocolShare.d.ts.map +1 -0
- package/dist/generated/instructions/setPoolProtocolShare.js +106 -0
- package/dist/generated/instructions/swap.d.ts +74 -0
- package/dist/generated/instructions/swap.d.ts.map +1 -0
- package/dist/generated/instructions/swap.js +108 -0
- package/dist/generated/instructions/syncPool.d.ts +44 -0
- package/dist/generated/instructions/syncPool.d.ts.map +1 -0
- package/dist/generated/instructions/syncPool.js +71 -0
- package/dist/generated/instructions/transferAdminAuthority.d.ts +52 -0
- package/dist/generated/instructions/transferAdminAuthority.d.ts.map +1 -0
- package/dist/generated/instructions/transferAdminAuthority.js +98 -0
- package/dist/generated/instructions/withdraw.d.ts +86 -0
- package/dist/generated/instructions/withdraw.d.ts.map +1 -0
- package/dist/generated/instructions/withdraw.js +129 -0
- package/dist/generated/pdas/adminConfig.d.ts +12 -0
- package/dist/generated/pdas/adminConfig.d.ts.map +1 -0
- package/dist/generated/pdas/adminConfig.js +19 -0
- package/dist/generated/pdas/binArray.d.ts +16 -0
- package/dist/generated/pdas/binArray.d.ts.map +1 -0
- package/dist/generated/pdas/binArray.js +19 -0
- package/dist/generated/pdas/index.d.ts +12 -0
- package/dist/generated/pdas/index.d.ts.map +1 -0
- package/dist/generated/pdas/index.js +11 -0
- package/dist/generated/pdas/pool.d.ts +18 -0
- package/dist/generated/pdas/pool.d.ts.map +1 -0
- package/dist/generated/pdas/pool.js +21 -0
- package/dist/generated/pdas/position.d.ts +15 -0
- package/dist/generated/pdas/position.d.ts.map +1 -0
- package/dist/generated/pdas/position.js +18 -0
- package/dist/generated/programs/index.d.ts +9 -0
- package/dist/generated/programs/index.d.ts.map +1 -0
- package/dist/generated/programs/index.js +8 -0
- package/dist/generated/programs/piconDlmm.d.ts +126 -0
- package/dist/generated/programs/piconDlmm.d.ts.map +1 -0
- package/dist/generated/programs/piconDlmm.js +285 -0
- package/dist/generated/types/bin.d.ts +28 -0
- package/dist/generated/types/bin.d.ts.map +1 -0
- package/dist/generated/types/bin.js +31 -0
- package/dist/generated/types/distributionMode.d.ts +19 -0
- package/dist/generated/types/distributionMode.d.ts.map +1 -0
- package/dist/generated/types/distributionMode.js +24 -0
- package/dist/generated/types/dynamicFeeConfig.d.ts +29 -0
- package/dist/generated/types/dynamicFeeConfig.d.ts.map +1 -0
- package/dist/generated/types/dynamicFeeConfig.js +29 -0
- package/dist/generated/types/dynamicFeeState.d.ts +27 -0
- package/dist/generated/types/dynamicFeeState.d.ts.map +1 -0
- package/dist/generated/types/dynamicFeeState.js +30 -0
- package/dist/generated/types/feeState.d.ts +26 -0
- package/dist/generated/types/feeState.d.ts.map +1 -0
- package/dist/generated/types/feeState.js +29 -0
- package/dist/generated/types/index.d.ts +13 -0
- package/dist/generated/types/index.d.ts.map +1 -0
- package/dist/generated/types/index.js +12 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/picon_dlmm.json +2378 -0
- package/dist/program_addresses.d.ts +4 -0
- package/dist/program_addresses.d.ts.map +1 -0
- package/dist/program_addresses.js +8 -0
- package/dist/quote/index.d.ts +4 -0
- package/dist/quote/index.d.ts.map +1 -0
- package/dist/quote/index.js +5 -0
- package/dist/quote/wasm-node/picon_dlmm_quote.d.ts +6 -0
- package/dist/quote/wasm-node/picon_dlmm_quote.d.ts.map +1 -0
- package/dist/quote/wasm-node/picon_dlmm_quote.js +398 -0
- package/dist/quote/wasm-node/picon_dlmm_quote_bg.wasm +0 -0
- package/dist/quote/wasm-node-loader.d.ts +4 -0
- package/dist/quote/wasm-node-loader.d.ts.map +1 -0
- package/dist/quote/wasm-node-loader.js +7 -0
- package/dist/quote/wasm-web/picon_dlmm_quote.d.ts +9 -0
- package/dist/quote/wasm-web/picon_dlmm_quote.d.ts.map +1 -0
- package/dist/quote/wasm-web/picon_dlmm_quote.js +486 -0
- package/dist/quote/wasm-web/picon_dlmm_quote_bg.wasm +0 -0
- package/dist/quote/wasm-web-loader.d.ts +4 -0
- package/dist/quote/wasm-web-loader.d.ts.map +1 -0
- package/dist/quote/wasm-web-loader.js +12 -0
- package/dist/utils/admin_config.d.ts +3 -0
- package/dist/utils/admin_config.d.ts.map +1 -0
- package/dist/utils/admin_config.js +4 -0
- package/dist/utils/ata.d.ts +49 -0
- package/dist/utils/ata.d.ts.map +1 -0
- package/dist/utils/ata.js +113 -0
- package/dist/utils/bin_array.d.ts +8 -0
- package/dist/utils/bin_array.d.ts.map +1 -0
- package/dist/utils/bin_array.js +29 -0
- package/dist/utils/bin_location.d.ts +11 -0
- package/dist/utils/bin_location.d.ts.map +1 -0
- package/dist/utils/bin_location.js +55 -0
- package/dist/utils/chunk.d.ts +2 -0
- package/dist/utils/chunk.d.ts.map +1 -0
- package/dist/utils/chunk.js +7 -0
- package/dist/utils/compute_budget.d.ts +11 -0
- package/dist/utils/compute_budget.d.ts.map +1 -0
- package/dist/utils/compute_budget.js +22 -0
- package/dist/utils/constants.d.ts +12 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +20 -0
- package/dist/utils/transfer_fee.d.ts +4 -0
- package/dist/utils/transfer_fee.d.ts.map +1 -0
- package/dist/utils/transfer_fee.js +21 -0
- package/dist/utils/type_guards.d.ts +2 -0
- package/dist/utils/type_guards.d.ts.map +1 -0
- package/dist/utils/type_guards.js +3 -0
- package/package.json +59 -0
- package/src/actions/accept_admin_authority.ts +17 -0
- package/src/actions/claim_fee.ts +84 -0
- package/src/actions/claim_multiple_fees.ts +123 -0
- package/src/actions/claim_protocol_fee.ts +68 -0
- package/src/actions/close_position.ts +21 -0
- package/src/actions/create_admin_config.ts +50 -0
- package/src/actions/create_bin_array.ts +30 -0
- package/src/actions/create_pool.ts +49 -0
- package/src/actions/delete_bin_array.ts +33 -0
- package/src/actions/deposit_by_weight.ts +107 -0
- package/src/actions/get_admin_config.ts +13 -0
- package/src/actions/get_bin_arrays_by_indices.ts +15 -0
- package/src/actions/get_pool.ts +8 -0
- package/src/actions/get_position.ts +8 -0
- package/src/actions/get_position_by_position_mint.ts +14 -0
- package/src/actions/get_positions_by_owner.ts +48 -0
- package/src/actions/get_positions_by_position_mints.ts +21 -0
- package/src/actions/helpers/build_swap_transaction_message.ts +86 -0
- package/src/actions/helpers/build_transaction_message.ts +45 -0
- package/src/actions/helpers/index.ts +7 -0
- package/src/actions/helpers/resolve_active_bin_and_mints.ts +21 -0
- package/src/actions/helpers/resolve_admin_config_address.ts +11 -0
- package/src/actions/helpers/resolve_mint_info.ts +36 -0
- package/src/actions/helpers/resolve_position_range.ts +21 -0
- package/src/actions/helpers/resolve_token_mints_and_programs.ts +56 -0
- package/src/actions/index.ts +34 -0
- package/src/actions/is_admin_config_active.ts +14 -0
- package/src/actions/on_event.ts +78 -0
- package/src/actions/open_position.ts +66 -0
- package/src/actions/quote.ts +70 -0
- package/src/actions/set_metadata_update_authority.ts +17 -0
- package/src/actions/set_pool_dynamic_fee_config.ts +17 -0
- package/src/actions/set_pool_protocol_share.ts +17 -0
- package/src/actions/swap.ts +56 -0
- package/src/actions/sync_pool.ts +35 -0
- package/src/actions/transfer_admin_authority.ts +17 -0
- package/src/actions/withdraw.ts +87 -0
- package/src/events.ts +279 -0
- package/src/generated/accounts/adminConfig.ts +147 -0
- package/src/generated/accounts/binArray.ts +155 -0
- package/src/generated/accounts/index.ts +12 -0
- package/src/generated/accounts/pool.ts +192 -0
- package/src/generated/accounts/position.ts +164 -0
- package/src/generated/errors/index.ts +9 -0
- package/src/generated/errors/piconDlmm.ts +124 -0
- package/src/generated/index.ts +14 -0
- package/src/generated/instructions/acceptAdminAuthority.ts +262 -0
- package/src/generated/instructions/claimFee.ts +395 -0
- package/src/generated/instructions/claimProtocolFee.ts +462 -0
- package/src/generated/instructions/closePosition.ts +342 -0
- package/src/generated/instructions/createAdminConfig.ts +369 -0
- package/src/generated/instructions/createBinArray.ts +344 -0
- package/src/generated/instructions/createPool.ts +582 -0
- package/src/generated/instructions/deleteBinArray.ts +365 -0
- package/src/generated/instructions/depositByWeight.ts +435 -0
- package/src/generated/instructions/index.ts +25 -0
- package/src/generated/instructions/openPosition.ts +547 -0
- package/src/generated/instructions/setMetadataUpdateAuthority.ts +274 -0
- package/src/generated/instructions/setPoolDynamicFeeConfig.ts +304 -0
- package/src/generated/instructions/setPoolProtocolShare.ts +298 -0
- package/src/generated/instructions/swap.ts +336 -0
- package/src/generated/instructions/syncPool.ts +189 -0
- package/src/generated/instructions/transferAdminAuthority.ts +271 -0
- package/src/generated/instructions/withdraw.ts +402 -0
- package/src/generated/pdas/adminConfig.ts +32 -0
- package/src/generated/pdas/binArray.ts +40 -0
- package/src/generated/pdas/index.ts +12 -0
- package/src/generated/pdas/pool.ts +43 -0
- package/src/generated/pdas/position.ts +37 -0
- package/src/generated/programs/index.ts +9 -0
- package/src/generated/programs/piconDlmm.ts +803 -0
- package/src/generated/types/bin.ts +64 -0
- package/src/generated/types/distributionMode.ts +43 -0
- package/src/generated/types/dynamicFeeConfig.ts +69 -0
- package/src/generated/types/dynamicFeeState.ts +71 -0
- package/src/generated/types/feeState.ts +60 -0
- package/src/generated/types/index.ts +13 -0
- package/src/index.ts +4 -0
- package/src/picon_dlmm.json +2378 -0
- package/src/program_addresses.ts +10 -0
- package/src/quote/index.ts +14 -0
- package/src/quote/wasm-node/package.json +4 -0
- package/src/quote/wasm-node/picon_dlmm_quote.d.ts +64 -0
- package/src/quote/wasm-node/picon_dlmm_quote.js +407 -0
- package/src/quote/wasm-node/picon_dlmm_quote_bg.wasm +0 -0
- package/src/quote/wasm-node/picon_dlmm_quote_bg.wasm.d.ts +11 -0
- package/src/quote/wasm-node-loader.ts +11 -0
- package/src/quote/wasm-web/picon_dlmm_quote.d.ts +100 -0
- package/src/quote/wasm-web/picon_dlmm_quote.js +500 -0
- package/src/quote/wasm-web/picon_dlmm_quote_bg.wasm +0 -0
- package/src/quote/wasm-web/picon_dlmm_quote_bg.wasm.d.ts +11 -0
- package/src/quote/wasm-web-loader.ts +17 -0
- package/src/utils/admin_config.ts +6 -0
- package/src/utils/ata.ts +213 -0
- package/src/utils/bin_array.ts +45 -0
- package/src/utils/bin_location.ts +79 -0
- package/src/utils/chunk.ts +7 -0
- package/src/utils/compute_budget.ts +58 -0
- package/src/utils/constants.ts +24 -0
- package/src/utils/transfer_fee.ts +29 -0
- package/src/utils/type_guards.ts +3 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
combineCodec,
|
|
11
|
+
fixDecoderSize,
|
|
12
|
+
fixEncoderSize,
|
|
13
|
+
getBytesDecoder,
|
|
14
|
+
getBytesEncoder,
|
|
15
|
+
getStructDecoder,
|
|
16
|
+
getStructEncoder,
|
|
17
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
18
|
+
SolanaError,
|
|
19
|
+
transformEncoder,
|
|
20
|
+
type AccountMeta,
|
|
21
|
+
type AccountSignerMeta,
|
|
22
|
+
type Address,
|
|
23
|
+
type FixedSizeCodec,
|
|
24
|
+
type FixedSizeDecoder,
|
|
25
|
+
type FixedSizeEncoder,
|
|
26
|
+
type Instruction,
|
|
27
|
+
type InstructionWithAccounts,
|
|
28
|
+
type InstructionWithData,
|
|
29
|
+
type ReadonlySignerAccount,
|
|
30
|
+
type ReadonlyUint8Array,
|
|
31
|
+
type TransactionSigner,
|
|
32
|
+
type WritableAccount,
|
|
33
|
+
} from "@solana/kit";
|
|
34
|
+
import {
|
|
35
|
+
getAccountMetaFactory,
|
|
36
|
+
type ResolvedInstructionAccount,
|
|
37
|
+
} from "@solana/program-client-core";
|
|
38
|
+
import { findAdminConfigPda } from "../pdas";
|
|
39
|
+
import { PICON_DLMM_PROGRAM_ADDRESS } from "../programs";
|
|
40
|
+
|
|
41
|
+
export const ACCEPT_ADMIN_AUTHORITY_DISCRIMINATOR: ReadonlyUint8Array =
|
|
42
|
+
new Uint8Array([109, 115, 12, 245, 11, 10, 16, 209]);
|
|
43
|
+
|
|
44
|
+
export function getAcceptAdminAuthorityDiscriminatorBytes(): ReadonlyUint8Array {
|
|
45
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
46
|
+
ACCEPT_ADMIN_AUTHORITY_DISCRIMINATOR,
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type AcceptAdminAuthorityInstruction<
|
|
51
|
+
TProgram extends string = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
52
|
+
TAccountPendingAuthority extends string | AccountMeta<string> = string,
|
|
53
|
+
TAccountAdminConfig extends string | AccountMeta<string> = string,
|
|
54
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
55
|
+
> = Instruction<TProgram> &
|
|
56
|
+
InstructionWithData<ReadonlyUint8Array> &
|
|
57
|
+
InstructionWithAccounts<
|
|
58
|
+
[
|
|
59
|
+
TAccountPendingAuthority extends string
|
|
60
|
+
? ReadonlySignerAccount<TAccountPendingAuthority> &
|
|
61
|
+
AccountSignerMeta<TAccountPendingAuthority>
|
|
62
|
+
: TAccountPendingAuthority,
|
|
63
|
+
TAccountAdminConfig extends string
|
|
64
|
+
? WritableAccount<TAccountAdminConfig>
|
|
65
|
+
: TAccountAdminConfig,
|
|
66
|
+
...TRemainingAccounts,
|
|
67
|
+
]
|
|
68
|
+
>;
|
|
69
|
+
|
|
70
|
+
export type AcceptAdminAuthorityInstructionData = {
|
|
71
|
+
discriminator: ReadonlyUint8Array;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export type AcceptAdminAuthorityInstructionDataArgs = {};
|
|
75
|
+
|
|
76
|
+
export function getAcceptAdminAuthorityInstructionDataEncoder(): FixedSizeEncoder<AcceptAdminAuthorityInstructionDataArgs> {
|
|
77
|
+
return transformEncoder(
|
|
78
|
+
getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]),
|
|
79
|
+
(value) => ({
|
|
80
|
+
...value,
|
|
81
|
+
discriminator: ACCEPT_ADMIN_AUTHORITY_DISCRIMINATOR,
|
|
82
|
+
}),
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function getAcceptAdminAuthorityInstructionDataDecoder(): FixedSizeDecoder<AcceptAdminAuthorityInstructionData> {
|
|
87
|
+
return getStructDecoder([
|
|
88
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
89
|
+
]);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function getAcceptAdminAuthorityInstructionDataCodec(): FixedSizeCodec<
|
|
93
|
+
AcceptAdminAuthorityInstructionDataArgs,
|
|
94
|
+
AcceptAdminAuthorityInstructionData
|
|
95
|
+
> {
|
|
96
|
+
return combineCodec(
|
|
97
|
+
getAcceptAdminAuthorityInstructionDataEncoder(),
|
|
98
|
+
getAcceptAdminAuthorityInstructionDataDecoder(),
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export type AcceptAdminAuthorityAsyncInput<
|
|
103
|
+
TAccountPendingAuthority extends string = string,
|
|
104
|
+
TAccountAdminConfig extends string = string,
|
|
105
|
+
> = {
|
|
106
|
+
pendingAuthority: TransactionSigner<TAccountPendingAuthority>;
|
|
107
|
+
adminConfig?: Address<TAccountAdminConfig>;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export async function getAcceptAdminAuthorityInstructionAsync<
|
|
111
|
+
TAccountPendingAuthority extends string,
|
|
112
|
+
TAccountAdminConfig extends string,
|
|
113
|
+
TProgramAddress extends Address = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
114
|
+
>(
|
|
115
|
+
input: AcceptAdminAuthorityAsyncInput<
|
|
116
|
+
TAccountPendingAuthority,
|
|
117
|
+
TAccountAdminConfig
|
|
118
|
+
>,
|
|
119
|
+
config?: { programAddress?: TProgramAddress },
|
|
120
|
+
): Promise<
|
|
121
|
+
AcceptAdminAuthorityInstruction<
|
|
122
|
+
TProgramAddress,
|
|
123
|
+
TAccountPendingAuthority,
|
|
124
|
+
TAccountAdminConfig
|
|
125
|
+
>
|
|
126
|
+
> {
|
|
127
|
+
// Program address.
|
|
128
|
+
const programAddress = config?.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
|
|
129
|
+
|
|
130
|
+
// Original accounts.
|
|
131
|
+
const originalAccounts = {
|
|
132
|
+
pendingAuthority: {
|
|
133
|
+
value: input.pendingAuthority ?? null,
|
|
134
|
+
isWritable: false,
|
|
135
|
+
},
|
|
136
|
+
adminConfig: { value: input.adminConfig ?? null, isWritable: true },
|
|
137
|
+
};
|
|
138
|
+
const accounts = originalAccounts as Record<
|
|
139
|
+
keyof typeof originalAccounts,
|
|
140
|
+
ResolvedInstructionAccount
|
|
141
|
+
>;
|
|
142
|
+
|
|
143
|
+
// Resolve default values.
|
|
144
|
+
if (!accounts.adminConfig.value) {
|
|
145
|
+
accounts.adminConfig.value = await findAdminConfigPda();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
149
|
+
return Object.freeze({
|
|
150
|
+
accounts: [
|
|
151
|
+
getAccountMeta("pendingAuthority", accounts.pendingAuthority),
|
|
152
|
+
getAccountMeta("adminConfig", accounts.adminConfig),
|
|
153
|
+
],
|
|
154
|
+
data: getAcceptAdminAuthorityInstructionDataEncoder().encode({}),
|
|
155
|
+
programAddress,
|
|
156
|
+
} as AcceptAdminAuthorityInstruction<
|
|
157
|
+
TProgramAddress,
|
|
158
|
+
TAccountPendingAuthority,
|
|
159
|
+
TAccountAdminConfig
|
|
160
|
+
>);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export type AcceptAdminAuthorityInput<
|
|
164
|
+
TAccountPendingAuthority extends string = string,
|
|
165
|
+
TAccountAdminConfig extends string = string,
|
|
166
|
+
> = {
|
|
167
|
+
pendingAuthority: TransactionSigner<TAccountPendingAuthority>;
|
|
168
|
+
adminConfig: Address<TAccountAdminConfig>;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export function getAcceptAdminAuthorityInstruction<
|
|
172
|
+
TAccountPendingAuthority extends string,
|
|
173
|
+
TAccountAdminConfig extends string,
|
|
174
|
+
TProgramAddress extends Address = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
175
|
+
>(
|
|
176
|
+
input: AcceptAdminAuthorityInput<
|
|
177
|
+
TAccountPendingAuthority,
|
|
178
|
+
TAccountAdminConfig
|
|
179
|
+
>,
|
|
180
|
+
config?: { programAddress?: TProgramAddress },
|
|
181
|
+
): AcceptAdminAuthorityInstruction<
|
|
182
|
+
TProgramAddress,
|
|
183
|
+
TAccountPendingAuthority,
|
|
184
|
+
TAccountAdminConfig
|
|
185
|
+
> {
|
|
186
|
+
// Program address.
|
|
187
|
+
const programAddress = config?.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
|
|
188
|
+
|
|
189
|
+
// Original accounts.
|
|
190
|
+
const originalAccounts = {
|
|
191
|
+
pendingAuthority: {
|
|
192
|
+
value: input.pendingAuthority ?? null,
|
|
193
|
+
isWritable: false,
|
|
194
|
+
},
|
|
195
|
+
adminConfig: { value: input.adminConfig ?? null, isWritable: true },
|
|
196
|
+
};
|
|
197
|
+
const accounts = originalAccounts as Record<
|
|
198
|
+
keyof typeof originalAccounts,
|
|
199
|
+
ResolvedInstructionAccount
|
|
200
|
+
>;
|
|
201
|
+
|
|
202
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
203
|
+
return Object.freeze({
|
|
204
|
+
accounts: [
|
|
205
|
+
getAccountMeta("pendingAuthority", accounts.pendingAuthority),
|
|
206
|
+
getAccountMeta("adminConfig", accounts.adminConfig),
|
|
207
|
+
],
|
|
208
|
+
data: getAcceptAdminAuthorityInstructionDataEncoder().encode({}),
|
|
209
|
+
programAddress,
|
|
210
|
+
} as AcceptAdminAuthorityInstruction<
|
|
211
|
+
TProgramAddress,
|
|
212
|
+
TAccountPendingAuthority,
|
|
213
|
+
TAccountAdminConfig
|
|
214
|
+
>);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export type ParsedAcceptAdminAuthorityInstruction<
|
|
218
|
+
TProgram extends string = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
219
|
+
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
|
|
220
|
+
> = {
|
|
221
|
+
programAddress: Address<TProgram>;
|
|
222
|
+
accounts: {
|
|
223
|
+
pendingAuthority: TAccountMetas[0];
|
|
224
|
+
adminConfig: TAccountMetas[1];
|
|
225
|
+
};
|
|
226
|
+
data: AcceptAdminAuthorityInstructionData;
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export function parseAcceptAdminAuthorityInstruction<
|
|
230
|
+
TProgram extends string,
|
|
231
|
+
TAccountMetas extends readonly AccountMeta[],
|
|
232
|
+
>(
|
|
233
|
+
instruction: Instruction<TProgram> &
|
|
234
|
+
InstructionWithAccounts<TAccountMetas> &
|
|
235
|
+
InstructionWithData<ReadonlyUint8Array>,
|
|
236
|
+
): ParsedAcceptAdminAuthorityInstruction<TProgram, TAccountMetas> {
|
|
237
|
+
if (instruction.accounts.length < 2) {
|
|
238
|
+
throw new SolanaError(
|
|
239
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
240
|
+
{
|
|
241
|
+
actualAccountMetas: instruction.accounts.length,
|
|
242
|
+
expectedAccountMetas: 2,
|
|
243
|
+
},
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
let accountIndex = 0;
|
|
247
|
+
const getNextAccount = () => {
|
|
248
|
+
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
|
|
249
|
+
accountIndex += 1;
|
|
250
|
+
return accountMeta;
|
|
251
|
+
};
|
|
252
|
+
return {
|
|
253
|
+
programAddress: instruction.programAddress,
|
|
254
|
+
accounts: {
|
|
255
|
+
pendingAuthority: getNextAccount(),
|
|
256
|
+
adminConfig: getNextAccount(),
|
|
257
|
+
},
|
|
258
|
+
data: getAcceptAdminAuthorityInstructionDataDecoder().decode(
|
|
259
|
+
instruction.data,
|
|
260
|
+
),
|
|
261
|
+
};
|
|
262
|
+
}
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
combineCodec,
|
|
11
|
+
fixDecoderSize,
|
|
12
|
+
fixEncoderSize,
|
|
13
|
+
getBytesDecoder,
|
|
14
|
+
getBytesEncoder,
|
|
15
|
+
getI32Decoder,
|
|
16
|
+
getI32Encoder,
|
|
17
|
+
getStructDecoder,
|
|
18
|
+
getStructEncoder,
|
|
19
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
20
|
+
SolanaError,
|
|
21
|
+
transformEncoder,
|
|
22
|
+
type AccountMeta,
|
|
23
|
+
type AccountSignerMeta,
|
|
24
|
+
type Address,
|
|
25
|
+
type FixedSizeCodec,
|
|
26
|
+
type FixedSizeDecoder,
|
|
27
|
+
type FixedSizeEncoder,
|
|
28
|
+
type Instruction,
|
|
29
|
+
type InstructionWithAccounts,
|
|
30
|
+
type InstructionWithData,
|
|
31
|
+
type ReadonlyAccount,
|
|
32
|
+
type ReadonlySignerAccount,
|
|
33
|
+
type ReadonlyUint8Array,
|
|
34
|
+
type TransactionSigner,
|
|
35
|
+
type WritableAccount,
|
|
36
|
+
} from "@solana/kit";
|
|
37
|
+
import {
|
|
38
|
+
getAccountMetaFactory,
|
|
39
|
+
type ResolvedInstructionAccount,
|
|
40
|
+
} from "@solana/program-client-core";
|
|
41
|
+
import { PICON_DLMM_PROGRAM_ADDRESS } from "../programs";
|
|
42
|
+
|
|
43
|
+
export const CLAIM_FEE_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([
|
|
44
|
+
169, 32, 79, 137, 136, 232, 70, 137,
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
export function getClaimFeeDiscriminatorBytes(): ReadonlyUint8Array {
|
|
48
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(CLAIM_FEE_DISCRIMINATOR);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type ClaimFeeInstruction<
|
|
52
|
+
TProgram extends string = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
53
|
+
TAccountOwner extends string | AccountMeta<string> = string,
|
|
54
|
+
TAccountPool extends string | AccountMeta<string> = string,
|
|
55
|
+
TAccountPosition extends string | AccountMeta<string> = string,
|
|
56
|
+
TAccountPositionTokenAccount extends string | AccountMeta<string> = string,
|
|
57
|
+
TAccountTokenMintX extends string | AccountMeta<string> = string,
|
|
58
|
+
TAccountTokenMintY extends string | AccountMeta<string> = string,
|
|
59
|
+
TAccountTokenOwnerAccountX extends string | AccountMeta<string> = string,
|
|
60
|
+
TAccountTokenOwnerAccountY extends string | AccountMeta<string> = string,
|
|
61
|
+
TAccountTokenVaultX extends string | AccountMeta<string> = string,
|
|
62
|
+
TAccountTokenVaultY extends string | AccountMeta<string> = string,
|
|
63
|
+
TAccountTokenProgramX extends string | AccountMeta<string> = string,
|
|
64
|
+
TAccountTokenProgramY extends string | AccountMeta<string> = string,
|
|
65
|
+
TAccountLowerBinArray extends string | AccountMeta<string> = string,
|
|
66
|
+
TAccountUpperBinArray extends string | AccountMeta<string> = string,
|
|
67
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
68
|
+
> = Instruction<TProgram> &
|
|
69
|
+
InstructionWithData<ReadonlyUint8Array> &
|
|
70
|
+
InstructionWithAccounts<
|
|
71
|
+
[
|
|
72
|
+
TAccountOwner extends string
|
|
73
|
+
? ReadonlySignerAccount<TAccountOwner> &
|
|
74
|
+
AccountSignerMeta<TAccountOwner>
|
|
75
|
+
: TAccountOwner,
|
|
76
|
+
TAccountPool extends string
|
|
77
|
+
? ReadonlyAccount<TAccountPool>
|
|
78
|
+
: TAccountPool,
|
|
79
|
+
TAccountPosition extends string
|
|
80
|
+
? WritableAccount<TAccountPosition>
|
|
81
|
+
: TAccountPosition,
|
|
82
|
+
TAccountPositionTokenAccount extends string
|
|
83
|
+
? ReadonlyAccount<TAccountPositionTokenAccount>
|
|
84
|
+
: TAccountPositionTokenAccount,
|
|
85
|
+
TAccountTokenMintX extends string
|
|
86
|
+
? ReadonlyAccount<TAccountTokenMintX>
|
|
87
|
+
: TAccountTokenMintX,
|
|
88
|
+
TAccountTokenMintY extends string
|
|
89
|
+
? ReadonlyAccount<TAccountTokenMintY>
|
|
90
|
+
: TAccountTokenMintY,
|
|
91
|
+
TAccountTokenOwnerAccountX extends string
|
|
92
|
+
? WritableAccount<TAccountTokenOwnerAccountX>
|
|
93
|
+
: TAccountTokenOwnerAccountX,
|
|
94
|
+
TAccountTokenOwnerAccountY extends string
|
|
95
|
+
? WritableAccount<TAccountTokenOwnerAccountY>
|
|
96
|
+
: TAccountTokenOwnerAccountY,
|
|
97
|
+
TAccountTokenVaultX extends string
|
|
98
|
+
? WritableAccount<TAccountTokenVaultX>
|
|
99
|
+
: TAccountTokenVaultX,
|
|
100
|
+
TAccountTokenVaultY extends string
|
|
101
|
+
? WritableAccount<TAccountTokenVaultY>
|
|
102
|
+
: TAccountTokenVaultY,
|
|
103
|
+
TAccountTokenProgramX extends string
|
|
104
|
+
? ReadonlyAccount<TAccountTokenProgramX>
|
|
105
|
+
: TAccountTokenProgramX,
|
|
106
|
+
TAccountTokenProgramY extends string
|
|
107
|
+
? ReadonlyAccount<TAccountTokenProgramY>
|
|
108
|
+
: TAccountTokenProgramY,
|
|
109
|
+
TAccountLowerBinArray extends string
|
|
110
|
+
? ReadonlyAccount<TAccountLowerBinArray>
|
|
111
|
+
: TAccountLowerBinArray,
|
|
112
|
+
TAccountUpperBinArray extends string
|
|
113
|
+
? ReadonlyAccount<TAccountUpperBinArray>
|
|
114
|
+
: TAccountUpperBinArray,
|
|
115
|
+
...TRemainingAccounts,
|
|
116
|
+
]
|
|
117
|
+
>;
|
|
118
|
+
|
|
119
|
+
export type ClaimFeeInstructionData = {
|
|
120
|
+
discriminator: ReadonlyUint8Array;
|
|
121
|
+
lowerBinId: number;
|
|
122
|
+
upperBinId: number;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export type ClaimFeeInstructionDataArgs = {
|
|
126
|
+
lowerBinId: number;
|
|
127
|
+
upperBinId: number;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export function getClaimFeeInstructionDataEncoder(): FixedSizeEncoder<ClaimFeeInstructionDataArgs> {
|
|
131
|
+
return transformEncoder(
|
|
132
|
+
getStructEncoder([
|
|
133
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
134
|
+
["lowerBinId", getI32Encoder()],
|
|
135
|
+
["upperBinId", getI32Encoder()],
|
|
136
|
+
]),
|
|
137
|
+
(value) => ({ ...value, discriminator: CLAIM_FEE_DISCRIMINATOR }),
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function getClaimFeeInstructionDataDecoder(): FixedSizeDecoder<ClaimFeeInstructionData> {
|
|
142
|
+
return getStructDecoder([
|
|
143
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
144
|
+
["lowerBinId", getI32Decoder()],
|
|
145
|
+
["upperBinId", getI32Decoder()],
|
|
146
|
+
]);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function getClaimFeeInstructionDataCodec(): FixedSizeCodec<
|
|
150
|
+
ClaimFeeInstructionDataArgs,
|
|
151
|
+
ClaimFeeInstructionData
|
|
152
|
+
> {
|
|
153
|
+
return combineCodec(
|
|
154
|
+
getClaimFeeInstructionDataEncoder(),
|
|
155
|
+
getClaimFeeInstructionDataDecoder(),
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export type ClaimFeeInput<
|
|
160
|
+
TAccountOwner extends string = string,
|
|
161
|
+
TAccountPool extends string = string,
|
|
162
|
+
TAccountPosition extends string = string,
|
|
163
|
+
TAccountPositionTokenAccount extends string = string,
|
|
164
|
+
TAccountTokenMintX extends string = string,
|
|
165
|
+
TAccountTokenMintY extends string = string,
|
|
166
|
+
TAccountTokenOwnerAccountX extends string = string,
|
|
167
|
+
TAccountTokenOwnerAccountY extends string = string,
|
|
168
|
+
TAccountTokenVaultX extends string = string,
|
|
169
|
+
TAccountTokenVaultY extends string = string,
|
|
170
|
+
TAccountTokenProgramX extends string = string,
|
|
171
|
+
TAccountTokenProgramY extends string = string,
|
|
172
|
+
TAccountLowerBinArray extends string = string,
|
|
173
|
+
TAccountUpperBinArray extends string = string,
|
|
174
|
+
> = {
|
|
175
|
+
owner: TransactionSigner<TAccountOwner>;
|
|
176
|
+
pool: Address<TAccountPool>;
|
|
177
|
+
position: Address<TAccountPosition>;
|
|
178
|
+
positionTokenAccount: Address<TAccountPositionTokenAccount>;
|
|
179
|
+
tokenMintX: Address<TAccountTokenMintX>;
|
|
180
|
+
tokenMintY: Address<TAccountTokenMintY>;
|
|
181
|
+
tokenOwnerAccountX: Address<TAccountTokenOwnerAccountX>;
|
|
182
|
+
tokenOwnerAccountY: Address<TAccountTokenOwnerAccountY>;
|
|
183
|
+
tokenVaultX: Address<TAccountTokenVaultX>;
|
|
184
|
+
tokenVaultY: Address<TAccountTokenVaultY>;
|
|
185
|
+
tokenProgramX: Address<TAccountTokenProgramX>;
|
|
186
|
+
tokenProgramY: Address<TAccountTokenProgramY>;
|
|
187
|
+
lowerBinArray: Address<TAccountLowerBinArray>;
|
|
188
|
+
upperBinArray?: Address<TAccountUpperBinArray>;
|
|
189
|
+
lowerBinId: ClaimFeeInstructionDataArgs["lowerBinId"];
|
|
190
|
+
upperBinId: ClaimFeeInstructionDataArgs["upperBinId"];
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export function getClaimFeeInstruction<
|
|
194
|
+
TAccountOwner extends string,
|
|
195
|
+
TAccountPool extends string,
|
|
196
|
+
TAccountPosition extends string,
|
|
197
|
+
TAccountPositionTokenAccount extends string,
|
|
198
|
+
TAccountTokenMintX extends string,
|
|
199
|
+
TAccountTokenMintY extends string,
|
|
200
|
+
TAccountTokenOwnerAccountX extends string,
|
|
201
|
+
TAccountTokenOwnerAccountY extends string,
|
|
202
|
+
TAccountTokenVaultX extends string,
|
|
203
|
+
TAccountTokenVaultY extends string,
|
|
204
|
+
TAccountTokenProgramX extends string,
|
|
205
|
+
TAccountTokenProgramY extends string,
|
|
206
|
+
TAccountLowerBinArray extends string,
|
|
207
|
+
TAccountUpperBinArray extends string,
|
|
208
|
+
TProgramAddress extends Address = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
209
|
+
>(
|
|
210
|
+
input: ClaimFeeInput<
|
|
211
|
+
TAccountOwner,
|
|
212
|
+
TAccountPool,
|
|
213
|
+
TAccountPosition,
|
|
214
|
+
TAccountPositionTokenAccount,
|
|
215
|
+
TAccountTokenMintX,
|
|
216
|
+
TAccountTokenMintY,
|
|
217
|
+
TAccountTokenOwnerAccountX,
|
|
218
|
+
TAccountTokenOwnerAccountY,
|
|
219
|
+
TAccountTokenVaultX,
|
|
220
|
+
TAccountTokenVaultY,
|
|
221
|
+
TAccountTokenProgramX,
|
|
222
|
+
TAccountTokenProgramY,
|
|
223
|
+
TAccountLowerBinArray,
|
|
224
|
+
TAccountUpperBinArray
|
|
225
|
+
>,
|
|
226
|
+
config?: { programAddress?: TProgramAddress },
|
|
227
|
+
): ClaimFeeInstruction<
|
|
228
|
+
TProgramAddress,
|
|
229
|
+
TAccountOwner,
|
|
230
|
+
TAccountPool,
|
|
231
|
+
TAccountPosition,
|
|
232
|
+
TAccountPositionTokenAccount,
|
|
233
|
+
TAccountTokenMintX,
|
|
234
|
+
TAccountTokenMintY,
|
|
235
|
+
TAccountTokenOwnerAccountX,
|
|
236
|
+
TAccountTokenOwnerAccountY,
|
|
237
|
+
TAccountTokenVaultX,
|
|
238
|
+
TAccountTokenVaultY,
|
|
239
|
+
TAccountTokenProgramX,
|
|
240
|
+
TAccountTokenProgramY,
|
|
241
|
+
TAccountLowerBinArray,
|
|
242
|
+
TAccountUpperBinArray
|
|
243
|
+
> {
|
|
244
|
+
// Program address.
|
|
245
|
+
const programAddress = config?.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
|
|
246
|
+
|
|
247
|
+
// Original accounts.
|
|
248
|
+
const originalAccounts = {
|
|
249
|
+
owner: { value: input.owner ?? null, isWritable: false },
|
|
250
|
+
pool: { value: input.pool ?? null, isWritable: false },
|
|
251
|
+
position: { value: input.position ?? null, isWritable: true },
|
|
252
|
+
positionTokenAccount: {
|
|
253
|
+
value: input.positionTokenAccount ?? null,
|
|
254
|
+
isWritable: false,
|
|
255
|
+
},
|
|
256
|
+
tokenMintX: { value: input.tokenMintX ?? null, isWritable: false },
|
|
257
|
+
tokenMintY: { value: input.tokenMintY ?? null, isWritable: false },
|
|
258
|
+
tokenOwnerAccountX: {
|
|
259
|
+
value: input.tokenOwnerAccountX ?? null,
|
|
260
|
+
isWritable: true,
|
|
261
|
+
},
|
|
262
|
+
tokenOwnerAccountY: {
|
|
263
|
+
value: input.tokenOwnerAccountY ?? null,
|
|
264
|
+
isWritable: true,
|
|
265
|
+
},
|
|
266
|
+
tokenVaultX: { value: input.tokenVaultX ?? null, isWritable: true },
|
|
267
|
+
tokenVaultY: { value: input.tokenVaultY ?? null, isWritable: true },
|
|
268
|
+
tokenProgramX: { value: input.tokenProgramX ?? null, isWritable: false },
|
|
269
|
+
tokenProgramY: { value: input.tokenProgramY ?? null, isWritable: false },
|
|
270
|
+
lowerBinArray: { value: input.lowerBinArray ?? null, isWritable: false },
|
|
271
|
+
upperBinArray: { value: input.upperBinArray ?? null, isWritable: false },
|
|
272
|
+
};
|
|
273
|
+
const accounts = originalAccounts as Record<
|
|
274
|
+
keyof typeof originalAccounts,
|
|
275
|
+
ResolvedInstructionAccount
|
|
276
|
+
>;
|
|
277
|
+
|
|
278
|
+
// Original args.
|
|
279
|
+
const args = { ...input };
|
|
280
|
+
|
|
281
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
282
|
+
return Object.freeze({
|
|
283
|
+
accounts: [
|
|
284
|
+
getAccountMeta("owner", accounts.owner),
|
|
285
|
+
getAccountMeta("pool", accounts.pool),
|
|
286
|
+
getAccountMeta("position", accounts.position),
|
|
287
|
+
getAccountMeta("positionTokenAccount", accounts.positionTokenAccount),
|
|
288
|
+
getAccountMeta("tokenMintX", accounts.tokenMintX),
|
|
289
|
+
getAccountMeta("tokenMintY", accounts.tokenMintY),
|
|
290
|
+
getAccountMeta("tokenOwnerAccountX", accounts.tokenOwnerAccountX),
|
|
291
|
+
getAccountMeta("tokenOwnerAccountY", accounts.tokenOwnerAccountY),
|
|
292
|
+
getAccountMeta("tokenVaultX", accounts.tokenVaultX),
|
|
293
|
+
getAccountMeta("tokenVaultY", accounts.tokenVaultY),
|
|
294
|
+
getAccountMeta("tokenProgramX", accounts.tokenProgramX),
|
|
295
|
+
getAccountMeta("tokenProgramY", accounts.tokenProgramY),
|
|
296
|
+
getAccountMeta("lowerBinArray", accounts.lowerBinArray),
|
|
297
|
+
getAccountMeta("upperBinArray", accounts.upperBinArray),
|
|
298
|
+
],
|
|
299
|
+
data: getClaimFeeInstructionDataEncoder().encode(
|
|
300
|
+
args as ClaimFeeInstructionDataArgs,
|
|
301
|
+
),
|
|
302
|
+
programAddress,
|
|
303
|
+
} as ClaimFeeInstruction<
|
|
304
|
+
TProgramAddress,
|
|
305
|
+
TAccountOwner,
|
|
306
|
+
TAccountPool,
|
|
307
|
+
TAccountPosition,
|
|
308
|
+
TAccountPositionTokenAccount,
|
|
309
|
+
TAccountTokenMintX,
|
|
310
|
+
TAccountTokenMintY,
|
|
311
|
+
TAccountTokenOwnerAccountX,
|
|
312
|
+
TAccountTokenOwnerAccountY,
|
|
313
|
+
TAccountTokenVaultX,
|
|
314
|
+
TAccountTokenVaultY,
|
|
315
|
+
TAccountTokenProgramX,
|
|
316
|
+
TAccountTokenProgramY,
|
|
317
|
+
TAccountLowerBinArray,
|
|
318
|
+
TAccountUpperBinArray
|
|
319
|
+
>);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export type ParsedClaimFeeInstruction<
|
|
323
|
+
TProgram extends string = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
324
|
+
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
|
|
325
|
+
> = {
|
|
326
|
+
programAddress: Address<TProgram>;
|
|
327
|
+
accounts: {
|
|
328
|
+
owner: TAccountMetas[0];
|
|
329
|
+
pool: TAccountMetas[1];
|
|
330
|
+
position: TAccountMetas[2];
|
|
331
|
+
positionTokenAccount: TAccountMetas[3];
|
|
332
|
+
tokenMintX: TAccountMetas[4];
|
|
333
|
+
tokenMintY: TAccountMetas[5];
|
|
334
|
+
tokenOwnerAccountX: TAccountMetas[6];
|
|
335
|
+
tokenOwnerAccountY: TAccountMetas[7];
|
|
336
|
+
tokenVaultX: TAccountMetas[8];
|
|
337
|
+
tokenVaultY: TAccountMetas[9];
|
|
338
|
+
tokenProgramX: TAccountMetas[10];
|
|
339
|
+
tokenProgramY: TAccountMetas[11];
|
|
340
|
+
lowerBinArray: TAccountMetas[12];
|
|
341
|
+
upperBinArray?: TAccountMetas[13] | undefined;
|
|
342
|
+
};
|
|
343
|
+
data: ClaimFeeInstructionData;
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
export function parseClaimFeeInstruction<
|
|
347
|
+
TProgram extends string,
|
|
348
|
+
TAccountMetas extends readonly AccountMeta[],
|
|
349
|
+
>(
|
|
350
|
+
instruction: Instruction<TProgram> &
|
|
351
|
+
InstructionWithAccounts<TAccountMetas> &
|
|
352
|
+
InstructionWithData<ReadonlyUint8Array>,
|
|
353
|
+
): ParsedClaimFeeInstruction<TProgram, TAccountMetas> {
|
|
354
|
+
if (instruction.accounts.length < 14) {
|
|
355
|
+
throw new SolanaError(
|
|
356
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
357
|
+
{
|
|
358
|
+
actualAccountMetas: instruction.accounts.length,
|
|
359
|
+
expectedAccountMetas: 14,
|
|
360
|
+
},
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
let accountIndex = 0;
|
|
364
|
+
const getNextAccount = () => {
|
|
365
|
+
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
|
|
366
|
+
accountIndex += 1;
|
|
367
|
+
return accountMeta;
|
|
368
|
+
};
|
|
369
|
+
const getNextOptionalAccount = () => {
|
|
370
|
+
const accountMeta = getNextAccount();
|
|
371
|
+
return accountMeta.address === PICON_DLMM_PROGRAM_ADDRESS
|
|
372
|
+
? undefined
|
|
373
|
+
: accountMeta;
|
|
374
|
+
};
|
|
375
|
+
return {
|
|
376
|
+
programAddress: instruction.programAddress,
|
|
377
|
+
accounts: {
|
|
378
|
+
owner: getNextAccount(),
|
|
379
|
+
pool: getNextAccount(),
|
|
380
|
+
position: getNextAccount(),
|
|
381
|
+
positionTokenAccount: getNextAccount(),
|
|
382
|
+
tokenMintX: getNextAccount(),
|
|
383
|
+
tokenMintY: getNextAccount(),
|
|
384
|
+
tokenOwnerAccountX: getNextAccount(),
|
|
385
|
+
tokenOwnerAccountY: getNextAccount(),
|
|
386
|
+
tokenVaultX: getNextAccount(),
|
|
387
|
+
tokenVaultY: getNextAccount(),
|
|
388
|
+
tokenProgramX: getNextAccount(),
|
|
389
|
+
tokenProgramY: getNextAccount(),
|
|
390
|
+
lowerBinArray: getNextAccount(),
|
|
391
|
+
upperBinArray: getNextOptionalAccount(),
|
|
392
|
+
},
|
|
393
|
+
data: getClaimFeeInstructionDataDecoder().decode(instruction.data),
|
|
394
|
+
};
|
|
395
|
+
}
|