Skip to content

createWalletClient

createWalletClient<transport, chain, accountOrAddress, rpcSchema>(parameters): object

Defined in: src/clients/createWalletClient.ts:48

Creates a Wallet Client with a given Transport configured for a Chain and an account.

A Wallet Client signs and sends transactions, so it carries an account and exposes everything that mutates state — createEntity, patchEntity, deleteEntity, extendEntity, changeOwnership and executeBatch — on top of the read actions a Public Client has.

transport extends Transport

chain extends Chain | undefined = undefined

accountOrAddress extends `0x${string}` | Account | undefined = undefined

rpcSchema extends RpcSchema | undefined = ArkivRpcSchema

Configuration object for the wallet client (chain, transport, account, etc.)

An Arkiv Wallet Client. WalletArkivClient

changeOwnership: (data, txParams?) => Promise<ChangeOwnershipReturnType>

Hands the entity with the given key to a new owner.

  • JSON-RPC Methods: eth_sendRawTransaction

ChangeOwnershipParameters

The ownership change parameters

TxParams

Optional transaction parameters

Promise<ChangeOwnershipReturnType>

The entity’s key and the transaction hash. ChangeOwnershipReturnType

createEntity: (data, txParams?) => Promise<CreateEntityReturnType>

Creates a new entity.

  • JSON-RPC Methods: eth_sendRawTransaction

CreateEntityParameters

The entity creation parameters

TxParams

Optional transaction parameters

Promise<CreateEntityReturnType>

The new entity’s key, the transaction hash, and the block it is expected to expire at. CreateEntityReturnType

If the expiry exceeds a protocol bound or would leave the entity dead on arrival.

If an attribute value does not fit the type it names.

If a name violates the attribute-name grammar.

import { createWalletClient, ExpirationTime, jsonToPayload } from "@arkiv-network/sdk"
import { i32 } from "@arkiv-network/sdk/attr"
import { tiramisu } from "@arkiv-network/sdk/chains"
import { http } from "viem"
import { privateKeyToAccount } from "viem/accounts"
const client = createWalletClient({
account: privateKeyToAccount("0x..."),
chain: tiramisu,
transport: http(),
})
const { entityKey, txHash, expiresAt } = await client.createEntity({
payload: jsonToPayload({ entityType: "testType", entityId: "testId" }),
contentType: "application/json",
attributes: { testKey: "testValue", level: i32(3) },
expires: ExpirationTime.fromDays(30),
})

deleteEntity: (data, txParams?) => Promise<DeleteEntityReturnType>

Deletes the entity with the given key.

  • JSON-RPC Methods: eth_sendRawTransaction

DeleteEntityParameters

The entity deletion parameters

TxParams

Optional transaction parameters

Promise<DeleteEntityReturnType>

The deleted entity’s key and the transaction hash. DeleteEntityReturnType

import { createWalletClient } from "@arkiv-network/sdk"
import { tiramisu } from "@arkiv-network/sdk/chains"
import { http } from "viem"
import { privateKeyToAccount } from "viem/accounts"
const client = createWalletClient({
account: privateKeyToAccount("0x..."),
chain: tiramisu,
transport: http(),
})
// entityKey is the bytes32 key returned by createEntity.
const { txHash } = await client.deleteEntity({ entityKey })

executeBatch: (data, txParams?) => Promise<ExecuteBatchReturnType>

Applies a batch of entity operations — creates, patches, deletes, extensions and ownership transfers — in one transaction.

  • JSON-RPC Methods: eth_sendRawTransaction

Every operation lands in one transaction, so the whole batch applies or none of it does. At least one operation is required.

ExecuteBatchParameters

The batch parameters (creates, patches, deletes, extensions, ownershipChanges)

TxParams

Optional transaction parameters

Promise<ExecuteBatchReturnType>

The transaction hash, plus the keys touched by each kind of operation. ExecuteBatchReturnType

