Skip to content

Commit

Permalink
feat(sdk)!: messageId -> message on result api
Browse files Browse the repository at this point in the history
  • Loading branch information
TillaTheHun0 committed Dec 12, 2023
1 parent 447926c commit 95fb277
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Read the result of the message evaluation from an `ao` Compute Unit `cu`
import { result } from "@permaweb/ao-sdk";

let { messages, spawns, output, error } = await result({
messageId: "VkjFCALjk4xxuCilddKS8ShZ-9HdeqeuYQOgMgWucro",
message: "VkjFCALjk4xxuCilddKS8ShZ-9HdeqeuYQOgMgWucro",
});
```

Expand Down
8 changes: 4 additions & 4 deletions sdk/src/lib/result/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { readWith } from './read.js'
* @property {string} [error]
*
* @typedef ReadResultArgs
* @property {string} messageId - the transaction id of the message
* @property {string} message - the transaction id of the message
*
* @callback ReadResult
* @param {ReadResultArgs} args
Expand All @@ -25,14 +25,14 @@ export function resultWith (env) {
const verifyInput = verifyInputWith(env)
const read = readWith(env)

return ({ messageId }) => {
return of({ id: messageId })
return ({ message }) => {
return of({ id: message })
.chain(verifyInput)
.chain(read)
.map(
env.logger.tap(
'readResult result for message "%s": %O',
messageId
message
)
)
.map(result => result)
Expand Down
4 changes: 3 additions & 1 deletion sdk/src/lib/spawn/verify-inputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ const checkTag = (name, pred, err) => tags => pred(tags[name])
*/

function verifyModuleWith ({ loadTransactionMeta, logger }) {
loadTransactionMeta = fromPromise(loadTransactionMetaSchema.implement(loadTransactionMeta))

return (module) => of(module)
.chain(fromPromise(loadTransactionMetaSchema.implement(loadTransactionMeta)))
.chain(loadTransactionMeta)
.map(prop('tags'))
.map(parseTags)
/**
Expand Down

0 comments on commit 95fb277

Please sign in to comment.