~dcrck/solana

bb47f596a9b3bc33f834a3158b3ff5b8dcf9273b — dcrck 4 months ago fcae69c
add boolean encoding for Instruction data
1 files changed, 3 insertions(+), 0 deletions(-)

M lib/solana/ix.ex
M lib/solana/ix.ex => lib/solana/ix.ex +3 -0
@@ 41,4 41,7 @@ defmodule Solana.Instruction do
  defp encode_value({value, size, :little}), do: <<value::size(size)-little>>
  defp encode_value(value) when is_binary(value), do: value
  defp encode_value(value) when is_integer(value), do: <<value>>
  defp encode_value(value) when is_boolean(value), do: <<unary(value)>>

  defp unary(val), do: if(val, do: 1, else: 0)
end