Skip to content

Commit ade452e

Browse files
committed
Build
1 parent 5420b6a commit ade452e

3 files changed

Lines changed: 379 additions & 89 deletions

File tree

dist/index.d.ts

Lines changed: 61 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { ICacheManager, IAgentRuntime, Provider, Memory, State, Action, Plugin } from '@elizaos/core';
2-
import { Hash, Address, Chain, PublicClient, HttpTransport, Account, WalletClient, PrivateKeyAccount } from 'viem';
3-
import { Token } from '@lifi/types';
1+
import { ICacheManager, IAgentRuntime, Provider, Memory, State, HandlerCallback, Action, Plugin } from '@elizaos/core';
2+
import { Hash, Address, Log, Chain, PublicClient, HttpTransport, Account, WalletClient, PrivateKeyAccount, TestClient } from 'viem';
3+
import { Token, Route } from '@lifi/types';
44
import * as viemChains from 'viem/chains';
55

66
declare const _SupportedChainList: Array<keyof typeof viemChains>;
@@ -12,6 +12,7 @@ interface Transaction {
1212
value: bigint;
1313
data?: `0x${string}`;
1414
chainId?: number;
15+
logs?: Log[];
1516
}
1617
interface TokenWithBalance {
1718
token: Token;
@@ -56,6 +57,21 @@ interface SwapParams {
5657
amount: string;
5758
slippage?: number;
5859
}
60+
interface BebopRoute {
61+
data: string;
62+
approvalTarget: Address;
63+
sellAmount: string;
64+
from: Address;
65+
to: Address;
66+
value: string;
67+
gas: string;
68+
gasPrice: string;
69+
}
70+
interface SwapQuote {
71+
aggregator: "lifi" | "bebop";
72+
minOutputAmount: string;
73+
swapData: Route | BebopRoute;
74+
}
5975
interface BridgeParams {
6076
fromChain: SupportedChain;
6177
toChain: SupportedChain;
@@ -94,6 +110,7 @@ interface EvmPluginConfig {
94110
zksync?: string;
95111
canto?: string;
96112
alienx?: string;
113+
gravity?: string;
97114
};
98115
secrets?: {
99116
EVM_PRIVATE_KEY: string;
@@ -134,6 +151,36 @@ interface ProviderError extends Error {
134151
code?: number;
135152
data?: unknown;
136153
}
154+
declare enum VoteType {
155+
AGAINST = 0,
156+
FOR = 1,
157+
ABSTAIN = 2
158+
}
159+
interface Proposal {
160+
targets: Address[];
161+
values: bigint[];
162+
calldatas: `0x${string}`[];
163+
description: string;
164+
}
165+
interface VoteParams {
166+
chain: SupportedChain;
167+
governor: Address;
168+
proposalId: string;
169+
support: VoteType;
170+
}
171+
interface QueueProposalParams extends Proposal {
172+
chain: SupportedChain;
173+
governor: Address;
174+
}
175+
interface ExecuteProposalParams extends Proposal {
176+
chain: SupportedChain;
177+
governor: Address;
178+
proposalId: string;
179+
}
180+
interface ProposeProposalParams extends Proposal {
181+
chain: SupportedChain;
182+
governor: Address;
183+
}
137184

138185
declare class WalletProvider {
139186
private cacheManager;
@@ -148,6 +195,7 @@ declare class WalletProvider {
148195
getCurrentChain(): Chain;
149196
getPublicClient(chainName: SupportedChain): PublicClient<HttpTransport, Chain, Account | undefined>;
150197
getWalletClient(chainName: SupportedChain): WalletClient;
198+
getTestClient(): TestClient;
151199
getChainConfigs(chainName: SupportedChain): Chain;
152200
getWalletBalance(): Promise<string | null>;
153201
getWalletBalanceForChain(chainName: SupportedChain): Promise<string | null>;
@@ -166,7 +214,7 @@ declare class WalletProvider {
166214
declare const initWalletProvider: (runtime: IAgentRuntime) => Promise<WalletProvider>;
167215
declare const evmWalletProvider: Provider;
168216

169-
declare const bridgeTemplate = "Given the recent messages and wallet information below:\n\n{{recentMessages}}\n\n{{walletInfo}}\n\nExtract the following information about the requested token bridge:\n- Token symbol or address to bridge\n- Source chain\n- Destination chain\n- Amount to bridge: Must be a string representing the amount in ether (only number without coin symbol, e.g., \"0.1\")\n- Destination address (if specified)\n\nRespond with a JSON markdown block containing only the extracted values:\n\n```json\n{\n \"token\": string | null,\n \"fromChain\": \"ethereum\" | \"abstract\" | \"base\" | \"sepolia\" | \"bsc\" | \"arbitrum\" | \"avalanche\" | \"polygon\" | \"optimism\" | \"cronos\" | \"gnosis\" | \"fantom\" | \"fraxtal\" | \"klaytn\" | \"celo\" | \"moonbeam\" | \"aurora\" | \"harmonyOne\" | \"moonriver\" | \"arbitrumNova\" | \"mantle\" | \"linea\" | \"scroll\" | \"filecoin\" | \"taiko\" | \"zksync\" | \"canto\" | \"alienx\" | null,\n \"toChain\": \"ethereum\" | \"abstract\" | \"base\" | \"sepolia\" | \"bsc\" | \"arbitrum\" | \"avalanche\" | \"polygon\" | \"optimism\" | \"cronos\" | \"gnosis\" | \"fantom\" | \"fraxtal\" | \"klaytn\" | \"celo\" | \"moonbeam\" | \"aurora\" | \"harmonyOne\" | \"moonriver\" | \"arbitrumNova\" | \"mantle\" | \"linea\" | \"scroll\" | \"filecoin\" | \"taiko\" | \"zksync\" | \"canto\" | \"alienx\" | null,\n \"amount\": string | null,\n \"toAddress\": string | null\n}\n```\n";
217+
declare const bridgeTemplate = "Given the recent messages and wallet information below:\n\n{{recentMessages}}\n\n{{walletInfo}}\n\nExtract the following information about the requested token bridge:\n- Token symbol or address to bridge\n- Source chain\n- Destination chain\n- Amount to bridge: Must be a string representing the amount in ether (only number without coin symbol, e.g., \"0.1\")\n- Destination address (if specified)\n\nRespond with a JSON markdown block containing only the extracted values:\n\n```json\n{\n \"token\": string | null,\n \"fromChain\": \"ethereum\" | \"abstract\" | \"base\" | \"sepolia\" | \"bsc\" | \"arbitrum\" | \"avalanche\" | \"polygon\" | \"optimism\" | \"cronos\" | \"gnosis\" | \"fantom\" | \"fraxtal\" | \"klaytn\" | \"celo\" | \"moonbeam\" | \"aurora\" | \"harmonyOne\" | \"moonriver\" | \"arbitrumNova\" | \"mantle\" | \"linea\" | \"scroll\" | \"filecoin\" | \"taiko\" | \"zksync\" | \"canto\" | \"alienx\" | \"gravity\" | null,\n \"toChain\": \"ethereum\" | \"abstract\" | \"base\" | \"sepolia\" | \"bsc\" | \"arbitrum\" | \"avalanche\" | \"polygon\" | \"optimism\" | \"cronos\" | \"gnosis\" | \"fantom\" | \"fraxtal\" | \"klaytn\" | \"celo\" | \"moonbeam\" | \"aurora\" | \"harmonyOne\" | \"moonriver\" | \"arbitrumNova\" | \"mantle\" | \"linea\" | \"scroll\" | \"filecoin\" | \"taiko\" | \"zksync\" | \"canto\" | \"alienx\" | \"gravity\" | null,\n \"amount\": string | null,\n \"toAddress\": string | null\n}\n```\n";
170218
declare const swapTemplate = "Given the recent messages and wallet information below:\n\n{{recentMessages}}\n\n{{walletInfo}}\n\nExtract the following information about the requested token swap:\n- Input token symbol or address (the token being sold)\n- Output token symbol or address (the token being bought)\n- Amount to swap: Must be a string representing the amount in ether (only number without coin symbol, e.g., \"0.1\")\n- Chain to execute on\n\nRespond with a JSON markdown block containing only the extracted values. Use null for any values that cannot be determined:\n\n```json\n{\n \"inputToken\": string | null,\n \"outputToken\": string | null,\n \"amount\": string | null,\n \"chain\": \"ethereum\" | \"abstract\" | \"base\" | \"sepolia\" | \"bsc\" | \"arbitrum\" | \"avalanche\" | \"polygon\" | \"optimism\" | \"cronos\" | \"gnosis\" | \"fantom\" | \"klaytn\" | \"celo\" | \"moonbeam\" | \"aurora\" | \"harmonyOne\" | \"moonriver\" | \"arbitrumNova\" | \"mantle\" | \"linea\" | \"scroll\" | \"filecoin\" | \"taiko\" | \"zksync\" | \"canto\" | \"alienx\" | null,\n \"slippage\": number | null\n}\n```\n";
171219

172220
declare class BridgeAction {
@@ -178,7 +226,7 @@ declare class BridgeAction {
178226
declare const bridgeAction: {
179227
name: string;
180228
description: string;
181-
handler: (runtime: IAgentRuntime, _message: Memory, state: State, _options: any, callback?: any) => Promise<boolean>;
229+
handler: (runtime: IAgentRuntime, _message: Memory, state: State, _options: Record<string, unknown>, callback?: HandlerCallback) => Promise<boolean>;
182230
template: string;
183231
validate: (runtime: IAgentRuntime) => Promise<boolean>;
184232
examples: {
@@ -193,9 +241,15 @@ declare const bridgeAction: {
193241

194242
declare class SwapAction {
195243
private walletProvider;
196-
private config;
244+
private lifiConfig;
245+
private bebopChainsMap;
197246
constructor(walletProvider: WalletProvider);
198247
swap(params: SwapParams): Promise<Transaction>;
248+
private getSortedQuotes;
249+
private getLifiQuote;
250+
private getBebopQuote;
251+
private executeLifiQuote;
252+
private executeBebopQuote;
199253
}
200254
declare const swapAction: {
201255
name: string;
@@ -222,4 +276,4 @@ declare const transferAction: Action;
222276

223277
declare const evmPlugin: Plugin;
224278

225-
export { BridgeAction, type BridgeParams, type ChainConfig, type ChainMetadata, type EvmPluginConfig, type LiFiRoute, type LiFiStatus, type ProviderError, type SupportedChain, SwapAction, type SwapParams, type TokenData, type TokenListResponse, type TokenPriceResponse, type TokenWithBalance, type Transaction, TransferAction, type TransferParams, type WalletBalance, WalletProvider, bridgeAction, bridgeTemplate, evmPlugin as default, evmPlugin, evmWalletProvider, initWalletProvider, swapAction, swapTemplate, transferAction };
279+
export { type BebopRoute, BridgeAction, type BridgeParams, type ChainConfig, type ChainMetadata, type EvmPluginConfig, type ExecuteProposalParams, type LiFiRoute, type LiFiStatus, type Proposal, type ProposeProposalParams, type ProviderError, type QueueProposalParams, type SupportedChain, SwapAction, type SwapParams, type SwapQuote, type TokenData, type TokenListResponse, type TokenPriceResponse, type TokenWithBalance, type Transaction, TransferAction, type TransferParams, type VoteParams, VoteType, type WalletBalance, WalletProvider, bridgeAction, bridgeTemplate, evmPlugin as default, evmPlugin, evmWalletProvider, initWalletProvider, swapAction, swapTemplate, transferAction };

0 commit comments

Comments
 (0)