@vleap/warps 0.0.5 → 0.0.6

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
@@ -34,7 +34,7 @@ declare const Config: {
34
34
  ApiUrl: (env: ChainEnv) => "https://devnet-api.multiversx.com" | "https://testnet-api.multiversx.com" | "https://api.multiversx.com";
35
35
  };
36
36
  Registry: {
37
- Contract: (env: ChainEnv) => string;
37
+ Contract: (env: ChainEnv) => "erd1qqqqqqqqqqqqqpgq8h85eq9l3cp40h5s3ujqshj2x775m2wyl3tsl20ltn" | "####";
38
38
  };
39
39
  };
40
40
 
@@ -63,6 +63,9 @@ declare class WarpRegistry {
63
63
  private registerCost;
64
64
  constructor(config: RegistryConfig);
65
65
  createRegisterTransaction(warp: Warp): Transaction$1;
66
+ createAliasAssignTransaction(warp: Warp, alias: string): Transaction$1;
67
+ reassignAliasTransaction(warp: Warp, alias: string): Transaction$1;
68
+ private getFactory;
66
69
  private loadRegistryInfo;
67
70
  }
68
71
 
package/dist/index.d.ts CHANGED
@@ -34,7 +34,7 @@ declare const Config: {
34
34
  ApiUrl: (env: ChainEnv) => "https://devnet-api.multiversx.com" | "https://testnet-api.multiversx.com" | "https://api.multiversx.com";
35
35
  };
36
36
  Registry: {
37
- Contract: (env: ChainEnv) => string;
37
+ Contract: (env: ChainEnv) => "erd1qqqqqqqqqqqqqpgq8h85eq9l3cp40h5s3ujqshj2x775m2wyl3tsl20ltn" | "####";
38
38
  };
39
39
  };
40
40
 
@@ -63,6 +63,9 @@ declare class WarpRegistry {
63
63
  private registerCost;
64
64
  constructor(config: RegistryConfig);
65
65
  createRegisterTransaction(warp: Warp): Transaction$1;
66
+ createAliasAssignTransaction(warp: Warp, alias: string): Transaction$1;
67
+ reassignAliasTransaction(warp: Warp, alias: string): Transaction$1;
68
+ private getFactory;
66
69
  private loadRegistryInfo;
67
70
  }
