@arkiv-network/sdk 0.4.2 → 0.4.4

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 CHANGED
@@ -32,9 +32,9 @@ mkdir arkiv-sample
32
32
  cd arkiv-sample
33
33
  ```
34
34
 
35
- Create an empty `index.ts` file:
35
+ Create an empty `read_example.ts` file:
36
36
  ```bash
37
- touch index.ts
37
+ touch read_example.ts
38
38
  ```
39
39
 
40
40
  Initialize a new JavaScript/TypeScript project:
@@ -59,7 +59,7 @@ After this step, a `package.json` file will be created with content similar to:
59
59
  }
60
60
  ```
61
61
 
62
- Modify the `"main"` entry to `"index.ts"` and set `"type"` to `"module"` so your `package.json` looks like this:
62
+ Modify the `"main"` entry to `"read_example.ts"` and set `"type"` to `"module"` so your `package.json` looks like this:
63
63
 
64
64
  ```json
65
65
  {
@@ -69,7 +69,7 @@ Modify the `"main"` entry to `"index.ts"` and set `"type"` to `"module"` so your
69
69
  "license": "ISC",
70
70
  "author": "",
71
71
  "type": "module",
72
- "main": "index.ts",
72
+ "main": "read_example.ts",
73
73
  "scripts": {
74
74
  "test": "echo \"Error: no test specified\" && exit 1"
75
75
  }
@@ -83,14 +83,14 @@ npm install @arkiv-network/sdk
83
83
  This command will update your `package.json` with a section like:
84
84
  ```json
85
85
  "dependencies": {
86
- "@arkiv-network/sdk": "^0.4.2"
86
+ "@arkiv-network/sdk": "^0.4.4"
87
87
  }
88
88
  ```
89
89
  It will also create a `node_modules` directory with all dependencies installed.
90
90
 
91
91
  ### Public Client Example (Query Data)
92
92
 
93
- To query data from Arkiv, use the following sample code in `index.ts`:
93
+ You can now use Arkiv's public client to query data. Paste the following in `read_example.ts`:
94
94
 
95
95
  ```typescript
96
96
  import { createPublicClient, http } from "@arkiv-network/sdk"
@@ -135,12 +135,12 @@ You have several options to run your TypeScript sample:
135
135
 
136
136
  - **With Node.js (using experimental TypeScript support):**
137
137
  ```bash
138
- node --experimental-strip-types index.ts
138
+ node --experimental-strip-types read_example.ts
139
139
  ```
140
140
 
141
141
  - **With Bun (native TypeScript support):**
142
142
  ```bash
143
- bun index.ts
143
+ bun read_example.ts
144
144
  ```
145
145
 
146
146
  - **Classic Node.js (using transpilation to JavaScript):**
@@ -158,26 +158,28 @@ You have several options to run your TypeScript sample:
158
158
  ```bash
159
159
  npx tsc --outDir dist
160
160
  ```
161
- This creates a `dist` directory containing `index.js` (the transpiled code), along with corresponding type declaration and source map files.
161
+ This creates a `dist` directory containing `read_example.js` (the transpiled code), along with corresponding type declaration and source map files.
162
162
  4. Run the transpiled script:
163
163
  ```bash
164
- node dist/index.js
164
+ node dist/read_example.js
165
165
  ```
166
166
 
167
167
  ### Wallet Client Example (Create Entity)
168
168
 
169
- Now, let's add storage functionality.
170
- First, import the required modules at the top of your `index.ts`:
169
+ Now let's add storage (write) functionality.
170
+ Create a file named `write_example.ts` with the following content:
171
171
 
172
172
  ```typescript
173
- import { createWalletClient } from '@arkiv-network/sdk';
174
- import { ExpirationTime, jsonToPayload } from '@arkiv-network/sdk/utils';
175
- import { privateKeyToAccount } from '@arkiv-network/sdk/accounts';
176
- ```
177
-
178
- Then, add the following example below your query code to create an entity:
173
+ import { createPublicClient, createWalletClient, http } from "@arkiv-network/sdk"
174
+ import { privateKeyToAccount } from "@arkiv-network/sdk/accounts"
175
+ import { mendoza } from "@arkiv-network/sdk/chains"
176
+ import { ExpirationTime, jsonToPayload } from "@arkiv-network/sdk/utils"
179
177
 
