Packages

A native Elixir SDK for the Hedera network: Ed25519 / ECDSA secp256k1 keys, gRPC over HTTP/2, and the Consensus, Crypto (incl. accounts), Token (HTS), File, Schedule and Smart Contract services — plus EIP-1559 Ethereum transactions and free/paid queries.

Current section

Files

Jump to
hedera_ex lib hedera duration.ex
Raw

lib/hedera/duration.ex

defmodule Hedera.Duration do
@moduledoc "A Hedera `Duration` in whole seconds (e.g. a transaction's valid window)."
alias Hedera.Proto
@enforce_keys [:seconds]
defstruct [:seconds]
@type t :: %__MODULE__{seconds: integer()}
@doc "Encode as a Hedera `Duration` protobuf message (seconds = field 1)."
@spec to_proto(t()) :: binary()
def to_proto(%__MODULE__{seconds: s}), do: Proto.varint_field(1, s)
end