wao 0.8.3 → 0.8.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/cjs/cli.js CHANGED
File without changes
package/cjs/tao.js CHANGED
@@ -87,7 +87,6 @@ var AO = /*#__PURE__*/function (_MAO) {
87
87
  monitor = _connect.monitor,
88
88
  unmonitor = _connect.unmonitor,
89
89
  mem = _connect.mem;
90
- _this.module = mem.modules.aos2_0_1;
91
90
  _this.assign = assign;
92
91
  _this.result = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
93
92
  var res,
package/cjs/utils.js CHANGED
@@ -329,7 +329,10 @@ var srcs = exports.srcs = {
329
329
  module_sqlite: "ghSkge2sIUD_F00ym5sEimC63BDBuBrq4b5OcwxOjiw",
330
330
  module_aos2: "Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM",
331
331
  scheduler: "_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA",
332
- authority: "fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY"
332
+ authority: "fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY",
333
+ module_wao: "Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM",
334
+ scheduler_wao: "_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA",
335
+ authority_wao: "eNaLJLsMiWCSWvQKNbk_YT-9ydeWl9lrWwXxLVp9kcg"
333
336
  };
334
337
  var buildTags = exports.buildTags = function buildTags(act, tags) {
335
338
  var _tags = [];
package/esm/ao.js CHANGED
@@ -78,10 +78,11 @@ class AO {
78
78
  in_memory = false,
79
79
  port,
80
80
  } = opt
81
-
82
81
  if (!_port && port) _port = port
83
82
  if (!aoconnect && _port) aoconnect = optAO(_port)
84
83
  if (!ar && _port) ar = { port: _port }
84
+ this.wao = opt.wao
85
+ if (isNil(this.wao)) this.wao = in_memory || !isNil(ar?.port)
85
86
  if (!module) {
86
87
  switch (module_type) {
87
88
  case "sqlite":
@@ -130,9 +131,15 @@ class AO {
130
131
  this.monitor = monitor
131
132
  this.unmonitor = unmonitor
132
133
  }
133
- this.module = module
134
- this.scheduler = scheduler
135
- this.authority = authority
134
+ if (this.wao) {
135
+ this.module = srcs.module_wao
136
+ this.scheduler = srcs.scheduler_wao
137
+ this.authority = srcs.authority_wao
138
+ } else {
139
+ this.module = module
140
+ this.scheduler = scheduler
141
+ this.authority = authority
142
+ }
136
143
  }
137
144
 
138
145
  async init(jwk) {
package/esm/aoconnect.js CHANGED
@@ -72,25 +72,16 @@ export const connect = (mem, { cache, log = false, extensions = {} } = {}) => {
72
72
  }
73
73
  }
74
74
 
75
- const genEnv = ({ pid, owner = "", module = "", auth = "" }) => {
75
+ const genEnv = async ({ pid, owner = "", module = "" }) => {
76
76
  return {
77
77
  Process: {
78
78
  Id: pid,
79
- Tags: [
80
- { name: "Data-Protocol", value: "ao" },
81
- { name: "Variant", value: "ao.TN.1" },
82
- { name: "Type", value: "Process" },
83
- { name: "Authority", value: auth },
84
- ],
79
+ Tags: (await mem.get("txs", pid))?.tags ?? [],
85
80
  Owner: owner,
86
81
  },
87
82
  Module: {
88
83
  Id: module,
89
- Tags: [
90
- { name: "Data-Protocol", value: "ao" },
91
- { name: "Variant", value: "ao.TN.1" },
92
- { name: "Type", value: "Module" },
93
- ],
84
+ Tags: (await mem.get("txs", module))?.tags ?? [],
94
85
  },
95
86
  }
96
87
  }
@@ -108,6 +99,7 @@ export const connect = (mem, { cache, log = false, extensions = {} } = {}) => {
108
99
  Module: mod,
109
100
  Scheduler: opt.scheduler,
110
101
  "Content-Type": "text/plain",
102
+ Authority: mu.addr,
111
103
  }),
112
104
  )
113
105
  let ex = false
@@ -171,11 +163,10 @@ export const connect = (mem, { cache, log = false, extensions = {} } = {}) => {
171
163
  if (_tags["On-Boot"] === "Data") data = opt.data ?? ""
172
164
  else data = (await mem.get("msgs", _tags["On-Boot"]))?.data ?? ""
173
165
  let msg = await genMsg(id, p, data, opt.tags, owner, mu.addr, true)
174
- const _env = genEnv({
166
+ const _env = await genEnv({
175
167
  pid: p.id,
176
168
  owner: p.owner,
177
169
  module: p.module,
178
- auth: mu.addr,
179
170
  })
180
171
  res = await _module.handle(null, msg, _env)
181
172
  p.memory = res.Memory
@@ -288,11 +279,10 @@ export const connect = (mem, { cache, log = false, extensions = {} } = {}) => {
288
279
  }
289
280
  // check: is owner=mu.addr right?
290
281
  const msg = await genMsg(opt.message, p, data, _tags, from, mu.addr)
291
- const _env = genEnv({
282
+ const _env = await genEnv({
292
283
  pid: p.id,
293
284
  owner: p.owner,
294
285
  module: p.module,
295
- auth: mu.addr,
296
286
  })
297
287
  if (!p.handle) {
298
288
  const { format, mod, wasm } = await mem.getWasm(p.modulea)
@@ -450,11 +440,10 @@ export const connect = (mem, { cache, log = false, extensions = {} } = {}) => {
450
440
  mu.addr,
451
441
  true,
452
442
  )
453
- const _env = genEnv({
443
+ const _env = await genEnv({
454
444
  pid: p.id,
455
445
  owner: p.owner,
456
446
  module: p.module,
457
- auth: mu.addr,
458
447
  })
459
448
  function cloneMemory(memory) {
460
449
  const buffer = memory.buffer.slice(0)
package/esm/cli.js CHANGED
File without changes
package/esm/tao.js CHANGED
@@ -3,7 +3,7 @@ import { createDataItemSigner } from "@permaweb/aoconnect"
3
3
  import { srcs, buildTags } from "./utils.js"
4
4
  import AR from "./tar.js"
5
5
  import { connect } from "./aoconnect.js"
6
- import { acc } from "./test.js"
6
+ import { acc, mu } from "./test.js"
7
7
  import { mergeLeft, is, map } from "ramda"
8
8
 
9
9
  let log = `
@@ -69,7 +69,6 @@ class AO extends MAO {
69
69
  cache: opt.cache,
70
70
  reset: opt.reset,
71
71
  })
72
- this.module = mem.modules.aos2_0_1
73
72
  this.assign = assign
74
73
  this.result = async (...opt) => {
75
74
  const res = await result(...opt)
package/esm/utils.js CHANGED
@@ -197,6 +197,9 @@ const srcs = {
197
197
  module_aos2: "Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM",
198
198
  scheduler: "_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA",
199
199
  authority: "fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY",
200
+ module_wao: "Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM",
201
+ scheduler_wao: "_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA",
202
+ authority_wao: "eNaLJLsMiWCSWvQKNbk_YT-9ydeWl9lrWwXxLVp9kcg",
200
203
  }
201
204
 
202
205
  const buildTags = (act, tags) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
4
4
  "bin": {
5
5
  "wao": "./cjs/cli.js",
6
6
  "wao-esm": "./esm/cli.js"