Skip to content

Commit 101550e

Browse files
authored
Merge pull request #1250 from permaweb/jfrain99/improve-mu-hb-compat
fix(mu): fix casing, pushparams for hb compat in mu
2 parents 97eceee + 3950dbc commit 101550e

File tree

5 files changed

+18
-21
lines changed

5 files changed

+18
-21
lines changed

scheduler-utils/src/client/gateway.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ export const parseHyperBeamResponse = (process) => {
3333

3434
const signedCommitment = commitments[processId]
3535
const committed = signedCommitment.committed
36-
const originalTags = Object.values(signedCommitment['original-tags'])
36+
const originalTags = Object.values(signedCommitment['original-tags'] ?? {})
3737
const data = process.data
3838
const tags = []
39-
if (!originalTags) {
39+
if (!originalTags || originalTags.length === 0) {
4040
delete process.data
4141
const tags = Object.keys(process).map(key => ({ name: key, value: process[key] }))
4242
return { id: processId, tags, data }
@@ -70,9 +70,7 @@ export function loadProcessWith ({ fetch, HB_GRAPHQL_URL, GRAPHQL_URL, GRAPHQL_M
7070
query ($ids: [ID!]!) {
7171
transactions(
7272
ids: $ids
73-
tags: [
74-
{ name: "Type", values: ["Process"] }
75-
]) {
73+
) {
7674
pageInfo {
7775
hasNextPage
7876
}

servers/mu/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"dependencies": {
2222
"@permaweb/ao-scheduler-utils": "^0.0.28",
23-
"@permaweb/aoconnect": "^0.0.88",
23+
"@permaweb/aoconnect": "^0.0.90",
2424
"arbundles": "0.11.0",
2525
"arweave": "^1.14.4",
2626
"async-mutex": "^0.5.0",

servers/mu/src/domain/clients/scheduler.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ function writeDataItemWith ({ fetch, histogram, logger, wallet }) {
6767

6868
// Helper function to convert tags array to object (like assoc in mainnet.js)
6969
const tagsToObj = tags.reduce((acc, tag) => {
70-
acc[tag.name] = tag.value
70+
acc[tag.name.toLowerCase()] = tag.value
7171
return acc
7272
}, {})
7373

7474
// Create push request parameters following mainnet.js pattern
7575
let pushParams = {}
76-
if (tagsToObj.Type === 'Process') {
76+
if (tagsToObj.type === 'Process') {
7777
pushParams = {
7878
path: '/push',
7979
method: 'POST',
@@ -91,19 +91,18 @@ function writeDataItemWith ({ fetch, histogram, logger, wallet }) {
9191
}
9292
} else {
9393
pushParams = {
94-
type: 'Message',
95-
path: `/${processId}[email protected]/push`,
94+
Type: 'Message',
95+
path: `/${processId}/push`,
9696
method: 'POST',
9797
...tagsToObj,
9898
'data-protocol': 'ao',
99-
'scheduler-device': '[email protected]',
100-
'push-device': '[email protected]',
101-
variant: 'ao.N.1',
10299
target: processId,
103-
signingFormat: 'ANS-104',
104-
'accept-bundle': 'true',
105-
'accept-codec': '[email protected]',
106-
data: dataStr
100+
'signing-format': 'ANS-104',
101+
accept: 'application/json',
102+
'accept-bundle': 'true'
103+
}
104+
if (dataStr) {
105+
pushParams.data = dataStr
107106
}
108107
}
109108

servers/mu/src/domain/lib/write-message-tx.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ export function writeMessageTxWith (env) {
7878
schedulerType: ctx.schedulerType,
7979
processId: ctx.tx.processId,
8080
id: ctx.dataItem?.id || '',
81-
tags: ctx.dataItem?.tags || [],
82-
dataStr: ctx.dataItem?.data || ''
81+
tags: ctx.dataItem?.tags || ctx?.cachedMsg?.msg?.Tags || [],
82+
dataStr: ctx.dataItem?.data || ctx?.cachedMsg?.msg?.Data || ''
8383
})
8484
.map(assoc('schedulerTx', __, ctx))
8585
.map(ctxSchema.parse)

servers/mu/src/domain/lib/write-process-tx.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export function writeProcessTxWith (env) {
4242
schedulerType: ctx.schedulerType,
4343
processId: ctx.tx.id,
4444
id: ctx.dataItem?.id || '',
45-
tags: ctx.dataItem?.tags || [],
46-
dataStr: ctx.dataItem?.data || ''
45+
tags: ctx.dataItem?.tags || ctx?.cachedMsg?.msg?.Tags || [],
46+
dataStr: ctx.dataItem?.data || ctx?.cachedMsg?.msg?.Data || ''
4747
})
4848
})
4949
})

0 commit comments

Comments
 (0)