@unicitylabs/sphere-sdk 0.14.11-dev.7 → 0.14.11
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/connect/index.cjs +1 -1
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +1 -1
- package/dist/connect/index.js.map +1 -1
- package/dist/core/index.cjs +47 -19
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +47 -19
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/connect/index.cjs +1 -1
- package/dist/impl/browser/connect/index.cjs.map +1 -1
- package/dist/impl/browser/connect/index.js +1 -1
- package/dist/impl/browser/connect/index.js.map +1 -1
- package/dist/impl/wallet-api-v2/index.cjs +95 -0
- package/dist/impl/wallet-api-v2/index.cjs.map +1 -1
- package/dist/impl/wallet-api-v2/index.js +95 -0
- package/dist/impl/wallet-api-v2/index.js.map +1 -1
- package/dist/index.cjs +47 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +47 -19
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +51 -24
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.d.cts +6 -1
- package/dist/modules/payments-v2/index.d.ts +6 -1
- package/dist/modules/payments-v2/index.js +50 -24
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -3137,6 +3137,98 @@ var SerialChain = class {
|
|
|
3137
3137
|
}
|
|
3138
3138
|
};
|
|
3139
3139
|
|
|
3140
|
+
// core/logger.ts
|
|
3141
|
+
var LOGGER_KEY = "__sphere_sdk_logger__";
|
|
3142
|
+
function getState() {
|
|
3143
|
+
const g = globalThis;
|
|
3144
|
+
if (!g[LOGGER_KEY]) {
|
|
3145
|
+
g[LOGGER_KEY] = { debug: false, tags: {}, handler: null };
|
|
3146
|
+
}
|
|
3147
|
+
return g[LOGGER_KEY];
|
|
3148
|
+
}
|
|
3149
|
+
function isEnabled(tag) {
|
|
3150
|
+
const state = getState();
|
|
3151
|
+
if (tag in state.tags) return state.tags[tag];
|
|
3152
|
+
return state.debug;
|
|
3153
|
+
}
|
|
3154
|
+
var logger = {
|
|
3155
|
+
/**
|
|
3156
|
+
* Configure the logger. Can be called multiple times (last write wins).
|
|
3157
|
+
* Typically called by createBrowserProviders(), createNodeProviders(), or Sphere.init().
|
|
3158
|
+
*/
|
|
3159
|
+
configure(config) {
|
|
3160
|
+
const state = getState();
|
|
3161
|
+
if (config.debug !== void 0) state.debug = config.debug;
|
|
3162
|
+
if (config.handler !== void 0) state.handler = config.handler;
|
|
3163
|
+
},
|
|
3164
|
+
/**
|
|
3165
|
+
* Enable/disable debug logging for a specific tag.
|
|
3166
|
+
* Per-tag setting overrides the global debug flag.
|
|
3167
|
+
*
|
|
3168
|
+
* @example
|
|
3169
|
+
* ```ts
|
|
3170
|
+
* logger.setTagDebug('Nostr', true); // enable only Nostr logs
|
|
3171
|
+
* logger.setTagDebug('Nostr', false); // disable Nostr logs even if global debug=true
|
|
3172
|
+
* ```
|
|
3173
|
+
*/
|
|
3174
|
+
setTagDebug(tag, enabled) {
|
|
3175
|
+
getState().tags[tag] = enabled;
|
|
3176
|
+
},
|
|
3177
|
+
/**
|
|
3178
|
+
* Clear per-tag override, falling back to global debug flag.
|
|
3179
|
+
*/
|
|
3180
|
+
clearTagDebug(tag) {
|
|
3181
|
+
delete getState().tags[tag];
|
|
3182
|
+
},
|
|
3183
|
+
/** Returns true if debug mode is enabled for the given tag (or globally). */
|
|
3184
|
+
isDebugEnabled(tag) {
|
|
3185
|
+
if (tag) return isEnabled(tag);
|
|
3186
|
+
return getState().debug;
|
|
3187
|
+
},
|
|
3188
|
+
/**
|
|
3189
|
+
* Debug-level log. Only shown when debug is enabled (globally or for this tag).
|
|
3190
|
+
* Use for detailed operational information.
|
|
3191
|
+
*/
|
|
3192
|
+
debug(tag, message, ...args) {
|
|
3193
|
+
if (!isEnabled(tag)) return;
|
|
3194
|
+
const state = getState();
|
|
3195
|
+
if (state.handler) {
|
|
3196
|
+
state.handler("debug", tag, message, ...args);
|
|
3197
|
+
} else {
|
|
3198
|
+
console.log(`[${tag}]`, message, ...args);
|
|
3199
|
+
}
|
|
3200
|
+
},
|
|
3201
|
+
/**
|
|
3202
|
+
* Warning-level log. ALWAYS shown regardless of debug flag.
|
|
3203
|
+
* Use for important but non-critical issues (timeouts, retries, degraded state).
|
|
3204
|
+
*/
|
|
3205
|
+
warn(tag, message, ...args) {
|
|
3206
|
+
const state = getState();
|
|
3207
|
+
if (state.handler) {
|
|
3208
|
+
state.handler("warn", tag, message, ...args);
|
|
3209
|
+
} else {
|
|
3210
|
+
console.warn(`[${tag}]`, message, ...args);
|
|
3211
|
+
}
|
|
3212
|
+
},
|
|
3213
|
+
/**
|
|
3214
|
+
* Error-level log. ALWAYS shown regardless of debug flag.
|
|
3215
|
+
* Use for critical failures that should never be silenced.
|
|
3216
|
+
*/
|
|
3217
|
+
error(tag, message, ...args) {
|
|
3218
|
+
const state = getState();
|
|
3219
|
+
if (state.handler) {
|
|
3220
|
+
state.handler("error", tag, message, ...args);
|
|
3221
|
+
} else {
|
|
3222
|
+
console.error(`[${tag}]`, message, ...args);
|
|
3223
|
+
}
|
|
3224
|
+
},
|
|
3225
|
+
/** Reset all logger state (debug flag, tags, handler). Primarily for tests. */
|
|
3226
|
+
reset() {
|
|
3227
|
+
const g = globalThis;
|
|
3228
|
+
delete g[LOGGER_KEY];
|
|
3229
|
+
}
|
|
3230
|
+
};
|
|
3231
|
+
|
|
3140
3232
|
// node_modules/@noble/hashes/hkdf.js
|
|
3141
3233
|
function extract(hash, ikm, salt) {
|
|
3142
3234
|
ahash(hash);
|
|
@@ -4298,6 +4390,9 @@ var WalletApiDeliveryPort = class {
|
|
|
4298
4390
|
await this.settleClaims(acks, settled, outcomes);
|
|
4299
4391
|
await this.settleRejects(acks, settled);
|
|
4300
4392
|
} catch (err) {
|
|
4393
|
+
await this.addSeenAll(settled).catch((seenErr) => {
|
|
4394
|
+
logger.warn("WalletApiDelivery", `seen-set write failed for ${String(settled.length)} committed acks:`, seenErr);
|
|
4395
|
+
});
|
|
4301
4396
|
throw asRetryable(err);
|
|
4302
4397
|
}
|
|
4303
4398
|
await this.addSeenAll(settled);
|