Skip to content

Generate a Wallet

You can easily generate a new non custodial smart or classic wallet using the Kriptonio SDK.

Smart Wallet

Smart Wallet is the default and recommended wallet type. Just call the generate method on wallet and provide a chainId and smart wallet type to generate a new wallet.

import { KriptonioSdk, ChainId } from '@kriptonio/sdk';
 
const sdk = new KriptonioSdk({
  accessToken: 'your-access-token',
});
 

const wallet = await sdk.wallet.generate({
  chainId: ChainId.Polygon,
  type: 'kernel',
});

Under the hood, this generates RPC and Paymaster endpoints for the created wallet. You can access them via the Kriptonio Web app to see stats, logs, and usage.

You can inspect the wallet address via the wallet.address property.

How to disable Paymaster

By default, all transactions going from this wallet will be sponsored by Kriptonio Paymaster. You can disable this, but in that case, you have to ensure that you have enough funds on the wallet to pay for the transaction gas cost.

import { ChainId, KriptonioSdk } from '@kriptonio/sdk';
 
const sdk = new KriptonioSdk({
  accessToken: 'your-access-token',
});
 

const wallet = await sdk.wallet.generate({
  chainId: ChainId.Polygon,
  type: 'kernel',

  paymaster: {
    disabled: true,
  },
});

Classic Wallet (EOA)

To generate a classic wallet secured by a private key, provide type as eoa to the generate method.

import { KriptonioSdk, ChainId } from '@kriptonio/sdk';
 
const sdk = new KriptonioSdk({
  accessToken: 'your-access-token',
});
 

const wallet = await sdk.wallet.generate({
  chainId: ChainId.Polygon,
  type: 'eoa', 
});