@pooflabs/web 0.0.62 → 0.0.63

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.
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { useContext, createContext, useState, useMemo, useRef, useEffect, useCallback } from 'react';
3
3
  import globalAxios, { isAxiosError } from 'axios';
4
- import { b as bufferExports, a as bs58$1, E as EventEmitter3 } from './index-7_nqSSXr.esm.js';
4
+ import { b as bufferExports, g as getDefaultExportFromCjs } from './index-AjAeq_x4.esm.js';
5
5
  import { Transaction as Transaction$1, VersionedTransaction } from '@solana/web3.js';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
7
  import '@coral-xyz/anchor';
@@ -1130,17 +1130,17 @@ function requireSrc () {
1130
1130
  return src;
1131
1131
  }
1132
1132
 
1133
- var bs58;
1133
+ var bs58$3;
1134
1134
  var hasRequiredBs58;
1135
1135
 
1136
1136
  function requireBs58 () {
1137
- if (hasRequiredBs58) return bs58;
1137
+ if (hasRequiredBs58) return bs58$3;
1138
1138
  hasRequiredBs58 = 1;
1139
1139
  const basex = requireSrc();
1140
1140
  const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
1141
1141
 
1142
- bs58 = basex(ALPHABET);
1143
- return bs58;
1142
+ bs58$3 = basex(ALPHABET);
1143
+ return bs58$3;
1144
1144
  }
1145
1145
 
1146
1146
  requireBs58();
@@ -3100,6 +3100,356 @@ function createAutoConfirmPlugin() {
3100
3100
  };
3101
3101
  }
3102
3102
 
