@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.
Files changed (178) hide show
  1. package/README.md +0 -42
  2. package/dist/attr/index.cjs +33 -34
  3. package/dist/attr/index.d.cts +1 -1
  4. package/dist/attr/index.d.ts +1 -2
  5. package/dist/attr/index.js +1 -2
  6. package/dist/{attributes-Df9IsCVs.cjs → attr-BXTkpnoc.cjs} +13 -3
  7. package/dist/{attributes-BhY5DwJp.js → attr-tmyREHtw.js} +14 -4
  8. package/dist/attr-tmyREHtw.js.map +1 -0
  9. package/dist/chains/index.cjs +1 -1
  10. package/dist/chains/index.d.cts +3 -0
  11. package/dist/chains/index.d.cts.map +1 -1
  12. package/dist/chains/index.d.ts +3 -0
  13. package/dist/chains/index.d.ts.map +1 -1
  14. package/dist/chains/index.js +1 -1
  15. package/dist/{chains-BYRTTipa.cjs → chains-BfNQliHU.cjs} +3 -0
  16. package/dist/{chains-BJrZs6sG.js → chains-Du8tql7I.js} +4 -1
  17. package/dist/chains-Du8tql7I.js.map +1 -0
  18. package/dist/{arkivTransactions-NtGD6uk5.d.ts → changeOwnership-B0ar96ub.d.ts} +74 -123
  19. package/dist/changeOwnership-B0ar96ub.d.ts.map +1 -0
  20. package/dist/{arkivTransactions-D74gERHG.d.cts → changeOwnership-BofkLnXJ.d.cts} +74 -123
  21. package/dist/changeOwnership-BofkLnXJ.d.cts.map +1 -0
  22. package/dist/entity/index.cjs +9 -9
  23. package/dist/entity/index.d.cts +3 -3
  24. package/dist/entity/index.d.ts +4 -5
  25. package/dist/entity/index.js +5 -6
  26. package/dist/{entity-BYQR1uoe.js → entity-BIp_df9u.js} +1 -1
  27. package/dist/{entity-BYQR1uoe.js.map → entity-BIp_df9u.js.map} +1 -1
  28. package/dist/{key-D1Bh7MF0.js → entity-CniBgBSd.js} +31 -19
  29. package/dist/entity-CniBgBSd.js.map +1 -0
  30. package/dist/{key-WKhXnXuU.cjs → entity-DJ0Gml9c.cjs} +37 -19
  31. package/dist/{errors-LTe7bOYS.js → errors-D2E1GRjw.js} +2 -2
  32. package/dist/errors-D2E1GRjw.js.map +1 -0
  33. package/dist/{errors-BVbjKVMN.cjs → errors-DhV00966.cjs} +1 -1
  34. package/dist/{expiry-nDbCgZX4.d.ts → expiry-BxOlvVWC.d.ts} +1 -1
  35. package/dist/{expiry-nDbCgZX4.d.ts.map → expiry-BxOlvVWC.d.ts.map} +1 -1
  36. package/dist/{expiry-BELY2Kpw.cjs → expiry-CG9GhVXv.cjs} +1 -1
  37. package/dist/{expiry-BjpxZZQU.js → expiry-Cgdb_dbq.js} +2 -2
  38. package/dist/expiry-Cgdb_dbq.js.map +1 -0
  39. package/dist/expiry-DRV29F1r.d.cts.map +1 -1
  40. package/dist/{flags-CRjPpoh3.d.cts → flags-0Vl5rrHq.d.cts} +1 -1
  41. package/dist/{flags-CRjPpoh3.d.cts.map → flags-0Vl5rrHq.d.cts.map} +1 -1
  42. package/dist/{flags-kr276q6i.cjs → flags-DCD26uhe.cjs} +1 -1
  43. package/dist/{flags-DFBs2J94.js → flags-DUT2gHEU.js} +2 -2
  44. package/dist/{flags-DFBs2J94.js.map → flags-DUT2gHEU.js.map} +1 -1
  45. package/dist/{flags-5dTNRnow.d.ts → flags-wmcMoAnN.d.ts} +1 -1
  46. package/dist/{flags-5dTNRnow.d.ts.map → flags-wmcMoAnN.d.ts.map} +1 -1
  47. package/dist/{index-fX_XyqLp.d.ts → index-BGp2plHs.d.cts} +15 -13
  48. package/dist/index-BGp2plHs.d.cts.map +1 -0
  49. package/dist/{index-DHDud2hC.d.ts → index-BKB875Um.d.ts} +5 -7
  50. package/dist/{index-DHDud2hC.d.ts.map → index-BKB875Um.d.ts.map} +1 -1
  51. package/dist/{index-DvYvrkdk.d.ts → index-CIcHPx2j.d.cts} +110 -6
  52. package/dist/index-CIcHPx2j.d.cts.map +1 -0
  53. package/dist/{index-CV5zCdpa.d.cts → index-Cd2aaWme.d.ts} +13 -6
  54. package/dist/index-Cd2aaWme.d.ts.map +1 -0
  55. package/dist/{index-CA4V7Pdh.d.cts → index-ezMZ2-JH.d.ts} +15 -13
  56. package/dist/index-ezMZ2-JH.d.ts.map +1 -0
  57. package/dist/{index-BF7Mq9Is.d.cts → index-rINthNuU.d.cts} +5 -7
  58. package/dist/{index-BF7Mq9Is.d.cts.map → index-rINthNuU.d.cts.map} +1 -1
  59. package/dist/index.cjs +433 -139
  60. package/dist/index.d.cts +58 -164
  61. package/dist/index.d.cts.map +1 -1
  62. package/dist/index.d.ts +59 -166
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +376 -75
  65. package/dist/index.js.map +1 -1
  66. package/dist/{payload-CcUj85ys.d.ts → payload-CGvVPZQX.d.ts} +61 -2
  67. package/dist/payload-CGvVPZQX.d.ts.map +1 -0
  68. package/dist/{payload-Bz6651ax.js → payload-DE7wMztL.js} +28 -3
  69. package/dist/payload-DE7wMztL.js.map +1 -0
  70. package/dist/{payload-BNoud2KZ.d.cts → payload-Dfu30njp.d.cts} +60 -1
  71. package/dist/payload-Dfu30njp.d.cts.map +1 -0
  72. package/dist/{payload-KC14SDlN.cjs → payload-DqFweqiO.cjs} +27 -2
  73. package/dist/query/index.cjs +5 -7
  74. package/dist/query/index.d.cts +4 -4
  75. package/dist/query/index.d.ts +4 -5
  76. package/dist/query/index.js +5 -7
  77. package/dist/{queryBuilder-DM6AWCBa.js → queryBuilder-wvA8sn--.js} +169 -23
  78. package/dist/queryBuilder-wvA8sn--.js.map +1 -0
  79. package/dist/{queryBuilder-DbUMEZln.cjs → queryBuilder-zHGhDmaG.cjs} +215 -33
  80. package/dist/{selection-DPg0uyJf.d.cts → selection-Bv8_o-7i.d.cts} +76 -68
  81. package/dist/selection-Bv8_o-7i.d.cts.map +1 -0
  82. package/dist/{selection-C4UhsMOO.d.ts → selection-ox7zdtVm.d.ts} +76 -69
  83. package/dist/selection-ox7zdtVm.d.ts.map +1 -0
  84. package/dist/types/index.cjs +2 -2
  85. package/dist/types/index.d.cts +6 -6
  86. package/dist/types/index.d.ts +7 -8
  87. package/dist/types/index.js +2 -2
  88. package/dist/utils/index.cjs +3 -3
  89. package/dist/utils/index.d.cts +1 -1
  90. package/dist/utils/index.d.ts +2 -2
  91. package/dist/utils/index.js +3 -3
  92. package/package.json +1 -5
  93. package/src/actions/public/getEntity.ts +1 -0
  94. package/src/actions/public/predictEntityKeys.test.ts +17 -1
  95. package/src/actions/public/predictEntityKeys.ts +28 -14
  96. package/src/actions/public/query.ts +1 -5
  97. package/src/actions/wallet/createEntity.ts +7 -6
  98. package/src/actions/wallet/{mutateEntities.test.ts → executeBatch.test.ts} +7 -7
  99. package/src/actions/wallet/{mutateEntities.ts → executeBatch.ts} +26 -11
  100. package/src/actions/wallet/extendEntity.ts +1 -0
  101. package/src/actions/wallet/patchEntity.ts +3 -3
  102. package/src/attr/attributes.ts +8 -2
  103. package/src/attr/errors.ts +2 -2
  104. package/src/attr/types.ts +3 -3
  105. package/src/attr/values.ts +5 -1
  106. package/src/chains/localhost.ts +3 -0
  107. package/src/clients/createPublicClient.test.ts +1 -1
  108. package/src/clients/createPublicClient.ts +5 -5
  109. package/src/clients/createWalletClient.test.ts +2 -2
  110. package/src/clients/createWalletClient.ts +3 -5
  111. package/src/clients/decorators/arkivPublic.ts +13 -24
  112. package/src/clients/decorators/arkivWallet.ts +40 -47
  113. package/src/entity/create.test.ts +20 -1
  114. package/src/entity/errors.ts +4 -3
  115. package/src/entity/expiry.ts +1 -0
  116. package/src/entity/index.ts +2 -2
  117. package/src/entity/key.ts +23 -3
  118. package/src/entity/operations.ts +1 -0
  119. package/src/index.ts +0 -13
  120. package/src/query/engine.ts +0 -11
  121. package/src/query/errors.ts +1 -1
  122. package/src/query/expression.ts +14 -7
  123. package/src/query/queryBuilder.test.ts +1 -21
  124. package/src/query/queryBuilder.ts +3 -10
  125. package/src/types/index.ts +4 -4
  126. package/src/types/rpcSchema.ts +1 -0
  127. package/src/types/txParams.ts +8 -0
  128. package/src/utils/arkivTransactions.test.ts +7 -1
  129. package/src/utils/arkivTransactions.ts +114 -254
  130. package/src/utils/expirationTime.ts +39 -0
  131. package/src/utils/payload.ts +25 -0
  132. package/dist/actions/advanced/index.cjs +0 -13
  133. package/dist/actions/advanced/index.d.cts +0 -8
  134. package/dist/actions/advanced/index.d.ts +0 -9
  135. package/dist/actions/advanced/index.js +0 -9
  136. package/dist/advanced-8ZPTmmaN.js +0 -598
  137. package/dist/advanced-8ZPTmmaN.js.map +0 -1
  138. package/dist/advanced-fPImL6lW.cjs +0 -656
  139. package/dist/arkivTransactions-D74gERHG.d.cts.map +0 -1
  140. package/dist/arkivTransactions-NtGD6uk5.d.ts.map +0 -1
  141. package/dist/attributes-BhY5DwJp.js.map +0 -1
  142. package/dist/chains-BJrZs6sG.js.map +0 -1
  143. package/dist/codec-Car3KkFF.d.ts +0 -102
  144. package/dist/codec-Car3KkFF.d.ts.map +0 -1
  145. package/dist/entity-B7G8q_Eo.cjs +0 -0
  146. package/dist/entity-CD_qFF2M.js +0 -0
  147. package/dist/errors-LTe7bOYS.js.map +0 -1
  148. package/dist/expiry-BjpxZZQU.js.map +0 -1
  149. package/dist/index-B5j76711.d.ts +0 -184
  150. package/dist/index-B5j76711.d.ts.map +0 -1
  151. package/dist/index-CA4V7Pdh.d.cts.map +0 -1
  152. package/dist/index-CV5zCdpa.d.cts.map +0 -1
  153. package/dist/index-DvYvrkdk.d.ts.map +0 -1
  154. package/dist/index-EeUO0nnJ.d.cts +0 -184
  155. package/dist/index-EeUO0nnJ.d.cts.map +0 -1
  156. package/dist/index-fX_XyqLp.d.ts.map +0 -1
  157. package/dist/key-D1Bh7MF0.js.map +0 -1
  158. package/dist/logger-CVpvU8ik.js +0 -153
  159. package/dist/logger-CVpvU8ik.js.map +0 -1
  160. package/dist/logger-Cr15lPAQ.cjs +0 -188
  161. package/dist/payload-BNoud2KZ.d.cts.map +0 -1
  162. package/dist/payload-Bz6651ax.js.map +0 -1
  163. package/dist/payload-CcUj85ys.d.ts.map +0 -1
  164. package/dist/queryBuilder-DM6AWCBa.js.map +0 -1
  165. package/dist/selection-C4UhsMOO.d.ts.map +0 -1
  166. package/dist/selection-DPg0uyJf.d.cts.map +0 -1
  167. package/dist/types-Bu_ZwMbZ.js +0 -0
  168. package/dist/types-NRqymi6S.cjs +0 -0
  169. package/src/actions/advanced/advanced.test.ts +0 -258
  170. package/src/actions/advanced/buildMutation.ts +0 -104
  171. package/src/actions/advanced/getMutationResult.ts +0 -112
  172. package/src/actions/advanced/index.ts +0 -21
  173. package/src/actions/advanced/pingTransaction.ts +0 -43
  174. package/src/actions/advanced/sendMutation.ts +0 -59
  175. package/src/clients/decorators/arkivAdvanced.ts +0 -144
  176. /package/dist/{entity-B00Li04j.cjs → entity-B0t6sN7F.cjs} +0 -0
  177. /package/dist/{attr-DlmErkvR.cjs → types-Bx1EKe0v.js} +0 -0
  178. /package/dist/{attr-GcQKatub.js → types-CKPddlfS.cjs} +0 -0
