wao 0.2.3 → 0.3.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/cjs/ao.js +9 -3
- package/cjs/aoconnect.js +1559 -420
- package/cjs/lua/weavedrive.lua +53 -0
- package/cjs/tao.js +5 -1
- package/esm/ao.js +22 -3
- package/esm/aoconnect.js +900 -108
- package/esm/lua/weavedrive.lua +53 -0
- package/esm/tao.js +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
local drive = { _version = "0.0.1" }
|
|
2
|
+
|
|
3
|
+
function drive.getBlock(height)
|
|
4
|
+
local block = io.open("/block/" .. height)
|
|
5
|
+
if not block then
|
|
6
|
+
return nil, "Block Header not found!"
|
|
7
|
+
end
|
|
8
|
+
local headers = require('json').decode(
|
|
9
|
+
block:read(
|
|
10
|
+
block:seek('end')
|
|
11
|
+
)
|
|
12
|
+
)
|
|
13
|
+
block:close()
|
|
14
|
+
return headers
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
function drive.getTx(txId)
|
|
18
|
+
local file = io.open('/tx/' .. txId)
|
|
19
|
+
if not file then
|
|
20
|
+
return nil, "File not found!"
|
|
21
|
+
end
|
|
22
|
+
local contents = require('json').decode(
|
|
23
|
+
file:read(
|
|
24
|
+
file:seek('end')
|
|
25
|
+
)
|
|
26
|
+
)
|
|
27
|
+
file:close()
|
|
28
|
+
return contents
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
function drive.getData(txId)
|
|
32
|
+
local file = io.open('/data/' .. txId)
|
|
33
|
+
if not file then
|
|
34
|
+
return nil, "File not found!"
|
|
35
|
+
end
|
|
36
|
+
local contents = file:read(
|
|
37
|
+
file:seek('end')
|
|
38
|
+
)
|
|
39
|
+
file:close()
|
|
40
|
+
return contents
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
function drive.getDataItem(txId)
|
|
44
|
+
local file = io.open('/tx2/' .. txId)
|
|
45
|
+
if not file then
|
|
46
|
+
return nil, "File not found!"
|
|
47
|
+
end
|
|
48
|
+
local contents = file:read(
|
|
49
|
+
file:seek('end')
|
|
50
|
+
)
|
|
51
|
+
file:close()
|
|
52
|
+
return contents
|
|
53
|
+
end
|
package/cjs/tao.js
CHANGED
|
@@ -46,8 +46,10 @@ var AO = /*#__PURE__*/function (_MAO) {
|
|
|
46
46
|
message = _connect.message,
|
|
47
47
|
spawn = _connect.spawn,
|
|
48
48
|
dryrun = _connect.dryrun,
|
|
49
|
+
monitor = _connect.monitor,
|
|
50
|
+
unmonitor = _connect.unmonitor,
|
|
49
51
|
txs = _connect.txs;
|
|
50
|
-
_this.module = modules.
|
|
52
|
+
_this.module = modules.aos2_0_1;
|
|
51
53
|
_this.assign = assign;
|
|
52
54
|
_this.result = result;
|
|
53
55
|
_this.results = results;
|
|
@@ -55,6 +57,8 @@ var AO = /*#__PURE__*/function (_MAO) {
|
|
|
55
57
|
_this.spawn = spawn;
|
|
56
58
|
_this.dryrun = dryrun;
|
|
57
59
|
_this.ar.txs = txs;
|
|
60
|
+
_this.monitor = monitor;
|
|
61
|
+
_this.unmonitor = unmonitor;
|
|
58
62
|
_this.accounts = accounts;
|
|
59
63
|
return _this;
|
|
60
64
|
}
|
package/esm/ao.js
CHANGED
|
@@ -2,6 +2,7 @@ import * as WarpArBundles from "warp-arbundles"
|
|
|
2
2
|
const pkg = WarpArBundles.default ? WarpArBundles.default : WarpArBundles
|
|
3
3
|
const { createData, ArweaveSigner } = pkg
|
|
4
4
|
import AR from "./ar.js"
|
|
5
|
+
|
|
5
6
|
import {
|
|
6
7
|
createDataItemSigner,
|
|
7
8
|
connect,
|
|
@@ -11,6 +12,8 @@ import {
|
|
|
11
12
|
message,
|
|
12
13
|
spawn,
|
|
13
14
|
dryrun,
|
|
15
|
+
monitor,
|
|
16
|
+
unmonitor,
|
|
14
17
|
} from "@permaweb/aoconnect"
|
|
15
18
|
|
|
16
19
|
import {
|
|
@@ -88,14 +91,24 @@ class AO {
|
|
|
88
91
|
}
|
|
89
92
|
if (in_memory) {
|
|
90
93
|
} else if (aoconnect) {
|
|
91
|
-
const {
|
|
92
|
-
|
|
94
|
+
const {
|
|
95
|
+
results,
|
|
96
|
+
assign,
|
|
97
|
+
result,
|
|
98
|
+
message,
|
|
99
|
+
spawn,
|
|
100
|
+
dryrun,
|
|
101
|
+
monitor,
|
|
102
|
+
unmonitor,
|
|
103
|
+
} = connect(aoconnect)
|
|
93
104
|
this.assign = assign
|
|
94
105
|
this.result = result
|
|
95
106
|
this.results = results
|
|
96
107
|
this.message = message
|
|
97
108
|
this.spawn = spawn
|
|
98
109
|
this.dryrun = dryrun
|
|
110
|
+
this.monitor = monitor
|
|
111
|
+
this.unmonitor = unmonitor
|
|
99
112
|
} else {
|
|
100
113
|
this.assign = assign
|
|
101
114
|
this.result = result
|
|
@@ -103,6 +116,8 @@ class AO {
|
|
|
103
116
|
this.message = message
|
|
104
117
|
this.spawn = spawn
|
|
105
118
|
this.dryrun = dryrun
|
|
119
|
+
this.monitor = monitor
|
|
120
|
+
this.unmonitor = unmonitor
|
|
106
121
|
}
|
|
107
122
|
this.module = module
|
|
108
123
|
this.scheduler = scheduler
|
|
@@ -648,7 +663,11 @@ class AO {
|
|
|
648
663
|
}
|
|
649
664
|
fns.push({ fn: this.wait, then: { "args.pid": "pid" } })
|
|
650
665
|
let i = 0
|
|
651
|
-
for (const v of !loads
|
|
666
|
+
for (const v of !loads
|
|
667
|
+
? src_data
|
|
668
|
+
? [{ data: src_data, src, fills }]
|
|
669
|
+
: []
|
|
670
|
+
: loads) {
|
|
652
671
|
if (!isBoot || i !== 0) {
|
|
653
672
|
fns.push({ fn: this.load, args: v, then: { "args.pid": "pid" } })
|
|
654
673
|
}
|