CreateEntityParameters
CreateEntityParameters =
object
Defined in: src/actions/wallet/createEntity.ts:49
Parameters for creating an entity.
An entity always carries contents and a type for them, plus a lifetime. Attributes, flags and a salt are optional on top of that.
Examples
Section titled “Examples”const { entityKey } = await client.createEntity({ attributes: { level: i32(10), balance: u256(1_000_000n), score: dec("3.5"), name: "Bob", // bare string -> str flagged: true, // bare boolean -> bool }, payload: jsonToPayload({ hello: "world" }), contentType: "application/json", expires: ExpirationTime.fromDays(30), flags: { readonly: true },})Pin an absolute deadline, but refuse to create something nearly dead:await client.createEntity({ payload, contentType: "application/json", expires: ExpirationTime.atDate(someDeadline, { atLeast: ExpirationTime.fromDays(1), // ...but live at least a day regardless }),})An entity that is nothing but queryable attributes still declares its (empty) contents:await client.createEntity({ attributes: { parent: key(parentKey), rank: i32(3) }, payload: new Uint8Array(), contentType: "application/octet-stream", expires: ExpirationTime.fromDays(30),})Properties
Section titled “Properties”attributes?
Section titled “attributes?”
optionalattributes:AttributeInputs
Defined in: src/actions/wallet/createEntity.ts:75
The entity’s queryable attributes, keyed by name. Values are the tagged constructors from
@arkiv-network/sdk/attr — i32, u256, dec, str, addr, key, bytes32, bool — or
a bare boolean, number, bigint or string where the type is unambiguous.
Throws
Section titled “Throws”If a name violates the attribute-name grammar.
Throws
Section titled “Throws”If a value does not fit the type it names or defaults to.
contentType
Section titled “contentType”contentType:
MimeType|string&object
Defined in: src/actions/wallet/createEntity.ts:66
The payload’s MIME type, e.g. "application/json". Sent as the $contentType cell.
expires
Section titled “expires”expires:
Expiry
Defined in: src/actions/wallet/createEntity.ts:56
How long the entity should live, built with ExpirationTime.
ExpirationTime.fromDays(30) is the everyday form. atBlock / atDate pin an absolute
deadline instead, and either can carry { atLeast } to guarantee a minimum life on top of it.
flags?
Section titled “flags?”
optionalflags:CreationFlags
Defined in: src/actions/wallet/createEntity.ts:80
Properties fixed at creation: readonly and permissionlessExtension. No operation changes
them afterwards, so an entity is whatever it was created as for life. Both default to false.
payload
Section titled “payload”payload:
Uint8Array
Defined in: src/actions/wallet/createEntity.ts:64
The entity’s opaque payload. Travels to the engine as the $payload system attribute; on this
surface it is just the entity’s contents.
Pass an empty Uint8Array for an entity that is nothing but queryable attributes — it is
written as an empty payload rather than left unset, so what you pass is what is stored.
optionalsalt:bigint
Defined in: src/actions/wallet/createEntity.ts:88
The salt mixed into the entity key. Defaults to 128 random bits, which makes the key unpredictable to everyone but the creator.
Pass 0n for a key derived from the owner and nonce alone — predictable by anyone, which is
what you want only when a third party must be able to compute the key in advance.