When you would like to use the SDK to perform an EVM operation, you must first create a transaction object. The different classes of the SDK: DID, RBAC, and Storage all show how an EVM tx is generated.

After receiving an EVM Transaction object back from the class you called, you are then able to use the SDK to send a transaction on behalf of the seed.

sendEvmTx(tx, baseUrl, seed)

ParameterTypeEVMSubstrateDescription
txEvmTransactionRequiredN/AEVM compatible transaction object returned from specific SDK method. Used to execute the corresponding peaq function. Gives the user the option to manually send the tx using ethers.js, web.js, or to use the sendEvmTx() in the peaq SDK to perform the operation.
baseUrlstringRequiredN/ARPC url used to connect to the blockchain. Reference Connecting to peaq for supported RPC urls.
seedstringRequiredN/AEthereum private key linked to the wallet executing the transactions. Allows the backend to perform write transactions on behalf of the user.
import { Sdk } from "@peaq-network/sdk";

const HTTPS_BASE_URL = "https://peaq.api.onfinality.io/public";
const EVM_PRIVATE = process.env['EVM_PRIVATE'];

const sdk = await Sdk.createInstance({
    baseUrl: HTTPS_BASE_URL,
    chainType: Sdk.ChainType.EVM
});

// e.g. sdk.did.create(), sdk.did.update(),  sdk.storage.create() ... etc.
// all return back a valid EVM tx that is used in sendEvmTx() 
const tx = await sdk.operation.function({});

const receipt = await Sdk.sendEvmTx({
    tx: tx,
    baseUrl: HTTPS_BASE_URL,
    seed: EVM_PRIVATE
});