Skip to content

Commit c1a0fd4

Browse files
committed
feat: add ctx_transaction? function to identify CTX transactions
1 parent 716a514 commit c1a0fd4

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

apps/explorer/lib/explorer/chain/transaction.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,14 @@ defmodule Explorer.Chain.Transaction do
13631363
end
13641364
end
13651365

1366+
@doc """
1367+
Returns true if the transaction is a CTX transaction.
1368+
CTX transactions are identified by the method signature 0x57983ac8 in the first 4 bytes of input data.
1369+
"""
1370+
@spec ctx_transaction?(Explorer.Chain.Transaction.t()) :: boolean
1371+
def ctx_transaction?(%__MODULE__{input: %{bytes: <<0x57, 0x98, 0x3A, 0xC8, _::binary>>}}), do: true
1372+
def ctx_transaction?(_), do: false
1373+
13661374
def bytes_to_address_hash(bytes), do: %Hash{byte_count: 20, bytes: bytes}
13671375

13681376
@doc """

0 commit comments

Comments
 (0)