@hiero-ledger/sdk 2.79.0 → 2.80.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.
- package/README.md +168 -11
- package/dist/umd.js +13 -12
- package/dist/umd.min.js +4 -4
- package/lib/ExchangeRate.cjs +1 -1
- package/lib/ExchangeRate.js +1 -1
- package/lib/ExchangeRate.js.map +1 -1
- package/lib/Executable.cjs +3 -1
- package/lib/Executable.js +1 -1
- package/lib/Executable.js.map +1 -1
- package/lib/Timestamp.cjs +2 -2
- package/lib/Timestamp.js +1 -1
- package/lib/Timestamp.js.map +1 -1
- package/lib/client/addressbooks/mainnet.cjs +1 -1
- package/lib/client/addressbooks/mainnet.d.ts +1 -1
- package/lib/client/addressbooks/mainnet.js +1 -1
- package/lib/client/addressbooks/mainnet.js.map +1 -1
- package/lib/version.js +1 -1
- package/package.json +9 -9
- package/src/ExchangeRate.js +2 -2
- package/src/Executable.js +3 -1
- package/src/Timestamp.js +2 -2
- package/src/client/addressbooks/mainnet.js +1 -1
package/README.md
CHANGED
|
@@ -72,6 +72,55 @@ After downloading the repo run:
|
|
|
72
72
|
|
|
73
73
|
2. `task build` to build the SDK
|
|
74
74
|
|
|
75
|
+
## Development
|
|
76
|
+
|
|
77
|
+
### Local Development Workflow
|
|
78
|
+
|
|
79
|
+
The SDK uses `pnpm workspaces` to manage its monorepo structure with sub-packages (`@hiero-ledger/proto` and `@hiero-ledger/cryptography`). For local development and testing the SDK in other projects, use the following workflow:
|
|
80
|
+
|
|
81
|
+
#### Build and Link Globally
|
|
82
|
+
|
|
83
|
+
Build the SDK and link it globally for use in other local projects:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
task build:dev
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
This command:
|
|
90
|
+
- Builds all packages (`proto`, `cryptography`, and the main SDK)
|
|
91
|
+
- Creates global symlinks for all three packages
|
|
92
|
+
- Allows you to use the local SDK in any other project on your machine
|
|
93
|
+
|
|
94
|
+
#### Use in Another Project
|
|
95
|
+
|
|
96
|
+
In your other project, link to the globally linked SDK:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
cd /path/to/your/other/project
|
|
100
|
+
pnpm link --global @hiero-ledger/sdk
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Now any changes you make to the SDK and rebuild will be immediately available in your project.
|
|
104
|
+
|
|
105
|
+
#### Unlink and Clean
|
|
106
|
+
|
|
107
|
+
When you're done with local development:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# In the hiero-sdk-js repository
|
|
111
|
+
task clean
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
This removes all global links and cleans up `node_modules`.
|
|
115
|
+
|
|
116
|
+
To unlink in your other project:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# In your other project
|
|
120
|
+
pnpm unlink @hiero-ledger/sdk
|
|
121
|
+
pnpm install
|
|
122
|
+
```
|
|
123
|
+
|
|
75
124
|
## React Native Support
|
|
76
125
|
|
|
77
126
|
The Hiero JavaScript SDK provides comprehensive support for React Native environments, including Expo. To ensure seamless integration, follow the guidelines based on your Expo version:
|
|
@@ -141,17 +190,125 @@ Every example can be executed using the following command from the root director
|
|
|
141
190
|
|
|
142
191
|
For detailed information on configuring the SDK, including environment variables and client settings, please refer to the [CONFIGURATION.md](./manual/CONFIGURATION.md) file.
|
|
143
192
|
|
|
144
|
-
##
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
193
|
+
## Local Development Setup
|
|
194
|
+
|
|
195
|
+
For contributors and developers who want to run integration tests locally, we provide **Solo** - the official Hiero local network solution. Solo provides a production-like Kubernetes-based environment with multiple consensus nodes and mirror node services.
|
|
196
|
+
|
|
197
|
+
### Quick Setup
|
|
198
|
+
|
|
199
|
+
1. **Install dependencies:**
|
|
200
|
+
```bash
|
|
201
|
+
task install
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Important:** This installs Solo and all project dependencies. Must be run before setup.
|
|
205
|
+
|
|
206
|
+
2. **Set up Solo local network:**
|
|
207
|
+
```bash
|
|
208
|
+
task solo:setup
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
This will automatically:
|
|
212
|
+
- Create a local Kubernetes cluster with Kind
|
|
213
|
+
- Deploy a 2-node consensus network (default: v0.69.1)
|
|
214
|
+
- Deploy mirror node services (default: v0.145.2)
|
|
215
|
+
- Create a dedicated ECDSA test account
|
|
216
|
+
- Generate a `.env` file with all necessary credentials
|
|
217
|
+
|
|
218
|
+
**Optional:** Specify custom versions or use local build:
|
|
219
|
+
```bash
|
|
220
|
+
# Custom consensus node version
|
|
221
|
+
task solo:setup -- --consensus-node-version v0.70.0
|
|
222
|
+
|
|
223
|
+
# Custom mirror node version
|
|
224
|
+
task solo:setup -- --mirror-node-version v0.146.0
|
|
225
|
+
|
|
226
|
+
# Both custom versions
|
|
227
|
+
task solo:setup -- --consensus-node-version v0.70.0 --mirror-node-version v0.146.0
|
|
228
|
+
|
|
229
|
+
# Use local build (overrides consensus-node-version)
|
|
230
|
+
task solo:setup -- --local-build-path ../hiero-consensus-node/hedera-node/data
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
3. **(Required for dynamic address book tests) Configure hosts:**
|
|
234
|
+
|
|
235
|
+
Before running dynamic address book tests, add Kubernetes service names to your `/etc/hosts` file:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
echo "127.0.0.1 network-node1-svc.solo.svc.cluster.local" | sudo tee -a /etc/hosts
|
|
239
|
+
echo "127.0.0.1 envoy-proxy-node1-svc.solo.svc.cluster.local" | sudo tee -a /etc/hosts
|
|
240
|
+
echo "127.0.0.1 network-node2-svc.solo.svc.cluster.local" | sudo tee -a /etc/hosts
|
|
241
|
+
echo "127.0.0.1 envoy-proxy-node2-svc.solo.svc.cluster.local" | sudo tee -a /etc/hosts
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**Note:** This is required for dynamic address book tests to pass. Skip if you're only running other integration tests.
|
|
245
|
+
|
|
246
|
+
4. **Run integration tests:**
|
|
247
|
+
```bash
|
|
248
|
+
task test:integration
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
5. **Teardown when done:**
|
|
252
|
+
```bash
|
|
253
|
+
task solo:teardown
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
For detailed setup instructions, troubleshooting, and advanced usage, see the [Solo Setup Guide](./manual/SOLO_SETUP.md).
|
|
257
|
+
|
|
258
|
+
### Prerequisites
|
|
259
|
+
|
|
260
|
+
Before setting up Solo, ensure you have:
|
|
261
|
+
- Docker Desktop (or Docker Engine)
|
|
262
|
+
- Kind (Kubernetes in Docker)
|
|
263
|
+
- kubectl
|
|
264
|
+
- Node.js v18+ (comes with npm/npx)
|
|
265
|
+
|
|
266
|
+
See the [Solo Setup Guide](./manual/SOLO_SETUP.md#prerequisites) for installation instructions.
|
|
267
|
+
|
|
268
|
+
## Running Tests
|
|
269
|
+
|
|
270
|
+
### Unit Tests
|
|
271
|
+
|
|
272
|
+
Unit tests do not require a local network and can be run directly:
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
task test:unit
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Or separately for Node.js and browser:
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
task test:unit:node
|
|
282
|
+
task test:unit:browser
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Integration Tests
|
|
286
|
+
|
|
287
|
+
Integration tests require a running local network. After setting up Solo (see above):
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
# Run all integration tests
|
|
291
|
+
task test:integration
|
|
292
|
+
|
|
293
|
+
# Run Node.js integration tests only
|
|
294
|
+
task test:integration:node
|
|
295
|
+
|
|
296
|
+
# Run browser integration tests only
|
|
297
|
+
task test:integration:browser
|
|
298
|
+
|
|
299
|
+
# Run dual-mode tests
|
|
300
|
+
task test:integration:dual-mode
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
#### Running Dynamic Address Book Tests
|
|
304
|
+
|
|
305
|
+
Dynamic address book tests require the `/etc/hosts` configuration described in step 3 of the setup. These tests validate that the SDK can correctly handle node address changes and reconnections using Kubernetes service names.
|
|
306
|
+
|
|
307
|
+
**Note:** All integration tests should pass reliably with the Solo setup. If you encounter failures:
|
|
308
|
+
1. Verify Solo is running: `task solo:status`
|
|
309
|
+
2. For dynamic address book test failures, ensure `/etc/hosts` is configured (see setup step 3)
|
|
310
|
+
3. Check the troubleshooting section in the [Solo Setup Guide](./manual/SOLO_SETUP.md#troubleshooting)
|
|
311
|
+
4. Try a fresh setup: `task solo:teardown && task solo:setup`
|
|
155
312
|
|
|
156
313
|
## Contributing
|
|
157
314
|
|