@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 +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +19 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -41,6 +41,7 @@ var GenericAnnounceAdapter = class {
|
|
|
41
41
|
icon;
|
|
42
42
|
provider;
|
|
43
43
|
metadataEnabled;
|
|
44
|
+
staticMetadata;
|
|
44
45
|
mapError;
|
|
45
46
|
// Optional WalletAdapter surface — assigned in the ctor ONLY when configured,
|
|
46
47
|
// so `getCapabilities()` and `'x' in adapter` feature-detection stay honest.
|
|
@@ -54,6 +55,7 @@ var GenericAnnounceAdapter = class {
|
|
|
54
55
|
this.provider = args.provider;
|
|
55
56
|
const config = args.config;
|
|
56
57
|
this.metadataEnabled = config?.metadata === true;
|
|
58
|
+
this.staticMetadata = config?.staticMetadata;
|
|
57
59
|
this.mapError = config?.mapError;
|
|
58
60
|
if (config?.events) this.on = this.makeOn();
|
|
59
61
|
if (config?.restore) this.restore = this.makeRestore();
|
|
@@ -96,7 +98,7 @@ var GenericAnnounceAdapter = class {
|
|
|
96
98
|
network: reportedNetwork ?? account.networkId ?? ctx.network
|
|
97
99
|
};
|
|
98
100
|
if (this.metadataEnabled) {
|
|
99
|
-
session.metadata = buildMetadata(status, account);
|
|
101
|
+
session.metadata = { ...this.staticMetadata ?? {}, ...buildMetadata(status, account) };
|
|
100
102
|
}
|
|
101
103
|
return { partyId, session, capabilities: this.getCapabilities() };
|
|
102
104
|
});
|
|
@@ -161,7 +163,12 @@ var GenericAnnounceAdapter = class {
|
|
|
161
163
|
return {
|
|
162
164
|
...persisted,
|
|
163
165
|
walletId: this.walletId,
|
|
164
|
-
|
|
166
|
+
// persisted (lowest) → static config → runtime RPC (wins).
|
|
167
|
+
metadata: {
|
|
168
|
+
...persisted.metadata ?? {},
|
|
169
|
+
...this.staticMetadata ?? {},
|
|
170
|
+
...buildMetadata(status, account)
|
|
171
|
+
}
|
|
165
172
|
};
|
|
166
173
|
});
|
|
167
174
|
}
|
|
@@ -715,12 +722,21 @@ var SESSION_STORAGE_KEY = "active_session";
|
|
|
715
722
|
var WALLETS_CHANGED_DEBOUNCE_MS = 50;
|
|
716
723
|
function deriveAnnounceConfig(entry) {
|
|
717
724
|
const cfg = entry.adapter?.config ?? {};
|
|
718
|
-
|
|
725
|
+
const config = {
|
|
719
726
|
events: entry.capabilities?.events === true,
|
|
720
727
|
restore: cfg.restore === true,
|
|
721
728
|
ledgerApi: cfg.ledgerApi === true,
|
|
722
729
|
metadata: cfg.metadata === true
|
|
723
730
|
};
|
|
731
|
+
const sm = cfg.staticMetadata;
|
|
732
|
+
if (sm && typeof sm === "object") {
|
|
733
|
+
const out = {};
|
|
734
|
+
for (const [k, v] of Object.entries(sm)) {
|
|
735
|
+
if (typeof v === "string") out[k] = v;
|
|
736
|
+
}
|
|
737
|
+
if (Object.keys(out).length > 0) config.staticMetadata = out;
|
|
738
|
+
}
|
|
739
|
+
return config;
|
|
724
740
|
}
|
|
725
741
|
var PartyLayerClient = class {
|
|
726
742
|
config;
|