🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

aptos-tool

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aptos-tool - npm Package Compare versions

Comparing version
0.0.6
to
0.0.7
+3
dist/src/config/index.d.ts
export declare const APTOS_COIN_TYPE = "0x1::aptos_coin::AptosCoin";
export declare const APT_DECIMALS = 8;
export declare const USDT_DECIMALS = 4;
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,+BAA+B,CAAC;AAC5D,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,aAAa,IAAI,CAAC"}
export * as Config from './config';
export { Token } from './Token';
export { TokenPairs } from './TokenPairs';
export * as Utils from './utils';
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC"}
import { default as BigNumber } from 'bignumber.js';
export declare class Token {
name: string;
symbol: string;
decimals: number;
index: number | string;
tags: string[];
bridge: string;
price: number | string;
priceU: number | string;
balance: number;
assetType: `${string}::${string}::${string}` | string;
coinType?: `${string}::${string}::${string}` | string;
faType?: string;
logoUrl?: string;
coingeckoId?: string;
coinMarketcapId?: string;
constructor(args: {
name: string;
symbol: string;
decimals: number;
assetType: `${string}::${string}::${string}` | string;
coinType?: `${string}::${string}::${string}` | string;
faType?: string;
index?: number | string;
tags?: string[];
bridge?: string;
price?: number | string;
priceU?: number | string;
balance?: number;
logoUrl?: string;
coingeckoId?: string;
coinMarketcapId?: string;
});
faTypeCalculate(): void;
priceDisplay(amount: DexNumberString, precision?: number): string;
priceDisplayWithSymbol(amount: DexNumberString, precision?: number): string;
priceInUSDT(APTPrice?: number | BigNumber): number;
volumeInUSDT(APTPrice?: number | BigNumber): string;
volumeInUSDTByBalance(balance?: string | number | BigNumber, APTPrice?: number | BigNumber): string | 0;
get submitAssetType(): string;
/**
*
* @param amount token amount in minimum unit (integer)
* @param decimals target token decimals
* @returns BigNumber
*
* @example
* Token.amountInDecimal(100000000, 8) // 1
* Token.amountInDecimal(100000000, 6) // 100
*/
static amountInDecimal(amount: DexNumberString, decimals?: number): BigNumber;
/**
*
* @param amount token amount in decimal
* @param decimals target token decimals
* @returns BigNumber
*
* @example
* Token.amountInUnit(1, 8) // 100000000
* Token.amountInUnit(100, 6) // 100000000
*/
static amountInUnit(amount: DexNumberString, decimals?: number): BigNumber;
/**
*
* @param balance token balance in minimum unit
* @param token Token
* @returns token balance in decimal
*
* @example
* Token.balanceInDecimal(100000000, token) // 1
*/
static balanceInUSDT(balance: number, token: Token): string;
/**
*
* @param balance token balance in minimum unit
* @param token Token
* @returns token balance in decimal
*
* @example
* Token.balanceInDecimal(100000000, token) // 1
*/
currentBalanceInUSDT(): string;
/**
*
* @returns token balance in decimal
*
* @example
* const token = new Token({balance: 100000000, decimals: 8})
*
* token.balanceInDecimal() // 1
*/
balanceInDecimal(): BigNumber;
/**
*
* @returns token balance in display format, with comma and decimal
*
* @example
* const token = new Token({balance: 12345678900000, decimals: 8})
*
* token.balanceDisplay() // 12,345.6789
*/
balanceDisplay(): string;
/**
*
* @returns token balance in display format with symbol, with comma and decimal
*
* const token = new Token({balance: 12345678900000, decimals: 8})
*
* token.balanceDisplayWithSymbol() // 12,345.6789 APT
*/
balanceDisplayWithSymbol(): string;
/**
*
* @param amount token amount in minimum unit
* @returns
*
* @example
* const token = new Token({balance: 100000000, decimals: 8})
*
* token.isInsufficientBalance(100000001) // true
* token.isInsufficientBalance(100000000) // false
*/
isInsufficientBalance(amount: DexNumberString): boolean;
/**
*
* @param amount token amount in decimal
* @returns
*
* @example
* const token = new Token({balance: 1, decimals: 8})
*
* token.isInsufficientBalanceWithDecimal(1.00000001) // true
* token.isInsufficientBalanceWithDecimal(1) // false
*/
isInsufficientBalanceWithDecimal(amount: DexNumberString): boolean;
isTheToken(token: Token): boolean;
clearBalance(): void;
}
{"version":3,"file":"Token.d.ts","sourceRoot":"","sources":["../../src/Token.ts"],"names":[],"mappings":"AAKA,OAAO,SAAS,MAAM,cAAc,CAAC;AASrC,qBAAa,KAAK;IAChB,IAAI,EAAE,MAAM,CAAM;IAClB,MAAM,EAAE,MAAM,CAAM;IACpB,QAAQ,EAAE,MAAM,CAAK;IACrB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAM;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAM;IACpB,MAAM,EAAE,MAAM,CAAM;IACpB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAK;IAC3B,MAAM,EAAE,MAAM,GAAG,MAAM,CAAK;IAC5B,OAAO,EAAE,MAAM,CAAK;IACpB,SAAS,EAAE,GAAG,MAAM,KAAK,MAAM,KAAK,MAAM,EAAE,GAAG,MAAM,CAAM;IAC3D,QAAQ,CAAC,EAAE,GAAG,MAAM,KAAK,MAAM,KAAK,MAAM,EAAE,GAAG,MAAM,CAAM;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAM;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;gBAEb,IAAI,EAAE;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,GAAG,MAAM,KAAK,MAAM,KAAK,MAAM,EAAE,GAAG,MAAM,CAAC;QACtD,QAAQ,CAAC,EAAE,GAAG,MAAM,KAAK,MAAM,KAAK,MAAM,EAAE,GAAG,MAAM,CAAC;QACtD,MAAM,CAAC,E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H,wBAAwB,IAAI,MAAM;IAIlC;;;;;;;;;;OAUG;IACH,qBAAqB,CAAC,MAAM,EAAE,eAAe;IAI7C;;;;;;;;;;OAUG;IACH,gCAAgC,CAAC,MAAM,EAAE,eAAe;IAIxD,UAAU,CAAC,KAAK,EAAE,KAAK;IAOvB,YAAY;CAGb"}
export declare enum OrderState {
None = "none",
Asc = "asc",
Desc = "desc"
}
export declare class TokenPairs {
static AddressRegex: RegExp;
static IsCoinToken: (type: string) => boolean;
/**
* Converts the given address string to its long format representation.
* This function processes an address string, converting it into a longer, typically more detailed format.
* It uses a regular expression to match addresses within the string and then converts them using methods provided by the AccountAddress class.
*
* @param address - The address string to be converted.
* @returns The converted address string in long format.
*/
static AddressToLong: (address: string) => string;
/**
* Compares two asset types for equality.
*
* This function checks if two asset type strings are equal. Asset types can be represented as a combination of
* account address, module name, and token name. If the asset type strings are incomplete or improperly formatted,
* the function returns false.
*
* @param token1AssetType - The string representation of the first asset type, in the format "account_address::module_name::token_name".
* @param token2AssetType - The string representation of the second asset type, in the format "account_address::module_name::token_name".
* @returns true if the two asset types are equal, otherwise false.
*/
static AssetTypeEq: (token1AssetType: string | undefined, token2AssetType: string | undefined) => boolean;
/**
* Determines the ordering relationship between two asset type pairs.
*
* This function compares two pairs of asset types and determines if they are in ascending ('asc'),
* descending ('desc'), or no specific order ('none'). It uses the `AssetTypeEq` function to check
* for equality between individual asset types within the pairs.
*
* @param tokenAssetPair - The first pair of asset type strings, e.g., ["asset1", "asset2"].
* @param tokenAssetPair2 - The second pair of asset type strings, e.g., ["asset3", "asset4"].
* @returns 'asc' if the pairs are in ascending order, 'desc' if in descending order, otherwise 'none'.
*/
static PairsAssetTypeOrder: (tokenAssetPair: string[], tokenAssetPair2: string[]) => OrderState;
/**
* Checks the type of token pair and returns the corresponding payload.
* This function determines which payload to return based on the types of tokens provided in the tokenPairType array.
* It uses the IsCoinToken method to check if each token is a coin.
*
* @param tokenPairType - An array containing two token types to be checked.
* @param payloads - An array containing four payloads, from which one is returned based on the token types.
* @returns The payload corresponding to the combination of token types.
*/
static TokenPairTypeCheck: (tokenPairType: string[], payloads: any[]) => any;
}
{"version":3,"file":"TokenPairs.d.ts","sourceRoot":"","sources":["../../src/TokenPairs.ts"],"names":[],"mappings":"AAGA,oBAAY,UAAU;IACpB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED,qBAAa,UAAU;IACrB,MAAM,CAAC,YAAY,SAA0B;IAE7C,MAAM,CAAC,WAAW,SAAU,MAAM,aAAoC;IAEtE;;;;;;;OAOG;IACH,MAAM,CAAC,aAAa,YAAa,MAAM,YAMrC;IAEF;;;;;;;;;;OAUG;IACH,MAAM,CAAC,WAAW,oBACC,MAAM,GAAG,SAAS,mBAClB,MAAM,GAAG,SAAS,aASnC;IAEF;;;;;;;;;;OAUG;IACH,MAAM,CAAC,mBAAmB,mBACR,MAAM,EAAE,mBACP,MAAM,EAAE,KACxB,UAAU,CAsBX;IAEF;;;;;;;;OAQG;IACH,MAAM,CAAC,kBAAkB,kBAAmB,MAAM,EAAE,YAAY,GAAG,EAAE,SAgCnE;CACH"}
import { default as BigNumber } from 'bignumber.js';
/**
* Converts a string to a Uint8Array.
* This function is useful for scenarios where string data needs to be represented in binary form, such as network transmission or binary file operations.
*
* @param str - The string to be converted.
* @returns A Uint8Array containing the binary representation of the input string.
*/
export declare const StringToUint8Array: (str: string) => Uint8Array<ArrayBuffer>;
/**
* Shortens the given address string by retaining only the prefix and suffix parts.
*
* This function is designed to display long addresses in a more concise manner on the interface,
* by showing only the beginning and end of the address and replacing the middle part with an ellipsis.
* This maintains the uniqueness of the address while improving readability and interface cleanliness.
*
* @param address - The address string, expected to be in a long format.
* @param opts - Optional parameters object, containing the lengths of the prefix and suffix.
* Default values are 6 characters for the prefix and 4 characters for the suffix.
* @returns The formatted shortened address string. Returns an empty string if the input address is empty or "0".
*/
export declare const ShortAddress: (address: string, opts?: {
prefixLen: number;
suffixLen: number;
}) => string;
/**
* Formats a given number as a percentage string.
*
* This function takes a numerator and a denominator, divides the numerator by the denominator,
* multiplies the result by 100, and formats it as a percentage with a specified precision.
*
* @param numerator {DexNumberString} - The numerator, which can be a number, string, or BigNumber, defaults to 0.
* @param denominator {DexNumberString} - The denominator, which can be a number, string, or BigNumber, defaults to 1.
* @param precision - The number of decimal places in the result, defaults to 2.
* @returns The formatted percentage string.
*/
export declare const PercentFormat: (numerator?: DexNumberString, denominator?: DexNumberString, precision?: number) => BigNumber;
/**
* Formats the given number into a string with a standard format.
*
* This function accepts a number, string, or BigNumber instance as input and returns it as a formatted string.
* The formatted string adheres to the formatting rules of the BigNumber.js library, which is suitable for financial calculations or handling large numbers.
*
* @param num {DexNumberString} - The input number, which can be a number, string, or BigNumber instance. Defaults to 0.
* @returns {string} - The formatted string representation of the input number.
*/
export declare const NumberFormat: (num?: DexNumberString) => string;
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,QAAS,MAAM,4BAW7C,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,YACd,MAAM,SACT;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,WAW/C,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,eACb,eAAe,gBACb,eAAe,cACjB,MAAM,KAChB,SAKF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,SAAS,eAAe,WAGhD,CAAC"}
+2
-3
{
"name": "aptos-tool",
"version": "0.0.6",
"version": "0.0.7",
"description": "",

@@ -11,4 +11,3 @@ "type": "module",

"import": "./dist/index.js",
"require": "./dist/index.cjs",
"types": "./dist/src/index.d.ts"
"require": "./dist/index.cjs"
}

@@ -15,0 +14,0 @@ },