@arkiv-network/sdk 0.8.1-dev.1 → 0.9.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/README.md +180 -61
  2. package/dist/chains/index.d.ts +17 -17
  3. package/dist/changeOwnership-Cy9gfyjN.d.cts +1160 -0
  4. package/dist/changeOwnership-Cy9gfyjN.d.cts.map +1 -0
  5. package/dist/changeOwnership-gXf-lBqI.d.ts +1160 -0
  6. package/dist/changeOwnership-gXf-lBqI.d.ts.map +1 -0
  7. package/dist/entity/index.cjs +4 -10
  8. package/dist/entity/index.d.cts +3 -3
  9. package/dist/entity/index.d.ts +3 -3
  10. package/dist/entity/index.js +3 -4
  11. package/dist/entity-BM1unrQf.cjs +41 -0
  12. package/dist/{entity-DJ0Gml9c.cjs → entity-BgaFJSaV.cjs} +4 -4
  13. package/dist/entity-CFAI1KyG.js +36 -0
  14. package/dist/entity-CFAI1KyG.js.map +1 -0
  15. package/dist/{entity-CniBgBSd.js → entity-CGqx_AU0.js} +4 -4
  16. package/dist/entity-CGqx_AU0.js.map +1 -0
  17. package/dist/{payload-AfUfSctb.d.ts → expirationTime-C7PZK49K.d.ts} +8 -37
  18. package/dist/expirationTime-C7PZK49K.d.ts.map +1 -0
  19. package/dist/expirationTime-CkIGNAg8.cjs +140 -0
  20. package/dist/{payload-D167BlJR.d.cts → expirationTime-DOB8V4B8.d.cts} +8 -37
  21. package/dist/expirationTime-DOB8V4B8.d.cts.map +1 -0
  22. package/dist/{expiry-Cgdb_dbq.js → expirationTime-UKPuA-LM.js} +62 -27
  23. package/dist/expirationTime-UKPuA-LM.js.map +1 -0
  24. package/dist/expiry-B48I-yTA.d.cts +40 -0
  25. package/dist/expiry-B48I-yTA.d.cts.map +1 -0
  26. package/dist/expiry-S2PUL8Hg.d.ts +40 -0
  27. package/dist/expiry-S2PUL8Hg.d.ts.map +1 -0
  28. package/dist/index-C-mMF5WZ.d.cts +735 -0
  29. package/dist/index-C-mMF5WZ.d.cts.map +1 -0
  30. package/dist/{index-BkqSnGJH.d.ts → index-C4zZqJ9S.d.ts} +5 -27
  31. package/dist/index-C4zZqJ9S.d.ts.map +1 -0
  32. package/dist/{index-CLhsFyVH.d.cts → index-CcVWYB6v.d.cts} +5 -27
  33. package/dist/index-CcVWYB6v.d.cts.map +1 -0
  34. package/dist/index-DCx2XC6S.d.ts +489 -0
  35. package/dist/index-DCx2XC6S.d.ts.map +1 -0
  36. package/dist/index-DLb7BfIw.d.ts +735 -0
  37. package/dist/index-DLb7BfIw.d.ts.map +1 -0
  38. package/dist/index-DzriOUm8.d.cts +489 -0
  39. package/dist/index-DzriOUm8.d.cts.map +1 -0
  40. package/dist/index.cjs +162 -146
  41. package/dist/index.d.cts +180 -133
  42. package/dist/index.d.cts.map +1 -1
  43. package/dist/index.d.ts +180 -133
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +93 -83
  46. package/dist/index.js.map +1 -1
  47. package/dist/params-BuIrJA9a.cjs +45 -0
  48. package/dist/params-DDJOnsNi.js +22 -0
  49. package/dist/params-DDJOnsNi.js.map +1 -0
  50. package/dist/query/index.cjs +9 -4
  51. package/dist/query/index.d.cts +6 -6
  52. package/dist/query/index.d.ts +6 -6
  53. package/dist/query/index.js +4 -5
  54. package/dist/query-D0KtuFh2.cjs +1625 -0
  55. package/dist/query-DpRDozmj.js +1417 -0
  56. package/dist/query-DpRDozmj.js.map +1 -0
  57. package/dist/schema/index.cjs +46 -0
  58. package/dist/schema/index.d.cts +2 -0
  59. package/dist/schema/index.d.ts +2 -0
  60. package/dist/schema/index.js +3 -0
  61. package/dist/{attr-BXTkpnoc.cjs → schema-B9AyXcgU.cjs} +513 -246
  62. package/dist/{attr-tmyREHtw.js → schema-DY4sqehl.js} +427 -244
  63. package/dist/schema-DY4sqehl.js.map +1 -0
  64. package/dist/types/index.cjs +1 -1
  65. package/dist/types/index.d.cts +5 -5
  66. package/dist/types/index.d.ts +5 -5
  67. package/dist/types/index.js +1 -1
  68. package/dist/utils/index.cjs +3 -5
  69. package/dist/utils/index.d.cts +3 -3
  70. package/dist/utils/index.d.ts +3 -3
  71. package/dist/utils/index.js +3 -3
  72. package/package.json +9 -12
  73. package/src/actions/public/getEntity.test.ts +69 -0
  74. package/src/actions/public/getEntity.ts +34 -20
  75. package/src/actions/public/predictEntityKeys.ts +8 -7
  76. package/src/actions/public/query.test.ts +58 -0
  77. package/src/actions/public/query.ts +41 -13
  78. package/src/actions/wallet/createEntity.ts +34 -63
  79. package/src/actions/wallet/executeBatch.test.ts +38 -0
  80. package/src/actions/wallet/executeBatch.ts +26 -9
  81. package/src/actions/wallet/extendEntity.ts +9 -8
  82. package/src/actions/wallet/patchEntity.ts +43 -52
  83. package/src/clients/createPublicClient.test.ts +10 -2
  84. package/src/clients/createWalletClient.ts +4 -1
  85. package/src/clients/decorators/arkivPublic.ts +123 -80
  86. package/src/clients/decorators/arkivWallet.ts +113 -65
  87. package/src/entity/create.test.ts +25 -21
  88. package/src/entity/expiry.ts +8 -6
  89. package/src/entity/flags.ts +1 -1
  90. package/src/entity/index.ts +2 -4
  91. package/src/entity/key.ts +3 -3
  92. package/src/entity/operations.ts +1 -1
  93. package/src/errors.ts +2 -11
  94. package/src/index.ts +18 -6
  95. package/src/query/builderBase.ts +166 -0
  96. package/src/query/countBuilder.test.ts +91 -0
  97. package/src/query/countBuilder.ts +67 -0
  98. package/src/query/engine.ts +9 -3
  99. package/src/query/errors.ts +24 -14
  100. package/src/query/expression.test.ts +129 -21
  101. package/src/query/expression.ts +323 -94
  102. package/src/query/index.ts +26 -4
  103. package/src/query/injection.test.ts +5 -11
  104. package/src/query/queryBuilder.test.ts +467 -58
  105. package/src/query/queryBuilder.ts +191 -98
  106. package/src/query/queryResult.ts +35 -9
  107. package/src/query/selection.test.ts +278 -24
  108. package/src/query/selection.ts +427 -86
  109. package/src/schema/attributes.test.ts +266 -0
  110. package/src/schema/attributes.ts +212 -0
  111. package/src/{attr → schema}/codec.test.ts +37 -5
  112. package/src/{attr → schema}/codec.ts +40 -11
  113. package/src/schema/column.ts +193 -0
  114. package/src/{attr → schema}/errors.ts +67 -10
  115. package/src/schema/index.ts +76 -0
  116. package/src/{attr → schema}/names.ts +4 -2
  117. package/src/schema/schema.test.ts +171 -0
  118. package/src/schema/schema.ts +250 -0
  119. package/src/{attr → schema}/types.ts +36 -30
  120. package/src/{attr → schema}/values.test.ts +62 -3
  121. package/src/{attr → schema}/values.ts +246 -65
  122. package/src/types/entity.test.ts +1 -44
  123. package/src/types/entity.ts +9 -55
  124. package/src/types/events.ts +1 -1
  125. package/src/types/index.ts +11 -4
  126. package/src/types/rpcSchema.ts +22 -16
  127. package/src/utils/arkivTransactions.test.ts +356 -116
  128. package/src/utils/arkivTransactions.ts +30 -38
  129. package/src/utils/entities.ts +10 -9
  130. package/src/utils/expirationTime.ts +5 -5
  131. package/src/utils/index.ts +0 -1
  132. package/src/utils/logger.test.ts +45 -0
  133. package/src/utils/logger.ts +5 -39
  134. package/src/utils/revert.test.ts +25 -0
  135. package/src/utils/revert.ts +28 -3
  136. package/dist/attr/index.cjs +0 -34
  137. package/dist/attr/index.d.cts +0 -2
  138. package/dist/attr/index.d.ts +0 -2
  139. package/dist/attr/index.js +0 -3
  140. package/dist/attr-tmyREHtw.js.map +0 -1
  141. package/dist/entity-B0t6sN7F.cjs +0 -71
  142. package/dist/entity-BIp_df9u.js +0 -67
  143. package/dist/entity-BIp_df9u.js.map +0 -1
  144. package/dist/entity-CniBgBSd.js.map +0 -1
  145. package/dist/expiry-BxOlvVWC.d.ts +0 -79
  146. package/dist/expiry-BxOlvVWC.d.ts.map +0 -1
  147. package/dist/expiry-CG9GhVXv.cjs +0 -135
  148. package/dist/expiry-Cgdb_dbq.js.map +0 -1
  149. package/dist/expiry-DRV29F1r.d.cts +0 -79
  150. package/dist/expiry-DRV29F1r.d.cts.map +0 -1
  151. package/dist/flags-DCD26uhe.cjs +0 -43
  152. package/dist/flags-DUT2gHEU.js +0 -33
  153. package/dist/flags-DUT2gHEU.js.map +0 -1
  154. package/dist/index-BkqSnGJH.d.ts.map +0 -1
  155. package/dist/index-C7fbakoI.d.cts +0 -278
  156. package/dist/index-C7fbakoI.d.cts.map +0 -1
  157. package/dist/index-CIcHPx2j.d.cts +0 -424
  158. package/dist/index-CIcHPx2j.d.cts.map +0 -1
  159. package/dist/index-CLhsFyVH.d.cts.map +0 -1
  160. package/dist/index-Cd2aaWme.d.ts +0 -424
  161. package/dist/index-Cd2aaWme.d.ts.map +0 -1
  162. package/dist/index-Cq6fa8AI.d.ts +0 -278
  163. package/dist/index-Cq6fa8AI.d.ts.map +0 -1
  164. package/dist/index-DaNeJUw8.d.ts +0 -955
  165. package/dist/index-DaNeJUw8.d.ts.map +0 -1
  166. package/dist/index-Dv16LO2s.d.cts +0 -955
  167. package/dist/index-Dv16LO2s.d.cts.map +0 -1
  168. package/dist/payload-AfUfSctb.d.ts.map +0 -1
  169. package/dist/payload-D167BlJR.d.cts.map +0 -1
  170. package/dist/payload-DE7wMztL.js +0 -92
  171. package/dist/payload-DE7wMztL.js.map +0 -1
  172. package/dist/payload-DqFweqiO.cjs +0 -108
  173. package/dist/query-9oojUdM7.cjs +0 -1128
  174. package/dist/query-Ber-lOJQ.js +0 -968
  175. package/dist/query-Ber-lOJQ.js.map +0 -1
  176. package/src/actions/public/getEntityCount.ts +0 -10
  177. package/src/attr/attributes.test.ts +0 -120
  178. package/src/attr/attributes.ts +0 -196
  179. package/src/attr/index.ts +0 -50
  180. package/src/types/mimeTypes.ts +0 -27
  181. package/src/utils/compression.test.ts +0 -32
  182. package/src/utils/compression.ts +0 -102
  183. package/src/utils/payload.ts +0 -36
  184. /package/src/{attr → schema}/decimal.ts +0 -0
