@vleap/warps 3.0.0-alpha.13 → 3.0.0-alpha.130

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,75 +1,322 @@
1
- import { Transaction, TransactionOnNetwork, Address, TokenTransfer as TokenTransfer$1, AbiRegistry, NetworkEntrypoint } from '@multiversx/sdk-core';
2
- import { TypedValue, Type, OptionValue, OptionalValue, List, VariadicValue, CompositeValue, StringValue, U8Value, U16Value, U32Value, U64Value, BigUIntValue, BooleanValue, AddressValue, TokenIdentifierValue, BytesValue, TokenTransfer, Struct, CodeMetadataValue, NothingValue, Transaction as Transaction$1, Address as Address$1 } from '@multiversx/sdk-core/out';
3
1
  import QRCodeStyling from 'qr-code-styling';
4
2
 
5
- declare const CacheTtl: {
6
- OneMinute: number;
7
- OneHour: number;
8
- OneDay: number;
9
- OneWeek: number;
10
- OneMonth: number;
11
- OneYear: number;
3
+ type WarpLanguage = '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;
4
+ type WarpText = string | WarpI18nText;
5
+ type WarpI18nText = {
6
+ [language: string]: string;
12
7
  };
13
- declare const CacheKey: {
14
- Warp: (env: WarpChainEnv, id: string) => string;
15
- WarpAbi: (env: WarpChainEnv, id: string) => string;
16
- LastWarpExecutionInputs: (env: WarpChainEnv, id: string, action: number) => string;
17
- RegistryInfo: (env: WarpChainEnv, id: string) => string;
18
- Brand: (env: WarpChainEnv, hash: string) => string;
19
- ChainInfo: (env: WarpChainEnv, chain: WarpChain) => string;
20
- ChainInfos: (env: WarpChainEnv) => string;
8
+
9
+ type WarpAlertName = string;
10
+ type WarpAlert = {
11
+ trigger: string;
12
+ subject: WarpText;
13
+ body: WarpText;
14
+ action?: string;
21
15
  };
22
- type CacheType = 'memory' | 'localStorage';
23
- declare class WarpCache {
24
- private strategy;
25
- constructor(type?: CacheType);
26
- private selectStrategy;
27
- set<T>(key: string, value: T, ttl: number): void;
28
- get<T>(key: string): T | null;
29
- forget(key: string): void;
30
- clear(): void;
31
- }
16
+ type WarpAlerts = Record<WarpAlertName, WarpAlert>;
17
+
18
+ type WarpBrand = {
19
+ protocol: string;
20
+ name: WarpText;
21
+ description: WarpText;
22
+ logo: string;
23
+ urls?: WarpBrandUrls;
24
+ colors?: WarpBrandColors;
25
+ cta?: WarpBrandCta;
26
+ meta?: WarpMeta;
27
+ };
28
+ type WarpBrandUrls = {
29
+ web?: string;
30
+ };
31
+ type WarpBrandColors = {
32
+ primary?: string;
33
+ secondary?: string;
34
+ };
35
+ type WarpBrandCta = {
36
+ title: WarpText;
37
+ description: WarpText;
38
+ label: WarpText;
39
+ url: string;
40
+ };
41
+
42
+ type ClientCacheConfig = {
43
+ ttl?: number;
44
+ type?: WarpCacheType;
45
+ };
46
+ type WarpCacheType = 'memory' | 'localStorage';
32
47
 
33
48
  type WarpChainEnv = 'mainnet' | 'testnet' | 'devnet';
34
49
  type ProtocolName = 'warp' | 'brand' | 'abi';
35
50
 
36
- type WarpChain = string;
37
- type WarpInitConfig = {
51
+ type WarpTrustStatus = 'unverified' | 'verified' | 'blacklisted';
52
+ type WarpRegistryInfo = {
53
+ hash: string;
54
+ alias: string | null;
55
+ trust: WarpTrustStatus;
56
+ owner: string;
57
+ createdAt: number;
58
+ upgradedAt: number;
59
+ brand: string | null;
60
+ upgrade: string | null;
61
+ };
62
+ type WarpRegistryConfigInfo = {
63
+ unitPrice: bigint;
64
+ admins: string[];
65
+ };
66
+
67
+ type WarpActionExecution = {
68
+ success: boolean;
69
+ warp: Warp;
70
+ action: number;
71
+ user: string | null;
72
+ txHash: string | null;
73
+ tx: WarpAdapterGenericTransaction | null;
74
+ next: WarpExecutionNextInfo | null;
75
+ values: {
76
+ string: string[];
77
+ native: WarpNativeValue[];
78
+ };
79
+ results: WarpExecutionResults;
80
+ messages: WarpExecutionMessages;
81
+ };
82
+ type WarpExecutionNextInfo = {
83
+ identifier: string | null;
84
+ url: string;
85
+ }[];
86
+ type WarpExecutionResults = Record<WarpResultName, any | null>;
87
+ type WarpExecutionMessages = Record<WarpMessageName, string | null>;
88
+
89
+ type ClientIndexConfig = {
90
+ url?: string;
91
+ apiKey?: string;
92
+ searchParamName?: string;
93
+ };
94
+ type WarpSearchResult = {
95
+ hits: WarpSearchHit[];
96
+ };
97
+ type WarpSearchHit = {
98
+ hash: string;
99
+ alias: string;
100
+ name: string;
101
+ title: string;
102
+ description: string;
103
+ preview: string;
104
+ status: string;
105
+ category: string;
106
+ featured: boolean;
107
+ };
108
+
109
+ interface TransformRunner {
110
+ run(code: string, context: any): Promise<any>;
111
+ }
112
+ type ClientTransformConfig = {
113
+ runner?: TransformRunner | null;
114
+ };
115
+
116
+ type WarpWalletDetails = {
117
+ address: string;
118
+ mnemonic?: string | null;
119
+ privateKey?: string | null;
120
+ };
121
+ type WarpUserWallets = Record<WarpChain, WarpWalletDetails | string | null>;
122
+ type WarpProviderConfig = Record<WarpChainEnv, string>;
123
+ type WarpClientConfig = {
38
124
  env: WarpChainEnv;
39
125
  clientUrl?: string;
40
126
  currentUrl?: string;
41
127
  vars?: Record<string, string | number>;
42
128
  user?: {
43
- wallet?: string;
129
+ wallets?: WarpUserWallets;
130
+ };
131
+ preferences?: {
132
+ language?: WarpLanguage;
133
+ explorers?: Record<WarpChain, WarpExplorerName>;
44
134
  };
135
+ providers?: Record<WarpChain, WarpProviderConfig>;
45
136
  schema?: {
46
137
  warp?: string;
47
138
  brand?: string;
48
139
  };
49
- cache?: {
50
- ttl?: number;
51
- type?: CacheType;
52
- };
53
- registry?: {
54
- contract?: string;
55
- };
56
- index?: {
57
- url?: string;
58
- apiKey?: string;
59
- searchParamName?: string;
140
+ cache?: ClientCacheConfig;
141
+ transform?: ClientTransformConfig;
142
+ index?: ClientIndexConfig;
143
+ interceptors?: {
144
+ openLink?: (url: string) => Promise<void>;
60
145
  };
61
146
  };
62
147
  type WarpCacheConfig = {
63
148
  ttl?: number;
64
149
  };
150
+ type AdapterFactory = (config: WarpClientConfig, fallback?: Adapter) => Adapter;
151
+ type Adapter = {
152
+ chainInfo: WarpChainInfo;
153
+ prefix: string;
154
+ builder: () => CombinedWarpBuilder;
155
+ executor: AdapterWarpExecutor;
156
+ results: AdapterWarpResults;
157
+ serializer: AdapterWarpSerializer;
158
+ registry: AdapterWarpRegistry;
159
+ explorer: AdapterWarpExplorer;
160
+ abiBuilder: () => AdapterWarpAbiBuilder;
161
+ brandBuilder: () => AdapterWarpBrandBuilder;
162
+ dataLoader: AdapterWarpDataLoader;
163
+ wallet: AdapterWarpWallet;
164
+ };
165
+ type WarpAdapterGenericTransaction = any;
166
+ type WarpAdapterGenericRemoteTransaction = any;
167
+ type WarpAdapterGenericValue = any;
168
+ type WarpAdapterGenericType = any;
169
+ interface WarpTypeHandler {
170
+ stringToNative(value: string): any;
171
+ nativeToString(value: any): string;
172
+ }
173
+ interface AdapterTypeRegistry {
174
+ registerType(typeName: string, handler: WarpTypeHandler): void;
175
+ registerTypeAlias(typeName: string, alias: string): void;
176
+ hasType(typeName: string): boolean;
177
+ getHandler(typeName: string): WarpTypeHandler | undefined;
178
+ getAlias(typeName: string): string | undefined;
179
+ resolveType(typeName: string): string;
180
+ getRegisteredTypes(): string[];
181
+ }
182
+ interface BaseWarpBuilder {
183
+ createFromRaw(encoded: string, validate?: boolean): Promise<Warp>;
184
+ createFromUrl(url: string): Promise<Warp>;
185
+ setName(name: string): BaseWarpBuilder;
186
+ setTitle(title: string): BaseWarpBuilder;
187
+ setDescription(description: string): BaseWarpBuilder;
188
+ setPreview(preview: string): BaseWarpBuilder;
189
+ setActions(actions: WarpAction[]): BaseWarpBuilder;
190
+ addAction(action: WarpAction): BaseWarpBuilder;
191
+ build(): Promise<Warp>;
192
+ }
193
+ interface AdapterWarpBuilder {
194
+ createInscriptionTransaction(warp: Warp): Promise<WarpAdapterGenericTransaction>;
195
+ createFromTransaction(tx: WarpAdapterGenericTransaction, validate?: boolean): Promise<Warp>;
196
+ createFromTransactionHash(hash: string, cache?: WarpCacheConfig): Promise<Warp | null>;
197
+ }
198
+ type CombinedWarpBuilder = AdapterWarpBuilder & BaseWarpBuilder;
199
+ interface AdapterWarpAbiBuilder {
200
+ createInscriptionTransaction(abi: WarpAbiContents): Promise<WarpAdapterGenericTransaction>;
201
+ createFromRaw(encoded: string): Promise<any>;
202
+ createFromTransaction(tx: WarpAdapterGenericTransaction): Promise<any>;
203
+ createFromTransactionHash(hash: string, cache?: WarpCacheConfig): Promise<any | null>;
204
+ }
205
+ interface AdapterWarpBrandBuilder {
206
+ createInscriptionTransaction(brand: WarpBrand): WarpAdapterGenericTransaction;
207
+ createFromTransaction(tx: WarpAdapterGenericTransaction, validate?: boolean): Promise<WarpBrand>;
208
+ createFromTransactionHash(hash: string, cache?: WarpCacheConfig): Promise<WarpBrand | null>;
209
+ }
210
+ interface AdapterWarpExecutor {
211
+ createTransaction(executable: WarpExecutable): Promise<WarpAdapterGenericTransaction>;
212
+ executeQuery(executable: WarpExecutable): Promise<WarpActionExecution>;
213
+ }
214
+ interface AdapterWarpResults {
215
+ getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<WarpActionExecution>;
216
+ }
217
+ interface AdapterWarpSerializer {
218
+ typedToString(value: WarpAdapterGenericValue): string;
219
+ typedToNative(value: WarpAdapterGenericValue): [WarpActionInputType, WarpNativeValue];
220
+ nativeToTyped(type: WarpActionInputType, value: WarpNativeValue): WarpAdapterGenericValue;
221
+ nativeToType(type: BaseWarpActionInputType): WarpAdapterGenericType;
222
+ stringToTyped(value: string): WarpAdapterGenericValue;
223
+ }
224
+ interface AdapterWarpRegistry {
225
+ init(): Promise<void>;
226
+ getRegistryConfig(): WarpRegistryConfigInfo;
227
+ createWarpRegisterTransaction(txHash: string, alias?: string | null, brand?: string | null): Promise<WarpAdapterGenericTransaction>;
228
+ createWarpUnregisterTransaction(txHash: string): Promise<WarpAdapterGenericTransaction>;
229
+ createWarpUpgradeTransaction(alias: string, txHash: string, brand?: string | null): Promise<WarpAdapterGenericTransaction>;
230
+ createWarpAliasSetTransaction(txHash: string, alias: string): Promise<WarpAdapterGenericTransaction>;
231
+ createWarpVerifyTransaction(txHash: string): Promise<WarpAdapterGenericTransaction>;
232
+ createWarpTransferOwnershipTransaction(txHash: string, newOwner: string): Promise<WarpAdapterGenericTransaction>;
233
+ createBrandRegisterTransaction(txHash: string): Promise<WarpAdapterGenericTransaction>;
234
+ createWarpBrandingTransaction(warpHash: string, brandHash: string): Promise<WarpAdapterGenericTransaction>;
235
+ getInfoByAlias(alias: string, cache?: WarpCacheConfig): Promise<{
236
+ registryInfo: WarpRegistryInfo | null;
237
+ brand: WarpBrand | null;
238
+ }>;
239
+ getInfoByHash(hash: string, cache?: WarpCacheConfig): Promise<{
240
+ registryInfo: WarpRegistryInfo | null;
241
+ brand: WarpBrand | null;
242
+ }>;
243
+ getUserWarpRegistryInfos(user?: string): Promise<WarpRegistryInfo[]>;
244
+ getUserBrands(user?: string): Promise<WarpBrand[]>;
245
+ fetchBrand(hash: string, cache?: WarpCacheConfig): Promise<WarpBrand | null>;
246
+ }
247
+ interface AdapterWarpExplorer {
248
+ getAccountUrl(address: string): string;
249
+ getTransactionUrl(hash: string): string;
250
+ getAssetUrl(identifier: string): string;
251
+ getContractUrl(address: string): string;
252
+ }
253
+ interface WarpDataLoaderOptions {
254
+ page?: number;
255
+ size?: number;
256
+ }
257
+ interface AdapterWarpDataLoader {
258
+ getAccount(address: string): Promise<WarpChainAccount>;
259
+ getAccountAssets(address: string): Promise<WarpChainAsset[]>;
260
+ getAsset(identifier: string): Promise<WarpChainAsset | null>;
261
+ getAction(identifier: string, awaitCompleted?: boolean): Promise<WarpChainAction | null>;
262
+ getAccountActions(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAction[]>;
263
+ }
264
+ interface AdapterWarpWallet {
265
+ signTransaction(tx: WarpAdapterGenericTransaction): Promise<WarpAdapterGenericTransaction>;
266
+ signTransactions(txs: WarpAdapterGenericTransaction[]): Promise<WarpAdapterGenericTransaction[]>;
267
+ signMessage(message: string): Promise<string>;
268
+ sendTransactions(txs: WarpAdapterGenericTransaction[]): Promise<string[]>;
269
+ sendTransaction(tx: WarpAdapterGenericTransaction): Promise<string>;
270
+ create(mnemonic: string): WarpWalletDetails;
271
+ generate(): WarpWalletDetails;
272
+ getAddress(): string | null;
273
+ }
274
+
275
+ type WarpChainAccount = {
276
+ chain: WarpChain;
277
+ address: string;
278
+ balance: bigint;
279
+ };
280
+ type WarpChainAssetValue = {
281
+ identifier: string;
282
+ amount: bigint;
283
+ };
284
+ type WarpChainAsset = {
285
+ chain: WarpChain;
286
+ identifier: string;
287
+ name: string;
288
+ symbol: string;
289
+ amount?: bigint;
290
+ decimals?: number;
291
+ logoUrl?: string | null;
292
+ price?: number;
293
+ supply?: bigint;
294
+ };
295
+ type WarpChainAction = {
296
+ chain: WarpChain;
297
+ id: string;
298
+ sender: string;
299
+ receiver: string;
300
+ value: bigint;
301
+ function: string;
302
+ status: WarpChainActionStatus;
303
+ createdAt: string;
304
+ error?: string | null;
305
+ tx?: WarpAdapterGenericRemoteTransaction | null;
306
+ };
307
+ type WarpChainActionStatus = 'pending' | 'success' | 'failed';
308
+
309
+ type WarpChain = string;
310
+ type WarpExplorerName = string;
65
311
  type WarpChainInfo = {
66
- name: WarpChain;
312
+ name: string;
67
313
  displayName: string;
68
314
  chainId: string;
69
315
  blockTime: number;
70
316
  addressHrp: string;
71
- apiUrl: string;
72
- explorerUrl: string;
317
+ defaultApiUrl: string;
318
+ logoUrl: string;
319
+ nativeToken: WarpChainAsset;
73
320
  };
74
321
  type WarpIdType = 'hash' | 'alias';
75
322
  type WarpVarPlaceholder = string;
@@ -78,9 +325,10 @@ type WarpResulutionPath = string;
78
325
  type WarpMessageName = string;
79
326
  type Warp = {
80
327
  protocol: string;
328
+ chain?: WarpChain;
81
329
  name: string;
82
- title: string;
83
- description: string | null;
330
+ title: WarpText;
331
+ description: WarpText | null;
84
332
  bot?: string;
85
333
  preview?: string;
86
334
  vars?: Record<WarpVarPlaceholder, string>;
@@ -88,89 +336,97 @@ type Warp = {
88
336
  next?: string;
89
337
  results?: Record<WarpResultName, WarpResulutionPath>;
90
338
  messages?: Record<WarpMessageName, string>;
339
+ alerts?: WarpAlerts;
91
340
  meta?: WarpMeta;
92
341
  };
93
342
  type WarpMeta = {
343
+ chain: WarpChain;
94
344
  hash: string;
95
345
  creator: string;
96
346
  createdAt: string;
97
347
  };
98
348
  type WarpAction = WarpTransferAction | WarpContractAction | WarpQueryAction | WarpCollectAction | WarpLinkAction;
349
+ type WarpActionIndex = number;
99
350
  type WarpActionType = 'transfer' | 'contract' | 'query' | 'collect' | 'link';
100
351
  type WarpTransferAction = {
101
352
  type: WarpActionType;
102
- chain?: WarpChain;
103
- label: string;
104
- description?: string | null;
353
+ label: WarpText;
354
+ description?: WarpText | null;
105
355
  address?: string;
106
356
  data?: string;
107
357
  value?: string;
108
- transfers?: WarpContractActionTransfer[];
358
+ transfers?: string[];
109
359
  inputs?: WarpActionInput[];
360
+ primary?: boolean;
361
+ auto?: boolean;
110
362
  next?: string;
111
363
  };
112
364
  type WarpContractAction = {
113
365
  type: WarpActionType;
114
- chain?: WarpChain;
115
- label: string;
116
- description?: string | null;
117
- address: string;
118
- func: string | null;
119
- args: string[];
366
+ label: WarpText;
367
+ description?: WarpText | null;
368
+ address?: string;
369
+ func?: string | null;
370
+ args?: string[];
120
371
  value?: string;
121
372
  gasLimit: number;
122
- transfers?: WarpContractActionTransfer[];
373
+ transfers?: string[];
123
374
  abi?: string;
124
375
  inputs?: WarpActionInput[];
376
+ primary?: boolean;
377
+ auto?: boolean;
125
378
  next?: string;
126
379
  };
127
- type WarpContractActionTransfer = {
128
- token: string;
129
- nonce?: number;
130
- amount?: string;
131
- };
132
380
  type WarpQueryAction = {
133
381
  type: WarpActionType;
134
- chain?: WarpChain;
135
- label: string;
136
- description?: string | null;
137
- address: string;
138
- func: string;
139
- args: string[];
382
+ label: WarpText;
383
+ description?: WarpText | null;
384
+ address?: string;
385
+ func?: string;
386
+ args?: string[];
140
387
  abi?: string;
141
388
  inputs?: WarpActionInput[];
389
+ primary?: boolean;
390
+ auto?: boolean;
142
391
  next?: string;
143
392
  };
144
393
  type WarpCollectAction = {
145
394
  type: WarpActionType;
146
- chain?: WarpChain;
147
- label: string;
148
- description?: string | null;
395
+ label: WarpText;
396
+ description?: WarpText | null;
149
397
  destination: {
150
398
  url: string;
151
399
  method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
152
400
  headers?: Record<string, string>;
153
401
  };
154
402
  inputs?: WarpActionInput[];
403
+ primary?: boolean;
404
+ auto?: boolean;
155
405
  next?: string;
156
406
  };
157
407
  type WarpLinkAction = {
158
408
  type: WarpActionType;
159
- chain?: WarpChain;
160
- label: string;
161
- description?: string | null;
409
+ label: WarpText;
410
+ description?: WarpText | null;
162
411
  url: string;
163
412
  inputs?: WarpActionInput[];
413
+ primary?: boolean;
414
+ auto?: boolean;
164
415
  };
165
- type WarpActionInputSource = 'field' | 'query' | 'user:wallet';
166
- type BaseWarpActionInputType = 'string' | 'uint8' | 'uint16' | 'uint32' | 'uint64' | 'biguint' | 'bool' | 'address' | 'token' | 'codemeta' | 'hex' | 'esdt' | 'nft';
416
+ type WarpActionInputSource = 'field' | 'query' | 'user:wallet' | 'hidden';
417
+ type BaseWarpActionInputType = 'string' | 'uint8' | 'uint16' | 'uint32' | 'uint64' | 'uint128' | 'uint256' | 'biguint' | 'bool' | 'address' | 'hex' | string;
167
418
  type WarpActionInputType = string;
168
- type WarpActionInputPosition = 'receiver' | 'value' | 'transfer' | `arg:${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10}` | 'data';
419
+ interface WarpStructValue {
420
+ [key: string]: WarpNativeValue;
421
+ }
422
+ type WarpNativeValue = string | number | bigint | boolean | WarpChainAssetValue | null | WarpNativeValue[] | WarpStructValue;
423
+ type WarpActionInputPosition = 'receiver' | 'value' | 'transfer' | `arg:${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10}` | 'data' | 'chain' | `payload:${string}`;
169
424
  type WarpActionInputModifier = 'scale';
170
425
  type WarpActionInput = {
171
426
  name: string;
172
427
  as?: string;
173
- description?: string | null;
428
+ label?: WarpText;
429
+ description?: WarpText | null;
174
430
  bot?: string;
175
431
  type: WarpActionInputType;
176
432
  position?: WarpActionInputPosition;
@@ -179,11 +435,12 @@ type WarpActionInput = {
179
435
  min?: number | WarpVarPlaceholder;
180
436
  max?: number | WarpVarPlaceholder;
181
437
  pattern?: string;
182
- patternDescription?: string;
438
+ patternDescription?: WarpText;
183
439
  options?: string[] | {
184
440
  [key: string]: string;
185
441
  };
186
442
  modifier?: string;
443
+ default?: string | number | boolean;
187
444
  };
188
445
  type ResolvedInput = {
189
446
  input: WarpActionInput;
@@ -198,8 +455,19 @@ type WarpContractVerification = {
198
455
  codeHash: string;
199
456
  abi: object;
200
457
  };
458
+ type WarpExecutable = {
459
+ chain: WarpChainInfo;
460
+ warp: Warp;
461
+ action: number;
462
+ destination: string;
463
+ args: string[];
464
+ value: bigint;
465
+ transfers: WarpChainAssetValue[];
466
+ data: string | null;
467
+ resolvedInputs: ResolvedInput[];
468
+ };
201
469
 
202
- type WarpWarpAbi = {
470
+ type WarpAbi = {
203
471
  protocol: string;
204
472
  content: WarpAbiContents;
205
473
  meta?: WarpMeta;
@@ -213,103 +481,16 @@ type WarpAbiContents = {
213
481
  events?: any[];
214
482
  };
215
483
 
216
- type Brand = {
217
- protocol: string;
218
- name: string;
219
- description: string;
220
- logo: string;
221
- urls?: BrandUrls;
222
- colors?: BrandColors;
223
- cta?: BrandCta;
224
- meta?: BrandMeta;
225
- };
226
- type BrandUrls = {
227
- web?: string;
228
- };
229
- type BrandColors = {
230
- primary?: string;
231
- secondary?: string;
232
- };
233
- type BrandCta = {
234
- title: string;
235
- description: string;
236
- label: string;
237
- url: string;
238
- };
239
- type BrandMeta = {
240
- hash: string;
241
- creator: string;
242
- createdAt: string;
243
- };
244
-
245
- type WarpTrustStatus = 'unverified' | 'verified' | 'blacklisted';
246
- type WarpRegistryInfo = {
247
- hash: string;
248
- alias: string | null;
249
- trust: WarpTrustStatus;
250
- owner: string;
251
- createdAt: number;
252
- upgradedAt: number;
253
- brand: string | null;
254
- upgrade: string | null;
255
- };
256
- type WarpRegistryConfigInfo = {
257
- unitPrice: bigint;
258
- admins: string[];
259
- };
260
-
261
- type WarpExecution = {
262
- success: boolean;
263
- warp: Warp;
264
- action: number;
265
- user: string | null;
266
- txHash: string | null;
267
- next: WarpExecutionNextInfo | null;
268
- values: any[];
269
- results: WarpExecutionResults;
270
- messages: WarpExecutionMessages;
484
+ type WarpSecret = {
485
+ key: string;
486
+ description?: string | null;
271
487
  };
272
- type WarpExecutionNextInfo = {
273
- identifier: string | null;
274
- url: string;
275
- }[];
276
- type WarpExecutionResults = Record<WarpResultName, any | null>;
277
- type WarpExecutionMessages = Record<WarpMessageName, string | null>;
278
488
 
279
- type WarpSearchResult = {
280
- hits: WarpSearchHit[];
281
- };
282
- type WarpSearchHit = {
283
- hash: string;
284
- alias: string;
285
- name: string;
286
- title: string;
287
- description: string;
288
- preview: string;
289
- status: string;
290
- category: string;
291
- featured: boolean;
489
+ type InterpolationBag = {
490
+ config: WarpClientConfig;
491
+ chain: WarpChainInfo;
292
492
  };
293
493
 
294
- declare class BrandBuilder {
295
- private config;
296
- private pendingBrand;
297
- constructor(config: WarpInitConfig);
298
- createInscriptionTransaction(brand: Brand): Transaction;
299
- createFromRaw(encoded: string, validateSchema?: boolean): Promise<Brand>;
300
- createFromTransaction(tx: TransactionOnNetwork, validateSchema?: boolean): Promise<Brand>;
301
- createFromTransactionHash(hash: string): Promise<Brand | null>;
302
- setName(name: string): BrandBuilder;
303
- setDescription(description: string): BrandBuilder;
304
- setLogo(logo: string): BrandBuilder;
305
- setUrls(urls: BrandUrls): BrandBuilder;
306
- setColors(colors: BrandColors): BrandBuilder;
307
- setCta(cta: BrandCta): BrandBuilder;
308
- build(): Promise<Brand>;
309
- private ensure;
310
- private ensureValidSchema;
311
- }
312
-
313
494
  declare const WarpProtocolVersions: {
314
495
  Warp: string;
315
496
  Brand: string;
@@ -320,56 +501,41 @@ declare const WarpConfig: {
320
501
  LatestBrandSchemaUrl: string;
321
502
  DefaultClientUrl: (env: WarpChainEnv) => "https://usewarp.to" | "https://testnet.usewarp.to" | "https://devnet.usewarp.to";
322
503
  SuperClientUrls: string[];
323
- MainChain: {
324
- Name: string;
325
- DisplayName: string;
326
- ApiUrl: (env: WarpChainEnv) => "https://devnet-api.multiversx.com" | "https://testnet-api.multiversx.com" | "https://api.multiversx.com";
327
- ExplorerUrl: (env: WarpChainEnv) => "https://devnet-explorer.multiversx.com" | "https://testnet-explorer.multiversx.com" | "https://explorer.multiversx.com";
328
- BlockTime: (env: WarpChainEnv) => number;
329
- AddressHrp: string;
330
- ChainId: (env: WarpChainEnv) => "D" | "T" | "1";
331
- };
332
- Registry: {
333
- Contract: (env: WarpChainEnv) => "erd1qqqqqqqqqqqqqpgqje2f99vr6r7sk54thg03c9suzcvwr4nfl3tsfkdl36" | "####" | "erd1qqqqqqqqqqqqqpgq3mrpj3u6q7tejv6d7eqhnyd27n9v5c5tl3ts08mffe";
334
- };
335
504
  AvailableActionInputSources: WarpActionInputSource[];
336
505
  AvailableActionInputTypes: WarpActionInputType[];
337
506
  AvailableActionInputPositions: WarpActionInputPosition[];
338
507
  };
339
508
 
340
- type InterpolationBag = {
341
- config: WarpInitConfig;
342
- chain: WarpChainInfo;
343
- };
344
- declare class WarpInterpolator {
345
- static apply(config: WarpInitConfig, warp: Warp): Promise<Warp>;
346
- static applyGlobals(config: WarpInitConfig, warp: Warp): Promise<Warp>;
347
- static applyVars(config: WarpInitConfig, warp: Warp): Warp;
348
- private static applyRootGlobals;
349
- private static applyActionGlobals;
509
+ declare enum WarpChainName {
510
+ Multiversx = "multiversx",
511
+ Vibechain = "vibechain",
512
+ Sui = "sui",
513
+ Ethereum = "ethereum",
514
+ Base = "base",
515
+ Arbitrum = "arbitrum",
516
+ Somnia = "somnia",
517
+ Fastset = "fastset"
350
518
  }
351
-
352
519
  declare const WarpConstants: {
353
520
  HttpProtocolPrefix: string;
354
521
  IdentifierParamName: string;
355
522
  IdentifierParamSeparator: string;
523
+ IdentifierChainDefault: string;
356
524
  IdentifierType: {
357
525
  Alias: WarpIdType;
358
526
  Hash: WarpIdType;
359
527
  };
360
- Source: {
361
- UserWallet: string;
362
- };
528
+ IdentifierAliasPrefix: string;
363
529
  Globals: {
364
530
  UserWallet: {
365
531
  Placeholder: string;
366
- Accessor: (bag: InterpolationBag) => string | undefined;
532
+ Accessor: (bag: InterpolationBag) => string | WarpWalletDetails | null | undefined;
367
533
  };
368
534
  ChainApiUrl: {
369
535
  Placeholder: string;
370
536
  Accessor: (bag: InterpolationBag) => string;
371
537
  };
372
- ChainExplorerUrl: {
538
+ ChainAddressHrp: {
373
539
  Placeholder: string;
374
540
  Accessor: (bag: InterpolationBag) => string;
375
541
  };
@@ -380,137 +546,377 @@ declare const WarpConstants: {
380
546
  };
381
547
  ArgParamsSeparator: string;
382
548
  ArgCompositeSeparator: string;
549
+ ArgListSeparator: string;
550
+ ArgStructSeparator: string;
383
551
  Transform: {
384
552
  Prefix: string;
385
553
  };
386
- Egld: {
387
- Identifier: string;
388
- EsdtIdentifier: string;
389
- DisplayName: string;
390
- Decimals: number;
554
+ Source: {
555
+ UserWallet: string;
391
556
  };
557
+ Position: {
558
+ Payload: string;
559
+ };
560
+ };
561
+ declare const WarpInputTypes: {
562
+ Option: string;
563
+ Vector: string;
564
+ Tuple: string;
565
+ Struct: string;
566
+ String: string;
567
+ Uint8: string;
568
+ Uint16: string;
569
+ Uint32: string;
570
+ Uint64: string;
571
+ Uint128: string;
572
+ Uint256: string;
573
+ Biguint: string;
574
+ Bool: string;
575
+ Address: string;
576
+ Asset: string;
577
+ Hex: string;
392
578
  };
579
+ declare const safeWindow: Window;
393
580
 
394
- declare const getMainChainInfo: (config: WarpInitConfig) => WarpChainInfo;
395
- declare const getChainExplorerUrl: (chain: WarpChainInfo, path?: string) => string;
581
+ interface CryptoProvider {
582
+ getRandomBytes(size: number): Promise<Uint8Array>;
583
+ }
584
+ declare class BrowserCryptoProvider implements CryptoProvider {
585
+ getRandomBytes(size: number): Promise<Uint8Array>;
586
+ }
587
+ declare class NodeCryptoProvider implements CryptoProvider {
588
+ getRandomBytes(size: number): Promise<Uint8Array>;
589
+ }
590
+ declare function getCryptoProvider(): CryptoProvider;
591
+ declare function setCryptoProvider(provider: CryptoProvider): void;
592
+ declare function getRandomBytes(size: number, cryptoProvider?: CryptoProvider): Promise<Uint8Array>;
593
+ declare function bytesToHex(bytes: Uint8Array): string;
594
+ declare function bytesToBase64(bytes: Uint8Array): string;
595
+ declare function getRandomHex(length: number, cryptoProvider?: CryptoProvider): Promise<string>;
596
+ declare function testCryptoAvailability(): Promise<{
597
+ randomBytes: boolean;
598
+ environment: 'browser' | 'nodejs' | 'unknown';
599
+ }>;
600
+ declare function createCryptoProvider(): CryptoProvider;
601
+
602
+ declare const extractWarpSecrets: (warp: Warp) => WarpSecret[];
603
+
604
+ declare const findWarpAdapterForChain: (chain: WarpChain, adapters: Adapter[]) => Adapter;
605
+ declare const findWarpAdapterByPrefix: (prefix: string, adapters: Adapter[]) => Adapter;
396
606
  declare const getLatestProtocolIdentifier: (name: ProtocolName) => string;
397
607
  declare const getWarpActionByIndex: (warp: Warp, index: number) => WarpAction;
398
- declare const toTypedChainInfo: (chainInfo: any) => WarpChainInfo;
399
- declare const shiftBigintBy: (value: bigint | string, decimals: number) => bigint;
608
+ declare const getWarpPrimaryAction: (warp: Warp) => {
609
+ action: WarpAction;
610
+ index: number;
611
+ };
612
+ declare const isWarpActionAutoExecute: (action: WarpAction, warp: Warp) => boolean;
613
+ declare const shiftBigintBy: (value: bigint | string | number, decimals: number) => bigint;
400
614
  declare const toPreviewText: (text: string, maxChars?: number) => string;
401
615
  declare const replacePlaceholders: (message: string, bag: Record<string, any>) => string;
616
+ declare const applyResultsToMessages: (warp: Warp, results: Record<string, any>) => Record<string, string>;
402
617
 
403
- declare const option: (value: TypedValue | null, type?: Type) => OptionValue;
404
- declare const optional: (value: TypedValue | null, type?: Type) => OptionalValue;
405
- declare const list: (values: TypedValue[]) => List;
406
- declare const variadic: (values: TypedValue[]) => VariadicValue;
407
- declare const composite: (values: TypedValue[]) => CompositeValue;
408
- declare const string: (value: string) => StringValue;
409
- declare const u8: (value: number) => U8Value;
410
- declare const u16: (value: number) => U16Value;
411
- declare const u32: (value: number) => U32Value;
412
- declare const u64: (value: bigint) => U64Value;
413
- declare const biguint: (value: bigint | string | number) => BigUIntValue;
414
- declare const boolean: (value: boolean) => BooleanValue;
415
- declare const address: (value: string) => AddressValue;
416
- declare const token: (value: string) => TokenIdentifierValue;
417
- declare const hex: (value: string) => BytesValue;
418
- declare const esdt: (value: TokenTransfer) => Struct;
419
- declare const codemeta: (hexString: string) => CodeMetadataValue;
420
- declare const nothing: () => NothingValue;
421
-
422
- declare class WarpAbiBuilder {
423
- private config;
424
- private cache;
425
- constructor(config: WarpInitConfig);
426
- createInscriptionTransaction(abi: WarpAbiContents): Transaction;
427
- createFromRaw(encoded: string): Promise<WarpWarpAbi>;
428
- createFromTransaction(tx: TransactionOnNetwork): Promise<WarpWarpAbi>;
429
- createFromTransactionHash(hash: string, cache?: WarpCacheConfig): Promise<WarpWarpAbi | null>;
430
- }
618
+ declare const resolveWarpText: (text: WarpText, config?: WarpClientConfig) => string;
619
+ declare const isWarpI18nText: (text: WarpText) => text is WarpI18nText;
620
+ declare const createWarpI18nText: (translations: Record<string, string>) => WarpI18nText;
431
621
 
432
- type TxComponents = {
433
- destination: Address;
434
- args: string[];
435
- value: bigint;
436
- transfers: TokenTransfer$1[];
437
- data: Buffer | null;
438
- resolvedInputs: ResolvedInput[];
439
- };
440
- declare class WarpActionExecutor {
441
- private config;
442
- private url;
443
- private serializer;
444
- private contractLoader;
445
- private cache;
446
- constructor(config: WarpInitConfig);
447
- createTransactionForExecute(warp: Warp, actionIndex: number, inputs: string[]): Promise<Transaction>;
448
- getTransactionExecutionResults(warp: Warp, actionIndex: number, tx: TransactionOnNetwork): Promise<WarpExecution>;
449
- executeQuery(warp: Warp, actionIndex: number, inputs: string[]): Promise<WarpExecution>;
450
- executeCollect(warp: Warp, actionIndex: number, inputs: string[], extra?: Record<string, any>): Promise<WarpExecution>;
451
- getTxComponentsFromInputs(chain: WarpChainInfo, action: WarpTransferAction | WarpContractAction | WarpQueryAction, inputs: string[], sender?: Address): Promise<TxComponents>;
452
- getResolvedInputs(chain: WarpChainInfo, action: WarpAction, inputArgs: string[]): Promise<ResolvedInput[]>;
453
- getModifiedInputs(inputs: ResolvedInput[]): ResolvedInput[];
454
- preprocessInput(chain: WarpChainInfo, input: string): Promise<string>;
455
- getAbiForAction(action: WarpContractAction | WarpQueryAction): Promise<AbiRegistry>;
456
- private getPreparedArgs;
457
- private getPreparedMessages;
458
- private fetchAbi;
459
- private toTypedTransfer;
460
- }
622
+ declare const getWarpInfoFromIdentifier: (prefixedIdentifier: string) => {
623
+ chainPrefix: string;
624
+ type: WarpIdType;
625
+ identifier: string;
626
+ identifierBase: string;
627
+ } | null;
628
+ declare const extractIdentifierInfoFromUrl: (url: string) => {
629
+ chainPrefix: string;
630
+ type: WarpIdType;
631
+ identifier: string;
632
+ identifierBase: string;
633
+ } | null;
634
+
635
+ /**
636
+ * Splits an input string into type and value, using only the first colon as separator.
637
+ * This handles cases where the value itself contains colons (like SUI token IDs).
638
+ */
639
+ declare const splitInput: (input: string) => [WarpActionInputType, string];
640
+ declare const hasInputPrefix: (input: string) => boolean;
641
+
642
+ declare const getNextInfo: (config: WarpClientConfig, adapters: Adapter[], warp: Warp, actionIndex: number, results: WarpExecutionResults) => WarpExecutionNextInfo | null;
643
+
644
+ /**
645
+ * Builds a nested payload object from a position string and field value.
646
+ * Position strings should be in format: "payload:path.to.nested.location"
647
+ *
648
+ * @param position - The position string defining where to place the value
649
+ * @param fieldName - The field name to use for the value
650
+ * @param value - The value to place at the position
651
+ * @returns A nested object structure or flat object if position doesn't start with 'payload:'
652
+ */
653
+ declare function buildNestedPayload(position: string, fieldName: string, value: any): any;
654
+ /**
655
+ * Recursively merges a source object into a target object and returns the merged result.
656
+ * Existing nested objects are merged recursively, primitive values are overwritten.
657
+ * Does not mutate the original target or source objects.
658
+ *
659
+ * @param target - The target object to merge into
660
+ * @param source - The source object to merge from
661
+ * @returns A new object with the merged result
662
+ */
663
+ declare function mergeNestedPayload(target: any, source: any): any;
664
+
665
+ declare const getProviderUrl: (config: WarpClientConfig, chain: WarpChain, env: WarpChainEnv, defaultProvider: string) => string;
666
+ declare const getProviderConfig: (config: WarpClientConfig, chain: WarpChain) => WarpProviderConfig | undefined;
461
667
 
462
- type WarpNativeValue = string | number | bigint | boolean | null | TokenTransfer | WarpNativeValue[];
463
- declare class WarpArgSerializer {
668
+ declare class WarpSerializer {
669
+ private readonly typeRegistry?;
670
+ constructor(options?: {
671
+ typeRegistry?: AdapterTypeRegistry;
672
+ });
464
673
  nativeToString(type: WarpActionInputType, value: WarpNativeValue): string;
465
- typedToString(value: TypedValue): string;
466
- typedToNative(value: TypedValue): [WarpActionInputType, WarpNativeValue];
467
- nativeToTyped(type: WarpActionInputType, value: WarpNativeValue): TypedValue;
468
- nativeToType(type: BaseWarpActionInputType): Type;
469
674
  stringToNative(value: string): [WarpActionInputType, WarpNativeValue];
470
- stringToTyped(value: string): TypedValue;
471
- typeToString(type: Type): WarpActionInputType;
675
+ private getTypeAndValue;
472
676
  }
473
677
 
474
- declare class WarpBuilder {
678
+ declare const extractCollectResults: (warp: Warp, response: any, actionIndex: number, inputs: ResolvedInput[], serializer: WarpSerializer, transformRunner?: TransformRunner | null) => Promise<{
679
+ values: {
680
+ string: string[];
681
+ native: any[];
682
+ };
683
+ results: WarpExecutionResults;
684
+ }>;
685
+ declare const evaluateResultsCommon: (warp: Warp, baseResults: WarpExecutionResults, actionIndex: number, inputs: ResolvedInput[], serializer: WarpSerializer, transformRunner?: TransformRunner | null) => Promise<WarpExecutionResults>;
686
+ /**
687
+ * Parses out[N] notation and returns the action index (1-based) or null if invalid.
688
+ * Also handles plain "out" which defaults to action index 1.
689
+ */
690
+ declare const parseResultsOutIndex: (resultPath: string) => number | null;
691
+
692
+ /**
693
+ * Signing utilities for creating and validating signed messages
694
+ * Works with any crypto provider or uses automatic detection
695
+ */
696
+
697
+ interface SignableMessage {
698
+ wallet: string;
699
+ nonce: string;
700
+ expiresAt: string;
701
+ purpose: string;
702
+ }
703
+ type HttpAuthHeaders = Record<string, string> & {
704
+ 'X-Signer-Wallet': string;
705
+ 'X-Signer-Signature': string;
706
+ 'X-Signer-Nonce': string;
707
+ 'X-Signer-ExpiresAt': string;
708
+ };
709
+ /**
710
+ * Creates a signable message with standard security fields
711
+ * This can be used for any type of proof or authentication
712
+ */
713
+ declare function createSignableMessage(walletAddress: string, purpose: string, cryptoProvider?: CryptoProvider, expiresInMinutes?: number): Promise<{
714
+ message: string;
715
+ nonce: string;
716
+ expiresAt: string;
717
+ }>;
718
+ /**
719
+ * Creates a signable message for HTTP authentication
720
+ * This is a convenience function that uses the standard format
721
+ */
722
+ declare function createAuthMessage(walletAddress: string, appName: string, cryptoProvider?: CryptoProvider, purpose?: string): Promise<{
723
+ message: string;
724
+ nonce: string;
725
+ expiresAt: string;
726
+ }>;
727
+ /**
728
+ * Creates HTTP authentication headers from a signature
729
+ */
730
+ declare function createAuthHeaders(walletAddress: string, signature: string, nonce: string, expiresAt: string): HttpAuthHeaders;
731
+ /**
732
+ * Creates HTTP authentication headers for a wallet using the provided signing function
733
+ */
734
+ declare function createHttpAuthHeaders(walletAddress: string, signMessage: (message: string) => Promise<string>, appName: string, cryptoProvider?: CryptoProvider): Promise<HttpAuthHeaders>;
735
+ /**
736
+ * Validates a signed message by checking expiration
737
+ */
738
+ declare function validateSignedMessage(expiresAt: string): boolean;
739
+ /**
740
+ * Parses a signed message to extract its components
741
+ */
742
+ declare function parseSignedMessage(message: string): SignableMessage;
743
+
744
+ declare const getWarpWalletAddress: (wallet: WarpWalletDetails | string | null | undefined) => string | null;
745
+ declare const getWarpWalletAddressFromConfig: (config: WarpClientConfig, chain: WarpChain) => string | null;
746
+ declare const getWarpWalletPrivateKey: (wallet: WarpWalletDetails | string | null | undefined) => string | null | undefined;
747
+ declare const getWarpWalletMnemonic: (wallet: WarpWalletDetails | string | null | undefined) => string | null | undefined;
748
+ declare const getWarpWalletPrivateKeyFromConfig: (config: WarpClientConfig, chain: WarpChain) => string | null;
749
+ declare const getWarpWalletMnemonicFromConfig: (config: WarpClientConfig, chain: WarpChain) => string | null;
750
+
751
+ type CodecFunc<T extends WarpNativeValue = WarpNativeValue> = (value: T) => string;
752
+ declare const string: CodecFunc<string>;
753
+ declare const uint8: CodecFunc<number>;
754
+ declare const uint16: CodecFunc<number>;
755
+ declare const uint32: CodecFunc<number>;
756
+ declare const uint64: CodecFunc<bigint | number>;
757
+ declare const biguint: CodecFunc<bigint | string | number>;
758
+ declare const bool: CodecFunc<boolean>;
759
+ declare const address: CodecFunc<string>;
760
+ declare const asset: CodecFunc<WarpChainAssetValue & {
761
+ decimals?: number;
762
+ }>;
763
+ declare const hex: CodecFunc<string>;
764
+ declare const option: <T extends WarpNativeValue>(codecFunc: CodecFunc<T>, value: T | null) => string;
765
+ declare const tuple: (...values: WarpNativeValue[]) => string;
766
+ declare const struct: CodecFunc<WarpStructValue>;
767
+ declare const vector: CodecFunc<WarpNativeValue[]>;
768
+
769
+ declare class WarpBrandBuilder {
475
770
  private config;
476
- private cache;
771
+ private pendingBrand;
772
+ constructor(config: WarpClientConfig);
773
+ createFromRaw(encoded: string, validateSchema?: boolean): Promise<WarpBrand>;
774
+ setName(name: WarpText): WarpBrandBuilder;
775
+ setDescription(description: WarpText): WarpBrandBuilder;
776
+ setLogo(logo: string): WarpBrandBuilder;
777
+ setUrls(urls: WarpBrandUrls): WarpBrandBuilder;
778
+ setColors(colors: WarpBrandColors): WarpBrandBuilder;
779
+ setCta(cta: WarpBrandCta): WarpBrandBuilder;
780
+ build(): Promise<WarpBrand>;
781
+ private ensure;
782
+ private ensureWarpText;
783
+ private ensureValidSchema;
784
+ }
785
+
786
+ declare class WarpBuilder implements BaseWarpBuilder {
787
+ protected readonly config: WarpClientConfig;
477
788
  private pendingWarp;
478
- constructor(config: WarpInitConfig);
479
- createInscriptionTransaction(warp: Warp): Transaction;
789
+ constructor(config: WarpClientConfig);
480
790
  createFromRaw(encoded: string, validate?: boolean): Promise<Warp>;
481
- createFromTransaction(tx: TransactionOnNetwork, validate?: boolean): Promise<Warp>;
482
- createFromTransactionHash(hash: string, cache?: WarpCacheConfig): Promise<Warp | null>;
791
+ createFromUrl(url: string): Promise<Warp>;
792
+ setChain(chain: WarpChain): WarpBuilder;
483
793
  setName(name: string): WarpBuilder;
484
- setTitle(title: string): WarpBuilder;
485
- setDescription(description: string): WarpBuilder;
794
+ setTitle(title: WarpText): WarpBuilder;
795
+ setDescription(description: WarpText): WarpBuilder;
486
796
  setPreview(preview: string): WarpBuilder;
487
797
  setActions(actions: WarpAction[]): WarpBuilder;
488
798
  addAction(action: WarpAction): WarpBuilder;
489
799
  build(): Promise<Warp>;
490
800
  getDescriptionPreview(description: string, maxChars?: number): string;
491
801
  private ensure;
802
+ private ensureWarpText;
492
803
  private validate;
493
804
  }
494
805
 
495
- declare class WarpContractLoader {
496
- private readonly config;
497
- constructor(config: WarpInitConfig);
498
- getContract(address: string, chain: WarpChainInfo): Promise<WarpContract | null>;
499
- getVerificationInfo(address: string, chain: WarpChainInfo): Promise<WarpContractVerification | null>;
806
+ declare const CacheTtl: {
807
+ OneMinute: number;
808
+ OneHour: number;
809
+ OneDay: number;
810
+ OneWeek: number;
811
+ OneMonth: number;
812
+ OneYear: number;
813
+ };
814
+ declare const WarpCacheKey: {
815
+ Warp: (env: WarpChainEnv, id: string) => string;
816
+ WarpAbi: (env: WarpChainEnv, id: string) => string;
817
+ WarpExecutable: (env: WarpChainEnv, id: string, action: number) => string;
818
+ RegistryInfo: (env: WarpChainEnv, id: string) => string;
819
+ Brand: (env: WarpChainEnv, hash: string) => string;
820
+ Asset: (env: WarpChainEnv, chain: string, identifier: string) => string;
821
+ };
822
+ declare class WarpCache {
823
+ private strategy;
824
+ constructor(type?: WarpCacheType);
825
+ private selectStrategy;
826
+ set<T>(key: string, value: T, ttl: number): void;
827
+ get<T>(key: string): T | null;
828
+ forget(key: string): void;
829
+ clear(): void;
830
+ }
831
+
832
+ type ExecutionHandlers = {
833
+ onExecuted?: (result: WarpActionExecution) => void | Promise<void>;
834
+ onError?: (params: {
835
+ message: string;
836
+ }) => void;
837
+ onSignRequest?: (params: {
838
+ message: string;
839
+ chain: WarpChainInfo;
840
+ }) => string | Promise<string>;
841
+ onActionExecuted?: (params: {
842
+ action: WarpActionIndex;
843
+ chain: WarpChainInfo | null;
844
+ execution: WarpActionExecution | null;
845
+ tx: WarpAdapterGenericTransaction | null;
846
+ }) => void;
847
+ };
848
+ declare class WarpExecutor {
849
+ private config;
850
+ private adapters;
851
+ private handlers?;
852
+ private factory;
853
+ constructor(config: WarpClientConfig, adapters: Adapter[], handlers?: ExecutionHandlers | undefined);
854
+ execute(warp: Warp, inputs: string[], meta?: {
855
+ envs?: Record<string, any>;
856
+ queries?: Record<string, any>;
857
+ }): Promise<{
858
+ txs: WarpAdapterGenericTransaction[];
859
+ chain: WarpChainInfo | null;
860
+ immediateExecutions: WarpActionExecution[];
861
+ }>;
862
+ executeAction(warp: Warp, actionIndex: WarpActionIndex, inputs: string[], meta?: {
863
+ envs?: Record<string, any>;
864
+ queries?: Record<string, any>;
865
+ }): Promise<{
866
+ tx: WarpAdapterGenericTransaction | null;
867
+ chain: WarpChainInfo | null;
868
+ immediateExecution: WarpActionExecution | null;
869
+ }>;
870
+ evaluateResults(warp: Warp, actions: WarpChainAction[]): Promise<void>;
871
+ private executeCollect;
872
+ private callHandler;
873
+ }
874
+
875
+ declare class WarpFactory {
876
+ private config;
877
+ private adapters;
878
+ private url;
879
+ private serializer;
880
+ private cache;
881
+ constructor(config: WarpClientConfig, adapters: Adapter[]);
882
+ getSerializer(): WarpSerializer;
883
+ createExecutable(warp: Warp, actionIndex: number, inputs: string[], meta?: {
884
+ envs?: Record<string, any>;
885
+ queries?: Record<string, any>;
886
+ }): Promise<WarpExecutable>;
887
+ getChainInfoForWarp(warp: Warp, inputs?: string[]): Promise<WarpChainInfo>;
888
+ getStringTypedInputs(action: WarpAction, inputs: string[]): string[];
889
+ getResolvedInputs(chain: WarpChain, action: WarpAction, inputArgs: string[]): Promise<ResolvedInput[]>;
890
+ getModifiedInputs(inputs: ResolvedInput[]): ResolvedInput[];
891
+ preprocessInput(chain: WarpChain, input: string): Promise<string>;
892
+ private getDestinationFromAction;
893
+ private getPreparedArgs;
894
+ private tryGetChainFromInputs;
500
895
  }
501
896
 
502
897
  declare class WarpIndex {
503
898
  private config;
504
- constructor(config: WarpInitConfig);
899
+ constructor(config: WarpClientConfig);
505
900
  search(query: string, params?: Record<string, any>, headers?: Record<string, string>): Promise<WarpSearchHit[]>;
506
901
  }
507
902
 
903
+ declare class WarpLinkBuilder {
904
+ private readonly config;
905
+ private readonly adapters;
906
+ constructor(config: WarpClientConfig, adapters: Adapter[]);
907
+ isValid(url: string): boolean;
908
+ build(chain: WarpChain, type: WarpIdType, id: string): string;
909
+ buildFromPrefixedIdentifier(identifier: string): string | null;
910
+ generateQrCode(chain: WarpChain, type: WarpIdType, id: string, size?: number, background?: string, color?: string, logoColor?: string): QRCodeStyling;
911
+ }
912
+
508
913
  type DetectionResult = {
509
914
  match: boolean;
510
915
  url: string;
511
916
  warp: Warp | null;
917
+ chain: WarpChain | null;
512
918
  registryInfo: WarpRegistryInfo | null;
513
- brand: Brand | null;
919
+ brand: WarpBrand | null;
514
920
  };
515
921
  type DetectionResultFromHtml = {
516
922
  match: boolean;
@@ -519,63 +925,88 @@ type DetectionResultFromHtml = {
519
925
  warp: Warp;
520
926
  }[];
521
927
  };
522
- declare class WarpLink {
928
+ declare class WarpLinkDetecter {
523
929
  private config;
524
- constructor(config: WarpInitConfig);
930
+ private adapters;
931
+ constructor(config: WarpClientConfig, adapters: Adapter[]);
525
932
  isValid(url: string): boolean;
526
933
  detectFromHtml(content: string): Promise<DetectionResultFromHtml>;
527
934
  detect(url: string, cache?: WarpCacheConfig): Promise<DetectionResult>;
528
- build(type: WarpIdType, id: string): string;
529
- buildFromPrefixedIdentifier(prefixedIdentifier: string): string;
530
- generateQrCode(type: WarpIdType, id: string, size?: number, background?: string, color?: string, logoColor?: string): QRCodeStyling;
531
- private extractIdentifierInfoFromUrl;
532
935
  }
533
936
 
534
- declare class WarpRegistry {
535
- private config;
536
- private cache;
537
- registryConfig: WarpRegistryConfigInfo;
538
- constructor(config: WarpInitConfig);
539
- init(): Promise<void>;
540
- createWarpRegisterTransaction(txHash: string, alias?: string | null, brand?: string | null): Transaction$1;
541
- createWarpUnregisterTransaction(txHash: string): Transaction$1;
542
- createWarpUpgradeTransaction(alias: string, txHash: string): Transaction$1;
543
- createWarpAliasSetTransaction(txHash: string, alias: string): Transaction$1;
544
- createWarpVerifyTransaction(txHash: string): Transaction$1;
545
- createWarpTransferOwnershipTransaction(txHash: string, newOwner: string): Transaction$1;
546
- createBrandRegisterTransaction(txHash: string): Transaction$1;
547
- createWarpBrandingTransaction(warpHash: string, brandHash: string): Transaction$1;
548
- getInfoByAlias(alias: string, cache?: WarpCacheConfig): Promise<{
549
- registryInfo: WarpRegistryInfo | null;
550
- brand: Brand | null;
551
- }>;
552
- getInfoByHash(hash: string, cache?: WarpCacheConfig): Promise<{
553
- registryInfo: WarpRegistryInfo | null;
554
- brand: Brand | null;
937
+ declare class WarpClient {
938
+ private readonly config;
939
+ private adapters;
940
+ constructor(config: WarpClientConfig, adapters: Adapter[]);
941
+ getConfig(): WarpClientConfig;
942
+ getAdapters(): Adapter[];
943
+ addAdapter(adapter: Adapter): WarpClient;
944
+ createExecutor(handlers?: ExecutionHandlers): WarpExecutor;
945
+ detectWarp(urlOrId: string, cache?: WarpCacheConfig): Promise<DetectionResult>;
946
+ executeWarp(warpOrIdentifierOrUrl: string | Warp, inputs: string[], handlers?: ExecutionHandlers, params?: {
947
+ cache?: WarpCacheConfig;
948
+ queries?: Record<string, any>;
949
+ }): Promise<{
950
+ txs: WarpAdapterGenericTransaction[];
951
+ chain: WarpChainInfo | null;
952
+ immediateExecutions: WarpActionExecution[];
953
+ evaluateResults: (remoteTxs: WarpAdapterGenericRemoteTransaction[]) => Promise<void>;
555
954
  }>;
556
- getUserWarpRegistryInfos(user?: string): Promise<WarpRegistryInfo[]>;
557
- getUserBrands(user?: string): Promise<Brand[]>;
558
- getChainInfos(cache?: WarpCacheConfig): Promise<WarpChainInfo[]>;
559
- getChainInfo(chain: WarpChain, cache?: WarpCacheConfig): Promise<WarpChainInfo | null>;
560
- fetchBrand(hash: string, cache?: WarpCacheConfig): Promise<Brand | null>;
561
- getRegistryContractAddress(): Address$1;
562
- private loadRegistryConfigs;
563
- private getFactory;
564
- private getController;
565
- private isCurrentUserAdmin;
566
- }
567
-
568
- declare class WarpUtils {
569
- static getInfoFromPrefixedIdentifier(prefixedIdentifier: string): {
570
- type: WarpIdType;
571
- identifier: string;
572
- identifierBase: string;
573
- } | null;
574
- static getNextInfo(config: WarpInitConfig, warp: Warp, actionIndex: number, results: WarpExecutionResults): WarpExecutionNextInfo | null;
575
- private static buildNextUrl;
576
- private static getNestedValue;
577
- static getChainInfoForAction(config: WarpInitConfig, action: WarpAction): Promise<WarpChainInfo>;
578
- static getChainEntrypoint(chainInfo: WarpChainInfo, env: WarpChainEnv): NetworkEntrypoint;
955
+ createInscriptionTransaction(chain: WarpChain, warp: Warp): WarpAdapterGenericTransaction;
956
+ createFromTransaction(chain: WarpChain, tx: WarpAdapterGenericRemoteTransaction, validate?: boolean): Promise<Warp>;
957
+ createFromTransactionHash(hash: string, cache?: WarpCacheConfig): Promise<Warp | null>;
958
+ signMessage(chain: WarpChain, message: string): Promise<string>;
959
+ getActions(chain: WarpChain, ids: string[], awaitCompleted?: boolean): Promise<WarpChainAction[]>;
960
+ getExplorer(chain: WarpChain): AdapterWarpExplorer;
961
+ getResults(chain: WarpChain): AdapterWarpResults;
962
+ getRegistry(chain: WarpChain): Promise<AdapterWarpRegistry>;
963
+ getDataLoader(chain: WarpChain): AdapterWarpDataLoader;
964
+ getWallet(chain: WarpChain): AdapterWarpWallet;
965
+ get factory(): WarpFactory;
966
+ get index(): WarpIndex;
967
+ get linkBuilder(): WarpLinkBuilder;
968
+ createBuilder(chain: WarpChain): CombinedWarpBuilder;
969
+ createAbiBuilder(chain: WarpChain): AdapterWarpAbiBuilder;
970
+ createBrandBuilder(chain: WarpChain): AdapterWarpBrandBuilder;
971
+ createSerializer(chain: WarpChain): AdapterWarpSerializer;
972
+ resolveText(warpText: WarpText): string;
973
+ }
974
+
975
+ declare class WarpInterpolator {
976
+ private config;
977
+ private adapter;
978
+ constructor(config: WarpClientConfig, adapter: Adapter);
979
+ apply(config: WarpClientConfig, warp: Warp, meta?: {
980
+ envs?: Record<string, any>;
981
+ queries?: Record<string, any>;
982
+ }): Promise<Warp>;
983
+ applyGlobals(config: WarpClientConfig, warp: Warp): Promise<Warp>;
984
+ applyVars(config: WarpClientConfig, warp: Warp, meta?: {
985
+ envs?: Record<string, any>;
986
+ queries?: Record<string, any>;
987
+ }): Warp;
988
+ private applyRootGlobals;
989
+ private applyActionGlobals;
990
+ }
991
+
992
+ declare class WarpLogger {
993
+ private static isTestEnv;
994
+ static debug(...args: any[]): void;
995
+ static info(...args: any[]): void;
996
+ static warn(...args: any[]): void;
997
+ static error(...args: any[]): void;
998
+ }
999
+
1000
+ declare class WarpTypeRegistry implements AdapterTypeRegistry {
1001
+ private typeHandlers;
1002
+ private typeAliases;
1003
+ registerType(typeName: string, handler: WarpTypeHandler): void;
1004
+ registerTypeAlias(typeName: string, alias: string): void;
1005
+ hasType(typeName: string): boolean;
1006
+ getHandler(typeName: string): WarpTypeHandler | undefined;
1007
+ getAlias(typeName: string): string | undefined;
1008
+ resolveType(typeName: string): string;
1009
+ getRegisteredTypes(): string[];
579
1010
  }
580
1011
 
581
1012
  type ValidationResult = {
@@ -585,12 +1016,13 @@ type ValidationResult = {
585
1016
  type ValidationError = string;
586
1017
  declare class WarpValidator {
587
1018
  private config;
588
- constructor(config: WarpInitConfig);
1019
+ constructor(config: WarpClientConfig);
589
1020
  validate(warp: Warp): Promise<ValidationResult>;
1021
+ private validatePrimaryAction;
590
1022
  private validateMaxOneValuePosition;
591
1023
  private validateVariableNamesAndResultNamesUppercase;
592
1024
  private validateAbiIsSetIfApplicable;
593
1025
  private validateSchema;
594
1026
  }
595
1027
 
596
- export { type BaseWarpActionInputType, type Brand, BrandBuilder, type BrandColors, type BrandCta, type BrandMeta, type BrandUrls, CacheKey, CacheTtl, type CacheType, type InterpolationBag, type ProtocolName, type ResolvedInput, type Warp, WarpAbiBuilder, type WarpAbiContents, type WarpAction, WarpActionExecutor, type WarpActionInput, type WarpActionInputModifier, type WarpActionInputPosition, type WarpActionInputSource, type WarpActionInputType, type WarpActionType, WarpArgSerializer, WarpBuilder, WarpCache, type WarpCacheConfig, type WarpChain, type WarpChainEnv, type WarpChainInfo, type WarpCollectAction, WarpConfig, WarpConstants, type WarpContract, type WarpContractAction, type WarpContractActionTransfer, WarpContractLoader, type WarpContractVerification, type WarpExecution, type WarpExecutionMessages, type WarpExecutionNextInfo, type WarpExecutionResults, type WarpIdType, WarpIndex, type WarpInitConfig, WarpInterpolator, WarpLink, type WarpLinkAction, type WarpMessageName, type WarpMeta, type WarpNativeValue, WarpProtocolVersions, type WarpQueryAction, WarpRegistry, type WarpRegistryConfigInfo, type WarpRegistryInfo, type WarpResultName, type WarpResulutionPath, type WarpSearchHit, type WarpSearchResult, type WarpTransferAction, type WarpTrustStatus, WarpUtils, WarpValidator, type WarpVarPlaceholder, type WarpWarpAbi, address, biguint, boolean, codemeta, composite, esdt, getChainExplorerUrl, getLatestProtocolIdentifier, getMainChainInfo, getWarpActionByIndex, hex, list, nothing, option, optional, replacePlaceholders, shiftBigintBy, string, toPreviewText, toTypedChainInfo, token, u16, u32, u64, u8, variadic };
1028
+ export { type Adapter, type AdapterFactory, type AdapterTypeRegistry, type AdapterWarpAbiBuilder, type AdapterWarpBrandBuilder, type AdapterWarpBuilder, type AdapterWarpDataLoader, type AdapterWarpExecutor, type AdapterWarpExplorer, type AdapterWarpRegistry, type AdapterWarpResults, type AdapterWarpSerializer, type AdapterWarpWallet, type BaseWarpActionInputType, type BaseWarpBuilder, BrowserCryptoProvider, CacheTtl, 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, type Warp, type WarpAbi, type WarpAbiContents, type WarpAction, type WarpActionExecution, type WarpActionIndex, type WarpActionInput, type WarpActionInputModifier, type WarpActionInputPosition, type WarpActionInputSource, type WarpActionInputType, type WarpActionType, type WarpAdapterGenericRemoteTransaction, type WarpAdapterGenericTransaction, type WarpAdapterGenericType, type WarpAdapterGenericValue, type WarpBrand, WarpBrandBuilder, type WarpBrandColors, type WarpBrandCta, type WarpBrandUrls, WarpBuilder, WarpCache, type WarpCacheConfig, WarpCacheKey, type WarpChain, type WarpChainAccount, type WarpChainAction, type WarpChainActionStatus, type WarpChainAsset, type WarpChainAssetValue, type WarpChainEnv, type WarpChainInfo, WarpChainName, WarpClient, type WarpClientConfig, type WarpCollectAction, WarpConfig, WarpConstants, type WarpContract, type WarpContractAction, type WarpContractVerification, type WarpDataLoaderOptions, type WarpExecutable, type WarpExecutionMessages, type WarpExecutionNextInfo, type WarpExecutionResults, WarpExecutor, type WarpExplorerName, WarpFactory, type WarpI18nText, type WarpIdType, WarpIndex, WarpInputTypes, WarpInterpolator, type WarpLanguage, type WarpLinkAction, WarpLinkBuilder, WarpLinkDetecter, WarpLogger, type WarpMessageName, type WarpMeta, type WarpNativeValue, WarpProtocolVersions, type WarpProviderConfig, type WarpQueryAction, type WarpRegistryConfigInfo, type WarpRegistryInfo, type WarpResultName, type WarpResulutionPath, type WarpSearchHit, type WarpSearchResult, type WarpSecret, WarpSerializer, type WarpStructValue, type WarpText, type WarpTransferAction, type WarpTrustStatus, type WarpTypeHandler, WarpTypeRegistry, type WarpUserWallets, WarpValidator, type WarpVarPlaceholder, type WarpWalletDetails, address, applyResultsToMessages, asset, biguint, bool, buildNestedPayload, bytesToBase64, bytesToHex, createAuthHeaders, createAuthMessage, createCryptoProvider, createHttpAuthHeaders, createSignableMessage, createWarpI18nText, evaluateResultsCommon, extractCollectResults, extractIdentifierInfoFromUrl, extractWarpSecrets, findWarpAdapterByPrefix, findWarpAdapterForChain, getCryptoProvider, getLatestProtocolIdentifier, getNextInfo, getProviderConfig, getProviderUrl, getRandomBytes, getRandomHex, getWarpActionByIndex, getWarpInfoFromIdentifier, getWarpPrimaryAction, getWarpWalletAddress, getWarpWalletAddressFromConfig, getWarpWalletMnemonic, getWarpWalletMnemonicFromConfig, getWarpWalletPrivateKey, getWarpWalletPrivateKeyFromConfig, hasInputPrefix, hex, isWarpActionAutoExecute, isWarpI18nText, mergeNestedPayload, option, parseResultsOutIndex, parseSignedMessage, replacePlaceholders, resolveWarpText, safeWindow, setCryptoProvider, shiftBigintBy, splitInput, string, struct, testCryptoAvailability, toPreviewText, tuple, uint16, uint32, uint64, uint8, validateSignedMessage, vector };