Skip to main content

MoneyAccountBalanceService Actions

7 actions registered.

NameDeprecated
fetchBalanceWithFallback
getExchangeRate
getMoneyAccountBalance
getMusdBalance
getMusdEquivalentValue
getVaultApy
getVmusdBalance

MoneyAccountBalanceService:fetchBalanceWithFallback​

Package: @metamask/money-account-balance-service

Fetches the canonical Money account balance, selecting the Money API or RPC source according to the moneyAccountBalanceSource remote feature flag (default: RPC primary with Money API fallback).

Callers must not select a source. Provenance is returned on the result so fallback is never silent. Malformed or unavailable source balances are reported via the messenger's captureException before fallback. Stale API results (behind options.minBlock) also fall back to RPC when the policy allows, without being reported as defects.

Parameters:

NameDescription
accountAddressThe Money account's Ethereum address.
optionsOptional freshness / cache-bypass controls (additive).

Returns: Canonical balance amounts with source provenance.

Handler signature:

(accountAddress: Hex, options?: FetchBalanceWithFallbackOptions) => Promise<CanonicalMoneyAccountBalanceResponse>

MoneyAccountBalanceService:getExchangeRate​

Package: @metamask/money-account-balance-service

Fetches the current exchange rate from the Veda Accountant contract via RPC. The rate represents the conversion factor from vmUSD shares to the underlying mUSD asset.

Parameters:

NameDescription
optionsThe options for the query.
options.staleTimeCache stale time override for this query.

Returns: The exchange rate as a raw uint256 string.

Handler signature:

({ staleTime, }?: {
staleTime?: number;
}) => Promise<ExchangeRateResponse>

MoneyAccountBalanceService:getMoneyAccountBalance​

Package: @metamask/money-account-balance-service

Fetches the account's total Money balance inputs in a single batched RPC request via Multicall3's aggregate3

Parameters:

NameDescription
accountAddressThe Money account's Ethereum address.

Returns: The mUSD balance and the mUSD-equivalent value of vault shares as raw uint256 strings. The total balance is the sum of the mUSD balance and the mUSD-equivalent value of vault shares.

Handler signature:

(accountAddress: Hex) => Promise<MoneyAccountBalanceResponse>

MoneyAccountBalanceService:getMusdBalance​

Package: @metamask/money-account-balance-service

Fetches the mUSD ERC-20 balance for the given account address via RPC.

Parameters:

NameDescription
accountAddressThe Money account's Ethereum address.

Returns: The mUSD balance as a raw uint256 string.

Handler signature:

(accountAddress: Hex) => Promise<{
balance: string;
}>

MoneyAccountBalanceService:getMusdEquivalentValue​

Package: @metamask/money-account-balance-service

Fetches the mUSD-equivalent value of the account's vmUSD vault shares via Lens.balanceOfInAssets RPC.

Parameters:

NameDescription
accountAddressThe Money account's Ethereum address.

Returns: The mUSD-equivalent value of vault shares as a raw uint256 string.

Handler signature:

(accountAddress: Hex) => Promise<MusdEquivalentValueResponse>

MoneyAccountBalanceService:getVaultApy​

Package: @metamask/money-account-balance-service

Fetches the vault's APY and fee breakdown from the Veda performance REST API. APR values in the response are converted to APY using daily compounding before the normalized response is returned.

Returns: The normalized vault APY response with compounded APY values.

Handler signature:

() => Promise<NormalizedVaultApyResponse>

MoneyAccountBalanceService:getVmusdBalance​

Package: @metamask/money-account-balance-service

Fetches the vmUSD (Veda vault share) ERC-20 balance for the given account address via RPC.

Parameters:

NameDescription
accountAddressThe Money account's Ethereum address.

Returns: The vmUSD balance as a raw uint256 string.

Handler signature:

(accountAddress: Hex) => Promise<{
balance: string;
}>