Firebase Functions Direct Access
It is possible to call Firebase Functions directly without going through the CLI or the Hardhat plugin. This might be useful in a few use cases where you are trying to automate certain tasks and integrate Ethernal in your workflow.
This page will explain how to use the most common ones. Other functions are accessible but are less relevant. If there is a certain task you would like to automate and need more endpoints that these ones, please reach out by email or on Discord.

Setup

You need to add the firebase package to your project. Examples below are for versions lower than 9.
First, you'll need to initialize firebase with Ethernal's configuration. If you are self-hosting, you can replace those values with your own:
1
const FIREBASE_CONFIG = {
2
apiKey: 'AIzaSyCUefO7sAM0YafO3CVslIf8Tn7eRZbXI3s',
3
authDomain: 'ethernal-95a14.firebaseapp.com',
4
databaseURL: 'https://ethernal-95a14-default-rtdb.firebaseio.com',
5
projectId: 'ethernal-95a14',
6
storageBucket: 'ethernal-95a14.appspot.com',
7
messagingSenderId: '864612390560',
8
appId: '1:864612390560:web:b339dc0292ff15f7161bc5'
9
}
10
const firebase = require('firebase/app');
11
require('firebase/auth')
12
require('firebase/functions');
13
firebase.initializeApp(FIREBASE_CONFIG);
14
15
// Your Ethernal email/password combination
16
await firebase.auth().signInWithEmailAndPassword("[email protected]", "password");
Copied!
From here, every call with be authentified with your credentials.

Synchronize contract metadata

This lets you associate a name & an ABI to a synchronized contract.
1
await firebase.functions().httpsCallable('syncContractData')({
2
workspace: workspaceName,
3
name: contractName,
4
address: contractAddress,
5
abi: contractAbi
6
});
Copied!
workspace and address parameters are mandatory, name & abi are optionals

Reset a workspace

This will remove all accounts/blocks/transactions/contracts from the workspace
1
await firebase.functions().httpsCallable('resetWorkspace')({
2
workspace: workspaceName
3
});
Copied!

Import a contract

This will add a contract at the specified address in the workspace. This will also trigger a fetch from the scanner (Etherscan, Bscscan, etc...) if applicable.
1
await firebase.functions().httpsCallable('importContract')({
2
workspace: workspaceName,
3
contractAddress: contractAddress
4
});
Copied!