Skip to content

Estimate

Before deploying or writing to a smart contract, you can estimate the gas cost of running the transaction.

Estimate Deploy

import { ChainId, KriptonioSdk } from '@kriptonio/sdk';
 
const sdk = new KriptonioSdk({
  accessToken: 'your-access-token',
});
 
const wallet = await sdk.wallet.generate({ chainId: ChainId.BaseSepolia, type: 'kernel' });
const smartContract = await sdk.smartContract.get({ id: '<id>', wallet });

 
// estimateDeploy accepts an optional array of constructor arguments
const estimation = await smartContract.estimateDeploy({
  params: [],
});

Estimate Write

import { ChainId, KriptonioSdk } from '@kriptonio/sdk';
 
const sdk = new KriptonioSdk({
  accessToken: 'your-access-token',
});
 
const wallet = await sdk.wallet.generate({ chainId: ChainId.BaseSepolia, type: 'kernel' });
const smartContract = await sdk.smartContract.get({ id: '<id>', wallet });

 
const estimation = await smartContract.estimate('functionName', {
  params: [],
});