tronzap-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +23 -0
  3. data/LICENSE +21 -0
  4. data/README.es.md +396 -0
  5. data/README.md +392 -0
  6. data/README.pt-br.md +392 -0
  7. data/README.ru.md +392 -0
  8. data/lib/tronzap/client.rb +239 -0
  9. data/lib/tronzap/coerce.rb +127 -0
  10. data/lib/tronzap/configuration.rb +140 -0
  11. data/lib/tronzap/errors.rb +150 -0
  12. data/lib/tronzap/http_adapter.rb +168 -0
  13. data/lib/tronzap/models/activate_address_rate.rb +11 -0
  14. data/lib/tronzap/models/address_resources.rb +13 -0
  15. data/lib/tronzap/models/aml_risk_factor.rb +28 -0
  16. data/lib/tronzap/models/bandwidth_rate.rb +28 -0
  17. data/lib/tronzap/models/direct_recharge_rate.rb +38 -0
  18. data/lib/tronzap/models/energy_rate.rb +44 -0
  19. data/lib/tronzap/models/enums.rb +26 -0
  20. data/lib/tronzap/models/resource_amounts.rb +13 -0
  21. data/lib/tronzap/models/timestamp.rb +58 -0
  22. data/lib/tronzap/models/transaction_params.rb +46 -0
  23. data/lib/tronzap/requests/address_activation.rb +28 -0
  24. data/lib/tronzap/requests/aml_check.rb +68 -0
  25. data/lib/tronzap/requests/aml_history.rb +34 -0
  26. data/lib/tronzap/requests/bandwidth_transaction.rb +33 -0
  27. data/lib/tronzap/requests/calculate.rb +32 -0
  28. data/lib/tronzap/requests/check_transaction.rb +48 -0
  29. data/lib/tronzap/requests/energy_transaction.rb +42 -0
  30. data/lib/tronzap/requests/estimate_energy.rb +38 -0
  31. data/lib/tronzap/requests/resource_bundle_transaction.rb +51 -0
  32. data/lib/tronzap/requests/validation.rb +56 -0
  33. data/lib/tronzap/response_decoder.rb +115 -0
  34. data/lib/tronzap/responses/account_balance.rb +20 -0
  35. data/lib/tronzap/responses/address_info.rb +26 -0
  36. data/lib/tronzap/responses/aml_check.rb +56 -0
  37. data/lib/tronzap/responses/aml_history.rb +28 -0
  38. data/lib/tronzap/responses/aml_service.rb +30 -0
  39. data/lib/tronzap/responses/calculation.rb +40 -0
  40. data/lib/tronzap/responses/direct_recharge_info.rb +22 -0
  41. data/lib/tronzap/responses/energy_estimate.rb +44 -0
  42. data/lib/tronzap/responses/service_rates.rb +36 -0
  43. data/lib/tronzap/responses/transaction.rb +44 -0
  44. data/lib/tronzap/version.rb +6 -0
  45. data/lib/tronzap-sdk.rb +4 -0
  46. data/lib/tronzap.rb +47 -0
  47. metadata +107 -0
