@sequence0/sdk 1.2.0 → 2.0.1
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/core/atomic.d.ts +76 -0
- package/dist/core/atomic.d.ts.map +1 -0
- package/dist/core/atomic.js +39 -0
- package/dist/core/atomic.js.map +1 -0
- package/dist/core/client.d.ts +238 -0
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/client.js +536 -4
- package/dist/core/client.js.map +1 -1
- package/dist/core/delegation.d.ts +184 -0
- package/dist/core/delegation.d.ts.map +1 -0
- package/dist/core/delegation.js +37 -0
- package/dist/core/delegation.js.map +1 -0
- package/dist/core/programmable.d.ts +66 -0
- package/dist/core/programmable.d.ts.map +1 -0
- package/dist/core/programmable.js +36 -0
- package/dist/core/programmable.js.map +1 -0
- package/dist/core/solvency.d.ts +223 -0
- package/dist/core/solvency.d.ts.map +1 -0
- package/dist/core/solvency.js +267 -0
- package/dist/core/solvency.js.map +1 -0
- package/dist/core/types.d.ts +11 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/universal-account.d.ts +438 -0
- package/dist/core/universal-account.d.ts.map +1 -0
- package/dist/core/universal-account.js +597 -0
- package/dist/core/universal-account.js.map +1 -0
- package/dist/core/witness.d.ts +197 -0
- package/dist/core/witness.d.ts.map +1 -0
- package/dist/core/witness.js +298 -0
- package/dist/core/witness.js.map +1 -0
- package/dist/erc4337/types.js +2 -2
- package/dist/index.d.ts +12 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/settlement/settlement.d.ts +152 -0
- package/dist/settlement/settlement.d.ts.map +1 -0
- package/dist/settlement/settlement.js +172 -0
- package/dist/settlement/settlement.js.map +1 -0
- package/dist/utils/discovery.js +4 -5
- package/dist/utils/discovery.js.map +1 -1
- package/dist/utils/eip712.js +2 -2
- package/dist/utils/fee.d.ts +2 -2
- package/dist/utils/fee.js +2 -2
- package/dist/utils/http.d.ts.map +1 -1
- package/dist/utils/http.js +6 -1
- package/dist/utils/http.js.map +1 -1
- package/dist/utils/logger.d.ts +3 -3
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +3 -3
- package/dist/utils/logger.js.map +1 -1
- package/dist/wallet/wallet.d.ts +52 -0
- package/dist/wallet/wallet.d.ts.map +1 -1
- package/dist/wallet/wallet.js +204 -0
- package/dist/wallet/wallet.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KEYSTONE: Universal Account — One Wallet, All Chains
|
|
3
|
+
*
|
|
4
|
+
* A single account identity that works across all 81 supported chains.
|
|
5
|
+
* Threshold keys (secp256k1 + ed25519) are generated once, and chain-
|
|
6
|
+
* specific addresses are derived deterministically. Send any token on
|
|
7
|
+
* any chain from one unified account, with automatic routing to the
|
|
8
|
+
* optimal source chain.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { UniversalAccountClient } from '@sequence0/sdk';
|
|
13
|
+
*
|
|
14
|
+
* const ua = new UniversalAccountClient('http://agent:8080');
|
|
15
|
+
*
|
|
16
|
+
* // Create a universal account
|
|
17
|
+
* const account = await ua.createAccount({
|
|
18
|
+
* ownerSignature: '0x...',
|
|
19
|
+
* timestamp: Date.now(),
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* // View all chain addresses
|
|
23
|
+
* const addresses = await ua.getChainAddresses(account.accountId);
|
|
24
|
+
* console.log('Ethereum:', addresses.ethereum.address);
|
|
25
|
+
* console.log('Solana:', addresses.solana.address);
|
|
26
|
+
* console.log('Bitcoin:', addresses.bitcoin.address);
|
|
27
|
+
*
|
|
28
|
+
* // Get unified balance across all chains
|
|
29
|
+
* const balance = await ua.getUnifiedBalance(account.accountId);
|
|
30
|
+
* for (const chain of balance.chains) {
|
|
31
|
+
* console.log(`${chain.chain}: ${chain.nativeBalance} ${chain.nativeSymbol}`);
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
34
|
+
* // Send — automatic routing picks the best source chain
|
|
35
|
+
* const result = await ua.send({
|
|
36
|
+
* accountId: account.accountId,
|
|
37
|
+
* to: '0xRecipient...',
|
|
38
|
+
* amount: '1.0',
|
|
39
|
+
* token: 'ETH',
|
|
40
|
+
* ownerSignature: '0x...',
|
|
41
|
+
* timestamp: Date.now(),
|
|
42
|
+
* });
|
|
43
|
+
* console.log('Tx:', result.txHash);
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* Address information for a single chain within a universal account.
|
|
48
|
+
*/
|
|
49
|
+
export interface ChainAddressInfo {
|
|
50
|
+
/** Chain name (e.g., 'ethereum', 'bitcoin', 'solana') */
|
|
51
|
+
chain: string;
|
|
52
|
+
/** Derived address on this chain */
|
|
53
|
+
address: string;
|
|
54
|
+
/** Curve used for key derivation on this chain */
|
|
55
|
+
curveType: 'secp256k1' | 'ed25519';
|
|
56
|
+
/** Whether this chain address is currently active */
|
|
57
|
+
isActive: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Full information about a universal account, including its
|
|
61
|
+
* threshold parameters, group keys, and all derived chain addresses.
|
|
62
|
+
*/
|
|
63
|
+
export interface UniversalAccountInfo {
|
|
64
|
+
/** Unique account identifier */
|
|
65
|
+
accountId: string;
|
|
66
|
+
/** On-chain owner address (Ethereum address that controls this account) */
|
|
67
|
+
ownerAddress: string;
|
|
68
|
+
/** Hex-encoded secp256k1 group public key */
|
|
69
|
+
secp256k1GroupKey: string;
|
|
70
|
+
/** Hex-encoded ed25519 group public key */
|
|
71
|
+
ed25519GroupKey: string;
|
|
72
|
+
/** Signing threshold (number of agents required to sign) */
|
|
73
|
+
threshold: number;
|
|
74
|
+
/** Total committee size */
|
|
75
|
+
committeeSize: number;
|
|
76
|
+
/** Map of chain name to chain address info */
|
|
77
|
+
chainAddresses: Record<string, ChainAddressInfo>;
|
|
78
|
+
/** Unix timestamp of account creation */
|
|
79
|
+
createdAt: number;
|
|
80
|
+
/** Whether the account is currently active */
|
|
81
|
+
isActive: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Balance information for a single token on a chain.
|
|
85
|
+
*/
|
|
86
|
+
export interface TokenBalance {
|
|
87
|
+
/** Token symbol (e.g., 'USDC', 'WETH') */
|
|
88
|
+
symbol: string;
|
|
89
|
+
/** Token contract address (undefined for native tokens) */
|
|
90
|
+
contractAddress?: string;
|
|
91
|
+
/** Token balance as a decimal string */
|
|
92
|
+
balance: string;
|
|
93
|
+
/** Token decimals */
|
|
94
|
+
decimals: number;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Balance information for a single chain, including native token
|
|
98
|
+
* and any tracked ERC-20 / SPL / equivalent token balances.
|
|
99
|
+
*/
|
|
100
|
+
export interface ChainBalance {
|
|
101
|
+
/** Chain name */
|
|
102
|
+
chain: string;
|
|
103
|
+
/** Account address on this chain */
|
|
104
|
+
address: string;
|
|
105
|
+
/** Native token balance as a decimal string */
|
|
106
|
+
nativeBalance: string;
|
|
107
|
+
/** Native token symbol (e.g., 'ETH', 'SOL', 'BTC') */
|
|
108
|
+
nativeSymbol: string;
|
|
109
|
+
/** Token balances on this chain */
|
|
110
|
+
tokens: TokenBalance[];
|
|
111
|
+
/** Unix timestamp of last balance update */
|
|
112
|
+
lastUpdated: number;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Aggregated balance view across all chains for a universal account.
|
|
116
|
+
*/
|
|
117
|
+
export interface UnifiedBalance {
|
|
118
|
+
/** Account ID this balance belongs to */
|
|
119
|
+
accountId: string;
|
|
120
|
+
/** Per-chain balance breakdown */
|
|
121
|
+
chains: ChainBalance[];
|
|
122
|
+
/** Total number of chains with balances */
|
|
123
|
+
totalChains: number;
|
|
124
|
+
/** Unix timestamp of last aggregation */
|
|
125
|
+
lastAggregated: number;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Options for sending tokens from a universal account.
|
|
129
|
+
* The agent network automatically routes to the optimal source chain
|
|
130
|
+
* based on available balances, fees, and latency.
|
|
131
|
+
*/
|
|
132
|
+
export interface UniversalSendOptions {
|
|
133
|
+
/** Account ID to send from */
|
|
134
|
+
accountId: string;
|
|
135
|
+
/** Destination address or account ID */
|
|
136
|
+
to: string;
|
|
137
|
+
/** Amount to send as a decimal string */
|
|
138
|
+
amount: string;
|
|
139
|
+
/** Token symbol (e.g., 'ETH', 'USDC', 'SOL', 'BTC') */
|
|
140
|
+
token: string;
|
|
141
|
+
/** Optional preferred source chain (overrides automatic routing) */
|
|
142
|
+
preferredChain?: string;
|
|
143
|
+
/** Owner signature authorizing this send */
|
|
144
|
+
ownerSignature: string;
|
|
145
|
+
/** Unix timestamp of the signature */
|
|
146
|
+
timestamp: number;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* The routing decision made by the agent network for a send operation.
|
|
150
|
+
* Describes which chain and address will be used as source and destination.
|
|
151
|
+
*/
|
|
152
|
+
export interface RoutingDecision {
|
|
153
|
+
/** Source chain selected for this send */
|
|
154
|
+
sourceChain: string;
|
|
155
|
+
/** Source address on the selected chain */
|
|
156
|
+
sourceAddress: string;
|
|
157
|
+
/** Destination chain */
|
|
158
|
+
destinationChain: string;
|
|
159
|
+
/** Destination address */
|
|
160
|
+
destinationAddress: string;
|
|
161
|
+
/** Amount being sent */
|
|
162
|
+
amount: string;
|
|
163
|
+
/** Token being sent */
|
|
164
|
+
token: string;
|
|
165
|
+
/** Estimated fee in the source chain's native token */
|
|
166
|
+
estimatedFee: string;
|
|
167
|
+
/** Human-readable reason for this routing choice */
|
|
168
|
+
reason: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Result of a universal send operation.
|
|
172
|
+
*
|
|
173
|
+
* - `pending` — request received, queued for processing
|
|
174
|
+
* - `routing` — agent is selecting the optimal source chain
|
|
175
|
+
* - `signing` — threshold signing in progress
|
|
176
|
+
* - `broadcasting` — signed transaction is being broadcast to the chain
|
|
177
|
+
* - `confirmed` — transaction confirmed on-chain
|
|
178
|
+
* - `failed` — send failed (check routing.reason for details)
|
|
179
|
+
*/
|
|
180
|
+
export type SendStatus = 'pending' | 'routing' | 'signing' | 'broadcasting' | 'confirmed' | 'failed';
|
|
181
|
+
export interface SendResult {
|
|
182
|
+
/** Unique request identifier for polling status */
|
|
183
|
+
requestId: string;
|
|
184
|
+
/** The routing decision (which chain, address, and fee) */
|
|
185
|
+
routing: RoutingDecision;
|
|
186
|
+
/** Current status of the send operation */
|
|
187
|
+
status: SendStatus;
|
|
188
|
+
/** Transaction hash (only when status is 'confirmed') */
|
|
189
|
+
txHash?: string;
|
|
190
|
+
/** Hex-encoded threshold signature (only when status is 'confirmed' or 'broadcasting') */
|
|
191
|
+
signature?: string;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Options for creating a new universal account.
|
|
195
|
+
*/
|
|
196
|
+
export interface CreateUniversalAccountOptions {
|
|
197
|
+
/** Signing threshold (default: 16) */
|
|
198
|
+
threshold?: number;
|
|
199
|
+
/** Total committee size (default: 24) */
|
|
200
|
+
committeeSize?: number;
|
|
201
|
+
/** Owner signature authorizing account creation */
|
|
202
|
+
ownerSignature: string;
|
|
203
|
+
/** Unix timestamp of the signature */
|
|
204
|
+
timestamp: number;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Network-wide statistics for the Universal Account protocol.
|
|
208
|
+
*/
|
|
209
|
+
export interface UniversalAccountStats {
|
|
210
|
+
/** Total number of universal accounts created */
|
|
211
|
+
totalAccounts: number;
|
|
212
|
+
/** Total number of derived chain addresses across all accounts */
|
|
213
|
+
totalAddresses: number;
|
|
214
|
+
/** Number of active (in-progress) send operations */
|
|
215
|
+
activeSends: number;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Client for the KEYSTONE Universal Account protocol.
|
|
219
|
+
*
|
|
220
|
+
* Communicates with universal account endpoints on the agent node
|
|
221
|
+
* to create accounts, query balances across all chains, and send
|
|
222
|
+
* tokens with automatic chain routing.
|
|
223
|
+
*/
|
|
224
|
+
export declare class UniversalAccountClient {
|
|
225
|
+
private baseUrl;
|
|
226
|
+
/**
|
|
227
|
+
* Create a new UniversalAccountClient.
|
|
228
|
+
*
|
|
229
|
+
* @param agentUrl - Agent node REST API URL (e.g., 'http://agent:8080')
|
|
230
|
+
* @param options - Optional client configuration
|
|
231
|
+
* @param options.timeout - Request timeout in milliseconds (default: 30000)
|
|
232
|
+
*/
|
|
233
|
+
constructor(agentUrl: string, options?: {
|
|
234
|
+
timeout?: number;
|
|
235
|
+
});
|
|
236
|
+
/**
|
|
237
|
+
* Create a new universal account.
|
|
238
|
+
*
|
|
239
|
+
* Initiates DKG for both secp256k1 and ed25519 curves, derives
|
|
240
|
+
* addresses on all 81 supported chains, and registers the account
|
|
241
|
+
* on the Sequence0 chain.
|
|
242
|
+
*
|
|
243
|
+
* @param options - Account creation options
|
|
244
|
+
* @returns The created account information with all chain addresses
|
|
245
|
+
*
|
|
246
|
+
* @throws {Sequence0Error} If the creation parameters are invalid
|
|
247
|
+
* @throws {NetworkError} If the agent is unreachable
|
|
248
|
+
*/
|
|
249
|
+
createAccount(options: CreateUniversalAccountOptions): Promise<UniversalAccountInfo>;
|
|
250
|
+
/**
|
|
251
|
+
* Get a universal account by its account ID.
|
|
252
|
+
*
|
|
253
|
+
* @param accountId - The unique account identifier
|
|
254
|
+
* @returns The account information
|
|
255
|
+
*
|
|
256
|
+
* @throws {Sequence0Error} If the account ID is invalid
|
|
257
|
+
* @throws {NetworkError} If the agent is unreachable or account not found
|
|
258
|
+
*/
|
|
259
|
+
getAccount(accountId: string): Promise<UniversalAccountInfo>;
|
|
260
|
+
/**
|
|
261
|
+
* Look up a universal account by any of its chain addresses.
|
|
262
|
+
*
|
|
263
|
+
* Given an address on any chain (Ethereum, Bitcoin, Solana, etc.),
|
|
264
|
+
* returns the universal account that owns it.
|
|
265
|
+
*
|
|
266
|
+
* @param address - An address on any supported chain
|
|
267
|
+
* @returns The account information, or null if no account owns this address
|
|
268
|
+
*
|
|
269
|
+
* @throws {Sequence0Error} If the address is invalid
|
|
270
|
+
* @throws {NetworkError} If the agent is unreachable
|
|
271
|
+
*/
|
|
272
|
+
getAccountByAddress(address: string): Promise<UniversalAccountInfo>;
|
|
273
|
+
/**
|
|
274
|
+
* Get all universal accounts owned by a specific owner address.
|
|
275
|
+
*
|
|
276
|
+
* @param ownerAddress - The Ethereum owner address
|
|
277
|
+
* @returns Array of account information objects
|
|
278
|
+
*
|
|
279
|
+
* @throws {Sequence0Error} If the owner address is invalid
|
|
280
|
+
* @throws {NetworkError} If the agent is unreachable
|
|
281
|
+
*/
|
|
282
|
+
getOwnerAccounts(ownerAddress: string): Promise<UniversalAccountInfo[]>;
|
|
283
|
+
/**
|
|
284
|
+
* Deactivate a universal account.
|
|
285
|
+
*
|
|
286
|
+
* Marks the account as inactive. This does not destroy the keys
|
|
287
|
+
* or chain addresses — it prevents new sends from being initiated.
|
|
288
|
+
* Only the account owner can deactivate.
|
|
289
|
+
*
|
|
290
|
+
* @param accountId - The account ID to deactivate
|
|
291
|
+
* @param ownerSignature - Owner signature authorizing deactivation
|
|
292
|
+
* @param timestamp - Unix timestamp of the signature
|
|
293
|
+
*
|
|
294
|
+
* @throws {Sequence0Error} If parameters are invalid
|
|
295
|
+
* @throws {NetworkError} If the agent is unreachable
|
|
296
|
+
*/
|
|
297
|
+
deactivateAccount(accountId: string, ownerSignature: string, timestamp: number): Promise<void>;
|
|
298
|
+
/**
|
|
299
|
+
* Get all chain addresses for a universal account.
|
|
300
|
+
*
|
|
301
|
+
* @param accountId - The account ID
|
|
302
|
+
* @returns Map of chain name to chain address info
|
|
303
|
+
*
|
|
304
|
+
* @throws {Sequence0Error} If the account ID is invalid
|
|
305
|
+
* @throws {NetworkError} If the agent is unreachable
|
|
306
|
+
*/
|
|
307
|
+
getChainAddresses(accountId: string): Promise<Record<string, ChainAddressInfo>>;
|
|
308
|
+
/**
|
|
309
|
+
* Get the address for a specific chain within a universal account.
|
|
310
|
+
*
|
|
311
|
+
* @param accountId - The account ID
|
|
312
|
+
* @param chain - The chain name (e.g., 'ethereum', 'bitcoin', 'solana')
|
|
313
|
+
* @returns The chain address info
|
|
314
|
+
*
|
|
315
|
+
* @throws {Sequence0Error} If parameters are invalid
|
|
316
|
+
* @throws {NetworkError} If the agent is unreachable
|
|
317
|
+
*/
|
|
318
|
+
getAddressForChain(accountId: string, chain: string): Promise<ChainAddressInfo>;
|
|
319
|
+
/**
|
|
320
|
+
* Get unified balance across all chains for a universal account.
|
|
321
|
+
*
|
|
322
|
+
* Agents query balances on all chains where the account has
|
|
323
|
+
* derived addresses and return an aggregated view.
|
|
324
|
+
*
|
|
325
|
+
* @param accountId - The account ID
|
|
326
|
+
* @returns Unified balance with per-chain breakdown
|
|
327
|
+
*
|
|
328
|
+
* @throws {Sequence0Error} If the account ID is invalid
|
|
329
|
+
* @throws {NetworkError} If the agent is unreachable
|
|
330
|
+
*/
|
|
331
|
+
getUnifiedBalance(accountId: string): Promise<UnifiedBalance>;
|
|
332
|
+
/**
|
|
333
|
+
* Get the balance for a specific chain within a universal account.
|
|
334
|
+
*
|
|
335
|
+
* @param accountId - The account ID
|
|
336
|
+
* @param chain - The chain name (e.g., 'ethereum', 'bitcoin', 'solana')
|
|
337
|
+
* @returns The chain balance
|
|
338
|
+
*
|
|
339
|
+
* @throws {Sequence0Error} If parameters are invalid
|
|
340
|
+
* @throws {NetworkError} If the agent is unreachable
|
|
341
|
+
*/
|
|
342
|
+
getChainBalance(accountId: string, chain: string): Promise<ChainBalance>;
|
|
343
|
+
/**
|
|
344
|
+
* Send tokens from a universal account.
|
|
345
|
+
*
|
|
346
|
+
* The agent network automatically selects the optimal source chain
|
|
347
|
+
* based on available balances, gas fees, and confirmation times.
|
|
348
|
+
* Use `preferredChain` to override automatic routing.
|
|
349
|
+
*
|
|
350
|
+
* @param options - Send options
|
|
351
|
+
* @returns The send result with routing decision and request ID for polling
|
|
352
|
+
*
|
|
353
|
+
* @throws {Sequence0Error} If the send parameters are invalid
|
|
354
|
+
* @throws {NetworkError} If the agent is unreachable
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* ```typescript
|
|
358
|
+
* const result = await ua.send({
|
|
359
|
+
* accountId: 'ua-abc123',
|
|
360
|
+
* to: '0xRecipient...',
|
|
361
|
+
* amount: '1.5',
|
|
362
|
+
* token: 'ETH',
|
|
363
|
+
* ownerSignature: '0x...',
|
|
364
|
+
* timestamp: Date.now(),
|
|
365
|
+
* });
|
|
366
|
+
*
|
|
367
|
+
* // Poll for confirmation
|
|
368
|
+
* const status = await ua.getSendStatus(result.requestId);
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
send(options: UniversalSendOptions): Promise<SendResult>;
|
|
372
|
+
/**
|
|
373
|
+
* Get the current status of a send operation.
|
|
374
|
+
*
|
|
375
|
+
* @param requestId - The send request ID
|
|
376
|
+
* @returns Current status of the send
|
|
377
|
+
*
|
|
378
|
+
* @throws {Sequence0Error} If the request ID is invalid
|
|
379
|
+
* @throws {NetworkError} If the agent is unreachable
|
|
380
|
+
*/
|
|
381
|
+
getSendStatus(requestId: string): Promise<SendResult>;
|
|
382
|
+
/**
|
|
383
|
+
* Wait for a send operation to reach a terminal status by polling.
|
|
384
|
+
*
|
|
385
|
+
* Polls the send status endpoint at 2-second intervals until
|
|
386
|
+
* the send is confirmed, fails, or the timeout is exceeded.
|
|
387
|
+
*
|
|
388
|
+
* @param requestId - The send request ID to wait for
|
|
389
|
+
* @param timeout - Max time to wait in ms (default: 120000)
|
|
390
|
+
* @returns The final send result
|
|
391
|
+
*
|
|
392
|
+
* @throws {TimeoutError} If the send is not completed within the timeout
|
|
393
|
+
* @throws {Sequence0Error} If the send fails
|
|
394
|
+
* @throws {NetworkError} If the agent is unreachable
|
|
395
|
+
*/
|
|
396
|
+
waitForSend(requestId: string, timeout?: number): Promise<SendResult>;
|
|
397
|
+
/**
|
|
398
|
+
* Preview the routing decision for a send without executing it.
|
|
399
|
+
*
|
|
400
|
+
* Use this to show users which chain will be used and the estimated
|
|
401
|
+
* fee before they authorize the send with their signature.
|
|
402
|
+
*
|
|
403
|
+
* @param options - Send options (without ownerSignature and timestamp)
|
|
404
|
+
* @returns The routing decision that would be made
|
|
405
|
+
*
|
|
406
|
+
* @throws {Sequence0Error} If the parameters are invalid
|
|
407
|
+
* @throws {NetworkError} If the agent is unreachable
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```typescript
|
|
411
|
+
* const route = await ua.previewRoute({
|
|
412
|
+
* accountId: 'ua-abc123',
|
|
413
|
+
* to: '0xRecipient...',
|
|
414
|
+
* amount: '1.5',
|
|
415
|
+
* token: 'ETH',
|
|
416
|
+
* });
|
|
417
|
+
* console.log(`Will send from ${route.sourceChain} (fee: ${route.estimatedFee})`);
|
|
418
|
+
* ```
|
|
419
|
+
*/
|
|
420
|
+
previewRoute(options: Omit<UniversalSendOptions, 'ownerSignature' | 'timestamp'>): Promise<RoutingDecision>;
|
|
421
|
+
/**
|
|
422
|
+
* Get network-wide Universal Account statistics.
|
|
423
|
+
*
|
|
424
|
+
* @returns Protocol statistics
|
|
425
|
+
*
|
|
426
|
+
* @throws {NetworkError} If the agent is unreachable
|
|
427
|
+
*/
|
|
428
|
+
getStats(): Promise<UniversalAccountStats>;
|
|
429
|
+
private get;
|
|
430
|
+
private post;
|
|
431
|
+
private mapAccountResponse;
|
|
432
|
+
private mapChainAddressResponse;
|
|
433
|
+
private mapChainBalanceResponse;
|
|
434
|
+
private mapUnifiedBalanceResponse;
|
|
435
|
+
private mapRoutingDecisionResponse;
|
|
436
|
+
private mapSendResultResponse;
|
|
437
|
+
}
|
|
438
|
+
//# sourceMappingURL=universal-account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"universal-account.d.ts","sourceRoot":"","sources":["../../src/core/universal-account.ts"],"names":[],"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