@web3jskit/walletkit 0.5.1 → 0.6.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/README.md +1 -4
- package/README.zh.md +1 -4
- package/dist/assets/fonts/manrope-latin-ext.woff2 +0 -0
- package/dist/assets/fonts/manrope-latin.woff2 +0 -0
- package/dist/assets/fonts/manrope-vietnamese.woff2 +0 -0
- package/dist/base.css +65 -0
- package/dist/btcConnector-BDtO-SY1.js +1 -0
- package/dist/{btcConnector-H4vacfvE.mjs → btcConnector-CcZ3Vta3.mjs} +4 -3
- package/dist/{btcConnector-CWSxooB_.mjs → btcConnector-DMgc1GYB.mjs} +16 -15
- package/dist/btcConnector-DfFAwTZX.js +1 -0
- package/dist/components/ConnectModal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts +3 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/WalletItem/index.d.ts +3 -0
- package/dist/components/WalletItem/index.d.ts.map +1 -1
- package/dist/components/WalletKitProvider/ChainProvider.d.ts +1 -2
- package/dist/components/WalletKitProvider/ChainProvider.d.ts.map +1 -1
- package/dist/components/WalletKitProvider/connectorInitialization.d.ts +12 -0
- package/dist/components/WalletKitProvider/connectorInitialization.d.ts.map +1 -0
- package/dist/components/WalletKitProvider/index.d.ts +1 -1
- package/dist/components/WalletKitProvider/index.d.ts.map +1 -1
- package/dist/config/iconDatabase.d.ts +0 -1
- package/dist/config/iconDatabase.d.ts.map +1 -1
- package/dist/config/walletConfig.d.ts +0 -1
- package/dist/config/walletConfig.d.ts.map +1 -1
- package/dist/core/connectors/Bitget_Wallet/tronConnector.d.ts +13 -0
- package/dist/core/connectors/Bitget_Wallet/tronConnector.d.ts.map +1 -0
- package/dist/core/connectors/_sol/discoverWallets.d.ts +4 -0
- package/dist/core/connectors/_sol/discoverWallets.d.ts.map +1 -0
- package/dist/core/connectors/_sol/discoveredSolConnector.d.ts +12 -0
- package/dist/core/connectors/_sol/discoveredSolConnector.d.ts.map +1 -0
- package/dist/core/connectors/_sol/wrapStandardSolWallet.d.ts +15 -0
- package/dist/core/connectors/_sol/wrapStandardSolWallet.d.ts.map +1 -0
- package/dist/core/connectors/_tron/discoverWallets.d.ts +6 -0
- package/dist/core/connectors/_tron/discoverWallets.d.ts.map +1 -0
- package/dist/core/connectors/_tron/discoveredTronConnector.d.ts +13 -0
- package/dist/core/connectors/_tron/discoveredTronConnector.d.ts.map +1 -0
- package/dist/core/connectors/_tron/tronConnector.d.ts.map +1 -1
- package/dist/core/connectors/_tron/wrapTip6963TronProvider.d.ts +2 -0
- package/dist/core/connectors/_tron/wrapTip6963TronProvider.d.ts.map +1 -0
- package/dist/core/connectors/connectorLoader.d.ts +3 -0
- package/dist/core/connectors/connectorLoader.d.ts.map +1 -0
- package/dist/core/connectors/createConnectors.d.ts +5 -1
- package/dist/core/connectors/createConnectors.d.ts.map +1 -1
- package/dist/core/connectors/publicConnectorApi.d.ts +7 -0
- package/dist/core/connectors/publicConnectorApi.d.ts.map +1 -0
- package/dist/core/utils/sortConnectModalWallets.d.ts +14 -0
- package/dist/core/utils/sortConnectModalWallets.d.ts.map +1 -0
- package/dist/core/utils/util.d.ts +7 -0
- package/dist/core/utils/util.d.ts.map +1 -1
- package/dist/core/utils/walletName.d.ts +5 -0
- package/dist/core/utils/walletName.d.ts.map +1 -0
- package/dist/createConnectors-C9LH3IR3.mjs +1400 -0
- package/dist/createConnectors-CJ8mKxGL.js +4 -0
- package/dist/createConnectors-Cv_QLnqK.js +71 -0
- package/dist/createConnectors-motkSfb8.mjs +700 -0
- package/dist/{deepLinkConnector-Cv1mS_6-.mjs → deepLinkConnector-BXnwTb3R.mjs} +1 -1
- package/dist/{deepLinkConnector-JrGcvOeL.mjs → deepLinkConnector-BYTD1fC1.mjs} +1 -1
- package/dist/deepLinkConnector-BdJyNgRZ.js +1 -0
- package/dist/{deepLinkConnector-DVJJth-5.mjs → deepLinkConnector-Bu6KKcGy.mjs} +1 -1
- package/dist/deepLinkConnector-Bw-eQd5I.js +1 -0
- package/dist/{deepLinkConnector-Dd1GhvIt.mjs → deepLinkConnector-C2hzBr3K.mjs} +1 -1
- package/dist/deepLinkConnector-CAwqVe4F.js +1 -0
- package/dist/deepLinkConnector-CuHi9EXY.js +1 -0
- package/dist/deepLinkConnector-Cvnq6T2g.js +1 -0
- package/dist/deepLinkConnector-DIFgHqiu.js +1 -0
- package/dist/deepLinkConnector-DNwi0QPz.js +1 -0
- package/dist/{deepLinkConnector-DmY8duGW.mjs → deepLinkConnector-DZhNx2B3.mjs} +1 -1
- package/dist/{deepLinkConnector-CJskbSoZ.mjs → deepLinkConnector-DjjZRYdu.mjs} +1 -1
- package/dist/{deepLinkConnector-CeF0BGa0.mjs → deepLinkConnector-DkxVqLoI.mjs} +6 -5
- package/dist/hooks/useWalletKit.d.ts +2 -2
- package/dist/hooks/useWalletKit.d.ts.map +1 -1
- package/dist/index-AJZEVNvC.js +44 -0
- package/dist/index-B2ReClHJ.js +1 -0
- package/dist/index-CwrzsL2T.mjs +6179 -0
- package/dist/index-D5CDP-Ja.mjs +79 -0
- package/dist/index-DBdIuPfj.js +3 -0
- package/dist/index-DcNXEbdu.mjs +94 -0
- package/dist/index-Dh0IhC3B.mjs +168 -0
- package/dist/index-Dqp1KqTh.js +1 -0
- package/dist/index-Ds_3MsPA.js +1 -0
- package/dist/index-bCuJkrSE.mjs +152 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +1 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +19 -20
- package/dist/index.js +1 -1
- package/dist/index.umd.js +12789 -55590
- package/dist/index2.css +1 -0
- package/dist/index3.css +1 -0
- package/dist/silentConnect-CZY4_0a5.js +1 -0
- package/dist/silentConnect-ScWCxMaM.mjs +11 -0
- package/dist/stores/helperStore.d.ts +0 -2
- package/dist/stores/helperStore.d.ts.map +1 -1
- package/dist/stores/modalStore.d.ts +1 -0
- package/dist/stores/modalStore.d.ts.map +1 -1
- package/dist/style.css +90 -87
- package/dist/tronConnector-Bx-nhNWr.mjs +14 -0
- package/dist/tronConnector-CXH3d_my.js +1 -0
- package/dist/tronConnector-DGnNuwqC.js +1 -0
- package/dist/tronConnector-P87k0GEa.mjs +21 -0
- package/dist/walletName-BwayBopz.mjs +8 -0
- package/dist/walletName-mwS8Jhxj.js +1 -0
- package/package.json +11 -4
- package/dist/btcConnector-BPOSvvaA.js +0 -1
- package/dist/btcConnector-Bc6dNLGT.js +0 -1
- package/dist/core/connectors/Bitget_Wallet/solConnector.d.ts +0 -13
- package/dist/core/connectors/Bitget_Wallet/solConnector.d.ts.map +0 -1
- package/dist/core/connectors/GelWallet/evmConnector.d.ts +0 -27
- package/dist/core/connectors/GelWallet/evmConnector.d.ts.map +0 -1
- package/dist/core/connectors/GelWallet/solConnector.d.ts +0 -15
- package/dist/core/connectors/GelWallet/solConnector.d.ts.map +0 -1
- package/dist/core/connectors/GelWallet/tronConnector.d.ts +0 -8
- package/dist/core/connectors/GelWallet/tronConnector.d.ts.map +0 -1
- package/dist/core/connectors/OKX_Wallet/solConnector.d.ts +0 -12
- package/dist/core/connectors/OKX_Wallet/solConnector.d.ts.map +0 -1
- package/dist/core/connectors/Phantom/solConnector.d.ts +0 -12
- package/dist/core/connectors/Phantom/solConnector.d.ts.map +0 -1
- package/dist/core/connectors/TronLink/tronConnector.d.ts +0 -13
- package/dist/core/connectors/TronLink/tronConnector.d.ts.map +0 -1
- package/dist/core/connectors/_gelwallet/gelWalletConnector.d.ts +0 -26
- package/dist/core/connectors/_gelwallet/gelWalletConnector.d.ts.map +0 -1
- package/dist/dapp.es-BPGP9PnL.mjs +0 -15917
- package/dist/dapp.es-sLnregcu.js +0 -103
- package/dist/deepLinkConnector-BEhA9fXM.js +0 -1
- package/dist/deepLinkConnector-BoFKaohV.js +0 -1
- package/dist/deepLinkConnector-C9yLvhQ0.js +0 -1
- package/dist/deepLinkConnector-COkumXeY.js +0 -1
- package/dist/deepLinkConnector-DjP2afmX.js +0 -1
- package/dist/deepLinkConnector-k6omMzz2.js +0 -1
- package/dist/deepLinkConnector-uAd7NNtg.js +0 -1
- package/dist/evmConnector-CCvp7d3d.js +0 -1
- package/dist/evmConnector-CoauAOGL.mjs +0 -163
- package/dist/gelWalletConnector-B3UtBzAC.mjs +0 -76
- package/dist/gelWalletConnector-DWtJW90d.js +0 -1
- package/dist/index-9qmfDVzH-C-zsxX98.mjs +0 -25638
- package/dist/index-9qmfDVzH-C6VVZD9P.js +0 -28
- package/dist/index-B3LF1VeP-58KzZv6u.js +0 -1
- package/dist/index-B3LF1VeP-IR-fSZI0.mjs +0 -120
- package/dist/index-CCHY2zSF-OxZZmzOg.mjs +0 -45
- package/dist/index-CCHY2zSF-ocS_tvXl.js +0 -1
- package/dist/index-CQkA0oWr.js +0 -138
- package/dist/index-CqeMS3Gf-C4g86ca5.js +0 -1
- package/dist/index-CqeMS3Gf-DXS8RsUh.mjs +0 -67
- package/dist/index-DGMGsMkJ-BTPPfxmS.js +0 -1
- package/dist/index-DGMGsMkJ-CHecRdpD.mjs +0 -27
- package/dist/index-djQ_DEqj.mjs +0 -9254
- package/dist/index-yUF_S07V-Cm9-qVkc.js +0 -1
- package/dist/index-yUF_S07V-DHeRsyE0.mjs +0 -48
- package/dist/solConnector-6iJX98IC.mjs +0 -41
- package/dist/solConnector-B0hCu-c0.js +0 -1
- package/dist/solConnector-BF2LX1V2.js +0 -1
- package/dist/solConnector-BJTonslk.mjs +0 -11
- package/dist/solConnector-BZeW9sSK.js +0 -1
- package/dist/solConnector-DiPxszBo.mjs +0 -11
- package/dist/solConnector-RfQtdzBT.js +0 -1
- package/dist/solConnector-uPbRCSOa.mjs +0 -11
- package/dist/tronConnector-BlFA83pA.js +0 -1
- package/dist/tronConnector-BsjZsmAJ.js +0 -1
- package/dist/tronConnector-CUOxt6Cw.mjs +0 -35
- package/dist/tronConnector-DfZzS07Y.mjs +0 -13
- package/dist/tronConnector-fKlrodno.js +0 -1
- package/dist/tronConnector-ofdgn1lq.mjs +0 -21
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-CQkA0oWr.js"),i=o=>({request:async({method:e,params:n})=>new Promise(()=>{if(console.log("OKX------request",e,n),e==="openDApp"){const t=`${o.deepLink}?dappUrl=${encodeURIComponent(window==null?void 0:window.location.href)}`;console.log("OKX-----deepLink",t),window.location.href=t}})});class c extends s.BaseConnector{constructor(e){const n=i(e);super(e,n),this.connect=async()=>{const t=await this.getProvider();try{return this.beforeConnecting(),await t.request({method:"openDApp"}),this.resetStatus(),Promise.resolve("")}catch(r){return console.error(r),this.resetStatus(),Promise.reject(r)}},this.reconnection=async()=>{console.log("reconnection")},this.disconnect=async()=>{this.resetStatus()},this.getAccounts=()=>{},this.__onAccountsChanged=()=>{},this.__onChainChanged=()=>{},this.__onConnect=()=>{},this.__onDisconnect=()=>{},this.deepLink=e.deepLink}}exports.default=c;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CQkA0oWr.js"),i=o=>({request:async({method:e,params:n})=>new Promise(()=>{if(console.log("MetaMask------request",e,n),e==="openDApp"){const t=`${o.deepLink}/${window.location.href}`;console.log("MetaMask------deepLink",t),window.location.href=t}})});class c extends r.BaseConnector{constructor(e){const n=i(e);super(e,n),this.connect=async()=>{const t=await this.getProvider();try{return this.beforeConnecting(),await t.request({method:"openDApp"}),this.resetStatus(),Promise.resolve("")}catch(s){return console.error(s),this.resetStatus(),Promise.reject(s)}},this.reconnection=async()=>{console.log("reconnection")},this.disconnect=async()=>{this.resetStatus()},this.getAccounts=()=>{},this.__onAccountsChanged=()=>{},this.__onChainChanged=()=>{},this.__onConnect=()=>{},this.__onDisconnect=()=>{},this.deepLink=e.deepLink}}exports.default=c;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-CQkA0oWr.js"),i=o=>({request:async({method:e,params:n})=>new Promise(()=>{if(console.log("Bitget------request",e,n),e==="openDApp"){const t=`${o.deepLink}?action=dapp&url=${window.location.href}`;console.log("Bitget------deepLink",t),window.location.href=t}})});class c extends s.BaseConnector{constructor(e){const n=i(e);super(e,n),this.connect=async()=>{const t=await this.getProvider();try{return this.beforeConnecting(),await t.request({method:"openDApp"}),this.resetStatus(),Promise.resolve("")}catch(r){return console.error(r),this.resetStatus(),Promise.reject(r)}},this.reconnection=async()=>{console.log("reconnection")},this.disconnect=async()=>{this.resetStatus()},this.getAccounts=()=>{},this.__onAccountsChanged=()=>{},this.__onChainChanged=()=>{},this.__onConnect=()=>{},this.__onDisconnect=()=>{},this.deepLink=e.deepLink}}exports.default=c;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CQkA0oWr.js"),i=o=>({request:async({method:e,params:n})=>(console.log("TokenPocket-----request",e,n),new Promise(()=>{if(e==="openDApp"){const t=`${o.deepLink}?param=${encodeURIComponent(JSON.stringify({url:window==null?void 0:window.location.href}))}`;console.log("TokenPocket-----deepLink",t),window.location.href=t}}))});class c extends r.BaseConnector{constructor(e){const n=i(e);super(e,n),this.connect=async()=>{const t=await this.getProvider();try{return this.beforeConnecting(),t.request({method:"openDApp"}),this.resetStatus(),Promise.resolve("")}catch(s){return this.resetStatus(),Promise.reject(s)}},this.reconnection=async()=>{console.log("reconnection")},this.disconnect=async()=>{this.resetStatus()},this.switchChain=()=>{},this.getAccounts=()=>{},this.getChainId=()=>{},this.__onAccountsChanged=()=>{},this.__onChainChanged=()=>{},this.__onConnect=()=>{},this.__onDisconnect=()=>{},this.deepLink=e.deepLink}}exports.default=c;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CQkA0oWr.js"),i=r=>({request:async({method:e,params:n})=>new Promise(()=>{if(console.log("Trust------request",e,n),e==="openDApp"){const t=`${r.deepLink}?url=${window.location.href}`;console.log("Trust------deepLink",t),window.location.href=t}})});class c extends o.BaseConnector{constructor(e){const n=i(e);super(e,n),this.connect=async()=>{const t=await this.getProvider();try{return this.beforeConnecting(),await t.request({method:"openDApp"}),this.resetStatus(),Promise.resolve("")}catch(s){return console.error(s),this.resetStatus(),Promise.reject(s)}},this.reconnection=async()=>{},this.disconnect=async()=>{this.resetStatus()},this.getAccounts=()=>{},this.__onAccountsChanged=()=>{},this.__onChainChanged=()=>{},this.__onConnect=()=>{},this.__onDisconnect=()=>{},this.deepLink=e.deepLink}}exports.default=c;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-CQkA0oWr.js"),i=o=>({request:async({method:e,params:t})=>(console.log("Tron-----request",e,t),new Promise(()=>{if(e==="openDApp"){const n=`${o.deepLink}?param=${encodeURIComponent(JSON.stringify({url:window==null?void 0:window.location.href,action:"open",protocol:"tronlink",version:"1.0"}))}`;console.log("Tron-----deepLink",n),window.location.href=n}}))});class c extends s.BaseConnector{constructor(e){const t=i(e);super(e,t),this.connect=async()=>{const n=await this.getProvider();try{return this.beforeConnecting(),n.request({method:"openDApp"}),this.resetStatus(),Promise.resolve("")}catch(r){return this.resetStatus(),Promise.reject(r)}},this.reconnection=async()=>{console.log("reconnection")},this.disconnect=async()=>{this.resetStatus()},this.switchChain=()=>{},this.getAccounts=()=>{},this.getChainId=()=>{},this.__onAccountsChanged=()=>{},this.__onChainChanged=()=>{},this.__onConnect=()=>{},this.__onDisconnect=()=>{},this.deepLink=e.deepLink}}exports.default=c;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CQkA0oWr.js"),l=(o,e)=>`https://phantom.app/ul/v1/${o}?${e.toString()}`,p=o=>({request:async({method:e,params:c})=>(console.log("Phantom-----request",e,c),new Promise(()=>{if(e==="openDApp"){const n=encodeURIComponent(window.location.href),t=`${o.deepLink}/${n}?ref=${n}`;console.log("Phantom------deepLink",t),window.location.href=t}else if(e==="login"){const n=r.nacl.box.keyPair(),t=r.bs58.encode(n.publicKey),i=n.secretKey;localStorage.setItem("clientPrivateKey",r.bs58.encode(i));const s=new URLSearchParams({dapp_encryption_public_key:t,app_url:window.location.href,redirect_link:window.location.href}),a=l("connect",s);window.location.href=a}}))});class h extends r.BaseConnector{constructor(e){const c=p(e);super(e,c),this.connect=async()=>{const n=await this.getProvider();try{return this.beforeConnecting(),await n.request({method:"openDApp"}),this.resetStatus(),Promise.resolve("")}catch(t){return console.error(t),this.resetStatus(),Promise.reject(t)}},this.reconnection=async()=>{console.log("reconnection")},this.disconnect=async()=>{this.resetStatus()},this.getAccounts=()=>{},this.__onAccountsChanged=()=>{},this.__onChainChanged=()=>{},this.__onConnect=()=>{},this.__onDisconnect=()=>{},this.deepLink=e.deepLink}}exports.default=h;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./gelWalletConnector-DWtJW90d.js"),o=require("./index-CQkA0oWr.js");class p extends m.GelWalletConnector{constructor(w){super(w,o.ChainType.EVM),this.getChainId=async()=>{const r=await(await this.getProvider()).request({method:"eth_chainId"});return Number(r)},this.connect=async t=>{try{const r=await this.getProvider();this.addEventListener(),this.beforeConnecting();const s=(await r.request({method:"eth_requestAccounts",params:[{chainId:t||o.numberToHex(this.store.getState().currentNetworkId)}]}))[0];return this.connectSuccess(s),s}catch(r){throw this.removeEventListener(),this.connectError(),r}},this.reconnection=async()=>{try{const t=await this.getProvider();this.addEventListener(),this.beforeConnecting();const e=(await t.request({method:"eth_accounts"}))[0];e?this.connectSuccess(e):this.__onDisconnect()}catch{this.removeEventListener(),this.connectError()}},this.disconnect=async()=>{this.__onDisconnect()},this.signMessage=async t=>await(await this.getProvider()).request({method:"personal_sign",params:[t,this.walletAddress]}),this.signTransaction=async t=>{const r=await this.getProvider();try{return await r.request({method:"eth_signTransaction",params:[t]})}catch(e){throw console.error("signTransaction:error",e),e}},this.sendTransaction=async t=>await(await this.getProvider()).request({method:"eth_sendTransaction",params:[t]}),this.multipleRequests=async t=>await await(await this.getProvider()).multipleRequest({chainType:o.ChainType.EVM,events:t}),this.waitForTransactionReceipt=async(t,r=6e4)=>{const e=await this.getProvider(),s=Date.now();for(;Date.now()-s<r;)try{const n=await e.request({method:"eth_getTransactionReceipt",params:[t]});if(n)return n;await new Promise(a=>setTimeout(a,1e3))}catch(n){throw n}throw new Error("Transaction receipt timeout")},this.readContract=async t=>{try{const{abi:r,address:e,functionName:s,args:n=[],rpcUrl:a,from:h}=t,c=this.store.getState().currentNetwork,l=a||(c==null?void 0:c.rpcUrls[0])||"",d=o.encodeFunctionData({abi:r,functionName:s,args:n}),u=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:Math.floor(Math.random()*1e5),jsonrpc:"2.0",method:"eth_call",params:[h?{from:h,to:e,data:d}:{to:e,data:d},"latest"]})}),i=await u.json();if(i.error)throw new Error(i.error.message);return!i.result||i.result==="0x"?u:o.decodeFunctionResult({abi:r,functionName:s,data:i.result})}catch(r){throw r}},this.writeContract=async t=>{const r=await this.getProvider();try{const e=o.encodeFunctionData({abi:t.abi,functionName:t.functionName,args:t.args||[]}),s={from:this.walletAddress,to:t.address,data:e,value:t.value};return await r.request({method:"eth_sendTransaction",params:[s]})}catch(e){const s=e;throw s.code===o.UserRejectedRequestError.code?new o.UserRejectedRequestError(s):s}},this.multicall=async(t,r)=>{try{const e=this.store.getState().currentNetwork;return await o.multicallRpc(t,{...r,network:e})}catch(e){const s=e;throw s.code===o.UserRejectedRequestError.code?new o.UserRejectedRequestError(s):s}},this.switchNetwork=async t=>{const r=await this.getProvider();try{await r.request({method:"wallet_switchEthereumChain",params:[{chainId:o.numberToHex(t)}]})}catch(e){if((e==null?void 0:e.code)===4902){const n=this.supportedNetworks.find(a=>a.chainId===t);if(n){const a={...n,chainId:o.numberToHex(n==null?void 0:n.chainId)};await r.request({method:"wallet_addEthereumChain",params:[a]})}return}const s=e;throw s.code===o.UserRejectedRequestError.code?new o.UserRejectedRequestError(s):s}}}}exports.default=p;
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { G as g } from "./gelWalletConnector-B3UtBzAC.mjs";
|
|
2
|
-
import { a as l, n as h, e as m, d as y, U as n, m as f } from "./index-djQ_DEqj.mjs";
|
|
3
|
-
class C extends g {
|
|
4
|
-
constructor(p) {
|
|
5
|
-
super(p, l.EVM), this.getChainId = async () => {
|
|
6
|
-
const r = await (await this.getProvider()).request({ method: "eth_chainId" });
|
|
7
|
-
return Number(r);
|
|
8
|
-
}, this.connect = async (e) => {
|
|
9
|
-
try {
|
|
10
|
-
const r = await this.getProvider();
|
|
11
|
-
this.addEventListener(), this.beforeConnecting();
|
|
12
|
-
const s = (await r.request({
|
|
13
|
-
method: "eth_requestAccounts",
|
|
14
|
-
params: [
|
|
15
|
-
{
|
|
16
|
-
chainId: e || h(this.store.getState().currentNetworkId)
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
}))[0];
|
|
20
|
-
return this.connectSuccess(s), s;
|
|
21
|
-
} catch (r) {
|
|
22
|
-
throw this.removeEventListener(), this.connectError(), r;
|
|
23
|
-
}
|
|
24
|
-
}, this.reconnection = async () => {
|
|
25
|
-
try {
|
|
26
|
-
const e = await this.getProvider();
|
|
27
|
-
this.addEventListener(), this.beforeConnecting();
|
|
28
|
-
const t = (await e.request({
|
|
29
|
-
method: "eth_accounts"
|
|
30
|
-
}))[0];
|
|
31
|
-
t ? this.connectSuccess(t) : this.__onDisconnect();
|
|
32
|
-
} catch {
|
|
33
|
-
this.removeEventListener(), this.connectError();
|
|
34
|
-
}
|
|
35
|
-
}, this.disconnect = async () => {
|
|
36
|
-
this.__onDisconnect();
|
|
37
|
-
}, this.signMessage = async (e) => await (await this.getProvider()).request({
|
|
38
|
-
method: "personal_sign",
|
|
39
|
-
params: [e, this.walletAddress]
|
|
40
|
-
}), this.signTransaction = async (e) => {
|
|
41
|
-
const r = await this.getProvider();
|
|
42
|
-
try {
|
|
43
|
-
return await r.request({
|
|
44
|
-
method: "eth_signTransaction",
|
|
45
|
-
params: [e]
|
|
46
|
-
});
|
|
47
|
-
} catch (t) {
|
|
48
|
-
throw console.error("signTransaction:error", t), t;
|
|
49
|
-
}
|
|
50
|
-
}, this.sendTransaction = async (e) => await (await this.getProvider()).request({
|
|
51
|
-
method: "eth_sendTransaction",
|
|
52
|
-
params: [e]
|
|
53
|
-
}), this.multipleRequests = async (e) => await await (await this.getProvider()).multipleRequest({
|
|
54
|
-
chainType: l.EVM,
|
|
55
|
-
events: e
|
|
56
|
-
}), this.waitForTransactionReceipt = async (e, r = 6e4) => {
|
|
57
|
-
const t = await this.getProvider(), s = Date.now();
|
|
58
|
-
for (; Date.now() - s < r; )
|
|
59
|
-
try {
|
|
60
|
-
const o = await t.request({
|
|
61
|
-
method: "eth_getTransactionReceipt",
|
|
62
|
-
params: [e]
|
|
63
|
-
});
|
|
64
|
-
if (o) return o;
|
|
65
|
-
await new Promise((a) => setTimeout(a, 1e3));
|
|
66
|
-
} catch (o) {
|
|
67
|
-
throw o;
|
|
68
|
-
}
|
|
69
|
-
throw new Error("Transaction receipt timeout");
|
|
70
|
-
}, this.readContract = async (e) => {
|
|
71
|
-
try {
|
|
72
|
-
const { abi: r, address: t, functionName: s, args: o = [], rpcUrl: a, from: d } = e, c = this.store.getState().currentNetwork, v = a || (c == null ? void 0 : c.rpcUrls[0]) || "", u = m({
|
|
73
|
-
abi: r,
|
|
74
|
-
functionName: s,
|
|
75
|
-
args: o
|
|
76
|
-
}), w = await fetch(v, {
|
|
77
|
-
method: "POST",
|
|
78
|
-
headers: {
|
|
79
|
-
"Content-Type": "application/json"
|
|
80
|
-
},
|
|
81
|
-
body: JSON.stringify({
|
|
82
|
-
id: Math.floor(Math.random() * 1e5),
|
|
83
|
-
jsonrpc: "2.0",
|
|
84
|
-
method: "eth_call",
|
|
85
|
-
params: [d ? { from: d, to: t, data: u } : { to: t, data: u }, "latest"]
|
|
86
|
-
})
|
|
87
|
-
}), i = await w.json();
|
|
88
|
-
if (i.error)
|
|
89
|
-
throw new Error(i.error.message);
|
|
90
|
-
return !i.result || i.result === "0x" ? w : y({
|
|
91
|
-
abi: r,
|
|
92
|
-
functionName: s,
|
|
93
|
-
data: i.result
|
|
94
|
-
});
|
|
95
|
-
} catch (r) {
|
|
96
|
-
throw r;
|
|
97
|
-
}
|
|
98
|
-
}, this.writeContract = async (e) => {
|
|
99
|
-
const r = await this.getProvider();
|
|
100
|
-
try {
|
|
101
|
-
const t = m({
|
|
102
|
-
abi: e.abi,
|
|
103
|
-
functionName: e.functionName,
|
|
104
|
-
args: e.args || []
|
|
105
|
-
}), s = {
|
|
106
|
-
from: this.walletAddress,
|
|
107
|
-
to: e.address,
|
|
108
|
-
data: t,
|
|
109
|
-
value: e.value
|
|
110
|
-
};
|
|
111
|
-
return await r.request({
|
|
112
|
-
method: "eth_sendTransaction",
|
|
113
|
-
params: [s]
|
|
114
|
-
});
|
|
115
|
-
} catch (t) {
|
|
116
|
-
const s = t;
|
|
117
|
-
throw s.code === n.code ? new n(s) : s;
|
|
118
|
-
}
|
|
119
|
-
}, this.multicall = async (e, r) => {
|
|
120
|
-
try {
|
|
121
|
-
const t = this.store.getState().currentNetwork;
|
|
122
|
-
return await f(
|
|
123
|
-
e,
|
|
124
|
-
{
|
|
125
|
-
...r,
|
|
126
|
-
network: t
|
|
127
|
-
}
|
|
128
|
-
);
|
|
129
|
-
} catch (t) {
|
|
130
|
-
const s = t;
|
|
131
|
-
throw s.code === n.code ? new n(s) : s;
|
|
132
|
-
}
|
|
133
|
-
}, this.switchNetwork = async (e) => {
|
|
134
|
-
const r = await this.getProvider();
|
|
135
|
-
try {
|
|
136
|
-
await r.request({
|
|
137
|
-
method: "wallet_switchEthereumChain",
|
|
138
|
-
params: [{ chainId: h(e) }]
|
|
139
|
-
});
|
|
140
|
-
} catch (t) {
|
|
141
|
-
if ((t == null ? void 0 : t.code) === 4902) {
|
|
142
|
-
const o = this.supportedNetworks.find((a) => a.chainId === e);
|
|
143
|
-
if (o) {
|
|
144
|
-
const a = {
|
|
145
|
-
...o,
|
|
146
|
-
chainId: h(o == null ? void 0 : o.chainId)
|
|
147
|
-
};
|
|
148
|
-
await r.request({
|
|
149
|
-
method: "wallet_addEthereumChain",
|
|
150
|
-
params: [a]
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
const s = t;
|
|
156
|
-
throw s.code === n.code ? new n(s) : s;
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
export {
|
|
162
|
-
C as default
|
|
163
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { B as p, a as f, C } from "./index-djQ_DEqj.mjs";
|
|
2
|
-
class y extends p {
|
|
3
|
-
constructor(u, v) {
|
|
4
|
-
super(u, null), this.getProvider = async () => {
|
|
5
|
-
var t, s, o, r;
|
|
6
|
-
let e;
|
|
7
|
-
if (this.provider)
|
|
8
|
-
e = this.provider;
|
|
9
|
-
else {
|
|
10
|
-
const n = await import("./dapp.es-BPGP9PnL.mjs").then((c) => c.b), i = (n == null ? void 0 : n.GelWallet) ?? (n == null ? void 0 : n.Web3Kit) ?? (n == null ? void 0 : n.default);
|
|
11
|
-
if (!i) throw new Error("GelWallet SDK not found in @web3jskit/dapp");
|
|
12
|
-
const a = (t = this.chainType) == null ? void 0 : t.toLowerCase();
|
|
13
|
-
if ((s = window.Web3Kit) != null && s._instance)
|
|
14
|
-
e = window.Web3Kit._instance.provider[a];
|
|
15
|
-
else {
|
|
16
|
-
const c = ((r = (o = this.store) == null ? void 0 : o.getState()) == null ? void 0 : r.useTestWallet) || !1;
|
|
17
|
-
typeof i.config == "function" && i.config({
|
|
18
|
-
hideEvokingButton: !1,
|
|
19
|
-
takeover: {
|
|
20
|
-
ethereum: !0,
|
|
21
|
-
solana: !0,
|
|
22
|
-
tronLink: !0
|
|
23
|
-
},
|
|
24
|
-
useTestWallet: c
|
|
25
|
-
});
|
|
26
|
-
const h = new i();
|
|
27
|
-
if (this.instance = h, e = await new Promise((l) => {
|
|
28
|
-
const d = () => {
|
|
29
|
-
h.provider && h.provider[a] ? l(h.provider[a]) : setTimeout(d, 100);
|
|
30
|
-
};
|
|
31
|
-
d();
|
|
32
|
-
}), window.Web3Kit = window.Web3Kit || {}, window.Web3Kit._instance = h, this.chainType === f.EVM) {
|
|
33
|
-
const l = e.request, d = async ({ methodName: w, ...m }) => await l({
|
|
34
|
-
chainType: this.chainType,
|
|
35
|
-
methodName: w,
|
|
36
|
-
...m
|
|
37
|
-
});
|
|
38
|
-
e.request = d;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
this.provider = e;
|
|
42
|
-
}
|
|
43
|
-
return this.provider || {};
|
|
44
|
-
}, this.addEventListener = async () => {
|
|
45
|
-
window.addEventListener("message", this.handleWeb3KitEvent);
|
|
46
|
-
}, this.removeEventListener = async () => {
|
|
47
|
-
window.removeEventListener("message", this.handleWeb3KitEvent);
|
|
48
|
-
}, this.handleWeb3KitEvent = (e) => {
|
|
49
|
-
const t = e.data;
|
|
50
|
-
t.target === "jsweb3-did" && (t.eventName === "disconnect" ? this.__onDisconnect() : t.eventName === "accountsChanged" ? this.__onAccountsChanged(t) : t.eventName === "chainChanged" && this.__onChainChanged(t));
|
|
51
|
-
}, this.__onAccountsChanged = (e) => {
|
|
52
|
-
var o, r, n, i, a;
|
|
53
|
-
if (!((o = e.data.connectedWebs) == null ? void 0 : o.find((c) => c.net.chainType === this.chainType)))
|
|
54
|
-
return;
|
|
55
|
-
const s = (a = (i = (n = (r = e.data) == null ? void 0 : r.account) == null ? void 0 : n.seriesWallets) == null ? void 0 : i[this.chainType]) == null ? void 0 : a.walletAddress;
|
|
56
|
-
s && (this.connectSuccess(s), this.walletEventEmitter.emit("accountsChanged", s));
|
|
57
|
-
}, this.__onChainChanged = (e) => {
|
|
58
|
-
const t = e.data.net.chainId;
|
|
59
|
-
this.store.getState().setCurrentNetwork(Number(t)), this.walletEventEmitter.emit("chainChanged", e.data.net);
|
|
60
|
-
}, this.__onConnect = () => {
|
|
61
|
-
}, this.__onDisconnect = async () => {
|
|
62
|
-
const e = await this.getProvider();
|
|
63
|
-
this.resetStatus(), this.removeEventListener(), this.walletEventEmitter.emit("disconnect"), e == null || e.request({
|
|
64
|
-
method: "wallet_revokePermissions",
|
|
65
|
-
params: [
|
|
66
|
-
{
|
|
67
|
-
eth_accounts: {}
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
});
|
|
71
|
-
}, this.chainType = v, this.connectorType = C.Run;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
export {
|
|
75
|
-
y as G
|
|
76
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const u=require("./index-CQkA0oWr.js");class f extends u.BaseConnector{constructor(v,w){super(v,null),this.getProvider=async()=>{var t,s,a,r;let e;if(this.provider)e=this.provider;else{const n=await Promise.resolve().then(()=>require("./dapp.es-sLnregcu.js")).then(c=>c.dapp_es),i=(n==null?void 0:n.GelWallet)??(n==null?void 0:n.Web3Kit)??(n==null?void 0:n.default);if(!i)throw new Error("GelWallet SDK not found in @web3jskit/dapp");const o=(t=this.chainType)==null?void 0:t.toLowerCase();if((s=window.Web3Kit)!=null&&s._instance)e=window.Web3Kit._instance.provider[o];else{const c=((r=(a=this.store)==null?void 0:a.getState())==null?void 0:r.useTestWallet)||!1;typeof i.config=="function"&&i.config({hideEvokingButton:!1,takeover:{ethereum:!0,solana:!0,tronLink:!0},useTestWallet:c});const h=new i;if(this.instance=h,e=await new Promise(l=>{const d=()=>{h.provider&&h.provider[o]?l(h.provider[o]):setTimeout(d,100)};d()}),window.Web3Kit=window.Web3Kit||{},window.Web3Kit._instance=h,this.chainType===u.ChainType.EVM){const l=e.request,d=async({methodName:m,...p})=>await l({chainType:this.chainType,methodName:m,...p});e.request=d}}this.provider=e}return this.provider||{}},this.addEventListener=async()=>{window.addEventListener("message",this.handleWeb3KitEvent)},this.removeEventListener=async()=>{window.removeEventListener("message",this.handleWeb3KitEvent)},this.handleWeb3KitEvent=e=>{const t=e.data;t.target==="jsweb3-did"&&(t.eventName==="disconnect"?this.__onDisconnect():t.eventName==="accountsChanged"?this.__onAccountsChanged(t):t.eventName==="chainChanged"&&this.__onChainChanged(t))},this.__onAccountsChanged=e=>{var a,r,n,i,o;if(!((a=e.data.connectedWebs)==null?void 0:a.find(c=>c.net.chainType===this.chainType)))return;const s=(o=(i=(n=(r=e.data)==null?void 0:r.account)==null?void 0:n.seriesWallets)==null?void 0:i[this.chainType])==null?void 0:o.walletAddress;s&&(this.connectSuccess(s),this.walletEventEmitter.emit("accountsChanged",s))},this.__onChainChanged=e=>{const t=e.data.net.chainId;this.store.getState().setCurrentNetwork(Number(t)),this.walletEventEmitter.emit("chainChanged",e.data.net)},this.__onConnect=()=>{},this.__onDisconnect=async()=>{const e=await this.getProvider();this.resetStatus(),this.removeEventListener(),this.walletEventEmitter.emit("disconnect"),e==null||e.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]})},this.chainType=w,this.connectorType=u.ConnectorType.Run}}exports.GelWalletConnector=f;
|