Skip to content

Commit 7fbf0cd

Browse files
authored
Merge pull request #474 from permaweb/impr/ao-core-lc
Impr/ao core lc
2 parents 4868f7e + ad24469 commit 7fbf0cd

File tree

1 file changed

+22
-35
lines changed

1 file changed

+22
-35
lines changed

src/services/mainnet.js

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ export function sendMessageMainnet({ processId, wallet, tags, data }, spinner) {
6161
const submitRequest = fromPromise(request)
6262
const params = {
6363
type: 'Message',
64-
path: `/${processId}[email protected]/push/[email protected]`,
64+
path: `/${processId}/push`,
6565
method: 'POST',
66-
...tags.reduce((a, t) => assoc(t.name, t.value, a), {}),
66+
...tags.reduce((a, t) => assoc(t.name.toLowerCase(), t.value, a), {}),
6767
'data-protocol': 'ao',
68-
variant: 'ao.N.1',
6968
target: processId,
70-
"signing-format": "ANS-104"
69+
"signing-format": "ANS-104",
70+
accept: 'application/json'
7171
}
7272
// set data if needed
7373
if (data) {
@@ -78,8 +78,6 @@ export function sendMessageMainnet({ processId, wallet, tags, data }, spinner) {
7878
.map(prop('body'))
7979
.map(JSON.parse)
8080
.map(handleResults)
81-
82-
8381
}
8482

8583
const setScheduler = fromPromise(async function (ctx) {
@@ -93,8 +91,6 @@ const setScheduler = fromPromise(async function (ctx) {
9391
.then(r => r.text())
9492
}
9593
ctx['scheduler'] = scheduler
96-
// should no longer need scheduler-location
97-
// ctx['scheduler-location'] = scheduler
9894

9995
return ctx
10096

@@ -114,8 +110,8 @@ const setAuthority = fromPromise(async function (ctx) {
114110
}
115111
authority = authority + ',fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY'
116112
}
117-
ctx['Authority'] = authority
118-
ctx['Authority'] = authority
113+
// ctx['authority'] = authority
114+
ctx['authority'] = authority
119115

120116
return ctx
121117
})
@@ -149,8 +145,7 @@ export function spawnProcessMainnet({ wallet, src, tags, data, isHyper }) {
149145
'execution-device': '[email protected]',
150146
'data-protocol': 'ao',
151147
variant: 'ao.N.1',
152-
// ...tags.reduce((a, t) => assoc(t.name.toLowerCase(), t.value, a), {}),
153-
...tags.reduce((a, t) => assoc(t.name, t.value, a), {}),
148+
...tags.reduce((a, t) => assoc(t.name.toLowerCase(), t.value, a), {}),
154149
'aos-version': pkg.version,
155150
'signing-format': 'ANS-104'
156151
}
@@ -163,9 +158,9 @@ export function spawnProcessMainnet({ wallet, src, tags, data, isHyper }) {
163158
.chain(params => isHyper ? of(params) : getExecutionDevice(params))
164159
.map(p => {
165160
if (p['execution-device'] === '[email protected]') {
166-
p.Module = process.env.AOS_MODULE || pkg.hyper.module
161+
p.module = process.env.AOS_MODULE || pkg.hyper.module
167162
} else {
168-
p.Module = src
163+
p.module = src
169164
}
170165
return p
171166
})
@@ -179,7 +174,10 @@ let _watch = false
179174

180175
export function printLiveMainnet() {
181176
keys(globalThis.alerts).map(k => {
182-
if (globalThis.alerts[k].print) {
177+
// if (globalThis.alerts[k]) {
178+
// console.log(globalThis.alerts[k])
179+
// }
180+
if (globalThis.alerts[k] && globalThis.alerts[k].print) {
183181
globalThis.alerts[k].print = false
184182

185183
if (!_watch) {
@@ -216,43 +214,32 @@ export async function liveMainnet(id, watch) {
216214
try {
217215
isJobRunning = true;
218216
// Get the current slot
219-
const currentSlotPath = `/${id}[email protected]/slot/current` // LIVE PARAMS
217+
const currentSlotPath = `/${id}/slot/current/body` // LIVE PARAMS
220218
const currentSlotParams = {
221219
path: currentSlotPath,
222-
method: 'POST',
223-
device: '[email protected]',
224-
'data-protocol': 'ao',
225-
variant: 'ao.N.1',
226-
'aos-version': pkg.version,
227-
'signing-format': 'ANS-104'
220+
method: 'GET'
228221
}
229222
const currentSlot = await request(currentSlotParams)
230-
.then(res => res.body)
231-
// .then(JSON.parse)
232-
// .then(res => res.body)
223+
.then(res => Number(res.body || '0'))
233224

234225
if (isNaN(cursor)) {
235226
cursor = currentSlot + 1
236227
}
237228
// Eval up to the current slot
238229
while (cursor <= currentSlot) {
239-
240-
const path = `/${id}[email protected]/compute&slot=${cursor}/results/[email protected]` // LIVE PARAMS
230+
const path = `/${id}/compute=${cursor}` // LIVE PARAMS
241231
const params = {
242232
path,
243-
method: 'POST',
244-
device: '[email protected]',
245-
'data-protocol': 'ao',
246-
'scheduler-device': '[email protected]',
247-
'push-device': '[email protected]',
248-
variant: 'ao.N.1',
249-
'aos-version': pkg.version,
250-
'signing-format': 'ANS-104',
233+
method: 'GET',
234+
accept: 'application/json',
235+
'accept-bundle': 'true'
251236
}
252237
const results = await request(params)
253238
.then(res => res.body)
254239
.then(JSON.parse)
240+
.then(prop('results'))
255241
.then(handleResults)
242+
// .catch(e => ({ Output: {}}))
256243

257244
// If results, add to alerts
258245
if (!globalThis.alerts[cursor]) {

0 commit comments

Comments
 (0)