@depay/widgets 9.0.4 → 9.1.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 +2 -27
- package/dist/esm/index.bundle.js +1 -1
- package/dist/esm/index.js +47 -15
- package/dist/umd/index.bundle.js +1 -1
- package/dist/umd/index.js +47 -15
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -22262,6 +22262,18 @@ var SelectionProvider = (function (props) {
|
|
|
22262
22262
|
}, props.children);
|
|
22263
22263
|
});
|
|
22264
22264
|
|
|
22265
|
+
function addressEllipsis (address) {
|
|
22266
|
+
var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4;
|
|
22267
|
+
if (address === undefined) {
|
|
22268
|
+
return address;
|
|
22269
|
+
}
|
|
22270
|
+
var _address = "";
|
|
22271
|
+
_address += address.slice(0, length + 2);
|
|
22272
|
+
_address += '...';
|
|
22273
|
+
_address += address.slice(address.length - length, address.length);
|
|
22274
|
+
return _address;
|
|
22275
|
+
}
|
|
22276
|
+
|
|
22265
22277
|
var msToTime = (function (ms) {
|
|
22266
22278
|
var year, month, day, hour, minute, second;
|
|
22267
22279
|
second = Math.floor(ms / 1000);
|
|
@@ -22322,7 +22334,8 @@ var ConfirmTokenSelectionDialog = (function (props) {
|
|
|
22322
22334
|
symbol: token.symbol,
|
|
22323
22335
|
name: token.name,
|
|
22324
22336
|
decimals: token.decimals,
|
|
22325
|
-
logo: token.image || token.logo
|
|
22337
|
+
logo: token.image || token.logo,
|
|
22338
|
+
routable: token.routable
|
|
22326
22339
|
});
|
|
22327
22340
|
setTimeout(props.unmount, 300);
|
|
22328
22341
|
};
|
|
@@ -22350,18 +22363,17 @@ var ConfirmTokenSelectionDialog = (function (props) {
|
|
|
22350
22363
|
className: "PaddingTopXS"
|
|
22351
22364
|
}, /*#__PURE__*/React.createElement("table", {
|
|
22352
22365
|
className: "Table TextLeft FontSizeS"
|
|
22353
|
-
}, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", {
|
|
22354
|
-
className: "
|
|
22355
|
-
}, /*#__PURE__*/React.createElement("td", {
|
|
22356
|
-
|
|
22357
|
-
|
|
22358
|
-
className: "Link",
|
|
22366
|
+
}, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("div", {
|
|
22367
|
+
className: "TableSubTitle"
|
|
22368
|
+
}, "Address")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("a", {
|
|
22369
|
+
className: "Link FontSizeM",
|
|
22370
|
+
title: address,
|
|
22359
22371
|
href: blockchain.explorerUrlFor({
|
|
22360
22372
|
token: address
|
|
22361
22373
|
}),
|
|
22362
22374
|
target: "_blank",
|
|
22363
22375
|
rel: "noopener noreferrer"
|
|
22364
|
-
}, address)))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("div", {
|
|
22376
|
+
}, addressEllipsis(address, 4))))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("div", {
|
|
22365
22377
|
className: "TableSubTitle"
|
|
22366
22378
|
}, "Blockchain")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("div", null, blockchain.label))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("div", {
|
|
22367
22379
|
className: "TableSubTitle"
|
|
@@ -22389,6 +22401,7 @@ var SelectBlockchainDialog = (function (props) {
|
|
|
22389
22401
|
var stacked = Object.keys(props.selection).length > 1;
|
|
22390
22402
|
var blockchains = [Blockchain.findByName('ethereum'), Blockchain.findByName('bsc'), Blockchain.findByName('polygon')];
|
|
22391
22403
|
var selectBlockchain = function selectBlockchain(blockchain) {
|
|
22404
|
+
window._depay_token_selection_selected_blockchain = blockchain.name;
|
|
22392
22405
|
setSelection(Object.assign(props.selection, {
|
|
22393
22406
|
blockchain: blockchain
|
|
22394
22407
|
}));
|
|
@@ -22475,7 +22488,9 @@ var SelectTokenDialog = (function (props) {
|
|
|
22475
22488
|
if (wallet) {
|
|
22476
22489
|
wallet.connectedTo().then(function (name) {
|
|
22477
22490
|
var blockchain = Blockchain.findByName(name);
|
|
22478
|
-
if (
|
|
22491
|
+
if (window._depay_token_selection_selected_blockchain) {
|
|
22492
|
+
startWithBlockchain(window._depay_token_selection_selected_blockchain);
|
|
22493
|
+
} else if (name && name.length && blockchain && blockchain.tokens && blockchain.tokens.length) {
|
|
22479
22494
|
startWithBlockchain(name);
|
|
22480
22495
|
} else {
|
|
22481
22496
|
startWithBlockchain('ethereum');
|
|
@@ -22521,6 +22536,7 @@ var SelectTokenDialog = (function (props) {
|
|
|
22521
22536
|
});
|
|
22522
22537
|
}, 300), []);
|
|
22523
22538
|
var onChangeSearch = function onChangeSearch(event) {
|
|
22539
|
+
setShowAddToken(false);
|
|
22524
22540
|
var term = event.target.value;
|
|
22525
22541
|
setSearchTerm(term);
|
|
22526
22542
|
if (term.match(/^0x/)) {
|
|
@@ -22535,17 +22551,23 @@ var SelectTokenDialog = (function (props) {
|
|
|
22535
22551
|
if (token == undefined) {
|
|
22536
22552
|
return;
|
|
22537
22553
|
}
|
|
22538
|
-
Promise.all([token.name(), token.symbol(), token.decimals()
|
|
22539
|
-
|
|
22554
|
+
Promise.all([token.name(), token.symbol(), token.decimals(), fetch("https://public.depay.com/tokens/routable/".concat(blockchain.name, "/").concat(term)).then(function (response) {
|
|
22555
|
+
if (response.status == 200) {
|
|
22556
|
+
return response.json();
|
|
22557
|
+
}
|
|
22558
|
+
})]).then(function (_ref) {
|
|
22559
|
+
var _ref2 = _slicedToArray(_ref, 4),
|
|
22540
22560
|
name = _ref2[0],
|
|
22541
22561
|
symbol = _ref2[1],
|
|
22542
|
-
decimals = _ref2[2]
|
|
22562
|
+
decimals = _ref2[2],
|
|
22563
|
+
routable = _ref2[3];
|
|
22543
22564
|
setTokens([{
|
|
22544
22565
|
name: name,
|
|
22545
22566
|
symbol: symbol,
|
|
22546
22567
|
decimals: decimals,
|
|
22547
22568
|
address: term,
|
|
22548
|
-
blockchain: blockchain.name
|
|
22569
|
+
blockchain: blockchain.name,
|
|
22570
|
+
routable: !!routable
|
|
22549
22571
|
}]);
|
|
22550
22572
|
});
|
|
22551
22573
|
} else if (term && term.length) {
|
|
@@ -22556,6 +22578,12 @@ var SelectTokenDialog = (function (props) {
|
|
|
22556
22578
|
}
|
|
22557
22579
|
};
|
|
22558
22580
|
var select = function select(token) {
|
|
22581
|
+
if (token.address) {
|
|
22582
|
+
token.address = ethers.utils.getAddress(token.address);
|
|
22583
|
+
}
|
|
22584
|
+
if (token.external_id) {
|
|
22585
|
+
token.external_id = ethers.utils.getAddress(token.external_id);
|
|
22586
|
+
}
|
|
22559
22587
|
if (blockchain.tokens.find(function (majorToken) {
|
|
22560
22588
|
return majorToken.address == (token.address || token.external_id);
|
|
22561
22589
|
})) {
|
|
@@ -22566,7 +22594,8 @@ var SelectTokenDialog = (function (props) {
|
|
|
22566
22594
|
logo: token.logo || token.image,
|
|
22567
22595
|
name: token.name,
|
|
22568
22596
|
symbol: token.symbol,
|
|
22569
|
-
decimals: token.decimals
|
|
22597
|
+
decimals: token.decimals,
|
|
22598
|
+
routable: true
|
|
22570
22599
|
});
|
|
22571
22600
|
setTimeout(props.unmount, 300);
|
|
22572
22601
|
} else {
|
|
@@ -22625,13 +22654,16 @@ var SelectTokenDialog = (function (props) {
|
|
|
22625
22654
|
className: "transparent",
|
|
22626
22655
|
src: blockchain.logo
|
|
22627
22656
|
})), /*#__PURE__*/React.createElement("div", {
|
|
22628
|
-
className: "CardBody
|
|
22657
|
+
className: "CardBody FontSizeM"
|
|
22629
22658
|
}, blockchain.label), /*#__PURE__*/React.createElement("div", {
|
|
22630
22659
|
className: "CardAction"
|
|
22631
22660
|
}, /*#__PURE__*/React.createElement(ChevronRight, null)))), /*#__PURE__*/React.createElement("div", {
|
|
22632
22661
|
className: "PaddingTopXS PaddingBottomS"
|
|
22633
22662
|
}, /*#__PURE__*/React.createElement("input", {
|
|
22634
22663
|
value: searchTerm,
|
|
22664
|
+
onBlur: function onBlur() {
|
|
22665
|
+
return setShowAddToken(false);
|
|
22666
|
+
},
|
|
22635
22667
|
onChange: onChangeSearch,
|
|
22636
22668
|
className: "Search",
|
|
22637
22669
|
autoFocus: true,
|