wao 0.5.3 → 0.5.5
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 +1 -1
- package/cjs/aoconnect.js +156 -135
- package/cjs/helpers.js +1 -1
- package/cjs/server.js +167 -99
- package/cjs/tar.js +87 -61
- package/esm/ao.js +1 -3
- package/esm/aoconnect.js +6 -1
- package/esm/helpers.js +1 -1
- package/esm/server.js +74 -12
- package/esm/tar.js +11 -4
- package/esm/tgql.js +1 -0
- package/package.json +2 -1
package/cjs/tar.js
CHANGED
|
@@ -149,7 +149,10 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
149
149
|
return this.arweave.wallets.jwkToAddress(jwk);
|
|
150
150
|
case 9:
|
|
151
151
|
owner = _context2.sent;
|
|
152
|
-
this.mem.addrmap[owner] =
|
|
152
|
+
this.mem.addrmap[owner] = {
|
|
153
|
+
address: owner,
|
|
154
|
+
key: jwk.n
|
|
155
|
+
};
|
|
153
156
|
_context2.next = 13;
|
|
154
157
|
return this.postTx(tx, jwk, {
|
|
155
158
|
recipient: "",
|
|
@@ -207,7 +210,10 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
207
210
|
_context3.t1 = _context3.sent;
|
|
208
211
|
hashBuffer = _context3.t0.from.call(_context3.t0, _context3.t1);
|
|
209
212
|
owner = _base64url["default"].encode(hashBuffer);
|
|
210
|
-
this.mem.addrmap[owner] =
|
|
213
|
+
this.mem.addrmap[owner] = {
|
|
214
|
+
key: di.owner,
|
|
215
|
+
address: owner
|
|
216
|
+
};
|
|
211
217
|
data = di.data;
|
|
212
218
|
try {
|
|
213
219
|
data = _base64url["default"].decode(di.data);
|
|
@@ -282,77 +288,91 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
282
288
|
height: this.mem.height,
|
|
283
289
|
previous: (_last = (0, _ramda.last)(this.mem.blocks)) !== null && _last !== void 0 ? _last : ""
|
|
284
290
|
};
|
|
285
|
-
if (item) {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
291
|
+
if (!item) {
|
|
292
|
+
_context4.next = 12;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
if (!item.id) {
|
|
296
|
+
item.id = tx.id;
|
|
297
|
+
this.mem.txs[tx.id] = item;
|
|
298
|
+
this.mem.txs[tx.id].parent = null;
|
|
299
|
+
this.mem.txs[tx.id].signature = tx.signature;
|
|
300
|
+
this.mem.txs[tx.id].anchor = tx.last_tx;
|
|
301
|
+
data_type = "";
|
|
302
|
+
_iterator3 = _createForOfIteratorHelper(tx.tags);
|
|
303
|
+
try {
|
|
304
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
305
|
+
v = _step3.value;
|
|
306
|
+
if (v.get("name", {
|
|
307
|
+
decode: true,
|
|
308
|
+
string: true
|
|
309
|
+
}) === "Content-Type") {
|
|
310
|
+
data_type = v.get("value", {
|
|
298
311
|
decode: true,
|
|
299
312
|
string: true
|
|
300
|
-
})
|
|
301
|
-
data_type = v.get("value", {
|
|
302
|
-
decode: true,
|
|
303
|
-
string: true
|
|
304
|
-
});
|
|
305
|
-
}
|
|
313
|
+
});
|
|
306
314
|
}
|
|
307
|
-
} catch (err) {
|
|
308
|
-
_iterator3.e(err);
|
|
309
|
-
} finally {
|
|
310
|
-
_iterator3.f();
|
|
311
|
-
}
|
|
312
|
-
this.mem.txs[tx.id]._data = {
|
|
313
|
-
size: tx.data_size,
|
|
314
|
-
type: data_type
|
|
315
|
-
};
|
|
316
|
-
} else {
|
|
317
|
-
this.mem.txs[item.id].parent = {
|
|
318
|
-
id: block.id
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
block.txs = [item.id];
|
|
322
|
-
this.mem.txs[item.id].block = block.id;
|
|
323
|
-
} else {
|
|
324
|
-
_tags = [];
|
|
325
|
-
_iterator4 = _createForOfIteratorHelper(tx.tags);
|
|
326
|
-
try {
|
|
327
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
328
|
-
_v = _step4.value;
|
|
329
|
-
_tags.push({
|
|
330
|
-
name: _base64url["default"].decode(_v.name),
|
|
331
|
-
value: _base64url["default"].decode(_v.value)
|
|
332
|
-
});
|
|
333
315
|
}
|
|
334
316
|
} catch (err) {
|
|
335
|
-
|
|
317
|
+
_iterator3.e(err);
|
|
336
318
|
} finally {
|
|
337
|
-
|
|
319
|
+
_iterator3.f();
|
|
338
320
|
}
|
|
339
|
-
tx.
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
321
|
+
this.mem.txs[tx.id]._data = {
|
|
322
|
+
size: tx.data_size,
|
|
323
|
+
type: data_type
|
|
324
|
+
};
|
|
325
|
+
} else {
|
|
326
|
+
this.mem.txs[item.id].parent = {
|
|
327
|
+
id: block.id
|
|
328
|
+
};
|
|
343
329
|
}
|
|
330
|
+
block.txs = [item.id];
|
|
331
|
+
this.mem.txs[item.id].block = block.id;
|
|
332
|
+
_context4.next = 22;
|
|
333
|
+
break;
|
|
334
|
+
case 12:
|
|
335
|
+
_tags = [];
|
|
336
|
+
_iterator4 = _createForOfIteratorHelper(tx.tags);
|
|
337
|
+
try {
|
|
338
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
339
|
+
_v = _step4.value;
|
|
340
|
+
_tags.push({
|
|
341
|
+
name: _base64url["default"].decode(_v.name),
|
|
342
|
+
value: _base64url["default"].decode(_v.value)
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
} catch (err) {
|
|
346
|
+
_iterator4.e(err);
|
|
347
|
+
} finally {
|
|
348
|
+
_iterator4.f();
|
|
349
|
+
}
|
|
350
|
+
tx.tags = _tags;
|
|
351
|
+
_context4.next = 18;
|
|
352
|
+
return this.arweave.wallets.jwkToAddress({
|
|
353
|
+
n: tx.owner
|
|
354
|
+
});
|
|
355
|
+
case 18:
|
|
356
|
+
tx.owner = _context4.sent;
|
|
357
|
+
this.mem.txs[tx.id] = tx;
|
|
358
|
+
block.txs = [tx.id];
|
|
359
|
+
this.mem.txs[tx.id].block = block.id;
|
|
360
|
+
case 22:
|
|
344
361
|
this.mem.blocks.push(block.id);
|
|
345
362
|
this.mem.blockmap[block.id] = block;
|
|
346
363
|
if (!jwk) {
|
|
347
|
-
_context4.next =
|
|
364
|
+
_context4.next = 29;
|
|
348
365
|
break;
|
|
349
366
|
}
|
|
350
|
-
_context4.next =
|
|
367
|
+
_context4.next = 27;
|
|
351
368
|
return this.arweave.wallets.jwkToAddress(jwk);
|
|
352
|
-
case
|
|
369
|
+
case 27:
|
|
353
370
|
owner = _context4.sent;
|
|
354
|
-
this.mem.addrmap[owner] =
|
|
355
|
-
|
|
371
|
+
this.mem.addrmap[owner] = {
|
|
372
|
+
address: owner,
|
|
373
|
+
key: jwk.n
|
|
374
|
+
};
|
|
375
|
+
case 29:
|
|
356
376
|
res = {
|
|
357
377
|
id: tx.id,
|
|
358
378
|
status: 200,
|
|
@@ -363,7 +383,7 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
363
383
|
err: err,
|
|
364
384
|
id: tx.id
|
|
365
385
|
});
|
|
366
|
-
case
|
|
386
|
+
case 31:
|
|
367
387
|
case "end":
|
|
368
388
|
return _context4.stop();
|
|
369
389
|
}
|
|
@@ -404,9 +424,15 @@ var AR = /*#__PURE__*/function (_MAR) {
|
|
|
404
424
|
case 0:
|
|
405
425
|
tx = this.mem.txs[id];
|
|
406
426
|
_data = (_this$mem$txs$id$data = (_this$mem$txs$id = this.mem.txs[id]) === null || _this$mem$txs$id === void 0 ? void 0 : _this$mem$txs$id.data) !== null && _this$mem$txs$id$data !== void 0 ? _this$mem$txs$id$data : null;
|
|
407
|
-
|
|
427
|
+
try {
|
|
428
|
+
JSON.parse(_data);
|
|
429
|
+
_data = Buffer.from(_data).toString("base64");
|
|
430
|
+
} catch (e) {}
|
|
431
|
+
if (tx.format === 2 && _data && string) {
|
|
432
|
+
_data = _base64url["default"].decode(_data);
|
|
433
|
+
}
|
|
408
434
|
return _context6.abrupt("return", _data);
|
|
409
|
-
case
|
|
435
|
+
case 5:
|
|
410
436
|
case "end":
|
|
411
437
|
return _context6.stop();
|
|
412
438
|
}
|
package/esm/ao.js
CHANGED
|
@@ -393,9 +393,7 @@ class AO {
|
|
|
393
393
|
}
|
|
394
394
|
if (ex) return txs
|
|
395
395
|
if (this.in_memory) await wait(1)
|
|
396
|
-
return Date.now() - start <
|
|
397
|
-
? await getRef(ref)
|
|
398
|
-
: []
|
|
396
|
+
return Date.now() - start < timeout ? await getRef(ref) : []
|
|
399
397
|
}
|
|
400
398
|
|
|
401
399
|
let [cache, checks, isOK] = [[], [], false]
|
package/esm/aoconnect.js
CHANGED
|
@@ -116,11 +116,13 @@ export const connect = mem => {
|
|
|
116
116
|
format = mem.wasms[mod].format
|
|
117
117
|
}
|
|
118
118
|
format ??= "wasm64-unknown-emscripten-draft_2024_02_15"
|
|
119
|
+
const now = Date.now
|
|
119
120
|
const handle = await AoLoader(wasm, {
|
|
120
121
|
format,
|
|
121
122
|
mode: "test",
|
|
122
123
|
WeaveDrive,
|
|
123
124
|
})
|
|
125
|
+
Date.now = now
|
|
124
126
|
_module = { handle, id: mod }
|
|
125
127
|
if (!mod) throw Error("module not found")
|
|
126
128
|
opt.tags = buildTags(
|
|
@@ -241,6 +243,7 @@ export const connect = mem => {
|
|
|
241
243
|
|
|
242
244
|
const assign = async opt => {
|
|
243
245
|
const p = mem.env[opt.process]
|
|
246
|
+
if (!p) return null
|
|
244
247
|
let _opt = mem.msgs[opt.message]
|
|
245
248
|
let hash = genHashChain(p.hash, opt.message)
|
|
246
249
|
p.hash = hash
|
|
@@ -300,7 +303,7 @@ export const connect = mem => {
|
|
|
300
303
|
delete res.Memory
|
|
301
304
|
p.res[opt.message] = res
|
|
302
305
|
p.results.push(opt.message)
|
|
303
|
-
p.txs.unshift({ id
|
|
306
|
+
p.txs.unshift({ id, ...opt })
|
|
304
307
|
mem.msgs[opt.message] = _opt
|
|
305
308
|
for (const v of res.Messages ?? []) {
|
|
306
309
|
if (mem.env[v.Target]) {
|
|
@@ -344,6 +347,7 @@ export const connect = mem => {
|
|
|
344
347
|
|
|
345
348
|
const message = async opt => {
|
|
346
349
|
const p = mem.env[opt.process]
|
|
350
|
+
if (!p) return null
|
|
347
351
|
let ex = false
|
|
348
352
|
let id = opt?.item?.id ?? ""
|
|
349
353
|
let owner = opt.owner ?? ""
|
|
@@ -422,6 +426,7 @@ export const connect = mem => {
|
|
|
422
426
|
},
|
|
423
427
|
dryrun: async opt => {
|
|
424
428
|
const p = mem.env[opt.process]
|
|
429
|
+
if (!p) return null
|
|
425
430
|
let id = opt.id ?? ""
|
|
426
431
|
let owner = opt.owner ?? ""
|
|
427
432
|
if (!opt.id && opt.signer) {
|
package/esm/helpers.js
CHANGED
package/esm/server.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import express from "express"
|
|
2
|
+
import cors from "cors"
|
|
2
3
|
import base64url from "base64url"
|
|
3
4
|
import { DataItem } from "arbundles"
|
|
4
5
|
import { tags } from "./utils.js"
|
|
@@ -6,7 +7,7 @@ import { connect } from "./aoconnect.js"
|
|
|
6
7
|
import { GQL, cu, su, mu } from "./test.js"
|
|
7
8
|
import bodyParser from "body-parser"
|
|
8
9
|
import { graphql, parse, validate, buildSchema } from "graphql"
|
|
9
|
-
import { map } from "ramda"
|
|
10
|
+
import { keys, map, reverse } from "ramda"
|
|
10
11
|
const schema = buildSchema(`
|
|
11
12
|
schema {
|
|
12
13
|
query: Query
|
|
@@ -201,7 +202,10 @@ class Server {
|
|
|
201
202
|
}
|
|
202
203
|
ar() {
|
|
203
204
|
const app = express()
|
|
205
|
+
app.use(cors())
|
|
204
206
|
app.use(bodyParser.json({ limit: "100mb" }))
|
|
207
|
+
app.get("/wallet/:id/balance", (req, res) => res.send("0"))
|
|
208
|
+
app.get("/mint/:id/:amount", (req, res) => res.json({ id: "0" }))
|
|
205
209
|
app.get("/tx/:id/offset", async (req, res) => {
|
|
206
210
|
res.status(500)
|
|
207
211
|
res.send(null)
|
|
@@ -232,6 +236,11 @@ class Server {
|
|
|
232
236
|
const tar = parsed.rootFieldName
|
|
233
237
|
const fields = parsed.fields[0].edges[0].node
|
|
234
238
|
const args = parsed.args
|
|
239
|
+
if (args.tags) {
|
|
240
|
+
let _tags = {}
|
|
241
|
+
for (const v of args.tags) _tags[v.name] = v.values
|
|
242
|
+
args.tags = _tags
|
|
243
|
+
}
|
|
235
244
|
let res2 = null
|
|
236
245
|
if (tar === "transactions") {
|
|
237
246
|
res2 = await this.gql.txs({ ...args })
|
|
@@ -241,9 +250,9 @@ class Server {
|
|
|
241
250
|
const edges = map(v => ({ node: v, cursor: v.cursor }), res2)
|
|
242
251
|
res.json({ data: { transactions: { edges } } })
|
|
243
252
|
})
|
|
244
|
-
|
|
245
253
|
let data = {}
|
|
246
254
|
app.post("/:id", async (req, res) => {
|
|
255
|
+
// id = "tx" | "chunk"
|
|
247
256
|
if (req.body.chunk) {
|
|
248
257
|
if (data[req.body.data_root]) {
|
|
249
258
|
data[req.body.data_root].data += req.body.chunk
|
|
@@ -277,10 +286,7 @@ class Server {
|
|
|
277
286
|
res.json({ id: req.body.id })
|
|
278
287
|
}
|
|
279
288
|
})
|
|
280
|
-
|
|
281
|
-
await this._ar.postTx(req.body)
|
|
282
|
-
res.json({ id: req.body.id })
|
|
283
|
-
})
|
|
289
|
+
|
|
284
290
|
const server = app.listen(this.ports.ar, () => {
|
|
285
291
|
console.log(`AR on port ${this.ports.ar}`)
|
|
286
292
|
})
|
|
@@ -288,6 +294,7 @@ class Server {
|
|
|
288
294
|
}
|
|
289
295
|
mu() {
|
|
290
296
|
const app = express()
|
|
297
|
+
app.use(cors())
|
|
291
298
|
app.use(express.raw({ type: "*/*" }))
|
|
292
299
|
app.get("/", (req, res) => res.send("ao messenger unit"))
|
|
293
300
|
app.post("/monitor/:id", async (req, res) => {
|
|
@@ -317,8 +324,12 @@ class Server {
|
|
|
317
324
|
} else {
|
|
318
325
|
err = true
|
|
319
326
|
}
|
|
320
|
-
if (err)
|
|
321
|
-
|
|
327
|
+
if (err) {
|
|
328
|
+
res.status(500)
|
|
329
|
+
res.send({ err })
|
|
330
|
+
} else {
|
|
331
|
+
res.send({ id: item.id })
|
|
332
|
+
}
|
|
322
333
|
})
|
|
323
334
|
const server = app.listen(this.ports.mu, () =>
|
|
324
335
|
console.log(`MU on port ${this.ports.mu}`),
|
|
@@ -327,8 +338,51 @@ class Server {
|
|
|
327
338
|
}
|
|
328
339
|
su() {
|
|
329
340
|
const app = express()
|
|
341
|
+
app.use(cors())
|
|
330
342
|
app.use(bodyParser.json())
|
|
331
|
-
app.get("/", (req, res) =>
|
|
343
|
+
app.get("/", (req, res) => {
|
|
344
|
+
res.json({
|
|
345
|
+
Unit: "Scheduler",
|
|
346
|
+
Timestamp: Date.now(),
|
|
347
|
+
Address: su.addr,
|
|
348
|
+
Processes: keys(this.mem.env),
|
|
349
|
+
})
|
|
350
|
+
})
|
|
351
|
+
app.get("/timestamp", (req, res) =>
|
|
352
|
+
res.json({ timestamp: Date.now(), block_height: this.mem.height }),
|
|
353
|
+
)
|
|
354
|
+
app.get("/:pid", (req, res) => {
|
|
355
|
+
const pid = req.params.pid
|
|
356
|
+
const edges = map(v => {
|
|
357
|
+
const tx = this.mem.txs[v.id]
|
|
358
|
+
const _tags = tags(v.tags)
|
|
359
|
+
const mid = _tags.Message
|
|
360
|
+
const mtx = this.mem.txs[mid]
|
|
361
|
+
return {
|
|
362
|
+
cursor: v.id,
|
|
363
|
+
node: {
|
|
364
|
+
message: {
|
|
365
|
+
id: mtx.id,
|
|
366
|
+
tags: mtx.tags,
|
|
367
|
+
owner: this.mem.addrmap[mtx.owner],
|
|
368
|
+
anchor: mtx.anchor ?? null,
|
|
369
|
+
target: pid,
|
|
370
|
+
signature: mtx.signature,
|
|
371
|
+
data: tx.data,
|
|
372
|
+
},
|
|
373
|
+
assignment: {
|
|
374
|
+
id: tx.id,
|
|
375
|
+
tags: tx.tags,
|
|
376
|
+
owner: this.mem.addrmap[tx.owner],
|
|
377
|
+
anchor: tx.anchor ?? null,
|
|
378
|
+
target: null,
|
|
379
|
+
signature: tx.signature,
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
}
|
|
383
|
+
})(reverse(this.mem.env[pid].txs))
|
|
384
|
+
res.json({ page_info: { has_next_page: false }, edges })
|
|
385
|
+
})
|
|
332
386
|
const server = app.listen(this.ports.su, () =>
|
|
333
387
|
console.log(`SU on port ${this.ports.su}`),
|
|
334
388
|
)
|
|
@@ -336,8 +390,11 @@ class Server {
|
|
|
336
390
|
}
|
|
337
391
|
cu() {
|
|
338
392
|
const app = express()
|
|
393
|
+
app.use(cors())
|
|
339
394
|
app.use(bodyParser.json())
|
|
340
|
-
app.get("/", (req, res) =>
|
|
395
|
+
app.get("/", (req, res) =>
|
|
396
|
+
res.json({ timestamp: Date.now(), address: cu.addr }),
|
|
397
|
+
)
|
|
341
398
|
app.get("/result/:mid", async (req, res) => {
|
|
342
399
|
const res2 = await this.result({
|
|
343
400
|
message: req.params.mid,
|
|
@@ -349,8 +406,13 @@ class Server {
|
|
|
349
406
|
const process = req.query["process-id"]
|
|
350
407
|
const { Id: id, Owner: owner, Tags: tags, Data: data } = req.body
|
|
351
408
|
const res2 = await this.dryrun({ id, owner, tags, data, process })
|
|
352
|
-
|
|
353
|
-
|
|
409
|
+
if (!res2) {
|
|
410
|
+
res.status(500)
|
|
411
|
+
res.json({ err: true })
|
|
412
|
+
} else {
|
|
413
|
+
delete res2.Memory
|
|
414
|
+
res.json(res2)
|
|
415
|
+
}
|
|
354
416
|
})
|
|
355
417
|
const server = app.listen(this.ports.cu, () =>
|
|
356
418
|
console.log(`CU on port ${this.ports.cu}`),
|
package/esm/tar.js
CHANGED
|
@@ -39,7 +39,7 @@ class AR extends MAR {
|
|
|
39
39
|
let _tags = buildTags(null, tags)
|
|
40
40
|
for (const v of _tags) tx.addTag(v.name, v.value)
|
|
41
41
|
const owner = await this.arweave.wallets.jwkToAddress(jwk)
|
|
42
|
-
this.mem.addrmap[owner] = jwk.n
|
|
42
|
+
this.mem.addrmap[owner] = { address: owner, key: jwk.n }
|
|
43
43
|
return await this.postTx(tx, jwk, {
|
|
44
44
|
recipient: "",
|
|
45
45
|
tags: _tags,
|
|
@@ -63,7 +63,7 @@ class AR extends MAR {
|
|
|
63
63
|
await crypto.subtle.digest("SHA-256", rowner),
|
|
64
64
|
)
|
|
65
65
|
const owner = base64url.encode(hashBuffer)
|
|
66
|
-
this.mem.addrmap[owner] = di.owner
|
|
66
|
+
this.mem.addrmap[owner] = { key: di.owner, address: owner }
|
|
67
67
|
let data = di.data
|
|
68
68
|
try {
|
|
69
69
|
data = base64url.decode(di.data)
|
|
@@ -123,6 +123,7 @@ class AR extends MAR {
|
|
|
123
123
|
})
|
|
124
124
|
}
|
|
125
125
|
tx.tags = _tags
|
|
126
|
+
tx.owner = await this.arweave.wallets.jwkToAddress({ n: tx.owner })
|
|
126
127
|
this.mem.txs[tx.id] = tx
|
|
127
128
|
block.txs = [tx.id]
|
|
128
129
|
this.mem.txs[tx.id].block = block.id
|
|
@@ -132,7 +133,7 @@ class AR extends MAR {
|
|
|
132
133
|
|
|
133
134
|
if (jwk) {
|
|
134
135
|
const owner = await this.arweave.wallets.jwkToAddress(jwk)
|
|
135
|
-
this.mem.addrmap[owner] = jwk.n
|
|
136
|
+
this.mem.addrmap[owner] = { address: owner, key: jwk.n }
|
|
136
137
|
}
|
|
137
138
|
res = { id: tx.id, status: 200, statusText: "200" }
|
|
138
139
|
return { res, err, id: tx.id }
|
|
@@ -145,7 +146,13 @@ class AR extends MAR {
|
|
|
145
146
|
async data(id, string) {
|
|
146
147
|
let tx = this.mem.txs[id]
|
|
147
148
|
let _data = this.mem.txs[id]?.data ?? null
|
|
148
|
-
|
|
149
|
+
try {
|
|
150
|
+
JSON.parse(_data)
|
|
151
|
+
_data = Buffer.from(_data).toString("base64")
|
|
152
|
+
} catch (e) {}
|
|
153
|
+
if (tx.format === 2 && _data && string) {
|
|
154
|
+
_data = base64url.decode(_data)
|
|
155
|
+
}
|
|
149
156
|
return _data
|
|
150
157
|
}
|
|
151
158
|
}
|
package/esm/tgql.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wao",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"arweave": "^1.15.1",
|
|
29
29
|
"base64url": "^3.0.1",
|
|
30
30
|
"body-parser": "^1.20.3",
|
|
31
|
+
"cors": "^2.8.5",
|
|
31
32
|
"express": "^4.21.2",
|
|
32
33
|
"graphql": "^16.10.0",
|
|
33
34
|
"ramda": "^0.30.1",
|