@arkiv-network/sdk 0.7.0-dev.1 → 0.8.0-advanced.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 (237) hide show
  1. package/README.md +71 -16
  2. package/dist/actions/advanced/index.cjs +13 -0
  3. package/dist/actions/advanced/index.d.cts +8 -0
  4. package/dist/actions/advanced/index.d.ts +9 -0
  5. package/dist/actions/advanced/index.js +9 -0
  6. package/dist/advanced-8ZPTmmaN.js +598 -0
  7. package/dist/advanced-8ZPTmmaN.js.map +1 -0
  8. package/dist/advanced-fPImL6lW.cjs +656 -0
  9. package/dist/arkivTransactions-D74gERHG.d.cts +571 -0
  10. package/dist/arkivTransactions-D74gERHG.d.cts.map +1 -0
  11. package/dist/arkivTransactions-NtGD6uk5.d.ts +571 -0
  12. package/dist/arkivTransactions-NtGD6uk5.d.ts.map +1 -0
  13. package/dist/attr/index.cjs +35 -0
  14. package/dist/attr/index.d.cts +2 -0
  15. package/dist/attr/index.d.ts +3 -0
  16. package/dist/attr/index.js +4 -0
  17. package/dist/attributes-BhY5DwJp.js +809 -0
  18. package/dist/attributes-BhY5DwJp.js.map +1 -0
  19. package/dist/attributes-Df9IsCVs.cjs +1029 -0
  20. package/dist/chains/index.cjs +2 -3
  21. package/dist/chains/index.d.cts +22 -60
  22. package/dist/chains/index.d.cts.map +1 -1
  23. package/dist/chains/index.d.ts +22 -60
  24. package/dist/chains/index.d.ts.map +1 -1
  25. package/dist/chains/index.js +2 -2
  26. package/dist/chains-BJrZs6sG.js +57 -0
  27. package/dist/chains-BJrZs6sG.js.map +1 -0
  28. package/dist/chains-BYRTTipa.cjs +73 -0
  29. package/dist/codec-Car3KkFF.d.ts +102 -0
  30. package/dist/codec-Car3KkFF.d.ts.map +1 -0
  31. package/dist/entity/index.cjs +20 -0
  32. package/dist/entity/index.d.cts +4 -0
  33. package/dist/entity/index.d.ts +5 -0
  34. package/dist/entity/index.js +7 -0
  35. package/dist/entity-B00Li04j.cjs +71 -0
  36. package/dist/entity-B7G8q_Eo.cjs +0 -0
  37. package/dist/entity-BYQR1uoe.js +67 -0
  38. package/dist/entity-BYQR1uoe.js.map +1 -0
  39. package/dist/entity-CD_qFF2M.js +0 -0
  40. package/dist/errors-BVbjKVMN.cjs +56 -0
  41. package/dist/errors-LTe7bOYS.js +33 -0
  42. package/dist/errors-LTe7bOYS.js.map +1 -0
  43. package/dist/expiry-BELY2Kpw.cjs +135 -0
  44. package/dist/expiry-BjpxZZQU.js +95 -0
  45. package/dist/expiry-BjpxZZQU.js.map +1 -0
  46. package/dist/expiry-DRV29F1r.d.cts +79 -0
  47. package/dist/expiry-DRV29F1r.d.cts.map +1 -0
  48. package/dist/expiry-nDbCgZX4.d.ts +79 -0
  49. package/dist/expiry-nDbCgZX4.d.ts.map +1 -0
  50. package/dist/flags-5dTNRnow.d.ts +41 -0
  51. package/dist/flags-5dTNRnow.d.ts.map +1 -0
  52. package/dist/flags-CRjPpoh3.d.cts +41 -0
  53. package/dist/flags-CRjPpoh3.d.cts.map +1 -0
  54. package/dist/flags-DFBs2J94.js +33 -0
  55. package/dist/flags-DFBs2J94.js.map +1 -0
  56. package/dist/flags-kr276q6i.cjs +43 -0
  57. package/dist/index-B5j76711.d.ts +184 -0
  58. package/dist/index-B5j76711.d.ts.map +1 -0
  59. package/dist/index-BF7Mq9Is.d.cts +280 -0
  60. package/dist/index-BF7Mq9Is.d.cts.map +1 -0
  61. package/dist/index-CA4V7Pdh.d.cts +167 -0
  62. package/dist/index-CA4V7Pdh.d.cts.map +1 -0
  63. package/dist/index-CV5zCdpa.d.cts +417 -0
  64. package/dist/index-CV5zCdpa.d.cts.map +1 -0
  65. package/dist/index-DHDud2hC.d.ts +280 -0
  66. package/dist/index-DHDud2hC.d.ts.map +1 -0
  67. package/dist/index-DvYvrkdk.d.ts +320 -0
  68. package/dist/index-DvYvrkdk.d.ts.map +1 -0
  69. package/dist/index-EeUO0nnJ.d.cts +184 -0
  70. package/dist/index-EeUO0nnJ.d.cts.map +1 -0
  71. package/dist/index-fX_XyqLp.d.ts +167 -0
  72. package/dist/index-fX_XyqLp.d.ts.map +1 -0
  73. package/dist/index.cjs +411 -405
  74. package/dist/index.d.cts +360 -209
  75. package/dist/index.d.cts.map +1 -1
  76. package/dist/index.d.ts +361 -209
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +342 -387
  79. package/dist/index.js.map +1 -1
  80. package/dist/key-D1Bh7MF0.js +70 -0
  81. package/dist/key-D1Bh7MF0.js.map +1 -0
  82. package/dist/key-WKhXnXuU.cjs +98 -0
  83. package/dist/logger-CVpvU8ik.js +153 -0
  84. package/dist/logger-CVpvU8ik.js.map +1 -0
  85. package/dist/logger-Cr15lPAQ.cjs +188 -0
  86. package/dist/payload-BNoud2KZ.d.cts +94 -0
  87. package/dist/payload-BNoud2KZ.d.cts.map +1 -0
  88. package/dist/payload-Bz6651ax.js +67 -0
  89. package/dist/payload-Bz6651ax.js.map +1 -0
  90. package/dist/payload-CcUj85ys.d.ts +94 -0
  91. package/dist/payload-CcUj85ys.d.ts.map +1 -0
  92. package/dist/payload-KC14SDlN.cjs +83 -0
  93. package/dist/query/index.cjs +26 -150
  94. package/dist/query/index.d.cts +5 -3
  95. package/dist/query/index.d.ts +6 -3
  96. package/dist/query/index.js +8 -138
  97. package/dist/queryBuilder-DM6AWCBa.js +820 -0
  98. package/dist/queryBuilder-DM6AWCBa.js.map +1 -0
  99. package/dist/queryBuilder-DbUMEZln.cjs +944 -0
  100. package/dist/selection-C4UhsMOO.d.ts +434 -0
  101. package/dist/selection-C4UhsMOO.d.ts.map +1 -0
  102. package/dist/selection-DPg0uyJf.d.cts +433 -0
  103. package/dist/selection-DPg0uyJf.d.cts.map +1 -0
  104. package/dist/types/index.cjs +3 -3
  105. package/dist/types/index.d.cts +7 -2
  106. package/dist/types/index.d.ts +8 -2
  107. package/dist/types/index.js +3 -3
  108. package/dist/types-Bu_ZwMbZ.js +0 -0
  109. package/dist/types-NRqymi6S.cjs +0 -0
  110. package/dist/utils/index.cjs +4 -17
  111. package/dist/utils/index.d.cts +3 -17
  112. package/dist/utils/index.d.ts +3 -17
  113. package/dist/utils/index.js +4 -18
  114. package/package.json +26 -5
  115. package/src/actions/advanced/advanced.test.ts +258 -0
  116. package/src/actions/advanced/buildMutation.ts +104 -0
  117. package/src/actions/advanced/getMutationResult.ts +112 -0
  118. package/src/actions/advanced/index.ts +21 -0
  119. package/src/actions/advanced/pingTransaction.ts +43 -0
  120. package/src/actions/advanced/sendMutation.ts +59 -0
  121. package/src/actions/public/getEntity.ts +27 -43
  122. package/src/actions/public/getEntityNonce.ts +30 -0
  123. package/src/actions/public/predictEntityKeys.test.ts +143 -0
  124. package/src/actions/public/predictEntityKeys.ts +138 -0
  125. package/src/actions/public/query.ts +35 -67
  126. package/src/actions/public/watchEntityEvents.test.ts +414 -0
  127. package/src/actions/public/watchEntityEvents.ts +225 -0
  128. package/src/actions/wallet/changeOwnership.ts +2 -2
  129. package/src/actions/wallet/createEntity.ts +99 -24
  130. package/src/actions/wallet/extendEntity.ts +37 -13
  131. package/src/actions/wallet/mutateEntities.test.ts +76 -0
  132. package/src/actions/wallet/mutateEntities.ts +16 -33
  133. package/src/actions/wallet/patchEntity.ts +90 -0
  134. package/src/attr/attributes.test.ts +120 -0
  135. package/src/attr/attributes.ts +190 -0
  136. package/src/attr/codec.test.ts +162 -0
  137. package/src/attr/codec.ts +220 -0
  138. package/src/attr/decimal.ts +86 -0
  139. package/src/attr/errors.ts +145 -0
  140. package/src/attr/index.ts +50 -0
  141. package/src/attr/names.ts +106 -0
  142. package/src/attr/types.ts +150 -0
  143. package/src/attr/values.test.ts +271 -0
  144. package/src/attr/values.ts +502 -0
  145. package/src/chains/cheesecake.ts +22 -0
  146. package/src/chains/index.ts +1 -2
  147. package/src/clients/createPublicClient.test.ts +3 -5
  148. package/src/clients/createPublicClient.ts +5 -4
  149. package/src/clients/createWalletClient.test.ts +2 -2
  150. package/src/clients/createWalletClient.ts +13 -7
  151. package/src/clients/decorators/arkivAdvanced.ts +144 -0
  152. package/src/clients/decorators/arkivPublic.ts +172 -139
  153. package/src/clients/decorators/arkivWallet.ts +101 -94
  154. package/src/entity/create.test.ts +184 -0
  155. package/src/entity/errors.ts +38 -0
  156. package/src/entity/events.ts +16 -0
  157. package/src/entity/expiry.test.ts +195 -0
  158. package/src/entity/expiry.ts +181 -0
  159. package/src/entity/flags.ts +65 -0
  160. package/src/entity/index.ts +15 -0
  161. package/src/entity/key.ts +68 -0
  162. package/src/entity/operations.ts +134 -0
  163. package/src/entity/params.ts +15 -0
  164. package/src/errors.ts +26 -49
  165. package/src/index.ts +19 -0
  166. package/src/query/engine.ts +68 -137
  167. package/src/query/errors.ts +151 -0
  168. package/src/query/expression.test.ts +286 -0
  169. package/src/query/expression.ts +493 -0
  170. package/src/query/index.ts +40 -4
  171. package/src/query/injection.test.ts +151 -0
  172. package/src/query/queryBuilder.test.ts +342 -637
  173. package/src/query/queryBuilder.ts +133 -359
  174. package/src/query/queryResult.ts +54 -51
  175. package/src/query/selection.test.ts +48 -98
  176. package/src/query/selection.ts +77 -65
  177. package/src/types/entity.test.ts +44 -155
  178. package/src/types/entity.ts +60 -52
  179. package/src/types/events.ts +59 -16
  180. package/src/types/index.ts +20 -17
  181. package/src/types/rpcSchema.ts +69 -37
  182. package/src/utils/arkivTransactions.test.ts +600 -155
  183. package/src/utils/arkivTransactions.ts +350 -219
  184. package/src/utils/chains.test.ts +21 -24
  185. package/src/utils/compression.ts +1 -1
  186. package/src/utils/entities.test.ts +62 -0
  187. package/src/utils/entities.ts +109 -37
  188. package/src/utils/expirationTime.ts +114 -10
  189. package/src/utils/logger.ts +2 -2
  190. package/src/utils/revert.test.ts +99 -0
  191. package/src/utils/revert.ts +145 -0
  192. package/dist/chains-BifaY04V.cjs +0 -108
  193. package/dist/chains-CrtkVbBh.js +0 -86
  194. package/dist/chains-CrtkVbBh.js.map +0 -1
  195. package/dist/consts-Bz0LZQZY.js +0 -7
  196. package/dist/consts-Bz0LZQZY.js.map +0 -1
  197. package/dist/consts-CxT1-RXU.cjs +0 -18
  198. package/dist/entity-BhSXaB23.cjs +0 -81
  199. package/dist/entity-CN41IOrq.d.cts +0 -401
  200. package/dist/entity-CN41IOrq.d.cts.map +0 -1
  201. package/dist/entity-DGfVyB-a.js +0 -71
  202. package/dist/entity-DGfVyB-a.js.map +0 -1
  203. package/dist/entity-NnEVlePN.d.ts +0 -401
  204. package/dist/entity-NnEVlePN.d.ts.map +0 -1
  205. package/dist/index-ClkpS6s_.d.ts +0 -481
  206. package/dist/index-ClkpS6s_.d.ts.map +0 -1
  207. package/dist/index-w4qop0Pe.d.cts +0 -481
  208. package/dist/index-w4qop0Pe.d.cts.map +0 -1
  209. package/dist/payload-BpNUPOnY.js +0 -13
  210. package/dist/payload-BpNUPOnY.js.map +0 -1
  211. package/dist/payload-C2KHOUoj.d.ts +0 -6
  212. package/dist/payload-C2KHOUoj.d.ts.map +0 -1
  213. package/dist/payload-CJN8fTvX.d.cts +0 -6
  214. package/dist/payload-CJN8fTvX.d.cts.map +0 -1
  215. package/dist/payload-D8YLKcJj.cjs +0 -23
  216. package/dist/query/index.js.map +0 -1
  217. package/dist/queryBuilder-BE_XhLLa.js +0 -735
  218. package/dist/queryBuilder-BE_XhLLa.js.map +0 -1
  219. package/dist/queryBuilder-J37buGCi.cjs +0 -865
  220. package/dist/utils/index.d.cts.map +0 -1
  221. package/dist/utils/index.d.ts.map +0 -1
  222. package/dist/utils/index.js.map +0 -1
  223. package/src/actions/public/buildQuery.ts +0 -10
  224. package/src/actions/public/subscribeEntityEvents.ts +0 -93
  225. package/src/actions/wallet/updateEntity.ts +0 -59
  226. package/src/chains/braga.ts +0 -26
  227. package/src/chains/kaolin.ts +0 -29
  228. package/src/query/engine.test.ts +0 -571
  229. package/src/query/predicate.test.ts +0 -461
  230. package/src/query/predicate.ts +0 -144
  231. package/src/query/queryResult.test.ts +0 -270
  232. package/src/query/selectQueryBuilder.test.ts +0 -213
  233. package/src/types/attributes.ts +0 -28
  234. package/src/utils/validation.test.ts +0 -106
  235. package/src/utils/validation.ts +0 -80
  236. /package/dist/{types-Ci4BRClw.js → attr-DlmErkvR.cjs} +0 -0
  237. /package/dist/{types-a8gm_IaQ.cjs → attr-GcQKatub.js} +0 -0
