@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 CHANGED
@@ -74,7 +74,7 @@ const client = createPartyLayer({
74
74
  | `adapters` | Replaces the included catalog |
75
75
  | `registryUrl` | Defaults to `https://registry.partylayer.xyz` |
76
76
 
77
- Hosted wallets require the user's own login and approval. Send is Mainnet-only in the catalog. See [configuration and wallet limits](https://partylayer.xyz/docs/wallets).
77
+ Hosted wallets require the user's own login and approval. Match the network selected in Send Connect to the dApp. See [configuration and wallet limits](https://partylayer.xyz/docs/wallets).
78
78
 
79
79
  ## Supported wallets
80
80
 
@@ -84,13 +84,13 @@ Generated from the stable registry and active SDK integrations. This is capabili
84
84
  | Wallet | Networks | Capabilities | Opt-in | Additional setup |
85
85
  |--------|----------|--------------|--------|---------|
86
86
  | Console Wallet | devnet, testnet, mainnet | signMessage, submitTransaction, restore | No | Included |
87
- | 5N Loop | devnet, mainnet | signMessage, submitTransaction, ledgerApi, restore, events | No | Included |
88
- | Cantor8 | devnet, mainnet | submitTransaction, events | No | Included |
87
+ | 5N Loop | devnet, mainnet, testnet | signMessage, submitTransaction, ledgerApi, restore, events | No | Included |
88
+ | Cantor8 | devnet, mainnet | signMessage, submitTransaction, events | No | Included |
89
89
  | Bron | devnet, testnet, mainnet | signMessage, signTransaction, ledgerApi, restore | Yes | Your OAuth/API configuration |
90
90
  | Nightly | devnet, testnet, mainnet | signMessage, submitTransaction, ledgerApi, restore, events | No | Included |
91
91
  | Cauri Wallet | devnet, mainnet | signMessage, submitTransaction | No | Included |
92
92
  | OneSwap V2 Wallet | devnet, mainnet | signMessage, submitTransaction | No | Included |
93
- | Send | mainnet | signMessage, submitTransaction, ledgerApi, restore, events | No | Included |
93
+ | Send | mainnet, testnet, devnet | signMessage, submitTransaction, ledgerApi, restore, events | No | Included |
94
94
  | Walley | mainnet, testnet, devnet | signMessage, submitTransaction | No | Included |
95
95
  | WalletConnect | devnet, testnet, mainnet | signMessage, submitTransaction, ledgerApi, restore, events | Yes | Your project ID |
96
96
  <!-- WALLETS:END -->
@@ -453,6 +453,7 @@ declare class PartyLayerClientBase {
453
453
  listWallets(filter?: WalletFilter): Promise<WalletInfo[]>;
454
454
  /** Resolve only reviewed default SDKs present in the active registry. */
455
455
  private ensureDefaultWallets;
456
+ private registryNetworkSupported;
456
457
  /**
457
458
  * Hide registry entries whose wallet needs an app-registered adapter that is
458
459
  * NOT registered. This is the library default (RainbowKit-style): never show a
@@ -453,6 +453,7 @@ declare class PartyLayerClientBase {
453
453
  listWallets(filter?: WalletFilter): Promise<WalletInfo[]>;
454
454
  /** Resolve only reviewed default SDKs present in the active registry. */
455
455
  private ensureDefaultWallets;
456
+ private registryNetworkSupported;
456
457
  /**
457
458
  * Hide registry entries whose wallet needs an app-registered adapter that is
458
459
  * NOT registered. This is the library default (RainbowKit-style): never show a
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PartyLayerBaseConfig, a as PartyLayerClientBase, T as TelemetryConfig } from './application-ledger-reader-DYaIuRCD.mjs';
2
- export { A as AdapterClass, b as ApplicationLedgerReaderOptions, c as CantonConnectEvent, C as ConnectOptions, D as DEFAULT_REGISTRY_URL, E as ErrorEvent, d as EventHandler, c as PartyLayerEvent, R as RegistryUpdatedEvent, S as SessionConnectedEvent, e as SessionDisconnectedEvent, f as SessionExpiredEvent, g as TxStatusEvent, W as WalletFilter, h as WalletHoldingsSnapshot, i as WalletHoldingsV2Snapshot, j as WalletLedgerClient, k as WalletLedgerReader, l as WalletLedgerReaderOptions, m as WalletTransactionConfirmation, n as WalletTransactionReference, o as WalletsChangedEvent, p as createApplicationLedgerReader, q as createWalletLedgerReader } from './application-ledger-reader-DYaIuRCD.mjs';
1
+ import { P as PartyLayerBaseConfig, a as PartyLayerClientBase, T as TelemetryConfig } from './application-ledger-reader-D3MFRC4B.mjs';
2
+ export { A as AdapterClass, b as ApplicationLedgerReaderOptions, c as CantonConnectEvent, C as ConnectOptions, D as DEFAULT_REGISTRY_URL, E as ErrorEvent, d as EventHandler, c as PartyLayerEvent, R as RegistryUpdatedEvent, S as SessionConnectedEvent, e as SessionDisconnectedEvent, f as SessionExpiredEvent, g as TxStatusEvent, W as WalletFilter, h as WalletHoldingsSnapshot, i as WalletHoldingsV2Snapshot, j as WalletLedgerClient, k as WalletLedgerReader, l as WalletLedgerReaderOptions, m as WalletTransactionConfirmation, n as WalletTransactionReference, o as WalletsChangedEvent, p as createApplicationLedgerReader, q as createWalletLedgerReader } from './application-ledger-reader-D3MFRC4B.mjs';
3
3
  import { BronAdapterConfig } from '@partylayer/adapter-bron';
4
4
  export { BronAdapter, BronAdapterConfig, BronApiConfig, BronAuthConfig } from '@partylayer/adapter-bron';
5
5
  import { WalletConnectAdapterConfig } from '@partylayer/adapter-walletconnect';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PartyLayerBaseConfig, a as PartyLayerClientBase, T as TelemetryConfig } from './application-ledger-reader-DYaIuRCD.js';
2
- export { A as AdapterClass, b as ApplicationLedgerReaderOptions, c as CantonConnectEvent, C as ConnectOptions, D as DEFAULT_REGISTRY_URL, E as ErrorEvent, d as EventHandler, c as PartyLayerEvent, R as RegistryUpdatedEvent, S as SessionConnectedEvent, e as SessionDisconnectedEvent, f as SessionExpiredEvent, g as TxStatusEvent, W as WalletFilter, h as WalletHoldingsSnapshot, i as WalletHoldingsV2Snapshot, j as WalletLedgerClient, k as WalletLedgerReader, l as WalletLedgerReaderOptions, m as WalletTransactionConfirmation, n as WalletTransactionReference, o as WalletsChangedEvent, p as createApplicationLedgerReader, q as createWalletLedgerReader } from './application-ledger-reader-DYaIuRCD.js';
1
+ import { P as PartyLayerBaseConfig, a as PartyLayerClientBase, T as TelemetryConfig } from './application-ledger-reader-D3MFRC4B.js';
2
+ export { A as AdapterClass, b as ApplicationLedgerReaderOptions, c as CantonConnectEvent, C as ConnectOptions, D as DEFAULT_REGISTRY_URL, E as ErrorEvent, d as EventHandler, c as PartyLayerEvent, R as RegistryUpdatedEvent, S as SessionConnectedEvent, e as SessionDisconnectedEvent, f as SessionExpiredEvent, g as TxStatusEvent, W as WalletFilter, h as WalletHoldingsSnapshot, i as WalletHoldingsV2Snapshot, j as WalletLedgerClient, k as WalletLedgerReader, l as WalletLedgerReaderOptions, m as WalletTransactionConfirmation, n as WalletTransactionReference, o as WalletsChangedEvent, p as createApplicationLedgerReader, q as createWalletLedgerReader } from './application-ledger-reader-D3MFRC4B.js';
3
3
  import { BronAdapterConfig } from '@partylayer/adapter-bron';
4
4
  export { BronAdapter, BronAdapterConfig, BronApiConfig, BronAuthConfig } from '@partylayer/adapter-bron';
5
5
  import { WalletConnectAdapterConfig } from '@partylayer/adapter-walletconnect';
package/dist/index.js CHANGED
@@ -1211,6 +1211,12 @@ function matchKnownByIdentity(providerId, base) {
1211
1211
  return providerId === String(w.walletId) || !!k && (providerId === k || providerId.startsWith(`${k}.`));
1212
1212
  });
1213
1213
  }
1214
+ function matchDiscoveredWallet(id, wallets) {
1215
+ return core.findMatchingWalletInfo(
1216
+ { provider: { id } },
1217
+ wallets
1218
+ ) ?? matchKnownByIdentity(id, wallets);
1219
+ }
1214
1220
  var DEFAULT_CONNECT_TIMEOUT_MS = 12e4;
1215
1221
  var PartyLayerClientBase = class {
1216
1222
  constructor(config, runtime = {}) {
@@ -1447,7 +1453,8 @@ var PartyLayerClientBase = class {
1447
1453
  }
1448
1454
  await Promise.all(registry.wallets.map(async (entry) => {
1449
1455
  const id = core.toWalletId(entry.id);
1450
- if (this.adapters.has(id) || !entry.supportedNetworks.includes(this.config.network) || entry.adapter?.transport === "discovery-adapter" && !entry.adapter.networkHosts?.[this.config.network]) return;
1456
+ const network = this.config.network;
1457
+ if (this.adapters.has(id) || !entry.supportedNetworks.includes(network) && !entry.additionalNetworks?.includes(network) || entry.adapter?.transport === "discovery-adapter" && !entry.adapter.networkHosts?.[network]) return;
1451
1458
  let pending = this.defaultLoads.get(entry.id);
1452
1459
  if (!pending) {
1453
1460
  pending = (async () => {
@@ -1460,8 +1467,9 @@ var PartyLayerClientBase = class {
1460
1467
  networkHosts: entry.adapter?.networkHosts,
1461
1468
  capabilities: entry.capabilities
1462
1469
  }) : entryAdapter;
1470
+ if (!this.registryNetworkSupported(entry, adapter)) return;
1463
1471
  if (typeof window !== "undefined" && adapter instanceof GenericDiscoveryAdapter) {
1464
- adapter.resolveOfficial(this.config.network);
1472
+ adapter.resolveOfficial(network);
1465
1473
  }
1466
1474
  this.registerAdapter(adapter);
1467
1475
  this.registryDefaultIds.add(id);
@@ -1478,6 +1486,10 @@ var PartyLayerClientBase = class {
1478
1486
  await pending;
1479
1487
  }));
1480
1488
  }
1489
+ registryNetworkSupported(entry, adapter) {
1490
+ const network = this.config.network;
1491
+ return entry.supportedNetworks.includes(network) || entry.additionalNetworks?.includes(network) === true && adapter?.supportsNetwork?.(network) === true;
1492
+ }
1481
1493
  /**
1482
1494
  * Hide registry entries whose wallet needs an app-registered adapter that is
1483
1495
  * NOT registered. This is the library default (RainbowKit-style): never show a
@@ -1499,19 +1511,23 @@ var PartyLayerClientBase = class {
1499
1511
  * adapters-only) or every non-announce entry is registered.
1500
1512
  */
1501
1513
  async gateUnconnectableEntries(wallets) {
1502
- if (!this.runtime.browserDiscovery) return wallets.filter((wallet) => this.adapters.has(wallet.walletId));
1514
+ if (!this.runtime.browserDiscovery) wallets = wallets.filter((wallet) => this.adapters.has(wallet.walletId));
1503
1515
  let hidden = null;
1504
1516
  const announceCapabilities = /* @__PURE__ */ new Map();
1517
+ const additionalNetworks = /* @__PURE__ */ new Map();
1505
1518
  try {
1506
1519
  const registry = await this.registryClient.getRegistry();
1507
1520
  for (const entry of registry.wallets) {
1521
+ const adapter = this.adapters.get(core.toWalletId(entry.id));
1522
+ if (entry.additionalNetworks && adapter) {
1523
+ additionalNetworks.set(entry.id, entry.additionalNetworks.filter((network) => adapter.supportsNetwork?.(network) === true));
1524
+ }
1508
1525
  if (entry.adapter?.transport === "announce" && this.runtime.browserDiscovery) {
1509
1526
  announceCapabilities.set(entry.id, getAnnounceCapabilities(deriveAnnounceConfig(entry)));
1510
1527
  continue;
1511
1528
  }
1512
- const walletId = core.toWalletId(entry.id);
1513
- if (!this.adapters.has(walletId)) {
1514
- (hidden ??= /* @__PURE__ */ new Set()).add(String(walletId));
1529
+ if (!adapter) {
1530
+ (hidden ??= /* @__PURE__ */ new Set()).add(entry.id);
1515
1531
  }
1516
1532
  }
1517
1533
  } catch {
@@ -1519,7 +1535,13 @@ var PartyLayerClientBase = class {
1519
1535
  }
1520
1536
  return wallets.filter((w) => !hidden?.has(String(w.walletId))).map((w) => {
1521
1537
  const capabilities = announceCapabilities.get(String(w.walletId));
1522
- return capabilities ? { ...w, capabilities } : w;
1538
+ const networks = additionalNetworks.get(String(w.walletId));
1539
+ if (!capabilities && !networks?.length) return w;
1540
+ return {
1541
+ ...w,
1542
+ capabilities: capabilities ?? w.capabilities,
1543
+ networks: networks?.length ? [.../* @__PURE__ */ new Set([...w.networks, ...networks])] : w.networks
1544
+ };
1523
1545
  });
1524
1546
  }
1525
1547
  /**
@@ -1614,17 +1636,26 @@ var PartyLayerClientBase = class {
1614
1636
  createProvider: (a) => this.announceChannel(a.target ?? a.id)
1615
1637
  });
1616
1638
  const byId = /* @__PURE__ */ new Map();
1617
- for (const d of snapshot) byId.set(d.id, d);
1618
- for (const d of this.announceRegistry.values())
1619
- if (!byId.has(d.id)) byId.set(d.id, d);
1639
+ const matchedAnnouncements = /* @__PURE__ */ new Set();
1640
+ for (const d of snapshot) {
1641
+ const announced = this.announceRegistry.get(d.id);
1642
+ if (d.announcementId) matchedAnnouncements.add(d.announcementId);
1643
+ byId.set(d.id, {
1644
+ ...d,
1645
+ name: d.name ?? announced?.name,
1646
+ icon: d.icon ?? announced?.icon
1647
+ });
1648
+ }
1649
+ for (const announced of this.announceRegistry.values()) {
1650
+ if (!byId.has(announced.id) && !matchedAnnouncements.has(announced.id)) {
1651
+ byId.set(announced.id, announced);
1652
+ }
1653
+ }
1620
1654
  const discovered = [...byId.values()];
1621
1655
  const entries = [];
1622
1656
  for (const d of discovered) {
1623
1657
  if (d.identityResolved === false) continue;
1624
- const known = core.findMatchingWalletInfo(
1625
- { provider: { id: d.id } },
1626
- base
1627
- ) ?? matchKnownByIdentity(d.id, base);
1658
+ const known = matchDiscoveredWallet(d.id, base) ?? (d.announcementId ? matchDiscoveredWallet(d.announcementId, base) : void 0);
1628
1659
  if (known) {
1629
1660
  if (this.adapters.has(known.walletId)) continue;
1630
1661
  try {
@@ -1688,7 +1719,7 @@ var PartyLayerClientBase = class {
1688
1719
  adapter: { packageName: "announced", versionRange: "*" },
1689
1720
  docs: [],
1690
1721
  networks: [this.config.network || "devnet"],
1691
- channel: "stable"
1722
+ channel: this.config.channel ?? "stable"
1692
1723
  });
1693
1724
  }
1694
1725
  this.announceEntriesCache = entries;
@@ -1784,7 +1815,7 @@ var PartyLayerClientBase = class {
1784
1815
  const nativeAdapter = this.adapters.get(options.walletId);
1785
1816
  if (nativeAdapter) {
1786
1817
  const entry = await this.registryClient.getWalletEntry(String(options.walletId)).catch(() => null);
1787
- if (entry?.supportedNetworks?.length && !entry.supportedNetworks.includes(this.config.network)) {
1818
+ if (entry?.supportedNetworks?.length && !this.registryNetworkSupported(entry, nativeAdapter)) {
1788
1819
  throw new core.WalletNotFoundError(`${String(options.walletId)} is unavailable on ${this.config.network}`);
1789
1820
  }
1790
1821
  isNativeWallet = true;
@@ -1815,7 +1846,14 @@ var PartyLayerClientBase = class {
1815
1846
  }
1816
1847
  const adapter = this.adapters.get(selectedWallet.walletId);
1817
1848
  if (!adapter) {
1818
- throw new core.WalletNotFoundError(String(selectedWallet.walletId));
1849
+ const walletId = String(selectedWallet.walletId);
1850
+ if (this.announceEnabled) {
1851
+ const entry = await this.registryClient.getWalletEntry(walletId).catch(() => null);
1852
+ if (entry?.adapter?.transport === "announce") {
1853
+ throw new core.WalletNotInstalledError(walletId);
1854
+ }
1855
+ }
1856
+ throw new core.WalletNotFoundError(walletId);
1819
1857
  }
1820
1858
  if (!isNativeWallet) {
1821
1859
  try {