@@ -0,0 +1,115 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tronzap
4
+ # Turns an HTTP response into a result or the matching {Error}.
5
+ #
6
+ # @api private
7
+ module ResponseDecoder
8
+ UNKNOWN_API_ERROR = "Unknown API error"
9
+ private_constant :UNKNOWN_API_ERROR
10
+
11
+ module_function
12
+
13
+ # The API code takes precedence over the HTTP status: some API errors arrive with 2xx, others with 4xx/5xx.
14
+ #
15
+ # @param response [#status, #headers, #body]
16
+ # @yieldparam result [Object] the parsed +result+ field
17
+ # @return [Object] what the block returns
18
+ def decode(response)
19
+ status = response.status.to_i
20
+ body = text(response.body)
21
+ document, parse_error = parse(body)
22
+
23
+ check_api_error(document, status, body) unless parse_error
24
+ raise http_error(status, body, response.headers) unless (200..299).cover?(status)
25
+
26
+ result = result(document, parse_error, status, body)
27
+ begin
28
+ yield result
29
+ rescue Coerce::Error => e
30
+ raise invalid("Unexpected result in response: #{e.message}", status, body)
31
+ end
32
+ end
33
+
34
+ def result(document, parse_error, status, body)
35
+ raise invalid("Invalid JSON response: #{parse_error.message}", status, body) if parse_error
36
+
37
+ result = document["result"]
38
+ raise invalid("Missing result in response", status, body) if result.nil?
39
+
40
+ result
41
+ end
42
+
43
+ def invalid(message, status, body)
44
+ InvalidResponseError.new(message, status: status, response_body: body)
45
+ end
46
+
47
+ def text(body)
48
+ text = body.to_s.dup.force_encoding(Encoding::UTF_8)
49
+ text.valid_encoding? ? text.freeze : text.scrub.freeze
50
+ end
51
+
52
+ def parse(body)
53
+ [JSON.parse(body, decimal_class: BigDecimal), nil]
54
+ rescue JSON::ParserError, EncodingError => e
55
+ [nil, e]
56
+ end
57
+
58
+ def check_api_error(document, status, body)
59
+ unless document.is_a?(Hash)
60
+ raise ApiError.new(UNKNOWN_API_ERROR, code: ErrorCode::AUTH_ERROR, status: status, response_body: body)
61
+ end
62
+
63
+ code = code(document["code"])
64
+ return if code&.zero?
65
+
66
+ raise ApiError.new(
67
+ string(document["error"]) || UNKNOWN_API_ERROR,
68
+ code: code || ErrorCode::AUTH_ERROR,
69
+ status: status,
70
+ response_body: body,
71
+ error_key: string(document["key"]),
72
+ request_id: string(document["request_id"])
73
+ )
74
+ end
75
+
76
+ def code(value)
77
+ case value
78
+ when Integer then value
79
+ when String then value.strip.match?(/\A[+-]?\d+\z/) ? value.to_i : nil
80
+ end
81
+ end
82
+
83
+ def string(value)
84
+ case value
85
+ when String then value
86
+ when Integer then value.to_s
87
+ when BigDecimal then value.to_s("F")
88
+ end
89
+ end
90
+
91
+ def http_error(status, body, headers)
92
+ case status
93
+ when 429
94
+ RateLimitError.new("Too many requests (HTTP 429)", status: status, response_body: body,
95
+ retry_after: retry_after(headers))
96
+ when 401, 403 then UnauthorizedError.new("Unauthorized (HTTP #{status})", status: status, response_body: body)
97
+ when 500.. then ServerError.new("Server error (HTTP #{status})", status: status, response_body: body)
98
+ else HttpError.new("HTTP error #{status}", status: status, response_body: body)
99
+ end
100
+ end
101
+
102
+ def retry_after(headers)
103
+ value = headers.to_h.find { |name, _| name.to_s.casecmp?("retry-after") }&.last
104
+ value = value.first if value.is_a?(Array)
105
+ return nil unless value.is_a?(String)
106
+
107
+ value = value.strip
108
+ return value.to_f if value.match?(/\A\d+(\.\d+)?\z/)
109
+
110
+ [Time.httpdate(value) - Time.now, 0.0].max
111
+ rescue ArgumentError
112
+ nil
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tronzap
4
+ # Results returned by {Client} methods. They are immutable; collections are frozen and never +nil+.
5
+ module Responses
6
+ # The account balance and the address that tops it up.
7
+ #
8
+ # @!attribute [r] balance
9
+ # @return [BigDecimal] available balance, in TRX
10
+ # @!attribute [r] address
11
+ # @return [String] the TRON address to send TRX to in order to top up the balance
12
+ AccountBalance = Data.define(:balance, :address) do
13
+ # @api private
14
+ def self.from_api(value)
15
+ data = Coerce.object(value, "result")
16
+ new(balance: Coerce.decimal(data["balance"], "balance"), address: Coerce.text(data["address"], "address"))
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tronzap
4
+ module Responses
5
+ # The on-chain resources and token balances of a TRON address.
6
+ #
7
+ # @!attribute [r] resources
8
+ # @return [Models::AddressResources] available energy and bandwidth
9
+ # @!attribute [r] balances
10
+ # @return [Hash{String => BigDecimal}] token balances by token symbol, for example +TRX+ and +USDT+
11
+ AddressInfo = Data.define(:resources, :balances) do
12
+ # @api private
13
+ def self.from_api(value)
14
+ data = Coerce.object(value, "result")
15
+ resources = Coerce.object(data["resources"], "resources")
16
+ new(
17
+ resources: Models::AddressResources.new(
18
+ energy: Coerce.integer(resources["energy"], "resources.energy"),
19
+ bandwidth: Coerce.integer(resources["bandwidth"], "resources.bandwidth")
20
+ ),
21
+ balances: Coerce.decimal_map(data["balances"], "balances")
22
+ )
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tronzap
4
+ module Responses
5
+ # An AML screening of an address or a transaction hash.
6
+ #
7
+ # @!attribute [r] id
8
+ # @return [String] the AML check ID
9
+ # @!attribute [r] type
10
+ # @return [Symbol] what is screened, one of {Models::AML_CHECK_TYPES} or +:unknown+
11
+ # @!attribute [r] address
12
+ # @return [String] the screened wallet address
13
+ # @!attribute [r] transaction_hash
14
+ # @return [String, nil] the screened transaction hash, +nil+ for an address check
15
+ # @!attribute [r] direction
16
+ # @return [Symbol, nil] the direction of the screened transaction, one of {Models::AML_DIRECTIONS} or
17
+ # +:unknown+, +nil+ when not given
18
+ # @!attribute [r] network
19
+ # @return [String] the network code, for example +TRX+, +BTC+ or +ETH+
20
+ # @!attribute [r] status
21
+ # @return [Symbol] the state of the check, one of {Models::AML_STATUSES} or +:unknown+
22
+ # @!attribute [r] risk_score
23
+ # @return [BigDecimal, nil] the risk score, +nil+ until the check completes. A completed check can have a
24
+ # score of 0, which is not the same as having no score yet.
25
+ # @!attribute [r] risk_level
26
+ # @return [Symbol, nil] the risk level, one of {Models::AML_RISK_LEVELS} or +:unknown+, +nil+ until the
27
+ # check completes
28
+ # @!attribute [r] blacklist
29
+ # @return [Boolean] whether the subject is blacklisted
30
+ # @!attribute [r] risk_factors
31
+ # @return [Array<Models::AmlRiskFactor>] the factors that contributed to the risk score
32
+ # @!attribute [r] checked_at
33
+ # @return [Models::Timestamp, nil] when the check completed, +nil+ when the API did not report it
34
+ AmlCheck = Data.define(:id, :type, :address, :transaction_hash, :direction, :network, :status,
35
+ :risk_score, :risk_level, :blacklist, :risk_factors, :checked_at) do
36
+ # @api private
37
+ def self.from_api(value)
38
+ data = Coerce.object(value, "AML check")
39
+ new(
40
+ id: Coerce.text(data["id"], "id"),
41
+ type: Coerce.enum(data["type"], Models::AML_CHECK_TYPES, "type"),
42
+ address: Coerce.text(data["address"], "address"),
43
+ transaction_hash: Coerce.optional_text(data["hash"], "hash"),
44
+ direction: Coerce.optional_enum(data["direction"], Models::AML_DIRECTIONS, "direction"),
45
+ network: Coerce.text(data["network"], "network"),
46
+ status: Coerce.enum(data["status"], Models::AML_STATUSES, "status"),
47
+ risk_score: Coerce.optional_decimal(data["risk_score"], "risk_score"),
48
+ risk_level: Coerce.optional_enum(data["risk_level"], Models::AML_RISK_LEVELS, "risk_level"),
49
+ blacklist: Coerce.boolean(data["blacklist"], "blacklist"),
50
+ risk_factors: Coerce.list(data["risk_factors"], "risk_factors") { Models::AmlRiskFactor.from_api(_1) },
51
+ checked_at: Coerce.timestamp(data["checked_at"], "checked_at")
52
+ )
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tronzap
4
+ module Responses
5
+ # One page of past AML checks, newest first.
6
+ #
7
+ # @!attribute [r] page
8
+ # @return [Integer] the page number, starting at 1
9
+ # @!attribute [r] per_page
10
+ # @return [Integer] the page size
11
+ # @!attribute [r] total
12
+ # @return [Integer] the number of checks across all pages
13
+ # @!attribute [r] items
14
+ # @return [Array<AmlCheck>] the checks on this page
15
+ AmlHistory = Data.define(:page, :per_page, :total, :items) do
16
+ # @api private
17
+ def self.from_api(value)
18
+ data = Coerce.object(value, "result")
19
+ new(
20
+ page: Coerce.integer(data["page"], "page"),
21
+ per_page: Coerce.integer(data["per_page"], "per_page"),
22
+ total: Coerce.integer(data["total"], "total"),
23
+ items: Coerce.list(data["items"], "items") { AmlCheck.from_api(_1) }
24
+ )
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tronzap
4
+ module Responses
5
+ # An AML screening product and its price.
6
+ #
7
+ # @!attribute [r] id
8
+ # @return [String] the service ID
9
+ # @!attribute [r] type
10
+ # @return [Symbol] what the service screens, one of {Models::AML_CHECK_TYPES} or +:unknown+
11
+ # @!attribute [r] price
12
+ # @return [BigDecimal] price of one check, in TRX
13
+ AmlService = Data.define(:id, :type, :price) do
14
+ # @api private
15
+ def self.from_api(value)
16
+ data = Coerce.object(value, "AML service")
17
+ new(
18
+ id: Coerce.text(data["id"], "id"),
19
+ type: Coerce.enum(data["type"], Models::AML_CHECK_TYPES, "type"),
20
+ price: Coerce.decimal(data["price"], "price")
21
+ )
22
+ end
23
+
24
+ # @api private
25
+ def self.list_from_api(value)
26
+ Coerce.list(value, "result") { from_api(_1) }
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tronzap
4
+ module Responses
5
+ # The price of an energy purchase.
6
+ #
7
+ # @!attribute [r] address
8
+ # @return [String] the TRON address that would receive the energy
9
+ # @!attribute [r] service
10
+ # @return [Symbol] the service the price is for, one of {Models::SERVICES} or +:unknown+
11
+ # @!attribute [r] amount
12
+ # @return [Integer] the amount priced
13
+ # @!attribute [r] energy
14
+ # @return [Integer] the energy priced
15
+ # @!attribute [r] duration
16
+ # @return [Integer] rental duration in hours
17
+ # @!attribute [r] price
18
+ # @return [BigDecimal] price of the energy, in TRX
19
+ # @!attribute [r] activation_fee
20
+ # @return [BigDecimal] address activation fee, in TRX
21
+ # @!attribute [r] total
22
+ # @return [BigDecimal] total cost, in TRX
23
+ Calculation = Data.define(:address, :service, :amount, :energy, :duration, :price, :activation_fee, :total) do
24
+ # @api private
25
+ def self.from_api(value)
26
+ data = Coerce.object(value, "result")
27
+ new(
28
+ address: Coerce.text(data["address"], "address"),
29
+ service: Coerce.enum(data["type"], Models::SERVICES, "type"),
30
+ amount: Coerce.integer(data["amount"], "amount"),
31
+ energy: Coerce.integer(data["energy"], "energy"),
32
+ duration: Coerce.integer(data["duration"], "duration"),
33
+ price: Coerce.decimal(data["price"], "price"),
34
+ activation_fee: Coerce.decimal(data["activation_fee"], "activation_fee"),
35
+ total: Coerce.decimal(data["total"], "total")
36
+ )
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tronzap
4
+ module Responses
5
+ # The address to pay for a direct energy recharge and the rates energy is delivered at.
6
+ #
7
+ # @!attribute [r] address
8
+ # @return [String] the TRON address to send TRX to
9
+ # @!attribute [r] rates
10
+ # @return [Array<Models::DirectRechargeRate>] the rates energy is delivered at
11
+ DirectRechargeInfo = Data.define(:address, :rates) do
12
+ # @api private
13
+ def self.from_api(value)
14
+ data = Coerce.object(value, "result")
15
+ new(
16
+ address: Coerce.text(data["address"], "address"),
17
+ rates: Coerce.list(data["rates"], "rates") { Models::DirectRechargeRate.from_api(_1) }
18
+ )
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tronzap
4
+ module Responses
5
+ # The energy a token transfer needs and what that energy costs.
6
+ #
7
+ # @!attribute [r] amount
8
+ # @return [Integer] the amount of energy the price applies to
9
+ # @!attribute [r] energy
10
+ # @return [Integer] the energy the transfer needs
11
+ # @!attribute [r] duration
12
+ # @return [Integer] rental duration in hours
13
+ # @!attribute [r] price
14
+ # @return [BigDecimal] price of the energy, in TRX
15
+ # @!attribute [r] activation_fee
16
+ # @return [BigDecimal] address activation fee, in TRX
17
+ # @!attribute [r] total
18
+ # @return [BigDecimal] total cost, in TRX
19
+ # @!attribute [r] from_address
20
+ # @return [String] the sender address
21
+ # @!attribute [r] to_address
22
+ # @return [String] the recipient address
23
+ # @!attribute [r] contract_address
24
+ # @return [String] the token contract the estimate is for
25
+ EnergyEstimate = Data.define(:amount, :energy, :duration, :price, :activation_fee, :total,
26
+ :from_address, :to_address, :contract_address) do
27
+ # @api private
28
+ def self.from_api(value)
29
+ data = Coerce.object(value, "result")
30
+ new(
31
+ amount: Coerce.integer(data["amount"], "amount"),
32
+ energy: Coerce.integer(data["energy"], "energy"),
33
+ duration: Coerce.integer(data["duration"], "duration"),
34
+ price: Coerce.decimal(data["price"], "price"),
35
+ activation_fee: Coerce.decimal(data["activation_fee"], "activation_fee"),
36
+ total: Coerce.decimal(data["total"], "total"),
37
+ from_address: Coerce.text(data["from_address"], "from_address"),
38
+ to_address: Coerce.text(data["to_address"], "to_address"),
39
+ contract_address: Coerce.text(data["contract_address"], "contract_address")
40
+ )
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tronzap
4
+ module Responses
5
+ # The resources on sale and their current prices.
6
+ #
7
+ # Energy is priced per unit and bandwidth per 1000 units: {Models::EnergyRate#price} × 65000 is the cost of
8
+ # 65000 energy, while 345 bandwidth at a {Models::BandwidthRate#price} of 1 costs 0.345.
9
+ #
10
+ # @!attribute [r] energy
11
+ # @return [Array<Models::EnergyRate>] energy price tiers
12
+ # @!attribute [r] bandwidth
13
+ # @return [Array<Models::BandwidthRate>] bandwidth price tiers
14
+ # @!attribute [r] activate_address
15
+ # @return [Models::ActivateAddressRate, nil] the address activation price, +nil+ when the API did not
16
+ # report one
17
+ ServiceRates = Data.define(:energy, :bandwidth, :activate_address) do
18
+ # @api private
19
+ def self.from_api(value)
20
+ data = Coerce.object(value, "result")
21
+ activation = data["activate_address"]
22
+ new(
23
+ energy: Coerce.list(data["energy"], "energy") { Models::EnergyRate.from_api(_1) },
24
+ bandwidth: Coerce.list(data["bandwidth"], "bandwidth") { Models::BandwidthRate.from_api(_1) },
25
+ activate_address: activation.nil? ? nil : activation_rate(activation)
26
+ )
27
+ end
28
+
29
+ def self.activation_rate(value)
30
+ data = Coerce.object(value, "activate_address")
31
+ Models::ActivateAddressRate.new(price: Coerce.decimal(data["price"], "activate_address.price"))
32
+ end
33
+ private_class_method :activation_rate
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tronzap
4
+ module Responses
5
+ # A purchase of energy, bandwidth or address activation.
6
+ #
7
+ # @!attribute [r] id
8
+ # @return [String] the transaction ID assigned by TronZap
9
+ # @!attribute [r] external_id
10
+ # @return [String, nil] the ID you passed when creating the transaction
11
+ # @!attribute [r] service
12
+ # @return [Symbol] the service of the transaction, one of {Models::SERVICES} or +:unknown+. The API currently
13
+ # reports a resource bundle as +:energy+; read {Models::TransactionParams#amounts} to see which resources
14
+ # it contains.
15
+ # @!attribute [r] params
16
+ # @return [Models::TransactionParams] the parameters the transaction was created with
17
+ # @!attribute [r] status
18
+ # @return [Symbol] the current state, one of {Models::TRANSACTION_STATUSES} or +:unknown+
19
+ # @!attribute [r] amount
20
+ # @return [BigDecimal] the amount charged, in TRX
21
+ # @!attribute [r] created_at
22
+ # @return [Models::Timestamp, nil] when the transaction was created, +nil+ when the API did not report it
23
+ # @!attribute [r] transaction_hash
24
+ # @return [String, nil] the on-chain transaction hash, +nil+ when the API did not report one
25
+ Transaction = Data.define(:id, :external_id, :service, :params, :status, :amount, :created_at,
26
+ :transaction_hash) do
27
+ # @api private
28
+ def self.from_api(value)
29
+ data = Coerce.object(value, "result")
30
+ service = Coerce.enum(data["service"], Models::SERVICES, "service")
31
+ new(
32
+ id: Coerce.text(data["id"], "id"),
33
+ external_id: Coerce.optional_text(data["external_id"], "external_id"),
34
+ service: service,
35
+ params: Models::TransactionParams.from_api(data["params"], service),
36
+ status: Coerce.enum(data["status"], Models::TRANSACTION_STATUSES, "status"),
37
+ amount: Coerce.decimal(data["amount"], "amount"),
38
+ created_at: Coerce.timestamp(data["created_at"], "created_at"),
39
+ transaction_hash: Coerce.optional_text(data["hash"], "hash")
40
+ )
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tronzap
4
+ # The SDK version, reported in the default +User-Agent+ header.
5
+ VERSION = "1.0.0"
6
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Bundler.require loads a gem by its name, so `gem "tronzap-sdk"` needs this file to load the library.
4
+ require_relative "tronzap"
data/lib/tronzap.rb ADDED
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bigdecimal"
4
+ require "json"
5
+ require "time"
6
+
7
+ require_relative "tronzap/version"
8
+ require_relative "tronzap/errors"
9
+ require_relative "tronzap/coerce"
10
+ require_relative "tronzap/models/enums"
11
+ require_relative "tronzap/models/timestamp"
12
+ require_relative "tronzap/models/resource_amounts"
13
+ require_relative "tronzap/models/transaction_params"
14
+ require_relative "tronzap/models/address_resources"
15
+ require_relative "tronzap/models/energy_rate"
16
+ require_relative "tronzap/models/bandwidth_rate"
17
+ require_relative "tronzap/models/activate_address_rate"
18
+ require_relative "tronzap/models/direct_recharge_rate"
19
+ require_relative "tronzap/models/aml_risk_factor"
20
+ require_relative "tronzap/requests/validation"
21
+ require_relative "tronzap/requests/estimate_energy"
22
+ require_relative "tronzap/requests/calculate"
23
+ require_relative "tronzap/requests/energy_transaction"
24
+ require_relative "tronzap/requests/bandwidth_transaction"
25
+ require_relative "tronzap/requests/resource_bundle_transaction"
26
+ require_relative "tronzap/requests/address_activation"
27
+ require_relative "tronzap/requests/check_transaction"
28
+ require_relative "tronzap/requests/aml_check"
29
+ require_relative "tronzap/requests/aml_history"
30
+ require_relative "tronzap/responses/account_balance"
31
+ require_relative "tronzap/responses/address_info"
32
+ require_relative "tronzap/responses/aml_check"
33
+ require_relative "tronzap/responses/aml_history"
34
+ require_relative "tronzap/responses/aml_service"
35
+ require_relative "tronzap/responses/calculation"
36
+ require_relative "tronzap/responses/direct_recharge_info"
37
+ require_relative "tronzap/responses/energy_estimate"
38
+ require_relative "tronzap/responses/service_rates"
39
+ require_relative "tronzap/responses/transaction"
40
+ require_relative "tronzap/http_adapter"
41
+ require_relative "tronzap/response_decoder"
42
+ require_relative "tronzap/configuration"
43
+ require_relative "tronzap/client"
44
+
45
+ # Official Ruby SDK for the {https://docs.tronzap.com/ TronZap API}. Start with {Tronzap::Client}.
46
+ module Tronzap
47
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tronzap-sdk
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - TronZap
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: bigdecimal
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '3.1'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '3.1'
26
+ description: Official Ruby SDK for TronZap.com. The TRON Energy API lets you buy energy
27
+ and bandwidth to lower USDT (TRC20) transfer fees, activate TRON addresses and run
28
+ AML checks.
29
+ email:
30
+ - support@tronzap.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - CHANGELOG.md
36
+ - LICENSE
37
+ - README.es.md
38
+ - README.md
39
+ - README.pt-br.md
40
+ - README.ru.md
41
+ - lib/tronzap-sdk.rb
42
+ - lib/tronzap.rb
43
+ - lib/tronzap/client.rb
44
+ - lib/tronzap/coerce.rb
45
+ - lib/tronzap/configuration.rb
46
+ - lib/tronzap/errors.rb
47
+ - lib/tronzap/http_adapter.rb
48
+ - lib/tronzap/models/activate_address_rate.rb
49
+ - lib/tronzap/models/address_resources.rb
50
+ - lib/tronzap/models/aml_risk_factor.rb
51
+ - lib/tronzap/models/bandwidth_rate.rb
52
+ - lib/tronzap/models/direct_recharge_rate.rb
53
+ - lib/tronzap/models/energy_rate.rb
54
+ - lib/tronzap/models/enums.rb
55
+ - lib/tronzap/models/resource_amounts.rb
56
+ - lib/tronzap/models/timestamp.rb
57
+ - lib/tronzap/models/transaction_params.rb
58
+ - lib/tronzap/requests/address_activation.rb
59
+ - lib/tronzap/requests/aml_check.rb
60
+ - lib/tronzap/requests/aml_history.rb
61
+ - lib/tronzap/requests/bandwidth_transaction.rb
62
+ - lib/tronzap/requests/calculate.rb
63
+ - lib/tronzap/requests/check_transaction.rb
64
+ - lib/tronzap/requests/energy_transaction.rb
65
+ - lib/tronzap/requests/estimate_energy.rb
66
+ - lib/tronzap/requests/resource_bundle_transaction.rb
67
+ - lib/tronzap/requests/validation.rb
68
+ - lib/tronzap/response_decoder.rb
69
+ - lib/tronzap/responses/account_balance.rb
70
+ - lib/tronzap/responses/address_info.rb
71
+ - lib/tronzap/responses/aml_check.rb
72
+ - lib/tronzap/responses/aml_history.rb
73
+ - lib/tronzap/responses/aml_service.rb
74
+ - lib/tronzap/responses/calculation.rb
75
+ - lib/tronzap/responses/direct_recharge_info.rb
76
+ - lib/tronzap/responses/energy_estimate.rb
77
+ - lib/tronzap/responses/service_rates.rb
78
+ - lib/tronzap/responses/transaction.rb
79
+ - lib/tronzap/version.rb
80
+ homepage: https://tronzap.com/
81
+ licenses:
82
+ - MIT
83
+ metadata:
84
+ homepage_uri: https://tronzap.com/
85
+ documentation_uri: https://docs.tronzap.com/
86
+ source_code_uri: https://github.com/tron-energy-market/tronzap-sdk-ruby
87
+ changelog_uri: https://github.com/tron-energy-market/tronzap-sdk-ruby/blob/main/CHANGELOG.md
88
+ bug_tracker_uri: https://github.com/tron-energy-market/tronzap-sdk-ruby/issues
89
+ rubygems_mfa_required: 'true'
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '3.3'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubygems_version: 4.0.20
105
+ specification_version: 4
106
+ summary: 'Official Ruby SDK for the TronZap API: buy TRON energy and bandwidth.'
107
+ test_files: []