Avalanche testnet error: {"message":"required param address not provided","code":141}

I’m following the NFT marketplace tutorial but I noticed that the tutorial’s react-moralis library does not support Avalanche Fuji testnet.

So I went to add it under C:\react\ethereum-nft-marketplace-boilerplate\node_modules\react-moralis\lib\hooks\useMoralisWeb3Api\useMoralisWeb3Api.d.ts

But I’m getting the error below.

2022-01-13T10:27:28.715Z - Failed running cloud function getNFTs for user undefined with:
  Input: {"chain":"0xa869"}
  Error: {"message":"required param address not provided","code":141}
2022-01-13T10:27:26.040Z - Error: Invalid hex number
    at fetch (/moralis-server/lib/cloud-code/plugins/convenience/web3Api.js:165:26)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-01-13T10:27:26.038Z - Failed running cloud function getAllTokenIds for user undefined with:
  Input: {"chain":"0xa869","address":"explore","limit":10}
  Error: {"message":"Invalid hex number","code":141}

Below is the entire useMoralisWeb3Api.d.ts code on how I added Avalanche testnet.

Generally, I added | "fuji" | "0xa869" | at the end of some arrays. FYI, I’m learning React the first time in my life thanks to you guys :slight_smile:

Any kind of help is super appreciated.

