@lendasat/lendaswap-sdk-pure 0.2.42 → 0.2.44
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/_esm-7KJOBTZC.js +3660 -0
- package/dist/_esm-7KJOBTZC.js.map +1 -0
- package/dist/_esm-UGRDSVEV.cjs +3662 -0
- package/dist/_esm-UGRDSVEV.cjs.map +1 -0
- package/dist/api/client.d.ts +0 -4
- package/dist/api/client.d.ts.map +1 -1
- package/dist/base-2KYNAFR3.cjs +109 -0
- package/dist/base-2KYNAFR3.cjs.map +1 -0
- package/dist/base-B6OGU65B.js +7 -0
- package/dist/base-B6OGU65B.js.map +1 -0
- package/dist/ccip-MPMAZOUF.js +5 -0
- package/dist/ccip-MPMAZOUF.js.map +1 -0
- package/dist/ccip-PD37NJHA.cjs +26 -0
- package/dist/ccip-PD37NJHA.cjs.map +1 -0
- package/dist/cctp-bridge/index.cjs +67 -0
- package/dist/cctp-bridge/index.cjs.map +1 -0
- package/dist/cctp-bridge/index.js +51 -15
- package/dist/cctp-bridge/index.js.map +1 -1
- package/dist/cctp-inbound/client.d.ts +21 -19
- package/dist/cctp-inbound/client.d.ts.map +1 -1
- package/dist/cctp-inbound/smartAccount.d.ts +21 -19
- package/dist/cctp-inbound/smartAccount.d.ts.map +1 -1
- package/dist/chunk-3JWT4OW2.js +369 -0
- package/dist/chunk-3JWT4OW2.js.map +1 -0
- package/dist/chunk-A4GKKURK.cjs +430 -0
- package/dist/chunk-A4GKKURK.cjs.map +1 -0
- package/dist/chunk-BZU3R5DJ.cjs +554 -0
- package/dist/chunk-BZU3R5DJ.cjs.map +1 -0
- package/dist/chunk-C4YXYD24.js +418 -0
- package/dist/chunk-C4YXYD24.js.map +1 -0
- package/dist/chunk-CZNQYFDP.js +6141 -0
- package/dist/chunk-CZNQYFDP.js.map +1 -0
- package/dist/chunk-DKTFDGIU.js +2207 -0
- package/dist/chunk-DKTFDGIU.js.map +1 -0
- package/dist/chunk-DNSJDKTP.cjs +96 -0
- package/dist/chunk-DNSJDKTP.cjs.map +1 -0
- package/dist/chunk-EPKFLKTM.js +47093 -0
- package/dist/chunk-EPKFLKTM.js.map +1 -0
- package/dist/chunk-JBVKWKD4.cjs +50 -0
- package/dist/chunk-JBVKWKD4.cjs.map +1 -0
- package/dist/chunk-NPFJAXKV.js +551 -0
- package/dist/chunk-NPFJAXKV.js.map +1 -0
- package/dist/chunk-PKDJZJMV.cjs +2214 -0
- package/dist/chunk-PKDJZJMV.cjs.map +1 -0
- package/dist/chunk-PLDDJCW6.js +43 -0
- package/dist/chunk-PLDDJCW6.js.map +1 -0
- package/dist/chunk-RIOT5VOJ.cjs +47240 -0
- package/dist/chunk-RIOT5VOJ.cjs.map +1 -0
- package/dist/chunk-WVZSHRV7.cjs +431 -0
- package/dist/chunk-WVZSHRV7.cjs.map +1 -0
- package/dist/chunk-YEZOPVAH.js +86 -0
- package/dist/chunk-YEZOPVAH.js.map +1 -0
- package/dist/chunk-YLWPBHMV.cjs +6311 -0
- package/dist/chunk-YLWPBHMV.cjs.map +1 -0
- package/dist/client.d.ts +68 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/compose-quote.d.ts +77 -0
- package/dist/compose-quote.d.ts.map +1 -0
- package/dist/delegate.cjs +23 -0
- package/dist/delegate.cjs.map +1 -0
- package/dist/delegate.js +5 -269
- package/dist/delegate.js.map +1 -1
- package/dist/dist-NE2R4YCX.js +5 -0
- package/dist/dist-NE2R4YCX.js.map +1 -0
- package/dist/dist-VEHYC67F.cjs +550 -0
- package/dist/dist-VEHYC67F.cjs.map +1 -0
- package/dist/esplora.d.ts +14 -0
- package/dist/esplora.d.ts.map +1 -1
- package/dist/generated/api.d.ts +235 -38
- package/dist/generated/api.d.ts.map +1 -1
- package/dist/index.cjs +35461 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35309 -32
- package/dist/index.js.map +1 -1
- package/dist/mine.wasm-JJEJEODX.js +9 -0
- package/dist/mine.wasm-JJEJEODX.js.map +1 -0
- package/dist/mine.wasm-Z3ORSBKN.cjs +12 -0
- package/dist/mine.wasm-Z3ORSBKN.cjs.map +1 -0
- package/dist/node.cjs +166 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.js +157 -18
- package/dist/node.js.map +1 -1
- package/dist/secp256k1-PJCSE4N6.cjs +30 -0
- package/dist/secp256k1-PJCSE4N6.cjs.map +1 -0
- package/dist/secp256k1-VZNNVEPN.js +5 -0
- package/dist/secp256k1-VZNNVEPN.js.map +1 -0
- package/dist/tokens.d.ts +2 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/types/chain-config.d.ts +50 -0
- package/dist/types/chain-config.d.ts.map +1 -0
- package/dist/types/chain.d.ts +11 -0
- package/dist/types/chain.d.ts.map +1 -0
- package/dist/types/dex-quote.d.ts +85 -0
- package/dist/types/dex-quote.d.ts.map +1 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/network-fees.d.ts +43 -0
- package/dist/types/network-fees.d.ts.map +1 -0
- package/dist/types/quote.d.ts +87 -0
- package/dist/types/quote.d.ts.map +1 -0
- package/dist/types/swap-pairs.d.ts +37 -0
- package/dist/types/swap-pairs.d.ts.map +1 -0
- package/dist/version.d.ts +2 -2
- package/dist/wallet-SCGRX3EN.js +4 -0
- package/dist/wallet-SCGRX3EN.js.map +1 -0
- package/dist/wallet-SZJDXAY7.cjs +45 -0
- package/dist/wallet-SZJDXAY7.cjs.map +1 -0
- package/package.json +23 -10
- package/dist/api/client.js +0 -13
- package/dist/api/client.js.map +0 -1
- package/dist/arkade-network.js +0 -40
- package/dist/arkade-network.js.map +0 -1
- package/dist/arkade.js +0 -61
- package/dist/arkade.js.map +0 -1
- package/dist/cctp/attestation.js +0 -149
- package/dist/cctp/attestation.js.map +0 -1
- package/dist/cctp/constants.js +0 -92
- package/dist/cctp/constants.js.map +0 -1
- package/dist/cctp/fee.js +0 -70
- package/dist/cctp/fee.js.map +0 -1
- package/dist/cctp/index.js +0 -13
- package/dist/cctp/index.js.map +0 -1
- package/dist/cctp/types.js +0 -5
- package/dist/cctp/types.js.map +0 -1
- package/dist/cctp/utils.js +0 -91
- package/dist/cctp/utils.js.map +0 -1
- package/dist/cctp-bridge/bridge.js +0 -74
- package/dist/cctp-bridge/bridge.js.map +0 -1
- package/dist/cctp-inbound/approveAndBurn.js +0 -95
- package/dist/cctp-inbound/approveAndBurn.js.map +0 -1
- package/dist/cctp-inbound/burn.js +0 -66
- package/dist/cctp-inbound/burn.js.map +0 -1
- package/dist/cctp-inbound/chainMap.js +0 -128
- package/dist/cctp-inbound/chainMap.js.map +0 -1
- package/dist/cctp-inbound/client.js +0 -125
- package/dist/cctp-inbound/client.js.map +0 -1
- package/dist/cctp-inbound/eip2612.js +0 -95
- package/dist/cctp-inbound/eip2612.js.map +0 -1
- package/dist/cctp-inbound/evmSignerAdapter.js +0 -82
- package/dist/cctp-inbound/evmSignerAdapter.js.map +0 -1
- package/dist/cctp-inbound/fundSwap.js +0 -95
- package/dist/cctp-inbound/fundSwap.js.map +0 -1
- package/dist/cctp-inbound/index.js +0 -34
- package/dist/cctp-inbound/index.js.map +0 -1
- package/dist/cctp-inbound/permit2.js +0 -32
- package/dist/cctp-inbound/permit2.js.map +0 -1
- package/dist/cctp-inbound/preflight.js +0 -84
- package/dist/cctp-inbound/preflight.js.map +0 -1
- package/dist/cctp-inbound/recover.js +0 -177
- package/dist/cctp-inbound/recover.js.map +0 -1
- package/dist/cctp-inbound/smartAccount.js +0 -117
- package/dist/cctp-inbound/smartAccount.js.map +0 -1
- package/dist/cctp-inbound/submit.js +0 -136
- package/dist/cctp-inbound/submit.js.map +0 -1
- package/dist/cctp-inbound/types.js +0 -5
- package/dist/cctp-inbound/types.js.map +0 -1
- package/dist/cctp-inbound/userOp.js +0 -151
- package/dist/cctp-inbound/userOp.js.map +0 -1
- package/dist/client.js +0 -4126
- package/dist/client.js.map +0 -1
- package/dist/create/arkade-to-lightning.js +0 -76
- package/dist/create/arkade-to-lightning.js.map +0 -1
- package/dist/create/arkade.js +0 -86
- package/dist/create/arkade.js.map +0 -1
- package/dist/create/bitcoin-to-arkade.js +0 -76
- package/dist/create/bitcoin-to-arkade.js.map +0 -1
- package/dist/create/bitcoin.js +0 -77
- package/dist/create/bitcoin.js.map +0 -1
- package/dist/create/evm-to-arkade.js +0 -80
- package/dist/create/evm-to-arkade.js.map +0 -1
- package/dist/create/evm-to-bitcoin.js +0 -82
- package/dist/create/evm-to-bitcoin.js.map +0 -1
- package/dist/create/evm-to-lightning.js +0 -89
- package/dist/create/evm-to-lightning.js.map +0 -1
- package/dist/create/index.js +0 -21
- package/dist/create/index.js.map +0 -1
- package/dist/create/lightning-to-arkade.js +0 -69
- package/dist/create/lightning-to-arkade.js.map +0 -1
- package/dist/create/lightning.js +0 -61
- package/dist/create/lightning.js.map +0 -1
- package/dist/create/retry.js +0 -71
- package/dist/create/retry.js.map +0 -1
- package/dist/create/types.js +0 -5
- package/dist/create/types.js.map +0 -1
- package/dist/escrow/index.js +0 -115
- package/dist/escrow/index.js.map +0 -1
- package/dist/esplora.js +0 -47
- package/dist/esplora.js.map +0 -1
- package/dist/evm/coordinator.js +0 -714
- package/dist/evm/coordinator.js.map +0 -1
- package/dist/evm/htlc.js +0 -278
- package/dist/evm/htlc.js.map +0 -1
- package/dist/evm/index.js +0 -10
- package/dist/evm/index.js.map +0 -1
- package/dist/evm/signing.js +0 -70
- package/dist/evm/signing.js.map +0 -1
- package/dist/evm/wallet.js +0 -133
- package/dist/evm/wallet.js.map +0 -1
- package/dist/generated/api.js +0 -6
- package/dist/generated/api.js.map +0 -1
- package/dist/logging.js +0 -130
- package/dist/logging.js.map +0 -1
- package/dist/price-calculations.js +0 -135
- package/dist/price-calculations.js.map +0 -1
- package/dist/redeem/arkade.js +0 -416
- package/dist/redeem/arkade.js.map +0 -1
- package/dist/redeem/ethereum.js +0 -206
- package/dist/redeem/ethereum.js.map +0 -1
- package/dist/redeem/gasless.js +0 -73
- package/dist/redeem/gasless.js.map +0 -1
- package/dist/redeem/index.js +0 -189
- package/dist/redeem/index.js.map +0 -1
- package/dist/redeem/types.js +0 -36
- package/dist/redeem/types.js.map +0 -1
- package/dist/refund/arkade.js +0 -200
- package/dist/refund/arkade.js.map +0 -1
- package/dist/refund/collab-arkade-evm.js +0 -307
- package/dist/refund/collab-arkade-evm.js.map +0 -1
- package/dist/refund/collab-arkade-lightning.js +0 -245
- package/dist/refund/collab-arkade-lightning.js.map +0 -1
- package/dist/refund/index.js +0 -12
- package/dist/refund/index.js.map +0 -1
- package/dist/refund/onchain.js +0 -366
- package/dist/refund/onchain.js.map +0 -1
- package/dist/signer/index.js +0 -249
- package/dist/signer/index.js.map +0 -1
- package/dist/storage/idb.js +0 -236
- package/dist/storage/idb.js.map +0 -1
- package/dist/storage/index.js +0 -98
- package/dist/storage/index.js.map +0 -1
- package/dist/storage/sqlite.js +0 -206
- package/dist/storage/sqlite.js.map +0 -1
- package/dist/storage/types.js +0 -9
- package/dist/storage/types.js.map +0 -1
- package/dist/tokens.js +0 -322
- package/dist/tokens.js.map +0 -1
- package/dist/usd-price.js +0 -96
- package/dist/usd-price.js.map +0 -1
- package/dist/usdt0-bridge/constants.js +0 -71
- package/dist/usdt0-bridge/constants.js.map +0 -1
- package/dist/usdt0-bridge/index.js +0 -11
- package/dist/usdt0-bridge/index.js.map +0 -1
- package/dist/usdt0-bridge/tracking.js +0 -123
- package/dist/usdt0-bridge/tracking.js.map +0 -1
- package/dist/usdt0-bridge/utils.js +0 -51
- package/dist/usdt0-bridge/utils.js.map +0 -1
- package/dist/version.js +0 -6
- package/dist/version.js.map +0 -1
- package/dist/ws.js +0 -145
- package/dist/ws.js.map +0 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
10
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
11
|
+
}) : x)(function(x) {
|
|
12
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
13
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
|
+
});
|
|
15
|
+
var __esm = (fn, res) => function __init() {
|
|
16
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
17
|
+
};
|
|
18
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
19
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
20
|
+
};
|
|
21
|
+
var __export = (target, all) => {
|
|
22
|
+
for (var name in all)
|
|
23
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
24
|
+
};
|
|
25
|
+
var __copyProps = (to, from, except, desc) => {
|
|
26
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
27
|
+
for (let key of __getOwnPropNames(from))
|
|
28
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
29
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
30
|
+
}
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
33
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
34
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
35
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
36
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
37
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
38
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
39
|
+
mod
|
|
40
|
+
));
|
|
41
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
42
|
+
|
|
43
|
+
exports.__commonJS = __commonJS;
|
|
44
|
+
exports.__esm = __esm;
|
|
45
|
+
exports.__export = __export;
|
|
46
|
+
exports.__require = __require;
|
|
47
|
+
exports.__toCommonJS = __toCommonJS;
|
|
48
|
+
exports.__toESM = __toESM;
|
|
49
|
+
//# sourceMappingURL=chunk-JBVKWKD4.cjs.map
|
|
50
|
+
//# sourceMappingURL=chunk-JBVKWKD4.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-JBVKWKD4.cjs"}
|
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
import { __export, __esm } from './chunk-PLDDJCW6.js';
|
|
2
|
+
|
|
3
|
+
// node_modules/.pnpm/@scure+base@2.0.0/node_modules/@scure/base/index.js
|
|
4
|
+
var base_exports = {};
|
|
5
|
+
__export(base_exports, {
|
|
6
|
+
base16: () => base16,
|
|
7
|
+
base32: () => base32,
|
|
8
|
+
base32crockford: () => base32crockford,
|
|
9
|
+
base32hex: () => base32hex,
|
|
10
|
+
base32hexnopad: () => base32hexnopad,
|
|
11
|
+
base32nopad: () => base32nopad,
|
|
12
|
+
base58: () => base58,
|
|
13
|
+
base58check: () => base58check,
|
|
14
|
+
base58flickr: () => base58flickr,
|
|
15
|
+
base58xmr: () => base58xmr,
|
|
16
|
+
base58xrp: () => base58xrp,
|
|
17
|
+
base64: () => base64,
|
|
18
|
+
base64nopad: () => base64nopad,
|
|
19
|
+
base64url: () => base64url,
|
|
20
|
+
base64urlnopad: () => base64urlnopad,
|
|
21
|
+
bech32: () => bech32,
|
|
22
|
+
bech32m: () => bech32m,
|
|
23
|
+
bytes: () => bytes,
|
|
24
|
+
bytesToString: () => bytesToString,
|
|
25
|
+
createBase58check: () => createBase58check,
|
|
26
|
+
hex: () => hex,
|
|
27
|
+
str: () => str,
|
|
28
|
+
stringToBytes: () => stringToBytes,
|
|
29
|
+
utf8: () => utf8,
|
|
30
|
+
utils: () => utils
|
|
31
|
+
});
|
|
32
|
+
function isBytes(a) {
|
|
33
|
+
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
34
|
+
}
|
|
35
|
+
function abytes(b) {
|
|
36
|
+
if (!isBytes(b))
|
|
37
|
+
throw new Error("Uint8Array expected");
|
|
38
|
+
}
|
|
39
|
+
function isArrayOf(isString, arr) {
|
|
40
|
+
if (!Array.isArray(arr))
|
|
41
|
+
return false;
|
|
42
|
+
if (arr.length === 0)
|
|
43
|
+
return true;
|
|
44
|
+
if (isString) {
|
|
45
|
+
return arr.every((item) => typeof item === "string");
|
|
46
|
+
} else {
|
|
47
|
+
return arr.every((item) => Number.isSafeInteger(item));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function afn(input) {
|
|
51
|
+
if (typeof input !== "function")
|
|
52
|
+
throw new Error("function expected");
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
function astr(label, input) {
|
|
56
|
+
if (typeof input !== "string")
|
|
57
|
+
throw new Error(`${label}: string expected`);
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
function anumber(n) {
|
|
61
|
+
if (!Number.isSafeInteger(n))
|
|
62
|
+
throw new Error(`invalid integer: ${n}`);
|
|
63
|
+
}
|
|
64
|
+
function aArr(input) {
|
|
65
|
+
if (!Array.isArray(input))
|
|
66
|
+
throw new Error("array expected");
|
|
67
|
+
}
|
|
68
|
+
function astrArr(label, input) {
|
|
69
|
+
if (!isArrayOf(true, input))
|
|
70
|
+
throw new Error(`${label}: array of strings expected`);
|
|
71
|
+
}
|
|
72
|
+
function anumArr(label, input) {
|
|
73
|
+
if (!isArrayOf(false, input))
|
|
74
|
+
throw new Error(`${label}: array of numbers expected`);
|
|
75
|
+
}
|
|
76
|
+
// @__NO_SIDE_EFFECTS__
|
|
77
|
+
function chain(...args) {
|
|
78
|
+
const id = (a) => a;
|
|
79
|
+
const wrap = (a, b) => (c) => a(b(c));
|
|
80
|
+
const encode = args.map((x) => x.encode).reduceRight(wrap, id);
|
|
81
|
+
const decode = args.map((x) => x.decode).reduce(wrap, id);
|
|
82
|
+
return { encode, decode };
|
|
83
|
+
}
|
|
84
|
+
// @__NO_SIDE_EFFECTS__
|
|
85
|
+
function alphabet(letters) {
|
|
86
|
+
const lettersA = typeof letters === "string" ? letters.split("") : letters;
|
|
87
|
+
const len = lettersA.length;
|
|
88
|
+
astrArr("alphabet", lettersA);
|
|
89
|
+
const indexes = new Map(lettersA.map((l, i) => [l, i]));
|
|
90
|
+
return {
|
|
91
|
+
encode: (digits) => {
|
|
92
|
+
aArr(digits);
|
|
93
|
+
return digits.map((i) => {
|
|
94
|
+
if (!Number.isSafeInteger(i) || i < 0 || i >= len)
|
|
95
|
+
throw new Error(`alphabet.encode: digit index outside alphabet "${i}". Allowed: ${letters}`);
|
|
96
|
+
return lettersA[i];
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
decode: (input) => {
|
|
100
|
+
aArr(input);
|
|
101
|
+
return input.map((letter) => {
|
|
102
|
+
astr("alphabet.decode", letter);
|
|
103
|
+
const i = indexes.get(letter);
|
|
104
|
+
if (i === void 0)
|
|
105
|
+
throw new Error(`Unknown letter: "${letter}". Allowed: ${letters}`);
|
|
106
|
+
return i;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
// @__NO_SIDE_EFFECTS__
|
|
112
|
+
function join(separator = "") {
|
|
113
|
+
astr("join", separator);
|
|
114
|
+
return {
|
|
115
|
+
encode: (from) => {
|
|
116
|
+
astrArr("join.decode", from);
|
|
117
|
+
return from.join(separator);
|
|
118
|
+
},
|
|
119
|
+
decode: (to) => {
|
|
120
|
+
astr("join.decode", to);
|
|
121
|
+
return to.split(separator);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
// @__NO_SIDE_EFFECTS__
|
|
126
|
+
function padding(bits, chr = "=") {
|
|
127
|
+
anumber(bits);
|
|
128
|
+
astr("padding", chr);
|
|
129
|
+
return {
|
|
130
|
+
encode(data) {
|
|
131
|
+
astrArr("padding.encode", data);
|
|
132
|
+
while (data.length * bits % 8)
|
|
133
|
+
data.push(chr);
|
|
134
|
+
return data;
|
|
135
|
+
},
|
|
136
|
+
decode(input) {
|
|
137
|
+
astrArr("padding.decode", input);
|
|
138
|
+
let end = input.length;
|
|
139
|
+
if (end * bits % 8)
|
|
140
|
+
throw new Error("padding: invalid, string should have whole number of bytes");
|
|
141
|
+
for (; end > 0 && input[end - 1] === chr; end--) {
|
|
142
|
+
const last = end - 1;
|
|
143
|
+
const byte = last * bits;
|
|
144
|
+
if (byte % 8 === 0)
|
|
145
|
+
throw new Error("padding: invalid, string has too much padding");
|
|
146
|
+
}
|
|
147
|
+
return input.slice(0, end);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
// @__NO_SIDE_EFFECTS__
|
|
152
|
+
function normalize(fn) {
|
|
153
|
+
afn(fn);
|
|
154
|
+
return { encode: (from) => from, decode: (to) => fn(to) };
|
|
155
|
+
}
|
|
156
|
+
function convertRadix(data, from, to) {
|
|
157
|
+
if (from < 2)
|
|
158
|
+
throw new Error(`convertRadix: invalid from=${from}, base cannot be less than 2`);
|
|
159
|
+
if (to < 2)
|
|
160
|
+
throw new Error(`convertRadix: invalid to=${to}, base cannot be less than 2`);
|
|
161
|
+
aArr(data);
|
|
162
|
+
if (!data.length)
|
|
163
|
+
return [];
|
|
164
|
+
let pos = 0;
|
|
165
|
+
const res = [];
|
|
166
|
+
const digits = Array.from(data, (d) => {
|
|
167
|
+
anumber(d);
|
|
168
|
+
if (d < 0 || d >= from)
|
|
169
|
+
throw new Error(`invalid integer: ${d}`);
|
|
170
|
+
return d;
|
|
171
|
+
});
|
|
172
|
+
const dlen = digits.length;
|
|
173
|
+
while (true) {
|
|
174
|
+
let carry = 0;
|
|
175
|
+
let done = true;
|
|
176
|
+
for (let i = pos; i < dlen; i++) {
|
|
177
|
+
const digit = digits[i];
|
|
178
|
+
const fromCarry = from * carry;
|
|
179
|
+
const digitBase = fromCarry + digit;
|
|
180
|
+
if (!Number.isSafeInteger(digitBase) || fromCarry / from !== carry || digitBase - digit !== fromCarry) {
|
|
181
|
+
throw new Error("convertRadix: carry overflow");
|
|
182
|
+
}
|
|
183
|
+
const div = digitBase / to;
|
|
184
|
+
carry = digitBase % to;
|
|
185
|
+
const rounded = Math.floor(div);
|
|
186
|
+
digits[i] = rounded;
|
|
187
|
+
if (!Number.isSafeInteger(rounded) || rounded * to + carry !== digitBase)
|
|
188
|
+
throw new Error("convertRadix: carry overflow");
|
|
189
|
+
if (!done)
|
|
190
|
+
continue;
|
|
191
|
+
else if (!rounded)
|
|
192
|
+
pos = i;
|
|
193
|
+
else
|
|
194
|
+
done = false;
|
|
195
|
+
}
|
|
196
|
+
res.push(carry);
|
|
197
|
+
if (done)
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
for (let i = 0; i < data.length - 1 && data[i] === 0; i++)
|
|
201
|
+
res.push(0);
|
|
202
|
+
return res.reverse();
|
|
203
|
+
}
|
|
204
|
+
function convertRadix2(data, from, to, padding2) {
|
|
205
|
+
aArr(data);
|
|
206
|
+
if (from <= 0 || from > 32)
|
|
207
|
+
throw new Error(`convertRadix2: wrong from=${from}`);
|
|
208
|
+
if (to <= 0 || to > 32)
|
|
209
|
+
throw new Error(`convertRadix2: wrong to=${to}`);
|
|
210
|
+
if (/* @__PURE__ */ radix2carry(from, to) > 32) {
|
|
211
|
+
throw new Error(`convertRadix2: carry overflow from=${from} to=${to} carryBits=${/* @__PURE__ */ radix2carry(from, to)}`);
|
|
212
|
+
}
|
|
213
|
+
let carry = 0;
|
|
214
|
+
let pos = 0;
|
|
215
|
+
const max = powers[from];
|
|
216
|
+
const mask = powers[to] - 1;
|
|
217
|
+
const res = [];
|
|
218
|
+
for (const n of data) {
|
|
219
|
+
anumber(n);
|
|
220
|
+
if (n >= max)
|
|
221
|
+
throw new Error(`convertRadix2: invalid data word=${n} from=${from}`);
|
|
222
|
+
carry = carry << from | n;
|
|
223
|
+
if (pos + from > 32)
|
|
224
|
+
throw new Error(`convertRadix2: carry overflow pos=${pos} from=${from}`);
|
|
225
|
+
pos += from;
|
|
226
|
+
for (; pos >= to; pos -= to)
|
|
227
|
+
res.push((carry >> pos - to & mask) >>> 0);
|
|
228
|
+
const pow = powers[pos];
|
|
229
|
+
if (pow === void 0)
|
|
230
|
+
throw new Error("invalid carry");
|
|
231
|
+
carry &= pow - 1;
|
|
232
|
+
}
|
|
233
|
+
carry = carry << to - pos & mask;
|
|
234
|
+
if (!padding2 && pos >= from)
|
|
235
|
+
throw new Error("Excess padding");
|
|
236
|
+
if (!padding2 && carry > 0)
|
|
237
|
+
throw new Error(`Non-zero padding: ${carry}`);
|
|
238
|
+
if (padding2 && pos > 0)
|
|
239
|
+
res.push(carry >>> 0);
|
|
240
|
+
return res;
|
|
241
|
+
}
|
|
242
|
+
// @__NO_SIDE_EFFECTS__
|
|
243
|
+
function radix(num) {
|
|
244
|
+
anumber(num);
|
|
245
|
+
const _256 = 2 ** 8;
|
|
246
|
+
return {
|
|
247
|
+
encode: (bytes2) => {
|
|
248
|
+
if (!isBytes(bytes2))
|
|
249
|
+
throw new Error("radix.encode input should be Uint8Array");
|
|
250
|
+
return convertRadix(Array.from(bytes2), _256, num);
|
|
251
|
+
},
|
|
252
|
+
decode: (digits) => {
|
|
253
|
+
anumArr("radix.decode", digits);
|
|
254
|
+
return Uint8Array.from(convertRadix(digits, num, _256));
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
// @__NO_SIDE_EFFECTS__
|
|
259
|
+
function radix2(bits, revPadding = false) {
|
|
260
|
+
anumber(bits);
|
|
261
|
+
if (bits <= 0 || bits > 32)
|
|
262
|
+
throw new Error("radix2: bits should be in (0..32]");
|
|
263
|
+
if (/* @__PURE__ */ radix2carry(8, bits) > 32 || /* @__PURE__ */ radix2carry(bits, 8) > 32)
|
|
264
|
+
throw new Error("radix2: carry overflow");
|
|
265
|
+
return {
|
|
266
|
+
encode: (bytes2) => {
|
|
267
|
+
if (!isBytes(bytes2))
|
|
268
|
+
throw new Error("radix2.encode input should be Uint8Array");
|
|
269
|
+
return convertRadix2(Array.from(bytes2), 8, bits, !revPadding);
|
|
270
|
+
},
|
|
271
|
+
decode: (digits) => {
|
|
272
|
+
anumArr("radix2.decode", digits);
|
|
273
|
+
return Uint8Array.from(convertRadix2(digits, bits, 8, revPadding));
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
function unsafeWrapper(fn) {
|
|
278
|
+
afn(fn);
|
|
279
|
+
return function(...args) {
|
|
280
|
+
try {
|
|
281
|
+
return fn.apply(null, args);
|
|
282
|
+
} catch (e) {
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
function checksum(len, fn) {
|
|
287
|
+
anumber(len);
|
|
288
|
+
afn(fn);
|
|
289
|
+
return {
|
|
290
|
+
encode(data) {
|
|
291
|
+
if (!isBytes(data))
|
|
292
|
+
throw new Error("checksum.encode: input should be Uint8Array");
|
|
293
|
+
const sum = fn(data).slice(0, len);
|
|
294
|
+
const res = new Uint8Array(data.length + len);
|
|
295
|
+
res.set(data);
|
|
296
|
+
res.set(sum, data.length);
|
|
297
|
+
return res;
|
|
298
|
+
},
|
|
299
|
+
decode(data) {
|
|
300
|
+
if (!isBytes(data))
|
|
301
|
+
throw new Error("checksum.decode: input should be Uint8Array");
|
|
302
|
+
const payload = data.slice(0, -len);
|
|
303
|
+
const oldChecksum = data.slice(-len);
|
|
304
|
+
const newChecksum = fn(payload).slice(0, len);
|
|
305
|
+
for (let i = 0; i < len; i++)
|
|
306
|
+
if (newChecksum[i] !== oldChecksum[i])
|
|
307
|
+
throw new Error("Invalid checksum");
|
|
308
|
+
return payload;
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
function bech32Polymod(pre) {
|
|
313
|
+
const b = pre >> 25;
|
|
314
|
+
let chk = (pre & 33554431) << 5;
|
|
315
|
+
for (let i = 0; i < POLYMOD_GENERATORS.length; i++) {
|
|
316
|
+
if ((b >> i & 1) === 1)
|
|
317
|
+
chk ^= POLYMOD_GENERATORS[i];
|
|
318
|
+
}
|
|
319
|
+
return chk;
|
|
320
|
+
}
|
|
321
|
+
function bechChecksum(prefix, words, encodingConst = 1) {
|
|
322
|
+
const len = prefix.length;
|
|
323
|
+
let chk = 1;
|
|
324
|
+
for (let i = 0; i < len; i++) {
|
|
325
|
+
const c = prefix.charCodeAt(i);
|
|
326
|
+
if (c < 33 || c > 126)
|
|
327
|
+
throw new Error(`Invalid prefix (${prefix})`);
|
|
328
|
+
chk = bech32Polymod(chk) ^ c >> 5;
|
|
329
|
+
}
|
|
330
|
+
chk = bech32Polymod(chk);
|
|
331
|
+
for (let i = 0; i < len; i++)
|
|
332
|
+
chk = bech32Polymod(chk) ^ prefix.charCodeAt(i) & 31;
|
|
333
|
+
for (let v of words)
|
|
334
|
+
chk = bech32Polymod(chk) ^ v;
|
|
335
|
+
for (let i = 0; i < 6; i++)
|
|
336
|
+
chk = bech32Polymod(chk);
|
|
337
|
+
chk ^= encodingConst;
|
|
338
|
+
return BECH_ALPHABET.encode(convertRadix2([chk % powers[30]], 30, 5, false));
|
|
339
|
+
}
|
|
340
|
+
// @__NO_SIDE_EFFECTS__
|
|
341
|
+
function genBech32(encoding) {
|
|
342
|
+
const ENCODING_CONST = encoding === "bech32" ? 1 : 734539939;
|
|
343
|
+
const _words = /* @__PURE__ */ radix2(5);
|
|
344
|
+
const fromWords = _words.decode;
|
|
345
|
+
const toWords = _words.encode;
|
|
346
|
+
const fromWordsUnsafe = unsafeWrapper(fromWords);
|
|
347
|
+
function encode(prefix, words, limit = 90) {
|
|
348
|
+
astr("bech32.encode prefix", prefix);
|
|
349
|
+
if (isBytes(words))
|
|
350
|
+
words = Array.from(words);
|
|
351
|
+
anumArr("bech32.encode", words);
|
|
352
|
+
const plen = prefix.length;
|
|
353
|
+
if (plen === 0)
|
|
354
|
+
throw new TypeError(`Invalid prefix length ${plen}`);
|
|
355
|
+
const actualLength = plen + 7 + words.length;
|
|
356
|
+
if (limit !== false && actualLength > limit)
|
|
357
|
+
throw new TypeError(`Length ${actualLength} exceeds limit ${limit}`);
|
|
358
|
+
const lowered = prefix.toLowerCase();
|
|
359
|
+
const sum = bechChecksum(lowered, words, ENCODING_CONST);
|
|
360
|
+
return `${lowered}1${BECH_ALPHABET.encode(words)}${sum}`;
|
|
361
|
+
}
|
|
362
|
+
function decode(str2, limit = 90) {
|
|
363
|
+
astr("bech32.decode input", str2);
|
|
364
|
+
const slen = str2.length;
|
|
365
|
+
if (slen < 8 || limit !== false && slen > limit)
|
|
366
|
+
throw new TypeError(`invalid string length: ${slen} (${str2}). Expected (8..${limit})`);
|
|
367
|
+
const lowered = str2.toLowerCase();
|
|
368
|
+
if (str2 !== lowered && str2 !== str2.toUpperCase())
|
|
369
|
+
throw new Error(`String must be lowercase or uppercase`);
|
|
370
|
+
const sepIndex = lowered.lastIndexOf("1");
|
|
371
|
+
if (sepIndex === 0 || sepIndex === -1)
|
|
372
|
+
throw new Error(`Letter "1" must be present between prefix and data only`);
|
|
373
|
+
const prefix = lowered.slice(0, sepIndex);
|
|
374
|
+
const data = lowered.slice(sepIndex + 1);
|
|
375
|
+
if (data.length < 6)
|
|
376
|
+
throw new Error("Data must be at least 6 characters long");
|
|
377
|
+
const words = BECH_ALPHABET.decode(data).slice(0, -6);
|
|
378
|
+
const sum = bechChecksum(prefix, words, ENCODING_CONST);
|
|
379
|
+
if (!data.endsWith(sum))
|
|
380
|
+
throw new Error(`Invalid checksum in ${str2}: expected "${sum}"`);
|
|
381
|
+
return { prefix, words };
|
|
382
|
+
}
|
|
383
|
+
const decodeUnsafe = unsafeWrapper(decode);
|
|
384
|
+
function decodeToBytes(str2) {
|
|
385
|
+
const { prefix, words } = decode(str2, false);
|
|
386
|
+
return { prefix, words, bytes: fromWords(words) };
|
|
387
|
+
}
|
|
388
|
+
function encodeFromBytes(prefix, bytes2) {
|
|
389
|
+
return encode(prefix, toWords(bytes2));
|
|
390
|
+
}
|
|
391
|
+
return {
|
|
392
|
+
encode,
|
|
393
|
+
decode,
|
|
394
|
+
encodeFromBytes,
|
|
395
|
+
decodeToBytes,
|
|
396
|
+
decodeUnsafe,
|
|
397
|
+
fromWords,
|
|
398
|
+
fromWordsUnsafe,
|
|
399
|
+
toWords
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
var gcd, radix2carry, powers, utils, base16, base32, base32nopad, base32hex, base32hexnopad, base32crockford, hasBase64Builtin, decodeBase64Builtin, base64, base64nopad, base64url, base64urlnopad, genBase58, base58, base58flickr, base58xrp, XMR_BLOCK_LEN, base58xmr, createBase58check, base58check, BECH_ALPHABET, POLYMOD_GENERATORS, bech32, bech32m, utf8, hasHexBuiltin, hexBuiltin, hex, CODERS, coderTypeError, bytesToString, str, stringToBytes, bytes;
|
|
403
|
+
var init_base = __esm({
|
|
404
|
+
"node_modules/.pnpm/@scure+base@2.0.0/node_modules/@scure/base/index.js"() {
|
|
405
|
+
gcd = (a, b) => b === 0 ? a : gcd(b, a % b);
|
|
406
|
+
radix2carry = /* @__NO_SIDE_EFFECTS__ */ (from, to) => from + (to - gcd(from, to));
|
|
407
|
+
powers = /* @__PURE__ */ (() => {
|
|
408
|
+
let res = [];
|
|
409
|
+
for (let i = 0; i < 40; i++)
|
|
410
|
+
res.push(2 ** i);
|
|
411
|
+
return res;
|
|
412
|
+
})();
|
|
413
|
+
utils = {
|
|
414
|
+
alphabet,
|
|
415
|
+
chain,
|
|
416
|
+
checksum,
|
|
417
|
+
convertRadix,
|
|
418
|
+
convertRadix2,
|
|
419
|
+
radix,
|
|
420
|
+
radix2,
|
|
421
|
+
join,
|
|
422
|
+
padding
|
|
423
|
+
};
|
|
424
|
+
base16 = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(4), /* @__PURE__ */ alphabet("0123456789ABCDEF"), /* @__PURE__ */ join(""));
|
|
425
|
+
base32 = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(5), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"), /* @__PURE__ */ padding(5), /* @__PURE__ */ join(""));
|
|
426
|
+
base32nopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(5), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"), /* @__PURE__ */ join(""));
|
|
427
|
+
base32hex = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(5), /* @__PURE__ */ alphabet("0123456789ABCDEFGHIJKLMNOPQRSTUV"), /* @__PURE__ */ padding(5), /* @__PURE__ */ join(""));
|
|
428
|
+
base32hexnopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(5), /* @__PURE__ */ alphabet("0123456789ABCDEFGHIJKLMNOPQRSTUV"), /* @__PURE__ */ join(""));
|
|
429
|
+
base32crockford = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(5), /* @__PURE__ */ alphabet("0123456789ABCDEFGHJKMNPQRSTVWXYZ"), /* @__PURE__ */ join(""), /* @__PURE__ */ normalize((s) => s.toUpperCase().replace(/O/g, "0").replace(/[IL]/g, "1")));
|
|
430
|
+
hasBase64Builtin = /* @__PURE__ */ (() => typeof Uint8Array.from([]).toBase64 === "function" && typeof Uint8Array.fromBase64 === "function")();
|
|
431
|
+
decodeBase64Builtin = (s, isUrl) => {
|
|
432
|
+
astr("base64", s);
|
|
433
|
+
const re = isUrl ? /^[A-Za-z0-9=_-]+$/ : /^[A-Za-z0-9=+/]+$/;
|
|
434
|
+
const alphabet2 = isUrl ? "base64url" : "base64";
|
|
435
|
+
if (s.length > 0 && !re.test(s))
|
|
436
|
+
throw new Error("invalid base64");
|
|
437
|
+
return Uint8Array.fromBase64(s, { alphabet: alphabet2, lastChunkHandling: "strict" });
|
|
438
|
+
};
|
|
439
|
+
base64 = hasBase64Builtin ? {
|
|
440
|
+
encode(b) {
|
|
441
|
+
abytes(b);
|
|
442
|
+
return b.toBase64();
|
|
443
|
+
},
|
|
444
|
+
decode(s) {
|
|
445
|
+
return decodeBase64Builtin(s, false);
|
|
446
|
+
}
|
|
447
|
+
} : /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ padding(6), /* @__PURE__ */ join(""));
|
|
448
|
+
base64nopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ join(""));
|
|
449
|
+
base64url = hasBase64Builtin ? {
|
|
450
|
+
encode(b) {
|
|
451
|
+
abytes(b);
|
|
452
|
+
return b.toBase64({ alphabet: "base64url" });
|
|
453
|
+
},
|
|
454
|
+
decode(s) {
|
|
455
|
+
return decodeBase64Builtin(s, true);
|
|
456
|
+
}
|
|
457
|
+
} : /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"), /* @__PURE__ */ padding(6), /* @__PURE__ */ join(""));
|
|
458
|
+
base64urlnopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"), /* @__PURE__ */ join(""));
|
|
459
|
+
genBase58 = /* @__NO_SIDE_EFFECTS__ */ (abc) => /* @__PURE__ */ chain(/* @__PURE__ */ radix(58), /* @__PURE__ */ alphabet(abc), /* @__PURE__ */ join(""));
|
|
460
|
+
base58 = /* @__PURE__ */ genBase58("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
|
|
461
|
+
base58flickr = /* @__PURE__ */ genBase58("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");
|
|
462
|
+
base58xrp = /* @__PURE__ */ genBase58("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");
|
|
463
|
+
XMR_BLOCK_LEN = [0, 2, 3, 5, 6, 7, 9, 10, 11];
|
|
464
|
+
base58xmr = {
|
|
465
|
+
encode(data) {
|
|
466
|
+
let res = "";
|
|
467
|
+
for (let i = 0; i < data.length; i += 8) {
|
|
468
|
+
const block = data.subarray(i, i + 8);
|
|
469
|
+
res += base58.encode(block).padStart(XMR_BLOCK_LEN[block.length], "1");
|
|
470
|
+
}
|
|
471
|
+
return res;
|
|
472
|
+
},
|
|
473
|
+
decode(str2) {
|
|
474
|
+
let res = [];
|
|
475
|
+
for (let i = 0; i < str2.length; i += 11) {
|
|
476
|
+
const slice = str2.slice(i, i + 11);
|
|
477
|
+
const blockLen = XMR_BLOCK_LEN.indexOf(slice.length);
|
|
478
|
+
const block = base58.decode(slice);
|
|
479
|
+
for (let j = 0; j < block.length - blockLen; j++) {
|
|
480
|
+
if (block[j] !== 0)
|
|
481
|
+
throw new Error("base58xmr: wrong padding");
|
|
482
|
+
}
|
|
483
|
+
res = res.concat(Array.from(block.slice(block.length - blockLen)));
|
|
484
|
+
}
|
|
485
|
+
return Uint8Array.from(res);
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
createBase58check = (sha256) => /* @__PURE__ */ chain(checksum(4, (data) => sha256(sha256(data))), base58);
|
|
489
|
+
base58check = createBase58check;
|
|
490
|
+
BECH_ALPHABET = /* @__PURE__ */ chain(/* @__PURE__ */ alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), /* @__PURE__ */ join(""));
|
|
491
|
+
POLYMOD_GENERATORS = [996825010, 642813549, 513874426, 1027748829, 705979059];
|
|
492
|
+
bech32 = /* @__PURE__ */ genBech32("bech32");
|
|
493
|
+
bech32m = /* @__PURE__ */ genBech32("bech32m");
|
|
494
|
+
utf8 = {
|
|
495
|
+
encode: (data) => new TextDecoder().decode(data),
|
|
496
|
+
decode: (str2) => new TextEncoder().encode(str2)
|
|
497
|
+
};
|
|
498
|
+
hasHexBuiltin = /* @__PURE__ */ (() => typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function")();
|
|
499
|
+
hexBuiltin = {
|
|
500
|
+
encode(data) {
|
|
501
|
+
abytes(data);
|
|
502
|
+
return data.toHex();
|
|
503
|
+
},
|
|
504
|
+
decode(s) {
|
|
505
|
+
astr("hex", s);
|
|
506
|
+
return Uint8Array.fromHex(s);
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
hex = hasHexBuiltin ? hexBuiltin : /* @__PURE__ */ chain(/* @__PURE__ */ radix2(4), /* @__PURE__ */ alphabet("0123456789abcdef"), /* @__PURE__ */ join(""), /* @__PURE__ */ normalize((s) => {
|
|
510
|
+
if (typeof s !== "string" || s.length % 2 !== 0)
|
|
511
|
+
throw new TypeError(`hex.decode: expected string, got ${typeof s} with length ${s.length}`);
|
|
512
|
+
return s.toLowerCase();
|
|
513
|
+
}));
|
|
514
|
+
CODERS = {
|
|
515
|
+
utf8,
|
|
516
|
+
hex,
|
|
517
|
+
base16,
|
|
518
|
+
base32,
|
|
519
|
+
base64,
|
|
520
|
+
base64url,
|
|
521
|
+
base58,
|
|
522
|
+
base58xmr
|
|
523
|
+
};
|
|
524
|
+
coderTypeError = "Invalid encoding type. Available types: utf8, hex, base16, base32, base64, base64url, base58, base58xmr";
|
|
525
|
+
bytesToString = (type, bytes2) => {
|
|
526
|
+
if (typeof type !== "string" || !CODERS.hasOwnProperty(type))
|
|
527
|
+
throw new TypeError(coderTypeError);
|
|
528
|
+
if (!isBytes(bytes2))
|
|
529
|
+
throw new TypeError("bytesToString() expects Uint8Array");
|
|
530
|
+
return CODERS[type].encode(bytes2);
|
|
531
|
+
};
|
|
532
|
+
str = bytesToString;
|
|
533
|
+
stringToBytes = (type, str2) => {
|
|
534
|
+
if (!CODERS.hasOwnProperty(type))
|
|
535
|
+
throw new TypeError(coderTypeError);
|
|
536
|
+
if (typeof str2 !== "string")
|
|
537
|
+
throw new TypeError("stringToBytes() expects string");
|
|
538
|
+
return CODERS[type].decode(str2);
|
|
539
|
+
};
|
|
540
|
+
bytes = stringToBytes;
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
/*! Bundled license information:
|
|
544
|
+
|
|
545
|
+
@scure/base/index.js:
|
|
546
|
+
(*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
547
|
+
*/
|
|
548
|
+
|
|
549
|
+
export { base16, base32, base32crockford, base32hex, base32hexnopad, base32nopad, base58, base58check, base58flickr, base58xmr, base58xrp, base64, base64nopad, base64url, base64urlnopad, base_exports, bech32, bech32m, bytes, bytesToString, createBase58check, hex, init_base, str, stringToBytes, utf8, utils };
|
|
550
|
+
//# sourceMappingURL=chunk-NPFJAXKV.js.map
|
|
551
|
+
//# sourceMappingURL=chunk-NPFJAXKV.js.map
|