Meteora 백서

Meteora

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 57쪽

createMerkleRootConfigFromAddresses(params)` | `Promise<Transaction[]>` | Build Merkle root config transactions from whitelisted wallets, chunked by tree size. | | `createMerkleProofResponse(params)` | `Promise<Record<string, MerkleProofResponse>>` | Generate proof responses keyed by `address-registryIndex`. | | `createPermissionlessEscrow(params)` | `Promise<Transaction>` | Build a transaction to create a permissionless escrow. | | `createPermissionedEscrowWithMerkleProof(params)` | `Promise<Transaction>` | Build a transaction to create a Merkle-proof escrow. | | `createPermissionedEscrowWithAutoFetchMerkleProofFromMetadata(params)` | `Promise<TransactionInstruction>` | Fetch proof data from `PermissionedServerMetadata.server_url` and return an escrow creation instruction. | | `createPermissionedEscrowWithCreator(params)` | `Promise<Transaction>` | Build a transaction to create an authority-permissioned escrow with an operator signer. | | `createOperator(params)` | `Promise<Transaction>` | Build a transaction to create an operator account. | | `deposit(params)` | `Promise<Transaction>` | Build a deposit transaction. It may include escrow creation or return a partially signed transaction from a permissioned authority server. | | `withdraw(params)` | `Promise<Transaction>` | Build an in-presale withdrawal transaction. | | `claim(params)` | `Promise<Transaction>` | Build a base token claim transaction. | | `withdrawRemainingQuote(params)` | `Promise<Transaction>` | Build a remaining quote refund transaction. | | `performUnsoldBaseTokenAction(payer)` | `Promise<Transaction>` | Build the unsold base token burn or refund transaction. | | `creatorWithdraw(params)` | `Promise<Transaction>` | Build a creator withdrawal transaction for completed or failed presales. | | `creatorCollectFee()` | `Promise<Transaction>` | Build a creator deposit-fee collection transaction. | | `refreshEscrow(params)` | `Promise<Transaction>` | Build an escrow refresh transaction. | | `closeEscrow(params)` | `Promise<Transaction>` | Build an escrow close transaction. | | `createPermissionedServerMetadata(params)` | `Promise<Transaction>` | Store a permissioned metadata URL. | | `closePermissionedServerMetadata(params)` | `Promise<Transaction>` | Close the permissioned metadata account. | | `getPresaleEscrowByOwner(owner)` | `Promise<IEscrowWrapper[]>` | Fetch escrow wrappers for an owner across initialized registries. | | `getEscrowsByPresale()` | `Promise<{ pubkey; account }[]>` | Fetch and decode all escrow accounts for the presale. | | `getEscrowsByPresaleRegistry(registryIndex)` | `Promise<{ pubkey; account }[]>` | Fetch and decode escrow accounts for one registry. | | `getParsedPresale()` | `PresaleWrapper` | Return a parsed wrapper for display and derived values. | ## PDA Helpers | Function | Use | | - | - | | `derivePresale(mint, quote, base, programId)` | Main presale PDA. | | `derivePresaleAuthority(programId)` | Presale authority PDA. | | `deriveFixedPricePresaleExtraArgs(presale, programId)` | Fixed-price extra-args PDA. | | `derivePresaleVault(presale, programId)` | Base token vault PDA. | | `deriveQuoteTokenVault(presale, programId)` | Quote token vault PDA. | | `deriveMerkleRootConfig(presale, programId, version)` | Merkle root config PDA. | | `deriveEscrow(presale, owner, registryIndex, programId)` | Buyer escrow PDA. | | `deriveOperator(creator, operator, programId)` | Operator PDA. | | `derivePermissionedServerMetadata(presale, programId)` | Permissioned metadata PDA. | | `deriveMetaplexMetadata(mint)` | Metaplex metadata PDA for a mint. | ## Low-level Instruction Builders | Builder | Program instruction | | - | - | | `createInitializeFixedPricePresaleArgsIx` | `initialize_fixed_price_presale_args` | | `createInitializeFixedPricePresaleIx` | `initialize_presale` with fixed-price mode | | `createInitializeProrataPresaleIx` | `initialize_presale` with prorata mode | | `createInitializeFcfsPresaleIx` | `initialize_presale` with FCFS mode | | `createCloseFixedPriceArgsIx` | `close_fixed_price_presale_args` | | `createMerkleRootConfigIx` | `create_merkle_root_config` | | `closeMerkleRootConfigIx` | `close_merkle_root_config` | | `createPermissionlessEscrowIx` / `getOrCreatePermissionlessEscrowIx` | `create_permissionless_escrow` | | `createPermissionedEscrowWithMerkleProofIx` / `getOrCreatePermissionedEscrowWithMerkleProofIx` | `create_permissioned_escrow_with_merkle_proof` | | `createPermissionedEscrowWithCreatorIx` / `getOrCreatePermissionedEscrowWithCreatorIx` | `create_permissioned_escrow_with_creator` | | `fetchPartialSignedInitEscrowAndDepositTransactionFromOperator` | Fetches a creator-hosted partially signed transaction for authority mode. | | `createOperatorIx` | `create_operator` | | `createRevokeOperatorIx` | `revoke_operator` | | `createDepositIx` | `deposit` | | `createWithdrawIx` | `withdraw` | | `createClaimIx` | `claim` | | `createWithdrawRemainingQuoteIx` | `withdraw_remaining_quote` | | `createPerformUnsoldBaseTokenActionIx` | `perform_unsold_base_token_action` | | `createCreatorWithdrawIx` | `creator_withdraw` | | `createCreatorCollectFeeIx` | `creator_collect_fee` | | `createRefreshEscrowIx` | `refresh_escrow` | | `createCloseEscrowIx` | `close_escrow` | | `createInitializePermissionedServerMetadataIx` | `create_permissioned_server_metadata` | | `createClosePermissionedServerMetadataIx` | `close_permissioned_server_metadata` | ## Account Wrappers | Wrapper | Useful methods | | - | - | | `PresaleWrapper` | `getPresaleProgressState`, `getPresaleProgressPercentage`, `getPresaleModeName`, `getWhitelistModeName`, `getRemainingDepositRawQuota`, `getTotalDepositRawAmount`, `getAllPresaleRegistries`, `getAverageTokenPrice`, `getTimings`, `canDeposit`, `canWithdraw`, `canWithdrawRemainingQuote`, `canClaim`, `canCreatorWithdraw`, `canCreatorCollectFee`. | | `PresaleRegistryWrapper` | `isInitialized`, `getRegistryIndex`, `getPresaleRawSupply`, `getTotalDepositRawAmount`, `getBuyerMaximumRawDepositCap`, `getBuyerMinimumRawDepositCap`, `getDepositFeeBps`, `getDepositFeePercentage`, `getTokenPrice`, `getTotalDepositFeeRawAmount`, `getWithdrawableRemainingQuote`, `getTotalBaseTokenSold`. | | `EscrowWrapper` | `getDepositRawAmount`, `getDepositFeeRawAmount`, `getIndividualDepositCap`, `getRemainingDepositAmount`, `getTotalClaimableRawAmount`, `getPendingClaimableRawAmount`, `getClaimedRawAmount`, `canWithdrawRemainingQuoteAmount`, `getWithdrawableRemainingQuoteAmount`, `canClose`. | ## Math Helpers | Function | Use | | - | - | | `uiPriceToQPrice(price, baseDecimals, quoteDecimals, rounding)` | Convert a UI fixed price into the program's Q64 `q_price`. | | `qPriceToPrice(qPrice)` | Convert a Q64 fixed price back to a `Decimal` price. | | `calculateDynamicLamportPrice(presaleSupply, totalDeposit)` | Compute dynamic lamport price from supply and total deposit. | | `calculateImmediateReleaseToken(totalSoldToken, immediateReleaseBps)` | Split sold token amount into immediate and vested portions. | | `calculateLockAndVestDurationFromTimestamps(presaleEnd, lockEnd, vestEnd)` | Convert absolute timestamps into lock and vest durations. | | `calculateMinimumQuoteAmountForBaseLamport(qPrice)` | Compute minimum quote needed to buy at least one base lamport. | | `calculateMaximumQuoteAmountForPresaleSupply(qPrice, presaleSupply)` | Compute quote cap for a fixed-price supply. | | `calculateDepositFeeIncludedAmount(depositAmount, feeBps, rounding)` | Calculate the fee-included quote amount for a net deposit amount. | ## Token 2022 Helpers | Function | Use | | - | - | | `getSliceAndExtraAccountMetasForTransferHook(connection, mint, mintAccount, accountsType)` | Fetch remaining-account slice metadata and account metas for a transfer-hook mint. | | `getExtraAccountMetasForTransferHook(connection, mint, mintAccount, source, destination, authority, amount)` | Resolve extra account metas for a transfer-hook transfer. | | `calculateTransferFeeIncludedAmount(mint, transferFeeExcludedAmount, epoch?)` | Include Token 2022 transfer fee for an intended net transfer amount. | | `calculateTransferFeeExcludedAmount(mint, transferFeeIncludedAmount, epoch?)` | Exclude Token 2022 transfer fee from a gross transfer amount. | | `getTokenProgramIdFromFlag(flag)` | Map program token flag to SPL Token or Token 2022 program ID. | ## Account Filters And RPC Helpers | Helper | Use | | - | - | | `getPresaleFilter()` | Memcmp discriminator filter for presale accounts. | | `getEscrowFilter()` | Memcmp discriminator filter for escrow accounts. | | `getEscrowPresaleFilter(presale)` | Filter escrows by parent presale. | | `getEscrowRegistryIndexFilter(registryIndex)` | Filter escrows by registry index. | | `getEscrowOwnerFilter(owner)` | Filter escrows by owner. | | `getOnChainTimestamp(connection)` | Read current on-chain Unix timestamp from the Clock sysvar. | | `fetchMultipleAccountsAutoChunk(connection, pubkeys)` | Fetch many accounts in chunks. | | `getSimulationComputeUnits(connection, instructions, payer, lookupTables)` | Estimate compute units by simulation. | ## Permissioned Metadata URLs Presale Vault has no Meteora-hosted public API. Permissioned presales can store a creator-managed `server_url` in `PermissionedServerMetadata`. | Whitelist mode | SDK behavior | | - | - | | `PermissionWithMerkleProof` | Auto-fetch helper requests `/{presaleAddress}/{registryIndex}/{owner}` from the stored base URL and expects `MerkleProofResponse`. | | `PermissionWithAuthority` | Deposit flow may request `/{presaleAddress}/{registryIndex}/{owner}?amount={amount}` from the stored base URL and expects a serialized partially signed transaction. | # Stake2Earn Data API Overview Source: https://docs.meteora.ag/developer-guides/stake2earn/api-reference/overview Learn how the Stake2Earn Data API exposes indexed vault analytics, vault discovery, vault filtering, vault details, and top-list leaderboard data. The Stake2Earn Data API exposes read-only indexed data for Stake2Earn vault discovery, aggregate analytics, vault filters, and leaderboard views. <Tip> The checked-in Stake2Earn OpenAPI file does not declare a rate limit. Treat the API as a read-only discovery and dashboard source, and use on-chain `stake_for_fee` accounts as the source of truth for transaction construction. </Tip> ## Base URLs | Environment | Base URL | Swagger UI | | - | - | - | | Production | `https://stake-for-fee-api.meteora.ag` | [Open](https://stake-for-fee-api.meteora.ag/swagger-ui/) | | Devnet | `https://devnet.stake-for-fee-api.meteora.ag` | [Open](https://devnet.stake-for-fee-api.meteora.ag/swagger-ui/) | The checked-in OpenAPI file is based on the production Swagger spec. The production spec references a vault-detail schema that is omitted from the live components; the local checked-in file includes the observed production vault-detail response fields so generated docs can resolve the endpoint. ## Analytics <CardGroup> <Card title="get_all_analytics" icon="file-code" href="/api-reference/stake2earn/analytics/get-all-analytics"> Returns aggregate Stake2Earn counts and USD stake totals using `GET` `/analytics/all` </Card> </CardGroup> ## Vaults <CardGroup> <Card title="get_all_vaults" icon="file-code" href="/api-reference/stake2earn/vault/get-all-vaults"> Returns all indexed Stake2Earn vaults using `GET` `/vault/all` </Card> <Card title="filter_vaults" icon="file-code" href="/api-reference/stake2earn/vault/filter-vaults"> Returns vaults filtered by pool address using `GET` `/vault/filter` </Card> <Card title="get_one_vault" icon="file-code" href="/api-reference/stake2earn/vault/get-one-vault"> Returns one vault and its top-list holders using `GET` `/vault/{vault_address}` </Card> </CardGroup> ## Query Parameters | Endpoint | Parameter | Meaning | | - | - | - | | `/vault/filter` | `pool_address` | Optional array of pool addresses. Production spec documents a maximum of `100` pool addresses. | | `/vault/{vault_address}` | `vault_address` | Stake2Earn fee vault address. | ## Common Vault Fields `Vault` list responses include: | Field | Meaning | | - | - | | `vault_address` | Stake2Earn `FeeVault` account address. | | `pool_address` | DAMM v1 pool linked to the vault. | | `token_a_mint`, `token_b_mint` | DAMM v1 pool token mints. | | `stake_mint` | Mint users stake in this vault. | | `token_a_symbol`, `token_b_symbol` | Indexed token display symbols when available. | | `total_staked_amount` | Indexed total stake amount in decimalized token units. | | `total_staked_amount_usd` | Indexed USD value of total stake. | | `current_reward_token_a_usd`, `current_reward_token_b_usd` | Indexed reward values by pool token. | | `current_reward_usd` | Combined indexed reward value. | | `daily_reward_usd` | Estimated daily reward based on indexed data. | | `created_at_slot`, `created_at_slot_timestamp`, `created_at_tx_sig` | Creation slot, timestamp, and transaction signature. | | `seconds_to_full_unlock` | Fee drip duration from vault configuration. | | `start_fee_distribute_timestamp` | Timestamp when fee distribution begins. | | `marketcap` | Indexed market cap value when available. | | `flags` | API flags such as TVL threshold status. | ## Vault Detail Fields `GET /vault/{vault_address}` returns the common vault fields plus `top_lists`. | Field | Meaning | | - | - | | `top_lists` | Array of top-list holder entries for the vault. | | `owner` | Holder wallet address. | | `staked_amount` | Holder stake amount in decimalized token units. | | `token_a_accumulated_reward`, `token_b_accumulated_reward` | Indexed accumulated rewards by pool token. | | `token_a_accumulated_reward_usd`, `token_b_accumulated_reward_usd` | Indexed USD values for accumulated rewards. | | `daily_reward_usd` | Holder's estimated daily reward. | ## API Or On-Chain Data | Need | Use | | - | - | | Vault discovery and dashboards | Data API `/vault/all`, `/vault/filter`, `/vault/{vault_address}`. | | Aggregate product metrics | Data API `/analytics/all`. | | Transaction construction | On-chain `FeeVault`, DAMM v1 pool, lock escrow, Dynamic Vault, token vault, and list accounts. | | Claimable fee execution | TypeScript SDK or CPI with fresh on-chain state and simulation. | | Leaderboard display | Data API for indexed display, on-chain top/full list accounts for execution-sensitive ranking. | # Stake2Earn Changelog Source: https://docs.meteora.ag/developer-guides/stake2earn/changelog Track Stake2Earn program, SDK, Rust interface, API, and documentation changes that affect integrations. This changelog summarizes integration-relevant changes from the inspected local `stake-for-fee` and `stake-for-fee-sdk` source repos. <Note> The checked-in SDK changelog uses both `@meteora-ag/stake-for-fee` and `@meteora-ag/m3m3` naming. The published TypeScript package inspected in `ts-client/package.json` is `@meteora-ag/m3m3` version `1.0.10`. </Note> ## Current Snapshot | Area | Version or source | | - | - | | Program crate | `stake-for-fee` `0.1.1` | | Public program ID | `FEESngU3neckdwib9X3KWqdL7Mjmqk9XNp3uh5JbP4KP` | | TypeScript package | `@meteora-ag/m3m3` `1.0.10` | | Rust interface crate | `stake_for_fee_interface` `0.1.0` | | Common Rust helper crate | `common` `0.0.1` | | Anchor version in program source | `0.28.0` | | Solana version in program source | `1.16.12` | ## Integration-Relevant Changes | Version or source note | Area | Change | | - | - | - | | `stake-for-fee` `0.1.1` | Program | `claim_fee` behavior changed so users can partially claim only the quote token side; the base/stake token side is automatically restaked. | | SDK changelog `1.0.10` | TypeScript SDK | Removed `@solana-developers/helpers` dependency and replaced `@mercurial-finance/dynamic-amm-sdk` with `@meteora-ag/dynamic-amm-sdk`. | | SDK changelog `1.0.9` | TypeScript SDK | Moved `@mercurial-finance/dynamic-amm-sdk` from dev dependency to dependency in the historical package lineage. | | SDK changelog `common` `0.0.1` | Rust helpers | Added PDA helper functions to derive Stake2Earn vault, top staker list, full balance list, and event authority keys. | | SDK changelog `1.0.1` | TypeScript SDK | Refactored `findLargestStakerNotInTopListFromFullBalanceList` and `findReplaceableTopStaker`. | | Program source | Admin flows | `update_seconds_to_full_unlock` requires the immediately preceding instruction to be `claim_fee_crank` for the same vault and program. | | Program source | Events | User and admin flows emit Anchor events through Event CPI. | | Live production API | API | Production exposes `/analytics/all`, `/vault/all`, `/vault/filter`, and `/vault/{vault_address}`. | ## Documentation Notes | Date | Change | | - | - | | 2026-05-22 | Rebuilt the Stake2Earn developer guide around program accounts, instructions, events, errors, TypeScript SDK, Rust integration, API overview, and changelog pages. | | 2026-05-22 | Replaced legacy long-form TypeScript script page with focused SDK getting-started, examples, and reference pages. | | 2026-05-22 | Replaced legacy CPI examples page with Rust library and CPI integration pages based on the local Rust interface source. | | 2026-05-22 | Updated the checked-in API spec to resolve the production vault-detail schema reference with observed production response fields. | ## Gaps To Watch | Gap | Impact | | - | - | | No high-level Rust SDK in inspected source | Rust integrations should use `stake_for_fee_interface`, `common` PDA helpers, and custom account fetching/parsing. | | No TypeScript high-level admin builders | `claim_fee_crank` and admin update flows require low-level Anchor program usage or custom builders. | | Production OpenAPI omits `VaultDetailWithLeaderboard` from live components | The docs include a local resolved schema, but integrators should still test API responses against the live host. | # Stake2Earn Developer Guide Source: https://docs.meteora.ag/developer-guides/stake2earn/index Learn how to build Stake2Earn integrations with the stake_for_fee program, TypeScript SDK, Rust helpers, Data API, and release notes. Stake2Earn is Meteora's stake-for-fee program for DAMM v1 constant-product pools. Pool creators lock DAMM v1 LP into a program-owned lock escrow, and token holders stake the pool's base token to compete for the top staker list that receives released LP fees. To learn the product flow, configuration limits, and formulas before integrating, read the product documentation. <CardGroup> <Card title="What Is Stake2Earn" icon="book-open" href="/legacy-products/stake2earn/what-is-stake2earn"> Product overview for Stake2Earn staking, LP fee delegation, and top staker rewards. </Card> <Card title="Configuration And Limits" icon="sliders" href="/legacy-products/stake2earn/configuration-and-limits"> Product-level settings and launch constraints for Stake2Earn vaults. </Card> <Card title="Stake2Earn Formulas" icon="calculator" href="/legacy-products/stake2earn/formulas"> Product formulas for staking, fees, and reward distribution. </Card> </CardGroup> <Warning> Stake2Earn only supports DAMM v1 constant-product pools where the quote mint is SOL or USDC and the stake mint is the non-quote pool token. </Warning> ## Integration <CardGroup> <Card title="Program Accounts" icon="table-cells" href="/developer-guides/stake2earn/program/accounts"> PDA seeds, vault state, stake escrow state, unstake requests, and top/full balance list layouts. </Card> <Card title="Program Instructions" icon="list" href="/developer-guides/stake2earn/program/instructions"> Vault creation, staking, claiming, unstaking, withdrawal, crank, and admin instruction details. </Card> <Card title="Program Events" icon="list" href="/developer-guides/stake2earn/program/events"> Event CPI emissions for vault lifecycle, staking, fee release, top list movement, and admin updates. </Card> <Card title="Program Errors" icon="triangle-exclamation" href="/developer-guides/stake2earn/program/errors"> A
프로젝트로 돌아가기