3103
+ var eventemitter3$1 = {exports: {}};
3104
+
3105
+ var hasRequiredEventemitter3$1;
3106
+
3107
+ function requireEventemitter3$1 () {
3108
+ if (hasRequiredEventemitter3$1) return eventemitter3$1.exports;
3109
+ hasRequiredEventemitter3$1 = 1;
3110
+ (function (module) {
3111
+
3112
+ var has = Object.prototype.hasOwnProperty
3113
+ , prefix = '~';
3114
+
3115
+ /**
3116
+ * Constructor to create a storage for our `EE` objects.
3117
+ * An `Events` instance is a plain object whose properties are event names.
3118
+ *
3119
+ * @constructor
3120
+ * @private
3121
+ */
3122
+ function Events() {}
3123
+
3124
+ //
3125
+ // We try to not inherit from `Object.prototype`. In some engines creating an
3126
+ // instance in this way is faster than calling `Object.create(null)` directly.
3127
+ // If `Object.create(null)` is not supported we prefix the event names with a
3128
+ // character to make sure that the built-in object properties are not
3129
+ // overridden or used as an attack vector.
3130
+ //
3131
+ if (Object.create) {
3132
+ Events.prototype = Object.create(null);
3133
+
3134
+ //
3135
+ // This hack is needed because the `__proto__` property is still inherited in
3136
+ // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
3137
+ //
3138
+ if (!new Events().__proto__) prefix = false;
3139
+ }
3140
+
3141
+ /**
3142
+ * Representation of a single event listener.
3143
+ *
3144
+ * @param {Function} fn The listener function.
3145
+ * @param {*} context The context to invoke the listener with.
3146
+ * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
3147
+ * @constructor
3148
+ * @private
3149
+ */
3150
+ function EE(fn, context, once) {
3151
+ this.fn = fn;
3152
+ this.context = context;
3153
+ this.once = once || false;
3154
+ }
3155
+
3156
+ /**
3157
+ * Add a listener for a given event.
3158
+ *
3159
+ * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
3160
+ * @param {(String|Symbol)} event The event name.
3161
+ * @param {Function} fn The listener function.
3162
+ * @param {*} context The context to invoke the listener with.
3163
+ * @param {Boolean} once Specify if the listener is a one-time listener.
3164
+ * @returns {EventEmitter}
3165
+ * @private
3166
+ */
3167
+ function addListener(emitter, event, fn, context, once) {
3168
+ if (typeof fn !== 'function') {
3169
+ throw new TypeError('The listener must be a function');
3170
+ }
3171
+
3172
+ var listener = new EE(fn, context || emitter, once)
3173
+ , evt = prefix ? prefix + event : event;
3174
+
3175
+ if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
3176
+ else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
3177
+ else emitter._events[evt] = [emitter._events[evt], listener];
3178
+
3179
+ return emitter;
3180
+ }
3181
+
3182
+ /**
3183
+ * Clear event by name.
3184
+ *
3185
+ * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
3186
+ * @param {(String|Symbol)} evt The Event name.
3187
+ * @private
3188
+ */
3189
+ function clearEvent(emitter, evt) {
3190
+ if (--emitter._eventsCount === 0) emitter._events = new Events();
3191
+ else delete emitter._events[evt];
3192
+ }
3193
+
3194
+ /**
3195
+ * Minimal `EventEmitter` interface that is molded against the Node.js
3196
+ * `EventEmitter` interface.
3197
+ *
3198
+ * @constructor
3199
+ * @public
3200
+ */
3201
+ function EventEmitter() {
3202
+ this._events = new Events();
3203
+ this._eventsCount = 0;
3204
+ }
3205
+
3206
+ /**
3207
+ * Return an array listing the events for which the emitter has registered
3208
+ * listeners.
3209
+ *
3210
+ * @returns {Array}
3211
+ * @public
3212
+ */
3213
+ EventEmitter.prototype.eventNames = function eventNames() {
3214
+ var names = []
3215
+ , events
3216
+ , name;
3217
+
3218
+ if (this._eventsCount === 0) return names;
3219
+
3220
+ for (name in (events = this._events)) {
3221
+ if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
3222
+ }
3223
+
3224
+ if (Object.getOwnPropertySymbols) {
3225
+ return names.concat(Object.getOwnPropertySymbols(events));
3226
+ }
3227
+
3228
+ return names;
3229
+ };
3230
+
3231
+ /**
3232
+ * Return the listeners registered for a given event.
3233
+ *
3234
+ * @param {(String|Symbol)} event The event name.
3235
+ * @returns {Array} The registered listeners.
3236
+ * @public
3237
+ */
3238
+ EventEmitter.prototype.listeners = function listeners(event) {
3239
+ var evt = prefix ? prefix + event : event
3240
+ , handlers = this._events[evt];
3241
+
3242
+ if (!handlers) return [];
3243
+ if (handlers.fn) return [handlers.fn];
3244
+
3245
+ for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
3246
+ ee[i] = handlers[i].fn;
3247
+ }
3248
+
3249
+ return ee;
3250
+ };
3251
+
3252
+ /**
3253
+ * Return the number of listeners listening to a given event.
3254
+ *
3255
+ * @param {(String|Symbol)} event The event name.
3256
+ * @returns {Number} The number of listeners.
3257
+ * @public
3258
+ */
3259
+ EventEmitter.prototype.listenerCount = function listenerCount(event) {
3260
+ var evt = prefix ? prefix + event : event
3261
+ , listeners = this._events[evt];
3262
+
3263
+ if (!listeners) return 0;
3264
+ if (listeners.fn) return 1;
3265
+ return listeners.length;
3266
+ };
3267
+
3268
+ /**
3269
+ * Calls each of the listeners registered for a given event.
3270
+ *
3271
+ * @param {(String|Symbol)} event The event name.
3272
+ * @returns {Boolean} `true` if the event had listeners, else `false`.
3273
+ * @public
3274
+ */
3275
+ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
3276
+ var evt = prefix ? prefix + event : event;
3277
+
3278
+ if (!this._events[evt]) return false;
3279
+
3280
+ var listeners = this._events[evt]
3281
+ , len = arguments.length
3282
+ , args
3283
+ , i;
3284
+
3285
+ if (listeners.fn) {
3286
+ if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
3287
+
3288
+ switch (len) {
3289
+ case 1: return listeners.fn.call(listeners.context), true;
3290
+ case 2: return listeners.fn.call(listeners.context, a1), true;
3291
+ case 3: return listeners.fn.call(listeners.context, a1, a2), true;
3292
+ case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
3293
+ case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
3294
+ case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
3295
+ }
3296
+
3297
+ for (i = 1, args = new Array(len -1); i < len; i++) {
3298
+ args[i - 1] = arguments[i];
3299
+ }
3300
+
3301
+ listeners.fn.apply(listeners.context, args);
3302
+ } else {
3303
+ var length = listeners.length
3304
+ , j;
3305
+
3306
+ for (i = 0; i < length; i++) {
3307
+ if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
3308
+
3309
+ switch (len) {
3310
+ case 1: listeners[i].fn.call(listeners[i].context); break;
3311
+ case 2: listeners[i].fn.call(listeners[i].context, a1); break;
3312
+ case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
3313
+ case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
3314
+ default:
3315
+ if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
3316
+ args[j - 1] = arguments[j];
3317
+ }
3318
+
3319
+ listeners[i].fn.apply(listeners[i].context, args);
3320
+ }
3321
+ }
3322
+ }
3323
+
3324
+ return true;
3325
+ };
3326
+
3327
+ /**
3328
+ * Add a listener for a given event.
3329
+ *
3330
+ * @param {(String|Symbol)} event The event name.
3331
+ * @param {Function} fn The listener function.
3332
+ * @param {*} [context=this] The context to invoke the listener with.
3333
+ * @returns {EventEmitter} `this`.
3334
+ * @public
3335
+ */
3336
+ EventEmitter.prototype.on = function on(event, fn, context) {
3337
+ return addListener(this, event, fn, context, false);
3338
+ };
3339
+
3340
+ /**
3341
+ * Add a one-time listener for a given event.
3342
+ *
3343
+ * @param {(String|Symbol)} event The event name.
3344
+ * @param {Function} fn The listener function.
3345
+ * @param {*} [context=this] The context to invoke the listener with.
3346
+ * @returns {EventEmitter} `this`.
3347
+ * @public
3348
+ */
3349
+ EventEmitter.prototype.once = function once(event, fn, context) {
3350
+ return addListener(this, event, fn, context, true);
3351
+ };
3352
+
3353
+ /**
3354
+ * Remove the listeners of a given event.
3355
+ *
3356
+ * @param {(String|Symbol)} event The event name.
3357
+ * @param {Function} fn Only remove the listeners that match this function.
3358
+ * @param {*} context Only remove the listeners that have this context.
3359
+ * @param {Boolean} once Only remove one-time listeners.
3360
+ * @returns {EventEmitter} `this`.
3361
+ * @public
3362
+ */
3363
+ EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
3364
+ var evt = prefix ? prefix + event : event;
3365
+
3366
+ if (!this._events[evt]) return this;
3367
+ if (!fn) {
3368
+ clearEvent(this, evt);
3369
+ return this;
3370
+ }
3371
+
3372
+ var listeners = this._events[evt];
3373
+
3374
+ if (listeners.fn) {
3375
+ if (
3376
+ listeners.fn === fn &&
3377
+ (!once || listeners.once) &&
3378
+ (!context || listeners.context === context)
3379
+ ) {
3380
+ clearEvent(this, evt);
3381
+ }
3382
+ } else {
3383
+ for (var i = 0, events = [], length = listeners.length; i < length; i++) {
3384
+ if (
3385
+ listeners[i].fn !== fn ||
3386
+ (once && !listeners[i].once) ||
3387
+ (context && listeners[i].context !== context)
3388
+ ) {
3389
+ events.push(listeners[i]);
3390
+ }
3391
+ }
3392
+
3393
+ //
3394
+ // Reset the array, or remove it completely if we have no more listeners.
3395
+ //
3396
+ if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
3397
+ else clearEvent(this, evt);
3398
+ }
3399
+
3400
+ return this;
3401
+ };
3402
+
3403
+ /**
3404
+ * Remove all listeners, or those of the specified event.
3405
+ *
3406
+ * @param {(String|Symbol)} [event] The event name.
3407
+ * @returns {EventEmitter} `this`.
3408
+ * @public
3409
+ */
3410
+ EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
3411
+ var evt;
3412
+
3413
+ if (event) {
3414
+ evt = prefix ? prefix + event : event;
3415
+ if (this._events[evt]) clearEvent(this, evt);
3416
+ } else {
3417
+ this._events = new Events();
3418
+ this._eventsCount = 0;
3419
+ }
3420
+
3421
+ return this;
3422
+ };
3423
+
3424
+ //
3425
+ // Alias methods names because people roll like that.
3426
+ //
3427
+ EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
3428
+ EventEmitter.prototype.addListener = EventEmitter.prototype.on;
3429
+
3430
+ //
3431
+ // Expose the prefix.
3432
+ //
3433
+ EventEmitter.prefixed = prefix;
3434
+
3435
+ //
3436
+ // Allow `EventEmitter` to be imported as module namespace.
3437
+ //
3438
+ EventEmitter.EventEmitter = EventEmitter;
3439
+
3440
+ //
3441
+ // Expose the module.
3442
+ //
3443
+ {
3444
+ module.exports = EventEmitter;
3445
+ }
3446
+ } (eventemitter3$1));
3447
+ return eventemitter3$1.exports;
3448
+ }
3449
+
3450
+ var eventemitter3Exports$1 = requireEventemitter3$1();
3451
+ var EventEmitter3 = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports$1);
3452
+
3103
3453
  // src/index.ts
