Cardanoex.Transaction (cardanoex v0.4.0)
The Transaction module lets you work with transactions for a wallet.
Link to this section Summary
Functions
Create and send transaction from the wallet.
Estimate fee for the transaction.
The estimate is made by assembling multiple transactions and analyzing the distribution of their fees.
The estimated_max
is the highest fee observed, and the estimated_min
is the fee which is lower than at least 90% of the fees observed.
Get transaction by id.
Lists all incoming and outgoing wallet's transactions.
Link to this section Functions
create(wallet_id, transaction)
Create and send transaction from the wallet.
Options
wallet_id
- hex based string. 40 characterstransaction
- A map with the following structure:
%{
payments: [
%{
address: "addr_test1qruzy7l5...nq04es9elzy7",
amount: %{quantity: 42_000_000, unit: "lovelace"}
}
]
}
# With asset:
%{
payments: [
%{
address:"addr_test1qruzy7l5...nq04es9elzy7",
amount: %{quantity: 1_407_406, unit: "lovelace"},
assets: [
%{
policy_id: "6b8d07d69639e9413dd637a1a815a7323c69c86abbafb66dbfdb1aa7",
asset_name: "",
quantity: 0
}
]
}
]
}
# With metadata:
%{
payments: [
%{
address: "addr_test1qruzy7l5...nq04es9elzy7",
amount: %{quantity: 1_407_406, unit: "lovelace"}
}
],
metadata: %{"0" => %{"string" => "cardano"}, "1" => %{"int" => 14}}
}
estimate_fee(wallet_id, transaction)
Estimate fee for the transaction.
The estimate is made by assembling multiple transactions and analyzing the distribution of their fees.
The estimated_max
is the highest fee observed, and the estimated_min
is the fee which is lower than at least 90% of the fees observed.
Options
wallet_id
- hex based string. 40 characterstransaction
- A map with the following structure:
%{
payments: [
%{
address: "addr_test1qruzy7l5...nq04es9elzy7",
amount: %{quantity: 42_000_000, unit: "lovelace"}
}
]
}
# With asset:
%{
payments: [
%{
address:"addr_test1qruzy7l5...nq04es9elzy7",
amount: %{quantity: 1_407_406, unit: "lovelace"},
assets: [
%{
policy_id: "6b8d07d69639e9413dd637a1a815a7323c69c86abbafb66dbfdb1aa7",
asset_name: "",
quantity: 0
}
]
}
]
}
# With metadata:
%{
payments: [
%{
address: "addr_test1qruzy7l5...nq04es9elzy7",
amount: %{quantity: 1_407_406, unit: "lovelace"}
}
],
metadata: %{"0" => %{"string" => "cardano"}, "1" => %{"int" => 14}}
}
get(wallet_id, transaction_id)
Get transaction by id.
Options
transaction_id
- Transaction ID
list(wallet_id, options \\ [])
Lists all incoming and outgoing wallet's transactions.
Options
start
- An optional start time in ISO 8601 date-and-time format. Basic and extended formats are both accepted. Times can be local (with a timezone offset) or UTC. If both a start time and an end time are specified, then the start time must not be later than the end time. Example:2008-08-08T08:08:08Z
stop
- An optional end time in ISO 8601 date-and-time format. Basic and extended formats are both accepted. Times can be local (with a timezone offset) or UTC. If both a start time and an end time are specified, then the start time must not be later than the end time.order
- Can be set to:descending
or:ascending
. Defaults to:descending
min_withdrawal
- Returns only transactions that have at least one withdrawal above the given amount. This is particularly useful when set to1
in order to list the withdrawal history of a wallet.