WalletArkivActions
WalletArkivActions<
transport,chain,account> =Pick<PublicActions<transport,chain,account>,"waitForTransactionReceipt"|"call"|"simulateContract"|"readContract"|"getBlockNumber"> &Pick<WalletActions<chain,account>,"addChain"|"sendCalls"|"waitForCallsStatus"|"sendTransaction"|"sendRawTransaction"|"signMessage"|"signTransaction"|"writeContract"> &object
Defined in: src/clients/decorators/arkivWallet.ts:35
Type Declaration
Section titled “Type Declaration”changeOwnership()
Section titled “changeOwnership()”changeOwnership: (
data,txParams?) =>Promise<ChangeOwnershipReturnType>
Hands the entity with the given key to a new owner.
- JSON-RPC Methods:
eth_sendRawTransaction
Parameters
Section titled “Parameters”The ownership change parameters
txParams?
Section titled “txParams?”Optional transaction parameters
Returns
Section titled “Returns”Promise<ChangeOwnershipReturnType>
The entity’s key and the transaction hash. ChangeOwnershipReturnType
createEntity()
Section titled “createEntity()”createEntity: <
S>(schema,values,options,txParams?) =>Promise<CreateEntityReturnType>
Creates a new entity through a schema: each column becomes an attribute, written with the type and indexed flag the schema declares.
- JSON-RPC Methods:
eth_sendRawTransaction
Type Parameters
Section titled “Type Parameters”S extends Schema
Parameters
Section titled “Parameters”schema
Section titled “schema”S
The schema the entity is written through, built with defineSchema.
values
Section titled “values”The entity’s values, keyed by column. Required columns must be given; defaulted ones left out are written with their default. CreateEntityValues
options
Section titled “options”The entity’s lifetime, plus its flags and salt. CreateEntityOptions
txParams?
Section titled “txParams?”Optional transaction parameters
Returns
Section titled “Returns”Promise<CreateEntityReturnType>
The new entity’s key, the transaction hash, and the block it expires at, as the engine recorded it. CreateEntityReturnType
Throws
Section titled “Throws”If the expiry exceeds a protocol bound or would leave the entity dead on arrival.
Throws
Section titled “Throws”If the values do not fit the schema.
Throws
Section titled “Throws”If a value does not fit its type.
Throws
Section titled “Throws”If the bytes values add up to more than MAX_ENTITY_BYTES.
Throws
Section titled “Throws”If the transaction fails or reverts.
Example
Section titled “Example”import { createWalletClient, ExpirationTime } from "@arkiv-network/sdk"import { addr, bytes, dec, defineSchema, str } from "@arkiv-network/sdk/schema"import { rabdi } from "@arkiv-network/sdk/chains"import { http } from "viem"import { privateKeyToAccount } from "viem/accounts"
const Posts = defineSchema("posts", { author: addr().indexed(), category: str().indexed(), score: dec().indexed(), title: str(), body: bytes(), thumbnail: bytes().optional(), mimeType: str().default("text/markdown"),})
const client = createWalletClient({ account: privateKeyToAccount("0x..."), chain: rabdi({ accessKey: "..." }), transport: http(),})const { entityKey, txHash, expiresAt } = await client.createEntity( Posts, { author: addr(client.account.address), category: "docs", score: dec("4.1"), title: "Cells, not entities", body: new TextEncoder().encode("# Hello"), }, { expiration: ExpirationTime.fromDays(30) },)deleteEntity()
Section titled “deleteEntity()”deleteEntity: (
data,txParams?) =>Promise<DeleteEntityReturnType>
Deletes the entity with the given key.
- JSON-RPC Methods:
eth_sendRawTransaction
Parameters
Section titled “Parameters”The entity deletion parameters
txParams?
Section titled “txParams?”Optional transaction parameters
Returns
Section titled “Returns”Promise<DeleteEntityReturnType>
The deleted entity’s key and the transaction hash. DeleteEntityReturnType
Example
Section titled “Example”import { createWalletClient } from "@arkiv-network/sdk"import { rabdi } from "@arkiv-network/sdk/chains"import { http } from "viem"import { privateKeyToAccount } from "viem/accounts"
const client = createWalletClient({ account: privateKeyToAccount("0x..."), chain: rabdi({ accessKey: "..." }), transport: http(),})// entityKey is the bytes32 key returned by createEntity.const { txHash } = await client.deleteEntity({ entityKey })executeBatch()
Section titled “executeBatch()”executeBatch: <
TCreates,TPatches>(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. Each create and patch names its own schema and is typed by it, so one batch can write entities of several schemas.
Type Parameters
Section titled “Type Parameters”TCreates
Section titled “TCreates”TCreates extends readonly Schema[] = []
TPatches
Section titled “TPatches”TPatches extends readonly Schema[] = []
Parameters
Section titled “Parameters”ExecuteBatchParameters<TCreates, TPatches>
The batch parameters (creates, patches, deletes, extensions, ownershipChanges)
txParams?
Section titled “txParams?”Optional transaction parameters
Returns
Section titled “Returns”Promise<ExecuteBatchReturnType>
The transaction hash, plus the keys touched by each kind of operation. ExecuteBatchReturnType
Throws
Section titled “Throws”If the batch has no operations.
Throws
Section titled “Throws”If an expiry exceeds a protocol bound or would leave the entity dead on arrival.
Throws
Section titled “Throws”If a create’s or patch’s values do not fit its schema.
Throws
Section titled “Throws”If a value does not fit its type.
Throws
Section titled “Throws”If a patch has nothing to apply.
Throws
Section titled “Throws”If a patch names a column in both set and unset.
Throws
Section titled “Throws”If the bytes values of one create or patch add up to more
than MAX_ENTITY_BYTES.
Throws
Section titled “Throws”If the transaction fails or reverts.
Example
Section titled “Example”import { createWalletClient, ExpirationTime } from "@arkiv-network/sdk"import { dec } from "@arkiv-network/sdk/schema"import { rabdi } from "@arkiv-network/sdk/chains"import { http } from "viem"import { privateKeyToAccount } from "viem/accounts"
const client = createWalletClient({ account: privateKeyToAccount("0x..."), chain: rabdi({ accessKey: "..." }), transport: http(),})// Posts is the schema from the createEntity example.const { txHash, createdEntities } = await client.executeBatch({ creates: [{ schema: Posts, values: { author, category: "docs", score: dec("4.1"), title: "Hi", body: new Uint8Array() }, expiration: ExpirationTime.fromDays(30), }], patches: [{ schema: Posts, entityKey: keyToRevise, set: { category: "archive" } }], deletes: [{ entityKey: staleKey }], extensions: [{ entityKey: keyToKeepAlive, expiration: ExpirationTime.atBlock(1_200_000n), }], ownershipChanges: [{ entityKey: keyToHandOver, newOwner }],})extendEntity()
Section titled “extendEntity()”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 move the expiry earlier; one that resolves to the
current expiry changes nothing.
- JSON-RPC Methods:
eth_sendRawTransaction
Parameters
Section titled “Parameters”The entity key and its new lifetime
txParams?
Section titled “txParams?”Optional transaction parameters
Returns
Section titled “Returns”Promise<ExtendEntityReturnType>
The entity’s key, the transaction hash, and the block it now expires at, as the engine recorded it. ExtendEntityReturnType
Throws
Section titled “Throws”If the expiry is malformed, exceeds a protocol bound, or would leave the entity dead on arrival.
Example
Section titled “Example”import { createWalletClient, ExpirationTime } from "@arkiv-network/sdk"import { rabdi } from "@arkiv-network/sdk/chains"import { http } from "viem"import { privateKeyToAccount } from "viem/accounts"
const client = createWalletClient({ account: privateKeyToAccount("0x..."), chain: rabdi({ accessKey: "..." }), transport: http(),})const { txHash, expiresAt } = await client.extendEntity({ entityKey, expiration: ExpirationTime.fromDays(30),})patchEntity()
Section titled “patchEntity()”patchEntity: <
S>(schema,entityKey,changes,txParams?) =>Promise<PatchEntityReturnType>
Patches the entity with the given key through a schema: sets some columns, unsets optional ones, and leaves everything it does not name alone.
- JSON-RPC Methods:
eth_sendRawTransaction
Type Parameters
Section titled “Type Parameters”S extends Schema
Parameters
Section titled “Parameters”schema
Section titled “schema”S
The schema the changes are typed by.
entityKey
Section titled “entityKey”Hex
The entity to patch.
changes
Section titled “changes”The columns to set and the optional columns to unset. PatchEntityChanges
txParams?
Section titled “txParams?”Optional transaction parameters
Returns
Section titled “Returns”Promise<PatchEntityReturnType>
The patched entity’s key and the transaction hash. PatchEntityReturnType
Throws
Section titled “Throws”If the patch has nothing to apply.
Throws
Section titled “Throws”If a name appears in both set and unset.
Throws
Section titled “Throws”If the changes do not fit the schema.
Throws
Section titled “Throws”If a value does not fit its type.
Throws
Section titled “Throws”If the bytes values in set add up to more than
MAX_ENTITY_BYTES.
Throws
Section titled “Throws”If the transaction fails or reverts.
Example
Section titled “Example”// Posts is the schema from the createEntity example.// One column changes, an optional one goes away.const { txHash } = await client.patchEntity(Posts, entityKey, { set: { score: dec("4.5") }, unset: ["thumbnail"],})Type Parameters
Section titled “Type Parameters”transport
Section titled “transport”transport extends Transport = Transport
chain extends Chain | undefined = Chain | undefined
account
Section titled “account”account extends Account | undefined = Account | undefined