sequence-sdk 1.1.0 → 1.2.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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/sequence/action.rb +18 -2
- data/lib/sequence/asset.rb +1 -0
- data/lib/sequence/client.rb +6 -0
- data/lib/sequence/contract.rb +1 -1
- data/lib/sequence/errors.rb +22 -8
- data/lib/sequence/flavor.rb +108 -0
- data/lib/sequence/http_wrapper.rb +6 -0
- data/lib/sequence/session.rb +3 -5
- data/lib/sequence/transaction.rb +64 -32
- data/lib/sequence/version.rb +1 -1
- metadata +4 -127
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b66d906a04f01900203dc177533f0553b9a50c8
|
4
|
+
data.tar.gz: 71e07a3fd57e6ef1139883bfa2028dc1ffe983af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8e2b3b1d2203f6dec039726340dcb4eb6e36b4625923ac1f861e8a00b1bcc972979dab084a6266b118e4ad5d6fcec47b12aa9c1339dd3413c52d6ef0b6fadd8
|
7
|
+
data.tar.gz: 7ff33dc5a42c4be3e5552071095f458082ccdeaf3c5fda1765301e3c5cbf362b566b5b7a60f62fc57d2f8489bb876ad0935930a95da7983aac86f4b894e75075
|
data/README.md
CHANGED
data/lib/sequence/action.rb
CHANGED
@@ -39,17 +39,31 @@ module Sequence
|
|
39
39
|
# @return [Time]
|
40
40
|
attrib :timestamp, rfc3339_time: true
|
41
41
|
|
42
|
+
# @!attribute [r] flavor_id
|
43
|
+
# The ID of the flavor held by the action.
|
44
|
+
# @return [String]
|
45
|
+
attrib :flavor_id
|
46
|
+
|
47
|
+
# @!attribute [r] snapshot
|
48
|
+
# A copy of the associated tags (flavor, source account, and destination
|
49
|
+
# account) as they existed at the time of the transaction.
|
50
|
+
# @return [Hash]
|
51
|
+
attrib :snapshot
|
52
|
+
|
42
53
|
# @!attribute [r] asset_id
|
54
|
+
# Deprecated. Use {#flavor_id} instead.
|
43
55
|
# The ID of the asset held by the action.
|
44
56
|
# @return [String]
|
45
57
|
attrib :asset_id
|
46
58
|
|
47
59
|
# @!attribute [r] asset_alias
|
60
|
+
# Deprecated. Use {#flavor_id} instead.
|
48
61
|
# The alias of the asset held by the action.
|
49
62
|
# @return [String]
|
50
63
|
attrib :asset_alias
|
51
64
|
|
52
65
|
# @!attribute [r] asset_tags
|
66
|
+
# Deprecated. Use {#snapshot} instead.
|
53
67
|
# The tags of the asset held by the action.
|
54
68
|
# @return [Hash]
|
55
69
|
attrib :asset_tags
|
@@ -60,12 +74,13 @@ module Sequence
|
|
60
74
|
attrib :source_account_id
|
61
75
|
|
62
76
|
# @!attribute [r] source_account_alias
|
63
|
-
# Deprecated. Use {#source_account_id} instead
|
77
|
+
# Deprecated. Use {#source_account_id} instead.
|
64
78
|
# The alias of the source account executing the action.
|
65
79
|
# @return [String]
|
66
80
|
attrib :source_account_alias
|
67
81
|
|
68
82
|
# @!attribute [r] source_account_tags
|
83
|
+
# Deprecated. Use {#snapshot} instead.
|
69
84
|
# The tags of the source account executing the action.
|
70
85
|
# @return [Hash]
|
71
86
|
attrib :source_account_tags
|
@@ -76,12 +91,13 @@ module Sequence
|
|
76
91
|
attrib :destination_account_id
|
77
92
|
|
78
93
|
# @!attribute [r] destination_account_alias
|
79
|
-
# Deprecated. Use {#destination_account_id} instead
|
94
|
+
# Deprecated. Use {#destination_account_id} instead.
|
80
95
|
# The alias of the destination account affected by the action.
|
81
96
|
# @return [String]
|
82
97
|
attrib :destination_account_alias
|
83
98
|
|
84
99
|
# @!attribute [r] destination_account_tags
|
100
|
+
# Deprecated. Use {#snapshot} instead.
|
85
101
|
# The tags of the destination account affected by the action.
|
86
102
|
# @return [Hash]
|
87
103
|
attrib :destination_account_tags
|
data/lib/sequence/asset.rb
CHANGED
data/lib/sequence/client.rb
CHANGED
@@ -4,6 +4,7 @@ require_relative './asset'
|
|
4
4
|
require_relative './balance'
|
5
5
|
require_relative './contract'
|
6
6
|
require_relative './dev_utils'
|
7
|
+
require_relative './flavor'
|
7
8
|
require_relative './key'
|
8
9
|
require_relative './stats'
|
9
10
|
require_relative './transaction'
|
@@ -55,6 +56,11 @@ module Sequence
|
|
55
56
|
@assets ||= Asset::ClientModule.new(self)
|
56
57
|
end
|
57
58
|
|
59
|
+
# @return [Flavor::ClientModule]
|
60
|
+
def flavors
|
61
|
+
@flavors ||= Flavor::ClientModule.new(self)
|
62
|
+
end
|
63
|
+
|
58
64
|
# @return [Action::ClientModule]
|
59
65
|
def actions
|
60
66
|
@actions ||= Action::ClientModule.new(self)
|
data/lib/sequence/contract.rb
CHANGED
@@ -46,7 +46,7 @@ module Sequence
|
|
46
46
|
attrib :account_id
|
47
47
|
|
48
48
|
# @!attribute [r] account_alias
|
49
|
-
# Deprecated. Use {#account_id} instead
|
49
|
+
# Deprecated. Use {#account_id} instead.
|
50
50
|
# The alias of the account controlling the contract.
|
51
51
|
# @return [String]
|
52
52
|
attrib :account_alias
|
data/lib/sequence/errors.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
module Sequence
|
2
|
-
|
3
2
|
# Base class for all errors raised by the Sequence SDK.
|
4
3
|
class BaseError < StandardError; end
|
5
4
|
|
@@ -36,37 +35,53 @@ module Sequence
|
|
36
35
|
class APIError < BaseError
|
37
36
|
attr_accessor(
|
38
37
|
:chain_message,
|
39
|
-
:code,
|
40
38
|
:data,
|
41
39
|
:detail,
|
42
40
|
:request_id,
|
43
41
|
:response,
|
44
42
|
:retriable,
|
43
|
+
:seq_code,
|
45
44
|
:temporary,
|
46
45
|
)
|
46
|
+
# Use {#seq_code} instead.
|
47
|
+
# @deprecated
|
48
|
+
attr_accessor :code
|
47
49
|
|
48
50
|
def initialize(body, response)
|
49
51
|
self.code = body['code']
|
50
52
|
self.chain_message = body['message']
|
51
53
|
self.detail = body['detail']
|
52
54
|
self.retriable = body['retriable']
|
55
|
+
self.seq_code = body['seq_code']
|
53
56
|
self.temporary = body['retriable']
|
54
57
|
|
55
58
|
self.response = response
|
56
59
|
self.request_id = response['Chain-Request-ID'] if response
|
57
60
|
|
58
|
-
super
|
61
|
+
super(
|
62
|
+
self.class.format_error_message(
|
63
|
+
seq_code,
|
64
|
+
chain_message,
|
65
|
+
detail,
|
66
|
+
request_id,
|
67
|
+
)
|
68
|
+
)
|
59
69
|
end
|
60
70
|
|
61
71
|
def retriable?
|
62
|
-
|
72
|
+
retriable
|
63
73
|
end
|
64
74
|
|
65
|
-
|
75
|
+
# @private
|
76
|
+
def self.format_error_message(seq_code, message, detail, request_id)
|
66
77
|
tokens = []
|
67
|
-
|
78
|
+
if seq_code.is_a?(String) && !seq_code.empty?
|
79
|
+
tokens << "Code: #{seq_code}"
|
80
|
+
end
|
68
81
|
tokens << "Message: #{message}"
|
69
|
-
|
82
|
+
if detail.is_a?(String) && !detail.empty?
|
83
|
+
tokens << "Detail: #{detail}"
|
84
|
+
end
|
70
85
|
tokens << "Request-ID: #{request_id}"
|
71
86
|
tokens.join(' ')
|
72
87
|
end
|
@@ -76,5 +91,4 @@ module Sequence
|
|
76
91
|
# response status code is 401. This is a common error case, so a discrete
|
77
92
|
# exception type is provided for convenience.
|
78
93
|
class UnauthorizedError < APIError; end
|
79
|
-
|
80
94
|
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
3
|
+
require_relative './client_module'
|
4
|
+
require_relative './errors'
|
5
|
+
require_relative './query'
|
6
|
+
require_relative './response_object'
|
7
|
+
|
8
|
+
module Sequence
|
9
|
+
# A type or class of value that can be tracked on a ledger.
|
10
|
+
class Flavor < ResponseObject
|
11
|
+
# @!attribute [r] id
|
12
|
+
# Unique, auto-generated identifier.
|
13
|
+
# @return [String]
|
14
|
+
attrib :id
|
15
|
+
|
16
|
+
# @!attribute [r] keys
|
17
|
+
# The set of keys used to sign transactions that issue tokens of the
|
18
|
+
# flavor.
|
19
|
+
# @return [Array<Key>]
|
20
|
+
attrib(:keys) { |raw| raw.map { |k| Key.new(k) } }
|
21
|
+
|
22
|
+
# @!attribute [r] quorum
|
23
|
+
# The number of keys required to sign transactions that issue tokens of
|
24
|
+
# the flavor.
|
25
|
+
# @return [Integer]
|
26
|
+
attrib :quorum
|
27
|
+
|
28
|
+
# @!attribute [r] tags
|
29
|
+
# User-specified key-value data describing the flavor.
|
30
|
+
# @return [Hash]
|
31
|
+
attrib :tags
|
32
|
+
|
33
|
+
class Key < ResponseObject
|
34
|
+
attrib :id
|
35
|
+
end
|
36
|
+
|
37
|
+
class ClientModule < Sequence::ClientModule
|
38
|
+
# Creates a new flavor in the ledger.
|
39
|
+
# @param [Hash] opts
|
40
|
+
# Options hash
|
41
|
+
# @option opts [String] id
|
42
|
+
# Unique, user-specified identifier.
|
43
|
+
# @option opts [Array<Hash>, Array<Sequence::Key>] keys
|
44
|
+
# The set of keys used for signing transactions that issue tokens of the
|
45
|
+
# flavor. A key can be either a key object, or a hash containing an
|
46
|
+
# `id` field.
|
47
|
+
# @option opts [Integer] quorum
|
48
|
+
# The number of keys required to sign transactions that issue tokens of
|
49
|
+
# the flavor. Defaults to the number of keys provided.
|
50
|
+
# @option opts [Hash] tags
|
51
|
+
# User-specified key-value data describing the flavor.
|
52
|
+
# @return [Flavor]
|
53
|
+
def create(opts = {})
|
54
|
+
validate_inclusion_of!(opts, :id, :keys, :quorum, :tags)
|
55
|
+
if opts[:keys].nil? || opts[:keys].empty?
|
56
|
+
raise ArgumentError, ':keys must be provided'
|
57
|
+
end
|
58
|
+
opts = { client_token: SecureRandom.uuid }.merge(opts)
|
59
|
+
Flavor.new(client.session.request('create-flavor', opts))
|
60
|
+
end
|
61
|
+
|
62
|
+
# Updates a flavor's tags.
|
63
|
+
# @param [Hash] opts
|
64
|
+
# Options hash
|
65
|
+
# @option opts [String] id
|
66
|
+
# The ID of the flavor.
|
67
|
+
# @option opts [Hash] tags
|
68
|
+
# A new set of tags, which will replace the existing tags.
|
69
|
+
# @return [void]
|
70
|
+
def update_tags(opts = {})
|
71
|
+
validate_inclusion_of!(opts, :id, :tags)
|
72
|
+
if (opts[:id].nil? || opts[:id].empty?)
|
73
|
+
raise ArgumentError, ':id must be provided'
|
74
|
+
end
|
75
|
+
client.session.request('update-flavor-tags', opts)
|
76
|
+
end
|
77
|
+
|
78
|
+
# Executes a query, returning an enumerable over individual flavors.
|
79
|
+
# @param [Hash] opts
|
80
|
+
# Options hash
|
81
|
+
# @option opts [String] filter
|
82
|
+
# A filter expression.
|
83
|
+
# @option opts [Array<String|Integer>] filter_params
|
84
|
+
# A list of values that will be interpolated into the filter expression.
|
85
|
+
# @return [Query]
|
86
|
+
def list(opts = {})
|
87
|
+
validate_inclusion_of!(
|
88
|
+
opts,
|
89
|
+
:filter,
|
90
|
+
:filter_params,
|
91
|
+
:page_size,
|
92
|
+
:after,
|
93
|
+
)
|
94
|
+
Query.new(client, opts)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
class Query < Sequence::Query
|
99
|
+
def fetch(query)
|
100
|
+
client.session.request('list-flavors', query)
|
101
|
+
end
|
102
|
+
|
103
|
+
def translate(raw)
|
104
|
+
Flavor.new(raw)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -116,6 +116,12 @@ module Sequence
|
|
116
116
|
def setup_connection
|
117
117
|
args = [@host.hostname, @host.port]
|
118
118
|
|
119
|
+
# Override host+port for local development.
|
120
|
+
env_addr = ENV['SEQADDR']
|
121
|
+
if env_addr
|
122
|
+
args = (env_addr.split(':') + [nil])[0...2]
|
123
|
+
end
|
124
|
+
|
119
125
|
# Proxy configuration
|
120
126
|
if @opts.key?(:proxy_addr)
|
121
127
|
args += [@opts[:proxy_addr], @opts[:proxy_port]]
|
data/lib/sequence/session.rb
CHANGED
@@ -13,7 +13,6 @@ module Sequence
|
|
13
13
|
@session_host = @opts[:session_host] || 'https://session-api.seq.com'
|
14
14
|
@ledger = @opts[:ledger_name] || raise(ArgumentError, "missing ledger_name")
|
15
15
|
@macaroon = @opts[:credential] || raise(ArgumentError, "missing credential")
|
16
|
-
@request_id = @opts[:request_id]
|
17
16
|
|
18
17
|
# Start at 0 to trigger an immediate refresh
|
19
18
|
@refresh_at = 0
|
@@ -37,13 +36,12 @@ module Sequence
|
|
37
36
|
@ledger_api = HttpWrapper.new(@host, @macaroon, @opts)
|
38
37
|
end
|
39
38
|
|
40
|
-
|
41
|
-
|
42
|
-
@opts.dup
|
39
|
+
def dup
|
40
|
+
Sequence::Session.new(@opts)
|
43
41
|
end
|
44
42
|
|
45
43
|
def request(path, body = {})
|
46
|
-
request_full_resp(
|
44
|
+
request_full_resp(nil, path, body)[:parsed_body]
|
47
45
|
end
|
48
46
|
|
49
47
|
def request_full_resp(id, path, body = {})
|
data/lib/sequence/transaction.rb
CHANGED
@@ -7,8 +7,8 @@ require_relative './validations'
|
|
7
7
|
|
8
8
|
module Sequence
|
9
9
|
# A transaction is an atomic update to the state of the ledger. Transactions
|
10
|
-
# can issue new
|
11
|
-
# another, and/or the retire
|
10
|
+
# can issue new flavor units, transfer of flavor units from one account to
|
11
|
+
# another, and/or the retire flavor units from an account.
|
12
12
|
class Transaction < ResponseObject
|
13
13
|
# @!attribute [r] id
|
14
14
|
# A unique ID.
|
@@ -101,60 +101,77 @@ module Sequence
|
|
101
101
|
# @return [String]
|
102
102
|
attrib :type
|
103
103
|
|
104
|
+
# @!attribute [r] flavor_id
|
105
|
+
# The id of the action's flavor.
|
106
|
+
# @return [String]
|
107
|
+
attrib :flavor_id
|
108
|
+
|
109
|
+
# @!attribute [r] snapshot
|
110
|
+
# A copy of the associated tags (flavor, source account, and destination
|
111
|
+
# account) as they existed at the time of the transaction.
|
112
|
+
# @return [Hash]
|
113
|
+
attrib :snapshot
|
114
|
+
|
104
115
|
# @!attribute [r] asset_id
|
116
|
+
# Deprecated. Use {#flavor_id} instead.
|
105
117
|
# The id of the action's asset.
|
106
118
|
# @return [String]
|
107
119
|
attrib :asset_id
|
108
120
|
|
109
121
|
# @!attribute [r] asset_alias
|
122
|
+
# Deprecated. Use {#flavor_id} instead.
|
110
123
|
# The alias of the action's asset.
|
111
124
|
# @return [String]
|
112
125
|
attrib :asset_alias
|
113
126
|
|
114
127
|
# @!attribute [r] asset_tags
|
128
|
+
# Deprecated. Use {#snapshot} instead.
|
115
129
|
# The tags of the action's asset.
|
116
130
|
# @return [Hash]
|
117
131
|
attrib :asset_tags
|
118
132
|
|
119
133
|
# @!attribute [r] amount
|
120
|
-
# The number of
|
134
|
+
# The number of flavor units issued, transferred, or retired.
|
121
135
|
# @return [Integer]
|
122
136
|
attrib :amount
|
123
137
|
|
124
138
|
# @!attribute [r] source_account_id
|
125
|
-
# The ID of the account serving as the source of
|
139
|
+
# The ID of the account serving as the source of flavor units. Null for
|
126
140
|
# issuances.
|
127
141
|
# @return [String]
|
128
142
|
attrib :source_account_id
|
129
143
|
|
130
144
|
# @!attribute [r] source_account_alias
|
131
|
-
# Deprecated. Use {#source_account_id} instead
|
132
|
-
# The alias of the account serving as the source of asset units.
|
133
|
-
# for issuances.
|
145
|
+
# Deprecated. Use {#source_account_id} instead.
|
146
|
+
# The alias of the account serving as the source of asset units.
|
147
|
+
# Null for issuances.
|
134
148
|
# @return [String]
|
135
149
|
attrib :source_account_alias
|
136
150
|
|
137
151
|
# @!attribute [r] source_account_tags
|
138
|
-
#
|
139
|
-
#
|
152
|
+
# Deprecated. Use {#snapshot} instead.
|
153
|
+
# The tags of the account serving as the source of flavor units.
|
154
|
+
# Null for issuances.
|
140
155
|
# @return [String]
|
141
156
|
attrib :source_account_tags
|
142
157
|
|
143
158
|
# @!attribute [r] destination_account_id
|
144
|
-
# The ID of the account receiving the
|
159
|
+
# The ID of the account receiving the flavor units.
|
160
|
+
# Null for retirements.
|
145
161
|
# @return [String]
|
146
162
|
attrib :destination_account_id
|
147
163
|
|
148
164
|
# @!attribute [r] destination_account_alias
|
149
|
-
# Deprecated. Use {#destination_account_id} instead
|
165
|
+
# Deprecated. Use {#destination_account_id} instead.
|
150
166
|
# The alias of the account receiving the asset units. Null for
|
151
167
|
# retirements.
|
152
168
|
# @return [String]
|
153
169
|
attrib :destination_account_alias
|
154
170
|
|
155
171
|
# @!attribute [r] destination_account_tags
|
156
|
-
#
|
157
|
-
#
|
172
|
+
# Deprecated. Use {#snapshot} instead.
|
173
|
+
# The tags of the account receiving the flavor units.
|
174
|
+
# Null for retirements.
|
158
175
|
# @return [String]
|
159
176
|
attrib :destination_account_tags
|
160
177
|
|
@@ -201,23 +218,27 @@ module Sequence
|
|
201
218
|
self
|
202
219
|
end
|
203
220
|
|
204
|
-
# Issues new units of
|
221
|
+
# Issues new units of a flavor to a destination account.
|
205
222
|
#
|
206
223
|
# @param [Hash] opts
|
207
224
|
# Options hash
|
208
225
|
# @option opts [Integer] :amount
|
209
|
-
# Amount of the
|
226
|
+
# Amount of the flavor to be issued.
|
227
|
+
# @option opts [String] :flavor_id
|
228
|
+
# ID of the flavor to be issued.
|
210
229
|
# @option opts [String] :asset_id
|
230
|
+
# Deprecated. Use :flavor_id instead.
|
211
231
|
# ID of the asset to be issued. You must specify either an ID or an
|
212
232
|
# alias.
|
213
233
|
# @option opts [String] :asset_alias
|
234
|
+
# Deprecated. Use :flavor_id instead.
|
214
235
|
# Asset alias of the asset to be issued. You must specify either an ID
|
215
236
|
# or an alias.
|
216
237
|
# @option opts [String] :destination_account_id
|
217
|
-
# ID of the account receiving the
|
238
|
+
# ID of the account receiving the flavor units. You must specify a
|
218
239
|
# destination account ID or alias.
|
219
240
|
# @option opts [String] :destination_account_alias
|
220
|
-
# Deprecated. Use :destination_account_id instead
|
241
|
+
# Deprecated. Use :destination_account_id instead.
|
221
242
|
# Alias of the account receiving the asset units. You must specify a
|
222
243
|
# destination account ID or alias.
|
223
244
|
# @option opts [Hash] :reference_data
|
@@ -227,13 +248,14 @@ module Sequence
|
|
227
248
|
validate_inclusion_of!(
|
228
249
|
opts,
|
229
250
|
:amount,
|
251
|
+
:flavor_id,
|
230
252
|
:asset_id,
|
231
253
|
:asset_alias,
|
232
254
|
:destination_account_id,
|
233
255
|
:destination_account_alias,
|
234
256
|
:reference_data,
|
235
257
|
)
|
236
|
-
validate_either!(opts, :asset_id, :asset_alias)
|
258
|
+
validate_either!(opts, :flavor_id, :asset_id, :asset_alias)
|
237
259
|
validate_either!(
|
238
260
|
opts,
|
239
261
|
:destination_account_id,
|
@@ -242,34 +264,38 @@ module Sequence
|
|
242
264
|
add_action(opts.merge(type: :issue))
|
243
265
|
end
|
244
266
|
|
245
|
-
# Moves units of
|
267
|
+
# Moves units of a flavor from a source (an account or contract) to a
|
246
268
|
# destination account.
|
247
269
|
#
|
248
270
|
# @param [Hash] opts
|
249
271
|
# Options hash
|
250
272
|
# @option opts [Integer] :amount
|
251
|
-
# Amount of the
|
273
|
+
# Amount of the flavor to be transferred.
|
274
|
+
# @option opts [String] :flavor_id
|
275
|
+
# ID of the flavor to be transferred.
|
252
276
|
# @option opts [String] :asset_id
|
277
|
+
# Deprecated. Use :flavor_id instead.
|
253
278
|
# ID of the asset to be transferred. You must specify either an ID or an
|
254
279
|
# alias.
|
255
280
|
# @option opts [String] :asset_alias
|
281
|
+
# Deprecated. Use :flavor_id instead.
|
256
282
|
# Asset alias of the asset to be transferred. You must specify either an
|
257
283
|
# ID or an alias.
|
258
284
|
# @option opts [String] :source_account_id
|
259
|
-
# ID of the account serving as the source of
|
285
|
+
# ID of the account serving as the source of flavor units. You must
|
260
286
|
# specify a source account ID, account alias, or contract ID.
|
261
287
|
# @option opts [String] :source_account_alias
|
262
|
-
# Deprecated. Use :source_account_id instead
|
288
|
+
# Deprecated. Use :source_account_id instead.
|
263
289
|
# Alias of the account serving as the source of asset units You must
|
264
290
|
# specify a source account ID, account alias, or contract ID.
|
265
291
|
# @option opts [String] :source_contract_id
|
266
|
-
# ID of the contract serving as the source of
|
292
|
+
# ID of the contract serving as the source of flavor units. You must
|
267
293
|
# specify a source account ID, account alias, or contract ID.
|
268
294
|
# @option opts [String] :destination_account_id
|
269
|
-
# ID of the account receiving the
|
295
|
+
# ID of the account receiving the flavor units. You must specify a
|
270
296
|
# destination account ID or alias.
|
271
297
|
# @option opts [String] :destination_account_alias
|
272
|
-
# Deprecated. Use :destination_account_id instead
|
298
|
+
# Deprecated. Use :destination_account_id instead.
|
273
299
|
# Alias of the account receiving the asset units. You must specify a
|
274
300
|
# destination account ID or alias.
|
275
301
|
# @option opts [Hash] :reference_data
|
@@ -281,6 +307,7 @@ module Sequence
|
|
281
307
|
validate_inclusion_of!(
|
282
308
|
opts,
|
283
309
|
:amount,
|
310
|
+
:flavor_id,
|
284
311
|
:asset_id,
|
285
312
|
:asset_alias,
|
286
313
|
:source_account_id,
|
@@ -291,7 +318,7 @@ module Sequence
|
|
291
318
|
:reference_data,
|
292
319
|
:change_reference_data,
|
293
320
|
)
|
294
|
-
validate_either!(opts, :asset_id, :asset_alias)
|
321
|
+
validate_either!(opts, :flavor_id, :asset_id, :asset_alias)
|
295
322
|
validate_either!(
|
296
323
|
opts,
|
297
324
|
:source_account_id,
|
@@ -306,27 +333,31 @@ module Sequence
|
|
306
333
|
add_action(opts.merge(type: :transfer))
|
307
334
|
end
|
308
335
|
|
309
|
-
# Takes units of
|
336
|
+
# Takes units of a flavor from a source (an account or contract) and
|
310
337
|
# retires them.
|
311
338
|
#
|
312
339
|
# @param [Hash] opts Options hash
|
313
340
|
# @option opts [Integer] :amount
|
314
|
-
# Amount of the
|
341
|
+
# Amount of the flavor to be retired.
|
342
|
+
# @option opts [String] :flavor_id
|
343
|
+
# ID of the flavor to be retired.
|
315
344
|
# @option opts [String] :asset_id
|
345
|
+
# Deprecated. Use :flavor_id instead.
|
316
346
|
# ID of the asset to be retired. You must specify either an ID or an
|
317
347
|
# alias.
|
318
348
|
# @option opts [String] :asset_alias
|
349
|
+
# Deprecated. Use :flavor_id instead.
|
319
350
|
# Asset alias of the asset to be retired. You must specify either an ID
|
320
351
|
# or an alias.
|
321
352
|
# @option opts [String] :source_account_id
|
322
|
-
# ID of the account serving as the source of
|
353
|
+
# ID of the account serving as the source of flavor units. You must
|
323
354
|
# specify a source account ID, account alias, or contract ID.
|
324
355
|
# @option opts [String] :source_account_alias
|
325
|
-
# Deprecated. Use :source_account_id instead
|
356
|
+
# Deprecated. Use :source_account_id instead.
|
326
357
|
# Alias of the account serving as the source of asset units You must
|
327
358
|
# specify a source account ID, account alias, or contract ID.
|
328
359
|
# @option opts [String] :source_contract_id
|
329
|
-
# ID of the contract serving as the source of
|
360
|
+
# ID of the contract serving as the source of flavor units. You must
|
330
361
|
# specify a source account ID, account alias, or contract ID.
|
331
362
|
# @option opts [Hash] :reference_data
|
332
363
|
# Reference data for the action.
|
@@ -337,6 +368,7 @@ module Sequence
|
|
337
368
|
validate_inclusion_of!(
|
338
369
|
opts,
|
339
370
|
:amount,
|
371
|
+
:flavor_id,
|
340
372
|
:asset_id,
|
341
373
|
:asset_alias,
|
342
374
|
:source_account_id,
|
@@ -345,7 +377,7 @@ module Sequence
|
|
345
377
|
:reference_data,
|
346
378
|
:change_reference_data,
|
347
379
|
)
|
348
|
-
validate_either!(opts, :asset_id, :asset_alias)
|
380
|
+
validate_either!(opts, :flavor_id, :asset_id, :asset_alias)
|
349
381
|
validate_either!(
|
350
382
|
opts,
|
351
383
|
:source_account_id,
|
data/lib/sequence/version.rb
CHANGED
metadata
CHANGED
@@ -1,139 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequence-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chain Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler-audit
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 3.5.0
|
62
|
-
- - ">="
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: 3.5.0
|
65
|
-
type: :development
|
66
|
-
prerelease: false
|
67
|
-
version_requirements: !ruby/object:Gem::Requirement
|
68
|
-
requirements:
|
69
|
-
- - "~>"
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: 3.5.0
|
72
|
-
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: 3.5.0
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: rspec-its
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - "~>"
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: 1.2.0
|
82
|
-
type: :development
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - "~>"
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: 1.2.0
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: simplecov
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - "~>"
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: 0.14.1
|
96
|
-
type: :development
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: 0.14.1
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: webmock
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - "~>"
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: 2.3.2
|
110
|
-
type: :development
|
111
|
-
prerelease: false
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - "~>"
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: 2.3.2
|
117
|
-
- !ruby/object:Gem::Dependency
|
118
|
-
name: yard
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - "~>"
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: 0.9.5
|
124
|
-
- - ">="
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
version: 0.9.5
|
127
|
-
type: :development
|
128
|
-
prerelease: false
|
129
|
-
version_requirements: !ruby/object:Gem::Requirement
|
130
|
-
requirements:
|
131
|
-
- - "~>"
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: 0.9.5
|
134
|
-
- - ">="
|
135
|
-
- !ruby/object:Gem::Version
|
136
|
-
version: 0.9.5
|
11
|
+
date: 2018-02-16 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
137
13
|
description: SDK for Sequence
|
138
14
|
email:
|
139
15
|
executables: []
|
@@ -152,6 +28,7 @@ files:
|
|
152
28
|
- lib/sequence/contract.rb
|
153
29
|
- lib/sequence/dev_utils.rb
|
154
30
|
- lib/sequence/errors.rb
|
31
|
+
- lib/sequence/flavor.rb
|
155
32
|
- lib/sequence/http_wrapper.rb
|
156
33
|
- lib/sequence/key.rb
|
157
34
|
- lib/sequence/page.rb
|