@@ -1,5 +1,4 @@
1
- import "../codec-Car3KkFF.js";
2
- import { a as ResolvedExpiry, i as Lifetime, n as Expiry, o as resolveExpiry, r as ExpiryContext, s as toBlocks, t as EncodedExpiry } from "../expiry-nDbCgZX4.js";
3
- import { a as randomSalt, c as InvalidCreationFlagsError, d as NoRandomSourceError, f as Operation, i as predictEntityKey, l as InvalidExpiryError, n as OperationType, o as ENTITY_EVENTS_ABI, r as MAX_SALT, s as EntityEventName, t as MAX_EXPIRES_AT, u as InvalidSaltError } from "../index-fX_XyqLp.js";
4
- import { i as encodeCreationFlags, n as ResolvedCreationFlags, r as decodeCreationFlags, t as CreationFlags } from "../flags-5dTNRnow.js";
5
- export { CreationFlags, ENTITY_EVENTS_ABI, EncodedExpiry, EntityEventName, Expiry, ExpiryContext, InvalidCreationFlagsError, InvalidExpiryError, InvalidSaltError, Lifetime, MAX_EXPIRES_AT, MAX_SALT, NoRandomSourceError, Operation, OperationType, ResolvedCreationFlags, ResolvedExpiry, decodeCreationFlags, encodeCreationFlags, predictEntityKey, randomSalt, resolveExpiry, toBlocks };
1
+ import { a as SaltInput, c as ENTITY_EVENTS_ABI, d as InvalidExpiryError, f as InvalidSaltError, i as NO_SALT, l as EntityEventName, n as OperationType, o as predictEntityKey, p as NoRandomSourceError, r as MAX_SALT, s as randomSalt, t as MAX_EXPIRES_AT, u as InvalidCreationFlagsError } from "../index-ezMZ2-JH.js";
2
+ import { a as ResolvedExpiry, i as Lifetime, n as Expiry, o as resolveExpiry, r as ExpiryContext, s as toBlocks, t as EncodedExpiry } from "../expiry-BxOlvVWC.js";
3
+ import { i as encodeCreationFlags, n as ResolvedCreationFlags, r as decodeCreationFlags, t as CreationFlags } from "../flags-wmcMoAnN.js";
4
+ export { CreationFlags, ENTITY_EVENTS_ABI, EncodedExpiry, EntityEventName, Expiry, ExpiryContext, InvalidCreationFlagsError, InvalidExpiryError, InvalidSaltError, Lifetime, MAX_EXPIRES_AT, MAX_SALT, NO_SALT, NoRandomSourceError, OperationType, ResolvedCreationFlags, ResolvedExpiry, SaltInput, decodeCreationFlags, encodeCreationFlags, predictEntityKey, randomSalt, resolveExpiry, toBlocks };
@@ -1,7 +1,6 @@
1
- import { a as OperationType, i as MAX_EXPIRES_AT, n as resolveExpiry, r as toBlocks } from "../expiry-BjpxZZQU.js";
2
- import { a as ENTITY_EVENTS_ABI, n as predictEntityKey, r as randomSalt, t as MAX_SALT } from "../key-D1Bh7MF0.js";
3
- import { i as NoRandomSourceError, n as InvalidExpiryError, r as InvalidSaltError, t as InvalidCreationFlagsError } from "../errors-LTe7bOYS.js";
4
- import { n as encodeCreationFlags, t as decodeCreationFlags } from "../flags-DFBs2J94.js";
5
- import "../entity-CD_qFF2M.js";
1
+ import { i as NoRandomSourceError, n as InvalidExpiryError, r as InvalidSaltError, t as InvalidCreationFlagsError } from "../errors-D2E1GRjw.js";
2
+ import { n as encodeCreationFlags, t as decodeCreationFlags } from "../flags-DUT2gHEU.js";
3
+ import { a as OperationType, i as MAX_EXPIRES_AT, n as resolveExpiry, r as toBlocks } from "../expiry-Cgdb_dbq.js";
4
+ import { a as randomSalt, i as predictEntityKey, n as MAX_SALT, r as NO_SALT, t as ENTITY_EVENTS_ABI } from "../entity-CniBgBSd.js";
6
5
 
