Before doing anything with the SDK, we must instantiate it. This will set the sessionKey, chainId and all properties needed to authenticate and authorise the remote-signing

Step 1. set .env variables via export or in your .env If you chose to use them directly skip to Step-2

export WALLET_PRIVATE_KEY=''
export CHAIN_ID=
export API_KEY=''

Step 2. Import the Etherspot RemoteSigner SDK.

  import { RemoteSignerSdk } from '@etherspot/remote-signer';

Step 2. Instantiate the SDK with below initialisation properties using this block of code.

  • privateKey
  • ChainID
  • etherspotWalletAddress
  • sessionKey
  • bundlerApiKey
import { privateKeyToAccount } from 'viem/accounts';
import { Account, Hex } from "viem";
import * as dotenv from 'dotenv';
import { createLocalAccount, EtherspotBundler, ExtendedLocalAccount, getViemAccount, RemoteSignerSdk, toRemoteSigner } from '@etherspot/remote-signer';

const externalViemAccount = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as string as Hex);
const bundlerProvider = new EtherspotBundler(chainId, bundlerApiKey);
const bundlerApiKey = process.env.API_KEY as string;
const sessionKey = ''; // sessionKey generated by modularSDK
const apiKey = process.env.API_KEY as string;
const etherspotWalletAddress = ''; // your etherspotModularWallet address
const chainId = Number(process.env.CHAIN_ID);

const remoteSignerSdk = await RemoteSignerSdk.create(externalViemAccount, {
  etherspotWalletAddress: etherspotWalletAddress,
  chainId: chainId,
  apiKey: apiKey,
  sessionKey: sessionKey,
  bundlerProvider: bundlerProvider
});

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

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