@tonconnect/ui-react 1.0.0-beta.1 → 1.0.0-beta.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.
- package/README.md +58 -26
- package/lib/index.js +59 -6
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +59 -6
- package/lib/index.umd.js.map +1 -1
- package/package.json +3 -3
package/lib/index.umd.js
CHANGED
|
@@ -4540,6 +4540,47 @@ var __objRest = (source, exclude) => {
|
|
|
4540
4540
|
function isWalletInfoRemote(value) {
|
|
4541
4541
|
return "bridgeUrl" in value;
|
|
4542
4542
|
}
|
|
4543
|
+
const FALLBACK_WALLETS_LIST = [
|
|
4544
|
+
{
|
|
4545
|
+
name: "Tonkeeper",
|
|
4546
|
+
image: "https://tonkeeper.com/assets/tonconnect-icon.png",
|
|
4547
|
+
tondns: "tonkeeper.ton",
|
|
4548
|
+
about_url: "https://tonkeeper.com",
|
|
4549
|
+
universal_url: "https://app.tonkeeper.com/ton-connect",
|
|
4550
|
+
bridge: [
|
|
4551
|
+
{
|
|
4552
|
+
type: "sse",
|
|
4553
|
+
url: "https://bridge.tonapi.io/bridge"
|
|
4554
|
+
},
|
|
4555
|
+
{
|
|
4556
|
+
type: "js",
|
|
4557
|
+
key: "tonkeeper"
|
|
4558
|
+
}
|
|
4559
|
+
]
|
|
4560
|
+
},
|
|
4561
|
+
{
|
|
4562
|
+
name: "OpenMask",
|
|
4563
|
+
image: "https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",
|
|
4564
|
+
about_url: "https://www.openmask.app/",
|
|
4565
|
+
bridge: [
|
|
4566
|
+
{
|
|
4567
|
+
type: "js",
|
|
4568
|
+
key: "openmask"
|
|
4569
|
+
}
|
|
4570
|
+
]
|
|
4571
|
+
},
|
|
4572
|
+
{
|
|
4573
|
+
name: "MyTonWallet",
|
|
4574
|
+
image: "https://mytonwallet.io/icon-256.png",
|
|
4575
|
+
about_url: "https://mytonwallet.io",
|
|
4576
|
+
bridge: [
|
|
4577
|
+
{
|
|
4578
|
+
type: "js",
|
|
4579
|
+
key: "mytonwallet"
|
|
4580
|
+
}
|
|
4581
|
+
]
|
|
4582
|
+
}
|
|
4583
|
+
];
|
|
4543
4584
|
class WalletsListManager {
|
|
4544
4585
|
constructor(walletsListSource) {
|
|
4545
4586
|
this.walletsListCache = null;
|
|
@@ -4569,17 +4610,29 @@ var __objRest = (source, exclude) => {
|
|
|
4569
4610
|
}
|
|
4570
4611
|
fetchWalletsList() {
|
|
4571
4612
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4613
|
+
let walletsList = [];
|
|
4572
4614
|
try {
|
|
4573
4615
|
const walletsResponse = yield fetch(this.walletsListSource);
|
|
4574
|
-
|
|
4575
|
-
if (!Array.isArray(walletsList)
|
|
4576
|
-
throw new FetchWalletsError("Wrong wallets list format");
|
|
4616
|
+
walletsList = yield walletsResponse.json();
|
|
4617
|
+
if (!Array.isArray(walletsList)) {
|
|
4618
|
+
throw new FetchWalletsError("Wrong wallets list format, wallets list must be an array.");
|
|
4577
4619
|
}
|
|
4578
|
-
const
|
|
4579
|
-
|
|
4620
|
+
const wrongFormatWallets = walletsList.filter((wallet) => !this.isCorrectWalletConfigDTO(wallet));
|
|
4621
|
+
if (wrongFormatWallets.length) {
|
|
4622
|
+
logError(`Wallet(s) ${wrongFormatWallets.map((wallet) => wallet.name).join(", ")} config format is wrong. They were removed from the wallets list.`);
|
|
4623
|
+
walletsList = walletsList.filter((wallet) => this.isCorrectWalletConfigDTO(wallet));
|
|
4624
|
+
}
|
|
4625
|
+
} catch (e2) {
|
|
4626
|
+
logError(e2);
|
|
4627
|
+
walletsList = FALLBACK_WALLETS_LIST;
|
|
4628
|
+
}
|
|
4629
|
+
let currentlyInjectedWallets = [];
|
|
4630
|
+
try {
|
|
4631
|
+
currentlyInjectedWallets = InjectedProvider.getCurrentlyInjectedWallets();
|
|
4580
4632
|
} catch (e2) {
|
|
4581
|
-
|
|
4633
|
+
logError(e2);
|
|
4582
4634
|
}
|
|
4635
|
+
return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(walletsList), currentlyInjectedWallets);
|
|
4583
4636
|
});
|
|
4584
4637
|
}
|
|
4585
4638
|
walletConfigDTOListToWalletConfigList(walletConfigDTO) {
|