diff --git a/src/config.ts b/src/config.ts index b968229ed..f61583558 100644 --- a/src/config.ts +++ b/src/config.ts @@ -25,6 +25,7 @@ export const networks: Record = { apiNearBlocks: 'https://api.nearblocks.io', ftContract: 'tkn.primitives.near', nftContract: 'nft.primitives.near', + fastNearApi: 'https://api.fastnear.com', }, testnet: { networkId: 'testnet', @@ -50,6 +51,7 @@ export const networks: Record = { apiNearBlocks: 'https://api-testnet.nearblocks.io', ftContract: 'tkn.primitives.testnet', nftContract: 'nft.primitives.testnet', + fastNearApi: 'https://test.api.fastnear.com', }, // localnet: { diff --git a/src/hooks/useNFT.ts b/src/hooks/useNFT.ts index 0368863b1..1d2ef12f2 100644 --- a/src/hooks/useNFT.ts +++ b/src/hooks/useNFT.ts @@ -1,6 +1,7 @@ import { useCallback, useContext, useEffect, useState } from 'react'; import { NearContext } from '@/components/wallet-selector/WalletSelector'; +import { network } from '@/config'; import type { Metadata, NFT } from '@/utils/types'; export interface Fastnear { @@ -22,7 +23,7 @@ export interface NFTConsult { } export const accounts_nft = async (accountId: string): Promise => { - const response = await fetch(`https://api.fastnear.com/v1/account/${accountId}/nft`); + const response = await fetch(`${network.fastNearApi}/v1/account/${accountId}/nft`); return await response.json(); }; diff --git a/src/hooks/useNearBlocksTxns.ts b/src/hooks/useNearBlocksTxns.ts index a07cfe1ae..a8aa4eb72 100644 --- a/src/hooks/useNearBlocksTxns.ts +++ b/src/hooks/useNearBlocksTxns.ts @@ -78,6 +78,11 @@ const useNearBlocksTxns = (contract: string, method: string) => { throw new Error('Network response was not ok'); } const data = await response.json(); + console.log( + 'pepe grillo', + data.txns.filter((txn: Txns) => txn.outcomes.status), + ); + setTransactions(data.txns.filter((txn: Txns) => txn.outcomes.status)); setLoading(false); } catch (err) { @@ -96,7 +101,7 @@ const useNearBlocksTxns = (contract: string, method: string) => { if (!wallet || !signedAccountId) return; fetchTransactions(); }, [contract, method, wallet, signedAccountId, fetchTransactions]); - + console.log('pepe grillo trans', transactions); return { transactions, loading, error, reloadTokens: fetchTransactions }; }; diff --git a/src/hooks/useTokens.ts b/src/hooks/useTokens.ts index 45a0f5013..403b46ebf 100644 --- a/src/hooks/useTokens.ts +++ b/src/hooks/useTokens.ts @@ -2,6 +2,7 @@ import { useCallback, useContext, useEffect, useState } from 'react'; import NearIconSvg from '@/components/sidebar-navigation/icons/near-icon.svg'; import { NearContext } from '@/components/wallet-selector/WalletSelector'; +import { network } from '@/config'; import whiteList from '@/utils/white-list.json'; export interface FastNearFT { @@ -16,7 +17,7 @@ export interface TokenFastNear { } export const accounts_ft = async (accountId: string): Promise => { - const response = await fetch(`https://api.fastnear.com/v1/account/${accountId}/ft`); + const response = await fetch(`${network.fastNearApi}/v1/account/${accountId}/ft`); return (await response.json()) as FastNearFT; }; diff --git a/src/utils/types.ts b/src/utils/types.ts index 8fa5da167..a0e4703fa 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -34,6 +34,7 @@ type ProductionNetwork = { apiNearBlocks: string; ftContract: string; nftContract: string; + fastNearApi: string; }; export interface TosData {