UNPKG

@coinbase/agentkit

Version:

Coinbase AgentKit core primitives

29 lines (28 loc) 938 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fetchVaultActions = fetchVaultActions; const utils_1 = require("../utils"); const constants_1 = require("../constants"); /** * Fetches a list of actions for a vault from the vaultsfyi API. * * @param root0 - The fetch parameters * @param root0.action - The action to fetch * @param root0.args - The action parameters * @param root0.sender - The sender address * @param root0.apiKey - The vaultsfyi API key * @returns The list of actions */ async function fetchVaultActions({ action, args, sender, apiKey, }) { const params = (0, utils_1.createSearchParams)({ ...args, sender, }); const response = await fetch(`${constants_1.VAULTS_API_URL}/transactions/vaults/${action}?${params}`, { method: "GET", headers: { "x-api-key": apiKey, }, }); return (await response.json()); }