@magic-ext/icon 0.1.11 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/LICENSE +21 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/es/index.js +2 -0
- package/dist/es/index.js.map +7 -0
- package/dist/es/index.mjs +2 -0
- package/dist/es/index.mjs.map +7 -0
- package/dist/extension.js +1 -0
- package/dist/react-native/index.native.js +2 -0
- package/dist/react-native/index.native.js.map +7 -0
- package/dist/types/index.cdn.d.ts +2 -0
- package/dist/{src → types}/index.d.ts +2 -1
- package/dist/types/index.native.d.ts +1 -0
- package/dist/{src → types}/type.d.ts +0 -0
- package/package.json +27 -13
- package/README.md +0 -115
- package/dist/index.js +0 -1
- package/src/index.ts +0 -52
- package/src/type.ts +0 -8
- package/tsconfig.json +0 -19
- package/webpack.config.js +0 -28
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# v3.0.0 (Tue Jan 25 2022)
|
|
2
|
+
|
|
3
|
+
#### 💥 Breaking Change
|
|
4
|
+
|
|
5
|
+
- Switch from `microbundle` to `esbuild` [#220](https://github.com/magiclabs/magic-js/pull/220) ([@smithki](https://github.com/smithki))
|
|
6
|
+
|
|
7
|
+
#### 🐛 Bug Fix
|
|
8
|
+
|
|
9
|
+
- Merge with master ([@smithki](https://github.com/smithki))
|
|
10
|
+
- Merge branch 'master' into feat/faster-builds ([@smithki](https://github.com/smithki))
|
|
11
|
+
- Modify CDN default exports ([@smithki](https://github.com/smithki))
|
|
12
|
+
- Support newly added Magic JS extensions in ESBuild ([@smithki](https://github.com/smithki))
|
|
13
|
+
|
|
14
|
+
#### Authors: 1
|
|
15
|
+
|
|
16
|
+
- Ian K Smith ([@smithki](https://github.com/smithki))
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# v1.0.0 (Fri Dec 10 2021)
|
|
21
|
+
|
|
22
|
+
#### 💥 Breaking Change
|
|
23
|
+
|
|
24
|
+
- Jerryliu sc 44386 migrate web3 related magic ext repos to magic part 2 [#251](https://github.com/magiclabs/magic-js/pull/251) ([@Ethella](https://github.com/Ethella))
|
|
25
|
+
|
|
26
|
+
#### Authors: 1
|
|
27
|
+
|
|
28
|
+
- Jerry Liu ([@Ethella](https://github.com/Ethella))
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
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 f=Object.create;var r=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames,s=Object.getOwnPropertySymbols,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var a=(n,t,i)=>t in n?r(n,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[t]=i,e=(n,t)=>{for(var i in t||(t={}))c.call(t,i)&&a(n,i,t[i]);if(s)for(var i of s(t))S.call(t,i)&&a(n,i,t[i]);return n};var g=n=>r(n,"__esModule",{value:!0});var h=(n,t)=>{g(n);for(var i in t)r(n,i,{get:t[i],enumerable:!0})},v=(n,t,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of d(t))!c.call(n,o)&&o!=="default"&&r(n,o,{get:()=>t[o],enumerable:!(i=u(t,o))||i.enumerable});return n},y=n=>v(g(r(n!=null?f(l(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);h(exports,{IconExtension:()=>m});var p=y(require("@magic-sdk/commons")),m=class extends p.Extension.Internal{constructor(t){super();this.iconConfig=t;this.name="icon";this.sendTransaction=t=>{let i=e({},t);return i.stepLimit&&i.stepLimit.toString(),i.nid&&i.nid.toString(),i.nonce&&i.nonce.toString(),i.version&&i.version.toString(),i.value&&i.value.toString(),this.request({id:42,jsonrpc:"2.0",method:"icx_sendTransaction",params:i})};this.signTransaction=t=>{let i=e({},t);return i.stepLimit&&i.stepLimit.toString(),i.nid&&i.nid.toString(),i.nonce&&i.nonce.toString(),i.version&&i.version.toString(),i.value&&i.value.toString(),this.request({id:42,jsonrpc:"2.0",method:"icx_signTransaction",params:i})};this.getAccount=()=>this.request({id:42,jsonrpc:"2.0",method:"icx_getAccount",params:[]});this.config={rpcUrl:t.rpcUrl,chainType:"ICON"}}};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { Extension } from '@magic-sdk/commons';\nimport { IconConfig, ConfigType } from './type';\n\nexport class IconExtension extends Extension.Internal<'icon', IconConfig> {\n name = 'icon' as const;\n\n config: ConfigType;\n\n constructor(public iconConfig: IconConfig) {\n super();\n\n this.config = {\n rpcUrl: iconConfig.rpcUrl,\n chainType: 'ICON',\n };\n }\n\n public sendTransaction = (txObj: any): Promise<string> => {\n const params = { ...txObj };\n\n if (params.stepLimit) params.stepLimit.toString();\n if (params.nid) params.nid.toString();\n if (params.nonce) params.nonce.toString();\n if (params.version) params.version.toString();\n if (params.value) params.value.toString();\n\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'icx_sendTransaction',\n params,\n });\n };\n\n public signTransaction = (txObj: any): Promise<any> => {\n const params = { ...txObj };\n\n if (params.stepLimit) params.stepLimit.toString();\n if (params.nid) params.nid.toString();\n if (params.nonce) params.nonce.toString();\n if (params.version) params.version.toString();\n if (params.value) params.value.toString();\n\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'icx_signTransaction',\n params,\n });\n };\n\n public getAccount = (): Promise<string> => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'icx_getAccount',\n params: [],\n });\n };\n}\n"],
|
|
5
|
+
"mappings": "k2BAAA,uCAA0B,iCAGnB,eAA4B,aAAU,QAA6B,CAKxE,YAAmB,EAAwB,CACzC,QADiB,kBAJnB,UAAO,OAaA,qBAAkB,AAAC,GAAgC,CACxD,GAAM,GAAS,KAAK,GAEpB,MAAI,GAAO,WAAW,EAAO,UAAU,WACnC,EAAO,KAAK,EAAO,IAAI,WACvB,EAAO,OAAO,EAAO,MAAM,WAC3B,EAAO,SAAS,EAAO,QAAQ,WAC/B,EAAO,OAAO,EAAO,MAAM,WAExB,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,sBACR,YAIG,qBAAkB,AAAC,GAA6B,CACrD,GAAM,GAAS,KAAK,GAEpB,MAAI,GAAO,WAAW,EAAO,UAAU,WACnC,EAAO,KAAK,EAAO,IAAI,WACvB,EAAO,OAAO,EAAO,MAAM,WAC3B,EAAO,SAAS,EAAO,QAAQ,WAC/B,EAAO,OAAO,EAAO,MAAM,WAExB,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,sBACR,YAIG,gBAAa,IACX,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,iBACR,OAAQ,KA7CV,KAAK,OAAS,CACZ,OAAQ,EAAW,OACnB,UAAW",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var s=Object.defineProperty;var r=Object.getOwnPropertySymbols;var c=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;var e=(t,n,i)=>n in t?s(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,o=(t,n)=>{for(var i in n||(n={}))c.call(n,i)&&e(t,i,n[i]);if(r)for(var i of r(n))a.call(n,i)&&e(t,i,n[i]);return t};import{Extension as g}from"@magic-sdk/commons";var p=class extends g.Internal{constructor(n){super();this.iconConfig=n;this.name="icon";this.sendTransaction=n=>{let i=o({},n);return i.stepLimit&&i.stepLimit.toString(),i.nid&&i.nid.toString(),i.nonce&&i.nonce.toString(),i.version&&i.version.toString(),i.value&&i.value.toString(),this.request({id:42,jsonrpc:"2.0",method:"icx_sendTransaction",params:i})};this.signTransaction=n=>{let i=o({},n);return i.stepLimit&&i.stepLimit.toString(),i.nid&&i.nid.toString(),i.nonce&&i.nonce.toString(),i.version&&i.version.toString(),i.value&&i.value.toString(),this.request({id:42,jsonrpc:"2.0",method:"icx_signTransaction",params:i})};this.getAccount=()=>this.request({id:42,jsonrpc:"2.0",method:"icx_getAccount",params:[]});this.config={rpcUrl:n.rpcUrl,chainType:"ICON"}}};export{p as IconExtension};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { Extension } from '@magic-sdk/commons';\nimport { IconConfig, ConfigType } from './type';\n\nexport class IconExtension extends Extension.Internal<'icon', IconConfig> {\n name = 'icon' as const;\n\n config: ConfigType;\n\n constructor(public iconConfig: IconConfig) {\n super();\n\n this.config = {\n rpcUrl: iconConfig.rpcUrl,\n chainType: 'ICON',\n };\n }\n\n public sendTransaction = (txObj: any): Promise<string> => {\n const params = { ...txObj };\n\n if (params.stepLimit) params.stepLimit.toString();\n if (params.nid) params.nid.toString();\n if (params.nonce) params.nonce.toString();\n if (params.version) params.version.toString();\n if (params.value) params.value.toString();\n\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'icx_sendTransaction',\n params,\n });\n };\n\n public signTransaction = (txObj: any): Promise<any> => {\n const params = { ...txObj };\n\n if (params.stepLimit) params.stepLimit.toString();\n if (params.nid) params.nid.toString();\n if (params.nonce) params.nonce.toString();\n if (params.version) params.version.toString();\n if (params.value) params.value.toString();\n\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'icx_signTransaction',\n params,\n });\n };\n\n public getAccount = (): Promise<string> => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'icx_getAccount',\n params: [],\n });\n };\n}\n"],
|
|
5
|
+
"mappings": "yVAAA,+CAGO,mBAA4B,GAAU,QAA6B,CAKxE,YAAmB,EAAwB,CACzC,QADiB,kBAJnB,UAAO,OAaA,qBAAkB,AAAC,GAAgC,CACxD,GAAM,GAAS,KAAK,GAEpB,MAAI,GAAO,WAAW,EAAO,UAAU,WACnC,EAAO,KAAK,EAAO,IAAI,WACvB,EAAO,OAAO,EAAO,MAAM,WAC3B,EAAO,SAAS,EAAO,QAAQ,WAC/B,EAAO,OAAO,EAAO,MAAM,WAExB,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,sBACR,YAIG,qBAAkB,AAAC,GAA6B,CACrD,GAAM,GAAS,KAAK,GAEpB,MAAI,GAAO,WAAW,EAAO,UAAU,WACnC,EAAO,KAAK,EAAO,IAAI,WACvB,EAAO,OAAO,EAAO,MAAM,WAC3B,EAAO,SAAS,EAAO,QAAQ,WAC/B,EAAO,OAAO,EAAO,MAAM,WAExB,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,sBACR,YAIG,gBAAa,IACX,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,iBACR,OAAQ,KA7CV,KAAK,OAAS,CACZ,OAAQ,EAAW,OACnB,UAAW",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var s=Object.defineProperty;var r=Object.getOwnPropertySymbols;var c=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;var e=(t,n,i)=>n in t?s(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,o=(t,n)=>{for(var i in n||(n={}))c.call(n,i)&&e(t,i,n[i]);if(r)for(var i of r(n))a.call(n,i)&&e(t,i,n[i]);return t};import{Extension as g}from"@magic-sdk/commons";var p=class extends g.Internal{constructor(n){super();this.iconConfig=n;this.name="icon";this.sendTransaction=n=>{let i=o({},n);return i.stepLimit&&i.stepLimit.toString(),i.nid&&i.nid.toString(),i.nonce&&i.nonce.toString(),i.version&&i.version.toString(),i.value&&i.value.toString(),this.request({id:42,jsonrpc:"2.0",method:"icx_sendTransaction",params:i})};this.signTransaction=n=>{let i=o({},n);return i.stepLimit&&i.stepLimit.toString(),i.nid&&i.nid.toString(),i.nonce&&i.nonce.toString(),i.version&&i.version.toString(),i.value&&i.value.toString(),this.request({id:42,jsonrpc:"2.0",method:"icx_signTransaction",params:i})};this.getAccount=()=>this.request({id:42,jsonrpc:"2.0",method:"icx_getAccount",params:[]});this.config={rpcUrl:n.rpcUrl,chainType:"ICON"}}};export{p as IconExtension};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { Extension } from '@magic-sdk/commons';\nimport { IconConfig, ConfigType } from './type';\n\nexport class IconExtension extends Extension.Internal<'icon', IconConfig> {\n name = 'icon' as const;\n\n config: ConfigType;\n\n constructor(public iconConfig: IconConfig) {\n super();\n\n this.config = {\n rpcUrl: iconConfig.rpcUrl,\n chainType: 'ICON',\n };\n }\n\n public sendTransaction = (txObj: any): Promise<string> => {\n const params = { ...txObj };\n\n if (params.stepLimit) params.stepLimit.toString();\n if (params.nid) params.nid.toString();\n if (params.nonce) params.nonce.toString();\n if (params.version) params.version.toString();\n if (params.value) params.value.toString();\n\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'icx_sendTransaction',\n params,\n });\n };\n\n public signTransaction = (txObj: any): Promise<any> => {\n const params = { ...txObj };\n\n if (params.stepLimit) params.stepLimit.toString();\n if (params.nid) params.nid.toString();\n if (params.nonce) params.nonce.toString();\n if (params.version) params.version.toString();\n if (params.value) params.value.toString();\n\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'icx_signTransaction',\n params,\n });\n };\n\n public getAccount = (): Promise<string> => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'icx_getAccount',\n params: [],\n });\n };\n}\n"],
|
|
5
|
+
"mappings": "yVAAA,+CAGO,mBAA4B,GAAU,QAA6B,CAKxE,YAAmB,EAAwB,CACzC,QADiB,kBAJnB,UAAO,OAaA,qBAAkB,AAAC,GAAgC,CACxD,GAAM,GAAS,KAAK,GAEpB,MAAI,GAAO,WAAW,EAAO,UAAU,WACnC,EAAO,KAAK,EAAO,IAAI,WACvB,EAAO,OAAO,EAAO,MAAM,WAC3B,EAAO,SAAS,EAAO,QAAQ,WAC/B,EAAO,OAAO,EAAO,MAAM,WAExB,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,sBACR,YAIG,qBAAkB,AAAC,GAA6B,CACrD,GAAM,GAAS,KAAK,GAEpB,MAAI,GAAO,WAAW,EAAO,UAAU,WACnC,EAAO,KAAK,EAAO,IAAI,WACvB,EAAO,OAAO,EAAO,MAAM,WAC3B,EAAO,SAAS,EAAO,QAAQ,WAC/B,EAAO,OAAO,EAAO,MAAM,WAExB,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,sBACR,YAIG,gBAAa,IACX,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,iBACR,OAAQ,KA7CV,KAAK,OAAS,CACZ,OAAQ,EAAW,OACnB,UAAW",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var MagicIconExtension=(()=>{var d=Object.create;var r=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames,c=Object.getOwnPropertySymbols,S=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable;var p=(t,i,n)=>i in t?r(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,e=(t,i)=>{for(var n in i||(i={}))a.call(i,n)&&p(t,n,i[n]);if(c)for(var n of c(i))h.call(i,n)&&p(t,n,i[n]);return t};var g=t=>r(t,"__esModule",{value:!0});var v=(t,i)=>()=>(i||t((i={exports:{}}).exports,i),i.exports);var y=(t,i,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of x(i))!a.call(t,o)&&o!=="default"&&r(t,o,{get:()=>i[o],enumerable:!(n=l(i,o))||n.enumerable});return t},I=t=>y(g(r(t!=null?d(S(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var f=v((b,m)=>{m.exports=Magic});var T={};g(T);var u=I(f()),s=class extends u.Extension.Internal{constructor(i){super();this.iconConfig=i;this.name="icon";this.sendTransaction=i=>{let n=e({},i);return n.stepLimit&&n.stepLimit.toString(),n.nid&&n.nid.toString(),n.nonce&&n.nonce.toString(),n.version&&n.version.toString(),n.value&&n.value.toString(),this.request({id:42,jsonrpc:"2.0",method:"icx_sendTransaction",params:n})};this.signTransaction=i=>{let n=e({},i);return n.stepLimit&&n.stepLimit.toString(),n.nid&&n.nid.toString(),n.nonce&&n.nonce.toString(),n.version&&n.version.toString(),n.value&&n.value.toString(),this.request({id:42,jsonrpc:"2.0",method:"icx_signTransaction",params:n})};this.getAccount=()=>this.request({id:42,jsonrpc:"2.0",method:"icx_getAccount",params:[]});this.config={rpcUrl:i.rpcUrl,chainType:"ICON"}}};module.exports=s;return T;})();
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var f=Object.create;var r=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames,s=Object.getOwnPropertySymbols,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var a=(n,t,i)=>t in n?r(n,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[t]=i,e=(n,t)=>{for(var i in t||(t={}))c.call(t,i)&&a(n,i,t[i]);if(s)for(var i of s(t))S.call(t,i)&&a(n,i,t[i]);return n};var g=n=>r(n,"__esModule",{value:!0});var h=(n,t)=>{g(n);for(var i in t)r(n,i,{get:t[i],enumerable:!0})},v=(n,t,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of d(t))!c.call(n,o)&&o!=="default"&&r(n,o,{get:()=>t[o],enumerable:!(i=u(t,o))||i.enumerable});return n},y=n=>v(g(r(n!=null?f(l(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);h(exports,{IconExtension:()=>m});var p=y(require("@magic-sdk/commons")),m=class extends p.Extension.Internal{constructor(t){super();this.iconConfig=t;this.name="icon";this.sendTransaction=t=>{let i=e({},t);return i.stepLimit&&i.stepLimit.toString(),i.nid&&i.nid.toString(),i.nonce&&i.nonce.toString(),i.version&&i.version.toString(),i.value&&i.value.toString(),this.request({id:42,jsonrpc:"2.0",method:"icx_sendTransaction",params:i})};this.signTransaction=t=>{let i=e({},t);return i.stepLimit&&i.stepLimit.toString(),i.nid&&i.nid.toString(),i.nonce&&i.nonce.toString(),i.version&&i.version.toString(),i.value&&i.value.toString(),this.request({id:42,jsonrpc:"2.0",method:"icx_signTransaction",params:i})};this.getAccount=()=>this.request({id:42,jsonrpc:"2.0",method:"icx_getAccount",params:[]});this.config={rpcUrl:t.rpcUrl,chainType:"ICON"}}};
|
|
2
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { Extension } from '@magic-sdk/commons';\nimport { IconConfig, ConfigType } from './type';\n\nexport class IconExtension extends Extension.Internal<'icon', IconConfig> {\n name = 'icon' as const;\n\n config: ConfigType;\n\n constructor(public iconConfig: IconConfig) {\n super();\n\n this.config = {\n rpcUrl: iconConfig.rpcUrl,\n chainType: 'ICON',\n };\n }\n\n public sendTransaction = (txObj: any): Promise<string> => {\n const params = { ...txObj };\n\n if (params.stepLimit) params.stepLimit.toString();\n if (params.nid) params.nid.toString();\n if (params.nonce) params.nonce.toString();\n if (params.version) params.version.toString();\n if (params.value) params.value.toString();\n\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'icx_sendTransaction',\n params,\n });\n };\n\n public signTransaction = (txObj: any): Promise<any> => {\n const params = { ...txObj };\n\n if (params.stepLimit) params.stepLimit.toString();\n if (params.nid) params.nid.toString();\n if (params.nonce) params.nonce.toString();\n if (params.version) params.version.toString();\n if (params.value) params.value.toString();\n\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'icx_signTransaction',\n params,\n });\n };\n\n public getAccount = (): Promise<string> => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: 'icx_getAccount',\n params: [],\n });\n };\n}\n"],
|
|
5
|
+
"mappings": "k2BAAA,uCAA0B,iCAGnB,eAA4B,aAAU,QAA6B,CAKxE,YAAmB,EAAwB,CACzC,QADiB,kBAJnB,UAAO,OAaA,qBAAkB,AAAC,GAAgC,CACxD,GAAM,GAAS,KAAK,GAEpB,MAAI,GAAO,WAAW,EAAO,UAAU,WACnC,EAAO,KAAK,EAAO,IAAI,WACvB,EAAO,OAAO,EAAO,MAAM,WAC3B,EAAO,SAAS,EAAO,QAAQ,WAC/B,EAAO,OAAO,EAAO,MAAM,WAExB,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,sBACR,YAIG,qBAAkB,AAAC,GAA6B,CACrD,GAAM,GAAS,KAAK,GAEpB,MAAI,GAAO,WAAW,EAAO,UAAU,WACnC,EAAO,KAAK,EAAO,IAAI,WACvB,EAAO,OAAO,EAAO,MAAM,WAC3B,EAAO,SAAS,EAAO,QAAQ,WAC/B,EAAO,OAAO,EAAO,MAAM,WAExB,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,sBACR,YAIG,gBAAa,IACX,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,iBACR,OAAQ,KA7CV,KAAK,OAAS,CACZ,OAAQ,EAAW,OACnB,UAAW",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Extension } from 'magic-sdk';
|
|
1
|
+
import { Extension } from '@magic-sdk/commons';
|
|
2
2
|
import { IconConfig, ConfigType } from './type';
|
|
3
3
|
export declare class IconExtension extends Extension.Internal<'icon', IconConfig> {
|
|
4
4
|
iconConfig: IconConfig;
|
|
@@ -6,5 +6,6 @@ export declare class IconExtension extends Extension.Internal<'icon', IconConfig
|
|
|
6
6
|
config: ConfigType;
|
|
7
7
|
constructor(iconConfig: IconConfig);
|
|
8
8
|
sendTransaction: (txObj: any) => Promise<string>;
|
|
9
|
+
signTransaction: (txObj: any) => Promise<any>;
|
|
9
10
|
getAccount: () => Promise<string>;
|
|
10
11
|
}
|
|
@@ -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/icon",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "magic icon 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
|
-
"
|
|
12
|
-
"
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"target": "neutral",
|
|
15
|
+
"cdnGlobalName": "MagicIconExtension",
|
|
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": "^
|
|
31
|
+
"@magic-sdk/commons": "^4.0.0"
|
|
18
32
|
},
|
|
19
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "5a1afc093cfec98bdcfb232cb2878510014da70a"
|
|
20
34
|
}
|
package/README.md
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
# Magic Extension Icon Blockchain
|
|
2
|
-
|
|
3
|
-
## Installation
|
|
4
|
-
```bash
|
|
5
|
-
npm i magic-sdk @magic-ext/icon
|
|
6
|
-
```
|
|
7
|
-
## Setup
|
|
8
|
-
Setup IconExtension with magic-sdk
|
|
9
|
-
```js
|
|
10
|
-
|
|
11
|
-
import { Magic } from 'magic-sdk';
|
|
12
|
-
import { IconExtension } from '@magic-ext/icon';
|
|
13
|
-
|
|
14
|
-
const magic = new Magic('YOUR_API_KEY', {
|
|
15
|
-
extensions: [
|
|
16
|
-
new IconExtension({
|
|
17
|
-
rpcUrl: 'icon rpc url'
|
|
18
|
-
})
|
|
19
|
-
]
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
// or
|
|
23
|
-
|
|
24
|
-
const magic = new Magic('YOUR_API_KEY', {
|
|
25
|
-
extensions: {
|
|
26
|
-
icon: new IconExtension({
|
|
27
|
-
rpcUrl: 'icon rpc url'
|
|
28
|
-
})
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Magic SDK
|
|
35
|
-
See the [developer documentation](https://docs.magic.link) to learn how you can master the Magic SDK in a matter of minutes.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## Usage
|
|
39
|
-
|
|
40
|
-
### Get account
|
|
41
|
-
Using getAccount function to get Icon public address for current user.
|
|
42
|
-
|
|
43
|
-
```js
|
|
44
|
-
const publicAddress = await magic.icon.getAccount();
|
|
45
|
-
console.log('icon public address', publicAddress);
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Send Transaction
|
|
49
|
-
Build the transaction object using builder class.
|
|
50
|
-
|
|
51
|
-
```js
|
|
52
|
-
/* Build `IcxTransaction` instance for sending ICX. */
|
|
53
|
-
const txObj = new IconBuilder.IcxTransactionBuilder()
|
|
54
|
-
.from("hxe4837d3b902dcaf9abe529f5584489c28d8b4621")
|
|
55
|
-
.to("hxe4837d3b902dcaf9abe529f5584489c28d8b4621")
|
|
56
|
-
.value(IconAmount.of(0.5, IconAmount.Unit.ICX).toLoop())
|
|
57
|
-
.stepLimit(IconConverter.toBigNumber(100000))
|
|
58
|
-
.nid(IconConverter.toBigNumber(3))
|
|
59
|
-
.nonce(IconConverter.toBigNumber(1))
|
|
60
|
-
.version(IconConverter.toBigNumber(3))
|
|
61
|
-
.timestamp((new Date()).getTime() * 1000)
|
|
62
|
-
.build();
|
|
63
|
-
|
|
64
|
-
/* Build `MessageTransaction` instance for sending data. */
|
|
65
|
-
const txObj = new IconBuilder.MessageTransactionBuilder()
|
|
66
|
-
.from('hxe4837d3b902dcaf9abe529f5584489c28d8b4621')
|
|
67
|
-
.to('hxe4837d3b902dcaf9abe529f5584489c28d8b4621')
|
|
68
|
-
.stepLimit(IconConverter.toBigNumber(1000000))
|
|
69
|
-
.nid(IconConverter.toBigNumber(3))
|
|
70
|
-
.nonce(IconConverter.toBigNumber(1))
|
|
71
|
-
.version(IconConverter.toBigNumber(3))
|
|
72
|
-
.timestamp((new Date()).getTime() * 1000)
|
|
73
|
-
.data(IconConverter.fromUtf8('Hello'))
|
|
74
|
-
.build();
|
|
75
|
-
|
|
76
|
-
/* Build `DeployTransaction` instance for deploying SCORE. */
|
|
77
|
-
const txObj = new DeployTransactionBuilder()
|
|
78
|
-
.from('hxe4837d3b902dcaf9abe529f5584489c28d8b4621')
|
|
79
|
-
.to('cx0000000000000000000000000000000000000000')
|
|
80
|
-
.stepLimit(IconConverter.toBigNumber(2100000000))
|
|
81
|
-
.nid(IconConverter.toBigNumber(3))
|
|
82
|
-
.nonce(IconConverter.toBigNumber(1))
|
|
83
|
-
.version(IconConverter.toBigNumber(3))
|
|
84
|
-
.timestamp((new Date()).getTime() * 1000)
|
|
85
|
-
.contentType('application/zip')
|
|
86
|
-
.content(`0x${content}`)
|
|
87
|
-
.params({
|
|
88
|
-
initialSupply: IconConverter.toHex('100000000000'),
|
|
89
|
-
decimals: IconConverter.toHex(18),
|
|
90
|
-
name: 'StandardToken',
|
|
91
|
-
symbol: 'ST',
|
|
92
|
-
})
|
|
93
|
-
.build();
|
|
94
|
-
|
|
95
|
-
/* Build `CallTransaction` instance for executing SCORE function. */
|
|
96
|
-
const txObj = new IconBuilder.CallTransactionBuilder()
|
|
97
|
-
.from('hxe4837d3b902dcaf9abe529f5584489c28d8b4621')
|
|
98
|
-
.to('cxd1602bde1d4b2b4facc8673c661c5e59e6ac20b4')
|
|
99
|
-
.stepLimit(IconConverter.toBigNumber('2000000'))
|
|
100
|
-
.nid(IconConverter.toBigNumber('3'))
|
|
101
|
-
.nonce(IconConverter.toBigNumber('1'))
|
|
102
|
-
.version(IconConverter.toBigNumber('3'))
|
|
103
|
-
.timestamp((new Date()).getTime() * 1000)
|
|
104
|
-
.method('hello')
|
|
105
|
-
.params({})
|
|
106
|
-
|
|
107
|
-
```
|
|
108
|
-
By passing txObj instance to `magic.icon.sendTransaction()` method, it will automatically sign the transaction with current user and
|
|
109
|
-
generate transaction object including signature, then send to ICON node.
|
|
110
|
-
```js
|
|
111
|
-
const txhash = await magic.icon.sendTransaction(txObj);
|
|
112
|
-
|
|
113
|
-
console.log('transaction result', txhash);
|
|
114
|
-
window.open(`https://bicon.tracker.solidwallet.io/transaction/${txhash}`)
|
|
115
|
-
```
|
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports=function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=1)}([function(t,n){t.exports=require("magic-sdk")},function(t,n,e){"use strict";e.r(n),e.d(n,"IconExtension",(function(){return c}));var r,o=e(0),i=(r=function(t,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)},function(t,n){function e(){this.constructor=t}r(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}),u=function(){return(u=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}).apply(this,arguments)},c=function(t){function n(n){var e=t.call(this)||this;return e.iconConfig=n,e.name="icon",e.sendTransaction=function(t){var n=u({},t);return n.stepLimit&&(n.stepLimit="string"==typeof n.stepLimit?n.stepLimit:n.stepLimit.toString()),n.nid&&(n.nid="string"==typeof n.nid?n.nid:n.nid.toString()),n.nonce&&(n.nonce="string"==typeof n.nonce?n.nonce:n.nonce.toString()),n.version&&(n.version="string"==typeof n.version?n.version:n.version.toString()),n.value&&(n.value="string"==typeof n.value?n.value:n.value.toString()),e.request({id:42,jsonrpc:"2.0",method:"icx_sendTransaction",params:n})},e.getAccount=function(){return e.request({id:42,jsonrpc:"2.0",method:"icx_getAccount",params:[]})},e.config={rpcUrl:n.rpcUrl,chainType:"ICON"},e}return i(n,t),n}(o.Extension.Internal)}]);
|
package/src/index.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Extension } from 'magic-sdk';
|
|
2
|
-
import { IconConfig, ConfigType } from './type';
|
|
3
|
-
|
|
4
|
-
export class IconExtension extends Extension.Internal<
|
|
5
|
-
'icon',
|
|
6
|
-
IconConfig
|
|
7
|
-
> {
|
|
8
|
-
name = 'icon' as const;
|
|
9
|
-
|
|
10
|
-
config: ConfigType;
|
|
11
|
-
|
|
12
|
-
constructor(public iconConfig: IconConfig){
|
|
13
|
-
super();
|
|
14
|
-
|
|
15
|
-
this.config = {
|
|
16
|
-
rpcUrl: iconConfig.rpcUrl,
|
|
17
|
-
chainType: 'ICON'
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public sendTransaction = (txObj: any): Promise<string> => {
|
|
22
|
-
|
|
23
|
-
let params = {...txObj};
|
|
24
|
-
|
|
25
|
-
if(params.stepLimit)
|
|
26
|
-
params.stepLimit = typeof params.stepLimit === 'string'? params.stepLimit : params.stepLimit.toString();
|
|
27
|
-
if(params.nid)
|
|
28
|
-
params.nid = typeof params.nid === 'string'? params.nid : params.nid.toString();
|
|
29
|
-
if(params.nonce)
|
|
30
|
-
params.nonce = typeof params.nonce === 'string'? params.nonce : params.nonce.toString();
|
|
31
|
-
if(params.version)
|
|
32
|
-
params.version = typeof params.version === 'string'? params.version : params.version.toString();
|
|
33
|
-
if(params.value)
|
|
34
|
-
params.value = typeof params.value === 'string'? params.value : params.value.toString();
|
|
35
|
-
|
|
36
|
-
return this.request({
|
|
37
|
-
id:42,
|
|
38
|
-
jsonrpc: '2.0',
|
|
39
|
-
method: 'icx_sendTransaction',
|
|
40
|
-
params
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
public getAccount = (): Promise<string> => {
|
|
45
|
-
return this.request({
|
|
46
|
-
id:42,
|
|
47
|
-
jsonrpc: '2.0',
|
|
48
|
-
method: 'icx_getAccount',
|
|
49
|
-
params: []
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
}
|
package/src/type.ts
DELETED
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
|
-
};
|