@partylayer/sdk 0.12.1 → 0.13.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/dist/index.d.mts CHANGED
@@ -643,6 +643,14 @@ interface AnnounceAdapterConfig {
643
643
  ledgerApi?: boolean;
644
644
  /** Populate the richer `session.metadata` on connect when the provider returns it. */
645
645
  metadata?: boolean;
646
+ /**
647
+ * Declarative wallet-specific STATIC metadata (e.g. `{ signingMethod:
648
+ * 'webauthn-prf' }`) — the wagmi connector-property pattern (like rdns/iconUrl).
649
+ * Merged into `session.metadata` ONLY when `metadata` is enabled, and FILLS
650
+ * GAPS: runtime RPC values (from `status`/account) take precedence on a key
651
+ * collision (EIP-6963: the wallet's runtime announce is authoritative).
652
+ */
653
+ staticMetadata?: Record<string, string>;
646
654
  /**
647
655
  * Optional error-translation hook. Given first crack at a thrown error: return
648
656
  * an `Error` to surface it, or `undefined` to fall through to the SDK's
@@ -676,6 +684,7 @@ declare class GenericAnnounceAdapter implements WalletAdapter {
676
684
  readonly icon?: string;
677
685
  private readonly provider;
678
686
  private readonly metadataEnabled;
687
+ private readonly staticMetadata?;
679
688
  private readonly mapError?;
680
689
  restore?: WalletAdapter['restore'];
681
690
  on?: WalletAdapter['on'];
package/dist/index.d.ts CHANGED
@@ -643,6 +643,14 @@ interface AnnounceAdapterConfig {
643
643
  ledgerApi?: boolean;
644
644
  /** Populate the richer `session.metadata` on connect when the provider returns it. */
645
645
  metadata?: boolean;
646
+ /**
647
+ * Declarative wallet-specific STATIC metadata (e.g. `{ signingMethod:
648
+ * 'webauthn-prf' }`) — the wagmi connector-property pattern (like rdns/iconUrl).
649
+ * Merged into `session.metadata` ONLY when `metadata` is enabled, and FILLS
650
+ * GAPS: runtime RPC values (from `status`/account) take precedence on a key
651
+ * collision (EIP-6963: the wallet's runtime announce is authoritative).
652
+ */
653
+ staticMetadata?: Record<string, string>;
646
654
  /**
647
655
  * Optional error-translation hook. Given first crack at a thrown error: return
648
656
  * an `Error` to surface it, or `undefined` to fall through to the SDK's
@@ -676,6 +684,7 @@ declare class GenericAnnounceAdapter implements WalletAdapter {
676
684
  readonly icon?: string;
677
685
  private readonly provider;
678
686
  private readonly metadataEnabled;
687
+ private readonly staticMetadata?;
679
688
  private readonly mapError?;
680
689
  restore?: WalletAdapter['restore'];
681
690
  on?: WalletAdapter['on'];
package/dist/index.js CHANGED
@@ -35,6 +35,7 @@ var GenericAnnounceAdapter = class {
35
35
  icon;
36
36
  provider;
37
37
  metadataEnabled;
38
+ staticMetadata;
38
39
  mapError;
39
40
  // Optional WalletAdapter surface — assigned in the ctor ONLY when configured,
40
41
  // so `getCapabilities()` and `'x' in adapter` feature-detection stay honest.
@@ -48,6 +49,7 @@ var GenericAnnounceAdapter = class {
48
49
  this.provider = args.provider;
49
50
  const config = args.config;
50
51
  this.metadataEnabled = config?.metadata === true;
52
+ this.staticMetadata = config?.staticMetadata;
51
53
  this.mapError = config?.mapError;
52
54
  if (config?.events) this.on = this.makeOn();
53
55
  if (config?.restore) this.restore = this.makeRestore();
@@ -90,7 +92,7 @@ var GenericAnnounceAdapter = class {
90
92
  network: reportedNetwork ?? account.networkId ?? ctx.network
91
93
  };
92
94
  if (this.metadataEnabled) {
93
- session.metadata = buildMetadata(status, account);
95
+ session.metadata = { ...this.staticMetadata ?? {}, ...buildMetadata(status, account) };
94
96
  }
95
97
  return { partyId, session, capabilities: this.getCapabilities() };
96
98
  });
@@ -155,7 +157,12 @@ var GenericAnnounceAdapter = class {
155
157
  return {
156
158
  ...persisted,
157
159
  walletId: this.walletId,
158
- metadata: { ...persisted.metadata ?? {}, ...buildMetadata(status, account) }
160
+ // persisted (lowest) → static config → runtime RPC (wins).
161
+ metadata: {
162
+ ...persisted.metadata ?? {},
163
+ ...this.staticMetadata ?? {},
164
+ ...buildMetadata(status, account)
165
+ }
159
166
  };
160
167
  });
161
168
  }
@@ -709,12 +716,21 @@ var SESSION_STORAGE_KEY = "active_session";
709
716
  var WALLETS_CHANGED_DEBOUNCE_MS = 50;
710
717
  function deriveAnnounceConfig(entry) {
711
718
  const cfg = entry.adapter?.config ?? {};
712
- return {
719
+ const config = {
713
720
  events: entry.capabilities?.events === true,
714
721
  restore: cfg.restore === true,
715
722
  ledgerApi: cfg.ledgerApi === true,
716
723
  metadata: cfg.metadata === true
717
724
  };
725
+ const sm = cfg.staticMetadata;
726
+ if (sm && typeof sm === "object") {
727
+ const out = {};
728
+ for (const [k, v] of Object.entries(sm)) {
729
+ if (typeof v === "string") out[k] = v;
730
+ }
731
+ if (Object.keys(out).length > 0) config.staticMetadata = out;
732
+ }
733
+ return config;
718
734
  }
719
735
  var PartyLayerClient = class {
720
736
  config;