wao 0.30.2 → 0.31.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/esm/hb.js CHANGED
@@ -21,55 +21,6 @@ class HB {
21
21
  } = {}) {
22
22
  this.cu = cu
23
23
  this.url = url
24
- this.dev = {}
25
- this.dev.hyperbuddy = {
26
- metrics: async (args = {}) => {
27
- return this.parseMetrics(
28
- await this.fetch(
29
- this.path({ dev: "hyperbuddy", path: "metrics", json: false }),
30
- false
31
- )
32
- )
33
- },
34
- }
35
- this.dev.json = {
36
- commit: async args => {
37
- return await this.post({ path: "/~json@1.0/commit", ...args })
38
- },
39
- verify: async args => {
40
- return await this.post({ path: "/~json@1.0/verify", ...args })
41
- },
42
- deserialize: async args => {
43
- return await this.post({ path: "/~json@1.0/deserialize", ...args })
44
- },
45
- serialize: async args => {
46
- return await this.post({ path: "/~json@1.0/serialize", ...args })
47
- },
48
- }
49
- this.dev.meta = {
50
- info: async (args = {}) => {
51
- let { method = "GET", json = true, key } = args
52
- if (method.toLowerCase() === "post") {
53
- return await this.post({ path: "/~meta@1.0/info", ...args })
54
- } else {
55
- return key
56
- ? await this.fetch(
57
- this.path({
58
- dev: "meta",
59
- path: `info/${key}`,
60
- json: args.json ?? false,
61
- }),
62
- args.json ?? false
63
- )
64
- : await this.fetch(
65
- this.path({ dev: "meta", path: "info", json: json })
66
- )
67
- }
68
- },
69
- build: async () => {
70
- return await this.fetch(this.path({ dev: "meta", path: "build" }))
71
- },
72
- }
73
24
  if (jwk) this._init(jwk)
74
25
  }
75
26
  async signEncoded(encoded) {
@@ -81,6 +32,7 @@ class HB {
81
32
  url: this.url,
82
33
  })
83
34
  }
