Skip to content

Commit

Permalink
Merge pull request #31 from gnosis/update-sequence
Browse files Browse the repository at this point in the history
`0xSequence` package update
  • Loading branch information
jfschwarz authored Jan 3, 2024
2 parents 24068cc + dd376bb commit a6b4621
Show file tree
Hide file tree
Showing 4 changed files with 184 additions and 160 deletions.
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

1 comment on commit a6b4621

@vercel
Copy link

@vercel vercel bot commented on a6b4621 Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.