docs: remove network-specific addresses from frontend guide#73
docs: remove network-specific addresses from frontend guide#73
Conversation
| addresses.contracts.FlowYieldVaultsRequests.addresses.testnet; | ||
| const networkConfig = addresses.metadata.networks.testnet; | ||
| addresses.contracts.FlowYieldVaultsRequests.addresses[network]; | ||
| const networkConfig = addresses.metadata.networks[network]; |
There was a problem hiding this comment.
getCadenceConfig and getCurrentNetworkKey are never defined.
Both helper functions appear in every code example but are not defined, imported, or documented anywhere in this guide or in the repo. A developer following this guide has no way to implement them.
At a minimum the guide needs to show the expected shape of getCadenceConfig's return value and where it comes from. Something like:
// Example – implement this for your app
function getCurrentNetworkKey(): "mainnet" | "testnet" {
// return the active network
}
interface CadenceConfig {
accessNodeApi: string; // e.g. "https://rest-testnet.onflow.org"
flowNetwork: string; // e.g. "testnet"
flowYieldVaultsEVM: string; // Cadence address of FlowYieldVaultsEVM contract
flowYieldVaults: string; // Cadence address of FlowYieldVaults contract
}
function getCadenceConfig(network: "mainnet" | "testnet"): CadenceConfig {
// return per-network values
}Without this, the "network-agnostic" refactor leaves the guide less usable than the hardcoded version it replaced.
| const balance = await fcl.query({ | ||
| cadence: GET_YIELDVAULT_BALANCE, | ||
| args: (arg, t) => [ | ||
| arg(FLOW_YIELD_VAULTS_ADDRESS, t.Address), | ||
| arg(cadenceConfig.flowYieldVaults, t.Address), | ||
| arg(yieldVaultId.toString(), t.UInt64), | ||
| ], | ||
| }); |
There was a problem hiding this comment.
Wrong address used for managerAddress — balance queries will return nil/0.0 at runtime.
cadenceConfig.flowYieldVaults is the address of the FlowYieldVaults contract, but managerAddress must be the account that holds the YieldVaultManager capability — which is the FlowYieldVaultsEVM worker account (cadenceConfig.flowYieldVaultsEVM).
The check_worker_status.cdc and check_yieldvaultmanager_status.cdc scripts confirm that the YieldVaultManager is stored and published by the FlowYieldVaultsEVM account, not the FlowYieldVaults contract account. Passing the wrong address means capabilities.borrow(...) will always return nil, so every balance and details query silently returns nil/0.0.
The same bug appears on the three call-sites in this file (lines ~407, ~440, ~464). All three should be:
| const balance = await fcl.query({ | |
| cadence: GET_YIELDVAULT_BALANCE, | |
| args: (arg, t) => [ | |
| arg(FLOW_YIELD_VAULTS_ADDRESS, t.Address), | |
| arg(cadenceConfig.flowYieldVaults, t.Address), | |
| arg(yieldVaultId.toString(), t.UInt64), | |
| ], | |
| }); | |
| arg(cadenceConfig.flowYieldVaultsEVM, t.Address), |
This bug pre-existed the PR (the old code used the same wrong FLOW_YIELD_VAULTS_ADDRESS), but since this PR touches every one of these lines it's the right time to fix it.
Review SummaryDocumentation-only PR. Two concrete issues found. 1.
|
Summary
FRONTEND_INTEGRATION.mdTesting