@arkiv-network/sdk 0.0.36-dev.5 → 0.1.0

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 (269) hide show
  1. package/README.md +96 -16
  2. package/dist/_cjs/actions/public/buildQuery.js.map +1 -1
  3. package/dist/_cjs/actions/public/getBlockTiming.d.ts.map +1 -1
  4. package/dist/_cjs/actions/public/getBlockTiming.js.map +1 -1
  5. package/dist/_cjs/actions/public/getEntity.js.map +1 -1
  6. package/dist/_cjs/actions/public/getEntityCount.js.map +1 -1
  7. package/dist/_cjs/actions/public/query.js.map +1 -1
  8. package/dist/_cjs/actions/public/subscribeEntityEvents.d.ts.map +1 -1
  9. package/dist/_cjs/actions/public/subscribeEntityEvents.js.map +1 -1
  10. package/dist/_cjs/actions/wallet/changeOwnership.d.ts +22 -0
  11. package/dist/_cjs/actions/wallet/changeOwnership.d.ts.map +1 -0
  12. package/dist/_cjs/actions/wallet/changeOwnership.js +15 -0
  13. package/dist/_cjs/actions/wallet/changeOwnership.js.map +1 -0
  14. package/dist/_cjs/actions/wallet/createEntity.d.ts +5 -3
  15. package/dist/_cjs/actions/wallet/createEntity.d.ts.map +1 -1
  16. package/dist/_cjs/actions/wallet/createEntity.js.map +1 -1
  17. package/dist/_cjs/actions/wallet/deleteEntity.d.ts.map +1 -1
  18. package/dist/_cjs/actions/wallet/deleteEntity.js.map +1 -1
  19. package/dist/_cjs/actions/wallet/extendEntity.d.ts.map +1 -1
  20. package/dist/_cjs/actions/wallet/extendEntity.js.map +1 -1
  21. package/dist/_cjs/actions/wallet/mutateEntities.d.ts.map +1 -1
  22. package/dist/_cjs/actions/wallet/mutateEntities.js.map +1 -1
  23. package/dist/_cjs/actions/wallet/updateEntity.d.ts +6 -4
  24. package/dist/_cjs/actions/wallet/updateEntity.d.ts.map +1 -1
  25. package/dist/_cjs/actions/wallet/updateEntity.js.map +1 -1
  26. package/dist/_cjs/chains/kaolin.js.map +1 -1
  27. package/dist/_cjs/chains/localhost.js.map +1 -1
  28. package/dist/_cjs/chains/marketplace.js.map +1 -1
  29. package/dist/_cjs/clients/baseClient.d.ts.map +1 -1
  30. package/dist/_cjs/clients/createPublicClient.d.ts.map +1 -1
  31. package/dist/_cjs/clients/createPublicClient.js.map +1 -1
  32. package/dist/_cjs/clients/createWalletClient.d.ts.map +1 -1
  33. package/dist/_cjs/clients/createWalletClient.js.map +1 -1
  34. package/dist/_cjs/clients/decorators/arkivPublic.d.ts +0 -2
  35. package/dist/_cjs/clients/decorators/arkivPublic.d.ts.map +1 -1
  36. package/dist/_cjs/clients/decorators/arkivPublic.js.map +1 -1
  37. package/dist/_cjs/clients/decorators/arkivWallet.d.ts +15 -5
  38. package/dist/_cjs/clients/decorators/arkivWallet.d.ts.map +1 -1
  39. package/dist/_cjs/clients/decorators/arkivWallet.js +2 -0
  40. package/dist/_cjs/clients/decorators/arkivWallet.js.map +1 -1
  41. package/dist/_cjs/consts.js +1 -1
  42. package/dist/_cjs/index.d.ts +1 -1
  43. package/dist/_cjs/index.d.ts.map +1 -1
  44. package/dist/_cjs/query/engine.d.ts +1 -1
  45. package/dist/_cjs/query/engine.d.ts.map +1 -1
  46. package/dist/_cjs/query/engine.js +6 -5
  47. package/dist/_cjs/query/engine.js.map +1 -1
  48. package/dist/_cjs/query/errors.js.map +1 -1
  49. package/dist/_cjs/query/predicate.d.ts.map +1 -1
  50. package/dist/_cjs/query/predicate.js.map +1 -1
  51. package/dist/_cjs/query/queryBuilder.d.ts +5 -5
  52. package/dist/_cjs/query/queryBuilder.d.ts.map +1 -1
  53. package/dist/_cjs/query/queryBuilder.js +8 -8
  54. package/dist/_cjs/query/queryBuilder.js.map +1 -1
  55. package/dist/_cjs/query/queryResult.d.ts.map +1 -1
  56. package/dist/_cjs/query/queryResult.js.map +1 -1
  57. package/dist/_cjs/types/attributes.d.ts +5 -0
  58. package/dist/_cjs/types/attributes.d.ts.map +1 -0
  59. package/dist/_cjs/types/{annotation.js → attributes.js} +1 -1
  60. package/dist/_cjs/types/attributes.js.map +1 -0
  61. package/dist/_cjs/types/entity.d.ts +5 -3
  62. package/dist/_cjs/types/entity.d.ts.map +1 -1
  63. package/dist/_cjs/types/entity.js +5 -3
  64. package/dist/_cjs/types/entity.js.map +1 -1
  65. package/dist/_cjs/types/events.d.ts.map +1 -1
  66. package/dist/_cjs/types/index.d.ts +2 -1
  67. package/dist/_cjs/types/index.d.ts.map +1 -1
  68. package/dist/_cjs/types/mimeTypes.d.ts +2 -0
  69. package/dist/_cjs/types/mimeTypes.d.ts.map +1 -0
  70. package/dist/_cjs/types/mimeTypes.js +3 -0
  71. package/dist/_cjs/types/mimeTypes.js.map +1 -0
  72. package/dist/_cjs/types/rpcSchema.d.ts +7 -20
  73. package/dist/_cjs/types/rpcSchema.d.ts.map +1 -1
  74. package/dist/_cjs/types/txParams.d.ts.map +1 -1
  75. package/dist/_cjs/utils/arkivTransactions.d.ts +3 -1
  76. package/dist/_cjs/utils/arkivTransactions.d.ts.map +1 -1
  77. package/dist/_cjs/utils/arkivTransactions.js +23 -17
  78. package/dist/_cjs/utils/arkivTransactions.js.map +1 -1
  79. package/dist/_cjs/utils/compression.d.ts +3 -0
  80. package/dist/_cjs/utils/compression.d.ts.map +1 -0
  81. package/dist/_cjs/utils/compression.js +24 -0
  82. package/dist/_cjs/utils/compression.js.map +1 -0
  83. package/dist/_cjs/utils/entities.d.ts.map +1 -1
  84. package/dist/_cjs/utils/entities.js +4 -4
  85. package/dist/_cjs/utils/entities.js.map +1 -1
  86. package/dist/_cjs/utils/expirationTime.d.ts.map +1 -1
  87. package/dist/_cjs/utils/expirationTime.js.map +1 -1
  88. package/dist/_cjs/utils/payload.js.map +1 -1
  89. package/dist/_esm/actions/public/buildQuery.js.map +1 -1
  90. package/dist/_esm/actions/public/getBlockTiming.d.ts.map +1 -1
  91. package/dist/_esm/actions/public/getBlockTiming.js.map +1 -1
  92. package/dist/_esm/actions/public/getEntity.js.map +1 -1
  93. package/dist/_esm/actions/public/getEntityCount.js.map +1 -1
  94. package/dist/_esm/actions/public/query.js.map +1 -1
  95. package/dist/_esm/actions/public/subscribeEntityEvents.d.ts.map +1 -1
  96. package/dist/_esm/actions/public/subscribeEntityEvents.js.map +1 -1
  97. package/dist/_esm/actions/wallet/changeOwnership.d.ts +22 -0
  98. package/dist/_esm/actions/wallet/changeOwnership.d.ts.map +1 -0
  99. package/dist/_esm/actions/wallet/changeOwnership.js +12 -0
  100. package/dist/_esm/actions/wallet/changeOwnership.js.map +1 -0
  101. package/dist/_esm/actions/wallet/createEntity.d.ts +5 -3
  102. package/dist/_esm/actions/wallet/createEntity.d.ts.map +1 -1
  103. package/dist/_esm/actions/wallet/createEntity.js.map +1 -1
  104. package/dist/_esm/actions/wallet/deleteEntity.d.ts.map +1 -1
  105. package/dist/_esm/actions/wallet/deleteEntity.js.map +1 -1
  106. package/dist/_esm/actions/wallet/extendEntity.d.ts.map +1 -1
  107. package/dist/_esm/actions/wallet/extendEntity.js.map +1 -1
  108. package/dist/_esm/actions/wallet/mutateEntities.d.ts.map +1 -1
  109. package/dist/_esm/actions/wallet/mutateEntities.js.map +1 -1
  110. package/dist/_esm/actions/wallet/updateEntity.d.ts +6 -4
  111. package/dist/_esm/actions/wallet/updateEntity.d.ts.map +1 -1
  112. package/dist/_esm/actions/wallet/updateEntity.js.map +1 -1
  113. package/dist/_esm/chains/kaolin.js.map +1 -1
  114. package/dist/_esm/chains/localhost.js.map +1 -1
  115. package/dist/_esm/chains/marketplace.js.map +1 -1
  116. package/dist/_esm/clients/baseClient.d.ts.map +1 -1
  117. package/dist/_esm/clients/createPublicClient.d.ts.map +1 -1
  118. package/dist/_esm/clients/createPublicClient.js.map +1 -1
  119. package/dist/_esm/clients/createWalletClient.d.ts.map +1 -1
  120. package/dist/_esm/clients/createWalletClient.js.map +1 -1
  121. package/dist/_esm/clients/decorators/arkivPublic.d.ts +0 -2
  122. package/dist/_esm/clients/decorators/arkivPublic.d.ts.map +1 -1
  123. package/dist/_esm/clients/decorators/arkivPublic.js.map +1 -1
  124. package/dist/_esm/clients/decorators/arkivWallet.d.ts +15 -5
  125. package/dist/_esm/clients/decorators/arkivWallet.d.ts.map +1 -1
  126. package/dist/_esm/clients/decorators/arkivWallet.js +2 -0
  127. package/dist/_esm/clients/decorators/arkivWallet.js.map +1 -1
  128. package/dist/_esm/consts.js +1 -1
  129. package/dist/_esm/index.d.ts +1 -1
  130. package/dist/_esm/index.d.ts.map +1 -1
  131. package/dist/_esm/query/engine.d.ts +1 -1
  132. package/dist/_esm/query/engine.d.ts.map +1 -1
  133. package/dist/_esm/query/engine.js +6 -5
  134. package/dist/_esm/query/engine.js.map +1 -1
  135. package/dist/_esm/query/errors.js.map +1 -1
  136. package/dist/_esm/query/predicate.d.ts.map +1 -1
  137. package/dist/_esm/query/predicate.js.map +1 -1
  138. package/dist/_esm/query/queryBuilder.d.ts +5 -5
  139. package/dist/_esm/query/queryBuilder.d.ts.map +1 -1
  140. package/dist/_esm/query/queryBuilder.js +8 -8
  141. package/dist/_esm/query/queryBuilder.js.map +1 -1
  142. package/dist/_esm/query/queryResult.d.ts.map +1 -1
  143. package/dist/_esm/query/queryResult.js.map +1 -1
  144. package/dist/_esm/types/attributes.d.ts +5 -0
  145. package/dist/_esm/types/attributes.d.ts.map +1 -0
  146. package/dist/_esm/types/attributes.js +2 -0
  147. package/dist/_esm/types/attributes.js.map +1 -0
  148. package/dist/_esm/types/entity.d.ts +5 -3
  149. package/dist/_esm/types/entity.d.ts.map +1 -1
  150. package/dist/_esm/types/entity.js +5 -3
  151. package/dist/_esm/types/entity.js.map +1 -1
  152. package/dist/_esm/types/events.d.ts.map +1 -1
  153. package/dist/_esm/types/index.d.ts +2 -1
  154. package/dist/_esm/types/index.d.ts.map +1 -1
  155. package/dist/_esm/types/mimeTypes.d.ts +2 -0
  156. package/dist/_esm/types/mimeTypes.d.ts.map +1 -0
  157. package/dist/_esm/types/mimeTypes.js +2 -0
  158. package/dist/_esm/types/mimeTypes.js.map +1 -0
  159. package/dist/_esm/types/rpcSchema.d.ts +7 -20
  160. package/dist/_esm/types/rpcSchema.d.ts.map +1 -1
  161. package/dist/_esm/types/txParams.d.ts.map +1 -1
  162. package/dist/_esm/utils/arkivTransactions.d.ts +3 -1
  163. package/dist/_esm/utils/arkivTransactions.d.ts.map +1 -1
  164. package/dist/_esm/utils/arkivTransactions.js +24 -18
  165. package/dist/_esm/utils/arkivTransactions.js.map +1 -1
  166. package/dist/_esm/utils/compression.d.ts +3 -0
  167. package/dist/_esm/utils/compression.d.ts.map +1 -0
  168. package/dist/_esm/utils/compression.js +20 -0
  169. package/dist/_esm/utils/compression.js.map +1 -0
  170. package/dist/_esm/utils/entities.d.ts.map +1 -1
  171. package/dist/_esm/utils/entities.js +4 -4
  172. package/dist/_esm/utils/entities.js.map +1 -1
  173. package/dist/_esm/utils/expirationTime.d.ts.map +1 -1
  174. package/dist/_esm/utils/expirationTime.js.map +1 -1
  175. package/dist/_esm/utils/payload.js.map +1 -1
  176. package/dist/_types/actions/public/getBlockTiming.d.ts.map +1 -1
  177. package/dist/_types/actions/public/subscribeEntityEvents.d.ts.map +1 -1
  178. package/dist/_types/actions/wallet/changeOwnership.d.ts +22 -0
  179. package/dist/_types/actions/wallet/changeOwnership.d.ts.map +1 -0
  180. package/dist/_types/actions/wallet/createEntity.d.ts +5 -3
  181. package/dist/_types/actions/wallet/createEntity.d.ts.map +1 -1
  182. package/dist/_types/actions/wallet/deleteEntity.d.ts.map +1 -1
  183. package/dist/_types/actions/wallet/extendEntity.d.ts.map +1 -1
  184. package/dist/_types/actions/wallet/mutateEntities.d.ts.map +1 -1
  185. package/dist/_types/actions/wallet/updateEntity.d.ts +6 -4
  186. package/dist/_types/actions/wallet/updateEntity.d.ts.map +1 -1
  187. package/dist/_types/clients/baseClient.d.ts.map +1 -1
  188. package/dist/_types/clients/createPublicClient.d.ts.map +1 -1
  189. package/dist/_types/clients/createWalletClient.d.ts.map +1 -1
  190. package/dist/_types/clients/decorators/arkivPublic.d.ts +0 -2
  191. package/dist/_types/clients/decorators/arkivPublic.d.ts.map +1 -1
  192. package/dist/_types/clients/decorators/arkivWallet.d.ts +15 -5
  193. package/dist/_types/clients/decorators/arkivWallet.d.ts.map +1 -1
  194. package/dist/_types/index.d.ts +1 -1
  195. package/dist/_types/index.d.ts.map +1 -1
  196. package/dist/_types/query/engine.d.ts +1 -1
  197. package/dist/_types/query/engine.d.ts.map +1 -1
  198. package/dist/_types/query/predicate.d.ts.map +1 -1
  199. package/dist/_types/query/queryBuilder.d.ts +5 -5
  200. package/dist/_types/query/queryBuilder.d.ts.map +1 -1
  201. package/dist/_types/query/queryResult.d.ts.map +1 -1
  202. package/dist/_types/types/attributes.d.ts +5 -0
  203. package/dist/_types/types/attributes.d.ts.map +1 -0
  204. package/dist/_types/types/entity.d.ts +5 -3
  205. package/dist/_types/types/entity.d.ts.map +1 -1
  206. package/dist/_types/types/events.d.ts.map +1 -1
  207. package/dist/_types/types/index.d.ts +2 -1
  208. package/dist/_types/types/index.d.ts.map +1 -1
  209. package/dist/_types/types/mimeTypes.d.ts +2 -0
  210. package/dist/_types/types/mimeTypes.d.ts.map +1 -0
  211. package/dist/_types/types/rpcSchema.d.ts +7 -20
  212. package/dist/_types/types/rpcSchema.d.ts.map +1 -1
  213. package/dist/_types/types/txParams.d.ts.map +1 -1
  214. package/dist/_types/utils/arkivTransactions.d.ts +3 -1
  215. package/dist/_types/utils/arkivTransactions.d.ts.map +1 -1
  216. package/dist/_types/utils/compression.d.ts +3 -0
  217. package/dist/_types/utils/compression.d.ts.map +1 -0
  218. package/dist/_types/utils/entities.d.ts.map +1 -1
  219. package/dist/_types/utils/expirationTime.d.ts.map +1 -1
  220. package/package.json +118 -116
  221. package/src/actions/public/buildQuery.ts +1 -1
  222. package/src/actions/public/getBlockTiming.ts +13 -13
  223. package/src/actions/public/getEntity.ts +9 -9
  224. package/src/actions/public/getEntityCount.ts +5 -5
  225. package/src/actions/public/query.ts +6 -6
  226. package/src/actions/public/subscribeEntityEvents.ts +92 -92
  227. package/src/actions/wallet/changeOwnership.ts +40 -0
  228. package/src/actions/wallet/createEntity.ts +20 -18
  229. package/src/actions/wallet/deleteEntity.ts +14 -14
  230. package/src/actions/wallet/extendEntity.ts +15 -15
  231. package/src/actions/wallet/mutateEntities.ts +58 -58
  232. package/src/actions/wallet/updateEntity.ts +21 -19
  233. package/src/chains/kaolin.ts +22 -22
  234. package/src/chains/localhost.ts +10 -10
  235. package/src/chains/marketplace.ts +22 -22
  236. package/src/clients/baseClient.ts +4 -4
  237. package/src/clients/createPublicClient.ts +31 -31
  238. package/src/clients/createWalletClient.ts +35 -35
  239. package/src/clients/decorators/arkivPublic.ts +179 -181
  240. package/src/clients/decorators/arkivWallet.ts +222 -204
  241. package/src/consts.ts +1 -1
  242. package/src/index.ts +8 -8
  243. package/src/query/engine.ts +93 -92
  244. package/src/query/errors.ts +12 -12
  245. package/src/query/predicate.ts +18 -18
  246. package/src/query/queryBuilder.ts +194 -194
  247. package/src/query/queryResult.ts +49 -49
  248. package/src/types/attributes.ts +4 -0
  249. package/src/types/entity.ts +29 -25
  250. package/src/types/events.ts +18 -18
  251. package/src/types/index.ts +2 -1
  252. package/src/types/mimeTypes.ts +27 -0
  253. package/src/types/rpcSchema.ts +46 -53
  254. package/src/types/txParams.ts +14 -14
  255. package/src/utils/arkivTransactions.ts +76 -67
  256. package/src/utils/compression.ts +21 -0
  257. package/src/utils/entities.ts +17 -10
  258. package/src/utils/expirationTime.ts +9 -9
  259. package/src/utils/payload.ts +2 -2
  260. package/dist/_cjs/types/annotation.d.ts +0 -5
  261. package/dist/_cjs/types/annotation.d.ts.map +0 -1
  262. package/dist/_cjs/types/annotation.js.map +0 -1
  263. package/dist/_esm/types/annotation.d.ts +0 -5
  264. package/dist/_esm/types/annotation.d.ts.map +0 -1
  265. package/dist/_esm/types/annotation.js +0 -2
  266. package/dist/_esm/types/annotation.js.map +0 -1
  267. package/dist/_types/types/annotation.d.ts +0 -5
  268. package/dist/_types/types/annotation.d.ts.map +0 -1
  269. package/src/types/annotation.ts +0 -4
