Raindex SDK Documentation
    Preparing search index...

    Class RaindexVaultsList

    Index

    Properties

    items: RaindexVault[]

    Returns all vaults in the list

    const allVaults = vaultsList.items;
    allVaults.forEach(vault => {
    console.log(`Vault ID: ${vault.id}, Balance: ${vault.formattedBalance}`);
    });

    Methods

    • Concatenates this vault list with another vault list and returns a new RaindexVaultsList

      Creates a new vault list containing all vaults from both lists. The order is preserved: items from the current list first, then items from the other list.

      const combinedVaults = vaultsList1.concat(vaultsList2);
      console.log(`Combined ${combinedVaults.items.length} vaults`);

      Parameters

      Returns WasmEncodedResult<RaindexVaultsList>

      New RaindexVaultsList containing vaults from both lists

    • Returns void

    • Returns only vaults that have a balance greater than zero

      const withdrawableVaults = vaultsList.getWithdrawableVaults();
      console.log(`${withdrawableVaults.length} vaults can be withdrawn from`);

      Returns WasmEncodedResult<RaindexVault[]>

      Array of vaults with non-zero balance

    • Generates multicall withdraw calldata for all withdrawable vaults

      Creates a single transaction that can withdraw from multiple vaults at once, optimizing gas costs and transaction efficiency.

      const result = await vaultsList.getWithdrawCalldata();
      if (result.error) {
      console.error("Error generating calldata:", result.error.readableMsg);
      return;
      }
      const calldata = result.value;
      // Use calldata for transaction

      Returns Promise<WasmEncodedResult<`0x${string}`>>

      Encoded multicall calldata for withdrawing from all vaults

    • Filters vaults by a list of IDs and returns a new RaindexVaultsList

      Creates a new vault list containing only vaults whose IDs match the provided list of IDs. The original list order is preserved; the input ids order does not affect the result ordering.

      Notes:

      • Duplicate IDs in ids are ignored (deduplicated).
      • Unknown IDs are ignored (they do not cause errors).
      const filteredVaults = vaultsList.pickByIds(['0x123', '0x456']);
      console.log(`Filtered to ${filteredVaults.items.length} vaults`);

      Parameters

      • ids: string[]

      Returns WasmEncodedResult<RaindexVaultsList>

      New RaindexVaultsList containing only vaults with matching IDs