import { UseResolveCallOptions } from "../_useResolveAsyncCall";
export interface UseMoralisWeb3ApiCallOptions extends UseResolveCallOptions {
}
export declare const useMoralisWeb3ApiCall: <Params extends object, Result>(call: (params: Params) => Promise<Result>, params?: Params | undefined, options?: UseMoralisWeb3ApiCallOptions | undefined) => {
    fetch: ({ throwOnError, onComplete, onError, onSuccess, params: fetchParams, }?: import("../_useResolveAsyncCall").ResolveCallOptions<Result | null, Params>) => Promise<void>;
    isFetching: boolean;
    isLoading: boolean;
    error: Error | null;
    data: Result | null;
    setData: import("use-immer").Updater<Result | null>;
};
export declare const useMoralisWeb3Api: () => {
    initialize: (serverUrl: string) => void;
    native: {
        getBlock: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            subdomain?: string | undefined;
        } & {
            block_number_or_hash: string;
        }) => Promise<{
            timestamp: string;
            number: string;
            hash: string;
            parent_hash: string;
            nonce: string;
            sha3_uncles: string;
            logs_bloom: string;
            transactions_root: string;
            state_root: string;
            receipts_root: string;
            miner: string;
            difficulty: string;
            total_difficulty: string;
            size: string;
            extra_data: string;
            gas_limit: string;
            gas_used: string;
            transaction_count: string;
            transactions: {
                hash: string;
                nonce: string;
                transaction_index: string;
                from_address: string;
                to_address: string;
                value: string;
                gas?: string | undefined;
                gas_price: string;
                input: string;
                receipt_cumulative_gas_used: string;
                receipt_gas_used: string;
                receipt_contract_address?: string | undefined;
                receipt_root?: string | undefined;
                receipt_status: string;
                block_timestamp: string;
                block_number: string;
                block_hash: string;
                logs: {
                    log_index: string;
                    transaction_hash: string;
                    transaction_index: string;
                    address: string;
                    data: string;
                    topic0: string;
                    topic1?: string | undefined;
                    topic2?: string | undefined;
                    topic3?: string | undefined;
                    block_timestamp: string;
                    block_number: string;
                    block_hash: string;
                }[];
            }[];
        }>;
        getDateToBlock: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            providerUrl?: string | undefined;
            date: string;
        }) => Promise<{
            date: number;
            block: number;
            timestamp: number;
        }>;
        getLogsByAddress: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            subdomain?: string | undefined;
            block_number?: string | undefined;
            from_block?: string | undefined;
            to_block?: string | undefined;
            from_date?: string | undefined;
            to_date?: string | undefined;
            topic0?: string | undefined;
            topic1?: string | undefined;
            topic2?: string | undefined;
            topic3?: string | undefined;
        } & {
            address: string;
        }) => Promise<{
            transaction_hash: string;
            address: string;
            block_timestamp: string;
            block_number: string;
            block_hash: string;
            data: string;
            topic0: string;
            topic1: string;
            topic2: string;
            topic3: string;
        }>;
        getNFTTransfersByBlock: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            subdomain?: string | undefined;
        } & {
            block_number_or_hash: string;
        }) => Promise<{
            total: number;
            page: number;
            page_size: number;
            result: {
                token_address: string;
                token_id: string;
                from_address?: string | undefined;
                to_address: string;
                value?: string | undefined;
                amount?: string | undefined;
                contract_type: string;
                block_number: string;
                block_timestamp: string;
                block_hash: string;
                transaction_hash: string;
                transaction_type?: string | undefined;
                transaction_index?: string | undefined;
                log_index: number;
                operator?: string | undefined;
            }[];
        }>;
        getTransaction: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            subdomain?: string | undefined;
        } & {
            transaction_hash: string;
        }) => Promise<{
            hash: string;
            nonce: string;
            transaction_index: string;
            from_address: string;
            to_address: string;
            value: string;
            gas?: string | undefined;
            gas_price: string;
            input: string;
            receipt_cumulative_gas_used: string;
            receipt_gas_used: string;
            receipt_contract_address?: string | undefined;
            receipt_root?: string | undefined;
            receipt_status: string;
            block_timestamp: string;
            block_number: string;
            block_hash: string;
            logs: {
                log_index: string;
                transaction_hash: string;
                transaction_index: string;
                address: string;
                data: string;
                topic0: string;
                topic1?: string | undefined;
                topic2?: string | undefined;
                topic3?: string | undefined;
                block_timestamp: string;
                block_number: string;
                block_hash: string;
            }[];
        }>;
        getContractEvents: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            subdomain?: string | undefined;
            providerUrl?: string | undefined;
            from_block?: number | undefined;
            to_block?: number | undefined;
            from_date?: string | undefined;
            to_date?: unknown;
            topic: string;
            offset?: number | undefined;
            limit?: number | undefined;
        } & {
            address: string;
        }) => Promise<{
            transaction_hash: string;
            address: string;
            block_timestamp: string;
            block_number: string;
            block_hash: string;
            data: {
                [key: string]: unknown;
            };
        }[]>;
        runContractFunction: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            subdomain?: string | undefined;
            providerUrl?: string | undefined;
            function_name: string;
        } & {
            address: string;
        }) => Promise<string>;
    };
    account: {
        getTransactions: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            subdomain?: string | undefined;
            from_block?: number | undefined;
            to_block?: number | undefined;
            from_date?: string | undefined;
            to_date?: unknown;
            offset?: number | undefined;
            limit?: number | undefined;
        } & {
            address: string;
        }) => Promise<{
            total?: number | undefined;
            page?: number | undefined;
            page_size?: number | undefined;
            result?: {
                hash: string;
                nonce: string;
                transaction_index: string;
                from_address: string;
                to_address: string;
                value: string;
                gas: string;
                gas_price: string;
                input: string;
                receipt_cumulative_gas_used: string;
                receipt_gas_used: string;
                receipt_contract_address: string;
                receipt_root: string;
                receipt_status: string;
                block_timestamp: string;
                block_number: string;
                block_hash: string;
            }[] | undefined;
        }>;
        getNativeBalance: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            providerUrl?: string | undefined;
            to_block?: number | undefined;
        } & {
            address: string;
        }) => Promise<{
            balance: string;
        }>;
        getTokenBalances: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            subdomain?: string | undefined;
            to_block?: number | undefined;
        } & {
            address: string;
        }) => Promise<{
            token_address: string;
            name: string;
            symbol: string;
            logo?: string | undefined;
            thumbnail?: string | undefined;
            decimals: string;
            balance: string;
        }[]>;
        getTokenTransfers: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            subdomain?: string | undefined;
            from_block?: number | undefined;
            to_block?: number | undefined;
            from_date?: string | undefined;
            to_date?: unknown;
            offset?: number | undefined;
            limit?: number | undefined;
        } & {
            address: string;
        }) => Promise<{
            transaction_hash: string;
            address: string;
            block_timestamp: string;
            block_number: string;
            block_hash: string;
            to_address: string;
            from_address: string;
            value: string;
        }[]>;
        getNFTs: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            format?: "decimal" | "hex" | undefined;
            offset?: number | undefined;
            limit?: number | undefined;
            order?: string | undefined;
        } & {
            address: string;
        }) => Promise<{
            status?: string | undefined;
            total?: number | undefined;
            page?: number | undefined;
            page_size?: number | undefined;
            result?: {
                token_address: string;
                token_id: string;
                contract_type: string;
                owner_of: string;
                block_number: string;
                block_number_minted: string;
                token_uri?: string | undefined;
                metadata?: string | undefined;
                synced_at?: string | undefined;
                amount?: string | undefined;
                name: string;
                symbol: string;
            }[] | undefined;
        }>;
        getNFTTransfers: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            format?: "decimal" | "hex" | undefined;
            direction?: "both" | "to" | "from" | undefined;
            offset?: number | undefined;
            limit?: number | undefined;
            order?: string | undefined;
        } & {
            address: string;
        }) => Promise<{
            total: number;
            page: number;
            page_size: number;
            result: {
                token_address: string;
                token_id: string;
                from_address?: string | undefined;
                to_address: string;
                value?: string | undefined;
                amount?: string | undefined;
                contract_type: string;
                block_number: string;
                block_timestamp: string;
                block_hash: string;
                transaction_hash: string;
                transaction_type?: string | undefined;
                transaction_index?: string | undefined;
                log_index: number;
                operator?: string | undefined;
            }[];
        }>;
        getNFTsForContract: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            format?: "decimal" | "hex" | undefined;
            offset?: number | undefined;
            limit?: number | undefined;
            order?: string | undefined;
        } & {
            address: string;
            token_address?: string | undefined;
        }) => Promise<{
            status?: string | undefined;
            total?: number | undefined;
            page?: number | undefined;
            page_size?: number | undefined;
            result?: {
                token_address: string;
                token_id: string;
                contract_type: string;
                owner_of: string;
                block_number: string;
                block_number_minted: string;
                token_uri?: string | undefined;
                metadata?: string | undefined;
                synced_at?: string | undefined;
                amount?: string | undefined;
                name: string;
                symbol: string;
            }[] | undefined;
        }>;
    };
    token: {
        getTokenMetadata: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            subdomain?: string | undefined;
            providerUrl?: string | undefined;
            addresses: string[];
        }) => Promise<{
            address: string;
            name: string;
            symbol: string;
            decimals: string;
            logo?: string | undefined;
            logo_hash?: string | undefined;
            thumbnail?: string | undefined;
            block_number?: string | undefined;
            validated?: string | undefined;
        }[]>;
        getTokenMetadataBySymbol: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            subdomain?: string | undefined;
            symbols: string[];
        }) => Promise<{
            address: string;
            name: string;
            symbol: string;
            decimals: string;
            logo?: string | undefined;
            logo_hash?: string | undefined;
            thumbnail?: string | undefined;
            block_number?: string | undefined;
            validated?: string | undefined;
        }[]>;
        getTokenPrice: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            providerUrl?: string | undefined;
            exchange?: string | undefined;
            to_block?: number | undefined;
        } & {
            address: string;
        }) => Promise<{
            nativePrice?: {
                value: string;
                decimals: number;
                name: string;
                symbol: string;
            } | undefined;
            usdPrice: number;
            exchangeAddress?: string | undefined;
            exchangeName?: string | undefined;
        } & {
            symbol: unknown;
        }>;
        getTokenAdressTransfers: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            subdomain?: string | undefined;
            from_block?: number | undefined;
            to_block?: number | undefined;
            from_date?: string | undefined;
            to_date?: unknown;
            offset?: number | undefined;
            limit?: number | undefined;
        } & {
            address: string;
        }) => Promise<{
            transaction_hash: string;
            address: string;
            block_timestamp: string;
            block_number: string;
            block_hash: string;
            to_address: string;
            from_address: string;
            value: string;
        }[]>;
        getTokenAllowance: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            providerUrl?: string | undefined;
            owner_address: string;
            spender_address: string;
        } & {
            address: string;
        }) => Promise<{
            allowance: string;
        }>;
        searchNFTs: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            format?: "decimal" | "hex" | undefined;
            q: string;
            filter?: "name" | "description" | "attributes" | "global" | "name,description" | "name,attributes" | "description,attributes" | "name,description,attributes" | undefined;
            offset?: number | undefined;
            limit?: number | undefined;
        }) => Promise<{
            total?: number | undefined;
            page?: number | undefined;
            page_size?: number | undefined;
            result?: ({
                token_address: string;
                token_id: string;
                contract_type: string;
                token_uri: string;
                metadata: string;
                synced_at: string;
            } & {
                token_hash: unknown;
            })[] | undefined;
        }>;
        getAllTokenIds: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            format?: "decimal" | "hex" | undefined;
            offset?: number | undefined;
            limit?: number | undefined;
            order?: string | undefined;
        } & {
            address: string;
        }) => Promise<{
            total?: number | undefined;
            page?: number | undefined;
            page_size?: number | undefined;
            result?: {
                token_address: string;
                token_id: string;
                contract_type: string;
                token_uri?: string | undefined;
                metadata?: string | undefined;
                synced_at?: string | undefined;
                amount?: string | undefined;
                name: string;
                symbol: string;
            }[] | undefined;
        }>;
        getContractNFTTransfers: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            format?: "decimal" | "hex" | undefined;
            offset?: number | undefined;
            limit?: number | undefined;
            order?: string | undefined;
        } & {
            address: string;
        }) => Promise<{
            total: number;
            page: number;
            page_size: number;
            result: {
                token_address: string;
                token_id: string;
                from_address?: string | undefined;
                to_address: string;
                value?: string | undefined;
                amount?: string | undefined;
                contract_type: string;
                block_number: string;
                block_timestamp: string;
                block_hash: string;
                transaction_hash: string;
                transaction_type?: string | undefined;
                transaction_index?: string | undefined;
                log_index: number;
                operator?: string | undefined;
            }[];
        }>;
        getNFTOwners: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            format?: "decimal" | "hex" | undefined;
            offset?: number | undefined;
            limit?: number | undefined;
            order?: string | undefined;
        } & {
            address: string;
        }) => Promise<{
            status?: string | undefined;
            total?: number | undefined;
            page?: number | undefined;
            page_size?: number | undefined;
            result?: {
                token_address: string;
                token_id: string;
                contract_type: string;
                owner_of: string;
                block_number: string;
                block_number_minted: string;
                token_uri?: string | undefined;
                metadata?: string | undefined;
                synced_at?: string | undefined;
                amount?: string | undefined;
                name: string;
                symbol: string;
            }[] | undefined;
        }>;
        getNFTMetadata: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
        } & {
            address: string;
        }) => Promise<{
            token_address: string;
            name: string;
            abi?: string | undefined;
            supports_token_uri?: number | undefined;
            synced_at?: string | undefined;
            symbol: string;
            contract_type: string;
        }>;
        getTokenIdMetadata: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            format?: "decimal" | "hex" | undefined;
        } & {
            address: string;
            token_id: string;
        }) => Promise<{
            token_address: string;
            token_id: string;
            contract_type: string;
            token_uri?: string | undefined;
            metadata?: string | undefined;
            synced_at?: string | undefined;
            amount?: string | undefined;
            name: string;
            symbol: string;
        }>;
        getTokenIdOwners: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            format?: "decimal" | "hex" | undefined;
            offset?: number | undefined;
            limit?: number | undefined;
            order?: string | undefined;
        } & {
            address: string;
            token_id: string;
        }) => Promise<{
            status?: string | undefined;
            total?: number | undefined;
            page?: number | undefined;
            page_size?: number | undefined;
            result?: {
                token_address: string;
                token_id: string;
                contract_type: string;
                owner_of: string;
                block_number: string;
                block_number_minted: string;
                token_uri?: string | undefined;
                metadata?: string | undefined;
                synced_at?: string | undefined;
                amount?: string | undefined;
                name: string;
                symbol: string;
            }[] | undefined;
        }>;
        getWalletTokenIdTransfers: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            format?: "decimal" | "hex" | undefined;
            offset?: number | undefined;
            limit?: number | undefined;
            order?: string | undefined;
        } & {
            address: string;
            token_id: string;
        }) => Promise<{
            total: number;
            page: number;
            page_size: number;
            result: {
                token_address: string;
                token_id: string;
                from_address?: string | undefined;
                to_address: string;
                value?: string | undefined;
                amount?: string | undefined;
                contract_type: string;
                block_number: string;
                block_timestamp: string;
                block_hash: string;
                transaction_hash: string;
                transaction_type?: string | undefined;
                transaction_index?: string | undefined;
                log_index: number;
                operator?: string | undefined;
            }[];
        }>;
    };
    resolve: {
        resolveDomain: (options: {
            currency?: "eth" | "0x1" | undefined;
        } & {
            domain: string;
        }) => Promise<{
            address: string;
        }>;
    };
    defi: {
        getPairReserves: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            to_block?: string | undefined;
            to_date?: unknown;
            provider_url?: string | undefined;
        } & {
            pair_address: string;
        }) => Promise<{
            reserve0: string;
            reserve1: string;
        }>;
        getPairAddress: (options: {
            chain?: "eth" | "0x1" | "ropsten" | "0x3" | "rinkeby" | "0x4" | "goerli" | "0x5" | "kovan" | "0x2a" | "polygon" | "0x89" | "mumbai" | "0x13881" | "bsc" | "0x38" | "bsc testnet" | "0x61" | "avalanche" | "0xa86a" | "fuji" | "0xa869" | undefined;
            to_block?: string | undefined;
            to_date?: unknown;
            exchange: "uniswapv2" | "uniswapv3" | "sushiswapv2" | "pancakeswapv2" | "pancakeswapv1" | "quickswap";
        } & {
            token0_address: string;
            token1_address: string;
        }) => Promise<{
            reserve0: string;
            reserve1: string;
        }>;
    };
    storage: {
        uploadFolder: () => Promise<{
            path: string;
        }[]>;
    };
    Web3API: typeof import("moralis/types").Moralis.Web3API;
};

