@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,435 @@
|
|
|
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
|
+
getArrayDecoder,
|
|
14
|
+
getArrayEncoder,
|
|
15
|
+
getBytesDecoder,
|
|
16
|
+
getBytesEncoder,
|
|
17
|
+
getI32Decoder,
|
|
18
|
+
getI32Encoder,
|
|
19
|
+
getStructDecoder,
|
|
20
|
+
getStructEncoder,
|
|
21
|
+
getU16Decoder,
|
|
22
|
+
getU16Encoder,
|
|
23
|
+
getU32Decoder,
|
|
24
|
+
getU32Encoder,
|
|
25
|
+
getU64Decoder,
|
|
26
|
+
getU64Encoder,
|
|
27
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
28
|
+
SolanaError,
|
|
29
|
+
transformEncoder,
|
|
30
|
+
type AccountMeta,
|
|
31
|
+
type AccountSignerMeta,
|
|
32
|
+
type Address,
|
|
33
|
+
type Codec,
|
|
34
|
+
type Decoder,
|
|
35
|
+
type Encoder,
|
|
36
|
+
type Instruction,
|
|
37
|
+
type InstructionWithAccounts,
|
|
38
|
+
type InstructionWithData,
|
|
39
|
+
type ReadonlyAccount,
|
|
40
|
+
type ReadonlySignerAccount,
|
|
41
|
+
type ReadonlyUint8Array,
|
|
42
|
+
type TransactionSigner,
|
|
43
|
+
type WritableAccount,
|
|
44
|
+
} from "@solana/kit";
|
|
45
|
+
import {
|
|
46
|
+
getAccountMetaFactory,
|
|
47
|
+
type ResolvedInstructionAccount,
|
|
48
|
+
} from "@solana/program-client-core";
|
|
49
|
+
import { PICON_DLMM_PROGRAM_ADDRESS } from "../programs";
|
|
50
|
+
import {
|
|
51
|
+
getDistributionModeDecoder,
|
|
52
|
+
getDistributionModeEncoder,
|
|
53
|
+
type DistributionMode,
|
|
54
|
+
type DistributionModeArgs,
|
|
55
|
+
} from "../types";
|
|
56
|
+
|
|
57
|
+
export const DEPOSIT_BY_WEIGHT_DISCRIMINATOR: ReadonlyUint8Array =
|
|
58
|
+
new Uint8Array([121, 187, 132, 201, 131, 190, 200, 124]);
|
|
59
|
+
|
|
60
|
+
export function getDepositByWeightDiscriminatorBytes(): ReadonlyUint8Array {
|
|
61
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
62
|
+
DEPOSIT_BY_WEIGHT_DISCRIMINATOR,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type DepositByWeightInstruction<
|
|
67
|
+
TProgram extends string = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
68
|
+
TAccountOwner extends string | AccountMeta<string> = string,
|
|
69
|
+
TAccountPool extends string | AccountMeta<string> = string,
|
|
70
|
+
TAccountPosition extends string | AccountMeta<string> = string,
|
|
71
|
+
TAccountPositionTokenAccount extends string | AccountMeta<string> = string,
|
|
72
|
+
TAccountTokenMintX extends string | AccountMeta<string> = string,
|
|
73
|
+
TAccountTokenMintY extends string | AccountMeta<string> = string,
|
|
74
|
+
TAccountTokenOwnerAccountX extends string | AccountMeta<string> = string,
|
|
75
|
+
TAccountTokenOwnerAccountY extends string | AccountMeta<string> = string,
|
|
76
|
+
TAccountTokenVaultX extends string | AccountMeta<string> = string,
|
|
77
|
+
TAccountTokenVaultY extends string | AccountMeta<string> = string,
|
|
78
|
+
TAccountTokenProgramX extends string | AccountMeta<string> = string,
|
|
79
|
+
TAccountTokenProgramY extends string | AccountMeta<string> = string,
|
|
80
|
+
TAccountLowerBinArray extends string | AccountMeta<string> = string,
|
|
81
|
+
TAccountUpperBinArray extends string | AccountMeta<string> = string,
|
|
82
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
83
|
+
> = Instruction<TProgram> &
|
|
84
|
+
InstructionWithData<ReadonlyUint8Array> &
|
|
85
|
+
InstructionWithAccounts<
|
|
86
|
+
[
|
|
87
|
+
TAccountOwner extends string
|
|
88
|
+
? ReadonlySignerAccount<TAccountOwner> &
|
|
89
|
+
AccountSignerMeta<TAccountOwner>
|
|
90
|
+
: TAccountOwner,
|
|
91
|
+
TAccountPool extends string
|
|
92
|
+
? WritableAccount<TAccountPool>
|
|
93
|
+
: TAccountPool,
|
|
94
|
+
TAccountPosition extends string
|
|
95
|
+
? WritableAccount<TAccountPosition>
|
|
96
|
+
: TAccountPosition,
|
|
97
|
+
TAccountPositionTokenAccount extends string
|
|
98
|
+
? ReadonlyAccount<TAccountPositionTokenAccount>
|
|
99
|
+
: TAccountPositionTokenAccount,
|
|
100
|
+
TAccountTokenMintX extends string
|
|
101
|
+
? ReadonlyAccount<TAccountTokenMintX>
|
|
102
|
+
: TAccountTokenMintX,
|
|
103
|
+
TAccountTokenMintY extends string
|
|
104
|
+
? ReadonlyAccount<TAccountTokenMintY>
|
|
105
|
+
: TAccountTokenMintY,
|
|
106
|
+
TAccountTokenOwnerAccountX extends string
|
|
107
|
+
? WritableAccount<TAccountTokenOwnerAccountX>
|
|
108
|
+
: TAccountTokenOwnerAccountX,
|
|
109
|
+
TAccountTokenOwnerAccountY extends string
|
|
110
|
+
? WritableAccount<TAccountTokenOwnerAccountY>
|
|
111
|
+
: TAccountTokenOwnerAccountY,
|
|
112
|
+
TAccountTokenVaultX extends string
|
|
113
|
+
? WritableAccount<TAccountTokenVaultX>
|
|
114
|
+
: TAccountTokenVaultX,
|
|
115
|
+
TAccountTokenVaultY extends string
|
|
116
|
+
? WritableAccount<TAccountTokenVaultY>
|
|
117
|
+
: TAccountTokenVaultY,
|
|
118
|
+
TAccountTokenProgramX extends string
|
|
119
|
+
? ReadonlyAccount<TAccountTokenProgramX>
|
|
120
|
+
: TAccountTokenProgramX,
|
|
121
|
+
TAccountTokenProgramY extends string
|
|
122
|
+
? ReadonlyAccount<TAccountTokenProgramY>
|
|
123
|
+
: TAccountTokenProgramY,
|
|
124
|
+
TAccountLowerBinArray extends string
|
|
125
|
+
? WritableAccount<TAccountLowerBinArray>
|
|
126
|
+
: TAccountLowerBinArray,
|
|
127
|
+
TAccountUpperBinArray extends string
|
|
128
|
+
? WritableAccount<TAccountUpperBinArray>
|
|
129
|
+
: TAccountUpperBinArray,
|
|
130
|
+
...TRemainingAccounts,
|
|
131
|
+
]
|
|
132
|
+
>;
|
|
133
|
+
|
|
134
|
+
export type DepositByWeightInstructionData = {
|
|
135
|
+
discriminator: ReadonlyUint8Array;
|
|
136
|
+
amountX: bigint;
|
|
137
|
+
amountY: bigint;
|
|
138
|
+
activeBinId: number;
|
|
139
|
+
maxActiveBinSlippage: number;
|
|
140
|
+
distributionMode: DistributionMode;
|
|
141
|
+
lowerBinId: number;
|
|
142
|
+
binWeights: Array<number>;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export type DepositByWeightInstructionDataArgs = {
|
|
146
|
+
amountX: number | bigint;
|
|
147
|
+
amountY: number | bigint;
|
|
148
|
+
activeBinId: number;
|
|
149
|
+
maxActiveBinSlippage: number;
|
|
150
|
+
distributionMode: DistributionModeArgs;
|
|
151
|
+
lowerBinId: number;
|
|
152
|
+
binWeights: Array<number>;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export function getDepositByWeightInstructionDataEncoder(): Encoder<DepositByWeightInstructionDataArgs> {
|
|
156
|
+
return transformEncoder(
|
|
157
|
+
getStructEncoder([
|
|
158
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
159
|
+
["amountX", getU64Encoder()],
|
|
160
|
+
["amountY", getU64Encoder()],
|
|
161
|
+
["activeBinId", getI32Encoder()],
|
|
162
|
+
["maxActiveBinSlippage", getU32Encoder()],
|
|
163
|
+
["distributionMode", getDistributionModeEncoder()],
|
|
164
|
+
["lowerBinId", getI32Encoder()],
|
|
165
|
+
["binWeights", getArrayEncoder(getU16Encoder())],
|
|
166
|
+
]),
|
|
167
|
+
(value) => ({ ...value, discriminator: DEPOSIT_BY_WEIGHT_DISCRIMINATOR }),
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export function getDepositByWeightInstructionDataDecoder(): Decoder<DepositByWeightInstructionData> {
|
|
172
|
+
return getStructDecoder([
|
|
173
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
174
|
+
["amountX", getU64Decoder()],
|
|
175
|
+
["amountY", getU64Decoder()],
|
|
176
|
+
["activeBinId", getI32Decoder()],
|
|
177
|
+
["maxActiveBinSlippage", getU32Decoder()],
|
|
178
|
+
["distributionMode", getDistributionModeDecoder()],
|
|
179
|
+
["lowerBinId", getI32Decoder()],
|
|
180
|
+
["binWeights", getArrayDecoder(getU16Decoder())],
|
|
181
|
+
]);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export function getDepositByWeightInstructionDataCodec(): Codec<
|
|
185
|
+
DepositByWeightInstructionDataArgs,
|
|
186
|
+
DepositByWeightInstructionData
|
|
187
|
+
> {
|
|
188
|
+
return combineCodec(
|
|
189
|
+
getDepositByWeightInstructionDataEncoder(),
|
|
190
|
+
getDepositByWeightInstructionDataDecoder(),
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export type DepositByWeightInput<
|
|
195
|
+
TAccountOwner extends string = string,
|
|
196
|
+
TAccountPool extends string = string,
|
|
197
|
+
TAccountPosition extends string = string,
|
|
198
|
+
TAccountPositionTokenAccount extends string = string,
|
|
199
|
+
TAccountTokenMintX extends string = string,
|
|
200
|
+
TAccountTokenMintY extends string = string,
|
|
201
|
+
TAccountTokenOwnerAccountX extends string = string,
|
|
202
|
+
TAccountTokenOwnerAccountY extends string = string,
|
|
203
|
+
TAccountTokenVaultX extends string = string,
|
|
204
|
+
TAccountTokenVaultY extends string = string,
|
|
205
|
+
TAccountTokenProgramX extends string = string,
|
|
206
|
+
TAccountTokenProgramY extends string = string,
|
|
207
|
+
TAccountLowerBinArray extends string = string,
|
|
208
|
+
TAccountUpperBinArray extends string = string,
|
|
209
|
+
> = {
|
|
210
|
+
owner: TransactionSigner<TAccountOwner>;
|
|
211
|
+
pool: Address<TAccountPool>;
|
|
212
|
+
position: Address<TAccountPosition>;
|
|
213
|
+
positionTokenAccount: Address<TAccountPositionTokenAccount>;
|
|
214
|
+
tokenMintX: Address<TAccountTokenMintX>;
|
|
215
|
+
tokenMintY: Address<TAccountTokenMintY>;
|
|
216
|
+
tokenOwnerAccountX: Address<TAccountTokenOwnerAccountX>;
|
|
217
|
+
tokenOwnerAccountY: Address<TAccountTokenOwnerAccountY>;
|
|
218
|
+
tokenVaultX: Address<TAccountTokenVaultX>;
|
|
219
|
+
tokenVaultY: Address<TAccountTokenVaultY>;
|
|
220
|
+
tokenProgramX: Address<TAccountTokenProgramX>;
|
|
221
|
+
tokenProgramY: Address<TAccountTokenProgramY>;
|
|
222
|
+
lowerBinArray: Address<TAccountLowerBinArray>;
|
|
223
|
+
upperBinArray?: Address<TAccountUpperBinArray>;
|
|
224
|
+
amountX: DepositByWeightInstructionDataArgs["amountX"];
|
|
225
|
+
amountY: DepositByWeightInstructionDataArgs["amountY"];
|
|
226
|
+
activeBinId: DepositByWeightInstructionDataArgs["activeBinId"];
|
|
227
|
+
maxActiveBinSlippage: DepositByWeightInstructionDataArgs["maxActiveBinSlippage"];
|
|
228
|
+
distributionMode: DepositByWeightInstructionDataArgs["distributionMode"];
|
|
229
|
+
lowerBinId: DepositByWeightInstructionDataArgs["lowerBinId"];
|
|
230
|
+
binWeights: DepositByWeightInstructionDataArgs["binWeights"];
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
export function getDepositByWeightInstruction<
|
|
234
|
+
TAccountOwner extends string,
|
|
235
|
+
TAccountPool extends string,
|
|
236
|
+
TAccountPosition extends string,
|
|
237
|
+
TAccountPositionTokenAccount extends string,
|
|
238
|
+
TAccountTokenMintX extends string,
|
|
239
|
+
TAccountTokenMintY extends string,
|
|
240
|
+
TAccountTokenOwnerAccountX extends string,
|
|
241
|
+
TAccountTokenOwnerAccountY extends string,
|
|
242
|
+
TAccountTokenVaultX extends string,
|
|
243
|
+
TAccountTokenVaultY extends string,
|
|
244
|
+
TAccountTokenProgramX extends string,
|
|
245
|
+
TAccountTokenProgramY extends string,
|
|
246
|
+
TAccountLowerBinArray extends string,
|
|
247
|
+
TAccountUpperBinArray extends string,
|
|
248
|
+
TProgramAddress extends Address = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
249
|
+
>(
|
|
250
|
+
input: DepositByWeightInput<
|
|
251
|
+
TAccountOwner,
|
|
252
|
+
TAccountPool,
|
|
253
|
+
TAccountPosition,
|
|
254
|
+
TAccountPositionTokenAccount,
|
|
255
|
+
TAccountTokenMintX,
|
|
256
|
+
TAccountTokenMintY,
|
|
257
|
+
TAccountTokenOwnerAccountX,
|
|
258
|
+
TAccountTokenOwnerAccountY,
|
|
259
|
+
TAccountTokenVaultX,
|
|
260
|
+
TAccountTokenVaultY,
|
|
261
|
+
TAccountTokenProgramX,
|
|
262
|
+
TAccountTokenProgramY,
|
|
263
|
+
TAccountLowerBinArray,
|
|
264
|
+
TAccountUpperBinArray
|
|
265
|
+
>,
|
|
266
|
+
config?: { programAddress?: TProgramAddress },
|
|
267
|
+
): DepositByWeightInstruction<
|
|
268
|
+
TProgramAddress,
|
|
269
|
+
TAccountOwner,
|
|
270
|
+
TAccountPool,
|
|
271
|
+
TAccountPosition,
|
|
272
|
+
TAccountPositionTokenAccount,
|
|
273
|
+
TAccountTokenMintX,
|
|
274
|
+
TAccountTokenMintY,
|
|
275
|
+
TAccountTokenOwnerAccountX,
|
|
276
|
+
TAccountTokenOwnerAccountY,
|
|
277
|
+
TAccountTokenVaultX,
|
|
278
|
+
TAccountTokenVaultY,
|
|
279
|
+
TAccountTokenProgramX,
|
|
280
|
+
TAccountTokenProgramY,
|
|
281
|
+
TAccountLowerBinArray,
|
|
282
|
+
TAccountUpperBinArray
|
|
283
|
+
> {
|
|
284
|
+
// Program address.
|
|
285
|
+
const programAddress = config?.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
|
|
286
|
+
|
|
287
|
+
// Original accounts.
|
|
288
|
+
const originalAccounts = {
|
|
289
|
+
owner: { value: input.owner ?? null, isWritable: false },
|
|
290
|
+
pool: { value: input.pool ?? null, isWritable: true },
|
|
291
|
+
position: { value: input.position ?? null, isWritable: true },
|
|
292
|
+
positionTokenAccount: {
|
|
293
|
+
value: input.positionTokenAccount ?? null,
|
|
294
|
+
isWritable: false,
|
|
295
|
+
},
|
|
296
|
+
tokenMintX: { value: input.tokenMintX ?? null, isWritable: false },
|
|
297
|
+
tokenMintY: { value: input.tokenMintY ?? null, isWritable: false },
|
|
298
|
+
tokenOwnerAccountX: {
|
|
299
|
+
value: input.tokenOwnerAccountX ?? null,
|
|
300
|
+
isWritable: true,
|
|
301
|
+
},
|
|
302
|
+
tokenOwnerAccountY: {
|
|
303
|
+
value: input.tokenOwnerAccountY ?? null,
|
|
304
|
+
isWritable: true,
|
|
305
|
+
},
|
|
306
|
+
tokenVaultX: { value: input.tokenVaultX ?? null, isWritable: true },
|
|
307
|
+
tokenVaultY: { value: input.tokenVaultY ?? null, isWritable: true },
|
|
308
|
+
tokenProgramX: { value: input.tokenProgramX ?? null, isWritable: false },
|
|
309
|
+
tokenProgramY: { value: input.tokenProgramY ?? null, isWritable: false },
|
|
310
|
+
lowerBinArray: { value: input.lowerBinArray ?? null, isWritable: true },
|
|
311
|
+
upperBinArray: { value: input.upperBinArray ?? null, isWritable: true },
|
|
312
|
+
};
|
|
313
|
+
const accounts = originalAccounts as Record<
|
|
314
|
+
keyof typeof originalAccounts,
|
|
315
|
+
ResolvedInstructionAccount
|
|
316
|
+
>;
|
|
317
|
+
|
|
318
|
+
// Original args.
|
|
319
|
+
const args = { ...input };
|
|
320
|
+
|
|
321
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
322
|
+
return Object.freeze({
|
|
323
|
+
accounts: [
|
|
324
|
+
getAccountMeta("owner", accounts.owner),
|
|
325
|
+
getAccountMeta("pool", accounts.pool),
|
|
326
|
+
getAccountMeta("position", accounts.position),
|
|
327
|
+
getAccountMeta("positionTokenAccount", accounts.positionTokenAccount),
|
|
328
|
+
getAccountMeta("tokenMintX", accounts.tokenMintX),
|
|
329
|
+
getAccountMeta("tokenMintY", accounts.tokenMintY),
|
|
330
|
+
getAccountMeta("tokenOwnerAccountX", accounts.tokenOwnerAccountX),
|
|
331
|
+
getAccountMeta("tokenOwnerAccountY", accounts.tokenOwnerAccountY),
|
|
332
|
+
getAccountMeta("tokenVaultX", accounts.tokenVaultX),
|
|
333
|
+
getAccountMeta("tokenVaultY", accounts.tokenVaultY),
|
|
334
|
+
getAccountMeta("tokenProgramX", accounts.tokenProgramX),
|
|
335
|
+
getAccountMeta("tokenProgramY", accounts.tokenProgramY),
|
|
336
|
+
getAccountMeta("lowerBinArray", accounts.lowerBinArray),
|
|
337
|
+
getAccountMeta("upperBinArray", accounts.upperBinArray),
|
|
338
|
+
],
|
|
339
|
+
data: getDepositByWeightInstructionDataEncoder().encode(
|
|
340
|
+
args as DepositByWeightInstructionDataArgs,
|
|
341
|
+
),
|
|
342
|
+
programAddress,
|
|
343
|
+
} as DepositByWeightInstruction<
|
|
344
|
+
TProgramAddress,
|
|
345
|
+
TAccountOwner,
|
|
346
|
+
TAccountPool,
|
|
347
|
+
TAccountPosition,
|
|
348
|
+
TAccountPositionTokenAccount,
|
|
349
|
+
TAccountTokenMintX,
|
|
350
|
+
TAccountTokenMintY,
|
|
351
|
+
TAccountTokenOwnerAccountX,
|
|
352
|
+
TAccountTokenOwnerAccountY,
|
|
353
|
+
TAccountTokenVaultX,
|
|
354
|
+
TAccountTokenVaultY,
|
|
355
|
+
TAccountTokenProgramX,
|
|
356
|
+
TAccountTokenProgramY,
|
|
357
|
+
TAccountLowerBinArray,
|
|
358
|
+
TAccountUpperBinArray
|
|
359
|
+
>);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export type ParsedDepositByWeightInstruction<
|
|
363
|
+
TProgram extends string = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
364
|
+
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
|
|
365
|
+
> = {
|
|
366
|
+
programAddress: Address<TProgram>;
|
|
367
|
+
accounts: {
|
|
368
|
+
owner: TAccountMetas[0];
|
|
369
|
+
pool: TAccountMetas[1];
|
|
370
|
+
position: TAccountMetas[2];
|
|
371
|
+
positionTokenAccount: TAccountMetas[3];
|
|
372
|
+
tokenMintX: TAccountMetas[4];
|
|
373
|
+
tokenMintY: TAccountMetas[5];
|
|
374
|
+
tokenOwnerAccountX: TAccountMetas[6];
|
|
375
|
+
tokenOwnerAccountY: TAccountMetas[7];
|
|
376
|
+
tokenVaultX: TAccountMetas[8];
|
|
377
|
+
tokenVaultY: TAccountMetas[9];
|
|
378
|
+
tokenProgramX: TAccountMetas[10];
|
|
379
|
+
tokenProgramY: TAccountMetas[11];
|
|
380
|
+
lowerBinArray: TAccountMetas[12];
|
|
381
|
+
upperBinArray?: TAccountMetas[13] | undefined;
|
|
382
|
+
};
|
|
383
|
+
data: DepositByWeightInstructionData;
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
export function parseDepositByWeightInstruction<
|
|
387
|
+
TProgram extends string,
|
|
388
|
+
TAccountMetas extends readonly AccountMeta[],
|
|
389
|
+
>(
|
|
390
|
+
instruction: Instruction<TProgram> &
|
|
391
|
+
InstructionWithAccounts<TAccountMetas> &
|
|
392
|
+
InstructionWithData<ReadonlyUint8Array>,
|
|
393
|
+
): ParsedDepositByWeightInstruction<TProgram, TAccountMetas> {
|
|
394
|
+
if (instruction.accounts.length < 14) {
|
|
395
|
+
throw new SolanaError(
|
|
396
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
397
|
+
{
|
|
398
|
+
actualAccountMetas: instruction.accounts.length,
|
|
399
|
+
expectedAccountMetas: 14,
|
|
400
|
+
},
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
let accountIndex = 0;
|
|
404
|
+
const getNextAccount = () => {
|
|
405
|
+
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
|
|
406
|
+
accountIndex += 1;
|
|
407
|
+
return accountMeta;
|
|
408
|
+
};
|
|
409
|
+
const getNextOptionalAccount = () => {
|
|
410
|
+
const accountMeta = getNextAccount();
|
|
411
|
+
return accountMeta.address === PICON_DLMM_PROGRAM_ADDRESS
|
|
412
|
+
? undefined
|
|
413
|
+
: accountMeta;
|
|
414
|
+
};
|
|
415
|
+
return {
|
|
416
|
+
programAddress: instruction.programAddress,
|
|
417
|
+
accounts: {
|
|
418
|
+
owner: getNextAccount(),
|
|
419
|
+
pool: getNextAccount(),
|
|
420
|
+
position: getNextAccount(),
|
|
421
|
+
positionTokenAccount: getNextAccount(),
|
|
422
|
+
tokenMintX: getNextAccount(),
|
|
423
|
+
tokenMintY: getNextAccount(),
|
|
424
|
+
tokenOwnerAccountX: getNextAccount(),
|
|
425
|
+
tokenOwnerAccountY: getNextAccount(),
|
|
426
|
+
tokenVaultX: getNextAccount(),
|
|
427
|
+
tokenVaultY: getNextAccount(),
|
|
428
|
+
tokenProgramX: getNextAccount(),
|
|
429
|
+
tokenProgramY: getNextAccount(),
|
|
430
|
+
lowerBinArray: getNextAccount(),
|
|
431
|
+
upperBinArray: getNextOptionalAccount(),
|
|
432
|
+
},
|
|
433
|
+
data: getDepositByWeightInstructionDataDecoder().decode(instruction.data),
|
|
434
|
+
};
|
|
435
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export * from "./acceptAdminAuthority";
|
|
10
|
+
export * from "./claimFee";
|
|
11
|
+
export * from "./claimProtocolFee";
|
|
12
|
+
export * from "./closePosition";
|
|
13
|
+
export * from "./createAdminConfig";
|
|
14
|
+
export * from "./createBinArray";
|
|
15
|
+
export * from "./createPool";
|
|
16
|
+
export * from "./deleteBinArray";
|
|
17
|
+
export * from "./depositByWeight";
|
|
18
|
+
export * from "./openPosition";
|
|
19
|
+
export * from "./setMetadataUpdateAuthority";
|
|
20
|
+
export * from "./setPoolDynamicFeeConfig";
|
|
21
|
+
export * from "./setPoolProtocolShare";
|
|
22
|
+
export * from "./swap";
|
|
23
|
+
export * from "./syncPool";
|
|
24
|
+
export * from "./transferAdminAuthority";
|
|
25
|
+
export * from "./withdraw";
|