@magic-ext/zilliqa 0.1.8 → 1.0.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # v1.0.0 (Thu Dec 09 2021)
2
+
3
+ #### 💥 Breaking Change
4
+
5
+ - Jerryliu sc 44386 migrate web3 related magic ext repos to magic (PART 1) [#248](https://github.com/magiclabs/magic-js/pull/248) ([@Ethella](https://github.com/Ethella))
6
+
7
+ #### Authors: 1
8
+
9
+ - Jerry Liu ([@Ethella](https://github.com/Ethella))
10
+
11
+ ---
12
+
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018-present Magic Labs, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ var t=require("@magic-sdk/commons");function i(t,r){return(i=Object.setPrototypeOf||function(t,i){return t.__proto__=i,t})(t,r)}exports.ZilliqaExtension=function(t){var r,a;function o(i){var r;return(r=t.call(this)||this).zilliqaConfig=void 0,r.name="zilliqa",r.config=void 0,r.sendTransaction=function(t,i){return t.amount&&(t.amount="string"==typeof t.amount?t.amount:t.amount.toString()),t.gasPrice&&(t.gasPrice="string"==typeof t.gasPrice?t.gasPrice:t.gasPrice.toString()),t.gasLimit&&(t.gasLimit="string"==typeof t.gasLimit?t.gasLimit:t.gasLimit.toNumber()),r.request({id:42,method:"zil_sendTransaction",jsonrpc:"2.0",params:{params:t,toDs:i}})},r.deployContract=function(t,i,a,o,n,e){return a.amount&&(a.amount="string"==typeof a.amount?a.amount:a.amount.toString()),a.gasPrice&&(a.gasPrice="string"==typeof a.gasPrice?a.gasPrice:a.gasPrice.toString()),a.gasLimit&&(a.gasLimit="string"==typeof a.gasLimit?a.gasLimit:a.gasLimit.toNumber()),r.request({id:42,jsonrpc:"2.0",method:"zil_deployContract",params:{init:t,code:i,params:a,attempts:o,interval:n,toDs:e}})},r.callContract=function(t,i,a,o,n,e,s){return void 0===o&&(o=33),void 0===n&&(n=1e3),void 0===e&&(e=!1),a.amount&&(a.amount="string"==typeof a.amount?a.amount:a.amount.toString()),a.gasPrice&&(a.gasPrice="string"==typeof a.gasPrice?a.gasPrice:a.gasPrice.toString()),a.gasLimit&&(a.gasLimit="string"==typeof a.gasLimit?a.gasLimit:a.gasLimit.toNumber()),r.request({id:42,jsonrpc:"2.0",method:"zil_callContract",params:{transition:t,args:i,params:a,attempts:o,interval:n,toDs:e,contractAddress:s}})},r.getWallet=function(){return r.request({id:42,jsonrpc:"2.0",method:"zil_getWallet",params:[]})},r.zilliqaConfig=i,r.config={rpcUrl:i.rpcUrl,chainType:"ZILLIQA"},r}return a=t,(r=o).prototype=Object.create(a.prototype),r.prototype.constructor=r,i(r,a),o}(t.Extension.Internal);
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport { Extension } from '@magic-sdk/commons';\nimport { ZilliqaConfig, ConfigType } from './type';\n\nexport class ZilliqaExtension extends Extension.Internal<'zilliqa', ZilliqaConfig> {\n name = 'zilliqa' as const;\n\n config: ConfigType;\n\n constructor(public zilliqaConfig: ZilliqaConfig) {\n super();\n\n this.config = {\n rpcUrl: zilliqaConfig.rpcUrl,\n chainType: 'ZILLIQA',\n };\n }\n\n public sendTransaction = (params: any, toDs: boolean): Promise<any> => {\n if (params.amount) params.amount = typeof params.amount === 'string' ? params.amount : params.amount.toString();\n if (params.gasPrice)\n params.gasPrice = typeof params.gasPrice === 'string' ? params.gasPrice : params.gasPrice.toString();\n if (params.gasLimit)\n params.gasLimit = typeof params.gasLimit === 'string' ? params.gasLimit : params.gasLimit.toNumber();\n\n return this.request({\n id: 42,\n method: 'zil_sendTransaction',\n jsonrpc: '2.0',\n params: {\n params,\n toDs,\n },\n });\n };\n\n public deployContract = (\n init: any,\n code: string,\n params: any,\n attempts: number,\n interval: number,\n toDs: boolean,\n ): Promise<any> => {\n if (params.amount) params.amount = typeof params.amount === 'string' ? params.amount : params.amount.toString();\n if (params.gasPrice)\n params.gasPrice = typeof params.gasPrice === 'string' ? params.gasPrice : params.gasPrice.toString();\n if (params.gasLimit)\n params.gasLimit = typeof params.gasLimit === 'string' ? params.gasLimit : params.gasLimit.toNumber();\n\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'zil_deployContract',\n params: {\n init,\n code,\n params,\n attempts,\n interval,\n toDs,\n },\n });\n };\n\n public callContract = (\n transition: string,\n args: any[],\n params: any,\n attempts = 33,\n interval = 1000,\n toDs = false,\n contractAddress: string,\n ) => {\n if (params.amount) params.amount = typeof params.amount === 'string' ? params.amount : params.amount.toString();\n if (params.gasPrice)\n params.gasPrice = typeof params.gasPrice === 'string' ? params.gasPrice : params.gasPrice.toString();\n if (params.gasLimit)\n params.gasLimit = typeof params.gasLimit === 'string' ? params.gasLimit : params.gasLimit.toNumber();\n\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'zil_callContract',\n params: {\n transition,\n args,\n params,\n attempts,\n interval,\n toDs,\n contractAddress,\n },\n });\n };\n\n public getWallet = (): Promise<object> => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'zil_getWallet',\n params: [],\n });\n };\n}\n"],"names":["zilliqaConfig","_this","name","config","sendTransaction","params","toDs","amount","toString","gasPrice","gasLimit","toNumber","request","id","method","jsonrpc","deployContract","init","code","attempts","interval","callContract","transition","args","contractAddress","getWallet","rpcUrl","chainType","Extension","Internal"],"mappings":"6KASE,WAAmBA,gBACjBC,sBADiBD,uBAJnBE,KAAO,YAEPC,gBAWOC,gBAAkB,SAACC,EAAaC,GAOrC,OANID,EAAOE,SAAQF,EAAOE,OAAkC,iBAAlBF,EAAOE,OAAsBF,EAAOE,OAASF,EAAOE,OAAOC,YACjGH,EAAOI,WACTJ,EAAOI,SAAsC,iBAApBJ,EAAOI,SAAwBJ,EAAOI,SAAWJ,EAAOI,SAASD,YACxFH,EAAOK,WACTL,EAAOK,SAAsC,iBAApBL,EAAOK,SAAwBL,EAAOK,SAAWL,EAAOK,SAASC,cAEhFC,QAAQ,CAClBC,GAAI,GACJC,OAAQ,sBACRC,QAAS,MACTV,OAAQ,CACNA,OAAAA,EACAC,KAAAA,QAKCU,eAAiB,SACtBC,EACAC,EACAb,EACAc,EACAC,EACAd,GAQA,OANID,EAAOE,SAAQF,EAAOE,OAAkC,iBAAlBF,EAAOE,OAAsBF,EAAOE,OAASF,EAAOE,OAAOC,YACjGH,EAAOI,WACTJ,EAAOI,SAAsC,iBAApBJ,EAAOI,SAAwBJ,EAAOI,SAAWJ,EAAOI,SAASD,YACxFH,EAAOK,WACTL,EAAOK,SAAsC,iBAApBL,EAAOK,SAAwBL,EAAOK,SAAWL,EAAOK,SAASC,cAEhFC,QAAQ,CAClBC,GAAI,GACJE,QAAS,MACTD,OAAQ,qBACRT,OAAQ,CACNY,KAAAA,EACAC,KAAAA,EACAb,OAAAA,EACAc,SAAAA,EACAC,SAAAA,EACAd,KAAAA,QAKCe,aAAe,SACpBC,EACAC,EACAlB,EACAc,EACAC,EACAd,EACAkB,GAQA,gBAXAL,IAAAA,EAAW,aACXC,IAAAA,EAAW,cACXd,IAAAA,GAAO,GAGHD,EAAOE,SAAQF,EAAOE,OAAkC,iBAAlBF,EAAOE,OAAsBF,EAAOE,OAASF,EAAOE,OAAOC,YACjGH,EAAOI,WACTJ,EAAOI,SAAsC,iBAApBJ,EAAOI,SAAwBJ,EAAOI,SAAWJ,EAAOI,SAASD,YACxFH,EAAOK,WACTL,EAAOK,SAAsC,iBAApBL,EAAOK,SAAwBL,EAAOK,SAAWL,EAAOK,SAASC,cAEhFC,QAAQ,CAClBC,GAAI,GACJE,QAAS,MACTD,OAAQ,mBACRT,OAAQ,CACNiB,WAAAA,EACAC,KAAAA,EACAlB,OAAAA,EACAc,SAAAA,EACAC,SAAAA,EACAd,KAAAA,EACAkB,gBAAAA,QAKCC,UAAY,WACjB,SAAYb,QAAQ,CAClBC,GAAI,GACJE,QAAS,MACTD,OAAQ,gBACRT,OAAQ,MA5FOJ,gBAAAD,EAGjBC,EAAKE,OAAS,CACZuB,OAAQ1B,EAAc0B,OACtBC,UAAW,aAVjB,0FAAsCC,YAAUC"}
@@ -0,0 +1,2 @@
1
+ import{Extension as t}from"@magic-sdk/commons";function i(t,r){return(i=Object.setPrototypeOf||function(t,i){return t.__proto__=i,t})(t,r)}var r=function(t){var r,a;function o(i){var r;return(r=t.call(this)||this).zilliqaConfig=void 0,r.name="zilliqa",r.config=void 0,r.sendTransaction=function(t,i){return t.amount&&(t.amount="string"==typeof t.amount?t.amount:t.amount.toString()),t.gasPrice&&(t.gasPrice="string"==typeof t.gasPrice?t.gasPrice:t.gasPrice.toString()),t.gasLimit&&(t.gasLimit="string"==typeof t.gasLimit?t.gasLimit:t.gasLimit.toNumber()),r.request({id:42,method:"zil_sendTransaction",jsonrpc:"2.0",params:{params:t,toDs:i}})},r.deployContract=function(t,i,a,o,n,e){return a.amount&&(a.amount="string"==typeof a.amount?a.amount:a.amount.toString()),a.gasPrice&&(a.gasPrice="string"==typeof a.gasPrice?a.gasPrice:a.gasPrice.toString()),a.gasLimit&&(a.gasLimit="string"==typeof a.gasLimit?a.gasLimit:a.gasLimit.toNumber()),r.request({id:42,jsonrpc:"2.0",method:"zil_deployContract",params:{init:t,code:i,params:a,attempts:o,interval:n,toDs:e}})},r.callContract=function(t,i,a,o,n,e,s){return void 0===o&&(o=33),void 0===n&&(n=1e3),void 0===e&&(e=!1),a.amount&&(a.amount="string"==typeof a.amount?a.amount:a.amount.toString()),a.gasPrice&&(a.gasPrice="string"==typeof a.gasPrice?a.gasPrice:a.gasPrice.toString()),a.gasLimit&&(a.gasLimit="string"==typeof a.gasLimit?a.gasLimit:a.gasLimit.toNumber()),r.request({id:42,jsonrpc:"2.0",method:"zil_callContract",params:{transition:t,args:i,params:a,attempts:o,interval:n,toDs:e,contractAddress:s}})},r.getWallet=function(){return r.request({id:42,jsonrpc:"2.0",method:"zil_getWallet",params:[]})},r.zilliqaConfig=i,r.config={rpcUrl:i.rpcUrl,chainType:"ZILLIQA"},r}return a=t,(r=o).prototype=Object.create(a.prototype),r.prototype.constructor=r,i(r,a),o}(t.Internal);export{r as ZilliqaExtension};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport { Extension } from '@magic-sdk/commons';\nimport { ZilliqaConfig, ConfigType } from './type';\n\nexport class ZilliqaExtension extends Extension.Internal<'zilliqa', ZilliqaConfig> {\n name = 'zilliqa' as const;\n\n config: ConfigType;\n\n constructor(public zilliqaConfig: ZilliqaConfig) {\n super();\n\n this.config = {\n rpcUrl: zilliqaConfig.rpcUrl,\n chainType: 'ZILLIQA',\n };\n }\n\n public sendTransaction = (params: any, toDs: boolean): Promise<any> => {\n if (params.amount) params.amount = typeof params.amount === 'string' ? params.amount : params.amount.toString();\n if (params.gasPrice)\n params.gasPrice = typeof params.gasPrice === 'string' ? params.gasPrice : params.gasPrice.toString();\n if (params.gasLimit)\n params.gasLimit = typeof params.gasLimit === 'string' ? params.gasLimit : params.gasLimit.toNumber();\n\n return this.request({\n id: 42,\n method: 'zil_sendTransaction',\n jsonrpc: '2.0',\n params: {\n params,\n toDs,\n },\n });\n };\n\n public deployContract = (\n init: any,\n code: string,\n params: any,\n attempts: number,\n interval: number,\n toDs: boolean,\n ): Promise<any> => {\n if (params.amount) params.amount = typeof params.amount === 'string' ? params.amount : params.amount.toString();\n if (params.gasPrice)\n params.gasPrice = typeof params.gasPrice === 'string' ? params.gasPrice : params.gasPrice.toString();\n if (params.gasLimit)\n params.gasLimit = typeof params.gasLimit === 'string' ? params.gasLimit : params.gasLimit.toNumber();\n\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'zil_deployContract',\n params: {\n init,\n code,\n params,\n attempts,\n interval,\n toDs,\n },\n });\n };\n\n public callContract = (\n transition: string,\n args: any[],\n params: any,\n attempts = 33,\n interval = 1000,\n toDs = false,\n contractAddress: string,\n ) => {\n if (params.amount) params.amount = typeof params.amount === 'string' ? params.amount : params.amount.toString();\n if (params.gasPrice)\n params.gasPrice = typeof params.gasPrice === 'string' ? params.gasPrice : params.gasPrice.toString();\n if (params.gasLimit)\n params.gasLimit = typeof params.gasLimit === 'string' ? params.gasLimit : params.gasLimit.toNumber();\n\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'zil_callContract',\n params: {\n transition,\n args,\n params,\n attempts,\n interval,\n toDs,\n contractAddress,\n },\n });\n };\n\n public getWallet = (): Promise<object> => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'zil_getWallet',\n params: [],\n });\n };\n}\n"],"names":["ZilliqaExtension","zilliqaConfig","_this","name","config","sendTransaction","params","toDs","amount","toString","gasPrice","gasLimit","toNumber","request","id","method","jsonrpc","deployContract","init","code","attempts","interval","callContract","transition","args","contractAddress","getWallet","rpcUrl","chainType","Extension","Internal"],"mappings":"2IAIaA,IAAAA,sBAKX,WAAmBC,gBACjBC,sBADiBD,uBAJnBE,KAAO,YAEPC,gBAWOC,gBAAkB,SAACC,EAAaC,GAOrC,OANID,EAAOE,SAAQF,EAAOE,OAAkC,iBAAlBF,EAAOE,OAAsBF,EAAOE,OAASF,EAAOE,OAAOC,YACjGH,EAAOI,WACTJ,EAAOI,SAAsC,iBAApBJ,EAAOI,SAAwBJ,EAAOI,SAAWJ,EAAOI,SAASD,YACxFH,EAAOK,WACTL,EAAOK,SAAsC,iBAApBL,EAAOK,SAAwBL,EAAOK,SAAWL,EAAOK,SAASC,cAEhFC,QAAQ,CAClBC,GAAI,GACJC,OAAQ,sBACRC,QAAS,MACTV,OAAQ,CACNA,OAAAA,EACAC,KAAAA,QAKCU,eAAiB,SACtBC,EACAC,EACAb,EACAc,EACAC,EACAd,GAQA,OANID,EAAOE,SAAQF,EAAOE,OAAkC,iBAAlBF,EAAOE,OAAsBF,EAAOE,OAASF,EAAOE,OAAOC,YACjGH,EAAOI,WACTJ,EAAOI,SAAsC,iBAApBJ,EAAOI,SAAwBJ,EAAOI,SAAWJ,EAAOI,SAASD,YACxFH,EAAOK,WACTL,EAAOK,SAAsC,iBAApBL,EAAOK,SAAwBL,EAAOK,SAAWL,EAAOK,SAASC,cAEhFC,QAAQ,CAClBC,GAAI,GACJE,QAAS,MACTD,OAAQ,qBACRT,OAAQ,CACNY,KAAAA,EACAC,KAAAA,EACAb,OAAAA,EACAc,SAAAA,EACAC,SAAAA,EACAd,KAAAA,QAKCe,aAAe,SACpBC,EACAC,EACAlB,EACAc,EACAC,EACAd,EACAkB,GAQA,gBAXAL,IAAAA,EAAW,aACXC,IAAAA,EAAW,cACXd,IAAAA,GAAO,GAGHD,EAAOE,SAAQF,EAAOE,OAAkC,iBAAlBF,EAAOE,OAAsBF,EAAOE,OAASF,EAAOE,OAAOC,YACjGH,EAAOI,WACTJ,EAAOI,SAAsC,iBAApBJ,EAAOI,SAAwBJ,EAAOI,SAAWJ,EAAOI,SAASD,YACxFH,EAAOK,WACTL,EAAOK,SAAsC,iBAApBL,EAAOK,SAAwBL,EAAOK,SAAWL,EAAOK,SAASC,cAEhFC,QAAQ,CAClBC,GAAI,GACJE,QAAS,MACTD,OAAQ,mBACRT,OAAQ,CACNiB,WAAAA,EACAC,KAAAA,EACAlB,OAAAA,EACAc,SAAAA,EACAC,SAAAA,EACAd,KAAAA,EACAkB,gBAAAA,QAKCC,UAAY,WACjB,SAAYb,QAAQ,CAClBC,GAAI,GACJE,QAAS,MACTD,OAAQ,gBACRT,OAAQ,MA5FOJ,gBAAAD,EAGjBC,EAAKE,OAAS,CACZuB,OAAQ1B,EAAc0B,OACtBC,UAAW,aAVjB,0FAAsCC,EAAUC"}
@@ -0,0 +1 @@
1
+ var MagicZilliqaExtension=function(t){function i(t,r){return(i=Object.setPrototypeOf||function(t,i){return t.__proto__=i,t})(t,r)}return function(t){var r,a;function n(i){var r;return(r=t.call(this)||this).zilliqaConfig=void 0,r.name="zilliqa",r.config=void 0,r.sendTransaction=function(t,i){return t.amount&&(t.amount="string"==typeof t.amount?t.amount:t.amount.toString()),t.gasPrice&&(t.gasPrice="string"==typeof t.gasPrice?t.gasPrice:t.gasPrice.toString()),t.gasLimit&&(t.gasLimit="string"==typeof t.gasLimit?t.gasLimit:t.gasLimit.toNumber()),r.request({id:42,method:"zil_sendTransaction",jsonrpc:"2.0",params:{params:t,toDs:i}})},r.deployContract=function(t,i,a,n,o,e){return a.amount&&(a.amount="string"==typeof a.amount?a.amount:a.amount.toString()),a.gasPrice&&(a.gasPrice="string"==typeof a.gasPrice?a.gasPrice:a.gasPrice.toString()),a.gasLimit&&(a.gasLimit="string"==typeof a.gasLimit?a.gasLimit:a.gasLimit.toNumber()),r.request({id:42,jsonrpc:"2.0",method:"zil_deployContract",params:{init:t,code:i,params:a,attempts:n,interval:o,toDs:e}})},r.callContract=function(t,i,a,n,o,e,s){return void 0===n&&(n=33),void 0===o&&(o=1e3),void 0===e&&(e=!1),a.amount&&(a.amount="string"==typeof a.amount?a.amount:a.amount.toString()),a.gasPrice&&(a.gasPrice="string"==typeof a.gasPrice?a.gasPrice:a.gasPrice.toString()),a.gasLimit&&(a.gasLimit="string"==typeof a.gasLimit?a.gasLimit:a.gasLimit.toNumber()),r.request({id:42,jsonrpc:"2.0",method:"zil_callContract",params:{transition:t,args:i,params:a,attempts:n,interval:o,toDs:e,contractAddress:s}})},r.getWallet=function(){return r.request({id:42,jsonrpc:"2.0",method:"zil_getWallet",params:[]})},r.zilliqaConfig=i,r.config={rpcUrl:i.rpcUrl,chainType:"ZILLIQA"},r}return a=t,(r=n).prototype=Object.create(a.prototype),r.prototype.constructor=r,i(r,a),n}(Magic.Extension.Internal)}();
@@ -0,0 +1,2 @@
1
+ import{Extension as t}from"@magic-sdk/commons";class i extends t.Internal{constructor(t){super(),this.zilliqaConfig=void 0,this.name="zilliqa",this.config=void 0,this.sendTransaction=(t,i)=>(t.amount&&(t.amount="string"==typeof t.amount?t.amount:t.amount.toString()),t.gasPrice&&(t.gasPrice="string"==typeof t.gasPrice?t.gasPrice:t.gasPrice.toString()),t.gasLimit&&(t.gasLimit="string"==typeof t.gasLimit?t.gasLimit:t.gasLimit.toNumber()),this.request({id:42,method:"zil_sendTransaction",jsonrpc:"2.0",params:{params:t,toDs:i}})),this.deployContract=(t,i,s,a,r,o)=>(s.amount&&(s.amount="string"==typeof s.amount?s.amount:s.amount.toString()),s.gasPrice&&(s.gasPrice="string"==typeof s.gasPrice?s.gasPrice:s.gasPrice.toString()),s.gasLimit&&(s.gasLimit="string"==typeof s.gasLimit?s.gasLimit:s.gasLimit.toNumber()),this.request({id:42,jsonrpc:"2.0",method:"zil_deployContract",params:{init:t,code:i,params:s,attempts:a,interval:r,toDs:o}})),this.callContract=(t,i,s,a=33,r=1e3,o=!1,e)=>(s.amount&&(s.amount="string"==typeof s.amount?s.amount:s.amount.toString()),s.gasPrice&&(s.gasPrice="string"==typeof s.gasPrice?s.gasPrice:s.gasPrice.toString()),s.gasLimit&&(s.gasLimit="string"==typeof s.gasLimit?s.gasLimit:s.gasLimit.toNumber()),this.request({id:42,jsonrpc:"2.0",method:"zil_callContract",params:{transition:t,args:i,params:s,attempts:a,interval:r,toDs:o,contractAddress:e}})),this.getWallet=()=>this.request({id:42,jsonrpc:"2.0",method:"zil_getWallet",params:[]}),this.zilliqaConfig=t,this.config={rpcUrl:t.rpcUrl,chainType:"ZILLIQA"}}}export{i as ZilliqaExtension};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport { Extension } from '@magic-sdk/commons';\nimport { ZilliqaConfig, ConfigType } from './type';\n\nexport class ZilliqaExtension extends Extension.Internal<'zilliqa', ZilliqaConfig> {\n name = 'zilliqa' as const;\n\n config: ConfigType;\n\n constructor(public zilliqaConfig: ZilliqaConfig) {\n super();\n\n this.config = {\n rpcUrl: zilliqaConfig.rpcUrl,\n chainType: 'ZILLIQA',\n };\n }\n\n public sendTransaction = (params: any, toDs: boolean): Promise<any> => {\n if (params.amount) params.amount = typeof params.amount === 'string' ? params.amount : params.amount.toString();\n if (params.gasPrice)\n params.gasPrice = typeof params.gasPrice === 'string' ? params.gasPrice : params.gasPrice.toString();\n if (params.gasLimit)\n params.gasLimit = typeof params.gasLimit === 'string' ? params.gasLimit : params.gasLimit.toNumber();\n\n return this.request({\n id: 42,\n method: 'zil_sendTransaction',\n jsonrpc: '2.0',\n params: {\n params,\n toDs,\n },\n });\n };\n\n public deployContract = (\n init: any,\n code: string,\n params: any,\n attempts: number,\n interval: number,\n toDs: boolean,\n ): Promise<any> => {\n if (params.amount) params.amount = typeof params.amount === 'string' ? params.amount : params.amount.toString();\n if (params.gasPrice)\n params.gasPrice = typeof params.gasPrice === 'string' ? params.gasPrice : params.gasPrice.toString();\n if (params.gasLimit)\n params.gasLimit = typeof params.gasLimit === 'string' ? params.gasLimit : params.gasLimit.toNumber();\n\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'zil_deployContract',\n params: {\n init,\n code,\n params,\n attempts,\n interval,\n toDs,\n },\n });\n };\n\n public callContract = (\n transition: string,\n args: any[],\n params: any,\n attempts = 33,\n interval = 1000,\n toDs = false,\n contractAddress: string,\n ) => {\n if (params.amount) params.amount = typeof params.amount === 'string' ? params.amount : params.amount.toString();\n if (params.gasPrice)\n params.gasPrice = typeof params.gasPrice === 'string' ? params.gasPrice : params.gasPrice.toString();\n if (params.gasLimit)\n params.gasLimit = typeof params.gasLimit === 'string' ? params.gasLimit : params.gasLimit.toNumber();\n\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'zil_callContract',\n params: {\n transition,\n args,\n params,\n attempts,\n interval,\n toDs,\n contractAddress,\n },\n });\n };\n\n public getWallet = (): Promise<object> => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'zil_getWallet',\n params: [],\n });\n };\n}\n"],"names":["ZilliqaExtension","Extension","Internal","constructor","zilliqaConfig","super","name","config","sendTransaction","params","toDs","amount","toString","gasPrice","gasLimit","toNumber","request","id","method","jsonrpc","deployContract","init","code","attempts","interval","callContract","transition","args","contractAddress","getWallet","this","rpcUrl","chainType"],"mappings":"qDAIaA,UAAyBC,EAAUC,SAK9CC,YAAmBC,GACjBC,aADiBD,0BAJnBE,KAAO,eAEPC,mBAWOC,gBAAkB,CAACC,EAAaC,KACjCD,EAAOE,SAAQF,EAAOE,OAAkC,iBAAlBF,EAAOE,OAAsBF,EAAOE,OAASF,EAAOE,OAAOC,YACjGH,EAAOI,WACTJ,EAAOI,SAAsC,iBAApBJ,EAAOI,SAAwBJ,EAAOI,SAAWJ,EAAOI,SAASD,YACxFH,EAAOK,WACTL,EAAOK,SAAsC,iBAApBL,EAAOK,SAAwBL,EAAOK,SAAWL,EAAOK,SAASC,iBAEhFC,QAAQ,CAClBC,GAAI,GACJC,OAAQ,sBACRC,QAAS,MACTV,OAAQ,CACNA,OAAAA,EACAC,KAAAA,WAKCU,eAAiB,CACtBC,EACAC,EACAb,EACAc,EACAC,EACAd,KAEID,EAAOE,SAAQF,EAAOE,OAAkC,iBAAlBF,EAAOE,OAAsBF,EAAOE,OAASF,EAAOE,OAAOC,YACjGH,EAAOI,WACTJ,EAAOI,SAAsC,iBAApBJ,EAAOI,SAAwBJ,EAAOI,SAAWJ,EAAOI,SAASD,YACxFH,EAAOK,WACTL,EAAOK,SAAsC,iBAApBL,EAAOK,SAAwBL,EAAOK,SAAWL,EAAOK,SAASC,iBAEhFC,QAAQ,CAClBC,GAAI,GACJE,QAAS,MACTD,OAAQ,qBACRT,OAAQ,CACNY,KAAAA,EACAC,KAAAA,EACAb,OAAAA,EACAc,SAAAA,EACAC,SAAAA,EACAd,KAAAA,WAKCe,aAAe,CACpBC,EACAC,EACAlB,EACAc,EAAW,GACXC,EAAW,IACXd,GAAO,EACPkB,KAEInB,EAAOE,SAAQF,EAAOE,OAAkC,iBAAlBF,EAAOE,OAAsBF,EAAOE,OAASF,EAAOE,OAAOC,YACjGH,EAAOI,WACTJ,EAAOI,SAAsC,iBAApBJ,EAAOI,SAAwBJ,EAAOI,SAAWJ,EAAOI,SAASD,YACxFH,EAAOK,WACTL,EAAOK,SAAsC,iBAApBL,EAAOK,SAAwBL,EAAOK,SAAWL,EAAOK,SAASC,iBAEhFC,QAAQ,CAClBC,GAAI,GACJE,QAAS,MACTD,OAAQ,mBACRT,OAAQ,CACNiB,WAAAA,EACAC,KAAAA,EACAlB,OAAAA,EACAc,SAAAA,EACAC,SAAAA,EACAd,KAAAA,EACAkB,gBAAAA,WAKCC,UAAY,SACLb,QAAQ,CAClBC,GAAI,GACJE,QAAS,MACTD,OAAQ,gBACRT,OAAQ,KA5FOqB,mBAAA1B,EAGjB0B,KAAKvB,OAAS,CACZwB,OAAQ3B,EAAc2B,OACtBC,UAAW"}
@@ -0,0 +1,2 @@
1
+ var t=require("@magic-sdk/commons");function i(t,r){return(i=Object.setPrototypeOf||function(t,i){return t.__proto__=i,t})(t,r)}exports.ZilliqaExtension=function(t){var r,a;function o(i){var r;return(r=t.call(this)||this).zilliqaConfig=void 0,r.name="zilliqa",r.config=void 0,r.sendTransaction=function(t,i){return t.amount&&(t.amount="string"==typeof t.amount?t.amount:t.amount.toString()),t.gasPrice&&(t.gasPrice="string"==typeof t.gasPrice?t.gasPrice:t.gasPrice.toString()),t.gasLimit&&(t.gasLimit="string"==typeof t.gasLimit?t.gasLimit:t.gasLimit.toNumber()),r.request({id:42,method:"zil_sendTransaction",jsonrpc:"2.0",params:{params:t,toDs:i}})},r.deployContract=function(t,i,a,o,n,e){return a.amount&&(a.amount="string"==typeof a.amount?a.amount:a.amount.toString()),a.gasPrice&&(a.gasPrice="string"==typeof a.gasPrice?a.gasPrice:a.gasPrice.toString()),a.gasLimit&&(a.gasLimit="string"==typeof a.gasLimit?a.gasLimit:a.gasLimit.toNumber()),r.request({id:42,jsonrpc:"2.0",method:"zil_deployContract",params:{init:t,code:i,params:a,attempts:o,interval:n,toDs:e}})},r.callContract=function(t,i,a,o,n,e,s){return void 0===o&&(o=33),void 0===n&&(n=1e3),void 0===e&&(e=!1),a.amount&&(a.amount="string"==typeof a.amount?a.amount:a.amount.toString()),a.gasPrice&&(a.gasPrice="string"==typeof a.gasPrice?a.gasPrice:a.gasPrice.toString()),a.gasLimit&&(a.gasLimit="string"==typeof a.gasLimit?a.gasLimit:a.gasLimit.toNumber()),r.request({id:42,jsonrpc:"2.0",method:"zil_callContract",params:{transition:t,args:i,params:a,attempts:o,interval:n,toDs:e,contractAddress:s}})},r.getWallet=function(){return r.request({id:42,jsonrpc:"2.0",method:"zil_getWallet",params:[]})},r.zilliqaConfig=i,r.config={rpcUrl:i.rpcUrl,chainType:"ZILLIQA"},r}return a=t,(r=o).prototype=Object.create(a.prototype),r.prototype.constructor=r,i(r,a),o}(t.Extension.Internal);
2
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.native.js","sources":["../../src/index.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport { Extension } from '@magic-sdk/commons';\nimport { ZilliqaConfig, ConfigType } from './type';\n\nexport class ZilliqaExtension extends Extension.Internal<'zilliqa', ZilliqaConfig> {\n name = 'zilliqa' as const;\n\n config: ConfigType;\n\n constructor(public zilliqaConfig: ZilliqaConfig) {\n super();\n\n this.config = {\n rpcUrl: zilliqaConfig.rpcUrl,\n chainType: 'ZILLIQA',\n };\n }\n\n public sendTransaction = (params: any, toDs: boolean): Promise<any> => {\n if (params.amount) params.amount = typeof params.amount === 'string' ? params.amount : params.amount.toString();\n if (params.gasPrice)\n params.gasPrice = typeof params.gasPrice === 'string' ? params.gasPrice : params.gasPrice.toString();\n if (params.gasLimit)\n params.gasLimit = typeof params.gasLimit === 'string' ? params.gasLimit : params.gasLimit.toNumber();\n\n return this.request({\n id: 42,\n method: 'zil_sendTransaction',\n jsonrpc: '2.0',\n params: {\n params,\n toDs,\n },\n });\n };\n\n public deployContract = (\n init: any,\n code: string,\n params: any,\n attempts: number,\n interval: number,\n toDs: boolean,\n ): Promise<any> => {\n if (params.amount) params.amount = typeof params.amount === 'string' ? params.amount : params.amount.toString();\n if (params.gasPrice)\n params.gasPrice = typeof params.gasPrice === 'string' ? params.gasPrice : params.gasPrice.toString();\n if (params.gasLimit)\n params.gasLimit = typeof params.gasLimit === 'string' ? params.gasLimit : params.gasLimit.toNumber();\n\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'zil_deployContract',\n params: {\n init,\n code,\n params,\n attempts,\n interval,\n toDs,\n },\n });\n };\n\n public callContract = (\n transition: string,\n args: any[],\n params: any,\n attempts = 33,\n interval = 1000,\n toDs = false,\n contractAddress: string,\n ) => {\n if (params.amount) params.amount = typeof params.amount === 'string' ? params.amount : params.amount.toString();\n if (params.gasPrice)\n params.gasPrice = typeof params.gasPrice === 'string' ? params.gasPrice : params.gasPrice.toString();\n if (params.gasLimit)\n params.gasLimit = typeof params.gasLimit === 'string' ? params.gasLimit : params.gasLimit.toNumber();\n\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'zil_callContract',\n params: {\n transition,\n args,\n params,\n attempts,\n interval,\n toDs,\n contractAddress,\n },\n });\n };\n\n public getWallet = (): Promise<object> => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'zil_getWallet',\n params: [],\n });\n };\n}\n"],"names":["zilliqaConfig","_this","name","config","sendTransaction","params","toDs","amount","toString","gasPrice","gasLimit","toNumber","request","id","method","jsonrpc","deployContract","init","code","attempts","interval","callContract","transition","args","contractAddress","getWallet","rpcUrl","chainType","Extension","Internal"],"mappings":"6KASE,WAAmBA,gBACjBC,sBADiBD,uBAJnBE,KAAO,YAEPC,gBAWOC,gBAAkB,SAACC,EAAaC,GAOrC,OANID,EAAOE,SAAQF,EAAOE,OAAkC,iBAAlBF,EAAOE,OAAsBF,EAAOE,OAASF,EAAOE,OAAOC,YACjGH,EAAOI,WACTJ,EAAOI,SAAsC,iBAApBJ,EAAOI,SAAwBJ,EAAOI,SAAWJ,EAAOI,SAASD,YACxFH,EAAOK,WACTL,EAAOK,SAAsC,iBAApBL,EAAOK,SAAwBL,EAAOK,SAAWL,EAAOK,SAASC,cAEhFC,QAAQ,CAClBC,GAAI,GACJC,OAAQ,sBACRC,QAAS,MACTV,OAAQ,CACNA,OAAAA,EACAC,KAAAA,QAKCU,eAAiB,SACtBC,EACAC,EACAb,EACAc,EACAC,EACAd,GAQA,OANID,EAAOE,SAAQF,EAAOE,OAAkC,iBAAlBF,EAAOE,OAAsBF,EAAOE,OAASF,EAAOE,OAAOC,YACjGH,EAAOI,WACTJ,EAAOI,SAAsC,iBAApBJ,EAAOI,SAAwBJ,EAAOI,SAAWJ,EAAOI,SAASD,YACxFH,EAAOK,WACTL,EAAOK,SAAsC,iBAApBL,EAAOK,SAAwBL,EAAOK,SAAWL,EAAOK,SAASC,cAEhFC,QAAQ,CAClBC,GAAI,GACJE,QAAS,MACTD,OAAQ,qBACRT,OAAQ,CACNY,KAAAA,EACAC,KAAAA,EACAb,OAAAA,EACAc,SAAAA,EACAC,SAAAA,EACAd,KAAAA,QAKCe,aAAe,SACpBC,EACAC,EACAlB,EACAc,EACAC,EACAd,EACAkB,GAQA,gBAXAL,IAAAA,EAAW,aACXC,IAAAA,EAAW,cACXd,IAAAA,GAAO,GAGHD,EAAOE,SAAQF,EAAOE,OAAkC,iBAAlBF,EAAOE,OAAsBF,EAAOE,OAASF,EAAOE,OAAOC,YACjGH,EAAOI,WACTJ,EAAOI,SAAsC,iBAApBJ,EAAOI,SAAwBJ,EAAOI,SAAWJ,EAAOI,SAASD,YACxFH,EAAOK,WACTL,EAAOK,SAAsC,iBAApBL,EAAOK,SAAwBL,EAAOK,SAAWL,EAAOK,SAASC,cAEhFC,QAAQ,CAClBC,GAAI,GACJE,QAAS,MACTD,OAAQ,mBACRT,OAAQ,CACNiB,WAAAA,EACAC,KAAAA,EACAlB,OAAAA,EACAc,SAAAA,EACAC,SAAAA,EACAd,KAAAA,EACAkB,gBAAAA,QAKCC,UAAY,WACjB,SAAYb,QAAQ,CAClBC,GAAI,GACJE,QAAS,MACTD,OAAQ,gBACRT,OAAQ,MA5FOJ,gBAAAD,EAGjBC,EAAKE,OAAS,CACZuB,OAAQ1B,EAAc0B,OACtBC,UAAW,aAVjB,0FAAsCC,YAAUC"}
@@ -0,0 +1,2 @@
1
+ import { ZilliqaExtension } from './index';
2
+ export { ZilliqaExtension as default };
@@ -1,16 +1,16 @@
1
- import { Extension } from 'magic-sdk';
2
- import { ZilliqaConfig, ConfigType } from './type';
3
- export declare class ZilliqaExtension extends Extension.Internal<'zilliqa', ZilliqaConfig> {
4
- zilliqaConfig: ZilliqaConfig;
5
- name: "zilliqa";
6
- config: ConfigType;
7
- constructor(zilliqaConfig: ZilliqaConfig);
8
- sendTransaction: (params: any, toDs: boolean) => Promise<any>;
9
- deployContract: (init: any, code: string, params: any, attempts: number, interval: number, toDs: boolean) => Promise<any>;
10
- callContract: (transition: string, args: any[], params: any, attempts: number | undefined, interval: number | undefined, toDs: boolean | undefined, contractAddress: string) => import("magic-sdk/dist/cjs/util/promise-tools").PromiEvent<any, {
11
- done: (result: any) => void;
12
- error: (err: import("magic-sdk").SDKError | import("magic-sdk").RPCError) => void;
13
- settled: () => void;
14
- }>;
15
- getWallet: () => Promise<object>;
16
- }
1
+ import { Extension } from '@magic-sdk/commons';
2
+ import { ZilliqaConfig, ConfigType } from './type';
3
+ export declare class ZilliqaExtension extends Extension.Internal<'zilliqa', ZilliqaConfig> {
4
+ zilliqaConfig: ZilliqaConfig;
5
+ name: "zilliqa";
6
+ config: ConfigType;
7
+ constructor(zilliqaConfig: ZilliqaConfig);
8
+ sendTransaction: (params: any, toDs: boolean) => Promise<any>;
9
+ deployContract: (init: any, code: string, params: any, attempts: number, interval: number, toDs: boolean) => Promise<any>;
10
+ callContract: (transition: string, args: any[], params: any, attempts: number | undefined, interval: number | undefined, toDs: boolean | undefined, contractAddress: string) => import("@magic-sdk/commons").PromiEvent<any, {
11
+ done: (result: any) => void;
12
+ error: (reason: any) => void;
13
+ settled: () => void;
14
+ }>;
15
+ getWallet: () => Promise<object>;
16
+ }
package/package.json CHANGED
@@ -1,20 +1,34 @@
1
1
  {
2
2
  "name": "@magic-ext/zilliqa",
3
- "version": "0.1.8",
4
- "description": " magic zilliqa extension",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
8
- "build": "webpack",
9
- "build:prod": "export NODE_ENV=production && webpack"
3
+ "version": "1.0.0",
4
+ "description": "magic zilliqa extension",
5
+ "author": "Magic <team@magic.link> (https://magic.link/)",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/magiclabs/magic-js"
10
10
  },
