@arkiv-network/sdk 0.8.0-advanced.2 → 0.8.0-advanced.3
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.
- package/dist/actions/advanced/index.cjs +6 -6
- package/dist/actions/advanced/index.d.cts +5 -5
- package/dist/actions/advanced/index.d.ts +6 -6
- package/dist/actions/advanced/index.js +6 -6
- package/dist/{advanced-fPImL6lW.cjs → advanced-Ds2XRflQ.cjs} +6 -6
- package/dist/{advanced-8ZPTmmaN.js → advanced-FZy7WoYR.js} +7 -7
- package/dist/advanced-FZy7WoYR.js.map +1 -0
- package/dist/{arkivTransactions-D74gERHG.d.cts → arkivTransactions-BpARZOsH.d.cts} +60 -47
- package/dist/arkivTransactions-BpARZOsH.d.cts.map +1 -0
- package/dist/{arkivTransactions-NtGD6uk5.d.ts → arkivTransactions-DfZ_yVDD.d.ts} +60 -47
- package/dist/arkivTransactions-DfZ_yVDD.d.ts.map +1 -0
- package/dist/attr/index.cjs +1 -1
- package/dist/attr/index.d.cts +1 -1
- package/dist/attr/index.d.ts +2 -2
- package/dist/attr/index.js +1 -1
- package/dist/{attributes-BhY5DwJp.js → attributes-BJGuhsqp.js} +14 -4
- package/dist/attributes-BJGuhsqp.js.map +1 -0
- package/dist/{attributes-Df9IsCVs.cjs → attributes-CMJlp1wn.cjs} +13 -3
- package/dist/chains/index.cjs +1 -1
- package/dist/chains/index.d.cts +3 -0
- package/dist/chains/index.d.cts.map +1 -1
- package/dist/chains/index.d.ts +3 -0
- package/dist/chains/index.d.ts.map +1 -1
- package/dist/chains/index.js +1 -1
- package/dist/{chains-BYRTTipa.cjs → chains-BfNQliHU.cjs} +3 -0
- package/dist/{chains-BJrZs6sG.js → chains-Du8tql7I.js} +4 -1
- package/dist/chains-Du8tql7I.js.map +1 -0
- package/dist/{codec-Car3KkFF.d.ts → codec-M74UR1_0.d.ts} +3 -4
- package/dist/codec-M74UR1_0.d.ts.map +1 -0
- package/dist/entity/index.cjs +5 -4
- package/dist/entity/index.d.cts +2 -2
- package/dist/entity/index.d.ts +3 -3
- package/dist/entity/index.js +5 -5
- package/dist/{errors-BVbjKVMN.cjs → errors-51znTSB1.cjs} +1 -1
- package/dist/{errors-LTe7bOYS.js → errors-CwPJ16bn.js} +2 -2
- package/dist/errors-CwPJ16bn.js.map +1 -0
- package/dist/{expiry-BjpxZZQU.js → expiry-CZErShX6.js} +2 -2
- package/dist/expiry-CZErShX6.js.map +1 -0
- package/dist/expiry-DRV29F1r.d.cts.map +1 -1
- package/dist/expiry-nDbCgZX4.d.ts.map +1 -1
- package/dist/{expiry-BELY2Kpw.cjs → expiry-xr6mx4f7.cjs} +1 -1
- package/dist/{flags-kr276q6i.cjs → flags-Bh0HJldY.cjs} +1 -1
- package/dist/{flags-DFBs2J94.js → flags-Cr76ldwF.js} +2 -2
- package/dist/{flags-DFBs2J94.js.map → flags-Cr76ldwF.js.map} +1 -1
- package/dist/{index-BF7Mq9Is.d.cts → index-CMeD8uEq.d.cts} +4 -4
- package/dist/{index-BF7Mq9Is.d.cts.map → index-CMeD8uEq.d.cts.map} +1 -1
- package/dist/{index-B5j76711.d.ts → index-CTDI5pXZ.d.ts} +5 -5
- package/dist/{index-B5j76711.d.ts.map → index-CTDI5pXZ.d.ts.map} +1 -1
- package/dist/{index-EeUO0nnJ.d.cts → index-CekGjkRx.d.cts} +5 -5
- package/dist/{index-EeUO0nnJ.d.cts.map → index-CekGjkRx.d.cts.map} +1 -1
- package/dist/{index-DvYvrkdk.d.ts → index-D0IzFwMX.d.ts} +12 -4
- package/dist/index-D0IzFwMX.d.ts.map +1 -0
- package/dist/{index-fX_XyqLp.d.ts → index-DZxwz2Ky.d.cts} +53 -43
- package/dist/index-DZxwz2Ky.d.cts.map +1 -0
- package/dist/{index-DHDud2hC.d.ts → index-Dz4SkQWg.d.ts} +4 -4
- package/dist/{index-DHDud2hC.d.ts.map → index-Dz4SkQWg.d.ts.map} +1 -1
- package/dist/{index-CA4V7Pdh.d.cts → index-JP31fjyM.d.ts} +53 -43
- package/dist/index-JP31fjyM.d.ts.map +1 -0
- package/dist/{index-CV5zCdpa.d.cts → index-NbfnXxgr.d.cts} +13 -6
- package/dist/index-NbfnXxgr.d.cts.map +1 -0
- package/dist/index.cjs +41 -42
- package/dist/index.d.cts +58 -52
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +59 -53
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -43
- package/dist/index.js.map +1 -1
- package/dist/{key-WKhXnXuU.cjs → key-E7mv0BYf.cjs} +23 -5
- package/dist/{key-D1Bh7MF0.js → key-XQkpw2xh.js} +17 -5
- package/dist/key-XQkpw2xh.js.map +1 -0
- package/dist/{payload-KC14SDlN.cjs → payload-Cvrir3Q-.cjs} +27 -2
- package/dist/{payload-CcUj85ys.d.ts → payload-D53ms-Mg.d.ts} +60 -1
- package/dist/payload-D53ms-Mg.d.ts.map +1 -0
- package/dist/{payload-Bz6651ax.js → payload-DaPzUvEh.js} +28 -3
- package/dist/payload-DaPzUvEh.js.map +1 -0
- package/dist/{payload-BNoud2KZ.d.cts → payload-hluX1rc0.d.cts} +60 -1
- package/dist/payload-hluX1rc0.d.cts.map +1 -0
- package/dist/query/index.cjs +4 -4
- package/dist/query/index.d.cts +3 -3
- package/dist/query/index.d.ts +4 -4
- package/dist/query/index.js +4 -4
- package/dist/{queryBuilder-DbUMEZln.cjs → queryBuilder-BXR-HxD9.cjs} +13 -10
- package/dist/{queryBuilder-DM6AWCBa.js → queryBuilder-BwauPaGO.js} +14 -11
- package/dist/queryBuilder-BwauPaGO.js.map +1 -0
- package/dist/{selection-DPg0uyJf.d.cts → selection-C6KeWJ7g.d.cts} +16 -8
- package/dist/selection-C6KeWJ7g.d.cts.map +1 -0
- package/dist/{selection-C4UhsMOO.d.ts → selection-mjiiAGDO.d.ts} +17 -9
- package/dist/selection-mjiiAGDO.d.ts.map +1 -0
- package/dist/types/index.d.cts +5 -5
- package/dist/types/index.d.ts +6 -6
- package/dist/utils/index.cjs +3 -3
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +3 -3
- package/package.json +1 -5
- package/src/actions/advanced/index.ts +1 -1
- package/src/actions/advanced/sendMutation.ts +1 -1
- package/src/actions/public/getEntity.ts +1 -0
- package/src/actions/public/predictEntityKeys.test.ts +17 -1
- package/src/actions/public/predictEntityKeys.ts +28 -14
- package/src/actions/wallet/createEntity.ts +7 -6
- package/src/actions/wallet/{mutateEntities.test.ts → executeBatch.test.ts} +7 -7
- package/src/actions/wallet/{mutateEntities.ts → executeBatch.ts} +9 -9
- package/src/actions/wallet/extendEntity.ts +1 -0
- package/src/actions/wallet/patchEntity.ts +3 -3
- package/src/attr/attributes.ts +8 -2
- package/src/attr/errors.ts +2 -2
- package/src/attr/types.ts +3 -3
- package/src/attr/values.ts +5 -1
- package/src/chains/localhost.ts +3 -0
- package/src/clients/createPublicClient.test.ts +1 -1
- package/src/clients/createPublicClient.ts +5 -5
- package/src/clients/createWalletClient.test.ts +2 -2
- package/src/clients/createWalletClient.ts +3 -5
- package/src/clients/decorators/arkivAdvanced.ts +1 -1
- package/src/clients/decorators/arkivPublic.ts +13 -12
- package/src/clients/decorators/arkivWallet.ts +40 -32
- package/src/entity/create.test.ts +20 -1
- package/src/entity/errors.ts +4 -3
- package/src/entity/expiry.ts +1 -0
- package/src/entity/index.ts +2 -1
- package/src/entity/key.ts +23 -3
- package/src/entity/operations.ts +1 -0
- package/src/query/errors.ts +1 -1
- package/src/query/expression.ts +14 -7
- package/src/query/queryBuilder.ts +1 -1
- package/src/types/index.ts +4 -4
- package/src/types/rpcSchema.ts +1 -0
- package/src/types/txParams.ts +8 -0
- package/src/utils/arkivTransactions.test.ts +7 -1
- package/src/utils/arkivTransactions.ts +2 -2
- package/src/utils/expirationTime.ts +39 -0
- package/src/utils/payload.ts +25 -0
- package/dist/advanced-8ZPTmmaN.js.map +0 -1
- package/dist/arkivTransactions-D74gERHG.d.cts.map +0 -1
- package/dist/arkivTransactions-NtGD6uk5.d.ts.map +0 -1
- package/dist/attributes-BhY5DwJp.js.map +0 -1
- package/dist/chains-BJrZs6sG.js.map +0 -1
- package/dist/codec-Car3KkFF.d.ts.map +0 -1
- package/dist/errors-LTe7bOYS.js.map +0 -1
- package/dist/expiry-BjpxZZQU.js.map +0 -1
- package/dist/index-CA4V7Pdh.d.cts.map +0 -1
- package/dist/index-CV5zCdpa.d.cts.map +0 -1
- package/dist/index-DvYvrkdk.d.ts.map +0 -1
- package/dist/index-fX_XyqLp.d.ts.map +0 -1
- package/dist/key-D1Bh7MF0.js.map +0 -1
- package/dist/payload-BNoud2KZ.d.cts.map +0 -1
- package/dist/payload-Bz6651ax.js.map +0 -1
- package/dist/payload-CcUj85ys.d.ts.map +0 -1
- package/dist/queryBuilder-DM6AWCBa.js.map +0 -1
- package/dist/selection-C4UhsMOO.d.ts.map +0 -1
- package/dist/selection-DPg0uyJf.d.cts.map +0 -1
package/src/query/expression.ts
CHANGED
|
@@ -12,6 +12,10 @@ import {
|
|
|
12
12
|
import { TYPE_IDS } from "../attr/types"
|
|
13
13
|
import { InvalidPredicateError, UnsupportedOperatorError } from "./errors"
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* The comparison operators the query language defines. `<` `<=` `>` `>=` need an ordered type —
|
|
17
|
+
* `i32`, `u64`, `u256` or `dec`; every type accepts `=` and `!=`.
|
|
18
|
+
*/
|
|
15
19
|
export type ComparisonOperator = "=" | "!=" | "<" | "<=" | ">" | ">="
|
|
16
20
|
|
|
17
21
|
/** A comparison between an attribute and a typed literal. */
|
|
@@ -216,7 +220,7 @@ export function ne(name: string, value: ValueInput): ComparisonNode {
|
|
|
216
220
|
}
|
|
217
221
|
|
|
218
222
|
/**
|
|
219
|
-
* Attribute is greater than value. Ordered types only (`i32`, `u256`, `dec`).
|
|
223
|
+
* Attribute is greater than value. Ordered types only (`i32`, `u64`, `u256`, `dec`).
|
|
220
224
|
*
|
|
221
225
|
* @throws {UnsupportedOperatorError} If the value's type carries no ordered index.
|
|
222
226
|
*
|
|
@@ -229,7 +233,7 @@ export function gt(name: string, value: ValueInput): ComparisonNode {
|
|
|
229
233
|
}
|
|
230
234
|
|
|
231
235
|
/**
|
|
232
|
-
* Attribute is greater than or equal to value. Ordered types only (`i32`, `u256`, `dec`).
|
|
236
|
+
* Attribute is greater than or equal to value. Ordered types only (`i32`, `u64`, `u256`, `dec`).
|
|
233
237
|
*
|
|
234
238
|
* @throws {UnsupportedOperatorError} If the value's type carries no ordered index.
|
|
235
239
|
*
|
|
@@ -241,7 +245,7 @@ export function gte(name: string, value: ValueInput): ComparisonNode {
|
|
|
241
245
|
}
|
|
242
246
|
|
|
243
247
|
/**
|
|
244
|
-
* Attribute is less than value. Ordered types only (`i32`, `u256`, `dec`).
|
|
248
|
+
* Attribute is less than value. Ordered types only (`i32`, `u64`, `u256`, `dec`).
|
|
245
249
|
*
|
|
246
250
|
* @throws {UnsupportedOperatorError} If the value's type carries no ordered index.
|
|
247
251
|
*
|
|
@@ -253,7 +257,7 @@ export function lt(name: string, value: ValueInput): ComparisonNode {
|
|
|
253
257
|
}
|
|
254
258
|
|
|
255
259
|
/**
|
|
256
|
-
* Attribute is less than or equal to value. Ordered types only (`i32`, `u256`, `dec`).
|
|
260
|
+
* Attribute is less than or equal to value. Ordered types only (`i32`, `u64`, `u256`, `dec`).
|
|
257
261
|
*
|
|
258
262
|
* @throws {UnsupportedOperatorError} If the value's type carries no ordered index.
|
|
259
263
|
*
|
|
@@ -271,7 +275,9 @@ export function lte(name: string, value: ValueInput): ComparisonNode {
|
|
|
271
275
|
* `startsWith("name", "é")` matches only the same byte sequence, not another normal form of it.
|
|
272
276
|
*
|
|
273
277
|
* @param prefix - The prefix, as a bare string or a `str` value.
|
|
274
|
-
* @throws {
|
|
278
|
+
* @throws {InvalidPredicateError} If the name is not a queryable attribute.
|
|
279
|
+
* @throws {UnsupportedOperatorError} If given a value that is not a `str`, or a system attribute
|
|
280
|
+
* (none of which is a `str`).
|
|
275
281
|
*
|
|
276
282
|
* @example
|
|
277
283
|
* startsWith("desc", "ab") // desc STARTSWITH str('ab')
|
|
@@ -325,7 +331,8 @@ export function exists(name: string): ExistsNode {
|
|
|
325
331
|
* Useful when the same name is written with different types across entities — a comparison already
|
|
326
332
|
* asserts the type, so this is for asking about the type alone.
|
|
327
333
|
*
|
|
328
|
-
* @param tag - The type tag: `bool`, `i32`, `u256`, `dec`, `bytes32`, `str`, `addr` or
|
|
334
|
+
* @param tag - The type tag: `bool`, `i32`, `u64`, `u256`, `dec`, `bytes32`, `str`, `addr` or
|
|
335
|
+
* `key`.
|
|
329
336
|
* @throws {InvalidPredicateError} If the tag is not a settable type, or the name is a system
|
|
330
337
|
* attribute (whose type is fixed).
|
|
331
338
|
*
|
|
@@ -344,7 +351,7 @@ export function hasType(name: string, tag: UserTypeTag): TypeOfNode {
|
|
|
344
351
|
if (!isUserTypeTag(tag)) {
|
|
345
352
|
throw new InvalidPredicateError(
|
|
346
353
|
`"${tag}" is not a settable attribute type. Use one of ` +
|
|
347
|
-
"bool, i32, u256, dec, bytes32, str, addr, key.",
|
|
354
|
+
"bool, i32, u64, u256, dec, bytes32, str, addr, key.",
|
|
348
355
|
name,
|
|
349
356
|
)
|
|
350
357
|
}
|
|
@@ -5,7 +5,7 @@ import type { Entity } from "../types/entity"
|
|
|
5
5
|
import type { RpcSelect } from "../types/rpcSchema"
|
|
6
6
|
import { type QueryRequest, runQuery } from "./engine"
|
|
7
7
|
import { InvalidPredicateError } from "./errors"
|
|
8
|
-
import { and, type Expression, eq } from "./expression"
|
|
8
|
+
import { and, type Expression, eq, type or } from "./expression"
|
|
9
9
|
import { QueryResult } from "./queryResult"
|
|
10
10
|
import { type SelectArg, toRpcSelect } from "./selection"
|
|
11
11
|
|
package/src/types/index.ts
CHANGED
|
@@ -12,11 +12,11 @@ export type {
|
|
|
12
12
|
} from "../actions/wallet/changeOwnership"
|
|
13
13
|
export type { CreateEntityParameters, CreateEntityReturnType } from "../actions/wallet/createEntity"
|
|
14
14
|
export type { DeleteEntityParameters, DeleteEntityReturnType } from "../actions/wallet/deleteEntity"
|
|
15
|
-
export type { ExtendEntityParameters, ExtendEntityReturnType } from "../actions/wallet/extendEntity"
|
|
16
15
|
export type {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from "../actions/wallet/
|
|
16
|
+
ExecuteBatchParameters,
|
|
17
|
+
ExecuteBatchReturnType,
|
|
18
|
+
} from "../actions/wallet/executeBatch"
|
|
19
|
+
export type { ExtendEntityParameters, ExtendEntityReturnType } from "../actions/wallet/extendEntity"
|
|
20
20
|
export type { PatchEntityParameters, PatchEntityReturnType } from "../actions/wallet/patchEntity"
|
|
21
21
|
export type { EntityFields } from "./entity"
|
|
22
22
|
export { Entity } from "./entity"
|
package/src/types/rpcSchema.ts
CHANGED
|
@@ -69,6 +69,7 @@ export type RpcSelect = {
|
|
|
69
69
|
attributes?: boolean | Record<string, boolean>
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/** The second parameter of `arkiv_query` — what to return, and where in the results to start. */
|
|
72
73
|
export type RpcQueryOptions = {
|
|
73
74
|
/** Block height to read at, as a hex quantity. Defaults to the head, and must be within the node's retained range. */
|
|
74
75
|
atBlock?: Hex
|
package/src/types/txParams.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transaction fields a write action passes through to the wallet, for the cases where the defaults
|
|
3
|
+
* are not what you want.
|
|
4
|
+
*
|
|
5
|
+
* Fee style is either/or: give `gasPrice` for a legacy transaction, or `maxFeePerGas` /
|
|
6
|
+
* `maxPriorityFeePerGas` for an EIP-1559 one. Mixing the two does not typecheck. Anything left out
|
|
7
|
+
* is estimated.
|
|
8
|
+
*/
|
|
1
9
|
export type TxParams =
|
|
2
10
|
| {
|
|
3
11
|
gas?: bigint
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from "../attr"
|
|
24
24
|
import type { ArkivClient } from "../clients/baseClient"
|
|
25
25
|
import { ARKIV_ADDRESS } from "../consts"
|
|
26
|
-
import { InvalidExpiryError } from "../entity"
|
|
26
|
+
import { InvalidExpiryError, NO_SALT } from "../entity"
|
|
27
27
|
import { ENTITY_EVENTS_ABI, type EntityEventName } from "../entity/events"
|
|
28
28
|
import { MAX_EXPIRES_AT, OperationType } from "../entity/params"
|
|
29
29
|
import { EmptyPatchError, EntityMutationError } from "../errors"
|
|
@@ -304,6 +304,12 @@ describe("creation flags and salt", () => {
|
|
|
304
304
|
expect(sentCreate(w2).salt).toBe(0n)
|
|
305
305
|
})
|
|
306
306
|
|
|
307
|
+
it("sends a zero salt for a create that opts out with NO_SALT", async () => {
|
|
308
|
+
const { client, writeContract } = makeClient()
|
|
309
|
+
await sendArkivTransaction(client, { creates: [{ ...validCreate, salt: NO_SALT }] })
|
|
310
|
+
expect(sentCreate(writeContract).salt).toBe(0n)
|
|
311
|
+
})
|
|
312
|
+
|
|
307
313
|
it("rejects a salt wider than the uint128 field", async () => {
|
|
308
314
|
const { client } = makeClient()
|
|
309
315
|
await expect(
|
|
@@ -22,7 +22,7 @@ import { ARKIV_ADDRESS } from "../consts"
|
|
|
22
22
|
import { ENTITY_EVENTS_ABI } from "../entity/events"
|
|
23
23
|
import { type Expiry, type ExpiryContext, resolveExpiry } from "../entity/expiry"
|
|
24
24
|
import { encodeCreationFlags } from "../entity/flags"
|
|
25
|
-
import { randomSalt,
|
|
25
|
+
import { randomSalt, resolveSalt } from "../entity/key"
|
|
26
26
|
import {
|
|
27
27
|
createOperation,
|
|
28
28
|
deleteOperation,
|
|
@@ -285,7 +285,7 @@ export function buildEntityOperations(ops: EntityMutationOps, context: ExpiryCon
|
|
|
285
285
|
const createOps = (creates ?? []).map((item) => {
|
|
286
286
|
validateContentType(item.contentType)
|
|
287
287
|
|
|
288
|
-
const salt = item.salt === undefined ? randomSalt() :
|
|
288
|
+
const salt = item.salt === undefined ? randomSalt() : resolveSalt(item.salt)
|
|
289
289
|
const expiry = resolveExpiry(item.expires, context)
|
|
290
290
|
|
|
291
291
|
return createOperation({
|
|
@@ -51,11 +51,50 @@ export const ExpirationTime = {
|
|
|
51
51
|
* @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.
|
|
52
52
|
*/
|
|
53
53
|
fromSeconds: (seconds: number): Lifetime => lifetimeOf(seconds),
|
|
54
|
+
/**
|
|
55
|
+
* A number of minutes.
|
|
56
|
+
*
|
|
57
|
+
* @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.
|
|
58
|
+
*/
|
|
54
59
|
fromMinutes: (minutes: number): Lifetime => lifetimeOf(minutes * 60),
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A number of hours.
|
|
63
|
+
*
|
|
64
|
+
* @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.
|
|
65
|
+
*/
|
|
55
66
|
fromHours: (hours: number): Lifetime => lifetimeOf(hours * 60 * 60),
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* A number of days. The everyday form — `fromDays(30)` is what most creates want.
|
|
70
|
+
*
|
|
71
|
+
* @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.
|
|
72
|
+
*/
|
|
56
73
|
fromDays: (days: number): Lifetime => lifetimeOf(days * 24 * 60 * 60),
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A number of weeks, each of 7 days.
|
|
77
|
+
*
|
|
78
|
+
* @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.
|
|
79
|
+
*/
|
|
57
80
|
fromWeeks: (weeks: number): Lifetime => lifetimeOf(weeks * 7 * 24 * 60 * 60),
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* A number of months, each of exactly **30 days** — calendar months are not all the same length,
|
|
84
|
+
* and a lifetime is a duration rather than a date. Use {@link ExpirationTime.atDate} when the
|
|
85
|
+
* expiry has to land on a particular calendar day.
|
|
86
|
+
*
|
|
87
|
+
* @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.
|
|
88
|
+
*/
|
|
58
89
|
fromMonths: (months: number): Lifetime => lifetimeOf(months * 30 * 24 * 60 * 60),
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A number of years, each of exactly **365 days** — leap days are not counted, so `fromYears(4)`
|
|
93
|
+
* is a day short of four calendar years. Use {@link ExpirationTime.atDate} for a calendar
|
|
94
|
+
* deadline.
|
|
95
|
+
*
|
|
96
|
+
* @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.
|
|
97
|
+
*/
|
|
59
98
|
fromYears: (years: number): Lifetime => lifetimeOf(years * 365 * 24 * 60 * 60),
|
|
60
99
|
|
|
61
100
|
/**
|
package/src/utils/payload.ts
CHANGED
|
@@ -1,9 +1,34 @@
|
|
|
1
1
|
import { stringToBytes, toBytes } from "viem"
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* A JSON-serialisable value as an entity payload — `JSON.stringify` then UTF-8.
|
|
5
|
+
*
|
|
6
|
+
* Pair it with `contentType: "application/json"`, which is what lets `entity.toJson()` read it back.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* await client.createEntity({
|
|
10
|
+
* payload: jsonToPayload({ hello: "world" }),
|
|
11
|
+
* contentType: "application/json",
|
|
12
|
+
* expires: ExpirationTime.fromDays(30),
|
|
13
|
+
* })
|
|
14
|
+
*/
|
|
3
15
|
export function jsonToPayload(json: object): Uint8Array {
|
|
4
16
|
return toBytes(JSON.stringify(json))
|
|
5
17
|
}
|
|
6
18
|
|
|
19
|
+
/**
|
|
20
|
+
* A string as an entity payload, encoded as UTF-8.
|
|
21
|
+
*
|
|
22
|
+
* Hex-looking text is encoded as text: `stringToPayload("0xab")` gives the four bytes of that
|
|
23
|
+
* string, not the single byte `0xab`. Read it back with `entity.toText()`.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* await client.createEntity({
|
|
27
|
+
* payload: stringToPayload("hello"),
|
|
28
|
+
* contentType: "text/plain",
|
|
29
|
+
* expires: ExpirationTime.fromDays(30),
|
|
30
|
+
* })
|
|
31
|
+
*/
|
|
7
32
|
export function stringToPayload(data: string): Uint8Array {
|
|
8
33
|
// stringToBytes, not toBytes: toBytes hex-decodes hex-looking strings, which
|
|
9
34
|
// would corrupt payloads like "0xab" instead of UTF-8 encoding them
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"advanced-8ZPTmmaN.js","names":["logger","EXECUTE_ABI","EXECUTE_FUNCTION_ABI","operations: Operation[]","events: MutationEvents","logger","logger","logger"],"sources":["../src/entity/operations.ts","../src/utils/revert.ts","../src/utils/arkivTransactions.ts","../src/actions/advanced/buildMutation.ts","../src/actions/advanced/getMutationResult.ts","../src/actions/advanced/pingTransaction.ts","../src/actions/advanced/sendMutation.ts"],"sourcesContent":["import { type Address, encodeAbiParameters, type Hex, parseAbi, parseAbiParameters } from \"viem\"\nimport type { AbiAttribute } from \"../attr/codec\"\nimport type { EncodedExpiry } from \"./expiry\"\nimport { OperationType } from \"./params\"\n\n/**\n * The one external entry point. A transaction is an ordered, **atomic** batch of entity operations:\n * all of them apply or none do, operation *n+1* observes operation *n*'s effects, and each applied\n * operation emits one event.\n */\nexport const EXECUTE_ABI = parseAbi([\n \"function execute((uint8 operation, bytes operationData)[] ops) external returns (bytes32[] keys)\",\n])\n\n/**\n * The engine's one read-only view: an owner's entity-minting nonce, which is the input\n * {@link predictEntityKey} needs and the only part of the derivation the caller cannot know.\n *\n * It is a `view` on the same address `execute` is called on, so it answers over `eth_call` without\n * a transaction.\n */\nexport const ENTITY_NONCE_ABI = parseAbi([\n \"function entityNonce(address owner) external view returns (uint64)\",\n])\n\n/**\n * The shared attribute shape, used by `create` (attributes) and `patch` (mutations). Written out\n * once and reused by every payload that carries attributes.\n */\nconst ATTRIBUTE_TUPLE = \"(bytes32 name, uint8 typeId, bytes value)[]\"\n\n/**\n * The payload struct for each operation tag. `operationData` is `abi.encode` of the struct the tag\n * selects — a tagged union, so a new operation is additive rather than a change to `execute`.\n */\nconst PAYLOAD_PARAMS = {\n [OperationType.Create]: parseAbiParameters(\n `(uint128 salt, uint64 expiresAt, uint64 minLifetime, uint8 creationFlags, ${ATTRIBUTE_TUPLE} attributes)`,\n ),\n [OperationType.Patch]: parseAbiParameters(`(bytes32 entityKey, ${ATTRIBUTE_TUPLE} mutations)`),\n [OperationType.ExtendExpiry]: parseAbiParameters(\n \"(bytes32 entityKey, uint64 expiresAt, uint64 minLifetime)\",\n ),\n [OperationType.TransferOwnership]: parseAbiParameters(\"(bytes32 entityKey, address newOwner)\"),\n [OperationType.Delete]: parseAbiParameters(\"(bytes32 entityKey)\"),\n} as const\n\n/** One entry of the `execute` batch: the operation tag and its ABI-encoded payload. */\nexport type Operation = {\n operation: number\n operationData: Hex\n}\n\n/** Creates an entity. The key is derived by the engine; predict it with `predictEntityKey`. */\nexport function createOperation({\n salt,\n expiry,\n creationFlags,\n attributes,\n}: {\n salt: bigint\n expiry: EncodedExpiry\n creationFlags: number\n attributes: AbiAttribute[]\n}): Operation {\n return {\n operation: OperationType.Create,\n operationData: encodeAbiParameters(PAYLOAD_PARAMS[OperationType.Create], [\n {\n salt,\n expiresAt: expiry.expiresAt,\n minLifetime: expiry.minLifetime,\n creationFlags,\n attributes,\n },\n ]),\n }\n}\n\n/** Applies a set of mutations to an existing entity. Tombstones unset attributes. */\nexport function patchOperation({\n entityKey,\n mutations,\n}: {\n entityKey: Hex\n mutations: AbiAttribute[]\n}): Operation {\n return {\n operation: OperationType.Patch,\n operationData: encodeAbiParameters(PAYLOAD_PARAMS[OperationType.Patch], [\n { entityKey, mutations },\n ]),\n }\n}\n\n/** Pushes an entity's expiry further out. Extending is allowed; shortening reverts. */\nexport function extendExpiryOperation({\n entityKey,\n expiry,\n}: {\n entityKey: Hex\n expiry: EncodedExpiry\n}): Operation {\n return {\n operation: OperationType.ExtendExpiry,\n operationData: encodeAbiParameters(PAYLOAD_PARAMS[OperationType.ExtendExpiry], [\n { entityKey, expiresAt: expiry.expiresAt, minLifetime: expiry.minLifetime },\n ]),\n }\n}\n\n/** Hands an entity to a new owner. */\nexport function transferOwnershipOperation({\n entityKey,\n newOwner,\n}: {\n entityKey: Hex\n newOwner: Address\n}): Operation {\n return {\n operation: OperationType.TransferOwnership,\n operationData: encodeAbiParameters(PAYLOAD_PARAMS[OperationType.TransferOwnership], [\n { entityKey, newOwner },\n ]),\n }\n}\n\n/** Deletes an entity before its expiry. */\nexport function deleteOperation({ entityKey }: { entityKey: Hex }): Operation {\n return {\n operation: OperationType.Delete,\n operationData: encodeAbiParameters(PAYLOAD_PARAMS[OperationType.Delete], [{ entityKey }]),\n }\n}\n","import { BaseError, ContractFunctionRevertedError, type Hex, hexToString } from \"viem\"\n\n/**\n * Turns a decoded engine revert into a sentence that says what to change.\n *\n * viem decodes the error and then renders it positionally — `Ident32InvalidByte(uint256 position,\n * bytes1 value)` arrives as `(5, 0x41)`, which is the right data and no help at all. The engine's\n * errors carry enough to name the actual problem, so this spends the args rather than printing\n * them.\n *\n * @param error - Anything thrown by a write action.\n * @returns The explanation, or `undefined` if this was not a decodable engine revert — in which\n * case the caller should fall back to whatever the transport said.\n */\nexport function describeEntityRevert(error: unknown): string | undefined {\n if (!(error instanceof BaseError)) return undefined\n const reverted = error.walk((e) => e instanceof ContractFunctionRevertedError)\n if (!(reverted instanceof ContractFunctionRevertedError)) return undefined\n\n const name = reverted.data?.errorName\n if (name === undefined) return undefined\n const args = (reverted.data?.args ?? []) as readonly unknown[]\n\n return explain(name, args) ?? `the engine rejected the batch with ${name}`\n}\n\n/** The attribute-name charset, quoted the way an error message should read. */\nconst CHARSET = '\"A\"-\"Z\", \"a\"-\"z\", \"0\"-\"9\", \".\", \"-\" and \"_\", with a letter first'\n\nfunction explain(name: string, args: readonly unknown[]): string | undefined {\n switch (name) {\n // ── attribute names ──────────────────────────────────────────────────────\n case \"Ident32InvalidByte\": {\n const position = Number(args[0] ?? 0)\n const char = printable(String(args[1] ?? \"0x00\"))\n return (\n `an attribute name holds ${char} at byte ${position}, which is outside the ` +\n `name charset (${CHARSET})`\n )\n }\n case \"Ident32Empty\":\n return \"an attribute name is empty\"\n\n // ── the attribute list ───────────────────────────────────────────────────\n case \"SystemAttributeNotWritable\":\n return (\n `\"${identName(args[0])}\" is owned by the engine and cannot be written. Only $payload and ` +\n \"$contentType are yours to set\"\n )\n case \"TombstoneInCreate\":\n return (\n `a create cannot unset \"${identName(args[0])}\" — nothing exists yet, so leave the name ` +\n \"out instead\"\n )\n case \"TombstoneValueNotEmpty\":\n return `the tombstone for \"${identName(args[0])}\" carries a value; unsetting takes no value`\n case \"InvalidValueType\":\n return `\"${identName(args[0])}\" names type id ${String(args[1])}, which is not a known type`\n case \"AttributesNotSorted\":\n return \"attributes must be strictly ascending by name, which also makes each name unique\"\n case \"TooManyAttributes\":\n return `${String(args[0])} attributes exceeds the limit of ${String(args[1])}`\n case \"EmptyMutations\":\n return `the patch of ${short(args[0])} has no mutations, so it would do nothing`\n\n // ── entity state and authorisation ───────────────────────────────────────\n case \"EntityNotFound\":\n return `no entity ${short(args[0])} — it may have been deleted, or have expired`\n case \"EntityExpired\":\n return `entity ${short(args[0])} expired at block ${String(args[1])}`\n case \"NotOwner\":\n return `entity ${short(args[0])} is owned by ${String(args[2])}, not ${String(args[1])}`\n case \"ReadOnlyEntity\":\n return (\n `entity ${short(args[0])} was created readonly, so its contents can never change. Its ` +\n \"expiry can still be extended, and it can be transferred or deleted\"\n )\n case \"ReservedCreationFlags\":\n return (\n `creation flags 0b${Number(args[0] ?? 0)\n .toString(2)\n .padStart(8, \"0\")} set a reserved ` +\n \"bit; only readonly and permissionlessExtension are defined\"\n )\n\n // ── expiry ───────────────────────────────────────────────────────────────\n case \"ExpiryDeadOnArrival\":\n return (\n `the expiry resolves to block ${String(args[0])}, which is not after the current block ` +\n `${String(args[1])}`\n )\n case \"ExpiryNotExtended\":\n return (\n `entity ${short(args[0])} already expires at block ${String(args[2])}, so extending it ` +\n `to ${String(args[1])} would shorten its life`\n )\n\n // ── ownership ────────────────────────────────────────────────────────────\n case \"TransferToZeroAddress\":\n return `entity ${short(args[0])} cannot be transferred to the zero address`\n case \"TransferToSelf\":\n return `entity ${short(args[0])} is already owned by that account`\n\n // ── batch framing ────────────────────────────────────────────────────────\n case \"EmptyBatch\":\n return \"the batch has no operations\"\n case \"InvalidOpType\":\n return `operation tag ${String(args[0])} is not one the engine knows`\n case \"NonCanonicalOperationData\":\n return (\n `the payload for operation tag ${String(args[0])} is not its canonical encoding, so the ` +\n \"engine refused it rather than accept a second spelling of the same operation\"\n )\n\n default:\n return undefined\n }\n}\n\n/** A `bytes32` Ident32 cell as the name it holds — left-aligned, null-padded. */\nfunction identName(raw: unknown): string {\n if (typeof raw !== \"string\") return String(raw)\n try {\n // Cut at the first null rather than trimming with a regex: the padding is whatever follows\n // the name, so everything before it is the name and nothing after it is. Written as an escape\n // because a literal NUL byte in source is invisible to every reader after you.\n return hexToString(raw as Hex).split(\"\\u0000\")[0] ?? \"\"\n } catch {\n return raw\n }\n}\n\n/** An entity key, abbreviated */\nfunction short(raw: unknown): string {\n const text = String(raw)\n return text.length > 18 ? `${text.slice(0, 10)}…${text.slice(-6)}` : text\n}\n\n/** A `bytes1` as something readable: the character it is, plus the byte it was. */\nfunction printable(byte: string): string {\n const code = Number.parseInt(byte.replace(/^0x/, \"\"), 16)\n if (!Number.isFinite(code)) return `byte ${byte}`\n const char = String.fromCharCode(code)\n return code >= 0x21 && code <= 0x7e ? `\"${char}\" (${byte})` : `byte ${byte}`\n}\n","import {\n type Address,\n ContractFunctionExecutionError,\n ContractFunctionRevertedError,\n decodeEventLog,\n type Hash,\n type Hex,\n parseAbi,\n TransactionExecutionError,\n type TransactionReceipt,\n} from \"viem\"\nimport type { ChangeOwnershipParameters } from \"../actions/wallet/changeOwnership\"\nimport type { CreateEntityParameters } from \"../actions/wallet/createEntity\"\nimport type { DeleteEntityParameters } from \"../actions/wallet/deleteEntity\"\nimport type { ExtendEntityParameters } from \"../actions/wallet/extendEntity\"\nimport type { PatchEntityParameters } from \"../actions/wallet/patchEntity\"\n// Internal seam: the ABI encoders are not part of the package's public surface.\nimport { encodeAttributes, encodeMutations } from \"../attr/attributes\"\nimport type { ArkivClient } from \"../clients/baseClient\"\nimport type { WalletArkivClient } from \"../clients/createWalletClient\"\nimport { ARKIV_ADDRESS } from \"../consts\"\nimport { ENTITY_EVENTS_ABI } from \"../entity/events\"\nimport { type Expiry, type ExpiryContext, resolveExpiry } from \"../entity/expiry\"\nimport { encodeCreationFlags } from \"../entity/flags\"\nimport { randomSalt, validateSalt } from \"../entity/key\"\nimport {\n createOperation,\n deleteOperation,\n EXECUTE_ABI as EXECUTE_FUNCTION_ABI,\n extendExpiryOperation,\n type Operation,\n patchOperation,\n transferOwnershipOperation,\n} from \"../entity/operations\"\nimport { EmptyPatchError, EntityMutationError, InvalidContentTypeError } from \"../errors\"\nimport type { TxParams } from \"../types\"\n\nimport { getLogger } from \"./logger\"\nimport { describeEntityRevert } from \"./revert\"\n\nconst logger = getLogger(\"utils:arkiv-transactions\")\n\n// RFC 2045 token chars, lowercase only. Rejects uppercase to prevent text/plain vs Text/Plain ambiguity.\nconst MIME_REGEX = /^[a-z][a-z0-9!#$&\\-^_]*\\/[a-z0-9][a-z0-9!#$&\\-^_.+]*$/\n\nfunction validateContentType(contentType: string): void {\n if (!MIME_REGEX.test(contentType)) {\n throw new InvalidContentTypeError(contentType)\n }\n}\n\nexport const ENTITY_ERRORS_ABI = parseAbi([\n // Batch and operation framing.\n \"error EmptyBatch()\",\n \"error InvalidOpType(uint8 operation)\",\n \"error NonCanonicalOperationData(uint8 operation)\",\n // The attribute triple list, structural.\n \"error AttributesNotSorted()\",\n \"error TooManyAttributes(uint256 count, uint256 maxCount)\",\n \"error EmptyMutations(bytes32 entityKey)\",\n \"error TombstoneInCreate(bytes32 name)\",\n \"error TombstoneValueNotEmpty(bytes32 name)\",\n \"error SystemAttributeNotWritable(bytes32 name)\",\n \"error InvalidValueType(bytes32 name, uint8 typeId)\",\n // Attribute-name validation. `Ident32` is a bytes32 on the wire.\n \"error Ident32Empty()\",\n \"error Ident32InvalidByte(uint256 position, bytes1 value)\",\n // Entity state and authorisation.\n \"error EntityNotFound(bytes32 entityKey)\",\n \"error EntityExpired(bytes32 entityKey, uint64 expiresAt)\",\n \"error NotOwner(bytes32 entityKey, address caller, address owner)\",\n \"error ReadOnlyEntity(bytes32 entityKey)\",\n \"error ReservedCreationFlags(uint8 creationFlags)\",\n // Expiry. The engine bounds an expiry only by the width of the field and by liveness — there is\n // no MAX_EXPIRES_AT or MAX_LIFETIME, so there is no error for exceeding one.\n \"error ExpiryDeadOnArrival(uint64 target, uint64 currentBlock)\",\n \"error ExpiryNotExtended(bytes32 entityKey, uint64 newExpiresAt, uint64 currentExpiresAt)\",\n // Ownership transfer.\n \"error TransferToZeroAddress(bytes32 entityKey)\",\n \"error TransferToSelf(bytes32 entityKey)\",\n])\n\nconst EXECUTE_ABI = [...EXECUTE_FUNCTION_ABI, ...ENTITY_ERRORS_ABI]\n\nexport type SendArkivTransactionResult = {\n receipt: TransactionReceipt\n /** The keys the engine minted for the entities this transaction created, in batch order. */\n createdEntityKeys: Hex[]\n /** The block each created entity expires at, as the engine recorded it, in the same order. */\n createdExpiries: bigint[]\n /** The block each extended entity now expires at, as the engine recorded it, in batch order. */\n extendedExpiries: bigint[]\n}\n\nexport async function sendArkivTransaction(\n client: ArkivClient,\n ops: EntityMutationOps,\n txParams?: TxParams,\n): Promise<SendArkivTransactionResult> {\n if (!client.account) throw new Error(\"Account required\")\n if (!client.chain) throw new Error(\"Chain required\")\n const walletClient = client as WalletArkivClient\n\n const { creates, extensions } = ops\n\n // The block height, to resolve any relative expiry — which both creates and extensions carry.\n // Skipped entirely for a batch with neither. Deliberately fetched even when every expiry is\n // absolute (where `mutationNeedsBlockNumber` would say no): the head is what makes the local\n // dead-on-arrival check in `resolveExpiry` work, and the everyday path buys that check — the\n // advanced path is where both are traded away for the saved call.\n const currentBlock =\n creates?.length || extensions?.length ? await walletClient.getBlockNumber() : 0n\n\n const operations = buildEntityOperations(ops, { currentBlock })\n\n logger(\"Sending execute with %d operations %o\", operations.length, operations)\n\n const txHash = await submitMutation(client, operations, txParams)\n\n try {\n const receipt = await walletClient.waitForTransactionReceipt({ hash: txHash })\n logger(\"Tx receipt %o\", receipt)\n\n if (receipt.status === \"reverted\") {\n try {\n await walletClient.simulateContract({\n address: ARKIV_ADDRESS,\n abi: EXECUTE_ABI,\n functionName: \"execute\",\n args: [operations],\n account: client.account,\n chain: client.chain,\n })\n } catch (err) {\n const error = err as { shortMessage?: string; cause?: { details?: string } }\n const reason =\n describeEntityRevert(err) ??\n error.shortMessage ??\n error.cause?.details ??\n \"No reason provided by backend.\"\n throw new EntityMutationError(\n `Transaction ${receipt.transactionHash} reverted. Reason: ${reason}`,\n )\n }\n throw new EntityMutationError(\n `Transaction ${receipt.transactionHash} reverted. No reason provided by backend.`,\n )\n }\n\n return {\n receipt,\n ...readAppliedOperations(receipt, {\n creates: creates?.length ?? 0,\n extensions: extensions?.length ?? 0,\n }),\n }\n } catch (error) {\n throw asEntityMutationError(error)\n }\n}\n\n/**\n * Wraps whatever a write step threw into an {@link EntityMutationError} — engine terms when the\n * revert data decodes, the node's own message otherwise. An {@link EntityMutationError} passes\n * through unchanged, so wrapped steps compose without double-wrapping.\n */\nfunction asEntityMutationError(error: unknown): EntityMutationError {\n if (error instanceof EntityMutationError) return error\n\n const described = describeEntityRevert(error)\n if (described !== undefined) {\n return new EntityMutationError(`Transaction failed: ${described}`, { cause: error })\n }\n\n let message = \"Transaction failed\"\n if (error instanceof TransactionExecutionError) {\n message += `: ${error.details}`\n } else if (error instanceof ContractFunctionExecutionError) {\n logger(\"Contract function execution error data:\", error.shortMessage)\n if (error.cause instanceof ContractFunctionRevertedError) {\n message += `: ${error.cause.message}`\n } else {\n message += \": Execution error without revert data\"\n }\n } else if (error instanceof Error) {\n message += `: ${error.message}`\n }\n\n return new EntityMutationError(message, { cause: error })\n}\n\n/**\n * The keys and expiries the engine recorded, read back from the events the batch emitted.\n */\nfunction readAppliedOperations(\n receipt: TransactionReceipt,\n expected: { creates: number; extensions: number },\n): Omit<SendArkivTransactionResult, \"receipt\"> {\n const events = collectMutationEvents(receipt.logs)\n\n const createdEntityKeys = events.created.map((e) => e.entityKey)\n const createdExpiries = events.created.map((e) => e.expiresAt)\n const extendedExpiries = events.extended.map((e) => e.expiresAt)\n\n // Operations apply in batch order and emit one event each, and creates lead the batch — so these\n // arrive already aligned with the parameters they came from. A count that disagrees means that\n // assumption broke, and a misaligned array would hand back a key belonging to another entity.\n assertCount(receipt, \"create\", createdEntityKeys.length, expected.creates)\n assertCount(receipt, \"extension\", extendedExpiries.length, expected.extensions)\n\n return { createdEntityKeys, createdExpiries, extendedExpiries }\n}\n\n/** One log as an entity event, or `undefined` for anything this SDK has no name for. */\nfunction decodeEntityLog(log: TransactionReceipt[\"logs\"][number]) {\n try {\n return decodeEventLog({ abi: ENTITY_EVENTS_ABI, topics: log.topics, data: log.data })\n } catch {\n // An event a newer engine emits and this ABI does not describe. Not this function's business.\n return undefined\n }\n}\n\nfunction assertCount(receipt: TransactionReceipt, what: string, got: number, want: number): void {\n if (got === want) return\n // Deliberately explicit that the write succeeded: this throws *after* a successful transaction,\n // and a caller who reads it as a failure and retries would create the entities a second time.\n throw new EntityMutationError(\n `Transaction ${receipt.transactionHash} succeeded — do not retry it — but emitted ${got} ` +\n `${what} event(s) for ${want} ${what} operation(s). The batch was applied; the SDK cannot ` +\n `say which entity each operation produced, so read them back to find them.`,\n )\n}\n\n// ─────────────────────────────────────────────────────────────────────────────────────────────────\n// The seams the advanced path is built on.\n//\n// `sendArkivTransaction` above is the everyday path: encode, send, wait, decode, diagnose. These\n// are the same steps as separate pieces, so `actions/advanced` can spend exactly the RPC calls a\n// caller asks for and no more — without a second copy of the encoding or the event decoding.\n// ─────────────────────────────────────────────────────────────────────────────────────────────────\n\n/** The five kinds of entity operation one Arkiv transaction can batch. */\nexport type EntityMutationOps = {\n /** The entities to create. */\n creates?: CreateEntityParameters[]\n /** The patches to apply. */\n patches?: PatchEntityParameters[]\n /** The entities to delete. */\n deletes?: DeleteEntityParameters[]\n /** The expiries to set. */\n extensions?: ExtendEntityParameters[]\n /** The ownership transfers to perform. */\n ownershipChanges?: ChangeOwnershipParameters[]\n}\n\n/**\n * Whether encoding the batch actually requires the chain head.\n *\n * Only a relative lifetime (`minLifetime > 0`) or a wall-clock deadline (a `Date`) is measured\n * from the current block. A purely absolute `atBlock(n)` expiry encodes the same bytes whatever\n * the head is, so a batch of those — or one with no expiries at all — needs no `eth_blockNumber`.\n */\nexport function mutationNeedsBlockNumber(ops: EntityMutationOps): boolean {\n return [...(ops.creates ?? []), ...(ops.extensions ?? [])].some((item) => {\n const expires = item.expires as Expiry | undefined\n // Malformed expiries are rejected by buildEntityOperations without needing the head.\n if (expires === undefined || typeof expires.minLifetime !== \"bigint\") return false\n return expires.minLifetime !== 0n || expires.expiresAt instanceof Date\n })\n}\n\n/**\n * Encodes a batch into the `execute` operations, in the order the engine applies them: creates,\n * patches, deletes, extensions, ownership transfers.\n *\n * Pure — every check here is local (content types, salts, expiry bounds, non-empty patches and a\n * non-empty batch), so the only chain input is `context.currentBlock`. Callers that carry no\n * relative expiry (see {@link mutationNeedsBlockNumber}) can pass `0n`, which disables the\n * dead-on-arrival pre-check and leaves that to the engine.\n */\nexport function buildEntityOperations(ops: EntityMutationOps, context: ExpiryContext): Operation[] {\n const { creates, patches, deletes, extensions, ownershipChanges } = ops\n\n const createOps = (creates ?? []).map((item) => {\n validateContentType(item.contentType)\n\n const salt = item.salt === undefined ? randomSalt() : validateSalt(item.salt)\n const expiry = resolveExpiry(item.expires, context)\n\n return createOperation({\n salt,\n expiry,\n creationFlags: encodeCreationFlags(item.flags),\n attributes: encodeAttributes(item.attributes, {\n payload: item.payload,\n contentType: item.contentType,\n }),\n })\n })\n\n const patchOps = (patches ?? []).map((item) => {\n if (item.contentType !== undefined) validateContentType(item.contentType)\n const mutations = encodeMutations(item)\n if (mutations.length === 0) {\n throw new EmptyPatchError(item.entityKey)\n }\n return patchOperation({ entityKey: item.entityKey, mutations })\n })\n\n // An extension resolves its expiry exactly as a create does — the engine applies the same\n // `max(expiresAt, currentBlock + minLifetime)` to both — so the same bounds are checked here\n // rather than left to a revert.\n const extendOps = (extensions ?? []).map((item) => {\n const expiry = resolveExpiry(item.expires, context)\n return extendExpiryOperation({ entityKey: item.entityKey, expiry })\n })\n\n const operations: Operation[] = [\n ...createOps,\n ...patchOps,\n ...(deletes ?? []).map((item) => deleteOperation({ entityKey: item.entityKey })),\n ...extendOps,\n ...(ownershipChanges ?? []).map((item) =>\n transferOwnershipOperation({\n entityKey: item.entityKey,\n newOwner: item.newOwner as Address,\n }),\n ),\n ]\n\n if (operations.length === 0) {\n throw new Error(\"No operations to perform\")\n }\n\n return operations\n}\n\n/**\n * Signs and sends an encoded batch, wrapping any node rejection in {@link EntityMutationError}.\n *\n * The submission half both write paths share: one `writeContract` — an `eth_sendRawTransaction`,\n * plus only the lookups viem needs for whatever `txParams` leaves out — with no waiting and no\n * polling. A rejection is reported in engine terms when the node returned decodable revert data,\n * and with the node's own message otherwise; either way the caller sees an\n * {@link EntityMutationError}.\n *\n * Internal seam shared with `actions/advanced/sendMutation`; not part of the package's public\n * surface.\n */\nexport async function submitMutation(\n client: ArkivClient,\n operations: Operation[],\n txParams?: TxParams,\n): Promise<Hash> {\n if (!client.account) throw new Error(\"Account required\")\n if (!client.chain) throw new Error(\"Chain required\")\n const walletClient = client as WalletArkivClient\n\n try {\n return await walletClient.writeContract({\n address: ARKIV_ADDRESS,\n abi: EXECUTE_ABI,\n functionName: \"execute\",\n args: [operations],\n account: client.account,\n chain: client.chain,\n ...txParams,\n })\n } catch (error) {\n throw asEntityMutationError(error)\n }\n}\n\n/** Everything the batch's events say happened, one entry per applied operation, per kind. */\nexport type MutationEvents = {\n created: { entityKey: Hex; owner: Address; expiresAt: bigint }[]\n patched: { entityKey: Hex; owner: Address }[]\n deleted: { entityKey: Hex; owner: Address }[]\n extended: { entityKey: Hex; owner: Address; expiresAt: bigint }[]\n ownershipTransferred: { entityKey: Hex; previousOwner: Address; newOwner: Address }[]\n}\n\n/**\n * Reads the entity events out of a receipt's logs, exactly as they were emitted.\n *\n * Lenient by design: it reports what the events say and nothing else — no counting against what\n * was asked for (the caller may not have the request at hand) and no error for a receipt with no\n * entity events at all. Logs from other contracts and events this SDK has no name for are skipped.\n */\nexport function collectMutationEvents(logs: TransactionReceipt[\"logs\"]): MutationEvents {\n const events: MutationEvents = {\n created: [],\n patched: [],\n deleted: [],\n extended: [],\n ownershipTransferred: [],\n }\n\n // `?? []` so a receipt without logs decodes to \"nothing happened\" rather than a TypeError.\n for (const log of logs ?? []) {\n // Only the operation address emits these, and a batch's transaction can carry logs from\n // anything else it touched.\n if (log.address.toLowerCase() !== ARKIV_ADDRESS.toLowerCase()) continue\n const decoded = decodeEntityLog(log)\n if (decoded === undefined) continue\n\n switch (decoded.eventName) {\n case \"EntityCreated\":\n events.created.push({\n entityKey: decoded.args.entityKey,\n owner: decoded.args.owner,\n expiresAt: decoded.args.expiresAt,\n })\n break\n case \"EntityPatched\":\n events.patched.push({ entityKey: decoded.args.entityKey, owner: decoded.args.owner })\n break\n case \"EntityDeleted\":\n events.deleted.push({ entityKey: decoded.args.entityKey, owner: decoded.args.owner })\n break\n case \"ExpiryExtended\":\n events.extended.push({\n entityKey: decoded.args.entityKey,\n owner: decoded.args.owner,\n expiresAt: decoded.args.expiresAt,\n })\n break\n case \"OwnershipTransferred\":\n events.ownershipTransferred.push({\n entityKey: decoded.args.entityKey,\n previousOwner: decoded.args.previousOwner,\n newOwner: decoded.args.newOwner,\n })\n break\n }\n }\n\n return events\n}\n","import { type Address, encodeFunctionData, type Hex } from \"viem\"\nimport type { ArkivClient } from \"../../clients/baseClient\"\nimport type { PublicArkivClient } from \"../../clients/createPublicClient\"\nimport { ARKIV_ADDRESS } from \"../../consts\"\nimport { EXECUTE_ABI, type Operation } from \"../../entity/operations\"\nimport {\n buildEntityOperations,\n type EntityMutationOps,\n mutationNeedsBlockNumber,\n} from \"../../utils/arkivTransactions\"\nimport { getLogger } from \"../../utils/logger\"\n\nconst logger = getLogger(\"actions:advanced:build-mutation\")\n\n/** Options for the advanced-path builders ({@link buildMutation}, {@link sendMutation}). */\nexport type BuildMutationOptions = {\n /**\n * The chain head to resolve relative expiries against.\n *\n * Pass a block number you already hold — from a previous call, `getBlockTiming()`, or your own\n * tracking — and the build spends no RPC call at all. Without it, one `eth_blockNumber` is made,\n * and only when the batch actually needs the head (a relative lifetime or a `Date` deadline);\n * purely absolute `atBlock(n)` expiries never trigger it.\n *\n * Supplying it also buys back a check: absolute expiries are validated against it, so an\n * `atBlock(n)` already in the past throws {@link InvalidExpiryError} locally instead of\n * reverting on-chain. When the head is neither supplied nor fetched, that dead-on-arrival\n * check is skipped — the one local validation of the everyday path this path trades away.\n */\n currentBlock?: bigint\n}\n\n/** What {@link buildMutation} hands back: the batch in every form a sender might want. */\nexport type BuildMutationReturnType = {\n /** The encoded batch, in engine order, for `writeContract`-style sends. */\n operations: Operation[]\n /** The Arkiv engine address the transaction must be sent to. */\n to: Address\n /**\n * The full `execute(operations)` calldata. Sign a transaction carrying it offline (with your own\n * nonce, gas and fees) and the whole mutation costs exactly one `eth_sendRawTransaction`.\n */\n data: Hex\n /**\n * How many operations of each kind went into the batch — which is how many events of each kind a\n * successful transaction emits, in batch order, for cross-checking a decoded result.\n */\n expected: {\n creates: number\n patches: number\n deletes: number\n extensions: number\n ownershipChanges: number\n }\n}\n\n/**\n * Encodes a mutation batch without sending anything.\n *\n * This is the first step of the advanced path: it performs only local validation and encoding, so\n * it costs **zero RPC calls** when `options.currentBlock` is provided (or no expiry is relative),\n * and at most one `eth_blockNumber` otherwise. Send the result however you like: pass `operations`\n * to `writeContract`, or sign `{ to, data }` offline and push it with `eth_sendRawTransaction`.\n *\n * One check rides on knowing the head: an absolute `atBlock(n)` already in the past is rejected\n * locally only when the head is supplied or was fetched anyway. With neither, a dead-on-arrival\n * expiry encodes cleanly and the engine reverts it on-chain — see\n * {@link BuildMutationOptions.currentBlock}.\n *\n * @throws {InvalidExpiryError} If an expiry exceeds a protocol bound.\n * @throws {InvalidValueError} If an attribute value does not fit the type it names.\n * @throws {EmptyPatchError} If a patch has nothing to apply.\n */\nexport async function buildMutation(\n client: ArkivClient,\n data: EntityMutationOps,\n options: BuildMutationOptions = {},\n): Promise<BuildMutationReturnType> {\n // The head is fetched only when an expiry is actually measured from it and the caller did not\n // supply one — the advanced path never spends an RPC call it can avoid.\n const currentBlock =\n options.currentBlock ??\n (mutationNeedsBlockNumber(data)\n ? // Every SDK-built client carries viem's `publicActions`; `PublicArkivClient` is the type\n // that says so, the same narrowing `sendArkivTransaction` does to `WalletArkivClient`.\n await (client as PublicArkivClient).getBlockNumber()\n : 0n)\n\n const operations = buildEntityOperations(data, { currentBlock })\n logger(\"Built %d operations at block %d\", operations.length, currentBlock)\n\n return {\n operations,\n to: ARKIV_ADDRESS,\n data: encodeFunctionData({ abi: EXECUTE_ABI, functionName: \"execute\", args: [operations] }),\n expected: {\n creates: data.creates?.length ?? 0,\n patches: data.patches?.length ?? 0,\n deletes: data.deletes?.length ?? 0,\n extensions: data.extensions?.length ?? 0,\n ownershipChanges: data.ownershipChanges?.length ?? 0,\n },\n }\n}\n","import { type Hash, type Hex, type TransactionReceipt, TransactionReceiptNotFoundError } from \"viem\"\nimport type { ArkivClient } from \"../../clients/baseClient\"\nimport type { PublicArkivClient } from \"../../clients/createPublicClient\"\nimport { collectMutationEvents } from \"../../utils/arkivTransactions\"\nimport { getLogger } from \"../../utils/logger\"\n\nconst logger = getLogger(\"actions:advanced:get-mutation-result\")\n\n/**\n * A mined mutation, decoded from its receipt alone.\n *\n * Everything here comes out of the events the batch emitted, so no request context is needed to\n * read it — a process that holds nothing but the transaction hash gets the full picture. Arrays\n * are in batch order, which is the order the operations were applied in.\n */\nexport type MutationResult = {\n /** `success` means the whole batch applied; `reverted` means none of it did (arrays are empty). */\n status: \"success\" | \"reverted\"\n /** The transaction hash. */\n txHash: Hash\n /** The block the transaction landed in. */\n blockNumber: bigint\n /** The keys the engine minted for the created entities, in batch order. */\n createdEntities: Hex[]\n /** The block each created entity expires at, as the engine recorded it, in the same order. */\n createdExpiries: bigint[]\n /** The keys of the patched entities. */\n patchedEntities: Hex[]\n /** The keys of the deleted entities. */\n deletedEntities: Hex[]\n /** The keys of the extended entities. */\n extendedEntities: Hex[]\n /** The block each extended entity now expires at, in the same order. */\n extendedExpiries: bigint[]\n /** The keys of the entities handed to a new owner. */\n ownershipChanges: Hex[]\n /** The raw receipt, so nothing the chain said is lost. */\n receipt: TransactionReceipt\n}\n\n/** Return type for {@link getMutationResult}: the decoded result, or still pending. */\nexport type GetMutationResultReturnType = MutationResult | { status: \"pending\" }\n\n/**\n * Decodes a receipt you already hold into a {@link MutationResult}. **Zero RPC calls.**\n *\n * The pure tail of the advanced path: if a receipt reached you some other way — your own\n * `waitForTransactionReceipt`, a webhook, a block watcher — this turns it into entity keys and\n * expiries without touching the network. Lenient by design: it reports what the events say,\n * without counting them against a request it never saw.\n */\nexport function decodeMutationResult(receipt: TransactionReceipt): MutationResult {\n const events = collectMutationEvents(receipt.logs)\n return {\n status: receipt.status,\n txHash: receipt.transactionHash,\n blockNumber: receipt.blockNumber,\n createdEntities: events.created.map((e) => e.entityKey),\n createdExpiries: events.created.map((e) => e.expiresAt),\n patchedEntities: events.patched.map((e) => e.entityKey),\n deletedEntities: events.deleted.map((e) => e.entityKey),\n extendedEntities: events.extended.map((e) => e.entityKey),\n extendedExpiries: events.extended.map((e) => e.expiresAt),\n ownershipChanges: events.ownershipTransferred.map((e) => e.entityKey),\n receipt,\n }\n}\n\n/**\n * Fetches a transaction's receipt — once — and decodes what the mutation did.\n *\n * Exactly one `eth_getTransactionReceipt`, like `pingTransaction`, but the answer carries the\n * decoded entity events as well: created keys, recorded expiries, and the keys of everything\n * patched, deleted, extended or handed over. A transaction that is not mined yet comes back as\n * `{ status: \"pending\" }` — check `status` before reading the rest.\n *\n * No revert diagnosis is run: a `reverted` result reports the fact and the raw receipt, and\n * spending a `simulateContract` on the why is your call, not the SDK's.\n */\nexport async function getMutationResult(\n client: ArkivClient,\n txHash: Hash,\n): Promise<GetMutationResultReturnType> {\n const receipt = await fetchReceipt(client, txHash)\n if (receipt === undefined) {\n logger(\"Tx %s still pending\", txHash)\n return { status: \"pending\" }\n }\n return decodeMutationResult(receipt)\n}\n\n/**\n * One `eth_getTransactionReceipt`, with \"not there yet\" as a value instead of an exception.\n *\n * Internal seam shared with `pingTransaction`; not part of the package's public surface.\n */\nexport async function fetchReceipt(\n client: ArkivClient,\n txHash: Hash,\n): Promise<TransactionReceipt | undefined> {\n // The one action this needs is on every SDK-built client — both factories extend viem's\n // `publicActions` — and `PublicArkivClient` is the type that says so, the same way\n // `sendArkivTransaction` narrows to `WalletArkivClient`.\n const reader = client as PublicArkivClient\n try {\n return await reader.getTransactionReceipt({ hash: txHash })\n } catch (error) {\n // viem models an unmined transaction as a throw; the advanced path models it as a state.\n if (error instanceof TransactionReceiptNotFoundError) return undefined\n throw error\n }\n}\n","import type { Hash } from \"viem\"\nimport type { ArkivClient } from \"../../clients/baseClient\"\nimport { getLogger } from \"../../utils/logger\"\nimport { fetchReceipt } from \"./getMutationResult\"\n\nconst logger = getLogger(\"actions:advanced:ping-transaction\")\n\n/** Return type for {@link pingTransaction}. */\nexport type PingTransactionReturnType =\n | {\n /** Not mined yet (or unknown to this node). Ping again later. */\n status: \"pending\"\n blockNumber?: undefined\n }\n | {\n /** Mined. `success` means the whole batch applied; `reverted` means none of it did. */\n status: \"success\" | \"reverted\"\n /** The block the transaction landed in. */\n blockNumber: bigint\n }\n\n/**\n * Asks the chain — once — whether a transaction has landed.\n *\n * Exactly one `eth_getTransactionReceipt`, never a poll: a transaction that is not mined yet comes\n * back as `{ status: \"pending\" }` rather than being waited on. This is the \"ping\" of the advanced\n * path — you own the schedule, the SDK owns nothing.\n *\n * When it reports `success` and you need the created keys or recorded expiries, spend the next\n * call on `getMutationResult` — or none at all, if you predicted the keys up front with\n * `predictEntityKeys`.\n */\nexport async function pingTransaction(\n client: ArkivClient,\n txHash: Hash,\n): Promise<PingTransactionReturnType> {\n const receipt = await fetchReceipt(client, txHash)\n if (receipt === undefined) {\n logger(\"Tx %s still pending\", txHash)\n return { status: \"pending\" }\n }\n return { status: receipt.status, blockNumber: receipt.blockNumber }\n}\n","import type { Hash } from \"viem\"\nimport type { ArkivClient } from \"../../clients/baseClient\"\nimport type { TxParams } from \"../../types\"\nimport { type EntityMutationOps, submitMutation } from \"../../utils/arkivTransactions\"\nimport { getLogger } from \"../../utils/logger\"\nimport {\n type BuildMutationOptions,\n type BuildMutationReturnType,\n buildMutation,\n} from \"./buildMutation\"\n\nconst logger = getLogger(\"actions:advanced:send-mutation\")\n\n/** Options for {@link sendMutation}. */\nexport type SendMutationOptions = BuildMutationOptions & {\n /**\n * Transaction parameters. Supply `nonce`, `gas` and the fee fields and viem has nothing left to\n * look up — the send collapses to a single `eth_sendRawTransaction`.\n */\n txParams?: TxParams\n}\n\n/** Return type for {@link sendMutation}. */\nexport type SendMutationReturnType = {\n /** The transaction hash. Poll it with `pingTransaction` / fetch it with `getMutationResult`. */\n txHash: Hash\n /** The per-kind operation counts of the batch that was sent, for cross-checking the result. */\n expected: BuildMutationReturnType[\"expected\"]\n}\n\n/**\n * Signs and sends a mutation batch, returning as soon as the transaction is submitted.\n *\n * The fire-and-forget half of the advanced path. Unlike `mutateEntities`, this does **not** wait\n * for a receipt, does not poll, and runs no revert diagnosis — it spends only what submitting\n * costs. With `options.currentBlock` and full `txParams` (nonce, gas, fees) that is exactly one\n * RPC call; each omitted piece adds only the lookup viem needs to fill it.\n *\n * Follow up separately, on your own schedule:\n * - `pingTransaction(txHash)` — one `eth_getTransactionReceipt`, tells you pending/success/reverted.\n * - `getMutationResult(txHash)` — the same single call, plus the decoded entity keys and expiries.\n *\n * @throws {EntityMutationError} If the node rejects the submission (the batch never made it into\n * the mempool) — in engine terms when the rejection decodes, with the node's message otherwise.\n * Anything after that — inclusion, success — is yours to check.\n */\nexport async function sendMutation(\n client: ArkivClient,\n data: EntityMutationOps,\n options: SendMutationOptions = {},\n): Promise<SendMutationReturnType> {\n const { operations, expected } = await buildMutation(client, data, options)\n\n logger(\"Sending execute with %d operations (no wait)\", operations.length)\n\n const txHash = await submitMutation(client, operations, options.txParams)\n\n return { txHash, expected }\n}\n"],"mappings":";;;;;;;;;;;;;AAUA,MAAa,cAAc,SAAS,CAClC,mGACD,CAAC;;;;;;;;AASF,MAAa,mBAAmB,SAAS,CACvC,qEACD,CAAC;;;;;AAMF,MAAM,kBAAkB;;;;;AAMxB,MAAM,iBAAiB;EACpB,cAAc,SAAS,mBACtB,6EAA6E,gBAAgB,cAC9F;EACA,cAAc,QAAQ,mBAAmB,uBAAuB,gBAAgB,aAAa;EAC7F,cAAc,eAAe,mBAC5B,4DACD;EACA,cAAc,oBAAoB,mBAAmB,wCAAwC;EAC7F,cAAc,SAAS,mBAAmB,sBAAsB;CAClE;;AASD,SAAgB,gBAAgB,EAC9B,MACA,QACA,eACA,cAMY;AACZ,QAAO;EACL,WAAW,cAAc;EACzB,eAAe,oBAAoB,eAAe,cAAc,SAAS,CACvE;GACE;GACA,WAAW,OAAO;GAClB,aAAa,OAAO;GACpB;GACA;GACD,CACF,CAAC;EACH;;;AAIH,SAAgB,eAAe,EAC7B,WACA,aAIY;AACZ,QAAO;EACL,WAAW,cAAc;EACzB,eAAe,oBAAoB,eAAe,cAAc,QAAQ,CACtE;GAAE;GAAW;GAAW,CACzB,CAAC;EACH;;;AAIH,SAAgB,sBAAsB,EACpC,WACA,UAIY;AACZ,QAAO;EACL,WAAW,cAAc;EACzB,eAAe,oBAAoB,eAAe,cAAc,eAAe,CAC7E;GAAE;GAAW,WAAW,OAAO;GAAW,aAAa,OAAO;GAAa,CAC5E,CAAC;EACH;;;AAIH,SAAgB,2BA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U,iCAAiC;;;;;;;;;;;;;;;;;AAmC1D,eAAsB,aACpB,QACA,MACA,UAA+B,EAAE,EACA;CACjC,MAAM,EAAE,YAAY,aAAa,MAAM,cAAc,QAAQ,MAAM,QAAQ;AAE3E,QAAO,gDAAgD,WAAW,OAAO;AAIzE,QAAO;EAAE,QAFM,MAAM,eAAe,QAAQ,YAAY,QAAQ,SAAS;EAExD;EAAU"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arkivTransactions-D74gERHG.d.cts","names":[],"sources":["../src/actions/public/getBlockTiming.ts","../src/actions/public/predictEntityKeys.ts","../src/actions/public/query.ts","../src/types/events.ts","../src/actions/public/watchEntityEvents.ts","../src/actions/wallet/createEntity.ts","../src/actions/wallet/deleteEntity.ts","../src/actions/wallet/extendEntity.ts","../src/actions/wallet/mutateEntities.ts","../src/actions/wallet/patchEntity.ts","../src/types/mimeTypes.ts","../src/types/txParams.ts","../src/actions/wallet/changeOwnership.ts","../src/utils/arkivTransactions.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAKY,wBAAA;;;;;;;;;;;;;AAAA,KCOA,kBAAA,GDPwB;;OCS7B;;EAFK,IAAA,EAAA,MAAA;AAQZ,CAAA;;AAaU,KAbE,2BAaF,CAAA,eAAA,MAAA,GAAA,MAAA,EAAA,eAAA,SAAA,MAAA,EAAA,GAAA,SAAA,GAAA,SAAA,MAAA,EAAA,GAAA,SAAA,CAAA,GAAA;EAKA;EAAM,KAAA,EAbP,OAaO;EAaJ;;;;;;;EAKF,KAAA,CAAA,EAvBA,MAuBA,GAAA,SAAA;EAOL;;;;EAED,KAAA,CAAA,EA3BM,MA2BN;CAAuB;;;;;;;;;;;AC3Df,KD6CA,2BC3CD,CAAA,eAAS,MAAA,GAAA,MAAA,EAAA,eAAA,SAAA,MAAA,EAAA,GAAA,SAAA,GAAA,SAAA,MAAA,EAAA,GAAA,SAAA,CAAA,GAAA,CD8Cf,MC9Ce,CAAA,SAAA,CAAA,SAAA,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ACA,SAAA,EQ9BS,GR8BT;EAAuB;;;;;;;;;;;EC3Df,GAAA,CAAA,EOyCJ,ePzCgB,GAAA,SAEb;EAaC;;;;ACXZ;AAUA;;EAEa,KAAA,CAAA,EAAA,SAAA,MAAA,EAAA,GAAA,SAAA;EACJ;;;AAcT;EAAiC,OAAA,CAAA,EMuBrB,UNvBqB,GAAA,SAAA;EAEpB;;;AAKb;EAAkC,WAAA,CAAA,EMqBlB,QNrBkB,GAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA,GAAA,SAAA;CAErB;;AAMG,KMiBJ,qBAAA,GNjBI;EAMJ;EAA4B,SAAA,EMa3B,GNb2B;EAE3B,MAAA,EMYH,INZG;CACI;;;KO7DL,QAAA;;;KCAA,QAAA;;;;;;;;EXKA,KAAA,CAAA,EAAA,MAAA;;;;ACOZ,CAAA;;;;;;;;ADPY,KYQA,yBAAA,GZRwB;aYSvB;YACD;;AXHZ;AAQA;;;;AAkBgB,KWfJ,yBAAA,GXeI;EAaJ,SAAA,EW3BC,GX2BD;EAGP,MAAA,EW7BK,IX6BL;CAC2B;;;;;KY4LpB,iBAAA;;YAEA;;YAEA;;YAEA;;eAEG;;qBAEM;;;;;;;;;iBAUL,wBAAA,MAA8B;;;;;;;;;;iBAkB9B,qBAAA,MAA2B,4BAA4B,gBAAgB;;KA8F3E,cAAA;;eACY;WAAY;;;;eACZ;WAAY;;;eACZ;WAAY;;;eACX;WAAY;;;;eACA;mBAAoB;cAAmB;;;;;;;;;;iBAU5D,qBAAA,OAA4B,6BAA6B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arkivTransactions-NtGD6uk5.d.ts","names":[],"sources":["../src/actions/public/getBlockTiming.ts","../src/actions/public/predictEntityKeys.ts","../src/actions/public/query.ts","../src/types/events.ts","../src/actions/public/watchEntityEvents.ts","../src/actions/wallet/createEntity.ts","../src/actions/wallet/deleteEntity.ts","../src/actions/wallet/extendEntity.ts","../src/actions/wallet/mutateEntities.ts","../src/actions/wallet/patchEntity.ts","../src/types/mimeTypes.ts","../src/types/txParams.ts","../src/actions/wallet/changeOwnership.ts","../src/utils/arkivTransactions.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAKY,wBAAA;;;;;;;;;;;;;AAAA,KCOA,kBAAA,GDPwB;;OCS7B;;EAFK,IAAA,EAAA,MAAA;AAQZ,CAAA;;AAaU,KAbE,2BAaF,CAAA,eAAA,MAAA,GAAA,MAAA,EAAA,eAAA,SAAA,MAAA,EAAA,GAAA,SAAA,GAAA,SAAA,MAAA,EAAA,GAAA,SAAA,CAAA,GAAA;EAKA;EAAM,KAAA,EAbP,OAaO;EAaJ;;;;;;;EAKF,KAAA,CAAA,EAvBA,MAuBA,GAAA,SAAA;EAOL;;;;EAED,KAAA,CAAA,EA3BM,MA2BN;CAAuB;;;;;;;;;;;AC3Df,KD6CA,2BC3CD,CAAA,eAAS,MAAA,GAAA,MAAA,EAAA,eAAA,SAAA,MAAA,EAAA,GAAA,SAAA,GAAA,SAAA,MAAA,EAAA,GAAA,SAAA,CAAA,GAAA,CD8Cf,MC9Ce,CAAA,SAAA,CAAA,SAAA,MAAA,EAAA,CAAA,GAAA,sBAaO,MDkCK,MCjCpB,GDiC6B,kBCjCvB,KDkCd,OAAO,oBAAoB;;;AE9C/B;AAUA;;KF2CK,MEzCQ,CAAA,CAAA,EAAA,gBAAA,MAAA,EAAA,aFyCuC,CEzCvC,EAAA,GAAA,EAAA,CAAA,GAAA,MAAA,SFyCkE,OEzClE,GF0CT,CE1CS,EAAA,GF2CT,IE3CS,CAAA,QAAA,CAAA,SF2Cc,OE3Cd,GF4CP,IE5CO,GF6CP,ME7CO,CF6CA,CE7CA,EF6CG,OE7CH,EAAA,CAAA,GF6CgB,IE7ChB,EF6CsB,CE7CtB,CAAA,CAAA;;;;AAeb;;;;;AAOA;;;;;AAcA;;;;;;AAQA;;;;;AASA;;;;;;;;;;AC5CA;;;KFzBY,YAAA;;WAED;;EFHC,OAAA,CAAA,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;;;;;;;;ADPY,KYQA,yBAAA,GZRwB;aYSvB;YACD;;AXHZ;AAQA;;;;AAkBgB,KWfJ,yBAAA,GXeI;EAaJ,SAAA,EW3BC,GX2BD;EAGP,MAAA,EW7BK,IX6BL;CAC2B;;;;;KY4LpB,iBAAA;;YAEA;;YAEA;;YAEA;;eAEG;;qBAEM;;;;;;;;;iBAUL,wBAAA,MAA8B;;;;;;;;;;iBAkB9B,qBAAA,MAA2B,4BAA4B,gBAAgB;;KA8F3E,cAAA;;eACY;WAAY;;;;eACZ;WAAY;;;eACZ;WAAY;;;eACX;WAAY;;;;eACA;mBAAoB;cAAmB;;;;;;;;;;iBAU5D,qBAAA,OAA4B,6BAA6B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attributes-BhY5DwJp.js","names":["size","resolved: Record<string, ArkivValue>","cells: [string, AnyArkivValue][]"],"sources":["../src/attr/errors.ts","../src/attr/decimal.ts","../src/attr/types.ts","../src/attr/values.ts","../src/attr/codec.ts","../src/attr/names.ts","../src/attr/attributes.ts"],"sourcesContent":["import type { TypeTag } from \"./types\"\n\n/**\n * A value was rejected by its tagged constructor — out of range, wrong length, bad checksum, too\n * much precision, and so on.\n *\n * The message names the offending value and, where there is one, the type that *would* hold it, so\n * the fix is in the error rather than in the docs.\n */\nexport class InvalidValueError extends Error {\n /** The type tag whose constructor rejected the value. */\n readonly tag: TypeTag\n /** The rejected input, as given. */\n readonly input: unknown\n\n constructor(tag: TypeTag, input: unknown, reason: string, hint?: string) {\n super(`Invalid ${tag} value ${describe(input)}: ${reason}.${hint ? ` ${hint}` : \"\"}`)\n this.name = \"InvalidValueError\"\n this.tag = tag\n this.input = input\n }\n}\n\n/**\n * A bare JavaScript value could not be given a type. Raised when an attribute or predicate is\n * handed something that is neither a tagged value nor one of the four bare forms\n * (`boolean`, `number`, `bigint`, `string`).\n */\nexport class UntypedValueError extends Error {\n readonly input: unknown\n\n constructor(input: unknown) {\n super(\n `Cannot infer an Arkiv type for ${describe(input)}. ` +\n \"Attribute values must be a tagged value (i32, u256, dec, str, addr, key, bytes32, bool) \" +\n \"or a bare boolean, number, bigint or string.\",\n )\n this.name = \"UntypedValueError\"\n this.input = input\n }\n}\n\n/**\n * An attribute was given `undefined` or `null` as its value.\n *\n * There is no such thing as an attribute with no value: an attribute either exists with a type, or\n * is not set. The fix is always to leave the name out of the map rather than to write an empty\n * value, so this is called out separately from {@link UntypedValueError} — the remedy is different.\n */\nexport class MissingValueError extends Error {\n /** The attribute whose value was missing, when raised from an attribute map. */\n readonly attributeName: string | undefined\n\n constructor(input: null | undefined, attributeName?: string) {\n const subject = attributeName ? `attribute \"${attributeName}\"` : \"attribute value\"\n super(\n `The ${subject} is ${input === null ? \"null\" : \"undefined\"}. An attribute is either set ` +\n \"with a value and a type or not set at all, so there is nothing to write here. \" +\n (attributeName\n ? `Omit \"${attributeName}\" from the attributes instead — e.g. build the map ` +\n \"conditionally, or drop the key when the value is absent.\"\n : \"Omit the attribute instead of giving it an empty value.\"),\n )\n this.name = \"MissingValueError\"\n this.attributeName = attributeName\n }\n}\n\n/** An attribute name violated the on-chain name grammar. */\nexport class InvalidAttributeNameError extends Error {\n readonly attributeName: string\n\n constructor(attributeName: string, reason: string) {\n super(\n `Invalid attribute name \"${attributeName}\": ${reason}. Names must be 1-32 bytes, start with ` +\n 'a letter, and contain only A-Z, a-z, 0-9, \".\", \"-\" or \"_\". Names are case-sensitive.',\n )\n this.name = \"InvalidAttributeNameError\"\n this.attributeName = attributeName\n }\n}\n\n/**\n * One patch tried to both write and remove the same attribute.\n */\nexport class ConflictingMutationError extends Error {\n readonly attributeName: string\n\n constructor(attributeName: string) {\n super(\n `The patch both sets and unsets \"${attributeName}\". A patch applies one mutation per ` +\n 'attribute, so say which you mean: drop it from \"unset\" to write the value, or from ' +\n '\"set\" to remove the attribute.',\n )\n this.name = \"ConflictingMutationError\"\n this.attributeName = attributeName\n }\n}\n\n/** More attributes were supplied than an entity operation can carry. */\nexport class TooManyAttributesError extends Error {\n constructor(count: number, max: number) {\n super(`An entity may carry at most ${max} attributes, got ${count}.`)\n this.name = \"TooManyAttributesError\"\n }\n}\n\n/** The node sent back an attribute this SDK cannot decode. */\nexport class UnknownAttributeTypeError extends Error {\n /** The type as the node named it — a tag over JSON-RPC, a typeId on the wire. */\n readonly type: string | number\n\n constructor(type: string | number) {\n super(\n `Unknown attribute type ${describe(type)}. The node is using a type this SDK version does ` +\n \"not know about — upgrade @arkiv-network/sdk.\",\n )\n this.name = \"UnknownAttributeTypeError\"\n this.type = type\n }\n}\n\n/** Renders an arbitrary input for an error message, without ever throwing. */\nfunction describe(input: unknown): string {\n switch (typeof input) {\n case \"string\":\n return JSON.stringify(input.length > 64 ? `${input.slice(0, 61)}...` : input)\n case \"bigint\":\n return `${input}n`\n case \"object\":\n return input === null ? \"null\" : safeJson(input)\n case \"undefined\":\n return \"undefined\"\n default:\n return String(input)\n }\n}\n\nfunction safeJson(input: object): string {\n try {\n return JSON.stringify(input) ?? String(input)\n } catch {\n return Object.prototype.toString.call(input)\n }\n}\n","import { InvalidValueError } from \"./errors\"\n\n/**\n * Decimal places a `dec` value is scaled by. Fixed by the protocol, so any two decimals are\n * directly comparable — and range-indexable — as plain integers.\n */\nexport const DECIMAL_SCALE = 18\n\n/** 10 ** {@link DECIMAL_SCALE} — the scaling factor between a `dec` and its integer units. */\nexport const DECIMAL_UNIT = 10n ** BigInt(DECIMAL_SCALE)\n\n/** The widest scaled value an `int256` holds. */\nconst INT256_MAX = 2n ** 255n - 1n\n/** The narrowest scaled value an `int256` holds. */\nconst INT256_MIN = -(2n ** 255n)\n\n/**\n * A decimal literal: an optional sign, at least one integer digit, and an optional fraction of at\n * most {@link DECIMAL_SCALE} digits. Exponents are not part of the grammar — `1e18` is a parse\n * error rather than a silent reinterpretation.\n */\nconst DECIMAL_RE = /^([+-]?)(\\d+)(?:\\.(\\d+))?$/\n\n/**\n * Parses a decimal literal into its scaled integer units.\n *\n * Excess fractional precision is an **error, never a rounding**: the protocol stores exactly 18\n * decimal places, and silently dropping the 19th digit would make a stored value differ from the\n * one that was written.\n *\n * @param input - The decimal literal, e.g. `\"3.5\"` or `\"-0.000001\"`.\n * @returns The value scaled by 10 ** 18.\n * @throws {InvalidValueError} If the literal is malformed, too precise, or out of `int256` range.\n */\nexport function decimalToUnits(input: string): bigint {\n const match = DECIMAL_RE.exec(input)\n if (!match) {\n throw new InvalidValueError(\n \"dec\",\n input,\n \"not a decimal literal\",\n 'Write it as sign, digits, and an optional \".\" with up to 18 fractional digits — e.g. ' +\n 'dec(\"3.5\") or dec(\"-0.25\"). Exponents such as \"1e18\" are not accepted.',\n )\n }\n\n const [, sign, whole, fraction = \"\"] = match\n if (fraction.length > DECIMAL_SCALE) {\n throw new InvalidValueError(\n \"dec\",\n input,\n `${fraction.length} fractional digits exceeds the ${DECIMAL_SCALE} the protocol stores`,\n \"Round it yourself before storing — a dec is never rounded for you, so that what you \" +\n \"write is exactly what is stored.\",\n )\n }\n\n const digits = BigInt(whole + fraction.padEnd(DECIMAL_SCALE, \"0\"))\n const units = sign === \"-\" ? -digits : digits\n if (units > INT256_MAX || units < INT256_MIN) {\n throw new InvalidValueError(\"dec\", input, \"exceeds the int256 range a dec is stored in\")\n }\n return units\n}\n\n/**\n * Renders scaled integer units back as a canonical decimal string: no leading zeros, no trailing\n * fractional zeros, no `-0`. Parsing the result yields the same units, so this is the inverse of\n * {@link decimalToUnits} on every value it accepts.\n *\n * @param units - The value scaled by 10 ** 18.\n * @returns The canonical decimal string, e.g. `\"3.5\"`.\n * @throws {InvalidValueError} If the units are outside the `int256` range.\n */\nexport function unitsToDecimal(units: bigint): string {\n if (units > INT256_MAX || units < INT256_MIN) {\n throw new InvalidValueError(\"dec\", units, \"exceeds the int256 range a dec is stored in\")\n }\n const negative = units < 0n\n const magnitude = negative ? -units : units\n const whole = magnitude / DECIMAL_UNIT\n const fraction = (magnitude % DECIMAL_UNIT).toString().padStart(DECIMAL_SCALE, \"0\")\n const trimmed = fraction.replace(/0+$/, \"\")\n const sign = negative ? \"-\" : \"\"\n return trimmed ? `${sign}${whole}.${trimmed}` : `${sign}${whole}`\n}\n","import type { Address, Hex } from \"viem\"\n\n/**\n * The protocol's attribute type vocabulary, mapping each short **tag** (the name used by the\n * client, the query language and this SDK) to its **typeId** (the byte carried on the wire and in\n * the entity record).\n *\n * The typeIds are consensus-critical: they are written into entity records and mixed into index\n * keys, so this table must never drift from the node's `AttributeType`.\n *\n * | tag | typeId | ABI wire type | indexing |\n * | --------- | ------ | ------------------- | ----------------- |\n * | `bool` | 1 | `bool` | equality |\n * | `i32` | 2 | `int32` | equality + range |\n * | `u64` | 3 | `uint64` | equality + range |\n * | `u256` | 4 | `uint256` | equality + range |\n * | `dec` | 5 | `int256` (18 dp) | equality + range |\n * | `bytes32` | 6 | `bytes32` | equality |\n * | `bytes` | 7 | `bytes` | none — system-only |\n * | `str` | 8 | `string` (<= 128 B) | equality + prefix |\n * | `addr` | 9 | `address` | equality |\n * | `key` | 10 | `bytes32` | equality |\n */\nexport const TYPE_IDS = {\n bool: 1,\n i32: 2,\n u64: 3,\n u256: 4,\n dec: 5,\n bytes32: 6,\n bytes: 7,\n str: 8,\n addr: 9,\n key: 10,\n} as const\n\n/** Every type tag, including the system-only `bytes`. */\nexport type TypeTag = keyof typeof TYPE_IDS\n\n/** Every typeId, including the system-only `7` (`bytes`). */\nexport type TypeId = (typeof TYPE_IDS)[TypeTag]\n\n/**\n * The tags a client may set on an attribute. `bytes` is excluded: it backs the system `$payload`\n * cell, which travels in its own operation field and is never carried in an attribute array.\n */\nexport type UserTypeTag = Exclude<TypeTag, \"bytes\">\n\n/** Whether a client may set an attribute of this type — everything except `bytes`. */\nexport function isUserSettable(tag: TypeTag): tag is UserTypeTag {\n return tag !== \"bytes\"\n}\n\n/**\n * Marks a value as having passed its constructor's validation. The symbol is module-private, so a\n * hand-written object literal is not assignable to {@link ArkivValue} — every value crossing the\n * wire has been range-, length- and format-checked by {@link i32}, {@link u256}, {@link dec}, and\n * friends.\n */\ndeclare const validated: unique symbol\n\n/**\n * A typed attribute value: the tag it was created with, plus the JavaScript representation of that\n * type. Constructed only by the tagged constructors in `@arkiv-network/sdk/attr`.\n *\n * @typeParam tag - The type tag, which also discriminates the {@link ArkivValue} union.\n * @typeParam value - The decoded JavaScript representation.\n */\nexport type Value<tag extends TypeTag, value> = {\n readonly type: tag\n readonly value: value\n readonly [validated]: tag\n}\n\n/** A boolean. */\nexport type BoolValue = Value<\"bool\", boolean>\n/** A 32-bit signed integer — the default for an untagged number. */\nexport type I32Value = Value<\"i32\", number>\n/**\n * A 64-bit unsigned integer — block heights, the\n * entity-nonce and `$expiresAt` are all `u64` */\nexport type U64Value = Value<\"u64\", bigint>\n/** A 256-bit unsigned integer. */\nexport type U256Value = Value<\"u256\", bigint>\n/**\n * A fixed-point decimal with 18 decimal places, held as its canonical decimal string (`\"3.5\"`).\n * Use {@link decUnits} for the exact scaled integer when you need to do arithmetic.\n */\nexport type DecValue = Value<\"dec\", string>\n/** 32 opaque bytes, as lowercase `0x` hex. */\nexport type Bytes32Value = Value<\"bytes32\", Hex>\n/** A UTF-8 string of at most 128 bytes. */\nexport type StrValue = Value<\"str\", string>\n/** A 20-byte Ethereum address, as EIP-55 checksummed hex. */\nexport type AddrValue = Value<\"addr\", Address>\n/** A reference to another entity. Weak by spec: dangling references are permitted. */\nexport type KeyValue = Value<\"key\", Hex>\n/**\n * Opaque variable-length bytes, as lowercase `0x` hex. System-only — it backs `$payload` and is\n * never settable as an attribute, so it is produced by decoding but has no constructor.\n */\nexport type BytesValue = Value<\"bytes\", Hex>\n\n/** Any value a client may set on an attribute. */\nexport type ArkivValue =\n | BoolValue\n | I32Value\n | U64Value\n | U256Value\n | DecValue\n | Bytes32Value\n | StrValue\n | AddrValue\n | KeyValue\n\n/** Any value that can come back from the node, including the system-only `bytes`. */\nexport type AnyArkivValue = ArkivValue | BytesValue\n\n/** The value type for a given tag — e.g. `ValueOf<\"u256\">` is {@link U256Value}. */\nexport type ValueOf<tag extends TypeTag> = Extract<AnyArkivValue, { type: tag }>\n\n/** The JavaScript representation carried by a value — e.g. `Decoded<U256Value>` is `bigint`. */\nexport type Decoded<value extends AnyArkivValue> = value[\"value\"]\n\n/**\n * Builds a validated value. Module-internal: the constructors in `values.ts` call this **after**\n * validating, which is what makes the {@link validated} brand meaningful.\n */\nexport function makeValue<tag extends TypeTag>(\n type: tag,\n value: Decoded<ValueOf<tag>>,\n): ValueOf<tag> {\n return { type, value } as unknown as ValueOf<tag>\n}\n\n/**\n * Whether `input` has the *shape* of an {@link ArkivValue} — a known type tag and a value.\n */\nexport function isArkivValue(input: unknown): input is AnyArkivValue {\n return (\n typeof input === \"object\" &&\n input !== null &&\n \"type\" in input &&\n \"value\" in input &&\n typeof (input as { type: unknown }).type === \"string\" &&\n // `Object.hasOwn`, not `in`: `in` walks the prototype chain, so `{ type: \"constructor\" }` would\n // be accepted as a typed value and then decode to nothing.\n Object.hasOwn(TYPE_IDS, (input as { type: string }).type)\n )\n}\n","import {\n type Address,\n checksumAddress,\n type Hex,\n isAddress,\n isHex,\n stringToBytes,\n toHex,\n} from \"viem\"\nimport { DECIMAL_UNIT, decimalToUnits, unitsToDecimal } from \"./decimal\"\nimport { InvalidValueError, MissingValueError, UntypedValueError } from \"./errors\"\nimport {\n type AddrValue,\n type AnyArkivValue,\n type ArkivValue,\n type BoolValue,\n type Bytes32Value,\n type BytesValue,\n type DecValue,\n type I32Value,\n isArkivValue,\n type KeyValue,\n makeValue,\n type StrValue,\n type U64Value,\n type U256Value,\n} from \"./types\"\n\n/** The widest `i32`. */\nexport const I32_MAX = 2147483647\n/** The narrowest `i32`. */\nexport const I32_MIN = -2147483648\n/** The widest `u64`. */\nexport const U64_MAX = 2n ** 64n - 1n\n/** The widest `u256`. */\nexport const U256_MAX = 2n ** 256n - 1n\n/**\n * The longest `str`, in UTF-8 bytes\n */\nexport const MAX_STRING_BYTES = 128\n\n/**\n * Finds the first C0 control or DEL — the characters a `str` may not contain.\n */\nfunction findControlChar(value: string): { index: number; code: number } | undefined {\n for (let index = 0; index < value.length; index++) {\n const code = value.charCodeAt(index)\n if (code <= 0x1f || code === 0x7f) return { index, code }\n }\n return undefined\n}\n\n/**\n * A boolean.\n *\n * `bool` is the one type that may also be written bare — `{ flagged: true }` and\n * `{ flagged: bool(true) }` are the same attribute.\n *\n * @example\n * bool(true) // { type: \"bool\", value: true }\n */\nexport function bool(value: boolean): BoolValue {\n if (typeof value !== \"boolean\") {\n throw new InvalidValueError(\"bool\", value, \"not a boolean\")\n }\n return makeValue(\"bool\", value)\n}\n\n/**\n * A 32-bit signed integer, indexed for equality and range queries. This is the default type for a\n * bare number, so `{ level: 10 }` and `{ level: i32(10) }` are the same attribute.\n *\n * @param value - An integer in [-2147483648, 2147483647].\n * @throws {InvalidValueError} If the value is not an integer, or does not fit an `i32`.\n *\n * @example\n * i32(10) // { type: \"i32\", value: 10 }\n * i32(-42) // negative values are fine — i32 is the signed integer\n */\nexport function i32(value: number | bigint): I32Value {\n if (typeof value === \"bigint\") {\n if (value > BigInt(I32_MAX) || value < BigInt(I32_MIN)) {\n throw new InvalidValueError(\"i32\", value, outOfI32Range(value >= 0n))\n }\n return makeValue(\"i32\", Number(value))\n }\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n throw new InvalidValueError(\"i32\", value, \"not a number\")\n }\n if (!Number.isInteger(value)) {\n throw new InvalidValueError(\n \"i32\",\n value,\n \"not an integer\",\n `Use dec(${JSON.stringify(String(value))}) for a fixed-point decimal.`,\n )\n }\n if (value > I32_MAX || value < I32_MIN) {\n throw new InvalidValueError(\"i32\", value, outOfI32Range(value >= 0))\n }\n return makeValue(\"i32\", value)\n}\n\nfunction outOfI32Range(nonNegative: boolean): string {\n const range = `outside the i32 range [${I32_MIN}, ${I32_MAX}]`\n return nonNegative\n ? `${range} — use u64(...) for large counters, timestamps and block heights (Date.now() does ` +\n `not fit an i32), or u256(...) beyond 2**64 - 1`\n : `${range} — use dec(...) for values that need more range than an i32`\n}\n\n/**\n * A 256-bit unsigned integer, indexed for equality and range queries. The type for token amounts\n * and anything else that can outgrow 2⁶⁴ — reach for {@link u64} first for counters, timestamps\n * and block heights.\n *\n * @param value - A non-negative integer, as a `bigint`, a safe `number`, or a decimal or `0x` hex\n * string.\n * @throws {InvalidValueError} If the value is negative, non-integral, or wider than 256 bits.\n *\n * @example\n * u256(1_000_000n)\n * u256(Date.now()) // safe integers are accepted\n * u256(\"0xf4240\") // hex, as it comes back over JSON-RPC\n */\nexport function u256(value: bigint | number | string): U256Value {\n return makeValue(\"u256\", toUnsigned(\"u256\", value, U256_MAX))\n}\n\n/**\n * A 64-bit unsigned integer, indexed for equality and range queries.\n *\n * This is the width the protocol counts in: block heights, `$expiresAt` and the entity-nonce are\n * all `u64`, so it is the type to reach for when a value has to line up with one of them. Use\n * {@link u256} for token amounts and anything else that can exceed 2⁶⁴.\n *\n * @param value - A non-negative integer, as a `bigint`, a safe `number`, or a decimal or `0x` hex\n * string.\n * @throws {InvalidValueError} If the value is negative, non-integral, or wider than 64 bits.\n *\n * @example\n * u64(1_200_000n) // a block height\n * u64(Date.now()) // safe integers are accepted\n * u64(\"0x124f80\") // hex, as it comes back over JSON-RPC\n */\nexport function u64(value: bigint | number | string): U64Value {\n return makeValue(\"u64\", toUnsigned(\"u64\", value, U64_MAX))\n}\n\n/**\n * Parses and range-checks an unsigned integer for `tag`, whose widest value is `max`.\n *\n * Shared by {@link u64} and {@link u256} so the two differ in exactly one thing — their width —\n * rather than in how they read a string or how they explain a failure.\n */\nfunction toUnsigned(tag: \"u64\" | \"u256\", value: bigint | number | string, max: bigint): bigint {\n const parsed = toUnsignedBigint(tag, value)\n if (parsed < 0n) {\n throw new InvalidValueError(\n tag,\n value,\n `negative — ${tag} is unsigned`,\n \"Use i32(...) for small signed integers, or dec(...) for a signed fixed-point value.\",\n )\n }\n if (parsed > max) {\n const bits = tag === \"u64\" ? 64 : 256\n throw new InvalidValueError(\n tag,\n value,\n `wider than ${bits} bits`,\n tag === \"u64\" ? \"Use u256(...) for values beyond 2**64 - 1.\" : undefined,\n )\n }\n return parsed\n}\n\nfunction toUnsignedBigint(tag: \"u64\" | \"u256\", value: bigint | number | string): bigint {\n if (typeof value === \"bigint\") return value\n if (typeof value === \"number\") {\n if (!Number.isInteger(value)) {\n throw new InvalidValueError(\n tag,\n value,\n \"not an integer\",\n `Use dec(${JSON.stringify(String(value))}) for a fixed-point decimal.`,\n )\n }\n if (!Number.isSafeInteger(value)) {\n throw new InvalidValueError(\n tag,\n value,\n \"beyond the safe integer range, so it may already have lost precision\",\n \"Pass it as a bigint literal (e.g. 12345678901234567890n) or a string instead.\",\n )\n }\n return BigInt(value)\n }\n if (typeof value === \"string\") {\n if (!/^(0x[0-9a-fA-F]+|\\d+)$/.test(value)) {\n throw new InvalidValueError(tag, value, \"not a decimal or 0x-hex integer\")\n }\n return BigInt(value)\n }\n throw new InvalidValueError(tag, value, \"not a bigint, number or string\")\n}\n\n/**\n * A signed fixed-point decimal with exactly 18 decimal places, indexed for equality and range\n * queries.\n *\n * Pass fractional values as **strings**. A JavaScript number cannot represent most decimals\n * exactly, so accepting `dec(0.1 + 0.2)` would quietly store `0.30000000000000004`; requiring the\n * string keeps what you write and what is stored the same thing. Excess precision is likewise an\n * error rather than a rounding.\n *\n * @param value - A decimal string, or an integral `number` / `bigint`.\n * @throws {InvalidValueError} If the value is malformed, has more than 18 fractional digits, or\n * falls outside the `int256` range.\n *\n * @example\n * dec(\"3.5\")\n * dec(\"-0.000000000000000001\") // the smallest step\n * dec(5) // integers may be passed bare\n */\nexport function dec(value: string | number | bigint): DecValue {\n if (typeof value === \"string\") {\n return makeValue(\"dec\", unitsToDecimal(decimalToUnits(value)))\n }\n if (typeof value === \"bigint\") {\n return decFromUnits(value * DECIMAL_UNIT)\n }\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n throw new InvalidValueError(\"dec\", value, \"not a number\")\n }\n if (!Number.isInteger(value)) {\n throw new InvalidValueError(\n \"dec\",\n value,\n \"a fractional number cannot be represented exactly in binary floating point\",\n `Pass it as a string instead: dec(${JSON.stringify(String(value))}).`,\n )\n }\n return decFromUnits(BigInt(value) * DECIMAL_UNIT)\n}\n\n/**\n * The exact scaled integer behind a `dec` — the value multiplied by 10 ** 18, which is what the\n * protocol stores and compares. Use it when you need exact arithmetic; JavaScript has no native\n * decimal type, so the SDK carries the canonical string and leaves the maths to you.\n *\n * @example\n * decUnits(dec(\"3.5\")) // 3500000000000000000n\n */\nexport function decUnits(value: DecValue): bigint {\n return decimalToUnits(value.value)\n}\n\n/**\n * A `dec` built from its scaled integer units — the inverse of {@link decUnits}.\n *\n * @example\n * decFromUnits(3_500_000_000_000_000_000n) // dec(\"3.5\")\n */\nexport function decFromUnits(units: bigint): DecValue {\n return makeValue(\"dec\", unitsToDecimal(units))\n}\n\n/**\n * A UTF-8 string of at most 128 bytes, indexed for equality and prefix (`STARTSWITH`) matching.\n *\n * The limit is on **bytes**, not characters: a string of 128 emoji does not fit.\n *\n * @throws {InvalidValueError} If the string exceeds 128 UTF-8 bytes.\n *\n * @example\n * str(\"Bob\")\n */\nexport function str(value: string): StrValue {\n if (typeof value !== \"string\") {\n throw new InvalidValueError(\"str\", value, \"not a string\")\n }\n const control = findControlChar(value)\n if (control !== undefined) {\n const code = control.code.toString(16).padStart(4, \"0\").toUpperCase()\n throw new InvalidValueError(\n \"str\",\n value,\n `contains the control character U+${code} at index ${control.index}`,\n \"A str is written into a query as str('...'), whose only escape is a doubled quote — there \" +\n \"is no spelling for a control character, so this value could be stored but never queried. \" +\n \"Free-form text belongs in the entity payload; keep a short, printable key here.\",\n )\n }\n const bytes = stringToBytes(value).length\n if (bytes > MAX_STRING_BYTES) {\n throw new InvalidValueError(\n \"str\",\n value,\n `${bytes} UTF-8 bytes exceeds the ${MAX_STRING_BYTES}-byte limit on a str`,\n \"Store the long form in the entity payload and keep a short, queryable key here.\",\n )\n }\n return makeValue(\"str\", value)\n}\n\n/**\n * A 20-byte Ethereum address, indexed for equality.\n *\n * All-lowercase and all-uppercase input carries no checksum and is accepted as-is; mixed-case\n * input is checked against its EIP-55 checksum, so a mistyped address is caught here rather than\n * being written to a wrong account. The stored value is always EIP-55 checksummed.\n *\n * @throws {InvalidValueError} If the value is not 20 hex bytes, or fails its EIP-55 checksum.\n *\n * @example\n * addr(\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\")\n */\nexport function addr(value: string): AddrValue {\n if (typeof value !== \"string\" || !/^0x[0-9a-fA-F]{40}$/.test(value)) {\n throw new InvalidValueError(\"addr\", value, \"not a 20-byte 0x-prefixed hex address\")\n }\n const body = value.slice(2)\n const cased = body !== body.toLowerCase() && body !== body.toUpperCase()\n if (cased && !isAddress(value, { strict: true })) {\n throw new InvalidValueError(\n \"addr\",\n value,\n \"fails its EIP-55 checksum, so a digit is probably mistyped\",\n `If those hex digits are right, the correctly checksummed form is ` +\n `${checksumAddress(value as Address)}.`,\n )\n }\n return makeValue(\"addr\", checksumAddress(value as Address))\n}\n\n/**\n * A reference to another entity, indexed for equality.\n *\n * References are **weak**: nothing checks that the target exists when you write it, and a\n * reference to a deleted or expired entity is allowed to dangle.\n *\n * @param value - A 32-byte entity key, as `0x` hex or raw bytes.\n * @throws {InvalidValueError} If the value is not exactly 32 bytes.\n *\n * @example\n * key(parentEntityKey)\n */\nexport function key(value: Hex | Uint8Array): KeyValue {\n return makeValue(\"key\", asFixedHex(\"key\", value, 32))\n}\n\n/**\n * 32 opaque bytes — a hash, a digest, an identifier from another system — indexed for equality.\n *\n * Use {@link key} instead when the bytes are an Arkiv entity key: same wire width, but the\n * distinct type makes the reference visible to readers and to the query language.\n *\n * @param value - 32 bytes, as `0x` hex or raw bytes.\n * @throws {InvalidValueError} If the value is not exactly 32 bytes.\n *\n * @example\n * bytes32(keccak256(toBytes(\"hello\")))\n */\nexport function bytes32(value: Hex | Uint8Array): Bytes32Value {\n return makeValue(\"bytes32\", asFixedHex(\"bytes32\", value, 32))\n}\n\n/** Normalizes hex-or-bytes input of a known width into lowercase `0x` hex. */\nfunction asFixedHex(tag: \"key\" | \"bytes32\", value: Hex | Uint8Array, size: number): Hex {\n if (value instanceof Uint8Array) {\n if (value.length !== size) {\n throw new InvalidValueError(tag, `<${value.length} bytes>`, `not exactly ${size} bytes`)\n }\n return toHex(value)\n }\n if (typeof value !== \"string\" || !isHex(value, { strict: true })) {\n throw new InvalidValueError(tag, value, \"not 0x-prefixed hex\")\n }\n if (value.length !== 2 + size * 2) {\n throw new InvalidValueError(\n tag,\n value,\n `${(value.length - 2) / 2} bytes, not exactly ${size} bytes`,\n )\n }\n return value.toLowerCase() as Hex\n}\n\n/**\n * A JavaScript value accepted wherever a typed value is expected: either a tagged value, or one of\n * the four bare forms that map unambiguously onto a single type.\n *\n * | bare form | type |\n * | --------- | ------- |\n * | `boolean` | `bool` |\n * | `number` | `i32` |\n * | `bigint` | `u256` |\n * | `string` | `str` |\n *\n * Anything else — a large number, a decimal, an address, an entity key — must name its type, which\n * is what keeps `\"0x1234...\"` a string rather than silently becoming a key.\n *\n * These defaults apply identically when writing and when querying, so a value written bare and\n * queried bare always agrees with itself. The mismatch to watch for is mixing the two: an attribute\n * written as {@link u64} does not match a bare `bigint` predicate, because that predicate asserts\n * `u256`. A type mismatch is not an error to the engine — it simply matches nothing.\n */\nexport type ValueInput = ArkivValue | boolean | number | bigint | string\n\n/**\n * Resolves a {@link ValueInput} to a typed value, applying the bare-form defaults above. Tagged\n * values pass through untouched.\n *\n * @param input - The value to resolve.\n * @param attributeName - The attribute this value belongs to, used to make errors name it.\n *\n * @throws {MissingValueError} If the input is `undefined` or `null` — an attribute is either set\n * with a value and a type, or not set at all.\n * @throws {UntypedValueError} If the input is not a tagged value or a bare boolean, number, bigint\n * or string.\n * @throws {InvalidValueError} If a bare value does not fit the type it defaults to.\n *\n * @example\n * toValue(10) // i32(10)\n * toValue(10n) // u256(10n)\n * toValue(\"hello\") // str(\"hello\")\n * toValue(dec(\"3.5\")) // unchanged\n */\nexport function toValue(input: ValueInput, attributeName?: string): ArkivValue {\n // `undefined` and `null` are rejected before the type switch. They are not assignable to\n // ValueInput, but they still arrive at runtime — from a spread of an optional-shaped object, or\n // from data that never went through the type system — and \"cannot infer a type for undefined\"\n // does not tell you the fix, which is always to leave the attribute out.\n if (input === undefined || input === null) {\n throw new MissingValueError(input, attributeName)\n }\n switch (typeof input) {\n case \"boolean\":\n return bool(input)\n case \"number\":\n return i32(input)\n case \"bigint\":\n return u256(input)\n case \"string\":\n return str(input)\n default: {\n // Widened to AnyArkivValue: `bytes` is not a member of ValueInput, but it is what a decoded\n // `$payload` carries, so a round-trip through a decoded entity must be rejected by name\n // rather than fall through to \"cannot infer a type\".\n const candidate = input as AnyArkivValue\n if (isArkivValue(candidate)) {\n if (candidate.type === \"bytes\") {\n throw new InvalidValueError(\n \"bytes\",\n candidate.value,\n \"system-only — bytes backs the entity payload and cannot be set as an attribute\",\n \"Pass the bytes as the entity payload instead.\",\n )\n }\n return revalidate(candidate)\n }\n throw new UntypedValueError(input)\n }\n }\n}\n\n/**\n * Re-runs a tagged value through its own constructor.\n *\n * {@link isArkivValue} can only check shape — the `validated` brand is a type-level construct with\n * no runtime existence, so a hand-written `{ type: \"u256\", value: \"1000\" }` (from `JSON.parse`, a\n * config file, an `as any` boundary) is indistinguishable from a real `u256(1000n)`. Passing it\n * through unchecked was silent corruption rather than an error: the ABI encoder would take the\n * *string* \"1000\" and write its UTF-8 bytes into the word, storing 2.27e76 on chain.\n *\n * Running the constructor again is what makes the brand's promise — \"every value crossing the wire\n * has been range-, length- and format-checked\" — true at runtime. For a value that really did come\n * from a constructor it is a no-op that returns an equal value.\n */\nfunction revalidate(value: Exclude<AnyArkivValue, BytesValue>): ArkivValue {\n switch (value.type) {\n case \"bool\":\n return bool(value.value)\n case \"i32\":\n return i32(value.value)\n case \"u64\":\n return u64(value.value)\n case \"u256\":\n return u256(value.value)\n case \"dec\":\n return dec(value.value)\n case \"bytes32\":\n return bytes32(value.value)\n case \"str\":\n return str(value.value)\n case \"addr\":\n return addr(value.value)\n case \"key\":\n return key(value.value)\n }\n}\n","import { bytesToString, type Hex, hexToBytes, pad, size, stringToBytes, toHex } from \"viem\"\nimport { unitsToDecimal } from \"./decimal\"\nimport { InvalidValueError, UnknownAttributeTypeError } from \"./errors\"\nimport { type AnyArkivValue, makeValue, type StrValue, TYPE_IDS, type TypeTag } from \"./types\"\nimport { addr, bool, bytes32, dec, decUnits, i32, key, u64, u256 } from \"./values\"\n\nfunction strFromChain(value: string): StrValue {\n return makeValue(\"str\", value)\n}\n\n/**\n * The `typeId` marking a tombstone — an attribute being unset. It carries a zero-length value and\n * is legal only in a patch's mutation list, never in a create.\n */\nexport const TOMBSTONE_TYPE_ID = 0\n\n/**\n * An attribute in its ABI form: `(Ident32 name, uint8 typeId, bytes value)`.\n *\n * The `value` encoding is selected by `typeId`: an exact 32-byte word for the word types, the raw\n * bytes for `str` and `bytes`, and zero-length for a tombstone.\n */\nexport type AbiAttribute = {\n name: Hex\n typeId: number\n value: Hex\n}\n\n/**\n * Encodes a typed value into the `bytes` the ABI carries for it.\n *\n * This and {@link decodeValueBytes} are the only place the value/wire mapping is written down.\n *\n * - Word types (`bool`, `i32`, `u64`, `u256`, `dec`, `bytes32`, `addr`, `key`) become exactly 32\n * bytes, in the encoding Solidity would use — right-aligned, and sign-extended for `i32`.\n * - `str` becomes its raw UTF-8 bytes, and `bytes` its raw bytes: variable length, no padding.\n */\nexport function encodeValueBytes(value: AnyArkivValue): Hex {\n switch (value.type) {\n case \"bool\":\n return pad(value.value ? \"0x01\" : \"0x00\", { size: 32 })\n case \"i32\":\n // int32 is sign-extended across the whole word, as Solidity encodes it.\n return toHex(BigInt.asUintN(256, BigInt(value.value)), { size: 32 })\n case \"u64\":\n case \"u256\":\n return toHex(value.value, { size: 32 })\n case \"dec\":\n return toHex(BigInt.asUintN(256, decUnits(value)), { size: 32 })\n case \"bytes32\":\n case \"key\":\n return value.value\n case \"addr\":\n return pad(value.value.toLowerCase() as Hex, { size: 32 })\n case \"str\":\n return toHex(stringToBytes(value.value))\n case \"bytes\":\n return value.value\n }\n}\n\n/**\n * Decodes the ABI `bytes` of an attribute of type `tag`.\n *\n * Rejects anything a well-formed encoder would not have produced — a word type whose value is not\n * 32 bytes, an `i32` that is not sign-extended, a `bool` that is neither 0 nor 1 — rather than\n * silently truncating it.\n */\nexport function decodeValueBytes(tag: TypeTag, value: Hex): AnyArkivValue {\n if (tag === \"str\") return strFromChain(bytesToString(hexToBytes(value)))\n if (tag === \"bytes\") return makeValue(\"bytes\", value.toLowerCase() as Hex)\n\n const width = size(value)\n if (width !== 32) {\n throw new InvalidValueError(tag, value, `a ${tag} value must be 32 bytes, got ${width}`)\n }\n const raw = BigInt(value)\n\n switch (tag) {\n case \"bool\":\n if (raw !== 0n && raw !== 1n) {\n throw new InvalidValueError(\"bool\", value, \"a bool word must hold exactly 0 or 1\")\n }\n return bool(raw === 1n)\n case \"i32\": {\n const narrowed = BigInt.asIntN(32, raw)\n if (BigInt.asUintN(256, narrowed) !== raw) {\n throw new InvalidValueError(\"i32\", value, \"an i32 word must be sign-extended\")\n }\n return i32(narrowed)\n }\n case \"u64\":\n if (raw >> 64n !== 0n) {\n throw new InvalidValueError(\"u64\", value, \"a u64 word must be zero-padded to 8 bytes\")\n }\n return u64(raw)\n case \"u256\":\n return u256(raw)\n case \"dec\":\n return dec(unitsToDecimal(BigInt.asIntN(256, raw)))\n case \"bytes32\":\n return bytes32(value)\n case \"key\":\n return key(value)\n case \"addr\": {\n if (raw >> 160n !== 0n) {\n throw new InvalidValueError(\n \"addr\",\n value,\n \"an address word must be zero-padded to 20 bytes\",\n )\n }\n return addr(`0x${value.slice(-40)}`)\n }\n }\n}\n\n/**\n * Encodes a named, typed attribute into its ABI form.\n *\n * @param name - The attribute name. Assumed already validated, or a system (`$`) name the SDK sets\n * itself.\n */\nexport function encodeAbiAttribute(name: string, value: AnyArkivValue): AbiAttribute {\n return {\n // Ident32 is left-aligned and null-padded, which is what `toHex` does for a string.\n name: toHex(name, { size: 32 }),\n typeId: TYPE_IDS[value.type],\n value: encodeValueBytes(value),\n }\n}\n\n/** Encodes a tombstone — the mutation that unsets `name`. Legal only in a patch. */\nexport function encodeTombstone(name: string): AbiAttribute {\n return { name: toHex(name, { size: 32 }), typeId: TOMBSTONE_TYPE_ID, value: \"0x\" }\n}\n\n/**\n * Decodes an attribute value as it comes back over JSON-RPC.\n *\n * The JSON encoding follows the value's **declared type**, never its magnitude: `bool` is a JSON\n * boolean, `i32` a JSON number, `u64`/`u256` a `0x` QUANTITY, `dec` a decimal string, `str` a\n * string, and\n * the byte-shaped types `0x` DATA. Decimal strings are also accepted for the integer types, so this\n * keeps working against a node that renders them that way.\n *\n * @param type - The type tag the response declared, e.g. `\"u256\"`.\n * @param value - The JSON value.\n * @throws {UnknownAttributeTypeError} If the tag names no known type.\n * @throws {InvalidValueError} If the value does not parse as that type.\n */\nexport function decodeRpcValue(type: string, value: unknown): AnyArkivValue {\n const tag = asTypeTag(type)\n switch (tag) {\n case \"bool\":\n return bool(asBoolean(value))\n case \"i32\":\n return i32(Number(asIntegerish(\"i32\", value)))\n case \"u64\":\n return u64(asIntegerish(\"u64\", value))\n case \"u256\":\n return u256(asIntegerish(\"u256\", value))\n case \"dec\":\n return dec(asString(\"dec\", value))\n case \"bytes32\":\n return bytes32(asString(\"bytes32\", value) as Hex)\n case \"key\":\n return key(asString(\"key\", value) as Hex)\n case \"addr\":\n return addr(asString(\"addr\", value))\n case \"str\":\n return strFromChain(asString(\"str\", value))\n case \"bytes\":\n return makeValue(\"bytes\", asString(\"bytes\", value).toLowerCase() as Hex)\n }\n}\n\n/**\n * Narrows a type tag as the node spelled it.\n *\n * @throws {UnknownAttributeTypeError} If it names no type this SDK knows.\n */\nexport function asTypeTag(type: string): TypeTag {\n // `Object.hasOwn`, not `in`: `in` walks the prototype chain, so \"constructor\" and \"toString\"\n // would pass as type tags and then fall off the end of the exhaustive switch below as `undefined`.\n if (typeof type !== \"string\" || !Object.hasOwn(TYPE_IDS, type)) {\n throw new UnknownAttributeTypeError(type)\n }\n return type as TypeTag\n}\n\nfunction asBoolean(value: unknown): boolean {\n if (typeof value === \"boolean\") return value\n // Tolerated because a node may render it as text; anything else is a protocol error.\n if (value === \"true\" || value === \"false\") return value === \"true\"\n throw new InvalidValueError(\"bool\", value, \"not a boolean\")\n}\n\nfunction asString(tag: TypeTag, value: unknown): string {\n if (typeof value !== \"string\") {\n throw new InvalidValueError(tag, value, `expected a string, got ${typeof value}`)\n }\n return value\n}\n\n/** A `0x` QUANTITY, a JSON number, or a decimal string — all of which name one integer. */\nfunction asIntegerish(tag: TypeTag, value: unknown): bigint {\n if (typeof value === \"number\") {\n if (!Number.isInteger(value)) {\n throw new InvalidValueError(tag, value, \"not an integer\")\n }\n return BigInt(value)\n }\n if (typeof value === \"bigint\") return value\n if (typeof value === \"string\") {\n if (/^0x[0-9a-fA-F]+$/.test(value)) return BigInt(value)\n if (/^-?\\d+$/.test(value)) return BigInt(value)\n }\n throw new InvalidValueError(tag, value, \"not an integer\")\n}\n","import { InvalidAttributeNameError } from \"./errors\"\n\n/** The longest attribute name, in bytes — the width of the on-chain `Ident32` name cell. */\nexport const MAX_NAME_BYTES = 32\n\n/**\n * The attribute-name grammar (`Ident32`): a leading letter, then letters, digits, `.`, `-` or `_`.\n *\n * Names are **case-sensitive** — `Level` and `level` are two different attributes.\n *\n * The charset is ASCII-only, so a name's length in characters is also its length in bytes.\n */\nconst NAME_RE = /^[A-Za-z][A-Za-z0-9._-]*$/\n\n/**\n * Words the query language reserves. They are rejected as attribute names because an attribute\n * named `not` or `str` could be written but never queried — the parser would read the name as an\n * operator or a type tag.\n *\n * Matched **case-insensitively**: query keywords are case-insensitive, so `NOT` and `not` are the\n * same operator, and the type tags are held to the same rule so that what is reserved does not\n * depend on how you happen to capitalise it.\n */\nconst RESERVED = new Set([\n // operators and keywords\n \"and\",\n \"or\",\n \"not\",\n \"true\",\n \"false\",\n \"startswith\",\n \"exists\",\n \"typeof\",\n // type tags\n \"bool\",\n \"i32\",\n \"u64\",\n \"u256\",\n \"dec\",\n \"bytes32\",\n \"bytes\",\n \"str\",\n \"addr\",\n \"key\",\n])\n\n/**\n * Validates an attribute name against the engine's `Ident32` grammar and the query language's\n * reserved words.\n *\n * @param name - The attribute name.\n * @throws {InvalidAttributeNameError} If the name is empty, too long, uses characters outside the\n * grammar, or collides with a reserved word.\n */\nexport function validateAttributeName(name: string): void {\n if (typeof name !== \"string\" || name.length === 0) {\n throw new InvalidAttributeNameError(String(name), \"the name is empty\")\n }\n if (name.startsWith(\"$\")) {\n throw new InvalidAttributeNameError(\n name,\n '\"$\" is reserved for system attributes, which the engine sets and you cannot write',\n )\n }\n if (!NAME_RE.test(name)) {\n const chars = [...name]\n const at = chars.findIndex(\n (char, index) => !(index === 0 ? /[A-Za-z]/ : /[A-Za-z0-9._-]/).test(char),\n )\n throw new InvalidAttributeNameError(\n name,\n at === 0\n ? `it starts with \"${chars[0]}\" rather than a letter`\n : `it contains \"${chars[at]}\" at position ${at}`,\n )\n }\n if (name.length > MAX_NAME_BYTES) {\n throw new InvalidAttributeNameError(name, `the name is ${name.length} bytes long`)\n }\n // `-` is a legal name character and `--` opens a comment that runs to the end of the line, so a\n // name containing one renders a query whose whole remainder is discarded\n if (name.includes(\"--\")) {\n throw new InvalidAttributeNameError(\n name,\n '\"--\" opens a comment in the query language, so everything after it in a query would be ' +\n \"discarded — an attribute with this name could be written but never safely queried\",\n )\n }\n if (RESERVED.has(name.toLowerCase())) {\n throw new InvalidAttributeNameError(\n name,\n `\"${name}\" is reserved by the query language, so an attribute with this name could never ` +\n \"be queried\",\n )\n }\n}\n\n/** Whether `name` is a valid attribute name — the non-throwing form of {@link validateAttributeName}. */\nexport function isValidAttributeName(name: string): boolean {\n try {\n validateAttributeName(name)\n return true\n } catch {\n return false\n }\n}\n","import { type AbiAttribute, encodeAbiAttribute, encodeTombstone } from \"./codec\"\nimport { ConflictingMutationError, InvalidValueError, TooManyAttributesError } from \"./errors\"\nimport { validateAttributeName } from \"./names\"\nimport type { AnyArkivValue, ArkivValue, TypeTag } from \"./types\"\nimport { makeValue } from \"./types\"\nimport { str, toValue, type ValueInput } from \"./values\"\n\n/**\n * The most attribute cells one operation may carry.\n */\nexport const MAX_ATTRIBUTES = 32\n\nexport const MAX_PAYLOAD_BYTES = 128 * 1024\n\n/** The system attribute holding an entity's opaque payload. */\nconst PAYLOAD_CELL = \"$payload\"\n/** The system attribute holding an entity's content type. */\nconst CONTENT_TYPE_CELL = \"$contentType\"\n\n/**\n * The attributes written on an entity, as a plain object keyed by attribute name.\n *\n * Values may be tagged ({@link ValueInput}) or bare where the type is unambiguous — see\n * {@link toValue} for the bare-form defaults.\n *\n * @example\n * const attributes = {\n * level: i32(10),\n * balance: u256(1_000_000n),\n * score: dec(\"3.5\"),\n * parent: key(parentKey),\n * name: \"Bob\", // bare string -> str\n * flagged: true, // bare boolean -> bool\n * } satisfies AttributeInputs\n */\nexport type AttributeInputs = Readonly<Record<string, ValueInput>>\n\n/**\n * The attributes read back from an entity: the same shape, with every value typed.\n *\n * A value read from here drops straight back into an {@link AttributeInputs} — the vocabulary is the\n * same in both directions.\n */\nexport type Attributes = Readonly<Record<string, AnyArkivValue>>\n\n/**\n * The names and types of an entity's attributes, with no values — what the `attributeSchema`\n * projection returns.\n *\n * Useful for asking what shape the data has without paying to transfer it, and for telling apart\n * two entities that use the same name with different types.\n */\nexport type AttributeSchema = Readonly<Record<string, TypeTag>>\n\n/**\n * The typed form of an attribute map: names validated, bare values resolved to their default type.\n *\n * @throws {InvalidAttributeNameError} If a name violates the attribute-name grammar.\n * @throws {MissingValueError} If a value is `undefined` or `null` — omit the name instead.\n * @throws {InvalidValueError} If a value does not fit the type it names or defaults to.\n * @throws {TooManyAttributesError} If there are more than {@link MAX_ATTRIBUTES} attributes.\n *\n * @example\n * resolveAttributes({ level: 10, name: \"Bob\" })\n * // { level: { type: \"i32\", value: 10 }, name: { type: \"str\", value: \"Bob\" } }\n */\nexport function resolveAttributes(attributes: AttributeInputs): Record<string, ArkivValue> {\n const entries = Object.entries(attributes)\n if (entries.length > MAX_ATTRIBUTES) {\n throw new TooManyAttributesError(entries.length, MAX_ATTRIBUTES)\n }\n const resolved: Record<string, ArkivValue> = {}\n for (const [name, input] of entries) {\n validateAttributeName(name)\n resolved[name] = toValue(input, name)\n }\n return resolved\n}\n\n/**\n * The payload and content type, which travel to the engine as system attributes.\n *\n * They are separate fields on the SDK's surface because that is what they are to an application —\n * an entity's contents and its type — but on the wire an operation carries no dedicated field for\n * either: `$payload` is the one `bytes`-typed cell, and `$contentType` is a `str`.\n */\nexport type SystemCells = {\n payload?: Uint8Array | undefined\n contentType?: string | undefined\n}\n\n/**\n * Encodes an attribute map, plus the payload and content-type system cells, into the ABI attribute\n * array an operation carries.\n *\n * @throws {InvalidAttributeNameError} If a name violates the attribute-name grammar.\n * @throws {MissingValueError} If a value is `undefined` or `null`.\n * @throws {InvalidValueError} If a value does not fit its type.\n * @throws {TooManyAttributesError} If there are more than {@link MAX_ATTRIBUTES} attributes.\n */\nexport function encodeAttributes(\n attributes: AttributeInputs = {},\n system: SystemCells = {},\n): AbiAttribute[] {\n const cells: [string, AnyArkivValue][] = Object.entries(resolveAttributes(attributes))\n\n // Written whenever the field is given, empty or not: an empty payload is a payload, and dropping\n // it would mean the entity does not hold what the caller passed. Absence is for the operations\n // that genuinely leave a cell alone, not for a value that happens to be empty.\n if (system.payload !== undefined) {\n if (system.payload.length > MAX_PAYLOAD_BYTES) {\n throw new InvalidValueError(\n \"bytes\",\n `<${system.payload.length} bytes>`,\n `${system.payload.length} bytes exceeds the ${MAX_PAYLOAD_BYTES}-byte payload limit`,\n \"Store the bulk elsewhere and keep a reference to it on the entity.\",\n )\n }\n cells.push([PAYLOAD_CELL, makeValue(\"bytes\", toHexBytes(system.payload))])\n }\n if (system.contentType !== undefined) {\n cells.push([CONTENT_TYPE_CELL, str(system.contentType)])\n }\n\n if (cells.length > MAX_ATTRIBUTES) {\n throw new TooManyAttributesError(cells.length, MAX_ATTRIBUTES)\n }\n\n return cells.map(([name, value]) => encodeAbiAttribute(name, value)).sort(byName)\n}\n\nexport type MutationInputs = SystemCells & {\n /** Attributes to write. Existing ones are overwritten; new ones are added. */\n set?: AttributeInputs | undefined\n /** Attribute names to remove. Each becomes a tombstone on the wire. */\n unset?: readonly string[] | undefined\n}\n\n/**\n * Encodes a patch's mutations into the ABI attribute array the operation carries.\n *\n * @throws {ConflictingMutationError} If a name appears in both `set` and `unset`.\n * @throws {InvalidAttributeNameError} If a name violates the attribute-name grammar.\n * @throws {InvalidValueError} If a value does not fit its type.\n * @throws {TooManyAttributesError} If `set` names more than {@link MAX_ATTRIBUTES} attributes.\n */\nexport function encodeMutations({\n set,\n unset,\n payload,\n contentType,\n}: MutationInputs): AbiAttribute[] {\n const written = encodeAttributes(set, { payload, contentType })\n const tombstones = resolveUnset(unset, set).map(encodeTombstone)\n const mutations = [...written, ...tombstones]\n if (mutations.length > MAX_ATTRIBUTES) {\n throw new TooManyAttributesError(mutations.length, MAX_ATTRIBUTES)\n }\n return mutations.sort(byName)\n}\n\nfunction resolveUnset(unset: readonly string[] = [], set: AttributeInputs = {}): string[] {\n if (!Array.isArray(unset)) {\n throw new TypeError(`\"unset\" must be an array of attribute names`)\n }\n const names = new Set(unset)\n for (const name of names) {\n validateAttributeName(name)\n if (Object.hasOwn(set, name)) {\n throw new ConflictingMutationError(name)\n }\n }\n return [...names]\n}\n\n/**\n * The engine requires attributes **strictly ascending by their `bytes32` name**: that ordering is\n * what the canonical serialization hashes into the state root, and it doubles as the uniqueness\n * check.\n */\nfunction byName(a: AbiAttribute, b: AbiAttribute): number {\n return a.name < b.name ? -1 : a.name > b.name ? 1 : 0\n}\n\n/** Raw bytes as lowercase `0x` hex, without viem's hex-string ambiguity. */\nfunction toHexBytes(bytes: Uint8Array): `0x${string}` {\n let out = \"0x\"\n for (const byte of bytes) out += byte.toString(16).padStart(2, \"0\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1B,OAAM,IAAI,yBAAyB,KAAK;;AAG5C,QAAO,CAAC,GAAG,MAAM;;;;;;;AAQnB,SAAS,OAAO,GAAiB,GAAyB;AACxD,QAAO,EAAE,OAAO,EAAE,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,IAAI;;;AAItD,SAAS,WAAW,OAAkC;CACpD,IAAI,MAAM;AACV,MAAK,MAAM,QAAQ,MAAO,QAAO,KAAK,SAAS,GAAG,CAAC,SAAS,GAAG,IAAI;AACnE,QAAO"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chains-BJrZs6sG.js","names":[],"sources":["../src/chains/cheesecake.ts","../src/chains/localhost.ts","../src/chains/index.ts"],"sourcesContent":["import { defineChain } from \"viem\"\n\n/**\n * Cheesecake is Arkiv's testnet.\n */\nexport const cheesecake = defineChain({\n id: 7733102,\n name: \"Cheesecake\",\n network: \"cheesecake\",\n nativeCurrency: {\n name: \"Golem\",\n symbol: \"GLM\",\n decimals: 18,\n },\n rpcUrls: {\n default: {\n http: [\"https://rpc.cheesecake.db-chain.devnet.gobas.me\"],\n webSocket: [\"wss://rpc.cheesecake.db-chain.devnet.gobas.me\"],\n },\n },\n testnet: true,\n})\n","import { defineChain } from \"viem\"\n\nexport const localhost = defineChain({\n id: 1337,\n name: \"Localhost\",\n nativeCurrency: {\n decimals: 18,\n name: \"Ether\",\n symbol: \"ETH\",\n },\n rpcUrls: {\n default: { http: [\"http://127.0.0.1:8545\"] },\n },\n})\n","export { cheesecake } from \"./cheesecake\"\nexport { localhost } from \"./localhost\"\n"],"mappings":";;;;;;;;;;;;;;;;;;AAKA,MAAa,aAAa,YAAY;CACpC,IAAI;CACJ,MAAM;CACN,SAAS;CACT,gBAAgB;EACd,MAAM;EACN,QAAQ;EACR,UAAU;EACX;CACD,SAAS,EACP,SAAS;EACP,MAAM,CAAC,kDAAkD;EACzD,WAAW,CAAC,gDAAgD;EAC7D,EACF;CACD,SAAS;CACV,CAAC;;;;ACnBF,MA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{"version":3,"file":"errors-LTe7bOYS.js","names":[],"sources":["../src/entity/errors.ts"],"sourcesContent":["/** An expiry could not be expressed, or would be rejected by the engine. */\nexport class InvalidExpiryError extends Error {\n constructor(reason: string) {\n super(`Invalid expiry: ${reason}`)\n this.name = \"InvalidExpiryError\"\n }\n}\n\n/** A `creationFlags` byte could not be built or read. */\nexport class InvalidCreationFlagsError extends Error {\n constructor(reason: string) {\n super(`Invalid creation flags: ${reason}`)\n this.name = \"InvalidCreationFlagsError\"\n }\n}\n\n/** A key salt was outside the `uint128` the wire carries. */\nexport class InvalidSaltError extends Error {\n constructor(salt: bigint) {\n super(\n `Invalid salt ${salt}. A salt is a uint128, so it must be between 0 and ` +\n `${2n ** 128n - 1n}. Omit it to get 128 random bits, or pass 0 for a predictable key.`,\n )\n this.name = \"InvalidSaltError\"\n }\n}\n\n/** No cryptographic randomness was available to generate a salt. */\nexport class NoRandomSourceError extends Error {\n constructor() {\n super(\n \"No cryptographic random source is available (globalThis.crypto.getRandomValues is \" +\n \"missing), so a key salt cannot be generated. Upgrade to Node 18+ or a modern browser, \" +\n \"or pass an explicit salt.\",\n )\n this.name = \"NoRandomSourceError\"\n }\n}\n"],"mappings":";;AACA,IAAa,qBAAb,cAAwC,MAAM;CAC5C,YAAY,QAAgB;AAC1B,QAAM,mBAAmB,SAAS;AAClC,OAAK,OAAO;;;;AAKhB,IAAa,4BAAb,cAA+C,MAAM;CACnD,YAAY,QAAgB;AAC1B,QAAM,2BAA2B,SAAS;AAC1C,OAAK,OAAO;;;;AAKhB,IAAa,mBAAb,cAAsC,MAAM;CAC1C,YAAY,MAAc;AACxB,QACE,gBAAgB,KAAK,qDAChB,MAAM,OAAO,GAAG,oEACtB;AACD,OAAK,OAAO;;;;AAKhB,IAAa,sBAAb,cAAyC,MAAM;CAC7C,cAAc;AACZ,QACE,oMAGD;AACD,OAAK,OAAO"}
|