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.79 to 1.0.0-development.80

6

CHANGELOG.md
# @thorswap-lib/types
## 1.0.0-development.80
### Patch Changes
- [`6cd7025`](https://github.com/thorswap/SwapKit/commit/6cd70256164568fb96b4397f027340a874d76ddc) Thanks [@chillios-ts](https://github.com/chillios-ts)! - remove getTransactions & getTransactionData
## 1.0.0-development.79

@@ -4,0 +10,0 @@

153

dist/index.d.ts

@@ -7,9 +7,9 @@ /// <reference types="node" />

export declare type AddChainWalletParams = ParamsWithChain<{
wallet: ChainWallet;
walletMethods: any;
}>;
export declare type Address = string;
export declare type AminoWrapping<T> = {
type: string;
value: T;
};
export declare type AmountWithAssetDenom = AmountWithDenom<Denomination.Asset, FixedNumber>;

@@ -58,2 +58,14 @@

declare type ApisType = {
[key in UTXOChains]?: string | any;
} & {
[key in EVMChains]?: string | any;
} & {
[key in Chain.Cosmos]?: string;
};
export declare enum ApiUrl {
Thorswap = "https://api.thorswap.finance"
}
export declare type Asset = {

@@ -127,3 +139,3 @@ chain: Chain;

Cosmos = "cosmoshub-4",
DogeCoin = "dogecoin",
Dogecoin = "dogecoin",
Ethereum = "1",

@@ -142,15 +154,57 @@ EthereumHex = "0x1",

declare type Coin = {
asset: Asset;
amount: AmountWithBaseDenom;
export declare const ChainToRPC: {
AVAX: RPCUrl;
BSC: RPCUrl;
ETH: RPCUrl;
GAIA: RPCUrl;
LTC: RPCUrl;
BTC: RPCUrl;
DOGE: RPCUrl;
BCH: RPCUrl;
};
export declare type CommonTxParams = {
asset: string;
amount: number;
decimal: number;
recipient: string;
memo?: string;
declare type ChainWallet = {
address: string;
balance: any[];
walletType: WalletOption;
};
declare type ConnectConfig = {
stagenet?: boolean;
/**
* @required for AVAX & BSC
*/
covalentApiKey?: string;
/**
* @required for ETH
*/
ethplorerApiKey?: string;
/**
* @required for BTC, LTC, DOGE & BCH
*/
utxoApiKey?: string;
/**
* @required for Walletconnect
*/
walletConnectProjectId?: string;
/**
* @optional for Trezor config
*/
trezorManifest?: {
email: string;
appUrl: string;
};
};
declare type ConnectMethodNames = 'connectXDEFI' | 'connectKeplr' | 'connectTrustwallet' | 'connectWalletconnect' | 'connectKeystore' | 'connectLedger' | 'connectTrezor' | 'connectEVMWallet';
export declare type ConnectWalletParams = {
addChain: (params: AddChainWalletParams) => void;
config: ConnectConfig;
rpcUrls: {
[chain in Chain]?: string;
};
apis: ApisType;
};
export declare enum ContractAddress {

@@ -300,4 +354,19 @@ AVAX = "0x0000000000000000000000000000000000000000",

declare type EVMChains = Chain.Ethereum | Chain.BinanceSmartChain | Chain.Avalanche;
export declare type EVMWalletOptions = WalletOption.BRAVE | WalletOption.METAMASK | WalletOption.TRUSTWALLET_WEB | WalletOption.COINBASE_WEB;
export declare type ExtendParams = {
excludedChains?: Chain[];
config?: ConnectConfig;
rpcUrls?: {
[chain in Chain]?: string;
};
apis?: ApisType;
wallets: {
connectMethodName: ConnectMethodNames;
connect: (params: ConnectWalletParams) => (...params: any) => Promise<any>;
}[];
};
export declare enum FeeOption {

@@ -354,13 +423,2 @@ Average = "average",

export declare type MultiSendParams = {
walletIndex?: number;
transactions: MultiTransfer[];
memo?: string;
};
export declare type MultiTransfer = {
to: Address;
coins: Coin[];
};
export declare enum Network {

@@ -379,16 +437,6 @@ Mainnet = "mainnet",

export declare interface ResourceWorkerGasPricesResponse {
ok: boolean;
result: {
chainId: ChainId;
asset: string;
gas: number;
units: 'tor' | 'gwei' | 'wei' | 'sats' | 'uatom';
}[];
}
declare type ParamsWithChain<T> = T & {
chain: Chain;
};
export declare enum ResourceWorkerUrls {
ALL_GAS_PRICES = "https://api.thorswap.net/resource-worker/gasPrice/getAll"
}
export declare enum RPCUrl {

@@ -398,3 +446,7 @@ Avalanche = "https://node-router.thorswap.net/avalanche-c",

Cosmos = "https://node-router.thorswap.net/cosmos/rpc",
Ethereum = "https://node-router.thorswap.net/ethereum"
Ethereum = "https://node-router.thorswap.net/ethereum",
Litecoin = "https://node-router.thorswap.net/litecoin",
Bitcoin = "https://node-router.thorswap.net/bitcoin",
Dogecoin = "https://node-router.thorswap.net/dogecoin",
BitcoinCash = "https://node-router.thorswap.net/bitcoin-cash"
}

@@ -562,3 +614,3 @@

export declare type TxFrom = {
declare type TxFrom = {
from: string;

@@ -571,10 +623,2 @@ amount: AmountWithBaseDenom;

export declare type TxHistoryParams = {
address: string;
offset?: number;
limit?: number;
startTime?: Date;
asset?: string;
};
export declare type TxParams = {

@@ -588,8 +632,3 @@ asset?: Asset;

export declare type TxsPage = {
total: number;
txs: Tx[];
};
export declare type TxTo = {
declare type TxTo = {
to: string;

@@ -600,3 +639,3 @@ amount: AmountWithBaseDenom;

export declare enum TxType {
declare enum TxType {
Transfer = "transfer",

@@ -614,2 +653,4 @@ Unknown = "unknown"

declare type UTXOChains = Chain.Bitcoin | Chain.Litecoin | Chain.Doge | Chain.BitcoinCash;
export declare enum WalletOption {

@@ -616,0 +657,0 @@ 'KEYSTORE' = "KEYSTORE",

var T = Object.defineProperty;
var m = (e, t, n) => t in e ? T(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var a = (e, t, n) => (m(e, typeof t != "symbol" ? t + "" : t, n), n);
const M = [
var m = (e, n, t) => n in e ? T(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
var a = (e, n, t) => (m(e, typeof n != "symbol" ? n + "" : n, t), t);
const R = [
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },

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

}
], V = [
], M = [
{

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

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

@@ -444,6 +444,6 @@ {

];
var A = /* @__PURE__ */ ((e) => (e.Base = "BASE", e.Asset = "ASSET", e))(A || {}), 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 || {}), i = /* @__PURE__ */ ((e) => (e.VALIDATION_ERROR = "VALIDATION_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))(i || {}), E = /* @__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 = "2001", e.THORCHAIN_PROVIDER = "3001", e.PROVIDER_UTIL = "4001", e))(E || {}), f = /* @__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_TOO_LOW = "2000", e.GAS_CONDITIONS_EXPENSIVE = "2001", 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))(f || {});
var c = /* @__PURE__ */ ((e) => (e.Base = "BASE", e.Asset = "ASSET", e))(c || {}), A = /* @__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))(A || {}), i = /* @__PURE__ */ ((e) => (e.VALIDATION_ERROR = "VALIDATION_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))(i || {}), E = /* @__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 = "2001", e.THORCHAIN_PROVIDER = "3001", e.PROVIDER_UTIL = "4001", e))(E || {}), f = /* @__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_TOO_LOW = "2000", e.GAS_CONDITIONS_EXPENSIVE = "2001", 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))(f || {});
class p extends Error {
constructor({
status: n,
status: t,
module: d,

@@ -462,3 +462,3 @@ code: u,

a(this, "options");
this.status = n, this.module = d, this.message = s, this.code = u, this.type = r || i.UNHANDLED_ERROR, this.options = {
this.status = t, this.module = d, this.message = s, this.code = u, this.type = r || i.UNHANDLED_ERROR, this.options = {
shouldLog: y || !0,

@@ -469,4 +469,4 @@ shouldTrace: l || !0,

}
static fromErrorInfo(n) {
return new p(n);
static fromErrorInfo(t) {
return new p(t);
}

@@ -477,6 +477,6 @@ identifier() {

handle() {
const n = `[${this.type}.${this.module}]: ${this.message}`;
if (this.options.shouldLog && console.error(n, `
const t = `[${this.type}.${this.module}]: ${this.message}`;
if (this.options.shouldLog && console.error(t, `
`, this.stack || ""), this.options.shouldThrow)
throw Error(n, { cause: this.stack });
throw Error(t, { cause: this.stack });
return this.returnErrorInfo();

@@ -488,4 +488,4 @@ }

}
var N = /* @__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))(N || {});
const U = [
var h = /* @__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))(h || {});
const V = [
"THOR",

@@ -503,4 +503,4 @@ "AVAX",

];
var S = /* @__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))(S || {}), g = /* @__PURE__ */ ((e) => (e.Mainnet = "mainnet", e.Testnet = "testnet", e))(g || {}), b = /* @__PURE__ */ ((e) => (e[e.Ethereum = 60] = "Ethereum", e[e.Binance = 714] = "Binance", e[e.THORChain = 931] = "THORChain", e))(b || {}), x = /* @__PURE__ */ ((e) => (e.Avalanche = "43114", e.AvalancheHex = "0xa86a", e.Binance = "Binance-Chain-Tigris", e.BinanceSmartChain = "56", 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))(x || {}), h = /* @__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))(h || {}), v = /* @__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))(v || {});
const w = {
var N = /* @__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))(N || {}), S = /* @__PURE__ */ ((e) => (e.Mainnet = "mainnet", e.Testnet = "testnet", e))(S || {}), g = /* @__PURE__ */ ((e) => (e[e.Ethereum = 60] = "Ethereum", e[e.Binance = 714] = "Binance", e[e.THORChain = 931] = "THORChain", e))(g || {}), b = /* @__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))(b || {});
const G = {
AVAX: [44, 60, 0, 0, 0],

@@ -517,4 +517,14 @@ BCH: [84, 145, 0, 0, 0],

};
var I = /* @__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))(I || {});
const P = {
var x = /* @__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))(x || {}), B = /* @__PURE__ */ ((e) => (e.Avalanche = "43114", e.AvalancheHex = "0xa86a", e.Binance = "Binance-Chain-Tigris", e.BinanceSmartChain = "56", 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 || {}), v = /* @__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))(v || {}), C = /* @__PURE__ */ ((e) => (e.Thorswap = "https://api.thorswap.finance", e))(C || {});
const U = {
AVAX: "https://node-router.thorswap.net/avalanche-c",
BSC: "https://bsc-dataseed.binance.org",
ETH: "https://node-router.thorswap.net/ethereum",
GAIA: "https://node-router.thorswap.net/cosmos/rpc",
LTC: "https://node-router.thorswap.net/litecoin",
BTC: "https://node-router.thorswap.net/bitcoin",
DOGE: "https://node-router.thorswap.net/dogecoin",
BCH: "https://node-router.thorswap.net/bitcoin-cash"
/* BitcoinCash */
}, D = {
AVAX: "43114",

@@ -531,3 +541,3 @@ BNB: "Binance-Chain-Tigris",

/* Thorchain */
}, D = {
}, P = {
AVAX: "0xa86a",

@@ -587,36 +597,36 @@ BNB: "Binance-Chain-Tigris",

};
var B = /* @__PURE__ */ ((e) => (e.ALL_GAS_PRICES = "https://api.thorswap.net/resource-worker/gasPrice/getAll", e))(B || {}), C = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(C || {}), O = /* @__PURE__ */ ((e) => (e.Transfer = "transfer", e.Unknown = "unknown", e))(O || {});
var I = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(I || {});
const F = "image rally need wedding health address purse army antenna leopard sea gain";
var L = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(L || {}), H = /* @__PURE__ */ ((e) => (e.FlatFee = "base", e.PerByte = "byte", e))(H || {}), _ = /* @__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))(_ || {});
var O = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(O || {}), H = /* @__PURE__ */ ((e) => (e.FlatFee = "base", e.PerByte = "byte", e))(H || {}), L = /* @__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))(L || {});
export {
p as ApiError,
c as AssetSymbol,
I as BaseDecimal,
N as Chain,
x as ChainId,
C as ApiUrl,
A as AssetSymbol,
x as BaseDecimal,
h as Chain,
B as ChainId,
X as ChainIdToChain,
P as ChainToChainId,
D as ChainToHexChainId,
S as ContractAddress,
A as Denomination,
v as DerivationPath,
D as ChainToChainId,
P as ChainToHexChainId,
U as ChainToRPC,
N as ContractAddress,
c as Denomination,
b as DerivationPath,
f as ERROR_CODE,
E as ERROR_MODULE,
i as ERROR_TYPE,
C as ErrorCode,
L as FeeOption,
I as ErrorCode,
O as FeeOption,
H as FeeType,
F as MOCK_PHRASE,
g as Network,
w as NetworkDerivationPath,
b as NetworkId,
h as RPCUrl,
B as ResourceWorkerUrls,
U as SUPPORTED_CHAINS,
G as TCAvalancheDepositABI,
V as TCEthereumVaultAbi,
O as TxType,
_ as WalletOption,
M as erc20ABI
S as Network,
G as NetworkDerivationPath,
g as NetworkId,
v as RPCUrl,
V as SUPPORTED_CHAINS,
w as TCAvalancheDepositABI,
M as TCEthereumVaultAbi,
L as WalletOption,
R as erc20ABI
};
//# sourceMappingURL=index.es.js.map

@@ -40,3 +40,3 @@ {

"types": "./dist/index.d.ts",
"version": "1.0.0-development.79"
"version": "1.0.0-development.80"
}
import { FixedNumber } from '@ethersproject/bignumber';
import { Chain } from './network.js';
import { WalletOption } from './wallet.js';
type UTXOChains = Chain.Bitcoin | Chain.Litecoin | Chain.Doge | Chain.BitcoinCash;
type EVMChains = Chain.Ethereum | Chain.BinanceSmartChain | Chain.Avalanche;
type ConnectMethodNames =
| 'connectXDEFI'
| 'connectKeplr'
| 'connectTrustwallet'
| 'connectWalletconnect'
| 'connectKeystore'
| 'connectLedger'
| 'connectTrezor'
| 'connectEVMWallet';
type ConnectConfig = {
stagenet?: boolean;
/**
* @required for AVAX & BSC
*/
covalentApiKey?: string;
/**
* @required for ETH
*/
ethplorerApiKey?: string;
/**
* @required for BTC, LTC, DOGE & BCH
*/
utxoApiKey?: string;
/**
* @required for Walletconnect
*/
walletConnectProjectId?: string;
/**
* @optional for Trezor config
*/
trezorManifest?: {
email: string;
appUrl: string;
};
};
type ChainWallet = {
address: string;
balance: any[];
walletType: WalletOption;
};
type ParamsWithChain<T> = T & { chain: Chain };
export type AddChainWalletParams = ParamsWithChain<{
wallet: ChainWallet;
walletMethods: any;
}>;
export type TxHash = string;

@@ -7,10 +62,2 @@

export type CommonTxParams = {
asset: string; // BNB.RUNE-B1A, BTC.BTC, ETH.USDT-0xffffff
amount: number;
decimal: number;
recipient: string;
memo?: string;
};
export type UTXO = {

@@ -31,5 +78,25 @@ hash: string;

export type AminoWrapping<T> = {
type: string;
value: T;
// TODO: Add types for api interface
type ApisType = { [key in UTXOChains]?: string | any } & {
[key in EVMChains]?: string | any;
} & {
[key in Chain.Cosmos]?: string;
};
export type ConnectWalletParams = {
addChain: (params: AddChainWalletParams) => void;
config: ConnectConfig;
rpcUrls: { [chain in Chain]?: string };
apis: ApisType;
};
export type ExtendParams = {
excludedChains?: Chain[];
config?: ConnectConfig;
rpcUrls?: { [chain in Chain]?: string };
apis?: ApisType;
wallets: {
connectMethodName: ConnectMethodNames;
connect: (params: ConnectWalletParams) => (...params: any) => Promise<any>;
}[];
};

@@ -46,27 +46,2 @@ export enum Chain {

export type EVMChain = Chain.Ethereum | Chain.BinanceSmartChain | Chain.Avalanche;
export enum ChainId {
Avalanche = '43114',
AvalancheHex = '0xa86a',
Binance = 'Binance-Chain-Tigris',
BinanceSmartChain = '56',
Bitcoin = 'bitcoin',
Bitcoincash = 'bitcoincash',
Cosmos = 'cosmoshub-4',
DogeCoin = 'dogecoin',
Ethereum = '1',
EthereumHex = '0x1',
Litecoin = 'litecoin',
Thorchain = 'thorchain-mainnet-v1',
ThorchainStagenet = 'thorchain-stagenet-v2',
}
export enum RPCUrl {
Avalanche = 'https://node-router.thorswap.net/avalanche-c',
BinanceSmartChain = 'https://bsc-dataseed.binance.org',
Cosmos = 'https://node-router.thorswap.net/cosmos/rpc',
Ethereum = 'https://node-router.thorswap.net/ethereum',
}
export enum DerivationPath {

@@ -113,2 +88,46 @@ AVAX = "m/44'/60'/0'/0",

export type EVMChain = Chain.Ethereum | Chain.BinanceSmartChain | Chain.Avalanche;
export enum ChainId {
Avalanche = '43114',
AvalancheHex = '0xa86a',
Binance = 'Binance-Chain-Tigris',
BinanceSmartChain = '56',
Bitcoin = 'bitcoin',
Bitcoincash = 'bitcoincash',
Cosmos = 'cosmoshub-4',
Dogecoin = 'dogecoin',
Ethereum = '1',
EthereumHex = '0x1',
Litecoin = 'litecoin',
Thorchain = 'thorchain-mainnet-v1',
ThorchainStagenet = 'thorchain-stagenet-v2',
}
export enum RPCUrl {
Avalanche = 'https://node-router.thorswap.net/avalanche-c',
BinanceSmartChain = 'https://bsc-dataseed.binance.org',
Cosmos = 'https://node-router.thorswap.net/cosmos/rpc',
Ethereum = 'https://node-router.thorswap.net/ethereum',
Litecoin = 'https://node-router.thorswap.net/litecoin',
Bitcoin = 'https://node-router.thorswap.net/bitcoin',
Dogecoin = 'https://node-router.thorswap.net/dogecoin',
BitcoinCash = 'https://node-router.thorswap.net/bitcoin-cash',
}
export enum ApiUrl {
Thorswap = 'https://api.thorswap.finance',
}
export const ChainToRPC = {
[Chain.Avalanche]: RPCUrl.Avalanche,
[Chain.BinanceSmartChain]: RPCUrl.BinanceSmartChain,
[Chain.Ethereum]: RPCUrl.Ethereum,
[Chain.Cosmos]: RPCUrl.Cosmos,
[Chain.Litecoin]: RPCUrl.Litecoin,
[Chain.Bitcoin]: RPCUrl.Bitcoin,
[Chain.Doge]: RPCUrl.Dogecoin,
[Chain.BitcoinCash]: RPCUrl.BitcoinCash,
};
export const ChainToChainId: Record<Chain, ChainId> = {

@@ -121,3 +140,3 @@ [Chain.Avalanche]: ChainId.Avalanche,

[Chain.Cosmos]: ChainId.Cosmos,
[Chain.Doge]: ChainId.DogeCoin,
[Chain.Doge]: ChainId.Dogecoin,
[Chain.Ethereum]: ChainId.Ethereum,

@@ -128,3 +147,2 @@ [Chain.Litecoin]: ChainId.Litecoin,

// Return Hex of ChainId if available
export const ChainToHexChainId: Record<Chain, ChainId> = {

@@ -137,3 +155,3 @@ [Chain.Avalanche]: ChainId.AvalancheHex,

[Chain.Cosmos]: ChainId.Cosmos,
[Chain.Doge]: ChainId.DogeCoin,
[Chain.Doge]: ChainId.Dogecoin,
[Chain.Ethereum]: ChainId.EthereumHex,

@@ -152,3 +170,3 @@ [Chain.Litecoin]: ChainId.Litecoin,

[ChainId.Cosmos]: Chain.Cosmos,
[ChainId.DogeCoin]: Chain.Doge,
[ChainId.Dogecoin]: Chain.Doge,
[ChainId.EthereumHex]: Chain.Ethereum,

@@ -160,15 +178,1 @@ [ChainId.Ethereum]: Chain.Ethereum,

};
export interface ResourceWorkerGasPricesResponse {
ok: boolean;
result: {
chainId: ChainId;
asset: string;
gas: number;
units: 'tor' | 'gwei' | 'wei' | 'sats' | 'uatom';
}[];
}
export enum ResourceWorkerUrls {
ALL_GAS_PRICES = `https://api.thorswap.net/resource-worker/gasPrice/getAll`,
}

@@ -8,3 +8,3 @@ import { BigNumberish } from '@ethersproject/bignumber';

export enum TxType {
enum TxType {
Transfer = 'transfer',

@@ -14,7 +14,3 @@ Unknown = 'unknown',

export type WalletTxParams = TxParams & {
from?: string;
};
export type TxTo = {
type TxTo = {
to: string; // address

@@ -25,3 +21,3 @@ amount: AmountWithBaseDenom; // amount

export type TxFrom = {
type TxFrom = {
from: string; // address or tx id

@@ -32,2 +28,6 @@ amount: AmountWithBaseDenom; // amount

export type WalletTxParams = TxParams & {
from?: string;
};
export type Tx = {

@@ -50,31 +50,2 @@ asset: Asset; // asset

export type TxsPage = {
total: number;
txs: Tx[];
};
export type TxHistoryParams = {
address: string; // Address to get history for
offset?: number; // Optional Offset
limit?: number; // Optional Limit of transactions
startTime?: Date; // Optional start time
asset?: string; // Optional asset. Result transactions will be filtered by this asset
};
type Coin = {
asset: Asset;
amount: AmountWithBaseDenom;
};
export type MultiTransfer = {
to: Address;
coins: Coin[];
};
export type MultiSendParams = {
walletIndex?: number;
transactions: MultiTransfer[];
memo?: string;
};
export type EIP1559TxParams<T = BigNumberish> = {

@@ -81,0 +52,0 @@ nonce?: number;

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