Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0xSequence package update #31

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"private": true,
"devDependencies": {
"0xsequence": "^1.2.6",
"0xsequence": "^1.6.2",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@walletconnect/core": "^2.10.2",
Expand Down
22 changes: 21 additions & 1 deletion frontend/src/chains.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { SequenceIndexerServices } from "@0xsequence/indexer"
import {
mainnet,
goerli,
Expand All @@ -25,6 +24,27 @@ export type ChainId = keyof typeof CHAINS

export const DEFAULT_CHAIN = CHAINS[5]

export enum SequenceIndexerServices {
MAINNET = "https://mainnet-indexer.sequence.app",

POLYGON = "https://polygon-indexer.sequence.app",
POLYGON_MUMBAI = "https://mumbai-indexer.sequence.app",

POLYGON_ZKEVM = "https://polygon-zkevm-indexer.sequence.app",

ARBITRUM = "https://arbitrum-indexer.sequence.app",
ARBITRUM_NOVA = "https://arbitrum-nova-indexer.sequence.app",

OPTIMISM = "https://optimism-indexer.sequence.app",
AVALANCHE = "https://avalanche-indexer.sequence.app",
GNOSIS = "https://gnosis-indexer.sequence.app",

BSC = "https://bsc-indexer.sequence.app",
BSC_TESTNET = "https://bsc-testnet-indexer.sequence.app",

GOERLI = "https://goerli-indexer.sequence.app",
}

export const SEQUENCER_ENDPOINTS: Record<ChainId, SequenceIndexerServices> = {
1: SequenceIndexerServices.MAINNET,
5: SequenceIndexerServices.GOERLI,
Expand Down
9 changes: 6 additions & 3 deletions frontend/src/hooks/useTokenBalances.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
SequenceIndexerClient,
SequenceIndexer,
TokenBalance,
ContractType,
} from "@0xsequence/indexer"
Expand All @@ -13,6 +13,8 @@ interface Props {
tokenId?: string
}

const API_KEY = process.env.REACT_APP_SEQUENCE_API_KEY || ""

const useTokenBalances = ({
accountAddress,
chainId,
Expand All @@ -24,8 +26,9 @@ const useTokenBalances = ({
const [error, setError] = useState<any>(null)

useEffect(() => {
const indexer = new SequenceIndexerClient(
SEQUENCER_ENDPOINTS[chainId as ChainId]
const indexer = new SequenceIndexer(
SEQUENCER_ENDPOINTS[chainId as ChainId],
API_KEY
)
const fetchData = async () => {
try {
Expand Down
Loading
Loading