@web3jskit/walletkit 0.5.1 → 0.5.2
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/dist/{btcConnector-CWSxooB_.mjs → btcConnector-CDgcyxQ3.mjs} +1 -1
- package/dist/{btcConnector-BPOSvvaA.js → btcConnector-Ca_Ne7hH.js} +1 -1
- package/dist/{btcConnector-H4vacfvE.mjs → btcConnector-D9c29Oxw.mjs} +1 -1
- package/dist/{btcConnector-Bc6dNLGT.js → btcConnector-PnjTRzcQ.js} +1 -1
- package/dist/{deepLinkConnector-DjP2afmX.js → deepLinkConnector-2xq1YA07.js} +1 -1
- package/dist/{deepLinkConnector-Cv1mS_6-.mjs → deepLinkConnector-BV1AtJUd.mjs} +1 -1
- package/dist/{deepLinkConnector-k6omMzz2.js → deepLinkConnector-B_fjG32i.js} +1 -1
- package/dist/{deepLinkConnector-COkumXeY.js → deepLinkConnector-BjV3gwrJ.js} +1 -1
- package/dist/{deepLinkConnector-uAd7NNtg.js → deepLinkConnector-BrFUCtcT.js} +1 -1
- package/dist/{deepLinkConnector-C9yLvhQ0.js → deepLinkConnector-COLT9UtB.js} +1 -1
- package/dist/{deepLinkConnector-Dd1GhvIt.mjs → deepLinkConnector-Cl2lfNcv.mjs} +1 -1
- package/dist/{deepLinkConnector-CJskbSoZ.mjs → deepLinkConnector-ClxWpKnx.mjs} +1 -1
- package/dist/{deepLinkConnector-DmY8duGW.mjs → deepLinkConnector-Cp3wn9oq.mjs} +1 -1
- package/dist/{deepLinkConnector-CeF0BGa0.mjs → deepLinkConnector-Cy9w-E2m.mjs} +1 -1
- package/dist/{deepLinkConnector-JrGcvOeL.mjs → deepLinkConnector-D2bdmDbP.mjs} +1 -1
- package/dist/{deepLinkConnector-DVJJth-5.mjs → deepLinkConnector-De3WEuvS.mjs} +1 -1
- package/dist/{deepLinkConnector-BoFKaohV.js → deepLinkConnector-DvpJaC8p.js} +1 -1
- package/dist/{deepLinkConnector-BEhA9fXM.js → deepLinkConnector-Dypz-oTG.js} +1 -1
- package/dist/{evmConnector-CoauAOGL.mjs → evmConnector-CDZHCMDp.mjs} +2 -2
- package/dist/{evmConnector-CCvp7d3d.js → evmConnector-CsLHlVqx.js} +1 -1
- package/dist/{gelWalletConnector-B3UtBzAC.mjs → gelWalletConnector-D-BogX91.mjs} +1 -1
- package/dist/{gelWalletConnector-DWtJW90d.js → gelWalletConnector-DmGJoazT.js} +1 -1
- package/dist/hooks/useWalletKit.d.ts +2 -0
- package/dist/hooks/useWalletKit.d.ts.map +1 -1
- package/dist/{index-CQkA0oWr.js → index-BZdLbTeL.js} +14 -14
- package/dist/{index-djQ_DEqj.mjs → index-Dm84KVCU.mjs} +1698 -1685
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.js +26 -9
- package/dist/{solConnector-BJTonslk.mjs → solConnector-2sU1qHsq.mjs} +1 -1
- package/dist/{solConnector-RfQtdzBT.js → solConnector-BEPYycHF.js} +1 -1
- package/dist/{solConnector-BZeW9sSK.js → solConnector-CVS5qwwy.js} +1 -1
- package/dist/{solConnector-uPbRCSOa.mjs → solConnector-CWIPltdg.mjs} +1 -1
- package/dist/{solConnector-6iJX98IC.mjs → solConnector-CXejjI9x.mjs} +2 -2
- package/dist/{solConnector-DiPxszBo.mjs → solConnector-CnQAb35I.mjs} +1 -1
- package/dist/{solConnector-B0hCu-c0.js → solConnector-DU5bMwKt.js} +1 -1
- package/dist/{solConnector-BF2LX1V2.js → solConnector-xJ3YPYMj.js} +1 -1
- package/dist/stores/modalStore.d.ts +1 -0
- package/dist/stores/modalStore.d.ts.map +1 -1
- package/dist/{tronConnector-BlFA83pA.js → tronConnector-CUnp7Df4.js} +1 -1
- package/dist/{tronConnector-ofdgn1lq.mjs → tronConnector-CaEipTWV.mjs} +1 -1
- package/dist/{tronConnector-DfZzS07Y.mjs → tronConnector-CpIX5IxL.mjs} +1 -1
- package/dist/{tronConnector-CUOxt6Cw.mjs → tronConnector-DMLqqMae.mjs} +1 -1
- package/dist/{tronConnector-fKlrodno.js → tronConnector-DesDymhW.js} +1 -1
- package/dist/{tronConnector-BsjZsmAJ.js → tronConnector-tU0iwxHV.js} +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-BZdLbTeL.js");class v extends r.BaseConnector{constructor(h){var i,a;const g=(i=window.phantom)==null?void 0:i.bitcoin;super(h,g),this.addEventListener=async()=>{(await this.getProvider()).on("accountsChanged",s=>{var n;const e=(n=s[0])==null?void 0:n.address;e?this.connectSuccess(e):this.disconnect()})},this.removeEventListener=async()=>{(await this.getProvider()).off("accountsChanged",()=>{})},this.connect=async()=>{const t=await this.getProvider();try{this.beforeConnecting();const e=(await t.requestAccounts())[0].address;return this.connectSuccess(e),this.addEventListener(),e}catch(s){throw this.connectError(),s}},this.disconnect=async()=>{this.resetStatus(),this.removeEventListener()},this.getAccounts=async()=>(await(await this.getProvider()).requestAccounts())[0],this.signMessage=async()=>{const t=new TextEncoder().encode("hello world"),s=await this.getAccounts().catch(()=>{}),e=s==null?void 0:s.address,{signature:n}=await this.getProvider().signMessage(e,t);return n},this.getPublicKey=async()=>{const t=await this.getAccounts().catch(()=>{});return console.log("accounts",t),t.publicKey},this.signAndBroadcastPsbt=async(t,s)=>{console.log(t);const e=await this.getProvider();console.log("provider",e);const n=o=>Uint8Array.from(o.match(/.{1,2}/g).map(u=>parseInt(u,16))),c=await this.getAccounts().catch(()=>{}),d=c==null?void 0:c.address;console.log("address",d);try{const o=await e.signPSBT(n(t),{inputsToSign:[{address:d,signingIndexes:[0,1,3],sigHash:0}]});console.log("签名成功:",o)}catch(o){throw console.error("签名失败:",o),new Error("Broadcast method not supported by Phantom provider")}},this.__onAccountsChanged=()=>{},this.__onChainChanged=()=>{},this.__onConnect=()=>{},this.reconnection=async()=>{},this.__onDisconnect=()=>{},this.connectorType=(a=window.phantom)!=null&&a.bitcoin?r.ConnectorType.Installed:r.ConnectorType.More}}exports.default=v;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-BZdLbTeL.js");class d extends i.BaseConnector{constructor(a){const r=window.bitkeep.unisat;super(a,r),this.addEventListener=async()=>{(await this.getProvider()).on("accountsChanged",t=>{const e=t[0];e?this.connectSuccess(e):this.disconnect()})},this.removeEventListener=async()=>{(await this.getProvider()).removeListener("accountsChanged",()=>{})},this.connect=async()=>{const s=await this.getProvider();try{this.beforeConnecting();const t=await s.requestAccounts();console.log("accounts",t);const e=t[0];return this.connectSuccess(e),this.addEventListener(),e}catch(t){throw this.connectError(),t}},this.disconnect=async()=>{this.resetStatus(),this.removeEventListener()},this.getAccounts=async()=>(await(await this.getProvider()).getAccounts())[0],this.signPsbt=async(s,t)=>await(await this.getProvider()).signPsbt(s,t),this.pushPsbt=async s=>await(await this.getProvider()).pushPsbt(s),this.signMessage=async(s,t)=>await(await this.getProvider()).signMessage(s,t),this.sendBitcoin=async(s,t,e)=>{const o=await this.getProvider();console.log("provider",o),console.log("toAddress, satoshis, options",s,t,e);try{let n=await o.sendBitcoin(s,t);return console.log(n),n}catch(n){console.error(n)}},this.signAndBroadcastPsbt=async(s,t)=>{const e=await this.getProvider();console.log("provider",e);const o=await this.getAccounts().catch(()=>{});console.log("address",o);const n={autoFinalize:!0,...t||{}};console.log("signOptions",n),!n.toSignInputs&&o&&(n.toSignInputs=[{index:0,address:o}]);const c=await e.signPsbt(s,n);return console.log("signed PsbtHex",c),await e.pushPsbt(c)},this.__onAccountsChanged=()=>{},this.__onChainChanged=()=>{},this.__onConnect=()=>{},this.reconnection=async()=>{},this.__onDisconnect=()=>{},this.connectorType=r?i.ConnectorType.Installed:i.ConnectorType.More}}exports.default=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-BZdLbTeL.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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-BZdLbTeL.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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-BZdLbTeL.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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-BZdLbTeL.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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-BZdLbTeL.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,4 +1,4 @@
|
|
|
1
|
-
import { B as l, b as p, c } from "./index-
|
|
1
|
+
import { B as l, b as p, c } from "./index-Dm84KVCU.mjs";
|
|
2
2
|
const h = (o, e) => `https://phantom.app/ul/v1/${o}?${e.toString()}`, d = (o) => ({
|
|
3
3
|
request: async ({ method: e, params: r }) => (console.log("Phantom-----request", e, r), new Promise(() => {
|
|
4
4
|
if (e === "openDApp") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-BZdLbTeL.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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-BZdLbTeL.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,5 +1,5 @@
|
|
|
1
|
-
import { G as g } from "./gelWalletConnector-
|
|
2
|
-
import { a as l, n as h, e as m, d as y, U as n, m as f } from "./index-
|
|
1
|
+
import { G as g } from "./gelWalletConnector-D-BogX91.mjs";
|
|
2
|
+
import { a as l, n as h, e as m, d as y, U as n, m as f } from "./index-Dm84KVCU.mjs";
|
|
3
3
|
class C extends g {
|
|
4
4
|
constructor(p) {
|
|
5
5
|
super(p, l.EVM), this.getChainId = async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./gelWalletConnector-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./gelWalletConnector-DmGJoazT.js"),o=require("./index-BZdLbTeL.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 +1 @@
|
|
|
1
|
-
"use strict";const u=require("./index-
|
|
1
|
+
"use strict";const u=require("./index-BZdLbTeL.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;
|
|
@@ -5,11 +5,13 @@ import { WalletHelperState } from '../stores/helperStore';
|
|
|
5
5
|
type WalletKitStoreState = WalletHelperState & WalletKitState;
|
|
6
6
|
type WalletKit = WalletKitStoreState & {
|
|
7
7
|
connect: () => Promise<Connector>;
|
|
8
|
+
closeConnect: () => void;
|
|
8
9
|
showWalletInfo: () => void;
|
|
9
10
|
closeWalletInfo: () => void;
|
|
10
11
|
};
|
|
11
12
|
export declare const useWalletKit: () => {
|
|
12
13
|
connect: () => Promise<unknown>;
|
|
14
|
+
closeConnect: () => void;
|
|
13
15
|
showWalletInfo: () => void;
|
|
14
16
|
closeWalletInfo: () => void;
|
|
15
17
|
hydrated: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWalletKit.d.ts","sourceRoot":"","sources":["../../src/hooks/useWalletKit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAqB,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAIlF,KAAK,mBAAmB,GAAG,iBAAiB,GAAG,cAAc,CAAC;AAE9D,KAAK,SAAS,GAAG,mBAAmB,GAAG;IACtC,OAAO,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;IAClC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;
|
|
1
|
+
{"version":3,"file":"useWalletKit.d.ts","sourceRoot":"","sources":["../../src/hooks/useWalletKit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAqB,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAIlF,KAAK,mBAAmB,GAAG,iBAAiB,GAAG,cAAc,CAAC;AAE9D,KAAK,SAAS,GAAG,mBAAmB,GAAG;IACtC,OAAO,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;IAClC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AA4BF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qDAwBuvB,CAAC;;;;;cAA+M,CAAC;;;;;;;;iCAAqO,CAAC;uCAA6D,CAAC;2CAAiE,CAAC;;;mDAA4K,CAAC;oBAAgB,CAAC;oBAAuB,CAAC;;mBAAgC,CAAC;qBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAdjlD,CAAC;AAGF,eAAO,MAAM,YAAY,QASD,SACvB,CAAC"}
|