Contract Import
Importing a Contract​
Requirements​
Before importing a contract, ensure you have:
- Contract must be deployed on a supported network
- You need the contract address and ABI (must be formatted using abitype or viem)
- Admin or Editor role required
ABI Format​
MOUNTAIN requires formatted ABI strings. See: ABI Format Guide
API Endpoint​
Example Request​
import { ContractApi } from '@kyuzan/mountain-public-api-client';
const contractApi = new ContractApi();
const importedContract = await contractApi.importContract({
networkId: 1, // Ethereum Mainnet
address: '0x1234567890123456789012345678901234567890',
formattedAbi: [
'function mint(address to, uint256 amount)',
'function transfer(address to, uint256 amount) returns (bool)',
'event Transfer(address indexed from, address indexed to, uint256 value)',
],
});
console.log('Contract imported:', importedContract.contract);
Activating Contract Functions​
After importing, you need to activate specific functions to make them callable through MOUNTAIN APIs.
API Endpoint​
Example Request​
const activatedFunction = await contractApi.activateContractFunction({
contractId: importedContract.contract.id,
formattedAbiFunction: 'function mint(address to, uint256 amount)',
});
console.log('Function activated:', activatedFunction.contractActivatedFunction);