11
- "peerDependencies": {
12
- "magic-sdk": "^1.4.0"
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "target": "web",
15
+ "cdnGlobalName": "MagicZilliqaExtension",
16
+ "main": "./dist/cjs/index.js",
17
+ "module": "./dist/es/index.js",
18
+ "types": "./dist/types/index.d.ts",
19
+ "jsdelivr": "./dist/extension.js",
20
+ "react-native": "./dist/react-native/index.native.js",
21
+ "exports": {
22
+ "import": "./dist/modern/index.mjs",
23
+ "require": "./dist/cjs/index.js"
24
+ },
25
+ "externals": {
26
+ "include": [
27
+ "@magic-sdk/commons"
28
+ ]
13
29
  },
14
- "author": "Fortmatic <team@fortmatic.com> (https://fortmatic.com/)",
15
- "license": "MIT",
16
30
  "devDependencies": {
17
- "magic-sdk": "^1.4.0"
31
+ "@magic-sdk/commons": "^2.2.1"
18
32
  },
19
- "gitHead": "cf2a3d7139192210b0a8ebb213f8f06fc7b23a01"
33
+ "gitHead": "d309ebe9694341a39001f233e2e426839de4713d"
20
34
  }
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- module.exports=function(t){var r={};function n(e){if(r[e])return r[e].exports;var i=r[e]={i:e,l:!1,exports:{}};return t[e].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=r,n.d=function(t,r,e){n.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:e})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,r){if(1&r&&(t=n(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)n.d(e,i,function(r){return t[r]}.bind(null,i));return e},n.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(r,"a",r),r},n.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},n.p="",n(n.s=1)}([function(t,r){t.exports=require("magic-sdk")},function(t,r,n){"use strict";n.r(r),n.d(r,"ZilliqaExtension",(function(){return a}));var e,i=n(0),o=(e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])})(t,r)},function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}),a=function(t){function r(r){var n=t.call(this)||this;return n.zilliqaConfig=r,n.name="zilliqa",n.sendTransaction=function(t,r){return t.amount&&(t.amount="string"==typeof t.amount?t.amount:t.amount.toString()),t.gasPrice&&(t.gasPrice="string"==typeof t.gasPrice?t.gasPrice:t.gasPrice.toString()),t.gasLimit&&(t.gasLimit="string"==typeof t.gasLimit?t.gasLimit:t.gasLimit.toNumber()),n.request({id:42,method:"zil_sendTransaction",jsonrpc:"2.0",params:{params:t,toDs:r}})},n.deployContract=function(t,r,e,i,o,a){return e.amount&&(e.amount="string"==typeof e.amount?e.amount:e.amount.toString()),e.gasPrice&&(e.gasPrice="string"==typeof e.gasPrice?e.gasPrice:e.gasPrice.toString()),e.gasLimit&&(e.gasLimit="string"==typeof e.gasLimit?e.gasLimit:e.gasLimit.toNumber()),n.request({id:42,jsonrpc:"2.0",method:"zil_deployContract",params:{init:t,code:r,params:e,attempts:i,interval:o,toDs:a}})},n.callContract=function(t,r,e,i,o,a,s){return void 0===i&&(i=33),void 0===o&&(o=1e3),void 0===a&&(a=!1),e.amount&&(e.amount="string"==typeof e.amount?e.amount:e.amount.toString()),e.gasPrice&&(e.gasPrice="string"==typeof e.gasPrice?e.gasPrice:e.gasPrice.toString()),e.gasLimit&&(e.gasLimit="string"==typeof e.gasLimit?e.gasLimit:e.gasLimit.toNumber()),n.request({id:42,jsonrpc:"2.0",method:"zil_callContract",params:{transition:t,args:r,params:e,attempts:i,interval:o,toDs:a,contractAddress:s}})},n.getWallet=function(){return n.request({id:42,jsonrpc:"2.0",method:"zil_getWallet",params:[]})},n.config={rpcUrl:r.rpcUrl,chainType:"ZILLIQA"},n}return o(r,t),r}(i.Extension.Internal)}]);
@@ -1,7 +0,0 @@
1
- export interface ZilliqaConfig {
2
- rpcUrl: string;
3
- }
4
- export interface ConfigType {
5
- rpcUrl: string;
6
- chainType: string;
7
- }
package/src/index.ts DELETED
@@ -1,113 +0,0 @@
1
- import { Extension } from 'magic-sdk';
2
- import { ZilliqaConfig, ConfigType } from './type'
3
-
4
- export class ZilliqaExtension extends Extension.Internal<
5
- 'zilliqa',
6
- ZilliqaConfig
7
- > {
8
- name = 'zilliqa' as const;
9
-
10
- config: ConfigType;
11
-
12
- constructor(public zilliqaConfig: ZilliqaConfig){
13
- super();
14
-
15
- this.config = {
16
- rpcUrl: zilliqaConfig.rpcUrl,
17
- chainType: 'ZILLIQA'
18
- };
19
- }
20
-
21
- public sendTransaction = (params: any, toDs: boolean): Promise<any> => {
22
-
23
- if(params.amount)
24
- params.amount = typeof params.amount === 'string'? params.amount : params.amount.toString();
25
- if(params.gasPrice)
26
- params.gasPrice = typeof params.gasPrice === 'string'? params.gasPrice : params.gasPrice.toString();
27
- if(params.gasLimit)
28
- params.gasLimit = typeof params.gasLimit === 'string'? params.gasLimit : params.gasLimit.toNumber();
29
-
30
- return this.request({
31
- id:42,
32
- method: 'zil_sendTransaction',
33
- jsonrpc: '2.0',
34
- params: {
35
- params,
36
- toDs,
37
- }
38
- })
39
- }
40
-
41
- public deployContract = (
42
- init: any,
43
- code: string,
44
- params: any,
45
- attempts: number,
46
- interval: number,
47
- toDs: boolean,
48
- ): Promise<any> => {
49
-
50
- if(params.amount)
51
- params.amount = typeof params.amount === 'string'? params.amount : params.amount.toString();
52
- if(params.gasPrice)
53
- params.gasPrice = typeof params.gasPrice === 'string'? params.gasPrice : params.gasPrice.toString();
54
- if(params.gasLimit)
55
- params.gasLimit = typeof params.gasLimit === 'string'? params.gasLimit : params.gasLimit.toNumber();
56
-
57
- return this.request({
58
- id:42,
59
- jsonrpc: '2.0',
60
- method: 'zil_deployContract',
61
- params: {
62
- init,
63
- code,
64
- params,
65
- attempts,
66
- interval,
67
- toDs,
68
- }
69
- })
70
- };
71
-
72
- public callContract = (
73
- transition: string,
74
- args: any[],
75
- params: any,
76
- attempts: number = 33,
77
- interval: number = 1000,
78
- toDs: boolean = false,
79
- contractAddress: string
80
- ) => {
81
-
82
- if(params.amount)
83
- params.amount = typeof params.amount === 'string'? params.amount : params.amount.toString();
84
- if(params.gasPrice)
85
- params.gasPrice = typeof params.gasPrice === 'string'? params.gasPrice : params.gasPrice.toString();
86
- if(params.gasLimit)
87
- params.gasLimit = typeof params.gasLimit === 'string'? params.gasLimit : params.gasLimit.toNumber();
88
-
89
- return this.request({
90
- id:42,
91
- jsonrpc: '2.0',
92
- method: 'zil_callContract',
93
- params: {
94
- transition,
95
- args,
96
- params,
97
- attempts,
98
- interval,
99
- toDs,
100
- contractAddress,
101
- }
102
- })
103
- }
104
-
105
- public getWallet = (): Promise<object> => {
106
- return this.request({
107
- id:42,
108
- jsonrpc: '2.0',
109
- method: 'zil_getWallet',
110
- params: []
111
- })
112
- }
113
- }
package/src/type.ts DELETED
@@ -1,8 +0,0 @@
1
- export interface ZilliqaConfig {
2
- rpcUrl: string;
3
- }
4
-
5
- export interface ConfigType {
6
- rpcUrl: string;
7
- chainType: string;
8
- }
package/tsconfig.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "./dist",
4
- "moduleResolution": "node",
5
- "noImplicitAny": true,
6
- "module": "es6",
7
- "target": "es5",
8
- "allowJs": true,
9
- "strict": true,
10
- "allowSyntheticDefaultImports": true,
11
- "experimentalDecorators": true,
12
- "noImplicitReturns": true,
13
- "noImplicitThis": true,
14
- "esModuleInterop": true,
15
- "downlevelIteration": true,
16
- "sourceMap": true,
17
- "declaration": true
18
- }
19
- }
package/webpack.config.js DELETED
@@ -1,28 +0,0 @@
1
- const path = require('path');
2
-
3
- const isDevelopment = process.env.NODE_ENV !== 'production';
4
-
5
- module.exports = {
6
- entry: './src/index.ts',
7
- mode: isDevelopment ? 'development' : 'production',
8
- module: {
9
- rules: [
10
- {
11
- test: /\.tsx?$/,
12
- use: 'ts-loader',
13
- exclude: /node_modules/,
14
- },
15
- ],
16
- },
17
- resolve: {
18
- extensions: [ '.ts', '.js' ],
19
- },
20
- externals: {
21
- 'magic-sdk': 'magic-sdk'
22
- },
23
- output: {
24
- filename: 'index.js',
25
- path: path.resolve(__dirname, './dist'),
26
- libraryTarget: 'commonjs2'
27
- },
28
- };