sequence-sdk 1.3 → 1.4

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
- SHA256:
3
- metadata.gz: e09d4689bbc276d717124a3bc897d1a39fb8d2615f42e6ef5b034dd83baa2b9c
4
- data.tar.gz: 2c045c5197ca3fadf832f94db50bdfd5d7644f403c1c6c02d048b01570c30033
2
+ SHA1:
3
+ metadata.gz: 9f876e454e9a1781b6b5ebf738c7b97e2b4da6f8
4
+ data.tar.gz: 886c73ca409af3fc64269b7869d4377ce025bde1
5
5
  SHA512:
6
- metadata.gz: 787a26b9b6d8a199ba3a22e665a3ef670bcf35427c36b83289b0406a07db2aa494847b558f5800dd4941879d51aaba15d91289902e511314c7a782be2d3cf143
7
- data.tar.gz: 9e54a051eff305522130abf1073720ce3b0dedf1e4def79d0a4435fddab759c9ac60429948ac4db486b253f1dd83c81bc3767fe07b8e5ffb6fb97b291030cb8b
6
+ metadata.gz: 3c31298680b651c54817de68c6ed604d64a48533501455c2bf19253b404def1fc5b4f51f8fc078972d21174a276aa5bb06aa97eeb6f975ee78e7dd5cf39864d9
7
+ data.tar.gz: 45e25719018b05da0c5dced226113c547f0b54952e17e083eadf132fbda80f0abfca65e61c7cb48afda9e15635975da2fc06f5e53b9cd4378a030a4ec820dfcd
data/README.md CHANGED
@@ -14,7 +14,7 @@ for the language's schedule for security and bug fixes.
14
14
  Add the following to your `Gemfile`:
15
15
 
16
16
  ```ruby
17
- gem 'sequence-sdk', '~> 1.3.0'
17
+ gem 'sequence-sdk', '~> 1.4.0'
18
18
  ```
19
19
 
20
20
  ### In your code
@@ -86,6 +86,7 @@ module Sequence
86
86
  client.session.request('update-account-tags', opts)
87
87
  end
88
88
 
89
+ # @deprecated Use list instead.
89
90
  # Executes a query, returning an enumerable over individual accounts.
90
91
  # @param [Hash] opts
91
92
  # Options hash
@@ -49,7 +49,7 @@ module Sequence
49
49
  # account, action, and token) as they existed at the time of the
50
50
  # transaction.
51
51
  # @return [Hash]
52
- attrib :snapshot
52
+ attrib :snapshot, snapshot: true
53
53
 
54
54
  # @!attribute [r] asset_id
55
55
  # Deprecated. Use {#flavor_id} instead.
@@ -103,7 +103,13 @@ module Sequence
103
103
  # @return [Hash]
104
104
  attrib :destination_account_tags
105
105
 
106
+ # @!attribute [r] tags
107
+ # User-specified key-value data embedded in the action.
108
+ # @return [Hash]
109
+ attrib :tags
110
+
106
111
  # @!attribute [r] reference_data
112
+ # Deprecated. Use {#tags} instead.
107
113
  # User-specified key-value data embedded in the action.
108
114
  # @return [Hash]
109
115
  attrib :reference_data
data/lib/sequence/key.rb CHANGED
@@ -32,6 +32,7 @@ module Sequence
32
32
  Key.new(client.session.request('create-key', opts))
33
33
  end
34
34
 
35
+ # @deprecated Use list instead.
35
36
  # Executes a query, returning an enumerable over individual keys.
36
37
  # @param [Hash] opts
37
38
  # Options hash
@@ -62,6 +62,7 @@ module Sequence
62
62
  attrib_name = attrib_name.to_sym
63
63
  opts = attrib_opts[attrib_name]
64
64
 
65
+ return Snapshot.new(raw_value) if opts[:snapshot]
65
66
  return Time.parse(raw_value) if opts[:rfc3339_time]
66
67
  return raw_value if opts[:translate].nil?
67
68
 
@@ -87,6 +88,36 @@ module Sequence
87
88
  raw_value
88
89
  end
89
90
 
91
+ class Snapshot
92
+ def initialize(data)
93
+ @data = data
94
+ end
95
+
96
+ def [](key)
97
+ @data[key]
98
+ end
99
+
100
+ def action_tags
101
+ @data['action_tags']
102
+ end
103
+
104
+ def destination_account_tags
105
+ @data['destination_account_tags']
106
+ end
107
+
108
+ def flavor_tags
109
+ @data['flavor_tags']
110
+ end
111
+
112
+ def source_account_tags
113
+ @data['source_account_tags']
114
+ end
115
+
116
+ def token_tags
117
+ @data['token_tags']
118
+ end
119
+ end
120
+
90
121
  class TranslateError < StandardError
91
122
  attr_reader :attrib_name
92
123
  attr_reader :raw_value
@@ -59,16 +59,12 @@ module Sequence
59
59
  builder = Builder.new(&block)
60
60
  end
61
61
 
62
- tpl = client.session.request('build-transaction', builder)
63
- tpl = client.session.request(
64
- '/sign-transaction',
65
- transaction: tpl,
66
- )
67
62
  Transaction.new(
68
- client.session.request('submit-transaction', transaction: tpl),
63
+ client.session.request('transact', builder),
69
64
  )
