@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,803 @@
|
|
|
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
|
+
assertIsInstructionWithAccounts,
|
|
11
|
+
containsBytes,
|
|
12
|
+
extendClient,
|
|
13
|
+
fixEncoderSize,
|
|
14
|
+
getBytesEncoder,
|
|
15
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT,
|
|
16
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
|
|
17
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
|
|
18
|
+
SolanaError,
|
|
19
|
+
type Address,
|
|
20
|
+
type ClientWithPayer,
|
|
21
|
+
type ClientWithRpc,
|
|
22
|
+
type ClientWithTransactionPlanning,
|
|
23
|
+
type ClientWithTransactionSending,
|
|
24
|
+
type ExtendedClient,
|
|
25
|
+
type GetAccountInfoApi,
|
|
26
|
+
type GetMultipleAccountsApi,
|
|
27
|
+
type Instruction,
|
|
28
|
+
type InstructionWithData,
|
|
29
|
+
type ReadonlyUint8Array,
|
|
30
|
+
} from "@solana/kit";
|
|
31
|
+
import {
|
|
32
|
+
addSelfFetchFunctions,
|
|
33
|
+
addSelfPlanAndSendFunctions,
|
|
34
|
+
type SelfFetchFunctions,
|
|
35
|
+
type SelfPlanAndSendFunctions,
|
|
36
|
+
} from "@solana/program-client-core";
|
|
37
|
+
import {
|
|
38
|
+
getAdminConfigCodec,
|
|
39
|
+
getBinArrayCodec,
|
|
40
|
+
getPoolCodec,
|
|
41
|
+
getPositionCodec,
|
|
42
|
+
type AdminConfig,
|
|
43
|
+
type AdminConfigArgs,
|
|
44
|
+
type BinArray,
|
|
45
|
+
type BinArrayArgs,
|
|
46
|
+
type Pool,
|
|
47
|
+
type PoolArgs,
|
|
48
|
+
type Position,
|
|
49
|
+
type PositionArgs,
|
|
50
|
+
} from "../accounts";
|
|
51
|
+
import {
|
|
52
|
+
getAcceptAdminAuthorityInstructionAsync,
|
|
53
|
+
getClaimFeeInstruction,
|
|
54
|
+
getClaimProtocolFeeInstructionAsync,
|
|
55
|
+
getClosePositionInstructionAsync,
|
|
56
|
+
getCreateAdminConfigInstructionAsync,
|
|
57
|
+
getCreateBinArrayInstructionAsync,
|
|
58
|
+
getCreatePoolInstructionAsync,
|
|
59
|
+
getDeleteBinArrayInstructionAsync,
|
|
60
|
+
getDepositByWeightInstruction,
|
|
61
|
+
getOpenPositionInstructionAsync,
|
|
62
|
+
getSetMetadataUpdateAuthorityInstructionAsync,
|
|
63
|
+
getSetPoolDynamicFeeConfigInstructionAsync,
|
|
64
|
+
getSetPoolProtocolShareInstructionAsync,
|
|
65
|
+
getSwapInstruction,
|
|
66
|
+
getSyncPoolInstruction,
|
|
67
|
+
getTransferAdminAuthorityInstructionAsync,
|
|
68
|
+
getWithdrawInstruction,
|
|
69
|
+
parseAcceptAdminAuthorityInstruction,
|
|
70
|
+
parseClaimFeeInstruction,
|
|
71
|
+
parseClaimProtocolFeeInstruction,
|
|
72
|
+
parseClosePositionInstruction,
|
|
73
|
+
parseCreateAdminConfigInstruction,
|
|
74
|
+
parseCreateBinArrayInstruction,
|
|
75
|
+
parseCreatePoolInstruction,
|
|
76
|
+
parseDeleteBinArrayInstruction,
|
|
77
|
+
parseDepositByWeightInstruction,
|
|
78
|
+
parseOpenPositionInstruction,
|
|
79
|
+
parseSetMetadataUpdateAuthorityInstruction,
|
|
80
|
+
parseSetPoolDynamicFeeConfigInstruction,
|
|
81
|
+
parseSetPoolProtocolShareInstruction,
|
|
82
|
+
parseSwapInstruction,
|
|
83
|
+
parseSyncPoolInstruction,
|
|
84
|
+
parseTransferAdminAuthorityInstruction,
|
|
85
|
+
parseWithdrawInstruction,
|
|
86
|
+
type AcceptAdminAuthorityAsyncInput,
|
|
87
|
+
type ClaimFeeInput,
|
|
88
|
+
type ClaimProtocolFeeAsyncInput,
|
|
89
|
+
type ClosePositionAsyncInput,
|
|
90
|
+
type CreateAdminConfigAsyncInput,
|
|
91
|
+
type CreateBinArrayAsyncInput,
|
|
92
|
+
type CreatePoolAsyncInput,
|
|
93
|
+
type DeleteBinArrayAsyncInput,
|
|
94
|
+
type DepositByWeightInput,
|
|
95
|
+
type OpenPositionAsyncInput,
|
|
96
|
+
type ParsedAcceptAdminAuthorityInstruction,
|
|
97
|
+
type ParsedClaimFeeInstruction,
|
|
98
|
+
type ParsedClaimProtocolFeeInstruction,
|
|
99
|
+
type ParsedClosePositionInstruction,
|
|
100
|
+
type ParsedCreateAdminConfigInstruction,
|
|
101
|
+
type ParsedCreateBinArrayInstruction,
|
|
102
|
+
type ParsedCreatePoolInstruction,
|
|
103
|
+
type ParsedDeleteBinArrayInstruction,
|
|
104
|
+
type ParsedDepositByWeightInstruction,
|
|
105
|
+
type ParsedOpenPositionInstruction,
|
|
106
|
+
type ParsedSetMetadataUpdateAuthorityInstruction,
|
|
107
|
+
type ParsedSetPoolDynamicFeeConfigInstruction,
|
|
108
|
+
type ParsedSetPoolProtocolShareInstruction,
|
|
109
|
+
type ParsedSwapInstruction,
|
|
110
|
+
type ParsedSyncPoolInstruction,
|
|
111
|
+
type ParsedTransferAdminAuthorityInstruction,
|
|
112
|
+
type ParsedWithdrawInstruction,
|
|
113
|
+
type SetMetadataUpdateAuthorityAsyncInput,
|
|
114
|
+
type SetPoolDynamicFeeConfigAsyncInput,
|
|
115
|
+
type SetPoolProtocolShareAsyncInput,
|
|
116
|
+
type SwapInput,
|
|
117
|
+
type SyncPoolInput,
|
|
118
|
+
type TransferAdminAuthorityAsyncInput,
|
|
119
|
+
type WithdrawInput,
|
|
120
|
+
} from "../instructions";
|
|
121
|
+
import {
|
|
122
|
+
findAdminConfigPda,
|
|
123
|
+
findBinArrayPda,
|
|
124
|
+
findPoolPda,
|
|
125
|
+
findPositionPda,
|
|
126
|
+
} from "../pdas";
|
|
127
|
+
|
|
128
|
+
export const PICON_DLMM_PROGRAM_ADDRESS =
|
|
129
|
+
"pDLMMk3KW3CUSxE1Wgjhx3jSmm2spe6Ry7Mq2HT26rC" as Address<"pDLMMk3KW3CUSxE1Wgjhx3jSmm2spe6Ry7Mq2HT26rC">;
|
|
130
|
+
|
|
131
|
+
export enum PiconDlmmAccount {
|
|
132
|
+
AdminConfig,
|
|
133
|
+
BinArray,
|
|
134
|
+
Pool,
|
|
135
|
+
Position,
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function identifyPiconDlmmAccount(
|
|
139
|
+
account: { data: ReadonlyUint8Array } | ReadonlyUint8Array,
|
|
140
|
+
): PiconDlmmAccount {
|
|
141
|
+
const data = "data" in account ? account.data : account;
|
|
142
|
+
if (
|
|
143
|
+
containsBytes(
|
|
144
|
+
data,
|
|
145
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
146
|
+
new Uint8Array([156, 10, 79, 161, 71, 9, 62, 77]),
|
|
147
|
+
),
|
|
148
|
+
0,
|
|
149
|
+
)
|
|
150
|
+
) {
|
|
151
|
+
return PiconDlmmAccount.AdminConfig;
|
|
152
|
+
}
|
|
153
|
+
if (
|
|
154
|
+
containsBytes(
|
|
155
|
+
data,
|
|
156
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
157
|
+
new Uint8Array([92, 142, 92, 220, 5, 148, 70, 181]),
|
|
158
|
+
),
|
|
159
|
+
0,
|
|
160
|
+
)
|
|
161
|
+
) {
|
|
162
|
+
return PiconDlmmAccount.BinArray;
|
|
163
|
+
}
|
|
164
|
+
if (
|
|
165
|
+
containsBytes(
|
|
166
|
+
data,
|
|
167
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
168
|
+
new Uint8Array([241, 154, 109, 4, 17, 177, 109, 188]),
|
|
169
|
+
),
|
|
170
|
+
0,
|
|
171
|
+
)
|
|
172
|
+
) {
|
|
173
|
+
return PiconDlmmAccount.Pool;
|
|
174
|
+
}
|
|
175
|
+
if (
|
|
176
|
+
containsBytes(
|
|
177
|
+
data,
|
|
178
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
179
|
+
new Uint8Array([170, 188, 143, 228, 122, 64, 247, 208]),
|
|
180
|
+
),
|
|
181
|
+
0,
|
|
182
|
+
)
|
|
183
|
+
) {
|
|
184
|
+
return PiconDlmmAccount.Position;
|
|
185
|
+
}
|
|
186
|
+
throw new SolanaError(
|
|
187
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT,
|
|
188
|
+
{ accountData: data, programName: "piconDlmm" },
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export enum PiconDlmmInstruction {
|
|
193
|
+
AcceptAdminAuthority,
|
|
194
|
+
ClaimFee,
|
|
195
|
+
ClaimProtocolFee,
|
|
196
|
+
ClosePosition,
|
|
197
|
+
CreateAdminConfig,
|
|
198
|
+
CreateBinArray,
|
|
199
|
+
CreatePool,
|
|
200
|
+
DeleteBinArray,
|
|
201
|
+
DepositByWeight,
|
|
202
|
+
OpenPosition,
|
|
203
|
+
SetMetadataUpdateAuthority,
|
|
204
|
+
SetPoolDynamicFeeConfig,
|
|
205
|
+
SetPoolProtocolShare,
|
|
206
|
+
Swap,
|
|
207
|
+
SyncPool,
|
|
208
|
+
TransferAdminAuthority,
|
|
209
|
+
Withdraw,
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export function identifyPiconDlmmInstruction(
|
|
213
|
+
instruction: { data: ReadonlyUint8Array } | ReadonlyUint8Array,
|
|
214
|
+
): PiconDlmmInstruction {
|
|
215
|
+
const data = "data" in instruction ? instruction.data : instruction;
|
|
216
|
+
if (
|
|
217
|
+
containsBytes(
|
|
218
|
+
data,
|
|
219
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
220
|
+
new Uint8Array([109, 115, 12, 245, 11, 10, 16, 209]),
|
|
221
|
+
),
|
|
222
|
+
0,
|
|
223
|
+
)
|
|
224
|
+
) {
|
|
225
|
+
return PiconDlmmInstruction.AcceptAdminAuthority;
|
|
226
|
+
}
|
|
227
|
+
if (
|
|
228
|
+
containsBytes(
|
|
229
|
+
data,
|
|
230
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
231
|
+
new Uint8Array([169, 32, 79, 137, 136, 232, 70, 137]),
|
|
232
|
+
),
|
|
233
|
+
0,
|
|
234
|
+
)
|
|
235
|
+
) {
|
|
236
|
+
return PiconDlmmInstruction.ClaimFee;
|
|
237
|
+
}
|
|
238
|
+
if (
|
|
239
|
+
containsBytes(
|
|
240
|
+
data,
|
|
241
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
242
|
+
new Uint8Array([165, 228, 133, 48, 99, 249, 255, 33]),
|
|
243
|
+
),
|
|
244
|
+
0,
|
|
245
|
+
)
|
|
246
|
+
) {
|
|
247
|
+
return PiconDlmmInstruction.ClaimProtocolFee;
|
|
248
|
+
}
|
|
249
|
+
if (
|
|
250
|
+
containsBytes(
|
|
251
|
+
data,
|
|
252
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
253
|
+
new Uint8Array([123, 134, 81, 0, 49, 68, 98, 98]),
|
|
254
|
+
),
|
|
255
|
+
0,
|
|
256
|
+
)
|
|
257
|
+
) {
|
|
258
|
+
return PiconDlmmInstruction.ClosePosition;
|
|
259
|
+
}
|
|
260
|
+
if (
|
|
261
|
+
containsBytes(
|
|
262
|
+
data,
|
|
263
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
264
|
+
new Uint8Array([19, 140, 214, 88, 151, 236, 89, 5]),
|
|
265
|
+
),
|
|
266
|
+
0,
|
|
267
|
+
)
|
|
268
|
+
) {
|
|
269
|
+
return PiconDlmmInstruction.CreateAdminConfig;
|
|
270
|
+
}
|
|
271
|
+
if (
|
|
272
|
+
containsBytes(
|
|
273
|
+
data,
|
|
274
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
275
|
+
new Uint8Array([107, 26, 23, 62, 137, 213, 131, 235]),
|
|
276
|
+
),
|
|
277
|
+
0,
|
|
278
|
+
)
|
|
279
|
+
) {
|
|
280
|
+
return PiconDlmmInstruction.CreateBinArray;
|
|
281
|
+
}
|
|
282
|
+
if (
|
|
283
|
+
containsBytes(
|
|
284
|
+
data,
|
|
285
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
286
|
+
new Uint8Array([233, 146, 209, 142, 207, 104, 64, 188]),
|
|
287
|
+
),
|
|
288
|
+
0,
|
|
289
|
+
)
|
|
290
|
+
) {
|
|
291
|
+
return PiconDlmmInstruction.CreatePool;
|
|
292
|
+
}
|
|
293
|
+
if (
|
|
294
|
+
containsBytes(
|
|
295
|
+
data,
|
|
296
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
297
|
+
new Uint8Array([158, 86, 142, 160, 52, 53, 194, 51]),
|
|
298
|
+
),
|
|
299
|
+
0,
|
|
300
|
+
)
|
|
301
|
+
) {
|
|
302
|
+
return PiconDlmmInstruction.DeleteBinArray;
|
|
303
|
+
}
|
|
304
|
+
if (
|
|
305
|
+
containsBytes(
|
|
306
|
+
data,
|
|
307
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
308
|
+
new Uint8Array([121, 187, 132, 201, 131, 190, 200, 124]),
|
|
309
|
+
),
|
|
310
|
+
0,
|
|
311
|
+
)
|
|
312
|
+
) {
|
|
313
|
+
return PiconDlmmInstruction.DepositByWeight;
|
|
314
|
+
}
|
|
315
|
+
if (
|
|
316
|
+
containsBytes(
|
|
317
|
+
data,
|
|
318
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
319
|
+
new Uint8Array([135, 128, 47, 77, 15, 152, 240, 49]),
|
|
320
|
+
),
|
|
321
|
+
0,
|
|
322
|
+
)
|
|
323
|
+
) {
|
|
324
|
+
return PiconDlmmInstruction.OpenPosition;
|
|
325
|
+
}
|
|
326
|
+
if (
|
|
327
|
+
containsBytes(
|
|
328
|
+
data,
|
|
329
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
330
|
+
new Uint8Array([82, 181, 7, 62, 133, 40, 2, 109]),
|
|
331
|
+
),
|
|
332
|
+
0,
|
|
333
|
+
)
|
|
334
|
+
) {
|
|
335
|
+
return PiconDlmmInstruction.SetMetadataUpdateAuthority;
|
|
336
|
+
}
|
|
337
|
+
if (
|
|
338
|
+
containsBytes(
|
|
339
|
+
data,
|
|
340
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
341
|
+
new Uint8Array([44, 189, 119, 222, 246, 2, 137, 85]),
|
|
342
|
+
),
|
|
343
|
+
0,
|
|
344
|
+
)
|
|
345
|
+
) {
|
|
346
|
+
return PiconDlmmInstruction.SetPoolDynamicFeeConfig;
|
|
347
|
+
}
|
|
348
|
+
if (
|
|
349
|
+
containsBytes(
|
|
350
|
+
data,
|
|
351
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
352
|
+
new Uint8Array([16, 138, 62, 186, 255, 137, 75, 193]),
|
|
353
|
+
),
|
|
354
|
+
0,
|
|
355
|
+
)
|
|
356
|
+
) {
|
|
357
|
+
return PiconDlmmInstruction.SetPoolProtocolShare;
|
|
358
|
+
}
|
|
359
|
+
if (
|
|
360
|
+
containsBytes(
|
|
361
|
+
data,
|
|
362
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
363
|
+
new Uint8Array([248, 198, 158, 145, 225, 117, 135, 200]),
|
|
364
|
+
),
|
|
365
|
+
0,
|
|
366
|
+
)
|
|
367
|
+
) {
|
|
368
|
+
return PiconDlmmInstruction.Swap;
|
|
369
|
+
}
|
|
370
|
+
if (
|
|
371
|
+
containsBytes(
|
|
372
|
+
data,
|
|
373
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
374
|
+
new Uint8Array([219, 251, 215, 251, 44, 37, 108, 102]),
|
|
375
|
+
),
|
|
376
|
+
0,
|
|
377
|
+
)
|
|
378
|
+
) {
|
|
379
|
+
return PiconDlmmInstruction.SyncPool;
|
|
380
|
+
}
|
|
381
|
+
if (
|
|
382
|
+
containsBytes(
|
|
383
|
+
data,
|
|
384
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
385
|
+
new Uint8Array([198, 11, 182, 207, 145, 11, 135, 215]),
|
|
386
|
+
),
|
|
387
|
+
0,
|
|
388
|
+
)
|
|
389
|
+
) {
|
|
390
|
+
return PiconDlmmInstruction.TransferAdminAuthority;
|
|
391
|
+
}
|
|
392
|
+
if (
|
|
393
|
+
containsBytes(
|
|
394
|
+
data,
|
|
395
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
396
|
+
new Uint8Array([183, 18, 70, 156, 148, 109, 161, 34]),
|
|
397
|
+
),
|
|
398
|
+
0,
|
|
399
|
+
)
|
|
400
|
+
) {
|
|
401
|
+
return PiconDlmmInstruction.Withdraw;
|
|
402
|
+
}
|
|
403
|
+
throw new SolanaError(
|
|
404
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
|
|
405
|
+
{ instructionData: data, programName: "piconDlmm" },
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export type ParsedPiconDlmmInstruction<
|
|
410
|
+
TProgram extends string = "pDLMMk3KW3CUSxE1Wgjhx3jSmm2spe6Ry7Mq2HT26rC",
|
|
411
|
+
> =
|
|
412
|
+
| ({
|
|
413
|
+
instructionType: PiconDlmmInstruction.AcceptAdminAuthority;
|
|
414
|
+
} & ParsedAcceptAdminAuthorityInstruction<TProgram>)
|
|
415
|
+
| ({
|
|
416
|
+
instructionType: PiconDlmmInstruction.ClaimFee;
|
|
417
|
+
} & ParsedClaimFeeInstruction<TProgram>)
|
|
418
|
+
| ({
|
|
419
|
+
instructionType: PiconDlmmInstruction.ClaimProtocolFee;
|
|
420
|
+
} & ParsedClaimProtocolFeeInstruction<TProgram>)
|
|
421
|
+
| ({
|
|
422
|
+
instructionType: PiconDlmmInstruction.ClosePosition;
|
|
423
|
+
} & ParsedClosePositionInstruction<TProgram>)
|
|
424
|
+
| ({
|
|
425
|
+
instructionType: PiconDlmmInstruction.CreateAdminConfig;
|
|
426
|
+
} & ParsedCreateAdminConfigInstruction<TProgram>)
|
|
427
|
+
| ({
|
|
428
|
+
instructionType: PiconDlmmInstruction.CreateBinArray;
|
|
429
|
+
} & ParsedCreateBinArrayInstruction<TProgram>)
|
|
430
|
+
| ({
|
|
431
|
+
instructionType: PiconDlmmInstruction.CreatePool;
|
|
432
|
+
} & ParsedCreatePoolInstruction<TProgram>)
|
|
433
|
+
| ({
|
|
434
|
+
instructionType: PiconDlmmInstruction.DeleteBinArray;
|
|
435
|
+
} & ParsedDeleteBinArrayInstruction<TProgram>)
|
|
436
|
+
| ({
|
|
437
|
+
instructionType: PiconDlmmInstruction.DepositByWeight;
|
|
438
|
+
} & ParsedDepositByWeightInstruction<TProgram>)
|
|
439
|
+
| ({
|
|
440
|
+
instructionType: PiconDlmmInstruction.OpenPosition;
|
|
441
|
+
} & ParsedOpenPositionInstruction<TProgram>)
|
|
442
|
+
| ({
|
|
443
|
+
instructionType: PiconDlmmInstruction.SetMetadataUpdateAuthority;
|
|
444
|
+
} & ParsedSetMetadataUpdateAuthorityInstruction<TProgram>)
|
|
445
|
+
| ({
|
|
446
|
+
instructionType: PiconDlmmInstruction.SetPoolDynamicFeeConfig;
|
|
447
|
+
} & ParsedSetPoolDynamicFeeConfigInstruction<TProgram>)
|
|
448
|
+
| ({
|
|
449
|
+
instructionType: PiconDlmmInstruction.SetPoolProtocolShare;
|
|
450
|
+
} & ParsedSetPoolProtocolShareInstruction<TProgram>)
|
|
451
|
+
| ({
|
|
452
|
+
instructionType: PiconDlmmInstruction.Swap;
|
|
453
|
+
} & ParsedSwapInstruction<TProgram>)
|
|
454
|
+
| ({
|
|
455
|
+
instructionType: PiconDlmmInstruction.SyncPool;
|
|
456
|
+
} & ParsedSyncPoolInstruction<TProgram>)
|
|
457
|
+
| ({
|
|
458
|
+
instructionType: PiconDlmmInstruction.TransferAdminAuthority;
|
|
459
|
+
} & ParsedTransferAdminAuthorityInstruction<TProgram>)
|
|
460
|
+
| ({
|
|
461
|
+
instructionType: PiconDlmmInstruction.Withdraw;
|
|
462
|
+
} & ParsedWithdrawInstruction<TProgram>);
|
|
463
|
+
|
|
464
|
+
export function parsePiconDlmmInstruction<TProgram extends string>(
|
|
465
|
+
instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,
|
|
466
|
+
): ParsedPiconDlmmInstruction<TProgram> {
|
|
467
|
+
const instructionType = identifyPiconDlmmInstruction(instruction);
|
|
468
|
+
switch (instructionType) {
|
|
469
|
+
case PiconDlmmInstruction.AcceptAdminAuthority: {
|
|
470
|
+
assertIsInstructionWithAccounts(instruction);
|
|
471
|
+
return {
|
|
472
|
+
instructionType: PiconDlmmInstruction.AcceptAdminAuthority,
|
|
473
|
+
...parseAcceptAdminAuthorityInstruction(instruction),
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
case PiconDlmmInstruction.ClaimFee: {
|
|
477
|
+
assertIsInstructionWithAccounts(instruction);
|
|
478
|
+
return {
|
|
479
|
+
instructionType: PiconDlmmInstruction.ClaimFee,
|
|
480
|
+
...parseClaimFeeInstruction(instruction),
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
case PiconDlmmInstruction.ClaimProtocolFee: {
|
|
484
|
+
assertIsInstructionWithAccounts(instruction);
|
|
485
|
+
return {
|
|
486
|
+
instructionType: PiconDlmmInstruction.ClaimProtocolFee,
|
|
487
|
+
...parseClaimProtocolFeeInstruction(instruction),
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
case PiconDlmmInstruction.ClosePosition: {
|
|
491
|
+
assertIsInstructionWithAccounts(instruction);
|
|
492
|
+
return {
|
|
493
|
+
instructionType: PiconDlmmInstruction.ClosePosition,
|
|
494
|
+
...parseClosePositionInstruction(instruction),
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
case PiconDlmmInstruction.CreateAdminConfig: {
|
|
498
|
+
assertIsInstructionWithAccounts(instruction);
|
|
499
|
+
return {
|
|
500
|
+
instructionType: PiconDlmmInstruction.CreateAdminConfig,
|
|
501
|
+
...parseCreateAdminConfigInstruction(instruction),
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
case PiconDlmmInstruction.CreateBinArray: {
|
|
505
|
+
assertIsInstructionWithAccounts(instruction);
|
|
506
|
+
return {
|
|
507
|
+
instructionType: PiconDlmmInstruction.CreateBinArray,
|
|
508
|
+
...parseCreateBinArrayInstruction(instruction),
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
case PiconDlmmInstruction.CreatePool: {
|
|
512
|
+
assertIsInstructionWithAccounts(instruction);
|
|
513
|
+
return {
|
|
514
|
+
instructionType: PiconDlmmInstruction.CreatePool,
|
|
515
|
+
...parseCreatePoolInstruction(instruction),
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
case PiconDlmmInstruction.DeleteBinArray: {
|
|
519
|
+
assertIsInstructionWithAccounts(instruction);
|
|
520
|
+
return {
|
|
521
|
+
instructionType: PiconDlmmInstruction.DeleteBinArray,
|
|
522
|
+
...parseDeleteBinArrayInstruction(instruction),
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
case PiconDlmmInstruction.DepositByWeight: {
|
|
526
|
+
assertIsInstructionWithAccounts(instruction);
|
|
527
|
+
return {
|
|
528
|
+
instructionType: PiconDlmmInstruction.DepositByWeight,
|
|
529
|
+
...parseDepositByWeightInstruction(instruction),
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
case PiconDlmmInstruction.OpenPosition: {
|
|
533
|
+
assertIsInstructionWithAccounts(instruction);
|
|
534
|
+
return {
|
|
535
|
+
instructionType: PiconDlmmInstruction.OpenPosition,
|
|
536
|
+
...parseOpenPositionInstruction(instruction),
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
case PiconDlmmInstruction.SetMetadataUpdateAuthority: {
|
|
540
|
+
assertIsInstructionWithAccounts(instruction);
|
|
541
|
+
return {
|
|
542
|
+
instructionType: PiconDlmmInstruction.SetMetadataUpdateAuthority,
|
|
543
|
+
...parseSetMetadataUpdateAuthorityInstruction(instruction),
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
case PiconDlmmInstruction.SetPoolDynamicFeeConfig: {
|
|
547
|
+
assertIsInstructionWithAccounts(instruction);
|
|
548
|
+
return {
|
|
549
|
+
instructionType: PiconDlmmInstruction.SetPoolDynamicFeeConfig,
|
|
550
|
+
...parseSetPoolDynamicFeeConfigInstruction(instruction),
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
case PiconDlmmInstruction.SetPoolProtocolShare: {
|
|
554
|
+
assertIsInstructionWithAccounts(instruction);
|
|
555
|
+
return {
|
|
556
|
+
instructionType: PiconDlmmInstruction.SetPoolProtocolShare,
|
|
557
|
+
...parseSetPoolProtocolShareInstruction(instruction),
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
case PiconDlmmInstruction.Swap: {
|
|
561
|
+
assertIsInstructionWithAccounts(instruction);
|
|
562
|
+
return {
|
|
563
|
+
instructionType: PiconDlmmInstruction.Swap,
|
|
564
|
+
...parseSwapInstruction(instruction),
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
case PiconDlmmInstruction.SyncPool: {
|
|
568
|
+
assertIsInstructionWithAccounts(instruction);
|
|
569
|
+
return {
|
|
570
|
+
instructionType: PiconDlmmInstruction.SyncPool,
|
|
571
|
+
...parseSyncPoolInstruction(instruction),
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
case PiconDlmmInstruction.TransferAdminAuthority: {
|
|
575
|
+
assertIsInstructionWithAccounts(instruction);
|
|
576
|
+
return {
|
|
577
|
+
instructionType: PiconDlmmInstruction.TransferAdminAuthority,
|
|
578
|
+
...parseTransferAdminAuthorityInstruction(instruction),
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
case PiconDlmmInstruction.Withdraw: {
|
|
582
|
+
assertIsInstructionWithAccounts(instruction);
|
|
583
|
+
return {
|
|
584
|
+
instructionType: PiconDlmmInstruction.Withdraw,
|
|
585
|
+
...parseWithdrawInstruction(instruction),
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
default:
|
|
589
|
+
throw new SolanaError(
|
|
590
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
|
|
591
|
+
{
|
|
592
|
+
instructionType: instructionType as string,
|
|
593
|
+
programName: "piconDlmm",
|
|
594
|
+
},
|
|
595
|
+
);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
export type PiconDlmmPlugin = {
|
|
600
|
+
accounts: PiconDlmmPluginAccounts;
|
|
601
|
+
instructions: PiconDlmmPluginInstructions;
|
|
602
|
+
pdas: PiconDlmmPluginPdas;
|
|
603
|
+
identifyAccount: typeof identifyPiconDlmmAccount;
|
|
604
|
+
identifyInstruction: typeof identifyPiconDlmmInstruction;
|
|
605
|
+
parseInstruction: typeof parsePiconDlmmInstruction;
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
export type PiconDlmmPluginAccounts = {
|
|
609
|
+
adminConfig: ReturnType<typeof getAdminConfigCodec> &
|
|
610
|
+
SelfFetchFunctions<AdminConfigArgs, AdminConfig>;
|
|
611
|
+
binArray: ReturnType<typeof getBinArrayCodec> &
|
|
612
|
+
SelfFetchFunctions<BinArrayArgs, BinArray>;
|
|
613
|
+
pool: ReturnType<typeof getPoolCodec> & SelfFetchFunctions<PoolArgs, Pool>;
|
|
614
|
+
position: ReturnType<typeof getPositionCodec> &
|
|
615
|
+
SelfFetchFunctions<PositionArgs, Position>;
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
export type PiconDlmmPluginInstructions = {
|
|
619
|
+
acceptAdminAuthority: (
|
|
620
|
+
input: AcceptAdminAuthorityAsyncInput,
|
|
621
|
+
) => ReturnType<typeof getAcceptAdminAuthorityInstructionAsync> &
|
|
622
|
+
SelfPlanAndSendFunctions;
|
|
623
|
+
claimFee: (
|
|
624
|
+
input: ClaimFeeInput,
|
|
625
|
+
) => ReturnType<typeof getClaimFeeInstruction> & SelfPlanAndSendFunctions;
|
|
626
|
+
claimProtocolFee: (
|
|
627
|
+
input: ClaimProtocolFeeAsyncInput,
|
|
628
|
+
) => ReturnType<typeof getClaimProtocolFeeInstructionAsync> &
|
|
629
|
+
SelfPlanAndSendFunctions;
|
|
630
|
+
closePosition: (
|
|
631
|
+
input: ClosePositionAsyncInput,
|
|
632
|
+
) => ReturnType<typeof getClosePositionInstructionAsync> &
|
|
633
|
+
SelfPlanAndSendFunctions;
|
|
634
|
+
createAdminConfig: (
|
|
635
|
+
input: CreateAdminConfigAsyncInput,
|
|
636
|
+
) => ReturnType<typeof getCreateAdminConfigInstructionAsync> &
|
|
637
|
+
SelfPlanAndSendFunctions;
|
|
638
|
+
createBinArray: (
|
|
639
|
+
input: MakeOptional<CreateBinArrayAsyncInput, "payer">,
|
|
640
|
+
) => ReturnType<typeof getCreateBinArrayInstructionAsync> &
|
|
641
|
+
SelfPlanAndSendFunctions;
|
|
642
|
+
createPool: (
|
|
643
|
+
input: CreatePoolAsyncInput,
|
|
644
|
+
) => ReturnType<typeof getCreatePoolInstructionAsync> &
|
|
645
|
+
SelfPlanAndSendFunctions;
|
|
646
|
+
deleteBinArray: (
|
|
647
|
+
input: DeleteBinArrayAsyncInput,
|
|
648
|
+
) => ReturnType<typeof getDeleteBinArrayInstructionAsync> &
|
|
649
|
+
SelfPlanAndSendFunctions;
|
|
650
|
+
depositByWeight: (
|
|
651
|
+
input: DepositByWeightInput,
|
|
652
|
+
) => ReturnType<typeof getDepositByWeightInstruction> &
|
|
653
|
+
SelfPlanAndSendFunctions;
|
|
654
|
+
openPosition: (
|
|
655
|
+
input: OpenPositionAsyncInput,
|
|
656
|
+
) => ReturnType<typeof getOpenPositionInstructionAsync> &
|
|
657
|
+
SelfPlanAndSendFunctions;
|
|
658
|
+
setMetadataUpdateAuthority: (
|
|
659
|
+
input: SetMetadataUpdateAuthorityAsyncInput,
|
|
660
|
+
) => ReturnType<typeof getSetMetadataUpdateAuthorityInstructionAsync> &
|
|
661
|
+
SelfPlanAndSendFunctions;
|
|
662
|
+
setPoolDynamicFeeConfig: (
|
|
663
|
+
input: SetPoolDynamicFeeConfigAsyncInput,
|
|
664
|
+
) => ReturnType<typeof getSetPoolDynamicFeeConfigInstructionAsync> &
|
|
665
|
+
SelfPlanAndSendFunctions;
|
|
666
|
+
setPoolProtocolShare: (
|
|
667
|
+
input: SetPoolProtocolShareAsyncInput,
|
|
668
|
+
) => ReturnType<typeof getSetPoolProtocolShareInstructionAsync> &
|
|
669
|
+
SelfPlanAndSendFunctions;
|
|
670
|
+
swap: (
|
|
671
|
+
input: SwapInput,
|
|
672
|
+
) => ReturnType<typeof getSwapInstruction> & SelfPlanAndSendFunctions;
|
|
673
|
+
syncPool: (
|
|
674
|
+
input: SyncPoolInput,
|
|
675
|
+
) => ReturnType<typeof getSyncPoolInstruction> & SelfPlanAndSendFunctions;
|
|
676
|
+
transferAdminAuthority: (
|
|
677
|
+
input: TransferAdminAuthorityAsyncInput,
|
|
678
|
+
) => ReturnType<typeof getTransferAdminAuthorityInstructionAsync> &
|
|
679
|
+
SelfPlanAndSendFunctions;
|
|
680
|
+
withdraw: (
|
|
681
|
+
input: WithdrawInput,
|
|
682
|
+
) => ReturnType<typeof getWithdrawInstruction> & SelfPlanAndSendFunctions;
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
export type PiconDlmmPluginPdas = {
|
|
686
|
+
adminConfig: typeof findAdminConfigPda;
|
|
687
|
+
position: typeof findPositionPda;
|
|
688
|
+
binArray: typeof findBinArrayPda;
|
|
689
|
+
pool: typeof findPoolPda;
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
export type PiconDlmmPluginRequirements = ClientWithRpc<
|
|
693
|
+
GetAccountInfoApi & GetMultipleAccountsApi
|
|
694
|
+
> &
|
|
695
|
+
ClientWithPayer &
|
|
696
|
+
ClientWithTransactionPlanning &
|
|
697
|
+
ClientWithTransactionSending;
|
|
698
|
+
|
|
699
|
+
export function piconDlmmProgram() {
|
|
700
|
+
return <T extends PiconDlmmPluginRequirements>(
|
|
701
|
+
client: T,
|
|
702
|
+
): ExtendedClient<T, { piconDlmm: PiconDlmmPlugin }> => {
|
|
703
|
+
return extendClient(client, {
|
|
704
|
+
piconDlmm: <PiconDlmmPlugin>{
|
|
705
|
+
accounts: {
|
|
706
|
+
adminConfig: addSelfFetchFunctions(client, getAdminConfigCodec()),
|
|
707
|
+
binArray: addSelfFetchFunctions(client, getBinArrayCodec()),
|
|
708
|
+
pool: addSelfFetchFunctions(client, getPoolCodec()),
|
|
709
|
+
position: addSelfFetchFunctions(client, getPositionCodec()),
|
|
710
|
+
},
|
|
711
|
+
instructions: {
|
|
712
|
+
acceptAdminAuthority: (input) =>
|
|
713
|
+
addSelfPlanAndSendFunctions(
|
|
714
|
+
client,
|
|
715
|
+
getAcceptAdminAuthorityInstructionAsync(input),
|
|
716
|
+
),
|
|
717
|
+
claimFee: (input) =>
|
|
718
|
+
addSelfPlanAndSendFunctions(client, getClaimFeeInstruction(input)),
|
|
719
|
+
claimProtocolFee: (input) =>
|
|
720
|
+
addSelfPlanAndSendFunctions(
|
|
721
|
+
client,
|
|
722
|
+
getClaimProtocolFeeInstructionAsync(input),
|
|
723
|
+
),
|
|
724
|
+
closePosition: (input) =>
|
|
725
|
+
addSelfPlanAndSendFunctions(
|
|
726
|
+
client,
|
|
727
|
+
getClosePositionInstructionAsync(input),
|
|
728
|
+
),
|
|
729
|
+
createAdminConfig: (input) =>
|
|
730
|
+
addSelfPlanAndSendFunctions(
|
|
731
|
+
client,
|
|
732
|
+
getCreateAdminConfigInstructionAsync(input),
|
|
733
|
+
),
|
|
734
|
+
createBinArray: (input) =>
|
|
735
|
+
addSelfPlanAndSendFunctions(
|
|
736
|
+
client,
|
|
737
|
+
getCreateBinArrayInstructionAsync({
|
|
738
|
+
...input,
|
|
739
|
+
payer: input.payer ?? client.payer,
|
|
740
|
+
}),
|
|
741
|
+
),
|
|
742
|
+
createPool: (input) =>
|
|
743
|
+
addSelfPlanAndSendFunctions(
|
|
744
|
+
client,
|
|
745
|
+
getCreatePoolInstructionAsync(input),
|
|
746
|
+
),
|
|
747
|
+
deleteBinArray: (input) =>
|
|
748
|
+
addSelfPlanAndSendFunctions(
|
|
749
|
+
client,
|
|
750
|
+
getDeleteBinArrayInstructionAsync(input),
|
|
751
|
+
),
|
|
752
|
+
depositByWeight: (input) =>
|
|
753
|
+
addSelfPlanAndSendFunctions(
|
|
754
|
+
client,
|
|
755
|
+
getDepositByWeightInstruction(input),
|
|
756
|
+
),
|
|
757
|
+
openPosition: (input) =>
|
|
758
|
+
addSelfPlanAndSendFunctions(
|
|
759
|
+
client,
|
|
760
|
+
getOpenPositionInstructionAsync(input),
|
|
761
|
+
),
|
|
762
|
+
setMetadataUpdateAuthority: (input) =>
|
|
763
|
+
addSelfPlanAndSendFunctions(
|
|
764
|
+
client,
|
|
765
|
+
getSetMetadataUpdateAuthorityInstructionAsync(input),
|
|
766
|
+
),
|
|
767
|
+
setPoolDynamicFeeConfig: (input) =>
|
|
768
|
+
addSelfPlanAndSendFunctions(
|
|
769
|
+
client,
|
|
770
|
+
getSetPoolDynamicFeeConfigInstructionAsync(input),
|
|
771
|
+
),
|
|
772
|
+
setPoolProtocolShare: (input) =>
|
|
773
|
+
addSelfPlanAndSendFunctions(
|
|
774
|
+
client,
|
|
775
|
+
getSetPoolProtocolShareInstructionAsync(input),
|
|
776
|
+
),
|
|
777
|
+
swap: (input) =>
|
|
778
|
+
addSelfPlanAndSendFunctions(client, getSwapInstruction(input)),
|
|
779
|
+
syncPool: (input) =>
|
|
780
|
+
addSelfPlanAndSendFunctions(client, getSyncPoolInstruction(input)),
|
|
781
|
+
transferAdminAuthority: (input) =>
|
|
782
|
+
addSelfPlanAndSendFunctions(
|
|
783
|
+
client,
|
|
784
|
+
getTransferAdminAuthorityInstructionAsync(input),
|
|
785
|
+
),
|
|
786
|
+
withdraw: (input) =>
|
|
787
|
+
addSelfPlanAndSendFunctions(client, getWithdrawInstruction(input)),
|
|
788
|
+
},
|
|
789
|
+
pdas: {
|
|
790
|
+
adminConfig: findAdminConfigPda,
|
|
791
|
+
position: findPositionPda,
|
|
792
|
+
binArray: findBinArrayPda,
|
|
793
|
+
pool: findPoolPda,
|
|
794
|
+
},
|
|
795
|
+
identifyAccount: identifyPiconDlmmAccount,
|
|
796
|
+
identifyInstruction: identifyPiconDlmmInstruction,
|
|
797
|
+
parseInstruction: parsePiconDlmmInstruction,
|
|
798
|
+
},
|
|
799
|
+
});
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|