68
71
 
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var w=(t,r)=>{for(var n in r)u(t,n,{get:r[n],enumerable:!0})},y=(t,r,n,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of C(r))!l.call(t,i)&&i!==n&&u(t,i,{get:()=>r[i],enumerable:!(s=v(r,i))||s.enumerable});return t};var W=t=>y(u({},"__esModule",{value:!0}),t);var T={};w(T,{Config:()=>o,WarpBuilder:()=>h,WarpRegistry:()=>d});module.exports=W(T);var o={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=>""}};var a=require("@multiversx/sdk-core");var p=t=>t==="devnet"?"D":t==="testnet"?"T":"1";var h=class{version=o.LatestVersion;pendingWarp={version:o.LatestVersion,name:"",title:"",description:null,preview:"",actions:[],owner:""};constructor(r){this.pendingWarp.name=r}static createInscriptionTransaction(r,n){let s=new a.TransactionsFactoryConfig({chainID:p(n.env)}),i=new a.TransferTransactionsFactory({config:s}),c=Buffer.from(JSON.stringify(r)).toString("base64"),g=new TextEncoder().encode(c);return i.createTransactionForNativeTokenTransfer({sender:a.Address.newFromBech32(r.owner),receiver:a.Address.newFromBech32(r.owner),nativeAmount:BigInt(0),data:g})}setTitle(r){return this.pendingWarp.title=r,this}setDescription(r){return this.pendingWarp.description=r,this}setPreview(r){return this.pendingWarp.preview=r,this}addAction(r){return this.pendingWarp.actions.push(r),this}setOwner(r){return this.pendingWarp.owner=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}`)}};var e=require("@multiversx/sdk-core/out");var d=class{config;registerCost;constructor(r){this.config=r,this.registerCost=BigInt(0),this.loadRegistryInfo(r)}createRegisterTransaction(r){if(this.registerCost===BigInt(0))throw new Error("registry config not loaded");let n=new e.TransactionsFactoryConfig({chainID:p(this.config.env)});return new e.SmartContractTransactionsFactory({config:n}).createTransactionForExecute({sender:e.Address.newFromBech32(r.owner),contract:e.Address.newFromBech32(o.Registry.Contract(this.config.env)),function:"register",gasLimit:BigInt(1e7),nativeTransferAmount:this.registerCost})}async loadRegistryInfo(r){let n=o.Registry.Contract(r.env),s=new e.ApiNetworkProvider(r.chainApiUrl||o.Chain.ApiUrl(r.env),{timeout:3e4}),i=new e.QueryRunnerAdapter({networkProvider:s}),c=new e.SmartContractQueriesController({queryRunner:i}),g=c.createQuery({contract:n,function:"getConfig",arguments:[]}),f=await c.runQuery(g),[m]=c.parseQueryResponse(f);console.log("registerCost",m,f),this.registerCost=m}};0&&(module.exports={Config,WarpBuilder,WarpRegistry});
1
+ "use strict";var h=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var w=(t,r)=>{for(var e in r)h(t,e,{get:r[e],enumerable:!0})},y=(t,r,e,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of v(r))!C.call(t,s)&&s!==e&&h(t,s,{get:()=>r[s],enumerable:!(a=l(r,s))||a.enumerable});return t};var W=t=>y(h({},"__esModule",{value:!0}),t);var T={};w(T,{Config:()=>i,WarpBuilder:()=>u,WarpRegistry:()=>d});module.exports=W(T);var i={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":"####"}};var o=require("@multiversx/sdk-core");var g=t=>t==="devnet"?"D":t==="testnet"?"T":"1";var u=class{version=i.LatestVersion;pendingWarp={version:i.LatestVersion,name:"",title:"",description:null,preview:"",actions:[],owner:""};constructor(r){this.pendingWarp.name=r}static createInscriptionTransaction(r,e){let a=new o.TransactionsFactoryConfig({chainID:g(e.env)}),s=new o.TransferTransactionsFactory({config:a}),c=Buffer.from(JSON.stringify(r)).toString("base64"),p=new TextEncoder().encode(c);return s.createTransactionForNativeTokenTransfer({sender:o.Address.newFromBech32(r.owner),receiver:o.Address.newFromBech32(r.owner),nativeAmount:BigInt(0),data:p})}setTitle(r){return this.pendingWarp.title=r,this}setDescription(r){return this.pendingWarp.description=r,this}setPreview(r){return this.pendingWarp.preview=r,this}addAction(r){return this.pendingWarp.actions.push(r),this}setOwner(r){return this.pendingWarp.owner=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 n=require("@multiversx/sdk-core/out");var d=class{config;registerCost;constructor(r){this.config=r,this.registerCost=BigInt(0),this.loadRegistryInfo(r)}createRegisterTransaction(r){if(this.registerCost===BigInt(0))throw new Error("registry config not loaded");return this.getFactory().createTransactionForExecute({sender:n.Address.newFromBech32(r.owner),contract:n.Address.newFromBech32(i.Registry.Contract(this.config.env)),function:"register",gasLimit:BigInt(1e7),nativeTransferAmount:this.registerCost})}createAliasAssignTransaction(r,e){return this.getFactory().createTransactionForExecute({sender:n.Address.newFromBech32(r.owner),contract:n.Address.newFromBech32(i.Registry.Contract(this.config.env)),function:"assignAlias",gasLimit:BigInt(1e7)})}reassignAliasTransaction(r,e){return this.getFactory().createTransactionForExecute({sender:n.Address.newFromBech32(r.owner),contract:n.Address.newFromBech32(i.Registry.Contract(this.config.env)),function:"reassignAlias",gasLimit:BigInt(1e7)})}getFactory(){let r=new n.TransactionsFactoryConfig({chainID:g(this.config.env)});return new n.SmartContractTransactionsFactory({config:r})}async loadRegistryInfo(r){let e=i.Registry.Contract(r.env),a=new n.ApiNetworkProvider(r.chainApiUrl||i.Chain.ApiUrl(r.env),{timeout:3e4}),s=new n.QueryRunnerAdapter({networkProvider:a}),c=new n.SmartContractQueriesController({queryRunner:s}),p=c.createQuery({contract:e,function:"getConfig",arguments:[]}),m=await c.runQuery(p),[f]=c.parseQueryResponse(m);console.log("registerCost",f,m),this.registerCost=f}};0&&(module.exports={Config,WarpBuilder,WarpRegistry});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var n={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=>""}};import{Address as u,TransactionsFactoryConfig as m,TransferTransactionsFactory as v}from"@multiversx/sdk-core";var s=t=>t==="devnet"?"D":t==="testnet"?"T":"1";var h=class{version=n.LatestVersion;pendingWarp={version:n.LatestVersion,name:"",title:"",description:null,preview:"",actions:[],owner:""};constructor(r){this.pendingWarp.name=r}static createInscriptionTransaction(r,e){let o=new m({chainID:s(e.env)}),a=new v({config:o}),i=Buffer.from(JSON.stringify(r)).toString("base64"),c=new TextEncoder().encode(i);return a.createTransactionForNativeTokenTransfer({sender:u.newFromBech32(r.owner),receiver:u.newFromBech32(r.owner),nativeAmount:BigInt(0),data:c})}setTitle(r){return this.pendingWarp.title=r,this}setDescription(r){return this.pendingWarp.description=r,this}setPreview(r){return this.pendingWarp.preview=r,this}addAction(r){return this.pendingWarp.actions.push(r),this}setOwner(r){return this.pendingWarp.owner=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}`)}};import{Address as d,ApiNetworkProvider as C,QueryRunnerAdapter as l,SmartContractQueriesController as w,SmartContractTransactionsFactory as y,TransactionsFactoryConfig as W}from"@multiversx/sdk-core/out";var f=class{config;registerCost;constructor(r){this.config=r,this.registerCost=BigInt(0),this.loadRegistryInfo(r)}createRegisterTransaction(r){if(this.registerCost===BigInt(0))throw new Error("registry config not loaded");let e=new W({chainID:s(this.config.env)});return new y({config:e}).createTransactionForExecute({sender:d.newFromBech32(r.owner),contract:d.newFromBech32(n.Registry.Contract(this.config.env)),function:"register",gasLimit:BigInt(1e7),nativeTransferAmount:this.registerCost})}async loadRegistryInfo(r){let e=n.Registry.Contract(r.env),o=new C(r.chainApiUrl||n.Chain.ApiUrl(r.env),{timeout:3e4}),a=new l({networkProvider:o}),i=new w({queryRunner:a}),c=i.createQuery({contract:e,function:"getConfig",arguments:[]}),p=await i.runQuery(c),[g]=i.parseQueryResponse(p);console.log("registerCost",g,p),this.registerCost=g}};export{n as Config,h as WarpBuilder,f as WarpRegistry};
1
+ var n={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 f,TransferTransactionsFactory as l}from"@multiversx/sdk-core";var o=t=>t==="devnet"?"D":t==="testnet"?"T":"1";var d=class{version=n.LatestVersion;pendingWarp={version:n.LatestVersion,name:"",title:"",description:null,preview:"",actions:[],owner:""};constructor(r){this.pendingWarp.name=r}static createInscriptionTransaction(r,e){let a=new f({chainID:o(e.env)}),c=new l({config:a}),s=Buffer.from(JSON.stringify(r)).toString("base64"),g=new TextEncoder().encode(s);return c.createTransactionForNativeTokenTransfer({sender:u.newFromBech32(r.owner),receiver:u.newFromBech32(r.owner),nativeAmount:BigInt(0),data:g})}setTitle(r){return this.pendingWarp.title=r,this}setDescription(r){return this.pendingWarp.description=r,this}setPreview(r){return this.pendingWarp.preview=r,this}addAction(r){return this.pendingWarp.actions.push(r),this}setOwner(r){return this.pendingWarp.owner=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}`)}};import{Address as i,ApiNetworkProvider as v,QueryRunnerAdapter as C,SmartContractQueriesController as w,SmartContractTransactionsFactory as y,TransactionsFactoryConfig as W}from"@multiversx/sdk-core/out";var m=class{config;registerCost;constructor(r){this.config=r,this.registerCost=BigInt(0),this.loadRegistryInfo(r)}createRegisterTransaction(r){if(this.registerCost===BigInt(0))throw new Error("registry config not loaded");return this.getFactory().createTransactionForExecute({sender:i.newFromBech32(r.owner),contract:i.newFromBech32(n.Registry.Contract(this.config.env)),function:"register",gasLimit:BigInt(1e7),nativeTransferAmount:this.registerCost})}createAliasAssignTransaction(r,e){return this.getFactory().createTransactionForExecute({sender:i.newFromBech32(r.owner),contract:i.newFromBech32(n.Registry.Contract(this.config.env)),function:"assignAlias",gasLimit:BigInt(1e7)})}reassignAliasTransaction(r,e){return this.getFactory().createTransactionForExecute({sender:i.newFromBech32(r.owner),contract:i.newFromBech32(n.Registry.Contract(this.config.env)),function:"reassignAlias",gasLimit:BigInt(1e7)})}getFactory(){let r=new W({chainID:o(this.config.env)});return new y({config:r})}async loadRegistryInfo(r){let e=n.Registry.Contract(r.env),a=new v(r.chainApiUrl||n.Chain.ApiUrl(r.env),{timeout:3e4}),c=new C({networkProvider:a}),s=new w({queryRunner:c}),g=s.createQuery({contract:e,function:"getConfig",arguments:[]}),p=await s.runQuery(g),[h]=s.parseQueryResponse(p);console.log("registerCost",h,p),this.registerCost=h}};export{n as Config,d as WarpBuilder,m as WarpRegistry};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vleap/warps",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",