Skip to content

Braga has been retired. The next public testnet is coming in September 2026. Read the announcement →

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.

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),
})

optional attributes: 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/attri32, u256, dec, str, addr, key, bytes32, bool — or a bare boolean, number, bigint or string where the type is unambiguous.

If a name violates the attribute-name grammar.

If a value does not fit the type it names or defaults to.


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: 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.


optional flags: 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: 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.


optional salt: 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.