New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@swapkit/api

Package Overview
Dependencies
Maintainers
1
Versions
242
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swapkit/api - npm Package Compare versions

Comparing version 0.0.0-nightly-20240208140027 to 0.0.0-nightly-20240223171610

640

dist/index.d.ts

@@ -1,3 +0,5 @@

import type { Chain, LedgerErrorCode, QuoteMode } from '@swapkit/types';
import type { Chain } from '@swapkit/types';
import type { LedgerErrorCode } from '@swapkit/types';
import type { Options } from 'ky';
import type { QuoteMode } from '@swapkit/types';

@@ -8,107 +10,100 @@ /**

export declare const ApiEndpoints: {
CachedPrices: string;
GasRates: string;
Quote: string;
Txn: string;
TokenlistProviders: string;
TokenList: string;
Thorname: string;
CachedPrices: string;
GasRates: string;
Quote: string;
Txn: string;
TokenlistProviders: string;
TokenList: string;
Thorname: string;
};
export declare type ApiParams =
| QuoteParams
| TxnParams
| CachedPricesParams
| TokensParams
| ThornameParams;
export declare type ApiParams = QuoteParams | TxnParams | CachedPricesParams | TokensParams | ThornameParams;
export declare type CachedPricesParams = {
tokens: {
identifier: string;
}[];
metadata?: 'true' | 'false';
lookup?: 'true' | 'false';
sparkline?: 'true' | 'false';
tokens: {
identifier: string;
}[];
metadata?: "true" | "false";
lookup?: "true" | "false";
sparkline?: "true" | "false";
};
export declare type CachedPricesResponse = {
identifier: string;
price_usd: number;
cg?: {
id?: string;
name?: string;
market_cap?: number;
total_volume?: number;
price_change_24h_usd?: number;
price_change_percentage_24h_usd?: number;
sparkline_in_7d?: string;
timestamp?: number;
};
identifier: string;
price_usd: number;
cg?: {
id?: string;
name?: string;
market_cap?: number;
total_volume?: number;
price_change_24h_usd?: number;
price_change_percentage_24h_usd?: number;
sparkline_in_7d?: string;
timestamp?: number;
};
};
declare type Calldata = {
amount: string;
amountIn: string;
amountOut: string;
amountOutMin: string;
assetAddress?: string;
data?: string;
deadline?: string;
expiration: number;
fromAsset?: string;
memo: string;
memoStreamingSwap?: string;
router?: string;
tcMemo?: string;
tcRouter?: string;
tcVault?: string;
token?: string;
userAddress: string;
vault?: string;
amount: string;
amountIn: string;
amountOut: string;
amountOutMin: string;
assetAddress?: string;
data?: string;
deadline?: string;
expiration: number;
fromAsset?: string;
memo: string;
memoStreamingSwap?: string;
router?: string;
tcMemo?: string;
tcRouter?: string;
tcVault?: string;
token?: string;
userAddress: string;
vault?: string;
};
export declare const defaultRequestHeaders:
| {
referrer?: undefined;
referer?: undefined;
}
| {
referrer: string;
referer: string;
};
export declare const defaultRequestHeaders: {
referrer?: undefined;
referer?: undefined;
} | {
referrer: string;
referer: string;
};
export declare interface EVMTransactionDetails {
contractAddress: string;
contractMethod: string;
contractParams: string[];
contractParamsStreaming: string[];
contractParamsNames: string[];
approvalToken?: string;
approvalSpender?: string;
contractAddress: string;
contractMethod: string;
contractParams: string[];
contractParamsStreaming: string[];
contractParamsNames: string[];
approvalToken?: string;
approvalSpender?: string;
}
declare type FeeItem = {
type: string;
asset: string;
networkFee: number;
networkFeeUSD: number;
affiliateFee: number;
affiliateFeeUSD: number;
totalFee: number;
totalFeeUSD: number;
isOutOfPocket: boolean;
slipFee?: number;
slipFeeUSD?: number;
type: string;
asset: string;
networkFee: number;
networkFeeUSD: number;
affiliateFee: number;
affiliateFeeUSD: number;
totalFee: number;
totalFeeUSD: number;
isOutOfPocket: boolean;
slipFee?: number;
slipFeeUSD?: number;
};
declare type Fees = {
[key in Chain]: FeeItem[];
[key in Chain]: FeeItem[];
};
export declare type GasPriceInfo = {
asset: string;
units: string;
gas: number;
chainId: string;
gasAsset: number;
asset: string;
units: string;
gas: number;
chainId: string;
gasAsset: number;
};

@@ -119,163 +114,160 @@

declare type Meta = {
buyChain: Chain;
buyChainGasRate: number;
hasStreamingSwap: boolean;
lastLegEffectiveSlipPercentage: number;
priceProtectionDetected: boolean;
priceProtectionRequired: boolean;
providerBuyAssetAmount: {
buyAmount: number;
chain: string;
symbol: string;
ticker: string;
};
quoteMode: QuoteMode;
sellChain: Chain;
sellChainGasRate: number;
warnings: {
warningCode: LedgerErrorCode;
warningMessage: string;
}[];
thornodeMeta?: {
dustThreshold?: number;
expectedAmountOut: number;
expectedAmountOutStreaming: number;
fees: {
affiliate: number;
asset: string;
outbound: number;
buyChain: Chain;
buyChainGasRate: number;
hasStreamingSwap: boolean;
lastLegEffectiveSlipPercentage: number;
priceProtectionDetected: boolean;
priceProtectionRequired: boolean;
providerBuyAssetAmount: {
buyAmount: number;
chain: string;
symbol: string;
ticker: string;
};
inboundConfirmationBlocks?: number;
inboundConfirmationSeconds?: number;
maxStreamingSwaps: number;
notes: string;
outboundDelayBlocks: number;
outboundDelaySeconds: number;
streamingSwapBlocks: number;
totalSwapSeconds: number;
warning: string;
};
quoteMode: QuoteMode;
sellChain: Chain;
sellChainGasRate: number;
warnings: {
warningCode: LedgerErrorCode;
warningMessage: string;
}[];
thornodeMeta?: {
dustThreshold?: number;
expectedAmountOut: number;
expectedAmountOutStreaming: number;
fees: {
affiliate: number;
asset: string;
outbound: number;
};
inboundConfirmationBlocks?: number;
inboundConfirmationSeconds?: number;
maxStreamingSwaps: number;
notes: string;
outboundDelayBlocks: number;
outboundDelaySeconds: number;
streamingSwapBlocks: number;
totalSwapSeconds: number;
warning: string;
};
};
declare type Part = {
provider: string;
percentage: number;
provider: string;
percentage: number;
};
export declare type QuoteParams = {
affiliateAddress?: string;
affiliateBasisPoints?: string;
buyAsset: string;
recipientAddress?: string;
sellAmount: string;
sellAsset: string;
senderAddress?: string;
slippage: string;
affiliateAddress?: string;
affiliateBasisPoints?: string;
buyAsset: string;
recipientAddress?: string;
sellAmount: string;
sellAsset: string;
senderAddress?: string;
slippage: string;
};
export declare type QuoteResponse = {
quoteId: string;
routes: QuoteRoute[];
quoteId: string;
routes: QuoteRoute[];
};
export declare type QuoteRoute = {
approvalTarget?: string;
approvalToken?: string;
calldata: Calldata;
complete?: boolean;
contract?: string;
contractInfo: string;
contractMethod?: string;
estimatedTime: number;
evmTransactionDetails?: EVMTransactionDetails;
expectedOutput: string;
expectedOutputMaxSlippage: string;
expectedOutputMaxSlippageUSD: string;
expectedOutputUSD: string;
fees: Fees;
inboundAddress: string;
index: number;
isPreferred?: boolean;
meta: Meta;
optimal: boolean;
path: string;
providers: string[];
subProviders: string[];
swaps: Swaps;
targetAddress: string;
timeEstimates?: TimeEstimates;
transaction?: any;
streamingSwap?: {
approvalTarget?: string;
approvalToken?: string;
calldata: Calldata;
complete?: boolean;
contract?: string;
contractInfo: string;
contractMethod?: string;
estimatedTime: number;
fees: {
[k: string]: Fees[];
};
evmTransactionDetails?: EVMTransactionDetails;
expectedOutput: string;
expectedOutputMaxSlippage: string;
expectedOutputMaxSlippageUSD: string;
expectedOutputUSD: string;
expectedOutputMaxSlippageUSD: string;
savingsInAsset: string;
savingsInUSD: string;
maxQuantity: number;
maxIntervalForMaxQuantity: number;
fees: Fees;
inboundAddress: string;
index: number;
isPreferred?: boolean;
meta: Meta;
optimal: boolean;
path: string;
providers: string[];
subProviders: string[];
swaps: Swaps;
targetAddress: string;
timeEstimates?: TimeEstimates;
transaction?: any;
};
streamingSwap?: {
estimatedTime: number;
fees: {
[k: string]: Fees[];
};
expectedOutput: string;
expectedOutputMaxSlippage: string;
expectedOutputUSD: string;
expectedOutputMaxSlippageUSD: string;
savingsInAsset: string;
savingsInUSD: string;
maxQuantity: number;
maxIntervalForMaxQuantity: number;
transaction?: any;
};
};
export declare const RequestClient: {
get: <T>(url: string | URL | Request, options?: Options) => Promise<T>;
post: <T_1>(url: string | URL | Request, options?: Options) => Promise<T_1>;
get: <T>(url: string | URL | Request, options?: Options) => Promise<T>;
post: <T_1>(url: string | URL | Request, options?: Options) => Promise<T_1>;
};
export declare const setRequestClientConfig: ({
apiKey,
...config
}: Options & {
apiKey?: string | undefined;
export declare const setRequestClientConfig: ({ apiKey, ...config }: Options & {
apiKey?: string | undefined;
}) => void;
export declare type StreamingSwapDetails = {
completed: number | null;
total: number | null;
refunded: number | null;
progress: StreamingSwapProgressStatus[] | null;
completed: number | null;
total: number | null;
refunded: number | null;
progress: StreamingSwapProgressStatus[] | null;
};
export declare enum StreamingSwapProgressStatus {
NOT_STARTED = 0,
SUCCESS = 1,
REFUNDED = 2,
NOT_STARTED = 0,
SUCCESS = 1,
REFUNDED = 2
}
declare type SwapItem = {
from: string;
to: string;
toTokenAddress: string;
parts: Part[];
from: string;
to: string;
toTokenAddress: string;
parts: Part[];
};
export declare const SwapKitApi: {
getCachedPrices: ({ tokens, ...options }: CachedPricesParams) => Promise<CachedPricesResponse[]>;
getQuote: (params: QuoteParams) => Promise<QuoteResponse>;
getGasRates: () => Promise<GasRatesResponse>;
getTxnDetails: (txHash: string) => Promise<TxnResponse>;
getTokenlistProviders: () => Promise<TokenlistProvidersResponse>;
getTokenList: (tokenlist: string) => Promise<unknown>;
getThornameAddresses: (address: string) => Promise<ThornameResponse>;
getThornameRegisteredChains: (address: string) => Promise<string[]>;
getThornameRlookup: (address: string, chain: string) => Promise<unknown>;
getCachedPrices: ({ tokens, ...options }: CachedPricesParams) => Promise<CachedPricesResponse[]>;
getQuote: (params: QuoteParams) => Promise<QuoteResponse>;
getGasRates: () => Promise<GasRatesResponse>;
getTxnDetails: (txHash: string) => Promise<TxnResponse>;
getTokenlistProviders: () => Promise<TokenlistProvidersResponse>;
getTokenList: (tokenlist: string) => Promise<unknown>;
getThornameAddresses: (address: string) => Promise<ThornameResponse>;
getThornameRegisteredChains: (address: string) => Promise<string[]>;
getThornameRlookup: (address: string, chain: string) => Promise<unknown>;
};
declare type Swaps = {
[key: string]: SwapItem[][];
[key: string]: SwapItem[][];
};
export declare type ThornameChainItem = {
address: string;
chain: string;
address: string;
chain: string;
};
export declare type ThornameParams = {
address: string;
chain: string;
address: string;
chain: string;
};

@@ -286,157 +278,157 @@

export declare interface TimeEstimates {
swapMs: number;
inboundMs?: number;
outboundMs?: number;
streamingMs?: number;
swapMs: number;
inboundMs?: number;
outboundMs?: number;
streamingMs?: number;
}
declare type Token = {
address: string;
chain: string;
ticker: string;
identifier: string;
decimals: number;
tokenlist: string;
logoURI: string;
chainId: string;
address: string;
chain: string;
ticker: string;
identifier: string;
decimals: number;
tokenlist: string;
logoURI: string;
chainId: string;
};
export declare type TokenlistProvidersResponse = {
provider: string;
nbTokens: number;
provider: string;
nbTokens: number;
}[];
export declare type TokensParams = {
tokenlist: string;
tokenlist: string;
};
export declare type TokensResponse = {
name: string;
timestamp: string;
version: {
major: number;
minor: number;
patch: number;
};
keywords: string[];
tokens: Token[];
name: string;
timestamp: string;
version: {
major: number;
minor: number;
patch: number;
};
keywords: string[];
tokens: Token[];
};
export declare enum TransactionType {
SWAP_TC_TO_TC = 'SWAP:TC-TC',
SWAP_ETH_TO_TC = 'SWAP:ERC20-TC',
SWAP_TC_TO_ETH = 'SWAP:TC-ERC20',
SWAP_ETH_TO_ETH = 'SWAP:ERC20-ERC20',
SWAP_AVAX_TO_TC = 'SWAP:AVAX-TC',
SWAP_TC_TO_AVAX = 'SWAP:TC-AVAX',
SWAP_AVAX_TO_AVAX = 'SWAP:AVAX-AVAX',
SWAP_ETH_TO_AVAX = 'SWAP:ETH-AVAX',
SWAP_AVAX_TO_ETH = 'SWAP:AVAX-ETH',
SWAP_TC_TO_GAIA = 'SWAP:TC-GAIA',
SWAP_GAIA_TO_TC = 'SWAP:GAIA-TC',
SWAP_TC_TO_BNB = 'SWAP:TC-BNB',
SWAP_BNB_TO_TC = 'SWAP:BNB-TC',
SWAP_TC_TO_BTC = 'SWAP:TC-BTC',
SWAP_BTC_TO_TC = 'SWAP:BTC-TC',
SWAP_TC_TO_BCH = 'SWAP:TC-BCH',
SWAP_BCH_TO_TC = 'SWAP:BCH-TC',
SWAP_TC_TO_LTC = 'SWAP:TC-LTC',
SWAP_LTC_TO_TC = 'SWAP:LTC-TC',
SWAP_TC_TO_DOGE = 'SWAP:TC-DOGE',
SWAP_DOGE_TO_TC = 'SWAP:DOGE-TC',
TC_STATUS = 'TC:STATUS', // only track status
TC_TRANSFER = 'TC:TRANSFER', // only track status
TC_DEPOSIT = 'TC:DEPOSIT',
TC_SEND = 'TC:SEND',
TC_SWITCH = 'TC:SWITCH',
TC_LP_ADD = 'TC:ADDLIQUIDITY',
TC_LP_WITHDRAW = 'TC:WITHDRAW', // Supports 'WITHDRAWLIQUIDITY' as well
TC_TNS_CREATE = 'TC:TNS-CREATE',
TC_TNS_EXTEND = 'TC:TNS-EXTEND',
TC_TNS_UPDATE = 'TC:TNS-UPDATE',
TC_SAVINGS_ADD = 'TC:ADDSAVINGS',
TC_SAVINGS_WITHDRAW = 'TC:WITHDRAWSAVINGS',
TC_LENDING_OPEN = 'TC:LENDINGOPEN',
TC_LENDING_CLOSE = 'TC:LENDINGCLOSE',
ETH_APPROVAL = 'ETH:APPROVAL',
ETH_STATUS = 'ETH:STATUS', // only track status
ETH_TRANSFER_TO_TC = 'ETH:TRANSFER:IN',
ETH_TRANSFER_FROM_TC = 'ETH:TRANSFER:OUT',
AVAX_APPROVAL = 'AVAX:APPROVAL',
AVAX_STATUS = 'AVAX:STATUS', // only track status
AVAX_TRANSFER_TO_TC = 'AVAX:TRANSFER:IN',
AVAX_TRANSFER_FROM_TC = 'AVAX:TRANSFER:OUT',
BSC_APPROVAL = 'BSC:APPROVAL',
BSC_STATUS = 'BSC:STATUS', // only track status
BSC_TRANSFER_TO_TC = 'BSC:TRANSFER:IN',
BSC_TRANSFER_FROM_TC = 'BSC:TRANSFER:OUT',
APPROVAL = 'APPROVAL',
STATUS = 'STATUS',
TRANSFER_TO_TC = 'TRANSFER:IN',
TRANSFER_FROM_TC = 'TRANSFER:OUT',
UNSUPPORTED = 'UNSUPPORTED',
TC_LENDING = 'TC:LENDING',
SWAP_TC_TO_TC = "SWAP:TC-TC",
SWAP_ETH_TO_TC = "SWAP:ERC20-TC",
SWAP_TC_TO_ETH = "SWAP:TC-ERC20",
SWAP_ETH_TO_ETH = "SWAP:ERC20-ERC20",
SWAP_AVAX_TO_TC = "SWAP:AVAX-TC",
SWAP_TC_TO_AVAX = "SWAP:TC-AVAX",
SWAP_AVAX_TO_AVAX = "SWAP:AVAX-AVAX",
SWAP_ETH_TO_AVAX = "SWAP:ETH-AVAX",
SWAP_AVAX_TO_ETH = "SWAP:AVAX-ETH",
SWAP_TC_TO_GAIA = "SWAP:TC-GAIA",
SWAP_GAIA_TO_TC = "SWAP:GAIA-TC",
SWAP_TC_TO_BNB = "SWAP:TC-BNB",
SWAP_BNB_TO_TC = "SWAP:BNB-TC",
SWAP_TC_TO_BTC = "SWAP:TC-BTC",
SWAP_BTC_TO_TC = "SWAP:BTC-TC",
SWAP_TC_TO_BCH = "SWAP:TC-BCH",
SWAP_BCH_TO_TC = "SWAP:BCH-TC",
SWAP_TC_TO_LTC = "SWAP:TC-LTC",
SWAP_LTC_TO_TC = "SWAP:LTC-TC",
SWAP_TC_TO_DOGE = "SWAP:TC-DOGE",
SWAP_DOGE_TO_TC = "SWAP:DOGE-TC",
TC_STATUS = "TC:STATUS",// only track status
TC_TRANSFER = "TC:TRANSFER",// only track status
TC_DEPOSIT = "TC:DEPOSIT",
TC_SEND = "TC:SEND",
TC_SWITCH = "TC:SWITCH",
TC_LP_ADD = "TC:ADDLIQUIDITY",
TC_LP_WITHDRAW = "TC:WITHDRAW",// Supports 'WITHDRAWLIQUIDITY' as well
TC_TNS_CREATE = "TC:TNS-CREATE",
TC_TNS_EXTEND = "TC:TNS-EXTEND",
TC_TNS_UPDATE = "TC:TNS-UPDATE",
TC_SAVINGS_ADD = "TC:ADDSAVINGS",
TC_SAVINGS_WITHDRAW = "TC:WITHDRAWSAVINGS",
TC_LENDING_OPEN = "TC:LENDINGOPEN",
TC_LENDING_CLOSE = "TC:LENDINGCLOSE",
ETH_APPROVAL = "ETH:APPROVAL",
ETH_STATUS = "ETH:STATUS",// only track status
ETH_TRANSFER_TO_TC = "ETH:TRANSFER:IN",
ETH_TRANSFER_FROM_TC = "ETH:TRANSFER:OUT",
AVAX_APPROVAL = "AVAX:APPROVAL",
AVAX_STATUS = "AVAX:STATUS",// only track status
AVAX_TRANSFER_TO_TC = "AVAX:TRANSFER:IN",
AVAX_TRANSFER_FROM_TC = "AVAX:TRANSFER:OUT",
BSC_APPROVAL = "BSC:APPROVAL",
BSC_STATUS = "BSC:STATUS",// only track status
BSC_TRANSFER_TO_TC = "BSC:TRANSFER:IN",
BSC_TRANSFER_FROM_TC = "BSC:TRANSFER:OUT",
APPROVAL = "APPROVAL",
STATUS = "STATUS",
TRANSFER_TO_TC = "TRANSFER:IN",
TRANSFER_FROM_TC = "TRANSFER:OUT",
UNSUPPORTED = "UNSUPPORTED",
TC_LENDING = "TC:LENDING"
}
export declare type TxnParams = {
txHash: string;
txHash: string;
};
export declare type TxnResponse = {
result: TxTrackerDetails;
done: boolean;
status: TxStatus;
error?: {
message: string;
};
result: TxTrackerDetails;
done: boolean;
status: TxStatus;
error?: {
message: string;
};
};
export declare enum TxStatus {
PENDING = 'pending',
SUCCESS = 'success',
CANCELLED = 'cancelled',
REFUNDED = 'refunded',
REPLACED = 'replaced',
ERROR = 'error',
UNKNOWN = 'unknown',
NOT_STARTED = 'not_started',
NOT_FOUND = 'not_found',
RETRIES_EXCEEDED = 'retries_exceeded',
STREAMING = 'streaming',
PENDING = "pending",
SUCCESS = "success",
CANCELLED = "cancelled",
REFUNDED = "refunded",
REPLACED = "replaced",
ERROR = "error",
UNKNOWN = "unknown",
NOT_STARTED = "not_started",
NOT_FOUND = "not_found",
RETRIES_EXCEEDED = "retries_exceeded",
STREAMING = "streaming"
}
export declare type TxTrackerDetails = {
quoteId: string;
firstTransactionHash: string;
currentLegIndex: number;
legs: TxTrackerLeg[];
status?: TxStatus;
startTimestamp?: number | null;
estimatedDuration?: number | null;
isStreamingSwap?: boolean;
quoteId: string;
firstTransactionHash: string;
currentLegIndex: number;
legs: TxTrackerLeg[];
status?: TxStatus;
startTimestamp?: number | null;
estimatedDuration?: number | null;
isStreamingSwap?: boolean;
};
export declare type TxTrackerLeg = {
hash?: string;
chain: Chain;
provider?: string;
txnType?: TransactionType;
fromAsset?: string;
fromAssetImage?: string;
toAsset?: string;
toAssetImage?: string;
fromAmount?: string;
toAmount?: string;
toAmountLimit?: string;
startTimestamp?: number | null;
updateTimestamp?: number | null;
endTimestamp?: number | null;
estimatedEndTimestamp?: number | null;
estimatedDuration?: number | null;
status?: TxStatus;
waitingFor?: string;
opaque?: any;
streamingSwapDetails?: StreamingSwapDetails;
hash?: string;
chain: Chain;
provider?: string;
txnType?: TransactionType;
fromAsset?: string;
fromAssetImage?: string;
toAsset?: string;
toAssetImage?: string;
fromAmount?: string;
toAmount?: string;
toAmountLimit?: string;
startTimestamp?: number | null;
updateTimestamp?: number | null;
endTimestamp?: number | null;
estimatedEndTimestamp?: number | null;
estimatedDuration?: number | null;
status?: TxStatus;
waitingFor?: string;
opaque?: any;
streamingSwapDetails?: StreamingSwapDetails;
};
export {};
export { }

@@ -1,7 +0,5 @@

var o = /* @__PURE__ */ ((t) => (t.INVALID_INPUT_PARAMETERS = "1000", t.UNKNOWN_PROVIDERS = "1001", t.CANNOT_FIND_INBOUND_ADDRESS = "1002", t.NO_INBOUND_ADDRESSES = "1003", t.CHAIN_HALTED_OR_UNSUPPORTED = "1004", t.MISSING_INPUT_PARAMETER = "1005", t.INVALID_TYPE_GENERIC = "1100", t.INVALID_NUMBER_STRING = "1101", t.INVALID_NUMBER = "1102", t.INVALID_BOOLEAN = "1103", t.INVALID_OBJECT = "1104", t.INVALID_ARRAY = "1105", t.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000", t.SELL_BUY_ASSETS_ARE_THE_SAME = "2001", t.MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002", t.AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003", t.AFF_ADDRESS_TOO_LONG = "2004", t.AFF_BPS_INTEGER_MAX_500 = "2005", t.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", t.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", t.PREFERRED_PROVIDER_NOT_SUPPORTED = "2008", t.DESTINATION_ADDRESS_SMART_CONTRACT = "2009", t.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010", t.SOURCE_ADDRESS_SMART_CONTRACT = "2011", t.INVALID_PROVIDER = "2100", t.MISSING_CROSS_CHAIN_PROVIDER = "2101", t.MISSING_AVAX_PROVIDER = "2102", t.MISSING_BSC_PROVIDER = "2103", t.MISSING_ETH_PROVIDER = "2104", t.INVALID_PROVIDER_FOR_SWAP_OUT = "2105", t.MISSING_ARB_PROVIDER = "2106", t.INVALID_CHAIN = "2200", t.INVALID_ASSET = "2201", t.INVALID_ASSET_IDENTIFIER = "2202", t.UNSUPPORTED_CHAIN = "2204", t.UNSUPPORTED_ASSET = "2203", t.UNSUPPORTED_ASSET_FOR_SWAPOUT = "2205", t.INVALID_SOURCE_ADDRESS = "2300", t.INVALID_DESTINATION_ADDRESS = "2301", t.THORNODE_QUOTE_GENERIC_ERROR = "3000", t.NOT_ENOUGH_SYNTH_BALANCE = "3001", t.SYNTH_MINTING_CAP_REACHED = "3002", t.INVALID_QUOTE_MODE = "4000", t.NO_QUOTES = "4001", t.SERVICE_UNAVAILABLE_GENERIC = "5000", t.MISSING_GAS_DATA_GENERIC = "5100", t.MISSING_TOKEN_INFO_GENERIC = "5200", t.CANT_FIND_TOKEN_LIST = "5201", t.NO_PRICE = "5202", t.PRICE_IS_STALE = "5203", t.ADDRESS_NOT_WHITELISTED = "6000", t.ADDRESS_ALREADY_CLAIMED = "6001", t.TEMPORARY_ERROR = "9999", t))(o || {});
o.INVALID_INPUT_PARAMETERS + "", o.UNKNOWN_PROVIDERS + "", o.CANNOT_FIND_INBOUND_ADDRESS + "", o.NO_INBOUND_ADDRESSES + "", o.CHAIN_HALTED_OR_UNSUPPORTED + "", o.MISSING_INPUT_PARAMETER + "", o.INVALID_TYPE_GENERIC + "", o.INVALID_NUMBER_STRING + "", o.INVALID_NUMBER + "", o.INVALID_BOOLEAN + "", o.INVALID_OBJECT + "", o.INVALID_ARRAY + "", o.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", o.SELL_BUY_ASSETS_ARE_THE_SAME + "", o.MISSING_SOURCE_ADDRESS_FOR_SYNTH + "", o.AFF_ADDRESS_AND_BPS_OR_NEITHER + "", o.AFF_ADDRESS_TOO_LONG + "", o.AFF_BPS_INTEGER_MAX_500 + "", o.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN + "", o.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN + "", o.PREFERRED_PROVIDER_NOT_SUPPORTED + "", o.SOURCE_ADDRESS_SMART_CONTRACT + "", o.DESTINATION_ADDRESS_SMART_CONTRACT + "", o.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", o.INVALID_PROVIDER + "", o.MISSING_CROSS_CHAIN_PROVIDER + "", o.MISSING_AVAX_PROVIDER + "", o.MISSING_BSC_PROVIDER + "", o.MISSING_ETH_PROVIDER + "", o.MISSING_ARB_PROVIDER + "", o.INVALID_PROVIDER_FOR_SWAP_OUT + "", o.INVALID_CHAIN + "", o.INVALID_ASSET + "", o.UNSUPPORTED_CHAIN + "", o.UNSUPPORTED_ASSET + "", o.UNSUPPORTED_ASSET_FOR_SWAPOUT + "", o.THORNODE_QUOTE_GENERIC_ERROR + "", o.INVALID_SOURCE_ADDRESS + "", o.INVALID_DESTINATION_ADDRESS + "", o.NOT_ENOUGH_SYNTH_BALANCE + "", o.SYNTH_MINTING_CAP_REACHED + "", o.INVALID_QUOTE_MODE + "", o.NO_QUOTES + "", o.SERVICE_UNAVAILABLE_GENERIC + "", o.MISSING_GAS_DATA_GENERIC + "", o.MISSING_TOKEN_INFO_GENERIC + "", o.CANT_FIND_TOKEN_LIST + "", o.NO_PRICE + "", o.PRICE_IS_STALE + "", o.ADDRESS_NOT_WHITELISTED + "", o.ADDRESS_ALREADY_CLAIMED + "";
var I = /* @__PURE__ */ ((t) => (t.Arbitrum = "ARB", t.Avalanche = "AVAX", t.Binance = "BNB", t.BinanceSmartChain = "BSC", t.Bitcoin = "BTC", t.BitcoinCash = "BCH", t.Cosmos = "GAIA", t.Dogecoin = "DOGE", t.Ethereum = "ETH", t.Kujira = "KUJI", t.Litecoin = "LTC", t.Maya = "MAYA", t.Optimism = "OP", t.Polkadot = "DOT", t.Chainflip = "FLIP", t.Polygon = "MATIC", t.THORChain = "THOR", t))(I || {}), f = /* @__PURE__ */ ((t) => (t.Arbitrum = "42161", t.ArbitrumHex = "0xa4b1", t.Avalanche = "43114", t.AvalancheHex = "0xa86a", t.Binance = "Binance-Chain-Tigris", t.BinanceSmartChain = "56", t.BinanceSmartChainHex = "0x38", t.Bitcoin = "bitcoin", t.BitcoinCash = "bitcoincash", t.Chainflip = "chainflip", t.Cosmos = "cosmoshub-4", t.Dogecoin = "dogecoin", t.Kujira = "kaiyo-1", t.Ethereum = "1", t.EthereumHex = "0x1", t.Litecoin = "litecoin", t.Maya = "mayachain-mainnet-v1", t.MayaStagenet = "mayachain-stagenet-v1", t.Optimism = "10", t.OptimismHex = "0xa", t.Polkadot = "polkadot", t.Polygon = "137", t.PolygonHex = "0x89", t.THORChain = "thorchain-mainnet-v1", t.THORChainStagenet = "thorchain-stagenet-v2", t))(f || {}), g = /* @__PURE__ */ ((t) => (t.Arbitrum = "https://arb1.arbitrum.io/rpc", t.Avalanche = "https://node-router.thorswap.net/avalanche-c", t.Binance = "", t.BinanceSmartChain = "https://bsc-dataseed.binance.org", t.Bitcoin = "https://node-router.thorswap.net/bitcoin", t.BitcoinCash = "https://node-router.thorswap.net/bitcoin-cash", t.Chainflip = "wss://mainnet-archive.chainflip.io", t.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", t.Kujira = "https://rpc-kujira.synergynodes.com/", t.Dogecoin = "https://node-router.thorswap.net/dogecoin", t.Ethereum = "https://node-router.thorswap.net/ethereum", t.Litecoin = "https://node-router.thorswap.net/litecoin", t.Maya = "https://tendermint.mayachain.info", t.MayaStagenet = "https://stagenet.tendermint.mayachain.info", t.Optimism = "https://mainnet.optimism.io", t.Polkadot = "wss://rpc.polkadot.io", t.Polygon = "https://polygon-rpc.com", t.THORChain = "https://rpc.thorswap.net", t.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", t))(g || {}), E = /* @__PURE__ */ ((t) => (t.Cosmos = "https://node-router.thorswap.net/cosmos/rest", t.Kujira = "https://lcd-kujira.synergynodes.com/", t.MayanodeMainnet = "https://mayanode.mayachain.info", t.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", t.ThornodeMainnet = "https://thornode.thorswap.net", t.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", t.ThorswapApi = "https://api.thorswap.net", t.ThorswapStatic = "https://static.thorswap.net", t))(E || {});
const N = Object.values(I), v = Object.keys(I), O = N.reduce(
var C = /* @__PURE__ */ ((t) => (t.Arbitrum = "ARB", t.Avalanche = "AVAX", t.Binance = "BNB", t.BinanceSmartChain = "BSC", t.Bitcoin = "BTC", t.BitcoinCash = "BCH", t.Cosmos = "GAIA", t.Dash = "DASH", t.Dogecoin = "DOGE", t.Ethereum = "ETH", t.Kujira = "KUJI", t.Litecoin = "LTC", t.Maya = "MAYA", t.Optimism = "OP", t.Polkadot = "DOT", t.Chainflip = "FLIP", t.Polygon = "MATIC", t.THORChain = "THOR", t))(C || {}), b = /* @__PURE__ */ ((t) => (t.Arbitrum = "42161", t.ArbitrumHex = "0xa4b1", t.Avalanche = "43114", t.AvalancheHex = "0xa86a", t.Binance = "Binance-Chain-Tigris", t.BinanceSmartChain = "56", t.BinanceSmartChainHex = "0x38", t.Bitcoin = "bitcoin", t.BitcoinCash = "bitcoincash", t.Chainflip = "chainflip", t.Cosmos = "cosmoshub-4", t.Dash = "dash", t.Dogecoin = "dogecoin", t.Kujira = "kaiyo-1", t.Ethereum = "1", t.EthereumHex = "0x1", t.Litecoin = "litecoin", t.Maya = "mayachain-mainnet-v1", t.MayaStagenet = "mayachain-stagenet-v1", t.Optimism = "10", t.OptimismHex = "0xa", t.Polkadot = "polkadot", t.Polygon = "137", t.PolygonHex = "0x89", t.THORChain = "thorchain-mainnet-v1", t.THORChainStagenet = "thorchain-stagenet-v2", t))(b || {}), O = /* @__PURE__ */ ((t) => (t.Arbitrum = "https://arb1.arbitrum.io/rpc", t.Avalanche = "https://node-router.thorswap.net/avalanche-c", t.Binance = "", t.BinanceSmartChain = "https://bsc-dataseed.binance.org", t.Bitcoin = "https://node-router.thorswap.net/bitcoin", t.BitcoinCash = "https://node-router.thorswap.net/bitcoin-cash", t.Chainflip = "wss://mainnet-archive.chainflip.io", t.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", t.Dash = "https://node-router.thorswap.net/dash", t.Dogecoin = "https://node-router.thorswap.net/dogecoin", t.Ethereum = "https://node-router.thorswap.net/ethereum", t.Kujira = "https://rpc-kujira.synergynodes.com/", t.Litecoin = "https://node-router.thorswap.net/litecoin", t.Maya = "https://tendermint.mayachain.info", t.MayaStagenet = "https://stagenet.tendermint.mayachain.info", t.Optimism = "https://mainnet.optimism.io", t.Polkadot = "wss://rpc.polkadot.io", t.Polygon = "https://polygon-rpc.com", t.THORChain = "https://rpc.thorswap.net", t.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", t))(O || {}), d = /* @__PURE__ */ ((t) => (t.Cosmos = "https://node-router.thorswap.net/cosmos/rest", t.Kujira = "https://lcd-kujira.synergynodes.com/", t.MayanodeMainnet = "https://mayanode.mayachain.info", t.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", t.ThornodeMainnet = "https://thornode.thorswap.net", t.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", t.ThorswapApi = "https://api.thorswap.net", t.ThorswapStatic = "https://static.thorswap.net", t))(d || {});
const m = Object.values(C), v = Object.keys(C), E = m.reduce(
(t, e) => {
const s = v.find((r) => I[r] === e);
const s = v.find((r) => C[r] === e);
return s && (t[e] = s), t;

@@ -11,21 +9,21 @@ },

);
N.reduce(
(t, e) => (t[e] = f[O[e]], t),
m.reduce(
(t, e) => (t[e] = b[E[e]], t),
{}
);
N.reduce(
(t, e) => (t[e] = g[O[e]], t),
m.reduce(
(t, e) => (t[e] = O[E[e]], t),
{}
);
N.reduce(
m.reduce(
(t, e) => {
const s = `${O[e]}Hex`;
return t[e] = f[s], t;
const s = `${E[e]}Hex`;
return t[e] = b[s], t;
},
{}
);
class m extends Error {
class g extends Error {
constructor(e, s, r) {
const i = e.status || e.status === 0 ? e.status : "", n = e.statusText || "", a = `${i} ${n}`.trim(), _ = a ? `status code ${a}` : "an unknown error";
super(`Request failed with ${_}`), Object.defineProperty(this, "response", {
const o = e.status || e.status === 0 ? e.status : "", n = e.statusText || "", a = `${o} ${n}`.trim(), i = a ? `status code ${a}` : "an unknown error";
super(`Request failed with ${i}`), Object.defineProperty(this, "response", {
enumerable: !0,

@@ -48,3 +46,3 @@ configurable: !0,

}
class U extends Error {
class N extends Error {
constructor(e) {

@@ -59,13 +57,13 @@ super("Request timed out"), Object.defineProperty(this, "request", {

}
const c = (t) => t !== null && typeof t == "object", T = (...t) => {
const A = (t) => t !== null && typeof t == "object", _ = (...t) => {
for (const e of t)
if ((!c(e) || Array.isArray(e)) && e !== void 0)
if ((!A(e) || Array.isArray(e)) && e !== void 0)
throw new TypeError("The `options` argument must be an object");
return D({}, ...t);
}, y = (t = {}, e = {}) => {
const s = new globalThis.Headers(t), r = e instanceof globalThis.Headers, i = new globalThis.Headers(e);
for (const [n, a] of i.entries())
return P({}, ...t);
}, D = (t = {}, e = {}) => {
const s = new globalThis.Headers(t), r = e instanceof globalThis.Headers, o = new globalThis.Headers(e);
for (const [n, a] of o.entries())
r && a === "undefined" || a === void 0 ? s.delete(n) : s.set(n, a);
return s;
}, D = (...t) => {
}, P = (...t) => {
let e = {}, s = {};

@@ -75,9 +73,9 @@ for (const r of t)

Array.isArray(e) || (e = []), e = [...e, ...r];
else if (c(r)) {
for (let [i, n] of Object.entries(r))
c(n) && i in e && (n = D(e[i], n)), e = { ...e, [i]: n };
c(r.headers) && (s = y(s, r.headers), e.headers = s);
else if (A(r)) {
for (let [o, n] of Object.entries(r))
A(n) && o in e && (n = P(e[o], n)), e = { ...e, [o]: n };
A(r.headers) && (s = D(s, r.headers), e.headers = s);
}
return e;
}, M = (() => {
}, q = (() => {
let t = !1, e = !1;

@@ -93,3 +91,3 @@ const s = typeof globalThis.ReadableStream == "function", r = typeof globalThis.Request == "function";

}).headers.has("Content-Type")), t && !e;
})(), G = typeof globalThis.AbortController == "function", k = typeof globalThis.ReadableStream == "function", F = typeof globalThis.FormData == "function", L = ["get", "post", "put", "patch", "head", "delete"], W = {
})(), L = typeof globalThis.AbortController == "function", U = typeof globalThis.ReadableStream == "function", x = typeof globalThis.FormData == "function", k = ["get", "post", "put", "patch", "head", "delete"], V = {
json: "application/json",

@@ -100,3 +98,3 @@ text: "text/*",

blob: "*/*"
}, p = 2147483647, w = Symbol("stop"), q = {
}, S = 2147483647, H = Symbol("stop"), j = {
json: !0,

@@ -112,3 +110,3 @@ parseJson: !0,

fetch: !0
}, x = {
}, F = {
method: !0,

@@ -129,7 +127,7 @@ headers: !0,

duplex: !0
}, j = (t) => L.includes(t) ? t.toUpperCase() : t, X = ["get", "put", "head", "delete", "options", "trace"], Y = [408, 413, 429, 500, 502, 503, 504], V = [413, 429, 503], P = {
}, G = (t) => k.includes(t) ? t.toUpperCase() : t, M = ["get", "put", "head", "delete", "options", "trace"], X = [408, 413, 429, 500, 502, 503, 504], W = [413, 429, 503], w = {
limit: 2,
methods: X,
statusCodes: Y,
afterStatusCodes: V,
methods: M,
statusCodes: X,
afterStatusCodes: W,
maxRetryAfter: Number.POSITIVE_INFINITY,

@@ -141,3 +139,3 @@ backoffLimit: Number.POSITIVE_INFINITY,

return {
...P,
...w,
limit: t

@@ -150,13 +148,13 @@ };

return {
...P,
...w,
...t,
afterStatusCodes: V
afterStatusCodes: W
};
};
async function K(t, e, s, r) {
return new Promise((i, n) => {
return new Promise((o, n) => {
const a = setTimeout(() => {
s && s.abort(), n(new U(t));
s && s.abort(), n(new N(t));
}, r.timeout);
r.fetch(t, e).then(i).catch(n).then(() => {
r.fetch(t, e).then(o).catch(n).then(() => {
clearTimeout(a);

@@ -168,33 +166,33 @@ });

return new Promise((s, r) => {
e && (e.throwIfAborted(), e.addEventListener("abort", i, { once: !0 }));
function i() {
e && (e.throwIfAborted(), e.addEventListener("abort", o, { once: !0 }));
function o() {
clearTimeout(n), r(e.reason);
}
const n = setTimeout(() => {
e == null || e.removeEventListener("abort", i), s();
e == null || e.removeEventListener("abort", o), s();
}, t);
});
}
const Q = (t, e) => {
const z = (t, e) => {
const s = {};
for (const r in e)
!(r in x) && !(r in q) && !(r in t) && (s[r] = e[r]);
!(r in F) && !(r in j) && !(r in t) && (s[r] = e[r]);
return s;
};
class l {
class T {
static create(e, s) {
const r = new l(e, s), i = async () => {
if (typeof r._options.timeout == "number" && r._options.timeout > p)
throw new RangeError(`The \`timeout\` option cannot be greater than ${p}`);
const r = new T(e, s), o = async () => {
if (typeof r._options.timeout == "number" && r._options.timeout > S)
throw new RangeError(`The \`timeout\` option cannot be greater than ${S}`);
await Promise.resolve();
let _ = await r._fetch();
for (const u of r._options.hooks.afterResponse) {
const A = await u(r.request, r._options, r._decorateResponse(_.clone()));
A instanceof globalThis.Response && (_ = A);
let i = await r._fetch();
for (const h of r._options.hooks.afterResponse) {
const u = await h(r.request, r._options, r._decorateResponse(i.clone()));
u instanceof globalThis.Response && (i = u);
}
if (r._decorateResponse(_), !_.ok && r._options.throwHttpErrors) {
let u = new m(_, r.request, r._options);
for (const A of r._options.hooks.beforeError)
u = await A(u);
throw u;
if (r._decorateResponse(i), !i.ok && r._options.throwHttpErrors) {
let h = new g(i, r.request, r._options);
for (const u of r._options.hooks.beforeError)
h = await u(h);
throw h;
}

@@ -204,19 +202,19 @@ if (r._options.onDownloadProgress) {

throw new TypeError("The `onDownloadProgress` option must be a function");
if (!k)
if (!U)
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
return r._stream(_.clone(), r._options.onDownloadProgress);
return r._stream(i.clone(), r._options.onDownloadProgress);
}
return _;
}, a = r._options.retry.methods.includes(r.request.method.toLowerCase()) ? r._retry(i) : i();
for (const [_, u] of Object.entries(W))
a[_] = async () => {
r.request.headers.set("accept", r.request.headers.get("accept") || u);
const R = (await a).clone();
if (_ === "json") {
if (R.status === 204 || (await R.clone().arrayBuffer()).byteLength === 0)
return i;
}, a = r._options.retry.methods.includes(r.request.method.toLowerCase()) ? r._retry(o) : o();
for (const [i, h] of Object.entries(V))
a[i] = async () => {
r.request.headers.set("accept", r.request.headers.get("accept") || h);
const p = (await a).clone();
if (i === "json") {
if (p.status === 204 || (await p.clone().arrayBuffer()).byteLength === 0)
return "";
if (s.parseJson)
return s.parseJson(await R.text());
return s.parseJson(await p.text());
}
return R[_]();
return p[i]();
};

@@ -256,4 +254,4 @@ return a;

...s,
headers: y(this._input.headers, s.headers),
hooks: D({
headers: D(this._input.headers, s.headers),
hooks: P({
beforeRequest: [],

@@ -264,3 +262,3 @@ beforeRetry: [],

}, s.hooks),
method: j(s.method ?? this._input.method),
method: G(s.method ?? this._input.method),
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing

@@ -279,3 +277,3 @@ prefixUrl: String(s.prefixUrl || ""),

}
if (G) {
if (L) {
if (this.abortController = new globalThis.AbortController(), this._options.signal) {

@@ -289,5 +287,5 @@ const r = this._options.signal;

}
if (M && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
const i = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), n = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, i);
(F && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers["content-type"]) && this.request.headers.delete("content-type"), this.request = new globalThis.Request(new globalThis.Request(n, { ...this.request }), this._options);
if (q && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
const o = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), n = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, o);
(x && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers["content-type"]) && this.request.headers.delete("content-type"), this.request = new globalThis.Request(new globalThis.Request(n, { ...this.request }), this._options);
}

@@ -297,4 +295,4 @@ this._options.json !== void 0 && (this._options.body = JSON.stringify(this._options.json), this.request.headers.set("content-type", this._options.headers.get("content-type") ?? "application/json"), this.request = new globalThis.Request(this.request, { body: this._options.body }));

_calculateRetryDelay(e) {
if (this._retryCount++, this._retryCount <= this._options.retry.limit && !(e instanceof U)) {
if (e instanceof m) {
if (this._retryCount++, this._retryCount <= this._options.retry.limit && !(e instanceof N)) {
if (e instanceof g) {
if (!this._options.retry.statusCodes.includes(e.response.status))

@@ -304,4 +302,4 @@ return 0;

if (r && this._options.retry.afterStatusCodes.includes(e.response.status)) {
let i = Number(r);
return Number.isNaN(i) ? i = Date.parse(r) - Date.now() : i *= 1e3, this._options.retry.maxRetryAfter !== void 0 && i > this._options.retry.maxRetryAfter ? 0 : i;
let o = Number(r);
return Number.isNaN(o) ? o = Date.parse(r) - Date.now() : o *= 1e3, this._options.retry.maxRetryAfter !== void 0 && o > this._options.retry.maxRetryAfter ? 0 : o;
}

@@ -323,7 +321,7 @@ if (e.response.status === 413)

} catch (s) {
const r = Math.min(this._calculateRetryDelay(s), p);
const r = Math.min(this._calculateRetryDelay(s), S);
if (r !== 0 && this._retryCount > 0) {
await J(r, { signal: this._options.signal });
for (const i of this._options.hooks.beforeRetry)
if (await i({
for (const o of this._options.hooks.beforeRetry)
if (await o({
request: this.request,

@@ -333,3 +331,3 @@ options: this._options,

retryCount: this._retryCount
}) === w)
}) === H)
return;

@@ -351,3 +349,3 @@ return this._retry(e);

}
const e = Q(this.request, this._options);
const e = z(this.request, this._options);
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), e) : K(this.request.clone(), e, this.abortController, this._options);

@@ -358,4 +356,4 @@ }

const r = Number(e.headers.get("content-length")) || 0;
let i = 0;
return e.status === 204 ? (s && s({ percent: 1, totalBytes: r, transferredBytes: i }, new Uint8Array()), new globalThis.Response(null, {
let o = 0;
return e.status === 204 ? (s && s({ percent: 1, totalBytes: r, transferredBytes: o }, new Uint8Array()), new globalThis.Response(null, {
status: e.status,

@@ -368,5 +366,5 @@ statusText: e.statusText,

s && s({ percent: 0, transferredBytes: 0, totalBytes: r }, new Uint8Array());
async function _() {
const { done: u, value: A } = await a.read();
if (u) {
async function i() {
const { done: h, value: u } = await a.read();
if (h) {
n.close();

@@ -376,9 +374,9 @@ return;

if (s) {
i += A.byteLength;
const R = r === 0 ? 0 : i / r;
s({ percent: R, transferredBytes: i, totalBytes: r }, A);
o += u.byteLength;
const p = r === 0 ? 0 : o / r;
s({ percent: p, transferredBytes: o, totalBytes: r }, u);
}
n.enqueue(A), await _();
n.enqueue(u), await i();
}
await _();
await i();
}

@@ -393,53 +391,57 @@ }), {

/*! MIT License © Sindre Sorhus */
const C = (t) => {
const e = (s, r) => l.create(s, T(t, r));
for (const s of L)
e[s] = (r, i) => l.create(r, T(t, i, { method: s }));
return e.create = (s) => C(T(s)), e.extend = (s) => C(T(t, s)), e.stop = w, e;
}, B = C();
let d;
const h = {
CachedPrices: `${E.ThorswapApi}/tokenlist/cached-price`,
GasRates: `${E.ThorswapApi}/resource-worker/gasPrice/getAll`,
Quote: `${E.ThorswapApi}/aggregator/tokens/quote`,
Txn: `${E.ThorswapApi}/apiusage/v2/txn`,
TokenlistProviders: `${E.ThorswapApi}/tokenlist/providers`,
TokenList: `${E.ThorswapStatic}/token-list`,
Thorname: `${E.ThorswapApi}/thorname`
}, H = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, b = () => d || (d = B.create({ headers: H }), d), ot = ({ apiKey: t, ...e }) => {
d = B.create({
const R = (t) => {
const e = (s, r) => T.create(s, _(t, r));
for (const s of k)
e[s] = (r, o) => T.create(r, _(t, o, { method: s }));
return e.create = (s) => R(_(s)), e.extend = (s) => R(_(t, s)), e.stop = H, e;
}, I = R();
let f;
const c = {
CachedPrices: `${d.ThorswapApi}/tokenlist/cached-price`,
GasRates: `${d.ThorswapApi}/resource-worker/gasPrice/getAll`,
Quote: `${d.ThorswapApi}/aggregator/tokens/quote`,
Txn: `${d.ThorswapApi}/apiusage/v2/txn`,
TokenlistProviders: `${d.ThorswapApi}/tokenlist/providers`,
TokenList: `${d.ThorswapStatic}/token-list`,
Thorname: `${d.ThorswapApi}/thorname`
}, B = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, y = () => f || (f = I.create({ headers: B }), f), st = ({ apiKey: t, ...e }) => {
f = I.create({
...e,
headers: { ...H, ...e.headers, "x-api-key": t }
headers: { ...B, ...e.headers, "x-api-key": t }
});
}, S = {
get: (t, e) => b().get(t, e).json(),
post: (t, e) => b().post(t, e).json()
}, z = ({ tokens: t, ...e }) => {
const s = new URLSearchParams();
return t.filter((r, i, n) => n.findIndex((a) => a === r) === i).forEach((r) => s.append("tokens", JSON.stringify(r))), e.metadata && s.append("metadata", "true"), e.lookup && s.append("lookup", "true"), e.sparkline && s.append("sparkline", "true"), S.post(h.CachedPrices, {
}, l = {
get: (t, e) => y().get(t, e).json(),
post: (t, e) => y().post(t, e).json()
}, Q = ({ tokens: t, ...e }) => {
const s = new URLSearchParams(), r = t.filter(
(o, n, a) => a.findIndex((i) => i === o) === n
);
for (const o of r)
s.append("tokens", JSON.stringify(o));
return e.metadata && s.append("metadata", "true"), e.lookup && s.append("lookup", "true"), e.sparkline && s.append("sparkline", "true"), l.post(c.CachedPrices, {
body: s.toString(),
headers: { "Content-Type": "application/x-www-form-urlencoded" }
});
}, it = {
getCachedPrices: z,
getQuote: (t) => S.get(h.Quote, { searchParams: t }),
getGasRates: () => S.get(h.GasRates),
getTxnDetails: (t) => S.get(h.Txn, { searchParams: t }),
getTokenlistProviders: () => S.get(h.TokenlistProviders),
getTokenList: (t) => S.get(`${h.TokenList}/${t}.json`),
getThornameAddresses: (t) => S.get(`${h.Thorname}/${t}`),
getThornameRegisteredChains: (t) => S.get(`${h.Thorname}/chains/${t}`),
getThornameRlookup: (t, e) => S.get(`${h.Thorname}/rlookup`, { searchParams: { address: t, chain: e } })
}, ot = {
getCachedPrices: Q,
getQuote: (t) => l.get(c.Quote, { searchParams: t }),
getGasRates: () => l.get(c.GasRates),
getTxnDetails: (t) => l.get(c.Txn, { searchParams: t }),
getTokenlistProviders: () => l.get(c.TokenlistProviders),
getTokenList: (t) => l.get(`${c.TokenList}/${t}.json`),
getThornameAddresses: (t) => l.get(`${c.Thorname}/${t}`),
getThornameRegisteredChains: (t) => l.get(`${c.Thorname}/chains/${t}`),
getThornameRlookup: (t, e) => l.get(`${c.Thorname}/rlookup`, { searchParams: { address: t, chain: e } })
};
var Z = /* @__PURE__ */ ((t) => (t.SWAP_TC_TO_TC = "SWAP:TC-TC", t.SWAP_ETH_TO_TC = "SWAP:ERC20-TC", t.SWAP_TC_TO_ETH = "SWAP:TC-ERC20", t.SWAP_ETH_TO_ETH = "SWAP:ERC20-ERC20", t.SWAP_AVAX_TO_TC = "SWAP:AVAX-TC", t.SWAP_TC_TO_AVAX = "SWAP:TC-AVAX", t.SWAP_AVAX_TO_AVAX = "SWAP:AVAX-AVAX", t.SWAP_ETH_TO_AVAX = "SWAP:ETH-AVAX", t.SWAP_AVAX_TO_ETH = "SWAP:AVAX-ETH", t.SWAP_TC_TO_GAIA = "SWAP:TC-GAIA", t.SWAP_GAIA_TO_TC = "SWAP:GAIA-TC", t.SWAP_TC_TO_BNB = "SWAP:TC-BNB", t.SWAP_BNB_TO_TC = "SWAP:BNB-TC", t.SWAP_TC_TO_BTC = "SWAP:TC-BTC", t.SWAP_BTC_TO_TC = "SWAP:BTC-TC", t.SWAP_TC_TO_BCH = "SWAP:TC-BCH", t.SWAP_BCH_TO_TC = "SWAP:BCH-TC", t.SWAP_TC_TO_LTC = "SWAP:TC-LTC", t.SWAP_LTC_TO_TC = "SWAP:LTC-TC", t.SWAP_TC_TO_DOGE = "SWAP:TC-DOGE", t.SWAP_DOGE_TO_TC = "SWAP:DOGE-TC", t.TC_STATUS = "TC:STATUS", t.TC_TRANSFER = "TC:TRANSFER", t.TC_DEPOSIT = "TC:DEPOSIT", t.TC_SEND = "TC:SEND", t.TC_SWITCH = "TC:SWITCH", t.TC_LP_ADD = "TC:ADDLIQUIDITY", t.TC_LP_WITHDRAW = "TC:WITHDRAW", t.TC_TNS_CREATE = "TC:TNS-CREATE", t.TC_TNS_EXTEND = "TC:TNS-EXTEND", t.TC_TNS_UPDATE = "TC:TNS-UPDATE", t.TC_SAVINGS_ADD = "TC:ADDSAVINGS", t.TC_SAVINGS_WITHDRAW = "TC:WITHDRAWSAVINGS", t.TC_LENDING_OPEN = "TC:LENDINGOPEN", t.TC_LENDING_CLOSE = "TC:LENDINGCLOSE", t.ETH_APPROVAL = "ETH:APPROVAL", t.ETH_STATUS = "ETH:STATUS", t.ETH_TRANSFER_TO_TC = "ETH:TRANSFER:IN", t.ETH_TRANSFER_FROM_TC = "ETH:TRANSFER:OUT", t.AVAX_APPROVAL = "AVAX:APPROVAL", t.AVAX_STATUS = "AVAX:STATUS", t.AVAX_TRANSFER_TO_TC = "AVAX:TRANSFER:IN", t.AVAX_TRANSFER_FROM_TC = "AVAX:TRANSFER:OUT", t.BSC_APPROVAL = "BSC:APPROVAL", t.BSC_STATUS = "BSC:STATUS", t.BSC_TRANSFER_TO_TC = "BSC:TRANSFER:IN", t.BSC_TRANSFER_FROM_TC = "BSC:TRANSFER:OUT", t.APPROVAL = "APPROVAL", t.STATUS = "STATUS", t.TRANSFER_TO_TC = "TRANSFER:IN", t.TRANSFER_FROM_TC = "TRANSFER:OUT", t.UNSUPPORTED = "UNSUPPORTED", t.TC_LENDING = "TC:LENDING", t))(Z || {}), tt = /* @__PURE__ */ ((t) => (t.PENDING = "pending", t.SUCCESS = "success", t.CANCELLED = "cancelled", t.REFUNDED = "refunded", t.REPLACED = "replaced", t.ERROR = "error", t.UNKNOWN = "unknown", t.NOT_STARTED = "not_started", t.NOT_FOUND = "not_found", t.RETRIES_EXCEEDED = "retries_exceeded", t.STREAMING = "streaming", t))(tt || {}), et = /* @__PURE__ */ ((t) => (t[t.NOT_STARTED = 0] = "NOT_STARTED", t[t.SUCCESS = 1] = "SUCCESS", t[t.REFUNDED = 2] = "REFUNDED", t))(et || {});
var Y = /* @__PURE__ */ ((t) => (t.SWAP_TC_TO_TC = "SWAP:TC-TC", t.SWAP_ETH_TO_TC = "SWAP:ERC20-TC", t.SWAP_TC_TO_ETH = "SWAP:TC-ERC20", t.SWAP_ETH_TO_ETH = "SWAP:ERC20-ERC20", t.SWAP_AVAX_TO_TC = "SWAP:AVAX-TC", t.SWAP_TC_TO_AVAX = "SWAP:TC-AVAX", t.SWAP_AVAX_TO_AVAX = "SWAP:AVAX-AVAX", t.SWAP_ETH_TO_AVAX = "SWAP:ETH-AVAX", t.SWAP_AVAX_TO_ETH = "SWAP:AVAX-ETH", t.SWAP_TC_TO_GAIA = "SWAP:TC-GAIA", t.SWAP_GAIA_TO_TC = "SWAP:GAIA-TC", t.SWAP_TC_TO_BNB = "SWAP:TC-BNB", t.SWAP_BNB_TO_TC = "SWAP:BNB-TC", t.SWAP_TC_TO_BTC = "SWAP:TC-BTC", t.SWAP_BTC_TO_TC = "SWAP:BTC-TC", t.SWAP_TC_TO_BCH = "SWAP:TC-BCH", t.SWAP_BCH_TO_TC = "SWAP:BCH-TC", t.SWAP_TC_TO_LTC = "SWAP:TC-LTC", t.SWAP_LTC_TO_TC = "SWAP:LTC-TC", t.SWAP_TC_TO_DOGE = "SWAP:TC-DOGE", t.SWAP_DOGE_TO_TC = "SWAP:DOGE-TC", t.TC_STATUS = "TC:STATUS", t.TC_TRANSFER = "TC:TRANSFER", t.TC_DEPOSIT = "TC:DEPOSIT", t.TC_SEND = "TC:SEND", t.TC_SWITCH = "TC:SWITCH", t.TC_LP_ADD = "TC:ADDLIQUIDITY", t.TC_LP_WITHDRAW = "TC:WITHDRAW", t.TC_TNS_CREATE = "TC:TNS-CREATE", t.TC_TNS_EXTEND = "TC:TNS-EXTEND", t.TC_TNS_UPDATE = "TC:TNS-UPDATE", t.TC_SAVINGS_ADD = "TC:ADDSAVINGS", t.TC_SAVINGS_WITHDRAW = "TC:WITHDRAWSAVINGS", t.TC_LENDING_OPEN = "TC:LENDINGOPEN", t.TC_LENDING_CLOSE = "TC:LENDINGCLOSE", t.ETH_APPROVAL = "ETH:APPROVAL", t.ETH_STATUS = "ETH:STATUS", t.ETH_TRANSFER_TO_TC = "ETH:TRANSFER:IN", t.ETH_TRANSFER_FROM_TC = "ETH:TRANSFER:OUT", t.AVAX_APPROVAL = "AVAX:APPROVAL", t.AVAX_STATUS = "AVAX:STATUS", t.AVAX_TRANSFER_TO_TC = "AVAX:TRANSFER:IN", t.AVAX_TRANSFER_FROM_TC = "AVAX:TRANSFER:OUT", t.BSC_APPROVAL = "BSC:APPROVAL", t.BSC_STATUS = "BSC:STATUS", t.BSC_TRANSFER_TO_TC = "BSC:TRANSFER:IN", t.BSC_TRANSFER_FROM_TC = "BSC:TRANSFER:OUT", t.APPROVAL = "APPROVAL", t.STATUS = "STATUS", t.TRANSFER_TO_TC = "TRANSFER:IN", t.TRANSFER_FROM_TC = "TRANSFER:OUT", t.UNSUPPORTED = "UNSUPPORTED", t.TC_LENDING = "TC:LENDING", t))(Y || {}), Z = /* @__PURE__ */ ((t) => (t.PENDING = "pending", t.SUCCESS = "success", t.CANCELLED = "cancelled", t.REFUNDED = "refunded", t.REPLACED = "replaced", t.ERROR = "error", t.UNKNOWN = "unknown", t.NOT_STARTED = "not_started", t.NOT_FOUND = "not_found", t.RETRIES_EXCEEDED = "retries_exceeded", t.STREAMING = "streaming", t))(Z || {}), tt = /* @__PURE__ */ ((t) => (t[t.NOT_STARTED = 0] = "NOT_STARTED", t[t.SUCCESS = 1] = "SUCCESS", t[t.REFUNDED = 2] = "REFUNDED", t))(tt || {});
export {
h as ApiEndpoints,
S as RequestClient,
et as StreamingSwapProgressStatus,
it as SwapKitApi,
Z as TransactionType,
tt as TxStatus,
H as defaultRequestHeaders,
ot as setRequestClientConfig
c as ApiEndpoints,
l as RequestClient,
tt as StreamingSwapProgressStatus,
ot as SwapKitApi,
Y as TransactionType,
Z as TxStatus,
B as defaultRequestHeaders,
st as setRequestClientConfig
};
//# sourceMappingURL=index.es.js.map
{
"author": "swapkit-oss-team",
"author": "swapkit-oss",
"dependencies": {
"ky": "1.2.0",
"@swapkit/types": "0.0.0-nightly-20240208140027"
"@swapkit/types": "0.0.0-nightly-20240223171610"
},
"description": "SwapKit Lib swapkit-api",
"devDependencies": {
"@vitest/coverage-istanbul": "1.2.1",
"vite": "5.0.12",
"vitest": "1.2.1",
"@internal/config": "0.0.0-nightly-20240208140027"
"@vitest/coverage-istanbul": "1.3.1",
"vite": "5.1.3",
"vitest": "1.3.1"
},
"eslintConfig": {
"extends": "../../../internal/eslint-config"
},
"exports": {

@@ -40,7 +36,7 @@ ".": {

"types": "./dist/index.d.ts",
"version": "0.0.0-nightly-20240208140027",
"version": "0.0.0-nightly-20240223171610",
"scripts": {
"build": "vite build",
"clean": "rm -rf dist vite.config.ts.* .turbo node_modules",
"lint": "eslint ./ --ext .ts,.tsx --fix; tsc --noEmit",
"clean": "rm -rf dist vite.config.ts.* node_modules",
"lint": "biome check --apply ./src",
"test": "echo 'vitest --run'",

@@ -47,0 +43,0 @@ "test:coverage": "echo 'vitest run --coverage'"

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

import { ApiEndpoints, RequestClient } from './requestClient.ts';
import { ApiEndpoints, RequestClient } from "./requestClient.ts";
import type {

@@ -11,17 +11,21 @@ CachedPricesParams,

TxnResponse,
} from './types/index.ts';
} from "./types/index.ts";
const getCachedPrices = ({ tokens, ...options }: CachedPricesParams) => {
const body = new URLSearchParams();
tokens
.filter((token, index, sourceArr) => sourceArr.findIndex((t) => t === token) === index)
.forEach((token) => body.append('tokens', JSON.stringify(token)));
const filteredTokens = tokens.filter(
(token, index, sourceArr) => sourceArr.findIndex((t) => t === token) === index,
);
if (options.metadata) body.append('metadata', 'true');
if (options.lookup) body.append('lookup', 'true');
if (options.sparkline) body.append('sparkline', 'true');
for (const token of filteredTokens) {
body.append("tokens", JSON.stringify(token));
}
if (options.metadata) body.append("metadata", "true");
if (options.lookup) body.append("lookup", "true");
if (options.sparkline) body.append("sparkline", "true");
return RequestClient.post<CachedPricesResponse[]>(ApiEndpoints.CachedPrices, {
body: body.toString(),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
headers: { "Content-Type": "application/x-www-form-urlencoded" },
});

@@ -28,0 +32,0 @@ };

@@ -1,3 +0,3 @@

export * from './api.ts';
export * from './requestClient.ts';
export * from './types/index.ts';
export * from "./api.ts";
export * from "./requestClient.ts";
export * from "./types/index.ts";

@@ -1,4 +0,4 @@

import { ApiUrl } from '@swapkit/types';
import type { Options } from 'ky';
import ky from 'ky';
import { ApiUrl } from "@swapkit/types";
import type { Options } from "ky";
import ky from "ky";

@@ -21,5 +21,5 @@ let kyClient: typeof ky;

export const defaultRequestHeaders =
typeof window !== 'undefined'
typeof window !== "undefined"
? {}
: { referrer: 'https://sk.thorswap.net', referer: 'https://sk.thorswap.net' };
: { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" };

@@ -37,3 +37,3 @@ const getKyClient = () => {

...config,
headers: { ...defaultRequestHeaders, ...config.headers, 'x-api-key': apiKey },
headers: { ...defaultRequestHeaders, ...config.headers, "x-api-key": apiKey },
});

@@ -40,0 +40,0 @@ };

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

export * from './gasRates.ts';
export * from './quote.ts';
export * from "./gasRates.ts";
export * from "./quote.ts";

@@ -1,88 +0,88 @@

import type { Chain, LedgerErrorCode, QuoteMode } from '@swapkit/types';
import type { Chain, LedgerErrorCode, QuoteMode } from "@swapkit/types";
export enum TransactionType {
// Old quote mode
SWAP_TC_TO_TC = 'SWAP:TC-TC',
SWAP_ETH_TO_TC = 'SWAP:ERC20-TC',
SWAP_TC_TO_ETH = 'SWAP:TC-ERC20',
SWAP_ETH_TO_ETH = 'SWAP:ERC20-ERC20',
SWAP_TC_TO_TC = "SWAP:TC-TC",
SWAP_ETH_TO_TC = "SWAP:ERC20-TC",
SWAP_TC_TO_ETH = "SWAP:TC-ERC20",
SWAP_ETH_TO_ETH = "SWAP:ERC20-ERC20",
// Old quote mode: AVAX
SWAP_AVAX_TO_TC = 'SWAP:AVAX-TC',
SWAP_TC_TO_AVAX = 'SWAP:TC-AVAX',
SWAP_AVAX_TO_AVAX = 'SWAP:AVAX-AVAX',
SWAP_ETH_TO_AVAX = 'SWAP:ETH-AVAX',
SWAP_AVAX_TO_ETH = 'SWAP:AVAX-ETH',
SWAP_AVAX_TO_TC = "SWAP:AVAX-TC",
SWAP_TC_TO_AVAX = "SWAP:TC-AVAX",
SWAP_AVAX_TO_AVAX = "SWAP:AVAX-AVAX",
SWAP_ETH_TO_AVAX = "SWAP:ETH-AVAX",
SWAP_AVAX_TO_ETH = "SWAP:AVAX-ETH",
// ATOM
SWAP_TC_TO_GAIA = 'SWAP:TC-GAIA',
SWAP_GAIA_TO_TC = 'SWAP:GAIA-TC',
SWAP_TC_TO_GAIA = "SWAP:TC-GAIA",
SWAP_GAIA_TO_TC = "SWAP:GAIA-TC",
// BNB
SWAP_TC_TO_BNB = 'SWAP:TC-BNB',
SWAP_BNB_TO_TC = 'SWAP:BNB-TC',
SWAP_TC_TO_BNB = "SWAP:TC-BNB",
SWAP_BNB_TO_TC = "SWAP:BNB-TC",
// BTC
SWAP_TC_TO_BTC = 'SWAP:TC-BTC',
SWAP_BTC_TO_TC = 'SWAP:BTC-TC',
SWAP_TC_TO_BTC = "SWAP:TC-BTC",
SWAP_BTC_TO_TC = "SWAP:BTC-TC",
// BCH
SWAP_TC_TO_BCH = 'SWAP:TC-BCH',
SWAP_BCH_TO_TC = 'SWAP:BCH-TC',
SWAP_TC_TO_BCH = "SWAP:TC-BCH",
SWAP_BCH_TO_TC = "SWAP:BCH-TC",
// LTC
SWAP_TC_TO_LTC = 'SWAP:TC-LTC',
SWAP_LTC_TO_TC = 'SWAP:LTC-TC',
SWAP_TC_TO_LTC = "SWAP:TC-LTC",
SWAP_LTC_TO_TC = "SWAP:LTC-TC",
// DOGE
SWAP_TC_TO_DOGE = 'SWAP:TC-DOGE',
SWAP_DOGE_TO_TC = 'SWAP:DOGE-TC',
SWAP_TC_TO_DOGE = "SWAP:TC-DOGE",
SWAP_DOGE_TO_TC = "SWAP:DOGE-TC",
// TC txns
TC_STATUS = 'TC:STATUS', // only track status
TC_TRANSFER = 'TC:TRANSFER', // only track status
TC_DEPOSIT = 'TC:DEPOSIT',
TC_SEND = 'TC:SEND',
TC_SWITCH = 'TC:SWITCH',
TC_LP_ADD = 'TC:ADDLIQUIDITY',
TC_LP_WITHDRAW = 'TC:WITHDRAW', // Supports 'WITHDRAWLIQUIDITY' as well
TC_TNS_CREATE = 'TC:TNS-CREATE',
TC_TNS_EXTEND = 'TC:TNS-EXTEND',
TC_TNS_UPDATE = 'TC:TNS-UPDATE',
TC_STATUS = "TC:STATUS", // only track status
TC_TRANSFER = "TC:TRANSFER", // only track status
TC_DEPOSIT = "TC:DEPOSIT",
TC_SEND = "TC:SEND",
TC_SWITCH = "TC:SWITCH",
TC_LP_ADD = "TC:ADDLIQUIDITY",
TC_LP_WITHDRAW = "TC:WITHDRAW", // Supports 'WITHDRAWLIQUIDITY' as well
TC_TNS_CREATE = "TC:TNS-CREATE",
TC_TNS_EXTEND = "TC:TNS-EXTEND",
TC_TNS_UPDATE = "TC:TNS-UPDATE",
// SAVINGS
TC_SAVINGS_ADD = 'TC:ADDSAVINGS',
TC_SAVINGS_WITHDRAW = 'TC:WITHDRAWSAVINGS',
TC_SAVINGS_ADD = "TC:ADDSAVINGS",
TC_SAVINGS_WITHDRAW = "TC:WITHDRAWSAVINGS",
// LENDING
TC_LENDING_OPEN = 'TC:LENDINGOPEN',
TC_LENDING_CLOSE = 'TC:LENDINGCLOSE',
TC_LENDING_OPEN = "TC:LENDINGOPEN",
TC_LENDING_CLOSE = "TC:LENDINGCLOSE",
// ERC-20 txns
ETH_APPROVAL = 'ETH:APPROVAL',
ETH_STATUS = 'ETH:STATUS', // only track status
ETH_TRANSFER_TO_TC = 'ETH:TRANSFER:IN',
ETH_TRANSFER_FROM_TC = 'ETH:TRANSFER:OUT',
ETH_APPROVAL = "ETH:APPROVAL",
ETH_STATUS = "ETH:STATUS", // only track status
ETH_TRANSFER_TO_TC = "ETH:TRANSFER:IN",
ETH_TRANSFER_FROM_TC = "ETH:TRANSFER:OUT",
// AVAX
AVAX_APPROVAL = 'AVAX:APPROVAL',
AVAX_STATUS = 'AVAX:STATUS', // only track status
AVAX_TRANSFER_TO_TC = 'AVAX:TRANSFER:IN',
AVAX_TRANSFER_FROM_TC = 'AVAX:TRANSFER:OUT',
AVAX_APPROVAL = "AVAX:APPROVAL",
AVAX_STATUS = "AVAX:STATUS", // only track status
AVAX_TRANSFER_TO_TC = "AVAX:TRANSFER:IN",
AVAX_TRANSFER_FROM_TC = "AVAX:TRANSFER:OUT",
// BSC
BSC_APPROVAL = 'BSC:APPROVAL',
BSC_STATUS = 'BSC:STATUS', // only track status
BSC_TRANSFER_TO_TC = 'BSC:TRANSFER:IN',
BSC_TRANSFER_FROM_TC = 'BSC:TRANSFER:OUT',
BSC_APPROVAL = "BSC:APPROVAL",
BSC_STATUS = "BSC:STATUS", // only track status
BSC_TRANSFER_TO_TC = "BSC:TRANSFER:IN",
BSC_TRANSFER_FROM_TC = "BSC:TRANSFER:OUT",
// Generic types
APPROVAL = 'APPROVAL',
STATUS = 'STATUS',
TRANSFER_TO_TC = 'TRANSFER:IN',
TRANSFER_FROM_TC = 'TRANSFER:OUT',
APPROVAL = "APPROVAL",
STATUS = "STATUS",
TRANSFER_TO_TC = "TRANSFER:IN",
TRANSFER_FROM_TC = "TRANSFER:OUT",
// Unsupported
UNSUPPORTED = 'UNSUPPORTED',
UNSUPPORTED = "UNSUPPORTED",
// Lending
TC_LENDING = 'TC:LENDING',
TC_LENDING = "TC:LENDING",
}
export enum TxStatus {
PENDING = 'pending',
SUCCESS = 'success',
CANCELLED = 'cancelled',
REFUNDED = 'refunded',
REPLACED = 'replaced',
ERROR = 'error',
UNKNOWN = 'unknown',
NOT_STARTED = 'not_started',
NOT_FOUND = 'not_found',
RETRIES_EXCEEDED = 'retries_exceeded',
STREAMING = 'streaming',
PENDING = "pending",
SUCCESS = "success",
CANCELLED = "cancelled",
REFUNDED = "refunded",
REPLACED = "replaced",
ERROR = "error",
UNKNOWN = "unknown",
NOT_STARTED = "not_started",
NOT_FOUND = "not_found",
RETRIES_EXCEEDED = "retries_exceeded",
STREAMING = "streaming",
}

@@ -222,5 +222,5 @@

tokens: { identifier: string }[];
metadata?: 'true' | 'false';
lookup?: 'true' | 'false';
sparkline?: 'true' | 'false';
metadata?: "true" | "false";
lookup?: "true" | "false";
sparkline?: "true" | "false";
};

@@ -227,0 +227,0 @@

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