@depay/widgets 6.16.1 → 6.16.5

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.
@@ -48841,7 +48841,13 @@ const submitSimpleTransfer = ({ transaction, wallet })=>{
48841
48841
  };
48842
48842
 
48843
48843
  function _optionalChain$6(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
48844
- let connectedInstance;
48844
+ const setConnectedInstance = (value)=>{
48845
+ window._connectedWalletConnectInstance = value;
48846
+ };
48847
+
48848
+ const getConnectedInstance = ()=>{
48849
+ return window._connectedWalletConnectInstance
48850
+ };
48845
48851
 
48846
48852
  class WalletConnectWallet {
48847
48853
 
@@ -48891,12 +48897,12 @@ class WalletConnectWallet {
48891
48897
  });
48892
48898
 
48893
48899
  instance.on("disconnect", (error, payload) => {
48894
- connectedInstance = undefined;
48900
+ setConnectedInstance(undefined);
48895
48901
  if (error) { throw error }
48896
48902
  });
48897
48903
 
48898
48904
  instance.on("modal_closed", ()=>{
48899
- connectedInstance = undefined;
48905
+ setConnectedInstance(undefined);
48900
48906
  this.connector = undefined;
48901
48907
  });
48902
48908
 
@@ -48915,23 +48921,28 @@ class WalletConnectWallet {
48915
48921
 
48916
48922
  async connect(options) {
48917
48923
  try {
48924
+ if(this.connector == undefined){
48925
+ this.connector = this.newWalletConnectInstance();
48926
+ }
48927
+
48918
48928
  if(this.connector.connected) {
48919
48929
  await this.connector.killSession();
48920
- connectedInstance = undefined;
48930
+ setConnectedInstance(undefined);
48921
48931
  this.connector = this.newWalletConnectInstance();
48922
48932
  }
48923
48933
 
48924
48934
  const { accounts, chainId } = await this.connector.connect({ chainId: _optionalChain$6([options, 'optionalAccess', _ => _.chainId]) });
48925
48935
 
48926
48936
  if(accounts instanceof Array && accounts.length) {
48927
- connectedInstance = this;
48937
+ setConnectedInstance(this);
48928
48938
  }
48929
48939
 
48930
48940
  this.connectedAccounts = accounts;
48931
48941
  this.connectedChainId = chainId;
48932
48942
 
48933
48943
  return accounts
48934
- } catch (e) {
48944
+ } catch (error) {
48945
+ console.log('WALLETCONNECT ERROR', error);
48935
48946
  return []
48936
48947
  }
48937
48948
  }
@@ -49025,7 +49036,7 @@ const wallets = {
49025
49036
  const instances = {};
49026
49037
 
49027
49038
  const getWalletClass = function(){
49028
- if(connectedInstance) {
49039
+ if(getConnectedInstance()) {
49029
49040
  return wallets.WalletConnect
49030
49041
  } else if (typeof window.ethereum === 'object' && window.ethereum.isMetaMask) {
49031
49042
  return wallets.MetaMask
@@ -49040,8 +49051,8 @@ const getWallet = function () {
49040
49051
  const walletClass = getWalletClass();
49041
49052
  const existingInstance = instances[walletClass];
49042
49053
 
49043
- if(connectedInstance) {
49044
- return connectedInstance
49054
+ if(getConnectedInstance()) {
49055
+ return getConnectedInstance()
49045
49056
  } else if(existingInstance) {
49046
49057
  return existingInstance
49047
49058
  } else if(walletClass) {
@@ -70070,6 +70081,7 @@ let TokenImage = function(props){
70070
70081
 
70071
70082
  return(
70072
70083
  react.createElement('img', {
70084
+ className: props.className ,
70073
70085
  src: src ,
70074
70086
  onError: handleLoadError , __self: this, __source: {fileName: _jsxFileName, lineNumber: 51}}
70075
70087
  )
@@ -48847,7 +48847,13 @@
48847
48847
  };
48848
48848
 
48849
48849
  function _optionalChain$6(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
48850
- let connectedInstance;
48850
+ const setConnectedInstance = (value)=>{
48851
+ window._connectedWalletConnectInstance = value;
48852
+ };
48853
+
48854
+ const getConnectedInstance = ()=>{
48855
+ return window._connectedWalletConnectInstance
48856
+ };
48851
48857
 
48852
48858
  class WalletConnectWallet {
48853
48859
 
@@ -48897,12 +48903,12 @@
48897
48903
  });
48898
48904
 
48899
48905
  instance.on("disconnect", (error, payload) => {
48900
- connectedInstance = undefined;
48906
+ setConnectedInstance(undefined);
48901
48907
  if (error) { throw error }
48902
48908
  });
48903
48909
 
48904
48910
  instance.on("modal_closed", ()=>{
48905
- connectedInstance = undefined;
48911
+ setConnectedInstance(undefined);
48906
48912
  this.connector = undefined;
48907
48913
  });
48908
48914
 
@@ -48921,23 +48927,28 @@
48921
48927
 
48922
48928
  async connect(options) {
48923
48929
  try {
48930
+ if(this.connector == undefined){
48931
+ this.connector = this.newWalletConnectInstance();
48932
+ }
48933
+
48924
48934
  if(this.connector.connected) {
48925
48935
  await this.connector.killSession();
48926
- connectedInstance = undefined;
48936
+ setConnectedInstance(undefined);
48927
48937
  this.connector = this.newWalletConnectInstance();
48928
48938
  }
48929
48939
 
48930
48940
  const { accounts, chainId } = await this.connector.connect({ chainId: _optionalChain$6([options, 'optionalAccess', _ => _.chainId]) });
48931
48941
 
48932
48942
  if(accounts instanceof Array && accounts.length) {
48933
- connectedInstance = this;
48943
+ setConnectedInstance(this);
48934
48944
  }
48935
48945
 
48936
48946
  this.connectedAccounts = accounts;
48937
48947
  this.connectedChainId = chainId;
48938
48948
 
48939
48949
  return accounts
48940
- } catch (e) {
48950
+ } catch (error) {
48951
+ console.log('WALLETCONNECT ERROR', error);
48941
48952
  return []
48942
48953
  }
48943
48954
  }
@@ -49031,7 +49042,7 @@
49031
49042
  const instances = {};
49032
49043
 
49033
49044
  const getWalletClass = function(){
49034
- if(connectedInstance) {
49045
+ if(getConnectedInstance()) {
49035
49046
  return wallets.WalletConnect
49036
49047
  } else if (typeof window.ethereum === 'object' && window.ethereum.isMetaMask) {
49037
49048
  return wallets.MetaMask
@@ -49046,8 +49057,8 @@
49046
49057
  const walletClass = getWalletClass();
49047
49058
  const existingInstance = instances[walletClass];
49048
49059
 
49049
- if(connectedInstance) {
49050
- return connectedInstance
49060
+ if(getConnectedInstance()) {
49061
+ return getConnectedInstance()
49051
49062
  } else if(existingInstance) {
49052
49063
  return existingInstance
49053
49064
  } else if(walletClass) {
@@ -70076,6 +70087,7 @@
70076
70087
 
70077
70088
  return(
70078
70089
  react.createElement('img', {
70090
+ className: props.className ,
70079
70091
  src: src ,
70080
70092
  onError: handleLoadError , __self: this, __source: {fileName: _jsxFileName, lineNumber: 51}}
70081
70093
  )
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@depay/widgets",
3
3
  "moduleName": "DePayWidgets",
4
- "version": "6.16.1",
4
+ "version": "6.16.5",
5
5
  "description": "Web3 Payments with any token. DePay simplifies and improves Web3 Payments with the power of DeFi. Accept any token with on-the-fly conversion.",
6
6
  "main": "./dist/umd/index.js",
7
7
  "module": "./dist/esm/index.js",
@@ -37,7 +37,7 @@
37
37
  "@depay/react-dialog-stack": "^4.1.1",
38
38
  "@depay/react-shadow-dom": "^4.0.0",
39
39
  "@depay/react-token-image": "^3.0.0",
40
- "@depay/walletconnect-v1": "^1.0.18",
40
+ "@depay/walletconnect-v1": "^1.1.0",
41
41
  "@depay/web3-assets": "^5.2.0",
42
42
  "@depay/web3-blockchains": "^4.2.0",
43
43
  "@depay/web3-client": "^8.0.0",
@@ -45,7 +45,7 @@
45
45
  "@depay/web3-exchanges": "^8.1.0",
46
46
  "@depay/web3-payments": "^9.3.3",
47
47
  "@depay/web3-tokens": "^8.0.1",
48
- "@depay/web3-wallets": "^9.0.0",
48
+ "@depay/web3-wallets": "^9.1.0",
49
49
  "decimal.js": "^10.3.1",
50
50
  "react-rangeslider": "^2.2.0"
51
51
  },