Module: GasfreeSdk::Types

Defined in:
lib/gasfree_sdk/types.rb

Overview

Custom types for the SDK

Defined Under Namespace

Modules: JSON

Constant Summary collapse

Address =

Address type with validation for both Ethereum and TRON addresses Ethereum: 0x followed by 40 hex characters OR just 40 hex characters TRON: Starts with T followed by 33 characters (base58)

Types::String.constrained(
  format: /\A(0x[0-9a-fA-F]{40}|[0-9a-fA-F]{40}|T[0-9A-Za-z]{33})\z/
)
Hash =

Hash type with validation

Types::String.constrained(format: /\A(0x)?[0-9a-fA-F]{64}\z/)
Amount =

Amount type (string representation of a number)

Types::String.constrained(format: /\A[0-9]+\z/)
Timestamp =

Timestamp type (Unix timestamp)

Types::Integer.constrained(gteq: 0)
ChainId =

Chain ID type

Types::Integer.constrained(gteq: 1)
Nonce =

Nonce type

Types::Integer.constrained(gteq: 0)
Version =

Version type

Types::Integer.constrained(included_in: [1])
State =

State type

Types::String.constrained(included_in: %w[
  WAITING
  INPROGRESS
  CONFIRMING
  SUCCEED
  FAILED
])