Skip to content

Commit 3a30ce4

Browse files
committed
chore: prettify
1 parent 7800dbc commit 3a30ce4

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

packages/plugin-starknet/src/providers/portfolioProvider.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class WalletProvider {
8383
async getWalletPortfolio(): Promise<TokenBalances> {
8484
const cacheKey = `walletPortfolio-${this.runtime.agentId}`;
8585
const cachedValues = await this.runtime.cacheManager.get<TokenBalances>(
86-
cacheKey,
86+
cacheKey
8787
);
8888
if (cachedValues) {
8989
elizaLogger.debug("Using cached data for getWalletPortfolio()");
@@ -109,20 +109,19 @@ export class WalletProvider {
109109

110110
async getTokenUsdValues(): Promise<CoingeckoPrices> {
111111
const cacheKey = "tokenUsdValues";
112-
const cachedValues = await this.runtime.cacheManager.get<
113-
CoingeckoPrices
114-
>(cacheKey);
112+
const cachedValues =
113+
await this.runtime.cacheManager.get<CoingeckoPrices>(cacheKey);
115114
if (cachedValues) {
116115
elizaLogger.debug("Using cached data for getTokenUsdValues()");
117116
return cachedValues;
118117
}
119118

120-
const coingeckoIds = Object.values(CONFIG.PORTFOLIO_TOKENS).map(
121-
(token) => token.coingeckoId,
122-
).join(",");
119+
const coingeckoIds = Object.values(CONFIG.PORTFOLIO_TOKENS)
120+
.map((token) => token.coingeckoId)
121+
.join(",");
123122

124123
const coingeckoPrices = await fetchWithRetry<CoingeckoPrices>(
125-
`https://api.coingecko.com/api/v3/simple/price?ids=${coingeckoIds}&vs_currencies=usd`,
124+
`https://api.coingecko.com/api/v3/simple/price?ids=${coingeckoIds}&vs_currencies=usd`
126125
);
127126

128127
await this.runtime.cacheManager.set(cacheKey, coingeckoPrices, {
@@ -137,7 +136,7 @@ const walletProvider: Provider = {
137136
get: async (
138137
runtime: IAgentRuntime,
139138
_message: Memory,
140-
_state?: State,
139+
_state?: State
141140
): Promise<string> => {
142141
const provider = new WalletProvider(runtime);
143142
let walletPortfolio: TokenBalances = null;
@@ -156,16 +155,17 @@ const walletProvider: Provider = {
156155
const rawBalance = walletPortfolio[token.address];
157156
if (rawBalance === undefined) return null;
158157

159-
const decimalBalance = Number(rawBalance) /
160-
Math.pow(10, token.decimals);
158+
const decimalBalance =
159+
Number(rawBalance) / Math.pow(10, token.decimals);
161160
const price = tokenUsdValues[token.coingeckoId]?.usd ?? 0;
162161
const usdValue = decimalBalance * price;
163162

164163
if (decimalBalance === 0 && usdValue === 0) return null;
165164

166-
return `${symbol.padEnd(9)}| ${
167-
decimalBalance.toFixed(18).replace(/\.?0+$/, "").padEnd(20)
168-
}| ${usdValue.toFixed(2)}`;
165+
return `${symbol.padEnd(9)}| ${decimalBalance
166+
.toFixed(18)
167+
.replace(/\.?0+$/, "")
168+
.padEnd(20)}| ${usdValue.toFixed(2)}`;
169169
})
170170
.filter((row): row is string => row !== null);
171171

packages/plugin-starknet/src/utils/ERC20Token.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class ERC20Token {
2727
calldata: CallData;
2828
constructor(
2929
token: string,
30-
providerOrAccount?: ProviderInterface | AccountInterface,
30+
providerOrAccount?: ProviderInterface | AccountInterface
3131
) {
3232
this.contract = new Contract(erc20Abi, token, providerOrAccount);
3333
this.calldata = new CallData(this.contract.abi);

packages/plugin-starknet/src/utils/index.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Account, Contract, RpcProvider } from "starknet";
44

55
export const getTokenBalance = async (
66
runtime: IAgentRuntime,
7-
tokenAddress: string,
7+
tokenAddress: string
88
) => {
99
const provider = getStarknetProvider(runtime);
1010

@@ -30,7 +30,7 @@ export const getStarknetAccount = (runtime: IAgentRuntime) => {
3030
return new Account(
3131
getStarknetProvider(runtime),
3232
runtime.getSetting("STARKNET_ADDRESS"),
33-
runtime.getSetting("STARKNET_PRIVATE_KEY"),
33+
runtime.getSetting("STARKNET_PRIVATE_KEY")
3434
);
3535
};
3636

@@ -45,7 +45,7 @@ export const PERCENTAGE_INPUT_PRECISION = 2;
4545
export const parseFormatedPercentage = (percent: string) =>
4646
new Percent(
4747
+percent * 10 ** PERCENTAGE_INPUT_PRECISION,
48-
100 * 10 ** PERCENTAGE_INPUT_PRECISION,
48+
100 * 10 ** PERCENTAGE_INPUT_PRECISION
4949
);
5050

5151
interface ParseCurrencyAmountOptions {
@@ -55,7 +55,7 @@ interface ParseCurrencyAmountOptions {
5555

5656
export const formatCurrenyAmount = (
5757
amount: Fraction,
58-
{ fixed, significant = 1 }: ParseCurrencyAmountOptions,
58+
{ fixed, significant = 1 }: ParseCurrencyAmountOptions
5959
) => {
6060
const fixedAmount = amount.toFixed(fixed);
6161
const significantAmount = amount.toSignificant(significant);
@@ -67,7 +67,7 @@ export const formatCurrenyAmount = (
6767
export const formatPercentage = (percentage: Percent) => {
6868
const formatedPercentage = +percentage.toFixed(2);
6969
const exact = percentage.equalTo(
70-
new Percent(Math.round(formatedPercentage * 100), 10000),
70+
new Percent(Math.round(formatedPercentage * 100), 10000)
7171
);
7272

7373
return `${exact ? "" : "~"}${formatedPercentage}%`;
@@ -83,7 +83,7 @@ export type RetryConfig = {
8383
export async function fetchWithRetry<T>(
8484
url: string,
8585
options?: RequestInit,
86-
config: RetryConfig = {},
86+
config: RetryConfig = {}
8787
): Promise<T> {
8888
const {
8989
maxRetries = 3,
@@ -101,7 +101,7 @@ export async function fetchWithRetry<T>(
101101

102102
if (!response.ok) {
103103
throw new Error(
104-
`Coingecko API HTTP status: ${response.status}`,
104+
`Coingecko API HTTP status: ${response.status}`
105105
);
106106
}
107107

0 commit comments

Comments
 (0)