@magic-ext/zilliqa 0.1.8 → 3.0.1

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,44 @@
1
+ # v3.0.1 (Tue Jan 25 2022)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Fix CDN build targets [#270](https://github.com/magiclabs/magic-js/pull/270) ([@smithki](https://github.com/smithki))
6
+ - Fix CDN issues related to ESBuild ([@smithki](https://github.com/smithki))
7
+
8
+ #### Authors: 1
9
+
10
+ - Ian K Smith ([@smithki](https://github.com/smithki))
11
+
12
+ ---
13
+
14
+ # v3.0.0 (Tue Jan 25 2022)
15
+
16
+ #### 💥 Breaking Change
17
+
18
+ - Switch from `microbundle` to `esbuild` [#220](https://github.com/magiclabs/magic-js/pull/220) ([@smithki](https://github.com/smithki))
19
+
20
+ #### 🐛 Bug Fix
21
+
22
+ - Merge with master ([@smithki](https://github.com/smithki))
23
+ - Merge branch 'master' into feat/faster-builds ([@smithki](https://github.com/smithki))
24
+ - Modify CDN default exports ([@smithki](https://github.com/smithki))
25
+ - Support newly added Magic JS extensions in ESBuild ([@smithki](https://github.com/smithki))
26
+
27
+ #### Authors: 1
28
+
29
+ - Ian K Smith ([@smithki](https://github.com/smithki))
30
+
31
+ ---
32
+
33
+ # v1.0.0 (Thu Dec 09 2021)
34
+
35
+ #### 💥 Breaking Change
36
+
37
+ - 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))
38
+
39
+ #### Authors: 1
40
+
41
+ - Jerry Liu ([@Ethella](https://github.com/Ethella))
42
+
43
+ ---
44
+
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 l=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var L=o=>l(o,"__esModule",{value:!0});var b=(o,i)=>{for(var n in i)l(o,n,{get:i[n],enumerable:!0})},d=(o,i,n,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let e of y(i))!P.call(o,e)&&(n||e!=="default")&&l(o,e,{get:()=>i[e],enumerable:!(t=f(i,e))||t.enumerable});return o};var h=(o=>(i,n)=>o&&o.get(i)||(n=d(L({}),i,1),o&&o.set(i,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var q={};b(q,{ZilliqaExtension:()=>u});var r=require("@magic-sdk/commons"),u=class extends r.Extension.Internal{constructor(i){super();this.zilliqaConfig=i;this.name="zilliqa";this.sendTransaction=(i,n)=>(i.amount&&(i.amount=typeof i.amount=="string"?i.amount:i.amount.toString()),i.gasPrice&&(i.gasPrice=typeof i.gasPrice=="string"?i.gasPrice:i.gasPrice.toString()),i.gasLimit&&(i.gasLimit=typeof i.gasLimit=="string"?i.gasLimit:i.gasLimit.toNumber()),this.request({id:42,method:"zil_sendTransaction",jsonrpc:"2.0",params:{params:i,toDs:n}}));this.deployContract=(i,n,t,e,g,c)=>(t.amount&&(t.amount=typeof t.amount=="string"?t.amount:t.amount.toString()),t.gasPrice&&(t.gasPrice=typeof t.gasPrice=="string"?t.gasPrice:t.gasPrice.toString()),t.gasLimit&&(t.gasLimit=typeof t.gasLimit=="string"?t.gasLimit:t.gasLimit.toNumber()),this.request({id:42,jsonrpc:"2.0",method:"zil_deployContract",params:{init:i,code:n,params:t,attempts:e,interval:g,toDs:c}}));this.callContract=(i,n,t,e=33,g=1e3,c=!1,s)=>(t.amount&&(t.amount=typeof t.amount=="string"?t.amount:t.amount.toString()),t.gasPrice&&(t.gasPrice=typeof t.gasPrice=="string"?t.gasPrice:t.gasPrice.toString()),t.gasLimit&&(t.gasLimit=typeof t.gasLimit=="string"?t.gasLimit:t.gasLimit.toNumber()),this.request({id:42,jsonrpc:"2.0",method:"zil_callContract",params:{transition:i,args:n,params:t,attempts:e,interval:g,toDs:c,contractAddress:s}}));this.getWallet=()=>this.request({id:42,jsonrpc:"2.0",method:"zil_getWallet",params:[]});this.config={rpcUrl:i.rpcUrl,chainType:"ZILLIQA"}}};module.exports=h(q);
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "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"],
5
+ "mappings": "8gBAAA,uCACA,MAA0B,8BAGnB,eAA+B,aAAU,QAAmC,CAKjF,YAAmB,EAA8B,CAC/C,QADiB,qBAJnB,UAAO,UAaA,qBAAkB,CAAC,EAAa,IACjC,GAAO,QAAQ,GAAO,OAAS,MAAO,GAAO,QAAW,SAAW,EAAO,OAAS,EAAO,OAAO,YACjG,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YACxF,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YAErF,KAAK,QAAQ,CAClB,GAAI,GACJ,OAAQ,sBACR,QAAS,MACT,OAAQ,CACN,SACA,WAKC,oBAAiB,CACtB,EACA,EACA,EACA,EACA,EACA,IAEI,GAAO,QAAQ,GAAO,OAAS,MAAO,GAAO,QAAW,SAAW,EAAO,OAAS,EAAO,OAAO,YACjG,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YACxF,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YAErF,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,qBACR,OAAQ,CACN,OACA,OACA,SACA,WACA,WACA,WAKC,kBAAe,CACpB,EACA,EACA,EACA,EAAW,GACX,EAAW,IACX,EAAO,GACP,IAEI,GAAO,QAAQ,GAAO,OAAS,MAAO,GAAO,QAAW,SAAW,EAAO,OAAS,EAAO,OAAO,YACjG,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YACxF,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YAErF,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,mBACR,OAAQ,CACN,aACA,OACA,SACA,WACA,WACA,OACA,sBAKC,eAAY,IACV,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,gBACR,OAAQ,KAzFV,KAAK,OAAS,CACZ,OAAQ,EAAc,OACtB,UAAW",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ import{Extension as l}from"@magic-sdk/commons";var r=class extends l.Internal{constructor(t){super();this.zilliqaConfig=t;this.name="zilliqa";this.sendTransaction=(t,n)=>(t.amount&&(t.amount=typeof t.amount=="string"?t.amount:t.amount.toString()),t.gasPrice&&(t.gasPrice=typeof t.gasPrice=="string"?t.gasPrice:t.gasPrice.toString()),t.gasLimit&&(t.gasLimit=typeof t.gasLimit=="string"?t.gasLimit:t.gasLimit.toNumber()),this.request({id:42,method:"zil_sendTransaction",jsonrpc:"2.0",params:{params:t,toDs:n}}));this.deployContract=(t,n,i,o,e,g)=>(i.amount&&(i.amount=typeof i.amount=="string"?i.amount:i.amount.toString()),i.gasPrice&&(i.gasPrice=typeof i.gasPrice=="string"?i.gasPrice:i.gasPrice.toString()),i.gasLimit&&(i.gasLimit=typeof i.gasLimit=="string"?i.gasLimit:i.gasLimit.toNumber()),this.request({id:42,jsonrpc:"2.0",method:"zil_deployContract",params:{init:t,code:n,params:i,attempts:o,interval:e,toDs:g}}));this.callContract=(t,n,i,o=33,e=1e3,g=!1,c)=>(i.amount&&(i.amount=typeof i.amount=="string"?i.amount:i.amount.toString()),i.gasPrice&&(i.gasPrice=typeof i.gasPrice=="string"?i.gasPrice:i.gasPrice.toString()),i.gasLimit&&(i.gasLimit=typeof i.gasLimit=="string"?i.gasLimit:i.gasLimit.toNumber()),this.request({id:42,jsonrpc:"2.0",method:"zil_callContract",params:{transition:t,args:n,params:i,attempts:o,interval:e,toDs:g,contractAddress:c}}));this.getWallet=()=>this.request({id:42,jsonrpc:"2.0",method:"zil_getWallet",params:[]});this.config={rpcUrl:t.rpcUrl,chainType:"ZILLIQA"}}};export{r as ZilliqaExtension};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "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"],
5
+ "mappings": "AACA,+CAGO,mBAA+B,GAAU,QAAmC,CAKjF,YAAmB,EAA8B,CAC/C,QADiB,qBAJnB,UAAO,UAaA,qBAAkB,CAAC,EAAa,IACjC,GAAO,QAAQ,GAAO,OAAS,MAAO,GAAO,QAAW,SAAW,EAAO,OAAS,EAAO,OAAO,YACjG,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YACxF,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YAErF,KAAK,QAAQ,CAClB,GAAI,GACJ,OAAQ,sBACR,QAAS,MACT,OAAQ,CACN,SACA,WAKC,oBAAiB,CACtB,EACA,EACA,EACA,EACA,EACA,IAEI,GAAO,QAAQ,GAAO,OAAS,MAAO,GAAO,QAAW,SAAW,EAAO,OAAS,EAAO,OAAO,YACjG,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YACxF,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YAErF,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,qBACR,OAAQ,CACN,OACA,OACA,SACA,WACA,WACA,WAKC,kBAAe,CACpB,EACA,EACA,EACA,EAAW,GACX,EAAW,IACX,EAAO,GACP,IAEI,GAAO,QAAQ,GAAO,OAAS,MAAO,GAAO,QAAW,SAAW,EAAO,OAAS,EAAO,OAAO,YACjG,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YACxF,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YAErF,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,mBACR,OAAQ,CACN,aACA,OACA,SACA,WACA,WACA,OACA,sBAKC,eAAY,IACV,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,gBACR,OAAQ,KAzFV,KAAK,OAAS,CACZ,OAAQ,EAAc,OACtB,UAAW",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ import{Extension as l}from"@magic-sdk/commons";var r=class extends l.Internal{constructor(t){super();this.zilliqaConfig=t;this.name="zilliqa";this.sendTransaction=(t,n)=>(t.amount&&(t.amount=typeof t.amount=="string"?t.amount:t.amount.toString()),t.gasPrice&&(t.gasPrice=typeof t.gasPrice=="string"?t.gasPrice:t.gasPrice.toString()),t.gasLimit&&(t.gasLimit=typeof t.gasLimit=="string"?t.gasLimit:t.gasLimit.toNumber()),this.request({id:42,method:"zil_sendTransaction",jsonrpc:"2.0",params:{params:t,toDs:n}}));this.deployContract=(t,n,i,o,e,g)=>(i.amount&&(i.amount=typeof i.amount=="string"?i.amount:i.amount.toString()),i.gasPrice&&(i.gasPrice=typeof i.gasPrice=="string"?i.gasPrice:i.gasPrice.toString()),i.gasLimit&&(i.gasLimit=typeof i.gasLimit=="string"?i.gasLimit:i.gasLimit.toNumber()),this.request({id:42,jsonrpc:"2.0",method:"zil_deployContract",params:{init:t,code:n,params:i,attempts:o,interval:e,toDs:g}}));this.callContract=(t,n,i,o=33,e=1e3,g=!1,c)=>(i.amount&&(i.amount=typeof i.amount=="string"?i.amount:i.amount.toString()),i.gasPrice&&(i.gasPrice=typeof i.gasPrice=="string"?i.gasPrice:i.gasPrice.toString()),i.gasLimit&&(i.gasLimit=typeof i.gasLimit=="string"?i.gasLimit:i.gasLimit.toNumber()),this.request({id:42,jsonrpc:"2.0",method:"zil_callContract",params:{transition:t,args:n,params:i,attempts:o,interval:e,toDs:g,contractAddress:c}}));this.getWallet=()=>this.request({id:42,jsonrpc:"2.0",method:"zil_getWallet",params:[]});this.config={rpcUrl:t.rpcUrl,chainType:"ZILLIQA"}}};export{r as ZilliqaExtension};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "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"],
5
+ "mappings": "AACA,+CAGO,mBAA+B,GAAU,QAAmC,CAKjF,YAAmB,EAA8B,CAC/C,QADiB,qBAJnB,UAAO,UAaA,qBAAkB,CAAC,EAAa,IACjC,GAAO,QAAQ,GAAO,OAAS,MAAO,GAAO,QAAW,SAAW,EAAO,OAAS,EAAO,OAAO,YACjG,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YACxF,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YAErF,KAAK,QAAQ,CAClB,GAAI,GACJ,OAAQ,sBACR,QAAS,MACT,OAAQ,CACN,SACA,WAKC,oBAAiB,CACtB,EACA,EACA,EACA,EACA,EACA,IAEI,GAAO,QAAQ,GAAO,OAAS,MAAO,GAAO,QAAW,SAAW,EAAO,OAAS,EAAO,OAAO,YACjG,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YACxF,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YAErF,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,qBACR,OAAQ,CACN,OACA,OACA,SACA,WACA,WACA,WAKC,kBAAe,CACpB,EACA,EACA,EACA,EAAW,GACX,EAAW,IACX,EAAO,GACP,IAEI,GAAO,QAAQ,GAAO,OAAS,MAAO,GAAO,QAAW,SAAW,EAAO,OAAS,EAAO,OAAO,YACjG,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YACxF,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YAErF,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,mBACR,OAAQ,CACN,aACA,OACA,SACA,WACA,WACA,OACA,sBAKC,eAAY,IACV,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,gBACR,OAAQ,KAzFV,KAAK,OAAS,CACZ,OAAQ,EAAc,OACtB,UAAW",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ var MagicZilliqaExtension=(()=>{var d=Object.create;var g=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var u=n=>g(n,"__esModule",{value:!0});var m=(n,i)=>()=>(i||n((i={exports:{}}).exports,i),i.exports),x=(n,i)=>{for(var o in i)g(n,o,{get:i[o],enumerable:!0})},s=(n,i,o,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let e of h(i))!C.call(n,e)&&(o||e!=="default")&&g(n,e,{get:()=>i[e],enumerable:!(t=b(i,e))||t.enumerable});return n},z=(n,i)=>s(u(g(n!=null?d(q(n)):{},"default",!i&&n&&n.__esModule?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n),S=(n=>(i,o)=>n&&n.get(i)||(o=s(u({}),i,1),n&&n.set(i,o),o))(typeof WeakMap!="undefined"?new WeakMap:0);var y=m((_,f)=>{f.exports=Magic});var T={};x(T,{default:()=>j});var P=z(y()),r=class extends P.Extension.Internal{constructor(i){super();this.zilliqaConfig=i;this.name="zilliqa";this.sendTransaction=(i,o)=>(i.amount&&(i.amount=typeof i.amount=="string"?i.amount:i.amount.toString()),i.gasPrice&&(i.gasPrice=typeof i.gasPrice=="string"?i.gasPrice:i.gasPrice.toString()),i.gasLimit&&(i.gasLimit=typeof i.gasLimit=="string"?i.gasLimit:i.gasLimit.toNumber()),this.request({id:42,method:"zil_sendTransaction",jsonrpc:"2.0",params:{params:i,toDs:o}}));this.deployContract=(i,o,t,e,c,l)=>(t.amount&&(t.amount=typeof t.amount=="string"?t.amount:t.amount.toString()),t.gasPrice&&(t.gasPrice=typeof t.gasPrice=="string"?t.gasPrice:t.gasPrice.toString()),t.gasLimit&&(t.gasLimit=typeof t.gasLimit=="string"?t.gasLimit:t.gasLimit.toNumber()),this.request({id:42,jsonrpc:"2.0",method:"zil_deployContract",params:{init:i,code:o,params:t,attempts:e,interval:c,toDs:l}}));this.callContract=(i,o,t,e=33,c=1e3,l=!1,L)=>(t.amount&&(t.amount=typeof t.amount=="string"?t.amount:t.amount.toString()),t.gasPrice&&(t.gasPrice=typeof t.gasPrice=="string"?t.gasPrice:t.gasPrice.toString()),t.gasLimit&&(t.gasLimit=typeof t.gasLimit=="string"?t.gasLimit:t.gasLimit.toNumber()),this.request({id:42,jsonrpc:"2.0",method:"zil_callContract",params:{transition:i,args:o,params:t,attempts:e,interval:c,toDs:l,contractAddress:L}}));this.getWallet=()=>this.request({id:42,jsonrpc:"2.0",method:"zil_getWallet",params:[]});this.config={rpcUrl:i.rpcUrl,chainType:"ZILLIQA"}}};var j=r;return S(T);})();
2
+ if (MagicZilliqaExtension && MagicZilliqaExtension.default != null) { MagicZilliqaExtension = Object.assign(MagicZilliqaExtension.default, MagicZilliqaExtension); delete MagicZilliqaExtension.default; }
@@ -0,0 +1,2 @@
1
+ var l=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var L=o=>l(o,"__esModule",{value:!0});var b=(o,i)=>{for(var n in i)l(o,n,{get:i[n],enumerable:!0})},d=(o,i,n,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let e of y(i))!P.call(o,e)&&(n||e!=="default")&&l(o,e,{get:()=>i[e],enumerable:!(t=f(i,e))||t.enumerable});return o};var h=(o=>(i,n)=>o&&o.get(i)||(n=d(L({}),i,1),o&&o.set(i,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var q={};b(q,{ZilliqaExtension:()=>u});var r=require("@magic-sdk/commons"),u=class extends r.Extension.Internal{constructor(i){super();this.zilliqaConfig=i;this.name="zilliqa";this.sendTransaction=(i,n)=>(i.amount&&(i.amount=typeof i.amount=="string"?i.amount:i.amount.toString()),i.gasPrice&&(i.gasPrice=typeof i.gasPrice=="string"?i.gasPrice:i.gasPrice.toString()),i.gasLimit&&(i.gasLimit=typeof i.gasLimit=="string"?i.gasLimit:i.gasLimit.toNumber()),this.request({id:42,method:"zil_sendTransaction",jsonrpc:"2.0",params:{params:i,toDs:n}}));this.deployContract=(i,n,t,e,g,c)=>(t.amount&&(t.amount=typeof t.amount=="string"?t.amount:t.amount.toString()),t.gasPrice&&(t.gasPrice=typeof t.gasPrice=="string"?t.gasPrice:t.gasPrice.toString()),t.gasLimit&&(t.gasLimit=typeof t.gasLimit=="string"?t.gasLimit:t.gasLimit.toNumber()),this.request({id:42,jsonrpc:"2.0",method:"zil_deployContract",params:{init:i,code:n,params:t,attempts:e,interval:g,toDs:c}}));this.callContract=(i,n,t,e=33,g=1e3,c=!1,s)=>(t.amount&&(t.amount=typeof t.amount=="string"?t.amount:t.amount.toString()),t.gasPrice&&(t.gasPrice=typeof t.gasPrice=="string"?t.gasPrice:t.gasPrice.toString()),t.gasLimit&&(t.gasLimit=typeof t.gasLimit=="string"?t.gasLimit:t.gasLimit.toNumber()),this.request({id:42,jsonrpc:"2.0",method:"zil_callContract",params:{transition:i,args:n,params:t,attempts:e,interval:g,toDs:c,contractAddress:s}}));this.getWallet=()=>this.request({id:42,jsonrpc:"2.0",method:"zil_getWallet",params:[]});this.config={rpcUrl:i.rpcUrl,chainType:"ZILLIQA"}}};module.exports=h(q);
2
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "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"],
5
+ "mappings": "8gBAAA,uCACA,MAA0B,8BAGnB,eAA+B,aAAU,QAAmC,CAKjF,YAAmB,EAA8B,CAC/C,QADiB,qBAJnB,UAAO,UAaA,qBAAkB,CAAC,EAAa,IACjC,GAAO,QAAQ,GAAO,OAAS,MAAO,GAAO,QAAW,SAAW,EAAO,OAAS,EAAO,OAAO,YACjG,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YACxF,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YAErF,KAAK,QAAQ,CAClB,GAAI,GACJ,OAAQ,sBACR,QAAS,MACT,OAAQ,CACN,SACA,WAKC,oBAAiB,CACtB,EACA,EACA,EACA,EACA,EACA,IAEI,GAAO,QAAQ,GAAO,OAAS,MAAO,GAAO,QAAW,SAAW,EAAO,OAAS,EAAO,OAAO,YACjG,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YACxF,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YAErF,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,qBACR,OAAQ,CACN,OACA,OACA,SACA,WACA,WACA,WAKC,kBAAe,CACpB,EACA,EACA,EACA,EAAW,GACX,EAAW,IACX,EAAO,GACP,IAEI,GAAO,QAAQ,GAAO,OAAS,MAAO,GAAO,QAAW,SAAW,EAAO,OAAS,EAAO,OAAO,YACjG,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YACxF,EAAO,UACT,GAAO,SAAW,MAAO,GAAO,UAAa,SAAW,EAAO,SAAW,EAAO,SAAS,YAErF,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,mBACR,OAAQ,CACN,aACA,OACA,SACA,WACA,WACA,OACA,sBAKC,eAAY,IACV,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,gBACR,OAAQ,KAzFV,KAAK,OAAS,CACZ,OAAQ,EAAc,OACtB,UAAW",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ import { ZilliqaExtension } from './index';
2
+ export default ZilliqaExtension;
@@ -1,4 +1,4 @@
1
- import { Extension } from 'magic-sdk';
1
+ import { Extension } from '@magic-sdk/commons';
2
2
  import { ZilliqaConfig, ConfigType } from './type';
3
3
  export declare class ZilliqaExtension extends Extension.Internal<'zilliqa', ZilliqaConfig> {
4
4
  zilliqaConfig: ZilliqaConfig;
@@ -7,9 +7,9 @@ export declare class ZilliqaExtension extends Extension.Internal<'zilliqa', Zill
7
7
  constructor(zilliqaConfig: ZilliqaConfig);
8
8
  sendTransaction: (params: any, toDs: boolean) => Promise<any>;
9
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, {
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
11
  done: (result: any) => void;
12
- error: (err: import("magic-sdk").SDKError | import("magic-sdk").RPCError) => void;
12
+ error: (reason: any) => void;
13
13
  settled: () => void;
14
14
  }>;
15
15
  getWallet: () => Promise<object>;
@@ -0,0 +1 @@
1
+ export * from './index';
File without changes
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": "3.0.1",
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": "neutral",
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/es/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": "^4.0.0"
18
32
  },
19
- "gitHead": "cf2a3d7139192210b0a8ebb213f8f06fc7b23a01"
33
+ "gitHead": "d438b0b289fd4dd06a19bbb0f9f8d27bb067cea0"
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)}]);
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
- };