@vleap/warps-adapter-evm 0.2.0-alpha.19 → 0.2.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.cts +219 -0
- package/dist/index.js +1396 -0
- package/dist/index.js.map +1 -0
- package/package.json +3 -2
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { WarpChainAsset, AdapterFactory, WarpClientConfig, Adapter, WarpChain, WarpChainEnv, WarpChainInfo, AdapterWarpDataLoader, WarpChainAccount, WarpDataLoaderOptions, WarpChainAction, AdapterWarpExecutor, WarpExecutable, WarpExecution, WarpActionInputType, AdapterWarpExplorer, AdapterWarpResults, Warp, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
|
|
2
|
+
import { ethers } from 'ethers';
|
|
3
|
+
|
|
4
|
+
declare const NativeTokenArb: WarpChainAsset;
|
|
5
|
+
declare const getArbitrumAdapter: AdapterFactory;
|
|
6
|
+
|
|
7
|
+
declare const NativeTokenBase: WarpChainAsset;
|
|
8
|
+
declare const getBaseAdapter: AdapterFactory;
|
|
9
|
+
|
|
10
|
+
declare const getAllEvmAdapters: (config: WarpClientConfig, fallback?: Adapter) => Adapter[];
|
|
11
|
+
declare const getAllEvmChainNames: () => WarpChain[];
|
|
12
|
+
|
|
13
|
+
declare const createEvmAdapter: (chainName: string, chainPrefix: string, chainInfos: Record<WarpChainEnv, WarpChainInfo>) => AdapterFactory;
|
|
14
|
+
|
|
15
|
+
declare const NativeTokenEth: WarpChainAsset;
|
|
16
|
+
declare const getEthereumAdapter: AdapterFactory;
|
|
17
|
+
|
|
18
|
+
declare const WarpEvmConstants: {
|
|
19
|
+
GasLimit: {
|
|
20
|
+
Default: number;
|
|
21
|
+
ContractCall: number;
|
|
22
|
+
ContractDeploy: number;
|
|
23
|
+
Transfer: number;
|
|
24
|
+
TokenTransfer: number;
|
|
25
|
+
Approve: number;
|
|
26
|
+
Swap: number;
|
|
27
|
+
};
|
|
28
|
+
GasPrice: {
|
|
29
|
+
Default: string;
|
|
30
|
+
};
|
|
31
|
+
Validation: {
|
|
32
|
+
MinGasLimit: number;
|
|
33
|
+
MaxGasLimit: number;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
declare enum EthereumExplorers {
|
|
37
|
+
Etherscan = "etherscan",
|
|
38
|
+
EtherscanSepolia = "etherscan_sepolia",
|
|
39
|
+
Ethplorer = "ethplorer",
|
|
40
|
+
Blockscout = "blockscout",
|
|
41
|
+
BlockscoutSepolia = "blockscout_sepolia"
|
|
42
|
+
}
|
|
43
|
+
declare enum ArbitrumExplorers {
|
|
44
|
+
Arbiscan = "arbiscan",
|
|
45
|
+
ArbiscanSepolia = "arbiscan_sepolia",
|
|
46
|
+
BlockscoutArbitrum = "blockscout_arbitrum",
|
|
47
|
+
BlockscoutArbitrumSepolia = "blockscout_arbitrum_sepolia"
|
|
48
|
+
}
|
|
49
|
+
declare enum BaseExplorers {
|
|
50
|
+
Basescan = "basescan",
|
|
51
|
+
BasescanSepolia = "basescan_sepolia",
|
|
52
|
+
BlockscoutBase = "blockscout_base",
|
|
53
|
+
BlockscoutBaseSepolia = "blockscout_base_sepolia"
|
|
54
|
+
}
|
|
55
|
+
type ExplorerName = EthereumExplorers | ArbitrumExplorers | BaseExplorers;
|
|
56
|
+
declare const EvmExplorers: {
|
|
57
|
+
readonly ethereum: {
|
|
58
|
+
readonly mainnet: readonly [EthereumExplorers.Etherscan, EthereumExplorers.Ethplorer, EthereumExplorers.Blockscout];
|
|
59
|
+
readonly testnet: readonly [EthereumExplorers.EtherscanSepolia, EthereumExplorers.BlockscoutSepolia];
|
|
60
|
+
readonly devnet: readonly [EthereumExplorers.EtherscanSepolia, EthereumExplorers.BlockscoutSepolia];
|
|
61
|
+
};
|
|
62
|
+
readonly arbitrum: {
|
|
63
|
+
readonly mainnet: readonly [ArbitrumExplorers.Arbiscan, ArbitrumExplorers.BlockscoutArbitrum];
|
|
64
|
+
readonly testnet: readonly [ArbitrumExplorers.ArbiscanSepolia, ArbitrumExplorers.BlockscoutArbitrumSepolia];
|
|
65
|
+
readonly devnet: readonly [ArbitrumExplorers.ArbiscanSepolia, ArbitrumExplorers.BlockscoutArbitrumSepolia];
|
|
66
|
+
};
|
|
67
|
+
readonly base: {
|
|
68
|
+
readonly mainnet: readonly [BaseExplorers.Basescan, BaseExplorers.BlockscoutBase];
|
|
69
|
+
readonly testnet: readonly [BaseExplorers.BasescanSepolia, BaseExplorers.BlockscoutBaseSepolia];
|
|
70
|
+
readonly devnet: readonly [BaseExplorers.BasescanSepolia, BaseExplorers.BlockscoutBaseSepolia];
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
declare const ExplorerUrls: Record<ExplorerName, string>;
|
|
74
|
+
|
|
75
|
+
interface TokenInfo$1 {
|
|
76
|
+
name?: string;
|
|
77
|
+
symbol?: string;
|
|
78
|
+
logoURI?: string;
|
|
79
|
+
decimals?: number;
|
|
80
|
+
}
|
|
81
|
+
declare class EvmLogoService {
|
|
82
|
+
static getTokenInfo(chainName: string, tokenAddress: string): Promise<TokenInfo$1>;
|
|
83
|
+
static getLogoUrl(chainName: string, tokenAddress: string, tokenName?: string, tokenSymbol?: string): Promise<string>;
|
|
84
|
+
private static fetchFromTokenLists;
|
|
85
|
+
private static fetchFromDefiLlama;
|
|
86
|
+
private static fetchFromTrustWallet;
|
|
87
|
+
static clearCache(): void;
|
|
88
|
+
static getCacheSize(): number;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface TokenMetadata$1 {
|
|
92
|
+
name: string;
|
|
93
|
+
symbol: string;
|
|
94
|
+
decimals: number;
|
|
95
|
+
logoUrl?: string;
|
|
96
|
+
}
|
|
97
|
+
interface TokenBalance {
|
|
98
|
+
tokenAddress: string;
|
|
99
|
+
balance: bigint;
|
|
100
|
+
metadata: TokenMetadata$1;
|
|
101
|
+
}
|
|
102
|
+
interface TokenInfo {
|
|
103
|
+
name?: string;
|
|
104
|
+
symbol?: string;
|
|
105
|
+
logoURI?: string;
|
|
106
|
+
decimals?: number;
|
|
107
|
+
}
|
|
108
|
+
interface TokenListResponse {
|
|
109
|
+
tokens: Array<{
|
|
110
|
+
chainId: number;
|
|
111
|
+
address: string;
|
|
112
|
+
name: string;
|
|
113
|
+
symbol: string;
|
|
114
|
+
decimals: number;
|
|
115
|
+
logoURI?: string;
|
|
116
|
+
}>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
interface TokenMetadata {
|
|
120
|
+
name: string;
|
|
121
|
+
symbol: string;
|
|
122
|
+
decimals: number;
|
|
123
|
+
logoUrl?: string;
|
|
124
|
+
}
|
|
125
|
+
declare class WarpEvmDataLoader implements AdapterWarpDataLoader {
|
|
126
|
+
private readonly config;
|
|
127
|
+
private readonly chain;
|
|
128
|
+
private provider;
|
|
129
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
130
|
+
getAccount(address: string): Promise<WarpChainAccount>;
|
|
131
|
+
getAccountAssets(address: string): Promise<WarpChainAsset[]>;
|
|
132
|
+
getAccountActions(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAction[]>;
|
|
133
|
+
private getERC20TokenBalances;
|
|
134
|
+
private getTokenBalance;
|
|
135
|
+
private getTokenMetadata;
|
|
136
|
+
private detectTokensFromEvents;
|
|
137
|
+
getTokenInfo(tokenAddress: string): Promise<TokenMetadata | null>;
|
|
138
|
+
getTokenBalanceForAddress(address: string, tokenAddress: string): Promise<bigint>;
|
|
139
|
+
getMultipleTokenBalances(address: string, tokenAddresses: string[]): Promise<Map<string, bigint>>;
|
|
140
|
+
getAccountTokens(address: string): Promise<WarpChainAsset[]>;
|
|
141
|
+
getTokenMetadataPublic(tokenAddress: string): Promise<TokenMetadata | null>;
|
|
142
|
+
getChainInfo(): Promise<{
|
|
143
|
+
chainId: string;
|
|
144
|
+
blockTime: number;
|
|
145
|
+
}>;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
declare class WarpEvmExecutor implements AdapterWarpExecutor {
|
|
149
|
+
private readonly config;
|
|
150
|
+
private readonly chain;
|
|
151
|
+
private readonly serializer;
|
|
152
|
+
private readonly provider;
|
|
153
|
+
private readonly results;
|
|
154
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
155
|
+
createTransaction(executable: WarpExecutable): Promise<ethers.TransactionRequest>;
|
|
156
|
+
createTransferTransaction(executable: WarpExecutable): Promise<ethers.TransactionRequest>;
|
|
157
|
+
createContractCallTransaction(executable: WarpExecutable): Promise<ethers.TransactionRequest>;
|
|
158
|
+
private createTokenTransferTransaction;
|
|
159
|
+
private createSingleTokenTransfer;
|
|
160
|
+
executeQuery(executable: WarpExecutable): Promise<WarpExecution>;
|
|
161
|
+
preprocessInput(chain: WarpChainInfo, input: string, type: WarpActionInputType, value: string): Promise<string>;
|
|
162
|
+
private estimateGasAndSetDefaults;
|
|
163
|
+
signMessage(message: string, privateKey: string): Promise<string>;
|
|
164
|
+
verifyMessage(message: string, signature: string): Promise<string>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
declare class WarpEvmExplorer implements AdapterWarpExplorer {
|
|
168
|
+
private readonly chain;
|
|
169
|
+
private readonly config;
|
|
170
|
+
constructor(chain: WarpChainInfo, config: WarpClientConfig);
|
|
171
|
+
private getExplorers;
|
|
172
|
+
private getPrimaryExplorer;
|
|
173
|
+
private getExplorerUrlByName;
|
|
174
|
+
getAccountUrl(address: string, explorer?: ExplorerName): string;
|
|
175
|
+
getTransactionUrl(hash: string, explorer?: ExplorerName): string;
|
|
176
|
+
getBlockUrl(blockNumber: string | number, explorer?: ExplorerName): string;
|
|
177
|
+
getAssetUrl(identifier: string, explorer?: ExplorerName): string;
|
|
178
|
+
getContractUrl(address: string, explorer?: ExplorerName): string;
|
|
179
|
+
getAllExplorers(): readonly ExplorerName[];
|
|
180
|
+
getExplorerByName(name: string): ExplorerName | undefined;
|
|
181
|
+
getAccountUrls(address: string): Record<ExplorerName, string>;
|
|
182
|
+
getTransactionUrls(hash: string): Record<ExplorerName, string>;
|
|
183
|
+
getAssetUrls(identifier: string): Record<ExplorerName, string>;
|
|
184
|
+
getContractUrls(address: string): Record<ExplorerName, string>;
|
|
185
|
+
getBlockUrls(blockNumber: string | number): Record<ExplorerName, string>;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
declare class WarpEvmResults implements AdapterWarpResults {
|
|
189
|
+
private readonly config;
|
|
190
|
+
private readonly chain?;
|
|
191
|
+
private readonly serializer;
|
|
192
|
+
private readonly provider;
|
|
193
|
+
constructor(config: WarpClientConfig, chain?: WarpChainInfo | undefined);
|
|
194
|
+
getTransactionExecutionResults(warp: Warp, tx: ethers.TransactionReceipt): Promise<WarpExecution>;
|
|
195
|
+
extractQueryResults(warp: Warp, typedValues: any[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
|
|
196
|
+
values: any[];
|
|
197
|
+
valuesRaw: any[];
|
|
198
|
+
results: WarpExecutionResults;
|
|
199
|
+
}>;
|
|
200
|
+
getTransactionStatus(txHash: string): Promise<{
|
|
201
|
+
status: 'pending' | 'confirmed' | 'failed';
|
|
202
|
+
blockNumber?: number;
|
|
203
|
+
gasUsed?: bigint;
|
|
204
|
+
}>;
|
|
205
|
+
getTransactionReceipt(txHash: string): Promise<ethers.TransactionReceipt | null>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
declare class WarpEvmSerializer implements AdapterWarpSerializer {
|
|
209
|
+
readonly coreSerializer: WarpSerializer;
|
|
210
|
+
constructor();
|
|
211
|
+
typedToString(value: any): string;
|
|
212
|
+
typedToNative(value: any): [WarpActionInputType, WarpNativeValue];
|
|
213
|
+
nativeToTyped(type: WarpActionInputType, value: WarpNativeValue): any;
|
|
214
|
+
nativeToType(type: BaseWarpActionInputType): WarpAdapterGenericType;
|
|
215
|
+
stringToTyped(value: string): any;
|
|
216
|
+
private parseNativeValue;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export { ArbitrumExplorers, BaseExplorers, EthereumExplorers, EvmExplorers, EvmLogoService, type ExplorerName, ExplorerUrls, NativeTokenArb, NativeTokenBase, NativeTokenEth, type TokenBalance, type TokenInfo, type TokenListResponse, type TokenMetadata$1 as TokenMetadata, WarpEvmConstants, WarpEvmDataLoader, WarpEvmExecutor, WarpEvmExplorer, WarpEvmResults, WarpEvmSerializer, createEvmAdapter, getAllEvmAdapters, getAllEvmChainNames, getArbitrumAdapter, getBaseAdapter, getEthereumAdapter };
|