@arkiv-network/sdk 0.3.2-dev.1 → 0.3.2-dev.3
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.ts +25 -25
- package/dist/{entity-DvQtQL8v.d.ts → entity-0JJeFAgO.d.cts} +1 -5
- package/dist/entity-0JJeFAgO.d.cts.map +1 -0
- package/dist/{entity-jTQZmEAd.d.cts → entity-BG8YycYJ.d.ts} +1 -5
- package/dist/entity-BG8YycYJ.d.ts.map +1 -0
- package/dist/index.cjs +20 -36
- 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 +36 -26
- 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-BBtwhH0G.d.ts → queryBuilder-BNhnpewa.d.ts} +44 -6
- package/dist/queryBuilder-BNhnpewa.d.ts.map +1 -0
- package/dist/{queryBuilder-D22Tamry.js → queryBuilder-CAQ7TDMZ.js} +50 -21
- package/dist/queryBuilder-CAQ7TDMZ.js.map +1 -0
- package/dist/{queryBuilder-D-bqHg3w.cjs → queryBuilder-DEkfSiCF.cjs} +60 -19
- package/dist/{queryBuilder-DkhyyeFr.d.cts → queryBuilder-Dc_ii8LH.d.cts} +44 -6
- 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/actions/public/getEntity.ts +18 -3
- 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 +4 -4
- package/src/query/queryBuilder.test.ts +44 -3
- package/src/query/queryBuilder.ts +80 -10
- package/src/types/rpcSchema.ts +0 -5
- package/dist/entity-DvQtQL8v.d.ts.map +0 -1
- package/dist/entity-jTQZmEAd.d.cts.map +0 -1
- package/dist/queryBuilder-BBtwhH0G.d.ts.map +0 -1
- package/dist/queryBuilder-D22Tamry.js.map +0 -1
- package/dist/queryBuilder-DkhyyeFr.d.cts.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;;;KAvCvB,qCACQ,YAAY,yBAChB,oBAAoB,mCAClB,s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A,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 { bytesToHex, createClient, decodeEventLog, hexToBytes, 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) {
|
|
@@ -19,11 +22,18 @@ async function getBlockTiming(client) {
|
|
|
19
22
|
//#endregion
|
|
20
23
|
//#region src/actions/public/getEntity.ts
|
|
21
24
|
async function getEntity(client, key) {
|
|
25
|
+
let bytes;
|
|
26
|
+
try {
|
|
27
|
+
bytes = hexToBytes(key);
|
|
28
|
+
} catch {
|
|
29
|
+
throw new Error(`Invalid key format: ${key}. Key must be a valid hex string.`);
|
|
30
|
+
}
|
|
31
|
+
if (bytes.length !== 32) throw new Error(`Invalid key length: ${bytes.length} bytes. Key must be 32 bytes (64 hex characters) long.`);
|
|
32
|
+
const hexKey = bytesToHex(bytes);
|
|
22
33
|
const result = await client.request({
|
|
23
34
|
method: "arkiv_query",
|
|
24
|
-
params: [`$key = ${
|
|
35
|
+
params: [`$key = ${hexKey}`]
|
|
25
36
|
});
|
|
26
|
-
console.debug("GetEntity result", result);
|
|
27
37
|
if (!result.data) throw new NoEntityFoundError();
|
|
28
38
|
return entityFromRpcResult(result.data[0]);
|
|
29
39
|
}
|
|
@@ -74,7 +84,7 @@ async function subscribeEntityEvents(client, { onError, onEntityCreated, onEntit
|
|
|
74
84
|
switch (event.eventName) {
|
|
75
85
|
case "ArkivEntityCreated":
|
|
76
86
|
onEntityCreated?.({
|
|
77
|
-
entityKey: toHex
|
|
87
|
+
entityKey: toHex(event.args.entityKey, { size: 32 }),
|
|
78
88
|
owner: event.args.ownerAddress,
|
|
79
89
|
expirationBlock: Number(event.args.expirationBlock),
|
|
80
90
|
cost: event.args.cost
|
|
@@ -82,7 +92,7 @@ async function subscribeEntityEvents(client, { onError, onEntityCreated, onEntit
|
|
|
82
92
|
break;
|
|
83
93
|
case "ArkivEntityUpdated":
|
|
84
94
|
onEntityUpdated?.({
|
|
85
|
-
entityKey: toHex
|
|
95
|
+
entityKey: toHex(event.args.entityKey, { size: 32 }),
|
|
86
96
|
owner: event.args.ownerAddress,
|
|
87
97
|
oldExpirationBlock: Number(event.args.oldExpirationBlock),
|
|
88
98
|
newExpirationBlock: Number(event.args.newExpirationBlock),
|
|
@@ -91,13 +101,13 @@ async function subscribeEntityEvents(client, { onError, onEntityCreated, onEntit
|
|
|
91
101
|
break;
|
|
92
102
|
case "ArkivEntityDeleted":
|
|
93
103
|
onEntityDeleted?.({
|
|
94
|
-
entityKey: toHex
|
|
104
|
+
entityKey: toHex(event.args.entityKey, { size: 32 }),
|
|
95
105
|
owner: event.args.ownerAddress
|
|
96
106
|
});
|
|
97
107
|
break;
|
|
98
108
|
case "ArkivEntityBTLExtended":
|
|
99
109
|
onEntityExpiresInExtended?.({
|
|
100
|
-
entityKey: toHex
|
|
110
|
+
entityKey: toHex(event.args.entityKey, { size: 32 }),
|
|
101
111
|
owner: event.args.ownerAddress,
|
|
102
112
|
oldExpirationBlock: Number(event.args.oldExpirationBlock),
|
|
103
113
|
newExpirationBlock: Number(event.args.newExpirationBlock),
|
|
@@ -106,13 +116,13 @@ async function subscribeEntityEvents(client, { onError, onEntityCreated, onEntit
|
|
|
106
116
|
break;
|
|
107
117
|
case "ArkivEntityExpired":
|
|
108
118
|
onEntityExpired?.({
|
|
109
|
-
entityKey: toHex
|
|
119
|
+
entityKey: toHex(event.args.entityKey, { size: 32 }),
|
|
110
120
|
owner: event.args.ownerAddress
|
|
111
121
|
});
|
|
112
122
|
break;
|
|
113
123
|
case "ArkivEntityOwnerChanged":
|
|
114
124
|
onEntityOwnerChanged?.({
|
|
115
|
-
entityKey: toHex
|
|
125
|
+
entityKey: toHex(event.args.entityKey, { size: 32 }),
|
|
116
126
|
oldOwner: event.args.oldOwnerAddress,
|
|
117
127
|
newOwner: event.args.newOwnerAddress
|
|
118
128
|
});
|
|
@@ -155,9 +165,9 @@ function publicArkivActions(client) {
|
|
|
155
165
|
/**
|
|
156
166
|
* 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
167
|
*
|
|
158
|
-
* - Docs: https://docs.
|
|
168
|
+
* - Docs: https://docs.arkiv.network/ts-sdk/clients/public
|
|
159
169
|
*
|
|
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.
|
|
170
|
+
* 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
171
|
*
|
|
162
172
|
* @param config - {@link PublicClientConfig}
|
|
163
173
|
* @returns A Arkiv Public Client. {@link PublicArkivClient}
|
|
@@ -234,30 +244,30 @@ async function compress(data) {
|
|
|
234
244
|
//#region src/utils/arkivTransactions.ts
|
|
235
245
|
function opsToTxData({ creates, updates, deletes, extensions, ownershipChanges }) {
|
|
236
246
|
function formatAttributes(attribute) {
|
|
237
|
-
return [toHex
|
|
247
|
+
return [toHex(attribute.key), toHex(attribute.value)];
|
|
238
248
|
}
|
|
239
249
|
const payload = [
|
|
240
250
|
(creates ?? []).map((item) => [
|
|
241
|
-
toHex
|
|
242
|
-
toHex
|
|
243
|
-
toHex
|
|
251
|
+
toHex(item.expiresIn / BLOCK_TIME),
|
|
252
|
+
toHex(item.contentType),
|
|
253
|
+
toHex(item.payload),
|
|
244
254
|
item.attributes.filter((attribute) => typeof attribute.value === "string").map(formatAttributes),
|
|
245
255
|
item.attributes.filter((attribute) => typeof attribute.value === "number").map(formatAttributes)
|
|
246
256
|
]),
|
|
247
257
|
(updates ?? []).map((item) => [
|
|
248
258
|
item.entityKey,
|
|
249
|
-
toHex
|
|
250
|
-
toHex
|
|
251
|
-
toHex
|
|
259
|
+
toHex(item.contentType),
|
|
260
|
+
toHex(item.expiresIn / BLOCK_TIME),
|
|
261
|
+
toHex(item.payload),
|
|
252
262
|
item.attributes.filter((attribute) => typeof attribute.value === "string").map(formatAttributes),
|
|
253
263
|
item.attributes.filter((attribute) => typeof attribute.value === "number").map(formatAttributes)
|
|
254
264
|
]),
|
|
255
265
|
(deletes ?? []).map((item) => item.entityKey),
|
|
256
|
-
(extensions ?? []).map((item) => [item.entityKey, toHex
|
|
266
|
+
(extensions ?? []).map((item) => [item.entityKey, toHex(item.expiresIn / BLOCK_TIME)]),
|
|
257
267
|
(ownershipChanges ?? []).map((item) => [item.entityKey, item.newOwner])
|
|
258
268
|
];
|
|
259
269
|
console.debug("txData to send as RLP", payload, payload.length);
|
|
260
|
-
return toRlp
|
|
270
|
+
return toRlp(payload);
|
|
261
271
|
}
|
|
262
272
|
async function sendArkivTransaction(client, data, txParams) {
|
|
263
273
|
if (!client.account) throw new Error("Account required");
|
|
@@ -270,13 +280,13 @@ async function sendArkivTransaction(client, data, txParams) {
|
|
|
270
280
|
data,
|
|
271
281
|
...txParams
|
|
272
282
|
});
|
|
273
|
-
const compressed = await compress(toBytes
|
|
283
|
+
const compressed = await compress(toBytes(data));
|
|
274
284
|
const txHash = await walletClient.sendTransaction({
|
|
275
285
|
account: client.account,
|
|
276
286
|
chain: client.chain,
|
|
277
287
|
to: ARKIV_ADDRESS,
|
|
278
288
|
value: 0n,
|
|
279
|
-
data: toHex
|
|
289
|
+
data: toHex(compressed),
|
|
280
290
|
...txParams
|
|
281
291
|
});
|
|
282
292
|
const receipt = await walletClient.waitForTransactionReceipt({ hash: txHash });
|
|
@@ -413,9 +423,9 @@ function walletArkivActions(client) {
|
|
|
413
423
|
/**
|
|
414
424
|
* 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
425
|
*
|
|
416
|
-
* - Docs: https://docs.
|
|
426
|
+
* - Docs: https://docs.arkiv.network/ts-sdk/clients/public
|
|
417
427
|
*
|
|
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.
|
|
428
|
+
* 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
429
|
*
|
|
420
430
|
* @param config - {@link PublicClientConfig}
|
|
421
431
|
* @returns A Arkiv Public Client. {@link PublicArkivClient}
|
|
@@ -439,5 +449,5 @@ function createWalletClient(parameters) {
|
|
|
439
449
|
}
|
|
440
450
|
|
|
441
451
|
//#endregion
|
|
442
|
-
export { createPublicClient, createWalletClient
|
|
452
|
+
export { createPublicClient, createWalletClient };
|
|
443
453
|
//# sourceMappingURL=index.js.map
|