@pooflabs/web 0.0.70-rc.1 → 0.0.70

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  var React = require('react');
4
4
  var globalAxios = require('axios');
5
- var index = require('./index-CMKICH1P.js');
5
+ var index = require('./index-Rzm01Zbu.js');
6
6
  var web3_js = require('@solana/web3.js');
7
7
  var jsxRuntime = require('react/jsx-runtime');
8
8
  require('@coral-xyz/anchor');
@@ -1150,17 +1150,17 @@ function requireSrc () {
1150
1150
  return src;
1151
1151
  }
1152
1152
 
1153
- var bs58;
1153
+ var bs58$3;
1154
1154
  var hasRequiredBs58;
1155
1155
 
1156
1156
  function requireBs58 () {
1157
- if (hasRequiredBs58) return bs58;
1157
+ if (hasRequiredBs58) return bs58$3;
1158
1158
  hasRequiredBs58 = 1;
1159
1159
  const basex = requireSrc();
1160
1160
  const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
1161
1161
 
1162
- bs58 = basex(ALPHABET);
1163
- return bs58;
1162
+ bs58$3 = basex(ALPHABET);
1163
+ return bs58$3;
1164
1164
  }
1165
1165
 
1166
1166
  requireBs58();
@@ -3120,6 +3120,356 @@ function createAutoConfirmPlugin() {
3120
3120
  };
3121
3121
  }
3122
3122
 
