@vleap/warps 3.0.0-alpha.26 → 3.0.0-alpha.28
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-N3TC7RPK.mjs +1 -0
- package/dist/WarpUtils-BJJV6B4S.mjs +1 -0
- package/dist/chunk-MJ5T5ZEU.mjs +1 -0
- package/dist/chunk-VCBS5KDH.mjs +1 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +37 -27
- package/dist/index.mjs +37 -27
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-MJ5T5ZEU.mjs";import"./chunk-VCBS5KDH.mjs";export{a as WarpInterpolator};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as a}from"./chunk-VCBS5KDH.mjs";export{a as WarpUtils};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as l}from"./chunk-VCBS5KDH.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 w=(i,n,r)=>n in i?o(i,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[n]=r;var x=(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')}),F=i=>n=>{var r=i[n];if(r)return r();throw new Error("Module not found in bundle: "+n)};var P=(i,n)=>()=>(i&&(n=i(i=0)),n);var z=(i,n)=>()=>(n||i((n={exports:{}}).exports,n),n.exports),E=(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 D=(i,n,r)=>(r=i!=null?I(g(i)):{},h(n||!i||!i.__esModule?o(r,"default",{value:i,enumerable:!0}):r,i)),G=i=>h(o({},"__esModule",{value:!0}),i);var M=(i,n,r)=>w(i,typeof n!="symbol"?n+"":n,r);import{WarpMultiversxRegistry as p}from"@vleap/warps-adapter-multiversx";import{getMainChainInfo as m,WarpSerializer as y,CacheTtl as d}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 y().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 m(n);let t=await new p(n).getChainInfo(r.chain,{ttl:d.OneWeek});if(!t)throw new Error(`WarpUtils: Chain info not found for ${r.chain}`);return t}};export{x as a,F as b,P as c,z as d,E as e,D as f,G as g,M as h,c as i};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { WarpInitConfig, Brand, WarpAbi, Warp, WarpCacheConfig, WarpAction,
|
|
1
|
+
import { WarpInitConfig, Brand, WarpAbi, Warp, WarpCacheConfig, WarpAction, WarpActionIndex, WarpChainInfo, WarpExecutionResults, WarpExecutable, ResolvedInput, WarpRegistryInfo } from '@vleap/warps-core';
|
|
2
2
|
export * from '@vleap/warps-core';
|
|
3
3
|
import { Transaction, TransactionOnNetwork } from '@multiversx/sdk-core';
|
|
4
|
-
import { BrandUrls, BrandColors, BrandCta
|
|
4
|
+
import { BrandUrls, BrandColors, BrandCta } from '@vleap/warps-core/src/types';
|
|
5
5
|
|
|
6
6
|
declare class BrandBuilder {
|
|
7
7
|
private config;
|
|
@@ -56,7 +56,8 @@ declare class WarpExecutor {
|
|
|
56
56
|
private config;
|
|
57
57
|
private factory;
|
|
58
58
|
constructor(config: WarpInitConfig);
|
|
59
|
-
execute(warp: Warp, action: WarpActionIndex, inputs: string[]): Promise<WarpAdapterTransaction>;
|
|
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>;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
declare class WarpFactory {
|
|
@@ -66,7 +67,6 @@ declare class WarpFactory {
|
|
|
66
67
|
private cache;
|
|
67
68
|
constructor(config: WarpInitConfig);
|
|
68
69
|
createExecutable(warp: Warp, actionIndex: number, inputs: string[]): Promise<WarpExecutable>;
|
|
69
|
-
executeCollect(warp: Warp, actionIndex: number, inputs: string[], extra?: Record<string, any>): Promise<WarpExecution>;
|
|
70
70
|
getResolvedInputs(chain: WarpChainInfo, action: WarpAction, inputArgs: string[]): Promise<ResolvedInput[]>;
|
|
71
71
|
getModifiedInputs(inputs: ResolvedInput[]): ResolvedInput[];
|
|
72
72
|
preprocessInput(chain: WarpChainInfo, input: string): Promise<string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { WarpInitConfig, Brand, WarpAbi, Warp, WarpCacheConfig, WarpAction,
|
|
1
|
+
import { WarpInitConfig, Brand, WarpAbi, Warp, WarpCacheConfig, WarpAction, WarpActionIndex, WarpChainInfo, WarpExecutionResults, WarpExecutable, ResolvedInput, WarpRegistryInfo } from '@vleap/warps-core';
|
|
2
2
|
export * from '@vleap/warps-core';
|
|
3
3
|
import { Transaction, TransactionOnNetwork } from '@multiversx/sdk-core';
|
|
4
|
-
import { BrandUrls, BrandColors, BrandCta
|
|
4
|
+
import { BrandUrls, BrandColors, BrandCta } from '@vleap/warps-core/src/types';
|
|
5
5
|
|
|
6
6
|
declare class BrandBuilder {
|
|
7
7
|
private config;
|
|
@@ -56,7 +56,8 @@ declare class WarpExecutor {
|
|
|
56
56
|
private config;
|
|
57
57
|
private factory;
|
|
58
58
|
constructor(config: WarpInitConfig);
|
|
59
|
-
execute(warp: Warp, action: WarpActionIndex, inputs: string[]): Promise<WarpAdapterTransaction>;
|
|
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>;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
declare class WarpFactory {
|
|
@@ -66,7 +67,6 @@ declare class WarpFactory {
|
|
|
66
67
|
private cache;
|
|
67
68
|
constructor(config: WarpInitConfig);
|
|
68
69
|
createExecutable(warp: Warp, actionIndex: number, inputs: string[]): Promise<WarpExecutable>;
|
|
69
|
-
executeCollect(warp: Warp, actionIndex: number, inputs: string[], extra?: Record<string, any>): Promise<WarpExecution>;
|
|
70
70
|
getResolvedInputs(chain: WarpChainInfo, action: WarpAction, inputArgs: string[]): Promise<ResolvedInput[]>;
|
|
71
71
|
getModifiedInputs(inputs: ResolvedInput[]): ResolvedInput[];
|
|
72
72
|
preprocessInput(chain: WarpChainInfo, input: string): Promise<string>;
|