@vleap/warps 3.0.0-alpha.25 → 3.0.0-alpha.27
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/WarpInterpolator-KC2E52JI.mjs +1 -0
- package/dist/WarpUtils-KXHUMJ3D.mjs +1 -0
- package/dist/chunk-FW52KEUA.mjs +1 -0
- package/dist/chunk-SD7PGGEZ.mjs +1 -0
- package/dist/index.d.mts +31 -524
- package/dist/index.d.ts +31 -524
- package/dist/index.js +66 -12
- package/dist/index.mjs +66 -2
- package/package.json +5 -10
- package/dist/chunk-3SAEGOMQ.mjs +0 -1
- package/dist/vm-JCVDACTR.mjs +0 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-FW52KEUA.mjs";import"./chunk-SD7PGGEZ.mjs";export{a as WarpInterpolator};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as a}from"./chunk-SD7PGGEZ.mjs";export{a as WarpUtils};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as l}from"./chunk-SD7PGGEZ.mjs";import{getMainChainInfo as f,WarpConstants as o}from"@vleap/warps-core";var c=class{static async apply(t,i){let a=this.applyVars(t,i);return await this.applyGlobals(t,a)}static async applyGlobals(t,i){let a={...i};return a.actions=await Promise.all(a.actions.map(async s=>await this.applyActionGlobals(t,s))),a=await this.applyRootGlobals(a,t),a}static applyVars(t,i){if(!i?.vars)return i;let a=JSON.stringify(i),s=(e,r)=>{a=a.replace(new RegExp(`{{${e.toUpperCase()}}}`,"g"),r.toString())};return Object.entries(i.vars).forEach(([e,r])=>{if(typeof r!="string")s(e,r);else if(r.startsWith(`${o.Vars.Query}:`)){if(!t.currentUrl)throw new Error("WarpUtils: currentUrl config is required to prepare vars");let n=r.split(`${o.Vars.Query}:`)[1],p=new URLSearchParams(t.currentUrl.split("?")[1]).get(n);p&&s(e,p)}else if(r.startsWith(`${o.Vars.Env}:`)){let n=r.split(`${o.Vars.Env}:`)[1],p=t.vars?.[n];p&&s(e,p)}else r===o.Source.UserWallet&&t.user?.wallet?s(e,t.user.wallet):s(e,r)}),JSON.parse(a)}static async applyRootGlobals(t,i){let a=JSON.stringify(t),s={config:i,chain:f(i)};return Object.values(o.Globals).forEach(e=>{let r=e.Accessor(s);r!=null&&(a=a.replace(new RegExp(`{{${e.Placeholder}}}`,"g"),r.toString()))}),JSON.parse(a)}static async applyActionGlobals(t,i){let a=await l.getChainInfoForAction(t,i),s=JSON.stringify(i),e={config:t,chain:a};return Object.values(o.Globals).forEach(r=>{let n=r.Accessor(e);n!=null&&(s=s.replace(new RegExp(`{{${r.Placeholder}}}`,"g"),n.toString()))}),JSON.parse(s)}};export{c as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var I=Object.create;var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var v=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(n,r)=>(typeof require<"u"?require:n)[r]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')}),x=i=>n=>{var r=i[n];if(r)return r();throw new Error("Module not found in bundle: "+n)};var F=(i,n)=>()=>(i&&(n=i(i=0)),n);var P=(i,n)=>()=>(n||i((n={exports:{}}).exports,n),n.exports),z=(i,n)=>{for(var r in n)o(i,r,{get:n[r],enumerable:!0})},h=(i,n,r,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of W(n))!l.call(i,t)&&t!==r&&o(i,t,{get:()=>n[t],enumerable:!(a=u(n,t))||a.enumerable});return i};var E=(i,n,r)=>(r=i!=null?I(g(i)):{},h(n||!i||!i.__esModule?o(r,"default",{value:i,enumerable:!0}):r,i)),D=i=>h(o({},"__esModule",{value:!0}),i);import{WarpMultiversxRegistry as p}from"@vleap/warps-adapter-multiversx";import{getMainChainInfo as w,WarpSerializer as m,CacheTtl as y}from"@vleap/warps-core";var c=class{static async getChainInfoForAction(n,r,a){if(a){let t=await this.tryGetChainFromInputs(n,r,a);if(t)return t}return this.getDefaultChainInfo(n,r)}static async tryGetChainFromInputs(n,r,a){let t=r.inputs?.findIndex(C=>C.position==="chain");if(t===-1||t===void 0)return null;let e=a[t];if(!e)throw new Error("WarpUtils: Chain input not found");let s=new m().stringToNative(e)[1],f=await new p(n).getChainInfo(s);if(!f)throw new Error(`WarpUtils: Chain info not found for ${s}`);return f}static async getDefaultChainInfo(n,r){if(!r.chain)return w(n);let t=await new p(n).getChainInfo(r.chain,{ttl:y.OneWeek});if(!t)throw new Error(`WarpUtils: Chain info not found for ${r.chain}`);return t}};export{v as a,x as b,F as c,P as d,z as e,E as f,D as g,c as h};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,297 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
declare const CacheTtl: {
|
|
6
|
-
OneMinute: number;
|
|
7
|
-
OneHour: number;
|
|
8
|
-
OneDay: number;
|
|
9
|
-
OneWeek: number;
|
|
10
|
-
OneMonth: number;
|
|
11
|
-
OneYear: number;
|
|
12
|
-
};
|
|
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;
|
|
21
|
-
};
|
|
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
|
-
}
|
|
32
|
-
|
|
33
|
-
type WarpChainEnv = 'mainnet' | 'testnet' | 'devnet';
|
|
34
|
-
type ProtocolName = 'warp' | 'brand' | 'abi';
|
|
35
|
-
|
|
36
|
-
type WarpChain = string;
|
|
37
|
-
type WarpInitConfig = {
|
|
38
|
-
env: WarpChainEnv;
|
|
39
|
-
clientUrl?: string;
|
|
40
|
-
currentUrl?: string;
|
|
41
|
-
vars?: Record<string, string | number>;
|
|
42
|
-
user?: {
|
|
43
|
-
wallet?: string;
|
|
44
|
-
};
|
|
45
|
-
schema?: {
|
|
46
|
-
warp?: string;
|
|
47
|
-
brand?: string;
|
|
48
|
-
};
|
|
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;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
type WarpCacheConfig = {
|
|
63
|
-
ttl?: number;
|
|
64
|
-
};
|
|
65
|
-
type WarpChainInfo = {
|
|
66
|
-
name: WarpChain;
|
|
67
|
-
displayName: string;
|
|
68
|
-
chainId: string;
|
|
69
|
-
blockTime: number;
|
|
70
|
-
addressHrp: string;
|
|
71
|
-
apiUrl: string;
|
|
72
|
-
explorerUrl: string;
|
|
73
|
-
nativeToken: string;
|
|
74
|
-
};
|
|
75
|
-
type WarpIdType = 'hash' | 'alias';
|
|
76
|
-
type WarpVarPlaceholder = string;
|
|
77
|
-
type WarpResultName = string;
|
|
78
|
-
type WarpResulutionPath = string;
|
|
79
|
-
type WarpMessageName = string;
|
|
80
|
-
type Warp = {
|
|
81
|
-
protocol: string;
|
|
82
|
-
name: string;
|
|
83
|
-
title: string;
|
|
84
|
-
description: string | null;
|
|
85
|
-
bot?: string;
|
|
86
|
-
preview?: string;
|
|
87
|
-
vars?: Record<WarpVarPlaceholder, string>;
|
|
88
|
-
actions: WarpAction[];
|
|
89
|
-
next?: string;
|
|
90
|
-
results?: Record<WarpResultName, WarpResulutionPath>;
|
|
91
|
-
messages?: Record<WarpMessageName, string>;
|
|
92
|
-
meta?: WarpMeta;
|
|
93
|
-
};
|
|
94
|
-
type WarpMeta = {
|
|
95
|
-
hash: string;
|
|
96
|
-
creator: string;
|
|
97
|
-
createdAt: string;
|
|
98
|
-
};
|
|
99
|
-
type WarpAction = WarpTransferAction | WarpContractAction | WarpQueryAction | WarpCollectAction | WarpLinkAction;
|
|
100
|
-
type WarpActionType = 'transfer' | 'contract' | 'query' | 'collect' | 'link';
|
|
101
|
-
type WarpTransferAction = {
|
|
102
|
-
type: WarpActionType;
|
|
103
|
-
chain?: WarpChain;
|
|
104
|
-
label: string;
|
|
105
|
-
description?: string | null;
|
|
106
|
-
address?: string;
|
|
107
|
-
data?: string;
|
|
108
|
-
value?: string;
|
|
109
|
-
transfers?: WarpContractActionTransfer[];
|
|
110
|
-
inputs?: WarpActionInput[];
|
|
111
|
-
next?: string;
|
|
112
|
-
};
|
|
113
|
-
type WarpContractAction = {
|
|
114
|
-
type: WarpActionType;
|
|
115
|
-
chain?: WarpChain;
|
|
116
|
-
label: string;
|
|
117
|
-
description?: string | null;
|
|
118
|
-
address: string;
|
|
119
|
-
func: string | null;
|
|
120
|
-
args: string[];
|
|
121
|
-
value?: string;
|
|
122
|
-
gasLimit: number;
|
|
123
|
-
transfers?: WarpContractActionTransfer[];
|
|
124
|
-
abi?: string;
|
|
125
|
-
inputs?: WarpActionInput[];
|
|
126
|
-
next?: string;
|
|
127
|
-
};
|
|
128
|
-
type WarpContractActionTransfer = {
|
|
129
|
-
token: string;
|
|
130
|
-
nonce?: number;
|
|
131
|
-
amount?: string;
|
|
132
|
-
};
|
|
133
|
-
type WarpQueryAction = {
|
|
134
|
-
type: WarpActionType;
|
|
135
|
-
chain?: WarpChain;
|
|
136
|
-
label: string;
|
|
137
|
-
description?: string | null;
|
|
138
|
-
address: string;
|
|
139
|
-
func: string;
|
|
140
|
-
args: string[];
|
|
141
|
-
abi?: string;
|
|
142
|
-
inputs?: WarpActionInput[];
|
|
143
|
-
next?: string;
|
|
144
|
-
};
|
|
145
|
-
type WarpCollectAction = {
|
|
146
|
-
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
|
-
};
|
|
155
|
-
inputs?: WarpActionInput[];
|
|
156
|
-
next?: string;
|
|
157
|
-
};
|
|
158
|
-
type WarpLinkAction = {
|
|
159
|
-
type: WarpActionType;
|
|
160
|
-
chain?: WarpChain;
|
|
161
|
-
label: string;
|
|
162
|
-
description?: string | null;
|
|
163
|
-
url: string;
|
|
164
|
-
inputs?: WarpActionInput[];
|
|
165
|
-
};
|
|
166
|
-
type WarpActionInputSource = 'field' | 'query' | 'user:wallet';
|
|
167
|
-
type BaseWarpActionInputType = 'string' | 'uint8' | 'uint16' | 'uint32' | 'uint64' | 'biguint' | 'bool' | 'address' | 'token' | 'codemeta' | 'hex' | 'esdt' | 'nft';
|
|
168
|
-
type WarpActionInputType = string;
|
|
169
|
-
type WarpActionInputPosition = 'receiver' | 'value' | 'transfer' | `arg:${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10}` | 'data' | 'chain';
|
|
170
|
-
type WarpActionInputModifier = 'scale';
|
|
171
|
-
type WarpActionInput = {
|
|
172
|
-
name: string;
|
|
173
|
-
as?: string;
|
|
174
|
-
description?: string | null;
|
|
175
|
-
bot?: string;
|
|
176
|
-
type: WarpActionInputType;
|
|
177
|
-
position?: WarpActionInputPosition;
|
|
178
|
-
source: WarpActionInputSource;
|
|
179
|
-
required?: boolean;
|
|
180
|
-
min?: number | WarpVarPlaceholder;
|
|
181
|
-
max?: number | WarpVarPlaceholder;
|
|
182
|
-
pattern?: string;
|
|
183
|
-
patternDescription?: string;
|
|
184
|
-
options?: string[] | {
|
|
185
|
-
[key: string]: string;
|
|
186
|
-
};
|
|
187
|
-
modifier?: string;
|
|
188
|
-
default?: string | number | boolean;
|
|
189
|
-
};
|
|
190
|
-
type ResolvedInput = {
|
|
191
|
-
input: WarpActionInput;
|
|
192
|
-
value: string | null;
|
|
193
|
-
};
|
|
194
|
-
type WarpContract = {
|
|
195
|
-
address: string;
|
|
196
|
-
owner: string;
|
|
197
|
-
verified: boolean;
|
|
198
|
-
};
|
|
199
|
-
type WarpContractVerification = {
|
|
200
|
-
codeHash: string;
|
|
201
|
-
abi: object;
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
type WarpWarpAbi = {
|
|
205
|
-
protocol: string;
|
|
206
|
-
content: WarpAbiContents;
|
|
207
|
-
meta?: WarpMeta;
|
|
208
|
-
};
|
|
209
|
-
type WarpAbiContents = {
|
|
210
|
-
name?: string;
|
|
211
|
-
constructor?: any;
|
|
212
|
-
upgradeConstructor?: any;
|
|
213
|
-
endpoints?: any[];
|
|
214
|
-
types?: Record<string, any>;
|
|
215
|
-
events?: any[];
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
type Brand = {
|
|
219
|
-
protocol: string;
|
|
220
|
-
name: string;
|
|
221
|
-
description: string;
|
|
222
|
-
logo: string;
|
|
223
|
-
urls?: BrandUrls;
|
|
224
|
-
colors?: BrandColors;
|
|
225
|
-
cta?: BrandCta;
|
|
226
|
-
meta?: BrandMeta;
|
|
227
|
-
};
|
|
228
|
-
type BrandUrls = {
|
|
229
|
-
web?: string;
|
|
230
|
-
};
|
|
231
|
-
type BrandColors = {
|
|
232
|
-
primary?: string;
|
|
233
|
-
secondary?: string;
|
|
234
|
-
};
|
|
235
|
-
type BrandCta = {
|
|
236
|
-
title: string;
|
|
237
|
-
description: string;
|
|
238
|
-
label: string;
|
|
239
|
-
url: string;
|
|
240
|
-
};
|
|
241
|
-
type BrandMeta = {
|
|
242
|
-
hash: string;
|
|
243
|
-
creator: string;
|
|
244
|
-
createdAt: string;
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
type WarpTrustStatus = 'unverified' | 'verified' | 'blacklisted';
|
|
248
|
-
type WarpRegistryInfo = {
|
|
249
|
-
hash: string;
|
|
250
|
-
alias: string | null;
|
|
251
|
-
trust: WarpTrustStatus;
|
|
252
|
-
owner: string;
|
|
253
|
-
createdAt: number;
|
|
254
|
-
upgradedAt: number;
|
|
255
|
-
brand: string | null;
|
|
256
|
-
upgrade: string | null;
|
|
257
|
-
};
|
|
258
|
-
type WarpRegistryConfigInfo = {
|
|
259
|
-
unitPrice: bigint;
|
|
260
|
-
admins: string[];
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
type WarpExecution = {
|
|
264
|
-
success: boolean;
|
|
265
|
-
warp: Warp;
|
|
266
|
-
action: number;
|
|
267
|
-
user: string | null;
|
|
268
|
-
txHash: string | null;
|
|
269
|
-
next: WarpExecutionNextInfo | null;
|
|
270
|
-
values: any[];
|
|
271
|
-
results: WarpExecutionResults;
|
|
272
|
-
messages: WarpExecutionMessages;
|
|
273
|
-
};
|
|
274
|
-
type WarpExecutionNextInfo = {
|
|
275
|
-
identifier: string | null;
|
|
276
|
-
url: string;
|
|
277
|
-
}[];
|
|
278
|
-
type WarpExecutionResults = Record<WarpResultName, any | null>;
|
|
279
|
-
type WarpExecutionMessages = Record<WarpMessageName, string | null>;
|
|
280
|
-
|
|
281
|
-
type WarpSearchResult = {
|
|
282
|
-
hits: WarpSearchHit[];
|
|
283
|
-
};
|
|
284
|
-
type WarpSearchHit = {
|
|
285
|
-
hash: string;
|
|
286
|
-
alias: string;
|
|
287
|
-
name: string;
|
|
288
|
-
title: string;
|
|
289
|
-
description: string;
|
|
290
|
-
preview: string;
|
|
291
|
-
status: string;
|
|
292
|
-
category: string;
|
|
293
|
-
featured: boolean;
|
|
294
|
-
};
|
|
1
|
+
import { WarpInitConfig, Brand, WarpAbi, Warp, WarpCacheConfig, WarpAction, WarpActionIndex, WarpChainInfo, WarpExecutionResults, WarpExecutable, ResolvedInput, WarpRegistryInfo } from '@vleap/warps-core';
|
|
2
|
+
export * from '@vleap/warps-core';
|
|
3
|
+
import { Transaction, TransactionOnNetwork } from '@multiversx/sdk-core';
|
|
4
|
+
import { BrandUrls, BrandColors, BrandCta } from '@vleap/warps-core/src/types';
|
|
295
5
|
|
|
296
6
|
declare class BrandBuilder {
|
|
297
7
|
private config;
|
|
@@ -312,168 +22,12 @@ declare class BrandBuilder {
|
|
|
312
22
|
private ensureValidSchema;
|
|
313
23
|
}
|
|
314
24
|
|
|
315
|
-
declare const WarpProtocolVersions: {
|
|
316
|
-
Warp: string;
|
|
317
|
-
Brand: string;
|
|
318
|
-
Abi: string;
|
|
319
|
-
};
|
|
320
|
-
declare const WarpConfig: {
|
|
321
|
-
LatestWarpSchemaUrl: string;
|
|
322
|
-
LatestBrandSchemaUrl: string;
|
|
323
|
-
DefaultClientUrl: (env: WarpChainEnv) => "https://usewarp.to" | "https://testnet.usewarp.to" | "https://devnet.usewarp.to";
|
|
324
|
-
SuperClientUrls: string[];
|
|
325
|
-
MainChain: {
|
|
326
|
-
Name: string;
|
|
327
|
-
DisplayName: string;
|
|
328
|
-
ApiUrl: (env: WarpChainEnv) => "https://devnet-api.multiversx.com" | "https://testnet-api.multiversx.com" | "https://api.multiversx.com";
|
|
329
|
-
ExplorerUrl: (env: WarpChainEnv) => "https://devnet-explorer.multiversx.com" | "https://testnet-explorer.multiversx.com" | "https://explorer.multiversx.com";
|
|
330
|
-
BlockTime: (env: WarpChainEnv) => number;
|
|
331
|
-
AddressHrp: string;
|
|
332
|
-
ChainId: (env: WarpChainEnv) => "D" | "T" | "1";
|
|
333
|
-
NativeToken: string;
|
|
334
|
-
};
|
|
335
|
-
Registry: {
|
|
336
|
-
Contract: (env: WarpChainEnv) => "erd1qqqqqqqqqqqqqpgqje2f99vr6r7sk54thg03c9suzcvwr4nfl3tsfkdl36" | "####" | "erd1qqqqqqqqqqqqqpgq3mrpj3u6q7tejv6d7eqhnyd27n9v5c5tl3ts08mffe";
|
|
337
|
-
};
|
|
338
|
-
AvailableActionInputSources: WarpActionInputSource[];
|
|
339
|
-
AvailableActionInputTypes: WarpActionInputType[];
|
|
340
|
-
AvailableActionInputPositions: WarpActionInputPosition[];
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
type InterpolationBag = {
|
|
344
|
-
config: WarpInitConfig;
|
|
345
|
-
chain: WarpChainInfo;
|
|
346
|
-
};
|
|
347
|
-
declare class WarpInterpolator {
|
|
348
|
-
static apply(config: WarpInitConfig, warp: Warp): Promise<Warp>;
|
|
349
|
-
static applyGlobals(config: WarpInitConfig, warp: Warp): Promise<Warp>;
|
|
350
|
-
static applyVars(config: WarpInitConfig, warp: Warp): Warp;
|
|
351
|
-
private static applyRootGlobals;
|
|
352
|
-
private static applyActionGlobals;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
declare const WarpConstants: {
|
|
356
|
-
HttpProtocolPrefix: string;
|
|
357
|
-
IdentifierParamName: string;
|
|
358
|
-
IdentifierParamSeparator: string;
|
|
359
|
-
IdentifierType: {
|
|
360
|
-
Alias: WarpIdType;
|
|
361
|
-
Hash: WarpIdType;
|
|
362
|
-
};
|
|
363
|
-
Source: {
|
|
364
|
-
UserWallet: string;
|
|
365
|
-
};
|
|
366
|
-
Globals: {
|
|
367
|
-
UserWallet: {
|
|
368
|
-
Placeholder: string;
|
|
369
|
-
Accessor: (bag: InterpolationBag) => string | undefined;
|
|
370
|
-
};
|
|
371
|
-
ChainApiUrl: {
|
|
372
|
-
Placeholder: string;
|
|
373
|
-
Accessor: (bag: InterpolationBag) => string;
|
|
374
|
-
};
|
|
375
|
-
ChainExplorerUrl: {
|
|
376
|
-
Placeholder: string;
|
|
377
|
-
Accessor: (bag: InterpolationBag) => string;
|
|
378
|
-
};
|
|
379
|
-
};
|
|
380
|
-
Vars: {
|
|
381
|
-
Query: string;
|
|
382
|
-
Env: string;
|
|
383
|
-
};
|
|
384
|
-
ArgParamsSeparator: string;
|
|
385
|
-
ArgCompositeSeparator: string;
|
|
386
|
-
Transform: {
|
|
387
|
-
Prefix: string;
|
|
388
|
-
};
|
|
389
|
-
Egld: {
|
|
390
|
-
Identifier: string;
|
|
391
|
-
EsdtIdentifier: string;
|
|
392
|
-
DisplayName: string;
|
|
393
|
-
Decimals: number;
|
|
394
|
-
};
|
|
395
|
-
};
|
|
396
|
-
|
|
397
|
-
declare const getMainChainInfo: (config: WarpInitConfig) => WarpChainInfo;
|
|
398
|
-
declare const getChainExplorerUrl: (chain: WarpChainInfo, path?: string) => string;
|
|
399
|
-
declare const getLatestProtocolIdentifier: (name: ProtocolName) => string;
|
|
400
|
-
declare const getWarpActionByIndex: (warp: Warp, index: number) => WarpAction;
|
|
401
|
-
declare const toTypedChainInfo: (chainInfo: any) => WarpChainInfo;
|
|
402
|
-
declare const shiftBigintBy: (value: bigint | string, decimals: number) => bigint;
|
|
403
|
-
declare const toPreviewText: (text: string, maxChars?: number) => string;
|
|
404
|
-
declare const replacePlaceholders: (message: string, bag: Record<string, any>) => string;
|
|
405
|
-
|
|
406
|
-
declare const option: (value: TypedValue | null, type?: Type) => OptionValue;
|
|
407
|
-
declare const optional: (value: TypedValue | null, type?: Type) => OptionalValue;
|
|
408
|
-
declare const list: (values: TypedValue[]) => List;
|
|
409
|
-
declare const variadic: (values: TypedValue[]) => VariadicValue;
|
|
410
|
-
declare const composite: (values: TypedValue[]) => CompositeValue;
|
|
411
|
-
declare const string: (value: string) => StringValue;
|
|
412
|
-
declare const u8: (value: number) => U8Value;
|
|
413
|
-
declare const u16: (value: number) => U16Value;
|
|
414
|
-
declare const u32: (value: number) => U32Value;
|
|
415
|
-
declare const u64: (value: bigint) => U64Value;
|
|
416
|
-
declare const biguint: (value: bigint | string | number) => BigUIntValue;
|
|
417
|
-
declare const boolean: (value: boolean) => BooleanValue;
|
|
418
|
-
declare const address: (value: string) => AddressValue;
|
|
419
|
-
declare const token: (value: string) => TokenIdentifierValue;
|
|
420
|
-
declare const hex: (value: string) => BytesValue;
|
|
421
|
-
declare const esdt: (value: TokenTransfer) => Struct;
|
|
422
|
-
declare const codemeta: (hexString: string) => CodeMetadataValue;
|
|
423
|
-
declare const nothing: () => NothingValue;
|
|
424
|
-
|
|
425
25
|
declare class WarpAbiBuilder {
|
|
426
26
|
private config;
|
|
427
27
|
private cache;
|
|
428
28
|
constructor(config: WarpInitConfig);
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
createFromTransaction(tx: TransactionOnNetwork): Promise<WarpWarpAbi>;
|
|
432
|
-
createFromTransactionHash(hash: string, cache?: WarpCacheConfig): Promise<WarpWarpAbi | null>;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
type TxComponents = {
|
|
436
|
-
chain: WarpChainInfo;
|
|
437
|
-
destination: Address;
|
|
438
|
-
args: string[];
|
|
439
|
-
value: bigint;
|
|
440
|
-
transfers: TokenTransfer$1[];
|
|
441
|
-
data: Buffer | null;
|
|
442
|
-
resolvedInputs: ResolvedInput[];
|
|
443
|
-
};
|
|
444
|
-
declare class WarpActionExecutor {
|
|
445
|
-
private config;
|
|
446
|
-
private url;
|
|
447
|
-
private serializer;
|
|
448
|
-
private contractLoader;
|
|
449
|
-
private cache;
|
|
450
|
-
private registry;
|
|
451
|
-
constructor(config: WarpInitConfig);
|
|
452
|
-
createTransactionForExecute(warp: Warp, actionIndex: number, inputs: string[]): Promise<Transaction>;
|
|
453
|
-
getTransactionExecutionResults(warp: Warp, actionIndex: number, tx: TransactionOnNetwork): Promise<WarpExecution>;
|
|
454
|
-
executeQuery(warp: Warp, actionIndex: number, inputs: string[]): Promise<WarpExecution>;
|
|
455
|
-
executeCollect(warp: Warp, actionIndex: number, inputs: string[], extra?: Record<string, any>): Promise<WarpExecution>;
|
|
456
|
-
getTxComponentsFromInputs(action: WarpTransferAction | WarpContractAction | WarpQueryAction, inputs: string[], sender?: Address): Promise<TxComponents>;
|
|
457
|
-
getResolvedInputs(chain: WarpChainInfo, action: WarpAction, inputArgs: string[]): Promise<ResolvedInput[]>;
|
|
458
|
-
getModifiedInputs(inputs: ResolvedInput[]): ResolvedInput[];
|
|
459
|
-
preprocessInput(chain: WarpChainInfo, input: string): Promise<string>;
|
|
460
|
-
getAbiForAction(action: WarpContractAction | WarpQueryAction): Promise<AbiRegistry>;
|
|
461
|
-
private getPreparedArgs;
|
|
462
|
-
private getPreparedMessages;
|
|
463
|
-
private fetchAbi;
|
|
464
|
-
private toTypedTransfer;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
type WarpNativeValue = string | number | bigint | boolean | null | TokenTransfer | WarpNativeValue[];
|
|
468
|
-
declare class WarpArgSerializer {
|
|
469
|
-
nativeToString(type: WarpActionInputType, value: WarpNativeValue): string;
|
|
470
|
-
typedToString(value: TypedValue): string;
|
|
471
|
-
typedToNative(value: TypedValue): [WarpActionInputType, WarpNativeValue];
|
|
472
|
-
nativeToTyped(type: WarpActionInputType, value: WarpNativeValue): TypedValue;
|
|
473
|
-
nativeToType(type: BaseWarpActionInputType): Type;
|
|
474
|
-
stringToNative(value: string): [WarpActionInputType, WarpNativeValue];
|
|
475
|
-
stringToTyped(value: string): TypedValue;
|
|
476
|
-
typeToString(type: Type): WarpActionInputType;
|
|
29
|
+
createFromRaw(encoded: string): Promise<WarpAbi>;
|
|
30
|
+
createFromTransaction(tx: TransactionOnNetwork): Promise<WarpAbi>;
|
|
477
31
|
}
|
|
478
32
|
|
|
479
33
|
declare class WarpBuilder {
|
|
@@ -497,17 +51,34 @@ declare class WarpBuilder {
|
|
|
497
51
|
private validate;
|
|
498
52
|
}
|
|
499
53
|
|
|
500
|
-
|
|
501
|
-
|
|
54
|
+
type WarpAdapterTransaction = any;
|
|
55
|
+
declare class WarpExecutor {
|
|
56
|
+
private config;
|
|
57
|
+
private factory;
|
|
502
58
|
constructor(config: WarpInitConfig);
|
|
503
|
-
|
|
504
|
-
|
|
59
|
+
execute(warp: Warp, action: WarpActionIndex, inputs: string[]): Promise<[WarpAdapterTransaction, WarpChainInfo]>;
|
|
60
|
+
executeCollect(warp: Warp, action: WarpActionIndex, inputs: string[], extra?: Record<string, any>): Promise<WarpExecutionResults>;
|
|
505
61
|
}
|
|
506
62
|
|
|
507
|
-
declare class
|
|
63
|
+
declare class WarpFactory {
|
|
508
64
|
private config;
|
|
65
|
+
private url;
|
|
66
|
+
private serializer;
|
|
67
|
+
private cache;
|
|
509
68
|
constructor(config: WarpInitConfig);
|
|
510
|
-
|
|
69
|
+
createExecutable(warp: Warp, actionIndex: number, inputs: string[]): Promise<WarpExecutable>;
|
|
70
|
+
getResolvedInputs(chain: WarpChainInfo, action: WarpAction, inputArgs: string[]): Promise<ResolvedInput[]>;
|
|
71
|
+
getModifiedInputs(inputs: ResolvedInput[]): ResolvedInput[];
|
|
72
|
+
preprocessInput(chain: WarpChainInfo, input: string): Promise<string>;
|
|
73
|
+
private getPreparedArgs;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
declare class WarpInterpolator {
|
|
77
|
+
static apply(config: WarpInitConfig, warp: Warp): Promise<Warp>;
|
|
78
|
+
static applyGlobals(config: WarpInitConfig, warp: Warp): Promise<Warp>;
|
|
79
|
+
static applyVars(config: WarpInitConfig, warp: Warp): Warp;
|
|
80
|
+
private static applyRootGlobals;
|
|
81
|
+
private static applyActionGlobals;
|
|
511
82
|
}
|
|
512
83
|
|
|
513
84
|
type DetectionResult = {
|
|
@@ -524,82 +95,18 @@ type DetectionResultFromHtml = {
|
|
|
524
95
|
warp: Warp;
|
|
525
96
|
}[];
|
|
526
97
|
};
|
|
527
|
-
declare class
|
|
98
|
+
declare class WarpLinkDetecter {
|
|
528
99
|
private config;
|
|
529
100
|
constructor(config: WarpInitConfig);
|
|
530
101
|
isValid(url: string): boolean;
|
|
531
102
|
detectFromHtml(content: string): Promise<DetectionResultFromHtml>;
|
|
532
103
|
detect(url: string, cache?: WarpCacheConfig): Promise<DetectionResult>;
|
|
533
|
-
build(type: WarpIdType, id: string): string;
|
|
534
|
-
buildFromPrefixedIdentifier(prefixedIdentifier: string): string;
|
|
535
|
-
generateQrCode(type: WarpIdType, id: string, size?: number, background?: string, color?: string, logoColor?: string): QRCodeStyling;
|
|
536
|
-
private extractIdentifierInfoFromUrl;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
declare class WarpRegistry {
|
|
540
|
-
private config;
|
|
541
|
-
private cache;
|
|
542
|
-
registryConfig: WarpRegistryConfigInfo;
|
|
543
|
-
constructor(config: WarpInitConfig);
|
|
544
|
-
init(): Promise<void>;
|
|
545
|
-
createWarpRegisterTransaction(txHash: string, alias?: string | null, brand?: string | null): Transaction$1;
|
|
546
|
-
createWarpUnregisterTransaction(txHash: string): Transaction$1;
|
|
547
|
-
createWarpUpgradeTransaction(alias: string, txHash: string): Transaction$1;
|
|
548
|
-
createWarpAliasSetTransaction(txHash: string, alias: string): Transaction$1;
|
|
549
|
-
createWarpVerifyTransaction(txHash: string): Transaction$1;
|
|
550
|
-
createWarpTransferOwnershipTransaction(txHash: string, newOwner: string): Transaction$1;
|
|
551
|
-
createBrandRegisterTransaction(txHash: string): Transaction$1;
|
|
552
|
-
createWarpBrandingTransaction(warpHash: string, brandHash: string): Transaction$1;
|
|
553
|
-
getInfoByAlias(alias: string, cache?: WarpCacheConfig): Promise<{
|
|
554
|
-
registryInfo: WarpRegistryInfo | null;
|
|
555
|
-
brand: Brand | null;
|
|
556
|
-
}>;
|
|
557
|
-
getInfoByHash(hash: string, cache?: WarpCacheConfig): Promise<{
|
|
558
|
-
registryInfo: WarpRegistryInfo | null;
|
|
559
|
-
brand: Brand | null;
|
|
560
|
-
}>;
|
|
561
|
-
getUserWarpRegistryInfos(user?: string): Promise<WarpRegistryInfo[]>;
|
|
562
|
-
getUserBrands(user?: string): Promise<Brand[]>;
|
|
563
|
-
getChainInfos(cache?: WarpCacheConfig): Promise<WarpChainInfo[]>;
|
|
564
|
-
getChainInfo(chain: WarpChain, cache?: WarpCacheConfig): Promise<WarpChainInfo | null>;
|
|
565
|
-
setChain(info: WarpChainInfo): Promise<Transaction$1>;
|
|
566
|
-
removeChain(chain: WarpChain): Promise<Transaction$1>;
|
|
567
|
-
fetchBrand(hash: string, cache?: WarpCacheConfig): Promise<Brand | null>;
|
|
568
|
-
getRegistryContractAddress(): Address$1;
|
|
569
|
-
private loadRegistryConfigs;
|
|
570
|
-
private getFactory;
|
|
571
|
-
private getController;
|
|
572
|
-
private isCurrentUserAdmin;
|
|
573
104
|
}
|
|
574
105
|
|
|
575
106
|
declare class WarpUtils {
|
|
576
|
-
static getInfoFromPrefixedIdentifier(prefixedIdentifier: string): {
|
|
577
|
-
type: WarpIdType;
|
|
578
|
-
identifier: string;
|
|
579
|
-
identifierBase: string;
|
|
580
|
-
} | null;
|
|
581
|
-
static getNextInfo(config: WarpInitConfig, warp: Warp, actionIndex: number, results: WarpExecutionResults): WarpExecutionNextInfo | null;
|
|
582
|
-
private static buildNextUrl;
|
|
583
|
-
private static getNestedValue;
|
|
584
107
|
static getChainInfoForAction(config: WarpInitConfig, action: WarpAction, inputs?: string[]): Promise<WarpChainInfo>;
|
|
585
108
|
private static tryGetChainFromInputs;
|
|
586
109
|
private static getDefaultChainInfo;
|
|
587
|
-
static getChainEntrypoint(chainInfo: WarpChainInfo, env: WarpChainEnv): NetworkEntrypoint;
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
type ValidationResult = {
|
|
591
|
-
valid: boolean;
|
|
592
|
-
errors: ValidationError[];
|
|
593
|
-
};
|
|
594
|
-
type ValidationError = string;
|
|
595
|
-
declare class WarpValidator {
|
|
596
|
-
private config;
|
|
597
|
-
constructor(config: WarpInitConfig);
|
|
598
|
-
validate(warp: Warp): Promise<ValidationResult>;
|
|
599
|
-
private validateMaxOneValuePosition;
|
|
600
|
-
private validateVariableNamesAndResultNamesUppercase;
|
|
601
|
-
private validateAbiIsSetIfApplicable;
|
|
602
|
-
private validateSchema;
|
|
603
110
|
}
|
|
604
111
|
|
|
605
|
-
export {
|
|
112
|
+
export { BrandBuilder, WarpAbiBuilder, type WarpAdapterTransaction, WarpBuilder, WarpExecutor, WarpFactory, WarpInterpolator, WarpLinkDetecter, WarpUtils };
|