3123
+ var eventemitter3$1 = {exports: {}};
3124
+
3125
+ var hasRequiredEventemitter3$1;
3126
+
3127
+ function requireEventemitter3$1 () {
3128
+ if (hasRequiredEventemitter3$1) return eventemitter3$1.exports;
3129
+ hasRequiredEventemitter3$1 = 1;
3130
+ (function (module) {
3131
+
3132
+ var has = Object.prototype.hasOwnProperty
3133
+ , prefix = '~';
3134
+
3135
+ /**
3136
+ * Constructor to create a storage for our `EE` objects.
3137
+ * An `Events` instance is a plain object whose properties are event names.
3138
+ *
3139
+ * @constructor
3140
+ * @private
3141
+ */
3142
+ function Events() {}
3143
+
3144
+ //
3145
+ // We try to not inherit from `Object.prototype`. In some engines creating an
3146
+ // instance in this way is faster than calling `Object.create(null)` directly.
3147
+ // If `Object.create(null)` is not supported we prefix the event names with a
3148
+ // character to make sure that the built-in object properties are not
3149
+ // overridden or used as an attack vector.
3150
+ //
3151
+ if (Object.create) {
3152
+ Events.prototype = Object.create(null);
3153
+
3154
+ //
3155
+ // This hack is needed because the `__proto__` property is still inherited in
3156
+ // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
3157
+ //
3158
+ if (!new Events().__proto__) prefix = false;
3159
+ }
3160
+
3161
+ /**
3162
+ * Representation of a single event listener.
3163
+ *
3164
+ * @param {Function} fn The listener function.
3165
+ * @param {*} context The context to invoke the listener with.
3166
+ * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
3167
+ * @constructor
3168
+ * @private
3169
+ */
3170
+ function EE(fn, context, once) {
3171
+ this.fn = fn;
3172
+ this.context = context;
3173
+ this.once = once || false;
3174
+ }
3175
+
3176
+ /**
3177
+ * Add a listener for a given event.
3178
+ *
3179
+ * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
3180
+ * @param {(String|Symbol)} event The event name.
3181
+ * @param {Function} fn The listener function.
3182
+ * @param {*} context The context to invoke the listener with.
3183
+ * @param {Boolean} once Specify if the listener is a one-time listener.
3184
+ * @returns {EventEmitter}
3185
+ * @private
3186
+ */
3187
+ function addListener(emitter, event, fn, context, once) {
3188
+ if (typeof fn !== 'function') {
3189
+ throw new TypeError('The listener must be a function');
3190
+ }
3191
+
3192
+ var listener = new EE(fn, context || emitter, once)
3193
+ , evt = prefix ? prefix + event : event;
3194
+
3195
+ if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
3196
+ else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
3197
+ else emitter._events[evt] = [emitter._events[evt], listener];
3198
+
3199
+ return emitter;
3200
+ }
3201
+
3202
+ /**
3203
+ * Clear event by name.
3204
+ *
3205
+ * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
3206
+ * @param {(String|Symbol)} evt The Event name.
3207
+ * @private
3208
+ */
3209
+ function clearEvent(emitter, evt) {
3210
+ if (--emitter._eventsCount === 0) emitter._events = new Events();
3211
+ else delete emitter._events[evt];
3212
+ }
3213
+
3214
+ /**
3215
+ * Minimal `EventEmitter` interface that is molded against the Node.js
3216
+ * `EventEmitter` interface.
3217
+ *
3218
+ * @constructor
3219
+ * @public
3220
+ */
3221
+ function EventEmitter() {
3222
+ this._events = new Events();
3223
+ this._eventsCount = 0;
3224
+ }
3225
+
3226
+ /**
3227
+ * Return an array listing the events for which the emitter has registered
3228
+ * listeners.
3229
+ *
3230
+ * @returns {Array}
3231
+ * @public
3232
+ */
3233
+ EventEmitter.prototype.eventNames = function eventNames() {
3234
+ var names = []
3235
+ , events
3236
+ , name;
3237
+
3238
+ if (this._eventsCount === 0) return names;
3239
+
3240
+ for (name in (events = this._events)) {
3241
+ if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
3242
+ }
3243
+
3244
+ if (Object.getOwnPropertySymbols) {
3245
+ return names.concat(Object.getOwnPropertySymbols(events));
3246
+ }
3247
+
3248
+ return names;
3249
+ };
3250
+
3251
+ /**
3252
+ * Return the listeners registered for a given event.
3253
+ *
3254
+ * @param {(String|Symbol)} event The event name.
3255
+ * @returns {Array} The registered listeners.
3256
+ * @public
3257
+ */
3258
+ EventEmitter.prototype.listeners = function listeners(event) {
3259
+ var evt = prefix ? prefix + event : event
3260
+ , handlers = this._events[evt];
3261
+
3262
+ if (!handlers) return [];
3263
+ if (handlers.fn) return [handlers.fn];
3264
+
3265
+ for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
3266
+ ee[i] = handlers[i].fn;
3267
+ }
3268
+
3269
+ return ee;
3270
+ };
3271
+
3272
+ /**
3273
+ * Return the number of listeners listening to a given event.
3274
+ *
3275
+ * @param {(String|Symbol)} event The event name.
3276
+ * @returns {Number} The number of listeners.
3277
+ * @public
3278
+ */
3279
+ EventEmitter.prototype.listenerCount = function listenerCount(event) {
3280
+ var evt = prefix ? prefix + event : event
3281
+ , listeners = this._events[evt];
3282
+
3283
+ if (!listeners) return 0;
3284
+ if (listeners.fn) return 1;
3285
+ return listeners.length;
3286
+ };
3287
+
3288
+ /**
3289
+ * Calls each of the listeners registered for a given event.
3290
+ *
3291
+ * @param {(String|Symbol)} event The event name.
3292
+ * @returns {Boolean} `true` if the event had listeners, else `false`.
3293
+ * @public
3294
+ */
3295
+ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
3296
+ var evt = prefix ? prefix + event : event;
3297
+
3298
+ if (!this._events[evt]) return false;
3299
+
3300
+ var listeners = this._events[evt]
3301
+ , len = arguments.length
3302
+ , args
3303
+ , i;
3304
+
3305
+ if (listeners.fn) {
3306
+ if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
3307
+
3308
+ switch (len) {
3309
+ case 1: return listeners.fn.call(listeners.context), true;
3310
+ case 2: return listeners.fn.call(listeners.context, a1), true;
3311
+ case 3: return listeners.fn.call(listeners.context, a1, a2), true;
3312
+ case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
3313
+ case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
3314
+ case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
3315
+ }
3316
+
3317
+ for (i = 1, args = new Array(len -1); i < len; i++) {
3318
+ args[i - 1] = arguments[i];
3319
+ }
3320
+
3321
+ listeners.fn.apply(listeners.context, args);
3322
+ } else {
3323
+ var length = listeners.length
3324
+ , j;
3325
+
3326
+ for (i = 0; i < length; i++) {
3327
+ if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
3328
+
3329
+ switch (len) {
3330
+ case 1: listeners[i].fn.call(listeners[i].context); break;
3331
+ case 2: listeners[i].fn.call(listeners[i].context, a1); break;
3332
+ case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
3333
+ case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
3334
+ default:
3335
+ if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
3336
+ args[j - 1] = arguments[j];
3337
+ }
3338
+
3339
+ listeners[i].fn.apply(listeners[i].context, args);
3340
+ }
3341
+ }
3342
+ }
3343
+
3344
+ return true;
3345
+ };
3346
+
3347
+ /**
3348
+ * Add a listener for a given event.
3349
+ *
3350
+ * @param {(String|Symbol)} event The event name.
3351
+ * @param {Function} fn The listener function.
3352
+ * @param {*} [context=this] The context to invoke the listener with.
3353
+ * @returns {EventEmitter} `this`.
3354
+ * @public
3355
+ */
3356
+ EventEmitter.prototype.on = function on(event, fn, context) {
3357
+ return addListener(this, event, fn, context, false);
3358
+ };
3359
+
3360
+ /**
3361
+ * Add a one-time listener for a given event.
3362
+ *
3363
+ * @param {(String|Symbol)} event The event name.
3364
+ * @param {Function} fn The listener function.
3365
+ * @param {*} [context=this] The context to invoke the listener with.
3366
+ * @returns {EventEmitter} `this`.
3367
+ * @public
3368
+ */
3369
+ EventEmitter.prototype.once = function once(event, fn, context) {
3370
+ return addListener(this, event, fn, context, true);
3371
+ };
3372
+
3373
+ /**
3374
+ * Remove the listeners of a given event.
3375
+ *
3376
+ * @param {(String|Symbol)} event The event name.
3377
+ * @param {Function} fn Only remove the listeners that match this function.
3378
+ * @param {*} context Only remove the listeners that have this context.
3379
+ * @param {Boolean} once Only remove one-time listeners.
3380
+ * @returns {EventEmitter} `this`.
3381
+ * @public
3382
+ */
3383
+ EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
3384
+ var evt = prefix ? prefix + event : event;
3385
+
3386
+ if (!this._events[evt]) return this;
3387
+ if (!fn) {
3388
+ clearEvent(this, evt);
3389
+ return this;
3390
+ }
3391
+
3392
+ var listeners = this._events[evt];
3393
+
3394
+ if (listeners.fn) {
3395
+ if (
3396
+ listeners.fn === fn &&
3397
+ (!once || listeners.once) &&
3398
+ (!context || listeners.context === context)
3399
+ ) {
3400
+ clearEvent(this, evt);
3401
+ }
3402
+ } else {
3403
+ for (var i = 0, events = [], length = listeners.length; i < length; i++) {
3404
+ if (
3405
+ listeners[i].fn !== fn ||
3406
+ (once && !listeners[i].once) ||
3407
+ (context && listeners[i].context !== context)
3408
+ ) {
3409
+ events.push(listeners[i]);
3410
+ }
3411
+ }
3412
+
3413
+ //
3414
+ // Reset the array, or remove it completely if we have no more listeners.
3415
+ //
3416
+ if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
3417
+ else clearEvent(this, evt);
3418
+ }
3419
+
3420
+ return this;
3421
+ };
3422
+
3423
+ /**
3424
+ * Remove all listeners, or those of the specified event.
3425
+ *
3426
+ * @param {(String|Symbol)} [event] The event name.
3427
+ * @returns {EventEmitter} `this`.
3428
+ * @public
3429
+ */
3430
+ EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
3431
+ var evt;
3432
+
3433
+ if (event) {
3434
+ evt = prefix ? prefix + event : event;
3435
+ if (this._events[evt]) clearEvent(this, evt);
3436
+ } else {
3437
+ this._events = new Events();
3438
+ this._eventsCount = 0;
3439
+ }
3440
+
3441
+ return this;
3442
+ };
3443
+
3444
+ //
3445
+ // Alias methods names because people roll like that.
3446
+ //
3447
+ EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
3448
+ EventEmitter.prototype.addListener = EventEmitter.prototype.on;
3449
+
3450
+ //
3451
+ // Expose the prefix.
3452
+ //
3453
+ EventEmitter.prefixed = prefix;
3454
+
3455
+ //
3456
+ // Allow `EventEmitter` to be imported as module namespace.
3457
+ //
3458
+ EventEmitter.EventEmitter = EventEmitter;
3459
+
3460
+ //
3461
+ // Expose the module.
3462
+ //
3463
+ {
3464
+ module.exports = EventEmitter;
3465
+ }
3466
+ } (eventemitter3$1));
3467
+ return eventemitter3$1.exports;
3468
+ }
3469
+
3470
+ var eventemitter3Exports$1 = requireEventemitter3$1();
3471
+ var EventEmitter3 = /*@__PURE__*/index.getDefaultExportFromCjs(eventemitter3Exports$1);
3472
+
3123
3473
  // src/index.ts
