Hey! Iâm following your tutorial here: https://docs.moralis.io/docs/using-firebase except for that I want to use the cloud function http.onRequest instead of .onCall as you have in the example. However, Iâm getting this error when Iâm trying to build:
src/index.ts:23:7 - error TS2322: Type âstring | string[] | ParsedQs | ParsedQs[] | undefinedâ is not assignable to type âEvmAddressishâ.
Type âundefinedâ is not assignable to type âEvmAddressishâ.
23 address: address,
node_modules/@moralisweb3/common-evm-utils/lib/operations/balance/getNativeBalanceOperation.d.ts:11:5
11 address: EvmAddressish;
The expected type comes from property âaddressâ which is declared here on type âGetNativeBalanceRequestâ
This is my code:
import * as functions from "firebase-functions";
import * as admin from "firebase-admin";
import {EvmChain} from "@moralisweb3/common-evm-utils";
import Moralis from "moralis";
admin.initializeApp(functions.config().firebase);
Moralis.start({
apiKey: "my_api_key",
});
// // Start writing functions
// // https://firebase.google.com/docs/functions/typescript
export const getBalance = functions.https.onRequest(async (req, res) => {
const address = req.query.address;
const result = await Moralis.EvmApi.balance.getNativeBalance({
chain: EvmChain.ETHEREUM,
address: address,
});
const usd = result.raw;
res.json({usd});
});