@unicitylabs/sphere-sdk 0.14.11 → 0.15.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/README.md +55 -17
- package/dist/connect/index.cjs +17 -17
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +17 -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 +10 -3
- package/dist/impl/browser/connect/index.cjs.map +1 -1
- package/dist/impl/browser/connect/index.js +10 -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 +9 -2
- package/dist/impl/nodejs/connect/index.cjs.map +1 -1
- package/dist/impl/nodejs/connect/index.js +9 -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 +3 -2
|
@@ -689,6 +689,98 @@ var WalletApiV2Client = class {
|
|
|
689
689
|
}
|
|
690
690
|
};
|
|
691
691
|
|
|
692
|
+
// core/logger.ts
|
|
693
|
+
var LOGGER_KEY = "__sphere_sdk_logger__";
|
|
694
|
+
function getState() {
|
|
695
|
+
const g = globalThis;
|
|
696
|
+
if (!g[LOGGER_KEY]) {
|
|
697
|
+
g[LOGGER_KEY] = { debug: false, tags: {}, handler: null };
|
|
698
|
+
}
|
|
699
|
+
return g[LOGGER_KEY];
|
|
700
|
+
}
|
|
701
|
+
function isEnabled(tag) {
|
|
702
|
+
const state = getState();
|
|
703
|
+
if (tag in state.tags) return state.tags[tag];
|
|
704
|
+
return state.debug;
|
|
705
|
+
}
|
|
706
|
+
var logger = {
|
|
707
|
+
/**
|
|
708
|
+
* Configure the logger. Can be called multiple times (last write wins).
|
|
709
|
+
* Typically called by createBrowserProviders(), createNodeProviders(), or Sphere.init().
|
|
710
|
+
*/
|
|
711
|
+
configure(config) {
|
|
712
|
+
const state = getState();
|
|
713
|
+
if (config.debug !== void 0) state.debug = config.debug;
|
|
714
|
+
if (config.handler !== void 0) state.handler = config.handler;
|
|
715
|
+
},
|
|
716
|
+
/**
|
|
717
|
+
* Enable/disable debug logging for a specific tag.
|
|
718
|
+
* Per-tag setting overrides the global debug flag.
|
|
719
|
+
*
|
|
720
|
+
* @example
|
|
721
|
+
* ```ts
|
|
722
|
+
* logger.setTagDebug('Nostr', true); // enable only Nostr logs
|
|
723
|
+
* logger.setTagDebug('Nostr', false); // disable Nostr logs even if global debug=true
|
|
724
|
+
* ```
|
|
725
|
+
*/
|
|
726
|
+
setTagDebug(tag, enabled) {
|
|
727
|
+
getState().tags[tag] = enabled;
|
|
728
|
+
},
|
|
729
|
+
/**
|
|
730
|
+
* Clear per-tag override, falling back to global debug flag.
|
|
731
|
+
*/
|
|
732
|
+
clearTagDebug(tag) {
|
|
733
|
+
delete getState().tags[tag];
|
|
734
|
+
},
|
|
735
|
+
/** Returns true if debug mode is enabled for the given tag (or globally). */
|
|
736
|
+
isDebugEnabled(tag) {
|
|
737
|
+
if (tag) return isEnabled(tag);
|
|
738
|
+
return getState().debug;
|
|
739
|
+
},
|
|
740
|
+
/**
|
|
741
|
+
* Debug-level log. Only shown when debug is enabled (globally or for this tag).
|
|
742
|
+
* Use for detailed operational information.
|
|
743
|
+
*/
|
|
744
|
+
debug(tag, message, ...args) {
|
|
745
|
+
if (!isEnabled(tag)) return;
|
|
746
|
+
const state = getState();
|
|
747
|
+
if (state.handler) {
|
|
748
|
+
state.handler("debug", tag, message, ...args);
|
|
749
|
+
} else {
|
|
750
|
+
console.log(`[${tag}]`, message, ...args);
|
|
751
|
+
}
|
|
752
|
+
},
|
|
753
|
+
/**
|
|
754
|
+
* Warning-level log. ALWAYS shown regardless of debug flag.
|
|
755
|
+
* Use for important but non-critical issues (timeouts, retries, degraded state).
|
|
756
|
+
*/
|
|
757
|
+
warn(tag, message, ...args) {
|
|
758
|
+
const state = getState();
|
|
759
|
+
if (state.handler) {
|
|
760
|
+
state.handler("warn", tag, message, ...args);
|
|
761
|
+
} else {
|
|
762
|
+
console.warn(`[${tag}]`, message, ...args);
|
|
763
|
+
}
|
|
764
|
+
},
|
|
765
|
+
/**
|
|
766
|
+
* Error-level log. ALWAYS shown regardless of debug flag.
|
|
767
|
+
* Use for critical failures that should never be silenced.
|
|
768
|
+
*/
|
|
769
|
+
error(tag, message, ...args) {
|
|
770
|
+
const state = getState();
|
|
771
|
+
if (state.handler) {
|
|
772
|
+
state.handler("error", tag, message, ...args);
|
|
773
|
+
} else {
|
|
774
|
+
console.error(`[${tag}]`, message, ...args);
|
|
775
|
+
}
|
|
776
|
+
},
|
|
777
|
+
/** Reset all logger state (debug flag, tags, handler). Primarily for tests. */
|
|
778
|
+
reset() {
|
|
779
|
+
const g = globalThis;
|
|
780
|
+
delete g[LOGGER_KEY];
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
|
|
692
784
|
// modules/payments-v2/stores.ts
|
|
693
785
|
var STORE_KEYS = {
|
|
694
786
|
intentBackstop: "intents",
|
|
@@ -3089,98 +3181,6 @@ var SerialChain = class {
|
|
|
3089
3181
|
}
|
|
3090
3182
|
};
|
|
3091
3183
|
|
|
3092
|
-
// core/logger.ts
|
|
3093
|
-
var LOGGER_KEY = "__sphere_sdk_logger__";
|
|
3094
|
-
function getState() {
|
|
3095
|
-
const g = globalThis;
|
|
3096
|
-
if (!g[LOGGER_KEY]) {
|
|
3097
|
-
g[LOGGER_KEY] = { debug: false, tags: {}, handler: null };
|
|
3098
|
-
}
|
|
3099
|
-
return g[LOGGER_KEY];
|
|
3100
|
-
}
|
|
3101
|
-
function isEnabled(tag) {
|
|
3102
|
-
const state = getState();
|
|
3103
|
-
if (tag in state.tags) return state.tags[tag];
|
|
3104
|
-
return state.debug;
|
|
3105
|
-
}
|
|
3106
|
-
var logger = {
|
|
3107
|
-
/**
|
|
3108
|
-
* Configure the logger. Can be called multiple times (last write wins).
|
|
3109
|
-
* Typically called by createBrowserProviders(), createNodeProviders(), or Sphere.init().
|
|
3110
|
-
*/
|
|
3111
|
-
configure(config) {
|
|
3112
|
-
const state = getState();
|
|
3113
|
-
if (config.debug !== void 0) state.debug = config.debug;
|
|
3114
|
-
if (config.handler !== void 0) state.handler = config.handler;
|
|
3115
|
-
},
|
|
3116
|
-
/**
|
|
3117
|
-
* Enable/disable debug logging for a specific tag.
|
|
3118
|
-
* Per-tag setting overrides the global debug flag.
|
|
3119
|
-
*
|
|
3120
|
-
* @example
|
|
3121
|
-
* ```ts
|
|
3122
|
-
* logger.setTagDebug('Nostr', true); // enable only Nostr logs
|
|
3123
|
-
* logger.setTagDebug('Nostr', false); // disable Nostr logs even if global debug=true
|
|
3124
|
-
* ```
|
|
3125
|
-
*/
|
|
3126
|
-
setTagDebug(tag, enabled) {
|
|
3127
|
-
getState().tags[tag] = enabled;
|
|
3128
|
-
},
|
|
3129
|
-
/**
|
|
3130
|
-
* Clear per-tag override, falling back to global debug flag.
|
|
3131
|
-
*/
|
|
3132
|
-
clearTagDebug(tag) {
|
|
3133
|
-
delete getState().tags[tag];
|
|
3134
|
-
},
|
|
3135
|
-
/** Returns true if debug mode is enabled for the given tag (or globally). */
|
|
3136
|
-
isDebugEnabled(tag) {
|
|
3137
|
-
if (tag) return isEnabled(tag);
|
|
3138
|
-
return getState().debug;
|
|
3139
|
-
},
|
|
3140
|
-
/**
|
|
3141
|
-
* Debug-level log. Only shown when debug is enabled (globally or for this tag).
|
|
3142
|
-
* Use for detailed operational information.
|
|
3143
|
-
*/
|
|
3144
|
-
debug(tag, message, ...args) {
|
|
3145
|
-
if (!isEnabled(tag)) return;
|
|
3146
|
-
const state = getState();
|
|
3147
|
-
if (state.handler) {
|
|
3148
|
-
state.handler("debug", tag, message, ...args);
|
|
3149
|
-
} else {
|
|
3150
|
-
console.log(`[${tag}]`, message, ...args);
|
|
3151
|
-
}
|
|
3152
|
-
},
|
|
3153
|
-
/**
|
|
3154
|
-
* Warning-level log. ALWAYS shown regardless of debug flag.
|
|
3155
|
-
* Use for important but non-critical issues (timeouts, retries, degraded state).
|
|
3156
|
-
*/
|
|
3157
|
-
warn(tag, message, ...args) {
|
|
3158
|
-
const state = getState();
|
|
3159
|
-
if (state.handler) {
|
|
3160
|
-
state.handler("warn", tag, message, ...args);
|
|
3161
|
-
} else {
|
|
3162
|
-
console.warn(`[${tag}]`, message, ...args);
|
|
3163
|
-
}
|
|
3164
|
-
},
|
|
3165
|
-
/**
|
|
3166
|
-
* Error-level log. ALWAYS shown regardless of debug flag.
|
|
3167
|
-
* Use for critical failures that should never be silenced.
|
|
3168
|
-
*/
|
|
3169
|
-
error(tag, message, ...args) {
|
|
3170
|
-
const state = getState();
|
|
3171
|
-
if (state.handler) {
|
|
3172
|
-
state.handler("error", tag, message, ...args);
|
|
3173
|
-
} else {
|
|
3174
|
-
console.error(`[${tag}]`, message, ...args);
|
|
3175
|
-
}
|
|
3176
|
-
},
|
|
3177
|
-
/** Reset all logger state (debug flag, tags, handler). Primarily for tests. */
|
|
3178
|
-
reset() {
|
|
3179
|
-
const g = globalThis;
|
|
3180
|
-
delete g[LOGGER_KEY];
|
|
3181
|
-
}
|
|
3182
|
-
};
|
|
3183
|
-
|
|
3184
3184
|
// node_modules/@noble/hashes/hkdf.js
|
|
3185
3185
|
function extract(hash, ikm, salt) {
|
|
3186
3186
|
ahash(hash);
|