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