From that error it looks like you also need to provide other parameters besides the chain id

1 Like

I’ve checked but I couldn’t find any other parameters that might be missing. Cos what I did was follow the rest of the blockchain that is added on the boilerplate code.

Is it possible that your team could update the react-moralis library so that it supports the AVAX testnet? I’m doing this cos I’m joining your avalanche hackathon. I think this will absolutely benefit the other participants.

What do you think?

It should be now, I think you will need update the react-moralis version to the latest one because fuji has not included in our SDK when the tutorial comes out :raised_hands: let me know if you still find any issue

Oh great @YosephKS. Terima kasih!

But I’m sooo new to all this cos I’m an old-school coder. Jut got back to coding after 15 year of absence. How do you update the SDK? Do I run npm update or yarn upgrade or something else?

1 Like

I just did yarn upgrade --latest and I got this. I think below is the latest.

  "name": "react-moralis",
  "version": "0.3.11",

But I’m still getting the error below from dashboard log, although my browser console.log has stopped seeing red.

2022-01-13T09:26:30.751Z - Failed running cloud function getNFTs for user undefined with:
  Input: {"chain":"0xa869"}
  Error: {"message":"required param address not provided","code":141}

Great seems like it’s the latest version, btw can you show me how do you call the getNFTs web3 API? do you by any chance just include the chain as the only params?