3124
3474
  var isBrowser = typeof window !== "undefined" && typeof window.btoa !== "undefined";
3125
3475
  function base64urlEncode(data) {
@@ -8447,6 +8797,133 @@ class Transaction {
8447
8797
  }
8448
8798
  }
8449
8799
 
8800
+ // base-x encoding / decoding
8801
+ // Copyright (c) 2018 base-x contributors
8802
+ // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
8803
+ // Distributed under the MIT software license, see the accompanying
8804
+ // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
8805
+ function base$3 (ALPHABET) {
8806
+ if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
8807
+ const BASE_MAP = new Uint8Array(256);
8808
+ for (let j = 0; j < BASE_MAP.length; j++) {
8809
+ BASE_MAP[j] = 255;
8810
+ }
8811
+ for (let i = 0; i < ALPHABET.length; i++) {
8812
+ const x = ALPHABET.charAt(i);
8813
+ const xc = x.charCodeAt(0);
8814
+ if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
8815
+ BASE_MAP[xc] = i;
8816
+ }
8817
+ const BASE = ALPHABET.length;
8818
+ const LEADER = ALPHABET.charAt(0);
8819
+ const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
8820
+ const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
8821
+ function encode (source) {
8822
+ // eslint-disable-next-line no-empty
8823
+ if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
8824
+ source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
8825
+ } else if (Array.isArray(source)) {
8826
+ source = Uint8Array.from(source);
8827
+ }
8828
+ if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
8829
+ if (source.length === 0) { return '' }
8830
+ // Skip & count leading zeroes.
8831
+ let zeroes = 0;
8832
+ let length = 0;
8833
+ let pbegin = 0;
8834
+ const pend = source.length;
8835
+ while (pbegin !== pend && source[pbegin] === 0) {
8836
+ pbegin++;
8837
+ zeroes++;
8838
+ }
8839
+ // Allocate enough space in big-endian base58 representation.
8840
+ const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
8841
+ const b58 = new Uint8Array(size);
8842
+ // Process the bytes.
8843
+ while (pbegin !== pend) {
8844
+ let carry = source[pbegin];
8845
+ // Apply "b58 = b58 * 256 + ch".
8846
+ let i = 0;
8847
+ for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
8848
+ carry += (256 * b58[it1]) >>> 0;
8849
+ b58[it1] = (carry % BASE) >>> 0;
8850
+ carry = (carry / BASE) >>> 0;
8851
+ }
8852
+ if (carry !== 0) { throw new Error('Non-zero carry') }
8853
+ length = i;
8854
+ pbegin++;
8855
+ }
8856
+ // Skip leading zeroes in base58 result.
8857
+ let it2 = size - length;
8858
+ while (it2 !== size && b58[it2] === 0) {
8859
+ it2++;
8860
+ }
8861
+ // Translate the result into a string.
8862
+ let str = LEADER.repeat(zeroes);
8863
+ for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
8864
+ return str
8865
+ }
8866
+ function decodeUnsafe (source) {
8867
+ if (typeof source !== 'string') { throw new TypeError('Expected String') }
8868
+ if (source.length === 0) { return new Uint8Array() }
8869
+ let psz = 0;
8870
+ // Skip and count leading '1's.
8871
+ let zeroes = 0;
8872
+ let length = 0;
8873
+ while (source[psz] === LEADER) {
8874
+ zeroes++;
8875
+ psz++;
8876
+ }
8877
+ // Allocate enough space in big-endian base256 representation.
8878
+ const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
8879
+ const b256 = new Uint8Array(size);
8880
+ // Process the characters.
8881
+ while (psz < source.length) {
8882
+ // Find code of next character
8883
+ const charCode = source.charCodeAt(psz);
8884
+ // Base map can not be indexed using char code
8885
+ if (charCode > 255) { return }
8886
+ // Decode character
8887
+ let carry = BASE_MAP[charCode];
8888
+ // Invalid character
8889
+ if (carry === 255) { return }
8890
+ let i = 0;
8891
+ for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
8892
+ carry += (BASE * b256[it3]) >>> 0;
8893
+ b256[it3] = (carry % 256) >>> 0;
8894
+ carry = (carry / 256) >>> 0;
8895
+ }
8896
+ if (carry !== 0) { throw new Error('Non-zero carry') }
8897
+ length = i;
8898
+ psz++;
8899
+ }
8900
+ // Skip leading zeroes in b256.
8901
+ let it4 = size - length;
8902
+ while (it4 !== size && b256[it4] === 0) {
8903
+ it4++;
8904
+ }
8905
+ const vch = new Uint8Array(zeroes + (size - it4));
8906
+ let j = zeroes;
8907
+ while (it4 !== size) {
8908
+ vch[j++] = b256[it4++];
8909
+ }
8910
+ return vch
8911
+ }
8912
+ function decode (string) {
8913
+ const buffer = decodeUnsafe(string);
8914
+ if (buffer) { return buffer }
8915
+ throw new Error('Non-base' + BASE + ' character')
8916
+ }
8917
+ return {
8918
+ encode,
8919
+ decodeUnsafe,
8920
+ decode
8921
+ }
8922
+ }
8923
+
8924
+ var ALPHABET$3 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
8925
+ var bs58$2 = base$3(ALPHABET$3);
8926
+
8450
8927
  // src/index.ts
