diff --git a/README.md b/README.md index 9c2df74..4853ad9 100644 --- a/README.md +++ b/README.md @@ -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) ``` diff --git a/lib/stringify.ak b/lib/stringify.ak index 08926cd..89e52df 100644 --- a/lib/stringify.ak +++ b/lib/stringify.ak @@ -361,7 +361,7 @@ fn is_close(chr: ByteArray) { } } -pub fn newline(self: ByteArray) { +fn newline(self: ByteArray) { self |> bytearray.concat("\n") } diff --git a/lib/stringify_test.ak b/lib/stringify_test.ak index abd92db..f267d95 100644 --- a/lib/stringify_test.ak +++ b/lib/stringify_test.ak @@ -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, @@ -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() {