Skip to content

Commit c65173d

Browse files
committed
Add prettier
1 parent 2b6f685 commit c65173d

11 files changed

Lines changed: 129 additions & 837 deletions

File tree

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"packageManager": "pnpm@10.15.1",
66
"scripts": {
77
"watch": "tsc && tsc --watch & jest --watch --coverage",
8-
"lint": "biome check",
9-
"fmt": "biome check --write",
8+
"lint": "prettier --check src/.",
9+
"fmt": "prettier --write src/.",
1010
"build": "tsup --config tsup.config.ts --external fsevents",
1111
"prepare": "pnpm run build"
1212
},
@@ -34,7 +34,7 @@
3434
"@testing-library/user-event": "^14.6.1",
3535
"@types/react": "^19.1.12",
3636
"@types/react-dom": "^19.1.9",
37-
"biome": "^0.3.3",
37+
"prettier": "^3.6.2",
3838
"rxjs": "^7.8.2",
3939
"tsup": "^8.5.0",
4040
"typescript": "^5.9.2"

pnpm-lock.yaml

Lines changed: 10 additions & 734 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/BitteWalletContext.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ export type BitteWalletContext = {
3535

3636
interface ContextProviderType {
3737
children: React.ReactNode;
38-
network?: 'testnet' | 'mainnet';
38+
network?: "testnet" | "mainnet";
3939
onlyMbWallet?: boolean;
4040
contractAddress?: string;
4141
additionalWallets?: Array<WalletModuleFactory>;
4242
onlyBitteWallet?: boolean;
43-
walletUrl?:string
43+
walletUrl?: string;
4444
}
4545

4646
export const BitteWalletContext = createContext<BitteWalletContext | null>(
47-
null
47+
null,
4848
);
4949

5050
export const BitteWalletContextProvider: React.FC<ContextProviderType> = ({
@@ -57,7 +57,7 @@ export const BitteWalletContextProvider: React.FC<ContextProviderType> = ({
5757
}): JSX.Element => {
5858
const [errorMessage, setErrorMessage] = useState<string | null>(null);
5959
const [components, setComponents] = useState<WalletSelectorComponents | null>(
60-
null
60+
null,
6161
);
6262
const [accounts, setAccounts] = useState<AccountState[]>([]);
6363
const [isWaitingForConnection, setIsWaitingForConnection] =
@@ -82,12 +82,11 @@ export const BitteWalletContextProvider: React.FC<ContextProviderType> = ({
8282
!!onlyBitteWallet ||
8383
!!(additionalWallets && additionalWallets.length > 0);
8484

85-
8685
return await setupBitteWalletSelector(
8786
isOnlyBitteWallet,
8887
selectedNetwork,
89-
{additionalWallets: additionalWallets },
90-
walletUrl
88+
{ additionalWallets: additionalWallets },
89+
walletUrl,
9190
);
9291
};
9392

@@ -138,7 +137,7 @@ export const BitteWalletContextProvider: React.FC<ContextProviderType> = ({
138137
const subscription = registerWalletAccountsSubscriber(
139138
(accounts: AccountState[]) => {
140139
setAccounts(accounts);
141-
}
140+
},
142141
);
143142

144143
return (): void => {
@@ -148,8 +147,6 @@ export const BitteWalletContextProvider: React.FC<ContextProviderType> = ({
148147

149148
const { selector, modal } = components || {};
150149

151-
152-
153150
const connect = async (): Promise<void> => {
154151
setIsWaitingForConnection(true);
155152

@@ -187,7 +184,7 @@ export const BitteWalletContextProvider: React.FC<ContextProviderType> = ({
187184
disconnect,
188185
signMessage,
189186
}),
190-
[selector, modal, accounts]
187+
[selector, modal, accounts],
191188
);
192189

193190
return (
@@ -201,7 +198,7 @@ export const useBitteWallet = (): BitteWalletContext => {
201198
const context = useContext(BitteWalletContext);
202199
if (!context) {
203200
throw new Error(
204-
"useBitteWallet must be used within a BitteWalletContextProvider"
201+
"useBitteWallet must be used within a BitteWalletContextProvider",
205202
);
206203
}
207204
return context;

src/hooks/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './useNearPrice';
1+
export * from "./useNearPrice";

src/hooks/methods/constants.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
export const QUERY_OPS_PREFIX = 'mintbase_js_data_';
2-
export const META_SERVICE_HOST = 'https://api.mintbase.xyz';
3-
export const META_SERVICE_HOST_TESTNET = 'https://surface-api-testnet-z3w7d7dnea-ew.a.run.app';
4-
export const BINANCE_API = 'https://api.binance.com/api/v3/ticker/price?symbol=NEARUSDT';
5-
export const COIN_GECKO_API = 'https://api.coingecko.com/api/v3/simple/price?ids=near%2Cusn%2Cjumbo-exchange&include_last_updated_at=true&vs_currencies=usd%2Ceur%2Ccny';
6-
export const MINTBASE_API_KEY_HEADER = 'mb-api-key';
1+
export const QUERY_OPS_PREFIX = "mintbase_js_data_";
2+
export const META_SERVICE_HOST = "https://api.mintbase.xyz";
3+
export const META_SERVICE_HOST_TESTNET =
4+
"https://surface-api-testnet-z3w7d7dnea-ew.a.run.app";
5+
export const BINANCE_API =
6+
"https://api.binance.com/api/v3/ticker/price?symbol=NEARUSDT";
7+
export const COIN_GECKO_API =
8+
"https://api.coingecko.com/api/v3/simple/price?ids=near%2Cusn%2Cjumbo-exchange&include_last_updated_at=true&vs_currencies=usd%2Ceur%2Ccny";
9+
export const MINTBASE_API_KEY_HEADER = "mb-api-key";

src/hooks/methods/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
export interface ParsedDataReturn<T> {
32
error?: null | string;
43
data?: T | null;

src/hooks/methods/utils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import { ParsedDataReturn } from './types';
1+
import { ParsedDataReturn } from "./types";
22

3-
export const parseData = <T>(data: T, error?: null | string, errorMsg?: string): ParsedDataReturn<T> => {
3+
export const parseData = <T>(
4+
data: T,
5+
error?: null | string,
6+
errorMsg?: string,
7+
): ParsedDataReturn<T> => {
48
if (error) {
59
console.error(errorMsg);
610
return { error: error };

src/hooks/useNearPrice.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { useEffect, useState } from 'react';
1+
import { useEffect, useState } from "react";
22

33
type UseNearPriceReturn = {
44
nearPrice: number;
55
error: string | null;
6-
}
6+
};
77

88
export const useNearPrice = (): UseNearPriceReturn => {
99
const [price, setPrice] = useState<number>(0);
@@ -28,32 +28,30 @@ export const useNearPrice = (): UseNearPriceReturn => {
2828
};
2929

3030
// Coppied from archived repo: https://github.com/Mintbase/mintbase-js/blob/1661bb879eae3ae4f3e525e69bb2c1aeed1ef77f/packages/data/src/api/nearPrice/nearPrice.ts#L17
31-
const BINANCE_API = 'https://api.binance.com/api/v3/ticker/price?symbol=NEARUSDT';
31+
const BINANCE_API =
32+
"https://api.binance.com/api/v3/ticker/price?symbol=NEARUSDT";
3233

3334
export interface ParsedDataReturn<T> {
3435
error?: null | string;
3536
data?: T | null;
3637
}
3738

38-
export interface NearPriceData {
39-
price?: string;
39+
export interface NearPriceData {
40+
price?: string;
4041
}
4142
export interface CoinGeckoNearPriceData {
42-
near?: {
43-
usd: string;
44-
};
43+
near?: {
44+
usd: string;
45+
};
4546
}
4647

47-
4848
export const nearPrice = async (): Promise<ParsedDataReturn<string>> => {
4949
try {
5050
const req = await fetch(BINANCE_API);
5151
const data: NearPriceData = await req.json();
52-
return {data: data.price || "0"};
52+
return { data: data.price || "0" };
5353
} catch (err: unknown) {
54-
console.error(
55-
`Failed to retrieve near price ${err}`,
56-
);
57-
return {data: "0"};
54+
console.error(`Failed to retrieve near price ${err}`);
55+
return { data: "0" };
5856
}
59-
};
57+
};

src/index.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1-
export * from './BitteWalletContext';
2-
export * from './hooks/useNearPrice';
3-
export type { Wallet, WalletModuleFactory, WalletModule, WalletBehaviourFactory, BrowserWallet, Account } from '@near-wallet-selector/core';
1+
export * from "./BitteWalletContext";
2+
export * from "./hooks/useNearPrice";
3+
export type {
4+
Wallet,
5+
WalletModuleFactory,
6+
WalletModule,
7+
WalletBehaviourFactory,
8+
BrowserWallet,
9+
Account,
10+
} from "@near-wallet-selector/core";

0 commit comments

Comments
 (0)