3104
3454
  var isBrowser = typeof window !== "undefined" && typeof window.btoa !== "undefined";
3105
3455
  function base64urlEncode(data) {
@@ -8427,6 +8777,133 @@ class Transaction {
8427
8777
  }
8428
8778
  }
8429
8779
 
8780
+ // base-x encoding / decoding
8781
+ // Copyright (c) 2018 base-x contributors
8782
+ // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
8783
+ // Distributed under the MIT software license, see the accompanying
8784
+ // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
8785
+ function base$3 (ALPHABET) {
8786
+ if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
8787
+ const BASE_MAP = new Uint8Array(256);
8788
+ for (let j = 0; j < BASE_MAP.length; j++) {
8789
+ BASE_MAP[j] = 255;
8790
+ }
8791
+ for (let i = 0; i < ALPHABET.length; i++) {
8792
+ const x = ALPHABET.charAt(i);
8793
+ const xc = x.charCodeAt(0);
8794
+ if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
8795
+ BASE_MAP[xc] = i;
8796
+ }
8797
+ const BASE = ALPHABET.length;
8798
+ const LEADER = ALPHABET.charAt(0);
8799
+ const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
8800
+ const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
8801
+ function encode (source) {
8802
+ // eslint-disable-next-line no-empty
8803
+ if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
8804
+ source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
8805
+ } else if (Array.isArray(source)) {
8806
+ source = Uint8Array.from(source);
8807
+ }
8808
+ if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
8809
+ if (source.length === 0) { return '' }
8810
+ // Skip & count leading zeroes.
8811
+ let zeroes = 0;
8812
+ let length = 0;
8813
+ let pbegin = 0;
8814
+ const pend = source.length;
8815
+ while (pbegin !== pend && source[pbegin] === 0) {
8816
+ pbegin++;
8817
+ zeroes++;
8818
+ }
8819
+ // Allocate enough space in big-endian base58 representation.
8820
+ const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
8821
+ const b58 = new Uint8Array(size);
8822
+ // Process the bytes.
8823
+ while (pbegin !== pend) {
8824
+ let carry = source[pbegin];
8825
+ // Apply "b58 = b58 * 256 + ch".
8826
+ let i = 0;
8827
+ for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
8828
+ carry += (256 * b58[it1]) >>> 0;
8829
+ b58[it1] = (carry % BASE) >>> 0;
8830
+ carry = (carry / BASE) >>> 0;
8831
+ }
8832
+ if (carry !== 0) { throw new Error('Non-zero carry') }
8833
+ length = i;
8834
+ pbegin++;
8835
+ }
8836
+ // Skip leading zeroes in base58 result.
8837
+ let it2 = size - length;
8838
+ while (it2 !== size && b58[it2] === 0) {
8839
+ it2++;
8840
+ }
8841
+ // Translate the result into a string.
8842
+ let str = LEADER.repeat(zeroes);
8843
+ for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
8844
+ return str
8845
+ }
8846
+ function decodeUnsafe (source) {
8847
+ if (typeof source !== 'string') { throw new TypeError('Expected String') }
8848
+ if (source.length === 0) { return new Uint8Array() }
8849
+ let psz = 0;
8850
+ // Skip and count leading '1's.
8851
+ let zeroes = 0;
8852
+ let length = 0;
8853
+ while (source[psz] === LEADER) {
8854
+ zeroes++;
8855
+ psz++;
8856
+ }
8857
+ // Allocate enough space in big-endian base256 representation.
8858
+ const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
8859
+ const b256 = new Uint8Array(size);
8860
+ // Process the characters.
8861
+ while (psz < source.length) {
8862
+ // Find code of next character
8863
+ const charCode = source.charCodeAt(psz);
8864
+ // Base map can not be indexed using char code
8865
+ if (charCode > 255) { return }
8866
+ // Decode character
8867
+ let carry = BASE_MAP[charCode];
8868
+ // Invalid character
8869
+ if (carry === 255) { return }
8870
+ let i = 0;
8871
+ for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
8872
+ carry += (BASE * b256[it3]) >>> 0;
8873
+ b256[it3] = (carry % 256) >>> 0;
8874
+ carry = (carry / 256) >>> 0;
8875
+ }
8876
+ if (carry !== 0) { throw new Error('Non-zero carry') }
8877
+ length = i;
8878
+ psz++;
8879
+ }
8880
+ // Skip leading zeroes in b256.
8881
+ let it4 = size - length;
8882
+ while (it4 !== size && b256[it4] === 0) {
8883
+ it4++;
8884
+ }
8885
+ const vch = new Uint8Array(zeroes + (size - it4));
8886
+ let j = zeroes;
8887
+ while (it4 !== size) {
8888
+ vch[j++] = b256[it4++];
8889
+ }
8890
+ return vch
8891
+ }
8892
+ function decode (string) {
8893
+ const buffer = decodeUnsafe(string);
8894
+ if (buffer) { return buffer }
8895
+ throw new Error('Non-base' + BASE + ' character')
8896
+ }
8897
+ return {
8898
+ encode,
8899
+ decodeUnsafe,
8900
+ decode
8901
+ }
8902
+ }
8903
+
8904
+ var ALPHABET$3 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
8905
+ var bs58$2 = base$3(ALPHABET$3);
8906
+
8430
8907
  // src/index.ts
