Socket
Socket
Sign inDemoInstall

@thorswap-lib/types

Package Overview
Dependencies
Maintainers
3
Versions
192
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thorswap-lib/types - npm Package Compare versions

Comparing version 1.0.0-development.87 to 1.0.0-development.88

26

dist/index.d.ts

@@ -44,10 +44,6 @@ import { BigNumber } from '@ethersproject/bignumber';

static fromErrorInfo(errorInfo: ErrorInfo): ApiError;
toErrorInfo(): ErrorInfo;
get identifier(): string;
get displayMessage(): string;
handle(): this & {
identifier: string;
};
returnErrorInfo(): this & {
identifier: string;
};
handle(): ErrorInfo;
}

@@ -299,2 +295,8 @@

MISSING_INPUT_PARAMETER = "1005",
INVALID_TYPE_GENERIC = "1100",
INVALID_NUMBER_STRING = "1101",
INVALID_NUMBER = "1102",
INVALID_BOOLEAN = "1103",
INVALID_OBJECT = "1104",
INVALID_ARRAY = "1105",
SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000",

@@ -310,2 +312,3 @@ SELL_BUY_ASSETS_ARE_THE_SAME = "2001",

DESTINATION_ADDRESS_SMART_CONTRACT = "2009",
BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010",
INVALID_PROVIDER = "2100",

@@ -326,4 +329,10 @@ MISSING_CROSS_CHAIN_PROVIDER = "2101",

SYNTH_MINTING_CAP_REACHED = "3002",
INVALID_QUOTE_MODE = "4000",
NO_QUOTES = "4001",
SERVICE_UNAVAILABLE_GENERIC = "5000",
MISSING_GAS_DATA_GENERIC = "5100",
MISSING_TOKEN_PRICE_GENERIC = "5200",
ADDRESS_NOT_WHITELISTED = "6000",
ADDRESS_ALREADY_CLAIMED = "6001"
ADDRESS_ALREADY_CLAIMED = "6001",
TEMPORARY_ERROR = "9999"
}

@@ -342,2 +351,3 @@

PROVIDER_UTIL = "4000",
TXN_DETAILS = "5000",
AIRDROP_UTIL = "6000"

@@ -369,3 +379,3 @@ }

code: ERROR_CODE;
message: string;
message?: string | undefined;
stack?: string;

@@ -372,0 +382,0 @@ identifier?: string;

