Skip to content

Commit

Permalink
token transaction unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bchamagne committed Aug 1, 2023
1 parent dca42f9 commit 16a127f
Show file tree
Hide file tree
Showing 3 changed files with 384 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/archethic/mining/pending_transaction_validation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ defmodule Archethic.Mining.PendingTransactionValidation do
"Invalid token transaction - token_reference exists but does not contain a valid JSON"}

:error ->
{:error, "Invalid token transaction - token_reference is not an hexacdecimal"}
{:error, "Invalid token transaction - token_reference is not an hexadecimal"}
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,19 @@ defmodule Archethic.TransactionChain.Transaction.ValidationStamp.LedgerOperation
%LedgerOperations{
unspent_outputs: []
}
iex> LedgerOperations.from_transaction(%LedgerOperations{},
...> %Transaction{
...> address: "@Token2",
...> type: :token,
...> data: %TransactionData{content: "{\"supply\": 100000000, \"token_reference\": \"40546F6B656E526566\", \"aeip\": [2, 18]}"}
...> }, ~U[2022-10-10 08:07:31.784Z]
...> )
%LedgerOperations{
unspent_outputs: [
%UnspentOutput{from: "@Token2", amount: 100_000_000, type: {:token, "@TokenRef", 0}, timestamp: ~U[2022-10-10 08:07:31.784Z]}
]
}
"""
@spec from_transaction(t(), Transaction.t(), DateTime.t()) :: t()
def from_transaction(
Expand Down
Loading

0 comments on commit 16a127f

Please sign in to comment.