@unicitylabs/sphere-sdk 0.14.11 → 0.15.0-dev.1
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 +55 -17
- package/dist/connect/index.cjs +10 -17
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +10 -17
- package/dist/connect/index.js.map +1 -1
- package/dist/core/index.cjs +69 -84
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +5 -14
- package/dist/core/index.d.ts +5 -14
- package/dist/core/index.js +69 -84
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/connect/index.cjs +3 -3
- package/dist/impl/browser/connect/index.cjs.map +1 -1
- package/dist/impl/browser/connect/index.js +3 -3
- package/dist/impl/browser/connect/index.js.map +1 -1
- package/dist/impl/browser/index.cjs.map +1 -1
- package/dist/impl/browser/index.js.map +1 -1
- package/dist/impl/nodejs/connect/index.cjs +2 -2
- package/dist/impl/nodejs/connect/index.cjs.map +1 -1
- package/dist/impl/nodejs/connect/index.js +2 -2
- package/dist/impl/nodejs/connect/index.js.map +1 -1
- package/dist/impl/nodejs/index.cjs.map +1 -1
- package/dist/impl/nodejs/index.js.map +1 -1
- package/dist/impl/wallet-api-v2/index.cjs +92 -92
- package/dist/impl/wallet-api-v2/index.cjs.map +1 -1
- package/dist/impl/wallet-api-v2/index.js +92 -92
- package/dist/impl/wallet-api-v2/index.js.map +1 -1
- package/dist/index.cjs +69 -84
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -11
- package/dist/index.d.ts +6 -11
- package/dist/index.js +69 -84
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +116 -174
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.d.cts +3 -5
- package/dist/modules/payments-v2/index.d.ts +3 -5
- package/dist/modules/payments-v2/index.js +114 -173
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/dist/token-engine/index.cjs +43 -57
- package/dist/token-engine/index.cjs.map +1 -1
- package/dist/token-engine/index.d.cts +0 -4
- package/dist/token-engine/index.d.ts +0 -4
- package/dist/token-engine/index.js +43 -57
- package/dist/token-engine/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -737,6 +737,98 @@ var WalletApiV2Client = class {
|
|
|
737
737
|
}
|
|
738
738
|
};
|
|
739
739
|
|
|
740
|
+
// core/logger.ts
|
|
741
|
+
var LOGGER_KEY = "__sphere_sdk_logger__";
|
|
742
|
+
function getState() {
|
|
743
|
+
const g = globalThis;
|
|
744
|
+
if (!g[LOGGER_KEY]) {
|
|
745
|
+
g[LOGGER_KEY] = { debug: false, tags: {}, handler: null };
|
|
746
|
+
}
|
|
747
|
+
return g[LOGGER_KEY];
|
|
748
|
+
}
|
|
749
|
+
function isEnabled(tag) {
|
|
750
|
+
const state = getState();
|
|
751
|
+
if (tag in state.tags) return state.tags[tag];
|
|
752
|
+
return state.debug;
|
|
753
|
+
}
|
|
754
|
+
var logger = {
|
|
755
|
+
/**
|
|
756
|
+
* Configure the logger. Can be called multiple times (last write wins).
|
|
757
|
+
* Typically called by createBrowserProviders(), createNodeProviders(), or Sphere.init().
|
|
758
|
+
*/
|
|
759
|
+
configure(config) {
|
|
760
|
+
const state = getState();
|
|
761
|
+
if (config.debug !== void 0) state.debug = config.debug;
|
|
762
|
+
if (config.handler !== void 0) state.handler = config.handler;
|
|
763
|
+
},
|
|
764
|
+
/**
|
|
765
|
+
* Enable/disable debug logging for a specific tag.
|
|
766
|
+
* Per-tag setting overrides the global debug flag.
|
|
767
|
+
*
|
|
768
|
+
* @example
|
|
769
|
+
* ```ts
|
|
770
|
+
* logger.setTagDebug('Nostr', true); // enable only Nostr logs
|
|
771
|
+
* logger.setTagDebug('Nostr', false); // disable Nostr logs even if global debug=true
|
|
772
|
+
* ```
|
|
773
|
+
*/
|
|
774
|
+
setTagDebug(tag, enabled) {
|
|
775
|
+
getState().tags[tag] = enabled;
|
|
776
|
+
},
|
|
777
|
+
/**
|
|
778
|
+
* Clear per-tag override, falling back to global debug flag.
|
|
779
|
+
*/
|
|
780
|
+
clearTagDebug(tag) {
|
|
781
|
+
delete getState().tags[tag];
|
|
782
|
+
},
|
|
783
|
+
/** Returns true if debug mode is enabled for the given tag (or globally). */
|
|
784
|
+
isDebugEnabled(tag) {
|
|
785
|
+
if (tag) return isEnabled(tag);
|
|
786
|
+
return getState().debug;
|
|
787
|
+
},
|
|
788
|
+
/**
|
|
789
|
+
* Debug-level log. Only shown when debug is enabled (globally or for this tag).
|
|
790
|
+
* Use for detailed operational information.
|
|
791
|
+
*/
|
|
792
|
+
debug(tag, message, ...args) {
|
|
793
|
+
if (!isEnabled(tag)) return;
|
|
794
|
+
const state = getState();
|
|
795
|
+
if (state.handler) {
|
|
796
|
+
state.handler("debug", tag, message, ...args);
|
|
797
|
+
} else {
|
|
798
|
+
console.log(`[${tag}]`, message, ...args);
|
|
799
|
+
}
|
|
800
|
+
},
|
|
801
|
+
/**
|
|
802
|
+
* Warning-level log. ALWAYS shown regardless of debug flag.
|
|
803
|
+
* Use for important but non-critical issues (timeouts, retries, degraded state).
|
|
804
|
+
*/
|
|
805
|
+
warn(tag, message, ...args) {
|
|
806
|
+
const state = getState();
|
|
807
|
+
if (state.handler) {
|
|
808
|
+
state.handler("warn", tag, message, ...args);
|
|
809
|
+
} else {
|
|
810
|
+
console.warn(`[${tag}]`, message, ...args);
|
|
811
|
+
}
|
|
812
|
+
},
|
|
813
|
+
/**
|
|
814
|
+
* Error-level log. ALWAYS shown regardless of debug flag.
|
|
815
|
+
* Use for critical failures that should never be silenced.
|
|
816
|
+
*/
|
|
817
|
+
error(tag, message, ...args) {
|
|
818
|
+
const state = getState();
|
|
819
|
+
if (state.handler) {
|
|
820
|
+
state.handler("error", tag, message, ...args);
|
|
821
|
+
} else {
|
|
822
|
+
console.error(`[${tag}]`, message, ...args);
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
/** Reset all logger state (debug flag, tags, handler). Primarily for tests. */
|
|
826
|
+
reset() {
|
|
827
|
+
const g = globalThis;
|
|
828
|
+
delete g[LOGGER_KEY];
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
|
|
740
832
|
// modules/payments-v2/stores.ts
|
|
741
833
|
var STORE_KEYS = {
|
|
742
834
|
intentBackstop: "intents",
|
|
@@ -3137,98 +3229,6 @@ var SerialChain = class {
|
|
|
3137
3229
|
}
|
|
3138
3230
|
};
|
|
3139
3231
|
|
|
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
|
-
|
|
3232
3232
|
// node_modules/@noble/hashes/hkdf.js
|
|
3233
3233
|
function extract(hash, ikm, salt) {
|
|
3234
3234
|
ahash(hash);
|