8431
8908
  function parseSignMessageResponse(base64Response, networkId) {
8432
8909
  const networkPrefix = networkId.split(":")[0].toLowerCase();
@@ -8473,7 +8950,7 @@ function parseTransactionResponse(base64RawTransaction, networkId, hash) {
8473
8950
  function parseSolanaSignatureResponse(base64Response) {
8474
8951
  try {
8475
8952
  const signatureBytes = base64urlDecode(base64Response);
8476
- const signature = bs58$1.encode(signatureBytes);
8953
+ const signature = bs58$2.encode(signatureBytes);
8477
8954
  return {
8478
8955
  signature,
8479
8956
  rawSignature: base64Response
@@ -8713,6 +9190,610 @@ function parseBitcoinTransactionToBase64Url(transaction) {
8713
9190
  throw new Error("Unsupported Bitcoin transaction format");
8714
9191
  }
8715
9192
 
9193
+ // base-x encoding / decoding
9194
+ // Copyright (c) 2018 base-x contributors
9195
+ // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
9196
+ // Distributed under the MIT software license, see the accompanying
9197
+ // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
9198
+ function base$2 (ALPHABET) {
9199
+ if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
9200
+ const BASE_MAP = new Uint8Array(256);
9201
+ for (let j = 0; j < BASE_MAP.length; j++) {
9202
+ BASE_MAP[j] = 255;
9203
+ }
9204
+ for (let i = 0; i < ALPHABET.length; i++) {
9205
+ const x = ALPHABET.charAt(i);
9206
+ const xc = x.charCodeAt(0);
9207
+ if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
9208
+ BASE_MAP[xc] = i;
9209
+ }
9210
+ const BASE = ALPHABET.length;
9211
+ const LEADER = ALPHABET.charAt(0);
9212
+ const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
9213
+ const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
9214
+ function encode (source) {
9215
+ // eslint-disable-next-line no-empty
9216
+ if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
9217
+ source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
9218
+ } else if (Array.isArray(source)) {
9219
+ source = Uint8Array.from(source);
9220
+ }
9221
+ if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
9222
+ if (source.length === 0) { return '' }
9223
+ // Skip & count leading zeroes.
9224
+ let zeroes = 0;
9225
+ let length = 0;
9226
+ let pbegin = 0;
9227
+ const pend = source.length;
9228
+ while (pbegin !== pend && source[pbegin] === 0) {
9229
+ pbegin++;
9230
+ zeroes++;
9231
+ }
9232
+ // Allocate enough space in big-endian base58 representation.
9233
+ const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
9234
+ const b58 = new Uint8Array(size);
9235
+ // Process the bytes.
9236
+ while (pbegin !== pend) {
9237
+ let carry = source[pbegin];
9238
+ // Apply "b58 = b58 * 256 + ch".
9239
+ let i = 0;
9240
+ for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
9241
+ carry += (256 * b58[it1]) >>> 0;
9242
+ b58[it1] = (carry % BASE) >>> 0;
9243
+ carry = (carry / BASE) >>> 0;
9244
+ }
9245
+ if (carry !== 0) { throw new Error('Non-zero carry') }
9246
+ length = i;
9247
+ pbegin++;
9248
+ }
9249
+ // Skip leading zeroes in base58 result.
9250
+ let it2 = size - length;
9251
+ while (it2 !== size && b58[it2] === 0) {
9252
+ it2++;
9253
+ }
9254
+ // Translate the result into a string.
9255
+ let str = LEADER.repeat(zeroes);
9256
+ for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
9257
+ return str
9258
+ }
9259
+ function decodeUnsafe (source) {
9260
+ if (typeof source !== 'string') { throw new TypeError('Expected String') }
9261
+ if (source.length === 0) { return new Uint8Array() }
9262
+ let psz = 0;
9263
+ // Skip and count leading '1's.
9264
+ let zeroes = 0;
9265
+ let length = 0;
9266
+ while (source[psz] === LEADER) {
9267
+ zeroes++;
9268
+ psz++;
9269
+ }
9270
+ // Allocate enough space in big-endian base256 representation.
9271
+ const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
9272
+ const b256 = new Uint8Array(size);
9273
+ // Process the characters.
9274
+ while (psz < source.length) {
9275
+ // Find code of next character
9276
+ const charCode = source.charCodeAt(psz);
9277
+ // Base map can not be indexed using char code
9278
+ if (charCode > 255) { return }
9279
+ // Decode character
9280
+ let carry = BASE_MAP[charCode];
9281
+ // Invalid character
9282
+ if (carry === 255) { return }
9283
+ let i = 0;
9284
+ for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
9285
+ carry += (BASE * b256[it3]) >>> 0;
9286
+ b256[it3] = (carry % 256) >>> 0;
9287
+ carry = (carry / 256) >>> 0;
9288
+ }
9289
+ if (carry !== 0) { throw new Error('Non-zero carry') }
9290
+ length = i;
9291
+ psz++;
9292
+ }
9293
+ // Skip leading zeroes in b256.
9294
+ let it4 = size - length;
9295
+ while (it4 !== size && b256[it4] === 0) {
9296
+ it4++;
9297
+ }
9298
+ const vch = new Uint8Array(zeroes + (size - it4));
9299
+ let j = zeroes;
9300
+ while (it4 !== size) {
9301
+ vch[j++] = b256[it4++];
9302
+ }
9303
+ return vch
9304
+ }
9305
+ function decode (string) {
9306
+ const buffer = decodeUnsafe(string);
9307
+ if (buffer) { return buffer }
9308
+ throw new Error('Non-base' + BASE + ' character')
9309
+ }
9310
+ return {
9311
+ encode,
9312
+ decodeUnsafe,
9313
+ decode
9314
+ }
9315
+ }
9316
+
9317
+ var ALPHABET$2 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
9318
+ var bs58$1 = base$2(ALPHABET$2);
9319
+
9320
+ // base-x encoding / decoding
9321
+ // Copyright (c) 2018 base-x contributors
9322
+ // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
9323
+ // Distributed under the MIT software license, see the accompanying
9324
+ // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
9325
+ function base$1 (ALPHABET) {
9326
+ if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
9327
+ const BASE_MAP = new Uint8Array(256);
9328
+ for (let j = 0; j < BASE_MAP.length; j++) {
9329
+ BASE_MAP[j] = 255;
9330
+ }
9331
+ for (let i = 0; i < ALPHABET.length; i++) {
9332
+ const x = ALPHABET.charAt(i);
9333
+ const xc = x.charCodeAt(0);
9334
+ if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
9335
+ BASE_MAP[xc] = i;
9336
+ }
9337
+ const BASE = ALPHABET.length;
9338
+ const LEADER = ALPHABET.charAt(0);
9339
+ const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
9340
+ const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
9341
+ function encode (source) {
9342
+ // eslint-disable-next-line no-empty
9343
+ if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
9344
+ source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
9345
+ } else if (Array.isArray(source)) {
9346
+ source = Uint8Array.from(source);
9347
+ }
9348
+ if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
9349
+ if (source.length === 0) { return '' }
9350
+ // Skip & count leading zeroes.
9351
+ let zeroes = 0;
9352
+ let length = 0;
9353
+ let pbegin = 0;
9354
+ const pend = source.length;
9355
+ while (pbegin !== pend && source[pbegin] === 0) {
9356
+ pbegin++;
9357
+ zeroes++;
9358
+ }
9359
+ // Allocate enough space in big-endian base58 representation.
9360
+ const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
9361
+ const b58 = new Uint8Array(size);
9362
+ // Process the bytes.
9363
+ while (pbegin !== pend) {
9364
+ let carry = source[pbegin];
9365
+ // Apply "b58 = b58 * 256 + ch".
9366
+ let i = 0;
9367
+ for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
9368
+ carry += (256 * b58[it1]) >>> 0;
9369
+ b58[it1] = (carry % BASE) >>> 0;
9370
+ carry = (carry / BASE) >>> 0;
9371
+ }
9372
+ if (carry !== 0) { throw new Error('Non-zero carry') }
9373
+ length = i;
9374
+ pbegin++;
9375
+ }
9376
+ // Skip leading zeroes in base58 result.
9377
+ let it2 = size - length;
9378
+ while (it2 !== size && b58[it2] === 0) {
9379
+ it2++;
9380
+ }
9381
+ // Translate the result into a string.
9382
+ let str = LEADER.repeat(zeroes);
9383
+ for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
9384
+ return str
9385
+ }
9386
+ function decodeUnsafe (source) {
9387
+ if (typeof source !== 'string') { throw new TypeError('Expected String') }
9388
+ if (source.length === 0) { return new Uint8Array() }
9389
+ let psz = 0;
9390
+ // Skip and count leading '1's.
9391
+ let zeroes = 0;
9392
+ let length = 0;
9393
+ while (source[psz] === LEADER) {
9394
+ zeroes++;
9395
+ psz++;
9396
+ }
9397
+ // Allocate enough space in big-endian base256 representation.
9398
+ const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
9399
+ const b256 = new Uint8Array(size);
9400
+ // Process the characters.
9401
+ while (psz < source.length) {
9402
+ // Find code of next character
9403
+ const charCode = source.charCodeAt(psz);
9404
+ // Base map can not be indexed using char code
9405
+ if (charCode > 255) { return }
9406
+ // Decode character
9407
+ let carry = BASE_MAP[charCode];
9408
+ // Invalid character
9409
+ if (carry === 255) { return }
9410
+ let i = 0;
9411
+ for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
9412
+ carry += (BASE * b256[it3]) >>> 0;
9413
+ b256[it3] = (carry % 256) >>> 0;
9414
+ carry = (carry / 256) >>> 0;
9415
+ }
9416
+ if (carry !== 0) { throw new Error('Non-zero carry') }
9417
+ length = i;
9418
+ psz++;
9419
+ }
9420
+ // Skip leading zeroes in b256.
9421
+ let it4 = size - length;
9422
+ while (it4 !== size && b256[it4] === 0) {
9423
+ it4++;
9424
+ }
9425
+ const vch = new Uint8Array(zeroes + (size - it4));
9426
+ let j = zeroes;
9427
+ while (it4 !== size) {
9428
+ vch[j++] = b256[it4++];
9429
+ }
9430
+ return vch
9431
+ }
9432
+ function decode (string) {
9433
+ const buffer = decodeUnsafe(string);
9434
+ if (buffer) { return buffer }
9435
+ throw new Error('Non-base' + BASE + ' character')
9436
+ }
9437
+ return {
9438
+ encode,
9439
+ decodeUnsafe,
9440
+ decode
9441
+ }
9442
+ }
9443
+
9444
+ var ALPHABET$1 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
9445
+ var bs582 = base$1(ALPHABET$1);
9446
+
9447
+ var eventemitter3 = {exports: {}};
9448
+
9449
+ var hasRequiredEventemitter3;
9450
+
9451
+ function requireEventemitter3 () {
9452
+ if (hasRequiredEventemitter3) return eventemitter3.exports;
9453
+ hasRequiredEventemitter3 = 1;
9454
+ (function (module) {
9455
+
9456
+ var has = Object.prototype.hasOwnProperty
9457
+ , prefix = '~';
9458
+
9459
+ /**
9460
+ * Constructor to create a storage for our `EE` objects.
9461
+ * An `Events` instance is a plain object whose properties are event names.
9462
+ *
9463
+ * @constructor
9464
+ * @private
9465
+ */
9466
+ function Events() {}
9467
+
9468
+ //
9469
+ // We try to not inherit from `Object.prototype`. In some engines creating an
9470
+ // instance in this way is faster than calling `Object.create(null)` directly.
9471
+ // If `Object.create(null)` is not supported we prefix the event names with a
9472
+ // character to make sure that the built-in object properties are not
9473
+ // overridden or used as an attack vector.
9474
+ //
9475
+ if (Object.create) {
9476
+ Events.prototype = Object.create(null);
9477
+
9478
+ //
9479
+ // This hack is needed because the `__proto__` property is still inherited in
9480
+ // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
9481
+ //
9482
+ if (!new Events().__proto__) prefix = false;
9483
+ }
9484
+
9485
+ /**
9486
+ * Representation of a single event listener.
9487
+ *
9488
+ * @param {Function} fn The listener function.
9489
+ * @param {*} context The context to invoke the listener with.
9490
+ * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
9491
+ * @constructor
9492
+ * @private
9493
+ */
9494
+ function EE(fn, context, once) {
9495
+ this.fn = fn;
9496
+ this.context = context;
9497
+ this.once = once || false;
9498
+ }
9499
+
9500
+ /**
9501
+ * Add a listener for a given event.
9502
+ *
9503
+ * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
9504
+ * @param {(String|Symbol)} event The event name.
9505
+ * @param {Function} fn The listener function.
9506
+ * @param {*} context The context to invoke the listener with.
9507
+ * @param {Boolean} once Specify if the listener is a one-time listener.
9508
+ * @returns {EventEmitter}
9509
+ * @private
9510
+ */
9511
+ function addListener(emitter, event, fn, context, once) {
9512
+ if (typeof fn !== 'function') {
9513
+ throw new TypeError('The listener must be a function');
9514
+ }
9515
+
9516
+ var listener = new EE(fn, context || emitter, once)
9517
+ , evt = prefix ? prefix + event : event;
9518
+
9519
+ if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
9520
+ else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
9521
+ else emitter._events[evt] = [emitter._events[evt], listener];
9522
+
9523
+ return emitter;
9524
+ }
9525
+
9526
+ /**
9527
+ * Clear event by name.
9528
+ *
9529
+ * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
9530
+ * @param {(String|Symbol)} evt The Event name.
9531
+ * @private
9532
+ */
9533
+ function clearEvent(emitter, evt) {
9534
+ if (--emitter._eventsCount === 0) emitter._events = new Events();
9535
+ else delete emitter._events[evt];
9536
+ }
9537
+
9538
+ /**
9539
+ * Minimal `EventEmitter` interface that is molded against the Node.js
9540
+ * `EventEmitter` interface.
9541
+ *
9542
+ * @constructor
9543
+ * @public
9544
+ */
9545
+ function EventEmitter() {
9546
+ this._events = new Events();
9547
+ this._eventsCount = 0;
9548
+ }
9549
+
9550
+ /**
9551
+ * Return an array listing the events for which the emitter has registered
9552
+ * listeners.
9553
+ *
9554
+ * @returns {Array}
9555
+ * @public
9556
+ */
9557
+ EventEmitter.prototype.eventNames = function eventNames() {
9558
+ var names = []
9559
+ , events
9560
+ , name;
9561
+
9562
+ if (this._eventsCount === 0) return names;
9563
+
9564
+ for (name in (events = this._events)) {
9565
+ if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
9566
+ }
9567
+
9568
+ if (Object.getOwnPropertySymbols) {
9569
+ return names.concat(Object.getOwnPropertySymbols(events));
9570
+ }
9571
+
9572
+ return names;
9573
+ };
9574
+
9575
+ /**
9576
+ * Return the listeners registered for a given event.
9577
+ *
9578
+ * @param {(String|Symbol)} event The event name.
9579
+ * @returns {Array} The registered listeners.
9580
+ * @public
9581
+ */
9582
+ EventEmitter.prototype.listeners = function listeners(event) {
9583
+ var evt = prefix ? prefix + event : event
9584
+ , handlers = this._events[evt];
9585
+
9586
+ if (!handlers) return [];
9587
+ if (handlers.fn) return [handlers.fn];
9588
+
9589
+ for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
9590
+ ee[i] = handlers[i].fn;
9591
+ }
9592
+
9593
+ return ee;
9594
+ };
9595
+
9596
+ /**
9597
+ * Return the number of listeners listening to a given event.
9598
+ *
9599
+ * @param {(String|Symbol)} event The event name.
9600
+ * @returns {Number} The number of listeners.
9601
+ * @public
9602
+ */
9603
+ EventEmitter.prototype.listenerCount = function listenerCount(event) {
9604
+ var evt = prefix ? prefix + event : event
9605
+ , listeners = this._events[evt];
9606
+
9607
+ if (!listeners) return 0;
9608
+ if (listeners.fn) return 1;
9609
+ return listeners.length;
9610
+ };
9611
+
9612
+ /**
9613
+ * Calls each of the listeners registered for a given event.
9614
+ *
9615
+ * @param {(String|Symbol)} event The event name.
9616
+ * @returns {Boolean} `true` if the event had listeners, else `false`.
9617
+ * @public
9618
+ */
9619
+ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
9620
+ var evt = prefix ? prefix + event : event;
9621
+
9622
+ if (!this._events[evt]) return false;
9623
+
9624
+ var listeners = this._events[evt]
9625
+ , len = arguments.length
9626
+ , args
9627
+ , i;
9628
+
9629
+ if (listeners.fn) {
9630
+ if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
9631
+
9632
+ switch (len) {
9633
+ case 1: return listeners.fn.call(listeners.context), true;
9634
+ case 2: return listeners.fn.call(listeners.context, a1), true;
9635
+ case 3: return listeners.fn.call(listeners.context, a1, a2), true;
9636
+ case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
9637
+ case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
9638
+ case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
9639
+ }
9640
+
9641
+ for (i = 1, args = new Array(len -1); i < len; i++) {
9642
+ args[i - 1] = arguments[i];
9643
+ }
9644
+
9645
+ listeners.fn.apply(listeners.context, args);
9646
+ } else {
9647
+ var length = listeners.length
9648
+ , j;
9649
+
9650
+ for (i = 0; i < length; i++) {
9651
+ if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
9652
+
9653
+ switch (len) {
9654
+ case 1: listeners[i].fn.call(listeners[i].context); break;
9655
+ case 2: listeners[i].fn.call(listeners[i].context, a1); break;
9656
+ case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
9657
+ case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
9658
+ default:
9659
+ if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
9660
+ args[j - 1] = arguments[j];
9661
+ }
9662
+
9663
+ listeners[i].fn.apply(listeners[i].context, args);
9664
+ }
9665
+ }
9666
+ }
9667
+
9668
+ return true;
9669
+ };
9670
+
9671
+ /**
9672
+ * Add a listener for a given event.
9673
+ *
9674
+ * @param {(String|Symbol)} event The event name.
9675
+ * @param {Function} fn The listener function.
9676
+ * @param {*} [context=this] The context to invoke the listener with.
9677
+ * @returns {EventEmitter} `this`.
9678
+ * @public
9679
+ */
9680
+ EventEmitter.prototype.on = function on(event, fn, context) {
9681
+ return addListener(this, event, fn, context, false);
9682
+ };
9683
+
9684
+ /**
9685
+ * Add a one-time listener for a given event.
9686
+ *
9687
+ * @param {(String|Symbol)} event The event name.
9688
+ * @param {Function} fn The listener function.
9689
+ * @param {*} [context=this] The context to invoke the listener with.
9690
+ * @returns {EventEmitter} `this`.
9691
+ * @public
9692
+ */
9693
+ EventEmitter.prototype.once = function once(event, fn, context) {
9694
+ return addListener(this, event, fn, context, true);
9695
+ };
9696
+
9697
+ /**
9698
+ * Remove the listeners of a given event.
9699
+ *
9700
+ * @param {(String|Symbol)} event The event name.
9701
+ * @param {Function} fn Only remove the listeners that match this function.
9702
+ * @param {*} context Only remove the listeners that have this context.
9703
+ * @param {Boolean} once Only remove one-time listeners.
9704
+ * @returns {EventEmitter} `this`.
9705
+ * @public
9706
+ */
9707
+ EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
9708
+ var evt = prefix ? prefix + event : event;
9709
+
9710
+ if (!this._events[evt]) return this;
9711
+ if (!fn) {
9712
+ clearEvent(this, evt);
9713
+ return this;
9714
+ }
9715
+
9716
+ var listeners = this._events[evt];
9717
+
9718
+ if (listeners.fn) {
9719
+ if (
9720
+ listeners.fn === fn &&
9721
+ (!once || listeners.once) &&
9722
+ (!context || listeners.context === context)
9723
+ ) {
9724
+ clearEvent(this, evt);
9725
+ }
9726
+ } else {
9727
+ for (var i = 0, events = [], length = listeners.length; i < length; i++) {
9728
+ if (
9729
+ listeners[i].fn !== fn ||
9730
+ (once && !listeners[i].once) ||
9731
+ (context && listeners[i].context !== context)
9732
+ ) {
9733
+ events.push(listeners[i]);
9734
+ }
9735
+ }
9736
+
9737
+ //
9738
+ // Reset the array, or remove it completely if we have no more listeners.
9739
+ //
9740
+ if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
9741
+ else clearEvent(this, evt);
9742
+ }
9743
+
9744
+ return this;
9745
+ };
9746
+
9747
+ /**
9748
+ * Remove all listeners, or those of the specified event.
9749
+ *
9750
+ * @param {(String|Symbol)} [event] The event name.
9751
+ * @returns {EventEmitter} `this`.
9752
+ * @public
9753
+ */
9754
+ EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
9755
+ var evt;
9756
+
9757
+ if (event) {
9758
+ evt = prefix ? prefix + event : event;
9759
+ if (this._events[evt]) clearEvent(this, evt);
9760
+ } else {
9761
+ this._events = new Events();
9762
+ this._eventsCount = 0;
9763
+ }
9764
+
9765
+ return this;
9766
+ };
9767
+
9768
+ //
9769
+ // Alias methods names because people roll like that.
9770
+ //
9771
+ EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
9772
+ EventEmitter.prototype.addListener = EventEmitter.prototype.on;
9773
+
9774
+ //
9775
+ // Expose the prefix.
9776
+ //
9777
+ EventEmitter.prefixed = prefix;
9778
+
9779
+ //
9780
+ // Allow `EventEmitter` to be imported as module namespace.
9781
+ //
9782
+ EventEmitter.EventEmitter = EventEmitter;
9783
+
9784
+ //
9785
+ // Expose the module.
9786
+ //
9787
+ {
9788
+ module.exports = EventEmitter;
9789
+ }
9790
+ } (eventemitter3));
9791
+ return eventemitter3.exports;
9792
+ }
9793
+
9794
+ var eventemitter3Exports = requireEventemitter3();
9795
+ var EventEmitter2 = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
9796
+
8716
9797
  // src/embedded-provider.ts
