UNPKG

@coinbase/agentkit

Version:

Coinbase AgentKit core primitives

25 lines (24 loc) 861 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getAccountOutflow = getAccountOutflow; const queries_1 = require("./queries"); const endpoints_1 = require("./endpoints"); const graphql_request_1 = require("graphql-request"); /** * Gets the current account outflows for the user * * @param userId - The user id of the account * @returns The data on the current streams from the agent */ async function getAccountOutflow(userId) { try { const client = new graphql_request_1.GraphQLClient(endpoints_1.BASE_GRAPH_ENDPOINT); const variables = { id: userId.toLowerCase() }; const data = await client.request(queries_1.getAccountOutflowQuery, variables); return data; } catch (error) { console.error("Error fetching account data:", error); return undefined; } }