8451
8928
  function parseSignMessageResponse(base64Response, networkId) {
8452
8929
  const networkPrefix = networkId.split(":")[0].toLowerCase();
@@ -8493,7 +8970,7 @@ function parseTransactionResponse(base64RawTransaction, networkId, hash) {
8493
8970
  function parseSolanaSignatureResponse(base64Response) {
8494
8971
  try {
8495
8972
  const signatureBytes = base64urlDecode(base64Response);
8496
- const signature = index.bs58.encode(signatureBytes);
8973
+ const signature = bs58$2.encode(signatureBytes);
8497
8974
  return {
8498
8975
  signature,
8499
8976
  rawSignature: base64Response
@@ -8733,6 +9210,610 @@ function parseBitcoinTransactionToBase64Url(transaction) {
8733
9210
  throw new Error("Unsupported Bitcoin transaction format");
8734
9211
  }
8735
9212
 
9213
+ // base-x encoding / decoding
9214
+ // Copyright (c) 2018 base-x contributors
9215
+ // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
9216
+ // Distributed under the MIT software license, see the accompanying
9217
+ // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
9218
+ function base$2 (ALPHABET) {
9219
+ if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
9220
+ const BASE_MAP = new Uint8Array(256);
9221
+ for (let j = 0; j < BASE_MAP.length; j++) {
9222
+ BASE_MAP[j] = 255;
9223
+ }
9224
+ for (let i = 0; i < ALPHABET.length; i++) {
9225
+ const x = ALPHABET.charAt(i);
9226
+ const xc = x.charCodeAt(0);
9227
+ if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
9228
+ BASE_MAP[xc] = i;
9229
+ }
9230
+ const BASE = ALPHABET.length;
9231
+ const LEADER = ALPHABET.charAt(0);
9232
+ const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
9233
+ const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
9234
+ function encode (source) {
9235
+ // eslint-disable-next-line no-empty
9236
+ if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
9237
+ source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
9238
+ } else if (Array.isArray(source)) {
9239
+ source = Uint8Array.from(source);
9240
+ }
9241
+ if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
9242
+ if (source.length === 0) { return '' }
9243
+ // Skip & count leading zeroes.
9244
+ let zeroes = 0;
9245
+ let length = 0;
9246
+ let pbegin = 0;
9247
+ const pend = source.length;
9248
+ while (pbegin !== pend && source[pbegin] === 0) {
9249
+ pbegin++;
9250
+ zeroes++;
9251
+ }
9252
+ // Allocate enough space in big-endian base58 representation.
9253
+ const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
9254
+ const b58 = new Uint8Array(size);
9255
+ // Process the bytes.
9256
+ while (pbegin !== pend) {
9257
+ let carry = source[pbegin];
9258
+ // Apply "b58 = b58 * 256 + ch".
9259
+ let i = 0;
9260
+ for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
9261
+ carry += (256 * b58[it1]) >>> 0;
9262
+ b58[it1] = (carry % BASE) >>> 0;
9263
+ carry = (carry / BASE) >>> 0;
9264
+ }
9265
+ if (carry !== 0) { throw new Error('Non-zero carry') }
9266
+ length = i;
9267
+ pbegin++;
9268
+ }
9269
+ // Skip leading zeroes in base58 result.
9270
+ let it2 = size - length;
9271
+ while (it2 !== size && b58[it2] === 0) {
9272
+ it2++;
9273
+ }
9274
+ // Translate the result into a string.
9275
+ let str = LEADER.repeat(zeroes);
9276
+ for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
9277
+ return str
9278
+ }
9279
+ function decodeUnsafe (source) {
9280
+ if (typeof source !== 'string') { throw new TypeError('Expected String') }
9281
+ if (source.length === 0) { return new Uint8Array() }
9282
+ let psz = 0;
9283
+ // Skip and count leading '1's.
9284
+ let zeroes = 0;
9285
+ let length = 0;
9286
+ while (source[psz] === LEADER) {
9287
+ zeroes++;
9288
+ psz++;
9289
+ }
9290
+ // Allocate enough space in big-endian base256 representation.
9291
+ const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
9292
+ const b256 = new Uint8Array(size);
9293
+ // Process the characters.
9294
+ while (psz < source.length) {
9295
+ // Find code of next character
9296
+ const charCode = source.charCodeAt(psz);
9297
+ // Base map can not be indexed using char code
9298
+ if (charCode > 255) { return }
9299
+ // Decode character
9300
+ let carry = BASE_MAP[charCode];
9301
+ // Invalid character
9302
+ if (carry === 255) { return }
9303
+ let i = 0;
9304
+ for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
9305
+ carry += (BASE * b256[it3]) >>> 0;
9306
+ b256[it3] = (carry % 256) >>> 0;
9307
+ carry = (carry / 256) >>> 0;
9308
+ }
9309
+ if (carry !== 0) { throw new Error('Non-zero carry') }
9310
+ length = i;
9311
+ psz++;
9312
+ }
9313
+ // Skip leading zeroes in b256.
9314
+ let it4 = size - length;
9315
+ while (it4 !== size && b256[it4] === 0) {
9316
+ it4++;
9317
+ }
9318
+ const vch = new Uint8Array(zeroes + (size - it4));
9319
+ let j = zeroes;
9320
+ while (it4 !== size) {
9321
+ vch[j++] = b256[it4++];
9322
+ }
9323
+ return vch
9324
+ }
9325
+ function decode (string) {
9326
+ const buffer = decodeUnsafe(string);
9327
+ if (buffer) { return buffer }
9328
+ throw new Error('Non-base' + BASE + ' character')
9329
+ }
9330
+ return {
9331
+ encode,
9332
+ decodeUnsafe,
9333
+ decode
9334
+ }
9335
+ }
9336
+
9337
+ var ALPHABET$2 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
9338
+ var bs58$1 = base$2(ALPHABET$2);
9339
+
9340
+ // base-x encoding / decoding
9341
+ // Copyright (c) 2018 base-x contributors
9342
+ // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
9343
+ // Distributed under the MIT software license, see the accompanying
9344
+ // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
9345
+ function base$1 (ALPHABET) {
9346
+ if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
9347
+ const BASE_MAP = new Uint8Array(256);
9348
+ for (let j = 0; j < BASE_MAP.length; j++) {
9349
+ BASE_MAP[j] = 255;
9350
+ }
9351
+ for (let i = 0; i < ALPHABET.length; i++) {
9352
+ const x = ALPHABET.charAt(i);
9353
+ const xc = x.charCodeAt(0);
9354
+ if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
9355
+ BASE_MAP[xc] = i;
9356
+ }
9357
+ const BASE = ALPHABET.length;
9358
+ const LEADER = ALPHABET.charAt(0);
9359
+ const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
9360
+ const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
9361
+ function encode (source) {
9362
+ // eslint-disable-next-line no-empty
9363
+ if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
9364
+ source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
9365
+ } else if (Array.isArray(source)) {
9366
+ source = Uint8Array.from(source);
9367
+ }
9368
+ if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
9369
+ if (source.length === 0) { return '' }
9370
+ // Skip & count leading zeroes.
9371
+ let zeroes = 0;
9372
+ let length = 0;
9373
+ let pbegin = 0;
9374
+ const pend = source.length;
9375
+ while (pbegin !== pend && source[pbegin] === 0) {
9376
+ pbegin++;
9377
+ zeroes++;
9378
+ }
9379
+ // Allocate enough space in big-endian base58 representation.
9380
+ const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
9381
+ const b58 = new Uint8Array(size);
9382
+ // Process the bytes.
9383
+ while (pbegin !== pend) {
9384
+ let carry = source[pbegin];
9385
+ // Apply "b58 = b58 * 256 + ch".
9386
+ let i = 0;
9387
+ for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
9388
+ carry += (256 * b58[it1]) >>> 0;
9389
+ b58[it1] = (carry % BASE) >>> 0;
9390
+ carry = (carry / BASE) >>> 0;
9391
+ }
9392
+ if (carry !== 0) { throw new Error('Non-zero carry') }
9393
+ length = i;
9394
+ pbegin++;
9395
+ }
9396
+ // Skip leading zeroes in base58 result.
9397
+ let it2 = size - length;
9398
+ while (it2 !== size && b58[it2] === 0) {
9399
+ it2++;
9400
+ }
9401
+ // Translate the result into a string.
9402
+ let str = LEADER.repeat(zeroes);
9403
+ for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
9404
+ return str
9405
+ }
9406
+ function decodeUnsafe (source) {
9407
+ if (typeof source !== 'string') { throw new TypeError('Expected String') }
9408
+ if (source.length === 0) { return new Uint8Array() }
9409
+ let psz = 0;
9410
+ // Skip and count leading '1's.
9411
+ let zeroes = 0;
9412
+ let length = 0;
9413
+ while (source[psz] === LEADER) {
9414
+ zeroes++;
9415
+ psz++;
9416
+ }
9417
+ // Allocate enough space in big-endian base256 representation.
9418
+ const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
9419
+ const b256 = new Uint8Array(size);
9420
+ // Process the characters.
9421
+ while (psz < source.length) {
9422
+ // Find code of next character
9423
+ const charCode = source.charCodeAt(psz);
9424
+ // Base map can not be indexed using char code
9425
+ if (charCode > 255) { return }
9426
+ // Decode character
9427
+ let carry = BASE_MAP[charCode];
9428
+ // Invalid character
9429
+ if (carry === 255) { return }
9430
+ let i = 0;
9431
+ for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
9432
+ carry += (BASE * b256[it3]) >>> 0;
9433
+ b256[it3] = (carry % 256) >>> 0;
9434
+ carry = (carry / 256) >>> 0;
9435
+ }
9436
+ if (carry !== 0) { throw new Error('Non-zero carry') }
9437
+ length = i;
9438
+ psz++;
9439
+ }
9440
+ // Skip leading zeroes in b256.
9441
+ let it4 = size - length;
9442
+ while (it4 !== size && b256[it4] === 0) {
9443
+ it4++;
9444
+ }
9445
+ const vch = new Uint8Array(zeroes + (size - it4));
9446
+ let j = zeroes;
9447
+ while (it4 !== size) {
9448
+ vch[j++] = b256[it4++];
9449
+ }
9450
+ return vch
9451
+ }
9452
+ function decode (string) {
9453
+ const buffer = decodeUnsafe(string);
9454
+ if (buffer) { return buffer }
9455
+ throw new Error('Non-base' + BASE + ' character')
9456
+ }
9457
+ return {
9458
+ encode,
9459
+ decodeUnsafe,
9460
+ decode
9461
+ }
9462
+ }
9463
+
9464
+ var ALPHABET$1 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
9465
+ var bs582 = base$1(ALPHABET$1);
9466
+
9467
+ var eventemitter3 = {exports: {}};
9468
+
9469
+ var hasRequiredEventemitter3;
9470
+
9471
+ function requireEventemitter3 () {
9472
+ if (hasRequiredEventemitter3) return eventemitter3.exports;
9473
+ hasRequiredEventemitter3 = 1;
9474
+ (function (module) {
9475
+
9476
+ var has = Object.prototype.hasOwnProperty
9477
+ , prefix = '~';
9478
+
9479
+ /**
9480
+ * Constructor to create a storage for our `EE` objects.
9481
+ * An `Events` instance is a plain object whose properties are event names.
9482
+ *
9483
+ * @constructor
9484
+ * @private
9485
+ */
9486
+ function Events() {}
9487
+
9488
+ //
9489
+ // We try to not inherit from `Object.prototype`. In some engines creating an
9490
+ // instance in this way is faster than calling `Object.create(null)` directly.
9491
+ // If `Object.create(null)` is not supported we prefix the event names with a
9492
+ // character to make sure that the built-in object properties are not
9493
+ // overridden or used as an attack vector.
9494
+ //
9495
+ if (Object.create) {
9496
+ Events.prototype = Object.create(null);
9497
+
9498
+ //
9499
+ // This hack is needed because the `__proto__` property is still inherited in
9500
+ // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
9501
+ //
9502
+ if (!new Events().__proto__) prefix = false;
9503
+ }
9504
+
9505
+ /**
9506
+ * Representation of a single event listener.
9507
+ *
9508
+ * @param {Function} fn The listener function.
9509
+ * @param {*} context The context to invoke the listener with.
9510
+ * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
9511
+ * @constructor
9512
+ * @private
9513
+ */
9514
+ function EE(fn, context, once) {
9515
+ this.fn = fn;
9516
+ this.context = context;
9517
+ this.once = once || false;
9518
+ }
9519
+
9520
+ /**
9521
+ * Add a listener for a given event.
9522
+ *
9523
+ * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
9524
+ * @param {(String|Symbol)} event The event name.
9525
+ * @param {Function} fn The listener function.
9526
+ * @param {*} context The context to invoke the listener with.
9527
+ * @param {Boolean} once Specify if the listener is a one-time listener.
9528
+ * @returns {EventEmitter}
9529
+ * @private
9530
+ */
9531
+ function addListener(emitter, event, fn, context, once) {
9532
+ if (typeof fn !== 'function') {
9533
+ throw new TypeError('The listener must be a function');
9534
+ }
9535
+
9536
+ var listener = new EE(fn, context || emitter, once)
9537
+ , evt = prefix ? prefix + event : event;
9538
+
9539
+ if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
9540
+ else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
9541
+ else emitter._events[evt] = [emitter._events[evt], listener];
9542
+
9543
+ return emitter;
9544
+ }
9545
+
9546
+ /**
9547
+ * Clear event by name.
9548
+ *
9549
+ * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
9550
+ * @param {(String|Symbol)} evt The Event name.
9551
+ * @private
9552
+ */
9553
+ function clearEvent(emitter, evt) {
9554
+ if (--emitter._eventsCount === 0) emitter._events = new Events();
9555
+ else delete emitter._events[evt];
9556
+ }
9557
+
9558
+ /**
9559
+ * Minimal `EventEmitter` interface that is molded against the Node.js
9560
+ * `EventEmitter` interface.
9561
+ *
9562
+ * @constructor
9563
+ * @public
9564
+ */
9565
+ function EventEmitter() {
9566
+ this._events = new Events();
9567
+ this._eventsCount = 0;
9568
+ }
9569
+
9570
+ /**
9571
+ * Return an array listing the events for which the emitter has registered
9572
+ * listeners.
9573
+ *
9574
+ * @returns {Array}
9575
+ * @public
9576
+ */
9577
+ EventEmitter.prototype.eventNames = function eventNames() {
9578
+ var names = []
9579
+ , events
9580
+ , name;
9581
+
9582
+ if (this._eventsCount === 0) return names;
9583
+
9584
+ for (name in (events = this._events)) {
9585
+ if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
9586
+ }
9587
+
9588
+ if (Object.getOwnPropertySymbols) {
9589
+ return names.concat(Object.getOwnPropertySymbols(events));
9590
+ }
9591
+
9592
+ return names;
9593
+ };
9594
+
9595
+ /**
9596
+ * Return the listeners registered for a given event.
9597
+ *
9598
+ * @param {(String|Symbol)} event The event name.
9599
+ * @returns {Array} The registered listeners.
9600
+ * @public
9601
+ */
9602
+ EventEmitter.prototype.listeners = function listeners(event) {
9603
+ var evt = prefix ? prefix + event : event
9604
+ , handlers = this._events[evt];
9605
+
9606
+ if (!handlers) return [];
9607
+ if (handlers.fn) return [handlers.fn];
9608
+
9609
+ for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
9610
+ ee[i] = handlers[i].fn;
9611
+ }
9612
+
9613
+ return ee;
9614
+ };
9615
+
9616
+ /**
9617
+ * Return the number of listeners listening to a given event.
9618
+ *
9619
+ * @param {(String|Symbol)} event The event name.
9620
+ * @returns {Number} The number of listeners.
9621
+ * @public
9622
+ */
9623
+ EventEmitter.prototype.listenerCount = function listenerCount(event) {
9624
+ var evt = prefix ? prefix + event : event
9625
+ , listeners = this._events[evt];
9626
+
9627
+ if (!listeners) return 0;
9628
+ if (listeners.fn) return 1;
9629
+ return listeners.length;
9630
+ };
9631
+
9632
+ /**
9633
+ * Calls each of the listeners registered for a given event.
9634
+ *
9635
+ * @param {(String|Symbol)} event The event name.
9636
+ * @returns {Boolean} `true` if the event had listeners, else `false`.
9637
+ * @public
9638
+ */
9639
+ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
9640
+ var evt = prefix ? prefix + event : event;
9641
+
9642
+ if (!this._events[evt]) return false;
9643
+
9644
+ var listeners = this._events[evt]
9645
+ , len = arguments.length
9646
+ , args
9647
+ , i;
9648
+
9649
+ if (listeners.fn) {
9650
+ if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
9651
+
9652
+ switch (len) {
9653
+ case 1: return listeners.fn.call(listeners.context), true;
9654
+ case 2: return listeners.fn.call(listeners.context, a1), true;
9655
+ case 3: return listeners.fn.call(listeners.context, a1, a2), true;
9656
+ case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
9657
+ case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
9658
+ case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
9659
+ }
9660
+
9661
+ for (i = 1, args = new Array(len -1); i < len; i++) {
9662
+ args[i - 1] = arguments[i];
9663
+ }
9664
+
9665
+ listeners.fn.apply(listeners.context, args);
9666
+ } else {
9667
+ var length = listeners.length
9668
+ , j;
9669
+
9670
+ for (i = 0; i < length; i++) {
9671
+ if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
9672
+
9673
+ switch (len) {
9674
+ case 1: listeners[i].fn.call(listeners[i].context); break;
9675
+ case 2: listeners[i].fn.call(listeners[i].context, a1); break;
9676
+ case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
9677
+ case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
9678
+ default:
9679
+ if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
9680
+ args[j - 1] = arguments[j];
9681
+ }
9682
+
9683
+ listeners[i].fn.apply(listeners[i].context, args);
9684
+ }
9685
+ }
9686
+ }
9687
+
9688
+ return true;
9689
+ };
9690
+
9691
+ /**
9692
+ * Add a listener for a given event.
9693
+ *
9694
+ * @param {(String|Symbol)} event The event name.
9695
+ * @param {Function} fn The listener function.
9696
+ * @param {*} [context=this] The context to invoke the listener with.
9697
+ * @returns {EventEmitter} `this`.
9698
+ * @public
9699
+ */
9700
+ EventEmitter.prototype.on = function on(event, fn, context) {
9701
+ return addListener(this, event, fn, context, false);
9702
+ };
9703
+
9704
+ /**
9705
+ * Add a one-time listener for a given event.
9706
+ *
9707
+ * @param {(String|Symbol)} event The event name.
9708
+ * @param {Function} fn The listener function.
9709
+ * @param {*} [context=this] The context to invoke the listener with.
9710
+ * @returns {EventEmitter} `this`.
9711
+ * @public
9712
+ */
9713
+ EventEmitter.prototype.once = function once(event, fn, context) {
9714
+ return addListener(this, event, fn, context, true);
9715
+ };
9716
+
9717
+ /**
9718
+ * Remove the listeners of a given event.
9719
+ *
9720
+ * @param {(String|Symbol)} event The event name.
9721
+ * @param {Function} fn Only remove the listeners that match this function.
9722
+ * @param {*} context Only remove the listeners that have this context.
9723
+ * @param {Boolean} once Only remove one-time listeners.
9724
+ * @returns {EventEmitter} `this`.
9725
+ * @public
9726
+ */
9727
+ EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
9728
+ var evt = prefix ? prefix + event : event;
9729
+
9730
+ if (!this._events[evt]) return this;
9731
+ if (!fn) {
9732
+ clearEvent(this, evt);
9733
+ return this;
9734
+ }
9735
+
9736
+ var listeners = this._events[evt];
9737
+
9738
+ if (listeners.fn) {
9739
+ if (
9740
+ listeners.fn === fn &&
9741
+ (!once || listeners.once) &&
9742
+ (!context || listeners.context === context)
9743
+ ) {
9744
+ clearEvent(this, evt);
9745
+ }
9746
+ } else {
9747
+ for (var i = 0, events = [], length = listeners.length; i < length; i++) {
9748
+ if (
9749
+ listeners[i].fn !== fn ||
9750
+ (once && !listeners[i].once) ||
9751
+ (context && listeners[i].context !== context)
9752
+ ) {
9753
+ events.push(listeners[i]);
9754
+ }
9755
+ }
9756
+
9757
+ //
9758
+ // Reset the array, or remove it completely if we have no more listeners.
9759
+ //
9760
+ if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
9761
+ else clearEvent(this, evt);
9762
+ }
9763
+
9764
+ return this;
9765
+ };
9766
+
9767
+ /**
9768
+ * Remove all listeners, or those of the specified event.
9769
+ *
9770
+ * @param {(String|Symbol)} [event] The event name.
9771
+ * @returns {EventEmitter} `this`.
9772
+ * @public
9773
+ */
9774
+ EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
9775
+ var evt;
9776
+
9777
+ if (event) {
9778
+ evt = prefix ? prefix + event : event;
9779
+ if (this._events[evt]) clearEvent(this, evt);
9780
+ } else {
9781
+ this._events = new Events();
9782
+ this._eventsCount = 0;
9783
+ }
9784
+
9785
+ return this;
9786
+ };
9787
+
9788
+ //
9789
+ // Alias methods names because people roll like that.
9790
+ //
9791
+ EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
9792
+ EventEmitter.prototype.addListener = EventEmitter.prototype.on;
9793
+
9794
+ //
9795
+ // Expose the prefix.
9796
+ //
9797
+ EventEmitter.prefixed = prefix;
9798
+
9799
+ //
9800
+ // Allow `EventEmitter` to be imported as module namespace.
9801
+ //
9802
+ EventEmitter.EventEmitter = EventEmitter;
9803
+
9804
+ //
9805
+ // Expose the module.
9806
+ //
9807
+ {
9808
+ module.exports = EventEmitter;
9809
+ }
9810
+ } (eventemitter3));
9811
+ return eventemitter3.exports;
9812
+ }
9813
+
9814
+ var eventemitter3Exports = requireEventemitter3();
9815
+ var EventEmitter2 = /*@__PURE__*/index.getDefaultExportFromCjs(eventemitter3Exports);
9816
+
8736
9817
  // src/embedded-provider.ts
