@joai/warps 3.0.0-beta.198

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.
@@ -0,0 +1,1270 @@
1
+ import QRCodeStyling from 'qr-code-styling';
2
+
3
+ declare enum WarpChainName {
4
+ Multiversx = "multiversx",
5
+ Vibechain = "vibechain",
6
+ Sui = "sui",
7
+ Ethereum = "ethereum",
8
+ Base = "base",
9
+ Arbitrum = "arbitrum",
10
+ Polygon = "polygon",
11
+ Somnia = "somnia",
12
+ Fastset = "fastset",
13
+ Solana = "solana",
14
+ Near = "near"
15
+ }
16
+ declare const WarpConstants: {
17
+ HttpProtocolPrefix: string;
18
+ IdentifierParamName: string;
19
+ IdentifierParamSeparator: string;
20
+ IdentifierChainDefault: WarpChainName;
21
+ IdentifierType: {
22
+ Alias: WarpIdentifierType;
23
+ Hash: WarpIdentifierType;
24
+ };
25
+ IdentifierAliasMarker: string;
26
+ Globals: {
27
+ UserWallet: {
28
+ Placeholder: string;
29
+ Accessor: (bag: InterpolationBag) => string | WarpWalletDetails | null | undefined;
30
+ };
31
+ UserWalletPublicKey: {
32
+ Placeholder: string;
33
+ Accessor: (bag: InterpolationBag) => string | null;
34
+ };
35
+ ChainApiUrl: {
36
+ Placeholder: string;
37
+ Accessor: (bag: InterpolationBag) => string;
38
+ };
39
+ ChainAddressHrp: {
40
+ Placeholder: string;
41
+ Accessor: (bag: InterpolationBag) => string;
42
+ };
43
+ };
44
+ Vars: {
45
+ Query: string;
46
+ Env: string;
47
+ };
48
+ ArgParamsSeparator: string;
49
+ ArgCompositeSeparator: string;
50
+ ArgListSeparator: string;
51
+ ArgStructSeparator: string;
52
+ Transform: {
53
+ Prefix: string;
54
+ };
55
+ Source: {
56
+ UserWallet: string;
57
+ };
58
+ Position: {
59
+ Payload: string;
60
+ };
61
+ Alerts: {
62
+ TriggerEventPrefix: string;
63
+ };
64
+ };
65
+ declare const WarpInputTypes: {
66
+ Option: string;
67
+ Vector: string;
68
+ Tuple: string;
69
+ Struct: string;
70
+ String: string;
71
+ Uint8: string;
72
+ Uint16: string;
73
+ Uint32: string;
74
+ Uint64: string;
75
+ Uint128: string;
76
+ Uint256: string;
77
+ Biguint: string;
78
+ Bool: string;
79
+ Address: string;
80
+ Asset: string;
81
+ Hex: string;
82
+ };
83
+ declare const safeWindow: Window;
84
+
85
+ type WarpLocale = 'en' | 'es' | 'fr' | 'de' | 'it' | 'pt' | 'ru' | 'zh' | 'ja' | 'ko' | 'ar' | 'hi' | 'nl' | 'sv' | 'da' | 'no' | 'fi' | 'pl' | 'tr' | 'el' | 'he' | 'th' | 'vi' | 'id' | 'ms' | 'tl' | string;
86
+ type WarpText = string | WarpI18nText;
87
+ type WarpI18nText = {
88
+ [language: string]: string;
89
+ };
90
+
91
+ type WarpAlertName = string;
92
+ type WarpAlert = {
93
+ label: WarpText;
94
+ trigger: string;
95
+ subject: WarpText;
96
+ body: WarpText;
97
+ action?: string;
98
+ };
99
+ type WarpAlerts = Record<WarpAlertName, WarpAlert>;
100
+
101
+ type WarpChainEnv = 'mainnet' | 'testnet' | 'devnet';
102
+ type WarpTheme = 'light' | 'dark';
103
+ type ProtocolName = 'warp' | 'brand' | 'abi';
104
+
105
+ type WarpBrand = {
106
+ protocol: string;
107
+ name: WarpText;
108
+ description: WarpText;
109
+ logo: WarpBrandLogo;
110
+ urls?: WarpBrandUrls;
111
+ colors?: WarpBrandColors;
112
+ cta?: WarpBrandCta;
113
+ meta?: WarpMeta;
114
+ };
115
+ type WarpBrandLogoThemed = Record<WarpTheme, string>;
116
+ type WarpBrandLogo = string | WarpBrandLogoThemed;
117
+ type WarpBrandUrls = {
118
+ web?: string;
119
+ };
120
+ type WarpBrandColors = {
121
+ primary?: string;
122
+ secondary?: string;
123
+ };
124
+ type WarpBrandCta = {
125
+ title: WarpText;
126
+ description: WarpText;
127
+ label: WarpText;
128
+ url: string;
129
+ };
130
+
131
+ type ClientCacheConfig = {
132
+ ttl?: number;
133
+ type?: WarpCacheType;
134
+ path?: string;
135
+ };
136
+ type WarpCacheType = 'memory' | 'localStorage' | 'static' | 'filesystem';
137
+
138
+ type WarpActionExecutionStatus = 'success' | 'error' | 'unhandled';
139
+ type WarpActionExecutionResult = {
140
+ status: WarpActionExecutionStatus;
141
+ warp: Warp;
142
+ action: number;
143
+ user: string | null;
144
+ txHash: string | null;
145
+ tx: WarpAdapterGenericTransaction | null;
146
+ next: WarpExecutionNextInfo | null;
147
+ values: {
148
+ string: string[];
149
+ native: WarpNativeValue[];
150
+ mapped: Record<string, any>;
151
+ };
152
+ output: WarpExecutionOutput;
153
+ messages: WarpExecutionMessages;
154
+ destination: string | null;
155
+ resolvedInputs: string[];
156
+ };
157
+ type WarpExecutionNextInfo = {
158
+ identifier: string | null;
159
+ url: string;
160
+ }[];
161
+ type WarpExecutionOutput = Record<WarpOutputName, any | null>;
162
+ type WarpExecutionMessages = Record<WarpMessageName, string | null>;
163
+
164
+ type WarpTrustStatus = 'unverified' | 'verified' | 'blacklisted';
165
+ type WarpRegistryInfo = {
166
+ hash: string;
167
+ alias: string | null;
168
+ trust: WarpTrustStatus;
169
+ owner: string;
170
+ createdAt: number;
171
+ upgradedAt: number;
172
+ brand: string | null;
173
+ upgrade: string | null;
174
+ };
175
+ type WarpRegistryConfigInfo = {
176
+ unitPrice: bigint;
177
+ admins: string[];
178
+ };
179
+
180
+ type ClientIndexConfig = {
181
+ url?: string;
182
+ apiKey?: string;
183
+ searchParamName?: string;
184
+ };
185
+ type WarpSearchResult = {
186
+ hits: WarpSearchHit[];
187
+ };
188
+ type WarpSearchHit = {
189
+ hash: string;
190
+ alias: string;
191
+ name: string;
192
+ title: string;
193
+ description: string;
194
+ preview: string;
195
+ status: string;
196
+ category: string;
197
+ featured: boolean;
198
+ };
199
+
200
+ interface TransformRunner {
201
+ run(code: string, context: any): Promise<any>;
202
+ }
203
+ type ClientTransformConfig = {
204
+ runner?: TransformRunner | null;
205
+ };
206
+
207
+ interface WalletProvider {
208
+ getAddress(): Promise<string | null>;
209
+ getPublicKey(): Promise<string | null>;
210
+ signTransaction(tx: any): Promise<any>;
211
+ signMessage(message: string): Promise<string>;
212
+ importFromMnemonic(mnemonic: string): Promise<WarpWalletDetails>;
213
+ importFromPrivateKey(privateKey: string): Promise<WarpWalletDetails>;
214
+ export(): Promise<WarpWalletDetails>;
215
+ generate(): Promise<WarpWalletDetails>;
216
+ }
217
+ type WalletProviderFactory = (config: WarpClientConfig, chain: WarpChainInfo) => WalletProvider | null;
218
+
219
+ type WarpWalletProvider = 'mnemonic' | 'privateKey' | 'coinbase' | 'privy' | 'gaupa';
220
+ type WarpWalletDetails = {
221
+ provider: WarpWalletProvider;
222
+ address: string;
223
+ mnemonic?: string | null;
224
+ privateKey?: string | null;
225
+ externalId?: string | null;
226
+ };
227
+ type WarpUserWallets = Partial<Record<WarpChainName, WarpWalletDetails | string | null>>;
228
+ type WarpProviderPreferences = Partial<Record<WarpChainEnv, string | WarpProviderConfig>>;
229
+ type WarpProviderConfig = {
230
+ url: string;
231
+ headers?: Record<string, string>;
232
+ };
233
+ type WarpClientConfig = {
234
+ env: WarpChainEnv;
235
+ clientUrl?: string;
236
+ currentUrl?: string;
237
+ vars?: Record<string, string | number>;
238
+ user?: {
239
+ id?: string;
240
+ wallets?: WarpUserWallets;
241
+ };
242
+ preferences?: {
243
+ locale?: WarpLocale;
244
+ theme?: WarpTheme;
245
+ explorers?: Partial<Record<WarpChainName, WarpExplorerName>>;
246
+ providers?: Partial<Record<WarpChainName, WarpProviderPreferences>>;
247
+ };
248
+ walletProviders?: Partial<Record<WarpChainName, Partial<Record<WarpWalletProvider, WalletProviderFactory>>>>;
249
+ fallback?: WarpChainName;
250
+ schema?: {
251
+ warp?: string;
252
+ brand?: string;
253
+ };
254
+ cache?: ClientCacheConfig;
255
+ transform?: ClientTransformConfig;
256
+ index?: ClientIndexConfig;
257
+ interceptors?: {
258
+ openLink?: (url: string) => Promise<void>;
259
+ };
260
+ };
261
+ type WarpCacheConfig = {
262
+ ttl?: number;
263
+ };
264
+ type ChainAdapterFactory = (config: WarpClientConfig, fallback?: ChainAdapter | undefined) => ChainAdapter;
265
+ type ChainAdapter = {
266
+ chainInfo: WarpChainInfo;
267
+ builder: () => CombinedWarpBuilder;
268
+ executor: AdapterWarpExecutor;
269
+ output: AdapterWarpOutput;
270
+ serializer: AdapterWarpSerializer;
271
+ registry: AdapterWarpRegistry;
272
+ explorer: AdapterWarpExplorer;
273
+ abiBuilder: () => AdapterWarpAbiBuilder;
274
+ brandBuilder: () => AdapterWarpBrandBuilder;
275
+ dataLoader: AdapterWarpDataLoader;
276
+ wallet: AdapterWarpWallet;
277
+ };
278
+ type WarpAdapterGenericTransaction = any;
279
+ type WarpAdapterGenericRemoteTransaction = any;
280
+ type WarpAdapterGenericValue = any;
281
+ type WarpAdapterGenericType = any;
282
+ interface WarpTypeHandler {
283
+ stringToNative(value: string): any;
284
+ nativeToString(value: any): string;
285
+ }
286
+ interface AdapterTypeRegistry {
287
+ registerType(typeName: string, handler: WarpTypeHandler): void;
288
+ registerTypeAlias(typeName: string, alias: string): void;
289
+ hasType(typeName: string): boolean;
290
+ getHandler(typeName: string): WarpTypeHandler | undefined;
291
+ getAlias(typeName: string): string | undefined;
292
+ resolveType(typeName: string): string;
293
+ getRegisteredTypes(): string[];
294
+ }
295
+ interface BaseWarpBuilder {
296
+ createFromRaw(encoded: string, validate?: boolean): Promise<Warp>;
297
+ createFromUrl(url: string): Promise<Warp>;
298
+ setName(name: string): BaseWarpBuilder;
299
+ setTitle(title: string): BaseWarpBuilder;
300
+ setDescription(description: string | null): BaseWarpBuilder;
301
+ setPreview(preview: string): BaseWarpBuilder;
302
+ setActions(actions: WarpAction[]): BaseWarpBuilder;
303
+ addAction(action: WarpAction): BaseWarpBuilder;
304
+ setOutput(output: Record<string, string> | null): BaseWarpBuilder;
305
+ build(validate?: boolean): Promise<Warp>;
306
+ }
307
+ interface AdapterWarpBuilder {
308
+ createInscriptionTransaction(warp: Warp): Promise<WarpAdapterGenericTransaction>;
309
+ createFromTransaction(tx: WarpAdapterGenericTransaction, validate?: boolean): Promise<Warp>;
310
+ createFromTransactionHash(hash: string, cache?: WarpCacheConfig): Promise<Warp | null>;
311
+ }
312
+ type CombinedWarpBuilder = AdapterWarpBuilder & BaseWarpBuilder;
313
+ interface AdapterWarpAbiBuilder {
314
+ createInscriptionTransaction(abi: WarpAbiContents): Promise<WarpAdapterGenericTransaction>;
315
+ createFromRaw(encoded: string): Promise<any>;
316
+ createFromTransaction(tx: WarpAdapterGenericTransaction): Promise<any>;
317
+ createFromTransactionHash(hash: string, cache?: WarpCacheConfig): Promise<any | null>;
318
+ }
319
+ interface AdapterWarpBrandBuilder {
320
+ createInscriptionTransaction(brand: WarpBrand): WarpAdapterGenericTransaction;
321
+ createFromTransaction(tx: WarpAdapterGenericTransaction, validate?: boolean): Promise<WarpBrand>;
322
+ createFromTransactionHash(hash: string, cache?: WarpCacheConfig): Promise<WarpBrand | null>;
323
+ }
324
+ interface AdapterWarpExecutor {
325
+ createTransaction(executable: WarpExecutable): Promise<WarpAdapterGenericTransaction>;
326
+ executeQuery(executable: WarpExecutable): Promise<WarpActionExecutionResult>;
327
+ }
328
+ interface AdapterWarpOutput {
329
+ getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<WarpActionExecutionResult>;
330
+ }
331
+ interface AdapterWarpSerializer {
332
+ typedToString(value: WarpAdapterGenericValue): string;
333
+ typedToNative(value: WarpAdapterGenericValue): [WarpActionInputType, WarpNativeValue];
334
+ nativeToTyped(type: WarpActionInputType, value: WarpNativeValue): WarpAdapterGenericValue;
335
+ nativeToType(type: BaseWarpActionInputType): WarpAdapterGenericType;
336
+ stringToTyped(value: string): WarpAdapterGenericValue;
337
+ }
338
+ interface AdapterWarpRegistry {
339
+ init(): Promise<void>;
340
+ getRegistryConfig(): WarpRegistryConfigInfo;
341
+ createWarpRegisterTransaction(txHash: string, alias?: string | null, brand?: string | null): Promise<WarpAdapterGenericTransaction>;
342
+ createWarpUnregisterTransaction(txHash: string): Promise<WarpAdapterGenericTransaction>;
343
+ createWarpUpgradeTransaction(alias: string, txHash: string, brand?: string | null): Promise<WarpAdapterGenericTransaction>;
344
+ createWarpAliasSetTransaction(txHash: string, alias: string): Promise<WarpAdapterGenericTransaction>;
345
+ createWarpVerifyTransaction(txHash: string): Promise<WarpAdapterGenericTransaction>;
346
+ createWarpTransferOwnershipTransaction(txHash: string, newOwner: string): Promise<WarpAdapterGenericTransaction>;
347
+ createBrandRegisterTransaction(txHash: string): Promise<WarpAdapterGenericTransaction>;
348
+ createWarpBrandingTransaction(warpHash: string, brandHash: string): Promise<WarpAdapterGenericTransaction>;
349
+ getInfoByAlias(alias: string, cache?: WarpCacheConfig): Promise<{
350
+ registryInfo: WarpRegistryInfo | null;
351
+ brand: WarpBrand | null;
352
+ }>;
353
+ getInfoByHash(hash: string, cache?: WarpCacheConfig): Promise<{
354
+ registryInfo: WarpRegistryInfo | null;
355
+ brand: WarpBrand | null;
356
+ }>;
357
+ getUserWarpRegistryInfos(user?: string): Promise<WarpRegistryInfo[]>;
358
+ getUserBrands(user?: string): Promise<WarpBrand[]>;
359
+ fetchBrand(hash: string, cache?: WarpCacheConfig): Promise<WarpBrand | null>;
360
+ }
361
+ interface AdapterWarpExplorer {
362
+ getAccountUrl(address: string): string;
363
+ getTransactionUrl(hash: string): string;
364
+ getAssetUrl(identifier: string): string;
365
+ getContractUrl(address: string): string;
366
+ }
367
+ interface WarpDataLoaderOptions {
368
+ page?: number;
369
+ size?: number;
370
+ }
371
+ interface AdapterWarpDataLoader {
372
+ getAccount(address: string): Promise<WarpChainAccount>;
373
+ getAccountAssets(address: string): Promise<WarpChainAsset[]>;
374
+ getAsset(identifier: string): Promise<WarpChainAsset | null>;
375
+ getAction(identifier: string, awaitCompleted?: boolean): Promise<WarpChainAction | null>;
376
+ getAccountActions(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAction[]>;
377
+ }
378
+ interface AdapterWarpWallet {
379
+ signTransaction(tx: WarpAdapterGenericTransaction): Promise<WarpAdapterGenericTransaction>;
380
+ signTransactions(txs: WarpAdapterGenericTransaction[]): Promise<WarpAdapterGenericTransaction[]>;
381
+ signMessage(message: string): Promise<string>;
382
+ sendTransactions(txs: WarpAdapterGenericTransaction[]): Promise<string[]>;
383
+ sendTransaction(tx: WarpAdapterGenericTransaction): Promise<string>;
384
+ importFromMnemonic(mnemonic: string): Promise<WarpWalletDetails>;
385
+ importFromPrivateKey(privateKey: string): Promise<WarpWalletDetails>;
386
+ export(provider: WarpWalletProvider): Promise<WarpWalletDetails>;
387
+ generate(provider: WarpWalletProvider): Promise<WarpWalletDetails>;
388
+ getAddress(): string | null;
389
+ getPublicKey(): string | null;
390
+ registerX402Handlers?(client: unknown): Promise<Record<string, () => void>>;
391
+ }
392
+
393
+ type WarpChainAccount = {
394
+ chain: WarpChainName;
395
+ address: string;
396
+ balance: bigint;
397
+ };
398
+ type WarpChainAssetValue = {
399
+ identifier: string;
400
+ amount: bigint;
401
+ };
402
+ type WarpChainAssetLogoThemed = Record<WarpTheme, string>;
403
+ type WarpChainAssetLogo = string | WarpChainAssetLogoThemed | null;
404
+ type WarpChainAsset = {
405
+ chain: WarpChainName;
406
+ identifier: string;
407
+ name: string;
408
+ symbol: string;
409
+ amount?: bigint;
410
+ decimals?: number;
411
+ logoUrl?: WarpChainAssetLogo;
412
+ price?: number;
413
+ supply?: bigint;
414
+ };
415
+ type WarpChainAction = {
416
+ chain: WarpChainName;
417
+ id: string;
418
+ sender: string;
419
+ receiver: string;
420
+ value: bigint;
421
+ function: string;
422
+ status: WarpChainActionStatus;
423
+ createdAt: string;
424
+ error?: string | null;
425
+ tx?: WarpAdapterGenericRemoteTransaction | null;
426
+ };
427
+ type WarpChainActionStatus = 'pending' | 'success' | 'failed';
428
+
429
+ type WarpExplorerName = string;
430
+ type WarpChainInfoLogoThemed = Record<WarpTheme, string>;
431
+ type WarpChainInfoLogo = string | WarpChainInfoLogoThemed;
432
+ type WarpChainInfo = {
433
+ name: WarpChainName;
434
+ displayName: string;
435
+ chainId: string;
436
+ blockTime: number;
437
+ addressHrp: string;
438
+ defaultApiUrl: string;
439
+ logoUrl: WarpChainInfoLogo;
440
+ nativeToken: WarpChainAsset;
441
+ };
442
+ type WarpIdentifierType = 'hash' | 'alias';
443
+ type WarpVarPlaceholder = string;
444
+ type WarpOutputName = string;
445
+ type WarpResulutionPath = string;
446
+ type WarpMessageName = string;
447
+ type Warp = {
448
+ protocol: string;
449
+ chain?: WarpChainName;
450
+ name: string;
451
+ title: WarpText;
452
+ description: WarpText | null;
453
+ bot?: string;
454
+ preview?: string;
455
+ vars?: Record<WarpVarPlaceholder, string>;
456
+ actions: WarpAction[];
457
+ next?: string;
458
+ output?: Record<WarpOutputName, WarpResulutionPath>;
459
+ messages?: Record<WarpMessageName, WarpText>;
460
+ ui?: string;
461
+ alerts?: WarpAlerts;
462
+ related?: string[];
463
+ meta?: WarpMeta;
464
+ };
465
+ type WarpMeta = {
466
+ chain: WarpChainName;
467
+ identifier: string;
468
+ query: string | null;
469
+ hash: string;
470
+ creator: string;
471
+ createdAt: string;
472
+ };
473
+ type WarpAction = WarpTransferAction | WarpContractAction | WarpQueryAction | WarpCollectAction | WarpLinkAction | WarpMcpAction | WarpPromptAction;
474
+ type WarpActionIndex = number;
475
+ type WarpActionType = 'transfer' | 'contract' | 'query' | 'collect' | 'link' | 'mcp' | 'prompt';
476
+ type WarpTransferAction = {
477
+ type: WarpActionType;
478
+ label: WarpText;
479
+ description?: WarpText | null;
480
+ address?: string;
481
+ data?: string;
482
+ value?: string;
483
+ transfers?: string[];
484
+ inputs?: WarpActionInput[];
485
+ primary?: boolean;
486
+ auto?: boolean;
487
+ next?: string;
488
+ when?: string;
489
+ };
490
+ type WarpContractAction = {
491
+ type: WarpActionType;
492
+ label: WarpText;
493
+ description?: WarpText | null;
494
+ address?: string;
495
+ func?: string | null;
496
+ args?: string[];
497
+ value?: string;
498
+ gasLimit: number;
499
+ transfers?: string[];
500
+ abi?: string;
501
+ inputs?: WarpActionInput[];
502
+ primary?: boolean;
503
+ auto?: boolean;
504
+ next?: string;
505
+ when?: string;
506
+ };
507
+ type WarpQueryAction = {
508
+ type: WarpActionType;
509
+ label: WarpText;
510
+ description?: WarpText | null;
511
+ address?: string;
512
+ func?: string;
513
+ args?: string[];
514
+ abi?: string;
515
+ inputs?: WarpActionInput[];
516
+ primary?: boolean;
517
+ auto?: boolean;
518
+ next?: string;
519
+ when?: string;
520
+ };
521
+ type WarpCollectAction = {
522
+ type: WarpActionType;
523
+ label: WarpText;
524
+ description?: WarpText | null;
525
+ destination?: WarpCollectDestination;
526
+ inputs?: WarpActionInput[];
527
+ primary?: boolean;
528
+ auto?: boolean;
529
+ next?: string;
530
+ when?: string;
531
+ };
532
+ type WarpCollectDestination = WarpCollectDestinationHttp | string;
533
+ type WarpCollectDestinationHttp = {
534
+ url: string;
535
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
536
+ headers?: Record<string, string>;
537
+ };
538
+ type WarpLinkAction = {
539
+ type: WarpActionType;
540
+ label: WarpText;
541
+ description?: WarpText | null;
542
+ url: string;
543
+ inputs?: WarpActionInput[];
544
+ primary?: boolean;
545
+ auto?: boolean;
546
+ when?: string;
547
+ };
548
+ type WarpMcpAction = {
549
+ type: WarpActionType;
550
+ label: WarpText;
551
+ description?: WarpText | null;
552
+ destination?: WarpMcpDestination;
553
+ inputs?: WarpActionInput[];
554
+ primary?: boolean;
555
+ auto?: boolean;
556
+ next?: string;
557
+ when?: string;
558
+ };
559
+ type WarpMcpDestination = {
560
+ url: string;
561
+ tool: string;
562
+ headers?: Record<string, string>;
563
+ };
564
+ type WarpPromptAction = {
565
+ type: WarpActionType;
566
+ label: WarpText;
567
+ description?: WarpText | null;
568
+ prompt: string;
569
+ inputs?: WarpActionInput[];
570
+ primary?: boolean;
571
+ auto?: boolean;
572
+ next?: string;
573
+ when?: string;
574
+ };
575
+ type WarpActionInputSource = 'field' | 'query' | 'user:wallet' | 'hidden';
576
+ type BaseWarpActionInputType = 'string' | 'uint8' | 'uint16' | 'uint32' | 'uint64' | 'uint128' | 'uint256' | 'biguint' | 'bool' | 'address' | 'hex' | string;
577
+ type WarpActionInputType = string;
578
+ interface WarpStructValue {
579
+ [key: string]: WarpNativeValue;
580
+ }
581
+ type WarpNativeValue = string | number | bigint | boolean | WarpChainAssetValue | null | WarpNativeValue[] | WarpStructValue;
582
+ type WarpActionInputPosition = 'receiver' | 'value' | 'transfer' | `arg:${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10}` | 'data' | 'chain' | `payload:${string}` | 'destination' | WarpActionInputPositionAssetObject;
583
+ type WarpActionInputPositionAssetObject = {
584
+ token: `arg:${string}`;
585
+ amount: `arg:${string}`;
586
+ };
587
+ type WarpActionInputModifier = 'scale' | 'transform';
588
+ type WarpActionInput = {
589
+ name: string;
590
+ as?: string;
591
+ label?: WarpText;
592
+ description?: WarpText | null;
593
+ bot?: string;
594
+ type: WarpActionInputType;
595
+ position?: WarpActionInputPosition;
596
+ source: WarpActionInputSource;
597
+ required?: boolean;
598
+ min?: number | WarpVarPlaceholder;
599
+ max?: number | WarpVarPlaceholder;
600
+ pattern?: string;
601
+ patternDescription?: WarpText;
602
+ options?: string[] | {
603
+ [key: string]: WarpText;
604
+ };
605
+ modifier?: string;
606
+ default?: string | number | boolean;
607
+ };
608
+ type ResolvedInput = {
609
+ input: WarpActionInput;
610
+ value: string | null;
611
+ };
612
+ type WarpContract = {
613
+ address: string;
614
+ owner: string;
615
+ verified: boolean;
616
+ };
617
+ type WarpContractVerification = {
618
+ codeHash: string;
619
+ abi: object;
620
+ };
621
+ type WarpExecutable = {
622
+ adapter: ChainAdapter;
623
+ chain: WarpChainInfo;
624
+ warp: Warp;
625
+ action: number;
626
+ destination: string | null;
627
+ args: string[];
628
+ value: bigint;
629
+ transfers: WarpChainAssetValue[];
630
+ data: string | null;
631
+ resolvedInputs: ResolvedInput[];
632
+ };
633
+
634
+ type WarpAbi = {
635
+ protocol: string;
636
+ content: WarpAbiContents;
637
+ meta?: WarpMeta;
638
+ };
639
+ type WarpAbiContents = {
640
+ name?: string;
641
+ constructor?: any;
642
+ upgradeConstructor?: any;
643
+ endpoints?: any[];
644
+ types?: Record<string, any>;
645
+ events?: any[];
646
+ };
647
+
648
+ type WarpSecret = {
649
+ key: string;
650
+ description?: string | null;
651
+ };
652
+
653
+ type InterpolationBag = {
654
+ config: WarpClientConfig;
655
+ adapter: ChainAdapter;
656
+ };
657
+
658
+ declare const WarpProtocolVersions: {
659
+ Warp: string;
660
+ Brand: string;
661
+ Abi: string;
662
+ };
663
+ declare const WarpConfig: {
664
+ LatestWarpSchemaUrl: string;
665
+ LatestBrandSchemaUrl: string;
666
+ DefaultClientUrl: (env: WarpChainEnv) => "https://usewarp.to" | "https://testnet.usewarp.to" | "https://devnet.usewarp.to";
667
+ SuperClientUrls: string[];
668
+ AvailableActionInputSources: WarpActionInputSource[];
669
+ AvailableActionInputTypes: WarpActionInputType[];
670
+ AvailableActionInputPositions: WarpActionInputPosition[];
671
+ };
672
+
673
+ declare const withAdapterFallback: (factory: ChainAdapterFactory, fallbackFactory: ChainAdapterFactory) => ChainAdapterFactory;
674
+
675
+ declare const getEventNameFromWarp: (warp: Warp, alertName: string) => string | null;
676
+
677
+ declare const getWarpBrandLogoUrl: (brand: WarpBrand, config?: WarpClientConfig) => string;
678
+ declare const getWarpChainAssetLogoUrl: (asset: WarpChainAsset, config?: WarpClientConfig) => string | null;
679
+ declare const getWarpChainInfoLogoUrl: (chainInfo: WarpChainInfo, config?: WarpClientConfig) => string;
680
+
681
+ interface CryptoProvider {
682
+ getRandomBytes(size: number): Promise<Uint8Array>;
683
+ }
684
+ declare class BrowserCryptoProvider implements CryptoProvider {
685
+ getRandomBytes(size: number): Promise<Uint8Array>;
686
+ }
687
+ declare class NodeCryptoProvider implements CryptoProvider {
688
+ getRandomBytes(size: number): Promise<Uint8Array>;
689
+ }
690
+ declare function getCryptoProvider(): CryptoProvider;
691
+ declare function setCryptoProvider(provider: CryptoProvider): void;
692
+ declare function getRandomBytes(size: number, cryptoProvider?: CryptoProvider): Promise<Uint8Array>;
693
+ declare function bytesToHex(bytes: Uint8Array): string;
694
+ declare function bytesToBase64(bytes: Uint8Array): string;
695
+ declare function getRandomHex(length: number, cryptoProvider?: CryptoProvider): Promise<string>;
696
+ declare function testCryptoAvailability(): Promise<{
697
+ randomBytes: boolean;
698
+ environment: 'browser' | 'nodejs' | 'unknown';
699
+ }>;
700
+ declare function createCryptoProvider(): CryptoProvider;
701
+
702
+ declare const extractWarpSecrets: (warp: Warp) => WarpSecret[];
703
+
704
+ declare const findWarpAdapterForChain: (chain: WarpChainName, adapters: ChainAdapter[]) => ChainAdapter;
705
+ declare const getLatestProtocolIdentifier: (name: ProtocolName) => string;
706
+ declare const getWarpActionByIndex: (warp: Warp, index: number) => WarpAction;
707
+ declare const getWarpPrimaryAction: (warp: Warp) => {
708
+ action: WarpAction;
709
+ index: number;
710
+ };
711
+ declare const isWarpActionAutoExecute: (action: WarpAction, warp: Warp) => boolean;
712
+ declare const shiftBigintBy: (value: bigint | string | number, decimals: number) => bigint;
713
+ declare const toPreviewText: (text: string, maxChars?: number) => string;
714
+ declare const replacePlaceholders: (message: string, bag: Record<string, any>) => string;
715
+ declare const replacePlaceholdersInWhenExpression: (expression: string, bag: Record<string, any>) => string;
716
+ declare const evaluateWhenCondition: (expression: string) => boolean;
717
+
718
+ declare const WARP_LANGUAGES: {
719
+ readonly de: "German";
720
+ readonly en: "English";
721
+ readonly es: "Spanish";
722
+ readonly fr: "French";
723
+ readonly it: "Italian";
724
+ readonly pt: "Portuguese";
725
+ readonly ru: "Russian";
726
+ readonly zh: "Chinese";
727
+ readonly ja: "Japanese";
728
+ readonly ko: "Korean";
729
+ readonly ar: "Arabic";
730
+ readonly hi: "Hindi";
731
+ readonly nl: "Dutch";
732
+ readonly sv: "Swedish";
733
+ readonly da: "Danish";
734
+ readonly no: "Norwegian";
735
+ readonly fi: "Finnish";
736
+ readonly pl: "Polish";
737
+ readonly tr: "Turkish";
738
+ readonly el: "Greek";
739
+ readonly he: "Hebrew";
740
+ readonly th: "Thai";
741
+ readonly vi: "Vietnamese";
742
+ readonly id: "Indonesian";
743
+ readonly ms: "Malay";
744
+ readonly tl: "Tagalog";
745
+ };
746
+ declare const resolveWarpText: (text: WarpText, config?: WarpClientConfig) => string;
747
+ declare const isWarpI18nText: (text: WarpText) => text is WarpI18nText;
748
+ declare const createWarpI18nText: (translations: Record<string, string>) => WarpI18nText;
749
+
750
+ declare const cleanWarpIdentifier: (identifier: string) => string;
751
+ declare const isEqualWarpIdentifier: (identifier1: string | null | undefined, identifier2: string | null | undefined) => boolean;
752
+ declare const createWarpIdentifier: (chain: WarpChainName, type: WarpIdentifierType, identifier: string) => string;
753
+ declare const getWarpInfoFromIdentifier: (prefixedIdentifier: string) => {
754
+ chain: WarpChainName;
755
+ type: WarpIdentifierType;
756
+ identifier: string;
757
+ identifierBase: string;
758
+ } | null;
759
+ declare const extractIdentifierInfoFromUrl: (url: string) => {
760
+ chain: WarpChainName;
761
+ type: WarpIdentifierType;
762
+ identifier: string;
763
+ identifierBase: string;
764
+ } | null;
765
+ declare const extractQueryStringFromUrl: (url: string) => string | null;
766
+ declare const extractQueryStringFromIdentifier: (identifier: string) => string | null;
767
+
768
+ /**
769
+ * Splits an input string into type and value, using only the first colon as separator.
770
+ * This handles cases where the value itself contains colons (like SUI token IDs).
771
+ */
772
+ declare const splitInput: (input: string) => [WarpActionInputType, string];
773
+ declare const hasInputPrefix: (input: string) => boolean;
774
+
775
+ declare const applyOutputToMessages: (warp: Warp, output: Record<string, any>, config: WarpClientConfig) => Record<string, string>;
776
+
777
+ declare const getNextInfo: (config: WarpClientConfig, adapters: ChainAdapter[], warp: Warp, actionIndex: number, output: WarpExecutionOutput) => WarpExecutionNextInfo | null;
778
+
779
+ declare class WarpSerializer {
780
+ private readonly typeRegistry?;
781
+ constructor(options?: {
782
+ typeRegistry?: AdapterTypeRegistry;
783
+ });
784
+ nativeToString(type: WarpActionInputType, value: WarpNativeValue): string;
785
+ stringToNative(value: string): [WarpActionInputType, WarpNativeValue];
786
+ private getTypeAndValue;
787
+ }
788
+
789
+ declare const extractCollectOutput: (warp: Warp, response: any, actionIndex: number, inputs: ResolvedInput[], serializer: WarpSerializer, config: WarpClientConfig) => Promise<{
790
+ values: {
791
+ string: string[];
792
+ native: any[];
793
+ mapped: Record<string, any>;
794
+ };
795
+ output: WarpExecutionOutput;
796
+ }>;
797
+ declare const evaluateOutputCommon: (warp: Warp, baseOutput: WarpExecutionOutput, actionIndex: number, inputs: ResolvedInput[], serializer: WarpSerializer, config: WarpClientConfig) => Promise<WarpExecutionOutput>;
798
+ declare const extractPromptOutput: (warp: Warp, promptValue: string, actionIndex: number, inputs: ResolvedInput[], serializer: WarpSerializer, config: WarpClientConfig) => Promise<{
799
+ values: {
800
+ string: string[];
801
+ native: any[];
802
+ mapped: Record<string, any>;
803
+ };
804
+ output: WarpExecutionOutput;
805
+ }>;
806
+ declare const parseOutputOutIndex: (outputPath: string) => number | null;
807
+
808
+ /**
809
+ * Builds a nested payload object from a position string and field value.
810
+ * Position strings should be in format: "payload:path.to.nested.location"
811
+ *
812
+ * @param position - The position string defining where to place the value
813
+ * @param fieldName - The field name to use for the value
814
+ * @param value - The value to place at the position
815
+ * @returns A nested object structure or flat object if position doesn't start with 'payload:'
816
+ */
817
+ declare function buildNestedPayload(position: string, fieldName: string, value: any): any;
818
+ /**
819
+ * Recursively merges a source object into a target object and returns the merged result.
820
+ * Existing nested objects are merged recursively, primitive values are overwritten.
821
+ * Does not mutate the original target or source objects.
822
+ *
823
+ * @param target - The target object to merge into
824
+ * @param source - The source object to merge from
825
+ * @returns A new object with the merged result
826
+ */
827
+ declare function mergeNestedPayload(target: any, source: any): any;
828
+ /**
829
+ * Converts a resolved input to a payload value, handling special types like biguint and asset.
830
+ *
831
+ * @param resolvedInput - The resolved input to convert
832
+ * @param serializer - The serializer to use for conversion
833
+ * @returns The converted value, or null if the input has no value
834
+ */
835
+ declare function toInputPayloadValue(resolvedInput: ResolvedInput, serializer: WarpSerializer): any;
836
+ /**
837
+ * Extracts non-empty string values from resolved inputs.
838
+ *
839
+ * @param inputs - The resolved inputs to extract values from
840
+ * @returns An array of non-empty string values
841
+ */
842
+ declare function extractResolvedInputValues(inputs: ResolvedInput[]): string[];
843
+ /**
844
+ * Builds a mapped output object from resolved inputs, using input name or "as" property as key.
845
+ * This is the same structure as the payload, but used for output mapping.
846
+ *
847
+ * @param inputs - The resolved inputs to build the mapped output from
848
+ * @param serializer - The serializer to use for value conversion
849
+ * @returns A mapped object with input names/aliases as keys and converted values
850
+ */
851
+ declare function buildMappedOutput(inputs: ResolvedInput[], serializer: WarpSerializer): Record<string, any>;
852
+
853
+ declare const getProviderConfig: (config: WarpClientConfig, chain: WarpChainName, env: WarpChainEnv, defaultProvider: string) => WarpProviderConfig;
854
+
855
+ /**
856
+ * Signing utilities for creating and validating signed messages
857
+ * Works with any crypto provider or uses automatic detection
858
+ */
859
+
860
+ interface SignableMessage {
861
+ wallet: string;
862
+ nonce: string;
863
+ expiresAt: string;
864
+ purpose: string;
865
+ }
866
+ type HttpAuthHeaders = Record<string, string> & {
867
+ 'X-Signer-Wallet': string;
868
+ 'X-Signer-Signature': string;
869
+ 'X-Signer-Nonce': string;
870
+ 'X-Signer-ExpiresAt': string;
871
+ };
872
+ /**
873
+ * Creates a signable message with standard security fields
874
+ * This can be used for any type of proof or authentication
875
+ */
876
+ declare function createSignableMessage(walletAddress: string, purpose: string, cryptoProvider?: CryptoProvider, expiresInMinutes?: number): Promise<{
877
+ message: string;
878
+ nonce: string;
879
+ expiresAt: string;
880
+ }>;
881
+ /**
882
+ * Creates a signable message for HTTP authentication
883
+ * This is a convenience function that uses the standard format
884
+ */
885
+ declare function createAuthMessage(walletAddress: string, appName: string, cryptoProvider?: CryptoProvider, purpose?: string): Promise<{
886
+ message: string;
887
+ nonce: string;
888
+ expiresAt: string;
889
+ }>;
890
+ /**
891
+ * Creates HTTP authentication headers from a signature
892
+ */
893
+ declare function createAuthHeaders(walletAddress: string, signature: string, nonce: string, expiresAt: string): HttpAuthHeaders;
894
+ /**
895
+ * Creates HTTP authentication headers for a wallet using the provided signing function
896
+ */
897
+ declare function createHttpAuthHeaders(walletAddress: string, signMessage: (message: string) => Promise<string>, appName: string, cryptoProvider?: CryptoProvider): Promise<HttpAuthHeaders>;
898
+ /**
899
+ * Validates a signed message by checking expiration
900
+ */
901
+ declare function validateSignedMessage(expiresAt: string): boolean;
902
+ /**
903
+ * Parses a signed message to extract its components
904
+ */
905
+ declare function parseSignedMessage(message: string): SignableMessage;
906
+
907
+ declare const getWalletFromConfigOrFail: (config: WarpClientConfig, chain: WarpChainName) => string | WarpWalletDetails;
908
+ declare const getWarpWalletAddress: (wallet: WarpWalletDetails | string | null | undefined) => string | null;
909
+ declare const getWarpWalletAddressFromConfig: (config: WarpClientConfig, chain: WarpChainName) => string | null;
910
+ declare const getWarpWalletPrivateKey: (wallet: WarpWalletDetails | string | null | undefined) => string | null;
911
+ declare const getWarpWalletMnemonic: (wallet: WarpWalletDetails | string | null | undefined) => string | null;
912
+ declare const getWarpWalletExternalId: (wallet: WarpWalletDetails | string | null | undefined) => string | null;
913
+ declare const getWarpWalletPrivateKeyFromConfig: (config: WarpClientConfig, chain: WarpChainName) => string | null;
914
+ declare const getWarpWalletMnemonicFromConfig: (config: WarpClientConfig, chain: WarpChainName) => string | null;
915
+ declare const getWarpWalletExternalIdFromConfig: (config: WarpClientConfig, chain: WarpChainName) => string | null;
916
+ declare const getWarpWalletExternalIdFromConfigOrFail: (config: WarpClientConfig, chain: WarpChainName) => string;
917
+ declare const isWarpWalletReadOnly: (wallet: WarpWalletDetails | string | null | undefined) => boolean;
918
+ declare const setWarpWalletInConfig: (config: WarpClientConfig, chain: WarpChainName, wallet: WarpWalletDetails) => void;
919
+ declare const normalizeMnemonic: (mnemonic: string | undefined | null) => string;
920
+ declare const validateMnemonicLength: (mnemonic: string, expectedWords?: number) => void;
921
+ declare const normalizeAndValidateMnemonic: (mnemonic: string, expectedWords?: number) => string;
922
+
923
+ interface WalletCache {
924
+ address: string | null;
925
+ publicKey: string | null;
926
+ }
927
+ declare function initializeWalletCache(provider: WalletProvider | null): Promise<WalletCache>;
928
+
929
+ declare function createDefaultWalletProvider(config: WarpClientConfig, chain: WarpChainInfo, rpcProvider?: any): WalletProvider | null;
930
+
931
+ declare function handleX402Payment(response: Response, url: string, method: string, body: string | undefined, adapters: ChainAdapter[]): Promise<Response>;
932
+
933
+ type CodecFunc<T extends WarpNativeValue = WarpNativeValue> = (value: T) => string;
934
+ declare const string: CodecFunc<string>;
935
+ declare const uint8: CodecFunc<number>;
936
+ declare const uint16: CodecFunc<number>;
937
+ declare const uint32: CodecFunc<number>;
938
+ declare const uint64: CodecFunc<bigint | number>;
939
+ declare const biguint: CodecFunc<bigint | string | number>;
940
+ declare const bool: CodecFunc<boolean>;
941
+ declare const address: CodecFunc<string>;
942
+ declare const asset: CodecFunc<WarpChainAssetValue & {
943
+ decimals?: number;
944
+ }>;
945
+ declare const hex: CodecFunc<string>;
946
+ declare const option: <T extends WarpNativeValue>(codecFunc: CodecFunc<T>, value: T | null) => string;
947
+ declare const tuple: (...values: WarpNativeValue[]) => string;
948
+ declare const struct: CodecFunc<WarpStructValue>;
949
+ declare const vector: CodecFunc<WarpNativeValue[]>;
950
+
951
+ declare class WarpBrandBuilder {
952
+ private config;
953
+ private pendingBrand;
954
+ constructor(config: WarpClientConfig);
955
+ createFromRaw(encoded: string, validateSchema?: boolean): Promise<WarpBrand>;
956
+ setName(name: WarpText): WarpBrandBuilder;
957
+ setDescription(description: WarpText): WarpBrandBuilder;
958
+ setLogo(logo: WarpBrandLogo): WarpBrandBuilder;
959
+ setUrls(urls: WarpBrandUrls): WarpBrandBuilder;
960
+ setColors(colors: WarpBrandColors): WarpBrandBuilder;
961
+ setCta(cta: WarpBrandCta): WarpBrandBuilder;
962
+ build(): Promise<WarpBrand>;
963
+ private ensure;
964
+ private ensureWarpText;
965
+ private ensureValidSchema;
966
+ }
967
+
968
+ declare class WarpBuilder implements BaseWarpBuilder {
969
+ protected readonly config: WarpClientConfig;
970
+ private pendingWarp;
971
+ constructor(config: WarpClientConfig);
972
+ createFromRaw(encoded: string, validate?: boolean): Promise<Warp>;
973
+ createFromUrl(url: string): Promise<Warp>;
974
+ setChain(chain: WarpChainName): WarpBuilder;
975
+ setName(name: string): WarpBuilder;
976
+ setTitle(title: WarpText): WarpBuilder;
977
+ setDescription(description: WarpText | null): WarpBuilder;
978
+ setPreview(preview: string): WarpBuilder;
979
+ setActions(actions: WarpAction[]): WarpBuilder;
980
+ addAction(action: WarpAction): WarpBuilder;
981
+ setOutput(output: Record<string, string> | null): WarpBuilder;
982
+ build(validate?: boolean): Promise<Warp>;
983
+ getDescriptionPreview(description: string, maxChars?: number): string;
984
+ private ensure;
985
+ private ensureWarpText;
986
+ private validate;
987
+ }
988
+
989
+ declare const CacheTtl: {
990
+ OneMinute: number;
991
+ OneHour: number;
992
+ OneDay: number;
993
+ OneWeek: number;
994
+ OneMonth: number;
995
+ OneYear: number;
996
+ };
997
+ declare const WarpCacheKey: {
998
+ Warp: (env: WarpChainEnv, id: string) => string;
999
+ WarpAbi: (env: WarpChainEnv, id: string) => string;
1000
+ WarpExecutable: (env: WarpChainEnv, id: string, action: number) => string;
1001
+ RegistryInfo: (env: WarpChainEnv, id: string) => string;
1002
+ Brand: (env: WarpChainEnv, hash: string) => string;
1003
+ Asset: (env: WarpChainEnv, chain: string, identifier: string) => string;
1004
+ };
1005
+ declare class WarpCache {
1006
+ private strategy;
1007
+ constructor(env: WarpChainEnv, config?: ClientCacheConfig);
1008
+ private selectStrategy;
1009
+ set<T>(key: string, value: T, ttl: number): void;
1010
+ get<T>(key: string): T | null;
1011
+ forget(key: string): void;
1012
+ clear(): void;
1013
+ }
1014
+
1015
+ type ExecutionHandlers = {
1016
+ onExecuted?: (result: WarpActionExecutionResult) => void | Promise<void>;
1017
+ onError?: (params: {
1018
+ message: string;
1019
+ result: WarpActionExecutionResult;
1020
+ }) => void;
1021
+ onSignRequest?: (params: {
1022
+ message: string;
1023
+ chain: WarpChainInfo;
1024
+ }) => string | Promise<string>;
1025
+ onActionExecuted?: (params: {
1026
+ action: WarpActionIndex;
1027
+ chain: WarpChainInfo | null;
1028
+ execution: WarpActionExecutionResult | null;
1029
+ tx: WarpAdapterGenericTransaction | null;
1030
+ }) => void;
1031
+ onActionUnhandled?: (params: {
1032
+ action: WarpActionIndex;
1033
+ chain: WarpChainInfo | null;
1034
+ execution: WarpActionExecutionResult | null;
1035
+ tx: WarpAdapterGenericTransaction | null;
1036
+ }) => void;
1037
+ };
1038
+ declare class WarpExecutor {
1039
+ private config;
1040
+ private adapters;
1041
+ private handlers?;
1042
+ private factory;
1043
+ constructor(config: WarpClientConfig, adapters: ChainAdapter[], handlers?: ExecutionHandlers | undefined);
1044
+ execute(warp: Warp, inputs: string[], meta?: {
1045
+ envs?: Record<string, any>;
1046
+ queries?: Record<string, any>;
1047
+ }): Promise<{
1048
+ txs: WarpAdapterGenericTransaction[];
1049
+ chain: WarpChainInfo | null;
1050
+ immediateExecutions: WarpActionExecutionResult[];
1051
+ resolvedInputs: string[];
1052
+ }>;
1053
+ executeAction(warp: Warp, actionIndex: WarpActionIndex, inputs: string[], meta?: {
1054
+ envs?: Record<string, any>;
1055
+ queries?: Record<string, any>;
1056
+ }): Promise<{
1057
+ tx: WarpAdapterGenericTransaction | null;
1058
+ chain: WarpChainInfo | null;
1059
+ immediateExecution: WarpActionExecutionResult | null;
1060
+ executable: WarpExecutable | null;
1061
+ }>;
1062
+ evaluateOutput(warp: Warp, actions: WarpChainAction[]): Promise<void>;
1063
+ private executeCollect;
1064
+ private doHttpRequest;
1065
+ private getDestinationFromResolvedInputs;
1066
+ private executeMcp;
1067
+ private buildCollectResult;
1068
+ private callHandler;
1069
+ private executePrompt;
1070
+ private evaluateWhenCondition;
1071
+ }
1072
+
1073
+ declare class WarpInterpolator {
1074
+ private config;
1075
+ private adapter;
1076
+ private adapters?;
1077
+ constructor(config: WarpClientConfig, adapter: ChainAdapter, adapters?: ChainAdapter[] | undefined);
1078
+ apply(warp: Warp, meta?: {
1079
+ envs?: Record<string, any>;
1080
+ queries?: Record<string, any>;
1081
+ }): Promise<Warp>;
1082
+ applyGlobals(warp: Warp): Promise<Warp>;
1083
+ applyVars(warp: Warp, meta?: {
1084
+ envs?: Record<string, any>;
1085
+ queries?: Record<string, any>;
1086
+ }): Warp;
1087
+ private applyRootGlobals;
1088
+ private applyActionGlobals;
1089
+ applyInputs(text: string, resolvedInputs: ResolvedInput[], serializer: WarpSerializer, primaryInputs?: ResolvedInput[]): string;
1090
+ private applyGlobalsToText;
1091
+ private replacePlaceholdersWithChain;
1092
+ buildInputBag(resolvedInputs: ResolvedInput[], serializer: WarpSerializer, primaryInputs?: ResolvedInput[]): Record<string, string>;
1093
+ }
1094
+
1095
+ declare class WarpFactory {
1096
+ private config;
1097
+ private adapters;
1098
+ private url;
1099
+ private serializer;
1100
+ private cache;
1101
+ constructor(config: WarpClientConfig, adapters: ChainAdapter[]);
1102
+ getSerializer(): WarpSerializer;
1103
+ getResolvedInputsFromCache(env: WarpChainEnv, warpHash: string | undefined, actionIndex: number): string[];
1104
+ createExecutable(warp: Warp, actionIndex: number, inputs: string[], meta?: {
1105
+ envs?: Record<string, any>;
1106
+ queries?: Record<string, any>;
1107
+ }): Promise<WarpExecutable>;
1108
+ getChainInfoForWarp(warp: Warp, inputs?: string[]): Promise<WarpChainInfo>;
1109
+ getStringTypedInputs(action: WarpAction, inputs: string[]): string[];
1110
+ getResolvedInputs(chain: WarpChainName, action: WarpAction, inputArgs: string[], interpolator?: WarpInterpolator): Promise<ResolvedInput[]>;
1111
+ private requiresPayloadInputs;
1112
+ private resolveActionInputs;
1113
+ getModifiedInputs(inputs: ResolvedInput[]): Promise<ResolvedInput[]>;
1114
+ /**
1115
+ * Builds a context object containing all previous evaluated inputs for use in transform modifiers.
1116
+ *
1117
+ * The context object provides access to inputs by their `as` field (if present) or `name` field.
1118
+ * For asset-type inputs, additional properties are available:
1119
+ * - `{key}` - The full asset object with `identifier` and `amount` properties
1120
+ * - `{key}.token` - The asset identifier as a string
1121
+ * - `{key}.amount` - The asset amount as a string
1122
+ * - `{key}.identifier` - Alias for `{key}.token`
1123
+ *
1124
+ * @example
1125
+ * // Given inputs:
1126
+ * // - { name: 'Asset', as: 'asset', type: 'asset', value: 'asset:ETH|1000000000000000000' }
1127
+ * // - { name: 'Amount', type: 'uint256', value: 'uint256:500' }
1128
+ *
1129
+ * // The context will be:
1130
+ * {
1131
+ * asset: { identifier: 'ETH', amount: 1000000000000000000n },
1132
+ * 'asset.token': 'ETH',
1133
+ * 'asset.amount': '1000000000000000000',
1134
+ * 'asset.identifier': 'ETH',
1135
+ * Amount: 500n
1136
+ * }
1137
+ *
1138
+ * // Usage in transform modifier:
1139
+ * // "modifier": "transform:(inputs) => inputs.asset?.identifier === 'ETH' ? {...} : inputs.asset"
1140
+ *
1141
+ * @param inputs - Array of all resolved inputs
1142
+ * @param currentIndex - Index of the current input being processed
1143
+ * @param currentInput - The current input being transformed (optional, included in context)
1144
+ * @returns Context object with all previous inputs accessible by name/as
1145
+ */
1146
+ private buildInputContext;
1147
+ preprocessInput(chain: WarpChainName, input: string): Promise<string>;
1148
+ private getDestinationFromAction;
1149
+ private getPreparedArgs;
1150
+ private tryGetChainFromInputs;
1151
+ }
1152
+
1153
+ declare class WarpIndex {
1154
+ private config;
1155
+ constructor(config: WarpClientConfig);
1156
+ search(query: string, params?: Record<string, any>, headers?: Record<string, string>): Promise<WarpSearchHit[]>;
1157
+ }
1158
+
1159
+ declare class WarpLinkBuilder {
1160
+ private readonly config;
1161
+ private readonly adapters;
1162
+ constructor(config: WarpClientConfig, adapters: ChainAdapter[]);
1163
+ isValid(url: string): boolean;
1164
+ build(chain: WarpChainName, type: WarpIdentifierType, id: string): string;
1165
+ buildFromPrefixedIdentifier(identifier: string): string | null;
1166
+ generateQrCode(chain: WarpChainName, type: WarpIdentifierType, id: string, size?: number, background?: string, color?: string, logoColor?: string): QRCodeStyling;
1167
+ }
1168
+
1169
+ type DetectionResult = {
1170
+ match: boolean;
1171
+ url: string;
1172
+ warp: Warp | null;
1173
+ chain: WarpChainName | null;
1174
+ registryInfo: WarpRegistryInfo | null;
1175
+ brand: WarpBrand | null;
1176
+ };
1177
+ type DetectionResultFromHtml = {
1178
+ match: boolean;
1179
+ output: {
1180
+ url: string;
1181
+ warp: Warp;
1182
+ }[];
1183
+ };
1184
+ declare class WarpLinkDetecter {
1185
+ private config;
1186
+ private adapters;
1187
+ constructor(config: WarpClientConfig, adapters: ChainAdapter[]);
1188
+ isValid(url: string): boolean;
1189
+ detectFromHtml(content: string): Promise<DetectionResultFromHtml>;
1190
+ detect(urlOrId: string, cache?: WarpCacheConfig): Promise<DetectionResult>;
1191
+ }
1192
+
1193
+ type WarpClientOptions = {
1194
+ chains: ChainAdapterFactory[];
1195
+ };
1196
+ declare class WarpClient {
1197
+ private readonly config;
1198
+ private readonly options;
1199
+ readonly chains: ChainAdapter[];
1200
+ constructor(config: WarpClientConfig, options: WarpClientOptions);
1201
+ getConfig(): WarpClientConfig;
1202
+ createExecutor(handlers?: ExecutionHandlers): WarpExecutor;
1203
+ detectWarp(urlOrId: string, cache?: WarpCacheConfig): Promise<DetectionResult>;
1204
+ executeWarp(warpOrIdentifierOrUrl: string | Warp, inputs: string[], handlers?: ExecutionHandlers, params?: {
1205
+ cache?: WarpCacheConfig;
1206
+ queries?: Record<string, any>;
1207
+ }): Promise<{
1208
+ txs: WarpAdapterGenericTransaction[];
1209
+ chain: WarpChainInfo | null;
1210
+ immediateExecutions: WarpActionExecutionResult[];
1211
+ evaluateOutput: (remoteTxs: WarpAdapterGenericRemoteTransaction[]) => Promise<void>;
1212
+ resolvedInputs: string[];
1213
+ }>;
1214
+ createInscriptionTransaction(chain: WarpChainName, warp: Warp): Promise<WarpAdapterGenericTransaction>;
1215
+ createFromTransaction(chain: WarpChainName, tx: WarpAdapterGenericRemoteTransaction, validate?: boolean): Promise<Warp>;
1216
+ createFromTransactionHash(hash: string, cache?: WarpCacheConfig): Promise<Warp | null>;
1217
+ signMessage(chain: WarpChainName, message: string): Promise<string>;
1218
+ getActions(chain: WarpChainName, ids: string[], awaitCompleted?: boolean): Promise<WarpChainAction[]>;
1219
+ getExplorer(chain: WarpChainName): AdapterWarpExplorer;
1220
+ getOutput(chain: WarpChainName): AdapterWarpOutput;
1221
+ getRegistry(chain: WarpChainName): Promise<AdapterWarpRegistry>;
1222
+ getDataLoader(chain: WarpChainName): AdapterWarpDataLoader;
1223
+ getWallet(chain: WarpChainName): AdapterWarpWallet;
1224
+ get factory(): WarpFactory;
1225
+ get index(): WarpIndex;
1226
+ get linkBuilder(): WarpLinkBuilder;
1227
+ createBuilder(chain: WarpChainName): CombinedWarpBuilder;
1228
+ createAbiBuilder(chain: WarpChainName): AdapterWarpAbiBuilder;
1229
+ createBrandBuilder(chain: WarpChainName): AdapterWarpBrandBuilder;
1230
+ createSerializer(chain: WarpChainName): AdapterWarpSerializer;
1231
+ resolveText(warpText: WarpText): string;
1232
+ }
1233
+
1234
+ declare class WarpLogger {
1235
+ private static isTestEnv;
1236
+ static debug(...args: any[]): void;
1237
+ static info(...args: any[]): void;
1238
+ static warn(...args: any[]): void;
1239
+ static error(...args: any[]): void;
1240
+ }
1241
+
1242
+ declare class WarpTypeRegistry implements AdapterTypeRegistry {
1243
+ private typeHandlers;
1244
+ private typeAliases;
1245
+ registerType(typeName: string, handler: WarpTypeHandler): void;
1246
+ registerTypeAlias(typeName: string, alias: string): void;
1247
+ hasType(typeName: string): boolean;
1248
+ getHandler(typeName: string): WarpTypeHandler | undefined;
1249
+ getAlias(typeName: string): string | undefined;
1250
+ resolveType(typeName: string): string;
1251
+ getRegisteredTypes(): string[];
1252
+ }
1253
+
1254
+ type ValidationResult = {
1255
+ valid: boolean;
1256
+ errors: ValidationError[];
1257
+ };
1258
+ type ValidationError = string;
1259
+ declare class WarpValidator {
1260
+ private config;
1261
+ constructor(config: WarpClientConfig);
1262
+ validate(warp: Warp): Promise<ValidationResult>;
1263
+ private validatePrimaryAction;
1264
+ private validateMaxOneValuePosition;
1265
+ private validateVariableNamesAndResultNamesUppercase;
1266
+ private validateAbiIsSetIfApplicable;
1267
+ private validateSchema;
1268
+ }
1269
+
1270
+ export { type AdapterTypeRegistry, type AdapterWarpAbiBuilder, type AdapterWarpBrandBuilder, type AdapterWarpBuilder, type AdapterWarpDataLoader, type AdapterWarpExecutor, type AdapterWarpExplorer, type AdapterWarpOutput, type AdapterWarpRegistry, type AdapterWarpSerializer, type AdapterWarpWallet, type BaseWarpActionInputType, type BaseWarpBuilder, BrowserCryptoProvider, CacheTtl, type ChainAdapter, type ChainAdapterFactory, type ClientIndexConfig, type ClientTransformConfig, type CodecFunc, type CombinedWarpBuilder, type CryptoProvider, type DetectionResult, type DetectionResultFromHtml, type ExecutionHandlers, type HttpAuthHeaders, type InterpolationBag, NodeCryptoProvider, type ProtocolName, type ResolvedInput, type SignableMessage, type TransformRunner, WARP_LANGUAGES, type WalletCache, type WalletProvider, type WalletProviderFactory, type Warp, type WarpAbi, type WarpAbiContents, type WarpAction, type WarpActionExecutionResult, type WarpActionExecutionStatus, type WarpActionIndex, type WarpActionInput, type WarpActionInputModifier, type WarpActionInputPosition, type WarpActionInputPositionAssetObject, type WarpActionInputSource, type WarpActionInputType, type WarpActionType, type WarpAdapterGenericRemoteTransaction, type WarpAdapterGenericTransaction, type WarpAdapterGenericType, type WarpAdapterGenericValue, type WarpAlert, type WarpAlertName, type WarpAlerts, type WarpBrand, WarpBrandBuilder, type WarpBrandColors, type WarpBrandCta, type WarpBrandLogo, type WarpBrandLogoThemed, type WarpBrandUrls, WarpBuilder, WarpCache, type WarpCacheConfig, WarpCacheKey, type WarpChainAccount, type WarpChainAction, type WarpChainActionStatus, type WarpChainAsset, type WarpChainAssetLogo, type WarpChainAssetLogoThemed, type WarpChainAssetValue, type WarpChainEnv, type WarpChainInfo, type WarpChainInfoLogo, type WarpChainInfoLogoThemed, WarpChainName, WarpClient, type WarpClientConfig, type WarpCollectAction, type WarpCollectDestination, type WarpCollectDestinationHttp, WarpConfig, WarpConstants, type WarpContract, type WarpContractAction, type WarpContractVerification, type WarpDataLoaderOptions, type WarpExecutable, type WarpExecutionMessages, type WarpExecutionNextInfo, type WarpExecutionOutput, WarpExecutor, type WarpExplorerName, WarpFactory, type WarpI18nText, type WarpIdentifierType, WarpIndex, WarpInputTypes, WarpInterpolator, type WarpLinkAction, WarpLinkBuilder, WarpLinkDetecter, type WarpLocale, WarpLogger, type WarpMcpAction, type WarpMcpDestination, type WarpMessageName, type WarpMeta, type WarpNativeValue, type WarpOutputName, type WarpPromptAction, WarpProtocolVersions, type WarpProviderConfig, type WarpProviderPreferences, type WarpQueryAction, type WarpRegistryConfigInfo, type WarpRegistryInfo, type WarpResulutionPath, type WarpSearchHit, type WarpSearchResult, type WarpSecret, WarpSerializer, type WarpStructValue, type WarpText, type WarpTheme, type WarpTransferAction, type WarpTrustStatus, type WarpTypeHandler, WarpTypeRegistry, type WarpUserWallets, WarpValidator, type WarpVarPlaceholder, type WarpWalletDetails, type WarpWalletProvider, address, applyOutputToMessages, asset, biguint, bool, buildMappedOutput, buildNestedPayload, bytesToBase64, bytesToHex, cleanWarpIdentifier, createAuthHeaders, createAuthMessage, createCryptoProvider, createDefaultWalletProvider, createHttpAuthHeaders, createSignableMessage, createWarpI18nText, createWarpIdentifier, evaluateOutputCommon, evaluateWhenCondition, extractCollectOutput, extractIdentifierInfoFromUrl, extractPromptOutput, extractQueryStringFromIdentifier, extractQueryStringFromUrl, extractResolvedInputValues, extractWarpSecrets, findWarpAdapterForChain, getCryptoProvider, getEventNameFromWarp, getLatestProtocolIdentifier, getNextInfo, getProviderConfig, getRandomBytes, getRandomHex, getWalletFromConfigOrFail, getWarpActionByIndex, getWarpBrandLogoUrl, getWarpChainAssetLogoUrl, getWarpChainInfoLogoUrl, getWarpInfoFromIdentifier, getWarpPrimaryAction, getWarpWalletAddress, getWarpWalletAddressFromConfig, getWarpWalletExternalId, getWarpWalletExternalIdFromConfig, getWarpWalletExternalIdFromConfigOrFail, getWarpWalletMnemonic, getWarpWalletMnemonicFromConfig, getWarpWalletPrivateKey, getWarpWalletPrivateKeyFromConfig, handleX402Payment, hasInputPrefix, hex, initializeWalletCache, isEqualWarpIdentifier, isWarpActionAutoExecute, isWarpI18nText, isWarpWalletReadOnly, mergeNestedPayload, normalizeAndValidateMnemonic, normalizeMnemonic, option, parseOutputOutIndex, parseSignedMessage, replacePlaceholders, replacePlaceholdersInWhenExpression, resolveWarpText, safeWindow, setCryptoProvider, setWarpWalletInConfig, shiftBigintBy, splitInput, string, struct, testCryptoAvailability, toInputPayloadValue, toPreviewText, tuple, uint16, uint32, uint64, uint8, validateMnemonicLength, validateSignedMessage, vector, withAdapterFallback };