@arkiv-network/sdk 0.8.0-advanced.2 → 0.8.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -42
- package/dist/attr/index.cjs +33 -34
- package/dist/attr/index.d.cts +1 -1
- package/dist/attr/index.d.ts +1 -2
- package/dist/attr/index.js +1 -2
- package/dist/{attributes-Df9IsCVs.cjs → attr-BXTkpnoc.cjs} +13 -3
- package/dist/{attributes-BhY5DwJp.js → attr-tmyREHtw.js} +14 -4
- package/dist/attr-tmyREHtw.js.map +1 -0
- 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/{arkivTransactions-NtGD6uk5.d.ts → changeOwnership-B0ar96ub.d.ts} +74 -123
- package/dist/changeOwnership-B0ar96ub.d.ts.map +1 -0
- package/dist/{arkivTransactions-D74gERHG.d.cts → changeOwnership-BofkLnXJ.d.cts} +74 -123
- package/dist/changeOwnership-BofkLnXJ.d.cts.map +1 -0
- package/dist/entity/index.cjs +9 -9
- package/dist/entity/index.d.cts +3 -3
- package/dist/entity/index.d.ts +4 -5
- package/dist/entity/index.js +5 -6
- package/dist/{entity-BYQR1uoe.js → entity-BIp_df9u.js} +1 -1
- package/dist/{entity-BYQR1uoe.js.map → entity-BIp_df9u.js.map} +1 -1
- package/dist/{key-D1Bh7MF0.js → entity-CniBgBSd.js} +31 -19
- package/dist/entity-CniBgBSd.js.map +1 -0
- package/dist/{key-WKhXnXuU.cjs → entity-DJ0Gml9c.cjs} +37 -19
- package/dist/{errors-LTe7bOYS.js → errors-D2E1GRjw.js} +2 -2
- package/dist/errors-D2E1GRjw.js.map +1 -0
- package/dist/{errors-BVbjKVMN.cjs → errors-DhV00966.cjs} +1 -1
- package/dist/{expiry-nDbCgZX4.d.ts → expiry-BxOlvVWC.d.ts} +1 -1
- package/dist/{expiry-nDbCgZX4.d.ts.map → expiry-BxOlvVWC.d.ts.map} +1 -1
- package/dist/{expiry-BELY2Kpw.cjs → expiry-CG9GhVXv.cjs} +1 -1
- package/dist/{expiry-BjpxZZQU.js → expiry-Cgdb_dbq.js} +2 -2
- package/dist/expiry-Cgdb_dbq.js.map +1 -0
- package/dist/expiry-DRV29F1r.d.cts.map +1 -1
- package/dist/{flags-CRjPpoh3.d.cts → flags-0Vl5rrHq.d.cts} +1 -1
- package/dist/{flags-CRjPpoh3.d.cts.map → flags-0Vl5rrHq.d.cts.map} +1 -1
- package/dist/{flags-kr276q6i.cjs → flags-DCD26uhe.cjs} +1 -1
- package/dist/{flags-DFBs2J94.js → flags-DUT2gHEU.js} +2 -2
- package/dist/{flags-DFBs2J94.js.map → flags-DUT2gHEU.js.map} +1 -1
- package/dist/{flags-5dTNRnow.d.ts → flags-wmcMoAnN.d.ts} +1 -1
- package/dist/{flags-5dTNRnow.d.ts.map → flags-wmcMoAnN.d.ts.map} +1 -1
- package/dist/{index-fX_XyqLp.d.ts → index-BGp2plHs.d.cts} +15 -13
- package/dist/index-BGp2plHs.d.cts.map +1 -0
- package/dist/{index-DHDud2hC.d.ts → index-BKB875Um.d.ts} +5 -7
- package/dist/{index-DHDud2hC.d.ts.map → index-BKB875Um.d.ts.map} +1 -1
- package/dist/{index-DvYvrkdk.d.ts → index-CIcHPx2j.d.cts} +110 -6
- package/dist/index-CIcHPx2j.d.cts.map +1 -0
- package/dist/{index-CV5zCdpa.d.cts → index-Cd2aaWme.d.ts} +13 -6
- package/dist/index-Cd2aaWme.d.ts.map +1 -0
- package/dist/{index-CA4V7Pdh.d.cts → index-ezMZ2-JH.d.ts} +15 -13
- package/dist/index-ezMZ2-JH.d.ts.map +1 -0
- package/dist/{index-BF7Mq9Is.d.cts → index-rINthNuU.d.cts} +5 -7
- package/dist/{index-BF7Mq9Is.d.cts.map → index-rINthNuU.d.cts.map} +1 -1
- package/dist/index.cjs +433 -139
- package/dist/index.d.cts +58 -164
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +59 -166
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +376 -75
- package/dist/index.js.map +1 -1
- package/dist/{payload-CcUj85ys.d.ts → payload-CGvVPZQX.d.ts} +61 -2
- package/dist/payload-CGvVPZQX.d.ts.map +1 -0
- package/dist/{payload-Bz6651ax.js → payload-DE7wMztL.js} +28 -3
- package/dist/payload-DE7wMztL.js.map +1 -0
- package/dist/{payload-BNoud2KZ.d.cts → payload-Dfu30njp.d.cts} +60 -1
- package/dist/payload-Dfu30njp.d.cts.map +1 -0
- package/dist/{payload-KC14SDlN.cjs → payload-DqFweqiO.cjs} +27 -2
- package/dist/query/index.cjs +5 -7
- package/dist/query/index.d.cts +4 -4
- package/dist/query/index.d.ts +4 -5
- package/dist/query/index.js +5 -7
- package/dist/{queryBuilder-DM6AWCBa.js → queryBuilder-wvA8sn--.js} +169 -23
- package/dist/queryBuilder-wvA8sn--.js.map +1 -0
- package/dist/{queryBuilder-DbUMEZln.cjs → queryBuilder-zHGhDmaG.cjs} +215 -33
- package/dist/{selection-DPg0uyJf.d.cts → selection-Bv8_o-7i.d.cts} +76 -68
- package/dist/selection-Bv8_o-7i.d.cts.map +1 -0
- package/dist/{selection-C4UhsMOO.d.ts → selection-ox7zdtVm.d.ts} +76 -69
- package/dist/selection-ox7zdtVm.d.ts.map +1 -0
- package/dist/types/index.cjs +2 -2
- package/dist/types/index.d.cts +6 -6
- package/dist/types/index.d.ts +7 -8
- package/dist/types/index.js +2 -2
- package/dist/utils/index.cjs +3 -3
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +3 -3
- package/package.json +1 -5
- 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/public/query.ts +1 -5
- 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} +26 -11
- 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/arkivPublic.ts +13 -24
- package/src/clients/decorators/arkivWallet.ts +40 -47
- 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 -2
- package/src/entity/key.ts +23 -3
- package/src/entity/operations.ts +1 -0
- package/src/index.ts +0 -13
- package/src/query/engine.ts +0 -11
- package/src/query/errors.ts +1 -1
- package/src/query/expression.ts +14 -7
- package/src/query/queryBuilder.test.ts +1 -21
- package/src/query/queryBuilder.ts +3 -10
- 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 +114 -254
- package/src/utils/expirationTime.ts +39 -0
- package/src/utils/payload.ts +25 -0
- package/dist/actions/advanced/index.cjs +0 -13
- package/dist/actions/advanced/index.d.cts +0 -8
- package/dist/actions/advanced/index.d.ts +0 -9
- package/dist/actions/advanced/index.js +0 -9
- package/dist/advanced-8ZPTmmaN.js +0 -598
- package/dist/advanced-8ZPTmmaN.js.map +0 -1
- package/dist/advanced-fPImL6lW.cjs +0 -656
- 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 +0 -102
- package/dist/codec-Car3KkFF.d.ts.map +0 -1
- package/dist/entity-B7G8q_Eo.cjs +0 -0
- package/dist/entity-CD_qFF2M.js +0 -0
- package/dist/errors-LTe7bOYS.js.map +0 -1
- package/dist/expiry-BjpxZZQU.js.map +0 -1
- package/dist/index-B5j76711.d.ts +0 -184
- package/dist/index-B5j76711.d.ts.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-EeUO0nnJ.d.cts +0 -184
- package/dist/index-EeUO0nnJ.d.cts.map +0 -1
- package/dist/index-fX_XyqLp.d.ts.map +0 -1
- package/dist/key-D1Bh7MF0.js.map +0 -1
- package/dist/logger-CVpvU8ik.js +0 -153
- package/dist/logger-CVpvU8ik.js.map +0 -1
- package/dist/logger-Cr15lPAQ.cjs +0 -188
- 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/dist/types-Bu_ZwMbZ.js +0 -0
- package/dist/types-NRqymi6S.cjs +0 -0
- package/src/actions/advanced/advanced.test.ts +0 -258
- package/src/actions/advanced/buildMutation.ts +0 -104
- package/src/actions/advanced/getMutationResult.ts +0 -112
- package/src/actions/advanced/index.ts +0 -21
- package/src/actions/advanced/pingTransaction.ts +0 -43
- package/src/actions/advanced/sendMutation.ts +0 -59
- package/src/clients/decorators/arkivAdvanced.ts +0 -144
- /package/dist/{entity-B00Li04j.cjs → entity-B0t6sN7F.cjs} +0 -0
- /package/dist/{attr-DlmErkvR.cjs → types-Bx1EKe0v.js} +0 -0
- /package/dist/{attr-GcQKatub.js → types-CKPddlfS.cjs} +0 -0
package/README.md
CHANGED
|
@@ -291,48 +291,6 @@ However, funds may not always be available for this key.
|
|
|
291
291
|
|
|
292
292
|
Sample code can also be found in the [`sample`](./sample) directory of this repository.
|
|
293
293
|
|
|
294
|
-
### Advanced Path (Minimal RPC Calls)
|
|
295
|
-
|
|
296
|
-
The everyday actions (`createEntity`, `mutateEntities`, ...) bundle send + wait + decode into one
|
|
297
|
-
call, which is convenient but spends several RPC requests per mutation. The `client.advanced`
|
|
298
|
-
namespace unbundles them so you control every call yourself:
|
|
299
|
-
|
|
300
|
-
```typescript
|
|
301
|
-
// 1. Send — submits the transaction and returns the hash immediately. No waiting, no polling,
|
|
302
|
-
// no revert diagnosis. Supply `currentBlock` and full `txParams` (nonce, gas, fees) and this
|
|
303
|
-
// is exactly one RPC call: eth_sendRawTransaction.
|
|
304
|
-
const { txHash } = await client.advanced.sendMutation(
|
|
305
|
-
{ creates: [{ payload, contentType: "application/json", expires: ExpirationTime.fromDays(30) }] },
|
|
306
|
-
{
|
|
307
|
-
currentBlock, // skip eth_blockNumber
|
|
308
|
-
txParams: { nonce, gas, maxFeePerGas, maxPriorityFeePerGas }, // skip fee/nonce/gas lookups
|
|
309
|
-
},
|
|
310
|
-
)
|
|
311
|
-
|
|
312
|
-
// 2. Ping — one eth_getTransactionReceipt, on your own schedule. Never polls.
|
|
313
|
-
const ping = await client.advanced.pingTransaction(txHash)
|
|
314
|
-
// { status: "pending" } | { status: "success" | "reverted", blockNumber }
|
|
315
|
-
|
|
316
|
-
// 3. Result — the same single call, decoded into entity keys and expiries.
|
|
317
|
-
const result = await client.advanced.getMutationResult(txHash)
|
|
318
|
-
if (result.status === "success") console.log(result.createdEntities, result.createdExpiries)
|
|
319
|
-
|
|
320
|
-
// Or, with a receipt you already hold (your own watcher, webhook...): zero RPC calls.
|
|
321
|
-
const decoded = client.advanced.decodeMutationResult(receipt)
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
For full offline control, `client.advanced.buildMutation(data, { currentBlock })` encodes the
|
|
325
|
-
batch with **zero** RPC calls and returns the `execute` calldata (`{ to, data }`) — sign it
|
|
326
|
-
yourself and the whole mutation costs a single `eth_sendRawTransaction`. Pair it with
|
|
327
|
-
`predictEntityKeys` to know the created keys before the transaction is even mined.
|
|
328
|
-
|
|
329
|
-
The checking half (`pingTransaction`, `getMutationResult`, `decodeMutationResult`) is also
|
|
330
|
-
available on the public client, so a keyless process can follow a transaction by hash alone.
|
|
331
|
-
|
|
332
|
-
A complete runnable walkthrough — manual nonce, gas and fee setup, the single-call send, and the
|
|
333
|
-
hand-rolled receipt check — is in
|
|
334
|
-
[`sample/write_example_advanced.ts`](./sample/write_example_advanced.ts).
|
|
335
|
-
|
|
336
294
|
## Package Distribution
|
|
337
295
|
|
|
338
296
|
This package supports multiple module formats for maximum compatibility:
|
package/dist/attr/index.cjs
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
const
|
|
2
|
-
require('../attr-DlmErkvR.cjs');
|
|
1
|
+
const require_attr = require('../attr-BXTkpnoc.cjs');
|
|
3
2
|
|
|
4
|
-
exports.ConflictingMutationError =
|
|
5
|
-
exports.DECIMAL_SCALE =
|
|
6
|
-
exports.DECIMAL_UNIT =
|
|
7
|
-
exports.I32_MAX =
|
|
8
|
-
exports.I32_MIN =
|
|
9
|
-
exports.InvalidAttributeNameError =
|
|
10
|
-
exports.InvalidValueError =
|
|
11
|
-
exports.MAX_ATTRIBUTES =
|
|
12
|
-
exports.MAX_NAME_BYTES =
|
|
13
|
-
exports.MAX_PAYLOAD_BYTES =
|
|
14
|
-
exports.MAX_STRING_BYTES =
|
|
15
|
-
exports.MissingValueError =
|
|
16
|
-
exports.TooManyAttributesError =
|
|
17
|
-
exports.U256_MAX =
|
|
18
|
-
exports.U64_MAX =
|
|
19
|
-
exports.UnknownAttributeTypeError =
|
|
20
|
-
exports.UntypedValueError =
|
|
21
|
-
exports.addr =
|
|
22
|
-
exports.bool =
|
|
23
|
-
exports.bytes32 =
|
|
24
|
-
exports.dec =
|
|
25
|
-
exports.decFromUnits =
|
|
26
|
-
exports.decUnits =
|
|
27
|
-
exports.i32 =
|
|
28
|
-
exports.isArkivValue =
|
|
29
|
-
exports.isValidAttributeName =
|
|
30
|
-
exports.key =
|
|
31
|
-
exports.str =
|
|
32
|
-
exports.toValue =
|
|
33
|
-
exports.u256 =
|
|
34
|
-
exports.u64 =
|
|
35
|
-
exports.validateAttributeName =
|
|
3
|
+
exports.ConflictingMutationError = require_attr.ConflictingMutationError;
|
|
4
|
+
exports.DECIMAL_SCALE = require_attr.DECIMAL_SCALE;
|
|
5
|
+
exports.DECIMAL_UNIT = require_attr.DECIMAL_UNIT;
|
|
6
|
+
exports.I32_MAX = require_attr.I32_MAX;
|
|
7
|
+
exports.I32_MIN = require_attr.I32_MIN;
|
|
8
|
+
exports.InvalidAttributeNameError = require_attr.InvalidAttributeNameError;
|
|
9
|
+
exports.InvalidValueError = require_attr.InvalidValueError;
|
|
10
|
+
exports.MAX_ATTRIBUTES = require_attr.MAX_ATTRIBUTES;
|
|
11
|
+
exports.MAX_NAME_BYTES = require_attr.MAX_NAME_BYTES;
|
|
12
|
+
exports.MAX_PAYLOAD_BYTES = require_attr.MAX_PAYLOAD_BYTES;
|
|
13
|
+
exports.MAX_STRING_BYTES = require_attr.MAX_STRING_BYTES;
|
|
14
|
+
exports.MissingValueError = require_attr.MissingValueError;
|
|
15
|
+
exports.TooManyAttributesError = require_attr.TooManyAttributesError;
|
|
16
|
+
exports.U256_MAX = require_attr.U256_MAX;
|
|
17
|
+
exports.U64_MAX = require_attr.U64_MAX;
|
|
18
|
+
exports.UnknownAttributeTypeError = require_attr.UnknownAttributeTypeError;
|
|
19
|
+
exports.UntypedValueError = require_attr.UntypedValueError;
|
|
20
|
+
exports.addr = require_attr.addr;
|
|
21
|
+
exports.bool = require_attr.bool;
|
|
22
|
+
exports.bytes32 = require_attr.bytes32;
|
|
23
|
+
exports.dec = require_attr.dec;
|
|
24
|
+
exports.decFromUnits = require_attr.decFromUnits;
|
|
25
|
+
exports.decUnits = require_attr.decUnits;
|
|
26
|
+
exports.i32 = require_attr.i32;
|
|
27
|
+
exports.isArkivValue = require_attr.isArkivValue;
|
|
28
|
+
exports.isValidAttributeName = require_attr.isValidAttributeName;
|
|
29
|
+
exports.key = require_attr.key;
|
|
30
|
+
exports.str = require_attr.str;
|
|
31
|
+
exports.toValue = require_attr.toValue;
|
|
32
|
+
exports.u256 = require_attr.u256;
|
|
33
|
+
exports.u64 = require_attr.u64;
|
|
34
|
+
exports.validateAttributeName = require_attr.validateAttributeName;
|
package/dist/attr/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as i32, B as Bytes32Value, C as ValueInput, D as dec, E as bytes32, F as u64, G as StrValue, H as DecValue, I as AddrValue, J as U64Value, K as TypeTag, L as AnyArkivValue, M as str, N as toValue, O as decFromUnits, P as u256, R as ArkivValue, S as U64_MAX, T as bool, U as I32Value, V as BytesValue, W as KeyValue, X as isArkivValue, Y as UserTypeTag, _ as MAX_PAYLOAD_BYTES, a as InvalidAttributeNameError, b as MAX_STRING_BYTES, c as TooManyAttributesError, d as DECIMAL_SCALE, f as DECIMAL_UNIT, g as MAX_ATTRIBUTES, h as Attributes, i as ConflictingMutationError, j as key, k as decUnits, l as UnknownAttributeTypeError, m as AttributeSchema, n as isValidAttributeName, o as InvalidValueError, p as AttributeInputs, q as U256Value, r as validateAttributeName, s as MissingValueError, t as MAX_NAME_BYTES, u as UntypedValueError, v as I32_MAX, w as addr, x as U256_MAX, y as I32_MIN, z as BoolValue } from "../index-
|
|
1
|
+
import { A as i32, B as Bytes32Value, C as ValueInput, D as dec, E as bytes32, F as u64, G as StrValue, H as DecValue, I as AddrValue, J as U64Value, K as TypeTag, L as AnyArkivValue, M as str, N as toValue, O as decFromUnits, P as u256, R as ArkivValue, S as U64_MAX, T as bool, U as I32Value, V as BytesValue, W as KeyValue, X as isArkivValue, Y as UserTypeTag, _ as MAX_PAYLOAD_BYTES, a as InvalidAttributeNameError, b as MAX_STRING_BYTES, c as TooManyAttributesError, d as DECIMAL_SCALE, f as DECIMAL_UNIT, g as MAX_ATTRIBUTES, h as Attributes, i as ConflictingMutationError, j as key, k as decUnits, l as UnknownAttributeTypeError, m as AttributeSchema, n as isValidAttributeName, o as InvalidValueError, p as AttributeInputs, q as U256Value, r as validateAttributeName, s as MissingValueError, t as MAX_NAME_BYTES, u as UntypedValueError, v as I32_MAX, w as addr, x as U256_MAX, y as I32_MIN, z as BoolValue } from "../index-CIcHPx2j.cjs";
|
|
2
2
|
export { AddrValue, AnyArkivValue, ArkivValue, AttributeInputs, AttributeSchema, Attributes, BoolValue, Bytes32Value, BytesValue, ConflictingMutationError, DECIMAL_SCALE, DECIMAL_UNIT, DecValue, I32Value, I32_MAX, I32_MIN, InvalidAttributeNameError, InvalidValueError, KeyValue, MAX_ATTRIBUTES, MAX_NAME_BYTES, MAX_PAYLOAD_BYTES, MAX_STRING_BYTES, MissingValueError, StrValue, TooManyAttributesError, TypeTag, U256Value, U256_MAX, U64Value, U64_MAX, UnknownAttributeTypeError, UntypedValueError, UserTypeTag, ValueInput, addr, bool, bytes32, dec, decFromUnits, decUnits, i32, isArkivValue, isValidAttributeName, key, str, toValue, u256, u64, validateAttributeName };
|
package/dist/attr/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as i32, C as ValueInput, D as dec, E as bytes32, F as u64, M as str, N as toValue, O as decFromUnits, P as u256, S as U64_MAX, T as bool, _ as MAX_PAYLOAD_BYTES, a as InvalidAttributeNameError, b as MAX_STRING_BYTES, c as TooManyAttributesError, d as DECIMAL_SCALE, f as DECIMAL_UNIT, g as MAX_ATTRIBUTES, h as Attributes, i as ConflictingMutationError, j as key, k as decUnits, l as UnknownAttributeTypeError, m as AttributeSchema, n as isValidAttributeName, o as InvalidValueError, p as AttributeInputs, r as validateAttributeName, s as MissingValueError, t as MAX_NAME_BYTES, u as UntypedValueError, v as I32_MAX, w as addr, x as U256_MAX, y as I32_MIN } from "../index-DvYvrkdk.js";
|
|
1
|
+
import { A as i32, B as Bytes32Value, C as ValueInput, D as dec, E as bytes32, F as u64, G as StrValue, H as DecValue, I as AddrValue, J as U64Value, K as TypeTag, L as AnyArkivValue, M as str, N as toValue, O as decFromUnits, P as u256, R as ArkivValue, S as U64_MAX, T as bool, U as I32Value, V as BytesValue, W as KeyValue, X as isArkivValue, Y as UserTypeTag, _ as MAX_PAYLOAD_BYTES, a as InvalidAttributeNameError, b as MAX_STRING_BYTES, c as TooManyAttributesError, d as DECIMAL_SCALE, f as DECIMAL_UNIT, g as MAX_ATTRIBUTES, h as Attributes, i as ConflictingMutationError, j as key, k as decUnits, l as UnknownAttributeTypeError, m as AttributeSchema, n as isValidAttributeName, o as InvalidValueError, p as AttributeInputs, q as U256Value, r as validateAttributeName, s as MissingValueError, t as MAX_NAME_BYTES, u as UntypedValueError, v as I32_MAX, w as addr, x as U256_MAX, y as I32_MIN, z as BoolValue } from "../index-Cd2aaWme.js";
|
|
3
2
|
export { AddrValue, AnyArkivValue, ArkivValue, AttributeInputs, AttributeSchema, Attributes, BoolValue, Bytes32Value, BytesValue, ConflictingMutationError, DECIMAL_SCALE, DECIMAL_UNIT, DecValue, I32Value, I32_MAX, I32_MIN, InvalidAttributeNameError, InvalidValueError, KeyValue, MAX_ATTRIBUTES, MAX_NAME_BYTES, MAX_PAYLOAD_BYTES, MAX_STRING_BYTES, MissingValueError, StrValue, TooManyAttributesError, TypeTag, U256Value, U256_MAX, U64Value, U64_MAX, UnknownAttributeTypeError, UntypedValueError, UserTypeTag, ValueInput, addr, bool, bytes32, dec, decFromUnits, decUnits, i32, isArkivValue, isValidAttributeName, key, str, toValue, u256, u64, validateAttributeName };
|
package/dist/attr/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { A as DECIMAL_UNIT, C as str, E as u64, F as TooManyAttributesError, I as UnknownAttributeTypeError, L as UntypedValueError, M as InvalidAttributeNameError, N as InvalidValueError, O as isArkivValue, P as MissingValueError, S as key, T as u256, _ as bytes32, a as MAX_NAME_BYTES, b as decUnits, d as I32_MIN, f as MAX_STRING_BYTES, g as bool, h as addr, j as ConflictingMutationError, k as DECIMAL_SCALE, m as U64_MAX, n as MAX_PAYLOAD_BYTES, o as isValidAttributeName, p as U256_MAX, s as validateAttributeName, t as MAX_ATTRIBUTES, u as I32_MAX, v as dec, w as toValue, x as i32, y as decFromUnits } from "../
|
|
2
|
-
import "../attr-GcQKatub.js";
|
|
1
|
+
import { A as DECIMAL_UNIT, C as str, E as u64, F as TooManyAttributesError, I as UnknownAttributeTypeError, L as UntypedValueError, M as InvalidAttributeNameError, N as InvalidValueError, O as isArkivValue, P as MissingValueError, S as key, T as u256, _ as bytes32, a as MAX_NAME_BYTES, b as decUnits, d as I32_MIN, f as MAX_STRING_BYTES, g as bool, h as addr, j as ConflictingMutationError, k as DECIMAL_SCALE, m as U64_MAX, n as MAX_PAYLOAD_BYTES, o as isValidAttributeName, p as U256_MAX, s as validateAttributeName, t as MAX_ATTRIBUTES, u as I32_MAX, v as dec, w as toValue, x as i32, y as decFromUnits } from "../attr-tmyREHtw.js";
|
|
3
2
|
|
|
4
3
|
export { ConflictingMutationError, DECIMAL_SCALE, DECIMAL_UNIT, I32_MAX, I32_MIN, InvalidAttributeNameError, InvalidValueError, MAX_ATTRIBUTES, MAX_NAME_BYTES, MAX_PAYLOAD_BYTES, MAX_STRING_BYTES, MissingValueError, TooManyAttributesError, U256_MAX, U64_MAX, UnknownAttributeTypeError, UntypedValueError, addr, bool, bytes32, dec, decFromUnits, decUnits, i32, isArkivValue, isValidAttributeName, key, str, toValue, u256, u64, validateAttributeName };
|
|
@@ -28,7 +28,7 @@ var InvalidValueError = class extends Error {
|
|
|
28
28
|
var UntypedValueError = class extends Error {
|
|
29
29
|
input;
|
|
30
30
|
constructor(input) {
|
|
31
|
-
super(`Cannot infer an Arkiv type for ${describe(input)}. Attribute values must be a tagged value (i32, u256, dec, str, addr, key, bytes32, bool) or a bare boolean, number, bigint or string.`);
|
|
31
|
+
super(`Cannot infer an Arkiv type for ${describe(input)}. Attribute values must be a tagged value (i32, u64, u256, dec, str, addr, key, bytes32, bool) or a bare boolean, number, bigint or string.`);
|
|
32
32
|
this.name = "UntypedValueError";
|
|
33
33
|
this.input = input;
|
|
34
34
|
}
|
|
@@ -391,7 +391,11 @@ function decFromUnits(units) {
|
|
|
391
391
|
*
|
|
392
392
|
* The limit is on **bytes**, not characters: a string of 128 emoji does not fit.
|
|
393
393
|
*
|
|
394
|
-
*
|
|
394
|
+
* C0 control characters and DEL are rejected: the query language writes a `str` as `str('...')`,
|
|
395
|
+
* whose only escape is a doubled quote, so a control character could be stored but never queried.
|
|
396
|
+
*
|
|
397
|
+
* @throws {InvalidValueError} If the value is not a string, holds a control character, or exceeds
|
|
398
|
+
* 128 UTF-8 bytes.
|
|
395
399
|
*
|
|
396
400
|
* @example
|
|
397
401
|
* str("Bob")
|
|
@@ -716,6 +720,10 @@ function isValidAttributeName(name) {
|
|
|
716
720
|
* The most attribute cells one operation may carry.
|
|
717
721
|
*/
|
|
718
722
|
const MAX_ATTRIBUTES = 32;
|
|
723
|
+
/**
|
|
724
|
+
* The largest payload an entity may carry, in bytes. The payload travels as the `$payload` system
|
|
725
|
+
* cell, so this is a bound on that one attribute rather than on the operation as a whole.
|
|
726
|
+
*/
|
|
719
727
|
const MAX_PAYLOAD_BYTES = 128 * 1024;
|
|
720
728
|
/** The system attribute holding an entity's opaque payload. */
|
|
721
729
|
const PAYLOAD_CELL = "$payload";
|
|
@@ -767,8 +775,10 @@ function encodeAttributes(attributes = {}, system = {}) {
|
|
|
767
775
|
*
|
|
768
776
|
* @throws {ConflictingMutationError} If a name appears in both `set` and `unset`.
|
|
769
777
|
* @throws {InvalidAttributeNameError} If a name violates the attribute-name grammar.
|
|
778
|
+
* @throws {MissingValueError} If a value is `undefined` or `null`.
|
|
770
779
|
* @throws {InvalidValueError} If a value does not fit its type.
|
|
771
|
-
* @throws {TooManyAttributesError} If
|
|
780
|
+
* @throws {TooManyAttributesError} If the mutations exceed {@link MAX_ATTRIBUTES}.
|
|
781
|
+
* @throws {TypeError} If `unset` is not an array.
|
|
772
782
|
*/
|
|
773
783
|
function encodeMutations({ set, unset, payload, contentType }) {
|
|
774
784
|
const written = encodeAttributes(set, {
|
|
@@ -28,7 +28,7 @@ var InvalidValueError = class extends Error {
|
|
|
28
28
|
var UntypedValueError = class extends Error {
|
|
29
29
|
input;
|
|
30
30
|
constructor(input) {
|
|
31
|
-
super(`Cannot infer an Arkiv type for ${describe(input)}. Attribute values must be a tagged value (i32, u256, dec, str, addr, key, bytes32, bool) or a bare boolean, number, bigint or string.`);
|
|
31
|
+
super(`Cannot infer an Arkiv type for ${describe(input)}. Attribute values must be a tagged value (i32, u64, u256, dec, str, addr, key, bytes32, bool) or a bare boolean, number, bigint or string.`);
|
|
32
32
|
this.name = "UntypedValueError";
|
|
33
33
|
this.input = input;
|
|
34
34
|
}
|
|
@@ -391,7 +391,11 @@ function decFromUnits(units) {
|
|
|
391
391
|
*
|
|
392
392
|
* The limit is on **bytes**, not characters: a string of 128 emoji does not fit.
|
|
393
393
|
*
|
|
394
|
-
*
|
|
394
|
+
* C0 control characters and DEL are rejected: the query language writes a `str` as `str('...')`,
|
|
395
|
+
* whose only escape is a doubled quote, so a control character could be stored but never queried.
|
|
396
|
+
*
|
|
397
|
+
* @throws {InvalidValueError} If the value is not a string, holds a control character, or exceeds
|
|
398
|
+
* 128 UTF-8 bytes.
|
|
395
399
|
*
|
|
396
400
|
* @example
|
|
397
401
|
* str("Bob")
|
|
@@ -716,6 +720,10 @@ function isValidAttributeName(name) {
|
|
|
716
720
|
* The most attribute cells one operation may carry.
|
|
717
721
|
*/
|
|
718
722
|
const MAX_ATTRIBUTES = 32;
|
|
723
|
+
/**
|
|
724
|
+
* The largest payload an entity may carry, in bytes. The payload travels as the `$payload` system
|
|
725
|
+
* cell, so this is a bound on that one attribute rather than on the operation as a whole.
|
|
726
|
+
*/
|
|
719
727
|
const MAX_PAYLOAD_BYTES = 128 * 1024;
|
|
720
728
|
/** The system attribute holding an entity's opaque payload. */
|
|
721
729
|
const PAYLOAD_CELL = "$payload";
|
|
@@ -767,8 +775,10 @@ function encodeAttributes(attributes = {}, system = {}) {
|
|
|
767
775
|
*
|
|
768
776
|
* @throws {ConflictingMutationError} If a name appears in both `set` and `unset`.
|
|
769
777
|
* @throws {InvalidAttributeNameError} If a name violates the attribute-name grammar.
|
|
778
|
+
* @throws {MissingValueError} If a value is `undefined` or `null`.
|
|
770
779
|
* @throws {InvalidValueError} If a value does not fit its type.
|
|
771
|
-
* @throws {TooManyAttributesError} If
|
|
780
|
+
* @throws {TooManyAttributesError} If the mutations exceed {@link MAX_ATTRIBUTES}.
|
|
781
|
+
* @throws {TypeError} If `unset` is not an array.
|
|
772
782
|
*/
|
|
773
783
|
function encodeMutations({ set, unset, payload, contentType }) {
|
|
774
784
|
const written = encodeAttributes(set, {
|
|
@@ -806,4 +816,4 @@ function toHexBytes(bytes) {
|
|
|
806
816
|
|
|
807
817
|
//#endregion
|
|
808
818
|
export { DECIMAL_UNIT as A, str as C, TYPE_IDS as D, u64 as E, TooManyAttributesError as F, UnknownAttributeTypeError as I, UntypedValueError as L, InvalidAttributeNameError as M, InvalidValueError as N, isArkivValue as O, MissingValueError as P, key as S, u256 as T, bytes32 as _, MAX_NAME_BYTES as a, decUnits as b, asTypeTag as c, I32_MIN as d, MAX_STRING_BYTES as f, bool as g, addr as h, encodeMutations as i, ConflictingMutationError as j, DECIMAL_SCALE as k, decodeRpcValue as l, U64_MAX as m, MAX_PAYLOAD_BYTES as n, isValidAttributeName as o, U256_MAX as p, encodeAttributes as r, validateAttributeName as s, MAX_ATTRIBUTES as t, I32_MAX as u, dec as v, toValue as w, i32 as x, decFromUnits as y };
|
|
809
|
-
//# sourceMappingURL=
|
|
819
|
+
//# sourceMappingURL=attr-tmyREHtw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attr-tmyREHtw.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, u64, u256, dec, str, addr, key, bytes32, \" +\n \"bool) 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\"\nimport type { decUnits } from \"./values\"\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 `i32`, `u256`, `dec`, and 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, free of C0 control characters and DEL. */\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 * C0 control characters and DEL are rejected: the query language writes a `str` as `str('...')`,\n * whose only escape is a doubled quote, so a control character could be stored but never queried.\n *\n * @throws {InvalidValueError} If the value is not a string, holds a control character, or exceeds\n * 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\n/**\n * The largest payload an entity may carry, in bytes. The payload travels as the `$payload` system\n * cell, so this is a bound on that one attribute rather than on the operation as a whole.\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 ArkivValue}) 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 {MissingValueError} If a value is `undefined` or `null`.\n * @throws {InvalidValueError} If a value does not fit its type.\n * @throws {TooManyAttributesError} If the mutations exceed {@link MAX_ATTRIBUTES}.\n * @throws {TypeError} If `unset` is not an array.\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(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,OAAO,OAAO,KAAK,KAAK,CAC1B,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"}
|
package/dist/chains/index.cjs
CHANGED
package/dist/chains/index.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/chains/cheesecake.ts","../../src/chains/localhost.ts"],"sourcesContent":[],"mappings":";;;;;;AAKa,cAAA,UAgBX,EAAA;EAAA,cAAA,CAAA,EAAA;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/chains/cheesecake.ts","../../src/chains/localhost.ts"],"sourcesContent":[],"mappings":";;;;;;AAKa,cAAA,UAgBX,EAAA;EAAA,cAAA,CAAA,EAAA;;;;;;;;;;;;;;IChBW,CAAA,CAAA,EAAA,MAWX,CAAA,EDKA,KAAA,CAAA,aAAA,GCLA;MAAA,CAAA,QAAA,EAAA,MAAA,CAAA,wBAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ADXW,cCAA,SDgBX,EAAA;EAAA,cAAA,CAAA,EAAA;;;;;;;;;;;;;;IChBW,CAAA,CAAA,EAAA,MAWX,CAAA,EAAA,KAAA,CAAA,aAAA,GAAA;MAAA,CAAA,QAAA,EAAA,MAAA,CAAA,wBAAA,SAAA"}
|
package/dist/chains/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/chains/cheesecake.ts","../../src/chains/localhost.ts"],"sourcesContent":[],"mappings":";;;;;;AAKa,cAAA,UAgBX,EAAA;EAAA,cAAA,CAAA,EAAA;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/chains/cheesecake.ts","../../src/chains/localhost.ts"],"sourcesContent":[],"mappings":";;;;;;AAKa,cAAA,UAgBX,EAAA;EAAA,cAAA,CAAA,EAAA;;;;;;;;;;;;;;IChBW,CAAA,CAAA,EAAA,MAWX,CAAA,EDKA,KAAA,CAAA,aAAA,GCLA;MAAA,CAAA,QAAA,EAAA,MAAA,CAAA,wBAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ADXW,cCAA,SDgBX,EAAA;EAAA,cAAA,CAAA,EAAA;;;;;;;;;;;;;;IChBW,CAAA,CAAA,EAAA,MAWX,CAAA,EAAA,KAAA,CAAA,aAAA,GAAA;MAAA,CAAA,QAAA,EAAA,MAAA,CAAA,wBAAA,SAAA"}
|
package/dist/chains/index.js
CHANGED
|
@@ -34,6 +34,9 @@ const cheesecake = defineChain({
|
|
|
34
34
|
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region src/chains/localhost.ts
|
|
37
|
+
/**
|
|
38
|
+
* A node running on the local machine
|
|
39
|
+
*/
|
|
37
40
|
const localhost = defineChain({
|
|
38
41
|
id: 1337,
|
|
39
42
|
name: "Localhost",
|
|
@@ -54,4 +57,4 @@ var chains_exports = /* @__PURE__ */ __export({
|
|
|
54
57
|
|
|
55
58
|
//#endregion
|
|
56
59
|
export { localhost as n, cheesecake as r, chains_exports as t };
|
|
57
|
-
//# sourceMappingURL=chains-
|
|
60
|
+
//# sourceMappingURL=chains-Du8tql7I.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chains-Du8tql7I.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\n/**\n * A node running on the local machine\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;;;;;;;AChBF,MAAa,YAAY,YAAY;CACnC,IAAI;CACJ,MAAM;CACN,gBAAgB;EACd,UAAU;EACV,MAAM;EACN,QAAQ;EACT;CACD,SAAS,EACP,SAAS,EAAE,MAAM,CAAC,wBAAwB,EAAE,EAC7C;CACF,CAAC"}
|