@pooflabs/web 0.0.60 → 0.0.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-D15hrtDJ.js → index-BDbuVeBU.js} +710 -958
- package/dist/index-BDbuVeBU.js.map +1 -0
- package/dist/{index-Bt89WhpV.esm.js → index-BcHdE9FZ.esm.js} +710 -957
- package/dist/index-BcHdE9FZ.esm.js.map +1 -0
- package/dist/{index-DzGrm7WK.js → index-D0CV6SvU.js} +1409 -37
- package/dist/index-D0CV6SvU.js.map +1 -0
- package/dist/{index-BU0jcnYK.esm.js → index-Dphggtap.esm.js} +1405 -33
- package/dist/index-Dphggtap.esm.js.map +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/index-BU0jcnYK.esm.js.map +0 -1
- package/dist/index-Bt89WhpV.esm.js.map +0 -1
- package/dist/index-D15hrtDJ.js.map +0 -1
- package/dist/index-DzGrm7WK.js.map +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var globalAxios = require('axios');
|
|
5
|
-
var index = require('./index-
|
|
5
|
+
var index = require('./index-BDbuVeBU.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) {
|
|
@@ -3167,7 +3517,7 @@ function stringToBase64url(str) {
|
|
|
3167
3517
|
/**
|
|
3168
3518
|
* The current version of Ethers.
|
|
3169
3519
|
*/
|
|
3170
|
-
const version = "6.
|
|
3520
|
+
const version = "6.16.0";
|
|
3171
3521
|
|
|
3172
3522
|
/**
|
|
3173
3523
|
* Property helper functions.
|
|
@@ -3374,7 +3724,8 @@ function _getBytes(value, name, copy) {
|
|
|
3374
3724
|
}
|
|
3375
3725
|
return value;
|
|
3376
3726
|
}
|
|
3377
|
-
if (typeof (value) === "string" && value.
|
|
3727
|
+
if (typeof (value) === "string" && (value.length % 2) === 0 &&
|
|
3728
|
+
value.match(/^0x[0-9a-f]*$/i)) {
|
|
3378
3729
|
const result = new Uint8Array((value.length - 2) / 2);
|
|
3379
3730
|
let offset = 2;
|
|
3380
3731
|
for (let i = 0; i < result.length; i++) {
|
|
@@ -3571,6 +3922,10 @@ function toBeHex(_value, _width) {
|
|
|
3571
3922
|
let result = value.toString(16);
|
|
3572
3923
|
{
|
|
3573
3924
|
const width = getNumber(_width, "width");
|
|
3925
|
+
// Special case when both value and width are 0 (see: #5025)
|
|
3926
|
+
if (width === 0 && value === BN_0$3) {
|
|
3927
|
+
return "0x";
|
|
3928
|
+
}
|
|
3574
3929
|
assert(width * 2 >= result.length, `value exceeds width (${width} bytes)`, "NUMERIC_FAULT", {
|
|
3575
3930
|
operation: "toBeHex",
|
|
3576
3931
|
fault: "overflow",
|
|
@@ -3586,10 +3941,11 @@ function toBeHex(_value, _width) {
|
|
|
3586
3941
|
/**
|
|
3587
3942
|
* Converts %%value%% to a Big Endian Uint8Array.
|
|
3588
3943
|
*/
|
|
3589
|
-
function toBeArray(_value) {
|
|
3944
|
+
function toBeArray(_value, _width) {
|
|
3590
3945
|
const value = getUint(_value, "value");
|
|
3591
3946
|
if (value === BN_0$3) {
|
|
3592
|
-
|
|
3947
|
+
const width = 0;
|
|
3948
|
+
return new Uint8Array(width);
|
|
3593
3949
|
}
|
|
3594
3950
|
let hex = value.toString(16);
|
|
3595
3951
|
if (hex.length % 2) {
|
|
@@ -6485,6 +6841,9 @@ const BN_2$1 = BigInt(2);
|
|
|
6485
6841
|
const BN_27$1 = BigInt(27);
|
|
6486
6842
|
const BN_28$1 = BigInt(28);
|
|
6487
6843
|
const BN_35$1 = BigInt(35);
|
|
6844
|
+
const BN_N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
|
|
6845
|
+
const BN_N_2 = BN_N / BN_2$1; // Must be integer (floor) division; do NOT shifts
|
|
6846
|
+
const inspect$1 = Symbol.for("nodejs.util.inspect.custom");
|
|
6488
6847
|
const _guard = {};
|
|
6489
6848
|
function toUint256(value) {
|
|
6490
6849
|
return zeroPadValue(toBeArray(value), 32);
|
|
@@ -6535,7 +6894,8 @@ class Signature {
|
|
|
6535
6894
|
* Returns true if the Signature is valid for [[link-eip-2]] signatures.
|
|
6536
6895
|
*/
|
|
6537
6896
|
isValid() {
|
|
6538
|
-
|
|
6897
|
+
const s = BigInt(this.#s);
|
|
6898
|
+
return (s <= BN_N_2);
|
|
6539
6899
|
}
|
|
6540
6900
|
/**
|
|
6541
6901
|
* The ``v`` value for a signature.
|
|
@@ -6611,8 +6971,26 @@ class Signature {
|
|
|
6611
6971
|
this.#v = v;
|
|
6612
6972
|
this.#networkV = null;
|
|
6613
6973
|
}
|
|
6614
|
-
|
|
6615
|
-
|
|
6974
|
+
/**
|
|
6975
|
+
* Returns the canonical signature.
|
|
6976
|
+
*
|
|
6977
|
+
* This is only necessary when dealing with legacy transaction which
|
|
6978
|
+
* did not enforce canonical S values (i.e. [[link-eip-2]]. Most
|
|
6979
|
+
* developers should never require this.
|
|
6980
|
+
*/
|
|
6981
|
+
getCanonical() {
|
|
6982
|
+
if (this.isValid()) {
|
|
6983
|
+
return this;
|
|
6984
|
+
}
|
|
6985
|
+
// Compute the canonical signature; s' = N - s, v = !v
|
|
6986
|
+
const s = BN_N - BigInt(this._s);
|
|
6987
|
+
const v = (55 - this.v);
|
|
6988
|
+
const result = new Signature(_guard, this.r, toUint256(s), v);
|
|
6989
|
+
// Populate the networkV if necessary
|
|
6990
|
+
if (this.networkV) {
|
|
6991
|
+
result.#networkV = this.networkV;
|
|
6992
|
+
}
|
|
6993
|
+
return result;
|
|
6616
6994
|
}
|
|
6617
6995
|
/**
|
|
6618
6996
|
* Returns a new identical [[Signature]].
|
|
@@ -6635,6 +7013,15 @@ class Signature {
|
|
|
6635
7013
|
r: this.r, s: this._s, v: this.v,
|
|
6636
7014
|
};
|
|
6637
7015
|
}
|
|
7016
|
+
[inspect$1]() {
|
|
7017
|
+
return this.toString();
|
|
7018
|
+
}
|
|
7019
|
+
toString() {
|
|
7020
|
+
if (this.isValid()) {
|
|
7021
|
+
return `Signature { r: ${this.r}, s: ${this._s}, v: ${this.v} }`;
|
|
7022
|
+
}
|
|
7023
|
+
return `Signature { r: ${this.r}, s: ${this._s}, v: ${this.v}, valid: false }`;
|
|
7024
|
+
}
|
|
6638
7025
|
/**
|
|
6639
7026
|
* Compute the chain ID from the ``v`` in a legacy EIP-155 transactions.
|
|
6640
7027
|
*
|
|
@@ -7152,7 +7539,9 @@ const BN_27 = BigInt(27);
|
|
|
7152
7539
|
const BN_28 = BigInt(28);
|
|
7153
7540
|
const BN_35 = BigInt(35);
|
|
7154
7541
|
const BN_MAX_UINT = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
|
7542
|
+
const inspect = Symbol.for("nodejs.util.inspect.custom");
|
|
7155
7543
|
const BLOB_SIZE = 4096 * 32;
|
|
7544
|
+
const CELL_COUNT = 128;
|
|
7156
7545
|
function getKzgLibrary(kzg) {
|
|
7157
7546
|
const blobToKzgCommitment = (blob) => {
|
|
7158
7547
|
if ("computeBlobProof" in kzg) {
|
|
@@ -7276,7 +7665,7 @@ function formatAuthorizationList(value) {
|
|
|
7276
7665
|
formatNumber(a.nonce, "nonce"),
|
|
7277
7666
|
formatNumber(a.signature.yParity, "yParity"),
|
|
7278
7667
|
toBeArray(a.signature.r),
|
|
7279
|
-
toBeArray(a.signature.
|
|
7668
|
+
toBeArray(a.signature._s)
|
|
7280
7669
|
];
|
|
7281
7670
|
});
|
|
7282
7671
|
}
|
|
@@ -7377,7 +7766,7 @@ function _serializeLegacy(tx, sig) {
|
|
|
7377
7766
|
// Add the signature
|
|
7378
7767
|
fields.push(toBeArray(v));
|
|
7379
7768
|
fields.push(toBeArray(sig.r));
|
|
7380
|
-
fields.push(toBeArray(sig.
|
|
7769
|
+
fields.push(toBeArray(sig._s));
|
|
7381
7770
|
return encodeRlp(fields);
|
|
7382
7771
|
}
|
|
7383
7772
|
function _parseEipSignature(tx, fields) {
|
|
@@ -7482,9 +7871,11 @@ function _serializeEip2930(tx, sig) {
|
|
|
7482
7871
|
function _parseEip4844(data) {
|
|
7483
7872
|
let fields = decodeRlp(getBytes(data).slice(1));
|
|
7484
7873
|
let typeName = "3";
|
|
7874
|
+
let blobWrapperVersion = null;
|
|
7485
7875
|
let blobs = null;
|
|
7486
7876
|
// Parse the network format
|
|
7487
7877
|
if (fields.length === 4 && Array.isArray(fields[0])) {
|
|
7878
|
+
// EIP-4844 format with sidecar
|
|
7488
7879
|
typeName = "3 (network format)";
|
|
7489
7880
|
const fBlobs = fields[1], fCommits = fields[2], fProofs = fields[3];
|
|
7490
7881
|
assertArgument(Array.isArray(fBlobs), "invalid network format: blobs not an array", "fields[1]", fBlobs);
|
|
@@ -7502,6 +7893,31 @@ function _parseEip4844(data) {
|
|
|
7502
7893
|
}
|
|
7503
7894
|
fields = fields[0];
|
|
7504
7895
|
}
|
|
7896
|
+
else if (fields.length === 5 && Array.isArray(fields[0])) {
|
|
7897
|
+
// EIP-7594 format with sidecar
|
|
7898
|
+
typeName = "3 (EIP-7594 network format)";
|
|
7899
|
+
blobWrapperVersion = getNumber(fields[1]);
|
|
7900
|
+
const fBlobs = fields[2], fCommits = fields[3], fProofs = fields[4];
|
|
7901
|
+
assertArgument(blobWrapperVersion === 1, `unsupported EIP-7594 network format version: ${blobWrapperVersion}`, "fields[1]", blobWrapperVersion);
|
|
7902
|
+
assertArgument(Array.isArray(fBlobs), "invalid EIP-7594 network format: blobs not an array", "fields[2]", fBlobs);
|
|
7903
|
+
assertArgument(Array.isArray(fCommits), "invalid EIP-7594 network format: commitments not an array", "fields[3]", fCommits);
|
|
7904
|
+
assertArgument(Array.isArray(fProofs), "invalid EIP-7594 network format: proofs not an array", "fields[4]", fProofs);
|
|
7905
|
+
assertArgument(fBlobs.length === fCommits.length, "invalid network format: blobs/commitments length mismatch", "fields", fields);
|
|
7906
|
+
assertArgument(fBlobs.length * CELL_COUNT === fProofs.length, "invalid network format: blobs/proofs length mismatch", "fields", fields);
|
|
7907
|
+
blobs = [];
|
|
7908
|
+
for (let i = 0; i < fBlobs.length; i++) {
|
|
7909
|
+
const proof = [];
|
|
7910
|
+
for (let j = 0; j < CELL_COUNT; j++) {
|
|
7911
|
+
proof.push(fProofs[(i * CELL_COUNT) + j]);
|
|
7912
|
+
}
|
|
7913
|
+
blobs.push({
|
|
7914
|
+
data: fBlobs[i],
|
|
7915
|
+
commitment: fCommits[i],
|
|
7916
|
+
proof: concat(proof)
|
|
7917
|
+
});
|
|
7918
|
+
}
|
|
7919
|
+
fields = fields[0];
|
|
7920
|
+
}
|
|
7505
7921
|
assertArgument(Array.isArray(fields) && (fields.length === 11 || fields.length === 14), `invalid field count for transaction type: ${typeName}`, "data", hexlify(data));
|
|
7506
7922
|
const tx = {
|
|
7507
7923
|
type: 3,
|
|
@@ -7516,7 +7932,8 @@ function _parseEip4844(data) {
|
|
|
7516
7932
|
data: hexlify(fields[7]),
|
|
7517
7933
|
accessList: handleAccessList(fields[8], "accessList"),
|
|
7518
7934
|
maxFeePerBlobGas: handleUint(fields[9], "maxFeePerBlobGas"),
|
|
7519
|
-
blobVersionedHashes: fields[10]
|
|
7935
|
+
blobVersionedHashes: fields[10],
|
|
7936
|
+
blobWrapperVersion
|
|
7520
7937
|
};
|
|
7521
7938
|
if (blobs) {
|
|
7522
7939
|
tx.blobs = blobs;
|
|
@@ -7556,6 +7973,29 @@ function _serializeEip4844(tx, sig, blobs) {
|
|
|
7556
7973
|
fields.push(toBeArray(sig.s));
|
|
7557
7974
|
// We have blobs; return the network wrapped format
|
|
7558
7975
|
if (blobs) {
|
|
7976
|
+
// Use EIP-7594
|
|
7977
|
+
if (tx.blobWrapperVersion != null) {
|
|
7978
|
+
const wrapperVersion = toBeArray(tx.blobWrapperVersion);
|
|
7979
|
+
const cellProofs = [];
|
|
7980
|
+
for (const { proof } of blobs) {
|
|
7981
|
+
const p = getBytes(proof);
|
|
7982
|
+
const cellSize = p.length / CELL_COUNT;
|
|
7983
|
+
for (let i = 0; i < p.length; i += cellSize) {
|
|
7984
|
+
cellProofs.push(p.subarray(i, i + cellSize));
|
|
7985
|
+
}
|
|
7986
|
+
}
|
|
7987
|
+
return concat([
|
|
7988
|
+
"0x03",
|
|
7989
|
+
encodeRlp([
|
|
7990
|
+
fields,
|
|
7991
|
+
wrapperVersion,
|
|
7992
|
+
blobs.map((b) => b.data),
|
|
7993
|
+
blobs.map((b) => b.commitment),
|
|
7994
|
+
cellProofs
|
|
7995
|
+
])
|
|
7996
|
+
]);
|
|
7997
|
+
}
|
|
7998
|
+
// Fall back onto classic EIP-4844 behavior
|
|
7559
7999
|
return concat([
|
|
7560
8000
|
"0x03",
|
|
7561
8001
|
encodeRlp([
|
|
@@ -7644,6 +8084,7 @@ class Transaction {
|
|
|
7644
8084
|
#kzg;
|
|
7645
8085
|
#blobs;
|
|
7646
8086
|
#auths;
|
|
8087
|
+
#blobWrapperVersion;
|
|
7647
8088
|
/**
|
|
7648
8089
|
* The transaction type.
|
|
7649
8090
|
*
|
|
@@ -7796,6 +8237,21 @@ class Transaction {
|
|
|
7796
8237
|
set signature(value) {
|
|
7797
8238
|
this.#sig = (value == null) ? null : Signature.from(value);
|
|
7798
8239
|
}
|
|
8240
|
+
isValid() {
|
|
8241
|
+
const sig = this.signature;
|
|
8242
|
+
if (sig && !sig.isValid()) {
|
|
8243
|
+
return false;
|
|
8244
|
+
}
|
|
8245
|
+
const auths = this.authorizationList;
|
|
8246
|
+
if (auths) {
|
|
8247
|
+
for (const auth of auths) {
|
|
8248
|
+
if (!auth.signature.isValid()) {
|
|
8249
|
+
return false;
|
|
8250
|
+
}
|
|
8251
|
+
}
|
|
8252
|
+
}
|
|
8253
|
+
return true;
|
|
8254
|
+
}
|
|
7799
8255
|
/**
|
|
7800
8256
|
* The access list.
|
|
7801
8257
|
*
|
|
@@ -7931,13 +8387,11 @@ class Transaction {
|
|
|
7931
8387
|
versionedHashes.push(getVersionedHash(1, commit));
|
|
7932
8388
|
}
|
|
7933
8389
|
else {
|
|
7934
|
-
const
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
});
|
|
7940
|
-
versionedHashes.push(getVersionedHash(1, commit));
|
|
8390
|
+
const data = hexlify(blob.data);
|
|
8391
|
+
const commitment = hexlify(blob.commitment);
|
|
8392
|
+
const proof = hexlify(blob.proof);
|
|
8393
|
+
blobs.push({ data, commitment, proof });
|
|
8394
|
+
versionedHashes.push(getVersionedHash(1, commitment));
|
|
7941
8395
|
}
|
|
7942
8396
|
}
|
|
7943
8397
|
this.#blobs = blobs;
|
|
@@ -7952,6 +8406,12 @@ class Transaction {
|
|
|
7952
8406
|
this.#kzg = getKzgLibrary(kzg);
|
|
7953
8407
|
}
|
|
7954
8408
|
}
|
|
8409
|
+
get blobWrapperVersion() {
|
|
8410
|
+
return this.#blobWrapperVersion;
|
|
8411
|
+
}
|
|
8412
|
+
set blobWrapperVersion(value) {
|
|
8413
|
+
this.#blobWrapperVersion = value;
|
|
8414
|
+
}
|
|
7955
8415
|
/**
|
|
7956
8416
|
* Creates a new Transaction with default values.
|
|
7957
8417
|
*/
|
|
@@ -7973,6 +8433,7 @@ class Transaction {
|
|
|
7973
8433
|
this.#kzg = null;
|
|
7974
8434
|
this.#blobs = null;
|
|
7975
8435
|
this.#auths = null;
|
|
8436
|
+
this.#blobWrapperVersion = null;
|
|
7976
8437
|
}
|
|
7977
8438
|
/**
|
|
7978
8439
|
* The transaction hash, if signed. Otherwise, ``null``.
|
|
@@ -7999,7 +8460,7 @@ class Transaction {
|
|
|
7999
8460
|
if (this.signature == null) {
|
|
8000
8461
|
return null;
|
|
8001
8462
|
}
|
|
8002
|
-
return recoverAddress(this.unsignedHash, this.signature);
|
|
8463
|
+
return recoverAddress(this.unsignedHash, this.signature.getCanonical());
|
|
8003
8464
|
}
|
|
8004
8465
|
/**
|
|
8005
8466
|
* The public key of the sender, if signed. Otherwise, ``null``.
|
|
@@ -8008,7 +8469,7 @@ class Transaction {
|
|
|
8008
8469
|
if (this.signature == null) {
|
|
8009
8470
|
return null;
|
|
8010
8471
|
}
|
|
8011
|
-
return SigningKey.recoverPublicKey(this.unsignedHash, this.signature);
|
|
8472
|
+
return SigningKey.recoverPublicKey(this.unsignedHash, this.signature.getCanonical());
|
|
8012
8473
|
}
|
|
8013
8474
|
/**
|
|
8014
8475
|
* Returns true if signed.
|
|
@@ -8195,6 +8656,56 @@ class Transaction {
|
|
|
8195
8656
|
accessList: this.accessList
|
|
8196
8657
|
};
|
|
8197
8658
|
}
|
|
8659
|
+
[inspect]() {
|
|
8660
|
+
return this.toString();
|
|
8661
|
+
}
|
|
8662
|
+
toString() {
|
|
8663
|
+
const output = [];
|
|
8664
|
+
const add = (key) => {
|
|
8665
|
+
let value = this[key];
|
|
8666
|
+
if (typeof (value) === "string") {
|
|
8667
|
+
value = JSON.stringify(value);
|
|
8668
|
+
}
|
|
8669
|
+
output.push(`${key}: ${value}`);
|
|
8670
|
+
};
|
|
8671
|
+
if (this.type) {
|
|
8672
|
+
add("type");
|
|
8673
|
+
}
|
|
8674
|
+
add("to");
|
|
8675
|
+
add("data");
|
|
8676
|
+
add("nonce");
|
|
8677
|
+
add("gasLimit");
|
|
8678
|
+
add("value");
|
|
8679
|
+
if (this.chainId != null) {
|
|
8680
|
+
add("chainId");
|
|
8681
|
+
}
|
|
8682
|
+
if (this.signature) {
|
|
8683
|
+
add("from");
|
|
8684
|
+
output.push(`signature: ${this.signature.toString()}`);
|
|
8685
|
+
}
|
|
8686
|
+
// @TODO: accessList
|
|
8687
|
+
// @TODO: blobs (might make output huge; maybe just include a flag?)
|
|
8688
|
+
const auths = this.authorizationList;
|
|
8689
|
+
if (auths) {
|
|
8690
|
+
const outputAuths = [];
|
|
8691
|
+
for (const auth of auths) {
|
|
8692
|
+
const o = [];
|
|
8693
|
+
o.push(`address: ${JSON.stringify(auth.address)}`);
|
|
8694
|
+
if (auth.nonce != null) {
|
|
8695
|
+
o.push(`nonce: ${auth.nonce}`);
|
|
8696
|
+
}
|
|
8697
|
+
if (auth.chainId != null) {
|
|
8698
|
+
o.push(`chainId: ${auth.chainId}`);
|
|
8699
|
+
}
|
|
8700
|
+
if (auth.signature) {
|
|
8701
|
+
o.push(`signature: ${auth.signature.toString()}`);
|
|
8702
|
+
}
|
|
8703
|
+
outputAuths.push(`Authorization { ${o.join(", ")} }`);
|
|
8704
|
+
}
|
|
8705
|
+
output.push(`authorizations: [ ${outputAuths.join(", ")} ]`);
|
|
8706
|
+
}
|
|
8707
|
+
return `Transaction { ${output.join(", ")} }`;
|
|
8708
|
+
}
|
|
8198
8709
|
/**
|
|
8199
8710
|
* Create a **Transaction** from a serialized transaction or a
|
|
8200
8711
|
* Transaction-like object.
|
|
@@ -8268,6 +8779,9 @@ class Transaction {
|
|
|
8268
8779
|
if (tx.kzg != null) {
|
|
8269
8780
|
result.kzg = tx.kzg;
|
|
8270
8781
|
}
|
|
8782
|
+
if (tx.blobWrapperVersion != null) {
|
|
8783
|
+
result.blobWrapperVersion = tx.blobWrapperVersion;
|
|
8784
|
+
}
|
|
8271
8785
|
if (tx.blobs != null) {
|
|
8272
8786
|
result.blobs = tx.blobs;
|
|
8273
8787
|
}
|
|
@@ -8283,6 +8797,133 @@ class Transaction {
|
|
|
8283
8797
|
}
|
|
8284
8798
|
}
|
|
8285
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
|
+
|
|
8286
8927
|
// src/index.ts
|
|
8287
8928
|
function parseSignMessageResponse(base64Response, networkId) {
|
|
8288
8929
|
const networkPrefix = networkId.split(":")[0].toLowerCase();
|
|
@@ -8329,7 +8970,7 @@ function parseTransactionResponse(base64RawTransaction, networkId, hash) {
|
|
|
8329
8970
|
function parseSolanaSignatureResponse(base64Response) {
|
|
8330
8971
|
try {
|
|
8331
8972
|
const signatureBytes = base64urlDecode(base64Response);
|
|
8332
|
-
const signature =
|
|
8973
|
+
const signature = bs58$2.encode(signatureBytes);
|
|
8333
8974
|
return {
|
|
8334
8975
|
signature,
|
|
8335
8976
|
rawSignature: base64Response
|
|
@@ -8569,6 +9210,610 @@ function parseBitcoinTransactionToBase64Url(transaction) {
|
|
|
8569
9210
|
throw new Error("Unsupported Bitcoin transaction format");
|
|
8570
9211
|
}
|
|
8571
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
|
+
|
|
8572
9817
|
// src/embedded-provider.ts
|
|
8573
9818
|
|
|
8574
9819
|
// src/constants.ts
|
|
@@ -8580,7 +9825,7 @@ var EmbeddedSolanaChain = class {
|
|
|
8580
9825
|
this.currentNetworkId = NetworkId.SOLANA_MAINNET;
|
|
8581
9826
|
this._connected = false;
|
|
8582
9827
|
this._publicKey = null;
|
|
8583
|
-
this.eventEmitter = new
|
|
9828
|
+
this.eventEmitter = new EventEmitter2();
|
|
8584
9829
|
this.setupEventListeners();
|
|
8585
9830
|
this.syncInitialState();
|
|
8586
9831
|
}
|
|
@@ -8604,7 +9849,7 @@ var EmbeddedSolanaChain = class {
|
|
|
8604
9849
|
message: messageStr,
|
|
8605
9850
|
networkId: this.currentNetworkId
|
|
8606
9851
|
});
|
|
8607
|
-
const signature = typeof result.signature === "string" ? new Uint8Array(
|
|
9852
|
+
const signature = typeof result.signature === "string" ? new Uint8Array(bs582.decode(result.signature)) : result.signature;
|
|
8608
9853
|
return {
|
|
8609
9854
|
signature,
|
|
8610
9855
|
publicKey: this._publicKey || ""
|
|
@@ -8710,7 +9955,7 @@ var EmbeddedEthereumChain = class {
|
|
|
8710
9955
|
this.currentNetworkId = NetworkId.ETHEREUM_MAINNET;
|
|
8711
9956
|
this._connected = false;
|
|
8712
9957
|
this._accounts = [];
|
|
8713
|
-
this.eventEmitter = new
|
|
9958
|
+
this.eventEmitter = new EventEmitter2();
|
|
8714
9959
|
this.setupEventListeners();
|
|
8715
9960
|
this.syncInitialState();
|
|
8716
9961
|
}
|
|
@@ -9287,7 +10532,7 @@ var EmbeddedProvider$1 = class EmbeddedProvider {
|
|
|
9287
10532
|
publicKey: stamperInfo.publicKey,
|
|
9288
10533
|
platform: platformName
|
|
9289
10534
|
});
|
|
9290
|
-
const base64urlPublicKey = base64urlEncode(
|
|
10535
|
+
const base64urlPublicKey = base64urlEncode(bs582.decode(stamperInfo.publicKey));
|
|
9291
10536
|
const username = `user-${randomUUID()}`;
|
|
9292
10537
|
const { organizationId } = await tempClient.createOrganization(organizationName, [
|
|
9293
10538
|
{
|
|
@@ -9876,6 +11121,133 @@ var EmbeddedProvider$1 = class EmbeddedProvider {
|
|
|
9876
11121
|
}
|
|
9877
11122
|
};
|
|
9878
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
|
+
|
|
9879
11251
|
// src/index.ts
|
|
9880
11252
|
var IndexedDbStamper = class {
|
|
9881
11253
|
// Optional for PKI, required for OIDC
|
|
@@ -9949,14 +11321,14 @@ var IndexedDbStamper = class {
|
|
|
9949
11321
|
const salt = params.type === "OIDC" ? params.salt : this.salt;
|
|
9950
11322
|
const stampData = stampType === "PKI" ? {
|
|
9951
11323
|
// Decode base58 public key to bytes, then encode as base64url (consistent with ApiKeyStamper)
|
|
9952
|
-
publicKey: base64urlEncode(
|
|
11324
|
+
publicKey: base64urlEncode(bs58.decode(this.activeKeyPairRecord.keyInfo.publicKey)),
|
|
9953
11325
|
signature: signatureBase64url,
|
|
9954
11326
|
kind: "PKI",
|
|
9955
11327
|
algorithm: this.algorithm
|
|
9956
11328
|
} : {
|
|
9957
11329
|
kind: "OIDC",
|
|
9958
11330
|
idToken,
|
|
9959
|
-
publicKey: base64urlEncode(
|
|
11331
|
+
publicKey: base64urlEncode(bs58.decode(this.activeKeyPairRecord.keyInfo.publicKey)),
|
|
9960
11332
|
salt,
|
|
9961
11333
|
algorithm: this.algorithm,
|
|
9962
11334
|
signature: signatureBase64url
|
|
@@ -10059,7 +11431,7 @@ var IndexedDbStamper = class {
|
|
|
10059
11431
|
["sign", "verify"]
|
|
10060
11432
|
);
|
|
10061
11433
|
const rawPublicKeyBuffer = await crypto.subtle.exportKey("raw", keyPair.publicKey);
|
|
10062
|
-
const publicKeyBase58 =
|
|
11434
|
+
const publicKeyBase58 = bs58.encode(new Uint8Array(rawPublicKeyBuffer));
|
|
10063
11435
|
const keyIdBuffer = await crypto.subtle.digest("SHA-256", rawPublicKeyBuffer);
|
|
10064
11436
|
const keyId = base64urlEncode(new Uint8Array(keyIdBuffer)).substring(0, 16);
|
|
10065
11437
|
const now = Date.now();
|
|
@@ -10560,7 +11932,7 @@ async function discoverWallets(addressTypes) {
|
|
|
10560
11932
|
var InjectedWalletSolanaChain = class {
|
|
10561
11933
|
constructor(provider, walletId, walletName) {
|
|
10562
11934
|
// Expose eventEmitter for testing - allows tests to trigger events directly
|
|
10563
|
-
this.eventEmitter = new
|
|
11935
|
+
this.eventEmitter = new EventEmitter3();
|
|
10564
11936
|
this._connected = false;
|
|
10565
11937
|
this._publicKey = null;
|
|
10566
11938
|
this.provider = provider;
|
|
@@ -10802,7 +12174,7 @@ var InjectedWalletSolanaChain = class {
|
|
|
10802
12174
|
};
|
|
10803
12175
|
var WalletStandardSolanaAdapter = class {
|
|
10804
12176
|
constructor(wallet, walletId, walletName) {
|
|
10805
|
-
this.eventEmitter = new
|
|
12177
|
+
this.eventEmitter = new EventEmitter3();
|
|
10806
12178
|
this._publicKey = null;
|
|
10807
12179
|
this.wallet = wallet;
|
|
10808
12180
|
this.walletId = walletId;
|
|
@@ -10978,7 +12350,7 @@ var WalletStandardSolanaAdapter = class {
|
|
|
10978
12350
|
throw new Error("No signature found in signAndSendTransaction result");
|
|
10979
12351
|
}
|
|
10980
12352
|
const signatureBytes = this.parseUint8Array(signatureOutput.signature);
|
|
10981
|
-
const signature =
|
|
12353
|
+
const signature = bs58$1.encode(signatureBytes);
|
|
10982
12354
|
return { signature };
|
|
10983
12355
|
} catch (error) {
|
|
10984
12356
|
debug.error(DebugCategory.INJECTED_PROVIDER, "Wallet Standard Solana signAndSendTransaction failed", {
|
|
@@ -11154,7 +12526,7 @@ var WalletStandardSolanaAdapter = class {
|
|
|
11154
12526
|
var InjectedWalletEthereumChain = class {
|
|
11155
12527
|
constructor(provider, walletId, walletName) {
|
|
11156
12528
|
// Expose eventEmitter for testing - allows tests to trigger events directly
|
|
11157
|
-
this.eventEmitter = new
|
|
12529
|
+
this.eventEmitter = new EventEmitter3();
|
|
11158
12530
|
this._connected = false;
|
|
11159
12531
|
this._chainId = "0x1";
|
|
11160
12532
|
this._accounts = [];
|
|
@@ -15410,4 +16782,4 @@ exports.useModal = useModal;
|
|
|
15410
16782
|
exports.usePhantom = usePhantom;
|
|
15411
16783
|
exports.useSolana = useSolana;
|
|
15412
16784
|
exports.useTheme = useTheme;
|
|
15413
|
-
//# sourceMappingURL=index-
|
|
16785
|
+
//# sourceMappingURL=index-D0CV6SvU.js.map
|