UNPKG

sei-agent-kit

Version:

A package for building AI agents on the SEI blockchain

29 lines (28 loc) 1.18 kB
import { Toolkit } from "@bancor/carbon-sdk/strategy-management"; import { initSyncedCache } from "@bancor/carbon-sdk/chain-cache"; import { ContractsApi, } from "@bancor/carbon-sdk/contracts-api"; import { JsonRpcProvider } from "@ethersproject/providers"; import { SEI_RPC_URL, MAX_BLOCK_AGE } from "../../constants"; /** */ export async function deleteStrategy(agent, config, strategyId) { const provider = new JsonRpcProvider(SEI_RPC_URL); const api = new ContractsApi(provider, config); const { cache } = initSyncedCache(api.reader, undefined, MAX_BLOCK_AGE); const carbonSDK = new Toolkit(api, cache, undefined); const populatedTx = await carbonSDK.deleteStrategy(strategyId); const viemTx = { chain: agent.walletClient.chain, account: agent.walletClient.account, to: populatedTx.to, data: populatedTx.data, value: 0n, gas: populatedTx.gasLimit ? BigInt(populatedTx.gasLimit.toString()) : undefined, nonce: populatedTx.nonce, }; const txHash = await agent.walletClient.sendTransaction(viemTx); return txHash; } //# sourceMappingURL=deleteStrategy.js.map