execute

Execute a transaction based on a prompt.

Example

import { Nebula } from "thirdweb/ai";
const wallet = createWallet("io.metamask");
const account = wallet.connect({ client });
const result = await Nebula.execute({
client,
account, // transactions will be sent from this account
message: "send 0.0001 ETH to vitalik.eth",
contextFilter: {
chains: [sepolia],
},
});

Multi message prompt:

Nebula.execute({
client,
account,
messages: [
{ role: "user", content: "What's the address of vitalik.eth" },
{
role: "assistant",
content:
"The address of vitalik.eth is 0xd8dA6BF26964aF8E437eEa5e3616511D7G3a3298",
},
{ role: "user", content: "Send them 0.0001 ETH" },
],
contextFilter: {
chains: [sepolia],
},
});
function execute(
input: Input & { account: Account },
): Promise<SendTransactionResult>;

Parameters

The input for the transaction.

Type

let input: Input & { account: Account };

Returns

let returnType: Promise<SendTransactionResult>;

The transaction hash. This API is in early access and might change in the future.