Skip to content

Commit

Permalink
Merge branch 'main' of github.com:t0anh/aiken-stringify
Browse files Browse the repository at this point in the history
  • Loading branch information
t0anhh committed Apr 13, 2024
2 parents 96310f8 + 1722846 commit 50819f7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
23 changes: 8 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,17 @@ fn log(self: a, serializer: fn(a) -> String) {
So we can attach it to anywhere like this:

```diff
Input {
output_reference: OutputReference(TransactionId('tx_0'), 0),
let input = Input {
output_reference: OutputReference(TransactionId("tx_0"), 0),
output: Output {
value: value.from_lovelace(111_000_000) |> value.add("pid", "name", 1),
address: Address {
payment_credential: ScriptCredential('script_hash')
stake_credential: None
payment_credential: ScriptCredential("script_hash"),
stake_credential: None,
},
value: Value ([
h'',
h'',
111000000
],[
h'706964', # pid
h'6E616D65', # name
1
]),
datum: NoDatum
}
datum: NoDatum,
reference_script: None,
},
}
+ |> log(stringify.input)
```
Expand Down
2 changes: 1 addition & 1 deletion lib/stringify.ak
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ fn is_close(chr: ByteArray) {
}
}

pub fn newline(self: ByteArray) {
fn newline(self: ByteArray) {
self |> bytearray.concat("\n")
}

Expand Down
6 changes: 1 addition & 5 deletions lib/stringify_test.ak
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use aiken/bytearray
use aiken/cbor
use aiken/dict
use aiken/string
use aiken/transaction.{
InlineDatum, Input, Mint, NoDatum, Output, OutputReference, ScriptPurpose,
Spend, Transaction, TransactionId,
Expand Down Expand Up @@ -98,10 +97,7 @@ test log_data() {
}

fn script_purpose_compare(a: ScriptPurpose, b: ScriptPurpose) {
bytearray.compare(
a |> cbor.diagnostic |> string.to_bytearray,
b |> cbor.diagnostic |> string.to_bytearray,
)
bytearray.compare(cbor.serialise(a), cbor.serialise(b))
}

test log_tx() {
Expand Down

0 comments on commit 50819f7

Please sign in to comment.