Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
77 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
packages/aragon-wrapper/src/rpc/handlers/describe-transaction.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { postprocessRadspecDescription, tryEvaluatingRadspec } from '../../radspec' | ||
|
||
export default async function (request, proxy, wrapper) { | ||
const [transaction = {}] = request.params | ||
if (!transaction.to) { | ||
throw new Error(`Could not describe transaction: missing 'to'`) | ||
} | ||
if (!transaction.data) { | ||
throw new Error(`Could not describe transaction: missing 'data'`) | ||
} | ||
|
||
let description | ||
try { | ||
description = await tryEvaluatingRadspec(transaction, wrapper) | ||
} catch (_) {} | ||
|
||
if (description) { | ||
try { | ||
const processed = await postprocessRadspecDescription(description, wrapper) | ||
return { | ||
annotatedDescription: processed.annotatedDescription, | ||
description: processed.description | ||
} | ||
} catch (_) {} | ||
} | ||
|
||
return { | ||
description | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters