@vleap/warps 3.0.0-alpha.15 → 3.0.0-alpha.151

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