@@ -0,0 +1,145 @@
1
+ import { BaseError, ContractFunctionRevertedError, type Hex, hexToString } from "viem"
2
+
3
+ /**
4
+ * Turns a decoded engine revert into a sentence that says what to change.
5
+ *
6
+ * viem decodes the error and then renders it positionally — `Ident32InvalidByte(uint256 position,
7
+ * bytes1 value)` arrives as `(5, 0x41)`, which is the right data and no help at all. The engine's
8
+ * errors carry enough to name the actual problem, so this spends the args rather than printing
9
+ * them.
10
+ *
11
+ * @param error - Anything thrown by a write action.
12
+ * @returns The explanation, or `undefined` if this was not a decodable engine revert — in which
13
+ * case the caller should fall back to whatever the transport said.
14
+ */
15
+ export function describeEntityRevert(error: unknown): string | undefined {
16
+ if (!(error instanceof BaseError)) return undefined
17
+ const reverted = error.walk((e) => e instanceof ContractFunctionRevertedError)
18
+ if (!(reverted instanceof ContractFunctionRevertedError)) return undefined
19
+
20
+ const name = reverted.data?.errorName
21
+ if (name === undefined) return undefined
22
+ const args = (reverted.data?.args ?? []) as readonly unknown[]
23
+
24
+ return explain(name, args) ?? `the engine rejected the batch with ${name}`
25
+ }
26
+
27
+ /** The attribute-name charset, quoted the way an error message should read. */
28
+ const CHARSET = '"A"-"Z", "a"-"z", "0"-"9", ".", "-" and "_", with a letter first'
29
+
30
+ function explain(name: string, args: readonly unknown[]): string | undefined {
31
+ switch (name) {
32
+ // ── attribute names ──────────────────────────────────────────────────────
33
+ case "Ident32InvalidByte": {
34
+ const position = Number(args[0] ?? 0)
35
+ const char = printable(String(args[1] ?? "0x00"))
36
+ return (
37
+ `an attribute name holds ${char} at byte ${position}, which is outside the ` +
38
+ `name charset (${CHARSET})`
39
+ )
40
+ }
41
+ case "Ident32Empty":
42
+ return "an attribute name is empty"
43
+
44
+ // ── the attribute list ───────────────────────────────────────────────────
45
+ case "SystemAttributeNotWritable":
46
+ return (
47
+ `"${identName(args[0])}" is owned by the engine and cannot be written. Only $payload and ` +
48
+ "$contentType are yours to set"
49
+ )
50
+ case "TombstoneInCreate":
51
+ return (
52
+ `a create cannot unset "${identName(args[0])}" — nothing exists yet, so leave the name ` +
53
+ "out instead"
54
+ )
55
+ case "TombstoneValueNotEmpty":
56
+ return `the tombstone for "${identName(args[0])}" carries a value; unsetting takes no value`
57
+ case "InvalidValueType":
58
+ return `"${identName(args[0])}" names type id ${String(args[1])}, which is not a known type`
59
+ case "AttributesNotSorted":
60
+ return "attributes must be strictly ascending by name, which also makes each name unique"
61
+ case "TooManyAttributes":
62
+ return `${String(args[0])} attributes exceeds the limit of ${String(args[1])}`
63
+ case "EmptyMutations":
64
+ return `the patch of ${short(args[0])} has no mutations, so it would do nothing`
65
+
66
+ // ── entity state and authorisation ───────────────────────────────────────
67
+ case "EntityNotFound":
68
+ return `no entity ${short(args[0])} — it may have been deleted, or have expired`
69
+ case "EntityExpired":
70
+ return `entity ${short(args[0])} expired at block ${String(args[1])}`
71
+ case "NotOwner":
72
+ return `entity ${short(args[0])} is owned by ${String(args[2])}, not ${String(args[1])}`
73
+ case "ReadOnlyEntity":
74
+ return (
75
+ `entity ${short(args[0])} was created readonly, so its contents can never change. Its ` +
76
+ "expiry can still be extended, and it can be transferred or deleted"
77
+ )
78
+ case "ReservedCreationFlags":
79
+ return (
80
+ `creation flags 0b${Number(args[0] ?? 0)
81
+ .toString(2)
82
+ .padStart(8, "0")} set a reserved ` +
83
+ "bit; only readonly and permissionlessExtension are defined"
84
+ )
85
+
86
+ // ── expiry ───────────────────────────────────────────────────────────────
87
+ case "ExpiryDeadOnArrival":
88
+ return (
89
+ `the expiry resolves to block ${String(args[0])}, which is not after the current block ` +
90
+ `${String(args[1])}`
91
+ )
92
+ case "ExpiryNotExtended":
93
+ return (
94
+ `entity ${short(args[0])} already expires at block ${String(args[2])}, so extending it ` +
95
+ `to ${String(args[1])} would shorten its life`
96
+ )
97
+
98
+ // ── ownership ────────────────────────────────────────────────────────────
99
+ case "TransferToZeroAddress":
100
+ return `entity ${short(args[0])} cannot be transferred to the zero address`
101
+ case "TransferToSelf":
102
+ return `entity ${short(args[0])} is already owned by that account`
103
+
104
+ // ── batch framing ────────────────────────────────────────────────────────
105
+ case "EmptyBatch":
106
+ return "the batch has no operations"
107
+ case "InvalidOpType":
108
+ return `operation tag ${String(args[0])} is not one the engine knows`
109
+ case "NonCanonicalOperationData":
110
+ return (
111
+ `the payload for operation tag ${String(args[0])} is not its canonical encoding, so the ` +
112
+ "engine refused it rather than accept a second spelling of the same operation"
113
+ )
114
+
115
+ default:
116
+ return undefined
117
+ }
118
+ }
119
+
120
+ /** A `bytes32` Ident32 cell as the name it holds — left-aligned, null-padded. */
121
+ function identName(raw: unknown): string {
122
+ if (typeof raw !== "string") return String(raw)
123
+ try {
124
+ // Cut at the first null rather than trimming with a regex: the padding is whatever follows
125
+ // the name, so everything before it is the name and nothing after it is. Written as an escape
126
+ // because a literal NUL byte in source is invisible to every reader after you.
127
+ return hexToString(raw as Hex).split("\u0000")[0] ?? ""
128
+ } catch {
129
+ return raw
130
+ }
131
+ }
132
+
133
+ /** An entity key, abbreviated */
134
+ function short(raw: unknown): string {
135
+ const text = String(raw)
136
+ return text.length > 18 ? `${text.slice(0, 10)}…${text.slice(-6)}` : text
137
+ }
138
+
139
+ /** A `bytes1` as something readable: the character it is, plus the byte it was. */
140
+ function printable(byte: string): string {
141
+ const code = Number.parseInt(byte.replace(/^0x/, ""), 16)
142
+ if (!Number.isFinite(code)) return `byte ${byte}`
143
+ const char = String.fromCharCode(code)
144
+ return code >= 0x21 && code <= 0x7e ? `"${char}" (${byte})` : `byte ${byte}`
145
+ }
@@ -1,108 +0,0 @@
1
- //#region rolldown:runtime
2
- var __defProp = Object.defineProperty;
3
- var __export = (all) => {
4
- let target = {};
5
- for (var name in all) __defProp(target, name, {
6
- get: all[name],
7
- enumerable: true
8
- });
9
- return target;
10
- };
11
-
12
- //#endregion
13
- let viem = require("viem");
14
-
15
- //#region src/chains/braga.ts
16
- const braga = (0, viem.defineChain)({
17
- id: 60138453102,
18
- name: "Braga",
19
- network: "braga",
20
- nativeCurrency: {
21
- name: "Golem",
22
- symbol: "GLM",
23
- decimals: 18
24
- },
25
- rpcUrls: { default: {
26
- http: ["https://braga.hoodi.arkiv.network/rpc"],
27
- webSocket: ["wss://braga.hoodi.arkiv.network/rpc/ws"]
28
- } },
29
- blockExplorers: { default: {
30
- name: "Braga Arkiv Explorer",
31
- url: "https://explorer.braga.hoodi.arkiv.network",
32
- apiUrl: "https://explorer.braga.hoodi.arkiv.network/api"
33
- } },
34
- testnet: true
35
- });
36
-
37
- //#endregion
38
- //#region src/chains/kaolin.ts
39
- /**
40
- * @deprecated The kaolin network is getting removed on may 15th 2026. Migration guide: https://docs.arkiv.network/networks/migrate-from-kaolin/
41
- */
42
- const kaolin = (0, viem.defineChain)({
43
- id: 60138453025,
44
- name: "Kaolin",
45
- network: "kaolin",
46
- nativeCurrency: {
47
- name: "Ethereum",
48
- symbol: "ETH",
49
- decimals: 18
50
- },
51
- rpcUrls: { default: {
52
- http: ["https://kaolin.hoodi.arkiv.network/rpc"],
53
- webSocket: ["wss://kaolin.hoodi.arkiv.network/rpc/ws"]
54
- } },
55
- blockExplorers: { default: {
56
- name: "Kaolin Arkiv Explorer",
57
- url: "https://explorer.kaolin.hoodi.arkiv.network",
58
- apiUrl: "https://explorer.kaolin.hoodi.arkiv.network/api"
59
- } },
60
- testnet: true
61
- });
62
-
63
- //#endregion
64
- //#region src/chains/localhost.ts
65
- const localhost = (0, viem.defineChain)({
66
- id: 1337,
67
- name: "Localhost",
68
- nativeCurrency: {
69
- decimals: 18,
70
- name: "Ether",
71
- symbol: "ETH"
72
- },
73
- rpcUrls: { default: { http: ["http://127.0.0.1:8545"] } }
74
- });
75
-
76
- //#endregion
77
- //#region src/chains/index.ts
78
- var chains_exports = /* @__PURE__ */ __export({
79
- braga: () => braga,
80
- kaolin: () => kaolin,
81
- localhost: () => localhost
82
- });
83
-
84
- //#endregion
85
- Object.defineProperty(exports, 'braga', {
86
- enumerable: true,
87
- get: function () {
88
- return braga;
89
- }
90
- });
91
- Object.defineProperty(exports, 'chains_exports', {
92
- enumerable: true,
93
- get: function () {
94
- return chains_exports;
95
- }
96
- });
97
- Object.defineProperty(exports, 'kaolin', {
98
- enumerable: true,
99
- get: function () {
100
- return kaolin;
101
- }
102
- });
103
- Object.defineProperty(exports, 'localhost', {
104
- enumerable: true,
105
- get: function () {
106
- return localhost;
107
- }
108
- });
@@ -1,86 +0,0 @@
1
- import { defineChain } from "viem";
2
-
3
- //#region rolldown:runtime
4
- var __defProp = Object.defineProperty;
5
- var __export = (all) => {
6
- let target = {};
7
- for (var name in all) __defProp(target, name, {
8
- get: all[name],
9
- enumerable: true
10
- });
11
- return target;
12
- };
13
-
14
- //#endregion
15
- //#region src/chains/braga.ts
16
- const braga = defineChain({
17
- id: 60138453102,
18
- name: "Braga",
19
- network: "braga",
20
- nativeCurrency: {
21
- name: "Golem",
22
- symbol: "GLM",
23
- decimals: 18
24
- },
25
- rpcUrls: { default: {
26
- http: ["https://braga.hoodi.arkiv.network/rpc"],
27
- webSocket: ["wss://braga.hoodi.arkiv.network/rpc/ws"]
28
- } },
29
- blockExplorers: { default: {
30
- name: "Braga Arkiv Explorer",
31
- url: "https://explorer.braga.hoodi.arkiv.network",
32
- apiUrl: "https://explorer.braga.hoodi.arkiv.network/api"
33
- } },
34
- testnet: true
35
- });
36
-
37
- //#endregion
38
- //#region src/chains/kaolin.ts
39
- /**
40
- * @deprecated The kaolin network is getting removed on may 15th 2026. Migration guide: https://docs.arkiv.network/networks/migrate-from-kaolin/
41
- */
42
- const kaolin = defineChain({
43
- id: 60138453025,
44
- name: "Kaolin",
45
- network: "kaolin",
46
- nativeCurrency: {
47
- name: "Ethereum",
48
- symbol: "ETH",
49
- decimals: 18
50
- },
51
- rpcUrls: { default: {
52
- http: ["https://kaolin.hoodi.arkiv.network/rpc"],
53
- webSocket: ["wss://kaolin.hoodi.arkiv.network/rpc/ws"]
54
- } },
55
- blockExplorers: { default: {
56
- name: "Kaolin Arkiv Explorer",
57
- url: "https://explorer.kaolin.hoodi.arkiv.network",
58
- apiUrl: "https://explorer.kaolin.hoodi.arkiv.network/api"
59
- } },
60
- testnet: true
61
- });
62
-
63
- //#endregion
64
- //#region src/chains/localhost.ts
65
- const localhost = defineChain({
66
- id: 1337,
67
- name: "Localhost",
68
- nativeCurrency: {
69
- decimals: 18,
70
- name: "Ether",
71
- symbol: "ETH"
72
- },
73
- rpcUrls: { default: { http: ["http://127.0.0.1:8545"] } }
74
- });
75
-
76
- //#endregion
77
- //#region src/chains/index.ts
78
- var chains_exports = /* @__PURE__ */ __export({
79
- braga: () => braga,
80
- kaolin: () => kaolin,
81
- localhost: () => localhost
82
- });
83
-
84
- //#endregion
85
- export { braga as i, localhost as n, kaolin as r, chains_exports as t };
86
- //# sourceMappingURL=chains-CrtkVbBh.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chains-CrtkVbBh.js","names":[],"sources":["../src/chains/braga.ts","../src/chains/kaolin.ts","../src/chains/localhost.ts","../src/chains/index.ts"],"sourcesContent":["import { defineChain } from \"viem\"\n\nexport const braga = defineChain({\n id: 60138453102,\n name: \"Braga\",\n network: \"braga\",\n nativeCurrency: {\n name: \"Golem\",\n symbol: \"GLM\",\n decimals: 18,\n },\n rpcUrls: {\n default: {\n http: [\"https://braga.hoodi.arkiv.network/rpc\"],\n webSocket: [\"wss://braga.hoodi.arkiv.network/rpc/ws\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Braga Arkiv Explorer\",\n url: \"https://explorer.braga.hoodi.arkiv.network\",\n apiUrl: \"https://explorer.braga.hoodi.arkiv.network/api\",\n },\n },\n testnet: true,\n})\n","import { defineChain } from \"viem\"\n\n/**\n * @deprecated The kaolin network is getting removed on may 15th 2026. Migration guide: https://docs.arkiv.network/networks/migrate-from-kaolin/\n */\nexport const kaolin = defineChain({\n id: 60138453025,\n name: \"Kaolin\",\n network: \"kaolin\",\n nativeCurrency: {\n name: \"Ethereum\",\n symbol: \"ETH\",\n decimals: 18,\n },\n rpcUrls: {\n default: {\n http: [\"https://kaolin.hoodi.arkiv.network/rpc\"],\n webSocket: [\"wss://kaolin.hoodi.arkiv.network/rpc/ws\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Kaolin Arkiv Explorer\",\n url: \"https://explorer.kaolin.hoodi.arkiv.network\",\n apiUrl: \"https://explorer.kaolin.hoodi.arkiv.network/api\",\n },\n },\n testnet: true,\n})\n","import { defineChain } from \"viem\"\n\nexport const localhost = defineChain({\n id: 1337,\n name: \"Localhost\",\n nativeCurrency: {\n decimals: 18,\n name: \"Ether\",\n symbol: \"ETH\",\n },\n rpcUrls: {\n default: { http: [\"http://127.0.0.1:8545\"] },\n },\n})\n","export { braga } from \"./braga\"\nexport { kaolin } from \"./kaolin\"\nexport { localhost } from \"./localhost\"\n"],"mappings":";;;;;;;;;;;;;;;AAEA,MAAa,QAAQ,YAAY;CAC/B,IAAI;CACJ,MAAM;CACN,SAAS;CACT,gBAAgB;EACd,MAAM;EACN,QAAQ;EACR,UAAU;EACX;CACD,SAAS,EACP,SAAS;EACP,MAAM,CAAC,wCAAwC;EAC/C,WAAW,CAAC,yCAAyC;EACtD,EACF;CACD,gBAAgB,EACd,SAAS;EACP,MAAM;EACN,KAAK;EACL,QAAQ;EACT,EACF;CACD,SAAS;CACV,CAAC;;;;;;;ACpBF,MAAa,SAAS,YAAY;CAChC,IAAI;CACJ,MAAM;CACN,SAAS;CACT,gBAAgB;EACd,MAAM;EACN,QAAQ;EACR,UAAU;EACX;CACD,SAAS,EACP,SAAS;EACP,MAAM,CAAC,yCAAyC;EAChD,WAAW,CAAC,0CAA0C;EACvD,EACF;CACD,gBAAgB,EACd,SAAS;EACP,MAAM;EACN,KAAK;EACL,QAAQ;EACT,EACF;CACD,SAAS;CACV,CAAC;;;;AC1BF,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"}
@@ -1,7 +0,0 @@
1
- //#region src/consts.ts
2
- const ARKIV_ADDRESS = "0x4400000000000000000000000000000000000044";
3
- const BLOCK_TIME = 2;
4
-
5
- //#endregion
6
- export { BLOCK_TIME as n, ARKIV_ADDRESS as t };
7
- //# sourceMappingURL=consts-Bz0LZQZY.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"consts-Bz0LZQZY.js","names":[],"sources":["../src/consts.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"],"mappings":";AACA,MAAa,gBAAgB;AAC7B,MAAa,aAAa"}
@@ -1,18 +0,0 @@
1
-
2
- //#region src/consts.ts
3
- const ARKIV_ADDRESS = "0x4400000000000000000000000000000000000044";
4
- const BLOCK_TIME = 2;
5
-
6
- //#endregion
7
- Object.defineProperty(exports, 'ARKIV_ADDRESS', {
8
- enumerable: true,
9
- get: function () {
10
- return ARKIV_ADDRESS;
11
- }
12
- });
13
- Object.defineProperty(exports, 'BLOCK_TIME', {
14
- enumerable: true,
15
- get: function () {
16
- return BLOCK_TIME;
17
- }
18
- });
@@ -1,81 +0,0 @@
1
- let viem = require("viem");
2
-
3
- //#region src/types/entity.ts
4
- let EntityOperationType = /* @__PURE__ */ function(EntityOperationType$1) {
5
- EntityOperationType$1[EntityOperationType$1["Create"] = 1] = "Create";
6
- EntityOperationType$1[EntityOperationType$1["Update"] = 2] = "Update";
7
- EntityOperationType$1[EntityOperationType$1["Extend"] = 3] = "Extend";
8
- EntityOperationType$1[EntityOperationType$1["Transfer"] = 4] = "Transfer";
9
- EntityOperationType$1[EntityOperationType$1["Delete"] = 5] = "Delete";
10
- EntityOperationType$1[EntityOperationType$1["Expire"] = 6] = "Expire";
11
- return EntityOperationType$1;
12
- }({});
13
- var Entity = class {
14
- key;
15
- contentType;
16
- owner;
17
- creator;
18
- expiresAtBlock;
19
- createdAtBlock;
20
- lastModifiedAtBlock;
21
- transactionIndexInBlock;
22
- operationIndexInTransaction;
23
- payload;
24
- attributes;
25
- constructor(key, contentType = void 0, owner = void 0, creator = void 0, expiresAtBlock = void 0, createdAtBlock = void 0, lastModifiedAtBlock = void 0, transactionIndexInBlock = void 0, operationIndexInTransaction = void 0, payload = void 0, attributes) {
26
- this.key = key;
27
- this.owner = owner;
28
- this.creator = creator;
29
- this.expiresAtBlock = expiresAtBlock;
30
- this.createdAtBlock = createdAtBlock;
31
- this.lastModifiedAtBlock = lastModifiedAtBlock;
32
- this.transactionIndexInBlock = transactionIndexInBlock;
33
- this.operationIndexInTransaction = operationIndexInTransaction;
34
- this.payload = payload;
35
- this.attributes = attributes;
36
- this.contentType = contentType;
37
- }
38
- /**
39
- * Converts the entity payload from bytes to a string and returns it.
40
- * Throws an error if the payload is undefined, which may occur if the entity was not queried with the withPayload option.
41
- * Throws an error if the conversion from bytes to string fails.
42
- * @returns The entity payload as a string.
43
- */
44
- toText() {
45
- if (this.payload === void 0) throw new Error("Entity has no payload – it was probably queried without withPayload(true) via QueryBuilder");
46
- try {
47
- return (0, viem.bytesToString)(this.payload);
48
- } catch (e) {
49
- throw new Error(`Failed to convert entity payload to text: ${e instanceof Error ? e.message : String(e)}`, { cause: e });
50
- }
51
- }
52
- /**
53
- * Parses the entity payload as JSON and returns the resulting object.
54
- * Throws an error if the payload is undefined, which may occur if the entity was not queried with the withPayload option.
55
- * Throws an error if the payload is empty or cannot be parsed as JSON.
56
- * @returns The parsed JSON object from the entity payload.
57
- */
58
- toJson() {
59
- const text = this.toText();
60
- if (!text) throw new Error("Entity has empty payload, cannot parse as JSON");
61
- try {
62
- return JSON.parse(text);
63
- } catch (e) {
64
- throw new Error(`Failed to parse entity payload as JSON: ${e instanceof Error ? e.message : String(e)}`, { cause: e });
65
- }
66
- }
67
- };
68
-
69
- //#endregion
70
- Object.defineProperty(exports, 'Entity', {
71
- enumerable: true,
72
- get: function () {
73
- return Entity;
74
- }
75
- });
76
- Object.defineProperty(exports, 'EntityOperationType', {
77
- enumerable: true,
78
- get: function () {
79
- return EntityOperationType;
80
- }
81
- });