mixin_bot 0.6.9 → 0.7.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/lib/mixin_bot/api/multisig.rb +0 -13
- data/lib/mixin_bot/api/rpc.rb +32 -0
- data/lib/mixin_bot/api.rb +2 -0
- data/lib/mixin_bot/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcc69721b226d0b558be21473b00ad31c5ddff688b81742167b58db6989b55a7
|
4
|
+
data.tar.gz: a4384317d625df14c6a015da3203cf23f840955691b3908ea81fab4a806e55bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c782580d7a5c7e3e4f52d1523890ba9a336c5459bf3c4841ab81b692335957db1eed78c1cb5ac2b03f7b190df2fb7d6c216833be38054e606efc9130d514963
|
7
|
+
data.tar.gz: 7b63815549077772b357e4d43d4b05d16d6a8bf6efc7899960878f1a75b12bf7320949b8806c80ea6b3ddf09ac4451eadc52b600475f056dd5c3be616203fd7c
|
@@ -122,19 +122,6 @@ module MixinBot
|
|
122
122
|
client.get(path, headers: { 'Authorization': authorization })
|
123
123
|
end
|
124
124
|
|
125
|
-
# send a signed transaction to main net
|
126
|
-
def send_raw_transaction(raw, access_token: nil)
|
127
|
-
path = '/external/proxy'
|
128
|
-
payload = {
|
129
|
-
method: 'sendrawtransaction',
|
130
|
-
params: [raw]
|
131
|
-
}
|
132
|
-
|
133
|
-
access_token ||= access_token('POST', path, payload.to_json)
|
134
|
-
authorization = format('Bearer %<access_token>s', access_token: access_token)
|
135
|
-
client.post(path, headers: { 'Authorization': authorization }, json: payload)
|
136
|
-
end
|
137
|
-
|
138
125
|
def build_threshold_script(threshold)
|
139
126
|
s = threshold.to_s(16)
|
140
127
|
s = s.length == 1 ? "0#{s}" : s
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MixinBot
|
4
|
+
class API
|
5
|
+
module Rpc
|
6
|
+
def rpc_proxy(method, params = [], access_token: nil)
|
7
|
+
path = '/external/proxy'
|
8
|
+
payload = {
|
9
|
+
method: method,
|
10
|
+
params: params
|
11
|
+
}
|
12
|
+
|
13
|
+
access_token ||= access_token('POST', path, payload.to_json)
|
14
|
+
authorization = format('Bearer %<access_token>s', access_token: access_token)
|
15
|
+
client.post(path, headers: { 'Authorization': authorization }, json: payload)
|
16
|
+
end
|
17
|
+
|
18
|
+
# send a signed transaction to main net
|
19
|
+
def send_raw_transaction(raw, access_token: nil)
|
20
|
+
rpc_proxy('sendrawtransaction', [raw], access_token: access_token)
|
21
|
+
end
|
22
|
+
|
23
|
+
def get_transaction(hash, access_token: nil)
|
24
|
+
rpc_proxy('gettransaction', [hash], access_token: nil)
|
25
|
+
end
|
26
|
+
|
27
|
+
def get_utxo(hash, index = 0, access_token: nil)
|
28
|
+
rpc_proxy 'getutxo', [hash, index], access_token: access_token
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/mixin_bot/api.rb
CHANGED
@@ -13,6 +13,7 @@ require_relative './api/message'
|
|
13
13
|
require_relative './api/multisig'
|
14
14
|
require_relative './api/payment'
|
15
15
|
require_relative './api/pin'
|
16
|
+
require_relative './api/rpc'
|
16
17
|
require_relative './api/snapshot'
|
17
18
|
require_relative './api/transaction'
|
18
19
|
require_relative './api/transfer'
|
@@ -86,6 +87,7 @@ module MixinBot
|
|
86
87
|
include MixinBot::API::Multisig
|
87
88
|
include MixinBot::API::Payment
|
88
89
|
include MixinBot::API::Pin
|
90
|
+
include MixinBot::API::Rpc
|
89
91
|
include MixinBot::API::Snapshot
|
90
92
|
include MixinBot::API::Transaction
|
91
93
|
include MixinBot::API::Transfer
|
data/lib/mixin_bot/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixin_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- an-lee
|
@@ -286,6 +286,7 @@ files:
|
|
286
286
|
- lib/mixin_bot/api/multisig.rb
|
287
287
|
- lib/mixin_bot/api/payment.rb
|
288
288
|
- lib/mixin_bot/api/pin.rb
|
289
|
+
- lib/mixin_bot/api/rpc.rb
|
289
290
|
- lib/mixin_bot/api/snapshot.rb
|
290
291
|
- lib/mixin_bot/api/transaction.rb
|
291
292
|
- lib/mixin_bot/api/transfer.rb
|