@depay/widgets 6.4.0 → 6.5.3

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.
@@ -71380,11 +71380,11 @@ var ConfirmTokenSelectionDialog = (function (props) {
71380
71380
  setOpen(false);
71381
71381
  props.resolve({
71382
71382
  blockchain: token.blockchain,
71383
- address: token.external_id,
71383
+ address: token.external_id || token.address,
71384
71384
  symbol: token.symbol,
71385
71385
  name: token.name,
71386
71386
  decimals: token.decimals,
71387
- logo: token.image
71387
+ logo: token.image || token.logo
71388
71388
  });
71389
71389
  setTimeout(props.unmount, 300);
71390
71390
  };
@@ -71511,15 +71511,15 @@ var SelectTokenDialog = (function (props) {
71511
71511
  var _useContext3 = react.useContext(SelectionContext),
71512
71512
  setSelection = _useContext3.setSelection;
71513
71513
 
71514
- var _useState = react.useState(Blockchain.findByName('ethereum')),
71514
+ var _useState = react.useState(),
71515
71515
  _useState2 = _slicedToArray(_useState, 2),
71516
- blockchain = _useState2[0],
71517
- setBlockchain = _useState2[1];
71516
+ requestController = _useState2[0],
71517
+ setRequestController = _useState2[1];
71518
71518
 
71519
71519
  var _useState3 = react.useState(),
71520
71520
  _useState4 = _slicedToArray(_useState3, 2),
71521
- requestController = _useState4[0],
71522
- setRequestController = _useState4[1];
71521
+ blockchain = _useState4[0],
71522
+ setBlockchain = _useState4[1];
71523
71523
 
71524
71524
  var _useState5 = react.useState(false),
71525
71525
  _useState6 = _slicedToArray(_useState5, 2),
@@ -71537,21 +71537,44 @@ var SelectTokenDialog = (function (props) {
71537
71537
  _useState10[1];
71538
71538
 
71539
71539
  var searchElement = react.useRef();
71540
- react.useEffect(function () {
71540
+ var wallet = getWallet();
71541
+
71542
+ var startWithBlockchain = function startWithBlockchain(name) {
71543
+ var blockchain = Blockchain.findByName(name);
71544
+ setBlockchain(blockchain);
71541
71545
  setSelection(Object.assign(props.selection, {
71542
71546
  blockchain: blockchain,
71543
71547
  token: undefined
71544
71548
  }));
71549
+ setTokens(blockchain.tokens);
71550
+ };
71551
+
71552
+ react.useEffect(function () {
71553
+ if (wallet) {
71554
+ wallet.connectedTo().then(function (name) {
71555
+ var blockchain = Blockchain.findByName(name);
71556
+
71557
+ if (name && name.length && blockchain && blockchain.tokens && blockchain.tokens.length) {
71558
+ startWithBlockchain(name);
71559
+ } else {
71560
+ startWithBlockchain('ethereum');
71561
+ }
71562
+ });
71563
+ } else {
71564
+ startWithBlockchain('ethereum');
71565
+ }
71545
71566
  }, []);
71546
71567
  react.useEffect(function () {
71547
- setBlockchain(props.selection.blockchain);
71548
- setTokens(props.selection.blockchain.tokens);
71568
+ if (props.selection.blockchain) {
71569
+ setBlockchain(props.selection.blockchain);
71570
+ setTokens(props.selection.blockchain.tokens);
71549
71571
 
71550
- if (searchElement.current) {
71551
- searchElement.current.value = '';
71552
- searchElement.current.focus();
71572
+ if (searchElement.current) {
71573
+ searchElement.current.value = '';
71574
+ searchElement.current.focus();
71575
+ }
71553
71576
  }
71554
- }, [props.selection.blockchain]);
71577
+ }, [props.selection, props.selection.blockchain]);
71555
71578
 
71556
71579
  var onClickChangeBlockchain = function onClickChangeBlockchain() {
71557
71580
  navigate('SelectBlockchain');
@@ -71620,7 +71643,7 @@ var SelectTokenDialog = (function (props) {
71620
71643
  }
71621
71644
  })["catch"](function () {});
71622
71645
  } else {
71623
- setTokens(props.selection.blockchain.tokens);
71646
+ setTokens(blockchain.tokens);
71624
71647
  }
71625
71648
  };
71626
71649
 
@@ -71677,7 +71700,7 @@ var SelectTokenDialog = (function (props) {
71677
71700
  }, token.name))));
71678
71701
  });
