@vleap/warps 0.0.14 → 0.0.15

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.mts CHANGED
@@ -3,7 +3,7 @@ import { Transaction as Transaction$1 } from '@multiversx/sdk-core/out';
3
3
 
4
4
  type ChainEnv = 'mainnet' | 'testnet' | 'devnet';
5
5
  type Warp = {
6
- version: string;
6
+ protocol: string;
7
7
  name: string;
8
8
  title: string;
9
9
  description: string | null;
@@ -29,6 +29,7 @@ type WarpLinkAction = {
29
29
  };
30
30
 
31
31
  declare const Config: {
32
+ ProtocolName: string;
32
33
  LatestVersion: string;
33
34
  Chain: {
34
35
  ApiUrl: (env: ChainEnv) => "https://devnet-api.multiversx.com" | "https://testnet-api.multiversx.com" | "https://api.multiversx.com";
@@ -39,7 +40,6 @@ declare const Config: {
39
40
  };
40
41
 
41
42
  declare class WarpBuilder {
42
- version: string;
43
43
  private pendingWarp;
44
44
  constructor(name: string);
45
45
  static createInscriptionTransaction(warp: Warp, config: {
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { Transaction as Transaction$1 } from '@multiversx/sdk-core/out';
3
3
 
4
4
  type ChainEnv = 'mainnet' | 'testnet' | 'devnet';
5
5
  type Warp = {
6
- version: string;
6
+ protocol: string;
7
7
  name: string;
8
8
  title: string;
9
9
  description: string | null;
@@ -29,6 +29,7 @@ type WarpLinkAction = {
29
29
  };
30
30
 
31
31
  declare const Config: {
32
+ ProtocolName: string;
32
33
  LatestVersion: string;
33
34
  Chain: {
34
35
  ApiUrl: (env: ChainEnv) => "https://devnet-api.multiversx.com" | "https://testnet-api.multiversx.com" | "https://api.multiversx.com";
@@ -39,7 +40,6 @@ declare const Config: {
39
40
  };
40
41
 
41
42
  declare class WarpBuilder {
42
- version: string;
43
43
  private pendingWarp;
44
44
  constructor(name: string);
45
45
  static createInscriptionTransaction(warp: Warp, config: {
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var g=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var W=(n,r)=>{for(var e in r)g(n,e,{get:r[e],enumerable:!0})},T=(n,r,e,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of w(r))!y.call(n,s)&&s!==e&&g(n,s,{get:()=>r[s],enumerable:!(i=C(r,s))||i.enumerable});return n};var q=n=>T(g({},"__esModule",{value:!0}),n);var F={};W(F,{Config:()=>o,WarpBuilder:()=>u,WarpRegistry:()=>h});module.exports=q(F);var o={LatestVersion:"0.1.0",Chain:{ApiUrl:n=>n==="devnet"?"https://devnet-api.multiversx.com":n==="testnet"?"https://testnet-api.multiversx.com":"https://api.multiversx.com"},Registry:{Contract:n=>n==="devnet"?"erd1qqqqqqqqqqqqqpgq8h85eq9l3cp40h5s3ujqshj2x775m2wyl3tsl20ltn":"####"}};var a=require("@multiversx/sdk-core");var p=n=>n==="devnet"?"D":n==="testnet"?"T":"1";var u=class n{version=o.LatestVersion;pendingWarp={version:o.LatestVersion,name:"",title:"",description:null,preview:"",actions:[],owner:""};constructor(r){this.pendingWarp.name=r}static createInscriptionTransaction(r,e){let i=new a.TransactionsFactoryConfig({chainID:p(e.env)}),s=new a.TransferTransactionsFactory({config:i}),c=JSON.stringify(r);return s.createTransactionForNativeTokenTransfer({sender:a.Address.newFromBech32(r.owner),receiver:a.Address.newFromBech32(r.owner),nativeAmount:BigInt(0),data:Buffer.from(c).valueOf()})}static createFromRaw(r){return JSON.parse(r)}static createFromTransaction(r){return n.createFromRaw(r.data.toString())}setTitle(r){return this.pendingWarp.title=r,this}setDescription(r){return this.pendingWarp.description=r,this}setPreview(r){return this.pendingWarp.preview=r,this}setOwner(r){return this.pendingWarp.owner=r,this}setActions(r){return this.pendingWarp.actions=r,this}addAction(r){return this.pendingWarp.actions.push(r),this}build(){return this.ensure(this.pendingWarp.version,"version is required"),this.ensure(this.pendingWarp.name,"name is required"),this.ensure(this.pendingWarp.title,"title is required"),this.ensure(this.pendingWarp.actions.length>0,"actions are required"),this.ensure(this.pendingWarp.owner,"owner is required"),this.pendingWarp}ensure(r,e){if(!r)throw new Error(`Warp: ${e}`)}};var t=require("@multiversx/sdk-core/out"),m=require("@multiversx/sdk-core/out/utils.codec");var h=class{config;registerCost;constructor(r){this.config=r,this.registerCost=BigInt(0),this.loadRegistryInfo(r)}createRegisterTransaction(r,e=null){if(this.registerCost===BigInt(0))throw new Error("registry config not loaded");let i=e?this.registerCost*BigInt(2):this.registerCost;return this.getFactory().createTransactionForExecute({sender:t.Address.newFromBech32(this.config.userAddress),contract:t.Address.newFromBech32(o.Registry.Contract(this.config.env)),function:"register",gasLimit:BigInt(1e7),nativeTransferAmount:i,arguments:e?[t.BytesValue.fromHex(r),t.BytesValue.fromUTF8(e)]:[t.BytesValue.fromHex(r)]})}createAliasAssignTransaction(r,e,i){return this.getFactory().createTransactionForExecute({sender:t.Address.newFromBech32(r.owner),contract:t.Address.newFromBech32(o.Registry.Contract(this.config.env)),function:"assignAlias",gasLimit:BigInt(1e7),arguments:[t.BytesValue.fromUTF8(e),t.BytesValue.fromUTF8(i)]})}getFactory(){let r=new t.TransactionsFactoryConfig({chainID:p(this.config.env)});return new t.SmartContractTransactionsFactory({config:r})}async loadRegistryInfo(r){let e=o.Registry.Contract(r.env),i=new t.ApiNetworkProvider(r.chainApiUrl||o.Chain.ApiUrl(r.env),{timeout:3e4}),s=new t.QueryRunnerAdapter({networkProvider:i}),c=new t.SmartContractQueriesController({queryRunner:s}),d=c.createQuery({contract:e,function:"getConfig",arguments:[]}),f=await c.runQuery(d),[l]=c.parseQueryResponse(f),v=BigInt("0x"+(0,m.byteArrayToHex)(l));this.registerCost=v}};0&&(module.exports={Config,WarpBuilder,WarpRegistry});
1
+ "use strict";var g=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var T=(e,r)=>{for(var n in r)g(e,n,{get:r[n],enumerable:!0})},q=(e,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of y(r))!W.call(e,o)&&o!==n&&g(e,o,{get:()=>r[o],enumerable:!(i=w(r,o))||i.enumerable});return e};var F=e=>q(g({},"__esModule",{value:!0}),e);var A={};T(A,{Config:()=>s,WarpBuilder:()=>u,WarpRegistry:()=>h});module.exports=F(A);var s={ProtocolName:"warp",LatestVersion:"0.1.0",Chain:{ApiUrl:e=>e==="devnet"?"https://devnet-api.multiversx.com":e==="testnet"?"https://testnet-api.multiversx.com":"https://api.multiversx.com"},Registry:{Contract:e=>e==="devnet"?"erd1qqqqqqqqqqqqqpgq8h85eq9l3cp40h5s3ujqshj2x775m2wyl3tsl20ltn":"####"}};var a=require("@multiversx/sdk-core");var p=e=>e==="devnet"?"D":e==="testnet"?"T":"1",m=()=>`${s.ProtocolName}:${s.LatestVersion}`;var u=class e{pendingWarp={protocol:m(),name:"",title:"",description:null,preview:"",actions:[],owner:""};constructor(r){this.pendingWarp.name=r}static createInscriptionTransaction(r,n){let i=new a.TransactionsFactoryConfig({chainID:p(n.env)}),o=new a.TransferTransactionsFactory({config:i}),c=JSON.stringify(r);return o.createTransactionForNativeTokenTransfer({sender:a.Address.newFromBech32(r.owner),receiver:a.Address.newFromBech32(r.owner),nativeAmount:BigInt(0),data:Buffer.from(c).valueOf()})}static createFromRaw(r){return JSON.parse(r)}static createFromTransaction(r){return e.createFromRaw(r.data.toString())}setTitle(r){return this.pendingWarp.title=r,this}setDescription(r){return this.pendingWarp.description=r,this}setPreview(r){return this.pendingWarp.preview=r,this}setOwner(r){return this.pendingWarp.owner=r,this}setActions(r){return this.pendingWarp.actions=r,this}addAction(r){return this.pendingWarp.actions.push(r),this}build(){return this.ensure(this.pendingWarp.protocol,"protocol is required"),this.ensure(this.pendingWarp.name,"name is required"),this.ensure(this.pendingWarp.title,"title is required"),this.ensure(this.pendingWarp.actions.length>0,"actions are required"),this.ensure(this.pendingWarp.owner,"owner is required"),this.pendingWarp}ensure(r,n){if(!r)throw new Error(`Warp: ${n}`)}};var t=require("@multiversx/sdk-core/out"),d=require("@multiversx/sdk-core/out/utils.codec");var h=class{config;registerCost;constructor(r){this.config=r,this.registerCost=BigInt(0),this.loadRegistryInfo(r)}createRegisterTransaction(r,n=null){if(this.registerCost===BigInt(0))throw new Error("registry config not loaded");let i=n?this.registerCost*BigInt(2):this.registerCost;return this.getFactory().createTransactionForExecute({sender:t.Address.newFromBech32(this.config.userAddress),contract:t.Address.newFromBech32(s.Registry.Contract(this.config.env)),function:"register",gasLimit:BigInt(1e7),nativeTransferAmount:i,arguments:n?[t.BytesValue.fromHex(r),t.BytesValue.fromUTF8(n)]:[t.BytesValue.fromHex(r)]})}createAliasAssignTransaction(r,n,i){return this.getFactory().createTransactionForExecute({sender:t.Address.newFromBech32(r.owner),contract:t.Address.newFromBech32(s.Registry.Contract(this.config.env)),function:"assignAlias",gasLimit:BigInt(1e7),arguments:[t.BytesValue.fromUTF8(n),t.BytesValue.fromUTF8(i)]})}getFactory(){let r=new t.TransactionsFactoryConfig({chainID:p(this.config.env)});return new t.SmartContractTransactionsFactory({config:r})}async loadRegistryInfo(r){let n=s.Registry.Contract(r.env),i=new t.ApiNetworkProvider(r.chainApiUrl||s.Chain.ApiUrl(r.env),{timeout:3e4}),o=new t.QueryRunnerAdapter({networkProvider:i}),c=new t.SmartContractQueriesController({queryRunner:o}),f=c.createQuery({contract:n,function:"getConfig",arguments:[]}),l=await c.runQuery(f),[C]=c.parseQueryResponse(l),v=BigInt("0x"+(0,d.byteArrayToHex)(C));this.registerCost=v}};0&&(module.exports={Config,WarpBuilder,WarpRegistry});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var e={LatestVersion:"0.1.0",Chain:{ApiUrl:t=>t==="devnet"?"https://devnet-api.multiversx.com":t==="testnet"?"https://testnet-api.multiversx.com":"https://api.multiversx.com"},Registry:{Contract:t=>t==="devnet"?"erd1qqqqqqqqqqqqqpgq8h85eq9l3cp40h5s3ujqshj2x775m2wyl3tsl20ltn":"####"}};import{Address as g,TransactionsFactoryConfig as v,TransferTransactionsFactory as C}from"@multiversx/sdk-core";var a=t=>t==="devnet"?"D":t==="testnet"?"T":"1";var u=class t{version=e.LatestVersion;pendingWarp={version:e.LatestVersion,name:"",title:"",description:null,preview:"",actions:[],owner:""};constructor(r){this.pendingWarp.name=r}static createInscriptionTransaction(r,n){let i=new v({chainID:a(n.env)}),p=new C({config:i}),s=JSON.stringify(r);return p.createTransactionForNativeTokenTransfer({sender:g.newFromBech32(r.owner),receiver:g.newFromBech32(r.owner),nativeAmount:BigInt(0),data:Buffer.from(s).valueOf()})}static createFromRaw(r){return JSON.parse(r)}static createFromTransaction(r){return t.createFromRaw(r.data.toString())}setTitle(r){return this.pendingWarp.title=r,this}setDescription(r){return this.pendingWarp.description=r,this}setPreview(r){return this.pendingWarp.preview=r,this}setOwner(r){return this.pendingWarp.owner=r,this}setActions(r){return this.pendingWarp.actions=r,this}addAction(r){return this.pendingWarp.actions.push(r),this}build(){return this.ensure(this.pendingWarp.version,"version is required"),this.ensure(this.pendingWarp.name,"name is required"),this.ensure(this.pendingWarp.title,"title is required"),this.ensure(this.pendingWarp.actions.length>0,"actions are required"),this.ensure(this.pendingWarp.owner,"owner is required"),this.pendingWarp}ensure(r,n){if(!r)throw new Error(`Warp: ${n}`)}};import{Address as c,ApiNetworkProvider as w,BytesValue as o,QueryRunnerAdapter as y,SmartContractQueriesController as W,SmartContractTransactionsFactory as T,TransactionsFactoryConfig as q}from"@multiversx/sdk-core/out";import{byteArrayToHex as F}from"@multiversx/sdk-core/out/utils.codec";var h=class{config;registerCost;constructor(r){this.config=r,this.registerCost=BigInt(0),this.loadRegistryInfo(r)}createRegisterTransaction(r,n=null){if(this.registerCost===BigInt(0))throw new Error("registry config not loaded");let i=n?this.registerCost*BigInt(2):this.registerCost;return this.getFactory().createTransactionForExecute({sender:c.newFromBech32(this.config.userAddress),contract:c.newFromBech32(e.Registry.Contract(this.config.env)),function:"register",gasLimit:BigInt(1e7),nativeTransferAmount:i,arguments:n?[o.fromHex(r),o.fromUTF8(n)]:[o.fromHex(r)]})}createAliasAssignTransaction(r,n,i){return this.getFactory().createTransactionForExecute({sender:c.newFromBech32(r.owner),contract:c.newFromBech32(e.Registry.Contract(this.config.env)),function:"assignAlias",gasLimit:BigInt(1e7),arguments:[o.fromUTF8(n),o.fromUTF8(i)]})}getFactory(){let r=new q({chainID:a(this.config.env)});return new T({config:r})}async loadRegistryInfo(r){let n=e.Registry.Contract(r.env),i=new w(r.chainApiUrl||e.Chain.ApiUrl(r.env),{timeout:3e4}),p=new y({networkProvider:i}),s=new W({queryRunner:p}),m=s.createQuery({contract:n,function:"getConfig",arguments:[]}),d=await s.runQuery(m),[f]=s.parseQueryResponse(d),l=BigInt("0x"+F(f));this.registerCost=l}};export{e as Config,u as WarpBuilder,h as WarpRegistry};
1
+ var n={ProtocolName:"warp",LatestVersion:"0.1.0",Chain:{ApiUrl:t=>t==="devnet"?"https://devnet-api.multiversx.com":t==="testnet"?"https://testnet-api.multiversx.com":"https://api.multiversx.com"},Registry:{Contract:t=>t==="devnet"?"erd1qqqqqqqqqqqqqpgq8h85eq9l3cp40h5s3ujqshj2x775m2wyl3tsl20ltn":"####"}};import{Address as u,TransactionsFactoryConfig as v,TransferTransactionsFactory as w}from"@multiversx/sdk-core";var a=t=>t==="devnet"?"D":t==="testnet"?"T":"1",g=()=>`${n.ProtocolName}:${n.LatestVersion}`;var h=class t{pendingWarp={protocol:g(),name:"",title:"",description:null,preview:"",actions:[],owner:""};constructor(r){this.pendingWarp.name=r}static createInscriptionTransaction(r,e){let i=new v({chainID:a(e.env)}),p=new w({config:i}),o=JSON.stringify(r);return p.createTransactionForNativeTokenTransfer({sender:u.newFromBech32(r.owner),receiver:u.newFromBech32(r.owner),nativeAmount:BigInt(0),data:Buffer.from(o).valueOf()})}static createFromRaw(r){return JSON.parse(r)}static createFromTransaction(r){return t.createFromRaw(r.data.toString())}setTitle(r){return this.pendingWarp.title=r,this}setDescription(r){return this.pendingWarp.description=r,this}setPreview(r){return this.pendingWarp.preview=r,this}setOwner(r){return this.pendingWarp.owner=r,this}setActions(r){return this.pendingWarp.actions=r,this}addAction(r){return this.pendingWarp.actions.push(r),this}build(){return this.ensure(this.pendingWarp.protocol,"protocol is required"),this.ensure(this.pendingWarp.name,"name is required"),this.ensure(this.pendingWarp.title,"title is required"),this.ensure(this.pendingWarp.actions.length>0,"actions are required"),this.ensure(this.pendingWarp.owner,"owner is required"),this.pendingWarp}ensure(r,e){if(!r)throw new Error(`Warp: ${e}`)}};import{Address as c,ApiNetworkProvider as y,BytesValue as s,QueryRunnerAdapter as W,SmartContractQueriesController as T,SmartContractTransactionsFactory as q,TransactionsFactoryConfig as F}from"@multiversx/sdk-core/out";import{byteArrayToHex as A}from"@multiversx/sdk-core/out/utils.codec";var m=class{config;registerCost;constructor(r){this.config=r,this.registerCost=BigInt(0),this.loadRegistryInfo(r)}createRegisterTransaction(r,e=null){if(this.registerCost===BigInt(0))throw new Error("registry config not loaded");let i=e?this.registerCost*BigInt(2):this.registerCost;return this.getFactory().createTransactionForExecute({sender:c.newFromBech32(this.config.userAddress),contract:c.newFromBech32(n.Registry.Contract(this.config.env)),function:"register",gasLimit:BigInt(1e7),nativeTransferAmount:i,arguments:e?[s.fromHex(r),s.fromUTF8(e)]:[s.fromHex(r)]})}createAliasAssignTransaction(r,e,i){return this.getFactory().createTransactionForExecute({sender:c.newFromBech32(r.owner),contract:c.newFromBech32(n.Registry.Contract(this.config.env)),function:"assignAlias",gasLimit:BigInt(1e7),arguments:[s.fromUTF8(e),s.fromUTF8(i)]})}getFactory(){let r=new F({chainID:a(this.config.env)});return new q({config:r})}async loadRegistryInfo(r){let e=n.Registry.Contract(r.env),i=new y(r.chainApiUrl||n.Chain.ApiUrl(r.env),{timeout:3e4}),p=new W({networkProvider:i}),o=new T({queryRunner:p}),d=o.createQuery({contract:e,function:"getConfig",arguments:[]}),f=await o.runQuery(d),[l]=o.parseQueryResponse(f),C=BigInt("0x"+A(l));this.registerCost=C}};export{n as Config,h as WarpBuilder,m as WarpRegistry};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vleap/warps",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",