@magic-ext/zilliqa 2.0.0 → 3.1.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 CHANGED
@@ -1,3 +1,51 @@
1
+ # v3.1.0 (Mon Mar 07 2022)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Update READMEs with outdated context/hyperlinks ([@smithki](https://github.com/smithki))
6
+
7
+ #### 🏠 Internal
8
+
9
+ - Internal documentation updates (`BUILD_SYSTEM.md`) [#283](https://github.com/magiclabs/magic-js/pull/283) ([@smithki](https://github.com/smithki))
10
+
11
+ #### Authors: 1
12
+
13
+ - Ian K Smith ([@smithki](https://github.com/smithki))
14
+
15
+ ---
16
+
17
+ # v3.0.1 (Tue Jan 25 2022)
18
+
19
+ #### 🐛 Bug Fix
20
+
21
+ - Fix CDN build targets [#270](https://github.com/magiclabs/magic-js/pull/270) ([@smithki](https://github.com/smithki))
22
+ - Fix CDN issues related to ESBuild ([@smithki](https://github.com/smithki))
23
+
24
+ #### Authors: 1
25
+
26
+ - Ian K Smith ([@smithki](https://github.com/smithki))
27
+
28
+ ---
29
+
30
+ # v3.0.0 (Tue Jan 25 2022)
31
+
32
+ #### 💥 Breaking Change
33
+
34
+ - Switch from `microbundle` to `esbuild` [#220](https://github.com/magiclabs/magic-js/pull/220) ([@smithki](https://github.com/smithki))
35
+
36
+ #### 🐛 Bug Fix
37
+
38
+ - Merge with master ([@smithki](https://github.com/smithki))
39
+ - Merge branch 'master' into feat/faster-builds ([@smithki](https://github.com/smithki))
40
+ - Modify CDN default exports ([@smithki](https://github.com/smithki))
41
+ - Support newly added Magic JS extensions in ESBuild ([@smithki](https://github.com/smithki))
42
+
43
+ #### Authors: 1
44
+
45
+ - Ian K Smith ([@smithki](https://github.com/smithki))
46
+
47
+ ---
48
+
1
49
  # v1.0.0 (Thu Dec 09 2021)
2
50
 
3
51
  #### 💥 Breaking Change
package/README.md CHANGED
@@ -34,7 +34,7 @@ const magic = new Magic('YOUR_API_KEY', {
34
34
  ```
35
35
 
36
36
  ## Magic SDK
37
- See the [developer documentation](https://docs.magic.link) to learn how you can master the Magic SDK in a matter of minutes.
37
+ See the [developer documentation](https://magic.link/docs) to learn how you can master the Magic SDK in a matter of minutes.
38
38
 
39
39
 
40
40
  ## Usage
package/dist/cjs/index.js CHANGED
@@ -1,2 +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);
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
2
  //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
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,EAAO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,MA5FOJ,gBAAAD,EAGjBC,EAAKE,OAAS,CACZuB,OAAQ1B,EAAc0B,OACtBC,UAAW,aAVjB,0FAAsCC,YAAUC"}
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
+ }
package/dist/es/index.js CHANGED
@@ -1,2 +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};
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
2
  //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
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,CA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CACZuB,OAAQ1B,EAAc0B,OACtBC,UAAW,aAVjB,0FAAsCC,EAAUC"}
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
+ }
package/dist/extension.js CHANGED
@@ -1 +1,2 @@
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)}();
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; }
@@ -1,2 +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);
1
+ var r=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var L=o=>r(o,"__esModule",{value:!0});var b=(o,i)=>{for(var n in i)r(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")&&r(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 l=require("@magic-sdk/commons"),u=class extends l.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
2
  //# sourceMappingURL=index.native.js.map
@@ -1 +1,7 @@
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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cesContent": ["export * from './index';\n", "/* 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,uCCCA,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
+ }
@@ -1,2 +1,2 @@
1
- import { ZilliqaExtension } from './index';
2
- export { ZilliqaExtension as default };
1
+ import { ZilliqaExtension } from './index';
2
+ export default ZilliqaExtension;
@@ -1,16 +1,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
- }
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
+ }
@@ -0,0 +1 @@
1
+ export * from './index';
@@ -0,0 +1,7 @@
1
+ export interface ZilliqaConfig {
2
+ rpcUrl: string;
3
+ }
4
+ export interface ConfigType {
5
+ rpcUrl: string;
6
+ chainType: string;
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magic-ext/zilliqa",
3
- "version": "2.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "magic zilliqa extension",
5
5
  "author": "Magic <team@magic.link> (https://magic.link/)",
6
6
  "license": "MIT",
@@ -11,7 +11,7 @@
11
11
  "files": [
12
12
  "dist"
13
13
  ],
14
- "target": "web",
14
+ "target": "neutral",
15
15
  "cdnGlobalName": "MagicZilliqaExtension",
16
16
  "main": "./dist/cjs/index.js",
17
17
  "module": "./dist/es/index.js",
@@ -19,7 +19,7 @@
19
19
  "jsdelivr": "./dist/extension.js",
20
20
  "react-native": "./dist/react-native/index.native.js",
21
21
  "exports": {
22
- "import": "./dist/modern/index.mjs",
22
+ "import": "./dist/es/index.mjs",
23
23
  "require": "./dist/cjs/index.js"
24
24
  },
25
25
  "externals": {
@@ -28,7 +28,7 @@
28
28
  ]
29
29
  },
30
30
  "devDependencies": {
31
- "@magic-sdk/commons": "^3.0.0"
31
+ "@magic-sdk/commons": "^4.1.0"
32
32
  },
33
- "gitHead": "a85f41892cbd7985ee1743764f7f905b89004eaa"
33
+ "gitHead": "6aa5a25b33865cfe27444ca6094efade16a82f9f"
34
34
  }
@@ -1,2 +0,0 @@
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
@@ -1 +0,0 @@
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,aAA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