8717
9798
 
8718
9799
  // src/constants.ts
@@ -8724,7 +9805,7 @@ var EmbeddedSolanaChain = class {
8724
9805
  this.currentNetworkId = NetworkId.SOLANA_MAINNET;
8725
9806
  this._connected = false;
8726
9807
  this._publicKey = null;
8727
- this.eventEmitter = new EventEmitter3();
9808
+ this.eventEmitter = new EventEmitter2();
8728
9809
  this.setupEventListeners();
8729
9810
  this.syncInitialState();
8730
9811
  }
@@ -8748,7 +9829,7 @@ var EmbeddedSolanaChain = class {
8748
9829
  message: messageStr,
8749
9830
  networkId: this.currentNetworkId
8750
9831
  });
8751
- const signature = typeof result.signature === "string" ? new Uint8Array(bs58$1.decode(result.signature)) : result.signature;
9832
+ const signature = typeof result.signature === "string" ? new Uint8Array(bs582.decode(result.signature)) : result.signature;
8752
9833
  return {
8753
9834
  signature,
8754
9835
  publicKey: this._publicKey || ""
@@ -8854,7 +9935,7 @@ var EmbeddedEthereumChain = class {
8854
9935
  this.currentNetworkId = NetworkId.ETHEREUM_MAINNET;
8855
9936
  this._connected = false;
8856
9937
  this._accounts = [];
8857
- this.eventEmitter = new EventEmitter3();
9938
+ this.eventEmitter = new EventEmitter2();
8858
9939
  this.setupEventListeners();
8859
9940
  this.syncInitialState();
8860
9941
  }
@@ -9431,7 +10512,7 @@ var EmbeddedProvider$1 = class EmbeddedProvider {
9431
10512
  publicKey: stamperInfo.publicKey,
9432
10513
  platform: platformName
9433
10514
  });
