@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,274 @@
|
|
|
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
|
+
getAddressDecoder,
|
|
14
|
+
getAddressEncoder,
|
|
15
|
+
getBytesDecoder,
|
|
16
|
+
getBytesEncoder,
|
|
17
|
+
getStructDecoder,
|
|
18
|
+
getStructEncoder,
|
|
19
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
20
|
+
SolanaError,
|
|
21
|
+
transformEncoder,
|
|
22
|
+
type AccountMeta,
|
|
23
|
+
type AccountSignerMeta,
|
|
24
|
+
type Address,
|
|
25
|
+
type FixedSizeCodec,
|
|
26
|
+
type FixedSizeDecoder,
|
|
27
|
+
type FixedSizeEncoder,
|
|
28
|
+
type Instruction,
|
|
29
|
+
type InstructionWithAccounts,
|
|
30
|
+
type InstructionWithData,
|
|
31
|
+
type ReadonlySignerAccount,
|
|
32
|
+
type ReadonlyUint8Array,
|
|
33
|
+
type TransactionSigner,
|
|
34
|
+
type WritableAccount,
|
|
35
|
+
} from "@solana/kit";
|
|
36
|
+
import {
|
|
37
|
+
getAccountMetaFactory,
|
|
38
|
+
type ResolvedInstructionAccount,
|
|
39
|
+
} from "@solana/program-client-core";
|
|
40
|
+
import { findAdminConfigPda } from "../pdas";
|
|
41
|
+
import { PICON_DLMM_PROGRAM_ADDRESS } from "../programs";
|
|
42
|
+
|
|
43
|
+
export const SET_METADATA_UPDATE_AUTHORITY_DISCRIMINATOR: ReadonlyUint8Array =
|
|
44
|
+
new Uint8Array([82, 181, 7, 62, 133, 40, 2, 109]);
|
|
45
|
+
|
|
46
|
+
export function getSetMetadataUpdateAuthorityDiscriminatorBytes(): ReadonlyUint8Array {
|
|
47
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
48
|
+
SET_METADATA_UPDATE_AUTHORITY_DISCRIMINATOR,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type SetMetadataUpdateAuthorityInstruction<
|
|
53
|
+
TProgram extends string = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
54
|
+
TAccountAuthority extends string | AccountMeta<string> = string,
|
|
55
|
+
TAccountAdminConfig extends string | AccountMeta<string> = string,
|
|
56
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
57
|
+
> = Instruction<TProgram> &
|
|
58
|
+
InstructionWithData<ReadonlyUint8Array> &
|
|
59
|
+
InstructionWithAccounts<
|
|
60
|
+
[
|
|
61
|
+
TAccountAuthority extends string
|
|
62
|
+
? ReadonlySignerAccount<TAccountAuthority> &
|
|
63
|
+
AccountSignerMeta<TAccountAuthority>
|
|
64
|
+
: TAccountAuthority,
|
|
65
|
+
TAccountAdminConfig extends string
|
|
66
|
+
? WritableAccount<TAccountAdminConfig>
|
|
67
|
+
: TAccountAdminConfig,
|
|
68
|
+
...TRemainingAccounts,
|
|
69
|
+
]
|
|
70
|
+
>;
|
|
71
|
+
|
|
72
|
+
export type SetMetadataUpdateAuthorityInstructionData = {
|
|
73
|
+
discriminator: ReadonlyUint8Array;
|
|
74
|
+
metadataUpdateAuthority: Address;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export type SetMetadataUpdateAuthorityInstructionDataArgs = {
|
|
78
|
+
metadataUpdateAuthority: Address;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export function getSetMetadataUpdateAuthorityInstructionDataEncoder(): FixedSizeEncoder<SetMetadataUpdateAuthorityInstructionDataArgs> {
|
|
82
|
+
return transformEncoder(
|
|
83
|
+
getStructEncoder([
|
|
84
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
85
|
+
["metadataUpdateAuthority", getAddressEncoder()],
|
|
86
|
+
]),
|
|
87
|
+
(value) => ({
|
|
88
|
+
...value,
|
|
89
|
+
discriminator: SET_METADATA_UPDATE_AUTHORITY_DISCRIMINATOR,
|
|
90
|
+
}),
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function getSetMetadataUpdateAuthorityInstructionDataDecoder(): FixedSizeDecoder<SetMetadataUpdateAuthorityInstructionData> {
|
|
95
|
+
return getStructDecoder([
|
|
96
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
97
|
+
["metadataUpdateAuthority", getAddressDecoder()],
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function getSetMetadataUpdateAuthorityInstructionDataCodec(): FixedSizeCodec<
|
|
102
|
+
SetMetadataUpdateAuthorityInstructionDataArgs,
|
|
103
|
+
SetMetadataUpdateAuthorityInstructionData
|
|
104
|
+
> {
|
|
105
|
+
return combineCodec(
|
|
106
|
+
getSetMetadataUpdateAuthorityInstructionDataEncoder(),
|
|
107
|
+
getSetMetadataUpdateAuthorityInstructionDataDecoder(),
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export type SetMetadataUpdateAuthorityAsyncInput<
|
|
112
|
+
TAccountAuthority extends string = string,
|
|
113
|
+
TAccountAdminConfig extends string = string,
|
|
114
|
+
> = {
|
|
115
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
116
|
+
adminConfig?: Address<TAccountAdminConfig>;
|
|
117
|
+
metadataUpdateAuthority: SetMetadataUpdateAuthorityInstructionDataArgs["metadataUpdateAuthority"];
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export async function getSetMetadataUpdateAuthorityInstructionAsync<
|
|
121
|
+
TAccountAuthority extends string,
|
|
122
|
+
TAccountAdminConfig extends string,
|
|
123
|
+
TProgramAddress extends Address = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
124
|
+
>(
|
|
125
|
+
input: SetMetadataUpdateAuthorityAsyncInput<
|
|
126
|
+
TAccountAuthority,
|
|
127
|
+
TAccountAdminConfig
|
|
128
|
+
>,
|
|
129
|
+
config?: { programAddress?: TProgramAddress },
|
|
130
|
+
): Promise<
|
|
131
|
+
SetMetadataUpdateAuthorityInstruction<
|
|
132
|
+
TProgramAddress,
|
|
133
|
+
TAccountAuthority,
|
|
134
|
+
TAccountAdminConfig
|
|
135
|
+
>
|
|
136
|
+
> {
|
|
137
|
+
// Program address.
|
|
138
|
+
const programAddress = config?.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
|
|
139
|
+
|
|
140
|
+
// Original accounts.
|
|
141
|
+
const originalAccounts = {
|
|
142
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
143
|
+
adminConfig: { value: input.adminConfig ?? null, isWritable: true },
|
|
144
|
+
};
|
|
145
|
+
const accounts = originalAccounts as Record<
|
|
146
|
+
keyof typeof originalAccounts,
|
|
147
|
+
ResolvedInstructionAccount
|
|
148
|
+
>;
|
|
149
|
+
|
|
150
|
+
// Original args.
|
|
151
|
+
const args = { ...input };
|
|
152
|
+
|
|
153
|
+
// Resolve default values.
|
|
154
|
+
if (!accounts.adminConfig.value) {
|
|
155
|
+
accounts.adminConfig.value = await findAdminConfigPda();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
159
|
+
return Object.freeze({
|
|
160
|
+
accounts: [
|
|
161
|
+
getAccountMeta("authority", accounts.authority),
|
|
162
|
+
getAccountMeta("adminConfig", accounts.adminConfig),
|
|
163
|
+
],
|
|
164
|
+
data: getSetMetadataUpdateAuthorityInstructionDataEncoder().encode(
|
|
165
|
+
args as SetMetadataUpdateAuthorityInstructionDataArgs,
|
|
166
|
+
),
|
|
167
|
+
programAddress,
|
|
168
|
+
} as SetMetadataUpdateAuthorityInstruction<
|
|
169
|
+
TProgramAddress,
|
|
170
|
+
TAccountAuthority,
|
|
171
|
+
TAccountAdminConfig
|
|
172
|
+
>);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export type SetMetadataUpdateAuthorityInput<
|
|
176
|
+
TAccountAuthority extends string = string,
|
|
177
|
+
TAccountAdminConfig extends string = string,
|
|
178
|
+
> = {
|
|
179
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
180
|
+
adminConfig: Address<TAccountAdminConfig>;
|
|
181
|
+
metadataUpdateAuthority: SetMetadataUpdateAuthorityInstructionDataArgs["metadataUpdateAuthority"];
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export function getSetMetadataUpdateAuthorityInstruction<
|
|
185
|
+
TAccountAuthority extends string,
|
|
186
|
+
TAccountAdminConfig extends string,
|
|
187
|
+
TProgramAddress extends Address = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
188
|
+
>(
|
|
189
|
+
input: SetMetadataUpdateAuthorityInput<
|
|
190
|
+
TAccountAuthority,
|
|
191
|
+
TAccountAdminConfig
|
|
192
|
+
>,
|
|
193
|
+
config?: { programAddress?: TProgramAddress },
|
|
194
|
+
): SetMetadataUpdateAuthorityInstruction<
|
|
195
|
+
TProgramAddress,
|
|
196
|
+
TAccountAuthority,
|
|
197
|
+
TAccountAdminConfig
|
|
198
|
+
> {
|
|
199
|
+
// Program address.
|
|
200
|
+
const programAddress = config?.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
|
|
201
|
+
|
|
202
|
+
// Original accounts.
|
|
203
|
+
const originalAccounts = {
|
|
204
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
205
|
+
adminConfig: { value: input.adminConfig ?? null, isWritable: true },
|
|
206
|
+
};
|
|
207
|
+
const accounts = originalAccounts as Record<
|
|
208
|
+
keyof typeof originalAccounts,
|
|
209
|
+
ResolvedInstructionAccount
|
|
210
|
+
>;
|
|
211
|
+
|
|
212
|
+
// Original args.
|
|
213
|
+
const args = { ...input };
|
|
214
|
+
|
|
215
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
216
|
+
return Object.freeze({
|
|
217
|
+
accounts: [
|
|
218
|
+
getAccountMeta("authority", accounts.authority),
|
|
219
|
+
getAccountMeta("adminConfig", accounts.adminConfig),
|
|
220
|
+
],
|
|
221
|
+
data: getSetMetadataUpdateAuthorityInstructionDataEncoder().encode(
|
|
222
|
+
args as SetMetadataUpdateAuthorityInstructionDataArgs,
|
|
223
|
+
),
|
|
224
|
+
programAddress,
|
|
225
|
+
} as SetMetadataUpdateAuthorityInstruction<
|
|
226
|
+
TProgramAddress,
|
|
227
|
+
TAccountAuthority,
|
|
228
|
+
TAccountAdminConfig
|
|
229
|
+
>);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export type ParsedSetMetadataUpdateAuthorityInstruction<
|
|
233
|
+
TProgram extends string = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
234
|
+
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
|
|
235
|
+
> = {
|
|
236
|
+
programAddress: Address<TProgram>;
|
|
237
|
+
accounts: {
|
|
238
|
+
authority: TAccountMetas[0];
|
|
239
|
+
adminConfig: TAccountMetas[1];
|
|
240
|
+
};
|
|
241
|
+
data: SetMetadataUpdateAuthorityInstructionData;
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export function parseSetMetadataUpdateAuthorityInstruction<
|
|
245
|
+
TProgram extends string,
|
|
246
|
+
TAccountMetas extends readonly AccountMeta[],
|
|
247
|
+
>(
|
|
248
|
+
instruction: Instruction<TProgram> &
|
|
249
|
+
InstructionWithAccounts<TAccountMetas> &
|
|
250
|
+
InstructionWithData<ReadonlyUint8Array>,
|
|
251
|
+
): ParsedSetMetadataUpdateAuthorityInstruction<TProgram, TAccountMetas> {
|
|
252
|
+
if (instruction.accounts.length < 2) {
|
|
253
|
+
throw new SolanaError(
|
|
254
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
255
|
+
{
|
|
256
|
+
actualAccountMetas: instruction.accounts.length,
|
|
257
|
+
expectedAccountMetas: 2,
|
|
258
|
+
},
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
let accountIndex = 0;
|
|
262
|
+
const getNextAccount = () => {
|
|
263
|
+
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
|
|
264
|
+
accountIndex += 1;
|
|
265
|
+
return accountMeta;
|
|
266
|
+
};
|
|
267
|
+
return {
|
|
268
|
+
programAddress: instruction.programAddress,
|
|
269
|
+
accounts: { authority: getNextAccount(), adminConfig: getNextAccount() },
|
|
270
|
+
data: getSetMetadataUpdateAuthorityInstructionDataDecoder().decode(
|
|
271
|
+
instruction.data,
|
|
272
|
+
),
|
|
273
|
+
};
|
|
274
|
+
}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
combineCodec,
|
|
11
|
+
fixDecoderSize,
|
|
12
|
+
fixEncoderSize,
|
|
13
|
+
getBytesDecoder,
|
|
14
|
+
getBytesEncoder,
|
|
15
|
+
getStructDecoder,
|
|
16
|
+
getStructEncoder,
|
|
17
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
18
|
+
SolanaError,
|
|
19
|
+
transformEncoder,
|
|
20
|
+
type AccountMeta,
|
|
21
|
+
type AccountSignerMeta,
|
|
22
|
+
type Address,
|
|
23
|
+
type FixedSizeCodec,
|
|
24
|
+
type FixedSizeDecoder,
|
|
25
|
+
type FixedSizeEncoder,
|
|
26
|
+
type Instruction,
|
|
27
|
+
type InstructionWithAccounts,
|
|
28
|
+
type InstructionWithData,
|
|
29
|
+
type ReadonlyAccount,
|
|
30
|
+
type ReadonlySignerAccount,
|
|
31
|
+
type ReadonlyUint8Array,
|
|
32
|
+
type TransactionSigner,
|
|
33
|
+
type WritableAccount,
|
|
34
|
+
} from "@solana/kit";
|
|
35
|
+
import {
|
|
36
|
+
getAccountMetaFactory,
|
|
37
|
+
type ResolvedInstructionAccount,
|
|
38
|
+
} from "@solana/program-client-core";
|
|
39
|
+
import { findAdminConfigPda } from "../pdas";
|
|
40
|
+
import { PICON_DLMM_PROGRAM_ADDRESS } from "../programs";
|
|
41
|
+
import {
|
|
42
|
+
getDynamicFeeConfigDecoder,
|
|
43
|
+
getDynamicFeeConfigEncoder,
|
|
44
|
+
type DynamicFeeConfig,
|
|
45
|
+
type DynamicFeeConfigArgs,
|
|
46
|
+
} from "../types";
|
|
47
|
+
|
|
48
|
+
export const SET_POOL_DYNAMIC_FEE_CONFIG_DISCRIMINATOR: ReadonlyUint8Array =
|
|
49
|
+
new Uint8Array([44, 189, 119, 222, 246, 2, 137, 85]);
|
|
50
|
+
|
|
51
|
+
export function getSetPoolDynamicFeeConfigDiscriminatorBytes(): ReadonlyUint8Array {
|
|
52
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
53
|
+
SET_POOL_DYNAMIC_FEE_CONFIG_DISCRIMINATOR,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type SetPoolDynamicFeeConfigInstruction<
|
|
58
|
+
TProgram extends string = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
59
|
+
TAccountAuthority extends string | AccountMeta<string> = string,
|
|
60
|
+
TAccountAdminConfig extends string | AccountMeta<string> = string,
|
|
61
|
+
TAccountPool extends string | AccountMeta<string> = string,
|
|
62
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
63
|
+
> = Instruction<TProgram> &
|
|
64
|
+
InstructionWithData<ReadonlyUint8Array> &
|
|
65
|
+
InstructionWithAccounts<
|
|
66
|
+
[
|
|
67
|
+
TAccountAuthority extends string
|
|
68
|
+
? ReadonlySignerAccount<TAccountAuthority> &
|
|
69
|
+
AccountSignerMeta<TAccountAuthority>
|
|
70
|
+
: TAccountAuthority,
|
|
71
|
+
TAccountAdminConfig extends string
|
|
72
|
+
? ReadonlyAccount<TAccountAdminConfig>
|
|
73
|
+
: TAccountAdminConfig,
|
|
74
|
+
TAccountPool extends string
|
|
75
|
+
? WritableAccount<TAccountPool>
|
|
76
|
+
: TAccountPool,
|
|
77
|
+
...TRemainingAccounts,
|
|
78
|
+
]
|
|
79
|
+
>;
|
|
80
|
+
|
|
81
|
+
export type SetPoolDynamicFeeConfigInstructionData = {
|
|
82
|
+
discriminator: ReadonlyUint8Array;
|
|
83
|
+
config: DynamicFeeConfig;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export type SetPoolDynamicFeeConfigInstructionDataArgs = {
|
|
87
|
+
config: DynamicFeeConfigArgs;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export function getSetPoolDynamicFeeConfigInstructionDataEncoder(): FixedSizeEncoder<SetPoolDynamicFeeConfigInstructionDataArgs> {
|
|
91
|
+
return transformEncoder(
|
|
92
|
+
getStructEncoder([
|
|
93
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
94
|
+
["config", getDynamicFeeConfigEncoder()],
|
|
95
|
+
]),
|
|
96
|
+
(value) => ({
|
|
97
|
+
...value,
|
|
98
|
+
discriminator: SET_POOL_DYNAMIC_FEE_CONFIG_DISCRIMINATOR,
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function getSetPoolDynamicFeeConfigInstructionDataDecoder(): FixedSizeDecoder<SetPoolDynamicFeeConfigInstructionData> {
|
|
104
|
+
return getStructDecoder([
|
|
105
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
106
|
+
["config", getDynamicFeeConfigDecoder()],
|
|
107
|
+
]);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function getSetPoolDynamicFeeConfigInstructionDataCodec(): FixedSizeCodec<
|
|
111
|
+
SetPoolDynamicFeeConfigInstructionDataArgs,
|
|
112
|
+
SetPoolDynamicFeeConfigInstructionData
|
|
113
|
+
> {
|
|
114
|
+
return combineCodec(
|
|
115
|
+
getSetPoolDynamicFeeConfigInstructionDataEncoder(),
|
|
116
|
+
getSetPoolDynamicFeeConfigInstructionDataDecoder(),
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type SetPoolDynamicFeeConfigAsyncInput<
|
|
121
|
+
TAccountAuthority extends string = string,
|
|
122
|
+
TAccountAdminConfig extends string = string,
|
|
123
|
+
TAccountPool extends string = string,
|
|
124
|
+
> = {
|
|
125
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
126
|
+
adminConfig?: Address<TAccountAdminConfig>;
|
|
127
|
+
pool: Address<TAccountPool>;
|
|
128
|
+
config: SetPoolDynamicFeeConfigInstructionDataArgs["config"];
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export async function getSetPoolDynamicFeeConfigInstructionAsync<
|
|
132
|
+
TAccountAuthority extends string,
|
|
133
|
+
TAccountAdminConfig extends string,
|
|
134
|
+
TAccountPool extends string,
|
|
135
|
+
TProgramAddress extends Address = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
136
|
+
>(
|
|
137
|
+
input: SetPoolDynamicFeeConfigAsyncInput<
|
|
138
|
+
TAccountAuthority,
|
|
139
|
+
TAccountAdminConfig,
|
|
140
|
+
TAccountPool
|
|
141
|
+
>,
|
|
142
|
+
config?: { programAddress?: TProgramAddress },
|
|
143
|
+
): Promise<
|
|
144
|
+
SetPoolDynamicFeeConfigInstruction<
|
|
145
|
+
TProgramAddress,
|
|
146
|
+
TAccountAuthority,
|
|
147
|
+
TAccountAdminConfig,
|
|
148
|
+
TAccountPool
|
|
149
|
+
>
|
|
150
|
+
> {
|
|
151
|
+
// Program address.
|
|
152
|
+
const programAddress = config?.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
|
|
153
|
+
|
|
154
|
+
// Original accounts.
|
|
155
|
+
const originalAccounts = {
|
|
156
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
157
|
+
adminConfig: { value: input.adminConfig ?? null, isWritable: false },
|
|
158
|
+
pool: { value: input.pool ?? null, isWritable: true },
|
|
159
|
+
};
|
|
160
|
+
const accounts = originalAccounts as Record<
|
|
161
|
+
keyof typeof originalAccounts,
|
|
162
|
+
ResolvedInstructionAccount
|
|
163
|
+
>;
|
|
164
|
+
|
|
165
|
+
// Original args.
|
|
166
|
+
const args = { ...input };
|
|
167
|
+
|
|
168
|
+
// Resolve default values.
|
|
169
|
+
if (!accounts.adminConfig.value) {
|
|
170
|
+
accounts.adminConfig.value = await findAdminConfigPda();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
174
|
+
return Object.freeze({
|
|
175
|
+
accounts: [
|
|
176
|
+
getAccountMeta("authority", accounts.authority),
|
|
177
|
+
getAccountMeta("adminConfig", accounts.adminConfig),
|
|
178
|
+
getAccountMeta("pool", accounts.pool),
|
|
179
|
+
],
|
|
180
|
+
data: getSetPoolDynamicFeeConfigInstructionDataEncoder().encode(
|
|
181
|
+
args as SetPoolDynamicFeeConfigInstructionDataArgs,
|
|
182
|
+
),
|
|
183
|
+
programAddress,
|
|
184
|
+
} as SetPoolDynamicFeeConfigInstruction<
|
|
185
|
+
TProgramAddress,
|
|
186
|
+
TAccountAuthority,
|
|
187
|
+
TAccountAdminConfig,
|
|
188
|
+
TAccountPool
|
|
189
|
+
>);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export type SetPoolDynamicFeeConfigInput<
|
|
193
|
+
TAccountAuthority extends string = string,
|
|
194
|
+
TAccountAdminConfig extends string = string,
|
|
195
|
+
TAccountPool extends string = string,
|
|
196
|
+
> = {
|
|
197
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
198
|
+
adminConfig: Address<TAccountAdminConfig>;
|
|
199
|
+
pool: Address<TAccountPool>;
|
|
200
|
+
config: SetPoolDynamicFeeConfigInstructionDataArgs["config"];
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export function getSetPoolDynamicFeeConfigInstruction<
|
|
204
|
+
TAccountAuthority extends string,
|
|
205
|
+
TAccountAdminConfig extends string,
|
|
206
|
+
TAccountPool extends string,
|
|
207
|
+
TProgramAddress extends Address = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
208
|
+
>(
|
|
209
|
+
input: SetPoolDynamicFeeConfigInput<
|
|
210
|
+
TAccountAuthority,
|
|
211
|
+
TAccountAdminConfig,
|
|
212
|
+
TAccountPool
|
|
213
|
+
>,
|
|
214
|
+
config?: { programAddress?: TProgramAddress },
|
|
215
|
+
): SetPoolDynamicFeeConfigInstruction<
|
|
216
|
+
TProgramAddress,
|
|
217
|
+
TAccountAuthority,
|
|
218
|
+
TAccountAdminConfig,
|
|
219
|
+
TAccountPool
|
|
220
|
+
> {
|
|
221
|
+
// Program address.
|
|
222
|
+
const programAddress = config?.programAddress ?? PICON_DLMM_PROGRAM_ADDRESS;
|
|
223
|
+
|
|
224
|
+
// Original accounts.
|
|
225
|
+
const originalAccounts = {
|
|
226
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
227
|
+
adminConfig: { value: input.adminConfig ?? null, isWritable: false },
|
|
228
|
+
pool: { value: input.pool ?? null, isWritable: true },
|
|
229
|
+
};
|
|
230
|
+
const accounts = originalAccounts as Record<
|
|
231
|
+
keyof typeof originalAccounts,
|
|
232
|
+
ResolvedInstructionAccount
|
|
233
|
+
>;
|
|
234
|
+
|
|
235
|
+
// Original args.
|
|
236
|
+
const args = { ...input };
|
|
237
|
+
|
|
238
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
239
|
+
return Object.freeze({
|
|
240
|
+
accounts: [
|
|
241
|
+
getAccountMeta("authority", accounts.authority),
|
|
242
|
+
getAccountMeta("adminConfig", accounts.adminConfig),
|
|
243
|
+
getAccountMeta("pool", accounts.pool),
|
|
244
|
+
],
|
|
245
|
+
data: getSetPoolDynamicFeeConfigInstructionDataEncoder().encode(
|
|
246
|
+
args as SetPoolDynamicFeeConfigInstructionDataArgs,
|
|
247
|
+
),
|
|
248
|
+
programAddress,
|
|
249
|
+
} as SetPoolDynamicFeeConfigInstruction<
|
|
250
|
+
TProgramAddress,
|
|
251
|
+
TAccountAuthority,
|
|
252
|
+
TAccountAdminConfig,
|
|
253
|
+
TAccountPool
|
|
254
|
+
>);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export type ParsedSetPoolDynamicFeeConfigInstruction<
|
|
258
|
+
TProgram extends string = typeof PICON_DLMM_PROGRAM_ADDRESS,
|
|
259
|
+
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
|
|
260
|
+
> = {
|
|
261
|
+
programAddress: Address<TProgram>;
|
|
262
|
+
accounts: {
|
|
263
|
+
authority: TAccountMetas[0];
|
|
264
|
+
adminConfig: TAccountMetas[1];
|
|
265
|
+
pool: TAccountMetas[2];
|
|
266
|
+
};
|
|
267
|
+
data: SetPoolDynamicFeeConfigInstructionData;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
export function parseSetPoolDynamicFeeConfigInstruction<
|
|
271
|
+
TProgram extends string,
|
|
272
|
+
TAccountMetas extends readonly AccountMeta[],
|
|
273
|
+
>(
|
|
274
|
+
instruction: Instruction<TProgram> &
|
|
275
|
+
InstructionWithAccounts<TAccountMetas> &
|
|
276
|
+
InstructionWithData<ReadonlyUint8Array>,
|
|
277
|
+
): ParsedSetPoolDynamicFeeConfigInstruction<TProgram, TAccountMetas> {
|
|
278
|
+
if (instruction.accounts.length < 3) {
|
|
279
|
+
throw new SolanaError(
|
|
280
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
281
|
+
{
|
|
282
|
+
actualAccountMetas: instruction.accounts.length,
|
|
283
|
+
expectedAccountMetas: 3,
|
|
284
|
+
},
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
let accountIndex = 0;
|
|
288
|
+
const getNextAccount = () => {
|
|
289
|
+
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
|
|
290
|
+
accountIndex += 1;
|
|
291
|
+
return accountMeta;
|
|
292
|
+
};
|
|
293
|
+
return {
|
|
294
|
+
programAddress: instruction.programAddress,
|
|
295
|
+
accounts: {
|
|
296
|
+
authority: getNextAccount(),
|
|
297
|
+
adminConfig: getNextAccount(),
|
|
298
|
+
pool: getNextAccount(),
|
|
299
|
+
},
|
|
300
|
+
data: getSetPoolDynamicFeeConfigInstructionDataDecoder().decode(
|
|
301
|
+
instruction.data,
|
|
302
|
+
),
|
|
303
|
+
};
|
|
304
|
+
}
|