If an expiry exceeds a protocol bound or would leave the entity dead on arrival.

If an attribute value does not fit the type it names.

import { createWalletClient, ExpirationTime, jsonToPayload } from "@arkiv-network/sdk"
import { tiramisu } from "@arkiv-network/sdk/chains"
import { http } from "viem"
import { privateKeyToAccount } from "viem/accounts"
const client = createWalletClient({
account: privateKeyToAccount("0x..."),
chain: tiramisu,
transport: http(),
})
const { txHash, createdEntities } = await client.executeBatch({
creates: [{
payload: jsonToPayload({ entityType: "testType", entityId: "testId" }),
contentType: "application/json",
attributes: { testKey: "testValue" },
expires: ExpirationTime.fromDays(30),
}],
patches: [{ entityKey: keyToRevise, set: { status: "archived" }, unset: ["draft"] }],
deletes: [{ entityKey: staleKey }],
extensions: [{
entityKey: keyToKeepAlive,
expires: ExpirationTime.atBlock(1_200_000n),
}],
ownershipChanges: [{ entityKey: keyToHandOver, newOwner }],
})

extendEntity: (data, txParams?) => Promise<ExtendEntityReturnType>

Sets a new expiry on the entity with the given key.

The new lifetime is resolved the same way a create’s is: a duration counts from now rather than adding to what the entity has left, and atBlock / atDate pin an absolute deadline. The engine rejects an extension that would not move the expiry later.

  • JSON-RPC Methods: eth_sendRawTransaction

ExtendEntityParameters

The entity key and its new lifetime

TxParams

Optional transaction parameters

Promise<ExtendEntityReturnType>

The entity’s key, the transaction hash, and the block it is now expected to expire at. ExtendEntityReturnType

If the expiry is malformed, exceeds a protocol bound, or would leave the entity dead on arrival.

import { createWalletClient, ExpirationTime } from "@arkiv-network/sdk"
import { tiramisu } from "@arkiv-network/sdk/chains"
import { http } from "viem"
import { privateKeyToAccount } from "viem/accounts"
const client = createWalletClient({
account: privateKeyToAccount("0x..."),
chain: tiramisu,
transport: http(),
})
const { txHash, expiresAt } = await client.extendEntity({
entityKey,
expires: ExpirationTime.fromDays(30),
})

patchEntity: (data, txParams?) => Promise<PatchEntityReturnType>

Applies a patch to the entity with the given key: sets some fields, unsets others, and leaves everything it does not name alone.

  • JSON-RPC Methods: eth_sendRawTransaction

PatchEntityParameters

The entity key and the mutations to apply

TxParams

Optional transaction parameters

Promise<PatchEntityReturnType>

The patched entity’s key and the transaction hash. PatchEntityReturnType

If the patch has nothing to apply.

If a name appears in both set and unset.

If an attribute value does not fit the type it names.

If a name violates the attribute-name grammar.

import { createWalletClient, jsonToPayload } from "@arkiv-network/sdk"
import { i32 } from "@arkiv-network/sdk/attr"
import { tiramisu } from "@arkiv-network/sdk/chains"
import { http } from "viem"
import { privateKeyToAccount } from "viem/accounts"
const client = createWalletClient({
account: privateKeyToAccount("0x..."),
chain: tiramisu,
transport: http(),
})
// Publish the entity: one attribute changes, one goes away, the payload is replaced.
const { txHash } = await client.patchEntity({
entityKey,
set: { status: "published", revision: i32(2) },
unset: ["draft"],
payload: jsonToPayload({ title: "Hello" }),
})
import { createWalletClient } from "@arkiv-network/sdk"
import { tiramisu } from "@arkiv-network/sdk/chains"
import { http } from "viem"
import { privateKeyToAccount } from "viem/accounts"
const client = createWalletClient({
chain: tiramisu,
transport: http(),
account: privateKeyToAccount("0x..."),
})