Skip to content

Commit

Permalink
Implement tx
Browse files Browse the repository at this point in the history
  • Loading branch information
t0anhh committed Mar 14, 2024
1 parent 923cad0 commit 7e6c1e6
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 124 deletions.
49 changes: 31 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ We get:
121([_ 121([_ 121([_ h'74785F30']), 0]), 121([_ 121([_ 122([_ h'7363726970745F68617368']), 122([])]), {_ h'': {_ h'': 111000000 }, h'706964': {_ h'6E616D65': 1 } }, 121([]), 122([])])])
```

- With `stringify.output`
- With `stringify.input`

```aiken
// ...
trace stringify.output(input)
trace stringify.input(input)
```

We get:

```shell
```bash
Input {
output_reference: OutputReference(TransactionId(tx_0), 0),
output: Output {
Expand Down Expand Up @@ -83,27 +83,40 @@ fn log(self: a, serializer: fn(a) -> String) {
So we can attach it to anywhere like this:

```diff
diff --git a/lib/debug/stringify_test.ak b/lib/debug/stringify_test.ak
index 487acf7..a54e6fc 100644
--- a/lib/debug/stringify_test.ak
+++ b/lib/debug/stringify_test.ak
@@ -85,5 +85,6 @@ test log_output_2() {
),
reference_script: None,
}
+ |> log(stringify.output)
( my_output |> log(stringify.output) ) == my_output
}
Input {
output_reference: OutputReference(TransactionId(tx_0), 0),
output: Output {
address: Address {
payment_credential: ScriptCredential('script_hash')
stake_credential: None
},
value: Value ([
h'',
h'',
111000000
],[
h'706964', # pid
h'6E616D65', # name
1
]),
datum: NoDatum
}
}
+ |> log(stringify.input)
```

## Supported
## Supported serializers

- [x] input
- [x] output
- [x] credential
- [x] value
- [x] minted_value
- [x] any
- [x] data
- [x] out_ref
- [ ] tx
- [ ] redeemers
- [x] tx
- [x] redeemers

## License

MIT
Loading

0 comments on commit 7e6c1e6

Please sign in to comment.