9434
- const base64urlPublicKey = base64urlEncode(bs58$1.decode(stamperInfo.publicKey));
10515
+ const base64urlPublicKey = base64urlEncode(bs582.decode(stamperInfo.publicKey));
9435
10516
  const username = `user-${randomUUID()}`;
9436
10517
  const { organizationId } = await tempClient.createOrganization(organizationName, [
9437
10518
  {
@@ -10020,6 +11101,133 @@ var EmbeddedProvider$1 = class EmbeddedProvider {
10020
11101
  }
10021
11102
  };
10022
11103
 
11104
+ // base-x encoding / decoding
11105
+ // Copyright (c) 2018 base-x contributors
11106
+ // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
11107
+ // Distributed under the MIT software license, see the accompanying
11108
+ // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
11109
+ function base (ALPHABET) {
11110
+ if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
11111
+ const BASE_MAP = new Uint8Array(256);
11112
+ for (let j = 0; j < BASE_MAP.length; j++) {
11113
+ BASE_MAP[j] = 255;
11114
+ }
11115
+ for (let i = 0; i < ALPHABET.length; i++) {
11116
+ const x = ALPHABET.charAt(i);
11117
+ const xc = x.charCodeAt(0);
11118
+ if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
11119
+ BASE_MAP[xc] = i;
11120
+ }
11121
+ const BASE = ALPHABET.length;
11122
+ const LEADER = ALPHABET.charAt(0);
11123
+ const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
11124
+ const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
11125
+ function encode (source) {
11126
+ // eslint-disable-next-line no-empty
11127
+ if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
11128
+ source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
11129
+ } else if (Array.isArray(source)) {
11130
+ source = Uint8Array.from(source);
11131
+ }
11132
+ if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
11133
+ if (source.length === 0) { return '' }
11134
+ // Skip & count leading zeroes.
11135
+ let zeroes = 0;
11136
+ let length = 0;
11137
+ let pbegin = 0;
11138
+ const pend = source.length;
11139
+ while (pbegin !== pend && source[pbegin] === 0) {
11140
+ pbegin++;
11141
+ zeroes++;
11142
+ }
11143
+ // Allocate enough space in big-endian base58 representation.
11144
+ const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
11145
+ const b58 = new Uint8Array(size);
11146
+ // Process the bytes.
11147
+ while (pbegin !== pend) {
11148
+ let carry = source[pbegin];
11149
+ // Apply "b58 = b58 * 256 + ch".
11150
+ let i = 0;
11151
+ for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
11152
+ carry += (256 * b58[it1]) >>> 0;
11153
+ b58[it1] = (carry % BASE) >>> 0;
11154
+ carry = (carry / BASE) >>> 0;
11155
+ }
11156
+ if (carry !== 0) { throw new Error('Non-zero carry') }
11157
+ length = i;
11158
+ pbegin++;
11159
+ }
11160
+ // Skip leading zeroes in base58 result.
11161
+ let it2 = size - length;
11162
+ while (it2 !== size && b58[it2] === 0) {
11163
+ it2++;
11164
+ }
11165
+ // Translate the result into a string.
11166
+ let str = LEADER.repeat(zeroes);
11167
+ for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
11168
+ return str
11169
+ }
11170
+ function decodeUnsafe (source) {
11171
+ if (typeof source !== 'string') { throw new TypeError('Expected String') }
11172
+ if (source.length === 0) { return new Uint8Array() }
11173
+ let psz = 0;
11174
+ // Skip and count leading '1's.
11175
+ let zeroes = 0;
11176
+ let length = 0;
11177
+ while (source[psz] === LEADER) {
11178
+ zeroes++;
11179
+ psz++;
11180
+ }
11181
+ // Allocate enough space in big-endian base256 representation.
11182
+ const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
11183
+ const b256 = new Uint8Array(size);
11184
+ // Process the characters.
11185
+ while (psz < source.length) {
11186
+ // Find code of next character
11187
+ const charCode = source.charCodeAt(psz);
11188
+ // Base map can not be indexed using char code
11189
+ if (charCode > 255) { return }
11190
+ // Decode character
11191
+ let carry = BASE_MAP[charCode];
11192
+ // Invalid character
11193
+ if (carry === 255) { return }
11194
+ let i = 0;
11195
+ for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
11196
+ carry += (BASE * b256[it3]) >>> 0;
11197
+ b256[it3] = (carry % 256) >>> 0;
11198
+ carry = (carry / 256) >>> 0;
11199
+ }
11200
+ if (carry !== 0) { throw new Error('Non-zero carry') }
11201
+ length = i;
11202
+ psz++;
11203
+ }
11204
+ // Skip leading zeroes in b256.
11205
+ let it4 = size - length;
11206
+ while (it4 !== size && b256[it4] === 0) {
11207
+ it4++;
11208
+ }
11209
+ const vch = new Uint8Array(zeroes + (size - it4));
11210
+ let j = zeroes;
11211
+ while (it4 !== size) {
11212
+ vch[j++] = b256[it4++];
11213
+ }
11214
+ return vch
11215
+ }
11216
+ function decode (string) {
11217
+ const buffer = decodeUnsafe(string);
11218
+ if (buffer) { return buffer }
11219
+ throw new Error('Non-base' + BASE + ' character')
11220
+ }
11221
+ return {
11222
+ encode,
11223
+ decodeUnsafe,
11224
+ decode
11225
+ }
11226
+ }
11227
+
11228
+ var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
11229
+ var bs58 = base(ALPHABET);
11230
+
10023
11231
  // src/index.ts