@@ -1,955 +0,0 @@
1
- import { C as ValueInput, G as StrValue, R as ArkivValue, Y as UserTypeTag, h as Attributes, m as AttributeSchema, p as AttributeInputs } from "./index-Cd2aaWme.js";
2
- import { a as SaltInput, c as CreationFlags, l as ResolvedCreationFlags } from "./index-BkqSnGJH.js";
3
- import { n as Expiry } from "./expiry-BxOlvVWC.js";
4
- import { Account, Address, Chain, Client, Hash, Hex, RpcSchema, Transport } from "viem";
5
-
6
- //#region src/types/rpcSchema.d.ts
7
-
8
- /**
9
- * An attribute as the node renders it: the name, the type **tag** (not the wire typeId), and the
10
- * value in the JSON encoding that type prescribes — a JSON number for `i32`, a `0x` QUANTITY for
11
- * `u64` and `u256`, a decimal string for `dec`, `0x` DATA for the byte-shaped types, and a string for
12
- * `str`.
13
- *
14
- * The encoding follows the *declared type*, never the magnitude, so a decoder dispatches on `type`
15
- * and never has to guess from the shape of the value.
16
- */
17
- type RpcAttribute = {
18
- name: string;
19
- type: string;
20
- value: unknown;
21
- };
22
- /** An entry of the `attributeSchema` projection — a name and its type, with no value. */
23
- type RpcAttributeSchemaEntry = {
24
- name: string;
25
- type: string;
26
- };
27
- /**
28
- * The `creationFlags` projection.
29
- */
30
- type RpcCreationFlags = {
31
- readonly?: boolean;
32
- permissionlessExtension?: boolean;
33
- raw: number;
34
- };
35
- /**
36
- * An entity as `arkiv_query` returns it. Every field is present only if it was selected, so all of
37
- * them are optional here — {@link RpcSelect} is what decides which arrive.
38
- */
39
- type RpcEntity = {
40
- key?: Hex;
41
- owner?: Hex;
42
- creator?: Hex;
43
- createdAt?: Hex;
44
- updatedAt?: Hex;
45
- expiresAt?: Hex;
46
- creationFlags?: RpcCreationFlags | number;
47
- contentType?: string;
48
- payload?: Hex;
49
- attributeSchema?: RpcAttributeSchemaEntry[];
50
- attributes?: RpcAttribute[];
51
- };
52
- /**
53
- * The `select` projection: flat, per-field booleans. Everything except `key` defaults to **off**,
54
- * so a query asks for exactly what it needs and nothing more.
55
- *
56
- * `attributes` is the one field with a third form: `true` for every attribute, or a map of names
57
- * for a subset.
58
- */
59
- type RpcSelect = {
60
- key?: boolean;
61
- owner?: boolean;
62
- creator?: boolean;
63
- createdAt?: boolean;
64
- updatedAt?: boolean;
65
- expiresAt?: boolean;
66
- creationFlags?: boolean;
67
- contentType?: boolean;
68
- payload?: boolean;
69
- attributeSchema?: boolean;
70
- attributes?: boolean | Record<string, boolean>;
71
- };
72
- /** The second parameter of `arkiv_query` — what to return, and where in the results to start. */
73
- type RpcQueryOptions = {
74
- /** Block height to read at, as a hex quantity. Defaults to the head, and must be within the node's retained range. */
75
- atBlock?: Hex;
76
- /** What to return. Defaults to `{ key: true }`. */
77
- select?: RpcSelect;
78
- /** Page size, as a hex quantity. Node maximum is 200. */
79
- limit?: Hex;
80
- /** Opaque cursor from a previous response; bound to that query, block and selection. */
81
- cursor?: string;
82
- };
83
- type ArkivRpcSchema = [{
84
- Method: "arkiv_query";
85
- Parameters?: [query: string, queryOptions?: RpcQueryOptions];
86
- ReturnType: {
87
- data: RpcEntity[];
88
- blockNumber: Hex;
89
- /** Omitted when no pages remain. */
90
- cursor?: string;
91
- };
92
- }, {
93
- Method: "arkiv_getBlockTiming";
94
- Parameters?: [];
95
- ReturnType: {
96
- current_block: bigint;
97
- current_block_time: number;
98
- duration: number;
99
- };
100
- }, {
101
- Method: "arkiv_getEntityCount";
102
- Parameters?: [];
103
- ReturnType: number;
104
- }];
105
- //#endregion
106
- //#region src/clients/baseClient.d.ts
107
- type ArkivClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, accountOrAddress extends Account | undefined = Account | undefined, rpcSchema extends RpcSchema | undefined = ArkivRpcSchema> = Client<transport, chain, accountOrAddress, rpcSchema>;
108
- //#endregion
109
- //#region src/actions/public/getBlockTiming.d.ts
110
- type GetBlockTimingReturnType = {
111
- currentBlock: bigint;
112
- currentBlockTime: number;
113
- blockDuration: number;
114
- };
115
- //#endregion
116
- //#region src/actions/public/predictEntityKeys.d.ts
117
- /**
118
- * A key a create will be given, together with the salt that mints it.
119
- *
120
- * The two travel as a pair because neither is any use alone: a create defaults to a *random* salt,
121
- * so the key only comes out as predicted if that same create carries this salt.
122
- */
123
- type PredictedEntityKey = {
124
- /** The key the create will be given. */
125
- key: Hex;
126
- /**
127
- * The salt the create must carry for its key to come out as {@link PredictedEntityKey.key}.
128
- * Always a plain `uint128` — a requested {@link NO_SALT} comes back as the `0n` it resolves to,
129
- * which a create accepts just the same.
130
- */
131
- salt: bigint;
132
- };
133
- /** Parameters for `client.predictEntityKeys`. */
134
- type PredictEntityKeysParameters<TCount extends number = number, TSalts extends readonly SaltInput[] | undefined = readonly SaltInput[] | undefined> = {
135
- /** The account that will sign the creates. Its nonce is what the keys are derived from. */
136
- owner: Address;
137
- /**
138
- * How many creates the batch will carry. Ignored when `salts` is given, which already says how
139
- * many there are.
140
- *
141
- * A literal count comes back as a fixed-length tuple, so `count: 2` destructures into two named
142
- * pairs without a cast.
143
- */
144
- count?: TCount | undefined;
145
- /**
146
- * The salt each create will carry, in batch order. Defaults to `count` fresh random salts —
147
- * either way each key comes back paired with the salt that mints it. Pass {@link NO_SALT} in a
148
- * slot whose create opts out of salting.
149
- */
150
- salts?: TSalts;
151
- };
152
- /**
153
- * The keys a batch would mint, in batch order, each paired with its salt.
154
- *
155
- * The length follows the request whenever it is known statically: a literal `count`, or a `salts`
156
- * tuple, gives a fixed-length tuple; a count computed at runtime gives a plain array.
157
- *
158
- * `TSalts` is wrapped in a tuple to stop the conditional distributing over it. Left naked, the
159
- * `readonly SaltInput[] | undefined` default would take both branches and union a tuple with an
160
- * array, which widens the length straight back to `number`.
161
- */
162
- type PredictEntityKeysReturnType<TCount extends number = number, TSalts extends readonly SaltInput[] | undefined = readonly SaltInput[] | undefined> = [TSalts] extends [readonly SaltInput[]] ? { -readonly [Index in keyof TSalts]: PredictedEntityKey } : Repeat<PredictedEntityKey, TCount>;
163
- /**
164
- * A tuple of `TLength` × `T`, or a plain array when the length is only known at runtime.
165
- *
166
- * Written tail-recursively so TypeScript can build the batch sizes anyone would actually send.
167
- */
168
- type Repeat<T, TLength extends number, TAcc extends T[] = []> = number extends TLength ? T[] : TAcc["length"] extends TLength ? TAcc : Repeat<T, TLength, [...TAcc, T]>;
169
- /**
170
- * Works out the keys an account's next creates will be given, before sending them.
171
- *
172
- * A key is `keccak256(chainId ++ registry ++ owner ++ nonce ++ salt)`. Everything but the nonce is
173
- * known to the caller, and the nonce is read here — so a batch can reference a key it is about to
174
- * mint, storing it as a `key` attribute on a sibling entity created in the same transaction.
175
- *
176
- * Each key arrives paired with its salt, and the create must be given that salt: a create left to
177
- * pick its own salt picks a random one, which mints a different key.
178
- *
179
- * The prediction is valid only while nothing else from this owner is in flight. Every create that
180
- * lands first takes the nonce with it and moves these keys. For a key you can rely on
181
- * unconditionally, read it back from the create instead — `createEntity` and `executeBatch`
182
- * report the keys the engine actually minted.
183
- *
184
- * @param parameters - Owner, and either a count or the salts. {@link PredictEntityKeysParameters}
185
- * @returns One `{ key, salt }` pair per create, in batch order. {@link PredictEntityKeysReturnType}
186
- *
187
- * @example A batch whose second entity points at its first.
188
- * import { key } from "@arkiv-network/sdk/attr"
189
- *
190
- * const [parent, child] = await client.predictEntityKeys({ owner: account.address, count: 2 })
191
- * await client.executeBatch({
192
- * creates: [
193
- * { payload, contentType, expires, salt: parent.salt },
194
- * {
195
- * payload,
196
- * contentType,
197
- * expires,
198
- * salt: child.salt,
199
- * attributes: { parent: key(parent.key) },
200
- * },
201
- * ],
202
- * })
203
- */
204
- //#endregion
205
- //#region src/query/expression.d.ts
206
- /**
207
- * The comparison operators the query language defines. `<` `<=` `>` `>=` need an ordered type —
208
- * `i32`, `u64`, `u256` or `dec`; every type accepts `=` and `!=`.
209
- */
210
- type ComparisonOperator = "=" | "!=" | "<" | "<=" | ">" | ">=";
211
- /** A comparison between an attribute and a typed literal. */
212
- type ComparisonNode = {
213
- readonly kind: "comparison";
214
- readonly name: string;
215
- readonly operator: ComparisonOperator;
216
- readonly value: ArkivValue;
217
- };
218
- /** A `STARTSWITH` prefix test, the language's only pattern operator. */
219
- type StartsWithNode = {
220
- readonly kind: "startsWith";
221
- readonly name: string;
222
- readonly value: StrValue;
223
- };
224
- /** An `EXISTS(name)` test — true when the attribute is set with any type. */
225
- type ExistsNode = {
226
- readonly kind: "exists";
227
- readonly name: string;
228
- };
229
- /** A `TYPEOF(name) = tag` test. */
230
- type TypeOfNode = {
231
- readonly kind: "typeOf";
232
- readonly name: string;
233
- readonly tag: UserTypeTag;
234
- };
235
- /** The complement of an expression, evaluated against the active-entity set. */
236
- type NotNode = {
237
- readonly kind: "not";
238
- readonly expression: Expression;
239
- };
240
- /** A conjunction. */
241
- type AndNode = {
242
- readonly kind: "and";
243
- readonly expressions: readonly Expression[];
244
- };
245
- /** A disjunction. */
246
- type OrNode = {
247
- readonly kind: "or";
248
- readonly expressions: readonly Expression[];
249
- };
250
- /**
251
- * A query expression: an immutable tree built by the combinators below, whose `toString()` is the
252
- * exact query string sent over the wire.
253
- *
254
- * @example
255
- * const q = and(gte("level", i32(10)), or(eq("status", str("open")), not(exists("closedAt"))))
256
- * String(q) // level >= i32(10) AND (status = str('open') OR NOT EXISTS(closedAt))
257
- */
258
- type Expression = ComparisonNode | StartsWithNode | ExistsNode | TypeOfNode | NotNode | AndNode | OrNode;
259
- /**
260
- * Attribute equals value — set with this exact type, and holding this value.
261
- *
262
- * Bare booleans, numbers, bigints and strings take the same default types they take when written
263
- * (`number` is an `i32`, `bigint` a `u256`, `string` a `str`); anything else names its type.
264
- *
265
- * @throws {InvalidPredicateError} If the name is not a queryable attribute, or a system attribute
266
- * is compared against the wrong type.
267
- *
268
- * @example
269
- * eq("status", str("open")) // status = str('open')
270
- * eq("flagged", true) // flagged = true
271
- * eq("$owner", addr(account)) // $owner = addr(0xd8dA…)
272
- */
273
- declare function eq(name: string, value: ValueInput): ComparisonNode;
274
- /**
275
- * Attribute is set with this type and holds a **different** value.
276
- *
277
- * This is typed value-negation, not the complement: an entity that never set the attribute, or set
278
- * it with another type, does not match. Use `not(eq(...))` for the full complement.
279
- *
280
- * @example
281
- * ne("status", str("closed")) // status != str('closed')
282
- * not(eq("status", str("closed"))) // NOT status = str('closed') — also matches entities with no status
283
- */
284
- declare function ne(name: string, value: ValueInput): ComparisonNode;
285
- /**
286
- * Attribute is greater than value. Ordered types only (`i32`, `u64`, `u256`, `dec`).
287
- *
288
- * @throws {UnsupportedOperatorError} If the value's type carries no ordered index.
289
- *
290
- * @example
291
- * gt("level", i32(10)) // level > i32(10)
292
- * gt("$expiresAt", u64(1_200_000n)) // $expiresAt > u64(1200000)
293
- */
294
- declare function gt(name: string, value: ValueInput): ComparisonNode;
295
- /**
296
- * Attribute is greater than or equal to value. Ordered types only (`i32`, `u64`, `u256`, `dec`).
297
- *
298
- * @throws {UnsupportedOperatorError} If the value's type carries no ordered index.
299
- *
300
- * @example
301
- * gte("score", dec("3.5")) // score >= dec(3.5)
302
- */
303
- declare function gte(name: string, value: ValueInput): ComparisonNode;
304
- /**
305
- * Attribute is less than value. Ordered types only (`i32`, `u64`, `u256`, `dec`).
306
- *
307
- * @throws {UnsupportedOperatorError} If the value's type carries no ordered index.
308
- *
309
- * @example
310
- * lt("level", i32(10)) // level < i32(10)
311
- */
312
- declare function lt(name: string, value: ValueInput): ComparisonNode;
313
- /**
314
- * Attribute is less than or equal to value. Ordered types only (`i32`, `u64`, `u256`, `dec`).
315
- *
316
- * @throws {UnsupportedOperatorError} If the value's type carries no ordered index.
317
- *
318
- * @example
319
- * lte("score", dec("5")) // score <= dec(5)
320
- */
321
- declare function lte(name: string, value: ValueInput): ComparisonNode;
322
- /**
323
- * Attribute is a `str` beginning with this prefix.
324
- *
325
- * The match is on **raw UTF-8 bytes** with no normalization — it is the index encoding, so
326
- * `startsWith("name", "é")` matches only the same byte sequence, not another normal form of it.
327
- *
328
- * @param prefix - The prefix, as a bare string or a `str` value.
329
- * @throws {InvalidPredicateError} If the name is not a queryable attribute.
330
- * @throws {UnsupportedOperatorError} If given a value that is not a `str`, or a system attribute
331
- * (none of which is a `str`).
332
- *
333
- * @example
334
- * startsWith("desc", "ab") // desc STARTSWITH str('ab')
335
- */
336
- declare function startsWith(name: string, prefix: string | StrValue): StartsWithNode;
337
- /**
338
- * The attribute is set, with any type.
339
- *
340
- * @throws {InvalidPredicateError} If given a system attribute — every entity has all of them, so
341
- * the test would be a constant.
342
- *
343
- * @example
344
- * exists("reviewedBy") // EXISTS(reviewedBy)
345
- * not(exists("closedAt")) // NOT EXISTS(closedAt)
346
- */
347
- declare function exists(name: string): ExistsNode;
348
- /**
349
- * The attribute is set with exactly this type, whatever its value.
350
- *
351
- * Useful when the same name is written with different types across entities — a comparison already
352
- * asserts the type, so this is for asking about the type alone.
353
- *
354
- * @param tag - The type tag: `bool`, `i32`, `u64`, `u256`, `dec`, `bytes32`, `str`, `addr` or
355
- * `key`.
356
- * @throws {InvalidPredicateError} If the tag is not a settable type, or the name is a system
357
- * attribute (whose type is fixed).
358
- *
359
- * @example
360
- * hasType("age", "i32") // TYPEOF(age) = i32
361
- */
362
- declare function hasType(name: string, tag: UserTypeTag): TypeOfNode;
363
- /**
364
- * The complement of an expression, evaluated against the set of live entities — unlike `!=`, it
365
- * matches entities that never set the attribute at all.
366
- *
367
- * @example
368
- * not(exists("closedAt")) // NOT EXISTS(closedAt)
369
- * not(and(eq("a", 1), eq("b", 2))) // NOT (a = i32(1) AND b = i32(2))
370
- */
371
- declare function not(expression: Expression): NotNode;
372
- /**
373
- * All of these must hold.
374
- *
375
- * A single expression is returned unwrapped, so building a conjunction from a filtered list does
376
- * not litter the query with redundant nesting.
377
- *
378
- * @param expressions - The expressions, as separate arguments or one array.
379
- * @throws {InvalidPredicateError} If given nothing to combine.
380
- *
381
- * @example
382
- * and(gte("level", i32(10)), eq("status", "open"))
383
- * and(filters) // an array works too
384
- */
385
- declare function and(expressions: readonly Expression[]): Expression;
386
- declare function and(...expressions: Expression[]): Expression;
387
- /**
388
- * At least one of these must hold.
389
- *
390
- * A single expression is returned unwrapped.
391
- *
392
- * @param expressions - The expressions, as separate arguments or one array.
393
- * @throws {InvalidPredicateError} If given nothing to combine.
394
- *
395
- * @example
396
- * or(eq("status", "open"), not(exists("closedAt")))
397
- */
398
- declare function or(expressions: readonly Expression[]): Expression;
399
- declare function or(...expressions: Expression[]): Expression;
400
- /**
401
- * Renders an expression as the query string the node parses. Equivalent to `String(expression)`.
402
- *
403
- * Literals are always written tagged, even where the language would infer them: an untagged number
404
- * defaults to `i32`, but spelling it `i32(10)` keeps the exact-type assertion visible in the query
405
- * that actually went over the wire.
406
- */
407
- declare function render(expression: Expression): string;
408
- //#endregion
409
- //#region src/types/entity.d.ts
410
- /**
411
- * The fields an {@link Entity} can carry. Every one is optional: a query returns exactly the parts
412
- * it selected, and `undefined` means "not asked for" rather than "empty".
413
- */
414
- type EntityFields = {
415
- key?: Hex | undefined;
416
- owner?: Hex | undefined;
417
- creator?: Hex | undefined;
418
- /** Block the entity was created at. */
419
- createdAt?: bigint | undefined;
420
- /** Block the entity was last patched at. */
421
- updatedAt?: bigint | undefined;
422
- /** Block the entity expires at. */
423
- expiresAt?: bigint | undefined;
424
- /** The immutable properties the entity was created with. */
425
- creationFlags?: ResolvedCreationFlags | undefined;
426
- contentType?: string | undefined;
427
- payload?: Uint8Array | undefined;
428
- /** Attribute names and types, with no values. */
429
- attributeSchema?: AttributeSchema | undefined;
430
- /** Attribute names, types and values. */
431
- attributes?: Attributes | undefined;
432
- };
433
- /**
434
- * An entity as it comes back from a query.
435
- *
436
- * Which fields are populated is decided by the query's selection — `select({ key: true })` gives
437
- * back an entity carrying only its key. The static type of a `select()` result is narrowed to
438
- * exactly the selected fields, so in typed code the `undefined`s here are not reachable.
439
- */
440
- declare class Entity implements EntityFields {
441
- key: Hex | undefined;
442
- owner: Hex | undefined;
443
- creator: Hex | undefined;
444
- createdAt: bigint | undefined;
445
- updatedAt: bigint | undefined;
446
- expiresAt: bigint | undefined;
447
- creationFlags: ResolvedCreationFlags | undefined;
448
- contentType: string | undefined;
449
- payload: Uint8Array | undefined;
450
- attributeSchema: AttributeSchema | undefined;
451
- attributes: Attributes | undefined;
452
- constructor(fields?: EntityFields);
453
- /**
454
- * The payload decoded as UTF-8 text.
455
- *
456
- * @throws If the payload was not selected, or is not valid UTF-8.
457
- */
458
- toText(): string;
459
- /**
460
- * The payload parsed as JSON.
461
- *
462
- * @throws If the payload was not selected, is empty, or is not valid JSON.
463
- */
464
- toJson(): any;
465
- }
466
- //#endregion
467
- //#region src/query/selection.d.ts
468
- /**
469
- * The entity fields a query can select. Each maps one-to-one onto a field of {@link Entity}.
470
- *
471
- * `attributes` takes a third form beyond `true`/`false`: a map of names, to fetch only those.
472
- */
473
- type SelectionFields = {
474
- key?: boolean;
475
- owner?: boolean;
476
- creator?: boolean;
477
- createdAt?: boolean;
478
- updatedAt?: boolean;
479
- expiresAt?: boolean;
480
- creationFlags?: boolean;
481
- contentType?: boolean;
482
- payload?: boolean;
483
- /** Attribute names and types, without their values. */
484
- attributeSchema?: boolean;
485
- /** `true` for every attribute, or a map of names for a subset. */
486
- attributes?: boolean | Readonly<Record<string, boolean>>;
487
- };
488
- /** The selection keys, in the order they are written into the RPC `select` object. */
489
- declare const SELECTION_KEYS: readonly ["key", "owner", "creator", "createdAt", "updatedAt", "expiresAt", "creationFlags", "contentType", "payload", "attributeSchema", "attributes"];
490
- /**
491
- * Requires at least one property of `T` to be present.
492
- * `{}` is not assignable, which is how `select({})` is rejected at compile time.
493
- */
494
- type AtLeastOne<T, K$1 extends keyof T = keyof T> = { [P in K$1]: Required<Pick<T, P>> & Partial<Omit<T, P>> }[K$1];
495
- /**
496
- * A non-empty entity selection — the object form accepted by `select()`. At least one field must be
497
- * selected.
498
- */
499
- type EntitySelection = AtLeastOne<SelectionFields>;
500
- /** Argument accepted by `select()` — a non-empty {@link EntitySelection}, or `"*"` for everything. */
501
- type SelectArg = EntitySelection | "*";
502
- /** Whether a selection value asks for the field: `true`, or a non-empty map of attribute names. */
503
- type Selected<V> = V extends false | undefined ? false : true;
504
- /**
505
- * The result of a selection `S`: an {@link Entity} narrowed to exactly the selected fields (each
506
- * non-`undefined`). The shape is flat — `select({ owner: true })` yields `{ owner: Hex }`, read as
507
- * `entity.owner`. Accessing an unselected field is a compile error.
508
- *
509
- * `toText()` / `toJson()` operate on the payload, so they appear only when `payload` was selected —
510
- * calling them otherwise would always throw.
511
- */
512
- type ProjectedEntity<S> = { readonly [K in keyof S as Selected<S[K]> extends true ? K : never]: K extends keyof Entity ? NonNullable<Entity[K]> : never } & (S extends {
513
- payload: true;
514
- } ? Pick<Entity, "toText" | "toJson"> : unknown);
515
- /** A selection of every field, used to type the result of `select()` / `select("*")`. */
516
- type AllSelected = { [K in (typeof SELECTION_KEYS)[number]]: true };
517
- /** The projected entity type when everything is selected — every field, plus the methods. */
518
- type FullEntity = ProjectedEntity<AllSelected>;
519
- /**
520
- * Converts a {@link SelectArg} into the RPC `select` object.
521
- *
522
- * Every field is opt-in — anything not explicitly selected is sent as `false`, including the key.
523
- * Sending the full object rather than omitting the `false`s keeps what the SDK asked for legible in
524
- * a request log, and pins the answer even if a node's defaults change.
525
- *
526
- * `undefined` or `"*"` selects everything.
527
- *
528
- * @throws If the selection asks for nothing.
529
- *
530
- * @example
531
- * toRpcSelect() // everything
532
- * toRpcSelect({ key: true }) // only the key
533
- * toRpcSelect({ attributes: { projectId: true } }) // one named attribute
534
- */
535
- declare function toRpcSelect(selection?: SelectArg): RpcSelect;
536
- //#endregion
537
- //#region src/actions/public/query.d.ts
538
- type QueryOptions = {
539
- /** What to return. Defaults to everything. */
540
- select?: SelectArg | undefined;
541
- /** Block height to read at. Defaults to the head. */
542
- atBlock?: bigint | undefined;
543
- /** Page size, up to the node maximum of 200. */
544
- limit?: number | undefined;
545
- /** Cursor from a previous page. */
546
- cursor?: string | undefined;
547
- };
548
- type QueryReturnType = {
549
- entities: Entity[];
550
- /** The cursor for the next page, or `undefined` when no pages remain. */
551
- cursor: string | undefined;
552
- /** The block the page was read at. */
553
- blockNumber: bigint;
554
- };
555
- //#endregion
556
- //#region src/types/events.d.ts
557
- /**
558
- * Where an event sits in the chain — carried by every on-chain entity event.
559
- *
560
- * Operations apply in batch order and emit one event each, so `blockNumber` and `logIndex` together
561
- * are the order the operations were applied in. A replica that replays them in that order sees
562
- * exactly what the engine did.
563
- */
564
- type EntityEventContext = {
565
- /** The block the operation was applied in. */
566
- blockNumber: bigint;
567
- /** The transaction the operation was part of. */
568
- transactionHash: Hex;
569
- /** The event's position within its block. */
570
- logIndex: number;
571
- };
572
- /** An entity was created. */
573
- type EntityCreatedEvent = EntityEventContext & {
574
- type: "EntityCreated";
575
- entityKey: Hex;
576
- owner: Address;
577
- /** The block the entity is set to expire at. */
578
- expiresAt: bigint;
579
- /**
580
- * The immutable properties the entity was created with, decoded from its `creationFlags` byte.
581
- */
582
- creationFlags: ResolvedCreationFlags;
583
- };
584
- /**
585
- * An entity's attributes or payload changed.
586
- *
587
- * The event says *that* it changed, not what to — read the entity to see the new state.
588
- */
589
- type EntityPatchedEvent = EntityEventContext & {
590
- type: "EntityPatched";
591
- entityKey: Hex;
592
- owner: Address;
593
- };
594
- /** An entity's expiry moved further out. */
595
- type ExpiryExtendedEvent = EntityEventContext & {
596
- type: "ExpiryExtended";
597
- entityKey: Hex;
598
- /**
599
- * The entity's owner — **not** whoever extended it. An entity created with
600
- * `permissionlessExtension` can be extended by anyone, and the event does not say by whom; read
601
- * the transaction's sender if you need that.
602
- */
603
- owner: Address;
604
- /** The block the entity is now set to expire at. */
605
- expiresAt: bigint;
606
- };
607
- /** An entity changed hands. */
608
- type OwnershipTransferredEvent = EntityEventContext & {
609
- type: "OwnershipTransferred";
610
- entityKey: Hex;
611
- previousOwner: Address;
612
- newOwner: Address;
613
- };
614
- /** An entity was deleted by its owner, before its expiry. */
615
- type EntityDeletedEvent = EntityEventContext & {
616
- type: "EntityDeleted";
617
- entityKey: Hex;
618
- owner: Address;
619
- };
620
- /**
621
- * Every event the engine emits, discriminated by `type`.
622
- */
623
- type EntityEvent = EntityCreatedEvent | EntityPatchedEvent | ExpiryExtendedEvent | OwnershipTransferredEvent | EntityDeletedEvent;
624
- //#endregion
625
- //#region src/actions/public/watchEntityEvents.d.ts
626
- /**
627
- * Handlers and options for `client.watchEntityEvents`. Every handler is optional; the watcher does
628
- * the work for the ones you pass.
629
- */
630
- type WatchEntityEventsParameters = {
631
- onEntityCreated?: ((event: EntityCreatedEvent) => void) | undefined;
632
- onEntityPatched?: ((event: EntityPatchedEvent) => void) | undefined;
633
- onExpiryExtended?: ((event: ExpiryExtendedEvent) => void) | undefined;
634
- onOwnershipTransferred?: ((event: OwnershipTransferredEvent) => void) | undefined;
635
- onEntityDeleted?: ((event: EntityDeletedEvent) => void) | undefined;
636
- /**
637
- * Every event, in application order, whatever its type. Runs *before* the per-event handler for
638
- * the same event.
639
- *
640
- * This is the replay seam: operations apply in batch order and emit one event each, so an
641
- * off-chain replica that consumes this in order sees exactly what the engine did.
642
- */
643
- onEvent?: ((event: EntityEvent) => void) | undefined;
644
- /**
645
- * Transport failures, logs that will not decode, and anything one of your own handlers throws.
646
- *
647
- * Defaults to `console.error`. A watcher whose filter the node dropped otherwise just goes quiet,
648
- * and a quiet watcher is indistinguishable from a quiet chain.
649
- */
650
- onError?: ((error: Error) => void) | undefined;
651
- /** Replay from this block before following the head. Defaults to the head. */
652
- fromBlock?: bigint | undefined;
653
- /** How often to poll, in milliseconds. Defaults to half a block. */
654
- pollingInterval?: number | undefined;
655
- };
656
- //#endregion
657
- //#region src/actions/wallet/changeOwnership.d.ts
658
- /**
659
- * Parameters for the changeOwnership function.
660
- * - entityKey: The key of the entity.
661
- * - newOwner: The address of the new owner.
662
- */
663
- type ChangeOwnershipParameters = {
664
- entityKey: Hex;
665
- newOwner: Hex;
666
- };
667
- /**
668
- * Return type for the changeOwnership function.
669
- * - entityKey: The key of the entity.
670
- * - txHash: The transaction hash.
671
- */
672
- type ChangeOwnershipReturnType = {
673
- entityKey: Hex;
674
- txHash: Hash;
675
- };
676
- //#endregion
677
- //#region src/actions/wallet/createEntity.d.ts
678
- /**
679
- * Parameters for creating an entity.
680
- *
681
- * An entity always carries contents and a type for them, plus a lifetime. Attributes, flags and a
682
- * salt are optional on top of that.
683
- *
684
- * @example
685
- * const { entityKey } = await client.createEntity({
686
- * attributes: {
687
- * level: i32(10),
688
- * balance: u256(1_000_000n),
689
- * score: dec("3.5"),
690
- * name: "Bob", // bare string -> str
691
- * flagged: true, // bare boolean -> bool
692
- * },
693
- * payload: jsonToPayload({ hello: "world" }),
694
- * contentType: "application/json",
695
- * expires: ExpirationTime.fromDays(30),
696
- * flags: { readonly: true },
697
- * })
698
- *
699
- * @example Pin an absolute deadline, but refuse to create something nearly dead:
700
- * await client.createEntity({
701
- * payload, contentType: "application/json",
702
- * expires: ExpirationTime.atDate(someDeadline, {
703
- * atLeast: ExpirationTime.fromDays(1), // ...but live at least a day regardless
704
- * }),
705
- * })
706
- *
707
- * @example An entity that is nothing but queryable attributes still declares its (empty) contents:
708
- * await client.createEntity({
709
- * attributes: { parent: key(parentKey), rank: i32(3) },
710
- * payload: new Uint8Array(),
711
- * contentType: "application/octet-stream",
712
- * expires: ExpirationTime.fromDays(30),
713
- * })
714
- */
715
- type CreateEntityParameters = {
716
- /**
717
- * How long the entity should live, built with {@link ExpirationTime}.
718
- *
719
- * `ExpirationTime.fromDays(30)` is the everyday form. `atBlock` / `atDate` pin an absolute
720
- * deadline instead, and either can carry `{ atLeast }` to guarantee a minimum life on top of it.
721
- */
722
- expires: Expiry;
723
- /**
724
- * The entity's opaque payload. Travels to the engine as the `$payload` system attribute; on this
725
- * surface it is just the entity's contents.
726
- *
727
- * Pass an empty `Uint8Array` for an entity that is nothing but queryable attributes — it is
728
- * written as an empty payload rather than left unset, so what you pass is what is stored.
729
- */
730
- payload: Uint8Array;
731
- /** The payload's MIME type, e.g. `"application/json"`. Sent as the `$contentType` cell. */
732
- contentType: MimeType | (string & {});
733
- /**
734
- * The entity's queryable attributes, keyed by name. Values are the tagged constructors from
735
- * `@arkiv-network/sdk/attr` — `i32`, `u64`, `u256`, `dec`, `str`, `addr`, `key`, `bytes32`,
736
- * `bool` — or a bare `boolean`, `number`, `bigint` or `string` where the type is unambiguous.
737
- *
738
- * @throws {InvalidAttributeNameError} If a name violates the attribute-name grammar.
739
- * @throws {InvalidValueError} If a value does not fit the type it names or defaults to.
740
- */
741
- attributes?: AttributeInputs | undefined;
742
- /**
743
- * Properties fixed at creation: `readonly` and `permissionlessExtension`. No operation changes
744
- * them afterwards, so an entity is whatever it was created as for life. Both default to `false`.
745
- */
746
- flags?: CreationFlags | undefined;
747
- /**
748
- * The salt mixed into the entity key. Defaults to 128 random bits, which makes the key
749
- * unpredictable to everyone but the creator.
750
- *
751
- * Pass {@link NO_SALT} for a key derived from the owner and nonce alone — predictable by anyone,
752
- * which is what you want only when a third party must be able to compute the key in advance.
753
- */
754
- salt?: SaltInput | undefined;
755
- };
756
- /**
757
- * The result of creating an entity.
758
- */
759
- type CreateEntityReturnType = {
760
- /** The new entity's key. */
761
- entityKey: Hex;
762
- txHash: Hash;
763
- /**
764
- * The block the entity is expected to expire at, resolved against the block the transaction was
765
- * built on.
766
- *
767
- * The engine resolves a duration against the block the transaction actually lands in, so for
768
- * `ExpirationTime.fromDays(30)` and friends this is a lower bound: the real expiry is later by
769
- * however many blocks passed between building and inclusion. An `atBlock` deadline is exact.
770
- */
771
- expiresAt: bigint;
772
- };
773
- //#endregion
774
- //#region src/actions/wallet/deleteEntity.d.ts
775
- /**
776
- * Parameters for the deleteEntity function.
777
- * - entityKey: The key of the entity to delete.
778
- */
779
- type DeleteEntityParameters = {
780
- entityKey: Hex;
781
- };
782
- /**
783
- * Return type for the deleteEntity function.
784
- * - entityKey: The key of the entity.
785
- * - txHash: The transaction hash.
786
- */
787
- type DeleteEntityReturnType = {
788
- entityKey: Hex;
789
- txHash: Hash;
790
- };
791
- //#endregion
792
- //#region src/actions/wallet/extendEntity.d.ts
793
- /**
794
- * Parameters for extending an entity's life.
795
- *
796
- * An extension **sets a new expiry**; it does not add to the existing one. It is resolved exactly
797
- * as a create's is — a duration counts from now, not from the entity's current expiry — so
798
- * `ExpirationTime.fromDays(30)` means "alive for thirty more days from now" whatever the entity's
799
- * remaining life happened to be.
800
- *
801
- * The engine rejects an extension that would not move the expiry later, so extending an entity by
802
- * less than it already has left is an error rather than a silent shortening.
803
- *
804
- * @example
805
- * await client.extendEntity({ entityKey, expires: ExpirationTime.fromDays(30) })
806
- * await client.extendEntity({ entityKey, expires: ExpirationTime.atBlock(1_200_000n) })
807
- */
808
- type ExtendEntityParameters = {
809
- entityKey: Hex;
810
- /** The entity's new lifetime, built with {@link ExpirationTime}. */
811
- expires: Expiry;
812
- };
813
- /**
814
- * The result of extending an entity.
815
- */
816
- type ExtendEntityReturnType = {
817
- entityKey: Hex;
818
- txHash: Hash;
819
- /**
820
- * The block the entity is now expected to expire at, resolved against the block the transaction
821
- * was built on. Durations are approximate, so treat this as the estimate the operation was built
822
- * from rather than the block the engine settled on.
823
- */
824
- expiresAt: bigint;
825
- };
826
- //#endregion
827
- //#region src/actions/wallet/patchEntity.d.ts
828
- /**
829
- * Parameters for patching an entity.
830
- *
831
- * A patch names only what changes. Attributes it does not mention keep whatever value they have, and
832
- * the payload and content type stay as they are unless given — so a caller can change one field
833
- * without first reading the entity to learn what the others are, and without racing anyone else who
834
- * is changing a different field.
835
- *
836
- * The entity's identity is fixed: a patch never moves the key, the owner, the creation flags or the
837
- * expiry. Use `extendEntity` for the expiry and `changeOwnership` for the owner.
838
- *
839
- * @example Change one attribute and remove another, leaving the payload alone:
840
- * await client.patchEntity({
841
- * entityKey,
842
- * set: { status: "published", level: i32(11) },
843
- * unset: ["draft"],
844
- * })
845
- *
846
- * @example Replace the contents without touching a single attribute:
847
- * await client.patchEntity({
848
- * entityKey,
849
- * payload: jsonToPayload({ hello: "again" }),
850
- * })
851
- */
852
- type PatchEntityParameters = {
853
- /** The entity to patch. */
854
- entityKey: Hex;
855
- /**
856
- * Attributes to write, keyed by name. An existing attribute is overwritten — including with a
857
- * different type — and a name the entity does not carry yet is added.
858
- *
859
- * Values are the tagged constructors from `@arkiv-network/sdk/attr` — `i32`, `u64`, `u256`,
860
- * `dec`, `str`, `addr`, `key`, `bytes32`, `bool` — or a bare `boolean`, `number`, `bigint` or
861
- * `string` where the type is unambiguous.
862
- *
863
- * @throws {InvalidAttributeNameError} If a name violates the attribute-name grammar.
864
- * @throws {InvalidValueError} If a value does not fit the type it names or defaults to.
865
- */
866
- set?: AttributeInputs | undefined;
867
- /**
868
- * Attribute names to remove. Naming one the entity does not carry is not an error — the outcome
869
- * is the same either way, and a caller clearing a field should not have to know whether it was
870
- * ever set.
871
- *
872
- * @throws {ConflictingMutationError} If a name also appears in `set`.
873
- */
874
- unset?: readonly string[] | undefined;
875
- /**
876
- * The entity's new payload. Omit it to leave the current contents untouched; pass an empty
877
- * `Uint8Array` to replace them with nothing.
878
- */
879
- payload?: Uint8Array | undefined;
880
- /**
881
- * The payload's new MIME type. Omit it to keep the current one — which is what you want when the
882
- * new payload is the same kind of thing as the old.
883
- */
884
- contentType?: MimeType | (string & {}) | undefined;
885
- };
886
- /** The result of patching an entity. */
887
- type PatchEntityReturnType = {
888
- /** The patched entity's key — unchanged, since a patch never moves it. */
889
- entityKey: Hex;
890
- txHash: Hash;
891
- };
892
- //#endregion
893
- //#region src/actions/wallet/executeBatch.d.ts
894
- /**
895
- * Parameters for the executeBatch function.
896
- *
897
- * At least one operation is required; a batch with nothing in it throws rather than spending gas on
898
- * an empty transaction.
899
- */
900
- type ExecuteBatchParameters = {
901
- /** The entities to create. */
902
- creates?: CreateEntityParameters[];
903
- /** The patches to apply. */
904
- patches?: PatchEntityParameters[];
905
- /** The entities to delete. */
906
- deletes?: DeleteEntityParameters[];
907
- /** The expiries to set. */
908
- extensions?: ExtendEntityParameters[];
909
- /** The ownership transfers to perform. */
910
- ownershipChanges?: ChangeOwnershipParameters[];
911
- };
912
- /** Return type for the executeBatch function. */
913
- type ExecuteBatchReturnType = {
914
- /** The transaction hash. */
915
- txHash: Hash;
916
- /** The keys of the created entities, in batch order. */
917
- createdEntities: Hex[];
918
- /** The keys of the patched entities. */
919
- patchedEntities: Hex[];
920
- /** The keys of the deleted entities. */
921
- deletedEntities: Hex[];
922
- /** The keys of the extended entities. */
923
- extendedEntities: Hex[];
924
- /** The keys of the entities handed to a new owner. */
925
- ownershipChanges: Hex[];
926
- };
927
- //#endregion
928
- //#region src/types/mimeTypes.d.ts
929
- type MimeType = "text/plain" | "text/html" | "text/css" | "text/csv" | "text/xml" | "text/javascript" | "application/json" | "application/xml" | "application/pdf" | "application/zip" | "application/gzip" | "application/octet-stream" | "application/javascript" | "application/x-www-form-urlencoded" | "image/png" | "image/jpeg" | "image/webp" | "image/gif" | "image/svg+xml" | "audio/mpeg" | "audio/wav" | "audio/ogg" | "video/mp4" | "video/webm" | "video/ogg" | "multipart/form-data";
930
- //#endregion
931
- //#region src/types/txParams.d.ts
932
- /**
933
- * Transaction fields a write action passes through to the wallet, for the cases where the defaults
934
- * are not what you want.
935
- *
936
- * Fee style is either/or: give `gasPrice` for a legacy transaction, or `maxFeePerGas` /
937
- * `maxPriorityFeePerGas` for an EIP-1559 one. Mixing the two does not typecheck. Anything left out
938
- * is estimated.
939
- */
940
- type TxParams = {
941
- gas?: bigint;
942
- nonce?: number;
943
- gasPrice?: bigint;
944
- maxFeePerGas?: never;
945
- maxPriorityFeePerGas?: never;
946
- } | {
947
- gas?: bigint;
948
- nonce?: number;
949
- maxFeePerGas?: bigint;
950
- maxPriorityFeePerGas?: bigint;
951
- gasPrice?: never;
952
- };
953
- //#endregion
954
- export { render as $, toRpcSelect as A, StartsWithNode as B, QueryOptions as C, ProjectedEntity as D, FullEntity as E, ComparisonOperator as F, gt as G, and as H, ExistsNode as I, lt as J, gte as K, Expression as L, EntityFields as M, AndNode as N, SelectArg as O, ComparisonNode as P, or as Q, NotNode as R, OwnershipTransferredEvent as S, EntitySelection as T, eq as U, TypeOfNode as V, exists as W, ne as X, lte as Y, not as Z, EntityDeletedEvent as _, PatchEntityParameters as a, ArkivClient as at, EntityPatchedEvent as b, ExtendEntityReturnType as c, RpcAttributeSchemaEntry as ct, CreateEntityParameters as d, RpcQueryOptions as dt, startsWith as et, CreateEntityReturnType as f, RpcSelect as ft, EntityCreatedEvent as g, WatchEntityEventsParameters as h, ExecuteBatchReturnType as i, GetBlockTimingReturnType as it, Entity as j, SelectionFields as k, DeleteEntityParameters as l, RpcCreationFlags as lt, ChangeOwnershipReturnType as m, MimeType as n, PredictEntityKeysReturnType as nt, PatchEntityReturnType as o, ArkivRpcSchema as ot, ChangeOwnershipParameters as p, hasType as q, ExecuteBatchParameters as r, PredictedEntityKey as rt, ExtendEntityParameters as s, RpcAttribute as st, TxParams as t, PredictEntityKeysParameters as tt, DeleteEntityReturnType as u, RpcEntity as ut, EntityEvent as v, QueryReturnType as w, ExpiryExtendedEvent as x, EntityEventContext as y, OrNode as z };
955
- //# sourceMappingURL=index-DaNeJUw8.d.ts.map