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