7
- export { ENTITY_EVENTS_ABI, InvalidCreationFlagsError, InvalidExpiryError, InvalidSaltError, MAX_EXPIRES_AT, MAX_SALT, NoRandomSourceError, OperationType, decodeCreationFlags, encodeCreationFlags, predictEntityKey, randomSalt, resolveExpiry, toBlocks };
6
+ export { ENTITY_EVENTS_ABI, InvalidCreationFlagsError, InvalidExpiryError, InvalidSaltError, MAX_EXPIRES_AT, MAX_SALT, NO_SALT, NoRandomSourceError, OperationType, decodeCreationFlags, encodeCreationFlags, predictEntityKey, randomSalt, resolveExpiry, toBlocks };
@@ -64,4 +64,4 @@ var Entity = class {
64
64
 
65
65
  //#endregion
66
66
  export { Entity as t };
67
- //# sourceMappingURL=entity-BYQR1uoe.js.map
67
+ //# sourceMappingURL=entity-BIp_df9u.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entity-BYQR1uoe.js","names":[],"sources":["../src/types/entity.ts"],"sourcesContent":["import { bytesToString, type Hex } from \"viem\"\nimport type { AttributeSchema, Attributes } from \"../attr\"\nimport type { ResolvedCreationFlags } from \"../entity/flags\"\n\n/**\n * The fields an {@link Entity} can carry. Every one is optional: a query returns exactly the parts\n * it selected, and `undefined` means \"not asked for\" rather than \"empty\".\n */\nexport type EntityFields = {\n key?: Hex | undefined\n owner?: Hex | undefined\n creator?: Hex | undefined\n /** Block the entity was created at. */\n createdAt?: bigint | undefined\n /** Block the entity was last patched at. */\n updatedAt?: bigint | undefined\n /** Block the entity expires at. */\n expiresAt?: bigint | undefined\n /** The immutable properties the entity was created with. */\n creationFlags?: ResolvedCreationFlags | undefined\n contentType?: string | undefined\n payload?: Uint8Array | undefined\n /** Attribute names and types, with no values. */\n attributeSchema?: AttributeSchema | undefined\n /** Attribute names, types and values. */\n attributes?: Attributes | undefined\n}\n\n/**\n * An entity as it comes back from a query.\n *\n * Which fields are populated is decided by the query's selection — `select({ key: true })` gives\n * back an entity carrying only its key. The static type of a `select()` result is narrowed to\n * exactly the selected fields, so in typed code the `undefined`s here are not reachable.\n */\nexport class Entity implements EntityFields {\n key: Hex | undefined\n owner: Hex | undefined\n creator: Hex | undefined\n createdAt: bigint | undefined\n updatedAt: bigint | undefined\n expiresAt: bigint | undefined\n creationFlags: ResolvedCreationFlags | undefined\n contentType: string | undefined\n payload: Uint8Array | undefined\n attributeSchema: AttributeSchema | undefined\n attributes: Attributes | undefined\n\n constructor(fields: EntityFields = {}) {\n this.key = fields.key\n this.owner = fields.owner\n this.creator = fields.creator\n this.createdAt = fields.createdAt\n this.updatedAt = fields.updatedAt\n this.expiresAt = fields.expiresAt\n this.creationFlags = fields.creationFlags\n this.contentType = fields.contentType\n this.payload = fields.payload\n this.attributeSchema = fields.attributeSchema\n this.attributes = fields.attributes\n }\n\n /**\n * The payload decoded as UTF-8 text.\n *\n * @throws If the payload was not selected, or is not valid UTF-8.\n */\n toText(): string {\n if (this.payload === undefined) {\n throw new Error(\n \"Entity has no payload — the query did not select it. Use select({ payload: true }).\",\n )\n }\n try {\n return bytesToString(this.payload)\n } catch (e) {\n throw new Error(\n `Failed to convert entity payload to text: ${e instanceof Error ? e.message : String(e)}`,\n { cause: e },\n )\n }\n }\n\n /**\n * The payload parsed as JSON.\n *\n * @throws If the payload was not selected, is empty, or is not valid JSON.\n */\n // biome-ignore lint/suspicious/noExplicitAny: JSON.parse returns whatever the payload holds.\n toJson(): any {\n const text = this.toText()\n if (!text) {\n throw new Error(\"Entity has empty payload, cannot parse as JSON\")\n }\n try {\n return JSON.parse(text)\n } catch (e) {\n throw new Error(\n `Failed to parse entity payload as JSON: ${e instanceof Error ? e.message : String(e)}`,\n { cause: e },\n )\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAmCA,IAAa,SAAb,MAA4C;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,SAAuB,EAAE,EAAE;AACrC,OAAK,MAAM,OAAO;AAClB,OAAK,QAAQ,OAAO;AACpB,OAAK,UAAU,OAAO;AACtB,OAAK,YAAY,OAAO;AACxB,OAAK,YAAY,OAAO;AACxB,OAAK,YAAY,OAAO;AACxB,OAAK,gBAAgB,OAAO;AAC5B,OAAK,cAAc,OAAO;AAC1B,OAAK,UAAU,OAAO;AACtB,OAAK,kBAAkB,OAAO;AAC9B,OAAK,aAAa,OAAO;;;;;;;CAQ3B,SAAiB;AACf,MAAI,KAAK,YAAY,OACnB,OAAM,IAAI,MACR,sFACD;AAEH,MAAI;AACF,UAAO,cAAc,KAAK,QAAQ;WAC3B,GAAG;AACV,SAAM,IAAI,MACR,6CAA6C,aAAa,QAAQ,EAAE,UAAU,OAAO,EAAE,IACvF,EAAE,OAAO,GAAG,CACb;;;;;;;;CAUL,SAAc;EACZ,MAAM,OAAO,KAAK,QAAQ;AAC1B,MAAI,CAAC,KACH,OAAM,IAAI,MAAM,iDAAiD;AAEnE,MAAI;AACF,UAAO,KAAK,MAAM,KAAK;WAChB,GAAG;AACV,SAAM,IAAI,MACR,2CAA2C,aAAa,QAAQ,EAAE,UAAU,OAAO,EAAE,IACrF,EAAE,OAAO,GAAG,CACb"}
1
+ {"version":3,"file":"entity-BIp_df9u.js","names":[],"sources":["../src/types/entity.ts"],"sourcesContent":["import { bytesToString, type Hex } from \"viem\"\nimport type { AttributeSchema, Attributes } from \"../attr\"\nimport type { ResolvedCreationFlags } from \"../entity/flags\"\n\n/**\n * The fields an {@link Entity} can carry. Every one is optional: a query returns exactly the parts\n * it selected, and `undefined` means \"not asked for\" rather than \"empty\".\n */\nexport type EntityFields = {\n key?: Hex | undefined\n owner?: Hex | undefined\n creator?: Hex | undefined\n /** Block the entity was created at. */\n createdAt?: bigint | undefined\n /** Block the entity was last patched at. */\n updatedAt?: bigint | undefined\n /** Block the entity expires at. */\n expiresAt?: bigint | undefined\n /** The immutable properties the entity was created with. */\n creationFlags?: ResolvedCreationFlags | undefined\n contentType?: string | undefined\n payload?: Uint8Array | undefined\n /** Attribute names and types, with no values. */\n attributeSchema?: AttributeSchema | undefined\n /** Attribute names, types and values. */\n attributes?: Attributes | undefined\n}\n\n/**\n * An entity as it comes back from a query.\n *\n * Which fields are populated is decided by the query's selection — `select({ key: true })` gives\n * back an entity carrying only its key. The static type of a `select()` result is narrowed to\n * exactly the selected fields, so in typed code the `undefined`s here are not reachable.\n */\nexport class Entity implements EntityFields {\n key: Hex | undefined\n owner: Hex | undefined\n creator: Hex | undefined\n createdAt: bigint | undefined\n updatedAt: bigint | undefined\n expiresAt: bigint | undefined\n creationFlags: ResolvedCreationFlags | undefined\n contentType: string | undefined\n payload: Uint8Array | undefined\n attributeSchema: AttributeSchema | undefined\n attributes: Attributes | undefined\n\n constructor(fields: EntityFields = {}) {\n this.key = fields.key\n this.owner = fields.owner\n this.creator = fields.creator\n this.createdAt = fields.createdAt\n this.updatedAt = fields.updatedAt\n this.expiresAt = fields.expiresAt\n this.creationFlags = fields.creationFlags\n this.contentType = fields.contentType\n this.payload = fields.payload\n this.attributeSchema = fields.attributeSchema\n this.attributes = fields.attributes\n }\n\n /**\n * The payload decoded as UTF-8 text.\n *\n * @throws If the payload was not selected, or is not valid UTF-8.\n */\n toText(): string {\n if (this.payload === undefined) {\n throw new Error(\n \"Entity has no payload — the query did not select it. Use select({ payload: true }).\",\n )\n }\n try {\n return bytesToString(this.payload)\n } catch (e) {\n throw new Error(\n `Failed to convert entity payload to text: ${e instanceof Error ? e.message : String(e)}`,\n { cause: e },\n )\n }\n }\n\n /**\n * The payload parsed as JSON.\n *\n * @throws If the payload was not selected, is empty, or is not valid JSON.\n */\n // biome-ignore lint/suspicious/noExplicitAny: JSON.parse returns whatever the payload holds.\n toJson(): any {\n const text = this.toText()\n if (!text) {\n throw new Error(\"Entity has empty payload, cannot parse as JSON\")\n }\n try {\n return JSON.parse(text)\n } catch (e) {\n throw new Error(\n `Failed to parse entity payload as JSON: ${e instanceof Error ? e.message : String(e)}`,\n { cause: e },\n )\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAmCA,IAAa,SAAb,MAA4C;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,SAAuB,EAAE,EAAE;AACrC,OAAK,MAAM,OAAO;AAClB,OAAK,QAAQ,OAAO;AACpB,OAAK,UAAU,OAAO;AACtB,OAAK,YAAY,OAAO;AACxB,OAAK,YAAY,OAAO;AACxB,OAAK,YAAY,OAAO;AACxB,OAAK,gBAAgB,OAAO;AAC5B,OAAK,cAAc,OAAO;AAC1B,OAAK,UAAU,OAAO;AACtB,OAAK,kBAAkB,OAAO;AAC9B,OAAK,aAAa,OAAO;;;;;;;CAQ3B,SAAiB;AACf,MAAI,KAAK,YAAY,OACnB,OAAM,IAAI,MACR,sFACD;AAEH,MAAI;AACF,UAAO,cAAc,KAAK,QAAQ;WAC3B,GAAG;AACV,SAAM,IAAI,MACR,6CAA6C,aAAa,QAAQ,EAAE,UAAU,OAAO,EAAE,IACvF,EAAE,OAAO,GAAG,CACb;;;;;;;;CAUL,SAAc;EACZ,MAAM,OAAO,KAAK,QAAQ;AAC1B,MAAI,CAAC,KACH,OAAM,IAAI,MAAM,iDAAiD;AAEnE,MAAI;AACF,UAAO,KAAK,MAAM,KAAK;WAChB,GAAG;AACV,SAAM,IAAI,MACR,2CAA2C,aAAa,QAAQ,EAAE,UAAU,OAAO,EAAE,IACrF,EAAE,OAAO,GAAG,CACb"}
@@ -1,25 +1,17 @@
1
- import { o as ARKIV_ADDRESS } from "./expiry-BjpxZZQU.js";
2
- import { i as NoRandomSourceError, r as InvalidSaltError } from "./errors-LTe7bOYS.js";
1
+ import { i as NoRandomSourceError, r as InvalidSaltError } from "./errors-D2E1GRjw.js";
2
+ import { o as ARKIV_ADDRESS } from "./expiry-Cgdb_dbq.js";
3
3
  import { encodePacked, keccak256, parseAbi } from "viem";
4
4
 
5
- //#region src/entity/events.ts
6
- /**
7
- * The events the engine emits: one per applied operation, in application order, so an off-chain
8
- * replica can replay a transaction operation by operation.
9
- */
10
- const ENTITY_EVENTS_ABI = parseAbi([
11
- "event EntityCreated(bytes32 indexed entityKey, address indexed owner, uint64 expiresAt, uint8 creationFlags)",
12
- "event EntityPatched(bytes32 indexed entityKey, address indexed owner)",
13
- "event ExpiryExtended(bytes32 indexed entityKey, address indexed owner, uint64 expiresAt)",
14
- "event OwnershipTransferred(bytes32 indexed entityKey, address indexed previousOwner, address indexed newOwner)",
15
- "event EntityDeleted(bytes32 indexed entityKey, address indexed owner)"
16
- ]);
17
-
18
- //#endregion
19
5
  //#region src/entity/key.ts
20
6
  /** The widest salt the `uint128` wire field carries. */
21
7
  const MAX_SALT = 2n ** 128n - 1n;
22
8
  /**
9
+ * Opts a create out of salting, as {@link CreateEntityParameters.salt}: the key is then derived
10
+ * from the owner and its nonce alone, so anyone who knows both can work it out before the create
11
+ * lands.
12
+ */
13
+ const NO_SALT = Symbol("NO_SALT");
14
+ /**
23
15
  * A cryptographically random 128-bit salt — what {@link CreateEntityParameters.salt} defaults to.
24
16
  *
25
17
  * The salt exists for unpredictability, not uniqueness: the per-owner nonce already guarantees
@@ -36,6 +28,12 @@ function randomSalt() {
36
28
  for (const byte of bytes) salt = salt << 8n | BigInt(byte);
37
29
  return salt;
38
30
  }
31
+ /**
32
+ * Resolves a caller-supplied salt to a `uint128`.
33
+ */
34
+ function resolveSalt(salt) {
35
+ return salt === NO_SALT ? 0n : validateSalt(salt);
36
+ }
39
37
  /** Validates a caller-supplied salt against the `uint128` wire field. */
40
38
  function validateSalt(salt) {
41
39
  if (typeof salt !== "bigint" || salt < 0n || salt > MAX_SALT) throw new InvalidSaltError(salt);
@@ -61,10 +59,24 @@ function predictEntityKey({ owner, nonce, salt, chainId }) {
61
59
  ARKIV_ADDRESS,
62
60
  owner,
63
61
  nonce,
64
- validateSalt(salt)
62
+ resolveSalt(salt)
65
63
  ]));
66
64
  }
67
65
 
68
66
  //#endregion
