@proton/wrap-constants 0.3.0 → 0.3.1

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.cjs CHANGED
@@ -26,6 +26,9 @@ let lodash_clonedeep = require("lodash.clonedeep");
26
26
  lodash_clonedeep = __toESM(lodash_clonedeep, 1);
27
27
  let bignumber_js = require("bignumber.js");
28
28
  bignumber_js = __toESM(bignumber_js, 1);
29
+ let _scure_base = require("@scure/base");
30
+ let _noble_hashes_sha2 = require("@noble/hashes/sha2");
31
+ let _noble_hashes_sha3 = require("@noble/hashes/sha3");
29
32
  // src/coins.ts
30
33
  let Chains = /* @__PURE__ */ function(Chains) {
31
34
  Chains["BitcoinMainnet"] = "Bitcoin";
@@ -2297,13 +2300,304 @@ const applyDiscountToFee = (fee, staked) => {
2297
2300
  else if (staked >= 1e5) return fee * .66;
2298
2301
  else return fee;
2299
2302
  };
2303
+ // src/validation/address.ts
2304
+ /**
2305
+ * Withdrawal destination validation for the bridge (MFE-855).
2306
+ *
2307
+ * The address and memo end up inside the XPR transfer memo as
2308
+ * `coin:network:address[?memo=...]:fee`, which the bridge server splits on ':'.
2309
+ * So beyond per-chain format checks, these validators also reject characters
2310
+ * that would corrupt that structure.
2311
+ *
2312
+ * Result levels:
2313
+ * - 'full' : the chain's address format was fully checked, including its
2314
+ * checksum where the format has one. Formats without a checksum
2315
+ * (Solana keys, EOS names, Hedera ids, single-case EVM) cannot
2316
+ * catch every typo even at this level.
2317
+ * - 'basic' : only the shared safety rules (and partial format checks) ran,
2318
+ * because no complete validator exists for this chain/format.
2319
+ */
2320
+ const MAX_ADDRESS_LENGTH = 128;
2321
+ const MAX_DEFAULT_MEMO_BYTES = 256;
2322
+ const FULL = {
2323
+ valid: true,
2324
+ level: "full"
2325
+ };
2326
+ const BASIC = {
2327
+ valid: true,
2328
+ level: "basic"
2329
+ };
2330
+ const fail = (reason) => ({
2331
+ valid: false,
2332
+ reason
2333
+ });
2334
+ const PRINTABLE_ASCII = /^[\x21-\x7e]+$/;
2335
+ const sharedAddressChecks = (address) => {
2336
+ if (typeof address !== "string" || address.length === 0) return fail("Address is required.");
2337
+ if (address.length > 128) return fail("Address is too long.");
2338
+ if (!PRINTABLE_ASCII.test(address)) return fail("Address contains spaces or unsupported characters.");
2339
+ if (address.includes(":")) return fail("Address must not contain \":\". If you pasted a payment link, paste only the address.");
2340
+ if (address.includes("?")) return fail("Address must not contain \"?\". Use the memo field for memos or tags.");
2341
+ return null;
2342
+ };
2343
+ const tryDecode = (fn) => {
2344
+ try {
2345
+ return fn();
2346
+ } catch {
2347
+ return;
2348
+ }
2349
+ };
2350
+ const bytesEqual = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
2351
+ const allZero = (a) => a.every((v) => v === 0);
2352
+ const UTXO_PARAMS = {
2353
+ ["Bitcoin"]: {
2354
+ name: "Bitcoin",
2355
+ segwitHrp: "bc",
2356
+ base58Versions: [0, 5]
2357
+ },
2358
+ ["Bitcoin (Testnet)"]: {
2359
+ name: "Bitcoin testnet",
2360
+ segwitHrp: "tb",
2361
+ base58Versions: [111, 196]
2362
+ },
2363
+ ["Litecoin"]: {
2364
+ name: "Litecoin",
2365
+ segwitHrp: "ltc",
2366
+ base58Versions: [
2367
+ 48,
2368
+ 50,
2369
+ 5
2370
+ ]
2371
+ },
2372
+ ["Litecoin (Testnet)"]: {
2373
+ name: "Litecoin testnet",
2374
+ segwitHrp: "tltc",
2375
+ base58Versions: [
2376
+ 111,
2377
+ 58,
2378
+ 196
2379
+ ]
2380
+ },
2381
+ ["Dogecoin"]: {
2382
+ name: "Dogecoin",
2383
+ base58Versions: [30, 22]
2384
+ }
2385
+ };
2386
+ const base58check = (0, _scure_base.createBase58check)(_noble_hashes_sha2.sha256);
2387
+ const BECH32_CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
2388
+ const validateSegwit = (address, hrp, name) => {
2389
+ if (address.length > 90) return fail(`Not a valid ${name} address.`);
2390
+ const lower = address.toLowerCase();
2391
+ const version = BECH32_CHARSET.indexOf(lower.charAt(hrp.length + 1));
2392
+ if (version < 0) return fail(`Not a valid ${name} address.`);
2393
+ const decoded = tryDecode(() => (version === 0 ? _scure_base.bech32 : _scure_base.bech32m).decode(address, 90));
2394
+ if (!decoded || decoded.prefix !== hrp) return fail(`Not a valid ${name} address (checksum or network mismatch).`);
2395
+ const program = tryDecode(() => _scure_base.bech32.fromWords(decoded.words.slice(1)));
2396
+ if (!program) return fail(`Not a valid ${name} address.`);
2397
+ if (version === 0 && program.length !== 20 && program.length !== 32) return fail(`Not a valid ${name} address.`);
2398
+ if (version === 1 && program.length !== 32) return fail(`Not a valid ${name} address.`);
2399
+ if (version > 1) return fail(`Unsupported ${name} address version.`);
2400
+ return FULL;
2401
+ };
2402
+ const validateUtxo = (address, params) => {
2403
+ const { name, segwitHrp, base58Versions } = params;
2404
+ if (segwitHrp && address.toLowerCase().startsWith(`${segwitHrp}1`)) return validateSegwit(address, segwitHrp, name);
2405
+ const payload = tryDecode(() => base58check.decode(address));
2406
+ if (!payload || payload.length !== 21 || !base58Versions.includes(payload[0])) return fail(`Not a valid ${name} address (checksum or network mismatch).`);
2407
+ return FULL;
2408
+ };
2409
+ const EVM_CHAINS = /* @__PURE__ */ new Set([
2410
+ "Ethereum",
2411
+ "Ethereum (Sepolia)",
2412
+ "Binance (BEP20)",
2413
+ "Polygon",
2414
+ "Avalanche C-Chain",
2415
+ "Metal C-Chain",
2416
+ "Metal C-Chain (Testnet)",
2417
+ "Metal L2",
2418
+ "Metal L2 (Testnet)"
2419
+ ]);
2420
+ const toHex = (bytes) => Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
2421
+ const validateHex40 = (hex) => {
2422
+ if (!/^[0-9a-fA-F]{40}$/.test(hex)) return fail("Address must be 0x followed by 40 hexadecimal characters.");
2423
+ if (/^0{40}$/.test(hex)) return fail("Withdrawing to the zero address would burn the funds.");
2424
+ const lower = hex.toLowerCase();
2425
+ if (hex === lower || hex === hex.toUpperCase()) return FULL;
2426
+ const hash = toHex((0, _noble_hashes_sha3.keccak_256)(new TextEncoder().encode(lower)));
2427
+ for (let i = 0; i < 40; i++) {
2428
+ const c = hex[i];
2429
+ if (c >= "0" && c <= "9") continue;
2430
+ const shouldBeUpper = parseInt(hash[i], 16) >= 8;
2431
+ if (c === c.toUpperCase() !== shouldBeUpper) return fail("Address checksum (EIP-55 capitalization) is invalid. Check for a typo.");
2432
+ }
2433
+ return FULL;
2434
+ };
2435
+ const validateEvm = (address) => address.startsWith("0x") ? validateHex40(address.slice(2)) : fail("Address must start with 0x.");
2436
+ const validateXdc = (address) => {
2437
+ if (address.startsWith("xdc") || address.startsWith("0x")) return validateHex40(address.slice(address.startsWith("xdc") ? 3 : 2));
2438
+ return fail("Address must start with xdc or 0x.");
2439
+ };
2440
+ const crc16xmodem = (data) => {
2441
+ let crc = 0;
2442
+ for (const byte of data) {
2443
+ crc ^= byte << 8;
2444
+ for (let i = 0; i < 8; i++) crc = crc & 32768 ? (crc << 1 ^ 4129) & 65535 : crc << 1 & 65535;
2445
+ }
2446
+ return crc;
2447
+ };
2448
+ const STELLAR_KINDS = {
2449
+ G: {
2450
+ length: 56,
2451
+ version: 48,
2452
+ bytes: 35
2453
+ },
2454
+ M: {
2455
+ length: 69,
2456
+ version: 96,
2457
+ bytes: 43
2458
+ }
2459
+ };
2460
+ const validateStellar = (address) => {
2461
+ const kind = STELLAR_KINDS[address[0]];
2462
+ if (!kind || address.length !== kind.length || !/^[A-Z2-7]+$/.test(address)) return fail("Not a valid Stellar address (should start with G and be 56 characters).");
2463
+ const data = tryDecode(() => _scure_base.base32nopad.decode(address));
2464
+ if (!data || data.length !== kind.bytes || data[0] !== kind.version) return fail("Not a valid Stellar address.");
2465
+ const body = data.slice(0, -2);
2466
+ const crc = crc16xmodem(body);
2467
+ if (data[data.length - 2] !== (crc & 255) || data[data.length - 1] !== crc >> 8) return fail("Stellar address checksum is invalid. Check for a typo.");
2468
+ return FULL;
2469
+ };
2470
+ const XRP_BLACKHOLES = [/* @__PURE__ */ new Uint8Array(20), Uint8Array.from([.../* @__PURE__ */ new Uint8Array(19), 1])];
2471
+ const validateXrp = (address) => {
2472
+ if (address.startsWith("X") || address.startsWith("T")) return fail("X-addresses are not supported. Use the classic r-address and put the destination tag in the memo field.");
2473
+ if (!address.startsWith("r") || address.length < 25 || address.length > 35) return fail("Not a valid XRP address.");
2474
+ const data = tryDecode(() => _scure_base.base58xrp.decode(address));
2475
+ if (!data || data.length !== 25 || data[0] !== 0) return fail("Not a valid XRP address.");
2476
+ const checksum = (0, _noble_hashes_sha2.sha256)((0, _noble_hashes_sha2.sha256)(data.slice(0, 21))).slice(0, 4);
2477
+ if (!bytesEqual(checksum, data.slice(21))) return fail("XRP address checksum is invalid. Check for a typo.");
2478
+ const accountId = data.slice(1, 21);
2479
+ if (XRP_BLACKHOLES.some((b) => bytesEqual(b, accountId))) return fail("This XRP address is unspendable (black hole).");
2480
+ return FULL;
2481
+ };
2482
+ const validateSolana = (address) => {
2483
+ if (address.length < 32 || address.length > 44) return fail("Not a valid Solana address.");
2484
+ const key = tryDecode(() => _scure_base.base58.decode(address));
2485
+ if (!key || key.length !== 32) return fail("Not a valid Solana address.");
2486
+ if (allZero(key)) return fail("This is the Solana system program, not a wallet address.");
2487
+ return FULL;
2488
+ };
2489
+ const validateCardano = (address) => {
2490
+ const lower = address.toLowerCase();
2491
+ if (lower.startsWith("addr_test1")) return fail("This is a Cardano testnet address.");
2492
+ if (lower.startsWith("stake")) return fail("This is a Cardano stake (reward) address, not a payment address.");
2493
+ if (lower.startsWith("addr1")) {
2494
+ const decoded = tryDecode(() => _scure_base.bech32.decode(address, 1023));
2495
+ const data = decoded && tryDecode(() => _scure_base.bech32.fromWords(decoded.words));
2496
+ if (!decoded || decoded.prefix !== "addr" || !data || data.length === 0) return fail("Not a valid Cardano address (checksum failed). Check for a typo.");
2497
+ const type = data[0] >> 4;
2498
+ if ((data[0] & 15) !== 1) return fail("This Cardano address is not for mainnet.");
2499
+ return (type <= 3 ? data.length === 57 : type <= 5 ? data.length > 29 : type <= 7 ? data.length === 29 : false) ? FULL : fail("Not a valid Cardano payment address.");
2500
+ }
2501
+ if ((address.startsWith("Ae2") || address.startsWith("DdzFF")) && tryDecode(() => _scure_base.base58.decode(address))) return BASIC;
2502
+ return fail("Not a valid Cardano address.");
2503
+ };
2504
+ const validateEos = (address) => /^[a-z1-5.]{1,12}$/.test(address) && !address.endsWith(".") ? FULL : fail("EOS account names are 1-12 characters: a-z, 1-5 and \".\" (not at the end).");
2505
+ const validateHedera = (address) => {
2506
+ const match = /^0\.0\.(\d{1,19})(-[a-z]{5})?$/.exec(address);
2507
+ if (!match) return fail("Hedera account ids look like 0.0.12345.");
2508
+ return match[2] ? BASIC : FULL;
2509
+ };
2510
+ const VALIDATORS = {
2511
+ ["XDC Network"]: validateXdc,
2512
+ ["Stellar"]: validateStellar,
2513
+ ["Stellar (Testnet)"]: validateStellar,
2514
+ ["Ripple"]: validateXrp,
2515
+ ["Solana"]: validateSolana,
2516
+ ["Cardano"]: validateCardano,
2517
+ ["EOS"]: validateEos,
2518
+ ["EOS (Jungle Testnet)"]: validateEos,
2519
+ ["Hedera (Mainnet)"]: validateHedera,
2520
+ ["Hedera (Testnet)"]: validateHedera
2521
+ };
2522
+ /**
2523
+ * Validate a withdrawal destination address for the given bridge chain
2524
+ * (a `Chains` enum value, i.e. `wallet.chain`). Expects already-trimmed input.
2525
+ * Pure and synchronous, so it is safe to call on every keystroke.
2526
+ */
2527
+ const validateWithdrawAddress = (chain, address) => {
2528
+ const sharedFailure = sharedAddressChecks(address);
2529
+ if (sharedFailure) return sharedFailure;
2530
+ const utxo = UTXO_PARAMS[chain];
2531
+ if (utxo) return validateUtxo(address, utxo);
2532
+ if (EVM_CHAINS.has(chain)) return validateEvm(address);
2533
+ const validator = VALIDATORS[chain];
2534
+ return validator ? validator(address) : BASIC;
2535
+ };
2536
+ const MEMO_BYTE_LIMITS = {
2537
+ ["Stellar"]: 28,
2538
+ ["Stellar (Testnet)"]: 28,
2539
+ ["Hedera (Mainnet)"]: 100,
2540
+ ["Hedera (Testnet)"]: 100
2541
+ };
2542
+ /**
2543
+ * Validate an optional withdrawal memo / destination tag. The memo is appended
2544
+ * to the address as `?memo=...` inside the ':'-delimited bridge memo, so
2545
+ * delimiter and URL-structure characters are rejected on every chain.
2546
+ */
2547
+ const validateWithdrawMemo = (chain, memo) => {
2548
+ if (memo === void 0 || memo === "") return { valid: true };
2549
+ if (typeof memo !== "string") return fail("Memo must be text.");
2550
+ if (/\p{Cc}/u.test(memo)) return fail("Memo contains unsupported characters.");
2551
+ if (/[:?&#=]/.test(memo)) return fail("Memo must not contain : ? & # or =.");
2552
+ if (chain === "Ripple") return /^\d{1,10}$/.test(memo) && Number(memo) <= 4294967295 ? { valid: true } : fail("XRP destination tags must be a whole number between 0 and 4294967295.");
2553
+ const limit = MEMO_BYTE_LIMITS[chain] ?? MAX_DEFAULT_MEMO_BYTES;
2554
+ if (new TextEncoder().encode(memo).length > limit) return fail(`Memo must be at most ${limit} bytes.`);
2555
+ return { valid: true };
2556
+ };
2557
+ // src/validation/withdrawError.ts
2558
+ /**
2559
+ * Turn a failed bridge withdrawal request into a message that is safe to show
2560
+ * to the user (MFE-855).
2561
+ *
2562
+ * Only 4xx responses are treated as user-facing: they describe a problem with
2563
+ * the request (for example an invalid address passed through from Proton Swap).
2564
+ * 5xx responses, network failures and anything unrecognised get a generic
2565
+ * message, so server internals such as stack traces are never displayed and
2566
+ * the raw "AxiosError: Request failed with status code 500" is never shown.
2567
+ *
2568
+ * Duck-typed so it has no axios dependency.
2569
+ */
2570
+ const GENERIC_WITHDRAW_ERROR = "Withdrawal failed. Please check the amount and address and try again.";
2571
+ const MAX_WITHDRAW_ERROR_LENGTH = 200;
2572
+ const sanitize = (raw) => {
2573
+ const cleaned = raw.replace(/[\p{Cc}\s]+/gu, " ").trim();
2574
+ return cleaned.length > 200 ? `${cleaned.slice(0, 199)}…` : cleaned;
2575
+ };
2576
+ const messageFromBody = (data) => {
2577
+ if (typeof data === "string") return data;
2578
+ if (data && typeof data === "object") {
2579
+ const { message, error } = data;
2580
+ if (typeof message === "string") return message;
2581
+ if (typeof error === "string") return error;
2582
+ }
2583
+ };
2584
+ const withdrawErrorMessage = (error) => {
2585
+ const response = error?.response;
2586
+ const status = response?.status;
2587
+ if (typeof status !== "number" || status < 400 || status >= 500) return GENERIC_WITHDRAW_ERROR;
2588
+ const raw = messageFromBody(response?.data);
2589
+ return (raw === void 0 ? "" : sanitize(raw)) || "Withdrawal failed. Please check the amount and address and try again.";
2590
+ };
2300
2591
  exports.Chains = Chains;
2301
2592
  exports.ExtendedAssetParser = ExtendedAssetParser;
2302
2593
  exports.FEE_FACTOR = FEE_FACTOR;
2594
+ exports.GENERIC_WITHDRAW_ERROR = GENERIC_WITHDRAW_ERROR;
2303
2595
  exports.Graph = Graph;
2304
2596
  exports.ILink = ILink;
2305
2597
  exports.INode = INode;
2306
2598
  exports.ITopics = ITopics;
2599
+ exports.MAX_ADDRESS_LENGTH = MAX_ADDRESS_LENGTH;
2600
+ exports.MAX_WITHDRAW_ERROR_LENGTH = MAX_WITHDRAW_ERROR_LENGTH;
2307
2601
  exports.Networks = Networks;
2308
2602
  exports.Providers = Providers;
2309
2603
  exports.Status = Status;
@@ -2409,9 +2703,12 @@ exports.syncParser = syncParser;
2409
2703
  exports.traceParser = traceParser;
2410
2704
  exports.tradeLogParser = tradeLogParser;
2411
2705
  exports.tradeParser = tradeParser;
2706
+ exports.validateWithdrawAddress = validateWithdrawAddress;
2707
+ exports.validateWithdrawMemo = validateWithdrawMemo;
2412
2708
  exports.webauthActionParser = webauthActionParser;
2413
2709
  exports.withdrawBodyBaseAction = withdrawBodyBaseAction;
2414
2710
  exports.withdrawBodyParser = withdrawBodyParser;
2711
+ exports.withdrawErrorMessage = withdrawErrorMessage;
2415
2712
  exports.withdrawHistoryMetalResponseParser = withdrawHistoryMetalResponseParser;
2416
2713
  exports.withdrawHistoryMetalSwapParser = withdrawHistoryMetalSwapParser;
2417
2714
  exports.withdrawMetalResponseParser = withdrawMetalResponseParser;
package/dist/index.d.cts CHANGED
@@ -1,89 +1,6 @@
1
- import BN, { BigNumber } from "bignumber.js";
2
- import "dayjs";
1
+ import { Asset, ExtendedAsset as ExtendedAsset$1 } from "@bloks/numbers";
3
2
  import * as z from "zod";
4
- declare namespace Maths {
5
- enum Operations {
6
- PLUS = "plus",
7
- MULTIPLY = "multipliedBy",
8
- DIVIDE = "dividedBy",
9
- MINUS = "minus"
10
- }
11
- }
12
- declare class Asset {
13
- symbol: Symbol;
14
- amount: BigNumber.Instance;
15
- get integerAmount(): BigNumber.Instance;
16
- constructor(asset: {
17
- code: string;
18
- precision: number;
19
- amount: BigNumber.Instance | number | string;
20
- });
21
- static fromString(asset: string): Asset;
22
- static fromSymbol({ symbol, amount }: {
23
- symbol: Symbol;
24
- amount: BigNumber.Instance;
25
- }): Asset;
26
- isEqualTo(asset: Asset): boolean;
27
- isLooselyEqualTo(asset: Asset): boolean;
28
- toString(): string;
29
- modifyAmount(x: number | BigNumber.Instance | Asset, method: Maths.Operations): Asset;
30
- plus(x: number): Asset;
31
- plus(x: Asset): Asset;
32
- minus(x: number): Asset;
33
- minus(x: Asset): Asset;
34
- multipliedBy(x: number): Asset;
35
- multipliedBy(x: Asset): Asset;
36
- dividedBy(x: number): Asset;
37
- dividedBy(x: Asset): Asset;
38
- }
39
- declare class ExtendedAsset$1 {
40
- quantity: Asset;
41
- contract: string;
42
- constructor(extendedAsset: {
43
- quantity: Asset;
44
- contract: string;
45
- });
46
- static fromRaw({ quantity, contract }: {
47
- quantity: string;
48
- contract: string;
49
- }): ExtendedAsset$1;
50
- static fromExtendedSymbol(symbol: ExtendedSymbol, amount: BigNumber.Instance): ExtendedAsset$1;
51
- isEqualTo(extendedAsset: ExtendedAsset$1): boolean;
52
- isLooselyEqualTo(extendedAsset: ExtendedAsset$1): boolean;
53
- toString(): string;
54
- toExtendedSymbol(): ExtendedSymbol;
55
- modifyAmount(x: number | BigNumber.Instance | Asset | ExtendedAsset$1, method: Maths.Operations): ExtendedAsset$1;
56
- plus(x: number): ExtendedAsset$1;
57
- plus(x: Asset): ExtendedAsset$1;
58
- minus(x: number): ExtendedAsset$1;
59
- minus(x: Asset): ExtendedAsset$1;
60
- multipliedBy(x: number): ExtendedAsset$1;
61
- multipliedBy(x: Asset): ExtendedAsset$1;
62
- dividedBy(x: number): ExtendedAsset$1;
63
- dividedBy(x: Asset): ExtendedAsset$1;
64
- }
65
- declare class Symbol {
66
- precision: number;
67
- code: string;
68
- constructor(symbol: {
69
- code: string;
70
- precision: number;
71
- });
72
- static fromString(symbol: string): Symbol;
73
- isEqualTo(symbol: Symbol): boolean;
74
- toString(): string;
75
- }
76
- declare class ExtendedSymbol {
77
- contract: string;
78
- sym: Symbol;
79
- constructor(sym: Symbol, contract: string);
80
- static fromRaw({ sym, contract }: {
81
- sym: string;
82
- contract: string;
83
- }): ExtendedSymbol;
84
- isEqualTo(extendedSymbol: ExtendedSymbol): boolean;
85
- toString(): string;
86
- }
3
+ import BN from "bignumber.js";
87
4
  declare enum Chains {
88
5
  BitcoinMainnet = "Bitcoin",
89
6
  BitcoinTestnet = "Bitcoin (Testnet)",
@@ -2601,4 +2518,62 @@ declare const isInputInvalid: (data: string, value: string | number, pool: {
2601
2518
  xtokenPrecision: number;
2602
2519
  }) => boolean;
2603
2520
  declare const applyDiscountToFee: (fee: number, staked: number) => number;
2604
- export { Address, Authorization, Authorizations, BloksRate, BloksRates, Chains, ChronicleTransaction, Coin, CoinWallet, CurrencyStat, CurrencyStats, Daily, DbHistoryTransaction, DbMarket, DepositBody, Depth, ExchangeRate, ExchangeRates, ExtendedAsset, ExtendedAssetParser, ExtendedToken, ExtendedTokenWithRate, FEE_FACTOR, GenerateAddressBody, GenerateAddressResponse, GenerateAuth, GenerateAuthBaseAction, GetDailyResponse, GetDepth, GetDepthParsed, GetDepthResponse, GetHistoryActions, GetHistoryActionsParsed, GetHistoryActionsResponse, GetHistoryTransactionResponse, GetHistoryTransfers, GetHistoryTransfersParsed, GetHistoryTransfersResponse, GetLeaderboard, GetLeaderboardParsed, GetLeaderboardResponse, GetMarketsResponse, GetOHLCV, GetOHLCVParsed, GetOHLCVResponse, GetOpenOrders, GetOpenOrdersBalancesResponse, GetOpenOrdersParsed, GetOpenOrdersResponse, GetOrderHistory, GetOrderHistoryParsed, GetOrderHistoryResponse, GetOrderLifecycle, GetOrderLifecycleParsed, GetOrderLifecycleResponse, GetReferralTotals, GetReferralTotalsParsed, GetReferralTotalsResponse, GetReferrals, GetReferralsParsed, GetReferralsResponse, GetSyncResponse, GetTradeHistory, GetTradeHistoryParsed, GetTradeHistoryResponse, GetTrades, GetTradesParsed, GetTradesResponse, Graph, HistoryAccountRamDelta, HistoryAct, HistoryAction, HistoryActionTrace, HistoryPartial, HistoryReceipt, HistoryTrace, HistoryTransaction, HistoryTransfer, ILink, INode, ITopics, Leaderboard, LoginAccountParamsV3, Market, MarketOpenOrdersBalance, MetalTransaction, Networks, OHLCV, OpenOrder, OrderHistory, OrderLog, OtcOrderResponse, OtcQuoteBody, OtcQuoteResponse, Pool, PoolTable, PostSerializeOrder, PostSerializeOrderResponse, PostSubmitOrder, PostSubmitOrderResponse, Providers, Rate, RawPool, Referral, ReferralTotal, SortDirection, Status, Sync, TOPICS, Trade, TradeLog, Type, WRAP_AUTH_ACTION, WRAP_CONTRACT, Wallet, WithdrawBody, WithdrawBodyBaseAction, WithdrawHistoryMetalResponse, WithdrawHistoryMetalSwap, WithdrawMetalResponse, WithdrawalFeeQuote, Wrap, WrapSetConf, WrapStart, accountParser, accountRamDeltaParser, actParser, actionTraceParser, addressParser, applyDiscountToFee, authorizationParser, authorizationsParser, baseActionParser, baseActionSerializedParser, bloksRatesParser, chronicleTransactionParser, compute_liquidity, compute_transfer, compute_transfer_curve, createAbstractAuthParser, dailyParser, dbHistoryTransactionParser, dbMarketParser, depositBodyParser, depthParser, exchangeRateParser, exchangeRatesParser, explorerLinkByChain, fillType, generateAddressBodyParser, generateAddressResponse, generateAuthActionsBaseParser, generateAuthParser, getDailyResponseParser, getDepthParser, getDepthResponseParser, getHistoryActionsParser, getHistoryActionsResponseParser, getHistoryTransactionResponseParser, getHistoryTransfersParser, getHistoryTransfersResponseParser, getLeaderboardParser, getLeaderboardResponseParser, getMarketsResponseParser, getOhlcvParser, getOhlcvResponseParser, getOpenOrdersBalancesResponseParser, getOpenOrdersParser, getOpenOrdersResponseParser, getOrderHistoryParser, getOrderHistoryResponseParser, getOrderLifecycleParser, getOrderLifecycleResponseParser, getReferralTotalsParser, getReferralTotalsResponseParser, getReferralsParser, getReferralsResponseParser, getSyncResponseParser, getTradeHistoryParser, getTradeHistoryResponseParser, getTradesParser, getTradesResponseParser, historyActionParser, historyPartialParser, historyTransactionParser, historyTransferParser, initializeCoins, initializeConstants, isInputInvalid, isSameToken, leaderboardParser, logStatus, loginAccountParamsV3Parser, marketOpenOrdersBalanceParser, marketParser, median, metalTransactionParser, ohlcvParser, openOrderParser, orderHistoryParser, orderLogParser, orderSide, orderType, otcOrderResponseParser, otcQuoteBodyParser, otcQuoteResponseParser, postSerializeOrderParser, postSerializeOrderResponseParser, postSubmitOrderParser, postSubmitOrderResponseParser, protonExplorerTxUrl, rateParser, receiptParser, refferalParser, refferalTotalParser, similarChains, singleActionTransactionParser, sortDirectionEnum, syncParser, traceParser, tradeLogParser, tradeParser, webauthActionParser, withdrawBodyBaseAction, withdrawBodyParser, withdrawHistoryMetalResponseParser, withdrawHistoryMetalSwapParser, withdrawMetalResponseParser, withdrawalFeeQuoteParser, wrapParser, wrapSetConfParser, wrapStartParser };
2521
+ /**
2522
+ * Withdrawal destination validation for the bridge (MFE-855).
2523
+ *
2524
+ * The address and memo end up inside the XPR transfer memo as
2525
+ * `coin:network:address[?memo=...]:fee`, which the bridge server splits on ':'.
2526
+ * So beyond per-chain format checks, these validators also reject characters
2527
+ * that would corrupt that structure.
2528
+ *
2529
+ * Result levels:
2530
+ * - 'full' : the chain's address format was fully checked, including its
2531
+ * checksum where the format has one. Formats without a checksum
2532
+ * (Solana keys, EOS names, Hedera ids, single-case EVM) cannot
2533
+ * catch every typo even at this level.
2534
+ * - 'basic' : only the shared safety rules (and partial format checks) ran,
2535
+ * because no complete validator exists for this chain/format.
2536
+ */
2537
+ declare const MAX_ADDRESS_LENGTH = 128;
2538
+ type AddressValidationLevel = 'full' | 'basic';
2539
+ type AddressValidationResult = {
2540
+ valid: true;
2541
+ level: AddressValidationLevel;
2542
+ } | {
2543
+ valid: false;
2544
+ reason: string;
2545
+ };
2546
+ type MemoValidationResult = {
2547
+ valid: true;
2548
+ } | {
2549
+ valid: false;
2550
+ reason: string;
2551
+ };
2552
+ /**
2553
+ * Validate a withdrawal destination address for the given bridge chain
2554
+ * (a `Chains` enum value, i.e. `wallet.chain`). Expects already-trimmed input.
2555
+ * Pure and synchronous, so it is safe to call on every keystroke.
2556
+ */
2557
+ declare const validateWithdrawAddress: (chain: string, address: string) => AddressValidationResult;
2558
+ /**
2559
+ * Validate an optional withdrawal memo / destination tag. The memo is appended
2560
+ * to the address as `?memo=...` inside the ':'-delimited bridge memo, so
2561
+ * delimiter and URL-structure characters are rejected on every chain.
2562
+ */
2563
+ declare const validateWithdrawMemo: (chain: string, memo: string | undefined) => MemoValidationResult;
2564
+ /**
2565
+ * Turn a failed bridge withdrawal request into a message that is safe to show
2566
+ * to the user (MFE-855).
2567
+ *
2568
+ * Only 4xx responses are treated as user-facing: they describe a problem with
2569
+ * the request (for example an invalid address passed through from Proton Swap).
2570
+ * 5xx responses, network failures and anything unrecognised get a generic
2571
+ * message, so server internals such as stack traces are never displayed and
2572
+ * the raw "AxiosError: Request failed with status code 500" is never shown.
2573
+ *
2574
+ * Duck-typed so it has no axios dependency.
2575
+ */
2576
+ declare const GENERIC_WITHDRAW_ERROR = "Withdrawal failed. Please check the amount and address and try again.";
2577
+ declare const MAX_WITHDRAW_ERROR_LENGTH = 200;
2578
+ declare const withdrawErrorMessage: (error: unknown) => string;
2579
+ export { Address, AddressValidationLevel, AddressValidationResult, Authorization, Authorizations, BloksRate, BloksRates, Chains, ChronicleTransaction, Coin, CoinWallet, CurrencyStat, CurrencyStats, Daily, DbHistoryTransaction, DbMarket, DepositBody, Depth, ExchangeRate, ExchangeRates, ExtendedAsset, ExtendedAssetParser, ExtendedToken, ExtendedTokenWithRate, FEE_FACTOR, GENERIC_WITHDRAW_ERROR, GenerateAddressBody, GenerateAddressResponse, GenerateAuth, GenerateAuthBaseAction, GetDailyResponse, GetDepth, GetDepthParsed, GetDepthResponse, GetHistoryActions, GetHistoryActionsParsed, GetHistoryActionsResponse, GetHistoryTransactionResponse, GetHistoryTransfers, GetHistoryTransfersParsed, GetHistoryTransfersResponse, GetLeaderboard, GetLeaderboardParsed, GetLeaderboardResponse, GetMarketsResponse, GetOHLCV, GetOHLCVParsed, GetOHLCVResponse, GetOpenOrders, GetOpenOrdersBalancesResponse, GetOpenOrdersParsed, GetOpenOrdersResponse, GetOrderHistory, GetOrderHistoryParsed, GetOrderHistoryResponse, GetOrderLifecycle, GetOrderLifecycleParsed, GetOrderLifecycleResponse, GetReferralTotals, GetReferralTotalsParsed, GetReferralTotalsResponse, GetReferrals, GetReferralsParsed, GetReferralsResponse, GetSyncResponse, GetTradeHistory, GetTradeHistoryParsed, GetTradeHistoryResponse, GetTrades, GetTradesParsed, GetTradesResponse, Graph, HistoryAccountRamDelta, HistoryAct, HistoryAction, HistoryActionTrace, HistoryPartial, HistoryReceipt, HistoryTrace, HistoryTransaction, HistoryTransfer, ILink, INode, ITopics, Leaderboard, LoginAccountParamsV3, MAX_ADDRESS_LENGTH, MAX_WITHDRAW_ERROR_LENGTH, Market, MarketOpenOrdersBalance, MemoValidationResult, MetalTransaction, Networks, OHLCV, OpenOrder, OrderHistory, OrderLog, OtcOrderResponse, OtcQuoteBody, OtcQuoteResponse, Pool, PoolTable, PostSerializeOrder, PostSerializeOrderResponse, PostSubmitOrder, PostSubmitOrderResponse, Providers, Rate, RawPool, Referral, ReferralTotal, SortDirection, Status, Sync, TOPICS, Trade, TradeLog, Type, WRAP_AUTH_ACTION, WRAP_CONTRACT, Wallet, WithdrawBody, WithdrawBodyBaseAction, WithdrawHistoryMetalResponse, WithdrawHistoryMetalSwap, WithdrawMetalResponse, WithdrawalFeeQuote, Wrap, WrapSetConf, WrapStart, accountParser, accountRamDeltaParser, actParser, actionTraceParser, addressParser, applyDiscountToFee, authorizationParser, authorizationsParser, baseActionParser, baseActionSerializedParser, bloksRatesParser, chronicleTransactionParser, compute_liquidity, compute_transfer, compute_transfer_curve, createAbstractAuthParser, dailyParser, dbHistoryTransactionParser, dbMarketParser, depositBodyParser, depthParser, exchangeRateParser, exchangeRatesParser, explorerLinkByChain, fillType, generateAddressBodyParser, generateAddressResponse, generateAuthActionsBaseParser, generateAuthParser, getDailyResponseParser, getDepthParser, getDepthResponseParser, getHistoryActionsParser, getHistoryActionsResponseParser, getHistoryTransactionResponseParser, getHistoryTransfersParser, getHistoryTransfersResponseParser, getLeaderboardParser, getLeaderboardResponseParser, getMarketsResponseParser, getOhlcvParser, getOhlcvResponseParser, getOpenOrdersBalancesResponseParser, getOpenOrdersParser, getOpenOrdersResponseParser, getOrderHistoryParser, getOrderHistoryResponseParser, getOrderLifecycleParser, getOrderLifecycleResponseParser, getReferralTotalsParser, getReferralTotalsResponseParser, getReferralsParser, getReferralsResponseParser, getSyncResponseParser, getTradeHistoryParser, getTradeHistoryResponseParser, getTradesParser, getTradesResponseParser, historyActionParser, historyPartialParser, historyTransactionParser, historyTransferParser, initializeCoins, initializeConstants, isInputInvalid, isSameToken, leaderboardParser, logStatus, loginAccountParamsV3Parser, marketOpenOrdersBalanceParser, marketParser, median, metalTransactionParser, ohlcvParser, openOrderParser, orderHistoryParser, orderLogParser, orderSide, orderType, otcOrderResponseParser, otcQuoteBodyParser, otcQuoteResponseParser, postSerializeOrderParser, postSerializeOrderResponseParser, postSubmitOrderParser, postSubmitOrderResponseParser, protonExplorerTxUrl, rateParser, receiptParser, refferalParser, refferalTotalParser, similarChains, singleActionTransactionParser, sortDirectionEnum, syncParser, traceParser, tradeLogParser, tradeParser, validateWithdrawAddress, validateWithdrawMemo, webauthActionParser, withdrawBodyBaseAction, withdrawBodyParser, withdrawErrorMessage, withdrawHistoryMetalResponseParser, withdrawHistoryMetalSwapParser, withdrawMetalResponseParser, withdrawalFeeQuoteParser, wrapParser, wrapSetConfParser, wrapStartParser };
package/dist/index.d.mts CHANGED
@@ -1,89 +1,6 @@
1
1
  import * as z from "zod";
2
- import BN, { BigNumber } from "bignumber.js";
3
- import "dayjs";
4
- declare namespace Maths {
5
- enum Operations {
6
- PLUS = "plus",
7
- MULTIPLY = "multipliedBy",
8
- DIVIDE = "dividedBy",
9
- MINUS = "minus"
10
- }
11
- }
12
- declare class Asset {
13
- symbol: Symbol;
14
- amount: BigNumber.Instance;
15
- get integerAmount(): BigNumber.Instance;
16
- constructor(asset: {
17
- code: string;
18
- precision: number;
19
- amount: BigNumber.Instance | number | string;
20
- });
21
- static fromString(asset: string): Asset;
22
- static fromSymbol({ symbol, amount }: {
23
- symbol: Symbol;
24
- amount: BigNumber.Instance;
25
- }): Asset;
26
- isEqualTo(asset: Asset): boolean;
27
- isLooselyEqualTo(asset: Asset): boolean;
28
- toString(): string;
29
- modifyAmount(x: number | BigNumber.Instance | Asset, method: Maths.Operations): Asset;
30
- plus(x: number): Asset;
31
- plus(x: Asset): Asset;
32
- minus(x: number): Asset;
33
- minus(x: Asset): Asset;
34
- multipliedBy(x: number): Asset;
35
- multipliedBy(x: Asset): Asset;
36
- dividedBy(x: number): Asset;
37
- dividedBy(x: Asset): Asset;
38
- }
39
- declare class ExtendedAsset$1 {
40
- quantity: Asset;
41
- contract: string;
42
- constructor(extendedAsset: {
43
- quantity: Asset;
44
- contract: string;
45
- });
46
- static fromRaw({ quantity, contract }: {
47
- quantity: string;
48
- contract: string;
49
- }): ExtendedAsset$1;
50
- static fromExtendedSymbol(symbol: ExtendedSymbol, amount: BigNumber.Instance): ExtendedAsset$1;
51
- isEqualTo(extendedAsset: ExtendedAsset$1): boolean;
52
- isLooselyEqualTo(extendedAsset: ExtendedAsset$1): boolean;
53
- toString(): string;
54
- toExtendedSymbol(): ExtendedSymbol;
55
- modifyAmount(x: number | BigNumber.Instance | Asset | ExtendedAsset$1, method: Maths.Operations): ExtendedAsset$1;
56
- plus(x: number): ExtendedAsset$1;
57
- plus(x: Asset): ExtendedAsset$1;
58
- minus(x: number): ExtendedAsset$1;
59
- minus(x: Asset): ExtendedAsset$1;
60
- multipliedBy(x: number): ExtendedAsset$1;
61
- multipliedBy(x: Asset): ExtendedAsset$1;
62
- dividedBy(x: number): ExtendedAsset$1;
63
- dividedBy(x: Asset): ExtendedAsset$1;
64
- }
65
- declare class Symbol {
66
- precision: number;
67
- code: string;
68
- constructor(symbol: {
69
- code: string;
70
- precision: number;
71
- });
72
- static fromString(symbol: string): Symbol;
73
- isEqualTo(symbol: Symbol): boolean;
74
- toString(): string;
75
- }
76
- declare class ExtendedSymbol {
77
- contract: string;
78
- sym: Symbol;
79
- constructor(sym: Symbol, contract: string);
80
- static fromRaw({ sym, contract }: {
81
- sym: string;
82
- contract: string;
83
- }): ExtendedSymbol;
84
- isEqualTo(extendedSymbol: ExtendedSymbol): boolean;
85
- toString(): string;
86
- }
2
+ import BN from "bignumber.js";
3
+ import { Asset, ExtendedAsset as ExtendedAsset$1 } from "@bloks/numbers";
87
4
  declare enum Chains {
88
5
  BitcoinMainnet = "Bitcoin",
89
6
  BitcoinTestnet = "Bitcoin (Testnet)",
@@ -2601,4 +2518,62 @@ declare const isInputInvalid: (data: string, value: string | number, pool: {
2601
2518
  xtokenPrecision: number;
2602
2519
  }) => boolean;
2603
2520
  declare const applyDiscountToFee: (fee: number, staked: number) => number;
2604
- export { Address, Authorization, Authorizations, BloksRate, BloksRates, Chains, ChronicleTransaction, Coin, CoinWallet, CurrencyStat, CurrencyStats, Daily, DbHistoryTransaction, DbMarket, DepositBody, Depth, ExchangeRate, ExchangeRates, ExtendedAsset, ExtendedAssetParser, ExtendedToken, ExtendedTokenWithRate, FEE_FACTOR, GenerateAddressBody, GenerateAddressResponse, GenerateAuth, GenerateAuthBaseAction, GetDailyResponse, GetDepth, GetDepthParsed, GetDepthResponse, GetHistoryActions, GetHistoryActionsParsed, GetHistoryActionsResponse, GetHistoryTransactionResponse, GetHistoryTransfers, GetHistoryTransfersParsed, GetHistoryTransfersResponse, GetLeaderboard, GetLeaderboardParsed, GetLeaderboardResponse, GetMarketsResponse, GetOHLCV, GetOHLCVParsed, GetOHLCVResponse, GetOpenOrders, GetOpenOrdersBalancesResponse, GetOpenOrdersParsed, GetOpenOrdersResponse, GetOrderHistory, GetOrderHistoryParsed, GetOrderHistoryResponse, GetOrderLifecycle, GetOrderLifecycleParsed, GetOrderLifecycleResponse, GetReferralTotals, GetReferralTotalsParsed, GetReferralTotalsResponse, GetReferrals, GetReferralsParsed, GetReferralsResponse, GetSyncResponse, GetTradeHistory, GetTradeHistoryParsed, GetTradeHistoryResponse, GetTrades, GetTradesParsed, GetTradesResponse, Graph, HistoryAccountRamDelta, HistoryAct, HistoryAction, HistoryActionTrace, HistoryPartial, HistoryReceipt, HistoryTrace, HistoryTransaction, HistoryTransfer, ILink, INode, ITopics, Leaderboard, LoginAccountParamsV3, Market, MarketOpenOrdersBalance, MetalTransaction, Networks, OHLCV, OpenOrder, OrderHistory, OrderLog, OtcOrderResponse, OtcQuoteBody, OtcQuoteResponse, Pool, PoolTable, PostSerializeOrder, PostSerializeOrderResponse, PostSubmitOrder, PostSubmitOrderResponse, Providers, Rate, RawPool, Referral, ReferralTotal, SortDirection, Status, Sync, TOPICS, Trade, TradeLog, Type, WRAP_AUTH_ACTION, WRAP_CONTRACT, Wallet, WithdrawBody, WithdrawBodyBaseAction, WithdrawHistoryMetalResponse, WithdrawHistoryMetalSwap, WithdrawMetalResponse, WithdrawalFeeQuote, Wrap, WrapSetConf, WrapStart, accountParser, accountRamDeltaParser, actParser, actionTraceParser, addressParser, applyDiscountToFee, authorizationParser, authorizationsParser, baseActionParser, baseActionSerializedParser, bloksRatesParser, chronicleTransactionParser, compute_liquidity, compute_transfer, compute_transfer_curve, createAbstractAuthParser, dailyParser, dbHistoryTransactionParser, dbMarketParser, depositBodyParser, depthParser, exchangeRateParser, exchangeRatesParser, explorerLinkByChain, fillType, generateAddressBodyParser, generateAddressResponse, generateAuthActionsBaseParser, generateAuthParser, getDailyResponseParser, getDepthParser, getDepthResponseParser, getHistoryActionsParser, getHistoryActionsResponseParser, getHistoryTransactionResponseParser, getHistoryTransfersParser, getHistoryTransfersResponseParser, getLeaderboardParser, getLeaderboardResponseParser, getMarketsResponseParser, getOhlcvParser, getOhlcvResponseParser, getOpenOrdersBalancesResponseParser, getOpenOrdersParser, getOpenOrdersResponseParser, getOrderHistoryParser, getOrderHistoryResponseParser, getOrderLifecycleParser, getOrderLifecycleResponseParser, getReferralTotalsParser, getReferralTotalsResponseParser, getReferralsParser, getReferralsResponseParser, getSyncResponseParser, getTradeHistoryParser, getTradeHistoryResponseParser, getTradesParser, getTradesResponseParser, historyActionParser, historyPartialParser, historyTransactionParser, historyTransferParser, initializeCoins, initializeConstants, isInputInvalid, isSameToken, leaderboardParser, logStatus, loginAccountParamsV3Parser, marketOpenOrdersBalanceParser, marketParser, median, metalTransactionParser, ohlcvParser, openOrderParser, orderHistoryParser, orderLogParser, orderSide, orderType, otcOrderResponseParser, otcQuoteBodyParser, otcQuoteResponseParser, postSerializeOrderParser, postSerializeOrderResponseParser, postSubmitOrderParser, postSubmitOrderResponseParser, protonExplorerTxUrl, rateParser, receiptParser, refferalParser, refferalTotalParser, similarChains, singleActionTransactionParser, sortDirectionEnum, syncParser, traceParser, tradeLogParser, tradeParser, webauthActionParser, withdrawBodyBaseAction, withdrawBodyParser, withdrawHistoryMetalResponseParser, withdrawHistoryMetalSwapParser, withdrawMetalResponseParser, withdrawalFeeQuoteParser, wrapParser, wrapSetConfParser, wrapStartParser };
2521
+ /**
2522
+ * Withdrawal destination validation for the bridge (MFE-855).
2523
+ *
2524
+ * The address and memo end up inside the XPR transfer memo as
2525
+ * `coin:network:address[?memo=...]:fee`, which the bridge server splits on ':'.
2526
+ * So beyond per-chain format checks, these validators also reject characters
2527
+ * that would corrupt that structure.
2528
+ *
2529
+ * Result levels:
2530
+ * - 'full' : the chain's address format was fully checked, including its
2531
+ * checksum where the format has one. Formats without a checksum
2532
+ * (Solana keys, EOS names, Hedera ids, single-case EVM) cannot
2533
+ * catch every typo even at this level.
2534
+ * - 'basic' : only the shared safety rules (and partial format checks) ran,
2535
+ * because no complete validator exists for this chain/format.
2536
+ */
2537
+ declare const MAX_ADDRESS_LENGTH = 128;
2538
+ type AddressValidationLevel = 'full' | 'basic';
2539
+ type AddressValidationResult = {
2540
+ valid: true;
2541
+ level: AddressValidationLevel;
2542
+ } | {
2543
+ valid: false;
2544
+ reason: string;
2545
+ };
2546
+ type MemoValidationResult = {
2547
+ valid: true;
2548
+ } | {
2549
+ valid: false;
2550
+ reason: string;
2551
+ };
2552
+ /**
2553
+ * Validate a withdrawal destination address for the given bridge chain
2554
+ * (a `Chains` enum value, i.e. `wallet.chain`). Expects already-trimmed input.
2555
+ * Pure and synchronous, so it is safe to call on every keystroke.
2556
+ */
2557
+ declare const validateWithdrawAddress: (chain: string, address: string) => AddressValidationResult;
2558
+ /**
2559
+ * Validate an optional withdrawal memo / destination tag. The memo is appended
2560
+ * to the address as `?memo=...` inside the ':'-delimited bridge memo, so
2561
+ * delimiter and URL-structure characters are rejected on every chain.
2562
+ */
2563
+ declare const validateWithdrawMemo: (chain: string, memo: string | undefined) => MemoValidationResult;
2564
+ /**
2565
+ * Turn a failed bridge withdrawal request into a message that is safe to show
2566
+ * to the user (MFE-855).
2567
+ *
2568
+ * Only 4xx responses are treated as user-facing: they describe a problem with
2569
+ * the request (for example an invalid address passed through from Proton Swap).
2570
+ * 5xx responses, network failures and anything unrecognised get a generic
2571
+ * message, so server internals such as stack traces are never displayed and
2572
+ * the raw "AxiosError: Request failed with status code 500" is never shown.
2573
+ *
2574
+ * Duck-typed so it has no axios dependency.
2575
+ */
2576
+ declare const GENERIC_WITHDRAW_ERROR = "Withdrawal failed. Please check the amount and address and try again.";
2577
+ declare const MAX_WITHDRAW_ERROR_LENGTH = 200;
2578
+ declare const withdrawErrorMessage: (error: unknown) => string;
2579
+ export { Address, AddressValidationLevel, AddressValidationResult, Authorization, Authorizations, BloksRate, BloksRates, Chains, ChronicleTransaction, Coin, CoinWallet, CurrencyStat, CurrencyStats, Daily, DbHistoryTransaction, DbMarket, DepositBody, Depth, ExchangeRate, ExchangeRates, ExtendedAsset, ExtendedAssetParser, ExtendedToken, ExtendedTokenWithRate, FEE_FACTOR, GENERIC_WITHDRAW_ERROR, GenerateAddressBody, GenerateAddressResponse, GenerateAuth, GenerateAuthBaseAction, GetDailyResponse, GetDepth, GetDepthParsed, GetDepthResponse, GetHistoryActions, GetHistoryActionsParsed, GetHistoryActionsResponse, GetHistoryTransactionResponse, GetHistoryTransfers, GetHistoryTransfersParsed, GetHistoryTransfersResponse, GetLeaderboard, GetLeaderboardParsed, GetLeaderboardResponse, GetMarketsResponse, GetOHLCV, GetOHLCVParsed, GetOHLCVResponse, GetOpenOrders, GetOpenOrdersBalancesResponse, GetOpenOrdersParsed, GetOpenOrdersResponse, GetOrderHistory, GetOrderHistoryParsed, GetOrderHistoryResponse, GetOrderLifecycle, GetOrderLifecycleParsed, GetOrderLifecycleResponse, GetReferralTotals, GetReferralTotalsParsed, GetReferralTotalsResponse, GetReferrals, GetReferralsParsed, GetReferralsResponse, GetSyncResponse, GetTradeHistory, GetTradeHistoryParsed, GetTradeHistoryResponse, GetTrades, GetTradesParsed, GetTradesResponse, Graph, HistoryAccountRamDelta, HistoryAct, HistoryAction, HistoryActionTrace, HistoryPartial, HistoryReceipt, HistoryTrace, HistoryTransaction, HistoryTransfer, ILink, INode, ITopics, Leaderboard, LoginAccountParamsV3, MAX_ADDRESS_LENGTH, MAX_WITHDRAW_ERROR_LENGTH, Market, MarketOpenOrdersBalance, MemoValidationResult, MetalTransaction, Networks, OHLCV, OpenOrder, OrderHistory, OrderLog, OtcOrderResponse, OtcQuoteBody, OtcQuoteResponse, Pool, PoolTable, PostSerializeOrder, PostSerializeOrderResponse, PostSubmitOrder, PostSubmitOrderResponse, Providers, Rate, RawPool, Referral, ReferralTotal, SortDirection, Status, Sync, TOPICS, Trade, TradeLog, Type, WRAP_AUTH_ACTION, WRAP_CONTRACT, Wallet, WithdrawBody, WithdrawBodyBaseAction, WithdrawHistoryMetalResponse, WithdrawHistoryMetalSwap, WithdrawMetalResponse, WithdrawalFeeQuote, Wrap, WrapSetConf, WrapStart, accountParser, accountRamDeltaParser, actParser, actionTraceParser, addressParser, applyDiscountToFee, authorizationParser, authorizationsParser, baseActionParser, baseActionSerializedParser, bloksRatesParser, chronicleTransactionParser, compute_liquidity, compute_transfer, compute_transfer_curve, createAbstractAuthParser, dailyParser, dbHistoryTransactionParser, dbMarketParser, depositBodyParser, depthParser, exchangeRateParser, exchangeRatesParser, explorerLinkByChain, fillType, generateAddressBodyParser, generateAddressResponse, generateAuthActionsBaseParser, generateAuthParser, getDailyResponseParser, getDepthParser, getDepthResponseParser, getHistoryActionsParser, getHistoryActionsResponseParser, getHistoryTransactionResponseParser, getHistoryTransfersParser, getHistoryTransfersResponseParser, getLeaderboardParser, getLeaderboardResponseParser, getMarketsResponseParser, getOhlcvParser, getOhlcvResponseParser, getOpenOrdersBalancesResponseParser, getOpenOrdersParser, getOpenOrdersResponseParser, getOrderHistoryParser, getOrderHistoryResponseParser, getOrderLifecycleParser, getOrderLifecycleResponseParser, getReferralTotalsParser, getReferralTotalsResponseParser, getReferralsParser, getReferralsResponseParser, getSyncResponseParser, getTradeHistoryParser, getTradeHistoryResponseParser, getTradesParser, getTradesResponseParser, historyActionParser, historyPartialParser, historyTransactionParser, historyTransferParser, initializeCoins, initializeConstants, isInputInvalid, isSameToken, leaderboardParser, logStatus, loginAccountParamsV3Parser, marketOpenOrdersBalanceParser, marketParser, median, metalTransactionParser, ohlcvParser, openOrderParser, orderHistoryParser, orderLogParser, orderSide, orderType, otcOrderResponseParser, otcQuoteBodyParser, otcQuoteResponseParser, postSerializeOrderParser, postSerializeOrderResponseParser, postSubmitOrderParser, postSubmitOrderResponseParser, protonExplorerTxUrl, rateParser, receiptParser, refferalParser, refferalTotalParser, similarChains, singleActionTransactionParser, sortDirectionEnum, syncParser, traceParser, tradeLogParser, tradeParser, validateWithdrawAddress, validateWithdrawMemo, webauthActionParser, withdrawBodyBaseAction, withdrawBodyParser, withdrawErrorMessage, withdrawHistoryMetalResponseParser, withdrawHistoryMetalSwapParser, withdrawMetalResponseParser, withdrawalFeeQuoteParser, wrapParser, wrapSetConfParser, wrapStartParser };