10024
11232
  var IndexedDbStamper = class {
10025
11233
  // Optional for PKI, required for OIDC
@@ -10093,14 +11301,14 @@ var IndexedDbStamper = class {
10093
11301
  const salt = params.type === "OIDC" ? params.salt : this.salt;
10094
11302
  const stampData = stampType === "PKI" ? {
10095
11303
  // Decode base58 public key to bytes, then encode as base64url (consistent with ApiKeyStamper)
10096
- publicKey: base64urlEncode(bs58$1.decode(this.activeKeyPairRecord.keyInfo.publicKey)),
11304
+ publicKey: base64urlEncode(bs58.decode(this.activeKeyPairRecord.keyInfo.publicKey)),
10097
11305
  signature: signatureBase64url,
10098
11306
  kind: "PKI",
10099
11307
  algorithm: this.algorithm
10100
11308
  } : {
10101
11309
  kind: "OIDC",
10102
11310
  idToken,
10103
- publicKey: base64urlEncode(bs58$1.decode(this.activeKeyPairRecord.keyInfo.publicKey)),
11311
+ publicKey: base64urlEncode(bs58.decode(this.activeKeyPairRecord.keyInfo.publicKey)),
10104
11312
  salt,
10105
11313
  algorithm: this.algorithm,
10106
11314
  signature: signatureBase64url
@@ -10203,7 +11411,7 @@ var IndexedDbStamper = class {
10203
11411
  ["sign", "verify"]
10204
11412
  );
10205
11413
  const rawPublicKeyBuffer = await crypto.subtle.exportKey("raw", keyPair.publicKey);
10206
- const publicKeyBase58 = bs58$1.encode(new Uint8Array(rawPublicKeyBuffer));
11414
+ const publicKeyBase58 = bs58.encode(new Uint8Array(rawPublicKeyBuffer));
10207
11415
  const keyIdBuffer = await crypto.subtle.digest("SHA-256", rawPublicKeyBuffer);
10208
11416
  const keyId = base64urlEncode(new Uint8Array(keyIdBuffer)).substring(0, 16);
10209
11417
  const now = Date.now();
@@ -15533,4 +16741,4 @@ function ConnectBox({ maxWidth = "350px", transparent = false, appIcon, appName
15533
16741
  }
15534
16742
 
15535
16743
  export { DerivationInfoAddressFormatEnum as AddressType, ConnectBox, ConnectButton, DebugLevel, NetworkId, PhantomProvider, darkTheme, debug, isMobileDevice, lightTheme, mergeTheme, useAccounts, useAutoConfirm, useConnect, useDisconnect, useDiscoveredWallets, useEthereum, useIsExtensionInstalled, useIsPhantomLoginAvailable, useModal, usePhantom, useSolana, useTheme };
15536
- //# sourceMappingURL=index-B4o54izZ.esm.js.map
16744
+ //# sourceMappingURL=index-Dcrdb8rn.esm.js.map