sequence-sdk 1.5.2 → 2.pre.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +2 -2
- data/lib/sequence/account.rb +31 -104
- data/lib/sequence/action.rb +15 -80
- data/lib/sequence/client.rb +24 -34
- data/lib/sequence/client_module.rb +0 -4
- data/lib/sequence/errors.rb +0 -4
- data/lib/sequence/feed.rb +28 -31
- data/lib/sequence/flavor.rb +29 -55
- data/lib/sequence/http_wrapper.rb +10 -13
- data/lib/sequence/key.rb +6 -36
- data/lib/sequence/page.rb +0 -6
- data/lib/sequence/query.rb +7 -20
- data/lib/sequence/session.rb +6 -45
- data/lib/sequence/stats.rb +9 -10
- data/lib/sequence/token.rb +24 -23
- data/lib/sequence/transaction.rb +84 -230
- data/lib/sequence/version.rb +1 -1
- metadata +131 -11
- data/lib/sequence/asset.rb +0 -119
- data/lib/sequence/balance.rb +0 -59
- data/lib/sequence/contract.rb +0 -104
- data/lib/sequence/validations.rb +0 -32
data/lib/sequence/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,139 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequence-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.pre.rc.1
|
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-04-
|
12
|
-
dependencies:
|
11
|
+
date: 2018-04-11 00:00:00.000000000 Z
|
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
|
13
137
|
description: SDK for Sequence
|
14
138
|
email:
|
15
139
|
executables: []
|
@@ -21,11 +145,8 @@ files:
|
|
21
145
|
- lib/sequence.rb
|
22
146
|
- lib/sequence/account.rb
|
23
147
|
- lib/sequence/action.rb
|
24
|
-
- lib/sequence/asset.rb
|
25
|
-
- lib/sequence/balance.rb
|
26
148
|
- lib/sequence/client.rb
|
27
149
|
- lib/sequence/client_module.rb
|
28
|
-
- lib/sequence/contract.rb
|
29
150
|
- lib/sequence/dev_utils.rb
|
30
151
|
- lib/sequence/errors.rb
|
31
152
|
- lib/sequence/feed.rb
|
@@ -39,7 +160,6 @@ files:
|
|
39
160
|
- lib/sequence/stats.rb
|
40
161
|
- lib/sequence/token.rb
|
41
162
|
- lib/sequence/transaction.rb
|
42
|
-
- lib/sequence/validations.rb
|
43
163
|
- lib/sequence/version.rb
|
44
164
|
homepage: https://github.com/sequence/sequence-sdk-ruby
|
45
165
|
licenses:
|
@@ -53,15 +173,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
53
173
|
requirements:
|
54
174
|
- - "~>"
|
55
175
|
- !ruby/object:Gem::Version
|
56
|
-
version: '2.
|
176
|
+
version: '2.3'
|
57
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
178
|
requirements:
|
59
|
-
- - "
|
179
|
+
- - ">"
|
60
180
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
181
|
+
version: 1.3.1
|
62
182
|
requirements: []
|
63
183
|
rubyforge_project:
|
64
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.7.3
|
65
185
|
signing_key:
|
66
186
|
specification_version: 4
|
67
187
|
summary: SDK for Sequence
|
data/lib/sequence/asset.rb
DELETED
@@ -1,119 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'securerandom'
|
4
|
-
|
5
|
-
require_relative './client_module'
|
6
|
-
require_relative './errors'
|
7
|
-
require_relative './query'
|
8
|
-
require_relative './response_object'
|
9
|
-
|
10
|
-
module Sequence
|
11
|
-
# A type or class of value that can be tracked on a ledger.
|
12
|
-
# @deprecated Use {Flavor} instead.
|
13
|
-
class Asset < ResponseObject
|
14
|
-
# @!attribute [r] id
|
15
|
-
# Unique, auto-generated identifier.
|
16
|
-
# @return [String]
|
17
|
-
attrib :id
|
18
|
-
|
19
|
-
# @!attribute [r] alias
|
20
|
-
# Unique, user-specified identifier.
|
21
|
-
# @return [String]
|
22
|
-
attrib :alias
|
23
|
-
|
24
|
-
# @!attribute [r] keys
|
25
|
-
# The set of keys used to sign transactions that issue the asset.
|
26
|
-
# @return [Array<Key>]
|
27
|
-
attrib(:keys) { |raw| raw.map { |k| Key.new(k) } }
|
28
|
-
|
29
|
-
# @!attribute [r] quorum
|
30
|
-
# The number of keys required to sign transactions that issue the asset.
|
31
|
-
# @return [Integer]
|
32
|
-
attrib :quorum
|
33
|
-
|
34
|
-
# @!attribute [r] tags
|
35
|
-
# User-specified key-value data describing the asset.
|
36
|
-
# @return [Hash]
|
37
|
-
attrib :tags
|
38
|
-
|
39
|
-
class Key < ResponseObject
|
40
|
-
attrib :id
|
41
|
-
attrib :alias
|
42
|
-
end
|
43
|
-
|
44
|
-
class ClientModule < Sequence::ClientModule
|
45
|
-
# Creates a new asset in the ledger.
|
46
|
-
# @param [Hash] opts
|
47
|
-
# Options hash
|
48
|
-
# @option opts [String] alias
|
49
|
-
# Unique, user-specified identifier.
|
50
|
-
# @option opts [Array<Hash>, Array<Sequence::Key>] keys
|
51
|
-
# The set of keys used for signing transactions that issue the asset. A
|
52
|
-
# key can be either a key object, or a hash containing either an `id` or
|
53
|
-
# `alias` field.
|
54
|
-
# @option opts [Integer] quorum
|
55
|
-
# The number of keys required to sign transactions that issue the asset.
|
56
|
-
# Defaults to the number of keys provided.
|
57
|
-
# @option opts [Hash] tags
|
58
|
-
# User-specified key-value data describing the asset.
|
59
|
-
# @return [Asset]
|
60
|
-
def create(opts = {})
|
61
|
-
validate_inclusion_of!(opts, :alias, :keys, :quorum, :tags)
|
62
|
-
validate_required!(opts, :keys)
|
63
|
-
Asset.new(client.session.request('create-asset', opts))
|
64
|
-
end
|
65
|
-
|
66
|
-
# Updates an asset's tags.
|
67
|
-
# @param [Hash] opts
|
68
|
-
# Options hash
|
69
|
-
# @option opts [String] id
|
70
|
-
# The ID of the asset. Either an ID or alias should be provided, but not
|
71
|
-
# both.
|
72
|
-
# @option opts [String] alias
|
73
|
-
# The alias of the asset. Either an ID or alias should be provided, but
|
74
|
-
# not both.
|
75
|
-
# @option opts [Hash] tags
|
76
|
-
# A new set of tags, which will replace the existing tags.
|
77
|
-
# @return [void]
|
78
|
-
def update_tags(opts = {})
|
79
|
-
validate_inclusion_of!(opts, :id, :alias, :tags)
|
80
|
-
if (opts[:id].nil? || opts[:id].empty?) &&
|
81
|
-
(opts[:alias].nil? || opts[:alias].empty?)
|
82
|
-
raise ArgumentError, ':id or :alias (but not both) must be provided'
|
83
|
-
end
|
84
|
-
client.session.request('update-asset-tags', opts)
|
85
|
-
end
|
86
|
-
|
87
|
-
# Executes a query, returning an enumerable over individual assets.
|
88
|
-
# @param [Hash] opts
|
89
|
-
# Options hash
|
90
|
-
# @option opts [String] filter
|
91
|
-
# A filter expression.
|
92
|
-
# @option opts [Array<String|Integer>] filter_params
|
93
|
-
# A list of values that will be interpolated into the filter expression.
|
94
|
-
# @option opts [Integer>] page_size
|
95
|
-
# The number of items to return in the result set.
|
96
|
-
# @return [Query]
|
97
|
-
def query(opts = {})
|
98
|
-
validate_inclusion_of!(
|
99
|
-
opts,
|
100
|
-
:filter,
|
101
|
-
:filter_params,
|
102
|
-
:page_size,
|
103
|
-
:after,
|
104
|
-
)
|
105
|
-
Query.new(client, opts)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
class Query < Sequence::Query
|
110
|
-
def fetch(query)
|
111
|
-
client.session.request('list-assets', query)
|
112
|
-
end
|
113
|
-
|
114
|
-
def translate(raw)
|
115
|
-
Asset.new(raw)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
data/lib/sequence/balance.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative './client_module'
|
4
|
-
require_relative './response_object'
|
5
|
-
require_relative './query'
|
6
|
-
|
7
|
-
module Sequence
|
8
|
-
# A summation of contract amounts. Contracts are selected using a filter, and
|
9
|
-
# their values are summed using the common values of one or more contract
|
10
|
-
# fields.
|
11
|
-
# @deprecated Use {Token::ClientModule#sum} instead.
|
12
|
-
class Balance < ResponseObject
|
13
|
-
# @!attribute [r] amount
|
14
|
-
# Summation of contract amounts.
|
15
|
-
# @return [Integer]
|
16
|
-
attrib :amount
|
17
|
-
|
18
|
-
# @!attribute [r] sum_by
|
19
|
-
# List of parameters along which contract amounts were summed.
|
20
|
-
# @return [Hash<String => String>]
|
21
|
-
attrib :sum_by
|
22
|
-
|
23
|
-
class ClientModule < Sequence::ClientModule
|
24
|
-
# Executes a query, returning an enumerable over individual balances.
|
25
|
-
# @param [Hash] opts
|
26
|
-
# Options hash
|
27
|
-
# @option opts [String] filter
|
28
|
-
# A filter expression.
|
29
|
-
# @option opts [Array<String|Integer>] filter_params
|
30
|
-
# A list of values that will be interpolated into the filter expression.
|
31
|
-
# @option opts [Array<String>] sum_by
|
32
|
-
# A list of fields along which contract values will be summed.
|
33
|
-
# @option opts [Integer>] page_size
|
34
|
-
# The number of items to return in the result set.
|
35
|
-
# @return [Query]
|
36
|
-
def query(opts = {})
|
37
|
-
validate_inclusion_of!(
|
38
|
-
opts,
|
39
|
-
:filter,
|
40
|
-
:filter_params,
|
41
|
-
:sum_by,
|
42
|
-
:page_size,
|
43
|
-
:after,
|
44
|
-
)
|
45
|
-
Query.new(client, opts)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
class Query < Sequence::Query
|
50
|
-
def fetch(query)
|
51
|
-
client.session.request('list-balances', query)
|
52
|
-
end
|
53
|
-
|
54
|
-
def translate(raw)
|
55
|
-
Balance.new(raw)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
data/lib/sequence/contract.rb
DELETED
@@ -1,104 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative './client_module'
|
4
|
-
require_relative './response_object'
|
5
|
-
require_relative './query'
|
6
|
-
|
7
|
-
module Sequence
|
8
|
-
# An entry in the ledger that contains value that can be spent.
|
9
|
-
# @deprecated Use {Token::ClientModule#list} instead.
|
10
|
-
class Contract < ResponseObject
|
11
|
-
# @!attribute [r] id
|
12
|
-
# A unique ID.
|
13
|
-
# @return [String]
|
14
|
-
attrib :id
|
15
|
-
|
16
|
-
# @!attribute [r] type
|
17
|
-
# The type of the contract. Currently, this is always "account".
|
18
|
-
# @return [String]
|
19
|
-
attrib :type
|
20
|
-
|
21
|
-
# @!attribute [r] transaction_id
|
22
|
-
# The ID of the transaction in which the contract appears.
|
23
|
-
# @return [String]
|
24
|
-
attrib :transaction_id
|
25
|
-
|
26
|
-
# @!attribute [r] asset_id
|
27
|
-
# The ID of the asset held by the contract.
|
28
|
-
# @return [String]
|
29
|
-
attrib :asset_id
|
30
|
-
|
31
|
-
# @!attribute [r] asset_alias
|
32
|
-
# The alias of the asset held by the contract.
|
33
|
-
# @return [String]
|
34
|
-
attrib :asset_alias
|
35
|
-
|
36
|
-
# @!attribute [r] asset_tags
|
37
|
-
# The tags of the asset held by the contract.
|
38
|
-
# @return [Hash]
|
39
|
-
attrib :asset_tags
|
40
|
-
|
41
|
-
# @!attribute [r] amount
|
42
|
-
# The number of units of the asset held by the contract.
|
43
|
-
# @return [Integer]
|
44
|
-
attrib :amount
|
45
|
-
|
46
|
-
# @!attribute [r] account_id
|
47
|
-
# The ID of the account controlling the contract.
|
48
|
-
# @return [String]
|
49
|
-
attrib :account_id
|
50
|
-
|
51
|
-
# @!attribute [r] account_alias
|
52
|
-
# Deprecated. Use {#account_id} instead.
|
53
|
-
# The alias of the account controlling the contract.
|
54
|
-
# @return [String]
|
55
|
-
attrib :account_alias
|
56
|
-
|
57
|
-
# @!attribute [r] account_tags
|
58
|
-
# The tags of the account controlling the contract.
|
59
|
-
# @return [Hash]
|
60
|
-
attrib :account_tags
|
61
|
-
|
62
|
-
# @!attribute [r] reference_data
|
63
|
-
# User-specified key-value data embedded in the contract.
|
64
|
-
# @return [Hash]
|
65
|
-
attrib :reference_data
|
66
|
-
|
67
|
-
class ClientModule < Sequence::ClientModule
|
68
|
-
# Executes a query, returning an enumerable over individual contracts.
|
69
|
-
# @param [Hash] opts
|
70
|
-
# Options hash
|
71
|
-
# @option opts [String] filter
|
72
|
-
# A filter expression.
|
73
|
-
# @option opts [Array<String|Integer>] filter_params
|
74
|
-
# A list of values that will be interpolated into the filter expression.
|
75
|
-
# @option opts [Integer] timestamp
|
76
|
-
# A millisecond Unix timestamp. Indicates that the query should be run
|
77
|
-
# over the state of the ledger at a given point in time.
|
78
|
-
# @option opts [Integer>] page_size
|
79
|
-
# The number of items to return in the result set.
|
80
|
-
# @return [Query]
|
81
|
-
def query(opts = {})
|
82
|
-
validate_inclusion_of!(
|
83
|
-
opts,
|
84
|
-
:filter,
|
85
|
-
:filter_params,
|
86
|
-
:timestamp,
|
87
|
-
:page_size,
|
88
|
-
:after,
|
89
|
-
)
|
90
|
-
Query.new(client, opts)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
class Query < Sequence::Query
|
95
|
-
def fetch(query)
|
96
|
-
client.session.request('list-contracts', query)
|
97
|
-
end
|
98
|
-
|
99
|
-
def translate(raw)
|
100
|
-
Contract.new(raw)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|