8737
9818
 
8738
9819
  // src/constants.ts
@@ -8744,7 +9825,7 @@ var EmbeddedSolanaChain = class {
8744
9825
  this.currentNetworkId = NetworkId.SOLANA_MAINNET;
8745
9826
  this._connected = false;
8746
9827
  this._publicKey = null;
8747
- this.eventEmitter = new index.EventEmitter3();
9828
+ this.eventEmitter = new EventEmitter2();
8748
9829
  this.setupEventListeners();
8749
9830
  this.syncInitialState();
8750
9831
  }
@@ -8768,7 +9849,7 @@ var EmbeddedSolanaChain = class {
8768
9849
  message: messageStr,
8769
9850
  networkId: this.currentNetworkId
8770
9851
  });
8771
- const signature = typeof result.signature === "string" ? new Uint8Array(index.bs58.decode(result.signature)) : result.signature;
9852
+ const signature = typeof result.signature === "string" ? new Uint8Array(bs582.decode(result.signature)) : result.signature;
8772
9853
  return {
8773
9854
  signature,
8774
9855
  publicKey: this._publicKey || ""
@@ -8874,7 +9955,7 @@ var EmbeddedEthereumChain = class {
8874
9955
  this.currentNetworkId = NetworkId.ETHEREUM_MAINNET;
8875
9956
  this._connected = false;
8876
9957
  this._accounts = [];
8877
- this.eventEmitter = new index.EventEmitter3();
9958
+ this.eventEmitter = new EventEmitter2();
8878
9959
  this.setupEventListeners();
8879
9960
  this.syncInitialState();
8880
9961
  }
@@ -9451,7 +10532,7 @@ var EmbeddedProvider$1 = class EmbeddedProvider {
9451
10532
  publicKey: stamperInfo.publicKey,
9452
10533
  platform: platformName
9453
10534
  });