@@ -1,232 +1,250 @@
1
1
  import type { Account, Chain, Client, Transport, WalletActions } from "viem"
2
+ import type {
3
+ ChangeOwnershipParameters,
4
+ ChangeOwnershipReturnType,
5
+ } from "../../actions/wallet/changeOwnership"
6
+ import { changeOwnership } from "../../actions/wallet/changeOwnership"
2
7
  import {
3
- type CreateEntityParameters,
4
- type CreateEntityReturnType,
5
- createEntity,
8
+ type CreateEntityParameters,
9
+ type CreateEntityReturnType,
10
+ createEntity,
6
11
  } from "../../actions/wallet/createEntity"
7
12
  import type {
8
- DeleteEntityParameters,
9
- DeleteEntityReturnType,
13
+ DeleteEntityParameters,
14
+ DeleteEntityReturnType,
10
15
  } from "../../actions/wallet/deleteEntity"
11
16
  import { deleteEntity } from "../../actions/wallet/deleteEntity"
12
17
  import type {
13
- ExtendEntityParameters,
14
- ExtendEntityReturnType,
18
+ ExtendEntityParameters,
19
+ ExtendEntityReturnType,
15
20
  } from "../../actions/wallet/extendEntity"
16
21
  import { extendEntity } from "../../actions/wallet/extendEntity"
17
22
  import type {
18
- MutateEntitiesParameters,
19
- MutateEntitiesReturnType,
23
+ MutateEntitiesParameters,
24
+ MutateEntitiesReturnType,
20
25
  } from "../../actions/wallet/mutateEntities"
21
26
  import { mutateEntities } from "../../actions/wallet/mutateEntities"
22
27
  import type {
23
- UpdateEntityParameters,
24
- UpdateEntityReturnType,
28
+ UpdateEntityParameters,
29
+ UpdateEntityReturnType,
25
30
  } from "../../actions/wallet/updateEntity"
26
31
  import { updateEntity } from "../../actions/wallet/updateEntity"
27
-
28
32
  import type { Entity, TxParams } from "../../types"
29
33
  import type { PublicArkivActions } from "./arkivPublic"
30
34
 
31
35
  export type WalletArkivActions<
32
- transport extends Transport = Transport,
33
- chain extends Chain | undefined = Chain | undefined,
34
- account extends Account | undefined = Account | undefined,
36
+ transport extends Transport = Transport,
37
+ chain extends Chain | undefined = Chain | undefined,
38
+ account extends Account | undefined = Account | undefined,
35
39
  > = PublicArkivActions<transport, chain, account> &
36
- Pick<
37
- WalletActions<chain, account>,
38
- | "sendTransaction"
39
- | "sendTransactionSync"
40
- | "sendRawTransaction"
41
- | "sendRawTransactionSync"
42
- | "signMessage"
43
- | "signTransaction"
44
- > & {
45
- /**
46
- * Returns the entity with the given key.
47
- *
48
- * - Docs: https://docs.golemdb.io/ts-sdk/actions/public/getEntity
49
- * - JSON-RPC Methods: [`golembase_getStorageValue`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_getstoragevalue)
50
- * - JSON-RPC Methods: [`golembase_getEntityMetaData`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_getEntityMetaData)
51
- *
52
- * @param args - {entityKey}
53
- * @returns The entity with the given key. {@link Entity}
54
- *
55
- * @example
56
- * import { createPublicClient, http } from 'arkiv'
57
- * import { kaolin } from 'arkiv/chains'
58
- *
59
- * const client = createPublicClient({
60
- * chain: kaolin,
61
- * transport: http(),
62
- * })
63
- * const { entityKey, txHash } = await client.createEntity({
64
- * payload: toBytes(JSON.stringify({ entity: { entityType: "testType", entityId: "testId" } })),
65
- * annotations: [{ key: "testKey", value: "testValue" }],
66
- * expiresIn: 1000,
67
- * })
68
- * console.log("entityKey", entityKey)
69
- * console.log("txHash", txHash)
70
- * // {
71
- * // entityKey: "0x123",
72
- * // txHash: "0x123",
73
- * // }
74
- */
75
- createEntity: (
76
- data: CreateEntityParameters,
77
- txParams?: TxParams,
78
- ) => Promise<CreateEntityReturnType>
40
+ Pick<
41
+ WalletActions<chain, account>,
42
+ | "sendTransaction"
43
+ | "sendTransactionSync"
44
+ | "sendRawTransaction"
45
+ | "sendRawTransactionSync"
46
+ | "signMessage"
47
+ | "signTransaction"
48
+ > & {
49
+ /**
50
+ * Returns the entity with the given key.
51
+ *
52
+ * - Docs: https://docs.golemdb.io/ts-sdk/actions/public/getEntity
53
+ *
54
+ * @param args - {entityKey}
55
+ * @returns The entity with the given key. {@link Entity}
56
+ *
57
+ * @example
58
+ * import { createPublicClient, http } from 'arkiv'
59
+ * import { kaolin } from 'arkiv/chains'
60
+ *
61
+ * const client = createPublicClient({
62
+ * chain: kaolin,
63
+ * transport: http(),
64
+ * })
65
+ * const { entityKey, txHash } = await client.createEntity({
66
+ * payload: toBytes(JSON.stringify({ entity: { entityType: "testType", entityId: "testId" } })),
67
+ * attributes: [{ key: "testKey", value: "testValue" }],
68
+ * expiresIn: 1000,
69
+ * })
70
+ * console.log("entityKey", entityKey)
71
+ * console.log("txHash", txHash)
72
+ * // {
73
+ * // entityKey: "0x123",
74
+ * // txHash: "0x123",
75
+ * // }
76
+ */
77
+ createEntity: (
78
+ data: CreateEntityParameters,
79
+ txParams?: TxParams,
80
+ ) => Promise<CreateEntityReturnType>
81
+
82
+ /**
83
+ * Updates the entity with the given key.
84
+ *
85
+ * - Docs: https://docs.golemdb.io/ts-sdk/actions/wallet/updateEntity
86
+ * - JSON-RPC Methods: [`golembase_updateEntity`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_updateEntity)
87
+ *
88
+ * @param args - {entityKey, data}
89
+ * @returns The entity with the given key. {@link Entity}
90
+ *
91
+ * @example
92
+ * import { createWalletClient, http } from 'arkiv'
93
+ * import { kaolin } from 'arkiv/chains'
94
+ *
95
+ * const client = createWalletClient({
96
+ * chain: kaolin,
97
+ * transport: http(),
98
+ * })
99
+ */
100
+ updateEntity: (
101
+ data: UpdateEntityParameters,
102
+ txParams?: TxParams,
103
+ ) => Promise<UpdateEntityReturnType>
79
104
 
80
- /**
81
- * Updates the entity with the given key.
82
- *
83
- * - Docs: https://docs.golemdb.io/ts-sdk/actions/wallet/updateEntity
84
- * - JSON-RPC Methods: [`golembase_updateEntity`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_updateEntity)
85
- *
86
- * @param args - {entityKey, data}
87
- * @returns The entity with the given key. {@link Entity}
88
- *
89
- * @example
90
- * import { createWalletClient, http } from 'arkiv'
91
- * import { kaolin } from 'arkiv/chains'
92
- *
93
- * const client = createWalletClient({
94
- * chain: kaolin,
95
- * transport: http(),
96
- * })
97
- */
98
- updateEntity: (
99
- data: UpdateEntityParameters,
100
- txParams?: TxParams,
101
- ) => Promise<UpdateEntityReturnType>
105
+ /**
106
+ * Deletes the entity with the given key.
107
+ *
108
+ * - Docs: https://docs.golemdb.io/ts-sdk/actions/wallet/deleteEntity
109
+ * - JSON-RPC Methods: [`golembase_deleteEntity`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_deleteEntity)
110
+ *
111
+ * @param args - {entityKey}
112
+ * @returns The entity with the given key. {@link Entity}
113
+ *
114
+ * @example
115
+ * import { createWalletClient, http } from 'arkiv'
116
+ * import { kaolin } from 'arkiv/chains'
117
+ *
118
+ * const client = createWalletClient({
119
+ * chain: kaolin,
120
+ * transport: http(),
121
+ * })
122
+ * const { entityKey, txHash } = await client.deleteEntity({ entityKey: "0x123" })
123
+ * console.log("entityKey", entityKey)
124
+ * console.log("txHash", txHash)
125
+ * // {
126
+ * // entityKey: "0x123",
127
+ * // txHash: "0x123",
128
+ * // }
129
+ */
130
+ deleteEntity: (
131
+ data: DeleteEntityParameters,
132
+ txParams?: TxParams,
133
+ ) => Promise<DeleteEntityReturnType>
102
134
 
103
- /**
104
- * Deletes the entity with the given key.
105
- *
106
- * - Docs: https://docs.golemdb.io/ts-sdk/actions/wallet/deleteEntity
107
- * - JSON-RPC Methods: [`golembase_deleteEntity`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_deleteEntity)
108
- *
109
- * @param args - {entityKey}
110
- * @returns The entity with the given key. {@link Entity}
111
- *
112
- * @example
113
- * import { createWalletClient, http } from 'arkiv'
114
- * import { kaolin } from 'arkiv/chains'
115
- *
116
- * const client = createWalletClient({
117
- * chain: kaolin,
118
- * transport: http(),
119
- * })
120
- * const { entityKey, txHash } = await client.deleteEntity({ entityKey: "0x123" })
121
- * console.log("entityKey", entityKey)
122
- * console.log("txHash", txHash)
123
- * // {
124
- * // entityKey: "0x123",
125
- * // txHash: "0x123",
126
- * // }
127
- */
128
- deleteEntity: (
129
- data: DeleteEntityParameters,
130
- txParams?: TxParams,
131
- ) => Promise<DeleteEntityReturnType>
135
+ /**
136
+ * Extends the entity with the given key.
137
+ *
138
+ * - Docs: https://docs.golemdb.io/ts-sdk/actions/wallet/extendEntity
139
+ * - JSON-RPC Methods: [`golembase_extendEntity`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_extendEntity)
140
+ *
141
+ * @param args - {entityKey, data}
142
+ * @returns The entity with the given key. {@link Entity}
143
+ *
144
+ * @example
145
+ * import { createWalletClient, http } from 'arkiv'
146
+ * import { kaolin } from 'arkiv/chains'
147
+ *
148
+ * const client = createWalletClient({
149
+ * chain: kaolin,
150
+ * transport: http(),
151
+ * })
152
+ * const { entityKey, txHash } = await client.extendEntity("0x123", {
153
+ * expiresIn: 1000,
154
+ * })
155
+ * console.log("entityKey", entityKey)
156
+ * console.log("txHash", txHash)
157
+ * // {
158
+ * // entityKey: "0x123",
159
+ * // txHash: "0x123",
160
+ * // }
161
+ */
162
+ extendEntity: (
163
+ data: ExtendEntityParameters,
164
+ txParams?: TxParams,
165
+ ) => Promise<ExtendEntityReturnType>
132
166
 
133
- /**
134
- * Extends the entity with the given key.
135
- *
136
- * - Docs: https://docs.golemdb.io/ts-sdk/actions/wallet/extendEntity
137
- * - JSON-RPC Methods: [`golembase_extendEntity`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_extendEntity)
138
- *
139
- * @param args - {entityKey, data}
140
- * @returns The entity with the given key. {@link Entity}
141
- *
142
- * @example
143
- * import { createWalletClient, http } from 'arkiv'
144
- * import { kaolin } from 'arkiv/chains'
145
- *
146
- * const client = createWalletClient({
147
- * chain: kaolin,
148
- * transport: http(),
149
- * })
150
- * const { entityKey, txHash } = await client.extendEntity("0x123", {
151
- * expiresIn: 1000,
152
- * })
153
- * console.log("entityKey", entityKey)
154
- * console.log("txHash", txHash)
155
- * // {
156
- * // entityKey: "0x123",
157
- * // txHash: "0x123",
158
- * // }
159
- */
160
- extendEntity: (
161
- data: ExtendEntityParameters,
162
- txParams?: TxParams,
163
- ) => Promise<ExtendEntityReturnType>
167
+ /**
168
+ * Changes the ownership of the entity with the given address.
169
+ *
170
+ * - Docs: https://docs.golemdb.io/ts-sdk/actions/wallet/changeOwnership
171
+ * - JSON-RPC Methods: [`golembase_ownershipChange`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_ownershipChange)
172
+ *
173
+ * @param args - {entityKey, newOwner}
174
+ * @returns The entity with the given address. {@link Entity}
175
+ */
176
+ changeOwnership: (
177
+ data: ChangeOwnershipParameters,
178
+ txParams?: TxParams,
179
+ ) => Promise<ChangeOwnershipReturnType>
164
180
 
165
- /**
166
- * Mutates the entities with the given keys.
167
- *
168
- * - Docs: https://docs.golemdb.io/ts-sdk/actions/wallet/mutateEntities
169
- * - JSON-RPC Methods: [`golembase_mutateEntities`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_mutateEntities)
170
- *
171
- * @param args - {data}
172
- * @returns The entity with the given key. {@link Entity}
173
- *
174
- * @example
175
- * import { createWalletClient, http } from 'arkiv'
176
- * import { kaolin } from 'arkiv/chains'
177
- *
178
- * const client = createWalletClient({
179
- * chain: kaolin,
180
- * transport: http(),
181
- * })
182
- * const { entityKey, txHash } = await client.mutateEntities({
183
- * creates: [{
184
- * payload: toBytes(JSON.stringify({ entity: { entityType: "testType", entityId: "testId" } })),
185
- * annotations: [{ key: "testKey", value: "testValue" }],
186
- * expiresIn: 1000,
187
- * }],
188
- * updates: [{
189
- * entityKey: "0x123",
190
- * payload: toBytes(JSON.stringify({ entity: { entityType: "testType", entityId: "testId" } })),
191
- * annotations: [{ key: "testKey", value: "testValue" }],
192
- * expiresIn: 1000,
193
- * }],
194
- * deletes: [{
195
- * entityKey: "0x321",
196
- * }],
197
- * extensions: [{
198
- * entityKey: "0x1234",
199
- * expiresIn: 1000,
200
- * }],
201
- * })
202
- * console.log("entityKey", entityKey)
203
- * console.log("txHash", txHash)
204
- * // {
205
- * // entityKey: "0x123",
206
- * // txHash: "0x123",
207
- * // }
208
- */
209
- mutateEntities: (
210
- data: MutateEntitiesParameters,
211
- txParams?: TxParams,
212
- ) => Promise<MutateEntitiesReturnType>
213
- }
181
+ /**
182
+ * Mutates the entities with the given keys.
183
+ *
184
+ * - Docs: https://docs.golemdb.io/ts-sdk/actions/wallet/mutateEntities
185
+ * - JSON-RPC Methods: [`golembase_mutateEntities`](https://docs.golemdb.io/dev/json-rpc-api/#golembase_mutateEntities)
186
+ *
187
+ * @param args - {data}
188
+ * @returns The entity with the given key. {@link Entity}
189
+ *
190
+ * @example
191
+ * import { createWalletClient, http } from 'arkiv'
192
+ * import { kaolin } from 'arkiv/chains'
193
+ *
194
+ * const client = createWalletClient({
195
+ * chain: kaolin,
196
+ * transport: http(),
197
+ * })
198
+ * const { entityKey, txHash } = await client.mutateEntities({
199
+ * creates: [{
200
+ * payload: toBytes(JSON.stringify({ entity: { entityType: "testType", entityId: "testId" } })),
201
+ * attriubutes: [{ key: "testKey", value: "testValue" }],
202
+ * expiresIn: 1000,
203
+ * }],
204
+ * updates: [{
205
+ * entityKey: "0x123",
206
+ * payload: toBytes(JSON.stringify({ entity: { entityType: "testType", entityId: "testId" } })),
207
+ * attributes: [{ key: "testKey", value: "testValue" }],
208
+ * expiresIn: 1000,
209
+ * }],
210
+ * deletes: [{
211
+ * entityKey: "0x321",
212
+ * }],
213
+ * extensions: [{
214
+ * entityKey: "0x1234",
215
+ * expiresIn: 1000,
216
+ * }],
217
+ * })
218
+ * console.log("entityKey", entityKey)
219
+ * console.log("txHash", txHash)
220
+ * // {
221
+ * // entityKey: "0x123",
222
+ * // txHash: "0x123",
223
+ * // }
224
+ */
225
+ mutateEntities: (
226
+ data: MutateEntitiesParameters,
227
+ txParams?: TxParams,
228
+ ) => Promise<MutateEntitiesReturnType>
229
+ }
214
230
 
215
231
  export function walletArkivActions<
216
- transport extends Transport = Transport,
217
- chain extends Chain | undefined = Chain | undefined,
218
- account extends Account | undefined = Account | undefined,
232
+ transport extends Transport = Transport,
233
+ chain extends Chain | undefined = Chain | undefined,
234
+ account extends Account | undefined = Account | undefined,
219
235
  >(client: Client<transport, chain, account>) {
220
- return {
221
- createEntity: (data: CreateEntityParameters, txParams?: TxParams) =>
222
- createEntity(client, data, txParams),
223
- updateEntity: (data: UpdateEntityParameters, txParams?: TxParams) =>
224
- updateEntity(client, data, txParams),
225
- deleteEntity: (data: DeleteEntityParameters, txParams?: TxParams) =>
226
- deleteEntity(client, data, txParams),
227
- extendEntity: (data: ExtendEntityParameters, txParams?: TxParams) =>
228
- extendEntity(client, data, txParams),
229
- mutateEntities: (data: MutateEntitiesParameters, txParams?: TxParams) =>
230
- mutateEntities(client, data, txParams),
231
- }
236
+ return {
237
+ createEntity: (data: CreateEntityParameters, txParams?: TxParams) =>
238
+ createEntity(client, data, txParams),
239
+ updateEntity: (data: UpdateEntityParameters, txParams?: TxParams) =>
240
+ updateEntity(client, data, txParams),
241
+ deleteEntity: (data: DeleteEntityParameters, txParams?: TxParams) =>
242
+ deleteEntity(client, data, txParams),
243
+ extendEntity: (data: ExtendEntityParameters, txParams?: TxParams) =>
244
+ extendEntity(client, data, txParams),
245
+ changeOwnership: (data: ChangeOwnershipParameters, txParams?: TxParams) =>
246
+ changeOwnership(client, data, txParams),
247
+ mutateEntities: (data: MutateEntitiesParameters, txParams?: TxParams) =>
248
+ mutateEntities(client, data, txParams),
249
+ }
232
250
  }
package/src/consts.ts CHANGED
@@ -1,2 +1,2 @@
1
- export const ARKIV_ADDRESS = "0x0000000000000000000000000000000060138453" as `0x${string}`
1
+ export const ARKIV_ADDRESS = "0x00000000000000000000000000000061726b6976" as `0x${string}`
2
2
  export const BLOCK_TIME = 2 // 2 seconds
package/src/index.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  // Export all public APIs
2
2
 
3
3
  export type {
4
- Account,
5
- Address,
6
- Chain,
7
- Hex,
8
- PublicClientConfig,
9
- RpcSchema,
10
- Transport,
4
+ Account,
5
+ Address,
6
+ Chain,
7
+ Hex,
8
+ PublicClientConfig,
9
+ RpcSchema,
10
+ Transport,
11
11
  } from "viem"
12
12
  // Re-export commonly used viem types for convenience
13
13
  export { http, toBytes, toHex, toRlp, webSocket } from "viem"
@@ -16,6 +16,6 @@ export type { PublicArkivClient } from "./clients/createPublicClient"
16
16
  export { createPublicClient } from "./clients/createPublicClient"
17
17
  export type { WalletArkivClient } from "./clients/createWalletClient"
18
18
  export { createWalletClient } from "./clients/createWalletClient"
19
- export type { Annotation } from "./types/annotation"
19
+ export type { Attribute } from "./types/attributes"
20
20
  export type { Entity } from "./types/entity"
21
21
  export type { ArkivRpcSchema } from "./types/rpcSchema"