wao 0.1.2 → 0.1.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/.babelrc-cjs +5 -0
- package/.babelrc-esm +5 -0
- package/README.md +589 -0
- package/dist/cjs/index.js +20 -0
- package/dist/esm/index.js +4 -0
- package/dist/package.json +36 -0
- package/make.js +23 -0
- package/package.json +35 -6
- package/src/.cache/opt.json +1 -0
- package/src/index.js +4 -0
- package/src/test.js +94 -0
- package/test/.cache/opt.json +1 -1
- package/test/test.js +46 -90
- package/cjs/index.js +0 -26
- package/esm/index.js +0 -5
- package/test/index.js +0 -5
- package/test/package.json +0 -21
- /package/{cjs → dist/cjs}/accounts.js +0 -0
- /package/{cjs → dist/cjs}/ao.js +0 -0
- /package/{cjs → dist/cjs}/aoconnect.js +0 -0
- /package/{cjs → dist/cjs}/ar.js +0 -0
- /package/{cjs → dist/cjs}/dirname.js +0 -0
- /package/{cjs → dist/cjs}/helpers.js +0 -0
- /package/{cjs → dist/cjs}/lua/aos2_0_1.wasm +0 -0
- /package/{cjs → dist/cjs}/utils.js +0 -0
- /package/{esm → dist/esm}/.cache/opt.json +0 -0
- /package/{esm → dist/esm}/accounts.js +0 -0
- /package/{esm → dist/esm}/ao.js +0 -0
- /package/{esm → dist/esm}/aoconnect.js +0 -0
- /package/{esm → dist/esm}/ar.js +0 -0
- /package/{esm → dist/esm}/dirname.js +0 -0
- /package/{esm → dist/esm}/helpers.js +0 -0
- /package/{esm → dist/esm}/lua/aos2_0_1.wasm +0 -0
- /package/{esm → dist/esm}/test.js +0 -0
- /package/{esm → dist/esm}/utils.js +0 -0
- /package/{test → src}/accounts.js +0 -0
- /package/{test → src}/ao.js +0 -0
- /package/{test → src}/aoconnect.js +0 -0
- /package/{test → src}/ar.js +0 -0
- /package/{test → src}/dirname.js +0 -0
- /package/{test → src}/helpers.js +0 -0
- /package/{test → src}/lua/aos2_0_1.wasm +0 -0
- /package/{test → src}/utils.js +0 -0
package/.babelrc-cjs
ADDED
package/.babelrc-esm
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,589 @@
|
|
|
1
|
+
# WAO SDK
|
|
2
|
+
|
|
3
|
+
WAO SDK streamlines Arweave/AO development with elegant syntax enhancements and seamless message piping for an enjoyable coding experience. Additionally, it includes a drop-in replacement for `aoconnect`, allowing to test lua scripts 1000x faster than the mainnet by emulating AO units in-memory.
|
|
4
|
+
|
|
5
|
+
- [Quick Start](#quick-start)
|
|
6
|
+
- [Installation](#installation)
|
|
7
|
+
|
|
8
|
+
- [API Reference](#api-reference)
|
|
9
|
+
- [AR](#ar)
|
|
10
|
+
- [AO](#ao)
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
### Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
yarn add wao
|
|
18
|
+
```
|
|
19
|
+
### Drop-in `aoconnect` Replacement for Tests
|
|
20
|
+
|
|
21
|
+
By replacing `aoconnect` with WAO connect, everything runs in-memory with zero latency and your tests execute 1000x faster. The APIs are identical. So there's no need to change anything else in your code.
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
//import { spawn, message, dryrun, assign, result } from "@permaweb/aoconnect"
|
|
25
|
+
import { connect } from "wao/test/aoconnect.js"
|
|
26
|
+
const { spawn, message, dryrun, assign, result } = connect()
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import { AR, AO } from "wao"
|
|
31
|
+
```
|
|
32
|
+
### Setting up a Project
|
|
33
|
+
|
|
34
|
+
It's super easy to set up a test AO project manually.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
mkdir wao-test && cd wao-test
|
|
38
|
+
yarn init && yarn add wao && yarn add mocha chai --dev
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Add a `test` command to your `package.json`, and set `module` type to work with ES6.
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"name": "wao-test",
|
|
46
|
+
"version": "1.0.0",
|
|
47
|
+
"type": "module",
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"wao": "^0.1.1"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"chai": "^5.1.2",
|
|
53
|
+
"mocha": "^10.8.2"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"test": "mocha --node-option=experimental-wasm-memory64"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Create `test` directory and `test.js` file.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
mkdir test && touch test.js
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Writing Tests
|
|
68
|
+
|
|
69
|
+
Write a simple test in `test.js`.
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
import { expect } from "chai"
|
|
73
|
+
import { connect } from "wao/test/aoconnect.js"
|
|
74
|
+
const { accounts, spawn, message, dryrun } = connect()
|
|
75
|
+
// import { utils } from "wao"
|
|
76
|
+
|
|
77
|
+
const src_data = `
|
|
78
|
+
Handlers.add("Hello", "Hello", function (msg)
|
|
79
|
+
msg.reply({ Data = "Hello, World!" })
|
|
80
|
+
end
|
|
81
|
+
)
|
|
82
|
+
`
|
|
83
|
+
describe("WAO", function () {
|
|
84
|
+
this.timeout(0)
|
|
85
|
+
describe("Aoconnect Replacement", function () {
|
|
86
|
+
it("should spawn a process and send messages", async () => {
|
|
87
|
+
const pid = await spawn({ signer: accounts[0].signer })
|
|
88
|
+
|
|
89
|
+
// on mainnet, you need to wait here till the process becomes available.
|
|
90
|
+
// WAO automatically handles it. No need with in-memory tests.
|
|
91
|
+
// await utils.wait({ pid })
|
|
92
|
+
|
|
93
|
+
await message({
|
|
94
|
+
process: pid,
|
|
95
|
+
tags: [{ name: "Action", value: "Eval" }],
|
|
96
|
+
data: src_data,
|
|
97
|
+
signer,
|
|
98
|
+
})
|
|
99
|
+
const res = await dryrun({
|
|
100
|
+
process: pid,
|
|
101
|
+
tags: [{ name: "Action", value: "Hello" }],
|
|
102
|
+
signer,
|
|
103
|
+
})
|
|
104
|
+
expect(res.Messages[0].Data).to.eql("Hello, World!")
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
```
|
|
109
|
+
Note that generating random Arweave wallets for every test takes time and slows down your test executions, so Wao connect provides pre-generated accounts for your tests, which saves hours if you are to run your tests thousands of times.
|
|
110
|
+
|
|
111
|
+
- `accounts[0] = { jwk, addr, signer }`
|
|
112
|
+
|
|
113
|
+
Run the test.
|
|
114
|
+
|
|
115
|
+
```js
|
|
116
|
+
yarn test
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
WAO comes with elegant syntactic sugar and makes writing AO projects absolute joy.
|
|
120
|
+
|
|
121
|
+
The same test can be written as follows.
|
|
122
|
+
|
|
123
|
+
```js
|
|
124
|
+
import { expect } from "chai"
|
|
125
|
+
import { AO } from "wao"
|
|
126
|
+
|
|
127
|
+
const src_data = `
|
|
128
|
+
Handlers.add( "Hello", "Hello", function (msg)
|
|
129
|
+
msg.reply({ Data = "Hello, World!" })
|
|
130
|
+
end
|
|
131
|
+
)
|
|
132
|
+
`
|
|
133
|
+
describe("WAO", function () {
|
|
134
|
+
this.timeout(0)
|
|
135
|
+
describe("AO Class", function () {
|
|
136
|
+
it("should spawn a process send messages", async () => {
|
|
137
|
+
const ao = await new AO({ in_memory: true }).init())
|
|
138
|
+
const { p } = await ao.deploy({ src_data })
|
|
139
|
+
expect(await p.d("Hello")).to.eql("Hello, World!")
|
|
140
|
+
})
|
|
141
|
+
})
|
|
142
|
+
})
|
|
143
|
+
```
|
|
144
|
+
The `AO` class is not only for tests, but also for production code. You just need to set `in_memory: true` to run the in-memory emulator when testing.
|
|
145
|
+
|
|
146
|
+
## API Reference
|
|
147
|
+
|
|
148
|
+
### AR
|
|
149
|
+
|
|
150
|
+
`AR` handles operations on the base Arweave Storage layer as well as wallet connections.
|
|
151
|
+
|
|
152
|
+
- [Instantiate](#instantiate)
|
|
153
|
+
- [Set or Generate Wallet](#set-or-generate-wallet)
|
|
154
|
+
- [toAddr](#toaddr)
|
|
155
|
+
- [mine](#mine)
|
|
156
|
+
- [balance | toAR | toWinston](#balance--toar--towinston)
|
|
157
|
+
- [transfer](#transfer)
|
|
158
|
+
- [checkWallet](#checkwallet)
|
|
159
|
+
- [post](#post)
|
|
160
|
+
- [tx](#tx)
|
|
161
|
+
- [data](#data)
|
|
162
|
+
- [bundle](#bundle)
|
|
163
|
+
|
|
164
|
+
#### Instantiate
|
|
165
|
+
|
|
166
|
+
```js
|
|
167
|
+
const ar = new AR()
|
|
168
|
+
```
|
|
169
|
+
`host`, `port`, and `protocol` can be set to access a specific gateway rather than `https://arweave.net`.
|
|
170
|
+
|
|
171
|
+
```js
|
|
172
|
+
const ar = new AR({ host: "localhost", port: 4000, protocol: "http" })
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
In case of local gateways, you can only set `port` and the rest will be automatically figured out.
|
|
176
|
+
```js
|
|
177
|
+
const ar = new AR({ port: 4000 })
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
#### Set or Generate Wallet
|
|
181
|
+
|
|
182
|
+
You can initialize AR with a wallet JWK or ArConnect.
|
|
183
|
+
|
|
184
|
+
```js
|
|
185
|
+
const ar = await new AR().init(jwk || arweaveWallet)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Or you can generate a new wallet. In case of ArLocal, you can mint AR at the same time.
|
|
189
|
+
|
|
190
|
+
```js
|
|
191
|
+
const { jwk, addr, pub, balance } = await ar.gen("100") // mint 100 AR
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Once a wallet is set in one of these 3 ways, you cannot use the instance with another wallet unless you re-initialize it with another wallet. This is to prevent executing transactions with the wrong wallet when the browser connected active address has been changed unknowingly.
|
|
195
|
+
|
|
196
|
+
You can go on without calling `init` or `gen`, in this case, AR generates a random wallet when needed, and also using different wallets will be allowed. This is useful, if you are only calling `dryrun` with AO, since AO requires a signature for `dryrun` too, but you don't want to bother the user by triggering the browser extension wallet for read only calls.
|
|
197
|
+
|
|
198
|
+
Once a wallet is set, `ar.jwk` and `ar.addr` will be available.
|
|
199
|
+
|
|
200
|
+
#### Token Related Methods
|
|
201
|
+
|
|
202
|
+
##### toAddr
|
|
203
|
+
|
|
204
|
+
Convert a jwk to the corresponding address.
|
|
205
|
+
|
|
206
|
+
```js
|
|
207
|
+
const addr = await ar.toAddr(jwk)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
##### mine
|
|
211
|
+
|
|
212
|
+
Mine pending blocks (only for arlocal).
|
|
213
|
+
|
|
214
|
+
```js
|
|
215
|
+
await ar.mine()
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
##### balance | toAR | toWinston
|
|
219
|
+
|
|
220
|
+
Get the current balance of the specified address in AR. `addr` will be `ar.addr` if omitted.
|
|
221
|
+
|
|
222
|
+
```js
|
|
223
|
+
const balance_AR = await ar.balance() // get own balance
|
|
224
|
+
const balance_Winston = ar.toWinston(balance_AR)
|
|
225
|
+
const balance_AR2 = ar.toAR(balance_Winston)
|
|
226
|
+
const balance_AR3 = await ar.balance(addr) // specify wallet address
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
##### transfer
|
|
230
|
+
|
|
231
|
+
Transfer AR token. `amount` is in AR, not in winston for simplicity.
|
|
232
|
+
|
|
233
|
+
```js
|
|
234
|
+
const { id } = await ar.transfer(amount, to)
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
You can set a jwk to the 3rd parameter as a sender, otherwise the sender is `ar.jwk`.
|
|
238
|
+
|
|
239
|
+
```js
|
|
240
|
+
const { id } = await ar.transfer(amount, to, jwk)
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
For most write functions, `jwk` can be specified as the last parameter or a field like `{ data, tags, jwk }`.
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
##### checkWallet
|
|
247
|
+
|
|
248
|
+
`checkWallet` is mostly used internally, but it returns `this.jwk` if a wallet has been assigned with `init`, or else it generates a random wallet to use. The following pattern is used in many places. With this pattern, if a wallet is set with `init` and the `jwk` the user is passing is different, `checkWallet` produces an error to prevent the wrong wallet. If no wallet has been set with `init` or `gen` and the `jwk` is not passed, it generates and returns a random wallet.
|
|
249
|
+
|
|
250
|
+
```js
|
|
251
|
+
some_class_method({ jwk }){
|
|
252
|
+
let err = null
|
|
253
|
+
;({ err, jwk } = await ar.checkWallet({ jwk }))
|
|
254
|
+
if(!err){
|
|
255
|
+
// do domething with the jwk
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
#### Storage Related Methods
|
|
261
|
+
|
|
262
|
+
##### post
|
|
263
|
+
|
|
264
|
+
Post a data to Arweave.
|
|
265
|
+
|
|
266
|
+
```js
|
|
267
|
+
const { err, id } = await ar.post({ data, tags })
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
`tags` are not an Array but a hash map Object for brevity.
|
|
271
|
+
|
|
272
|
+
```js
|
|
273
|
+
const tags = { "Content-Type": "text/markdown", Type: "blog-post" }
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
If you must use the same name for multiple tags, the value can be an Array.
|
|
277
|
+
|
|
278
|
+
```js
|
|
279
|
+
const tags = { Name: [ "name-tag-1", "name-tag-2" ] }
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
##### tx
|
|
284
|
+
|
|
285
|
+
Get a transaction.
|
|
286
|
+
|
|
287
|
+
```js
|
|
288
|
+
const tx = await ar.tx(txid)
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
##### data
|
|
292
|
+
|
|
293
|
+
Get a data.
|
|
294
|
+
|
|
295
|
+
```js
|
|
296
|
+
const data = await ar.data(txid, true) // true if string
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
##### bundle
|
|
300
|
+
|
|
301
|
+
Bundle ANS-104 dataitems.
|
|
302
|
+
|
|
303
|
+
```js
|
|
304
|
+
const { err, id } = await ar.bundle(dataitems)
|
|
305
|
+
```
|
|
306
|
+
`dataitems` are `[ [ data, tags ], [ data, tags ], [ data, tags ] ]`.
|
|
307
|
+
```js
|
|
308
|
+
const { err, id } = await ar.bundle([
|
|
309
|
+
[ "this is text", { "Content-Type": "text/plain" }],
|
|
310
|
+
[ "# this is markdown", { "Content-Type": "text/markdown" }],
|
|
311
|
+
[ png_image, { "Content-Type": "image/png" }]
|
|
312
|
+
])
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### AO
|
|
316
|
+
|
|
317
|
+
- [Instantiate](#instantiate-1)
|
|
318
|
+
- [deploy](#deploy)
|
|
319
|
+
- [msg](#msg)
|
|
320
|
+
- [dry](#dry)
|
|
321
|
+
- [asgn](#asgn)
|
|
322
|
+
- [load](#load)
|
|
323
|
+
- [eval](#eval)
|
|
324
|
+
- [spwn](#spwn)
|
|
325
|
+
- [aoconnect Functions](#aoconnect-functions)
|
|
326
|
+
- [postModule](#postmodule)
|
|
327
|
+
- [postScheduler](#postscheduler)
|
|
328
|
+
- [wait](#wait)
|
|
329
|
+
- [Function Piping](#function-piping)
|
|
330
|
+
|
|
331
|
+
#### Instantiate
|
|
332
|
+
|
|
333
|
+
You can initialize AO in the same way as AR.
|
|
334
|
+
|
|
335
|
+
```js
|
|
336
|
+
const ao = await new AO().init(arweaveWallet || jwk)
|
|
337
|
+
```
|
|
338
|
+
If you need to pass AR settings, use `ar`. `ao.ar` will be automatically available.
|
|
339
|
+
|
|
340
|
+
```js
|
|
341
|
+
const ao = await new AO({ ar: { port: 4000 }}).init(arweaveWallet || jwk)
|
|
342
|
+
const addr = ao.ar.addr
|
|
343
|
+
await ao.ar.post({ data, tags })
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
#### AO Core Functions
|
|
347
|
+
|
|
348
|
+
##### deploy
|
|
349
|
+
|
|
350
|
+
Spawn a process, get a Lua source, and eval the script. `src` is an Arweave txid of the Lua script.
|
|
351
|
+
|
|
352
|
+
```js
|
|
353
|
+
const { err, res, pid } = await ao.deploy({ data, tags, src, fills })
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
`fills` replace the Lua source script from `src`.
|
|
357
|
+
|
|
358
|
+
```lua
|
|
359
|
+
local replace_me = '<REPLACE_ME>'
|
|
360
|
+
local replace_me_again = '<REPLACE_ME_AGAIN>'
|
|
361
|
+
local replace_me_with_hello_again = '<REPLACE_ME>'
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
```js
|
|
365
|
+
const fills = { REPLACE_ME: "hello", REPLACE_ME_AGAIN: "world" }
|
|
366
|
+
```
|
|
367
|
+
This will end up in the following lua script.
|
|
368
|
+
|
|
369
|
+
```lua
|
|
370
|
+
local replace_me = 'hello'
|
|
371
|
+
local replace_me_again = 'world'
|
|
372
|
+
local replace_me_with_hello_again = 'hello'
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
In case you have multiple scripts, use `loads` and pass `src` and `fills` respectively.
|
|
376
|
+
|
|
377
|
+
```js
|
|
378
|
+
await ao.deploy({ tags, loads: [ { src, fills }, { src: src2, fills: fills2 } ] })
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
##### msg
|
|
383
|
+
|
|
384
|
+
Send a message.
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
```js
|
|
388
|
+
const { err, mid, res, out } = await ao.msg({
|
|
389
|
+
data, action, tags, check, checkData, get
|
|
390
|
+
})
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
`check` determins if the message call is successful by checking through `Tags` in `Messages` in `res`.
|
|
394
|
+
|
|
395
|
+
```js
|
|
396
|
+
const check = { "Status" : "Success" } // succeeds if Status tag is "Success"
|
|
397
|
+
const check2 = { "Status" : true } // succeeds if Status tag exists
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
`checkData` checks `Data` field instead of `Tags`.
|
|
402
|
+
|
|
403
|
+
```js
|
|
404
|
+
const checkData = "Success" // succeeds if Data field is "Success"
|
|
405
|
+
const checkData2 = true // succeeds if Data field exists
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
`get` will return specified data via `out`.
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
```js
|
|
412
|
+
const get = "ID" // returns the value of "ID" tag
|
|
413
|
+
const get2 = { name: "Profile", json: true } // "Profile" tag with JSON.parse()
|
|
414
|
+
const get3 = { data: true, json: true } // returns Data field with JSON.parse()
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
##### dry
|
|
418
|
+
|
|
419
|
+
Dryrun a message without writing to Arweave.
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
```js
|
|
423
|
+
const { err, res, out } = await ao.dry({
|
|
424
|
+
data, action, tags, check, checkData, get
|
|
425
|
+
})
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
##### asgn
|
|
429
|
+
|
|
430
|
+
Assign an existing message to a process.
|
|
431
|
+
|
|
432
|
+
```js
|
|
433
|
+
const { err, mid, res, out } = await ao.asgn({ pid, mid, check, checkData, get })
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
##### load
|
|
437
|
+
|
|
438
|
+
Get a Lua source script from Arweave and eval it on a process.
|
|
439
|
+
|
|
440
|
+
```js
|
|
441
|
+
const { err, res, mid } = await ao.load({ src, fills, pid })
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
##### eval
|
|
445
|
+
|
|
446
|
+
Eval a Lua script on a process.
|
|
447
|
+
|
|
448
|
+
```js
|
|
449
|
+
const { err, res, mid } = await ao.eval({ pid, data })
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
##### spwn
|
|
453
|
+
|
|
454
|
+
Spawn a process. `module` and `scheduler` are auto-set if omitted.
|
|
455
|
+
|
|
456
|
+
```js
|
|
457
|
+
const { err, res, pid } = await ao.spwn({ module, scheduler, tags, data })
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
#### aoconnect Functions
|
|
461
|
+
|
|
462
|
+
The original aoconnect functions `message` | `spawn` | `result` | `assign` | `dryrun` are also available.
|
|
463
|
+
`createDataItemSigner` is available as `toSigner`.
|
|
464
|
+
|
|
465
|
+
```js
|
|
466
|
+
const signer = ao.toSigner(jwk)
|
|
467
|
+
const process = await ao.spawn({ module, scheduler, signer, tags, data })
|
|
468
|
+
const message = await ao.message({ process, signer, tags, data })
|
|
469
|
+
const result = await ao.result({ process, message })
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
#### Advanced Functions
|
|
473
|
+
|
|
474
|
+
##### postModule
|
|
475
|
+
|
|
476
|
+
`data` should be wasm binary. `overwrite` to replace the default module set to the AO instance.
|
|
477
|
+
|
|
478
|
+
```js
|
|
479
|
+
const { err, id: module } = await ao.postModule({ data, jwk, tags, overwrite })
|
|
480
|
+
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
##### postScheduler
|
|
484
|
+
|
|
485
|
+
This will post `Scheduler-Location` with the `jwk` address as the returning `scheduler`.
|
|
486
|
+
|
|
487
|
+
```js
|
|
488
|
+
const { err, scheduler } = await ao.postScheduler({ url, jwk, tags, overwrite })
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
##### wait
|
|
492
|
+
|
|
493
|
+
`wait` untill the process becomes available after `spwn`. This is mostly used internally with `deploy`.
|
|
494
|
+
|
|
495
|
+
```js
|
|
496
|
+
const { err } = await ao.wait({ pid })
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
#### Function Piping
|
|
500
|
+
|
|
501
|
+
Most functions return in the format of `{ err, res, out, pid, mid, id }`, and these function can be chained with `pipe`, which makes executing multiple messages a breeze.
|
|
502
|
+
|
|
503
|
+
For example, following is how `deploy` uses `pipe` internally. The execusion will be immediately aborted if any of the functions in `fns` produces an error.
|
|
504
|
+
|
|
505
|
+
```js
|
|
506
|
+
let fns = [
|
|
507
|
+
{
|
|
508
|
+
fn: "spwn",
|
|
509
|
+
args: { module, scheduler, tags, data },
|
|
510
|
+
then: { "args.pid": "pid" },
|
|
511
|
+
},
|
|
512
|
+
{ fn: "wait", then: { "args.pid": "pid" } },
|
|
513
|
+
{ fn: "load", args: { src, fills }, then: { "args.pid": "pid" } }
|
|
514
|
+
]
|
|
515
|
+
const { err, res, out, pid } = await this.pipe({ jwk, fns })
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
##### bind
|
|
519
|
+
|
|
520
|
+
If the function comes from other instances rather than `AO`, use `bind`.
|
|
521
|
+
|
|
522
|
+
```js
|
|
523
|
+
const fns = [{ fn: "post", bind: this.ar, args: { data, tags }}]
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
##### then
|
|
527
|
+
|
|
528
|
+
You can pass values between functions with `then`. For instance, passing the result from the previous functions to the next function's arguments is a common operation.
|
|
529
|
+
|
|
530
|
+
```js
|
|
531
|
+
const fns = [
|
|
532
|
+
{ fn: "post", bind: ao.ar, args: { data, tags }, then: ({ id, args, out })=>{
|
|
533
|
+
args.tags.TxId = id // adding TxId tag to `msg` args
|
|
534
|
+
out.txid = id // `out` will be returned at last with `pipe`
|
|
535
|
+
}},
|
|
536
|
+
{ fn: "msg", args: { pid, tags }},
|
|
537
|
+
]
|
|
538
|
+
const { out: { txid } } = await ao.pipe({ fns, jwk })
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
If `then` returns a value, `pipe` will immediately return with that single value. You can also use `err` to abort `pipe` with an error.
|
|
542
|
+
|
|
543
|
+
```js
|
|
544
|
+
const fns = [
|
|
545
|
+
{ fn: "msg", args: { pid, tags }, then: ({ inp })=>{
|
|
546
|
+
if(inp.done) return inp.val
|
|
547
|
+
}},
|
|
548
|
+
{ fn: "msg", args: { pid, tags }, err: ({ inp })=>{
|
|
549
|
+
if(!inp.done) return "something went wrong"
|
|
550
|
+
}},
|
|
551
|
+
]
|
|
552
|
+
const val = await ao.pipe({ jwk, fns })
|
|
553
|
+
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
`then` has many useful parameters.
|
|
557
|
+
|
|
558
|
+
- `res` : `res` from the previous result
|
|
559
|
+
- `args` : `args` for the next function
|
|
560
|
+
- `out` : `out` the final `out` result from the `pipe` sequence
|
|
561
|
+
- `inp` : `out` from the previous result
|
|
562
|
+
- `_` : if values are assigned to the `_` fields, `pipe` returns them as top-level fields in the end
|
|
563
|
+
- `pid` : `pid` will be passed if any previous functions returns `pid` ( e.g. `deploy` )
|
|
564
|
+
- `mid` : `mid` will be passed if any previous functions returns `mid` ( e.g. `msg` )
|
|
565
|
+
- `id` : `id` will be passed if any previous functions returns `id` ( e.g. `post` )
|
|
566
|
+
|
|
567
|
+
`then` can be a simplified hashmap object.
|
|
568
|
+
|
|
569
|
+
```js
|
|
570
|
+
let fns = [
|
|
571
|
+
{
|
|
572
|
+
fn: "msg",
|
|
573
|
+
args: { tags },
|
|
574
|
+
then: { "args.mid": "mid", "out.key": "inp.a", "_.val": "inp.b" },
|
|
575
|
+
},
|
|
576
|
+
{ fn: "some_func", args: {} } // args.mid will be set from the previous `then`
|
|
577
|
+
]
|
|
578
|
+
const { out: { key }, val } = await ao.pipe({ jwk, fns })
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
##### cb
|
|
582
|
+
|
|
583
|
+
`cb` can report the current progress of `pipe` after every function execution.
|
|
584
|
+
|
|
585
|
+
```js
|
|
586
|
+
await ao.pipe({ jwk, fns, cb: ({ i, fns, inp })=>{
|
|
587
|
+
console.log(`${i} / ${fns.length} functions executed`)
|
|
588
|
+
}})
|
|
589
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "AO", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _ao["default"];
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "AR", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _ar["default"];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _ar = _interopRequireDefault(require("./ar.js"));
|
|
19
|
+
var _ao = _interopRequireDefault(require("./ao.js"));
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wao",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "cjs/index.js",
|
|
6
|
+
"module": "esm/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"require": "./cjs/index.js",
|
|
10
|
+
"import": "./esm/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./utils": {
|
|
13
|
+
"require": "./cjs/utils.js",
|
|
14
|
+
"import": "./esm/utils.js"
|
|
15
|
+
},
|
|
16
|
+
"./connect": {
|
|
17
|
+
"require": "./cjs/aoconnect.js",
|
|
18
|
+
"import": "./esm/aoconnect.js"
|
|
19
|
+
},
|
|
20
|
+
"./test": {
|
|
21
|
+
"require": "./cjs/helpers.js",
|
|
22
|
+
"import": "./esm/helpers.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"author": "",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@babel/plugin-transform-modules-commonjs": "^7.24.8",
|
|
29
|
+
"@permaweb/ao-loader": "^0.0.43",
|
|
30
|
+
"@permaweb/aoconnect": "^0.0.61",
|
|
31
|
+
"arbundles": "^0.11.1",
|
|
32
|
+
"arweave": "^1.15.1",
|
|
33
|
+
"base64url": "^3.0.1",
|
|
34
|
+
"ramda": "^0.30.1"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/make.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { writeFileSync, readFileSync } from "fs"
|
|
2
|
+
import { resolve } from "path"
|
|
3
|
+
|
|
4
|
+
const packageJson = resolve(import.meta.dirname, "package.json")
|
|
5
|
+
const packageJsonDist = resolve(import.meta.dirname, "dist/package.json")
|
|
6
|
+
const packageJsonDist2 = resolve(import.meta.dirname, "dist/esm/package.json")
|
|
7
|
+
const json = JSON.parse(readFileSync(packageJson, "utf8"))
|
|
8
|
+
delete json.type
|
|
9
|
+
delete json.devDependencies
|
|
10
|
+
delete json.scripts
|
|
11
|
+
json.main = "cjs/index.js"
|
|
12
|
+
json.module = "esm/index.js"
|
|
13
|
+
|
|
14
|
+
console.log(json)
|
|
15
|
+
writeFileSync(packageJsonDist, JSON.stringify(json, undefined, 2))
|
|
16
|
+
|
|
17
|
+
const json2 = JSON.parse(readFileSync(packageJson, "utf8"))
|
|
18
|
+
json2.type = "module"
|
|
19
|
+
delete json2.devDependencies
|
|
20
|
+
delete json2.scripts
|
|
21
|
+
delete json2.main
|
|
22
|
+
json2.module = "index.js"
|
|
23
|
+
//writeFileSync(packageJsonDist2, JSON.stringify(json2, undefined, 2))
|
package/package.json
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wao",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/cjs/index.js",
|
|
7
|
+
"module": "dist/src/index.js",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build:cjs": "babel src --out-dir dist/cjs --config-file ./.babelrc-cjs && rm dist/cjs/test.js",
|
|
10
|
+
"build": "rm -rf dist && npm run build:cjs && cp src -rf dist/esm && node make.js && cp .npmignore dist/ && cp src/lua dist/cjs/lua -rf",
|
|
11
|
+
"test": "mocha --node-option=experimental-wasm-memory64"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"require": "./cjs/index.js",
|
|
16
|
+
"import": "./esm/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./utils": {
|
|
19
|
+
"require": "./cjs/utils.js",
|
|
20
|
+
"import": "./esm/utils.js"
|
|
21
|
+
},
|
|
22
|
+
"./connect": {
|
|
23
|
+
"require": "./cjs/aoconnect.js",
|
|
24
|
+
"import": "./esm/aoconnect.js"
|
|
25
|
+
},
|
|
26
|
+
"./test": {
|
|
27
|
+
"require": "./cjs/helpers.js",
|
|
28
|
+
"import": "./esm/helpers.js"
|
|
29
|
+
}
|
|
9
30
|
},
|
|
10
31
|
"author": "",
|
|
11
32
|
"license": "MIT",
|
|
@@ -17,5 +38,13 @@
|
|
|
17
38
|
"arweave": "^1.15.1",
|
|
18
39
|
"base64url": "^3.0.1",
|
|
19
40
|
"ramda": "^0.30.1"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@babel/cli": "^7.24.8",
|
|
44
|
+
"@babel/core": "^7.25.2",
|
|
45
|
+
"@babel/preset-env": "^7.25.3",
|
|
46
|
+
"chai": "^5.1.1",
|
|
47
|
+
"mocha": "^10.7.3",
|
|
48
|
+
"yargs": "^17.7.2"
|
|
20
49
|
}
|
|
21
|
-
}
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"ar":{"port":4000},"jwk":{"kty":"RSA","n":"vAiSYEBIogdeHhE1c-WoZOrrpsqing6sDQffTJYI7v2Hik7WkjhtxoXH3xlWk-dfUUXdntGEoaU9cBIdBz4EczxIkvBZ0e2bJQgDrZfbuQgy7RMdcvvCDQYXhQqF_DkmCbxDjpnP_W_Z3wL_7Sil5Ru5Jj_M_c6cyODuOiv8WZUZRi1KCoSuUVZr6dgiqGmzU_tBtZgoEtStKb29RHtT0PgpktWTYTk1nHWpOrA0mJMivrDdLmLfexFe_bPpZp-cW9MxOzbdj_jG3VpZE6iT6z-g2H2sQC2xROCvYMrhu2JrV447gOT81PKPw4sUw1aPE17GKg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JbuKpIZ9uUmeLMtelAECsMblLMTiUaRrXnTM9WezXwjwFqqqf7LTapzGPC0W4U7vRyV6ZpFzJ_VdLlWKMcsoByw6E-iUP3eE8qsvmfFdY4N1dBOU0FdRdf96BZUYA69pZ3pylykjUWK6rnATMl8dYN5yGecDdDCNleQjRv9n3kmIOpBGCt9qLvpi66HHzlCpt0AQTSQ41GqKvnN6hOJh7pNI_qfMvI9cBhsdUa3HEzaE7N3tzlVke37BQYMmSO88grsX5jIV_nc8BZ4EQ","qi":"8XcLLnE-6jPJURB3K-BNPBylUxXwQwEeMs4MX7tFXqxnnh2A23tVhOXESEb6PDkKe2Gql78B6_WrbtiTozV_-c6M0VjqGHRor62dBCvef9mUpiPUxkbflwlmcbqGTuiCNZyoZxR-8Pf0E2al2WxEkKeQjkplNHWt433A6hbx3rx8HsWAdM4RhY3LMsddGpFMc5gjm5PmTKo33uC15X16SmpC00SeVDnKaoiWWI3005RmMP2Wfago9XCTEwBsWeozQC7R2zI3CuW7jX3W6UeUYPoEeS3Qa0suCP4CqCbfNwstl-SQhWtm2IVBpbOZTDQ6e0cYUyyMGVh1AMCoehHMrw"},"module_sqlite":"I2E4Uu9bVmxCmXmfSfwQ3hOosbGRIKpF5qebATBylzs","ao":{"module":"I2E4Uu9bVmxCmXmfSfwQ3hOosbGRIKpF5qebATBylzs","scheduler":"9uDpdXg7JjC8xonD61nylkcjA2QYIti7jqSKgxOuLWs","aoconnect":{"MU_URL":"http://localhost:4002","CU_URL":"http://localhost:4004","GATEWAY_URL":"http://localhost:4000"},"ar":{"port":4000},"authority":"XztbUZU7D8lAcWlbg0avCD0s2lMBbFGgTC4YzLcOR90"},"ao2":{"module":"KCRP66Aq-4uQ7R556SgaNtzDNSnRJW4DA1m5sgxirDk","scheduler":"9uDpdXg7JjC8xonD61nylkcjA2QYIti7jqSKgxOuLWs","aoconnect":{"MU_URL":"http://localhost:4002","CU_URL":"http://localhost:4004","GATEWAY_URL":"http://localhost:4000"},"ar":{"port":4000},"authority":"XztbUZU7D8lAcWlbg0avCD0s2lMBbFGgTC4YzLcOR90"},"profile":{"module":"I2E4Uu9bVmxCmXmfSfwQ3hOosbGRIKpF5qebATBylzs","registry_src":"maJGJ2tAa6zVtW1rGhngNlhEZDUqbCwO3r5mYxDBCsQ","registry":"yRmn7BZDk_c916ZNy8JBY-H52vYMrP8SBp-npeOgAbU","profile_src":"LNTKw-wvmybqSrxvtMYtdplOADLAey1c8FpNXoMa638","ao":{"module":"I2E4Uu9bVmxCmXmfSfwQ3hOosbGRIKpF5qebATBylzs","scheduler":"9uDpdXg7JjC8xonD61nylkcjA2QYIti7jqSKgxOuLWs","aoconnect":{"MU_URL":"http://localhost:4002","CU_URL":"http://localhost:4004","GATEWAY_URL":"http://localhost:4000"},"ar":{"port":4000},"authority":"XztbUZU7D8lAcWlbg0avCD0s2lMBbFGgTC4YzLcOR90"}},"note":{"proxy":"0uUOLKRlt-4zume2JnSeIYFlSK6-5mH51kdj6o3Q4jw","note_src":"XmteOz1FGAFKGLRtVQo65-ggchiQJ1bJ7OrHueZDK8I","profile":{"module":"I2E4Uu9bVmxCmXmfSfwQ3hOosbGRIKpF5qebATBylzs","registry_src":"maJGJ2tAa6zVtW1rGhngNlhEZDUqbCwO3r5mYxDBCsQ","registry":"yRmn7BZDk_c916ZNy8JBY-H52vYMrP8SBp-npeOgAbU","profile_src":"LNTKw-wvmybqSrxvtMYtdplOADLAey1c8FpNXoMa638","ao":{"module":"I2E4Uu9bVmxCmXmfSfwQ3hOosbGRIKpF5qebATBylzs","scheduler":"9uDpdXg7JjC8xonD61nylkcjA2QYIti7jqSKgxOuLWs","aoconnect":{"MU_URL":"http://localhost:4002","CU_URL":"http://localhost:4004","GATEWAY_URL":"http://localhost:4000"},"ar":{"port":4000},"authority":"XztbUZU7D8lAcWlbg0avCD0s2lMBbFGgTC4YzLcOR90"}}},"notebook":{"notebook_src":"cAa0NBOgYfQPRH6DEcKxrLBm4QExws4FCKAyP-LHufg","registry":"EGVoxgKS9V4z6w21RJ9HiM3Q6TcwgwdwX8INSUTUuKE","registry_src":"6EX6wZ8RfUHbSfUvhU5Aby7q52czm0T-RckiOrIG4Wc","profile":{"module":"I2E4Uu9bVmxCmXmfSfwQ3hOosbGRIKpF5qebATBylzs","registry_src":"maJGJ2tAa6zVtW1rGhngNlhEZDUqbCwO3r5mYxDBCsQ","registry":"yRmn7BZDk_c916ZNy8JBY-H52vYMrP8SBp-npeOgAbU","profile_src":"LNTKw-wvmybqSrxvtMYtdplOADLAey1c8FpNXoMa638","ao":{"module":"I2E4Uu9bVmxCmXmfSfwQ3hOosbGRIKpF5qebATBylzs","scheduler":"9uDpdXg7JjC8xonD61nylkcjA2QYIti7jqSKgxOuLWs","aoconnect":{"MU_URL":"http://localhost:4002","CU_URL":"http://localhost:4004","GATEWAY_URL":"http://localhost:4000"},"ar":{"port":4000},"authority":"XztbUZU7D8lAcWlbg0avCD0s2lMBbFGgTC4YzLcOR90"}}},"asset":{"asset_src":"sZe0uqoLAlzFtFcATqERh_Jg3yvyJ-P1Fp7MstYUr8E","profile":{"module":"I2E4Uu9bVmxCmXmfSfwQ3hOosbGRIKpF5qebATBylzs","registry_src":"maJGJ2tAa6zVtW1rGhngNlhEZDUqbCwO3r5mYxDBCsQ","registry":"yRmn7BZDk_c916ZNy8JBY-H52vYMrP8SBp-npeOgAbU","profile_src":"LNTKw-wvmybqSrxvtMYtdplOADLAey1c8FpNXoMa638","ao":{"module":"I2E4Uu9bVmxCmXmfSfwQ3hOosbGRIKpF5qebATBylzs","scheduler":"9uDpdXg7JjC8xonD61nylkcjA2QYIti7jqSKgxOuLWs","aoconnect":{"MU_URL":"http://localhost:4002","CU_URL":"http://localhost:4004","GATEWAY_URL":"http://localhost:4000"},"ar":{"port":4000},"authority":"XztbUZU7D8lAcWlbg0avCD0s2lMBbFGgTC4YzLcOR90"}}},"collection":{"collection_src":"5MGgg1uHqI04MS7ZZNJSDYld2CqxyC9Aws08k4VZey0","registry":"EGVoxgKS9V4z6w21RJ9HiM3Q6TcwgwdwX8INSUTUuKE","registry_src":"6EX6wZ8RfUHbSfUvhU5Aby7q52czm0T-RckiOrIG4Wc","profile":{"module":"I2E4Uu9bVmxCmXmfSfwQ3hOosbGRIKpF5qebATBylzs","registry_src":"maJGJ2tAa6zVtW1rGhngNlhEZDUqbCwO3r5mYxDBCsQ","registry":"yRmn7BZDk_c916ZNy8JBY-H52vYMrP8SBp-npeOgAbU","profile_src":"LNTKw-wvmybqSrxvtMYtdplOADLAey1c8FpNXoMa638","ao":{"module":"I2E4Uu9bVmxCmXmfSfwQ3hOosbGRIKpF5qebATBylzs","scheduler":"9uDpdXg7JjC8xonD61nylkcjA2QYIti7jqSKgxOuLWs","aoconnect":{"MU_URL":"http://localhost:4002","CU_URL":"http://localhost:4004","GATEWAY_URL":"http://localhost:4000"},"ar":{"port":4000},"authority":"XztbUZU7D8lAcWlbg0avCD0s2lMBbFGgTC4YzLcOR90"}}},"modules":{"aos2":"KCRP66Aq-4uQ7R556SgaNtzDNSnRJW4DA1m5sgxirDk","aos1":"WpmAgOtIAWrtwyrMpWQv8bsINlFo9N8qu8lXng-Hjv0","sqlite":"I2E4Uu9bVmxCmXmfSfwQ3hOosbGRIKpF5qebATBylzs"}}
|
package/src/index.js
ADDED
package/src/test.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Profile, AR, AO, Collection, Notebook } from "./index.js"
|
|
2
|
+
import { expect } from "chai"
|
|
3
|
+
import { createDataItemSigner, connect } from "@permaweb/aoconnect"
|
|
4
|
+
import { resolve } from "path"
|
|
5
|
+
import { readFileSync } from "fs"
|
|
6
|
+
export class Src {
|
|
7
|
+
constructor({ ar, base = "./lua", readFileSync, dir, resolve }) {
|
|
8
|
+
this.ar = ar
|
|
9
|
+
this.base = base
|
|
10
|
+
this.dir = dir
|
|
11
|
+
}
|
|
12
|
+
async upload(file, ext = "lua") {
|
|
13
|
+
const data = readFileSync(
|
|
14
|
+
`${this.dir}/${this.base}/${file}.${ext}`,
|
|
15
|
+
ext === "wasm" ? null : "utf8",
|
|
16
|
+
)
|
|
17
|
+
const res = await this.ar.post({ data })
|
|
18
|
+
return res.err ? null : res.id
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const setup = async ({ aoconnect, arweave } = {}) => {
|
|
23
|
+
console.error = () => {}
|
|
24
|
+
console.warn = () => {}
|
|
25
|
+
arweave ??= { port: 4000 }
|
|
26
|
+
aoconnect ??= {
|
|
27
|
+
MU_URL: "http://localhost:4002",
|
|
28
|
+
CU_URL: "http://localhost:4004",
|
|
29
|
+
GATEWAY_URL: "http://localhost:4000",
|
|
30
|
+
}
|
|
31
|
+
const dir = resolve(import.meta.dirname)
|
|
32
|
+
const thumbnail = readFileSync(`${dir}/assets/thumbnail.png`)
|
|
33
|
+
const banner = readFileSync(resolve(`${dir}/assets/banner.png`))
|
|
34
|
+
const ar = new AR(arweave)
|
|
35
|
+
await ar.gen("10")
|
|
36
|
+
const src = new Src({ ar, readFileSync, dir })
|
|
37
|
+
const notelib_src = await src.upload("atomic-note-library")
|
|
38
|
+
const registry_src = await src.upload("registry000")
|
|
39
|
+
const profile_src = await src.upload("profile000")
|
|
40
|
+
const collection_registry_src = await src.upload("collection-registry")
|
|
41
|
+
const notebook_src = await src.upload("notebook")
|
|
42
|
+
const note_src = await src.upload("atomic-note")
|
|
43
|
+
const proxy = await src.upload("proxy")
|
|
44
|
+
const wasm = await src.upload("aos-sqlite", "wasm")
|
|
45
|
+
const wasm2 = await src.upload("aos", "wasm")
|
|
46
|
+
const ao = new AO({ aoconnect, ar })
|
|
47
|
+
|
|
48
|
+
const { id: module_sqlite } = await ao.postModule({
|
|
49
|
+
data: await ar.data(wasm),
|
|
50
|
+
overwrite: true,
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
const { scheduler } = await ao.postScheduler({
|
|
54
|
+
url: "http://su",
|
|
55
|
+
overwrite: true,
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const profile = new Profile({ profile_src, registry_src, ao })
|
|
59
|
+
await profile.createRegistry({})
|
|
60
|
+
const notebook = new Notebook({
|
|
61
|
+
notebook_src,
|
|
62
|
+
registry_src: collection_registry_src,
|
|
63
|
+
profile,
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
await notebook.createRegistry()
|
|
67
|
+
const { id: module } = await ao.postModule({ data: await ar.data(wasm2) })
|
|
68
|
+
const { pid: proxy_pid } = await ao.deploy({ src: proxy, module })
|
|
69
|
+
|
|
70
|
+
let opt = {
|
|
71
|
+
ar: { ...arweave },
|
|
72
|
+
profile: { registry_src, registry: profile.registry, profile_src },
|
|
73
|
+
ao: { module: module_sqlite, scheduler, aoconnect },
|
|
74
|
+
note: { proxy: proxy_pid, note_src, notelib_src },
|
|
75
|
+
notebook: {
|
|
76
|
+
notebook_src,
|
|
77
|
+
registry: notebook.registry,
|
|
78
|
+
registry_src: collection_registry_src,
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
return { opt, profile, ao, ar, thumbnail, banner }
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const ok = obj => {
|
|
85
|
+
if (obj.err) console.log(obj.err)
|
|
86
|
+
expect(obj.err).to.eql(null)
|
|
87
|
+
return obj
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const fail = obj => {
|
|
91
|
+
if (!obj.err) console.log(obj.res)
|
|
92
|
+
expect(obj.err).to.not.eql(null)
|
|
93
|
+
return obj
|
|
94
|
+
}
|
package/test/.cache/opt.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"ar":{"port":4000},"jwk":{"kty":"RSA","n":"
|
|
1
|
+
{"ar":{"port":4000},"jwk":{"kty":"RSA","n":"wsyarqJvBMvXHsVbWP-Z2A8dN53UZ426QWsVTkFGk93CmsYnWFlhtFsPH75Iy1sL4holEJJI6bdbswwPK6Cp00HhhqTePxLgW6VDWdRpIMlJgSDa9PkPN7irCD0fx1Qvn0AzZHuOL3K7_Sz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44lNfpVfyNHGvA14Jx6mWUFwVd10FgvOdcz_KnHvAUeon1a-7lHPkmUP0TCrjCQ_bBXsmtBer6l90npNb_5T-sbXFunDMAMpdROK8cDCU8Q","dq":"PaqHcdSV073sPFc0CNIXjctK43zJS5VskQrodLNbw2DVh1n3gxYPoH840_mMNX8wnLJVMt0RhPLbaQgq6ioTHT1sGUk09zd8c0EId71KdL9b3c_U7xlakvqIVIhTha9XlgJbpLY5bQ5vVyd-tJplfzD6_wovJDDpheYiOVPkYBfgKbQ8Ad577xjtja4vvd7fWjZTf0nRkM3k4rK0ovZVAIIzaiXpbM-VGLlrwNMB4cvhU0Mx8hqQr_9BeWb189ukcAstYdS-vR68DwzNOIi3LgnIfCHaMqLWZQY09cgM7g1F-udEV9ZTaDCL3iyOqUY7ObcXWp60RvBICAf4r-hciQ","qi":"FWul7oSZaQdGa-WzHNKEDRM6PI6m8arWnzU8wEuvIxEWVdwfDvWsWEpmTdfw87dnGXezEx35hYjAWwvugmwaHB3s57keydhHyjjHZQFhKfYIKlWBnQKyWZO3RPJkohe8vZZZuDwW3v6gr_TYZoPOZ1685-FJM94TuhC8wBhsCP1Dc1vYQAO1wkzQKLxw1EI4q5iqjU2UICxkYZE_Fs0XwEZPN51uK33bsdyihfdidDrHbGyoZ3qLInBfcHPmx8hdzcUSIHoswLlsDc4S7ojtH0DpfhgrF_mElH-sUroIknKND9OJGvG5lCcso3KUXeTHs2caHt5SgZcD5G0s_4v1Tg"},"ao":{"module":"scFcvpwMp8IQErKvgqzTMRH9mvMUBke0YjrlEpAMdMs","scheduler":"Pkrt9mwwpBAiXX1tBF_rVs6BTAWsmj9smPr-o_i8BV8","aoconnect":{"local":true},"ar":{"port":4000},"authority":null},"ao2":{"module":"T2paWyXNaBOEmRbA5eNhtAHRplruIUw3e-xDKVJnwuM","scheduler":"Pkrt9mwwpBAiXX1tBF_rVs6BTAWsmj9smPr-o_i8BV8","aoconnect":{"local":true},"ar":{"port":4000},"authority":null},"authority":null,"targets":{"profile":false,"note":false,"asset":false},"modules":{"aos2":"T2paWyXNaBOEmRbA5eNhtAHRplruIUw3e-xDKVJnwuM","aos1":"5B9JSpy2_AagJSWW51dQ4Ixq3ULEBiEweaZKDtB3B90","sqlite":"scFcvpwMp8IQErKvgqzTMRH9mvMUBke0YjrlEpAMdMs"}}
|
package/test/test.js
CHANGED
|
@@ -1,94 +1,50 @@
|
|
|
1
|
-
import { Profile, AR, AO, Collection, Notebook } from "./index.js"
|
|
2
1
|
import { expect } from "chai"
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const notebook_src = await src.upload("notebook")
|
|
42
|
-
const note_src = await src.upload("atomic-note")
|
|
43
|
-
const proxy = await src.upload("proxy")
|
|
44
|
-
const wasm = await src.upload("aos-sqlite", "wasm")
|
|
45
|
-
const wasm2 = await src.upload("aos", "wasm")
|
|
46
|
-
const ao = new AO({ aoconnect, ar })
|
|
47
|
-
|
|
48
|
-
const { id: module_sqlite } = await ao.postModule({
|
|
49
|
-
data: await ar.data(wasm),
|
|
50
|
-
overwrite: true,
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
const { scheduler } = await ao.postScheduler({
|
|
54
|
-
url: "http://su",
|
|
55
|
-
overwrite: true,
|
|
2
|
+
import { connect } from "../src/aoconnect.js"
|
|
3
|
+
import { AO } from "../src/index.js"
|
|
4
|
+
|
|
5
|
+
const src_data = `
|
|
6
|
+
Handlers.add( "Hello", "Hello", function (msg)
|
|
7
|
+
msg.reply({ Data = "Hello, World!" })
|
|
8
|
+
end
|
|
9
|
+
)
|
|
10
|
+
`
|
|
11
|
+
describe("WAO", function () {
|
|
12
|
+
this.timeout(0)
|
|
13
|
+
describe("Aoconnect", function () {
|
|
14
|
+
let message, dryrun, spawn, signer
|
|
15
|
+
|
|
16
|
+
before(async () => {
|
|
17
|
+
;({
|
|
18
|
+
accounts: [{ signer }],
|
|
19
|
+
spawn,
|
|
20
|
+
message,
|
|
21
|
+
dryrun,
|
|
22
|
+
} = connect())
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it("should spawn a process send messages", async () => {
|
|
26
|
+
const pid = await spawn({ signer })
|
|
27
|
+
await message({
|
|
28
|
+
process: pid,
|
|
29
|
+
tags: [{ name: "Action", value: "Eval" }],
|
|
30
|
+
data: src_data,
|
|
31
|
+
signer,
|
|
32
|
+
})
|
|
33
|
+
const res = await dryrun({
|
|
34
|
+
process: pid,
|
|
35
|
+
tags: [{ name: "Action", value: "Hello" }],
|
|
36
|
+
signer,
|
|
37
|
+
})
|
|
38
|
+
expect(res.Messages[0].Data).to.eql("Hello, World!")
|
|
39
|
+
})
|
|
56
40
|
})
|
|
57
41
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
42
|
+
describe("SDK", function () {
|
|
43
|
+
let ao
|
|
44
|
+
before(async () => (ao = await new AO({ in_memory: true }).init()))
|
|
45
|
+
it("should spawn a process send messages", async () => {
|
|
46
|
+
const { p } = await ao.deploy({ src_data })
|
|
47
|
+
expect(await p.d("Hello")).to.eql("Hello, World!")
|
|
48
|
+
})
|
|
64
49
|
})
|
|
65
|
-
|
|
66
|
-
await notebook.createRegistry()
|
|
67
|
-
const { id: module } = await ao.postModule({ data: await ar.data(wasm2) })
|
|
68
|
-
const { pid: proxy_pid } = await ao.deploy({ src: proxy, module })
|
|
69
|
-
|
|
70
|
-
let opt = {
|
|
71
|
-
ar: { ...arweave },
|
|
72
|
-
profile: { registry_src, registry: profile.registry, profile_src },
|
|
73
|
-
ao: { module: module_sqlite, scheduler, aoconnect },
|
|
74
|
-
note: { proxy: proxy_pid, note_src, notelib_src },
|
|
75
|
-
notebook: {
|
|
76
|
-
notebook_src,
|
|
77
|
-
registry: notebook.registry,
|
|
78
|
-
registry_src: collection_registry_src,
|
|
79
|
-
},
|
|
80
|
-
}
|
|
81
|
-
return { opt, profile, ao, ar, thumbnail, banner }
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export const ok = obj => {
|
|
85
|
-
if (obj.err) console.log(obj.err)
|
|
86
|
-
expect(obj.err).to.eql(null)
|
|
87
|
-
return obj
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export const fail = obj => {
|
|
91
|
-
if (!obj.err) console.log(obj.res)
|
|
92
|
-
expect(obj.err).to.not.eql(null)
|
|
93
|
-
return obj
|
|
94
|
-
}
|
|
50
|
+
})
|
package/cjs/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "AO", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function get() {
|
|
10
|
-
return _ao["default"];
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, "AR", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _ar["default"];
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
exports.utils = void 0;
|
|
20
|
-
var _ar = _interopRequireDefault(require("./ar.js"));
|
|
21
|
-
var _ao = _interopRequireDefault(require("./ao.js"));
|
|
22
|
-
var utils = _interopRequireWildcard(require("./utils.js"));
|
|
23
|
-
exports.utils = utils;
|
|
24
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
25
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
26
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
package/esm/index.js
DELETED
package/test/index.js
DELETED
package/test/package.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "wao",
|
|
3
|
-
"version": "0.1.2",
|
|
4
|
-
"description": "",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"module": "index.js",
|
|
7
|
-
"engines": {
|
|
8
|
-
"node": ">=20.0.0"
|
|
9
|
-
},
|
|
10
|
-
"author": "",
|
|
11
|
-
"license": "MIT",
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@babel/plugin-transform-modules-commonjs": "^7.24.8",
|
|
14
|
-
"@permaweb/ao-loader": "^0.0.43",
|
|
15
|
-
"@permaweb/aoconnect": "^0.0.61",
|
|
16
|
-
"arbundles": "^0.11.1",
|
|
17
|
-
"arweave": "^1.15.1",
|
|
18
|
-
"base64url": "^3.0.1",
|
|
19
|
-
"ramda": "^0.30.1"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
File without changes
|
/package/{cjs → dist/cjs}/ao.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/{cjs → dist/cjs}/ar.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{esm → dist/esm}/ao.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/{esm → dist/esm}/ar.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{test → src}/ao.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/{test → src}/ar.js
RENAMED
|
File without changes
|
/package/{test → src}/dirname.js
RENAMED
|
File without changes
|
/package/{test → src}/helpers.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/{test → src}/utils.js
RENAMED
|
File without changes
|