@arkiv-network/sdk 0.3.2-dev.0 → 0.3.2-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/chains/index.d.cts +25 -25
- package/dist/chains/index.d.cts.map +1 -1
- package/dist/chains/index.d.ts +25 -25
- package/dist/{entity-o4fwHXKf.d.ts → entity-0JJeFAgO.d.cts} +7 -5
- package/dist/entity-0JJeFAgO.d.cts.map +1 -0
- package/dist/{entity-OY78HYxA.d.cts → entity-BG8YycYJ.d.ts} +7 -5
- package/dist/entity-BG8YycYJ.d.ts.map +1 -0
- package/dist/index.cjs +11 -34
- package/dist/index.d.cts +40 -38
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +40 -38
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -24
- package/dist/index.js.map +1 -1
- package/dist/query/index.cjs +3 -1
- package/dist/query/index.d.cts +3 -3
- package/dist/query/index.d.ts +3 -3
- package/dist/query/index.js +2 -2
- package/dist/{queryBuilder-CboWSREN.d.ts → queryBuilder-BNhnpewa.d.ts} +56 -3
- package/dist/queryBuilder-BNhnpewa.d.ts.map +1 -0
- package/dist/{queryBuilder-BueP5de6.js → queryBuilder-CAQ7TDMZ.js} +60 -4
- package/dist/queryBuilder-CAQ7TDMZ.js.map +1 -0
- package/dist/{queryBuilder-n9ocnT4P.cjs → queryBuilder-DEkfSiCF.cjs} +70 -2
- package/dist/{queryBuilder-Bm1zGqKA.d.cts → queryBuilder-Dc_ii8LH.d.cts} +56 -3
- package/dist/queryBuilder-Dc_ii8LH.d.cts.map +1 -0
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types-CBTc19th.cjs +0 -0
- package/dist/types-Cv8NMtbo.js +0 -0
- package/dist/utils/index.d.cts.map +1 -1
- package/package.json +1 -1
- package/src/clients/createPublicClient.ts +2 -2
- package/src/clients/createWalletClient.ts +2 -2
- package/src/clients/decorators/arkivPublic.ts +2 -2
- package/src/clients/decorators/arkivWallet.ts +12 -11
- package/src/index.ts +3 -34
- package/src/query/engine.test.ts +69 -0
- package/src/query/engine.ts +8 -3
- package/src/query/queryBuilder.test.ts +76 -1
- package/src/query/queryBuilder.ts +103 -0
- package/src/types/rpcSchema.ts +7 -5
- package/dist/entity-OY78HYxA.d.cts.map +0 -1
- package/dist/entity-o4fwHXKf.d.ts.map +0 -1
- package/dist/queryBuilder-Bm1zGqKA.d.cts.map +0 -1
- package/dist/queryBuilder-BueP5de6.js.map +0 -1
- package/dist/queryBuilder-CboWSREN.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
import { _ as ArkivRpcSchema, a as MutateEntitiesReturnType, b as RpcQueryOptions, c as ExtendEntityParameters, d as DeleteEntityReturnType, f as CreateEntityParameters, g as ArkivClient, h as ChangeOwnershipReturnType, i as MutateEntitiesParameters, l as ExtendEntityReturnType, m as ChangeOwnershipParameters, n as TxParams, o as UpdateEntityParameters, p as CreateEntityReturnType, r as Attribute, s as UpdateEntityReturnType, t as Entity, u as DeleteEntityParameters, v as RpcEntity, x as MimeType, y as RpcIncludeData } from "./entity-
|
|
2
|
-
import { t as QueryBuilder } from "./queryBuilder-
|
|
3
|
-
import { Account,
|
|
1
|
+
import { _ as ArkivRpcSchema, a as MutateEntitiesReturnType, b as RpcQueryOptions, c as ExtendEntityParameters, d as DeleteEntityReturnType, f as CreateEntityParameters, g as ArkivClient, h as ChangeOwnershipReturnType, i as MutateEntitiesParameters, l as ExtendEntityReturnType, m as ChangeOwnershipParameters, n as TxParams, o as UpdateEntityParameters, p as CreateEntityReturnType, r as Attribute, s as UpdateEntityReturnType, t as Entity, u as DeleteEntityParameters, v as RpcEntity, x as MimeType, y as RpcIncludeData } from "./entity-BG8YycYJ.js";
|
|
2
|
+
import { t as QueryBuilder } from "./queryBuilder-BNhnpewa.js";
|
|
3
|
+
import { Account, Address, Chain, Client, Hex, ParseAccount, Prettify, PublicActions, PublicClientConfig, RpcSchema, Transport, WalletActions, WalletClientConfig } from "viem";
|
|
4
|
+
export * from "viem";
|
|
4
5
|
|
|
5
6
|
//#region src/types/events.d.ts
|
|
6
7
|
type OnEntityCreatedEvent = {
|
|
7
|
-
entityKey: Hex
|
|
8
|
-
owner: Hex
|
|
8
|
+
entityKey: Hex;
|
|
9
|
+
owner: Hex;
|
|
9
10
|
expirationBlock: number;
|
|
10
11
|
cost: bigint;
|
|
11
12
|
};
|
|
12
13
|
type OnEntityUpdatedEvent = {
|
|
13
|
-
entityKey: Hex
|
|
14
|
-
owner: Hex
|
|
14
|
+
entityKey: Hex;
|
|
15
|
+
owner: Hex;
|
|
15
16
|
oldExpirationBlock: number;
|
|
16
17
|
newExpirationBlock: number;
|
|
17
18
|
cost: bigint;
|
|
18
19
|
};
|
|
19
20
|
type OnEntityDeletedEvent = {
|
|
20
|
-
entityKey: Hex
|
|
21
|
-
owner: Hex
|
|
21
|
+
entityKey: Hex;
|
|
22
|
+
owner: Hex;
|
|
22
23
|
};
|
|
23
24
|
type OnEntityExpiredEvent = {
|
|
24
|
-
entityKey: Hex
|
|
25
|
-
owner: Hex
|
|
25
|
+
entityKey: Hex;
|
|
26
|
+
owner: Hex;
|
|
26
27
|
};
|
|
27
28
|
type OnEntityExpiresInExtendedEvent = {
|
|
28
|
-
entityKey: Hex
|
|
29
|
-
owner: Hex
|
|
29
|
+
entityKey: Hex;
|
|
30
|
+
owner: Hex;
|
|
30
31
|
oldExpirationBlock: number;
|
|
31
32
|
newExpirationBlock: number;
|
|
32
33
|
cost: bigint;
|
|
33
34
|
};
|
|
34
35
|
//#endregion
|
|
35
36
|
//#region src/clients/decorators/arkivPublic.d.ts
|
|
36
|
-
type PublicArkivActions<transport extends Transport
|
|
37
|
+
type PublicArkivActions<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = Pick<PublicActions<transport, chain, account>, "getBalance" | "getBlock" | "getBlockNumber" | "getChainId" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "waitForTransactionReceipt" | "watchEvent"> & {
|
|
37
38
|
/**
|
|
38
39
|
* Returns the entity with the given key.
|
|
39
40
|
*
|
|
40
|
-
* - Docs: https://docs.
|
|
41
|
+
* - Docs: https://docs.arkiv.network/ts-sdk/actions/public/getEntity
|
|
41
42
|
*
|
|
42
43
|
* @param args - {entityKey}
|
|
43
44
|
* @returns The entity with the given key. {@link Entity}
|
|
@@ -56,12 +57,12 @@ type PublicArkivActions<transport extends Transport$1 = Transport$1, chain exten
|
|
|
56
57
|
* // value: "0x123",
|
|
57
58
|
* // }
|
|
58
59
|
*/
|
|
59
|
-
getEntity: (key: Hex
|
|
60
|
+
getEntity: (key: Hex) => Promise<Entity>;
|
|
60
61
|
/**
|
|
61
62
|
* Returns a QueryBuilder instance for building and executing queries.
|
|
62
63
|
* The QueryBuilder object follows the Builder pattern, allowing you to chain methods to build a query and then execute it.
|
|
63
64
|
*
|
|
64
|
-
* - Docs: https://docs.
|
|
65
|
+
* - Docs: https://docs.arkiv.network/ts-sdk/actions/public/query
|
|
65
66
|
*
|
|
66
67
|
* @returns A QueryBuilder instance for building and executing queries. {@link QueryBuilder}
|
|
67
68
|
*
|
|
@@ -151,13 +152,13 @@ type PublicArkivActions<transport extends Transport$1 = Transport$1, chain exten
|
|
|
151
152
|
};
|
|
152
153
|
//#endregion
|
|
153
154
|
//#region src/clients/createPublicClient.d.ts
|
|
154
|
-
type PublicArkivClient<transport extends Transport
|
|
155
|
+
type PublicArkivClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, accountOrAddress extends Account | undefined = undefined, rpcSchema extends RpcSchema | undefined = ArkivRpcSchema> = Prettify<Client<transport, chain, accountOrAddress, rpcSchema, PublicArkivActions<transport, chain>>>;
|
|
155
156
|
/**
|
|
156
157
|
* Creates a Public Client with a given [Transport](https://viem.sh/docs/clients/intro) configured for a [Chain](https://viem.sh/docs/clients/chains).
|
|
157
158
|
*
|
|
158
|
-
* - Docs: https://docs.
|
|
159
|
+
* - Docs: https://docs.arkiv.network/ts-sdk/clients/public
|
|
159
160
|
*
|
|
160
|
-
* A Public Client is an interface to "public" [Ethereum JSON-RPC API](https://ethereum.org/en/developers/docs/apis/json-rpc/), [Arkiv JSON-RPC API](https://docs.
|
|
161
|
+
* A Public Client is an interface to "public" [Ethereum JSON-RPC API](https://ethereum.org/en/developers/docs/apis/json-rpc/), [Arkiv JSON-RPC API](https://docs.arkiv.network/json-rpc/), and [Kaolin JSON-RPC API](https://kaolin.holesky.arkiv.network/rpc) methods such as retrieving block numbers, transactions, reading from smart contracts, etc through [Public Actions](/docs/actions/public/introduction).
|
|
161
162
|
*
|
|
162
163
|
* @param config - {@link PublicClientConfig}
|
|
163
164
|
* @returns A Arkiv Public Client. {@link PublicArkivClient}
|
|
@@ -171,14 +172,15 @@ type PublicArkivClient<transport extends Transport$1 = Transport$1, chain extend
|
|
|
171
172
|
* transport: http(),
|
|
172
173
|
* })
|
|
173
174
|
*/
|
|
174
|
-
declare function createPublicClient<transport extends Transport
|
|
175
|
+
declare function createPublicClient<transport extends Transport, chain extends Chain | undefined = undefined, accountOrAddress extends Account | Address | undefined = undefined, rpcSchema extends RpcSchema | undefined = ArkivRpcSchema>(parameters: PublicClientConfig<transport, chain, accountOrAddress, rpcSchema>): PublicArkivClient<transport, chain, ParseAccount<accountOrAddress>, rpcSchema>;
|
|
175
176
|
//#endregion
|
|
176
177
|
//#region src/clients/decorators/arkivWallet.d.ts
|
|
177
|
-
type WalletArkivActions<transport extends Transport
|
|
178
|
+
type WalletArkivActions<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = Pick<PublicActions<transport, chain, account>, "waitForTransactionReceipt"> & Pick<WalletActions<chain, account>, "addChain" | "sendTransaction" | "sendTransactionSync" | "sendRawTransaction" | "sendRawTransactionSync" | "signMessage" | "signTransaction"> & {
|
|
178
179
|
/**
|
|
179
180
|
* Returns the entity with the given key.
|
|
180
181
|
*
|
|
181
|
-
* - Docs: https://docs.
|
|
182
|
+
* - Docs: https://docs.arkiv.network/ts-sdk/actions/public/getEntity
|
|
183
|
+
* - JSON-RPC Methods: [`eth_sendRawTransaction`](https://docs.arkiv.network/dev/json-rpc-api/#mutateEntities)
|
|
182
184
|
*
|
|
183
185
|
* @param args - {entityKey}
|
|
184
186
|
* @returns The entity with the given key. {@link Entity}
|
|
@@ -207,8 +209,8 @@ type WalletArkivActions<transport extends Transport$1 = Transport$1, chain exten
|
|
|
207
209
|
/**
|
|
208
210
|
* Updates the entity with the given key.
|
|
209
211
|
*
|
|
210
|
-
* - Docs: https://docs.
|
|
211
|
-
* - JSON-RPC Methods: [`
|
|
212
|
+
* - Docs: https://docs.arkiv.network/ts-sdk/actions/wallet/updateEntity
|
|
213
|
+
* - JSON-RPC Methods: [`eth_sendRawTransaction`](https://docs.arkiv.network/dev/json-rpc-api/#mutateEntities)
|
|
212
214
|
*
|
|
213
215
|
* @param args - {entityKey, data}
|
|
214
216
|
* @returns The entity with the given key. {@link Entity}
|
|
@@ -226,8 +228,8 @@ type WalletArkivActions<transport extends Transport$1 = Transport$1, chain exten
|
|
|
226
228
|
/**
|
|
227
229
|
* Deletes the entity with the given key.
|
|
228
230
|
*
|
|
229
|
-
* - Docs: https://docs.
|
|
230
|
-
* - JSON-RPC Methods: [`
|
|
231
|
+
* - Docs: https://docs.arkiv.network/ts-sdk/actions/wallet/deleteEntity
|
|
232
|
+
* - JSON-RPC Methods: [`eth_sendRawTransaction`](https://docs.arkiv.network/dev/json-rpc-api/#mutateEntities)
|
|
231
233
|
*
|
|
232
234
|
* @param args - {entityKey}
|
|
233
235
|
* @returns The entity with the given key. {@link Entity}
|
|
@@ -252,8 +254,8 @@ type WalletArkivActions<transport extends Transport$1 = Transport$1, chain exten
|
|
|
252
254
|
/**
|
|
253
255
|
* Extends the entity with the given key.
|
|
254
256
|
*
|
|
255
|
-
* - Docs: https://docs.
|
|
256
|
-
* - JSON-RPC Methods: [`
|
|
257
|
+
* - Docs: https://docs.arkiv.network/ts-sdk/actions/wallet/extendEntity
|
|
258
|
+
* - JSON-RPC Methods: [`eth_sendRawTransaction`](https://docs.arkiv.network/dev/json-rpc-api/#mutateEntities)
|
|
257
259
|
*
|
|
258
260
|
* @param args - {entityKey, data}
|
|
259
261
|
* @returns The entity with the given key. {@link Entity}
|
|
@@ -280,8 +282,8 @@ type WalletArkivActions<transport extends Transport$1 = Transport$1, chain exten
|
|
|
280
282
|
/**
|
|
281
283
|
* Changes the ownership of the entity with the given address.
|
|
282
284
|
*
|
|
283
|
-
* - Docs: https://docs.
|
|
284
|
-
* - JSON-RPC Methods: [`
|
|
285
|
+
* - Docs: https://docs.arkiv.network/ts-sdk/actions/wallet/changeOwnership
|
|
286
|
+
* - JSON-RPC Methods: [`eth_sendRawTransaction`](https://docs.arkiv.network/dev/json-rpc-api/#mutateEntities)
|
|
285
287
|
*
|
|
286
288
|
* @param args - {entityKey, newOwner}
|
|
287
289
|
* @returns The entity with the given address. {@link Entity}
|
|
@@ -290,8 +292,8 @@ type WalletArkivActions<transport extends Transport$1 = Transport$1, chain exten
|
|
|
290
292
|
/**
|
|
291
293
|
* Mutates the entities with the given keys.
|
|
292
294
|
*
|
|
293
|
-
* - Docs: https://docs.
|
|
294
|
-
* - JSON-RPC Methods: [`golembase_mutateEntities`](https://docs.
|
|
295
|
+
* - Docs: https://docs.arkiv.network/ts-sdk/actions/wallet/mutateEntities
|
|
296
|
+
* - JSON-RPC Methods: [`golembase_mutateEntities`](https://docs.arkiv.network/dev/json-rpc-api/#golembase_mutateEntities)
|
|
295
297
|
*
|
|
296
298
|
* @param args - {data}
|
|
297
299
|
* @returns The entity with the given key. {@link Entity}
|
|
@@ -335,13 +337,13 @@ type WalletArkivActions<transport extends Transport$1 = Transport$1, chain exten
|
|
|
335
337
|
};
|
|
336
338
|
//#endregion
|
|
337
339
|
//#region src/clients/createWalletClient.d.ts
|
|
338
|
-
type WalletArkivClient<transport extends Transport
|
|
340
|
+
type WalletArkivClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined, rpcSchema extends RpcSchema | undefined = ArkivRpcSchema> = Prettify<Client<transport, chain, account, rpcSchema, WalletArkivActions<transport, chain, account>>>;
|
|
339
341
|
/**
|
|
340
342
|
* Creates a Public Client with a given [Transport](https://viem.sh/docs/clients/intro) configured for a [Chain](https://viem.sh/docs/clients/chains).
|
|
341
343
|
*
|
|
342
|
-
* - Docs: https://docs.
|
|
344
|
+
* - Docs: https://docs.arkiv.network/ts-sdk/clients/public
|
|
343
345
|
*
|
|
344
|
-
* A Public Client is an interface to "public" [Ethereum JSON-RPC API](https://ethereum.org/en/developers/docs/apis/json-rpc/), [Arkiv JSON-RPC API](https://docs.
|
|
346
|
+
* A Public Client is an interface to "public" [Ethereum JSON-RPC API](https://ethereum.org/en/developers/docs/apis/json-rpc/), [Arkiv JSON-RPC API](https://docs.arkiv.network/json-rpc/), and [Kaolin JSON-RPC API](https://kaolin.holesky.arkiv.network/rpc) methods such as retrieving block numbers, transactions, reading from smart contracts, etc through [Public Actions](/docs/actions/public/introduction).
|
|
345
347
|
*
|
|
346
348
|
* @param config - {@link PublicClientConfig}
|
|
347
349
|
* @returns A Arkiv Public Client. {@link PublicArkivClient}
|
|
@@ -355,7 +357,7 @@ type WalletArkivClient<transport extends Transport$1 = Transport$1, chain extend
|
|
|
355
357
|
* transport: http(),
|
|
356
358
|
* })
|
|
357
359
|
*/
|
|
358
|
-
declare function createWalletClient<transport extends Transport
|
|
360
|
+
declare function createWalletClient<transport extends Transport, chain extends Chain | undefined = undefined, accountOrAddress extends Account | Address | undefined = undefined, rpcSchema extends RpcSchema | undefined = ArkivRpcSchema>(parameters: WalletClientConfig<transport, chain, accountOrAddress, rpcSchema>): WalletArkivClient<transport, chain, ParseAccount<accountOrAddress>, rpcSchema>;
|
|
359
361
|
//#endregion
|
|
360
|
-
export { type
|
|
362
|
+
export { type ArkivClient, ArkivRpcSchema, Attribute, ChangeOwnershipParameters, ChangeOwnershipReturnType, CreateEntityParameters, CreateEntityReturnType, DeleteEntityParameters, DeleteEntityReturnType, Entity, ExtendEntityParameters, ExtendEntityReturnType, MimeType, MutateEntitiesParameters, MutateEntitiesReturnType, type PublicArkivClient, RpcEntity, RpcIncludeData, RpcQueryOptions, TxParams, UpdateEntityParameters, UpdateEntityReturnType, type WalletArkivClient, createPublicClient, createWalletClient };
|
|
361
363
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types/events.ts","../src/clients/decorators/arkivPublic.ts","../src/clients/createPublicClient.ts","../src/clients/decorators/arkivWallet.ts","../src/clients/createWalletClient.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types/events.ts","../src/clients/decorators/arkivPublic.ts","../src/clients/createPublicClient.ts","../src/clients/decorators/arkivWallet.ts","../src/clients/createWalletClient.ts"],"sourcesContent":[],"mappings":";;;;;;KAEY,oBAAA;aACC;SACJ;;;;AAFG,KAOA,oBAAA,GAPoB;EAOpB,SAAA,EACC,GADD;EAQA,KAAA,EANH,GAMG;EAKA,kBAAA,EAAA,MAAoB;EAKpB,kBAAA,EAAA,MAAA;;;KAVA,oBAAA;ECDA,SAAA,EDEC,GCFD;EACQ,KAAA,EDEX,GCFW;CAAY;AAChB,KDIJ,oBAAA,GCJI;EAAoB,SAAA,EDKvB,GCLuB;EAClB,KAAA,EDKT,GCLS;CAAsB;AAExB,KDMJ,8BAAA,GCNI;EAAW,SAAA,EDOd,GCPc;EAAO,KAAA,EDQzB,GCRyB;EAAhC,kBAAA,EAAA,MAAA;EADE,kBAAA,EAAA,MAAA;EAmCe,IAAA,EAAA,MAAA;CAAgB;;;KAv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P,SH1BO,GAAA,SAAA,GG0BiB,cH1BjB,CAAA,CAAA,UAAA,EG4Bb,kBH5Ba,CG4BM,SH5BN,EG4BiB,KH5BjB,EG4BwB,gBH5BxB,EG4B0C,SH5B1C,CAAA,CAAA,EG6BxB,iBH7BwB,CG6BN,SH7BM,EG6BK,KH7BL,EG6BY,YH7BZ,CG6ByB,gBH7BzB,CAAA,EG6B4C,SH7B5C,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as entityFromRpcResult, s as NoEntityFoundError, t as QueryBuilder } from "./queryBuilder-CAQ7TDMZ.js";
|
|
2
2
|
import { n as BLOCK_TIME, t as ARKIV_ADDRESS } from "./consts-CHtLBwGd.js";
|
|
3
|
-
import
|
|
3
|
+
import "./types-Cv8NMtbo.js";
|
|
4
|
+
import { createClient, decodeEventLog, parseAbi, publicActions, toBytes, toHex, toRlp, walletActions } from "viem";
|
|
5
|
+
|
|
6
|
+
export * from "viem"
|
|
4
7
|
|
|
5
8
|
//#region src/actions/public/getBlockTiming.ts
|
|
6
9
|
async function getBlockTiming(client) {
|
|
@@ -74,7 +77,7 @@ async function subscribeEntityEvents(client, { onError, onEntityCreated, onEntit
|
|
|
74
77
|
switch (event.eventName) {
|
|
75
78
|
case "ArkivEntityCreated":
|
|
76
79
|
onEntityCreated?.({
|
|
77
|
-
entityKey: toHex
|
|
80
|
+
entityKey: toHex(event.args.entityKey, { size: 32 }),
|
|
78
81
|
owner: event.args.ownerAddress,
|
|
79
82
|
expirationBlock: Number(event.args.expirationBlock),
|
|
80
83
|
cost: event.args.cost
|
|
@@ -82,7 +85,7 @@ async function subscribeEntityEvents(client, { onError, onEntityCreated, onEntit
|
|
|
82
85
|
break;
|
|
83
86
|
case "ArkivEntityUpdated":
|
|
84
87
|
onEntityUpdated?.({
|
|
85
|
-
entityKey: toHex
|
|
88
|
+
entityKey: toHex(event.args.entityKey, { size: 32 }),
|
|
86
89
|
owner: event.args.ownerAddress,
|
|
87
90
|
oldExpirationBlock: Number(event.args.oldExpirationBlock),
|
|
88
91
|
newExpirationBlock: Number(event.args.newExpirationBlock),
|
|
@@ -91,13 +94,13 @@ async function subscribeEntityEvents(client, { onError, onEntityCreated, onEntit
|
|
|
91
94
|
break;
|
|
92
95
|
case "ArkivEntityDeleted":
|
|
93
96
|
onEntityDeleted?.({
|
|
94
|
-
entityKey: toHex
|
|
97
|
+
entityKey: toHex(event.args.entityKey, { size: 32 }),
|
|
95
98
|
owner: event.args.ownerAddress
|
|
96
99
|
});
|
|
97
100
|
break;
|
|
98
101
|
case "ArkivEntityBTLExtended":
|
|
99
102
|
onEntityExpiresInExtended?.({
|
|
100
|
-
entityKey: toHex
|
|
103
|
+
entityKey: toHex(event.args.entityKey, { size: 32 }),
|
|
101
104
|
owner: event.args.ownerAddress,
|
|
102
105
|
oldExpirationBlock: Number(event.args.oldExpirationBlock),
|
|
103
106
|
newExpirationBlock: Number(event.args.newExpirationBlock),
|
|
@@ -106,13 +109,13 @@ async function subscribeEntityEvents(client, { onError, onEntityCreated, onEntit
|
|
|
106
109
|
break;
|
|
107
110
|
case "ArkivEntityExpired":
|
|
108
111
|
onEntityExpired?.({
|
|
109
|
-
entityKey: toHex
|
|
112
|
+
entityKey: toHex(event.args.entityKey, { size: 32 }),
|
|
110
113
|
owner: event.args.ownerAddress
|
|
111
114
|
});
|
|
112
115
|
break;
|
|
113
116
|
case "ArkivEntityOwnerChanged":
|
|
114
117
|
onEntityOwnerChanged?.({
|
|
115
|
-
entityKey: toHex
|
|
118
|
+
entityKey: toHex(event.args.entityKey, { size: 32 }),
|
|
116
119
|
oldOwner: event.args.oldOwnerAddress,
|
|
117
120
|
newOwner: event.args.newOwnerAddress
|
|
118
121
|
});
|
|
@@ -155,9 +158,9 @@ function publicArkivActions(client) {
|
|
|
155
158
|
/**
|
|
156
159
|
* Creates a Public Client with a given [Transport](https://viem.sh/docs/clients/intro) configured for a [Chain](https://viem.sh/docs/clients/chains).
|
|
157
160
|
*
|
|
158
|
-
* - Docs: https://docs.
|
|
161
|
+
* - Docs: https://docs.arkiv.network/ts-sdk/clients/public
|
|
159
162
|
*
|
|
160
|
-
* A Public Client is an interface to "public" [Ethereum JSON-RPC API](https://ethereum.org/en/developers/docs/apis/json-rpc/), [Arkiv JSON-RPC API](https://docs.
|
|
163
|
+
* A Public Client is an interface to "public" [Ethereum JSON-RPC API](https://ethereum.org/en/developers/docs/apis/json-rpc/), [Arkiv JSON-RPC API](https://docs.arkiv.network/json-rpc/), and [Kaolin JSON-RPC API](https://kaolin.holesky.arkiv.network/rpc) methods such as retrieving block numbers, transactions, reading from smart contracts, etc through [Public Actions](/docs/actions/public/introduction).
|
|
161
164
|
*
|
|
162
165
|
* @param config - {@link PublicClientConfig}
|
|
163
166
|
* @returns A Arkiv Public Client. {@link PublicArkivClient}
|
|
@@ -234,30 +237,30 @@ async function compress(data) {
|
|
|
234
237
|
//#region src/utils/arkivTransactions.ts
|
|
235
238
|
function opsToTxData({ creates, updates, deletes, extensions, ownershipChanges }) {
|
|
236
239
|
function formatAttributes(attribute) {
|
|
237
|
-
return [toHex
|
|
240
|
+
return [toHex(attribute.key), toHex(attribute.value)];
|
|
238
241
|
}
|
|
239
242
|
const payload = [
|
|
240
243
|
(creates ?? []).map((item) => [
|
|
241
|
-
toHex
|
|
242
|
-
toHex
|
|
243
|
-
toHex
|
|
244
|
+
toHex(item.expiresIn / BLOCK_TIME),
|
|
245
|
+
toHex(item.contentType),
|
|
246
|
+
toHex(item.payload),
|
|
244
247
|
item.attributes.filter((attribute) => typeof attribute.value === "string").map(formatAttributes),
|
|
245
248
|
item.attributes.filter((attribute) => typeof attribute.value === "number").map(formatAttributes)
|
|
246
249
|
]),
|
|
247
250
|
(updates ?? []).map((item) => [
|
|
248
251
|
item.entityKey,
|
|
249
|
-
toHex
|
|
250
|
-
toHex
|
|
251
|
-
toHex
|
|
252
|
+
toHex(item.contentType),
|
|
253
|
+
toHex(item.expiresIn / BLOCK_TIME),
|
|
254
|
+
toHex(item.payload),
|
|
252
255
|
item.attributes.filter((attribute) => typeof attribute.value === "string").map(formatAttributes),
|
|
253
256
|
item.attributes.filter((attribute) => typeof attribute.value === "number").map(formatAttributes)
|
|
254
257
|
]),
|
|
255
258
|
(deletes ?? []).map((item) => item.entityKey),
|
|
256
|
-
(extensions ?? []).map((item) => [item.entityKey, toHex
|
|
259
|
+
(extensions ?? []).map((item) => [item.entityKey, toHex(item.expiresIn / BLOCK_TIME)]),
|
|
257
260
|
(ownershipChanges ?? []).map((item) => [item.entityKey, item.newOwner])
|
|
258
261
|
];
|
|
259
262
|
console.debug("txData to send as RLP", payload, payload.length);
|
|
260
|
-
return toRlp
|
|
263
|
+
return toRlp(payload);
|
|
261
264
|
}
|
|
262
265
|
async function sendArkivTransaction(client, data, txParams) {
|
|
263
266
|
if (!client.account) throw new Error("Account required");
|
|
@@ -270,13 +273,13 @@ async function sendArkivTransaction(client, data, txParams) {
|
|
|
270
273
|
data,
|
|
271
274
|
...txParams
|
|
272
275
|
});
|
|
273
|
-
const compressed = await compress(toBytes
|
|
276
|
+
const compressed = await compress(toBytes(data));
|
|
274
277
|
const txHash = await walletClient.sendTransaction({
|
|
275
278
|
account: client.account,
|
|
276
279
|
chain: client.chain,
|
|
277
280
|
to: ARKIV_ADDRESS,
|
|
278
281
|
value: 0n,
|
|
279
|
-
data: toHex
|
|
282
|
+
data: toHex(compressed),
|
|
280
283
|
...txParams
|
|
281
284
|
});
|
|
282
285
|
const receipt = await walletClient.waitForTransactionReceipt({ hash: txHash });
|
|
@@ -413,9 +416,9 @@ function walletArkivActions(client) {
|
|
|
413
416
|
/**
|
|
414
417
|
* Creates a Public Client with a given [Transport](https://viem.sh/docs/clients/intro) configured for a [Chain](https://viem.sh/docs/clients/chains).
|
|
415
418
|
*
|
|
416
|
-
* - Docs: https://docs.
|
|
419
|
+
* - Docs: https://docs.arkiv.network/ts-sdk/clients/public
|
|
417
420
|
*
|
|
418
|
-
* A Public Client is an interface to "public" [Ethereum JSON-RPC API](https://ethereum.org/en/developers/docs/apis/json-rpc/), [Arkiv JSON-RPC API](https://docs.
|
|
421
|
+
* A Public Client is an interface to "public" [Ethereum JSON-RPC API](https://ethereum.org/en/developers/docs/apis/json-rpc/), [Arkiv JSON-RPC API](https://docs.arkiv.network/json-rpc/), and [Kaolin JSON-RPC API](https://kaolin.holesky.arkiv.network/rpc) methods such as retrieving block numbers, transactions, reading from smart contracts, etc through [Public Actions](/docs/actions/public/introduction).
|
|
419
422
|
*
|
|
420
423
|
* @param config - {@link PublicClientConfig}
|
|
421
424
|
* @returns A Arkiv Public Client. {@link PublicArkivClient}
|
|
@@ -439,5 +442,5 @@ function createWalletClient(parameters) {
|
|
|
439
442
|
}
|
|
440
443
|
|
|
441
444
|
//#endregion
|
|
442
|
-
export { createPublicClient, createWalletClient
|
|
445
|
+
export { createPublicClient, createWalletClient };
|
|
443
446
|
//# sourceMappingURL=index.js.map
|