var N = Object.defineProperty;
var E = (e, a, n) => a in e ? N(e, a, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[a] = n;
var s = (e, a, n) => (E(e, typeof a != "symbol" ? a + "" : a, n), n);
const U = [
var _ = (e, a, n) => a in e ? N(e, a, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[a] = n;
var s = (e, a, n) => (_(e, typeof a != "symbol" ? a + "" : a, n), n);
const G = [
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },

@@ -102,3 +102,3 @@ {

}
], G = [
], w = [
{

@@ -278,3 +278,3 @@ inputs: [{ internalType: "address", name: "rune", type: "address" }],

}
], w = [
], F = [
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },

@@ -444,4 +444,4 @@ {

];
var _ = /* @__PURE__ */ ((e) => (e.Base = "BASE", e.Asset = "ASSET", e))(_ || {}), I = /* @__PURE__ */ ((e) => (e.THOR = "THOR", e.RUNE = "RUNE", e["RUNE-67C"] = "RUNE-67C", e["RUNE-B1A"] = "RUNE-B1A", e.ATOM = "ATOM", e.MUON = "MUON", e.USDC = "USDC", e))(I || {}), y = /* @__PURE__ */ ((e) => (e.VALIDATION_ERROR = "VALIDATION_ERROR", e.REQUEST_PARAMETER_ERROR = "REQUEST_PARAMETER_ERROR", e.RESPONSE_PARSING_ERROR = "RESPONSE_PARSING_ERROR", e.UNHANDLED_ERROR = "UNHANDLED_ERROR", e.INCOMPATIBLE_ASSETS_OPERATIONS = "INCOMPATIBLE_ASSETS_OPERATIONS", e.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", e.UNSUPPORTED_ASSET = "UNSUPPORTED_ASSET", e.MISSING_INBOUND_INFO = "MISSING_INBOUND_INFO", e.QUOTE_FETCHING_ERROR = "QUOTE_FETCHING_ERROR", e.AIRDROP_ERROR = "AIRDROP_ERROR", e))(y || {}), c = /* @__PURE__ */ ((e) => (e.HEALTH_CONTROLLER = "1000", e.LIQUIDITY_CONTROLLER = "1001", e.PROVIDER_CONTROLLER = "1002", e.QUOTE_CONTROLLER = "1003", e.SWAP_CONTROLLER = "1004", e.UTIL_CONTROLLER = "1005", e.AIRDROP_CONTROLLER = "1006", e.PROVIDER_ENTITY = "2000", e.THORCHAIN_PROVIDER = "3000", e.PROVIDER_UTIL = "4000", e.AIRDROP_UTIL = "6000", e))(c || {}), t = /* @__PURE__ */ ((e) => (e.INVALID_INPUT_PARAMETERS = "1000", e.UNKNOWN_PROVIDERS = "1001", e.CANNOT_FIND_INBOUND_ADDRESS = "1002", e.NO_INBOUND_ADDRESSES = "1003", e.CHAIN_HALTED_OR_UNSUPPORTED = "1004", e.MISSING_INPUT_PARAMETER = "1005", e.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000", e.SELL_BUY_ASSETS_ARE_THE_SAME = "2001", e.MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002", e.AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003", e.AFF_ADDRESS_TOO_LONG = "2004", e.AFF_BPS_INTEGER_0_100 = "2005", e.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", e.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", e.PREFERRED_PROFVIDER_NOT_SUPPORTED = "2008", e.DESTINATION_ADDRESS_SMART_CONTRACT = "2009", e.INVALID_PROVIDER = "2100", e.MISSING_CROSS_CHAIN_PROVIDER = "2101", e.MISSING_AVAX_PROVIDER = "2102", e.MISSING_BSC_PROVIDER = "2103", e.MISSING_ETH_PROVIDER = "2104", e.INVALID_PROVIDER_FOR_SWAP_OUT = "2105", e.INVALID_CHAIN = "2200", e.INVALID_ASSET = "2201", e.INVALID_ASSET_IDENTIFIER = "2202", e.UNSUPPORTED_CHAIN = "2204", e.UNSUPPORTED_ASSET = "2203", e.UNSUPPORTED_ASSET_FOR_SWAPOUT = "2205", e.THORNODE_QUOTE_GENERIC_ERROR = "3000", e.NOT_ENOUGH_SYNTH_BALANCE = "3001", e.SYNTH_MINTING_CAP_REACHED = "3002", e.ADDRESS_NOT_WHITELISTED = "6000", e.ADDRESS_ALREADY_CLAIMED = "6001", e))(t || {});
const h = {
var E = /* @__PURE__ */ ((e) => (e.Base = "BASE", e.Asset = "ASSET", e))(E || {}), c = /* @__PURE__ */ ((e) => (e.THOR = "THOR", e.RUNE = "RUNE", e["RUNE-67C"] = "RUNE-67C", e["RUNE-B1A"] = "RUNE-B1A", e.ATOM = "ATOM", e.MUON = "MUON", e.USDC = "USDC", e))(c || {}), o = /* @__PURE__ */ ((e) => (e.VALIDATION_ERROR = "VALIDATION_ERROR", e.REQUEST_PARAMETER_ERROR = "REQUEST_PARAMETER_ERROR", e.RESPONSE_PARSING_ERROR = "RESPONSE_PARSING_ERROR", e.UNHANDLED_ERROR = "UNHANDLED_ERROR", e.INCOMPATIBLE_ASSETS_OPERATIONS = "INCOMPATIBLE_ASSETS_OPERATIONS", e.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", e.UNSUPPORTED_ASSET = "UNSUPPORTED_ASSET", e.MISSING_INBOUND_INFO = "MISSING_INBOUND_INFO", e.QUOTE_FETCHING_ERROR = "QUOTE_FETCHING_ERROR", e.AIRDROP_ERROR = "AIRDROP_ERROR", e))(o || {}), h = /* @__PURE__ */ ((e) => (e.HEALTH_CONTROLLER = "1000", e.LIQUIDITY_CONTROLLER = "1001", e.PROVIDER_CONTROLLER = "1002", e.QUOTE_CONTROLLER = "1003", e.SWAP_CONTROLLER = "1004", e.UTIL_CONTROLLER = "1005", e.AIRDROP_CONTROLLER = "1006", e.PROVIDER_ENTITY = "2000", e.THORCHAIN_PROVIDER = "3000", e.PROVIDER_UTIL = "4000", e.TXN_DETAILS = "5000", e.AIRDROP_UTIL = "6000", e))(h || {}), t = /* @__PURE__ */ ((e) => (e.INVALID_INPUT_PARAMETERS = "1000", e.UNKNOWN_PROVIDERS = "1001", e.CANNOT_FIND_INBOUND_ADDRESS = "1002", e.NO_INBOUND_ADDRESSES = "1003", e.CHAIN_HALTED_OR_UNSUPPORTED = "1004", e.MISSING_INPUT_PARAMETER = "1005", e.INVALID_TYPE_GENERIC = "1100", e.INVALID_NUMBER_STRING = "1101", e.INVALID_NUMBER = "1102", e.INVALID_BOOLEAN = "1103", e.INVALID_OBJECT = "1104", e.INVALID_ARRAY = "1105", e.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000", e.SELL_BUY_ASSETS_ARE_THE_SAME = "2001", e.MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002", e.AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003", e.AFF_ADDRESS_TOO_LONG = "2004", e.AFF_BPS_INTEGER_0_100 = "2005", e.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", e.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", e.PREFERRED_PROFVIDER_NOT_SUPPORTED = "2008", e.DESTINATION_ADDRESS_SMART_CONTRACT = "2009", e.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010", e.INVALID_PROVIDER = "2100", e.MISSING_CROSS_CHAIN_PROVIDER = "2101", e.MISSING_AVAX_PROVIDER = "2102", e.MISSING_BSC_PROVIDER = "2103", e.MISSING_ETH_PROVIDER = "2104", e.INVALID_PROVIDER_FOR_SWAP_OUT = "2105", e.INVALID_CHAIN = "2200", e.INVALID_ASSET = "2201", e.INVALID_ASSET_IDENTIFIER = "2202", e.UNSUPPORTED_CHAIN = "2204", e.UNSUPPORTED_ASSET = "2203", e.UNSUPPORTED_ASSET_FOR_SWAPOUT = "2205", e.THORNODE_QUOTE_GENERIC_ERROR = "3000", e.NOT_ENOUGH_SYNTH_BALANCE = "3001", e.SYNTH_MINTING_CAP_REACHED = "3002", e.INVALID_QUOTE_MODE = "4000", e.NO_QUOTES = "4001", e.SERVICE_UNAVAILABLE_GENERIC = "5000", e.MISSING_GAS_DATA_GENERIC = "5100", e.MISSING_TOKEN_PRICE_GENERIC = "5200", e.ADDRESS_NOT_WHITELISTED = "6000", e.ADDRESS_ALREADY_CLAIMED = "6001", e.TEMPORARY_ERROR = "9999", e))(t || {});
const f = {
[t.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",

@@ -453,2 +453,8 @@ [t.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",

[t.MISSING_INPUT_PARAMETER]: "Missing input parameter: {0}.",
[t.INVALID_TYPE_GENERIC]: "Invalid type",
[t.INVALID_NUMBER_STRING]: "Invalid number string.",
[t.INVALID_NUMBER]: "Invalid number.",
[t.INVALID_BOOLEAN]: "Invalid boolean.",
[t.INVALID_OBJECT]: "Invalid object.",
[t.INVALID_ARRAY]: "Invalid array.",
[t.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Sell amount must be a positive integer.",

@@ -464,2 +470,3 @@ [t.SELL_BUY_ASSETS_ARE_THE_SAME]: "Sell and buy assets are the same.",

[t.DESTINATION_ADDRESS_SMART_CONTRACT]: "Destination address is a smart contract.",
[t.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Buy amount must be a positive integer.",
[t.INVALID_PROVIDER]: "Invalid provider {0}.",

@@ -479,6 +486,11 @@ [t.MISSING_CROSS_CHAIN_PROVIDER]: "Missing cross-chain provider.",

[t.SYNTH_MINTING_CAP_REACHED]: "Synth minting cap reached.",
[t.INVALID_QUOTE_MODE]: "Invalid quote mode.",
[t.NO_QUOTES]: "No quotes to service this request.",
[t.SERVICE_UNAVAILABLE_GENERIC]: "Service unavailable.",
[t.MISSING_GAS_DATA_GENERIC]: "Missing gas data.",
[t.MISSING_TOKEN_PRICE_GENERIC]: "Missing token price.",
[t.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
[t.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
}, o = (e, a) => {
let n = h[e];
}, p = (e, a) => {
let n = f[e];
for (let r = 0; r < a.length; r++)

@@ -488,11 +500,11 @@ n = n.replace(`{${r}}`, a[r]);

};
class T extends Error {
class y extends Error {
constructor({
status: n,
revision: r,
module: l,
module: T,
code: i,
message: d,
type: p,
options: { shouldLog: m, shouldThrow: A, shouldTrace: S } = {
message: l,
type: m,
options: { shouldLog: A, shouldThrow: I, shouldTrace: S } = {
shouldLog: !0,

@@ -502,5 +514,6 @@ shouldThrow: !0,

},
displayMessageParams: u
displayMessageParams: d
}) {
super(d);
const u = l || p(i, d || []) || "";
super(u);
s(this, "status");

@@ -516,16 +529,19 @@ s(this, "revision");

s(this, "displayMessageParams");
this.status = n, this.revision = r || "NO_REVISION", this.module = l, this.message = d, this.display = o(i, u || []), this.code = i, this.type = p || y.UNHANDLED_ERROR, this.options = {
shouldLog: m || !0,
this.status = n, this.revision = r || "NO_REVISION", this.module = T, this.message = u, this.display = p(i, d || []), this.code = i, this.type = m || o.UNHANDLED_ERROR, this.options = {
shouldLog: A || !0,
shouldTrace: S || !0,
shouldThrow: A || !0
}, this.displayMessageParams = u || [], this.options.shouldTrace && Error.captureStackTrace(this);
shouldThrow: I || !1
}, this.displayMessageParams = d || [], this.options.shouldTrace && Error.captureStackTrace(this);
}
static fromErrorInfo(n) {
return new T(n);
return new y(n);
}
toErrorInfo() {
return { ...this, identifier: this.identifier };
}
get identifier() {
return `${this.revision || "NO_REVISION"}-${this.type || "NO_TYPE"}-${this.module}-${this.code}`;
return `${this.revision}-${this.type || "NO_TYPE"}-${this.module}-${this.code}`;
}
get displayMessage() {
return o(this.code, this.displayMessageParams || []);
return p(this.code, this.displayMessageParams || []);
}

@@ -537,10 +553,7 @@ handle() {

throw Error(n, { cause: this.stack });
return this.returnErrorInfo();
return this.toErrorInfo();
}
returnErrorInfo() {
return { ...this, identifier: this.identifier };
}
}
var f = /* @__PURE__ */ ((e) => (e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Doge = "DOGE", e.Ethereum = "ETH", e.Litecoin = "LTC", e.THORChain = "THOR", e))(f || {});
const F = [
var L = /* @__PURE__ */ ((e) => (e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Doge = "DOGE", e.Ethereum = "ETH", e.Litecoin = "LTC", e.THORChain = "THOR", e))(L || {});
const X = [
"THOR",

@@ -558,4 +571,4 @@ "AVAX",

];
var R = /* @__PURE__ */ ((e) => (e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.USDC_SPL_MINT_ADDRESS = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", e.USDC_SPL_TESTNET_MINT_ADDRESS = "6TEqT62wq5mbKQPubX9eFeNJRYXRJd79Hk51pZk7nZrB", e))(R || {}), g = /* @__PURE__ */ ((e) => (e.Mainnet = "mainnet", e.Testnet = "testnet", e))(g || {}), O = /* @__PURE__ */ ((e) => (e[e.Ethereum = 60] = "Ethereum", e[e.Binance = 714] = "Binance", e[e.THORChain = 931] = "THORChain", e))(O || {}), D = /* @__PURE__ */ ((e) => (e.AVAX = "m/44'/60'/0'/0", e.BCH = "m/44'/145'/0'/0", e.BNB = "m/44'/714'/0'/0", e.BSC = "m/44'/60'/0'/0", e.BTC = "m/84'/0'/0'/0", e.DOGE = "m/44'/3'/0'/0", e.ETH = "m/44'/60'/0'/0", e.GAIA = "m/44'/118'/0'/0", e.LTC = "m/84'/2'/0'/0", e.THOR = "m/44'/931'/0'/0", e))(D || {});
const X = {
var g = /* @__PURE__ */ ((e) => (e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.USDC_SPL_MINT_ADDRESS = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", e.USDC_SPL_TESTNET_MINT_ADDRESS = "6TEqT62wq5mbKQPubX9eFeNJRYXRJd79Hk51pZk7nZrB", e))(g || {}), B = /* @__PURE__ */ ((e) => (e.Mainnet = "mainnet", e.Testnet = "testnet", e))(B || {}), v = /* @__PURE__ */ ((e) => (e[e.Ethereum = 60] = "Ethereum", e[e.Binance = 714] = "Binance", e[e.THORChain = 931] = "THORChain", e))(v || {}), D = /* @__PURE__ */ ((e) => (e.AVAX = "m/44'/60'/0'/0", e.BCH = "m/44'/145'/0'/0", e.BNB = "m/44'/714'/0'/0", e.BSC = "m/44'/60'/0'/0", e.BTC = "m/84'/0'/0'/0", e.DOGE = "m/44'/3'/0'/0", e.ETH = "m/44'/60'/0'/0", e.GAIA = "m/44'/118'/0'/0", e.LTC = "m/84'/2'/0'/0", e.THOR = "m/44'/931'/0'/0", e))(D || {});
const Y = {
AVAX: [44, 60, 0, 0, 0],

@@ -572,4 +585,4 @@ BCH: [84, 145, 0, 0, 0],

};
var L = /* @__PURE__ */ ((e) => (e[e.AVAX = 18] = "AVAX", e[e.BCH = 8] = "BCH", e[e.BNB = 8] = "BNB", e[e.BSC = 18] = "BSC", e[e.BTC = 8] = "BTC", e[e.DOGE = 8] = "DOGE", e[e.ETH = 18] = "ETH", e[e.GAIA = 6] = "GAIA", e[e.LTC = 8] = "LTC", e[e.THOR = 8] = "THOR", e))(L || {}), B = /* @__PURE__ */ ((e) => (e.Avalanche = "43114", e.AvalancheHex = "0xa86a", e.Binance = "Binance-Chain-Tigris", e.BinanceSmartChain = "56", e.BinanceSmartChainHex = "0x38", e.Bitcoin = "bitcoin", e.Bitcoincash = "bitcoincash", e.Cosmos = "cosmoshub-4", e.Dogecoin = "dogecoin", e.Ethereum = "1", e.EthereumHex = "0x1", e.Litecoin = "litecoin", e.Thorchain = "thorchain-mainnet-v1", e.ThorchainStagenet = "thorchain-stagenet-v2", e))(B || {}), b = /* @__PURE__ */ ((e) => (e.Avalanche = "https://node-router.thorswap.net/avalanche-c", e.BinanceSmartChain = "https://bsc-dataseed.binance.org", e.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", e.Ethereum = "https://node-router.thorswap.net/ethereum", e.Litecoin = "https://node-router.thorswap.net/litecoin", e.Bitcoin = "https://node-router.thorswap.net/bitcoin", e.Dogecoin = "https://node-router.thorswap.net/dogecoin", e.BitcoinCash = "https://node-router.thorswap.net/bitcoin-cash", e))(b || {}), v = /* @__PURE__ */ ((e) => (e.Thorswap = "https://api.thorswap.finance", e))(v || {});
const K = {
var b = /* @__PURE__ */ ((e) => (e[e.AVAX = 18] = "AVAX", e[e.BCH = 8] = "BCH", e[e.BNB = 8] = "BNB", e[e.BSC = 18] = "BSC", e[e.BTC = 8] = "BTC", e[e.DOGE = 8] = "DOGE", e[e.ETH = 18] = "ETH", e[e.GAIA = 6] = "GAIA", e[e.LTC = 8] = "LTC", e[e.THOR = 8] = "THOR", e))(b || {}), V = /* @__PURE__ */ ((e) => (e.Avalanche = "43114", e.AvalancheHex = "0xa86a", e.Binance = "Binance-Chain-Tigris", e.BinanceSmartChain = "56", e.BinanceSmartChainHex = "0x38", e.Bitcoin = "bitcoin", e.Bitcoincash = "bitcoincash", e.Cosmos = "cosmoshub-4", e.Dogecoin = "dogecoin", e.Ethereum = "1", e.EthereumHex = "0x1", e.Litecoin = "litecoin", e.Thorchain = "thorchain-mainnet-v1", e.ThorchainStagenet = "thorchain-stagenet-v2", e))(V || {}), M = /* @__PURE__ */ ((e) => (e.Avalanche = "https://node-router.thorswap.net/avalanche-c", e.BinanceSmartChain = "https://bsc-dataseed.binance.org", e.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", e.Ethereum = "https://node-router.thorswap.net/ethereum", e.Litecoin = "https://node-router.thorswap.net/litecoin", e.Bitcoin = "https://node-router.thorswap.net/bitcoin", e.Dogecoin = "https://node-router.thorswap.net/dogecoin", e.BitcoinCash = "https://node-router.thorswap.net/bitcoin-cash", e))(M || {}), O = /* @__PURE__ */ ((e) => (e.Thorswap = "https://api.thorswap.finance", e))(O || {});
const Q = {
AVAX: "https://node-router.thorswap.net/avalanche-c",

@@ -584,3 +597,3 @@ BSC: "https://bsc-dataseed.binance.org",

/* BitcoinCash */
}, Y = {
}, q = {
AVAX: "43114",

@@ -597,3 +610,3 @@ BNB: "Binance-Chain-Tigris",

/* Thorchain */
}, q = {
}, K = {
AVAX: "0xa86a",

@@ -610,3 +623,3 @@ BNB: "Binance-Chain-Tigris",

/* Thorchain */
}, Q = {
}, W = {
[

@@ -658,37 +671,37 @@ "0xa86a"

};
var H = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(H || {});
const W = "image rally need wedding health address purse army antenna leopard sea gain";
var x = /* @__PURE__ */ ((e) => (e[e.NotInstalled = 0] = "NotInstalled", e[e.Detected = 1] = "Detected", e))(x || {}), C = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(C || {}), M = /* @__PURE__ */ ((e) => (e.FlatFee = "base", e.PerByte = "byte", e))(M || {}), V = /* @__PURE__ */ ((e) => (e.KEYSTORE = "KEYSTORE", e.XDEFI = "XDEFI", e.METAMASK = "METAMASK", e.COINBASE_WEB = "COINBASE_WEB", e.TREZOR = "TREZOR", e.TRUSTWALLET = "TRUSTWALLET", e.TRUSTWALLET_WEB = "TRUSTWALLET_WEB", e.LEDGER = "LEDGER", e.KEPLR = "KEPLR", e.BRAVE = "BRAVE", e.WALLETCONNECT = "WALLETCONNECT", e))(V || {});
var R = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(R || {});
const k = "image rally need wedding health address purse army antenna leopard sea gain";
var H = /* @__PURE__ */ ((e) => (e[e.NotInstalled = 0] = "NotInstalled", e[e.Detected = 1] = "Detected", e))(H || {}), U = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(U || {}), x = /* @__PURE__ */ ((e) => (e.FlatFee = "base", e.PerByte = "byte", e))(x || {}), C = /* @__PURE__ */ ((e) => (e.KEYSTORE = "KEYSTORE", e.XDEFI = "XDEFI", e.METAMASK = "METAMASK", e.COINBASE_WEB = "COINBASE_WEB", e.TREZOR = "TREZOR", e.TRUSTWALLET = "TRUSTWALLET", e.TRUSTWALLET_WEB = "TRUSTWALLET_WEB", e.LEDGER = "LEDGER", e.KEPLR = "KEPLR", e.BRAVE = "BRAVE", e.WALLETCONNECT = "WALLETCONNECT", e))(C || {});
export {
T as ApiError,
v as ApiUrl,
I as AssetSymbol,
L as BaseDecimal,
f as Chain,
B as ChainId,
Q as ChainIdToChain,
Y as ChainToChainId,
q as ChainToHexChainId,
K as ChainToRPC,
R as ContractAddress,
_ as Denomination,
y as ApiError,
O as ApiUrl,
c as AssetSymbol,
b as BaseDecimal,
L as Chain,
V as ChainId,
W as ChainIdToChain,
q as ChainToChainId,
K as ChainToHexChainId,
Q as ChainToRPC,
g as ContractAddress,
E as Denomination,
D as DerivationPath,
t as ERROR_CODE,
c as ERROR_MODULE,
y as ERROR_TYPE,
H as ErrorCode,
C as FeeOption,
M as FeeType,
W as MOCK_PHRASE,
g as Network,
X as NetworkDerivationPath,
O as NetworkId,
b as RPCUrl,
F as SUPPORTED_CHAINS,
w as TCAvalancheDepositABI,
G as TCEthereumVaultAbi,
V as WalletOption,
x as WalletStatus,
U as erc20ABI
h as ERROR_MODULE,
o as ERROR_TYPE,
R as ErrorCode,
U as FeeOption,
x as FeeType,
k as MOCK_PHRASE,
B as Network,
Y as NetworkDerivationPath,
v as NetworkId,
M as RPCUrl,
X as SUPPORTED_CHAINS,
F as TCAvalancheDepositABI,
w as TCEthereumVaultAbi,
C as WalletOption,
H as WalletStatus,
G as erc20ABI
};
//# sourceMappingURL=index.es.js.map

@@ -36,3 +36,3 @@ {

"types": "./dist/index.d.ts",
"version": "1.0.0-development.87",
"version": "1.0.0-development.88",
"scripts": {

@@ -39,0 +39,0 @@ "build": "echo 'Build types 🛠'; vite build && echo 'Build succeeded types ✅'",

@@ -30,31 +30,35 @@ import { getDisplayMessage } from './displayMessages.js';

}: ErrorInfo) {
super(message);
const safeMessage = message || getDisplayMessage(code, displayMessageParams || []) || '';
super(safeMessage);
this.status = status;
this.revision = revision || 'NO_REVISION';
this.module = module;
this.message = message;
this.message = safeMessage;
this.display = getDisplayMessage(code, displayMessageParams || []);
this.code = code;
this.type = type ? type : ERROR_TYPE.UNHANDLED_ERROR;
this.type = type || ERROR_TYPE.UNHANDLED_ERROR;
this.options = {
shouldLog: shouldLog || true,
shouldTrace: shouldTrace || true,
shouldThrow: shouldThrow || true,
shouldThrow: shouldThrow || false,
};
this.displayMessageParams = displayMessageParams || [];
if (this.options.shouldTrace) Error.captureStackTrace(this); // NodeJS Error supports this
if (this.options.shouldTrace) Error.captureStackTrace(this);
}
public static fromErrorInfo(errorInfo: ErrorInfo) {
public static fromErrorInfo(errorInfo: ErrorInfo): ApiError {
return new ApiError(errorInfo);
}
public get identifier() {
return `${this.revision || 'NO_REVISION'}-${this.type || 'NO_TYPE'}-${this.module}-${
this.code
}`;
public toErrorInfo(): ErrorInfo {
return { ...this, identifier: this.identifier };
}
public get displayMessage() {
public get identifier(): string {
return `${this.revision}-${this.type || 'NO_TYPE'}-${this.module}-${this.code}`;
}
public get displayMessage(): string {
return getDisplayMessage(this.code, this.displayMessageParams || []);

@@ -67,10 +71,6 @@ }

if (this.options.shouldLog) console.error(message, '\n', this.stack || '');
if (this.options.shouldThrow) throw Error(message, { cause: this.stack }); // NodeJS Error supports this
if (this.options.shouldThrow) throw Error(message, { cause: this.stack });
return this.returnErrorInfo();
return this.toErrorInfo();
}
public returnErrorInfo() {
return { ...this, identifier: this.identifier };
}
}

@@ -1,2 +0,2 @@

import { ERROR_CODE } from "./types.js";
import { ERROR_CODE } from './types.js';

@@ -10,12 +10,21 @@ export const ERROR_DISPLAY_MESSAGES: Record<string, string> = {

[ERROR_CODE.MISSING_INPUT_PARAMETER]: 'Missing input parameter: {0}.',
[ERROR_CODE.INVALID_TYPE_GENERIC]: 'Invalid type',
[ERROR_CODE.INVALID_NUMBER_STRING]: 'Invalid number string.',
[ERROR_CODE.INVALID_NUMBER]: 'Invalid number.',
[ERROR_CODE.INVALID_BOOLEAN]: 'Invalid boolean.',
[ERROR_CODE.INVALID_OBJECT]: 'Invalid object.',
[ERROR_CODE.INVALID_ARRAY]: 'Invalid array.',
[ERROR_CODE.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER]: 'Sell amount must be a positive integer.',
[ERROR_CODE.SELL_BUY_ASSETS_ARE_THE_SAME]: 'Sell and buy assets are the same.',
[ERROR_CODE.MISSING_SOURCE_ADDRESS_FOR_SYNTH]: 'Source address is required for synth quote.',
[ERROR_CODE.AFF_ADDRESS_AND_BPS_OR_NEITHER]: 'Must provide affiliateAddress and affiliateBasisPoints params, or neither.',
[ERROR_CODE.AFF_ADDRESS_AND_BPS_OR_NEITHER]:
'Must provide affiliateAddress and affiliateBasisPoints params, or neither.',
[ERROR_CODE.AFF_ADDRESS_TOO_LONG]: 'affiliateAddress too long: 3 characters max.',
[ERROR_CODE.AFF_BPS_INTEGER_0_100]: 'affiliateBasisPoints must be an integer between 0 and 100.',
[ERROR_CODE.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN]: 'Source address {0} invalid for sell chain.',
[ERROR_CODE.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN]: 'Destination address {0} invalid for buy chain.',
[ERROR_CODE.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN]:
'Destination address {0} invalid for buy chain.',
[ERROR_CODE.PREFERRED_PROFVIDER_NOT_SUPPORTED]: 'Preferred provider not supported.',
[ERROR_CODE.DESTINATION_ADDRESS_SMART_CONTRACT]: 'Destination address is a smart contract.',
[ERROR_CODE.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: 'Buy amount must be a positive integer.',
[ERROR_CODE.INVALID_PROVIDER]: 'Invalid provider {0}.',

@@ -33,4 +42,10 @@ [ERROR_CODE.MISSING_CROSS_CHAIN_PROVIDER]: 'Missing cross-chain provider.',

[ERROR_CODE.THORNODE_QUOTE_GENERIC_ERROR]: 'ThorNode quote generic error.',
[ERROR_CODE.NOT_ENOUGH_SYNTH_BALANCE]: 'Source address doesn\'t have enough synth balance for this quote.',
[ERROR_CODE.NOT_ENOUGH_SYNTH_BALANCE]:
"Source address doesn't have enough synth balance for this quote.",
[ERROR_CODE.SYNTH_MINTING_CAP_REACHED]: 'Synth minting cap reached.',
[ERROR_CODE.INVALID_QUOTE_MODE]: 'Invalid quote mode.',
[ERROR_CODE.NO_QUOTES]: 'No quotes to service this request.',
[ERROR_CODE.SERVICE_UNAVAILABLE_GENERIC]: 'Service unavailable.',
[ERROR_CODE.MISSING_GAS_DATA_GENERIC]: 'Missing gas data.',
[ERROR_CODE.MISSING_TOKEN_PRICE_GENERIC]: 'Missing token price.',
[ERROR_CODE.ADDRESS_NOT_WHITELISTED]: 'Address {0} not whitelisted for airdrop.',

@@ -43,10 +58,8 @@ [ERROR_CODE.ADDRESS_ALREADY_CLAIMED]: 'Address {0} already claimed the airdrop.',

for(let i = 0; i < displayMessageParams.length; i++) {
for (let i = 0; i < displayMessageParams.length; i++) {
displayMessage = displayMessage.replace(`{${i}}`, displayMessageParams[i]);
}
if(displayMessageParams.length === 0)
return displayMessage.replace('{0}', '');
else
return displayMessage;
}
if (displayMessageParams.length === 0) return displayMessage.replace('{0}', '');
else return displayMessage;
};

@@ -29,2 +29,4 @@ export enum ERROR_TYPE {

PROVIDER_UTIL = '4000',
// Aggregator
TXN_DETAILS = '5000',
// AirDrop

@@ -35,3 +37,3 @@ AIRDROP_UTIL = '6000',

export enum ERROR_CODE {
// 10xx - Conditions
// 10xx - Generic
INVALID_INPUT_PARAMETERS = '1000',

@@ -43,2 +45,9 @@ UNKNOWN_PROVIDERS = '1001',

MISSING_INPUT_PARAMETER = '1005',
// 11xx - Type error
INVALID_TYPE_GENERIC = '1100',
INVALID_NUMBER_STRING = '1101',
INVALID_NUMBER = '1102',
INVALID_BOOLEAN = '1103',
INVALID_OBJECT = '1104',
INVALID_ARRAY = '1105',
// 20xx - Quote request parameters

@@ -55,2 +64,3 @@ SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = '2000',

DESTINATION_ADDRESS_SMART_CONTRACT = '2009',
BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = '2010',
// 21xx - Quote request providers issue

@@ -74,5 +84,16 @@ INVALID_PROVIDER = '2100',

SYNTH_MINTING_CAP_REACHED = '3002',
// 40xx - Code logic error (not the client's fault)
INVALID_QUOTE_MODE = '4000',
NO_QUOTES = '4001',
// 50xx - Service unavailable
SERVICE_UNAVAILABLE_GENERIC = '5000',
// 51xx - Missing gas data
MISSING_GAS_DATA_GENERIC = '5100',
// 52xx - Missing token price
MISSING_TOKEN_PRICE_GENERIC = '5200',
// 60xx - Airdrop
ADDRESS_NOT_WHITELISTED = '6000',
ADDRESS_ALREADY_CLAIMED = '6001',
// 90xx - Unhandled
TEMPORARY_ERROR = '9999', // use only when waiting for a PR to be merged
}

@@ -86,3 +107,3 @@

code: ERROR_CODE;
message: string;
message?: string | undefined;
stack?: string;

@@ -89,0 +110,0 @@ identifier?: string;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc