digitalbits-sdk 0.27.1 → 0.27.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 +4 -4
- data/README.md +5 -5
- data/lib/digitalbits-sdk.rb +2 -2
- data/lib/digitalbits/account.rb +6 -6
- data/lib/digitalbits/amount.rb +5 -5
- data/lib/digitalbits/client.rb +39 -39
- data/lib/digitalbits/frontier/problem.rb +1 -1
- data/lib/digitalbits/sep10.rb +27 -27
- data/lib/digitalbits/transaction_page.rb +2 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc5ac7f64541d09831efc8007d82c653c3a1128ce373f600935a129f2164be0b
|
4
|
+
data.tar.gz: a4852a3d107b01c414edf2fdf28de7b07ec7718ac28df3e23e07efdb6b247c61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d272a513e233905d562f8bc9fa0b52ca844d76735aa067a66416ba96aeea9b4a8cb771fcd858be742151681e71da58f26699c7e58d4976fbc5130df7eb94d26
|
7
|
+
data.tar.gz: b77e9307912980c7b04826f7554434ecdce9fbe29099411b6a57a40f78f3d95b8bea80e9feb984400a1a8473b6b4dc77c2398adfff93e96795979721b83eb3b1
|
data/README.md
CHANGED
@@ -25,21 +25,21 @@ A simple payment from the root account to some random accounts
|
|
25
25
|
```ruby
|
26
26
|
require 'digitalbits-sdk'
|
27
27
|
|
28
|
-
account =
|
29
|
-
client =
|
30
|
-
recipient =
|
28
|
+
account = Digitalbits::Account.master
|
29
|
+
client = Digitalbits::Client.default_testnet()
|
30
|
+
recipient = Digitalbits::Account.random
|
31
31
|
|
32
32
|
client.send_payment({
|
33
33
|
from: account,
|
34
34
|
to: recipient,
|
35
|
-
amount:
|
35
|
+
amount: Digitalbits::Amount.new(100_000_000)
|
36
36
|
})
|
37
37
|
```
|
38
38
|
|
39
39
|
Be sure to set the network when submitting to the public network (more information in [digitalbits-base](https://www.github.com/xdbfoundation/ruby-digitalbits-base)):
|
40
40
|
|
41
41
|
```ruby
|
42
|
-
|
42
|
+
Digitalbits.default_network = Digitalbits::Networks::PUBLIC
|
43
43
|
```
|
44
44
|
|
45
45
|
## Development
|
data/lib/digitalbits-sdk.rb
CHANGED
data/lib/digitalbits/account.rb
CHANGED
@@ -3,22 +3,22 @@ require "uri"
|
|
3
3
|
require "faraday"
|
4
4
|
require "json"
|
5
5
|
|
6
|
-
module
|
6
|
+
module Digitalbits
|
7
7
|
class Account
|
8
8
|
delegate :address, to: :keypair
|
9
9
|
|
10
10
|
def self.random
|
11
|
-
keypair =
|
11
|
+
keypair = Digitalbits::KeyPair.random
|
12
12
|
new(keypair)
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.from_seed(seed)
|
16
|
-
keypair =
|
16
|
+
keypair = Digitalbits::KeyPair.from_seed(seed)
|
17
17
|
new(keypair)
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.from_address(address)
|
21
|
-
keypair =
|
21
|
+
keypair = Digitalbits::KeyPair.from_address(address)
|
22
22
|
new(keypair)
|
23
23
|
end
|
24
24
|
|
@@ -56,13 +56,13 @@ module DigitalBits
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def self.master
|
59
|
-
keypair =
|
59
|
+
keypair = Digitalbits::KeyPair.from_raw_seed("allmylifemyhearthasbeensearching")
|
60
60
|
new(keypair)
|
61
61
|
end
|
62
62
|
|
63
63
|
attr_reader :keypair
|
64
64
|
|
65
|
-
# @param [
|
65
|
+
# @param [Digitalbits::KeyPair] keypair
|
66
66
|
def initialize(keypair)
|
67
67
|
@keypair = keypair
|
68
68
|
end
|
data/lib/digitalbits/amount.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
module
|
1
|
+
module Digitalbits
|
2
2
|
class Amount
|
3
3
|
attr_reader :amount
|
4
4
|
attr_reader :asset
|
5
5
|
|
6
6
|
# @param [Fixnum] amount
|
7
|
-
# @param [
|
8
|
-
def initialize(amount, asset =
|
7
|
+
# @param [Digitalbits::Asset] asset
|
8
|
+
def initialize(amount, asset = Digitalbits::Asset.native)
|
9
9
|
# TODO: how are we going to handle decimal considerations?
|
10
10
|
|
11
11
|
@amount = amount
|
@@ -13,7 +13,7 @@ module DigitalBits
|
|
13
13
|
end
|
14
14
|
|
15
15
|
# @return [Array(Symbol, Fixnum)] in case of a native asset
|
16
|
-
# @return [Array(Symbol, String,
|
16
|
+
# @return [Array(Symbol, String, Digitalbits::KeyPair, Fixnum)] in case of alphanum asset
|
17
17
|
def to_payment
|
18
18
|
case asset.type
|
19
19
|
when AssetType.asset_type_native
|
@@ -30,7 +30,7 @@ module DigitalBits
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def inspect
|
33
|
-
"#<
|
33
|
+
"#<Digitalbits::Amount #{asset}(#{amount})>"
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
data/lib/digitalbits/client.rb
CHANGED
@@ -2,7 +2,7 @@ require "hyperclient"
|
|
2
2
|
require "active_support/core_ext/object/blank"
|
3
3
|
require "securerandom"
|
4
4
|
|
5
|
-
module
|
5
|
+
module Digitalbits
|
6
6
|
class AccountRequiresMemoError < StandardError
|
7
7
|
attr_reader :account_id, :operation_index
|
8
8
|
|
@@ -61,9 +61,9 @@ module DigitalBits
|
|
61
61
|
}
|
62
62
|
end
|
63
63
|
|
64
|
-
# @param [
|
64
|
+
# @param [Digitalbits::Account|String] account_or_address
|
65
65
|
def account_info(account_or_address)
|
66
|
-
account_id = if account_or_address.is_a?(
|
66
|
+
account_id = if account_or_address.is_a?(Digitalbits::Account)
|
67
67
|
account_or_address.address
|
68
68
|
else
|
69
69
|
account_or_address
|
@@ -71,14 +71,14 @@ module DigitalBits
|
|
71
71
|
@frontier.account(account_id: account_id)._get
|
72
72
|
end
|
73
73
|
|
74
|
-
# @option options [
|
75
|
-
# @option options [
|
74
|
+
# @option options [Digitalbits::Account] :account
|
75
|
+
# @option options [Digitalbits::Account] :destination
|
76
76
|
def account_merge(options = {})
|
77
77
|
account = options[:account]
|
78
78
|
destination = options[:destination]
|
79
79
|
sequence = options[:sequence] || (account_info(account).sequence.to_i + 1)
|
80
80
|
|
81
|
-
transaction =
|
81
|
+
transaction = Digitalbits::TransactionBuilder.account_merge(
|
82
82
|
source_account: destination.keypair,
|
83
83
|
sequence_number: sequence,
|
84
84
|
destination: destination.keypair
|
@@ -94,8 +94,8 @@ module DigitalBits
|
|
94
94
|
Faraday.post(uri.to_s)
|
95
95
|
end
|
96
96
|
|
97
|
-
# @option options [
|
98
|
-
# @option options [
|
97
|
+
# @option options [Digitalbits::Account] :account
|
98
|
+
# @option options [Digitalbits::Account] :funder
|
99
99
|
# @option options [Integer] :starting_balance
|
100
100
|
def create_account(options = {})
|
101
101
|
funder = options[:funder]
|
@@ -104,7 +104,7 @@ module DigitalBits
|
|
104
104
|
# instead of using a hard-coded default value.
|
105
105
|
fee = options[:fee] || DEFAULT_FEE
|
106
106
|
|
107
|
-
payment =
|
107
|
+
payment = Digitalbits::TransactionBuilder.create_account(
|
108
108
|
source_account: funder.keypair,
|
109
109
|
sequence_number: sequence,
|
110
110
|
base_fee: fee,
|
@@ -115,9 +115,9 @@ module DigitalBits
|
|
115
115
|
submit_transaction(tx_envelope: envelope)
|
116
116
|
end
|
117
117
|
|
118
|
-
# @option options [
|
119
|
-
# @option options [
|
120
|
-
# @option options [
|
118
|
+
# @option options [Digitalbits::Account] :from The source account
|
119
|
+
# @option options [Digitalbits::Account] :to The destination account
|
120
|
+
# @option options [Digitalbits::Amount] :amount The amount to send
|
121
121
|
def send_payment(options = {})
|
122
122
|
from_account = options[:from]
|
123
123
|
tx_source_account = options[:transaction_source] || from_account
|
@@ -126,11 +126,11 @@ module DigitalBits
|
|
126
126
|
sequence = options[:sequence] ||
|
127
127
|
(account_info(tx_source_account).sequence.to_i + 1)
|
128
128
|
|
129
|
-
payment =
|
129
|
+
payment = Digitalbits::TransactionBuilder.new(
|
130
130
|
source_account: tx_source_account.keypair,
|
131
131
|
sequence_number: sequence
|
132
132
|
).add_operation(
|
133
|
-
|
133
|
+
Digitalbits::Operation.payment(
|
134
134
|
source_account: op_source_account.keypair,
|
135
135
|
destination: options[:to].keypair,
|
136
136
|
amount: options[:amount].to_payment
|
@@ -144,10 +144,10 @@ module DigitalBits
|
|
144
144
|
submit_transaction(tx_envelope: envelope)
|
145
145
|
end
|
146
146
|
|
147
|
-
# @option options [
|
147
|
+
# @option options [Digitalbits::Account] :account
|
148
148
|
# @option options [Integer] :limit
|
149
149
|
# @option options [Integer] :cursor
|
150
|
-
# @return [
|
150
|
+
# @return [Digitalbits::TransactionPage]
|
151
151
|
def transactions(options = {})
|
152
152
|
args = options.slice(:limit, :cursor)
|
153
153
|
|
@@ -161,8 +161,8 @@ module DigitalBits
|
|
161
161
|
TransactionPage.new(resource)
|
162
162
|
end
|
163
163
|
|
164
|
-
# @param [Array(Symbol,String,
|
165
|
-
# @param [
|
164
|
+
# @param [Array(Symbol,String,Digitalbits::KeyPair|Digitalbits::Account)] asset
|
165
|
+
# @param [Digitalbits::Account] source
|
166
166
|
# @param [Integer] sequence
|
167
167
|
# @param [Integer] fee
|
168
168
|
# @param [Integer] limit
|
@@ -182,7 +182,7 @@ module DigitalBits
|
|
182
182
|
}
|
183
183
|
op_args[:limit] = limit unless limit.nil?
|
184
184
|
|
185
|
-
tx =
|
185
|
+
tx = Digitalbits::TransactionBuilder.change_trust(
|
186
186
|
source_account: source.keypair,
|
187
187
|
sequence_number: sequence,
|
188
188
|
**op_args
|
@@ -192,7 +192,7 @@ module DigitalBits
|
|
192
192
|
submit_transaction(tx_envelope: envelope)
|
193
193
|
end
|
194
194
|
|
195
|
-
# @param [
|
195
|
+
# @param [Digitalbits::TransactionEnvelope] tx_envelope
|
196
196
|
# @option options [Boolean] :skip_memo_required_check (false)
|
197
197
|
def submit_transaction(tx_envelope:, options: {skip_memo_required_check: false})
|
198
198
|
unless options[:skip_memo_required_check]
|
@@ -202,21 +202,21 @@ module DigitalBits
|
|
202
202
|
end
|
203
203
|
|
204
204
|
# Required by SEP-0029
|
205
|
-
# @param [
|
205
|
+
# @param [Digitalbits::TransactionEnvelope] tx_envelope
|
206
206
|
def check_memo_required(tx_envelope)
|
207
207
|
tx = tx_envelope.tx
|
208
208
|
|
209
|
-
if tx.is_a?(
|
209
|
+
if tx.is_a?(Digitalbits::FeeBumpTransaction)
|
210
210
|
tx = tx.inner_tx.v1!.tx
|
211
211
|
end
|
212
212
|
|
213
213
|
# Check transactions where the .memo field is nil or of type MemoType.memo_none
|
214
|
-
if !tx.memo.nil? && tx.memo.type !=
|
214
|
+
if !tx.memo.nil? && tx.memo.type != Digitalbits::MemoType.memo_none
|
215
215
|
return
|
216
216
|
end
|
217
217
|
|
218
218
|
destinations = Set.new
|
219
|
-
ot =
|
219
|
+
ot = Digitalbits::OperationType
|
220
220
|
|
221
221
|
tx.operations.each_with_index do |op, idx|
|
222
222
|
destination = case op.body.type
|
@@ -230,12 +230,12 @@ module DigitalBits
|
|
230
230
|
next
|
231
231
|
end
|
232
232
|
|
233
|
-
if destinations.include?(destination) || destination.switch ==
|
233
|
+
if destinations.include?(destination) || destination.switch == Digitalbits::CryptoKeyType.key_type_muxed_ed25519
|
234
234
|
next
|
235
235
|
end
|
236
236
|
|
237
237
|
destinations.add(destination)
|
238
|
-
kp =
|
238
|
+
kp = Digitalbits::KeyPair.from_public_key(destination.value)
|
239
239
|
|
240
240
|
begin
|
241
241
|
info = account_info(kp.address)
|
@@ -250,47 +250,47 @@ module DigitalBits
|
|
250
250
|
end
|
251
251
|
end
|
252
252
|
|
253
|
-
# DEPRECATED: this function has been moved
|
253
|
+
# DEPRECATED: this function has been moved Digitalbits::SEP10.build_challenge_tx and
|
254
254
|
# will be removed in the next major version release.
|
255
255
|
#
|
256
|
-
# A wrapper function for
|
256
|
+
# A wrapper function for Digitalbits::SEP10::build_challenge_tx.
|
257
257
|
#
|
258
|
-
# @param server [
|
259
|
-
# @param client [
|
258
|
+
# @param server [Digitalbits::KeyPair] Keypair for server's signing account.
|
259
|
+
# @param client [Digitalbits::KeyPair] Keypair for the account whishing to authenticate with the server.
|
260
260
|
# @param anchor_name [String] Anchor's name to be used in the manage_data key.
|
261
261
|
# @param timeout [Integer] Challenge duration (default to 5 minutes).
|
262
262
|
#
|
263
263
|
# @return [String] A base64 encoded string of the raw TransactionEnvelope xdr struct for the transaction.
|
264
264
|
def build_challenge_tx(server:, client:, anchor_name:, timeout: 300)
|
265
|
-
|
265
|
+
Digitalbits::SEP10.build_challenge_tx(
|
266
266
|
server: server, client: client, anchor_name: anchor_name, timeout: timeout
|
267
267
|
)
|
268
268
|
end
|
269
269
|
|
270
|
-
# DEPRECATED: this function has been moved to
|
270
|
+
# DEPRECATED: this function has been moved to Digitalbits::SEP10::read_challenge_tx and
|
271
271
|
# will be removed in the next major version release.
|
272
272
|
#
|
273
|
-
# A wrapper function for
|
273
|
+
# A wrapper function for Digitalbits::SEP10.verify_challenge_transaction
|
274
274
|
#
|
275
275
|
# @param challenge [String] SEP0010 transaction challenge in base64.
|
276
|
-
# @param server [
|
276
|
+
# @param server [Digitalbits::KeyPair] Digitalbits::KeyPair for server where the challenge was generated.
|
277
277
|
#
|
278
278
|
# @return [Boolean]
|
279
279
|
def verify_challenge_tx(challenge:, server:)
|
280
|
-
|
280
|
+
Digitalbits::SEP10.verify_challenge_tx(challenge_xdr: challenge, server: server)
|
281
281
|
true
|
282
282
|
end
|
283
283
|
|
284
|
-
# DEPRECATED: this function has been moved to
|
284
|
+
# DEPRECATED: this function has been moved to Digitalbits::SEP10::verify_tx_signed_by and
|
285
285
|
# will be removed in the next major version release.
|
286
286
|
#
|
287
|
-
# @param transaction_envelope [
|
288
|
-
# @param keypair [
|
287
|
+
# @param transaction_envelope [Digitalbits::TransactionEnvelope]
|
288
|
+
# @param keypair [Digitalbits::KeyPair]
|
289
289
|
#
|
290
290
|
# @return [Boolean]
|
291
291
|
#
|
292
292
|
def verify_tx_signed_by(transaction_envelope:, keypair:)
|
293
|
-
|
293
|
+
Digitalbits::SEP10.verify_tx_signed_by(
|
294
294
|
tx_envelope: transaction_envelope, keypair: keypair
|
295
295
|
)
|
296
296
|
end
|
data/lib/digitalbits/sep10.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
module
|
1
|
+
module Digitalbits
|
2
2
|
class InvalidSep10ChallengeError < StandardError; end
|
3
3
|
|
4
4
|
class SEP10
|
5
|
-
include
|
5
|
+
include Digitalbits::DSL
|
6
6
|
|
7
7
|
# Helper method to create a valid challenge transaction which you can use for DigitalBits Web Authentication.
|
8
8
|
#
|
9
9
|
# @example
|
10
|
-
# server =
|
11
|
-
# user =
|
12
|
-
#
|
10
|
+
# server = Digitalbits::KeyPair.random # SIGNING_KEY from your digitalbits.toml
|
11
|
+
# user = Digitalbits::KeyPair.from_address('G...')
|
12
|
+
# Digitalbits::SEP10.build_challenge_tx(server: server, client: user, domain: 'example.com', timeout: 300)
|
13
13
|
#
|
14
|
-
# @param server [
|
15
|
-
# @param client [
|
14
|
+
# @param server [Digitalbits::KeyPair] server's signing keypair (SIGNING_KEY in service's digitalbits.toml)
|
15
|
+
# @param client [Digitalbits::KeyPair] account trying to authenticate with the server
|
16
16
|
# @param domain [String] service's domain to be used in the manage_data key
|
17
17
|
# @param timeout [Integer] challenge duration (default to 5 minutes)
|
18
18
|
#
|
@@ -22,7 +22,7 @@ module DigitalBits
|
|
22
22
|
if domain.blank? && options.key?(:anchor_name)
|
23
23
|
ActiveSupport::Deprecation.new("next release", "digitalbits-sdk").warn <<~MSG
|
24
24
|
SEP-10 v2.0.0 requires usage of service home domain instead of anchor name in the challenge transaction.
|
25
|
-
Please update your implementation to use `
|
25
|
+
Please update your implementation to use `Digitalbits::SEP10.build_challenge_tx(..., home_domain: 'example.com')`.
|
26
26
|
Using `anchor_name` parameter makes your service incompatible with SEP10-2.0 clients, support for this parameter
|
27
27
|
is deprecated and will be removed in the next major release of digitalbits-base.
|
28
28
|
MSG
|
@@ -30,12 +30,12 @@ module DigitalBits
|
|
30
30
|
end
|
31
31
|
|
32
32
|
now = Time.now.to_i
|
33
|
-
time_bounds =
|
33
|
+
time_bounds = Digitalbits::TimeBounds.new(
|
34
34
|
min_time: now,
|
35
35
|
max_time: now + timeout
|
36
36
|
)
|
37
37
|
|
38
|
-
tb =
|
38
|
+
tb = Digitalbits::TransactionBuilder.new(
|
39
39
|
source_account: server,
|
40
40
|
sequence_number: 0,
|
41
41
|
time_bounds: time_bounds
|
@@ -45,7 +45,7 @@ module DigitalBits
|
|
45
45
|
# cryptographic-quality random string encoded using base64 (for a total of
|
46
46
|
# 64 bytes after encoding).
|
47
47
|
tb.add_operation(
|
48
|
-
|
48
|
+
Digitalbits::Operation.manage_data(
|
49
49
|
name: "#{domain} auth",
|
50
50
|
value: SecureRandom.base64(48),
|
51
51
|
source_account: client
|
@@ -54,7 +54,7 @@ module DigitalBits
|
|
54
54
|
|
55
55
|
if options.key?(:auth_domain)
|
56
56
|
tb.add_operation(
|
57
|
-
|
57
|
+
Digitalbits::Operation.manage_data(
|
58
58
|
name: "web_auth_domain",
|
59
59
|
value: options[:auth_domain],
|
60
60
|
source_account: server
|
@@ -75,17 +75,17 @@ module DigitalBits
|
|
75
75
|
# the signed challenge
|
76
76
|
#
|
77
77
|
# @example
|
78
|
-
# sep10 =
|
79
|
-
# server =
|
78
|
+
# sep10 = Digitalbits::SEP10
|
79
|
+
# server = Digitalbits::KeyPair.random # this should be the SIGNING_KEY from your digitalbits.toml
|
80
80
|
# challenge = sep10.build_challenge_tx(server: server, client: user, domain: domain, timeout: timeout)
|
81
81
|
# envelope, client_address = sep10.read_challenge_tx(server: server, challenge_xdr: challenge)
|
82
82
|
#
|
83
83
|
# @param challenge_xdr [String] SEP0010 transaction challenge in base64.
|
84
|
-
# @param server [
|
84
|
+
# @param server [Digitalbits::KeyPair] keypair for server where the challenge was generated.
|
85
85
|
#
|
86
|
-
# @return [Array(
|
86
|
+
# @return [Array(Digitalbits::TransactionEnvelope, String)]
|
87
87
|
def self.read_challenge_tx(server:, challenge_xdr:, **options)
|
88
|
-
envelope =
|
88
|
+
envelope = Digitalbits::TransactionEnvelope.from_xdr(challenge_xdr, "base64")
|
89
89
|
transaction = envelope.tx
|
90
90
|
|
91
91
|
if transaction.seq_num != 0
|
@@ -148,7 +148,7 @@ module DigitalBits
|
|
148
148
|
end
|
149
149
|
|
150
150
|
# Mirror the return type of the other SDK's and return a string
|
151
|
-
client_kp =
|
151
|
+
client_kp = Digitalbits::KeyPair.from_public_key(client_account_id.ed25519!)
|
152
152
|
|
153
153
|
[envelope, client_kp.address]
|
154
154
|
end
|
@@ -159,7 +159,7 @@ module DigitalBits
|
|
159
159
|
# signatures match a signer that has been provided as an argument, and those
|
160
160
|
# signatures meet a threshold on the account.
|
161
161
|
#
|
162
|
-
# @param server [
|
162
|
+
# @param server [Digitalbits::KeyPair] keypair for server's account.
|
163
163
|
# @param challenge_xdr [String] SEP0010 challenge transaction in base64.
|
164
164
|
# @param signers [{String => Integer}] The signers of client account.
|
165
165
|
# @param threshold [Integer] The medThreshold on the client account.
|
@@ -191,7 +191,7 @@ module DigitalBits
|
|
191
191
|
#
|
192
192
|
# If verification succeeds a list of signers that were found is returned, excluding the server account ID.
|
193
193
|
#
|
194
|
-
# @param server [
|
194
|
+
# @param server [Digitalbits::Keypair] server's signing key
|
195
195
|
# @param challenge_xdr [String] SEP0010 transaction challenge transaction in base64.
|
196
196
|
# @param signers [<String>] The signers of client account.
|
197
197
|
#
|
@@ -233,10 +233,10 @@ module DigitalBits
|
|
233
233
|
# Verifies every signer passed matches a signature on the transaction exactly once,
|
234
234
|
# returning a list of unique signers that were found to have signed the transaction.
|
235
235
|
#
|
236
|
-
# @param tx_envelope [
|
236
|
+
# @param tx_envelope [Digitalbits::TransactionEnvelope] SEP0010 transaction challenge transaction envelope.
|
237
237
|
# @param signers [<String>] The signers of client account.
|
238
238
|
#
|
239
|
-
# @return [Set<
|
239
|
+
# @return [Set<Digitalbits::KeyPair>]
|
240
240
|
def self.verify_tx_signatures(tx_envelope:, signers:)
|
241
241
|
signatures = tx_envelope.signatures
|
242
242
|
if signatures.empty?
|
@@ -244,7 +244,7 @@ module DigitalBits
|
|
244
244
|
end
|
245
245
|
|
246
246
|
tx_hash = tx_envelope.tx.hash
|
247
|
-
to_keypair =
|
247
|
+
to_keypair = Digitalbits::DSL.method(:KeyPair)
|
248
248
|
keys_by_hint = signers.map(&to_keypair).index_by(&:signature_hint)
|
249
249
|
|
250
250
|
tx_envelope.signatures.each.with_object(Set.new) do |sig, result|
|
@@ -253,13 +253,13 @@ module DigitalBits
|
|
253
253
|
end
|
254
254
|
end
|
255
255
|
|
256
|
-
# Verifies if a
|
256
|
+
# Verifies if a Digitalbits::TransactionEnvelope was signed by the given Digitalbits::KeyPair
|
257
257
|
#
|
258
258
|
# @example
|
259
|
-
#
|
259
|
+
# Digitalbits::SEP10.verify_tx_signed_by(tx_envelope: envelope, keypair: keypair)
|
260
260
|
#
|
261
|
-
# @param tx_envelope [
|
262
|
-
# @param keypair [
|
261
|
+
# @param tx_envelope [Digitalbits::TransactionEnvelope]
|
262
|
+
# @param keypair [Digitalbits::KeyPair]
|
263
263
|
#
|
264
264
|
# @return [Boolean]
|
265
265
|
def self.verify_tx_signed_by(tx_envelope:, keypair:)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Digitalbits
|
2
2
|
class TransactionPage
|
3
3
|
include Enumerable
|
4
4
|
|
@@ -13,7 +13,7 @@ module DigitalBits
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
# @return [
|
16
|
+
# @return [Digitalbits::TransactionPage]
|
17
17
|
def next_page
|
18
18
|
self.class.new(@resource.next)
|
19
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: digitalbits-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.27.
|
4
|
+
version: 0.27.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- XDB Foundation
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: digitalbits-base
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.27.
|
19
|
+
version: 0.27.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.27.
|
26
|
+
version: 0.27.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,11 +168,11 @@ licenses:
|
|
168
168
|
- Apache-2.0
|
169
169
|
metadata:
|
170
170
|
bug_tracker_uri: https://github.com/xdbfoundation/ruby-digitalbits-sdk/issues
|
171
|
-
changelog_uri: https://github.com/xdbfoundation/ruby-digitalbits-sdk/blob/v0.27.
|
172
|
-
documentation_uri: https://rubydoc.info/gems/digitalbits-sdk/0.27.
|
171
|
+
changelog_uri: https://github.com/xdbfoundation/ruby-digitalbits-sdk/blob/v0.27.2/sdk/CHANGELOG.md
|
172
|
+
documentation_uri: https://rubydoc.info/gems/digitalbits-sdk/0.27.2/
|
173
173
|
github_repo: ssh://github.com/xdbfoundation/ruby-digitalbits-sdk
|
174
174
|
homepage_uri: https://github.com/xdbfoundation/ruby-digitalbits-sdk/tree/main/sdk
|
175
|
-
source_code_uri: https://github.com/xdbfoundation/ruby-digitalbits-sdk/tree/v0.27.
|
175
|
+
source_code_uri: https://github.com/xdbfoundation/ruby-digitalbits-sdk/tree/v0.27.2/sdk
|
176
176
|
post_install_message:
|
177
177
|
rdoc_options: []
|
178
178
|
require_paths:
|
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
188
|
- !ruby/object:Gem::Version
|
189
189
|
version: '0'
|
190
190
|
requirements: []
|
191
|
-
rubygems_version: 3.
|
191
|
+
rubygems_version: 3.2.22
|
192
192
|
signing_key:
|
193
193
|
specification_version: 4
|
194
194
|
summary: DigitalBits client library
|