tron.rb 1.0.1 → 1.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 966fad6a23cb5e25e03942b1c957e50686b57aba89cffca0567618648015dcad
4
- data.tar.gz: '09b08d02c41b826b15cfb283acac79f4c9bd1272465013ec7961e64076b03b7e'
3
+ metadata.gz: 47245c19132066a0f55673961d9bd8501bef9377debef4eaadc9e2ed879915e7
4
+ data.tar.gz: 589e32a25eab5e81040e094e3178f334084830b0abf023b290e13b0c8d6720f6
5
5
  SHA512:
6
- metadata.gz: b532f28c101c294eab8b13d1439f41a6ec71d14911a0b4c351c009a0f711dedf27c67c8041bbddb84a785d766cd2655a0d3920498748b0823bb6629593c337f8
7
- data.tar.gz: a474fa28f378f2c0c28dbfb247db873f6080a66a94976b26d1a59578e8786687ef598d55ffaa8c2550a281a4a7fd32a4653615e08451cf5391e540edaf5bb1fd
6
+ metadata.gz: b690a27e2d498cd3f30fa5ac6390ef7a789a4c1f3647b144e13ea81e9a9caa894e73ca71c44f5d2b8f649a36cc5bfd1bb55ac03b396f4e95e71fe1f01bae8f8a
7
+ data.tar.gz: a25185d641615a26d40bcbb21ea8fb6f0fc6bf9aea69d842fe54d159cc0932a932f34966ce1d72bf2353ab945540b32c9ddaacff7c7338996fdaacfaeb231632
data/README.md CHANGED
@@ -100,7 +100,7 @@ portfolio = client.get_wallet_portfolio('TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb', in
100
100
 
101
101
  puts "Total Portfolio Value: $#{portfolio[:total_value_usd]}"
102
102
  portfolio[:tokens].each do |token|
103
- puts "#{token[:symbol]}: #{token[:balance]} ($#{token[:value_usd]})"
103
+ puts "#{token[:symbol]}: #{token[:token_balance]} ($#{token[:usd_value]})"
104
104
  end
105
105
  ```
106
106
 
data/lib/tron/client.rb CHANGED
@@ -80,11 +80,11 @@ module Tron
80
80
  tokens << {
81
81
  symbol: 'TRX',
82
82
  name: 'Tronix',
83
- balance: trx_balance,
83
+ token_balance: trx_balance,
84
84
  decimals: 6,
85
85
  address: nil,
86
86
  price_usd: trx_price,
87
- value_usd: trx_price ? (trx_balance * trx_price).round(2) : nil
87
+ usd_value: trx_price ? (trx_balance * trx_price).round(2) : nil
88
88
  }
89
89
  end
90
90
 
@@ -94,24 +94,24 @@ module Tron
94
94
 
95
95
  # Get USD price for this token
96
96
  price_usd = price_service.get_token_price_usd(token[:symbol].downcase)
97
- value_usd = price_usd ? (token[:balance] * price_usd).round(2) : nil
97
+ usd_value = price_usd ? (token[:balance] * price_usd).round(2) : nil
98
98
 
99
99
  tokens << {
100
100
  symbol: token[:symbol],
101
101
  name: token[:name],
102
- balance: token[:balance],
102
+ token_balance: token[:balance],
103
103
  decimals: token[:decimals],
104
104
  address: token[:address],
105
105
  price_usd: price_usd,
106
- value_usd: value_usd
106
+ usd_value: usd_value
107
107
  }
108
108
  end
109
109
 
110
110
  # Step 4: Calculate total portfolio value
111
- total_value_usd = tokens.sum { |t| t[:value_usd] || 0 }
111
+ total_value_usd = tokens.sum { |t| t[:usd_value] || 0 }
112
112
 
113
113
  # Step 5: Sort by value (highest first)
114
- tokens.sort_by! { |t| -(t[:value_usd] || 0) }
114
+ tokens.sort_by! { |t| -(t[:usd_value] || 0) }
115
115
 
116
116
  {
117
117
  address: address,
data/lib/tron/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  # lib/tron/version.rb
4
4
  module Tron
5
- VERSION = "1.0.1".freeze
5
+ VERSION = "1.0.3".freeze
6
6
  end
data/lib/tron.rb CHANGED
@@ -8,7 +8,12 @@ require_relative 'tron/configuration'
8
8
  module Tron
9
9
  class << self
10
10
  def client
11
- @client ||= Client.new
11
+ @client ||= Client.new(
12
+ api_key: Client.configuration.api_key,
13
+ tronscan_api_key: Client.configuration.tronscan_api_key,
14
+ network: Client.configuration.network,
15
+ timeout: Client.configuration.timeout
16
+ )
12
17
  end
13
18
 
14
19
  def configure(&block)
@@ -16,6 +21,10 @@ module Tron
16
21
  Client.configure(&block)
17
22
  end
18
23
 
24
+ def configuration
25
+ Client.configuration
26
+ end
27
+
19
28
  # Delegate common methods to the default client
20
29
  def method_missing(method, *args, &block)
21
30
  if client.respond_to?(method)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tron.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Your Name
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-17 00:00:00.000000000 Z
11
+ date: 2025-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base58