The file below is taken from https://github.com/ethereum-boilerplate/ethereum-nft-marketplace-boilerplate/blob/main/src/hooks/useNFTBalance.js. I did not change anything.

See the } = useMoralisWeb3ApiCall(account.getNFTs, { chain: chainId, ...options });

import { useMoralisDapp } from "providers/MoralisDappProvider/MoralisDappProvider";
import { useEffect, useState } from "react";
import { useMoralisWeb3Api, useMoralisWeb3ApiCall } from "react-moralis";
import { useIPFS } from "./useIPFS";

export const useNFTBalance = (options) => {
  const { account } = useMoralisWeb3Api();
  const { chainId } = useMoralisDapp();
  const { resolveLink } = useIPFS();
  const [NFTBalance, setNFTBalance] = useState([]);
  const {
    fetch: getNFTBalance,
    data,
    error,
    isLoading,
  } = useMoralisWeb3ApiCall(account.getNFTs, { chain: chainId, ...options });
  const [fetchSuccess, setFetchSuccess] = useState(true);

  useEffect(async () => {
    if (data?.result) {
      const NFTs = data.result;
      setFetchSuccess(true);
      for (let NFT of NFTs) {
        if (NFT?.metadata) {
          NFT.metadata = JSON.parse(NFT.metadata);
          NFT.image = resolveLink(NFT.metadata?.image);
        } else if (NFT?.token_uri) {
          try {
            await fetch(NFT.token_uri)
              .then((response) => response.json())
              .then((data) => {
                NFT.image = resolveLink(data.image);
              });
          } catch (error) {
            setFetchSuccess(false);

/*          !!Temporary work around to avoid CORS issues when retrieving NFT images!!
            Create a proxy server as per https://dev.to/terieyenike/how-to-create-a-proxy-server-on-heroku-5b5c
            Replace <your url here> with your proxy server_url below
            Remove comments :)

              try {
                await fetch(`<your url here>/${NFT.token_uri}`)
                .then(response => response.json())
                .then(data => {
                  NFT.image = resolveLink(data.image);
                });
              } catch (error) {
                setFetchSuccess(false);
              }

 */
          }
        }
      }
      setNFTBalance(NFTs);
    }
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [data]);

  return { getNFTBalance, NFTBalance, fetchSuccess, error, isLoading };
};

Actually, now I can’t see any of my NFTs on ETH, Mumbai or Avalanche Fuji. Previously before upgrade I could. Funny thing is now browser console doesn’t show anymore error.

I have a few NFTs as shown here - https://testnet.snowtrace.io/tokentxns-nft?a=0xCA6c272710698bbF3358c8131035CbD2AFDFea67

Hmmmm that’s quite strange :thinking: ohh btw just wondering when you upgraded the react-moralis did you try to upgrade moralis SDK too?

Oh, moralis SDK is different? OMG. Hang on, let me check out how to do it.

Ok, I’m doing it now.

Ok done. But I’m still getting the same status quo as after I upgraded react-moralis. Error with function getNFTs and seeing no Nfts on the site

What you call getNFTs, you are authenticated or you set the address parameter?

To be honest, I’m not sure. Cos your colleague wrote it -> https://www.youtube.com/watch?v=WZWCzsB1xUE

But I think it’s to call your Moralis server to get the list of NFTs from my wallet. So, I have Moralis server connected to Avalanche testnet and my React connects to it to get my list of NFTs. I’m using the same address to login to my React site - 0xCA6c272710698bbF3358c8131035CbD2AFDFea67

And here’s the screenshot.

Strange :thinking: what if you try to specify the address param with your address?

I really have no idea how to specify it to be honest. I only started learning react today. I’m a Java, PHP, vanilla JS kinda guy…lol. React is quite out of this world to me.

WAit. Here’s the funny thing. I stopped running my React site for 30 mins already and the error is still appearing on my dashboard log. Perhaps there’s someone to do with your server?

if you restart the server the logs will also reset, in case that it would help you

1 Like

Do u mean restart my moralis server or my react site?