9454
- const base64urlPublicKey = base64urlEncode(index.bs58.decode(stamperInfo.publicKey));
10535
+ const base64urlPublicKey = base64urlEncode(bs582.decode(stamperInfo.publicKey));
9455
10536
  const username = `user-${randomUUID()}`;
9456
10537
  const { organizationId } = await tempClient.createOrganization(organizationName, [
9457
10538
  {
@@ -10040,6 +11121,133 @@ var EmbeddedProvider$1 = class EmbeddedProvider {
10040
11121
  }
10041
11122
  };
10042
11123
 
11124
+ // base-x encoding / decoding
11125
+ // Copyright (c) 2018 base-x contributors
11126
+ // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
11127
+ // Distributed under the MIT software license, see the accompanying
11128
+ // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
11129
+ function base (ALPHABET) {
11130
+ if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
11131
+ const BASE_MAP = new Uint8Array(256);
11132
+ for (let j = 0; j < BASE_MAP.length; j++) {
11133
+ BASE_MAP[j] = 255;
11134
+ }
11135
+ for (let i = 0; i < ALPHABET.length; i++) {
11136
+ const x = ALPHABET.charAt(i);
11137
+ const xc = x.charCodeAt(0);
11138
+ if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
11139
+ BASE_MAP[xc] = i;
11140
+ }
11141
+ const BASE = ALPHABET.length;
11142
+ const LEADER = ALPHABET.charAt(0);
11143
+ const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
11144
+ const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
11145
+ function encode (source) {
11146
+ // eslint-disable-next-line no-empty
11147
+ if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
11148
+ source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
11149
+ } else if (Array.isArray(source)) {
11150
+ source = Uint8Array.from(source);
11151
+ }
11152
+ if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
11153
+ if (source.length === 0) { return '' }
11154
+ // Skip & count leading zeroes.
11155
+ let zeroes = 0;
11156
+ let length = 0;
11157
+ let pbegin = 0;
11158
+ const pend = source.length;
11159
+ while (pbegin !== pend && source[pbegin] === 0) {
11160
+ pbegin++;
11161
+ zeroes++;
11162
+ }
11163
+ // Allocate enough space in big-endian base58 representation.
11164
+ const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
11165
+ const b58 = new Uint8Array(size);
11166
+ // Process the bytes.
11167
+ while (pbegin !== pend) {
11168
+ let carry = source[pbegin];
11169
+ // Apply "b58 = b58 * 256 + ch".
11170
+ let i = 0;
11171
+ for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
11172
+ carry += (256 * b58[it1]) >>> 0;
11173
+ b58[it1] = (carry % BASE) >>> 0;
11174
+ carry = (carry / BASE) >>> 0;
11175
+ }
11176
+ if (carry !== 0) { throw new Error('Non-zero carry') }
11177
+ length = i;
11178
+ pbegin++;
11179
+ }
11180
+ // Skip leading zeroes in base58 result.
11181
+ let it2 = size - length;
11182
+ while (it2 !== size && b58[it2] === 0) {
11183
+ it2++;
11184
+ }
11185
+ // Translate the result into a string.
11186
+ let str = LEADER.repeat(zeroes);
11187
+ for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
11188
+ return str
11189
+ }
11190
+ function decodeUnsafe (source) {
11191
+ if (typeof source !== 'string') { throw new TypeError('Expected String') }
11192
+ if (source.length === 0) { return new Uint8Array() }
11193
+ let psz = 0;
11194
+ // Skip and count leading '1's.
11195
+ let zeroes = 0;
11196
+ let length = 0;
11197
+ while (source[psz] === LEADER) {
11198
+ zeroes++;
11199
+ psz++;
11200
+ }
11201
+ // Allocate enough space in big-endian base256 representation.
11202
+ const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
11203
+ const b256 = new Uint8Array(size);
11204
+ // Process the characters.
11205
+ while (psz < source.length) {
11206
+ // Find code of next character
11207
+ const charCode = source.charCodeAt(psz);
11208
+ // Base map can not be indexed using char code
11209
+ if (charCode > 255) { return }
11210
+ // Decode character
11211
+ let carry = BASE_MAP[charCode];
11212
+ // Invalid character
11213
+ if (carry === 255) { return }
11214
+ let i = 0;
11215
+ for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
11216
+ carry += (BASE * b256[it3]) >>> 0;
11217
+ b256[it3] = (carry % 256) >>> 0;
11218
+ carry = (carry / 256) >>> 0;
11219
+ }
11220
+ if (carry !== 0) { throw new Error('Non-zero carry') }
11221
+ length = i;
11222
+ psz++;
11223
+ }
11224
+ // Skip leading zeroes in b256.
11225
+ let it4 = size - length;
11226
+ while (it4 !== size && b256[it4] === 0) {
11227
+ it4++;
11228
+ }
11229
+ const vch = new Uint8Array(zeroes + (size - it4));
11230
+ let j = zeroes;
11231
+ while (it4 !== size) {
11232
+ vch[j++] = b256[it4++];
11233
+ }
11234
+ return vch
11235
+ }
11236
+ function decode (string) {
11237
+ const buffer = decodeUnsafe(string);
11238
+ if (buffer) { return buffer }
11239
+ throw new Error('Non-base' + BASE + ' character')
11240
+ }
11241
+ return {
11242
+ encode,
11243
+ decodeUnsafe,
11244
+ decode
11245
+ }
11246
+ }
11247
+
11248
+ var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
11249
+ var bs58 = base(ALPHABET);
11250
+
10043
11251
  // src/index.ts
