tron.rb 1.0.1 → 1.0.2

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: 68e2df783fb208cc34d8e404c6c93b7fd27aae0066b2f6efec8650c739b5c623
4
+ data.tar.gz: a13fae572eaebef060a24485db75d70d4d8a71a5952e62f18624b98926225258
5
5
  SHA512:
6
- metadata.gz: b532f28c101c294eab8b13d1439f41a6ec71d14911a0b4c351c009a0f711dedf27c67c8041bbddb84a785d766cd2655a0d3920498748b0823bb6629593c337f8
7
- data.tar.gz: a474fa28f378f2c0c28dbfb247db873f6080a66a94976b26d1a59578e8786687ef598d55ffaa8c2550a281a4a7fd32a4653615e08451cf5391e540edaf5bb1fd
6
+ metadata.gz: f74287a0bd02186a0b8b2b7c4faf62a25fe4ba5e78168da5388855e21d9b3c36e6b5eaeda8d7ea2a787837729971fb033d3174d81352417f3839d043ccc5b275
7
+ data.tar.gz: 21779f5695517650257c97719bb8903e4de98d4a0c69157816d2cf71a25420385cdfd9d3c8225f6c037a00cce41fe201f4ecbe75dd1231705d4424fe05f0cd79
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.2".freeze
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Your Name