@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
package/dist/events.js
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// Hand-written event decoding — Codama's Anchor-IDL conversion (`@codama/nodes-from-anchor`)
|
|
2
|
+
// currently drops the IDL's `events` field entirely, so there's nothing to generate this from
|
|
3
|
+
// yet (confirmed: `SwapEvent` etc. don't even survive as plain defined types in the
|
|
4
|
+
// intermediate Codama IDL, let alone get rendered). Once Codama adds event support, this file
|
|
5
|
+
// should be deleted in favor of the generated equivalent — the codec style below matches
|
|
6
|
+
// `generated/types/*.ts` exactly for that reason.
|
|
7
|
+
import { getAddressDecoder, getBase64Encoder, getBooleanDecoder, getI32Decoder, getStructDecoder, getU16Decoder, getU32Decoder, getU64Decoder, } from "@solana/kit";
|
|
8
|
+
import { PICON_DLMM_PROGRAM_ADDRESS } from "./generated";
|
|
9
|
+
function getCreatePoolEventDecoder() {
|
|
10
|
+
return getStructDecoder([
|
|
11
|
+
["pool", getAddressDecoder()],
|
|
12
|
+
["binStep", getU16Decoder()],
|
|
13
|
+
["feeRate", getU32Decoder()],
|
|
14
|
+
["tokenMintX", getAddressDecoder()],
|
|
15
|
+
["tokenMintY", getAddressDecoder()],
|
|
16
|
+
]);
|
|
17
|
+
}
|
|
18
|
+
function getOpenPositionEventDecoder() {
|
|
19
|
+
return getStructDecoder([
|
|
20
|
+
["pool", getAddressDecoder()],
|
|
21
|
+
["position", getAddressDecoder()],
|
|
22
|
+
["owner", getAddressDecoder()],
|
|
23
|
+
["lowerBinId", getI32Decoder()],
|
|
24
|
+
["upperBinId", getI32Decoder()],
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
function getClosePositionEventDecoder() {
|
|
28
|
+
return getStructDecoder([
|
|
29
|
+
["pool", getAddressDecoder()],
|
|
30
|
+
["position", getAddressDecoder()],
|
|
31
|
+
["owner", getAddressDecoder()],
|
|
32
|
+
["lowerBinId", getI32Decoder()],
|
|
33
|
+
["upperBinId", getI32Decoder()],
|
|
34
|
+
]);
|
|
35
|
+
}
|
|
36
|
+
function getDepositEventDecoder() {
|
|
37
|
+
return getStructDecoder([
|
|
38
|
+
["pool", getAddressDecoder()],
|
|
39
|
+
["position", getAddressDecoder()],
|
|
40
|
+
["owner", getAddressDecoder()],
|
|
41
|
+
["lowerBinId", getI32Decoder()],
|
|
42
|
+
["upperBinId", getI32Decoder()],
|
|
43
|
+
["amountX", getU64Decoder()],
|
|
44
|
+
["amountY", getU64Decoder()],
|
|
45
|
+
["transferFeeX", getU64Decoder()],
|
|
46
|
+
["transferFeeY", getU64Decoder()],
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
49
|
+
function getWithdrawEventDecoder() {
|
|
50
|
+
return getStructDecoder([
|
|
51
|
+
["pool", getAddressDecoder()],
|
|
52
|
+
["position", getAddressDecoder()],
|
|
53
|
+
["owner", getAddressDecoder()],
|
|
54
|
+
["lowerBinId", getI32Decoder()],
|
|
55
|
+
["upperBinId", getI32Decoder()],
|
|
56
|
+
["bpsRemoved", getU16Decoder()],
|
|
57
|
+
["amountX", getU64Decoder()],
|
|
58
|
+
["amountY", getU64Decoder()],
|
|
59
|
+
["transferFeeX", getU64Decoder()],
|
|
60
|
+
["transferFeeY", getU64Decoder()],
|
|
61
|
+
]);
|
|
62
|
+
}
|
|
63
|
+
function getClaimFeeEventDecoder() {
|
|
64
|
+
return getStructDecoder([
|
|
65
|
+
["pool", getAddressDecoder()],
|
|
66
|
+
["position", getAddressDecoder()],
|
|
67
|
+
["owner", getAddressDecoder()],
|
|
68
|
+
["lowerBinId", getI32Decoder()],
|
|
69
|
+
["upperBinId", getI32Decoder()],
|
|
70
|
+
["amountX", getU64Decoder()],
|
|
71
|
+
["amountY", getU64Decoder()],
|
|
72
|
+
["transferFeeX", getU64Decoder()],
|
|
73
|
+
["transferFeeY", getU64Decoder()],
|
|
74
|
+
]);
|
|
75
|
+
}
|
|
76
|
+
function getSwapEventDecoder() {
|
|
77
|
+
return getStructDecoder([
|
|
78
|
+
["pool", getAddressDecoder()],
|
|
79
|
+
["xToY", getBooleanDecoder()],
|
|
80
|
+
["preBinId", getI32Decoder()],
|
|
81
|
+
["postBinId", getI32Decoder()],
|
|
82
|
+
["amountIn", getU64Decoder()],
|
|
83
|
+
["amountOut", getU64Decoder()],
|
|
84
|
+
["inputTransferFee", getU64Decoder()],
|
|
85
|
+
["outputTransferFee", getU64Decoder()],
|
|
86
|
+
["lpFee", getU64Decoder()],
|
|
87
|
+
["protocolFee", getU64Decoder()],
|
|
88
|
+
]);
|
|
89
|
+
}
|
|
90
|
+
// Discriminators are the first 8 bytes of sha256("event:<EventName>") — copied from the IDL's
|
|
91
|
+
// `events` array (`ts-sdk/src/picon_dlmm.json`), same derivation Anchor uses for accounts.
|
|
92
|
+
const DISCRIMINATORS = {
|
|
93
|
+
CreatePoolEvent: [177, 49, 12, 210, 160, 118, 167, 116],
|
|
94
|
+
OpenPositionEvent: [83, 43, 164, 147, 169, 87, 81, 172],
|
|
95
|
+
ClosePositionEvent: [198, 217, 115, 95, 191, 120, 142, 137],
|
|
96
|
+
DepositEvent: [120, 248, 61, 83, 31, 142, 107, 144],
|
|
97
|
+
WithdrawEvent: [22, 9, 133, 26, 160, 44, 71, 192],
|
|
98
|
+
ClaimFeeEvent: [173, 80, 235, 15, 116, 19, 144, 33],
|
|
99
|
+
SwapEvent: [64, 198, 205, 232, 38, 8, 113, 226],
|
|
100
|
+
};
|
|
101
|
+
const DECODERS = {
|
|
102
|
+
CreatePoolEvent: getCreatePoolEventDecoder(),
|
|
103
|
+
OpenPositionEvent: getOpenPositionEventDecoder(),
|
|
104
|
+
ClosePositionEvent: getClosePositionEventDecoder(),
|
|
105
|
+
DepositEvent: getDepositEventDecoder(),
|
|
106
|
+
WithdrawEvent: getWithdrawEventDecoder(),
|
|
107
|
+
ClaimFeeEvent: getClaimFeeEventDecoder(),
|
|
108
|
+
SwapEvent: getSwapEventDecoder(),
|
|
109
|
+
};
|
|
110
|
+
const PROGRAM_DATA_PREFIX = "Program data: ";
|
|
111
|
+
// `emit!` (not `emit_cpi!`) writes each event as a `Program data: <base64>` log line — the
|
|
112
|
+
// base64 payload is [8-byte discriminator][borsh-encoded fields], same layout as an account.
|
|
113
|
+
function decodeEventBytes(bytes) {
|
|
114
|
+
const discriminator = bytes.subarray(0, 8);
|
|
115
|
+
const body = bytes.subarray(8);
|
|
116
|
+
for (const name of Object.keys(DISCRIMINATORS)) {
|
|
117
|
+
const expected = DISCRIMINATORS[name];
|
|
118
|
+
if (expected.every((byte, i) => byte === discriminator[i])) {
|
|
119
|
+
return { name, data: DECODERS[name].decode(body) };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
// Decodes a single `Program data: ...` log line, or returns undefined if the line isn't one
|
|
125
|
+
// (or belongs to an event this SDK doesn't know about).
|
|
126
|
+
export function decodeEventFromLogLine(logLine) {
|
|
127
|
+
if (!logLine.startsWith(PROGRAM_DATA_PREFIX)) {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
const base64Payload = logLine.slice(PROGRAM_DATA_PREFIX.length);
|
|
131
|
+
const bytes = getBase64Encoder().encode(base64Payload);
|
|
132
|
+
return decodeEventBytes(bytes);
|
|
133
|
+
}
|
|
134
|
+
// Matches the "Program <address> invoke [<depth>]" / "Program <address> success"/"failed"
|
|
135
|
+
// bracket Solana emits around every top-level call and CPI.
|
|
136
|
+
const INVOKE_LOG = /^Program (\w+) invoke \[\d+\]$/;
|
|
137
|
+
const RESULT_LOG = /^Program (\w+) (?:success|failed)/;
|
|
138
|
+
// Decodes every recognized event out of a transaction's full log array, in log order —
|
|
139
|
+
// scoped to lines logged while this program is the currently-executing one, tracked via the
|
|
140
|
+
// invoke/success bracket above. Without this, a "Program data:" line from a CPI'd program that
|
|
141
|
+
// happens to emit an identically-named (and thus identically-discriminated, since Anchor
|
|
142
|
+
// derives discriminators from the event name alone) event would be mis-decoded as ours, or
|
|
143
|
+
// throw if its body doesn't match our layout.
|
|
144
|
+
export function decodeEventsFromLogs(logs, programAddress = PICON_DLMM_PROGRAM_ADDRESS) {
|
|
145
|
+
const events = [];
|
|
146
|
+
const programStack = [];
|
|
147
|
+
for (const line of logs) {
|
|
148
|
+
const invokeMatch = INVOKE_LOG.exec(line);
|
|
149
|
+
if (invokeMatch !== null) {
|
|
150
|
+
programStack.push(invokeMatch[1]);
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (RESULT_LOG.test(line)) {
|
|
154
|
+
programStack.pop();
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
if (programStack[programStack.length - 1] !== programAddress) {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
const event = decodeEventFromLogLine(line);
|
|
161
|
+
if (event !== undefined) {
|
|
162
|
+
events.push(event);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return events;
|
|
166
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type EncodedAccount, type FetchAccountConfig, type FetchAccountsConfig, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from "@solana/kit";
|
|
9
|
+
export declare const ADMIN_CONFIG_DISCRIMINATOR: ReadonlyUint8Array;
|
|
10
|
+
export declare function getAdminConfigDiscriminatorBytes(): ReadonlyUint8Array;
|
|
11
|
+
export type AdminConfig = {
|
|
12
|
+
discriminator: ReadonlyUint8Array;
|
|
13
|
+
authority: Address;
|
|
14
|
+
pendingAuthority: Address;
|
|
15
|
+
metadataUpdateAuthority: Address;
|
|
16
|
+
};
|
|
17
|
+
export type AdminConfigArgs = {
|
|
18
|
+
authority: Address;
|
|
19
|
+
pendingAuthority: Address;
|
|
20
|
+
metadataUpdateAuthority: Address;
|
|
21
|
+
};
|
|
22
|
+
/** Gets the encoder for {@link AdminConfigArgs} account data. */
|
|
23
|
+
export declare function getAdminConfigEncoder(): FixedSizeEncoder<AdminConfigArgs>;
|
|
24
|
+
/** Gets the decoder for {@link AdminConfig} account data. */
|
|
25
|
+
export declare function getAdminConfigDecoder(): FixedSizeDecoder<AdminConfig>;
|
|
26
|
+
/** Gets the codec for {@link AdminConfig} account data. */
|
|
27
|
+
export declare function getAdminConfigCodec(): FixedSizeCodec<AdminConfigArgs, AdminConfig>;
|
|
28
|
+
export declare function decodeAdminConfig<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<AdminConfig, TAddress>;
|
|
29
|
+
export declare function decodeAdminConfig<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<AdminConfig, TAddress>;
|
|
30
|
+
export declare function fetchAdminConfig<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<AdminConfig, TAddress>>;
|
|
31
|
+
export declare function fetchMaybeAdminConfig<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<AdminConfig, TAddress>>;
|
|
32
|
+
export declare function fetchAllAdminConfig(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<AdminConfig>[]>;
|
|
33
|
+
export declare function fetchAllMaybeAdminConfig(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<AdminConfig>[]>;
|
|
34
|
+
export declare function getAdminConfigSize(): number;
|
|
35
|
+
//# sourceMappingURL=adminConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adminConfig.d.ts","sourceRoot":"","sources":["../../../src/generated/accounts/adminConfig.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAKL,mBAAmB,EACnB,oBAAoB,EAUpB,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,0BAA0B,EAAE,kBAEvC,CAAC;AAEH,wBAAgB,gCAAgC,IAAI,kBAAkB,CAIrE;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,aAAa,EAAE,kBAAkB,CAAC;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,uBAAuB,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,uBAAuB,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF,iEAAiE;AACjE,wBAAgB,qBAAqB,IAAI,gBAAgB,CAAC,eAAe,CAAC,CAUzE;AAED,6DAA6D;AAC7D,wBAAgB,qBAAqB,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAOrE;AAED,2DAA2D;AAC3D,wBAAgB,mBAAmB,IAAI,cAAc,CACnD,eAAe,EACf,WAAW,CACZ,CAEA;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,EAChE,cAAc,EAAE,cAAc,CAAC,QAAQ,CAAC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,kBAAkB,IAAI,MAAM,CAE3C"}
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
import { assertAccountExists, assertAccountsExist, combineCodec, decodeAccount, fetchEncodedAccount, fetchEncodedAccounts, fixDecoderSize, fixEncoderSize, getAddressDecoder, getAddressEncoder, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, transformEncoder, } from "@solana/kit";
|
|
9
|
+
export const ADMIN_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
10
|
+
156, 10, 79, 161, 71, 9, 62, 77,
|
|
11
|
+
]);
|
|
12
|
+
export function getAdminConfigDiscriminatorBytes() {
|
|
13
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(ADMIN_CONFIG_DISCRIMINATOR);
|
|
14
|
+
}
|
|
15
|
+
/** Gets the encoder for {@link AdminConfigArgs} account data. */
|
|
16
|
+
export function getAdminConfigEncoder() {
|
|
17
|
+
return transformEncoder(getStructEncoder([
|
|
18
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
19
|
+
["authority", getAddressEncoder()],
|
|
20
|
+
["pendingAuthority", getAddressEncoder()],
|
|
21
|
+
["metadataUpdateAuthority", getAddressEncoder()],
|
|
22
|
+
]), (value) => ({ ...value, discriminator: ADMIN_CONFIG_DISCRIMINATOR }));
|
|
23
|
+
}
|
|
24
|
+
/** Gets the decoder for {@link AdminConfig} account data. */
|
|
25
|
+
export function getAdminConfigDecoder() {
|
|
26
|
+
return getStructDecoder([
|
|
27
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
28
|
+
["authority", getAddressDecoder()],
|
|
29
|
+
["pendingAuthority", getAddressDecoder()],
|
|
30
|
+
["metadataUpdateAuthority", getAddressDecoder()],
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
/** Gets the codec for {@link AdminConfig} account data. */
|
|
34
|
+
export function getAdminConfigCodec() {
|
|
35
|
+
return combineCodec(getAdminConfigEncoder(), getAdminConfigDecoder());
|
|
36
|
+
}
|
|
37
|
+
export function decodeAdminConfig(encodedAccount) {
|
|
38
|
+
return decodeAccount(encodedAccount, getAdminConfigDecoder());
|
|
39
|
+
}
|
|
40
|
+
export async function fetchAdminConfig(rpc, address, config) {
|
|
41
|
+
const maybeAccount = await fetchMaybeAdminConfig(rpc, address, config);
|
|
42
|
+
assertAccountExists(maybeAccount);
|
|
43
|
+
return maybeAccount;
|
|
44
|
+
}
|
|
45
|
+
export async function fetchMaybeAdminConfig(rpc, address, config) {
|
|
46
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
|
|
47
|
+
return decodeAdminConfig(maybeAccount);
|
|
48
|
+
}
|
|
49
|
+
export async function fetchAllAdminConfig(rpc, addresses, config) {
|
|
50
|
+
const maybeAccounts = await fetchAllMaybeAdminConfig(rpc, addresses, config);
|
|
51
|
+
assertAccountsExist(maybeAccounts);
|
|
52
|
+
return maybeAccounts;
|
|
53
|
+
}
|
|
54
|
+
export async function fetchAllMaybeAdminConfig(rpc, addresses, config) {
|
|
55
|
+
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
56
|
+
return maybeAccounts.map((maybeAccount) => decodeAdminConfig(maybeAccount));
|
|
57
|
+
}
|
|
58
|
+
export function getAdminConfigSize() {
|
|
59
|
+
return 104;
|
|
60
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type EncodedAccount, type FetchAccountConfig, type FetchAccountsConfig, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from "@solana/kit";
|
|
9
|
+
import { type Bin, type BinArgs } from "../types";
|
|
10
|
+
export declare const BIN_ARRAY_DISCRIMINATOR: ReadonlyUint8Array;
|
|
11
|
+
export declare function getBinArrayDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type BinArray = {
|
|
13
|
+
discriminator: ReadonlyUint8Array;
|
|
14
|
+
index: number;
|
|
15
|
+
pool: Address;
|
|
16
|
+
payer: Address;
|
|
17
|
+
padding: ReadonlyUint8Array;
|
|
18
|
+
bins: Array<Bin>;
|
|
19
|
+
};
|
|
20
|
+
export type BinArrayArgs = {
|
|
21
|
+
index: number;
|
|
22
|
+
pool: Address;
|
|
23
|
+
payer: Address;
|
|
24
|
+
padding: ReadonlyUint8Array;
|
|
25
|
+
bins: Array<BinArgs>;
|
|
26
|
+
};
|
|
27
|
+
/** Gets the encoder for {@link BinArrayArgs} account data. */
|
|
28
|
+
export declare function getBinArrayEncoder(): FixedSizeEncoder<BinArrayArgs>;
|
|
29
|
+
/** Gets the decoder for {@link BinArray} account data. */
|
|
30
|
+
export declare function getBinArrayDecoder(): FixedSizeDecoder<BinArray>;
|
|
31
|
+
/** Gets the codec for {@link BinArray} account data. */
|
|
32
|
+
export declare function getBinArrayCodec(): FixedSizeCodec<BinArrayArgs, BinArray>;
|
|
33
|
+
export declare function decodeBinArray<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<BinArray, TAddress>;
|
|
34
|
+
export declare function decodeBinArray<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<BinArray, TAddress>;
|
|
35
|
+
export declare function fetchBinArray<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<BinArray, TAddress>>;
|
|
36
|
+
export declare function fetchMaybeBinArray<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<BinArray, TAddress>>;
|
|
37
|
+
export declare function fetchAllBinArray(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<BinArray>[]>;
|
|
38
|
+
export declare function fetchAllMaybeBinArray(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<BinArray>[]>;
|
|
39
|
+
export declare function getBinArraySize(): number;
|
|
40
|
+
//# sourceMappingURL=binArray.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binArray.d.ts","sourceRoot":"","sources":["../../../src/generated/accounts/binArray.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAKL,mBAAmB,EACnB,oBAAoB,EAcpB,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAgC,KAAK,GAAG,EAAE,KAAK,OAAO,EAAE,MAAM,UAAU,CAAC;AAEhF,eAAO,MAAM,uBAAuB,EAAE,kBAEpC,CAAC;AAEH,wBAAgB,6BAA6B,IAAI,kBAAkB,CAElE;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,aAAa,EAAE,kBAAkB,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,kBAAkB,CAAC;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C,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAG3C;AAED,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,EAC/C,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,EACzB,MAAM,CAAC,EAAE,mBAAmB,GAC3B,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAI9B;AAED,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,EAC/C,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,EACzB,MAAM,CAAC,EAAE,mBAAmB,GAC3B,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,CAGnC;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
import { assertAccountExists, assertAccountsExist, combineCodec, decodeAccount, fetchEncodedAccount, fetchEncodedAccounts, fixDecoderSize, fixEncoderSize, getAddressDecoder, getAddressEncoder, getArrayDecoder, getArrayEncoder, getBytesDecoder, getBytesEncoder, getI32Decoder, getI32Encoder, getStructDecoder, getStructEncoder, transformEncoder, } from "@solana/kit";
|
|
9
|
+
import { getBinDecoder, getBinEncoder } from "../types";
|
|
10
|
+
export const BIN_ARRAY_DISCRIMINATOR = new Uint8Array([
|
|
11
|
+
92, 142, 92, 220, 5, 148, 70, 181,
|
|
12
|
+
]);
|
|
13
|
+
export function getBinArrayDiscriminatorBytes() {
|
|
14
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(BIN_ARRAY_DISCRIMINATOR);
|
|
15
|
+
}
|
|
16
|
+
/** Gets the encoder for {@link BinArrayArgs} account data. */
|
|
17
|
+
export function getBinArrayEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([
|
|
19
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
20
|
+
["index", getI32Encoder()],
|
|
21
|
+
["pool", getAddressEncoder()],
|
|
22
|
+
["payer", getAddressEncoder()],
|
|
23
|
+
["padding", fixEncoderSize(getBytesEncoder(), 12)],
|
|
24
|
+
["bins", getArrayEncoder(getBinEncoder(), { size: 100 })],
|
|
25
|
+
]), (value) => ({ ...value, discriminator: BIN_ARRAY_DISCRIMINATOR }));
|
|
26
|
+
}
|
|
27
|
+
/** Gets the decoder for {@link BinArray} account data. */
|
|
28
|
+
export function getBinArrayDecoder() {
|
|
29
|
+
return getStructDecoder([
|
|
30
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
31
|
+
["index", getI32Decoder()],
|
|
32
|
+
["pool", getAddressDecoder()],
|
|
33
|
+
["payer", getAddressDecoder()],
|
|
34
|
+
["padding", fixDecoderSize(getBytesDecoder(), 12)],
|
|
35
|
+
["bins", getArrayDecoder(getBinDecoder(), { size: 100 })],
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
38
|
+
/** Gets the codec for {@link BinArray} account data. */
|
|
39
|
+
export function getBinArrayCodec() {
|
|
40
|
+
return combineCodec(getBinArrayEncoder(), getBinArrayDecoder());
|
|
41
|
+
}
|
|
42
|
+
export function decodeBinArray(encodedAccount) {
|
|
43
|
+
return decodeAccount(encodedAccount, getBinArrayDecoder());
|
|
44
|
+
}
|
|
45
|
+
export async function fetchBinArray(rpc, address, config) {
|
|
46
|
+
const maybeAccount = await fetchMaybeBinArray(rpc, address, config);
|
|
47
|
+
assertAccountExists(maybeAccount);
|
|
48
|
+
return maybeAccount;
|
|
49
|
+
}
|
|
50
|
+
export async function fetchMaybeBinArray(rpc, address, config) {
|
|
51
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
|
|
52
|
+
return decodeBinArray(maybeAccount);
|
|
53
|
+
}
|
|
54
|
+
export async function fetchAllBinArray(rpc, addresses, config) {
|
|
55
|
+
const maybeAccounts = await fetchAllMaybeBinArray(rpc, addresses, config);
|
|
56
|
+
assertAccountsExist(maybeAccounts);
|
|
57
|
+
return maybeAccounts;
|
|
58
|
+
}
|
|
59
|
+
export async function fetchAllMaybeBinArray(rpc, addresses, config) {
|
|
60
|
+
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
61
|
+
return maybeAccounts.map((maybeAccount) => decodeBinArray(maybeAccount));
|
|
62
|
+
}
|
|
63
|
+
export function getBinArraySize() {
|
|
64
|
+
return 8088;
|
|
65
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
export * from "./adminConfig";
|
|
9
|
+
export * from "./binArray";
|
|
10
|
+
export * from "./pool";
|
|
11
|
+
export * from "./position";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generated/accounts/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
export * from "./adminConfig";
|
|
9
|
+
export * from "./binArray";
|
|
10
|
+
export * from "./pool";
|
|
11
|
+
export * from "./position";
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type EncodedAccount, type FetchAccountConfig, type FetchAccountsConfig, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from "@solana/kit";
|
|
9
|
+
import { type DynamicFeeState, type DynamicFeeStateArgs } from "../types";
|
|
10
|
+
export declare const POOL_DISCRIMINATOR: ReadonlyUint8Array;
|
|
11
|
+
export declare function getPoolDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type Pool = {
|
|
13
|
+
discriminator: ReadonlyUint8Array;
|
|
14
|
+
binStep: number;
|
|
15
|
+
feeRate: number;
|
|
16
|
+
protocolShare: number;
|
|
17
|
+
bump: ReadonlyUint8Array;
|
|
18
|
+
activeBinId: number;
|
|
19
|
+
dynamicFeeState: DynamicFeeState;
|
|
20
|
+
tokenMintX: Address;
|
|
21
|
+
tokenMintY: Address;
|
|
22
|
+
tokenVaultX: Address;
|
|
23
|
+
tokenVaultY: Address;
|
|
24
|
+
protocolFeeX: bigint;
|
|
25
|
+
protocolFeeY: bigint;
|
|
26
|
+
};
|
|
27
|
+
export type PoolArgs = {
|
|
28
|
+
binStep: number;
|
|
29
|
+
feeRate: number;
|
|
30
|
+
protocolShare: number;
|
|
31
|
+
bump: ReadonlyUint8Array;
|
|
32
|
+
activeBinId: number;
|
|
33
|
+
dynamicFeeState: DynamicFeeStateArgs;
|
|
34
|
+
tokenMintX: Address;
|
|
35
|
+
tokenMintY: Address;
|
|
36
|
+
tokenVaultX: Address;
|
|
37
|
+
tokenVaultY: Address;
|
|
38
|
+
protocolFeeX: number | bigint;
|
|
39
|
+
protocolFeeY: number | bigint;
|
|
40
|
+
};
|
|
41
|
+
/** Gets the encoder for {@link PoolArgs} account data. */
|
|
42
|
+
export declare function getPoolEncoder(): FixedSizeEncoder<PoolArgs>;
|
|
43
|
+
/** Gets the decoder for {@link Pool} account data. */
|
|
44
|
+
export declare function getPoolDecoder(): FixedSizeDecoder<Pool>;
|
|
45
|
+
/** Gets the codec for {@link Pool} account data. */
|
|
46
|
+
export declare function getPoolCodec(): FixedSizeCodec<PoolArgs, Pool>;
|
|
47
|
+
export declare function decodePool<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<Pool, TAddress>;
|
|
48
|
+
export declare function decodePool<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<Pool, TAddress>;
|
|
49
|
+
export declare function fetchPool<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<Pool, TAddress>>;
|
|
50
|
+
export declare function fetchMaybePool<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<Pool, TAddress>>;
|
|
51
|
+
export declare function fetchAllPool(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<Pool>[]>;
|
|
52
|
+
export declare function fetchAllMaybePool(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<Pool>[]>;
|
|
53
|
+
export declare function getPoolSize(): number;
|
|
54
|
+
//# sourceMappingURL=pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../../src/generated/accounts/pool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAKL,mBAAmB,EACnB,oBAAoB,EAkBpB,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACzB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,kBAAkB,EAAE,kBAE/B,CAAC;AAEH,wBAAgB,yBAAyB,IAAI,kBAAkB,CAE9D;AAED,MAAM,MAAM,IAAI,GAAG;IACjB,aAAa,EAAE,kBAAkB,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,kBAAkB,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,kBAAkB,CAAC;IACzB,WAA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E,OAAO,CAAC,QAAQ,CAAC,EAC1B,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAGvC;AAED,wBAAsB,YAAY,CAChC,GAAG,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,EAC/C,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,EACzB,MAAM,CAAC,EAAE,mBAAmB,GAC3B,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAI1B;AAED,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,EAC/C,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,EACzB,MAAM,CAAC,EAAE,mBAAmB,GAC3B,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAG/B;AAED,wBAAgB,WAAW,IAAI,MAAM,CAEpC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
import { assertAccountExists, assertAccountsExist, combineCodec, decodeAccount, fetchEncodedAccount, fetchEncodedAccounts, fixDecoderSize, fixEncoderSize, getAddressDecoder, getAddressEncoder, getBytesDecoder, getBytesEncoder, getI32Decoder, getI32Encoder, getStructDecoder, getStructEncoder, getU16Decoder, getU16Encoder, getU32Decoder, getU32Encoder, getU64Decoder, getU64Encoder, transformEncoder, } from "@solana/kit";
|
|
9
|
+
import { getDynamicFeeStateDecoder, getDynamicFeeStateEncoder, } from "../types";
|
|
10
|
+
export const POOL_DISCRIMINATOR = new Uint8Array([
|
|
11
|
+
241, 154, 109, 4, 17, 177, 109, 188,
|
|
12
|
+
]);
|
|
13
|
+
export function getPoolDiscriminatorBytes() {
|
|
14
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(POOL_DISCRIMINATOR);
|
|
15
|
+
}
|
|
16
|
+
/** Gets the encoder for {@link PoolArgs} account data. */
|
|
17
|
+
export function getPoolEncoder() {
|
|
18
|
+
return transformEncoder(getStructEncoder([
|
|
19
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
20
|
+
["binStep", getU16Encoder()],
|
|
21
|
+
["feeRate", getU32Encoder()],
|
|
22
|
+
["protocolShare", getU16Encoder()],
|
|
23
|
+
["bump", fixEncoderSize(getBytesEncoder(), 1)],
|
|
24
|
+
["activeBinId", getI32Encoder()],
|
|
25
|
+
["dynamicFeeState", getDynamicFeeStateEncoder()],
|
|
26
|
+
["tokenMintX", getAddressEncoder()],
|
|
27
|
+
["tokenMintY", getAddressEncoder()],
|
|
28
|
+
["tokenVaultX", getAddressEncoder()],
|
|
29
|
+
["tokenVaultY", getAddressEncoder()],
|
|
30
|
+
["protocolFeeX", getU64Encoder()],
|
|
31
|
+
["protocolFeeY", getU64Encoder()],
|
|
32
|
+
]), (value) => ({ ...value, discriminator: POOL_DISCRIMINATOR }));
|
|
33
|
+
}
|
|
34
|
+
/** Gets the decoder for {@link Pool} account data. */
|
|
35
|
+
export function getPoolDecoder() {
|
|
36
|
+
return getStructDecoder([
|
|
37
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
38
|
+
["binStep", getU16Decoder()],
|
|
39
|
+
["feeRate", getU32Decoder()],
|
|
40
|
+
["protocolShare", getU16Decoder()],
|
|
41
|
+
["bump", fixDecoderSize(getBytesDecoder(), 1)],
|
|
42
|
+
["activeBinId", getI32Decoder()],
|
|
43
|
+
["dynamicFeeState", getDynamicFeeStateDecoder()],
|
|
44
|
+
["tokenMintX", getAddressDecoder()],
|
|
45
|
+
["tokenMintY", getAddressDecoder()],
|
|
46
|
+
["tokenVaultX", getAddressDecoder()],
|
|
47
|
+
["tokenVaultY", getAddressDecoder()],
|
|
48
|
+
["protocolFeeX", getU64Decoder()],
|
|
49
|
+
["protocolFeeY", getU64Decoder()],
|
|
50
|
+
]);
|
|
51
|
+
}
|
|
52
|
+
/** Gets the codec for {@link Pool} account data. */
|
|
53
|
+
export function getPoolCodec() {
|
|
54
|
+
return combineCodec(getPoolEncoder(), getPoolDecoder());
|
|
55
|
+
}
|
|
56
|
+
export function decodePool(encodedAccount) {
|
|
57
|
+
return decodeAccount(encodedAccount, getPoolDecoder());
|
|
58
|
+
}
|
|
59
|
+
export async function fetchPool(rpc, address, config) {
|
|
60
|
+
const maybeAccount = await fetchMaybePool(rpc, address, config);
|
|
61
|
+
assertAccountExists(maybeAccount);
|
|
62
|
+
return maybeAccount;
|
|
63
|
+
}
|
|
64
|
+
export async function fetchMaybePool(rpc, address, config) {
|
|
65
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
|
|
66
|
+
return decodePool(maybeAccount);
|
|
67
|
+
}
|
|
68
|
+
export async function fetchAllPool(rpc, addresses, config) {
|
|
69
|
+
const maybeAccounts = await fetchAllMaybePool(rpc, addresses, config);
|
|
70
|
+
assertAccountsExist(maybeAccounts);
|
|
71
|
+
return maybeAccounts;
|
|
72
|
+
}
|
|
73
|
+
export async function fetchAllMaybePool(rpc, addresses, config) {
|
|
74
|
+
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
75
|
+
return maybeAccounts.map((maybeAccount) => decodePool(maybeAccount));
|
|
76
|
+
}
|
|
77
|
+
export function getPoolSize() {
|
|
78
|
+
return 203;
|
|
79
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type EncodedAccount, type FetchAccountConfig, type FetchAccountsConfig, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from "@solana/kit";
|
|
9
|
+
import { type FeeState, type FeeStateArgs } from "../types";
|
|
10
|
+
export declare const POSITION_DISCRIMINATOR: ReadonlyUint8Array;
|
|
11
|
+
export declare function getPositionDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type Position = {
|
|
13
|
+
discriminator: ReadonlyUint8Array;
|
|
14
|
+
pool: Address;
|
|
15
|
+
positionMint: Address;
|
|
16
|
+
lowerBinId: number;
|
|
17
|
+
upperBinId: number;
|
|
18
|
+
padding: ReadonlyUint8Array;
|
|
19
|
+
feeStates: Array<FeeState>;
|
|
20
|
+
};
|
|
21
|
+
export type PositionArgs = {
|
|
22
|
+
pool: Address;
|
|
23
|
+
positionMint: Address;
|
|
24
|
+
lowerBinId: number;
|
|
25
|
+
upperBinId: number;
|
|
26
|
+
padding: ReadonlyUint8Array;
|
|
27
|
+
feeStates: Array<FeeStateArgs>;
|
|
28
|
+
};
|
|
29
|
+
/** Gets the encoder for {@link PositionArgs} account data. */
|
|
30
|
+
export declare function getPositionEncoder(): FixedSizeEncoder<PositionArgs>;
|
|
31
|
+
/** Gets the decoder for {@link Position} account data. */
|
|
32
|
+
export declare function getPositionDecoder(): FixedSizeDecoder<Position>;
|
|
33
|
+
/** Gets the codec for {@link Position} account data. */
|
|
34
|
+
export declare function getPositionCodec(): FixedSizeCodec<PositionArgs, Position>;
|
|
35
|
+
export declare function decodePosition<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<Position, TAddress>;
|
|
36
|
+
export declare function decodePosition<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<Position, TAddress>;
|
|
37
|
+
export declare function fetchPosition<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<Position, TAddress>>;
|
|
38
|
+
export declare function fetchMaybePosition<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<Position, TAddress>>;
|
|
39
|
+
export declare function fetchAllPosition(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<Position>[]>;
|
|
40
|
+
export declare function fetchAllMaybePosition(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<Position>[]>;
|
|
41
|
+
export declare function getPositionSize(): number;
|
|
42
|
+
//# sourceMappingURL=position.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../src/generated/accounts/position.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAKL,mBAAmB,EACnB,oBAAoB,EAcpB,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,YAAY,EAClB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,sBAAsB,EAAE,kBAEnC,CAAC;AAEH,wBAAgB,6BAA6B,IAAI,kBAAkB,CAElE;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,aAAa,EAAE,kBAAkB,CAAC;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,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