35
+
84
36
  _init(jwk) {
85
37
  this.jwk = jwk
86
38
  this.signer = createSigner(jwk, this.url)
@@ -97,11 +49,17 @@ class HB {
97
49
  this._request = request
98
50
  }
99
51
 
52
+ async setInfo() {
53
+ if (!this._info) {
54
+ try {
55
+ this._info = await this.g("/~meta@1.0/info")
56
+ } catch (e) {}
57
+ }
58
+ }
59
+
100
60
  async init(jwk) {
101
61
  this._init(jwk)
102
- try {
103
- this._info = await this.dev.meta.info({})
104
- } catch (e) {}
62
+ await this.setInfo()
105
63
  return this
106
64
  }
107
65
 
@@ -122,6 +80,7 @@ class HB {
122
80
  this.lua ??= id
123
81
  return id
124
82
  }
83
+
125
84
  async scheduleAOS({ pid, action = "Eval", tags = {}, data }) {
126
85
  pid ??= this.pid
127
86
  let _tags = mergeLeft(tags, {
@@ -129,71 +88,26 @@ class HB {
129
88
  method: "POST",
130
89
  path: `/${pid}~process@1.0/schedule`,
131
90
  scheduler: this.scheduler,
132
- Type: "Message",
91
+ type: "Message",
133
92
  Action: action,
134
- Target: pid,
93
+ target: pid,
135
94
  })
136
95
  if (data) _tags.data = data
137
96
  let res = await this.post(_tags)
138
97
  const slot = res.headers.slot
139
98
  return { slot, res, pid }
140
99
  }
100
+
141
101
  async messageAOS(args) {
142
102
  const { slot, pid } = await this.scheduleAOS(args)
143
103
  return { slot, outbox: await this.computeAOS({ pid, slot }) }
144
104
  }
105
+
145
106
  async messageLegacy(args) {
146
107
  const { slot, pid } = await this.scheduleLegacy(args)
147
108
  console.log(slot, pid, args)
148
109
  return { slot, res: await this.computeLegacy({ pid, slot }) }
149
110
  }
150
- path({
151
- dev = "message",
152
- path,
153
- json = true,
154
- params = {},
155
- pid = "",
156
- tail = "",
157
- }) {
158
- if (!/@/.test(dev)) dev += "@1.0"
159
- let _params = ""
160
- if (!isEmpty(params)) {
161
- let i = 0
162
- for (const k in params) {
163
- _params += `${i === 0 ? "?" : "&"}${k}=${params[k]}`
164
- i++
165
- }
166
- }
167
- if (path && !/^\//.test(path)) path = "/" + path
168
- return `/${pid}~${dev}${path ?? ""}${tail}${json ? "/~json@1.0/serialize" : ""}${_params}`
169
- }
170
-
171
- async text(dev, path, params = {}, tail) {
172
- let pid = ""
173
- if (/^[a-zA-Z0-9_-]{43}$/.test(dev)) {
174
- pid = dev
175
- dev = "process"
176
- }
177
- return await this.fetch(
178
- this.path({ dev, path, json: false, params, pid, tail }),
179
- false
180
- )
181
- }
182
-
183
- async json(dev, path, params = {}, tail) {
184
- let pid = ""
185
- if (/^[a-zA-Z0-9_-]{43}$/.test(dev)) {
186
- pid = dev
187
- dev = "process"
188
- }
189
- return await this.fetch(
190
- this.path({ dev, path, json: true, params, pid, tail })
191
- )
192
- }
193
-
194
- async fetch(path, json = true) {
195
- return await fetch(this.url + path).then(r => (json ? r.json() : r.text()))
196
- }
197
111
 
198
112
  async computeAOS({ pid, slot }) {
199
113
  return await this.getJSON({ path: `/${pid}/compute/results/outbox`, slot })
@@ -214,14 +128,14 @@ class HB {
214
128
  }
215
129
 
216
130
  async spawn(tags = {}) {
217
- const addr = await this.dev.meta.info({ key: "address" })
131
+ const addr = await this.g("/~meta@1.0/info/address")
218
132
  this.scheduler ??= addr
219
133
  const _tags = mergeLeft(tags, {
220
134
  device: "process@1.0",
221
135
  path: "/schedule",
222
136
  scheduler: this.scheduler,
223
137
  "random-seed": seed(16),
224
- Type: "Process",
138
+ type: "Process",
225
139
  "execution-device": "test-device@1.0",
226
140
  })
227
141
  const res = await this.post(_tags)
@@ -246,12 +160,14 @@ class HB {
246
160
  const res = await this.post({ path: "/~wao@1.0/cache_module", data, type })
247
161
  return res.headers.id
248
162
  }
163
+
249
164
  async message(args) {
250
165
  const pid = args.pid
251
166
  const { slot } = await this.schedule(args)
252
167
  const res = await this.compute({ pid, slot })
253
168
  return { slot, pid, res }
254
169
  }
170
+
255
171
  async scheduleLegacy({
256
172
  pid,
257
173
  action = "Eval",
@@ -262,16 +178,18 @@ class HB {
262
178
  if (action) tags.Action = action
263
179
  return await this.schedule({ pid, tags, data, scheduler })
264
180
  }
181
+
265
182
  async scheduleLua(...args) {
266
183
  return await this.scheduleLegacy(...args)
267
184
  }
185
+
268
186
  async schedule({ pid, tags = {}, data } = {}) {
269
187
  pid ??= this.pid
270
188
  let _tags = mergeLeft(tags, {
271
189
  method: "POST",
272
190
  path: `/${pid}/schedule`,
273
- Type: "Message",
274
- Target: pid,
191
+ type: "Message",
192
+ target: pid,
275
193
  })
276
194
  if (data) _tags.data = data
277
195
  let res = await this.post(_tags)
@@ -279,19 +197,19 @@ class HB {
279
197
  }
280
198
 
281
199
  async spawnAOS(image) {
282
- const addr = await this.dev.meta.info({ key: "address" })
200
+ const addr = await this.g("/~meta@1.0/info/address")
283
201
  this.scheduler ??= addr
284
202
  image ??= this.image ?? (await this.getImage())
285
203
  const res = await this.post({
286
204
  device: "process@1.0",
287
205
  path: "/schedule",
288
206
  scheduler: this.scheduler,
289
- "Data-Protocol": "ao",
290
- Variant: "ao.N.1",
207
+ "data-protocol": "ao",
208
+ variant: "ao.N.1",
291
209
  "scheduler-location": this.scheduler,
292
- Authority: this.scheduler,
210
+ authority: this.scheduler,
293
211
  "random-seed": seed(16),
294
- Type: "Process",
212
+ type: "Process",
295
213
  image,
296
214
  "execution-device": "stack@1.0",
297
215
  "push-device": "push@1.0",
@@ -314,19 +232,19 @@ class HB {
314
232
  }
315
233
 
316
234
  async spawnLua(lua) {
317
- const addr = await this.dev.meta.info({ key: "address" })
235
+ const addr = await this.g("/~meta@1.0/info/address")
318
236
  this.scheduler ??= addr
319
237
  lua ??= this.lua ?? (await this.getLua())
320
238
  const res = await this.post({
321
239
  device: "process@1.0",
322
240
  path: "/schedule",
323
241
  scheduler: this.scheduler,
324
- "Data-Protocol": "ao",
325
- Variant: "ao.N.1",
242
+ "data-protocol": "ao",
243
+ variant: "ao.N.1",
326
244
  "scheduler-location": this.scheduler,
327
- Authority: this.scheduler,
245
+ authority: this.scheduler,
328
246
  "random-seed": seed(16),
329
- Type: "Process",
247
+ type: "Process",
330
248
  module: lua,
331
249
  "execution-device": "lua@5.3a",
332
250
  "push-device": "push@1.0",
@@ -337,41 +255,11 @@ class HB {
337
255
  return { pid, res }
338
256
  }
339
257
 
340
- parseMetrics(txt) {
341
- const parts = txt.split(/\r?\n/)
342
- let index = 0
343
- let _metrics = {}
344
- let vals = []
345
- let desc = []
346
- for (const v of parts) {
347
- if (/^# /.test(v)) {
348
- const [_, type, name, ...rest] = v.split(" ")
349
- if (!_metrics[name]) _metrics[name] = { index: ++index, values: [] }
350
- _metrics[name][type] = rest.join(" ")
351
- } else if (v !== "") {
352
- if (/{/.test(v)) {
353
- const [name, rest] = v.split("{")
354
- if (!_metrics[name]) _metrics[name] = { index: ++index, values: [] }
355
- const [params, val] = rest.split("}")
356
- let _params = {}
357
- for (const v of params.split(",")) {
358
- const [key, val] = v.trim().split("=")
359
- _params[key] = val.replace(/"/g, "")
360
- }
361
- _metrics[name].values.push({ value: val.trim(), params: _params })
362
- } else {
363
- const [name, val] = v.split(" ")
364
- if (!_metrics[name]) _metrics[name] = { index: ++index, values: [] }
365
- _metrics[name].values.push({ value: val })
366
- }
367
- }
368
- }
369
- return _metrics
370
- }
371
258
  async now({ pid, path = "" }) {
372
259
  if (path && !/^\//.test(path)) path = "/" + path
373
260
  return await this.getJSON({ path: `/${pid}/now${path}` })
374
261
  }
262
+
375
263
  async slot({ pid, path = "" }) {
376
264
  if (path && !/^\//.test(path)) path = "/" + path
377
265
  return await this.getJSON({ path: `/${pid}/slot${path}` })
@@ -382,14 +270,6 @@ class HB {
382
270
  if (isNotNil(from)) params += `&from=${from}`
383
271
  if (isNotNil(to)) params += `&to=${to}`
384
272
  params += `&accept=application/aos-2`
385
- const {
386
- out: { body },
387
- } = await this.get({
388
- path: "/~scheduler@1.0/schedule",
389
- target: pid,
390
- from,
391
- accept: "application/aos-2",
392
- })
393
273
  let res = await fetch(`${this.url}/~scheduler@1.0/schedule?${params}`).then(
394
274
  r => r.json()
395
275
  )
@@ -403,12 +283,13 @@ class HB {
403
283
  }
404
284
 
405
285
  async spawnLegacy({ module, tags = {}, data } = {}) {
286
+ await this.setInfo()
406
287
  let t = {
407
- Type: "Process",
408
- "Data-Protocol": "ao",
409
- Variant: "ao.TN.1",
288
+ type: "Process",
289
+ "data-protocol": "ao",
290
+ variant: "ao.TN.1",
410
291
  scheduler: this._info.address,
411
- Authority: this._info.address,
292
+ authority: this._info.address,
412
293
  "scheduler-location": this._info.address,
413
294
  "random-seed": seed(16),
414
295
  module: module ?? "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
@@ -424,6 +305,7 @@ class HB {
424
305
  tags = mergeLeft(tags, t)
425
306
  return await this.spawn(tags)
426
307
  }
308
+
427
309
  async results({ process, limit, sort = "DESC", from, to } = {}) {
428
310
  let params = ""
429
311
  const addParam = (key, val) => {
@@ -442,6 +324,7 @@ class HB {
442
324
  })
443
325
  return JSON.parse(res.body)
444
326
  }
327
+
445
328
  async dryrun({ tags = {}, pid, action, data } = {}) {
446
329
  if (typeof action === "string") tags.Action = action
447
330
  let json = { Tags: buildTags({ ...tags }), Owner: this.addr }
@@ -455,6 +338,7 @@ class HB {
455
338
  })
456
339
  return JSON.parse(res.body)
457
340
  }
341
+
458
342
  async commit(obj, opts) {
459
343
  const msg = await this.sign(obj, opts)
460
344
  const hmacId = hmacid(msg.headers)
@@ -462,7 +346,6 @@ class HB {
462
346
  const committer = this.addr
463
347
  const meta = { alg: "rsa-pss-sha512", "commitment-device": "httpsig@1.0" }
464
348
  const meta2 = { alg: "hmac-sha256", "commitment-device": "httpsig@1.0" }
465
-
466
349
  const sigs = {
467
350
  signature: msg.headers.signature,
468
351
  "signature-input": msg.headers["signature-input"],
@@ -475,11 +358,25 @@ class HB {
475
358
  ...obj,
476
359
  }
477
360
  }
361
+
362
+ async p(path, ...args) {
363
+ args[0] ??= {}
364
+ args[0].path ??= path
365
+ return (await this.post(...args))?.out ?? null
366
+ }
367
+
478
368
  async post(obj, json) {
479
369
  const _json = json ? "/~json@1.0/serialize" : ""
480
370
  obj.path += _json
481
371
  return await this.send(await this.sign(obj))
482
372
  }
373
+
374
+ async g(path, ...args) {
375
+ args[0] ??= {}
376
+ args[0].path ??= path
377
+ return (await this.get(...args))?.out ?? null
378
+ }
379
+
483
380
  async get({ path, ...params }, json = false) {
484
381
  const _json = json ? "/~json@1.0/serialize" : ""
485
382
  path ??= "/~message@1.0"
@@ -505,10 +402,12 @@ class HB {
505
402
  ...http,
506
403
  }
507
404
  }
405
+
508
406
  async postJSON(args) {
509
407
  const res = await this.post(args, true)
510
408
  return JSON.parse(res.body)
511
409
  }
410
+
512
411
  async getJSON(args) {
513
412
  const res = await this.get(args, true)
514
413
  return JSON.parse(res.body)
package/esm/hyperbeam.js CHANGED
@@ -1,18 +1,23 @@
1
1
  import { spawn } from "child_process"
2
2
  import { resolve } from "path"
3
3
  import { isNil, map } from "ramda"
4
+ import { toAddr } from "./test.js"
5
+ import HB from "./hb.js"
4
6
  import { rmSync, readFileSync, readdirSync } from "fs"
5
7
  import devs from "./devs.js"
8
+ import dotenv from "dotenv"
9
+ dotenv.config({ path: ".env.hyperbeam" })
6
10
 
7
11
  export default class HyperBEAM {
12
+ static OPERATOR = Symbol("operator")
8
13
  constructor({
9
14
  port = 10001,
10
15
  cu = 6363,
11
- as,
16
+ as = [],
12
17
  bundler,
13
18
  gateway,
14
- wallet,
15
- clearCache,
19
+ wallet = ".wallet.json",
20
+ reset,
16
21
  cwd = "./HyperBEAM",
17
22
  c,
18
23
  cmake,
@@ -23,20 +28,24 @@ export default class HyperBEAM {
23
28
  p4_lua,
24
29
  store_prefix,
25
30
  operator,
26
- console = true,
31
+ logs = true,
27
32
  shell = true,
28
33
  devices,
29
34
  } = {}) {
30
35
  this.devices = devices
31
36
  this.p4_non_chargable_routes = p4_non_chargable_routes
32
- as ??= shell ? [] : ["genesis_wasm"]
33
- this.console = console
34
- if (clearCache) {
35
- const dirname = resolve(process.cwd(), cwd)
36
- for (let v of readdirSync(dirname)) {
37
+ this.logs = logs
38
+ this.cwd = cwd
39
+ this.dirname = resolve(process.cwd(), this.cwd)
40
+ this.wallet = wallet
41
+ this.wallet_location = resolve(this.dirname, this.wallet)
42
+ this.jwk = JSON.parse(this.file(this.wallet_location))
43
+ this.addr = toAddr(this.jwk.n)
44
+ if (reset) {
45
+ for (let v of readdirSync(this.dirname)) {
37
46
  if (/^cache-/.test(v)) {
38
47
  try {
39
- rmSync(resolve(dirname, v), { recursive: true, force: true })
48
+ rmSync(resolve(this.dirname, v), { recursive: true, force: true })
40
49
  } catch (e) {
41
50
  console.log(e)
42
51
  }
@@ -51,15 +60,24 @@ export default class HyperBEAM {
51
60
  this.simple_pay = simple_pay
52
61
  this.spp = simple_pay_price
53
62
  this.operator = operator
63
+ if (this.operator === HyperBEAM.OPERATOR) this.operator = this.addr
54
64
  this.faff = faff
55
65
  this.c = c
56
66
  this.cmake = cmake
57
67
  this.port = port
68
+ this.url = `http://localhost:${this.port}`
58
69
  this.bundler = bundler
59
70
  this.as = as
60
71
  this.gateway = gateway
61
- this.wallet = wallet
62
- this.cwd = cwd
72
+ if (Array.isArray(this.faff)) {
73
+ let i = 0
74
+ for (let v of this.faff) {
75
+ if (typeof v === "symbol" && v === HyperBEAM.OPERATOR) {
76
+ this.faff[i] = this.addr
77
+ }
78
+ i++
79
+ }
80
+ }
63
81
  if (shell) this.shell()
64
82
  }
65
83
  shell() {
@@ -77,7 +95,7 @@ export default class HyperBEAM {
77
95
  cwd: resolve(process.cwd(), this.cwd),
78
96
  }
79
97
  )
80
- if (this.console) {
98
+ if (this.logs) {
81
99
  this._shell.stdout.on("data", chunk => console.log(chunk.toString()))
82
100
  this._shell.stderr.on("data", err => console.error(err.toString()))
83
101
  this._shell.on("error", err =>
@@ -89,6 +107,9 @@ export default class HyperBEAM {
89
107
  })
90
108
  }
91
109
  }
110
+ file(path, type = "utf8") {
111
+ return readFileSync(resolve(this.dirname, path), type)
112
+ }
92
113
  eunit(module, test) {
93
114
  return new Promise(res => {
94
115
  let isTest = !isNil(test)
@@ -120,7 +141,7 @@ export default class HyperBEAM {
120
141
  env: { ...process.env, ...this.genEnv() },
121
142
  cwd: resolve(process.cwd(), this.cwd),
122
143
  })
123
- if (this.console) {
144
+ if (this.logs) {
124
145
  _eunit.stdout.on("data", chunk => console.log(chunk.toString()))
125
146
  _eunit.stderr.on("data", err => console.error(err.toString()))
126
147
  _eunit.on("error", err =>
@@ -135,10 +156,13 @@ export default class HyperBEAM {
135
156
  }
136
157
  async ok() {
137
158
  try {
138
- const address = await fetch(
139
- `http://localhost:${this.port}/~meta@1.0/info/address`
140
- ).then(r => r.text())
141
- return address ? true : false
159
+ const address = await fetch(`${this.url}/~meta@1.0/info/address`).then(
160
+ r => r.text()
161
+ )
162
+ if (address) {
163
+ this.hb = await new HB({ url: this.url }).init(this.jwk)
164
+ return true
165
+ } else return false
142
166
  } catch (e) {
143
167
  return false
144
168
  }
@@ -237,7 +261,6 @@ export default class HyperBEAM {
237
261
  ? `, on => #{ <<"request">> => #{ <<"device">> => <<"p4@1.0">>, <<"pricing-device">> => <<"faff@1.0">>, <<"ledger-device">> => <<"faff@1.0">> }, <<"response">> => #{ <<"device">> => <<"p4@1.0">>, <<"pricing-device">> => <<"faff@1.0">>, <<"ledger-device">> => <<"faff@1.0">> } }`
238
262
  : ""
239
263
  const start = `hb:start_mainnet(#{ ${_port}${_gateway}${_wallet}${_faff}${_bundler}${_on}${_p4_non_chargable}${_operator}${_spp}${_devices}${_node_processes}}).`
240
- console.log(start)
241
264
  return start
242
265
  }
243
266
 
@@ -3,11 +3,13 @@
3
3
  "version": "0.0.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
- "test": "node --experimental-wasm-memory64",
7
- "test-only": "node --experimental-wasm-memory64 --test-only",
6
+ "test": "node --experimental-wasm-memory64 --test --test-concurrency=1",
7
+ "test-only": "node --experimental-wasm-memory64 --test-only --test-concurrency=1",
8
+ "test-all": "node --experimental-wasm-memory64 --test --test-concurrency=1 test/**/*.test.js",
8
9
  "deploy": "node scripts/deploy.js"
9
10
  },
10
11
  "dependencies": {
11
- "wao": "^0.29.2"
12
+ "dotenv": "^17.2.0",
13
+ "wao": "^0.30.4"
12
14
  }
13
15
  }
@@ -0,0 +1,18 @@
1
+ import assert from "assert"
2
+ import { describe, it, before, after, beforeEach } from "node:test"
3
+ import { HyperBEAM } from "wao/test"
4
+ const cwd = "../../HyperBEAM"
5
+
6
+ describe("HyperBEAM", function () {
7
+ let hbeam, hb
8
+ before(
9
+ async () => (hbeam = await new HyperBEAM({ cwd, reset: true }).ready())
10
+ )
11
+ beforeEach(async () => (hb = hbeam.hb))
12
+ after(async () => hbeam.kill())
13
+
14
+ it("should run a HyperBEAM node", async () => {
15
+ const build = await hb.g("/~meta@1.0/build")
16
+ assert.equal(build.node, "HyperBEAM")
17
+ })
18
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.30.2",
3
+ "version": "0.31.0",
4
4
  "bin": {
5
5
  "wao": "./cjs/cli.js",
6
6
  "wao-esm": "./esm/cli.js"
@@ -45,6 +45,7 @@
45
45
  "buffer": "^6.0.3",
46
46
  "chokidar": "^4.0.3",
47
47
  "cors": "^2.8.5",
48
+ "dotenv": "^17.2.0",
48
49
  "express": "^5.1.0",
49
50
  "fast-sha256": "^1.3.0",
50
51
  "graphql": "^16.10.0",
@@ -1,30 +0,0 @@
1
- import assert from "assert"
2
- import { describe, it, before, after, beforeEach } from "node:test"
3
- import { HyperBEAM, toAddr } from "wao/test"
4
- import { HB } from "wao"
5
- import { resolve } from "path"
6
- import { readFileSync } from "fs"
7
-
8
- const cwd = "../../HyperBEAM"
9
- const wallet = resolve(process.cwd(), cwd, ".wallet.json")
10
-
11
- const jwk = JSON.parse(readFileSync(wallet, "utf8"))
12
- const addr = toAddr(jwk.n)
13
-
14
- describe("HyperBEAM", function () {
15
- let hbeam, hb, jwk
16
-
17
- before(async () => {
18
- hbeam = await new HyperBEAM({ cwd }).ready()
19
- jwk = JSON.parse(readFileSync(resolve(process.cwd(), cwd, wallet), "utf8"))
20
- })
21
-
22
- beforeEach(async () => (hb = await new HB({}).init(jwk)))
23
-
24
- after(async () => hbeam.kill())
25
-
26
- it("should run a HyperBEAM node", async () => {
27
- const { out } = await hb.getJSON({ path: "/~meta@1.0/build" })
28
- assert.equal(out.node, "HyperBEAM")
29
- })
30
- })
@@ -1,30 +0,0 @@
1
- import assert from "assert"
2
- import { describe, it, before, after, beforeEach } from "node:test"
3
- import { HyperBEAM, toAddr } from "wao/test"
4
- import { HB } from "wao"
5
- import { resolve } from "path"
6
- import { readFileSync } from "fs"
7
-
8
- const cwd = "../../HyperBEAM"
9
- const wallet = resolve(process.cwd(), cwd, ".wallet.json")
10
-
11
- const jwk = JSON.parse(readFileSync(wallet, "utf8"))
12
- const addr = toAddr(jwk.n)
13
-
14
- describe("HyperBEAM", function () {
15
- let hbeam, hb, jwk
16
-
17
- before(async () => {
18
- hbeam = await new HyperBEAM({ cwd }).ready()
19
- jwk = JSON.parse(readFileSync(resolve(process.cwd(), cwd, wallet), "utf8"))
20
- })
21
-
22
- beforeEach(async () => (hb = await new HB({}).init(jwk)))
23
-
24
- after(async () => hbeam.kill())
25
-
26
- it("should run a HyperBEAM node", async () => {
27
- const { out } = await hb.getJSON({ path: "/~meta@1.0/build" })
28
- assert.equal(out.node, "HyperBEAM")
29
- })
30
- })
File without changes
File without changes