Module: GasfreeSdk
- Extended by:
- Dry::Configurable
- Defined in:
- lib/gasfree_sdk.rb,
lib/gasfree_sdk/types.rb,
lib/gasfree_sdk/base58.rb,
lib/gasfree_sdk/client.rb,
lib/gasfree_sdk/crypto.rb,
lib/gasfree_sdk/errors.rb,
lib/gasfree_sdk/models.rb,
lib/gasfree_sdk/version.rb,
lib/gasfree_sdk/models/token.rb,
lib/gasfree_sdk/models/provider.rb,
lib/gasfree_sdk/tron_eip712_signer.rb,
lib/gasfree_sdk/models/gas_free_address.rb,
lib/gasfree_sdk/models/transfer_request.rb,
lib/gasfree_sdk/models/transfer_response.rb
Overview
GasFree SDK error classes and utilities
Defined Under Namespace
Modules: Base58, Crypto, Models, Types Classes: APIError, AddressNotFoundError, AuthenticationError, Client, DeadlineExceededError, Error, InsufficientBalanceError, InvalidSignatureError, TransferNotFoundError, TronEIP712Signer
Constant Summary collapse
- ERROR_CODE_MAP =
Map error codes to specific error classes
{ "INVALID_SIGNATURE" => InvalidSignatureError, "DEADLINE_EXCEEDED" => DeadlineExceededError, "INSUFFICIENT_BALANCE" => InsufficientBalanceError, "ADDRESS_NOT_FOUND" => AddressNotFoundError, "TRANSFER_NOT_FOUND" => TransferNotFoundError }.freeze
- VERSION =
"1.0.0"
Class Method Summary collapse
-
.build_error(code:, reason:, message:) ⇒ Error
Factory method to create appropriate error instances.
-
.client ⇒ GasfreeSdk::Client
Create a new client instance.
-
.configure {|config| ... } ⇒ Object
Configure the SDK.
-
.reset_client! ⇒ void
Reset the client instance.
Class Method Details
.build_error(code:, reason:, message:) ⇒ Error
Factory method to create appropriate error instances
52 53 54 55 |
# File 'lib/gasfree_sdk/errors.rb', line 52 def build_error(code:, reason:, message:) error_class = determine_error_class(code, reason) error_class.new(, code: code, reason: reason) end |
.client ⇒ GasfreeSdk::Client
Create a new client instance
53 54 55 |
# File 'lib/gasfree_sdk.rb', line 53 def client @client ||= Client.new end |
.configure {|config| ... } ⇒ Object
Configure the SDK
47 48 49 |
# File 'lib/gasfree_sdk.rb', line 47 def configure yield config end |
.reset_client! ⇒ void
This method returns an undefined value.
Reset the client instance
59 60 61 |
# File 'lib/gasfree_sdk.rb', line 59 def reset_client! @client = nil end |