71679
71702
 
71680
- if (props.selection.blockchain == undefined) {
71703
+ if (blockchain == undefined) {
71681
71704
  return null;
71682
71705
  }
71683
71706
 
@@ -71695,10 +71718,10 @@ var SelectTokenDialog = (function (props) {
71695
71718
  className: "CardImage small"
71696
71719
  }, /*#__PURE__*/react.createElement("img", {
71697
71720
  className: "transparent",
71698
- src: props.selection.blockchain.logo
71721
+ src: blockchain.logo
71699
71722
  })), /*#__PURE__*/react.createElement("div", {
71700
71723
  className: "CardBody"
71701
- }, props.selection.blockchain.label), /*#__PURE__*/react.createElement("div", {
71724
+ }, blockchain.label), /*#__PURE__*/react.createElement("div", {
71702
71725
  className: "CardAction"
71703
71726
  }, /*#__PURE__*/react.createElement(ChevronRight, null)))), /*#__PURE__*/react.createElement("div", {
71704
71727
  className: "PaddingTopXS PaddingBottomS"
package/dist/esm/index.js CHANGED
@@ -4757,11 +4757,11 @@ var ConfirmTokenSelectionDialog = (function (props) {
4757
4757
  setOpen(false);
4758
4758
  props.resolve({
4759
4759
  blockchain: token.blockchain,
4760
- address: token.external_id,
4760
+ address: token.external_id || token.address,
4761
4761
  symbol: token.symbol,
4762
4762
  name: token.name,
4763
4763
  decimals: token.decimals,
4764
- logo: token.image
4764
+ logo: token.image || token.logo
4765
4765
  });
4766
4766
  setTimeout(props.unmount, 300);
4767
4767
  };
@@ -4888,15 +4888,15 @@ var SelectTokenDialog = (function (props) {
4888
4888
  var _useContext3 = useContext(SelectionContext),
4889
4889
  setSelection = _useContext3.setSelection;
4890
4890
 
4891
- var _useState = useState(Blockchain.findByName('ethereum')),
4891
+ var _useState = useState(),
4892
4892
  _useState2 = _slicedToArray(_useState, 2),
4893
- blockchain = _useState2[0],
4894
- setBlockchain = _useState2[1];
4893
+ requestController = _useState2[0],
4894
+ setRequestController = _useState2[1];
4895
4895
 
4896
4896
  var _useState3 = useState(),
4897
4897
  _useState4 = _slicedToArray(_useState3, 2),
4898
- requestController = _useState4[0],
4899
- setRequestController = _useState4[1];
4898
+ blockchain = _useState4[0],
4899
+ setBlockchain = _useState4[1];
4900
4900
 
4901
4901
  var _useState5 = useState(false),
4902
4902
  _useState6 = _slicedToArray(_useState5, 2),
@@ -4914,21 +4914,44 @@ var SelectTokenDialog = (function (props) {
4914
4914
  _useState10[1];
4915
4915
 
4916
4916
  var searchElement = useRef();
4917
- useEffect(function () {
4917
+ var wallet = getWallet();
4918
+
4919
+ var startWithBlockchain = function startWithBlockchain(name) {
4920
+ var blockchain = Blockchain.findByName(name);
4921
+ setBlockchain(blockchain);
4918
4922
  setSelection(Object.assign(props.selection, {
4919
4923
  blockchain: blockchain,
4920
4924
  token: undefined
4921
4925
  }));
4926
+ setTokens(blockchain.tokens);
4927
+ };
4928
+
4929
+ useEffect(function () {
4930
+ if (wallet) {
4931
+ wallet.connectedTo().then(function (name) {
4932
+ var blockchain = Blockchain.findByName(name);
4933
+
4934
+ if (name && name.length && blockchain && blockchain.tokens && blockchain.tokens.length) {
4935
+ startWithBlockchain(name);
4936
+ } else {
4937
+ startWithBlockchain('ethereum');
4938
+ }
4939
+ });
4940
+ } else {
4941
+ startWithBlockchain('ethereum');
4942
+ }
4922
4943
  }, []);
4923
4944
  useEffect(function () {
4924
- setBlockchain(props.selection.blockchain);
4925
- setTokens(props.selection.blockchain.tokens);
4945
+ if (props.selection.blockchain) {
4946
+ setBlockchain(props.selection.blockchain);
4947
+ setTokens(props.selection.blockchain.tokens);
4926
4948
 
4927
- if (searchElement.current) {
4928
- searchElement.current.value = '';
4929
- searchElement.current.focus();
4949
+ if (searchElement.current) {
4950
+ searchElement.current.value = '';
4951
+ searchElement.current.focus();
4952
+ }
4930
4953
  }
4931
- }, [props.selection.blockchain]);
4954
+ }, [props.selection, props.selection.blockchain]);
4932
4955
 
4933
4956
  var onClickChangeBlockchain = function onClickChangeBlockchain() {
4934
4957
  navigate('SelectBlockchain');
@@ -4997,7 +5020,7 @@ var SelectTokenDialog = (function (props) {
4997
5020
  }
4998
5021
  })["catch"](function () {});
4999
5022
  } else {
5000
- setTokens(props.selection.blockchain.tokens);
5023
+ setTokens(blockchain.tokens);
5001
5024
  }
5002
5025
  };
5003
5026
 
@@ -5054,7 +5077,7 @@ var SelectTokenDialog = (function (props) {
5054
5077
  }, token.name))));
5055
5078
  });
5056
5079
 
5057
- if (props.selection.blockchain == undefined) {
5080
+ if (blockchain == undefined) {
5058
5081
  return null;
5059
5082
  }
5060
5083
 
@@ -5072,10 +5095,10 @@ var SelectTokenDialog = (function (props) {
5072
5095
  className: "CardImage small"
5073
5096
  }, /*#__PURE__*/React.createElement("img", {
5074
5097
  className: "transparent",
5075
- src: props.selection.blockchain.logo
5098
+ src: blockchain.logo
5076
5099
  })), /*#__PURE__*/React.createElement("div", {
5077
5100
  className: "CardBody"
5078
- }, props.selection.blockchain.label), /*#__PURE__*/React.createElement("div", {
5101
+ }, blockchain.label), /*#__PURE__*/React.createElement("div", {
5079
5102
  className: "CardAction"
5080
5103
  }, /*#__PURE__*/React.createElement(ChevronRight, null)))), /*#__PURE__*/React.createElement("div", {
5081
5104
  className: "PaddingTopXS PaddingBottomS"
@@ -71386,11 +71386,11 @@
71386
71386
  setOpen(false);
71387
71387
  props.resolve({
71388
71388
  blockchain: token.blockchain,
71389
- address: token.external_id,
71389
+ address: token.external_id || token.address,
71390
71390
  symbol: token.symbol,
71391
71391
  name: token.name,
71392
71392
  decimals: token.decimals,
71393
- logo: token.image
71393
+ logo: token.image || token.logo
71394
71394
  });
71395
71395
  setTimeout(props.unmount, 300);
71396
71396
  };
@@ -71517,15 +71517,15 @@
71517
71517
  var _useContext3 = react.useContext(SelectionContext),
71518
71518
  setSelection = _useContext3.setSelection;
71519
71519
 
71520
- var _useState = react.useState(Blockchain.findByName('ethereum')),
71520
+ var _useState = react.useState(),
71521
71521
  _useState2 = _slicedToArray(_useState, 2),
71522
- blockchain = _useState2[0],
71523
- setBlockchain = _useState2[1];
71522
+ requestController = _useState2[0],
71523
+ setRequestController = _useState2[1];
71524
71524
 
71525
71525
  var _useState3 = react.useState(),
71526
71526
  _useState4 = _slicedToArray(_useState3, 2),
71527
- requestController = _useState4[0],
71528
- setRequestController = _useState4[1];
71527
+ blockchain = _useState4[0],
71528
+ setBlockchain = _useState4[1];
71529
71529
 
71530
71530
  var _useState5 = react.useState(false),
71531
71531
  _useState6 = _slicedToArray(_useState5, 2),
@@ -71543,21 +71543,44 @@
71543
71543
  _useState10[1];
71544
71544
 
71545
71545
  var searchElement = react.useRef();
71546
- react.useEffect(function () {
71546
+ var wallet = getWallet();
71547
+
71548
+ var startWithBlockchain = function startWithBlockchain(name) {
71549
+ var blockchain = Blockchain.findByName(name);
71550
+ setBlockchain(blockchain);
71547
71551
  setSelection(Object.assign(props.selection, {
71548
71552
  blockchain: blockchain,
71549
71553
  token: undefined
71550
71554
  }));
71555
+ setTokens(blockchain.tokens);
71556
+ };
71557
+
71558
+ react.useEffect(function () {
71559
+ if (wallet) {
71560
+ wallet.connectedTo().then(function (name) {
71561
+ var blockchain = Blockchain.findByName(name);
71562
+
71563
+ if (name && name.length && blockchain && blockchain.tokens && blockchain.tokens.length) {
71564
+ startWithBlockchain(name);
71565
+ } else {
71566
+ startWithBlockchain('ethereum');
71567
+ }
71568
+ });
71569
+ } else {
71570
+ startWithBlockchain('ethereum');
71571
+ }
71551
71572
  }, []);
71552
71573
  react.useEffect(function () {
71553
- setBlockchain(props.selection.blockchain);
71554
- setTokens(props.selection.blockchain.tokens);
71574
+ if (props.selection.blockchain) {
71575
+ setBlockchain(props.selection.blockchain);
71576
+ setTokens(props.selection.blockchain.tokens);
71555
71577
 
71556
- if (searchElement.current) {
71557
- searchElement.current.value = '';
71558
- searchElement.current.focus();
71578
+ if (searchElement.current) {
71579
+ searchElement.current.value = '';
71580
+ searchElement.current.focus();
71581
+ }
71559
71582
  }
71560
- }, [props.selection.blockchain]);
71583
+ }, [props.selection, props.selection.blockchain]);
71561
71584
 
71562
71585
  var onClickChangeBlockchain = function onClickChangeBlockchain() {
71563
71586
  navigate('SelectBlockchain');
@@ -71626,7 +71649,7 @@
71626
71649
  }
71627
71650
  })["catch"](function () {});