10044
11252
  var IndexedDbStamper = class {
10045
11253
  // Optional for PKI, required for OIDC
@@ -10113,14 +11321,14 @@ var IndexedDbStamper = class {
10113
11321
  const salt = params.type === "OIDC" ? params.salt : this.salt;
10114
11322
  const stampData = stampType === "PKI" ? {
10115
11323
  // Decode base58 public key to bytes, then encode as base64url (consistent with ApiKeyStamper)
10116
- publicKey: base64urlEncode(index.bs58.decode(this.activeKeyPairRecord.keyInfo.publicKey)),
11324
+ publicKey: base64urlEncode(bs58.decode(this.activeKeyPairRecord.keyInfo.publicKey)),
10117
11325
  signature: signatureBase64url,
10118
11326
  kind: "PKI",
10119
11327
  algorithm: this.algorithm
10120
11328
  } : {
10121
11329
  kind: "OIDC",
10122
11330
  idToken,
10123
- publicKey: base64urlEncode(index.bs58.decode(this.activeKeyPairRecord.keyInfo.publicKey)),
11331
+ publicKey: base64urlEncode(bs58.decode(this.activeKeyPairRecord.keyInfo.publicKey)),
10124
11332
  salt,
10125
11333
  algorithm: this.algorithm,
10126
11334
  signature: signatureBase64url
@@ -10223,7 +11431,7 @@ var IndexedDbStamper = class {
10223
11431
  ["sign", "verify"]
10224
11432
  );
10225
11433
  const rawPublicKeyBuffer = await crypto.subtle.exportKey("raw", keyPair.publicKey);
10226
- const publicKeyBase58 = index.bs58.encode(new Uint8Array(rawPublicKeyBuffer));
11434
+ const publicKeyBase58 = bs58.encode(new Uint8Array(rawPublicKeyBuffer));
10227
11435
  const keyIdBuffer = await crypto.subtle.digest("SHA-256", rawPublicKeyBuffer);
10228
11436
  const keyId = base64urlEncode(new Uint8Array(keyIdBuffer)).substring(0, 16);
10229
11437
  const now = Date.now();
@@ -10724,7 +11932,7 @@ async function discoverWallets(addressTypes) {
10724
11932
  var InjectedWalletSolanaChain = class {
10725
11933
  constructor(provider, walletId, walletName) {
10726
11934
  // Expose eventEmitter for testing - allows tests to trigger events directly
10727
- this.eventEmitter = new index.EventEmitter3();
11935
+ this.eventEmitter = new EventEmitter3();
10728
11936
  this._connected = false;
10729
11937
  this._publicKey = null;
10730
11938
  this.provider = provider;
@@ -10966,7 +12174,7 @@ var InjectedWalletSolanaChain = class {
10966
12174
  };
10967
12175
  var WalletStandardSolanaAdapter = class {
10968
12176
  constructor(wallet, walletId, walletName) {
10969
- this.eventEmitter = new index.EventEmitter3();
12177
+ this.eventEmitter = new EventEmitter3();
10970
12178
  this._publicKey = null;
10971
12179
  this.wallet = wallet;
10972
12180
  this.walletId = walletId;
@@ -11142,7 +12350,7 @@ var WalletStandardSolanaAdapter = class {
11142
12350
  throw new Error("No signature found in signAndSendTransaction result");
11143
12351
  }
11144
12352
  const signatureBytes = this.parseUint8Array(signatureOutput.signature);
11145
- const signature = index.bs58.encode(signatureBytes);
12353
+ const signature = bs58$1.encode(signatureBytes);
11146
12354
  return { signature };
11147
12355
  } catch (error) {
11148
12356
  debug.error(DebugCategory.INJECTED_PROVIDER, "Wallet Standard Solana signAndSendTransaction failed", {
@@ -11318,7 +12526,7 @@ var WalletStandardSolanaAdapter = class {
11318
12526
  var InjectedWalletEthereumChain = class {
11319
12527
  constructor(provider, walletId, walletName) {
11320
12528
  // Expose eventEmitter for testing - allows tests to trigger events directly
11321
- this.eventEmitter = new index.EventEmitter3();
12529
+ this.eventEmitter = new EventEmitter3();
11322
12530
  this._connected = false;
11323
12531
  this._chainId = "0x1";
11324
12532
  this._accounts = [];
@@ -15574,4 +16782,4 @@ exports.useModal = useModal;
15574
16782
  exports.usePhantom = usePhantom;
15575
16783
  exports.useSolana = useSolana;
15576
16784
  exports.useTheme = useTheme;
15577
- //# sourceMappingURL=index-BO2G95MR.js.map
16785
+ //# sourceMappingURL=index-De5j2Ofs.js.map