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