🎩 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.10
to
0.0.11
+1
-1
dist/index.cjs

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

"use strict";var h=Object.defineProperty;var m=(i,e,t)=>e in i?h(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var s=(i,e,t)=>m(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@aptos-labs/ts-sdk"),r=require("bignumber.js"),y="0x1::aptos_coin::AptosCoin",f=Object.freeze(Object.defineProperty({__proto__:null,APTOS_COIN_TYPE:y,APT_DECIMALS:8,USDT_DECIMALS:4},Symbol.toStringTag,{value:"Module"})),n=class n{};s(n,"AddressRegex",/0x[a-fA-F0-9]{1,64}/g),s(n,"IsCoinToken",e=>{var t;return((t=e==null?void 0:e.split("::"))==null?void 0:t.length)>=3}),s(n,"AddressToLong",e=>e.replace(n.AddressRegex,t=>p.AccountAddress.from(t).toStringLong())),s(n,"AssetTypeEq",(e,t)=>!(!e||!t)&&n.AddressToLong(e)===n.AddressToLong(t)),s(n,"PairsAssetTypeOrder",(e,t)=>{const[a,o]=e,[l,u]=t;return n.AssetTypeEq(a,l)&&n.AssetTypeEq(o,u)?"asc":n.AssetTypeEq(a,u)&&n.AssetTypeEq(o,l)?"desc":"none"}),s(n,"TokenPairTypeCheck",(e,t)=>n.IsCoinToken(e[0])||n.IsCoinToken(e[1])?n.IsCoinToken(e[0])&&n.IsCoinToken(e[1])?t[1]:n.IsCoinToken(e[0])&&!n.IsCoinToken(e[1])?t[2]:!n.IsCoinToken(e[0])&&n.IsCoinToken(e[1])?t[3]:void 0:t[0]);let c=n;const d=i=>{const e=new ArrayBuffer(i.length),t=new Uint8Array(e);for(let a=0,o=i.length;a<o;a++)t[a]=i.charCodeAt(a);return t},A=Object.freeze(Object.defineProperty({__proto__:null,NumberFormat:(i=0)=>new r(i).toFormat(),PercentFormat:(i=0,e=1,t=2)=>r(e).isNaN()||r(e).isZero()?r(0):r(i).div(e).times(100).dp(t),ShortAddress:(i,e={prefixLen:6,suffixLen:4})=>{const t=new RegExp(`(^\\S{${e.prefixLen}})(\\S*)(\\S{${e.suffixLen}})$`);return i&&i!=="0"?i.replace(t,"$1...$3"):""},StringToUint8Array:d},Symbol.toStringTag,{value:"Module"}));r.config({EXPONENTIAL_AT:[-1e9,1e9]});class T{constructor(e){s(this,"name","");s(this,"symbol","");s(this,"decimals",8);s(this,"index","");s(this,"tags",[]);s(this,"bridge","");s(this,"price",0);s(this,"priceU",0);s(this,"balance",0);s(this,"assetType","");s(this,"coinType","");s(this,"faType","");s(this,"logoUrl");s(this,"coingeckoId");s(this,"coinMarketcapId");Object.assign(this,e),this.faTypeCalculate()}faTypeCalculate(){if(!this.coinType)return;if(c.AssetTypeEq(this.coinType,y))return void(this.faType="0xa");const[e,t,a]=this.coinType.split("::"),o=[p.AccountAddress.from(e).toString(),t,a].join("::"),l=new p.Serializer;l.serializeFixedBytes(d(o));const u=p.createObjectAddress(p.AccountAddress.from("0xa"),l.toUint8Array());this.faType=u.toString()}priceDisplay(e,t=4){return new r(this.price||0).times(e||0).dp(t).toFormat()}priceDisplayWithSymbol(e,t=4){return`${this.priceDisplay(e,t)} ${this.symbol}`}priceInUSDT(e=0){return new r(this.price||0).times(e).dp(4).toNumber()}volumeInUSDT(e=0){return T.amountInDecimal(this.balance,this.decimals).times(this.priceInUSDT(e)).dp(4).toString()}volumeInUSDTByBalance(e=0,t=0){return new r(e||0).times(this.priceInUSDT(t)).dp(4).toString()||0}get submitAssetType(){return this.coinType||this.faType||""}static amountInDecimal(e,t=8){return new r(e||0).shiftedBy(-1*t).dp(Number(t))}static amountInUnit(e,t=8){return new r(e||0).shiftedBy(t)}static balanceInUSDT(e,t){const a=new r(e||0).shiftedBy(-1*t.decimals).times(t.price);return r(a).isEqualTo(0)?"$0":r(a).isLessThan(.001)?"< $0.001":`$ ${a.dp(3).toFormat()}`}currentBalanceInUSDT(){return T.balanceInUSDT(this.balance,this)}balanceInDecimal(){return T.amountInDecimal(this.balance,this.decimals)}balanceDisplay(){return new r(this.balance||0).shiftedBy(-1*this.decimals).toFormat()}balanceDisplayWithSymbol(){return`${this.balanceDisplay()} ${this.symbol}`}isInsufficientBalance(e){return new r(this.balance).isLessThan(e)}isInsufficientBalanceWithDecimal(e){return this.balanceInDecimal().isLessThan(e)}isTheToken(e){return c.AssetTypeEq(this.coinType,e.coinType)||c.AssetTypeEq(this.faType,e.faType)}clearBalance(){this.balance=0}}exports.Config=f,exports.Token=T,exports.TokenPairs=c,exports.Utils=A;
"use strict";var h=Object.defineProperty;var m=(i,e,t)=>e in i?h(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var s=(i,e,t)=>m(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@aptos-labs/ts-sdk"),r=require("bignumber.js"),y="0x1::aptos_coin::AptosCoin",f=Object.freeze(Object.defineProperty({__proto__:null,APTOS_COIN_TYPE:y,APT_DECIMALS:8,USDT_DECIMALS:4},Symbol.toStringTag,{value:"Module"})),n=class n{};s(n,"AddressRegex",/0x[a-fA-F0-9]{1,64}/g),s(n,"IsCoinToken",e=>{var t;return((t=e==null?void 0:e.split("::"))==null?void 0:t.length)>=3}),s(n,"AddressToLong",e=>e.replace(n.AddressRegex,t=>p.AccountAddress.from(t).toStringLong())),s(n,"AssetTypeEq",(e,t)=>!(!e||!t)&&n.AddressToLong(e)===n.AddressToLong(t)),s(n,"PairsAssetTypeOrder",(e,t)=>{const[a,o]=e,[l,u]=t;return n.AssetTypeEq(a,l)&&n.AssetTypeEq(o,u)?"asc":n.AssetTypeEq(a,u)&&n.AssetTypeEq(o,l)?"desc":"none"}),s(n,"TokenPairTypeCheck",(e,t)=>n.IsCoinToken(e[0])||n.IsCoinToken(e[1])?n.IsCoinToken(e[0])&&n.IsCoinToken(e[1])?t[1]:n.IsCoinToken(e[0])&&!n.IsCoinToken(e[1])?t[2]:!n.IsCoinToken(e[0])&&n.IsCoinToken(e[1])?t[3]:void 0:t[0]);let c=n;const d=i=>{const e=new ArrayBuffer(i.length),t=new Uint8Array(e);for(let a=0,o=i.length;a<o;a++)t[a]=i.charCodeAt(a);return t},A=Object.freeze(Object.defineProperty({__proto__:null,NumberFormat:(i=0)=>new r(i).toFormat(),PercentFormat:(i=0,e=1,t=2)=>r(e).isNaN()||r(e).isZero()?r(0):r(i).div(e).times(100).dp(t),ShortAddress:(i,e={prefixLen:6,suffixLen:4})=>{const t=new RegExp(`(^\\S{${e.prefixLen}})(\\S*)(\\S{${e.suffixLen}})$`);return i&&i!=="0"?i.replace(t,"$1...$3"):""},StringToUint8Array:d},Symbol.toStringTag,{value:"Module"}));r.config({EXPONENTIAL_AT:1e9});class T{constructor(e){s(this,"name","");s(this,"symbol","");s(this,"decimals",8);s(this,"index","");s(this,"tags",[]);s(this,"bridge","");s(this,"price",0);s(this,"priceU",0);s(this,"balance",0);s(this,"assetType","");s(this,"coinType","");s(this,"faType","");s(this,"logoUrl");s(this,"coingeckoId");s(this,"coinMarketcapId");Object.assign(this,e),this.faTypeCalculate()}faTypeCalculate(){if(!this.coinType)return;if(c.AssetTypeEq(this.coinType,y))return void(this.faType="0xa");const[e,t,a]=this.coinType.split("::"),o=[p.AccountAddress.from(e).toString(),t,a].join("::"),l=new p.Serializer;l.serializeFixedBytes(d(o));const u=p.createObjectAddress(p.AccountAddress.from("0xa"),l.toUint8Array());this.faType=u.toString()}priceDisplay(e,t=4){return new r(this.price||0).times(e||0).dp(t).toFormat()}priceDisplayWithSymbol(e,t=4){return`${this.priceDisplay(e,t)} ${this.symbol}`}priceInUSDT(e=0){return new r(this.price||0).times(e).dp(4).toNumber()}volumeInUSDT(e=0){return T.amountInDecimal(this.balance,this.decimals).times(this.priceInUSDT(e)).dp(4).toString()}volumeInUSDTByBalance(e=0,t=0){return new r(e||0).times(this.priceInUSDT(t)).dp(4).toString()||0}get submitAssetType(){return this.coinType||this.faType||""}static amountInDecimal(e,t=8){return new r(e||0).shiftedBy(-1*t).dp(Number(t))}static amountInUnit(e,t=8){return new r(e||0).shiftedBy(t)}static balanceInUSDT(e,t){const a=new r(e||0).shiftedBy(-1*t.decimals).times(t.price);return r(a).isEqualTo(0)?"$0":r(a).isLessThan(.001)?"< $0.001":`$ ${a.dp(3).toFormat()}`}currentBalanceInUSDT(){return T.balanceInUSDT(this.balance,this)}balanceInDecimal(){return T.amountInDecimal(this.balance,this.decimals)}balanceDisplay(){return new r(this.balance||0).shiftedBy(-1*this.decimals).toFormat()}balanceDisplayWithSymbol(){return`${this.balanceDisplay()} ${this.symbol}`}isInsufficientBalance(e){return new r(this.balance).isLessThan(e)}isInsufficientBalanceWithDecimal(e){return this.balanceInDecimal().isLessThan(e)}isTheToken(e){return c.AssetTypeEq(this.coinType,e.coinType)||c.AssetTypeEq(this.faType,e.faType)}clearBalance(){this.balance=0}}exports.Config=f,exports.Token=T,exports.TokenPairs=c,exports.Utils=A;

@@ -24,3 +24,3 @@ var d = Object.defineProperty;

}, StringToUint8Array: u }, Symbol.toStringTag, { value: "Module" }));
r.config({ EXPONENTIAL_AT: [-1e9, 1e9] });
r.config({ EXPONENTIAL_AT: 1e9 });
class T {

@@ -27,0 +27,0 @@ constructor(e) {

{
"name": "aptos-tool",
"version": "0.0.10",
"version": "0.0.11",
"description": "",

@@ -5,0 +5,0 @@ "type": "module",

@@ -12,3 +12,3 @@ import {

BigNumber.config({
EXPONENTIAL_AT: [-1e9, 1e9],
EXPONENTIAL_AT: 1e9,
});

@@ -15,0 +15,0 @@