createWalletClient
createWalletClient<
transport,chain,accountOrAddress,rpcSchema>(parameters):object
Defined in: src/clients/createWalletClient.ts:44
Creates a Public Client with a given Transport configured for a Chain.
A Public Client is an interface to “public” Ethereum JSON-RPC API, Arkiv JSON-RPC API, and Braga JSON-RPC API methods such as retrieving block numbers, transactions, reading from smart contracts, etc through Public Actions.
Type Parameters
Section titled “Type Parameters”transport
Section titled “transport”transport extends Transport
chain extends Chain | undefined = undefined
accountOrAddress
Section titled “accountOrAddress”accountOrAddress extends `0x${string}` | Account | undefined = undefined
rpcSchema
Section titled “rpcSchema”rpcSchema extends RpcSchema | undefined = ArkivRpcSchema
Parameters
Section titled “Parameters”parameters
Section titled “parameters”Configuration object for the wallet client (chain, transport, account, etc.)
Returns
Section titled “Returns”A Arkiv Wallet Client. WalletArkivClient
changeOwnership()
Section titled “changeOwnership()”changeOwnership: (
data,txParams?) =>Promise<ChangeOwnershipReturnType>
Changes the ownership of the entity with the given address.
- Docs: https://docs.arkiv.network/ts-sdk/actions/wallet/changeOwnership
- 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 with updated ownership and transaction hash
createEntity()
Section titled “createEntity()”createEntity: (
data,txParams?) =>Promise<CreateEntityReturnType>
Creates a new entity.
- Docs: https://docs.arkiv.network/ts-sdk/actions/wallet/createEntity
- JSON-RPC Methods:
eth_sendRawTransaction
Parameters
Section titled “Parameters”The entity creation parameters
txParams?
Section titled “txParams?”Optional transaction parameters
Returns
Section titled “Returns”Promise<CreateEntityReturnType>
The created entity with transaction hash
Example
Section titled “Example”import { createPublicClient, http } from 'arkiv'import { braga } from 'arkiv/chains'
const client = createPublicClient({ chain: braga, transport: http(),})const { entityKey, txHash } = await client.createEntity({ payload: toBytes(JSON.stringify({ entity: { entityType: "testType", entityId: "testId" } })), attributes: [{ key: "testKey", value: "testValue" }], expiresIn: 1000,})console.log("entityKey", entityKey)console.log("txHash", txHash)// {// entityKey: "0x123",// txHash: "0x123",// }deleteEntity()
Section titled “deleteEntity()”deleteEntity: (
data,txParams?) =>Promise<DeleteEntityReturnType>
Deletes the entity with the given key.
- Docs: https://docs.arkiv.network/ts-sdk/actions/wallet/deleteEntity
- 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 with transaction hash
Example
Section titled “Example”import { createWalletClient, http } from 'arkiv'import { braga } from 'arkiv/chains'
const client = createWalletClient({ chain: braga, transport: http(),})const { entityKey, txHash } = await client.deleteEntity({ entityKey: "0x123" })console.log("entityKey", entityKey)console.log("txHash", txHash)// {// entityKey: "0x123",// txHash: "0x123",// }extendEntity()
Section titled “extendEntity()”extendEntity: (
data,txParams?) =>Promise<ExtendEntityReturnType>
Extends the entity with the given key.
- Docs: https://docs.arkiv.network/ts-sdk/actions/wallet/extendEntity
- JSON-RPC Methods:
eth_sendRawTransaction
Parameters
Section titled “Parameters”The entity update parameters
txParams?
Section titled “txParams?”Optional transaction parameters
Returns
Section titled “Returns”Promise<ExtendEntityReturnType>
The updated entity with transaction hash
Example
Section titled “Example”import { createWalletClient, http } from 'arkiv'import { braga } from 'arkiv/chains'
const client = createWalletClient({ chain: braga, transport: http(),})const { entityKey, txHash } = await client.extendEntity("0x123", { expiresIn: 1000,})console.log("entityKey", entityKey)console.log("txHash", txHash)// {// entityKey: "0x123",// txHash: "0x123",// }mutateEntities()
Section titled “mutateEntities()”mutateEntities: (
data,txParams?) =>Promise<MutateEntitiesReturnType>
Mutates the entities with the given keys.
- Docs: https://docs.arkiv.network/ts-sdk/actions/wallet/mutateEntities
- JSON-RPC Methods:
eth_sendRawTransaction
Parameters
Section titled “Parameters”The mutation parameters (creates, updates, deletes, extensions)
txParams?
Section titled “txParams?”Optional transaction parameters
Returns
Section titled “Returns”Promise<MutateEntitiesReturnType>
The mutation result with transaction hash
Example
Section titled “Example”import { createWalletClient, http } from 'arkiv'import { braga } from 'arkiv/chains'
const client = createWalletClient({ chain: braga, transport: http(),})const { entityKey, txHash } = await client.mutateEntities({ creates: [{ payload: toBytes(JSON.stringify({ entity: { entityType: "testType", entityId: "testId" } })), attriubutes: [{ key: "testKey", value: "testValue" }], expiresIn: 1000, }], updates: [{ entityKey: "0x123", payload: toBytes(JSON.stringify({ entity: { entityType: "testType", entityId: "testId" } })), attributes: [{ key: "testKey", value: "testValue" }], expiresIn: 1000, }], deletes: [{ entityKey: "0x321", }], extensions: [{ entityKey: "0x1234", expiresIn: 1000, }],})console.log("entityKey", entityKey)console.log("txHash", txHash)// {// entityKey: "0x123",// txHash: "0x123",// }updateEntity()
Section titled “updateEntity()”updateEntity: (
data,txParams?) =>Promise<UpdateEntityReturnType>
Updates the entity with the given key.
- Docs: https://docs.arkiv.network/ts-sdk/actions/wallet/updateEntity
- JSON-RPC Methods:
eth_sendRawTransaction
Parameters
Section titled “Parameters”The entity update parameters
txParams?
Section titled “txParams?”Optional transaction parameters
Returns
Section titled “Returns”Promise<UpdateEntityReturnType>
The updated entity with transaction hash
Example
Section titled “Example”import { createWalletClient, http } from 'arkiv'import { braga } from 'arkiv/chains'
const client = createWalletClient({ chain: braga, transport: http(),})Example
Section titled “Example”import { createPublicClient, http } from 'arkiv'import { braga } from 'arkiv/chains'
const client = createPublicClient({ chain: braga, transport: http(),})