Before doing anything with the SDK, we must instantiate it. This will create the Etherspot smart account based off of the values we pass in.

Step 1. Import the Etherspot Prime SDK.

  import { PrimeSdk } from '@etherspot/prime-sdk';

Step 2. Instantiate the SDK with a private key using this line of code.

  const primeSdk = new PrimeSdk({ privateKey: WALLET_PRIVATE_KEY }, { chainId: Number(CHAIN_ID) })

And that’s it! You’re now ready to call any of the Prime SDK functions.

If you want to use a different bundler than the Etherspot bundler we have hosted on each network, you can specify a different one like this:

  const primeSdk = new PrimeSdk({ privateKey: WALLET_PRIVATE_KEY }, { chainId: Number(CHAIN_ID) }, { rpcProviderUrl: "https://ethereum-bundler.etherspot.io/" })

You can check primeSdk.state() to check if the Etherspot network is up and running correctly.

In the next page we’ll take a look at the various functions the SDK offers.