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.
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:
const FIREBASE_CONFIG = {
apiKey: 'AIzaSyCUefO7sAM0YafO3CVslIf8Tn7eRZbXI3s',
authDomain: 'ethernal-95a14.firebaseapp.com',
databaseURL: 'https://ethernal-95a14-default-rtdb.firebaseio.com',
projectId: 'ethernal-95a14',
storageBucket: 'ethernal-95a14.appspot.com',
messagingSenderId: '864612390560',
appId: '1:864612390560:web:b339dc0292ff15f7161bc5'
}
const firebase = require('firebase/app');
require('firebase/auth')
require('firebase/functions');
firebase.initializeApp(FIREBASE_CONFIG);
// Your Ethernal email/password combination
await firebase.auth().signInWithEmailAndPassword("[email protected]", "password");
From here, every call with be authentified with your credentials.
This lets you associate a name & an ABI to a synchronized contract.
await firebase.functions().httpsCallable('syncContractData')({
workspace: workspaceName,
name: contractName,
address: contractAddress,
abi: contractAbi
});
workspace
and address
parameters are mandatory, name
& abi
are optionalsThis will remove all accounts/blocks/transactions/contracts from the workspace
await firebase.functions().httpsCallable('resetWorkspace')({
workspace: workspaceName
});
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.
await firebase.functions().httpsCallable('importContract')({
workspace: workspaceName,
contractAddress: contractAddress
});
Last modified 10mo ago