Skip to content

Send Transaction

After you have created or imported a wallet, you can send a transaction.

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 hash = await wallet.sendTransaction({
  to: wallet.address,
  value: 0n,
});

If the wallet is a smart wallet, gas will be automatically sponsored by Kriptonio (if paymaster is enabled, which is the default option). In the case of a classic wallet, you will need to have enough funds to cover the gas cost.

Also, in the case of a smart wallet, in the background, we will send a user operation instead of a regular transaction that is being sent from a classic wallet.

Estimate Gas

You can estimate the gas cost of a transaction before sending it.

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 estimation = await wallet.estimateGas({
  to: wallet.address,
  value: 0n,
});