71628
71651
  } else {
71629
- setTokens(props.selection.blockchain.tokens);
71652
+ setTokens(blockchain.tokens);
71630
71653
  }
71631
71654
  };
71632
71655
 
@@ -71683,7 +71706,7 @@
71683
71706
  }, token.name))));
71684
71707
  });
71685
71708
 
71686
- if (props.selection.blockchain == undefined) {
71709
+ if (blockchain == undefined) {
71687
71710
  return null;
71688
71711
  }
71689
71712
 
@@ -71701,10 +71724,10 @@
71701
71724
  className: "CardImage small"
71702
71725
  }, /*#__PURE__*/react.createElement("img", {
71703
71726
  className: "transparent",
71704
- src: props.selection.blockchain.logo
71727
+ src: blockchain.logo
71705
71728
  })), /*#__PURE__*/react.createElement("div", {
71706
71729
  className: "CardBody"
71707
- }, props.selection.blockchain.label), /*#__PURE__*/react.createElement("div", {
71730
+ }, blockchain.label), /*#__PURE__*/react.createElement("div", {
71708
71731
  className: "CardAction"
71709
71732
  }, /*#__PURE__*/react.createElement(ChevronRight, null)))), /*#__PURE__*/react.createElement("div", {
71710
71733
  className: "PaddingTopXS PaddingBottomS"
package/dist/umd/index.js CHANGED
@@ -4752,11 +4752,11 @@
4752
4752
  setOpen(false);
4753
4753
  props.resolve({
4754
4754
  blockchain: token.blockchain,
4755
- address: token.external_id,
4755
+ address: token.external_id || token.address,
4756
4756
  symbol: token.symbol,
4757
4757
  name: token.name,
4758
4758
  decimals: token.decimals,
4759
- logo: token.image
4759
+ logo: token.image || token.logo
4760
4760
  });
4761
4761
  setTimeout(props.unmount, 300);
4762
4762
  };
@@ -4883,15 +4883,15 @@
4883
4883
  var _useContext3 = React.useContext(SelectionContext),
4884
4884
  setSelection = _useContext3.setSelection;
4885
4885
 
4886
- var _useState = React.useState(web3Blockchains.Blockchain.findByName('ethereum')),
4886
+ var _useState = React.useState(),
4887
4887
  _useState2 = _slicedToArray(_useState, 2),
4888
- blockchain = _useState2[0],
4889
- setBlockchain = _useState2[1];
4888
+ requestController = _useState2[0],
4889
+ setRequestController = _useState2[1];
4890
4890
 
4891
4891
  var _useState3 = React.useState(),
4892
4892
  _useState4 = _slicedToArray(_useState3, 2),
4893
- requestController = _useState4[0],
4894
- setRequestController = _useState4[1];
4893
+ blockchain = _useState4[0],
4894
+ setBlockchain = _useState4[1];
4895
4895
 
4896
4896
  var _useState5 = React.useState(false),
4897
4897
  _useState6 = _slicedToArray(_useState5, 2),
@@ -4909,21 +4909,44 @@
4909
4909
  _useState10[1];
4910
4910
 
4911
4911
  var searchElement = React.useRef();
4912
- React.useEffect(function () {
4912
+ var wallet = web3Wallets.getWallet();
4913
+
4914
+ var startWithBlockchain = function startWithBlockchain(name) {
4915
+ var blockchain = web3Blockchains.Blockchain.findByName(name);
4916
+ setBlockchain(blockchain);
4913
4917
  setSelection(Object.assign(props.selection, {
4914
4918
  blockchain: blockchain,
4915
4919
  token: undefined
4916
4920
  }));
4921
+ setTokens(blockchain.tokens);
4922
+ };
4923
+
4924
+ React.useEffect(function () {
4925
+ if (wallet) {
4926
+ wallet.connectedTo().then(function (name) {
4927
+ var blockchain = web3Blockchains.Blockchain.findByName(name);
4928
+
4929
+ if (name && name.length && blockchain && blockchain.tokens && blockchain.tokens.length) {
4930
+ startWithBlockchain(name);
4931
+ } else {
4932
+ startWithBlockchain('ethereum');
4933
+ }
4934
+ });
4935
+ } else {
4936
+ startWithBlockchain('ethereum');
4937
+ }
4917
4938
  }, []);
4918
4939
  React.useEffect(function () {
4919
- setBlockchain(props.selection.blockchain);
4920
- setTokens(props.selection.blockchain.tokens);
4940
+ if (props.selection.blockchain) {
4941
+ setBlockchain(props.selection.blockchain);
4942
+ setTokens(props.selection.blockchain.tokens);
4921
4943
 
4922
- if (searchElement.current) {
4923
- searchElement.current.value = '';
4924
- searchElement.current.focus();
4944
+ if (searchElement.current) {
4945
+ searchElement.current.value = '';
4946
+ searchElement.current.focus();
4947
+ }
4925
4948
  }
4926
- }, [props.selection.blockchain]);
4949
+ }, [props.selection, props.selection.blockchain]);
4927
4950
 
4928
4951
  var onClickChangeBlockchain = function onClickChangeBlockchain() {
4929
4952
  navigate('SelectBlockchain');
@@ -4992,7 +5015,7 @@
4992
5015
  }
4993
5016
  })["catch"](function () {});
