zilliqa 0.1.2 → 0.1.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 +4 -4
- data/lib/zilliqa/account/wallet.rb +1 -26
- data/lib/zilliqa/jsonrpc/provider.rb +0 -4
- data/lib/zilliqa/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71bba757956cda1651fb68aca99d2ad56b5c4448d8188d8704eb8830b15f560a
|
4
|
+
data.tar.gz: e898727b5c67ea2ca0cbf021a10f9363936f28a82bda943ef2174c45cd625881
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa11781f35765054e687f4a4d0632a54dafbaedcb9585cfec5e1a7e62f357300407f73f6ecd530d36d669c9644e5e33a0f73abe6d9493a5e9afb3d4c416e4155
|
7
|
+
data.tar.gz: 5392773a506247f687dd2543f04ae633b797371ad29a8f7b3c4336052cfef44765180575c2d213e9028d40df71bc48cf8addcce7a123230e468de5447a446b55
|
@@ -3,7 +3,6 @@ require 'digest'
|
|
3
3
|
module Zilliqa
|
4
4
|
module Account
|
5
5
|
class Wallet
|
6
|
-
MAINNET = 65_537
|
7
6
|
|
8
7
|
# Takes an array of Account objects and instantiates a Wallet instance.
|
9
8
|
def initialize(provider = nil, accounts = {})
|
@@ -70,30 +69,6 @@ module Zilliqa
|
|
70
69
|
@default_account = @accounts[address]
|
71
70
|
end
|
72
71
|
|
73
|
-
# to_checksum_address
|
74
|
-
#
|
75
|
-
# takes hex-encoded string and returns the corresponding address
|
76
|
-
#
|
77
|
-
# @param {string} address
|
78
|
-
# @returns {string}
|
79
|
-
def self.to_checksum_address(address)
|
80
|
-
return Zilliqa::Util::Bech32.from_bech32(address) if Zilliqa::Util::Validator.bech32?(address)
|
81
|
-
address = address.downcase.gsub('0x', '')
|
82
|
-
|
83
|
-
s1 = Digest::SHA256.hexdigest(Util.decode_hex(address))
|
84
|
-
v = s1.to_i(base=16)
|
85
|
-
|
86
|
-
ret = ['0x']
|
87
|
-
address.each_char.each_with_index do |c, idx|
|
88
|
-
if '1234567890'.include?(c)
|
89
|
-
ret << c
|
90
|
-
else
|
91
|
-
ret << ((v & (2 ** (255 - 6 * idx))) < 1 ? c.downcase : c.upcase)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
ret.join
|
96
|
-
end
|
97
72
|
|
98
73
|
def transfer(to_addr, amount)
|
99
74
|
gas_price = Integer(@provider.GetMinimumGasPrice)
|
@@ -127,7 +102,7 @@ module Zilliqa
|
|
127
102
|
|
128
103
|
def sign_with(tx, address)
|
129
104
|
account = @accounts[address]
|
130
|
-
address =
|
105
|
+
address = account.address
|
131
106
|
|
132
107
|
raise 'The selected account does not exist on this Wallet instance.' unless account
|
133
108
|
|
data/lib/zilliqa/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zilliqa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- snuff
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-07-
|
12
|
+
date: 2020-07-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -196,8 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
196
|
- !ruby/object:Gem::Version
|
197
197
|
version: '0'
|
198
198
|
requirements: []
|
199
|
-
|
200
|
-
rubygems_version: 2.7.10
|
199
|
+
rubygems_version: 3.1.4
|
201
200
|
signing_key:
|
202
201
|
specification_version: 4
|
203
202
|
summary: Zilliqa — Zilliqa Ruby Blockchain Library
|