69
- export { ENTITY_EVENTS_ABI as a, validateSalt as i, predictEntityKey as n, randomSalt as r, MAX_SALT as t };
70
- //# sourceMappingURL=key-D1Bh7MF0.js.map
67
+ //#region src/entity/events.ts
68
+ /**
69
+ * The events the engine emits: one per applied operation, in application order, so an off-chain
70
+ * replica can replay a transaction operation by operation.
71
+ */
72
+ const ENTITY_EVENTS_ABI = parseAbi([
73
+ "event EntityCreated(bytes32 indexed entityKey, address indexed owner, uint64 expiresAt, uint8 creationFlags)",
74
+ "event EntityPatched(bytes32 indexed entityKey, address indexed owner)",
75
+ "event ExpiryExtended(bytes32 indexed entityKey, address indexed owner, uint64 expiresAt)",
76
+ "event OwnershipTransferred(bytes32 indexed entityKey, address indexed previousOwner, address indexed newOwner)",
77
+ "event EntityDeleted(bytes32 indexed entityKey, address indexed owner)"
78
+ ]);
79
+
80
+ //#endregion
81
+ export { randomSalt as a, predictEntityKey as i, MAX_SALT as n, resolveSalt as o, NO_SALT as r, ENTITY_EVENTS_ABI as t };
82
+ //# sourceMappingURL=entity-CniBgBSd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-CniBgBSd.js","names":[],"sources":["../src/entity/key.ts","../src/entity/events.ts"],"sourcesContent":["import { type Address, encodePacked, type Hex, keccak256 } from \"viem\"\nimport type { CreateEntityParameters } from \"../actions/wallet/createEntity\"\nimport { ARKIV_ADDRESS } from \"../consts\"\nimport { InvalidSaltError, NoRandomSourceError } from \"./errors\"\n\n/** The widest salt the `uint128` wire field carries. */\nexport const MAX_SALT = 2n ** 128n - 1n\n\n/**\n * Opts a create out of salting, as {@link CreateEntityParameters.salt}: the key is then derived\n * from the owner and its nonce alone, so anyone who knows both can work it out before the create\n * lands.\n */\nexport const NO_SALT = Symbol(\"NO_SALT\")\n\n/**\n * A salt as a caller expresses it: an explicit `uint128`, or {@link NO_SALT} to opt out of salting.\n */\nexport type SaltInput = bigint | typeof NO_SALT\n\n/**\n * A cryptographically random 128-bit salt — what {@link CreateEntityParameters.salt} defaults to.\n *\n * The salt exists for unpredictability, not uniqueness: the per-owner nonce already guarantees\n * distinct keys. Random bits mean only the creator can predict the key of an entity they are about\n * to create, so nobody else can reference or squat it in advance.\n *\n * @throws {NoRandomSourceError} If the runtime has no `crypto.getRandomValues`.\n */\nexport function randomSalt(): bigint {\n const source = globalThis.crypto\n if (typeof source?.getRandomValues !== \"function\") {\n throw new NoRandomSourceError()\n }\n const bytes = source.getRandomValues(new Uint8Array(16))\n let salt = 0n\n for (const byte of bytes) salt = (salt << 8n) | BigInt(byte)\n return salt\n}\n\n/**\n * Resolves a caller-supplied salt to a `uint128`.\n */\nexport function resolveSalt(salt: SaltInput): bigint {\n return salt === NO_SALT ? 0n : validateSalt(salt)\n}\n\n/** Validates a caller-supplied salt against the `uint128` wire field. */\nexport function validateSalt(salt: bigint): bigint {\n if (typeof salt !== \"bigint\" || salt < 0n || salt > MAX_SALT) {\n throw new InvalidSaltError(salt)\n }\n return salt\n}\n\n/**\n * The key an entity will be created with, derived exactly as the engine derives it:\n * `keccak256(domain ++ owner ++ nonce ++ salt)`.\n *\n * Deriving it client-side is what lets a batch compose: predict the key of a create, then have a\n * later operation in the same transaction reference it, or store it as a `key` attribute on a\n * sibling entity.\n */\nexport function predictEntityKey({\n owner,\n nonce,\n salt,\n chainId,\n}: {\n /** The account creating the entity. */\n owner: Address\n /**\n * The owner's entity-nonce at creation time. Each create in a batch consumes one, so the *n*th\n * create in a batch uses `nonce + n`.\n */\n nonce: bigint\n /** The salt the create will carry, or {@link NO_SALT} if it carries none. */\n salt: SaltInput\n /** The chain the entity is being created on — half of the derivation domain. */\n chainId: number\n}): Hex {\n return keccak256(\n encodePacked(\n [\"uint256\", \"address\", \"address\", \"uint64\", \"uint128\"],\n [BigInt(chainId), ARKIV_ADDRESS, owner, nonce, resolveSalt(salt)],\n ),\n )\n}\n","import { parseAbi } from \"viem\"\n\n/**\n * The events the engine emits: one per applied operation, in application order, so an off-chain\n * replica can replay a transaction operation by operation.\n */\nexport const ENTITY_EVENTS_ABI = parseAbi([\n \"event EntityCreated(bytes32 indexed entityKey, address indexed owner, uint64 expiresAt, uint8 creationFlags)\",\n \"event EntityPatched(bytes32 indexed entityKey, address indexed owner)\",\n \"event ExpiryExtended(bytes32 indexed entityKey, address indexed owner, uint64 expiresAt)\",\n \"event OwnershipTransferred(bytes32 indexed entityKey, address indexed previousOwner, address indexed newOwner)\",\n \"event EntityDeleted(bytes32 indexed entityKey, address indexed owner)\",\n])\n\n/** The name of each event in {@link ENTITY_EVENTS_ABI}. */\nexport type EntityEventName = (typeof ENTITY_EVENTS_ABI)[number][\"name\"]\n"],"mappings":";;;;;;AAMA,MAAa,WAAW,MAAM,OAAO;;;;;;AAOrC,MAAa,UAAU,OAAO,UAAU;;;;;;;;;;AAgBxC,SAAgB,aAAqB;CACnC,MAAM,SAAS,WAAW;AAC1B,KAAI,OAAO,QAAQ,oBAAoB,WACrC,OAAM,IAAI,qBAAqB;CAEjC,MAAM,QAAQ,OAAO,gBAAgB,IAAI,WAAW,GAAG,CAAC;CACxD,IAAI,OAAO;AACX,MAAK,MAAM,QAAQ,MAAO,QAAQ,QAAQ,KAAM,OAAO,KAAK;AAC5D,QAAO;;;;;AAMT,SAAgB,YAAY,MAAyB;AACnD,QAAO,SAAS,UAAU,KAAK,aAAa,KAAK;;;AAInD,SAAgB,aAAa,MAAsB;AACjD,KAAI,OAAO,SAAS,YAAY,OAAO,MAAM,OAAO,SAClD,OAAM,IAAI,iBAAiB,KAAK;AAElC,QAAO;;;;;;;;;;AAWT,SAAgB,iBAAiB,EAC/B,OACA,OACA,MACA,WAaM;AACN,QAAO,UACL,aACE;EAAC;EAAW;EAAW;EAAW;EAAU;EAAU,EACtD;EAAC,OAAO,QAAQ;EAAE;EAAe;EAAO;EAAO,YAAY,KAAK;EAAC,CAClE,CACF;;;;;;;;;AChFH,MAAa,oBAAoB,SAAS;CACxC;CACA;CACA;CACA;CACA;CACD,CAAC"}
@@ -1,25 +1,17 @@
1
- const require_expiry = require('./expiry-BELY2Kpw.cjs');
2
- const require_errors = require('./errors-BVbjKVMN.cjs');
1
+ const require_errors = require('./errors-DhV00966.cjs');
2
+ const require_expiry = require('./expiry-CG9GhVXv.cjs');
3
3
  let viem = require("viem");
4
4
 
5
- //#region src/entity/events.ts
6
- /**
7
- * The events the engine emits: one per applied operation, in application order, so an off-chain
8
- * replica can replay a transaction operation by operation.
9
- */
10
- const ENTITY_EVENTS_ABI = (0, viem.parseAbi)([
11
- "event EntityCreated(bytes32 indexed entityKey, address indexed owner, uint64 expiresAt, uint8 creationFlags)",
12
- "event EntityPatched(bytes32 indexed entityKey, address indexed owner)",
13
- "event ExpiryExtended(bytes32 indexed entityKey, address indexed owner, uint64 expiresAt)",
14
- "event OwnershipTransferred(bytes32 indexed entityKey, address indexed previousOwner, address indexed newOwner)",
15
- "event EntityDeleted(bytes32 indexed entityKey, address indexed owner)"
16
- ]);
17
-
18
- //#endregion
19
5
  //#region src/entity/key.ts
20
6
  /** The widest salt the `uint128` wire field carries. */
21
7
  const MAX_SALT = 2n ** 128n - 1n;
22
8
  /**
9
+ * Opts a create out of salting, as {@link CreateEntityParameters.salt}: the key is then derived
10
+ * from the owner and its nonce alone, so anyone who knows both can work it out before the create
11
+ * lands.
12
+ */
13
+ const NO_SALT = Symbol("NO_SALT");
14
+ /**
23
15
  * A cryptographically random 128-bit salt — what {@link CreateEntityParameters.salt} defaults to.
24
16
  *
25
17
  * The salt exists for unpredictability, not uniqueness: the per-owner nonce already guarantees
@@ -36,6 +28,12 @@ function randomSalt() {
36
28
  for (const byte of bytes) salt = salt << 8n | BigInt(byte);
37
29
  return salt;
38
30
  }
31
+ /**
32
+ * Resolves a caller-supplied salt to a `uint128`.
33
+ */
34
+ function resolveSalt(salt) {
35
+ return salt === NO_SALT ? 0n : validateSalt(salt);
36
+ }
39
37
  /** Validates a caller-supplied salt against the `uint128` wire field. */
40
38
  function validateSalt(salt) {
41
39
  if (typeof salt !== "bigint" || salt < 0n || salt > MAX_SALT) throw new require_errors.InvalidSaltError(salt);
@@ -61,10 +59,24 @@ function predictEntityKey({ owner, nonce, salt, chainId }) {
61
59
  require_expiry.ARKIV_ADDRESS,
62
60
  owner,
63
61
  nonce,
64
- validateSalt(salt)
62
+ resolveSalt(salt)
65
63
  ]));
66
64
  }
67
65
 
66
+ //#endregion
67
+ //#region src/entity/events.ts
68
+ /**
69
+ * The events the engine emits: one per applied operation, in application order, so an off-chain
70
+ * replica can replay a transaction operation by operation.
71
+ */
72
+ const ENTITY_EVENTS_ABI = (0, viem.parseAbi)([
73
+ "event EntityCreated(bytes32 indexed entityKey, address indexed owner, uint64 expiresAt, uint8 creationFlags)",
74
+ "event EntityPatched(bytes32 indexed entityKey, address indexed owner)",
75
+ "event ExpiryExtended(bytes32 indexed entityKey, address indexed owner, uint64 expiresAt)",
76
+ "event OwnershipTransferred(bytes32 indexed entityKey, address indexed previousOwner, address indexed newOwner)",
77
+ "event EntityDeleted(bytes32 indexed entityKey, address indexed owner)"
78
+ ]);
79
+
68
80
  //#endregion