4994
5017
  } else {
4995
- setTokens(props.selection.blockchain.tokens);
5018
+ setTokens(blockchain.tokens);
4996
5019
  }
4997
5020
  };
4998
5021
 
@@ -5049,7 +5072,7 @@
5049
5072
  }, token.name))));
5050
5073
  });
5051
5074
 
5052
- if (props.selection.blockchain == undefined) {
5075
+ if (blockchain == undefined) {
5053
5076
  return null;
5054
5077
  }
5055
5078
 
@@ -5067,10 +5090,10 @@
5067
5090
  className: "CardImage small"
5068
5091
  }, /*#__PURE__*/React__default["default"].createElement("img", {
5069
5092
  className: "transparent",
5070
- src: props.selection.blockchain.logo
5093
+ src: blockchain.logo
5071
5094
  })), /*#__PURE__*/React__default["default"].createElement("div", {
5072
5095
  className: "CardBody"
5073
- }, props.selection.blockchain.label), /*#__PURE__*/React__default["default"].createElement("div", {
5096
+ }, blockchain.label), /*#__PURE__*/React__default["default"].createElement("div", {
5074
5097
  className: "CardAction"
5075
5098
  }, /*#__PURE__*/React__default["default"].createElement(ChevronRight, null)))), /*#__PURE__*/React__default["default"].createElement("div", {
5076
5099
  className: "PaddingTopXS PaddingBottomS"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@depay/widgets",
3
3
  "moduleName": "DePayWidgets",
4
- "version": "6.4.0",
4
+ "version": "6.5.3",
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",
@@ -45,7 +45,7 @@
45
45
  "@depay/web3-exchanges": "^8.1.0",
46
46
  "@depay/web3-payments": "^9.1.0",
47
47
  "@depay/web3-tokens": "^8.0.0",
48
- "@depay/web3-wallets": "^8.0.2",
48
+ "@depay/web3-wallets": "^8.1.0",
49
49
  "decimal.js": "^10.3.1",
50
50
  "react-rangeslider": "^2.2.0"
51
51
  },