@trustware/sdk-staging 1.1.5-staging.1 → 1.1.6-staging.2
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/constants.cjs +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/core-CVbN3gJy.d.ts +114 -0
- package/dist/core-u95iahDO.d.cts +114 -0
- package/dist/core.cjs +3934 -2552
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.mjs +3613 -2230
- package/dist/core.mjs.map +1 -1
- package/dist/{detect-DhXP4n2q.d.ts → detect-6MRR4B7g.d.ts} +1 -1
- package/dist/{detect-Mq5fFA3b.d.cts → detect-DVIWcXpl.d.cts} +1 -1
- package/dist/index.cjs +6579 -4374
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +6392 -4238
- package/dist/index.mjs.map +1 -1
- package/dist/manager-CXSw1h5e.d.cts +738 -0
- package/dist/manager-CXSw1h5e.d.ts +738 -0
- package/dist/wallet.cjs +3367 -1947
- package/dist/wallet.cjs.map +1 -1
- package/dist/wallet.d.cts +3 -3
- package/dist/wallet.d.ts +3 -3
- package/dist/wallet.mjs +3354 -1934
- package/dist/wallet.mjs.map +1 -1
- package/dist/widget.cjs +6188 -3982
- package/dist/widget.cjs.map +1 -1
- package/dist/widget.mjs +7108 -4953
- package/dist/widget.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/core-BfzQXmVp.d.cts +0 -475
- package/dist/core-CVt6h8aW.d.ts +0 -475
- package/dist/manager-tnJ6BGOZ.d.cts +0 -330
- package/dist/manager-tnJ6BGOZ.d.ts +0 -330
|
@@ -0,0 +1,738 @@
|
|
|
1
|
+
declare enum TrustwareErrorCode {
|
|
2
|
+
INVALID_CONFIG = "INVALID_CONFIG",
|
|
3
|
+
INVALID_API_KEY = "INVALID_API_KEY",
|
|
4
|
+
WALLET_NOT_CONNECTED = "WALLET_NOT_CONNECTED",
|
|
5
|
+
BRIDGE_FAILED = "BRIDGE_FAILED",
|
|
6
|
+
NETWORK_ERROR = "NETWORK_ERROR",
|
|
7
|
+
UNKNOWN_ERROR = "UNKNOWN_ERROR",
|
|
8
|
+
INPUT_ERROR = "INPUT_ERROR"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare class TrustwareError extends Error {
|
|
12
|
+
code: TrustwareErrorCode;
|
|
13
|
+
userMessage?: string;
|
|
14
|
+
cause?: unknown;
|
|
15
|
+
constructor(params: {
|
|
16
|
+
code: TrustwareErrorCode;
|
|
17
|
+
message: string;
|
|
18
|
+
userMessage?: string;
|
|
19
|
+
cause?: unknown;
|
|
20
|
+
});
|
|
21
|
+
toJSON(): {
|
|
22
|
+
name: string;
|
|
23
|
+
code: TrustwareErrorCode;
|
|
24
|
+
message: string;
|
|
25
|
+
userMessage: string | undefined;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type TrustwareWidgetTheme = {
|
|
30
|
+
primaryColor: string;
|
|
31
|
+
secondaryColor: string;
|
|
32
|
+
backgroundColor: string;
|
|
33
|
+
textColor: string;
|
|
34
|
+
borderColor: string;
|
|
35
|
+
radius: number;
|
|
36
|
+
};
|
|
37
|
+
type TrustwareWidgetMessages = {
|
|
38
|
+
title: string;
|
|
39
|
+
description: string;
|
|
40
|
+
};
|
|
41
|
+
declare const DEFAULT_THEME: TrustwareWidgetTheme;
|
|
42
|
+
declare const DEFAULT_MESSAGES: TrustwareWidgetMessages;
|
|
43
|
+
|
|
44
|
+
type WalletId = "metamask" | "coinbase" | "walletconnect" | "rainbow" | "phantom-evm" | "phantom-solana" | "solflare" | "backpack" | "rabby" | "brave" | "okx" | "zerion" | "taho" | "safe" | "imtoken" | "trust" | "bitget" | "kucoin";
|
|
45
|
+
type WalletCategory = "injected" | "walletconnect" | "app";
|
|
46
|
+
type WalletEcosystem = "evm" | "solana" | "multi";
|
|
47
|
+
type WalletMeta = {
|
|
48
|
+
id: WalletId;
|
|
49
|
+
name: string;
|
|
50
|
+
category: WalletCategory;
|
|
51
|
+
ecosystem: WalletEcosystem;
|
|
52
|
+
logo: string;
|
|
53
|
+
emoji?: string;
|
|
54
|
+
homepage?: string;
|
|
55
|
+
chromeWebStore?: string;
|
|
56
|
+
android?: string;
|
|
57
|
+
ios?: string;
|
|
58
|
+
deepLink?: (currentUrl: string) => string;
|
|
59
|
+
detectFlags?: string[];
|
|
60
|
+
};
|
|
61
|
+
type EIP1193 = {
|
|
62
|
+
request(args: {
|
|
63
|
+
method: string;
|
|
64
|
+
params?: unknown[] | object;
|
|
65
|
+
}): Promise<unknown>;
|
|
66
|
+
};
|
|
67
|
+
type EIP6963ProviderDetail = {
|
|
68
|
+
info: {
|
|
69
|
+
uuid: string;
|
|
70
|
+
name: string;
|
|
71
|
+
icon: string;
|
|
72
|
+
rdns?: string;
|
|
73
|
+
version?: string;
|
|
74
|
+
wallets?: {
|
|
75
|
+
name: string;
|
|
76
|
+
version?: string;
|
|
77
|
+
}[];
|
|
78
|
+
features?: string[];
|
|
79
|
+
};
|
|
80
|
+
provider: any;
|
|
81
|
+
methods: string[];
|
|
82
|
+
events: string[];
|
|
83
|
+
};
|
|
84
|
+
type DetectedWallet = {
|
|
85
|
+
meta: WalletMeta;
|
|
86
|
+
via: "eip6963" | "injected-flag" | "walletconnect" | "solana-window";
|
|
87
|
+
detail?: EIP6963ProviderDetail;
|
|
88
|
+
provider?: any;
|
|
89
|
+
};
|
|
90
|
+
type SolanaProviderLike = {
|
|
91
|
+
isPhantom?: boolean;
|
|
92
|
+
isSolflare?: boolean;
|
|
93
|
+
isBackpack?: boolean;
|
|
94
|
+
isConnected?: boolean;
|
|
95
|
+
publicKey?: {
|
|
96
|
+
toString(): string;
|
|
97
|
+
};
|
|
98
|
+
connect?: (options?: Record<string, unknown>) => Promise<unknown>;
|
|
99
|
+
disconnect?: () => Promise<void>;
|
|
100
|
+
signAndSendTransaction?: (transaction: unknown, options?: Record<string, unknown>) => Promise<{
|
|
101
|
+
signature?: string;
|
|
102
|
+
} | string>;
|
|
103
|
+
signTransaction?: (transaction: unknown) => Promise<{
|
|
104
|
+
serialize: () => Uint8Array;
|
|
105
|
+
}>;
|
|
106
|
+
on?: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
107
|
+
off?: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
108
|
+
removeListener?: (event: string, listener: (...args: unknown[]) => void) => void;
|
|
109
|
+
};
|
|
110
|
+
type BaseWalletInterface = {
|
|
111
|
+
ecosystem: "evm" | "solana";
|
|
112
|
+
getAddress(): Promise<string>;
|
|
113
|
+
disconnect?(): Promise<void>;
|
|
114
|
+
};
|
|
115
|
+
type EvmWalletInterface = BaseWalletInterface & {
|
|
116
|
+
ecosystem: "evm";
|
|
117
|
+
getChainId(): Promise<number>;
|
|
118
|
+
switchChain(chainId: number): Promise<void>;
|
|
119
|
+
} & ({
|
|
120
|
+
type: "eip1193";
|
|
121
|
+
request(args: {
|
|
122
|
+
method: string;
|
|
123
|
+
params?: unknown[] | object;
|
|
124
|
+
}): Promise<unknown>;
|
|
125
|
+
} | {
|
|
126
|
+
type: "wagmi";
|
|
127
|
+
sendTransaction(tx: {
|
|
128
|
+
to: `0x${string}`;
|
|
129
|
+
data: `0x${string}`;
|
|
130
|
+
value?: bigint;
|
|
131
|
+
chainId?: number;
|
|
132
|
+
}): Promise<{
|
|
133
|
+
hash: `0x${string}`;
|
|
134
|
+
}>;
|
|
135
|
+
});
|
|
136
|
+
type SolanaWalletInterface = BaseWalletInterface & {
|
|
137
|
+
ecosystem: "solana";
|
|
138
|
+
type: "solana";
|
|
139
|
+
getChainKey(): Promise<string>;
|
|
140
|
+
sendSerializedTransaction(serializedTransactionBase64: string, chainId?: string): Promise<string>;
|
|
141
|
+
};
|
|
142
|
+
type WalletInterFaceAPI = EvmWalletInterface | SolanaWalletInterface;
|
|
143
|
+
type SimpleWalletInterface = {
|
|
144
|
+
getAddress(): Promise<string>;
|
|
145
|
+
disconnect?(): Promise<void>;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
type ChainMeta = {
|
|
149
|
+
id: string;
|
|
150
|
+
networkIdentifier: string;
|
|
151
|
+
nativeCurrency: {
|
|
152
|
+
symbol: string;
|
|
153
|
+
decimals: number;
|
|
154
|
+
name: string;
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
type TokenMeta = {
|
|
158
|
+
chainId: string;
|
|
159
|
+
address: `0x${string}`;
|
|
160
|
+
symbol: string;
|
|
161
|
+
decimals: number;
|
|
162
|
+
visible?: boolean;
|
|
163
|
+
active?: boolean;
|
|
164
|
+
};
|
|
165
|
+
type BalanceRow = {
|
|
166
|
+
chain_key: string;
|
|
167
|
+
category: "native" | "erc20" | "spl" | "btc";
|
|
168
|
+
contract?: string;
|
|
169
|
+
address?: string;
|
|
170
|
+
symbol?: string;
|
|
171
|
+
decimals: number;
|
|
172
|
+
balance: string;
|
|
173
|
+
name?: string;
|
|
174
|
+
logoURI?: string;
|
|
175
|
+
usdPrice?: number;
|
|
176
|
+
};
|
|
177
|
+
type WalletAddressBalanceWrapper = {
|
|
178
|
+
chain_id: string;
|
|
179
|
+
balances: BalanceRow[];
|
|
180
|
+
count: number;
|
|
181
|
+
error: string | null;
|
|
182
|
+
source: string;
|
|
183
|
+
};
|
|
184
|
+
type TokenPageOptions = {
|
|
185
|
+
cursor?: string;
|
|
186
|
+
limit?: number;
|
|
187
|
+
q?: string;
|
|
188
|
+
};
|
|
189
|
+
type TokenPageInfo = {
|
|
190
|
+
hasNextPage: boolean;
|
|
191
|
+
nextCursor?: string;
|
|
192
|
+
};
|
|
193
|
+
type TokenPageResult = {
|
|
194
|
+
data: TokenDef[];
|
|
195
|
+
pageInfo: TokenPageInfo;
|
|
196
|
+
};
|
|
197
|
+
type BalanceStreamOptions = {
|
|
198
|
+
stream?: boolean;
|
|
199
|
+
signal?: AbortSignal;
|
|
200
|
+
strict?: boolean;
|
|
201
|
+
};
|
|
202
|
+
type ChainType = "evm" | "cosmos" | "solana" | "btc" | string;
|
|
203
|
+
interface NativeCurrency {
|
|
204
|
+
symbol: string;
|
|
205
|
+
name?: string;
|
|
206
|
+
decimals?: number;
|
|
207
|
+
icon?: string;
|
|
208
|
+
}
|
|
209
|
+
interface ChainDef {
|
|
210
|
+
/** API commonly sends both. We canonicalize on chainId as string. */
|
|
211
|
+
chainId: string | number;
|
|
212
|
+
id?: string | number;
|
|
213
|
+
/** Keys we use to resolve chains from presets / user input */
|
|
214
|
+
networkIdentifier?: string;
|
|
215
|
+
axelarChainName?: string;
|
|
216
|
+
networkName?: string;
|
|
217
|
+
/** UI/availability flags */
|
|
218
|
+
enabled?: boolean;
|
|
219
|
+
visible?: boolean;
|
|
220
|
+
isTestnet?: boolean;
|
|
221
|
+
/** Display */
|
|
222
|
+
chainIconURI?: string;
|
|
223
|
+
nativeCurrency?: NativeCurrency;
|
|
224
|
+
/** Kinds (some payloads use both) */
|
|
225
|
+
type?: ChainType;
|
|
226
|
+
chainType?: ChainType;
|
|
227
|
+
/** Nice-to-have extras we won't rely on but keep for completeness */
|
|
228
|
+
blockExplorerUrls?: string[];
|
|
229
|
+
rpc?: string;
|
|
230
|
+
rpcList?: string[];
|
|
231
|
+
}
|
|
232
|
+
type TokenType = "evm" | "solana" | "btc" | string;
|
|
233
|
+
interface TokenDef {
|
|
234
|
+
/** Core identity */
|
|
235
|
+
address: string;
|
|
236
|
+
chainId: string | number;
|
|
237
|
+
/** Display */
|
|
238
|
+
logoURI?: string;
|
|
239
|
+
name: string;
|
|
240
|
+
symbol: string;
|
|
241
|
+
/** Behavior / filtering */
|
|
242
|
+
decimals: number;
|
|
243
|
+
active?: boolean;
|
|
244
|
+
visible?: boolean;
|
|
245
|
+
type: TokenType;
|
|
246
|
+
/** Optional metadata */
|
|
247
|
+
usdPrice?: number;
|
|
248
|
+
coingeckoId?: string;
|
|
249
|
+
createdBy?: string;
|
|
250
|
+
subGraphIds?: string[];
|
|
251
|
+
subGraphOnly?: boolean;
|
|
252
|
+
}
|
|
253
|
+
type TokenWithBalance = TokenDef & {
|
|
254
|
+
balance?: bigint;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
type WalletAddressSource = "provider" | "manual" | "imported";
|
|
258
|
+
type WalletIdentityAddress = {
|
|
259
|
+
address: string;
|
|
260
|
+
chainType: ChainType;
|
|
261
|
+
chainKey?: string;
|
|
262
|
+
chainId?: string;
|
|
263
|
+
providerId?: string;
|
|
264
|
+
source: WalletAddressSource;
|
|
265
|
+
};
|
|
266
|
+
type WalletIdentity = {
|
|
267
|
+
addresses: WalletIdentityAddress[];
|
|
268
|
+
};
|
|
269
|
+
type WalletAddressResolution = {
|
|
270
|
+
status: "resolved";
|
|
271
|
+
address: string;
|
|
272
|
+
source: WalletAddressSource;
|
|
273
|
+
chainType: ChainType;
|
|
274
|
+
chainKey?: string;
|
|
275
|
+
chainId?: string;
|
|
276
|
+
} | {
|
|
277
|
+
status: "missing" | "invalid";
|
|
278
|
+
reason: string;
|
|
279
|
+
address?: string;
|
|
280
|
+
source?: WalletAddressSource;
|
|
281
|
+
chainType?: ChainType;
|
|
282
|
+
chainKey?: string;
|
|
283
|
+
chainId?: string;
|
|
284
|
+
};
|
|
285
|
+
type WalletIdentityChainLike = ChainDef | ChainType | string | null;
|
|
286
|
+
|
|
287
|
+
type BuildRouteBody = {
|
|
288
|
+
fromChain: string;
|
|
289
|
+
toChain: string;
|
|
290
|
+
fromToken: string;
|
|
291
|
+
toToken: string;
|
|
292
|
+
fromAmount: string;
|
|
293
|
+
fromAddress: string;
|
|
294
|
+
toAddress: string;
|
|
295
|
+
fromAmountUsd?: string;
|
|
296
|
+
fromAmountUSD?: string;
|
|
297
|
+
refundAddress?: string;
|
|
298
|
+
direction?: string;
|
|
299
|
+
slippage?: number;
|
|
300
|
+
slippageBps?: number;
|
|
301
|
+
linkId?: string;
|
|
302
|
+
memo?: string;
|
|
303
|
+
};
|
|
304
|
+
type TxRequest = {
|
|
305
|
+
to?: string;
|
|
306
|
+
target?: string;
|
|
307
|
+
data: string;
|
|
308
|
+
value?: string;
|
|
309
|
+
gasLimit?: string;
|
|
310
|
+
maxFeePerGas?: string;
|
|
311
|
+
maxPriorityFeePerGas?: string;
|
|
312
|
+
chainId?: number | string;
|
|
313
|
+
gasPrice?: string;
|
|
314
|
+
};
|
|
315
|
+
declare function buildRoute(body: BuildRouteBody, signal?: AbortSignal): Promise<{
|
|
316
|
+
intentId: string;
|
|
317
|
+
txReq: TxRequest;
|
|
318
|
+
actions: unknown[];
|
|
319
|
+
finalExchangeRate: {
|
|
320
|
+
fromAmountUSD?: string;
|
|
321
|
+
toAmountMinUSD?: string;
|
|
322
|
+
};
|
|
323
|
+
route: RoutePlan | undefined;
|
|
324
|
+
}>;
|
|
325
|
+
declare function buildDepositAddress(body: BuildRouteBody, signal?: AbortSignal): Promise<{
|
|
326
|
+
intentId: string;
|
|
327
|
+
depositAddress: string;
|
|
328
|
+
actions: unknown[];
|
|
329
|
+
finalExchangeRate: {
|
|
330
|
+
fromAmountUSD?: string;
|
|
331
|
+
toAmountMinUSD?: string;
|
|
332
|
+
};
|
|
333
|
+
route: RoutePlan | undefined;
|
|
334
|
+
}>;
|
|
335
|
+
declare function submitReceipt(intentId: string, txHash: string): Promise<any>;
|
|
336
|
+
declare function getStatus(intentId: string): Promise<Transaction>;
|
|
337
|
+
declare function pollStatus(intentId: string, { intervalMs, timeoutMs }?: {
|
|
338
|
+
intervalMs?: number | undefined;
|
|
339
|
+
timeoutMs?: number | undefined;
|
|
340
|
+
}): Promise<Transaction>;
|
|
341
|
+
|
|
342
|
+
type RouteParams = {
|
|
343
|
+
fromChain: string;
|
|
344
|
+
toChain: string;
|
|
345
|
+
fromToken: string;
|
|
346
|
+
toToken: string;
|
|
347
|
+
fromAmount: string | number;
|
|
348
|
+
fromAddress: string;
|
|
349
|
+
toAddress: string;
|
|
350
|
+
slippage?: number;
|
|
351
|
+
};
|
|
352
|
+
type RouteIntent = {
|
|
353
|
+
id: string;
|
|
354
|
+
fromChainId: string | number;
|
|
355
|
+
toChainId: string | number;
|
|
356
|
+
fromToken: string;
|
|
357
|
+
toToken: string;
|
|
358
|
+
fromAddress: string;
|
|
359
|
+
toAddress: string;
|
|
360
|
+
fromAmountWei: string | number;
|
|
361
|
+
quoteToAmountWei: string | number;
|
|
362
|
+
minToAmountWei: string | number;
|
|
363
|
+
requestId?: string;
|
|
364
|
+
routeRaw?: unknown;
|
|
365
|
+
status: "created" | "submitted" | "bridging" | "success" | "failed";
|
|
366
|
+
createdDate: Date | string;
|
|
367
|
+
updatedDate: Date | string;
|
|
368
|
+
};
|
|
369
|
+
type Transaction = {
|
|
370
|
+
id: string;
|
|
371
|
+
intentId: string;
|
|
372
|
+
fromAddress: string;
|
|
373
|
+
toAddress: string;
|
|
374
|
+
fromChainId: string | number;
|
|
375
|
+
toChainId: string | number;
|
|
376
|
+
sourceTxHash: string;
|
|
377
|
+
destTxHash: string;
|
|
378
|
+
requestId: string;
|
|
379
|
+
transactionRequest: unknown;
|
|
380
|
+
status: "submitted" | "bridging" | "success" | "failed";
|
|
381
|
+
statusRaw?: unknown;
|
|
382
|
+
routePath?: unknown;
|
|
383
|
+
routeStatus?: unknown;
|
|
384
|
+
toAmountWei?: string | number;
|
|
385
|
+
fromChainBlock: number;
|
|
386
|
+
toChainBlock: number;
|
|
387
|
+
fromChainTxUrl?: string;
|
|
388
|
+
toChainTxUrl?: string;
|
|
389
|
+
gasStatus?: string;
|
|
390
|
+
isGMPTransaction?: boolean;
|
|
391
|
+
axelarTransactionUrl?: string;
|
|
392
|
+
createdDate: Date | string;
|
|
393
|
+
updatedDate: Date | string;
|
|
394
|
+
timeSpentMs?: number;
|
|
395
|
+
};
|
|
396
|
+
type RouteEstimate = {
|
|
397
|
+
fromAmount?: string;
|
|
398
|
+
toAmount?: string;
|
|
399
|
+
toAmountMin?: string;
|
|
400
|
+
fromAmountUsd?: string;
|
|
401
|
+
toAmountUsd?: string;
|
|
402
|
+
totalFeesUsd?: string;
|
|
403
|
+
toAmountMinUsd?: string;
|
|
404
|
+
fees?: unknown[];
|
|
405
|
+
};
|
|
406
|
+
type RoutePlan = {
|
|
407
|
+
estimate?: RouteEstimate;
|
|
408
|
+
execution?: {
|
|
409
|
+
transaction?: TxRequest;
|
|
410
|
+
};
|
|
411
|
+
steps?: unknown[];
|
|
412
|
+
provider?: string;
|
|
413
|
+
requestId?: string;
|
|
414
|
+
reliabilityScore?: number;
|
|
415
|
+
diagnostics?: {
|
|
416
|
+
rawPayload?: unknown;
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
type BuildRouteResult = {
|
|
420
|
+
intentId: string;
|
|
421
|
+
txReq: TxRequest;
|
|
422
|
+
actions: unknown[];
|
|
423
|
+
finalExchangeRate: {
|
|
424
|
+
fromAmountUSD?: string;
|
|
425
|
+
toAmountMinUSD?: string;
|
|
426
|
+
};
|
|
427
|
+
route: RoutePlan | undefined;
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
type TrustwareEvent = {
|
|
431
|
+
type: "error";
|
|
432
|
+
error: TrustwareError;
|
|
433
|
+
} | {
|
|
434
|
+
type: "transaction_started";
|
|
435
|
+
} | {
|
|
436
|
+
type: "transaction_success";
|
|
437
|
+
txHash: string;
|
|
438
|
+
transaction?: Transaction;
|
|
439
|
+
} | {
|
|
440
|
+
type: "wallet_connected";
|
|
441
|
+
address: string;
|
|
442
|
+
} | {
|
|
443
|
+
type: "token_page_loaded";
|
|
444
|
+
chainRef: string;
|
|
445
|
+
query?: string;
|
|
446
|
+
count: number;
|
|
447
|
+
hasNextPage: boolean;
|
|
448
|
+
cursor?: string;
|
|
449
|
+
} | {
|
|
450
|
+
type: "token_page_error";
|
|
451
|
+
chainRef: string;
|
|
452
|
+
query?: string;
|
|
453
|
+
cursor?: string;
|
|
454
|
+
message: string;
|
|
455
|
+
} | {
|
|
456
|
+
type: "balance_stream_chunk";
|
|
457
|
+
address: string;
|
|
458
|
+
chunkSize: number;
|
|
459
|
+
} | {
|
|
460
|
+
type: "balance_stream_fallback";
|
|
461
|
+
address: string;
|
|
462
|
+
message: string;
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
/** WalletConnect configuration options (all optional - SDK has built-in defaults) */
|
|
466
|
+
type WalletConnectConfig = {
|
|
467
|
+
/** Override the built-in WalletConnect project ID (optional - SDK includes one) */
|
|
468
|
+
projectId?: string;
|
|
469
|
+
/** Chain IDs to support (defaults to [1] for Ethereum mainnet) */
|
|
470
|
+
chains?: number[];
|
|
471
|
+
/** Optional chain IDs (chains that can be switched to) */
|
|
472
|
+
optionalChains?: number[];
|
|
473
|
+
/** dApp metadata shown in wallet */
|
|
474
|
+
metadata?: {
|
|
475
|
+
name: string;
|
|
476
|
+
description?: string;
|
|
477
|
+
url: string;
|
|
478
|
+
icons?: string[];
|
|
479
|
+
};
|
|
480
|
+
/** Custom relay URL (defaults to WalletConnect's relay) */
|
|
481
|
+
relayUrl?: string;
|
|
482
|
+
/** Whether to show our custom QR modal (default: true) */
|
|
483
|
+
showQrModal?: boolean;
|
|
484
|
+
/** Disable WalletConnect entirely (default: false) */
|
|
485
|
+
disabled?: boolean;
|
|
486
|
+
};
|
|
487
|
+
/** Resolved WalletConnect config with defaults applied */
|
|
488
|
+
type ResolvedWalletConnectConfig = {
|
|
489
|
+
projectId: string;
|
|
490
|
+
chains: number[];
|
|
491
|
+
optionalChains: number[];
|
|
492
|
+
metadata: {
|
|
493
|
+
name: string;
|
|
494
|
+
description: string;
|
|
495
|
+
url: string;
|
|
496
|
+
icons: string[];
|
|
497
|
+
};
|
|
498
|
+
relayUrl?: string;
|
|
499
|
+
showQrModal: boolean;
|
|
500
|
+
};
|
|
501
|
+
type TrustwareConfigOptions = {
|
|
502
|
+
apiKey: string;
|
|
503
|
+
routes: {
|
|
504
|
+
toChain: string;
|
|
505
|
+
toToken: string;
|
|
506
|
+
fromToken?: string;
|
|
507
|
+
fromChain?: string;
|
|
508
|
+
fromAddress?: string;
|
|
509
|
+
toAddress?: string;
|
|
510
|
+
defaultSlippage?: number;
|
|
511
|
+
routeType?: string;
|
|
512
|
+
options?: {
|
|
513
|
+
routeRefreshMs?: number;
|
|
514
|
+
fixedFromAmount?: string | number;
|
|
515
|
+
minAmountOut?: string | number;
|
|
516
|
+
maxAmountOut?: string | number;
|
|
517
|
+
};
|
|
518
|
+
};
|
|
519
|
+
autoDetectProvider?: boolean;
|
|
520
|
+
theme?: TrustwareWidgetTheme;
|
|
521
|
+
messages?: Partial<TrustwareWidgetMessages>;
|
|
522
|
+
retry?: RetryConfig;
|
|
523
|
+
walletConnect?: WalletConnectConfig;
|
|
524
|
+
features?: FeatureFlags;
|
|
525
|
+
onError?: (error: TrustwareError) => void;
|
|
526
|
+
onSuccess?: (transaction: Transaction) => void;
|
|
527
|
+
onEvent?: (event: TrustwareEvent) => void;
|
|
528
|
+
};
|
|
529
|
+
type ResolvedTrustwareConfig = {
|
|
530
|
+
apiKey: string;
|
|
531
|
+
routes: {
|
|
532
|
+
toChain: string;
|
|
533
|
+
toToken: string;
|
|
534
|
+
fromToken?: string;
|
|
535
|
+
fromAddress?: string;
|
|
536
|
+
toAddress?: string;
|
|
537
|
+
defaultSlippage: number;
|
|
538
|
+
routeType: string;
|
|
539
|
+
options: {
|
|
540
|
+
routeRefreshMs?: number;
|
|
541
|
+
fixedFromAmount?: string | number;
|
|
542
|
+
minAmountOut?: string | number;
|
|
543
|
+
maxAmountOut?: string | number;
|
|
544
|
+
};
|
|
545
|
+
};
|
|
546
|
+
autoDetectProvider: boolean;
|
|
547
|
+
theme: TrustwareWidgetTheme;
|
|
548
|
+
messages: TrustwareWidgetMessages;
|
|
549
|
+
retry: ResolvedRetryConfig;
|
|
550
|
+
walletConnect?: ResolvedWalletConnectConfig | WalletConnectConfig | undefined;
|
|
551
|
+
features: ResolvedFeatureFlags;
|
|
552
|
+
onError?: (error: TrustwareError) => void;
|
|
553
|
+
onSuccess?: (transaction: Transaction) => void;
|
|
554
|
+
onEvent?: (event: TrustwareEvent) => void;
|
|
555
|
+
};
|
|
556
|
+
type FeatureFlags = {
|
|
557
|
+
tokensPagination?: boolean;
|
|
558
|
+
balanceStreaming?: boolean;
|
|
559
|
+
shouldAllowGA4?: boolean;
|
|
560
|
+
};
|
|
561
|
+
type ResolvedFeatureFlags = {
|
|
562
|
+
tokensPagination: boolean;
|
|
563
|
+
balanceStreaming: boolean;
|
|
564
|
+
shouldAllowGA4: boolean;
|
|
565
|
+
};
|
|
566
|
+
declare const DEFAULT_SLIPPAGE = 1;
|
|
567
|
+
declare const DEFAULT_AUTO_DETECT_PROVIDER = false;
|
|
568
|
+
type RateLimitInfo = {
|
|
569
|
+
/** Maximum requests allowed in the current window */
|
|
570
|
+
limit: number;
|
|
571
|
+
/** Requests remaining in the current window */
|
|
572
|
+
remaining: number;
|
|
573
|
+
/** Unix timestamp when the rate limit window resets */
|
|
574
|
+
reset: number;
|
|
575
|
+
/** Seconds until rate limit resets (only present on 429 responses) */
|
|
576
|
+
retryAfter?: number;
|
|
577
|
+
};
|
|
578
|
+
type RetryConfig = {
|
|
579
|
+
/** Enable automatic retry on 429 responses (default: true). Note: This does NOT disable backend rate limits, only client-side retry behavior. */
|
|
580
|
+
autoRetry?: boolean;
|
|
581
|
+
/** Maximum number of retries on 429 (default: 3) */
|
|
582
|
+
maxRetries?: number;
|
|
583
|
+
/** Base delay in ms for exponential backoff (default: 1000) */
|
|
584
|
+
baseDelayMs?: number;
|
|
585
|
+
/** Callback when rate limit info is received from server */
|
|
586
|
+
onRateLimitInfo?: (info: RateLimitInfo) => void;
|
|
587
|
+
/** Callback when rate limit is hit (429 received) */
|
|
588
|
+
onRateLimited?: (info: RateLimitInfo, retryCount: number) => void;
|
|
589
|
+
/** Callback when remaining requests fall below threshold */
|
|
590
|
+
onRateLimitApproaching?: (info: RateLimitInfo, threshold: number) => void;
|
|
591
|
+
/** Threshold for onRateLimitApproaching callback (default: 5) */
|
|
592
|
+
approachingThreshold?: number;
|
|
593
|
+
};
|
|
594
|
+
type ResolvedRetryConfig = {
|
|
595
|
+
autoRetry: boolean;
|
|
596
|
+
maxRetries: number;
|
|
597
|
+
baseDelayMs: number;
|
|
598
|
+
approachingThreshold: number;
|
|
599
|
+
onRateLimitInfo?: (info: RateLimitInfo) => void;
|
|
600
|
+
onRateLimited?: (info: RateLimitInfo, retryCount: number) => void;
|
|
601
|
+
onRateLimitApproaching?: (info: RateLimitInfo, threshold: number) => void;
|
|
602
|
+
};
|
|
603
|
+
declare const DEFAULT_RETRY_CONFIG: ResolvedRetryConfig;
|
|
604
|
+
declare const DEFAULT_FEATURE_FLAGS: ResolvedFeatureFlags;
|
|
605
|
+
|
|
606
|
+
type WagmiConnector = {
|
|
607
|
+
/** Human label like "MetaMask", "WalletConnect" */
|
|
608
|
+
name: string;
|
|
609
|
+
/** Free-form type hint: "injected" | "walletConnect" | ... */
|
|
610
|
+
type?: string;
|
|
611
|
+
};
|
|
612
|
+
type WagmiBridge = {
|
|
613
|
+
/** Host app believes it’s connected (Wagmi state) */
|
|
614
|
+
isConnected(): boolean;
|
|
615
|
+
/** List of available connectors */
|
|
616
|
+
connectors(): WagmiConnector[];
|
|
617
|
+
/** Try connecting via a specific connector */
|
|
618
|
+
connect(connector: WagmiConnector): Promise<void>;
|
|
619
|
+
/** Disconnect current session */
|
|
620
|
+
disconnect(): Promise<void>;
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
declare function createWalletIdentity(addresses?: WalletIdentityAddress[]): WalletIdentity;
|
|
624
|
+
declare function upsertWalletIdentityAddress(identity: WalletIdentity, next: WalletIdentityAddress): WalletIdentity;
|
|
625
|
+
declare function resolveWalletAddressForChain(identity: WalletIdentity, chain?: WalletIdentityChainLike): WalletAddressResolution;
|
|
626
|
+
declare function buildWalletIdentityAddress(params: {
|
|
627
|
+
address: string;
|
|
628
|
+
chain: WalletIdentityChainLike;
|
|
629
|
+
source: WalletAddressSource;
|
|
630
|
+
providerId?: string;
|
|
631
|
+
}): WalletIdentityAddress | null;
|
|
632
|
+
declare class IdentityStore {
|
|
633
|
+
private _identity;
|
|
634
|
+
get snapshot(): WalletIdentity;
|
|
635
|
+
reset(): void;
|
|
636
|
+
upsert(next: WalletIdentityAddress): WalletIdentity;
|
|
637
|
+
resolve(chain?: WalletIdentityChainLike): WalletAddressResolution;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
type Status = "idle" | "detecting" | "connecting" | "connected" | "error";
|
|
641
|
+
type ConnectedVia = "extension" | "walletconnect" | "direct" | null;
|
|
642
|
+
type Listener = (s: Status) => void;
|
|
643
|
+
interface WalletSnapshot {
|
|
644
|
+
status: Status;
|
|
645
|
+
connectedVia: ConnectedVia;
|
|
646
|
+
walletType: "walletconnect" | "other";
|
|
647
|
+
error: string | null;
|
|
648
|
+
detected: DetectedWallet[];
|
|
649
|
+
wallet: WalletInterFaceAPI | null;
|
|
650
|
+
simple: SimpleWalletInterface | null;
|
|
651
|
+
identity: ReturnType<any>;
|
|
652
|
+
connectedWalletId: string | null;
|
|
653
|
+
address: string | null;
|
|
654
|
+
isConnected: boolean;
|
|
655
|
+
}
|
|
656
|
+
declare class WalletManager {
|
|
657
|
+
private _status;
|
|
658
|
+
private _connectedVia;
|
|
659
|
+
private _wallet;
|
|
660
|
+
private _detected;
|
|
661
|
+
private _listeners;
|
|
662
|
+
private _error;
|
|
663
|
+
private _identity;
|
|
664
|
+
private _providerCleanup;
|
|
665
|
+
private _connectedWalletId;
|
|
666
|
+
private _address;
|
|
667
|
+
private _onExternalDisconnectCallback;
|
|
668
|
+
private _snapshot;
|
|
669
|
+
get status(): Status;
|
|
670
|
+
get error(): string | null;
|
|
671
|
+
get detected(): DetectedWallet[];
|
|
672
|
+
get wallet(): WalletInterFaceAPI | null;
|
|
673
|
+
get connectedVia(): ConnectedVia;
|
|
674
|
+
get connectedWalletId(): string | null;
|
|
675
|
+
get address(): string | null;
|
|
676
|
+
get isConnected(): boolean;
|
|
677
|
+
get walletType(): "walletconnect" | "other";
|
|
678
|
+
get simple(): SimpleWalletInterface | null;
|
|
679
|
+
get identity(): WalletIdentity;
|
|
680
|
+
get snapshot(): WalletSnapshot;
|
|
681
|
+
private buildSnapshot;
|
|
682
|
+
onChange(fn: Listener): () => boolean;
|
|
683
|
+
private emit;
|
|
684
|
+
onExternalDisconnect(cb: () => void): () => void;
|
|
685
|
+
private triggerExternalDisconnect;
|
|
686
|
+
setDetected(list: DetectedWallet[]): void;
|
|
687
|
+
autoAttach(opts?: {
|
|
688
|
+
wagmi?: WagmiBridge;
|
|
689
|
+
pick?: (list: DetectedWallet[]) => DetectedWallet | undefined;
|
|
690
|
+
}): Promise<void>;
|
|
691
|
+
connectDetected(target: DetectedWallet, opts?: {
|
|
692
|
+
wagmi?: WagmiBridge;
|
|
693
|
+
}): Promise<{
|
|
694
|
+
error: null;
|
|
695
|
+
api: WalletInterFaceAPI;
|
|
696
|
+
} | {
|
|
697
|
+
error: string;
|
|
698
|
+
api: WalletInterFaceAPI | null;
|
|
699
|
+
} | undefined>;
|
|
700
|
+
connectWalletConnect(walletCfg?: WalletConnectConfig): Promise<{
|
|
701
|
+
error: null;
|
|
702
|
+
api: WalletInterFaceAPI;
|
|
703
|
+
} | {
|
|
704
|
+
error: string;
|
|
705
|
+
api: null;
|
|
706
|
+
}>;
|
|
707
|
+
disconnect(wagmi?: WagmiBridge): Promise<void>;
|
|
708
|
+
attachWallet(api: WalletInterFaceAPI): void;
|
|
709
|
+
setStatus(s: Status): void;
|
|
710
|
+
addIdentityAddress(address: WalletIdentityAddress): void;
|
|
711
|
+
resolveAddressForChain(chain: Parameters<IdentityStore["resolve"]>[0]): WalletAddressResolution;
|
|
712
|
+
private clearProviderCleanup;
|
|
713
|
+
private clearConnectedState;
|
|
714
|
+
private fullReset;
|
|
715
|
+
private bindExtensionProviderEvents;
|
|
716
|
+
private syncIdentityFromWallet;
|
|
717
|
+
}
|
|
718
|
+
declare const walletManager: WalletManager;
|
|
719
|
+
declare function useWireDetectionIntoManager(): void;
|
|
720
|
+
declare function useWalletConnectConnect(walletCfg?: WalletConnectConfig): () => Promise<{
|
|
721
|
+
error: null;
|
|
722
|
+
api: WalletInterFaceAPI;
|
|
723
|
+
} | {
|
|
724
|
+
error: string;
|
|
725
|
+
api: null;
|
|
726
|
+
}>;
|
|
727
|
+
declare function useWalletInfo(wagmi?: WagmiBridge): {
|
|
728
|
+
walletMetaId: string | null;
|
|
729
|
+
address: string | null;
|
|
730
|
+
isConnected: boolean;
|
|
731
|
+
connectedVia: ConnectedVia;
|
|
732
|
+
walletType: "walletconnect" | "other";
|
|
733
|
+
status: Status;
|
|
734
|
+
disconnect: () => Promise<void>;
|
|
735
|
+
};
|
|
736
|
+
declare function useWalletExternalDisconnect(cb: () => void): void;
|
|
737
|
+
|
|
738
|
+
export { type WalletEcosystem as $, type TokenDef as A, type BalanceRow as B, type ChainDef as C, DEFAULT_AUTO_DETECT_PROVIDER as D, type EIP1193 as E, type FeatureFlags as F, type TokenMeta as G, type TokenPageInfo as H, IdentityStore as I, type TokenPageOptions as J, type TokenPageResult as K, type TokenType as L, type TokenWithBalance as M, type NativeCurrency as N, type TrustwareWidgetMessages as O, type TrustwareWidgetTheme as P, type WagmiBridge as Q, type RateLimitInfo as R, type SimpleWalletInterface as S, type TrustwareConfigOptions as T, type WagmiConnector as U, type WalletAddressBalanceWrapper as V, type WalletInterFaceAPI as W, type WalletAddressResolution as X, type WalletAddressSource as Y, type WalletCategory as Z, type WalletConnectConfig as _, TrustwareError as a, type WalletId as a0, type WalletIdentity as a1, type WalletIdentityAddress as a2, type WalletIdentityChainLike as a3, type WalletMeta as a4, buildWalletIdentityAddress as a5, createWalletIdentity as a6, resolveWalletAddressForChain as a7, upsertWalletIdentityAddress as a8, useWireDetectionIntoManager as a9, type WalletSnapshot as aa, useWalletConnectConnect as ab, useWalletExternalDisconnect as ac, useWalletInfo as ad, walletManager as ae, buildRoute as af, buildDepositAddress as ag, submitReceipt as ah, getStatus as ai, pollStatus as aj, type Transaction as b, type TrustwareEvent as c, type BalanceStreamOptions as d, type BuildRouteResult as e, type ChainMeta as f, type ChainType as g, DEFAULT_FEATURE_FLAGS as h, DEFAULT_MESSAGES as i, DEFAULT_RETRY_CONFIG as j, DEFAULT_SLIPPAGE as k, DEFAULT_THEME as l, type DetectedWallet as m, type EIP6963ProviderDetail as n, type EvmWalletInterface as o, type ResolvedFeatureFlags as p, type ResolvedRetryConfig as q, type ResolvedTrustwareConfig as r, type ResolvedWalletConnectConfig as s, type RetryConfig as t, type RouteEstimate as u, type RouteIntent as v, type RouteParams as w, type RoutePlan as x, type SolanaProviderLike as y, type SolanaWalletInterface as z };
|