@pooflabs/web 0.0.78 → 0.0.79
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-6pNPzV1t.esm.js +6 -0
- package/dist/index-6pNPzV1t.esm.js.map +1 -0
- package/dist/{index-DE7k2G22.js → index-BHGEc97p.js} +883 -25
- package/dist/index-BHGEc97p.js.map +1 -0
- package/dist/{index-OAJ0rndN.esm.js → index-CiwYJvf8.esm.js} +882 -24
- package/dist/index-CiwYJvf8.esm.js.map +1 -0
- package/dist/{index-CwGoYY0Y.esm.js → index-CsIXFm8d.esm.js} +335 -517
- package/dist/index-CsIXFm8d.esm.js.map +1 -0
- package/dist/index-D9BY44i-.js +8 -0
- package/dist/index-D9BY44i-.js.map +1 -0
- package/dist/{index-Cp727oEW.js → index-DwU9hjtr.js} +334 -517
- package/dist/index-DwU9hjtr.js.map +1 -0
- package/dist/{index-Cmu0PVJD.esm.js → index-U-xlsKRI.esm.js} +881 -23
- package/dist/index-U-xlsKRI.esm.js.map +1 -0
- package/dist/{index-CKaaE12K.js → index-zS_Y-wbi.js} +882 -24
- package/dist/index-zS_Y-wbi.js.map +1 -0
- package/dist/{index.browser-DFeGGyO7.esm.js → index.browser-C9bFQZyQ.esm.js} +128 -5
- package/dist/index.browser-C9bFQZyQ.esm.js.map +1 -0
- package/dist/{index.browser-B4een3Gz.esm.js → index.browser-CMEwqnEe.esm.js} +2 -2
- package/dist/{index.browser-B4een3Gz.esm.js.map → index.browser-CMEwqnEe.esm.js.map} +1 -1
- package/dist/{index.browser-AZQ5TnZ4.js → index.browser-Cpi4W_1r.js} +2 -2
- package/dist/{index.browser-AZQ5TnZ4.js.map → index.browser-Cpi4W_1r.js.map} +1 -1
- package/dist/{index.browser-x87QUr4N.esm.js → index.browser-Dbq5Qf1G.esm.js} +128 -5
- package/dist/index.browser-Dbq5Qf1G.esm.js.map +1 -0
- package/dist/{index.browser-BMtEulGJ.js → index.browser-Df7yN8D5.js} +129 -6
- package/dist/index.browser-Df7yN8D5.js.map +1 -0
- package/dist/{index.browser-QPkAiPQp.js → index.browser-dszs5oe5.js} +129 -6
- package/dist/index.browser-dszs5oe5.js.map +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{index.native-CjEJXA9y.esm.js → index.native-CEf5PJ_g.esm.js} +2690 -550
- package/dist/index.native-CEf5PJ_g.esm.js.map +1 -0
- package/dist/{index.native-D7IrIMX1.js → index.native-DtxPWD00.js} +2690 -549
- package/dist/index.native-DtxPWD00.js.map +1 -0
- package/dist/index.native.esm.js +1 -1
- package/dist/index.native.js +1 -1
- package/dist/{phantom-wallet-provider-B1TleWsy.esm.js → phantom-wallet-provider-B0UmUtfB.esm.js} +51 -4
- package/dist/{phantom-wallet-provider-B1TleWsy.esm.js.map → phantom-wallet-provider-B0UmUtfB.esm.js.map} +1 -1
- package/dist/{phantom-wallet-provider-DwmdHVd-.js → phantom-wallet-provider-BbyQIlro.js} +51 -4
- package/dist/{phantom-wallet-provider-DwmdHVd-.js.map → phantom-wallet-provider-BbyQIlro.js.map} +1 -1
- package/dist/{privy-wallet-provider-Cf6WgpK1.js → privy-wallet-provider-CoQzq0F4.js} +3 -3
- package/dist/privy-wallet-provider-CoQzq0F4.js.map +1 -0
- package/dist/{privy-wallet-provider-CZgiUwUN.esm.js → privy-wallet-provider-DGjYglh7.esm.js} +3 -3
- package/dist/privy-wallet-provider-DGjYglh7.esm.js.map +1 -0
- package/dist/{solana-mobile-wallet-provider-DZmpeNIS.js → solana-mobile-wallet-provider-BLoovRsJ.js} +4 -4
- package/dist/{solana-mobile-wallet-provider-DZmpeNIS.js.map → solana-mobile-wallet-provider-BLoovRsJ.js.map} +1 -1
- package/dist/{solana-mobile-wallet-provider-C9j8O3mD.esm.js → solana-mobile-wallet-provider-DIyP-Az5.esm.js} +4 -4
- package/dist/{solana-mobile-wallet-provider-C9j8O3mD.esm.js.map → solana-mobile-wallet-provider-DIyP-Az5.esm.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-Bdcc5821.js +0 -2375
- package/dist/index-Bdcc5821.js.map +0 -1
- package/dist/index-CKaaE12K.js.map +0 -1
- package/dist/index-Cmu0PVJD.esm.js.map +0 -1
- package/dist/index-Cp727oEW.js.map +0 -1
- package/dist/index-CrOVJFX9.esm.js +0 -2373
- package/dist/index-CrOVJFX9.esm.js.map +0 -1
- package/dist/index-CwGoYY0Y.esm.js.map +0 -1
- package/dist/index-DE7k2G22.js.map +0 -1
- package/dist/index-OAJ0rndN.esm.js.map +0 -1
- package/dist/index.browser-BMtEulGJ.js.map +0 -1
- package/dist/index.browser-DFeGGyO7.esm.js.map +0 -1
- package/dist/index.browser-QPkAiPQp.js.map +0 -1
- package/dist/index.browser-x87QUr4N.esm.js.map +0 -1
- package/dist/index.native-CjEJXA9y.esm.js.map +0 -1
- package/dist/index.native-D7IrIMX1.js.map +0 -1
- package/dist/privy-wallet-provider-CZgiUwUN.esm.js.map +0 -1
- package/dist/privy-wallet-provider-Cf6WgpK1.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
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 } from './index-
|
|
5
|
-
import {
|
|
4
|
+
import { b as bufferExports } from './index-6pNPzV1t.esm.js';
|
|
5
|
+
import { p as getDefaultExportFromCjs } from './index.native-CEf5PJ_g.esm.js';
|
|
6
6
|
import { Transaction as Transaction$1, VersionedTransaction } from '@solana/web3.js';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
8
|
import '@coral-xyz/anchor';
|
|
@@ -1131,17 +1131,17 @@ function requireSrc () {
|
|
|
1131
1131
|
return src;
|
|
1132
1132
|
}
|
|
1133
1133
|
|
|
1134
|
-
var bs58;
|
|
1134
|
+
var bs58$3;
|
|
1135
1135
|
var hasRequiredBs58;
|
|
1136
1136
|
|
|
1137
1137
|
function requireBs58 () {
|
|
1138
|
-
if (hasRequiredBs58) return bs58;
|
|
1138
|
+
if (hasRequiredBs58) return bs58$3;
|
|
1139
1139
|
hasRequiredBs58 = 1;
|
|
1140
1140
|
const basex = requireSrc();
|
|
1141
1141
|
const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
1142
1142
|
|
|
1143
|
-
bs58 = basex(ALPHABET);
|
|
1144
|
-
return bs58;
|
|
1143
|
+
bs58$3 = basex(ALPHABET);
|
|
1144
|
+
return bs58$3;
|
|
1145
1145
|
}
|
|
1146
1146
|
|
|
1147
1147
|
requireBs58();
|
|
@@ -3101,13 +3101,13 @@ function createAutoConfirmPlugin() {
|
|
|
3101
3101
|
};
|
|
3102
3102
|
}
|
|
3103
3103
|
|
|
3104
|
-
var eventemitter3 = {exports: {}};
|
|
3104
|
+
var eventemitter3$1 = {exports: {}};
|
|
3105
3105
|
|
|
3106
|
-
var hasRequiredEventemitter3;
|
|
3106
|
+
var hasRequiredEventemitter3$1;
|
|
3107
3107
|
|
|
3108
|
-
function requireEventemitter3 () {
|
|
3109
|
-
if (hasRequiredEventemitter3) return eventemitter3.exports;
|
|
3110
|
-
hasRequiredEventemitter3 = 1;
|
|
3108
|
+
function requireEventemitter3$1 () {
|
|
3109
|
+
if (hasRequiredEventemitter3$1) return eventemitter3$1.exports;
|
|
3110
|
+
hasRequiredEventemitter3$1 = 1;
|
|
3111
3111
|
(function (module) {
|
|
3112
3112
|
|
|
3113
3113
|
var has = Object.prototype.hasOwnProperty
|
|
@@ -3444,12 +3444,12 @@ function requireEventemitter3 () {
|
|
|
3444
3444
|
{
|
|
3445
3445
|
module.exports = EventEmitter;
|
|
3446
3446
|
}
|
|
3447
|
-
} (eventemitter3));
|
|
3448
|
-
return eventemitter3.exports;
|
|
3447
|
+
} (eventemitter3$1));
|
|
3448
|
+
return eventemitter3$1.exports;
|
|
3449
3449
|
}
|
|
3450
3450
|
|
|
3451
|
-
var eventemitter3Exports = requireEventemitter3();
|
|
3452
|
-
var EventEmitter3 = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
|
|
3451
|
+
var eventemitter3Exports$1 = requireEventemitter3$1();
|
|
3452
|
+
var EventEmitter3 = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports$1);
|
|
3453
3453
|
|
|
3454
3454
|
// src/index.ts
|
|
3455
3455
|
var isBrowser = typeof window !== "undefined" && typeof window.btoa !== "undefined";
|
|
@@ -8778,6 +8778,133 @@ class Transaction {
|
|
|
8778
8778
|
}
|
|
8779
8779
|
}
|
|
8780
8780
|
|
|
8781
|
+
// base-x encoding / decoding
|
|
8782
|
+
// Copyright (c) 2018 base-x contributors
|
|
8783
|
+
// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
|
|
8784
|
+
// Distributed under the MIT software license, see the accompanying
|
|
8785
|
+
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
|
8786
|
+
function base$3 (ALPHABET) {
|
|
8787
|
+
if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
|
|
8788
|
+
const BASE_MAP = new Uint8Array(256);
|
|
8789
|
+
for (let j = 0; j < BASE_MAP.length; j++) {
|
|
8790
|
+
BASE_MAP[j] = 255;
|
|
8791
|
+
}
|
|
8792
|
+
for (let i = 0; i < ALPHABET.length; i++) {
|
|
8793
|
+
const x = ALPHABET.charAt(i);
|
|
8794
|
+
const xc = x.charCodeAt(0);
|
|
8795
|
+
if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
|
|
8796
|
+
BASE_MAP[xc] = i;
|
|
8797
|
+
}
|
|
8798
|
+
const BASE = ALPHABET.length;
|
|
8799
|
+
const LEADER = ALPHABET.charAt(0);
|
|
8800
|
+
const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
|
|
8801
|
+
const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
|
|
8802
|
+
function encode (source) {
|
|
8803
|
+
// eslint-disable-next-line no-empty
|
|
8804
|
+
if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
|
|
8805
|
+
source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
|
8806
|
+
} else if (Array.isArray(source)) {
|
|
8807
|
+
source = Uint8Array.from(source);
|
|
8808
|
+
}
|
|
8809
|
+
if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
|
|
8810
|
+
if (source.length === 0) { return '' }
|
|
8811
|
+
// Skip & count leading zeroes.
|
|
8812
|
+
let zeroes = 0;
|
|
8813
|
+
let length = 0;
|
|
8814
|
+
let pbegin = 0;
|
|
8815
|
+
const pend = source.length;
|
|
8816
|
+
while (pbegin !== pend && source[pbegin] === 0) {
|
|
8817
|
+
pbegin++;
|
|
8818
|
+
zeroes++;
|
|
8819
|
+
}
|
|
8820
|
+
// Allocate enough space in big-endian base58 representation.
|
|
8821
|
+
const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
|
|
8822
|
+
const b58 = new Uint8Array(size);
|
|
8823
|
+
// Process the bytes.
|
|
8824
|
+
while (pbegin !== pend) {
|
|
8825
|
+
let carry = source[pbegin];
|
|
8826
|
+
// Apply "b58 = b58 * 256 + ch".
|
|
8827
|
+
let i = 0;
|
|
8828
|
+
for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
|
|
8829
|
+
carry += (256 * b58[it1]) >>> 0;
|
|
8830
|
+
b58[it1] = (carry % BASE) >>> 0;
|
|
8831
|
+
carry = (carry / BASE) >>> 0;
|
|
8832
|
+
}
|
|
8833
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
8834
|
+
length = i;
|
|
8835
|
+
pbegin++;
|
|
8836
|
+
}
|
|
8837
|
+
// Skip leading zeroes in base58 result.
|
|
8838
|
+
let it2 = size - length;
|
|
8839
|
+
while (it2 !== size && b58[it2] === 0) {
|
|
8840
|
+
it2++;
|
|
8841
|
+
}
|
|
8842
|
+
// Translate the result into a string.
|
|
8843
|
+
let str = LEADER.repeat(zeroes);
|
|
8844
|
+
for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
|
|
8845
|
+
return str
|
|
8846
|
+
}
|
|
8847
|
+
function decodeUnsafe (source) {
|
|
8848
|
+
if (typeof source !== 'string') { throw new TypeError('Expected String') }
|
|
8849
|
+
if (source.length === 0) { return new Uint8Array() }
|
|
8850
|
+
let psz = 0;
|
|
8851
|
+
// Skip and count leading '1's.
|
|
8852
|
+
let zeroes = 0;
|
|
8853
|
+
let length = 0;
|
|
8854
|
+
while (source[psz] === LEADER) {
|
|
8855
|
+
zeroes++;
|
|
8856
|
+
psz++;
|
|
8857
|
+
}
|
|
8858
|
+
// Allocate enough space in big-endian base256 representation.
|
|
8859
|
+
const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
|
|
8860
|
+
const b256 = new Uint8Array(size);
|
|
8861
|
+
// Process the characters.
|
|
8862
|
+
while (psz < source.length) {
|
|
8863
|
+
// Find code of next character
|
|
8864
|
+
const charCode = source.charCodeAt(psz);
|
|
8865
|
+
// Base map can not be indexed using char code
|
|
8866
|
+
if (charCode > 255) { return }
|
|
8867
|
+
// Decode character
|
|
8868
|
+
let carry = BASE_MAP[charCode];
|
|
8869
|
+
// Invalid character
|
|
8870
|
+
if (carry === 255) { return }
|
|
8871
|
+
let i = 0;
|
|
8872
|
+
for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
|
|
8873
|
+
carry += (BASE * b256[it3]) >>> 0;
|
|
8874
|
+
b256[it3] = (carry % 256) >>> 0;
|
|
8875
|
+
carry = (carry / 256) >>> 0;
|
|
8876
|
+
}
|
|
8877
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
8878
|
+
length = i;
|
|
8879
|
+
psz++;
|
|
8880
|
+
}
|
|
8881
|
+
// Skip leading zeroes in b256.
|
|
8882
|
+
let it4 = size - length;
|
|
8883
|
+
while (it4 !== size && b256[it4] === 0) {
|
|
8884
|
+
it4++;
|
|
8885
|
+
}
|
|
8886
|
+
const vch = new Uint8Array(zeroes + (size - it4));
|
|
8887
|
+
let j = zeroes;
|
|
8888
|
+
while (it4 !== size) {
|
|
8889
|
+
vch[j++] = b256[it4++];
|
|
8890
|
+
}
|
|
8891
|
+
return vch
|
|
8892
|
+
}
|
|
8893
|
+
function decode (string) {
|
|
8894
|
+
const buffer = decodeUnsafe(string);
|
|
8895
|
+
if (buffer) { return buffer }
|
|
8896
|
+
throw new Error('Non-base' + BASE + ' character')
|
|
8897
|
+
}
|
|
8898
|
+
return {
|
|
8899
|
+
encode,
|
|
8900
|
+
decodeUnsafe,
|
|
8901
|
+
decode
|
|
8902
|
+
}
|
|
8903
|
+
}
|
|
8904
|
+
|
|
8905
|
+
var ALPHABET$3 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
8906
|
+
var bs58$2 = base$3(ALPHABET$3);
|
|
8907
|
+
|
|
8781
8908
|
// src/index.ts
|
|
8782
8909
|
function parseSignMessageResponse(base64Response, networkId) {
|
|
8783
8910
|
const networkPrefix = networkId.split(":")[0].toLowerCase();
|
|
@@ -8824,7 +8951,7 @@ function parseTransactionResponse(base64RawTransaction, networkId, hash) {
|
|
|
8824
8951
|
function parseSolanaSignatureResponse(base64Response) {
|
|
8825
8952
|
try {
|
|
8826
8953
|
const signatureBytes = base64urlDecode(base64Response);
|
|
8827
|
-
const signature = bs58$
|
|
8954
|
+
const signature = bs58$2.encode(signatureBytes);
|
|
8828
8955
|
return {
|
|
8829
8956
|
signature,
|
|
8830
8957
|
rawSignature: base64Response
|
|
@@ -9064,6 +9191,610 @@ function parseBitcoinTransactionToBase64Url(transaction) {
|
|
|
9064
9191
|
throw new Error("Unsupported Bitcoin transaction format");
|
|
9065
9192
|
}
|
|
9066
9193
|
|
|
9194
|
+
// base-x encoding / decoding
|
|
9195
|
+
// Copyright (c) 2018 base-x contributors
|
|
9196
|
+
// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
|
|
9197
|
+
// Distributed under the MIT software license, see the accompanying
|
|
9198
|
+
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
|
9199
|
+
function base$2 (ALPHABET) {
|
|
9200
|
+
if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
|
|
9201
|
+
const BASE_MAP = new Uint8Array(256);
|
|
9202
|
+
for (let j = 0; j < BASE_MAP.length; j++) {
|
|
9203
|
+
BASE_MAP[j] = 255;
|
|
9204
|
+
}
|
|
9205
|
+
for (let i = 0; i < ALPHABET.length; i++) {
|
|
9206
|
+
const x = ALPHABET.charAt(i);
|
|
9207
|
+
const xc = x.charCodeAt(0);
|
|
9208
|
+
if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
|
|
9209
|
+
BASE_MAP[xc] = i;
|
|
9210
|
+
}
|
|
9211
|
+
const BASE = ALPHABET.length;
|
|
9212
|
+
const LEADER = ALPHABET.charAt(0);
|
|
9213
|
+
const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
|
|
9214
|
+
const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
|
|
9215
|
+
function encode (source) {
|
|
9216
|
+
// eslint-disable-next-line no-empty
|
|
9217
|
+
if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
|
|
9218
|
+
source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
|
9219
|
+
} else if (Array.isArray(source)) {
|
|
9220
|
+
source = Uint8Array.from(source);
|
|
9221
|
+
}
|
|
9222
|
+
if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
|
|
9223
|
+
if (source.length === 0) { return '' }
|
|
9224
|
+
// Skip & count leading zeroes.
|
|
9225
|
+
let zeroes = 0;
|
|
9226
|
+
let length = 0;
|
|
9227
|
+
let pbegin = 0;
|
|
9228
|
+
const pend = source.length;
|
|
9229
|
+
while (pbegin !== pend && source[pbegin] === 0) {
|
|
9230
|
+
pbegin++;
|
|
9231
|
+
zeroes++;
|
|
9232
|
+
}
|
|
9233
|
+
// Allocate enough space in big-endian base58 representation.
|
|
9234
|
+
const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
|
|
9235
|
+
const b58 = new Uint8Array(size);
|
|
9236
|
+
// Process the bytes.
|
|
9237
|
+
while (pbegin !== pend) {
|
|
9238
|
+
let carry = source[pbegin];
|
|
9239
|
+
// Apply "b58 = b58 * 256 + ch".
|
|
9240
|
+
let i = 0;
|
|
9241
|
+
for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
|
|
9242
|
+
carry += (256 * b58[it1]) >>> 0;
|
|
9243
|
+
b58[it1] = (carry % BASE) >>> 0;
|
|
9244
|
+
carry = (carry / BASE) >>> 0;
|
|
9245
|
+
}
|
|
9246
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
9247
|
+
length = i;
|
|
9248
|
+
pbegin++;
|
|
9249
|
+
}
|
|
9250
|
+
// Skip leading zeroes in base58 result.
|
|
9251
|
+
let it2 = size - length;
|
|
9252
|
+
while (it2 !== size && b58[it2] === 0) {
|
|
9253
|
+
it2++;
|
|
9254
|
+
}
|
|
9255
|
+
// Translate the result into a string.
|
|
9256
|
+
let str = LEADER.repeat(zeroes);
|
|
9257
|
+
for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
|
|
9258
|
+
return str
|
|
9259
|
+
}
|
|
9260
|
+
function decodeUnsafe (source) {
|
|
9261
|
+
if (typeof source !== 'string') { throw new TypeError('Expected String') }
|
|
9262
|
+
if (source.length === 0) { return new Uint8Array() }
|
|
9263
|
+
let psz = 0;
|
|
9264
|
+
// Skip and count leading '1's.
|
|
9265
|
+
let zeroes = 0;
|
|
9266
|
+
let length = 0;
|
|
9267
|
+
while (source[psz] === LEADER) {
|
|
9268
|
+
zeroes++;
|
|
9269
|
+
psz++;
|
|
9270
|
+
}
|
|
9271
|
+
// Allocate enough space in big-endian base256 representation.
|
|
9272
|
+
const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
|
|
9273
|
+
const b256 = new Uint8Array(size);
|
|
9274
|
+
// Process the characters.
|
|
9275
|
+
while (psz < source.length) {
|
|
9276
|
+
// Find code of next character
|
|
9277
|
+
const charCode = source.charCodeAt(psz);
|
|
9278
|
+
// Base map can not be indexed using char code
|
|
9279
|
+
if (charCode > 255) { return }
|
|
9280
|
+
// Decode character
|
|
9281
|
+
let carry = BASE_MAP[charCode];
|
|
9282
|
+
// Invalid character
|
|
9283
|
+
if (carry === 255) { return }
|
|
9284
|
+
let i = 0;
|
|
9285
|
+
for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
|
|
9286
|
+
carry += (BASE * b256[it3]) >>> 0;
|
|
9287
|
+
b256[it3] = (carry % 256) >>> 0;
|
|
9288
|
+
carry = (carry / 256) >>> 0;
|
|
9289
|
+
}
|
|
9290
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
9291
|
+
length = i;
|
|
9292
|
+
psz++;
|
|
9293
|
+
}
|
|
9294
|
+
// Skip leading zeroes in b256.
|
|
9295
|
+
let it4 = size - length;
|
|
9296
|
+
while (it4 !== size && b256[it4] === 0) {
|
|
9297
|
+
it4++;
|
|
9298
|
+
}
|
|
9299
|
+
const vch = new Uint8Array(zeroes + (size - it4));
|
|
9300
|
+
let j = zeroes;
|
|
9301
|
+
while (it4 !== size) {
|
|
9302
|
+
vch[j++] = b256[it4++];
|
|
9303
|
+
}
|
|
9304
|
+
return vch
|
|
9305
|
+
}
|
|
9306
|
+
function decode (string) {
|
|
9307
|
+
const buffer = decodeUnsafe(string);
|
|
9308
|
+
if (buffer) { return buffer }
|
|
9309
|
+
throw new Error('Non-base' + BASE + ' character')
|
|
9310
|
+
}
|
|
9311
|
+
return {
|
|
9312
|
+
encode,
|
|
9313
|
+
decodeUnsafe,
|
|
9314
|
+
decode
|
|
9315
|
+
}
|
|
9316
|
+
}
|
|
9317
|
+
|
|
9318
|
+
var ALPHABET$2 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
9319
|
+
var bs58$1 = base$2(ALPHABET$2);
|
|
9320
|
+
|
|
9321
|
+
// base-x encoding / decoding
|
|
9322
|
+
// Copyright (c) 2018 base-x contributors
|
|
9323
|
+
// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
|
|
9324
|
+
// Distributed under the MIT software license, see the accompanying
|
|
9325
|
+
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
|
9326
|
+
function base$1 (ALPHABET) {
|
|
9327
|
+
if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
|
|
9328
|
+
const BASE_MAP = new Uint8Array(256);
|
|
9329
|
+
for (let j = 0; j < BASE_MAP.length; j++) {
|
|
9330
|
+
BASE_MAP[j] = 255;
|
|
9331
|
+
}
|
|
9332
|
+
for (let i = 0; i < ALPHABET.length; i++) {
|
|
9333
|
+
const x = ALPHABET.charAt(i);
|
|
9334
|
+
const xc = x.charCodeAt(0);
|
|
9335
|
+
if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
|
|
9336
|
+
BASE_MAP[xc] = i;
|
|
9337
|
+
}
|
|
9338
|
+
const BASE = ALPHABET.length;
|
|
9339
|
+
const LEADER = ALPHABET.charAt(0);
|
|
9340
|
+
const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
|
|
9341
|
+
const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
|
|
9342
|
+
function encode (source) {
|
|
9343
|
+
// eslint-disable-next-line no-empty
|
|
9344
|
+
if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
|
|
9345
|
+
source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
|
9346
|
+
} else if (Array.isArray(source)) {
|
|
9347
|
+
source = Uint8Array.from(source);
|
|
9348
|
+
}
|
|
9349
|
+
if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
|
|
9350
|
+
if (source.length === 0) { return '' }
|
|
9351
|
+
// Skip & count leading zeroes.
|
|
9352
|
+
let zeroes = 0;
|
|
9353
|
+
let length = 0;
|
|
9354
|
+
let pbegin = 0;
|
|
9355
|
+
const pend = source.length;
|
|
9356
|
+
while (pbegin !== pend && source[pbegin] === 0) {
|
|
9357
|
+
pbegin++;
|
|
9358
|
+
zeroes++;
|
|
9359
|
+
}
|
|
9360
|
+
// Allocate enough space in big-endian base58 representation.
|
|
9361
|
+
const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
|
|
9362
|
+
const b58 = new Uint8Array(size);
|
|
9363
|
+
// Process the bytes.
|
|
9364
|
+
while (pbegin !== pend) {
|
|
9365
|
+
let carry = source[pbegin];
|
|
9366
|
+
// Apply "b58 = b58 * 256 + ch".
|
|
9367
|
+
let i = 0;
|
|
9368
|
+
for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
|
|
9369
|
+
carry += (256 * b58[it1]) >>> 0;
|
|
9370
|
+
b58[it1] = (carry % BASE) >>> 0;
|
|
9371
|
+
carry = (carry / BASE) >>> 0;
|
|
9372
|
+
}
|
|
9373
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
9374
|
+
length = i;
|
|
9375
|
+
pbegin++;
|
|
9376
|
+
}
|
|
9377
|
+
// Skip leading zeroes in base58 result.
|
|
9378
|
+
let it2 = size - length;
|
|
9379
|
+
while (it2 !== size && b58[it2] === 0) {
|
|
9380
|
+
it2++;
|
|
9381
|
+
}
|
|
9382
|
+
// Translate the result into a string.
|
|
9383
|
+
let str = LEADER.repeat(zeroes);
|
|
9384
|
+
for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
|
|
9385
|
+
return str
|
|
9386
|
+
}
|
|
9387
|
+
function decodeUnsafe (source) {
|
|
9388
|
+
if (typeof source !== 'string') { throw new TypeError('Expected String') }
|
|
9389
|
+
if (source.length === 0) { return new Uint8Array() }
|
|
9390
|
+
let psz = 0;
|
|
9391
|
+
// Skip and count leading '1's.
|
|
9392
|
+
let zeroes = 0;
|
|
9393
|
+
let length = 0;
|
|
9394
|
+
while (source[psz] === LEADER) {
|
|
9395
|
+
zeroes++;
|
|
9396
|
+
psz++;
|
|
9397
|
+
}
|
|
9398
|
+
// Allocate enough space in big-endian base256 representation.
|
|
9399
|
+
const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
|
|
9400
|
+
const b256 = new Uint8Array(size);
|
|
9401
|
+
// Process the characters.
|
|
9402
|
+
while (psz < source.length) {
|
|
9403
|
+
// Find code of next character
|
|
9404
|
+
const charCode = source.charCodeAt(psz);
|
|
9405
|
+
// Base map can not be indexed using char code
|
|
9406
|
+
if (charCode > 255) { return }
|
|
9407
|
+
// Decode character
|
|
9408
|
+
let carry = BASE_MAP[charCode];
|
|
9409
|
+
// Invalid character
|
|
9410
|
+
if (carry === 255) { return }
|
|
9411
|
+
let i = 0;
|
|
9412
|
+
for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
|
|
9413
|
+
carry += (BASE * b256[it3]) >>> 0;
|
|
9414
|
+
b256[it3] = (carry % 256) >>> 0;
|
|
9415
|
+
carry = (carry / 256) >>> 0;
|
|
9416
|
+
}
|
|
9417
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
9418
|
+
length = i;
|
|
9419
|
+
psz++;
|
|
9420
|
+
}
|
|
9421
|
+
// Skip leading zeroes in b256.
|
|
9422
|
+
let it4 = size - length;
|
|
9423
|
+
while (it4 !== size && b256[it4] === 0) {
|
|
9424
|
+
it4++;
|
|
9425
|
+
}
|
|
9426
|
+
const vch = new Uint8Array(zeroes + (size - it4));
|
|
9427
|
+
let j = zeroes;
|
|
9428
|
+
while (it4 !== size) {
|
|
9429
|
+
vch[j++] = b256[it4++];
|
|
9430
|
+
}
|
|
9431
|
+
return vch
|
|
9432
|
+
}
|
|
9433
|
+
function decode (string) {
|
|
9434
|
+
const buffer = decodeUnsafe(string);
|
|
9435
|
+
if (buffer) { return buffer }
|
|
9436
|
+
throw new Error('Non-base' + BASE + ' character')
|
|
9437
|
+
}
|
|
9438
|
+
return {
|
|
9439
|
+
encode,
|
|
9440
|
+
decodeUnsafe,
|
|
9441
|
+
decode
|
|
9442
|
+
}
|
|
9443
|
+
}
|
|
9444
|
+
|
|
9445
|
+
var ALPHABET$1 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
9446
|
+
var bs582 = base$1(ALPHABET$1);
|
|
9447
|
+
|
|
9448
|
+
var eventemitter3 = {exports: {}};
|
|
9449
|
+
|
|
9450
|
+
var hasRequiredEventemitter3;
|
|
9451
|
+
|
|
9452
|
+
function requireEventemitter3 () {
|
|
9453
|
+
if (hasRequiredEventemitter3) return eventemitter3.exports;
|
|
9454
|
+
hasRequiredEventemitter3 = 1;
|
|
9455
|
+
(function (module) {
|
|
9456
|
+
|
|
9457
|
+
var has = Object.prototype.hasOwnProperty
|
|
9458
|
+
, prefix = '~';
|
|
9459
|
+
|
|
9460
|
+
/**
|
|
9461
|
+
* Constructor to create a storage for our `EE` objects.
|
|
9462
|
+
* An `Events` instance is a plain object whose properties are event names.
|
|
9463
|
+
*
|
|
9464
|
+
* @constructor
|
|
9465
|
+
* @private
|
|
9466
|
+
*/
|
|
9467
|
+
function Events() {}
|
|
9468
|
+
|
|
9469
|
+
//
|
|
9470
|
+
// We try to not inherit from `Object.prototype`. In some engines creating an
|
|
9471
|
+
// instance in this way is faster than calling `Object.create(null)` directly.
|
|
9472
|
+
// If `Object.create(null)` is not supported we prefix the event names with a
|
|
9473
|
+
// character to make sure that the built-in object properties are not
|
|
9474
|
+
// overridden or used as an attack vector.
|
|
9475
|
+
//
|
|
9476
|
+
if (Object.create) {
|
|
9477
|
+
Events.prototype = Object.create(null);
|
|
9478
|
+
|
|
9479
|
+
//
|
|
9480
|
+
// This hack is needed because the `__proto__` property is still inherited in
|
|
9481
|
+
// some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
|
|
9482
|
+
//
|
|
9483
|
+
if (!new Events().__proto__) prefix = false;
|
|
9484
|
+
}
|
|
9485
|
+
|
|
9486
|
+
/**
|
|
9487
|
+
* Representation of a single event listener.
|
|
9488
|
+
*
|
|
9489
|
+
* @param {Function} fn The listener function.
|
|
9490
|
+
* @param {*} context The context to invoke the listener with.
|
|
9491
|
+
* @param {Boolean} [once=false] Specify if the listener is a one-time listener.
|
|
9492
|
+
* @constructor
|
|
9493
|
+
* @private
|
|
9494
|
+
*/
|
|
9495
|
+
function EE(fn, context, once) {
|
|
9496
|
+
this.fn = fn;
|
|
9497
|
+
this.context = context;
|
|
9498
|
+
this.once = once || false;
|
|
9499
|
+
}
|
|
9500
|
+
|
|
9501
|
+
/**
|
|
9502
|
+
* Add a listener for a given event.
|
|
9503
|
+
*
|
|
9504
|
+
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
9505
|
+
* @param {(String|Symbol)} event The event name.
|
|
9506
|
+
* @param {Function} fn The listener function.
|
|
9507
|
+
* @param {*} context The context to invoke the listener with.
|
|
9508
|
+
* @param {Boolean} once Specify if the listener is a one-time listener.
|
|
9509
|
+
* @returns {EventEmitter}
|
|
9510
|
+
* @private
|
|
9511
|
+
*/
|
|
9512
|
+
function addListener(emitter, event, fn, context, once) {
|
|
9513
|
+
if (typeof fn !== 'function') {
|
|
9514
|
+
throw new TypeError('The listener must be a function');
|
|
9515
|
+
}
|
|
9516
|
+
|
|
9517
|
+
var listener = new EE(fn, context || emitter, once)
|
|
9518
|
+
, evt = prefix ? prefix + event : event;
|
|
9519
|
+
|
|
9520
|
+
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
|
|
9521
|
+
else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
|
|
9522
|
+
else emitter._events[evt] = [emitter._events[evt], listener];
|
|
9523
|
+
|
|
9524
|
+
return emitter;
|
|
9525
|
+
}
|
|
9526
|
+
|
|
9527
|
+
/**
|
|
9528
|
+
* Clear event by name.
|
|
9529
|
+
*
|
|
9530
|
+
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
9531
|
+
* @param {(String|Symbol)} evt The Event name.
|
|
9532
|
+
* @private
|
|
9533
|
+
*/
|
|
9534
|
+
function clearEvent(emitter, evt) {
|
|
9535
|
+
if (--emitter._eventsCount === 0) emitter._events = new Events();
|
|
9536
|
+
else delete emitter._events[evt];
|
|
9537
|
+
}
|
|
9538
|
+
|
|
9539
|
+
/**
|
|
9540
|
+
* Minimal `EventEmitter` interface that is molded against the Node.js
|
|
9541
|
+
* `EventEmitter` interface.
|
|
9542
|
+
*
|
|
9543
|
+
* @constructor
|
|
9544
|
+
* @public
|
|
9545
|
+
*/
|
|
9546
|
+
function EventEmitter() {
|
|
9547
|
+
this._events = new Events();
|
|
9548
|
+
this._eventsCount = 0;
|
|
9549
|
+
}
|
|
9550
|
+
|
|
9551
|
+
/**
|
|
9552
|
+
* Return an array listing the events for which the emitter has registered
|
|
9553
|
+
* listeners.
|
|
9554
|
+
*
|
|
9555
|
+
* @returns {Array}
|
|
9556
|
+
* @public
|
|
9557
|
+
*/
|
|
9558
|
+
EventEmitter.prototype.eventNames = function eventNames() {
|
|
9559
|
+
var names = []
|
|
9560
|
+
, events
|
|
9561
|
+
, name;
|
|
9562
|
+
|
|
9563
|
+
if (this._eventsCount === 0) return names;
|
|
9564
|
+
|
|
9565
|
+
for (name in (events = this._events)) {
|
|
9566
|
+
if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
|
|
9567
|
+
}
|
|
9568
|
+
|
|
9569
|
+
if (Object.getOwnPropertySymbols) {
|
|
9570
|
+
return names.concat(Object.getOwnPropertySymbols(events));
|
|
9571
|
+
}
|
|
9572
|
+
|
|
9573
|
+
return names;
|
|
9574
|
+
};
|
|
9575
|
+
|
|
9576
|
+
/**
|
|
9577
|
+
* Return the listeners registered for a given event.
|
|
9578
|
+
*
|
|
9579
|
+
* @param {(String|Symbol)} event The event name.
|
|
9580
|
+
* @returns {Array} The registered listeners.
|
|
9581
|
+
* @public
|
|
9582
|
+
*/
|
|
9583
|
+
EventEmitter.prototype.listeners = function listeners(event) {
|
|
9584
|
+
var evt = prefix ? prefix + event : event
|
|
9585
|
+
, handlers = this._events[evt];
|
|
9586
|
+
|
|
9587
|
+
if (!handlers) return [];
|
|
9588
|
+
if (handlers.fn) return [handlers.fn];
|
|
9589
|
+
|
|
9590
|
+
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
|
|
9591
|
+
ee[i] = handlers[i].fn;
|
|
9592
|
+
}
|
|
9593
|
+
|
|
9594
|
+
return ee;
|
|
9595
|
+
};
|
|
9596
|
+
|
|
9597
|
+
/**
|
|
9598
|
+
* Return the number of listeners listening to a given event.
|
|
9599
|
+
*
|
|
9600
|
+
* @param {(String|Symbol)} event The event name.
|
|
9601
|
+
* @returns {Number} The number of listeners.
|
|
9602
|
+
* @public
|
|
9603
|
+
*/
|
|
9604
|
+
EventEmitter.prototype.listenerCount = function listenerCount(event) {
|
|
9605
|
+
var evt = prefix ? prefix + event : event
|
|
9606
|
+
, listeners = this._events[evt];
|
|
9607
|
+
|
|
9608
|
+
if (!listeners) return 0;
|
|
9609
|
+
if (listeners.fn) return 1;
|
|
9610
|
+
return listeners.length;
|
|
9611
|
+
};
|
|
9612
|
+
|
|
9613
|
+
/**
|
|
9614
|
+
* Calls each of the listeners registered for a given event.
|
|
9615
|
+
*
|
|
9616
|
+
* @param {(String|Symbol)} event The event name.
|
|
9617
|
+
* @returns {Boolean} `true` if the event had listeners, else `false`.
|
|
9618
|
+
* @public
|
|
9619
|
+
*/
|
|
9620
|
+
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|
9621
|
+
var evt = prefix ? prefix + event : event;
|
|
9622
|
+
|
|
9623
|
+
if (!this._events[evt]) return false;
|
|
9624
|
+
|
|
9625
|
+
var listeners = this._events[evt]
|
|
9626
|
+
, len = arguments.length
|
|
9627
|
+
, args
|
|
9628
|
+
, i;
|
|
9629
|
+
|
|
9630
|
+
if (listeners.fn) {
|
|
9631
|
+
if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
|
|
9632
|
+
|
|
9633
|
+
switch (len) {
|
|
9634
|
+
case 1: return listeners.fn.call(listeners.context), true;
|
|
9635
|
+
case 2: return listeners.fn.call(listeners.context, a1), true;
|
|
9636
|
+
case 3: return listeners.fn.call(listeners.context, a1, a2), true;
|
|
9637
|
+
case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
9638
|
+
case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
9639
|
+
case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
9640
|
+
}
|
|
9641
|
+
|
|
9642
|
+
for (i = 1, args = new Array(len -1); i < len; i++) {
|
|
9643
|
+
args[i - 1] = arguments[i];
|
|
9644
|
+
}
|
|
9645
|
+
|
|
9646
|
+
listeners.fn.apply(listeners.context, args);
|
|
9647
|
+
} else {
|
|
9648
|
+
var length = listeners.length
|
|
9649
|
+
, j;
|
|
9650
|
+
|
|
9651
|
+
for (i = 0; i < length; i++) {
|
|
9652
|
+
if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
|
|
9653
|
+
|
|
9654
|
+
switch (len) {
|
|
9655
|
+
case 1: listeners[i].fn.call(listeners[i].context); break;
|
|
9656
|
+
case 2: listeners[i].fn.call(listeners[i].context, a1); break;
|
|
9657
|
+
case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
|
|
9658
|
+
case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
|
|
9659
|
+
default:
|
|
9660
|
+
if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
|
|
9661
|
+
args[j - 1] = arguments[j];
|
|
9662
|
+
}
|
|
9663
|
+
|
|
9664
|
+
listeners[i].fn.apply(listeners[i].context, args);
|
|
9665
|
+
}
|
|
9666
|
+
}
|
|
9667
|
+
}
|
|
9668
|
+
|
|
9669
|
+
return true;
|
|
9670
|
+
};
|
|
9671
|
+
|
|
9672
|
+
/**
|
|
9673
|
+
* Add a listener for a given event.
|
|
9674
|
+
*
|
|
9675
|
+
* @param {(String|Symbol)} event The event name.
|
|
9676
|
+
* @param {Function} fn The listener function.
|
|
9677
|
+
* @param {*} [context=this] The context to invoke the listener with.
|
|
9678
|
+
* @returns {EventEmitter} `this`.
|
|
9679
|
+
* @public
|
|
9680
|
+
*/
|
|
9681
|
+
EventEmitter.prototype.on = function on(event, fn, context) {
|
|
9682
|
+
return addListener(this, event, fn, context, false);
|
|
9683
|
+
};
|
|
9684
|
+
|
|
9685
|
+
/**
|
|
9686
|
+
* Add a one-time listener for a given event.
|
|
9687
|
+
*
|
|
9688
|
+
* @param {(String|Symbol)} event The event name.
|
|
9689
|
+
* @param {Function} fn The listener function.
|
|
9690
|
+
* @param {*} [context=this] The context to invoke the listener with.
|
|
9691
|
+
* @returns {EventEmitter} `this`.
|
|
9692
|
+
* @public
|
|
9693
|
+
*/
|
|
9694
|
+
EventEmitter.prototype.once = function once(event, fn, context) {
|
|
9695
|
+
return addListener(this, event, fn, context, true);
|
|
9696
|
+
};
|
|
9697
|
+
|
|
9698
|
+
/**
|
|
9699
|
+
* Remove the listeners of a given event.
|
|
9700
|
+
*
|
|
9701
|
+
* @param {(String|Symbol)} event The event name.
|
|
9702
|
+
* @param {Function} fn Only remove the listeners that match this function.
|
|
9703
|
+
* @param {*} context Only remove the listeners that have this context.
|
|
9704
|
+
* @param {Boolean} once Only remove one-time listeners.
|
|
9705
|
+
* @returns {EventEmitter} `this`.
|
|
9706
|
+
* @public
|
|
9707
|
+
*/
|
|
9708
|
+
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
9709
|
+
var evt = prefix ? prefix + event : event;
|
|
9710
|
+
|
|
9711
|
+
if (!this._events[evt]) return this;
|
|
9712
|
+
if (!fn) {
|
|
9713
|
+
clearEvent(this, evt);
|
|
9714
|
+
return this;
|
|
9715
|
+
}
|
|
9716
|
+
|
|
9717
|
+
var listeners = this._events[evt];
|
|
9718
|
+
|
|
9719
|
+
if (listeners.fn) {
|
|
9720
|
+
if (
|
|
9721
|
+
listeners.fn === fn &&
|
|
9722
|
+
(!once || listeners.once) &&
|
|
9723
|
+
(!context || listeners.context === context)
|
|
9724
|
+
) {
|
|
9725
|
+
clearEvent(this, evt);
|
|
9726
|
+
}
|
|
9727
|
+
} else {
|
|
9728
|
+
for (var i = 0, events = [], length = listeners.length; i < length; i++) {
|
|
9729
|
+
if (
|
|
9730
|
+
listeners[i].fn !== fn ||
|
|
9731
|
+
(once && !listeners[i].once) ||
|
|
9732
|
+
(context && listeners[i].context !== context)
|
|
9733
|
+
) {
|
|
9734
|
+
events.push(listeners[i]);
|
|
9735
|
+
}
|
|
9736
|
+
}
|
|
9737
|
+
|
|
9738
|
+
//
|
|
9739
|
+
// Reset the array, or remove it completely if we have no more listeners.
|
|
9740
|
+
//
|
|
9741
|
+
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
|
|
9742
|
+
else clearEvent(this, evt);
|
|
9743
|
+
}
|
|
9744
|
+
|
|
9745
|
+
return this;
|
|
9746
|
+
};
|
|
9747
|
+
|
|
9748
|
+
/**
|
|
9749
|
+
* Remove all listeners, or those of the specified event.
|
|
9750
|
+
*
|
|
9751
|
+
* @param {(String|Symbol)} [event] The event name.
|
|
9752
|
+
* @returns {EventEmitter} `this`.
|
|
9753
|
+
* @public
|
|
9754
|
+
*/
|
|
9755
|
+
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
9756
|
+
var evt;
|
|
9757
|
+
|
|
9758
|
+
if (event) {
|
|
9759
|
+
evt = prefix ? prefix + event : event;
|
|
9760
|
+
if (this._events[evt]) clearEvent(this, evt);
|
|
9761
|
+
} else {
|
|
9762
|
+
this._events = new Events();
|
|
9763
|
+
this._eventsCount = 0;
|
|
9764
|
+
}
|
|
9765
|
+
|
|
9766
|
+
return this;
|
|
9767
|
+
};
|
|
9768
|
+
|
|
9769
|
+
//
|
|
9770
|
+
// Alias methods names because people roll like that.
|
|
9771
|
+
//
|
|
9772
|
+
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
9773
|
+
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
|
9774
|
+
|
|
9775
|
+
//
|
|
9776
|
+
// Expose the prefix.
|
|
9777
|
+
//
|
|
9778
|
+
EventEmitter.prefixed = prefix;
|
|
9779
|
+
|
|
9780
|
+
//
|
|
9781
|
+
// Allow `EventEmitter` to be imported as module namespace.
|
|
9782
|
+
//
|
|
9783
|
+
EventEmitter.EventEmitter = EventEmitter;
|
|
9784
|
+
|
|
9785
|
+
//
|
|
9786
|
+
// Expose the module.
|
|
9787
|
+
//
|
|
9788
|
+
{
|
|
9789
|
+
module.exports = EventEmitter;
|
|
9790
|
+
}
|
|
9791
|
+
} (eventemitter3));
|
|
9792
|
+
return eventemitter3.exports;
|
|
9793
|
+
}
|
|
9794
|
+
|
|
9795
|
+
var eventemitter3Exports = requireEventemitter3();
|
|
9796
|
+
var EventEmitter2 = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
|
|
9797
|
+
|
|
9067
9798
|
// src/embedded-provider.ts
|
|
9068
9799
|
|
|
9069
9800
|
// src/constants.ts
|
|
@@ -9075,7 +9806,7 @@ var EmbeddedSolanaChain = class {
|
|
|
9075
9806
|
this.currentNetworkId = NetworkId.SOLANA_MAINNET;
|
|
9076
9807
|
this._connected = false;
|
|
9077
9808
|
this._publicKey = null;
|
|
9078
|
-
this.eventEmitter = new
|
|
9809
|
+
this.eventEmitter = new EventEmitter2();
|
|
9079
9810
|
this.setupEventListeners();
|
|
9080
9811
|
this.syncInitialState();
|
|
9081
9812
|
}
|
|
@@ -9099,7 +9830,7 @@ var EmbeddedSolanaChain = class {
|
|
|
9099
9830
|
message: messageStr,
|
|
9100
9831
|
networkId: this.currentNetworkId
|
|
9101
9832
|
});
|
|
9102
|
-
const signature = typeof result.signature === "string" ? new Uint8Array(
|
|
9833
|
+
const signature = typeof result.signature === "string" ? new Uint8Array(bs582.decode(result.signature)) : result.signature;
|
|
9103
9834
|
return {
|
|
9104
9835
|
signature,
|
|
9105
9836
|
publicKey: this._publicKey || ""
|
|
@@ -9205,7 +9936,7 @@ var EmbeddedEthereumChain = class {
|
|
|
9205
9936
|
this.currentNetworkId = NetworkId.ETHEREUM_MAINNET;
|
|
9206
9937
|
this._connected = false;
|
|
9207
9938
|
this._accounts = [];
|
|
9208
|
-
this.eventEmitter = new
|
|
9939
|
+
this.eventEmitter = new EventEmitter2();
|
|
9209
9940
|
this.setupEventListeners();
|
|
9210
9941
|
this.syncInitialState();
|
|
9211
9942
|
}
|
|
@@ -9782,7 +10513,7 @@ var EmbeddedProvider$1 = class EmbeddedProvider {
|
|
|
9782
10513
|
publicKey: stamperInfo.publicKey,
|
|
9783
10514
|
platform: platformName
|
|
9784
10515
|
});
|
|
9785
|
-
const base64urlPublicKey = base64urlEncode(
|
|
10516
|
+
const base64urlPublicKey = base64urlEncode(bs582.decode(stamperInfo.publicKey));
|
|
9786
10517
|
const username = `user-${randomUUID()}`;
|
|
9787
10518
|
const { organizationId } = await tempClient.createOrganization(organizationName, [
|
|
9788
10519
|
{
|
|
@@ -10371,6 +11102,133 @@ var EmbeddedProvider$1 = class EmbeddedProvider {
|
|
|
10371
11102
|
}
|
|
10372
11103
|
};
|
|
10373
11104
|
|
|
11105
|
+
// base-x encoding / decoding
|
|
11106
|
+
// Copyright (c) 2018 base-x contributors
|
|
11107
|
+
// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
|
|
11108
|
+
// Distributed under the MIT software license, see the accompanying
|
|
11109
|
+
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
|
11110
|
+
function base (ALPHABET) {
|
|
11111
|
+
if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
|
|
11112
|
+
const BASE_MAP = new Uint8Array(256);
|
|
11113
|
+
for (let j = 0; j < BASE_MAP.length; j++) {
|
|
11114
|
+
BASE_MAP[j] = 255;
|
|
11115
|
+
}
|
|
11116
|
+
for (let i = 0; i < ALPHABET.length; i++) {
|
|
11117
|
+
const x = ALPHABET.charAt(i);
|
|
11118
|
+
const xc = x.charCodeAt(0);
|
|
11119
|
+
if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
|
|
11120
|
+
BASE_MAP[xc] = i;
|
|
11121
|
+
}
|
|
11122
|
+
const BASE = ALPHABET.length;
|
|
11123
|
+
const LEADER = ALPHABET.charAt(0);
|
|
11124
|
+
const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
|
|
11125
|
+
const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
|
|
11126
|
+
function encode (source) {
|
|
11127
|
+
// eslint-disable-next-line no-empty
|
|
11128
|
+
if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
|
|
11129
|
+
source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
|
11130
|
+
} else if (Array.isArray(source)) {
|
|
11131
|
+
source = Uint8Array.from(source);
|
|
11132
|
+
}
|
|
11133
|
+
if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
|
|
11134
|
+
if (source.length === 0) { return '' }
|
|
11135
|
+
// Skip & count leading zeroes.
|
|
11136
|
+
let zeroes = 0;
|
|
11137
|
+
let length = 0;
|
|
11138
|
+
let pbegin = 0;
|
|
11139
|
+
const pend = source.length;
|
|
11140
|
+
while (pbegin !== pend && source[pbegin] === 0) {
|
|
11141
|
+
pbegin++;
|
|
11142
|
+
zeroes++;
|
|
11143
|
+
}
|
|
11144
|
+
// Allocate enough space in big-endian base58 representation.
|
|
11145
|
+
const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
|
|
11146
|
+
const b58 = new Uint8Array(size);
|
|
11147
|
+
// Process the bytes.
|
|
11148
|
+
while (pbegin !== pend) {
|
|
11149
|
+
let carry = source[pbegin];
|
|
11150
|
+
// Apply "b58 = b58 * 256 + ch".
|
|
11151
|
+
let i = 0;
|
|
11152
|
+
for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
|
|
11153
|
+
carry += (256 * b58[it1]) >>> 0;
|
|
11154
|
+
b58[it1] = (carry % BASE) >>> 0;
|
|
11155
|
+
carry = (carry / BASE) >>> 0;
|
|
11156
|
+
}
|
|
11157
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
11158
|
+
length = i;
|
|
11159
|
+
pbegin++;
|
|
11160
|
+
}
|
|
11161
|
+
// Skip leading zeroes in base58 result.
|
|
11162
|
+
let it2 = size - length;
|
|
11163
|
+
while (it2 !== size && b58[it2] === 0) {
|
|
11164
|
+
it2++;
|
|
11165
|
+
}
|
|
11166
|
+
// Translate the result into a string.
|
|
11167
|
+
let str = LEADER.repeat(zeroes);
|
|
11168
|
+
for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
|
|
11169
|
+
return str
|
|
11170
|
+
}
|
|
11171
|
+
function decodeUnsafe (source) {
|
|
11172
|
+
if (typeof source !== 'string') { throw new TypeError('Expected String') }
|
|
11173
|
+
if (source.length === 0) { return new Uint8Array() }
|
|
11174
|
+
let psz = 0;
|
|
11175
|
+
// Skip and count leading '1's.
|
|
11176
|
+
let zeroes = 0;
|
|
11177
|
+
let length = 0;
|
|
11178
|
+
while (source[psz] === LEADER) {
|
|
11179
|
+
zeroes++;
|
|
11180
|
+
psz++;
|
|
11181
|
+
}
|
|
11182
|
+
// Allocate enough space in big-endian base256 representation.
|
|
11183
|
+
const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
|
|
11184
|
+
const b256 = new Uint8Array(size);
|
|
11185
|
+
// Process the characters.
|
|
11186
|
+
while (psz < source.length) {
|
|
11187
|
+
// Find code of next character
|
|
11188
|
+
const charCode = source.charCodeAt(psz);
|
|
11189
|
+
// Base map can not be indexed using char code
|
|
11190
|
+
if (charCode > 255) { return }
|
|
11191
|
+
// Decode character
|
|
11192
|
+
let carry = BASE_MAP[charCode];
|
|
11193
|
+
// Invalid character
|
|
11194
|
+
if (carry === 255) { return }
|
|
11195
|
+
let i = 0;
|
|
11196
|
+
for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
|
|
11197
|
+
carry += (BASE * b256[it3]) >>> 0;
|
|
11198
|
+
b256[it3] = (carry % 256) >>> 0;
|
|
11199
|
+
carry = (carry / 256) >>> 0;
|
|
11200
|
+
}
|
|
11201
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
11202
|
+
length = i;
|
|
11203
|
+
psz++;
|
|
11204
|
+
}
|
|
11205
|
+
// Skip leading zeroes in b256.
|
|
11206
|
+
let it4 = size - length;
|
|
11207
|
+
while (it4 !== size && b256[it4] === 0) {
|
|
11208
|
+
it4++;
|
|
11209
|
+
}
|
|
11210
|
+
const vch = new Uint8Array(zeroes + (size - it4));
|
|
11211
|
+
let j = zeroes;
|
|
11212
|
+
while (it4 !== size) {
|
|
11213
|
+
vch[j++] = b256[it4++];
|
|
11214
|
+
}
|
|
11215
|
+
return vch
|
|
11216
|
+
}
|
|
11217
|
+
function decode (string) {
|
|
11218
|
+
const buffer = decodeUnsafe(string);
|
|
11219
|
+
if (buffer) { return buffer }
|
|
11220
|
+
throw new Error('Non-base' + BASE + ' character')
|
|
11221
|
+
}
|
|
11222
|
+
return {
|
|
11223
|
+
encode,
|
|
11224
|
+
decodeUnsafe,
|
|
11225
|
+
decode
|
|
11226
|
+
}
|
|
11227
|
+
}
|
|
11228
|
+
|
|
11229
|
+
var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
11230
|
+
var bs58 = base(ALPHABET);
|
|
11231
|
+
|
|
10374
11232
|
// src/index.ts
|
|
10375
11233
|
var IndexedDbStamper = class {
|
|
10376
11234
|
// Optional for PKI, required for OIDC
|
|
@@ -10444,14 +11302,14 @@ var IndexedDbStamper = class {
|
|
|
10444
11302
|
const salt = params.type === "OIDC" ? params.salt : this.salt;
|
|
10445
11303
|
const stampData = stampType === "PKI" ? {
|
|
10446
11304
|
// Decode base58 public key to bytes, then encode as base64url (consistent with ApiKeyStamper)
|
|
10447
|
-
publicKey: base64urlEncode(bs58
|
|
11305
|
+
publicKey: base64urlEncode(bs58.decode(this.activeKeyPairRecord.keyInfo.publicKey)),
|
|
10448
11306
|
signature: signatureBase64url,
|
|
10449
11307
|
kind: "PKI",
|
|
10450
11308
|
algorithm: this.algorithm
|
|
10451
11309
|
} : {
|
|
10452
11310
|
kind: "OIDC",
|
|
10453
11311
|
idToken,
|
|
10454
|
-
publicKey: base64urlEncode(bs58
|
|
11312
|
+
publicKey: base64urlEncode(bs58.decode(this.activeKeyPairRecord.keyInfo.publicKey)),
|
|
10455
11313
|
salt,
|
|
10456
11314
|
algorithm: this.algorithm,
|
|
10457
11315
|
signature: signatureBase64url
|
|
@@ -10554,7 +11412,7 @@ var IndexedDbStamper = class {
|
|
|
10554
11412
|
["sign", "verify"]
|
|
10555
11413
|
);
|
|
10556
11414
|
const rawPublicKeyBuffer = await crypto.subtle.exportKey("raw", keyPair.publicKey);
|
|
10557
|
-
const publicKeyBase58 = bs58
|
|
11415
|
+
const publicKeyBase58 = bs58.encode(new Uint8Array(rawPublicKeyBuffer));
|
|
10558
11416
|
const keyIdBuffer = await crypto.subtle.digest("SHA-256", rawPublicKeyBuffer);
|
|
10559
11417
|
const keyId = base64urlEncode(new Uint8Array(keyIdBuffer)).substring(0, 16);
|
|
10560
11418
|
const now = Date.now();
|
|
@@ -15884,4 +16742,4 @@ function ConnectBox({ maxWidth = "350px", transparent = false, appIcon, appName
|
|
|
15884
16742
|
}
|
|
15885
16743
|
|
|
15886
16744
|
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 };
|
|
15887
|
-
//# sourceMappingURL=index-
|
|
16745
|
+
//# sourceMappingURL=index-CiwYJvf8.esm.js.map
|