cryptomate_api 0.1.4 → 0.3.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/.rubocop.yml +13 -7
- data/CHANGELOG.md +7 -0
- data/Gemfile +4 -4
- data/Gemfile.lock +67 -0
- data/README.md +0 -2
- data/Rakefile +3 -3
- data/cryptomate_api.gemspec +18 -15
- data/lib/cryptomate_api/base.rb +34 -7
- data/lib/cryptomate_api/management/blockchain.rb +13 -11
- data/lib/cryptomate_api/management/client.rb +51 -49
- data/lib/cryptomate_api/management/configuration.rb +31 -28
- data/lib/cryptomate_api/management/credential.rb +83 -81
- data/lib/cryptomate_api/management/key.rb +58 -56
- data/lib/cryptomate_api/management/operation.rb +23 -21
- data/lib/cryptomate_api/mpc/account.rb +58 -56
- data/lib/cryptomate_api/mpc/wallet.rb +102 -100
- data/lib/cryptomate_api/payment.rb +64 -0
- data/lib/cryptomate_api/version.rb +1 -1
- data/lib/cryptomate_api.rb +2 -2
- metadata +9 -6
- data/lib/cryptomate_api/configuration.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 906be66131260ee217ea113c34d721097024af3ccfd109357b16cb63db2710c0
|
4
|
+
data.tar.gz: 94433f3e67c9d62a522e85c640c54a263f0558f049a42ff737d1cef4137838ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd6398f342185320a4e848bf3d9a21561d9b0070cf42b6665b004728fb35fdc84a01a350e0b3d8f38aacbb0c46354d31af2eb4235b0db457cad9ebc95a545ab9
|
7
|
+
data.tar.gz: 784af7e1d756604e05fa01e56f000cdb852383f8b2047cefeb427a6450ebdf21b5d35a08954ab6f209acdf2c893726f4a7fee3016af783731f31152a37a0c8b5
|
data/.rubocop.yml
CHANGED
@@ -1,13 +1,19 @@
|
|
1
1
|
AllCops:
|
2
|
-
|
2
|
+
NewCops: enable
|
3
|
+
TargetRubyVersion: 3.1
|
3
4
|
|
4
|
-
Style/
|
5
|
-
Enabled:
|
6
|
-
EnforcedStyle: double_quotes
|
5
|
+
Style/Documentation:
|
6
|
+
Enabled: false
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
EnforcedStyle: double_quotes
|
8
|
+
Naming/VariableNumber:
|
9
|
+
EnforcedStyle: snake_case
|
11
10
|
|
12
11
|
Layout/LineLength:
|
13
12
|
Max: 120
|
13
|
+
AllowedPatterns: ['(\A|\s)#'] # ignore comments
|
14
|
+
|
15
|
+
Lint/AmbiguousBlockAssociation:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Naming/AccessorMethodName:
|
19
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -3,3 +3,10 @@
|
|
3
3
|
## [0.1.0] - 2023-11-04
|
4
4
|
|
5
5
|
- Initial release
|
6
|
+
- Modules included:
|
7
|
+
- [Management](https://cryptomate.me/docs/management)
|
8
|
+
- [MPC](https://cryptomate.me/docs/mpc)
|
9
|
+
|
10
|
+
## [0.2.0] - 2023-11-30
|
11
|
+
|
12
|
+
- Added [Payments module](https://cryptomate.me/docs/payments)
|
data/Gemfile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in cryptomate_api.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem
|
8
|
+
gem 'rake', '~> 13.0'
|
9
9
|
|
10
|
-
gem
|
10
|
+
gem 'rspec', '~> 3.0'
|
11
11
|
|
12
|
-
gem
|
12
|
+
gem 'rubocop', '~> 1.21'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cryptomate_api (0.2.2)
|
5
|
+
httparty (~> 0.18)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.2)
|
11
|
+
diff-lcs (1.5.0)
|
12
|
+
httparty (0.21.0)
|
13
|
+
mini_mime (>= 1.0.0)
|
14
|
+
multi_xml (>= 0.5.2)
|
15
|
+
json (2.6.3)
|
16
|
+
language_server-protocol (3.17.0.3)
|
17
|
+
mini_mime (1.1.5)
|
18
|
+
multi_xml (0.6.0)
|
19
|
+
parallel (1.23.0)
|
20
|
+
parser (3.2.2.4)
|
21
|
+
ast (~> 2.4.1)
|
22
|
+
racc
|
23
|
+
racc (1.7.3)
|
24
|
+
rainbow (3.1.1)
|
25
|
+
rake (13.1.0)
|
26
|
+
regexp_parser (2.8.2)
|
27
|
+
rexml (3.2.6)
|
28
|
+
rspec (3.12.0)
|
29
|
+
rspec-core (~> 3.12.0)
|
30
|
+
rspec-expectations (~> 3.12.0)
|
31
|
+
rspec-mocks (~> 3.12.0)
|
32
|
+
rspec-core (3.12.2)
|
33
|
+
rspec-support (~> 3.12.0)
|
34
|
+
rspec-expectations (3.12.3)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.12.0)
|
37
|
+
rspec-mocks (3.12.6)
|
38
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
+
rspec-support (~> 3.12.0)
|
40
|
+
rspec-support (3.12.1)
|
41
|
+
rubocop (1.57.2)
|
42
|
+
json (~> 2.3)
|
43
|
+
language_server-protocol (>= 3.17.0)
|
44
|
+
parallel (~> 1.10)
|
45
|
+
parser (>= 3.2.2.4)
|
46
|
+
rainbow (>= 2.2.2, < 4.0)
|
47
|
+
regexp_parser (>= 1.8, < 3.0)
|
48
|
+
rexml (>= 3.2.5, < 4.0)
|
49
|
+
rubocop-ast (>= 1.28.1, < 2.0)
|
50
|
+
ruby-progressbar (~> 1.7)
|
51
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
52
|
+
rubocop-ast (1.30.0)
|
53
|
+
parser (>= 3.2.1.0)
|
54
|
+
ruby-progressbar (1.13.0)
|
55
|
+
unicode-display_width (2.5.0)
|
56
|
+
|
57
|
+
PLATFORMS
|
58
|
+
x86_64-darwin-22
|
59
|
+
|
60
|
+
DEPENDENCIES
|
61
|
+
cryptomate_api!
|
62
|
+
rake (~> 13.0)
|
63
|
+
rspec (~> 3.0)
|
64
|
+
rubocop (~> 1.21)
|
65
|
+
|
66
|
+
BUNDLED WITH
|
67
|
+
2.4.10
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
5
|
|
6
6
|
RSpec::Core::RakeTask.new(:spec)
|
7
7
|
|
8
|
-
require
|
8
|
+
require 'rubocop/rake_task'
|
9
9
|
|
10
10
|
RuboCop::RakeTask.new
|
11
11
|
|
data/cryptomate_api.gemspec
CHANGED
@@ -1,31 +1,34 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative 'lib/cryptomate_api/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
6
|
+
spec.name = 'cryptomate_api'
|
7
7
|
spec.version = CryptomateApi::VERSION
|
8
|
-
spec.authors = [
|
9
|
-
spec.email = [
|
10
|
-
spec.licenses = [
|
8
|
+
spec.authors = ['Matias Albarello']
|
9
|
+
spec.email = ['matias.albarello@gmail.com']
|
10
|
+
spec.licenses = ['MIT']
|
11
11
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
|
15
|
-
|
12
|
+
spec.summary = 'Ruby client for the CryptoMate API.'
|
13
|
+
spec.description = 'Provides a Ruby interface to the CryptoMate API, allowing easy access to cryptocurrency data and \
|
14
|
+
transaction operations. Supports retrieving currency details, creating and fetching transactions, \
|
15
|
+
and managing user information.'
|
16
|
+
spec.homepage = 'https://github.com/matiasalbarello/cryptomate_api'
|
17
|
+
spec.required_ruby_version = '>= 3.1'
|
16
18
|
|
17
|
-
spec.metadata[
|
18
|
-
spec.metadata[
|
19
|
-
spec.metadata[
|
19
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
20
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
21
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
20
22
|
|
21
23
|
spec.files = Dir.chdir(__dir__) do
|
22
24
|
`git ls-files -z`.split("\x0").reject do |f|
|
23
25
|
(File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
|
24
26
|
end
|
25
27
|
end
|
26
|
-
spec.bindir =
|
28
|
+
spec.bindir = 'exe'
|
27
29
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
28
|
-
spec.require_paths = [
|
30
|
+
spec.require_paths = ['lib']
|
29
31
|
|
30
|
-
spec.add_dependency
|
32
|
+
spec.add_dependency 'httparty', '~> 0.18'
|
33
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
31
34
|
end
|
data/lib/cryptomate_api/base.rb
CHANGED
@@ -1,15 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'httparty'
|
2
4
|
|
3
5
|
module CryptomateApi
|
6
|
+
class << self
|
7
|
+
def configure
|
8
|
+
yield self if block_given?
|
9
|
+
end
|
10
|
+
|
11
|
+
def base_uri=(uri)
|
12
|
+
Base.base_uri uri
|
13
|
+
end
|
14
|
+
|
15
|
+
def api_key=(key)
|
16
|
+
Base.headers 'Content-Type' => 'application/json', 'x-api-key' => key
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
4
20
|
class Base
|
5
21
|
include HTTParty
|
6
22
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
23
|
+
class << self
|
24
|
+
[:get, :post, :put, :patch, :delete, :head, :options, :move].each do |http_method|
|
25
|
+
define_method(http_method) do |*args, &block|
|
26
|
+
ensure_configuration!
|
27
|
+
super(*args, &block)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def ensure_configuration!
|
34
|
+
errors = []
|
35
|
+
errors << "Base URI not configured" if base_uri.nil?
|
36
|
+
errors << "API key not configured" if headers['x-api-key'].nil?
|
37
|
+
|
38
|
+
raise CryptomateApi::Error, errors.join(", ") unless errors.empty?
|
39
|
+
end
|
13
40
|
end
|
14
41
|
end
|
15
|
-
end
|
42
|
+
end
|
@@ -6,17 +6,19 @@ module CryptomateApi
|
|
6
6
|
# credentials for your clients or using every other endpoints that ask for the blockchain where
|
7
7
|
# you want to operate.
|
8
8
|
class Blockchain < CryptomateApi::Base
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
9
|
+
class << self
|
10
|
+
# Get all blockchains
|
11
|
+
# https://cryptomate.me/docs/management#get-all-blockchains
|
12
|
+
# Response:
|
13
|
+
# [
|
14
|
+
# {
|
15
|
+
# "id": "string",
|
16
|
+
# "description": "string"
|
17
|
+
# }
|
18
|
+
# ]
|
19
|
+
def get_all_blockchains
|
20
|
+
get('/management/blockchains/list')
|
21
|
+
end
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -5,58 +5,60 @@ module CryptomateApi
|
|
5
5
|
# Manage the company information from here, like changing the webhook url where we will
|
6
6
|
# notify that some event happened or just changing the name of the company.
|
7
7
|
class Client < CryptomateApi::Base
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
8
|
+
class << self
|
9
|
+
# Get clients information
|
10
|
+
# https://cryptomate.me/docs/management#get-clients-information
|
11
|
+
# Response:
|
12
|
+
# {
|
13
|
+
# "name": "string",
|
14
|
+
# "last_name": "string",
|
15
|
+
# "email": "string",
|
16
|
+
# "social_reason": "string",
|
17
|
+
# "webhook_url": "string",
|
18
|
+
# }
|
19
|
+
def get_clients
|
20
|
+
get('/management/clients')
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
23
|
+
# Update Webhook-Url
|
24
|
+
# https://cryptomate.me/docs/management#update-webhook-url
|
25
|
+
# @param [String] webhook_url (New webhook url to use to inform any changes.)
|
26
|
+
# Response:
|
27
|
+
# {
|
28
|
+
# "name": "string",
|
29
|
+
# "email": "string",
|
30
|
+
# "webhook_url": "string"
|
31
|
+
# }
|
32
|
+
def update_webhook_url(webhook_url)
|
33
|
+
patch('/management/clients/webhook-url', body: { webhook_url: }.to_json)
|
34
|
+
end
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
36
|
+
# Update Client-Information
|
37
|
+
# https://cryptomate.me/docs/management#update-client-information
|
38
|
+
# @param [String] name (Name of the client to update.)
|
39
|
+
# @param [String] email (Email of the client to update.)
|
40
|
+
# @param [String] webhook_url (New webhook url to use to inform any changes.)
|
41
|
+
# Response:
|
42
|
+
# {
|
43
|
+
# "name": "string",
|
44
|
+
# "email": "string",
|
45
|
+
# "webhook_url": "string"
|
46
|
+
# }
|
47
|
+
def update_client_information(name, email, webhook_url)
|
48
|
+
put('/management/clients', body: { name:, email:, webhook_url: }.to_json)
|
49
|
+
end
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
51
|
+
# Update Payment Address
|
52
|
+
# https://cryptomate.me/docs/management#update-payments-address
|
53
|
+
# @param [String] address (Address where you want to receive the payments)
|
54
|
+
# @param [String] blockchain (Blockchain where you want to receive the payments)
|
55
|
+
# Response:
|
56
|
+
# {
|
57
|
+
# "address": "string",
|
58
|
+
# }
|
59
|
+
def update_payment_address(address, blockchain)
|
60
|
+
patch('/management/clients/payment-treasury', body: { address:, blockchain: }.to_json)
|
61
|
+
end
|
60
62
|
end
|
61
63
|
end
|
62
64
|
end
|
@@ -4,36 +4,39 @@ module CryptomateApi
|
|
4
4
|
module Management
|
5
5
|
# Manage the company configurations from here, like changing the payment destination address for each blockchain.
|
6
6
|
class Configuration < CryptomateApi::Base
|
7
|
-
|
8
|
-
# Gets the treasury wallet address for holding the payments received on the selected blockchain.
|
9
|
-
# https://cryptomate.me/docs/management#get-payment-destination
|
10
|
-
# @param [String] blockchain (Id of the blockchain.)
|
11
|
-
# Response:
|
12
|
-
# {
|
13
|
-
# "address": "string",
|
14
|
-
# "blockchain": "string"
|
15
|
-
# }
|
16
|
-
def get_payment_destination(blockchain)
|
17
|
-
self.class.get("/management/configurations/payments/#{blockchain}")
|
18
|
-
end
|
7
|
+
class << self
|
19
8
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
9
|
+
# Get payment destination
|
10
|
+
# Gets the treasury wallet address for holding the payments received on the selected blockchain.
|
11
|
+
# https://cryptomate.me/docs/management#get-payment-destination
|
12
|
+
# @param [String] blockchain (Id of the blockchain.)
|
13
|
+
# Response:
|
14
|
+
# {
|
15
|
+
# "address": "string",
|
16
|
+
# "blockchain": "string"
|
17
|
+
# }
|
18
|
+
def get_payment_destination(blockchain)
|
19
|
+
get("/management/configurations/payments/#{blockchain}")
|
20
|
+
end
|
21
|
+
|
22
|
+
# Set payment destination
|
23
|
+
# Sets the treasury wallet that all the payments will sent after being completed.
|
24
|
+
# https://cryptomate.me/docs/management#set-payment-destination
|
25
|
+
# @param [String] address (Address of the treasury wallet)
|
26
|
+
# @param [String] blockchain (Id of the blockchain.)
|
27
|
+
# Response: None
|
28
|
+
def set_payment_destination(address, blockchain)
|
29
|
+
post('/management/configurations/payments', body: { address:, blockchain: }.to_json)
|
30
|
+
end
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
# Delete payment destination
|
33
|
+
# Deletes the treasury wallet that all the payments will sent after being completed.
|
34
|
+
# https://cryptomate.me/docs/management#delete-payment-destination
|
35
|
+
# @param [String] blockchain (Id of the blockchain.)
|
36
|
+
# Response: None
|
37
|
+
def delete_payment_destination(blockchain)
|
38
|
+
delete("/management/configurations/payments/#{blockchain}")
|
39
|
+
end
|
37
40
|
end
|
38
41
|
end
|
39
42
|
end
|