@partylayer/sdk 0.22.1 → 0.22.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/README.md +4 -4
- package/dist/{application-ledger-reader-DYaIuRCD.d.mts → application-ledger-reader-D3MFRC4B.d.mts} +1 -0
- package/dist/{application-ledger-reader-DYaIuRCD.d.ts → application-ledger-reader-D3MFRC4B.d.ts} +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +55 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -18
- package/dist/index.mjs.map +1 -1
- package/dist/native.d.mts +2 -2
- package/dist/native.d.ts +2 -2
- package/dist/native.js +55 -17
- package/dist/native.js.map +1 -1
- package/dist/native.mjs +56 -18
- package/dist/native.mjs.map +1 -1
- package/package.json +9 -9
package/dist/native.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as PartyLayerClientBase, P as PartyLayerBaseConfig } from './application-ledger-reader-
|
|
2
|
-
export { A as AdapterClass, b as ApplicationLedgerReaderOptions, C as ConnectOptions, c as PartyLayerEvent, W as WalletFilter, j as WalletLedgerClient, k as WalletLedgerReader, l as WalletLedgerReaderOptions, p as createApplicationLedgerReader, q as createWalletLedgerReader } from './application-ledger-reader-
|
|
1
|
+
import { a as PartyLayerClientBase, P as PartyLayerBaseConfig } from './application-ledger-reader-D3MFRC4B.mjs';
|
|
2
|
+
export { A as AdapterClass, b as ApplicationLedgerReaderOptions, C as ConnectOptions, c as PartyLayerEvent, W as WalletFilter, j as WalletLedgerClient, k as WalletLedgerReader, l as WalletLedgerReaderOptions, p as createApplicationLedgerReader, q as createWalletLedgerReader } from './application-ledger-reader-D3MFRC4B.mjs';
|
|
3
3
|
import '@partylayer/core';
|
|
4
4
|
import '@partylayer/registry-client';
|
|
5
5
|
|
package/dist/native.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as PartyLayerClientBase, P as PartyLayerBaseConfig } from './application-ledger-reader-
|
|
2
|
-
export { A as AdapterClass, b as ApplicationLedgerReaderOptions, C as ConnectOptions, c as PartyLayerEvent, W as WalletFilter, j as WalletLedgerClient, k as WalletLedgerReader, l as WalletLedgerReaderOptions, p as createApplicationLedgerReader, q as createWalletLedgerReader } from './application-ledger-reader-
|
|
1
|
+
import { a as PartyLayerClientBase, P as PartyLayerBaseConfig } from './application-ledger-reader-D3MFRC4B.js';
|
|
2
|
+
export { A as AdapterClass, b as ApplicationLedgerReaderOptions, C as ConnectOptions, c as PartyLayerEvent, W as WalletFilter, j as WalletLedgerClient, k as WalletLedgerReader, l as WalletLedgerReaderOptions, p as createApplicationLedgerReader, q as createWalletLedgerReader } from './application-ledger-reader-D3MFRC4B.js';
|
|
3
3
|
import '@partylayer/core';
|
|
4
4
|
import '@partylayer/registry-client';
|
|
5
5
|
|
package/dist/native.js
CHANGED
|
@@ -1205,6 +1205,12 @@ function matchKnownByIdentity(providerId, base) {
|
|
|
1205
1205
|
return providerId === String(w.walletId) || !!k && (providerId === k || providerId.startsWith(`${k}.`));
|
|
1206
1206
|
});
|
|
1207
1207
|
}
|
|
1208
|
+
function matchDiscoveredWallet(id, wallets) {
|
|
1209
|
+
return core.findMatchingWalletInfo(
|
|
1210
|
+
{ provider: { id } },
|
|
1211
|
+
wallets
|
|
1212
|
+
) ?? matchKnownByIdentity(id, wallets);
|
|
1213
|
+
}
|
|
1208
1214
|
var DEFAULT_CONNECT_TIMEOUT_MS = 12e4;
|
|
1209
1215
|
var PartyLayerClientBase = class {
|
|
1210
1216
|
constructor(config, runtime = {}) {
|
|
@@ -1441,7 +1447,8 @@ var PartyLayerClientBase = class {
|
|
|
1441
1447
|
}
|
|
1442
1448
|
await Promise.all(registry.wallets.map(async (entry) => {
|
|
1443
1449
|
const id = core.toWalletId(entry.id);
|
|
1444
|
-
|
|
1450
|
+
const network = this.config.network;
|
|
1451
|
+
if (this.adapters.has(id) || !entry.supportedNetworks.includes(network) && !entry.additionalNetworks?.includes(network) || entry.adapter?.transport === "discovery-adapter" && !entry.adapter.networkHosts?.[network]) return;
|
|
1445
1452
|
let pending = this.defaultLoads.get(entry.id);
|
|
1446
1453
|
if (!pending) {
|
|
1447
1454
|
pending = (async () => {
|
|
@@ -1454,8 +1461,9 @@ var PartyLayerClientBase = class {
|
|
|
1454
1461
|
networkHosts: entry.adapter?.networkHosts,
|
|
1455
1462
|
capabilities: entry.capabilities
|
|
1456
1463
|
}) : entryAdapter;
|
|
1464
|
+
if (!this.registryNetworkSupported(entry, adapter)) return;
|
|
1457
1465
|
if (typeof window !== "undefined" && adapter instanceof GenericDiscoveryAdapter) {
|
|
1458
|
-
adapter.resolveOfficial(
|
|
1466
|
+
adapter.resolveOfficial(network);
|
|
1459
1467
|
}
|
|
1460
1468
|
this.registerAdapter(adapter);
|
|
1461
1469
|
this.registryDefaultIds.add(id);
|
|
@@ -1472,6 +1480,10 @@ var PartyLayerClientBase = class {
|
|
|
1472
1480
|
await pending;
|
|
1473
1481
|
}));
|
|
1474
1482
|
}
|
|
1483
|
+
registryNetworkSupported(entry, adapter) {
|
|
1484
|
+
const network = this.config.network;
|
|
1485
|
+
return entry.supportedNetworks.includes(network) || entry.additionalNetworks?.includes(network) === true && adapter?.supportsNetwork?.(network) === true;
|
|
1486
|
+
}
|
|
1475
1487
|
/**
|
|
1476
1488
|
* Hide registry entries whose wallet needs an app-registered adapter that is
|
|
1477
1489
|
* NOT registered. This is the library default (RainbowKit-style): never show a
|
|
@@ -1493,19 +1505,23 @@ var PartyLayerClientBase = class {
|
|
|
1493
1505
|
* adapters-only) or every non-announce entry is registered.
|
|
1494
1506
|
*/
|
|
1495
1507
|
async gateUnconnectableEntries(wallets) {
|
|
1496
|
-
if (!this.runtime.browserDiscovery)
|
|
1508
|
+
if (!this.runtime.browserDiscovery) wallets = wallets.filter((wallet) => this.adapters.has(wallet.walletId));
|
|
1497
1509
|
let hidden = null;
|
|
1498
1510
|
const announceCapabilities = /* @__PURE__ */ new Map();
|
|
1511
|
+
const additionalNetworks = /* @__PURE__ */ new Map();
|
|
1499
1512
|
try {
|
|
1500
1513
|
const registry = await this.registryClient.getRegistry();
|
|
1501
1514
|
for (const entry of registry.wallets) {
|
|
1515
|
+
const adapter = this.adapters.get(core.toWalletId(entry.id));
|
|
1516
|
+
if (entry.additionalNetworks && adapter) {
|
|
1517
|
+
additionalNetworks.set(entry.id, entry.additionalNetworks.filter((network) => adapter.supportsNetwork?.(network) === true));
|
|
1518
|
+
}
|
|
1502
1519
|
if (entry.adapter?.transport === "announce" && this.runtime.browserDiscovery) {
|
|
1503
1520
|
announceCapabilities.set(entry.id, getAnnounceCapabilities(deriveAnnounceConfig(entry)));
|
|
1504
1521
|
continue;
|
|
1505
1522
|
}
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
(hidden ??= /* @__PURE__ */ new Set()).add(String(walletId));
|
|
1523
|
+
if (!adapter) {
|
|
1524
|
+
(hidden ??= /* @__PURE__ */ new Set()).add(entry.id);
|
|
1509
1525
|
}
|
|
1510
1526
|
}
|
|
1511
1527
|
} catch {
|
|
@@ -1513,7 +1529,13 @@ var PartyLayerClientBase = class {
|
|
|
1513
1529
|
}
|
|
1514
1530
|
return wallets.filter((w) => !hidden?.has(String(w.walletId))).map((w) => {
|
|
1515
1531
|
const capabilities = announceCapabilities.get(String(w.walletId));
|
|
1516
|
-
|
|
1532
|
+
const networks = additionalNetworks.get(String(w.walletId));
|
|
1533
|
+
if (!capabilities && !networks?.length) return w;
|
|
1534
|
+
return {
|
|
1535
|
+
...w,
|
|
1536
|
+
capabilities: capabilities ?? w.capabilities,
|
|
1537
|
+
networks: networks?.length ? [.../* @__PURE__ */ new Set([...w.networks, ...networks])] : w.networks
|
|
1538
|
+
};
|
|
1517
1539
|
});
|
|
1518
1540
|
}
|
|
1519
1541
|
/**
|
|
@@ -1608,17 +1630,26 @@ var PartyLayerClientBase = class {
|
|
|
1608
1630
|
createProvider: (a) => this.announceChannel(a.target ?? a.id)
|
|
1609
1631
|
});
|
|
1610
1632
|
const byId = /* @__PURE__ */ new Map();
|
|
1611
|
-
|
|
1612
|
-
for (const d of
|
|
1613
|
-
|
|
1633
|
+
const matchedAnnouncements = /* @__PURE__ */ new Set();
|
|
1634
|
+
for (const d of snapshot) {
|
|
1635
|
+
const announced = this.announceRegistry.get(d.id);
|
|
1636
|
+
if (d.announcementId) matchedAnnouncements.add(d.announcementId);
|
|
1637
|
+
byId.set(d.id, {
|
|
1638
|
+
...d,
|
|
1639
|
+
name: d.name ?? announced?.name,
|
|
1640
|
+
icon: d.icon ?? announced?.icon
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
for (const announced of this.announceRegistry.values()) {
|
|
1644
|
+
if (!byId.has(announced.id) && !matchedAnnouncements.has(announced.id)) {
|
|
1645
|
+
byId.set(announced.id, announced);
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1614
1648
|
const discovered = [...byId.values()];
|
|
1615
1649
|
const entries = [];
|
|
1616
1650
|
for (const d of discovered) {
|
|
1617
1651
|
if (d.identityResolved === false) continue;
|
|
1618
|
-
const known =
|
|
1619
|
-
{ provider: { id: d.id } },
|
|
1620
|
-
base
|
|
1621
|
-
) ?? matchKnownByIdentity(d.id, base);
|
|
1652
|
+
const known = matchDiscoveredWallet(d.id, base) ?? (d.announcementId ? matchDiscoveredWallet(d.announcementId, base) : void 0);
|
|
1622
1653
|
if (known) {
|
|
1623
1654
|
if (this.adapters.has(known.walletId)) continue;
|
|
1624
1655
|
try {
|
|
@@ -1682,7 +1713,7 @@ var PartyLayerClientBase = class {
|
|
|
1682
1713
|
adapter: { packageName: "announced", versionRange: "*" },
|
|
1683
1714
|
docs: [],
|
|
1684
1715
|
networks: [this.config.network || "devnet"],
|
|
1685
|
-
channel: "stable"
|
|
1716
|
+
channel: this.config.channel ?? "stable"
|
|
1686
1717
|
});
|
|
1687
1718
|
}
|
|
1688
1719
|
this.announceEntriesCache = entries;
|
|
@@ -1778,7 +1809,7 @@ var PartyLayerClientBase = class {
|
|
|
1778
1809
|
const nativeAdapter = this.adapters.get(options.walletId);
|
|
1779
1810
|
if (nativeAdapter) {
|
|
1780
1811
|
const entry = await this.registryClient.getWalletEntry(String(options.walletId)).catch(() => null);
|
|
1781
|
-
if (entry?.supportedNetworks?.length && !
|
|
1812
|
+
if (entry?.supportedNetworks?.length && !this.registryNetworkSupported(entry, nativeAdapter)) {
|
|
1782
1813
|
throw new core.WalletNotFoundError(`${String(options.walletId)} is unavailable on ${this.config.network}`);
|
|
1783
1814
|
}
|
|
1784
1815
|
isNativeWallet = true;
|
|
@@ -1809,7 +1840,14 @@ var PartyLayerClientBase = class {
|
|
|
1809
1840
|
}
|
|
1810
1841
|
const adapter = this.adapters.get(selectedWallet.walletId);
|
|
1811
1842
|
if (!adapter) {
|
|
1812
|
-
|
|
1843
|
+
const walletId = String(selectedWallet.walletId);
|
|
1844
|
+
if (this.announceEnabled) {
|
|
1845
|
+
const entry = await this.registryClient.getWalletEntry(walletId).catch(() => null);
|
|
1846
|
+
if (entry?.adapter?.transport === "announce") {
|
|
1847
|
+
throw new core.WalletNotInstalledError(walletId);
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
throw new core.WalletNotFoundError(walletId);
|
|
1813
1851
|
}
|
|
1814
1852
|
if (!isNativeWallet) {
|
|
1815
1853
|
try {
|