70
65
  end
71
66
 
67
+ # @deprecated Use list instead.
72
68
  # Executes a query, returning an enumerable over individual transactions.
73
69
  # @param [Hash] opts Options hash
74
70
  # @option opts [String] filter
@@ -134,7 +130,7 @@ module Sequence
134
130
  # account, action, and token) as they existed at the time of the
135
131
  # transaction.
136
132
  # @return [Hash]
137
- attrib :snapshot
133
+ attrib :snapshot, snapshot: true
138
134
 
139
135
  # @!attribute [r] asset_id
140
136
  # Deprecated. Use {#flavor_id} instead.
@@ -199,7 +195,13 @@ module Sequence
199
195
  # @return [String]
200
196
  attrib :destination_account_tags
201
197
 
198
+ # @!attribute [r] tags
199
+ # User-specified, key-value data embedded into the action.
200
+ # @return [Hash]
201
+ attrib :tags
202
+
202
203
  # @!attribute [r] reference_data
204
+ # Deprecated. Use {#tags} instead.
203
205
  # User-specified, key-value data embedded into the action.
204
206
  # @return [Hash]
205
207
  attrib :reference_data
@@ -242,7 +244,7 @@ module Sequence
242
244
  self
243
245
  end
244
246
 
245
- # Issues new units of a flavor to a destination account.
247
+ # Issues new tokens to a destination account.
246
248
  #
247
249
  # @param [Hash] opts
248
250
  # Options hash
@@ -267,7 +269,10 @@ module Sequence
267
269
  # destination account ID or alias.
268
270
  # @option opts [Hash] :token_tags
269
271
  # Tags to add to the receiving tokens.
272
+ # @option opts [Hash] :action_tags
273
+ # Tags to add to the action.
270
274
  # @option opts [Hash] :reference_data
275
+ # Deprecated. Use :token_tags or :action_tags instead.
271
276
  # Reference data for the action.
272
277
  # @return [Builder]
273
278
  def issue(opts = {})
@@ -280,6 +285,7 @@ module Sequence
280
285
  :destination_account_id,
281
286
  :destination_account_alias,
282
287
  :token_tags,
288
+ :action_tags,
283
289
  :reference_data,
284
290
  )
285
291
  validate_either!(opts, :flavor_id, :asset_id, :asset_alias)
@@ -291,7 +297,7 @@ module Sequence
291
297
  add_action(opts.merge(type: :issue))
292
298
  end
293
299
 
294
- # Moves units of a flavor from a source (an account or contract) to a
300
+ # Moves tokens from a source (an account or contract) to a
295
301
  # destination account.
296
302
  #
297
303
  # @param [Hash] opts
@@ -331,7 +337,10 @@ module Sequence
331
337
  # destination account ID or alias.
332
338
  # @option opts [Hash] :token_tags
333
339
  # Tags to add to the receiving tokens.
340
+ # @option opts [Hash] :action_tags
341
+ # Tags to add to the action.
334
342
  # @option opts [Hash] :reference_data
343
+ # Deprecated. Use :token_tags or :action_tags instead.
335
344
  # reference data for the action.
336
345
  # @option opts [Hash] :change_reference_data
337
346
  # Deprecated. This happens automatically when using token tags.
@@ -352,6 +361,7 @@ module Sequence
352
361
  :destination_account_id,
353
362
  :destination_account_alias,
354
363
  :token_tags,
364
+ :action_tags,
355
365
  :reference_data,
356
366
  :change_reference_data,
357
367
  )
@@ -370,7 +380,7 @@ module Sequence
370
380
  add_action(opts.merge(type: :transfer))
371
381
  end
372
382
 
373
- # Takes units of a flavor from a source (an account or contract) and
383
+ # Takes tokens from a source (an account or contract) and
374
384
  # retires them.
375
385
  #
376
386
  # @param [Hash] opts Options hash
@@ -400,7 +410,10 @@ module Sequence
400
410
  # @option opts [String] :source_contract_id
401
411
  # ID of the contract serving as the source of flavor units. You must
402
412
  # specify a source account ID, account alias, or contract ID.
413
+ # @option opts [Hash] :action_tags
414
+ # Tags to add to the action.
403
415
  # @option opts [Hash] :reference_data
416
+ # Deprecated. Use :token_tags or :action_tags instead.
404
417
  # Reference data for the action.
405
418
  # @option opts [Hash] :change_reference_data
406
419
  # Deprecated. This happens automatically when using token tags.
@@ -418,6 +431,7 @@ module Sequence
418
431
  :source_account_id,
419
432
  :source_account_alias,
420
433
  :source_contract_id,
434
+ :action_tags,
421
435
  :reference_data,
422
436
  :change_reference_data,
423
437
  )
@@ -1,3 +1,3 @@
1
1
  module Sequence
2
- VERSION = '1.3'.freeze
2
+ VERSION = '1.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequence-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.3'
4
+ version: '1.4'
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-03-02 00:00:00.000000000 Z
11
+ date: 2018-03-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: SDK for Sequence
14
14
  email:
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  version: '0'
61
61
  requirements: []
62
62
  rubyforge_project:
63
- rubygems_version: 2.7.6
63
+ rubygems_version: 2.6.13
64
64
  signing_key:
65
65
  specification_version: 4
66
66
  summary: SDK for Sequence