69
81
  Object.defineProperty(exports, 'ENTITY_EVENTS_ABI', {
70
82
  enumerable: true,
@@ -78,6 +90,12 @@ Object.defineProperty(exports, 'MAX_SALT', {
78
90
  return MAX_SALT;
79
91
  }
80
92
  });
93
+ Object.defineProperty(exports, 'NO_SALT', {
94
+ enumerable: true,
95
+ get: function () {
96
+ return NO_SALT;
97
+ }
98
+ });
81
99
  Object.defineProperty(exports, 'predictEntityKey', {
82
100
  enumerable: true,
83
101
  get: function () {
@@ -90,9 +108,9 @@ Object.defineProperty(exports, 'randomSalt', {
90
108
  return randomSalt;
91
109
  }
92
110
  });
93
- Object.defineProperty(exports, 'validateSalt', {
111
+ Object.defineProperty(exports, 'resolveSalt', {
94
112
  enumerable: true,
95
113
  get: function () {
96
- return validateSalt;
114
+ return resolveSalt;
97
115
  }
98
116
  });
@@ -16,7 +16,7 @@ var InvalidCreationFlagsError = class extends Error {
16
16
  /** A key salt was outside the `uint128` the wire carries. */
17
17
  var InvalidSaltError = class extends Error {
18
18
  constructor(salt) {
19
- super(`Invalid salt ${salt}. A salt is a uint128, so it must be between 0 and ${2n ** 128n - 1n}. Omit it to get 128 random bits, or pass 0 for a predictable key.`);
19
+ super(`Invalid salt ${String(salt)}. A salt is a uint128, so it must be between 0 and ${2n ** 128n - 1n}. Omit it to get 128 random bits, or pass NO_SALT for a key derived from the owner and nonce alone.`);
20
20
  this.name = "InvalidSaltError";
21
21
  }
22
22
  };
@@ -30,4 +30,4 @@ var NoRandomSourceError = class extends Error {
30
30
 
31
31
  //#endregion
32
32
  export { NoRandomSourceError as i, InvalidExpiryError as n, InvalidSaltError as r, InvalidCreationFlagsError as t };
33
- //# sourceMappingURL=errors-LTe7bOYS.js.map
33
+ //# sourceMappingURL=errors-D2E1GRjw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-D2E1GRjw.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: unknown) {\n super(\n `Invalid salt ${String(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 NO_SALT for a key derived ` +\n `from the owner and nonce alone.`,\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,MAAe;AACzB,QACE,gBAAgB,OAAO,KAAK,CAAC,qDACxB,MAAM,OAAO,GAAG,qGAEtB;AACD,OAAK,OAAO;;;;AAKhB,IAAa,sBAAb,cAAyC,MAAM;CAC7C,cAAc;AACZ,QACE,oMAGD;AACD,OAAK,OAAO"}
@@ -17,7 +17,7 @@ var InvalidCreationFlagsError = class extends Error {
17
17
  /** A key salt was outside the `uint128` the wire carries. */
18
18
  var InvalidSaltError = class extends Error {
19
19
  constructor(salt) {
20
- super(`Invalid salt ${salt}. A salt is a uint128, so it must be between 0 and ${2n ** 128n - 1n}. Omit it to get 128 random bits, or pass 0 for a predictable key.`);
20
+ super(`Invalid salt ${String(salt)}. A salt is a uint128, so it must be between 0 and ${2n ** 128n - 1n}. Omit it to get 128 random bits, or pass NO_SALT for a key derived from the owner and nonce alone.`);
21
21
  this.name = "InvalidSaltError";
22
22
  }
23
23
  };
@@ -76,4 +76,4 @@ declare function resolveExpiry(expiry: Expiry, context: ExpiryContext): Resolved
76
76
  declare function toBlocks(seconds: number): bigint;
77
77
  //#endregion
78
78
  export { ResolvedExpiry as a, Lifetime as i, Expiry as n, resolveExpiry as o, ExpiryContext as r, toBlocks as s, EncodedExpiry as t };
79
- //# sourceMappingURL=expiry-nDbCgZX4.d.ts.map
79
+ //# sourceMappingURL=expiry-BxOlvVWC.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"expiry-nDbCgZX4.d.ts","names":[],"sources":["../src/entity/expiry.ts"],"sourcesContent":[],"mappings":";;;AAsBA;AAiBA;AAaA;AAQA,cAnDc,SAmDY,EAAA,OAAA,MAAG;AAM7B;AAeA;;;;;AAmEA;;;;;KA9HY,MAAA;;;;;;;+BAOmB;YACnB,SAAA;;;;;;;;KASA,QAAA,GAAW;;;;KAaX,aAAA;;;;;;;KAQA,cAAA,GAAiB;;;;;KAMjB,aAAA;;;;;;;;;;;;;;iBAeI,aAAA,SAAsB,iBAAiB,gBAAgB;;;;;;;;;;;iBAmEvD,QAAA"}
1
+ {"version":3,"file":"expiry-BxOlvVWC.d.ts","names":[],"sources":["../src/entity/expiry.ts"],"sourcesContent":[],"mappings":";;;AAuBA;AAiBA;AAaA;AAQA,cAnDc,SAmDY,EAAA,OAAA,MAAG;AAM7B;AAeA;;;;;AAmEA;;;;;KA9HY,MAAA;;;;;;;+BAOmB;YACnB,SAAA;;;;;;;;KASA,QAAA,GAAW;;;;KAaX,aAAA;;;;;;;KAQA,cAAA,GAAiB;;;;;KAMjB,aAAA;;;;;;;;;;;;;;iBAeI,aAAA,SAAsB,iBAAiB,gBAAgB;;;;;;;;;;;iBAmEvD,QAAA"}
@@ -1,4 +1,4 @@
1
- const require_errors = require('./errors-BVbjKVMN.cjs');
1
+ const require_errors = require('./errors-DhV00966.cjs');
2
2
 
3
3
  //#region src/consts.ts
4
4
  const ARKIV_ADDRESS = "0x4400000000000000000000000000000000000044";
@@ -1,4 +1,4 @@
1
- import { n as InvalidExpiryError } from "./errors-LTe7bOYS.js";
1
+ import { n as InvalidExpiryError } from "./errors-D2E1GRjw.js";
2
2
 
3
3
  //#region src/consts.ts
4
4
  const ARKIV_ADDRESS = "0x4400000000000000000000000000000000000044";
@@ -92,4 +92,4 @@ function blockAtDate(date, currentBlock) {
92
92
 
93
93
  //#endregion
94
94
  export { OperationType as a, MAX_EXPIRES_AT as i, resolveExpiry as n, ARKIV_ADDRESS as o, toBlocks as r, BLOCK_TIME as s, makeExpiry as t };
95
- //# sourceMappingURL=expiry-BjpxZZQU.js.map
95
+ //# sourceMappingURL=expiry-Cgdb_dbq.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expiry-Cgdb_dbq.js","names":[],"sources":["../src/consts.ts","../src/entity/params.ts","../src/entity/expiry.ts"],"sourcesContent":["//export const ARKIV_ADDRESS = \"0x00000000000000000000000000000061726b6976\" as `0x${string}`\nexport const ARKIV_ADDRESS = \"0x4400000000000000000000000000000000000044\" as `0x${string}`\nexport const BLOCK_TIME = 2 // 2 seconds\n","/**\n * Max uint64 value\n */\nexport const MAX_EXPIRES_AT = 2n ** 64n - 1n\n\n/** The operation tags of the `execute` ABI's tagged union. */\nexport const OperationType = {\n Create: 1,\n Patch: 2,\n ExtendExpiry: 3,\n TransferOwnership: 4,\n Delete: 5,\n} as const\n\nexport type OperationType = (typeof OperationType)[keyof typeof OperationType]\n","import { BLOCK_TIME } from \"../consts\"\nimport type { ExpirationTime } from \"../utils/expirationTime\"\nimport { InvalidExpiryError } from \"./errors\"\nimport { MAX_EXPIRES_AT } from \"./params\"\n\n/**\n * The brand. Module-private and never exported, so the only way to obtain an {@link Expiry} is to\n * build one with {@link ExpirationTime} — a hand-written `{ minLifetime, expiresAt }` literal will\n * not typecheck, and neither will a bare number of seconds.\n */\ndeclare const validated: unique symbol\n\n/**\n * How long an entity should live.\n *\n * This is the pair the ABI carries, and the engine resolves it as\n * `max(expiresAt, currentBlock + minLifetime)` — whichever is later. Build one with\n * {@link ExpirationTime}; there is no other way to make one.\n *\n * Which slot a value lands in also decides which rules govern it. `minLifetime` is a duration, so\n * it must come to a whole number of blocks. `expiresAt` is a block height, which is a whole number\n * by construction, so a wall-clock date rounds into it rather than being rejected.\n */\nexport type Expiry = {\n /** Lifetime floor in blocks, counted from the block the transaction lands in. `0n` if unset. */\n readonly minLifetime: bigint\n /**\n * Absolute deadline: a block height, or a `Date` still to be placed against the current block.\n * `0n` if unset.\n */\n readonly expiresAt: bigint | Date\n readonly [validated]: true\n}\n\n/**\n * An expiry that is nothing but a duration — what the `ExpirationTime.from*` helpers return.\n *\n * Distinguished from a full {@link Expiry} by its `expiresAt` being the literal `0n`, which is what\n * keeps `atBlock(x, { atLeast: atBlock(y) })` from compiling: a deadline is not a floor.\n */\nexport type Lifetime = Expiry & { readonly expiresAt: 0n }\n\n/**\n * Builds a branded {@link Expiry}.\n *\n * Internal seam for {@link ExpirationTime}, which is the only thing that should call it — it is not\n * part of the package's public surface.\n */\nexport function makeExpiry(minLifetime: bigint, expiresAt: bigint | Date): Expiry {\n return { minLifetime, expiresAt } as Expiry\n}\n\n/** The two `uint256` values the ABI carries, with every `Date` already placed. */\nexport type EncodedExpiry = {\n /** Absolute target block height, or `0n` for a purely relative lifetime. */\n expiresAt: bigint\n /** Relative floor in blocks, or `0n` for a purely absolute expiry. */\n minLifetime: bigint\n}\n\n/** What an expiry resolves to, given the chain's current block. */\nexport type ResolvedExpiry = EncodedExpiry & {\n /** The block the entity will expire at — `max(expiresAt, currentBlock + minLifetime)`. */\n target: bigint\n}\n\n/** What the SDK needs to know about the chain to resolve an expiry. */\nexport type ExpiryContext = {\n currentBlock: bigint\n}\n\n/**\n * Resolves an expiry into the wire pair and the block the entity will expire at.\n *\n * Durations are converted to blocks at the nominal `BLOCK_TIME` (2 seconds), which makes them\n * **approximate**: block production is not a clock, so a lifetime asked for in days drifts if the\n * chain runs fast or slow. The block it was converted to comes back as\n * {@link ResolvedExpiry.target}, so the approximation is always observable rather than assumed.\n *\n * @throws {InvalidExpiryError} If the expiry is malformed, does not fit the `uint64` the wire\n * carries, or would leave the entity dead on arrival.\n */\nexport function resolveExpiry(expiry: Expiry, context: ExpiryContext): ResolvedExpiry {\n const { currentBlock } = context\n\n if (typeof expiry?.minLifetime !== \"bigint\" || expiry.expiresAt === undefined) {\n throw new InvalidExpiryError(\n \"expires must be built with ExpirationTime, e.g. ExpirationTime.fromDays(30) or \" +\n \"ExpirationTime.atBlock(1_200_000n)\",\n )\n }\n\n const { minLifetime } = expiry\n const absolute =\n typeof expiry.expiresAt === \"bigint\"\n ? expiry.expiresAt\n : blockAtDate(expiry.expiresAt, currentBlock)\n\n if (minLifetime === 0n && absolute === 0n) {\n throw new InvalidExpiryError(\n \"no expiry given. Pass ExpirationTime.fromDays(30) for a lifetime, \" +\n \"ExpirationTime.atBlock(n) for an absolute deadline, or a deadline with \" +\n \"{ atLeast } to take whichever is later.\",\n )\n }\n\n if (absolute > MAX_EXPIRES_AT) {\n throw new InvalidExpiryError(\n `expiresAt resolves to block ${absolute}, which does not fit the uint64 the wire carries ` +\n `(max ${MAX_EXPIRES_AT}). Use ExpirationTime.permanent() for an entity that should not ` +\n \"expire.\",\n )\n }\n if (minLifetime > MAX_EXPIRES_AT) {\n throw new InvalidExpiryError(\n `the lifetime is ${minLifetime} blocks, which does not fit the uint64 the wire carries ` +\n `(max ${MAX_EXPIRES_AT})`,\n )\n }\n\n const relative = minLifetime === 0n ? 0n : currentBlock + minLifetime\n const target = absolute > relative ? absolute : relative\n\n if (target <= currentBlock) {\n throw new InvalidExpiryError(\n `the entity would expire at block ${target}, which is not after the current block ` +\n `${currentBlock}, so it would be dead on arrival`,\n )\n }\n if (target > MAX_EXPIRES_AT) {\n throw new InvalidExpiryError(\n `a lifetime of ${minLifetime} blocks from block ${currentBlock} lands at ${target}, past ` +\n `the largest expiry the wire carries (${MAX_EXPIRES_AT})`,\n )\n }\n\n return { expiresAt: absolute, minLifetime, target }\n}\n\n/**\n * A duration in seconds as a whole number of blocks.\n *\n * Arkiv counts lifetimes in blocks, so a duration that is not a whole number of them does not\n * describe anything the chain can store. Rather than silently round a caller's `3` up to two blocks\n * — four seconds, not what they asked for — this rejects it: a duration must be a positive multiple\n * of `BLOCK_TIME` (2 seconds). The {@link ExpirationTime} helpers all produce such multiples.\n *\n * @throws {InvalidExpiryError} If the duration is not a positive whole number of blocks' seconds.\n */\nexport function toBlocks(seconds: number): bigint {\n if (!Number.isInteger(seconds) || seconds <= 0) {\n throw new InvalidExpiryError(\n `a lifetime must be a positive whole number of seconds, got ${seconds}. Use the ` +\n \"ExpirationTime helpers, e.g. ExpirationTime.fromDays(30).\",\n )\n }\n if (seconds % BLOCK_TIME !== 0) {\n throw new InvalidExpiryError(\n `a lifetime must be a multiple of the ${BLOCK_TIME}s block time, got ${seconds}, which is ` +\n `${seconds / BLOCK_TIME} blocks. Try ${seconds - (seconds % BLOCK_TIME)} or ` +\n `${seconds + BLOCK_TIME - (seconds % BLOCK_TIME)}, or ExpirationTime.fromBlocks(n).`,\n )\n }\n return BigInt(seconds / BLOCK_TIME)\n}\n\n/**\n * The block a wall-clock instant lands on.\n *\n * Rounds **up**: a date almost never falls on a block boundary, and unlike a duration — which the\n * caller states and can state exactly — there is nothing here to reject, so the entity lives until\n * at least the instant asked for.\n */\nfunction blockAtDate(date: Date, currentBlock: bigint): bigint {\n const secondsAway = (date.getTime() - Date.now()) / 1000\n if (secondsAway <= 0) {\n throw new InvalidExpiryError(\n `the deadline ${date.toISOString()} is in the past, so the entity would be dead on arrival`,\n )\n }\n return currentBlock + BigInt(Math.ceil(secondsAway / BLOCK_TIME))\n}\n"],"mappings":";;;AACA,MAAa,gBAAgB;AAC7B,MAAa,aAAa;;;;;;;ACC1B,MAAa,iBAAiB,MAAM,MAAM;;AAG1C,MAAa,gBAAgB;CAC3B,QAAQ;CACR,OAAO;CACP,cAAc;CACd,mBAAmB;CACnB,QAAQ;CACT;;;;;;;;;;ACoCD,SAAgB,WAAW,aAAqB,WAAkC;AAChF,QAAO;EAAE;EAAa;EAAW;;;;;;;;;;;;;AAiCnC,SAAgB,cAAc,QAAgB,SAAwC;CACpF,MAAM,EAAE,iBAAiB;AAEzB,KAAI,OAAO,QAAQ,gBAAgB,YAAY,OAAO,cAAc,OAClE,OAAM,IAAI,mBACR,oHAED;CAGH,MAAM,EAAE,gBAAgB;CACxB,MAAM,WACJ,OAAO,OAAO,cAAc,WACxB,OAAO,YACP,YAAY,OAAO,WAAW,aAAa;AAEjD,KAAI,gBAAgB,MAAM,aAAa,GACrC,OAAM,IAAI,mBACR,mLAGD;AAGH,KAAI,WAAW,eACb,OAAM,IAAI,mBACR,+BAA+B,SAAS,wDAC9B,eAAe,yEAE1B;AAEH,KAAI,cAAc,eAChB,OAAM,IAAI,mBACR,mBAAmB,YAAY,+DACrB,eAAe,GAC1B;CAGH,MAAM,WAAW,gBAAgB,KAAK,KAAK,eAAe;CAC1D,MAAM,SAAS,WAAW,WAAW,WAAW;AAEhD,KAAI,UAAU,aACZ,OAAM,IAAI,mBACR,oCAAoC,OAAO,yCACtC,aAAa,kCACnB;AAEH,KAAI,SAAS,eACX,OAAM,IAAI,mBACR,iBAAiB,YAAY,qBAAqB,aAAa,YAAY,OAAO,8CACxC,eAAe,GAC1D;AAGH,QAAO;EAAE,WAAW;EAAU;EAAa;EAAQ;;;;;;;;;;;;AAarD,SAAgB,SAAS,SAAyB;AAChD,KAAI,CAAC,OAAO,UAAU,QAAQ,IAAI,WAAW,EAC3C,OAAM,IAAI,mBACR,8DAA8D,QAAQ,qEAEvE;AAEH,KAAI,UAAU,eAAe,EAC3B,OAAM,IAAI,mBACR,wCAAwC,WAAW,oBAAoB,QAAQ,aAC1E,UAAU,WAAW,eAAe,UAAW,UAAU,WAAY,MACrE,UAAU,aAAc,UAAU,WAAY,oCACpD;AAEH,QAAO,OAAO,UAAU,WAAW;;;;;;;;;AAUrC,SAAS,YAAY,MAAY,cAA8B;CAC7D,MAAM,eAAe,KAAK,SAAS,GAAG,KAAK,KAAK,IAAI;AACpD,KAAI,eAAe,EACjB,OAAM,IAAI,mBACR,gBAAgB,KAAK,aAAa,CAAC,yDACpC;AAEH,QAAO,eAAe,OAAO,KAAK,KAAK,cAAc,WAAW,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"expiry-DRV29F1r.d.cts","names":[],"sources":["../src/entity/expiry.ts"],"sourcesContent":[],"mappings":";;;AAsBA;AAiBA;AAaA;AAQA,cAnDc,SAmDY,EAAA,OAAA,MAAG;AAM7B;AAeA;;;;;AAmEA;;;;;KA9HY,MAAA;;;;;;;+BAOmB;YACnB,SAAA;;;;;;;;KASA,QAAA,GAAW;;;;KAaX,aAAA;;;;;;;KAQA,cAAA,GAAiB;;;;;KAMjB,aAAA;;;;;;;;;;;;;;iBAeI,aAAA,SAAsB,iBAAiB,gBAAgB;;;;;;;;;;;iBAmEvD,QAAA"}
1
+ {"version":3,"file":"expiry-DRV29F1r.d.cts","names":[],"sources":["../src/entity/expiry.ts"],"sourcesContent":[],"mappings":";;;AAuBA;AAiBA;AAaA;AAQA,cAnDc,SAmDY,EAAA,OAAA,MAAG;AAM7B;AAeA;;;;;AAmEA;;;;;KA9HY,MAAA;;;;;;;+BAOmB;YACnB,SAAA;;;;;;;;KASA,QAAA,GAAW;;;;KAaX,aAAA;;;;;;;KAQA,cAAA,GAAiB;;;;;KAMjB,aAAA;;;;;;;;;;;;;;iBAeI,aAAA,SAAsB,iBAAiB,gBAAgB;;;;;;;;;;;iBAmEvD,QAAA"}
@@ -38,4 +38,4 @@ declare function encodeCreationFlags(flags?: CreationFlags): number;
38
38
  declare function decodeCreationFlags(raw: number): ResolvedCreationFlags;
39
39
  //#endregion
40
40
  export { encodeCreationFlags as i, ResolvedCreationFlags as n, decodeCreationFlags as r, CreationFlags as t };
41
- //# sourceMappingURL=flags-CRjPpoh3.d.cts.map
41
+ //# sourceMappingURL=flags-0Vl5rrHq.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"flags-CRjPpoh3.d.cts","names":[],"sources":["../src/entity/flags.ts"],"sourcesContent":[],"mappings":";;AAYA;AAcA;AAWA;AAkBA;;KA3CY,aAAA;;;;;;;;;;;;;KAcA,qBAAA;;;;;;;;;;iBAWI,mBAAA,SAA2B;;;;;;;iBAkB3B,mBAAA,eAAkC"}
1
+ {"version":3,"file":"flags-0Vl5rrHq.d.cts","names":[],"sources":["../src/entity/flags.ts"],"sourcesContent":[],"mappings":";;AAYA;AAcA;AAWA;AAkBA;;KA3CY,aAAA;;;;;;;;;;;;;KAcA,qBAAA;;;;;;;;;;iBAWI,mBAAA,SAA2B;;;;;;;iBAkB3B,mBAAA,eAAkC"}
@@ -1,4 +1,4 @@
1
- const require_errors = require('./errors-BVbjKVMN.cjs');
1
+ const require_errors = require('./errors-DhV00966.cjs');
2
2
 
3
3
  //#region src/entity/flags.ts
4
4
  /** Bit positions in the `creationFlags` byte. Bits 2-7 are reserved and must be zero. */
@@ -1,4 +1,4 @@
1
- import { t as InvalidCreationFlagsError } from "./errors-LTe7bOYS.js";
1
+ import { t as InvalidCreationFlagsError } from "./errors-D2E1GRjw.js";
2
2
 
3
3
  //#region src/entity/flags.ts
4
4
  /** Bit positions in the `creationFlags` byte. Bits 2-7 are reserved and must be zero. */
@@ -30,4 +30,4 @@ function decodeCreationFlags(raw) {
30
30
 
31
31
  //#endregion
32
32
  export { encodeCreationFlags as n, decodeCreationFlags as t };
33
- //# sourceMappingURL=flags-DFBs2J94.js.map
33
+ //# sourceMappingURL=flags-DUT2gHEU.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flags-DFBs2J94.js","names":[],"sources":["../src/entity/flags.ts"],"sourcesContent":["import { InvalidCreationFlagsError } from \"./errors\"\n\n/** Bit positions in the `creationFlags` byte. Bits 2-7 are reserved and must be zero. */\nconst READONLY_BIT = 0b0000_0001\nconst PERMISSIONLESS_EXTENSION_BIT = 0b0000_0010\n\n/**\n * The immutable properties an entity is created with. Both default to `false`.\n *\n * Creation flags are fixed at creation: there is no operation that changes them, so an entity is\n * whatever it was created as for its whole life.\n */\nexport type CreationFlags = {\n /**\n * The entity's attributes and payload can never be changed — only its expiry extended, its\n * ownership transferred, and the entity deleted.\n */\n readonly?: boolean\n /**\n * Anyone, not just the owner, may extend the entity's expiry. Lets a third party keep something\n * alive without being able to change it.\n */\n permissionlessExtension?: boolean\n}\n\n/** {@link CreationFlags} as read back, with every flag resolved and the raw byte alongside. */\nexport type ResolvedCreationFlags = {\n readonly: boolean\n permissionlessExtension: boolean\n raw: number\n}\n\n/**\n * Packs creation flags into the `creationFlags` byte.\n *\n * @throws {InvalidCreationFlagsError} If a value is not a boolean.\n */\nexport function encodeCreationFlags(flags: CreationFlags = {}): number {\n for (const [name, value] of Object.entries(flags)) {\n if (value !== undefined && typeof value !== \"boolean\") {\n throw new InvalidCreationFlagsError(`\"${name}\" must be a boolean, got ${typeof value}`)\n }\n }\n return (\n (flags.readonly ? READONLY_BIT : 0) |\n (flags.permissionlessExtension ? PERMISSIONLESS_EXTENSION_BIT : 0)\n )\n}\n\n/**\n * Reads the `creationFlags` byte back.\n *\n * @param raw - The `creationFlags` byte.\n * @throws {InvalidCreationFlagsError} Malformed input\n */\nexport function decodeCreationFlags(raw: number): ResolvedCreationFlags {\n if (!Number.isInteger(raw) || raw < 0 || raw > 0xff) {\n throw new InvalidCreationFlagsError(`${raw} is not a byte`)\n }\n return {\n readonly: (raw & READONLY_BIT) !== 0,\n permissionlessExtension: (raw & PERMISSIONLESS_EXTENSION_BIT) !== 0,\n raw,\n }\n}\n"],"mappings":";;;;AAGA,MAAM,eAAe;AACrB,MAAM,+BAA+B;;;;;;AAiCrC,SAAgB,oBAAoB,QAAuB,EAAE,EAAU;AACrE,MAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,MAAM,CAC/C,KAAI,UAAU,UAAa,OAAO,UAAU,UAC1C,OAAM,IAAI,0BAA0B,IAAI,KAAK,2BAA2B,OAAO,QAAQ;AAG3F,SACG,MAAM,WAAW,eAAe,MAChC,MAAM,0BAA0B,+BAA+B;;;;;;;;AAUpE,SAAgB,oBAAoB,KAAoC;AACtE,KAAI,CAAC,OAAO,UAAU,IAAI,IAAI,MAAM,KAAK,MAAM,IAC7C,OAAM,IAAI,0BAA0B,GAAG,IAAI,gBAAgB;AAE7D,QAAO;EACL,WAAW,MAAM,kBAAkB;EACnC,0BAA0B,MAAM,kCAAkC;EAClE;EACD"}
1
+ {"version":3,"file":"flags-DUT2gHEU.js","names":[],"sources":["../src/entity/flags.ts"],"sourcesContent":["import { InvalidCreationFlagsError } from \"./errors\"\n\n/** Bit positions in the `creationFlags` byte. Bits 2-7 are reserved and must be zero. */\nconst READONLY_BIT = 0b0000_0001\nconst PERMISSIONLESS_EXTENSION_BIT = 0b0000_0010\n\n/**\n * The immutable properties an entity is created with. Both default to `false`.\n *\n * Creation flags are fixed at creation: there is no operation that changes them, so an entity is\n * whatever it was created as for its whole life.\n */\nexport type CreationFlags = {\n /**\n * The entity's attributes and payload can never be changed — only its expiry extended, its\n * ownership transferred, and the entity deleted.\n */\n readonly?: boolean\n /**\n * Anyone, not just the owner, may extend the entity's expiry. Lets a third party keep something\n * alive without being able to change it.\n */\n permissionlessExtension?: boolean\n}\n\n/** {@link CreationFlags} as read back, with every flag resolved and the raw byte alongside. */\nexport type ResolvedCreationFlags = {\n readonly: boolean\n permissionlessExtension: boolean\n raw: number\n}\n\n/**\n * Packs creation flags into the `creationFlags` byte.\n *\n * @throws {InvalidCreationFlagsError} If a value is not a boolean.\n */\nexport function encodeCreationFlags(flags: CreationFlags = {}): number {\n for (const [name, value] of Object.entries(flags)) {\n if (value !== undefined && typeof value !== \"boolean\") {\n throw new InvalidCreationFlagsError(`\"${name}\" must be a boolean, got ${typeof value}`)\n }\n }\n return (\n (flags.readonly ? READONLY_BIT : 0) |\n (flags.permissionlessExtension ? PERMISSIONLESS_EXTENSION_BIT : 0)\n )\n}\n\n/**\n * Reads the `creationFlags` byte back.\n *\n * @param raw - The `creationFlags` byte.\n * @throws {InvalidCreationFlagsError} Malformed input\n */\nexport function decodeCreationFlags(raw: number): ResolvedCreationFlags {\n if (!Number.isInteger(raw) || raw < 0 || raw > 0xff) {\n throw new InvalidCreationFlagsError(`${raw} is not a byte`)\n }\n return {\n readonly: (raw & READONLY_BIT) !== 0,\n permissionlessExtension: (raw & PERMISSIONLESS_EXTENSION_BIT) !== 0,\n raw,\n }\n}\n"],"mappings":";;;;AAGA,MAAM,eAAe;AACrB,MAAM,+BAA+B;;;;;;AAiCrC,SAAgB,oBAAoB,QAAuB,EAAE,EAAU;AACrE,MAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,MAAM,CAC/C,KAAI,UAAU,UAAa,OAAO,UAAU,UAC1C,OAAM,IAAI,0BAA0B,IAAI,KAAK,2BAA2B,OAAO,QAAQ;AAG3F,SACG,MAAM,WAAW,eAAe,MAChC,MAAM,0BAA0B,+BAA+B;;;;;;;;AAUpE,SAAgB,oBAAoB,KAAoC;AACtE,KAAI,CAAC,OAAO,UAAU,IAAI,IAAI,MAAM,KAAK,MAAM,IAC7C,OAAM,IAAI,0BAA0B,GAAG,IAAI,gBAAgB;AAE7D,QAAO;EACL,WAAW,MAAM,kBAAkB;EACnC,0BAA0B,MAAM,kCAAkC;EAClE;EACD"}
@@ -38,4 +38,4 @@ declare function encodeCreationFlags(flags?: CreationFlags): number;
38
38
  declare function decodeCreationFlags(raw: number): ResolvedCreationFlags;
39
39
  //#endregion
40
40
  export { encodeCreationFlags as i, ResolvedCreationFlags as n, decodeCreationFlags as r, CreationFlags as t };
41
- //# sourceMappingURL=flags-5dTNRnow.d.ts.map
41
+ //# sourceMappingURL=flags-wmcMoAnN.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"flags-5dTNRnow.d.ts","names":[],"sources":["../src/entity/flags.ts"],"sourcesContent":[],"mappings":";;AAYA;AAcA;AAWA;AAkBA;;KA3CY,aAAA;;;;;;;;;;;;;KAcA,qBAAA;;;;;;;;;;iBAWI,mBAAA,SAA2B;;;;;;;iBAkB3B,mBAAA,eAAkC"}
1
+ {"version":3,"file":"flags-wmcMoAnN.d.ts","names":[],"sources":["../src/entity/flags.ts"],"sourcesContent":[],"mappings":";;AAYA;AAcA;AAWA;AAkBA;;KA3CY,aAAA;;;;;;;;;;;;;KAcA,qBAAA;;;;;;;;;;iBAWI,mBAAA,SAA2B;;;;;;;iBAkB3B,mBAAA,eAAkC"}
@@ -1,13 +1,5 @@
1
1
  import { Address, Hex } from "viem";
2
2
 
3
- //#region src/entity/operations.d.ts
4
-
5
- /** One entry of the `execute` batch: the operation tag and its ABI-encoded payload. */
6
- type Operation = {
7
- operation: number;
8
- operationData: Hex;
9
- };
10
- //#endregion
11
3
  //#region src/entity/errors.d.ts
12
4
  /** An expiry could not be expressed, or would be rejected by the engine. */
13
5
  declare class InvalidExpiryError extends Error {
@@ -19,7 +11,7 @@ declare class InvalidCreationFlagsError extends Error {
19
11
  }
20
12
  /** A key salt was outside the `uint128` the wire carries. */
21
13
  declare class InvalidSaltError extends Error {
22
- constructor(salt: bigint);
14
+ constructor(salt: unknown);
23
15
  }
24
16
  /** No cryptographic randomness was available to generate a salt. */
25
17
  declare class NoRandomSourceError extends Error {
@@ -111,6 +103,16 @@ type EntityEventName = (typeof ENTITY_EVENTS_ABI)[number]["name"];
111
103
  //#region src/entity/key.d.ts
112
104
  /** The widest salt the `uint128` wire field carries. */
113
105
  declare const MAX_SALT: bigint;
106
+ /**
107
+ * Opts a create out of salting, as {@link CreateEntityParameters.salt}: the key is then derived
108
+ * from the owner and its nonce alone, so anyone who knows both can work it out before the create
109
+ * lands.
110
+ */
111
+ declare const NO_SALT: unique symbol;
112
+ /**
113
+ * A salt as a caller expresses it: an explicit `uint128`, or {@link NO_SALT} to opt out of salting.
114
+ */
115
+ type SaltInput = bigint | typeof NO_SALT;
114
116
  /**
115
117
  * A cryptographically random 128-bit salt — what {@link CreateEntityParameters.salt} defaults to.
116
118
  *
@@ -142,8 +144,8 @@ declare function predictEntityKey({
142
144
  * create in a batch uses `nonce + n`.
143
145
  */
144
146
  nonce: bigint;
145
- /** The salt the create will carry. */
146
- salt: bigint;
147
+ /** The salt the create will carry, or {@link NO_SALT} if it carries none. */
148
+ salt: SaltInput;
147
149
  /** The chain the entity is being created on — half of the derivation domain. */
148
150
  chainId: number;
149
151
  }): Hex;
@@ -163,5 +165,5 @@ declare const OperationType: {
163
165
  };
164
166
  type OperationType = (typeof OperationType)[keyof typeof OperationType];
165
167
  //#endregion
166
- export { randomSalt as a, InvalidCreationFlagsError as c, NoRandomSourceError as d, Operation as f, predictEntityKey as i, InvalidExpiryError as l, OperationType as n, ENTITY_EVENTS_ABI as o, MAX_SALT as r, EntityEventName as s, MAX_EXPIRES_AT as t, InvalidSaltError as u };
167
- //# sourceMappingURL=index-fX_XyqLp.d.ts.map
168
+ export { SaltInput as a, ENTITY_EVENTS_ABI as c, InvalidExpiryError as d, InvalidSaltError as f, NO_SALT as i, EntityEventName as l, OperationType as n, predictEntityKey as o, NoRandomSourceError as p, MAX_SALT as r, randomSalt as s, MAX_EXPIRES_AT as t, InvalidCreationFlagsError as u };
169
+ //# sourceMappingURL=index-BGp2plHs.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BGp2plHs.d.cts","names":[],"sources":["../src/entity/errors.ts","../src/entity/events.ts","../src/entity/key.ts","../src/entity/params.ts"],"sourcesContent":[],"mappings":";;;;cACa,kBAAA,SAA2B,KAAA;;AAAxC;AAQA;AAQa,cARA,yBAAA,SAAkC,KAAA,CAQJ;EAY9B,WAAA,CAAA,MAAA,EAAA,MAAoB;;;cAZpB,gBAAA,SAAyB,KAAA;ECXzB,WAAA,CAAA,IAAA,EAAA,OAMX;AAGF;;cDca,mBAAA,SAA4B,KAAA;;AEvBzC;;;;;;AFLA;AAQa,cCHA,iBDG0B,EAAA,SAAQ,CAAK;EAQvC,SAAA,IAAA,EAAA,eAAiB;EAYjB,SAAA,IAAA,EAAA,OAAoB;;;;ICvBpB,SAAA,OAMX,EAAA,IAAA;EAGU,CAAA,EAAA;;;;ECTC,CAAA,EAAA;IAOA,SAA2B,IAAA,EAAA,QAAA;IAK5B,SAAS,IAAA,EAAA,WAAmB;EAWxB,CAAA,EAAA;IAkCA,SAAA,IAAA,EAAgB,OAAA;IAC9B,SAAA,IAAA,EAAA,eAAA;EACA,CAAA,CAAA;CACA,EAAA;EACA,SAAA,IAAA,EAAA,eAAA;EAGO,SAAA,IAAA,EAAA,OAAA;EAOD,SAAA,MAAA,EAAA,SAAA,CAAA;IAGJ,SAAA,IAAA,EAAA,SAAA;IAAG,SAAA,IAAA,EAAA,WAAA;;;;IC7EM,SAAA,IAA+B,EAAA,OAAA;IAG/B,SAAA,OAMH,EAAA,IAAA;EAEE,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KFCA,eAAA,WAA0B;;;;cCTzB;AFLb;AAQA;AAQA;AAYA;;cEhBa;;ADPb;AASA;KCGY,SAAA,mBAA4B;;;AAZxC;AAOA;AAKA;AAWA;AAkCA;;;AAGE,iBArCc,UAAA,CAAA,CAqCd,EAAA,MAAA;;;AC/DF;AAGA;AAQA;;;;iBDiDgB,gBAAA;;;;;;;SAOP;;;;;;;QAOD;;;IAGJ;;;;;;AF/ES,cGEA,cHFmB,EAAQ,MAAK;AAQ7C;AAQa,cGXA,aHWiB,EAAQ;EAYzB,SAAA,MAAA,EAAA,CAAA;;;;ECvBA,SAAA,MAAA,EAAA,CAAA;AASb,CAAA;KEDY,aAAA,WAAwB,4BAA4B"}
@@ -1,5 +1,5 @@
1
- import { R as RpcSelect, i as SelectArg, j as ArkivClient, p as Expression, s as Entity } from "./selection-C4UhsMOO.js";
2
- import { d as TypeTag } from "./codec-Car3KkFF.js";
1
+ import { K as TypeTag } from "./index-Cd2aaWme.js";
2
+ import { R as RpcSelect, d as Expression, i as SelectArg, j as ArkivClient, k as Entity } from "./selection-ox7zdtVm.js";
3
3
  import { Hex } from "viem";
4
4
 
5
5
  //#region src/query/engine.d.ts
@@ -43,7 +43,7 @@ declare function runQuery(client: ArkivClient, request: QueryRequest): Promise<Q
43
43
  * | | `=` `!=` | `<` `<=` `>` `>=` | `STARTSWITH` |
44
44
  * | --- | --- | --- | --- |
45
45
  * | `bool` | yes | no | no |
46
- * | `i32` `u256` `dec` | yes | yes | no |
46
+ * | `i32` `u64` `u256` `dec` | yes | yes | no |
47
47
  * | `str` | yes | no | yes |
48
48
  * | `addr` `key` `bytes32` | yes | no | no |
49
49
  */
@@ -234,9 +234,7 @@ declare class SelectQueryBuilder<TEntity = Entity> {
234
234
  *
235
235
  * Pagination normally goes through {@link QueryResult.next}, which carries the cursor for you;
236
236
  * this is for resuming a walk in a later process. A cursor is bound to the query, block and
237
- * selection it came from, so it must be used with an identically-built query — {@link atBlock}
238
- * set to the `blockNumber` of the page the cursor came from is required (persist the two
239
- * together), and a fetch with a cursor but no block rejects locally.
237
+ * selection it came from, so it must be used with an identically-built query.
240
238
  */
241
239
  cursor(cursor: string): this;
242
240
  /**
@@ -277,4 +275,4 @@ declare class SelectQueryBuilder<TEntity = Entity> {
277
275
  }
278
276
  //#endregion
279
277
  export { QueryErrorKind as a, QueryRequest as c, QueryError as i, QueryResponse as l, QueryResult as n, UnsupportedOperatorError as o, InvalidPredicateError as r, MAX_LIMIT as s, SelectQueryBuilder as t, runQuery as u };
280
- //# sourceMappingURL=index-DHDud2hC.d.ts.map
278
+ //# sourceMappingURL=index-BKB875Um.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-DHDud2hC.d.ts","names":[],"sources":["../src/query/engine.ts","../src/query/errors.ts","../src/query/queryResult.ts","../src/query/queryBuilder.ts"],"sourcesContent":[],"mappings":";;;;;cAUa,SAAA;;AAAA,KAGD,YAAA,GAHU;EAGV;EAcA,KAAA,EAAA,MAAA;EAaU;EAAiB,MAAA,EAvB7B,SAuB6B;EAAsB;EAAuB,KAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAAR;EAAO,MAAA,CAAA,EAAA,MAAA,GAAA,SAAA;;;;ACxBnF;AAMgB,KDKJ,aAAA,GCLI;EAE4C,QAAA,EDIhD,MCJgD,EAAA;EARd;EAAK,WAAA,EAAA,MAAA;EAyBtC;EAgBD,MAAA,EAAA,MAAA,GAAc,SAAA;AAwC1B,CAAA;;;;;;iBDzDsB,QAAA,SAAiB,sBAAsB,eAAe,QAAQ;;;;;;;AA9BpF;AAGA;AAcA;AAaA;;;;;;;cCxBa,wBAAA,SAAiC,KAAA;;EAAjC,SAAA,aAAA,EAAA,MAAyB;EAMtB;EAE4C,SAAA,QAAA,EAAA,MAAA;EARd;EAAK,SAAA,GAAA,EAMnC,OANmC;EAyBtC,WAAA,CAAA,aAAsB,EAAA,MAAA,EAAA,QAAa,EAAA,MAAA,EAAA,GAAA,EAjBY,OAiBZ,EAAA,IAAA,CAAA,EAAA,MAAA;AAgBhD;AAwCA;;;;;cAxDa,qBAAA,SAA8B,KAAA;;;ECrCtC,WAAA,CAAS,OAAA,EAAA,MAAA,EAAA,aAAA,CAAA,EAAA,MAAA;;;;;AAgBd;;AAE8B,KDmClB,cAAA;;+GCSwB;kHAApB;;;ACzBhB,0DAA0C,OAAA;;;;;;;;;;;;;;;;;cFwD7B,UAAA,SAAmB,KAAA;;iBAEf;;;;;;;oBAQG;;;;;KCvGf,yCAAyC,QAAQ,YAAY;;;AFMlE;AAGA;AAcA;AAaA;;;;;;;;;ACxBa,cCIA,WDJyB,CAAA,UCIH,MDJG,CAAA,CAAA;EAMtB;EAE4C,SAAA,QAAA,EAAA,SCF9B,ODE8B,EAAA;EARd;;AAyB9C;AAgBA;AAwCA;;EAUoB,SAAA,WAAA,EAAA,MAAA;EAVY;EAAK,SAAA,MAAA,EAAA,MAAA,GAAA,SAAA;;iCC7Dd,uEAGR,UAAU;;AAtCoB;;;;;EAmBhC,WAAA,CAAA,CAAA,EAAW,OAAA;EAAW;;;;;;;EA8CnB,IAAA,CAAA,CAAA,EAAA,OAAA,CAAQ,WAAR,CAAoB,OAApB,CAAA,CAAA;;;;AFrDhB;AAcA;AAaA;;;;;;;;;ACxBA;;;;;AAyBA;AAgBA;AAwCA;;;;;;;;AChG6C;;;;AAGQ,cCqCxC,kBDrCwC,CAAA,UCqCX,MDrCW,CAAA,CAAA;EAgBxC,iBAAW,OAAA;EAAW,iBAAA,OAAA;EAEL,iBAAA,QAAA;EAcP,QAAA,QAAA;EAGE,QAAA,UAAA;EAAV,QAAA,MAAA;EA2BqB,QAAA,OAAA;EAAZ,QAAA,QAAA;EAAR,WAAA,CAAA,MAAA,ECfM,WDeN,EAAA,SAAA,CAAA,ECf+B,SDe/B;EAAO;;;;ACzBvB;;;;;;EAuCiB,KAAA,CAAA,WAAA,EAAA,SAda,UAcb,EAAA,CAAA,EAAA,IAAA;EAWI,KAAA,CAAA,GAAA,WAAA,EAxBG,UAwBH,EAAA,CAAA,EAAA,IAAA;EAyEgB;;;;;;;iBApFpB;;;;;;;qBAWI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAyEJ,QAAQ,YAAY;;;;;;;;;GAqB3B,MAAA,CAAO,aAAA,KAAkB,eAAe"}
1
+ {"version":3,"file":"index-BKB875Um.d.ts","names":[],"sources":["../src/query/engine.ts","../src/query/errors.ts","../src/query/queryResult.ts","../src/query/queryBuilder.ts"],"sourcesContent":[],"mappings":";;;;;cAUa,SAAA;;AAAA,KAGD,YAAA,GAHU;EAGV;EAcA,KAAA,EAAA,MAAA;EAaU;EAAiB,MAAA,EAvB7B,SAuB6B;EAAsB;EAAuB,KAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAAR;EAAO,MAAA,CAAA,EAAA,MAAA,GAAA,SAAA;;;;ACxBnF;AAMgB,KDKJ,aAAA,GCLI;EAE4C,QAAA,EDIhD,MCJgD,EAAA;EARd;EAAK,WAAA,EAAA,MAAA;EAyBtC;EAgBD,MAAA,EAAA,MAAA,GAAc,SAAA;AAwC1B,CAAA;;;;;;iBDzDsB,QAAA,SAAiB,sBAAsB,eAAe,QAAQ;;;;;;;AA9BpF;AAGA;AAcA;AAaA;;;;;;;cCxBa,wBAAA,SAAiC,KAAA;;EAAjC,SAAA,aAAA,EAAA,MAAyB;EAMtB;EAE4C,SAAA,QAAA,EAAA,MAAA;EARd;EAAK,SAAA,GAAA,EAMnC,OANmC;EAyBtC,WAAA,CAAA,aAAsB,EAAA,MAAA,EAAA,QAAa,EAAA,MAAA,EAAA,GAAA,EAjBY,OAiBZ,EAAA,IAAA,CAAA,EAAA,MAAA;AAgBhD;AAwCA;;;;;cAxDa,qBAAA,SAA8B,KAAA;;;ECrCtC,WAAA,CAAS,OAAA,EAAA,MAAA,EAAA,aAAA,CAAA,EAAA,MAAA;;;;;AAgBd;;AAE8B,KDmClB,cAAA;;+GCSwB;kHAApB;;;ACzBhB,0DAA0C,OAAA;;;;;;;;;;;;;;;;;cFwD7B,UAAA,SAAmB,KAAA;;iBAEf;;;;;;;oBAQG;;;;;KCvGf,yCAAyC,QAAQ,YAAY;;;AFMlE;AAGA;AAcA;AAaA;;;;;;;;;ACxBa,cCIA,WDJyB,CAAA,UCIH,MDJG,CAAA,CAAA;EAMtB;EAE4C,SAAA,QAAA,EAAA,SCF9B,ODE8B,EAAA;EARd;;AAyB9C;AAgBA;AAwCA;;EAUoB,SAAA,WAAA,EAAA,MAAA;EAVY;EAAK,SAAA,MAAA,EAAA,MAAA,GAAA,SAAA;;iCC7Dd,uEAGR,UAAU;;AAtCoB;;;;;EAmBhC,WAAA,CAAA,CAAA,EAAW,OAAA;EAAW;;;;;;;EA8CnB,IAAA,CAAA,CAAA,EAAA,OAAA,CAAQ,WAAR,CAAoB,OAApB,CAAA,CAAA;;;;AFrDhB;AAcA;AAaA;;;;;;;;;ACxBA;;;;;AAyBA;AAgBA;AAwCA;;;;;;;;AChG6C;;;;AAGQ,cCqCxC,kBDrCwC,CAAA,UCqCX,MDrCW,CAAA,CAAA;EAgBxC,iBAAW,OAAA;EAAW,iBAAA,OAAA;EAEL,iBAAA,QAAA;EAcP,QAAA,QAAA;EAGE,QAAA,UAAA;EAAV,QAAA,MAAA;EA2BqB,QAAA,OAAA;EAAZ,QAAA,QAAA;EAAR,WAAA,CAAA,MAAA,ECfM,WDeN,EAAA,SAAA,CAAA,ECf+B,SDe/B;EAAO;;;;ACzBvB;;;;;;EAuCiB,KAAA,CAAA,WAAA,EAAA,SAda,UAcb,EAAA,CAAA,EAAA,IAAA;EAWI,KAAA,CAAA,GAAA,WAAA,EAxBG,UAwBH,EAAA,CAAA,EAAA,IAAA;EAuEgB;;;;;;;iBAlFpB;;;;;;;qBAWI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAuEJ,QAAQ,YAAY;;;;;;;;;GAqB3B,MAAA,CAAO,aAAA,KAAkB,eAAe"}