180
- ```typescript
178
+ // Create a public client
179
+ const publicClient = createPublicClient({
180
+ chain: mendoza, // mendoza is the Arkiv testnet for the purposes of hackathons organized in Buenos Aires during devconnect 2025
181
+ transport: http(),
182
+ })
181
183
  // Create a wallet client with an account
182
184
  const client = createWalletClient({
183
185
  chain: mendoza,
@@ -209,6 +211,23 @@ const newEntity = await publicClient.getEntity(entityKey);
209
211
  console.log('Entity:', newEntity);
210
212
  ```
211
213
 
214
+ Now you can run it in the same way as in the previous example:
215
+ - **With Node.js (using experimental TypeScript support):**
216
+ ```bash
217
+ node --experimental-strip-types write_example.ts
218
+ ```
219
+
220
+ - **With Bun (native TypeScript support):**
221
+ ```bash
222
+ bun write_example.ts
223
+ ```
224
+
225
+ - **Classic Node.js (using transpilation to JavaScript):**
226
+ ```bash
227
+ npx tsc --outDir dist
228
+ node dist/write_example.js
229
+ ```
230
+
212
231
  **Note:**
213
232
  You must provide your own private key with a minimum balance on the Arkiv L3 network.
214
233
  You can generate a private key using any tool, for example: https://vanity-eth.tk/
@@ -221,7 +240,7 @@ For quick testing, you may use this example key:
221
240
  ```
222
241
  However, funds may not always be available for this key.
223
242
 
224
- The full example code can be found in the `sample` directory of this repository.
243
+ Sample code can also be found in the [`sample`](./sample) directory of this repository.
225
244
 
226
245
  ## Package Distribution
227
246
 
@@ -1,4 +1,4 @@
1
- import * as viem8 from "viem";
1
+ import * as viem0 from "viem";
2
2
 
3
3
  //#region src/chains/kaolin.d.ts
4
4
  declare const kaolin: {
@@ -11,13 +11,13 @@ declare const kaolin: {
11
11
  };
12
12
  blockTime?: number | undefined | undefined;
13
13
  contracts?: {
14
- [x: string]: viem8.ChainContract | {
15
- [sourceId: number]: viem8.ChainContract | undefined;
14
+ [x: string]: viem0.ChainContract | {
15
+ [sourceId: number]: viem0.ChainContract | undefined;
16
16
  } | undefined;
17
- ensRegistry?: viem8.ChainContract | undefined;
18
- ensUniversalResolver?: viem8.ChainContract | undefined;
19
- multicall3?: viem8.ChainContract | undefined;
20
- erc6492Verifier?: viem8.ChainContract | undefined;
17
+ ensRegistry?: viem0.ChainContract | undefined;
18
+ ensUniversalResolver?: viem0.ChainContract | undefined;
19
+ multicall3?: viem0.ChainContract | undefined;
20
+ erc6492Verifier?: viem0.ChainContract | undefined;
21
21
  } | undefined;
22
22
  ensTlds?: readonly string[] | undefined;
23
23
  id: 60138453025;
@@ -37,9 +37,9 @@ declare const kaolin: {
37
37
  sourceId?: number | undefined | undefined;
38
38
  testnet: true;
39
39
  custom?: Record<string, unknown> | undefined;
40
- fees?: viem8.ChainFees<undefined> | undefined;
40
+ fees?: viem0.ChainFees<undefined> | undefined;
41
41
  formatters?: undefined;
42
- serializers?: viem8.ChainSerializers<undefined, viem8.TransactionSerializable> | undefined;
42
+ serializers?: viem0.ChainSerializers<undefined, viem0.TransactionSerializable> | undefined;
43
43
  readonly network: "kaolin";
44
44
  };
45
45
  //#endregion
@@ -59,13 +59,13 @@ declare const localhost: {
59
59
  } | undefined | undefined;
60
60
  blockTime?: number | undefined | undefined;
61
61
  contracts?: {
62
- [x: string]: viem8.ChainContract | {
63
- [sourceId: number]: viem8.ChainContract | undefined;
62
+ [x: string]: viem0.ChainContract | {
63
+ [sourceId: number]: viem0.ChainContract | undefined;
64
64
  } | undefined;
65
- ensRegistry?: viem8.ChainContract | undefined;
66
- ensUniversalResolver?: viem8.ChainContract | undefined;
67
- multicall3?: viem8.ChainContract | undefined;
68
- erc6492Verifier?: viem8.ChainContract | undefined;
65
+ ensRegistry?: viem0.ChainContract | undefined;
66
+ ensUniversalResolver?: viem0.ChainContract | undefined;
67
+ multicall3?: viem0.ChainContract | undefined;
68
+ erc6492Verifier?: viem0.ChainContract | undefined;
69
69
  } | undefined;
70
70
  ensTlds?: readonly string[] | undefined;
71
71
  id: 1337;
@@ -84,9 +84,9 @@ declare const localhost: {
84
84
  sourceId?: number | undefined | undefined;
85
85
  testnet?: boolean | undefined | undefined;
86
86
  custom?: Record<string, unknown> | undefined;
87
- fees?: viem8.ChainFees<undefined> | undefined;
87
+ fees?: viem0.ChainFees<undefined> | undefined;
88
88
  formatters?: undefined;
89
- serializers?: viem8.ChainSerializers<undefined, viem8.TransactionSerializable> | undefined;
89
+ serializers?: viem0.ChainSerializers<undefined, viem0.TransactionSerializable> | undefined;
90
90
  };
91
91
  //#endregion
92
92
  //#region src/chains/marketplace.d.ts
@@ -100,13 +100,13 @@ declare const marketplace: {
100
100
  };
101
101
  blockTime?: number | undefined | undefined;
102
102
  contracts?: {
103
- [x: string]: viem8.ChainContract | {
104
- [sourceId: number]: viem8.ChainContract | undefined;
103
+ [x: string]: viem0.ChainContract | {
104
+ [sourceId: number]: viem0.ChainContract | undefined;
105
105
  } | undefined;
106
- ensRegistry?: viem8.ChainContract | undefined;
107
- ensUniversalResolver?: viem8.ChainContract | undefined;
108
- multicall3?: viem8.ChainContract | undefined;
109
- erc6492Verifier?: viem8.ChainContract | undefined;
106
+ ensRegistry?: viem0.ChainContract | undefined;
107
+ ensUniversalResolver?: viem0.ChainContract | undefined;
108
+ multicall3?: viem0.ChainContract | undefined;
109
+ erc6492Verifier?: viem0.ChainContract | undefined;
110
110
  } | undefined;
111
111
  ensTlds?: readonly string[] | undefined;
112
112
  id: 60138453027;
@@ -126,9 +126,9 @@ declare const marketplace: {
126
126
  sourceId?: number | undefined | undefined;
127
127
  testnet: true;
128
128
  custom?: Record<string, unknown> | undefined;
129
- fees?: viem8.ChainFees<undefined> | undefined;
129
+ fees?: viem0.ChainFees<undefined> | undefined;
130
130
  formatters?: undefined;
131
- serializers?: viem8.ChainSerializers<undefined, viem8.TransactionSerializable> | undefined;
131
+ serializers?: viem0.ChainSerializers<undefined, viem0.TransactionSerializable> | undefined;
132
132
  readonly network: "marketplace";
133
133
  };
134
134
  //#endregion
@@ -143,13 +143,13 @@ declare const mendoza: {
143
143
  };
144
144
  blockTime?: number | undefined | undefined;
145
145
  contracts?: {
146
- [x: string]: viem8.ChainContract | {
147
- [sourceId: number]: viem8.ChainContract | undefined;
146
+ [x: string]: viem0.ChainContract | {
147
+ [sourceId: number]: viem0.ChainContract | undefined;
148
148
  } | undefined;
149
- ensRegistry?: viem8.ChainContract | undefined;
150
- ensUniversalResolver?: viem8.ChainContract | undefined;
151
- multicall3?: viem8.ChainContract | undefined;
152
- erc6492Verifier?: viem8.ChainContract | undefined;
149
+ ensRegistry?: viem0.ChainContract | undefined;
150
+ ensUniversalResolver?: viem0.ChainContract | undefined;
151
+ multicall3?: viem0.ChainContract | undefined;
152
+ erc6492Verifier?: viem0.ChainContract | undefined;
153
153
  } | undefined;
154
154
  ensTlds?: readonly string[] | undefined;
155
155
  id: 60138453056;
@@ -169,9 +169,9 @@ declare const mendoza: {
169
169
  sourceId?: number | undefined | undefined;
170
170
  testnet: true;
171
171
  custom?: Record<string, unknown> | undefined;
172
- fees?: viem8.ChainFees<undefined> | undefined;
172
+ fees?: viem0.ChainFees<undefined> | undefined;
173
173
  formatters?: undefined;
174
- serializers?: viem8.ChainSerializers<undefined, viem8.TransactionSerializable> | undefined;
174
+ serializers?: viem0.ChainSerializers<undefined, viem0.TransactionSerializable> | undefined;
175
175
  readonly network: "mendoza";
176
176
  };
177
177
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkiv-network/sdk",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "TypeScript client library for Arkiv's blockchains interactions",
5
5
  "type": "module",
6
6
  "target": "esnext",