bitnob 0.0.4.1 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +1 -1
- data/Gemfile.lock +8 -8
- data/README.md +109 -39
- data/bitnob.gemspec +6 -6
- data/lib/bitnob/modules/base_endpoints.rb +1 -0
- data/lib/bitnob/objects/checkout.rb +1 -1
- data/lib/bitnob/objects/lightning.rb +37 -0
- data/lib/bitnob/objects/lnurl.rb +148 -0
- data/lib/bitnob/objects/stablecoins.rb +93 -0
- data/lib/bitnob/objects/wallets.rb +5 -0
- data/lib/bitnob/version.rb +1 -1
- data/lib/bitnob.rb +2 -1
- metadata +28 -27
- data/lib/bitnob/objects/usdc.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 283271f6f2fe35e54b4424fde8281dd4d75dca7dd69316c1c76a040c0c8acbef
|
4
|
+
data.tar.gz: 45730b6a6072246468fe435e5f8b22c9f2734f7485c4d254cd89238ca691bebc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7cdad3f14e36bbc93d02f87220f1cd7412d08c0801ced0634bc71f6aa74dd56c59bf7bad70d4a448368ff658d4c8f0a8af9d245d0067a5f8d185f202bde2c81
|
7
|
+
data.tar.gz: 50a779e5ae03bf67eecc9beb1d6a416fc887b815eb181f09a9df4533f856ce386856ddda050ee9d8b31f7ea9649a42fc09de618d58fa94a551f4821ef2347463
|
data/.github/workflows/main.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bitnob (0.0.
|
4
|
+
bitnob (0.0.6)
|
5
5
|
dotenv (~> 2.7)
|
6
6
|
httparty (~> 0.19.0)
|
7
7
|
|
@@ -52,7 +52,7 @@ GEM
|
|
52
52
|
rubocop-performance (1.13.2)
|
53
53
|
rubocop (>= 1.7.0, < 2.0)
|
54
54
|
rubocop-ast (>= 0.4.0)
|
55
|
-
rubocop-rspec (2.
|
55
|
+
rubocop-rspec (2.9.0)
|
56
56
|
rubocop (~> 1.19)
|
57
57
|
ruby-progressbar (1.11.0)
|
58
58
|
unicode-display_width (2.1.0)
|
@@ -62,12 +62,12 @@ PLATFORMS
|
|
62
62
|
|
63
63
|
DEPENDENCIES
|
64
64
|
bitnob!
|
65
|
-
bundler
|
66
|
-
rake
|
67
|
-
rspec
|
68
|
-
rubocop
|
69
|
-
rubocop-performance
|
70
|
-
rubocop-rspec
|
65
|
+
bundler (~> 2.3)
|
66
|
+
rake (~> 13.0)
|
67
|
+
rspec (~> 3.11)
|
68
|
+
rubocop (~> 1.25)
|
69
|
+
rubocop-performance (~> 1.13)
|
70
|
+
rubocop-rspec (~> 2.9)
|
71
71
|
|
72
72
|
BUNDLED WITH
|
73
73
|
2.3.7
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# Bitnob
|
2
|
+
|
2
3
|
---
|
3
4
|
This is a Ruby gem for easy integration of Bitnob For Business API for various applications written in Ruby language from Bitnob.
|
4
5
|
|
@@ -7,22 +8,26 @@ This is a Ruby gem for easy integration of Bitnob For Business API for various a
|
|
7
8
|
## Getting started
|
8
9
|
|
9
10
|
### Requirements
|
11
|
+
|
10
12
|
This gem requires Ruby 2.6+ and Rails 5.2+
|
11
13
|
|
12
|
-
### Installation
|
14
|
+
### Installation
|
15
|
+
|
13
16
|
- Add the following to your gem file:
|
17
|
+
|
14
18
|
```ruby
|
15
19
|
gem 'bitnob', '~> 0.0.2'
|
16
20
|
```
|
21
|
+
|
17
22
|
Then run:
|
18
23
|
|
19
24
|
```ruby
|
20
25
|
bundle install
|
21
26
|
```
|
22
27
|
|
23
|
-
### Usage
|
24
|
-
- To use this SDK, you need to create a new Bitnob class with your API secret key gotten from your dashboard settings. We recommend you store such keys in an environment variable name `BITNOB_API_KEY`. Instantiating such object would look like this
|
28
|
+
### Usage
|
25
29
|
|
30
|
+
- To use this SDK, you need to create a new Bitnob class with your API secret key gotten from your dashboard settings. We recommend you store such keys in an environment variable name `BITNOB_API_KEY`. Instantiating such object would look like this
|
26
31
|
|
27
32
|
By default the package assumes that you are currently working using a sandbox credential in development, however to go live, your `secret key` nust be a production-grade secret key and you need to specify `true` when instantiating your bitnob class like this:
|
28
33
|
|
@@ -44,34 +49,42 @@ By default the package assumes that you are currently working using a sandbox cr
|
|
44
49
|
`NOTE`: It is best practice to always set your API keys to your environment variable for security purpose. Please be warned not use this package without setting your API keys in your environment variables in production.
|
45
50
|
|
46
51
|
### Bitnob Functions
|
52
|
+
|
47
53
|
- Before making use of any bitnob functions, it is expected you instantiate a new Function class and pass production as true to whatever function you wish to perform. Below is a demonstration:
|
48
54
|
|
49
55
|
- `Customer.new(true)`
|
50
56
|
- `Lightning.new(true)`
|
51
57
|
- `Onchain.new(true)`
|
52
58
|
- `Wallets.new(true)`
|
59
|
+
- `Cards.new(true)`
|
60
|
+
- `Checkout.new(true)`
|
61
|
+
- `Swap.new(true)`
|
62
|
+
- `StableCoin.new(true)`
|
53
63
|
|
54
|
-
|
55
|
-
#### Customers
|
64
|
+
### Customers
|
56
65
|
|
57
66
|
- To manage customers on your Bitnob for business in your ruby application, simply follow the instruction at the beginning of this sub-heading and instantiate a new `Customer` class.
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
67
|
+
- The following functions are available:
|
68
|
+
- create_customer
|
69
|
+
- get_customer_by_email
|
70
|
+
- get_customer
|
71
|
+
- update_customer
|
63
72
|
|
64
73
|
### Lightning
|
65
|
-
- To create Lightning Transactions, simply follow the instruction at the beginning of this sub-heading and instantiate a new `Lightning` class.
|
66
|
-
- The following functions are available:
|
67
|
-
- create_invoice
|
68
|
-
- pay_invoice
|
69
|
-
- initiate_payment
|
70
|
-
- decode_payment request
|
71
|
-
- get_invoice
|
72
74
|
|
75
|
+
- To create Lightning Transactions, simply follow the instruction at the beginning of this sub-heading and instantiate a new `Lightning` class.
|
76
|
+
- The following functions are available:
|
77
|
+
- create_invoice
|
78
|
+
- pay_invoice
|
79
|
+
- initiate_payment
|
80
|
+
- decode_payment request
|
81
|
+
- get_invoice
|
82
|
+
- ln_pay :new:
|
83
|
+
- probe_for_route :new:
|
84
|
+
- probe_route :new:
|
85
|
+
|
86
|
+
###### Full Transaction Workflow
|
73
87
|
|
74
|
-
###### Full Transaction Workflow
|
75
88
|
```ruby
|
76
89
|
require 'bitnob'
|
77
90
|
|
@@ -89,13 +102,34 @@ By default the package assumes that you are currently working using a sandbox cr
|
|
89
102
|
new_ln_invoice = ln.create_invoice(payload)
|
90
103
|
|
91
104
|
```
|
92
|
-
### Onchain
|
93
|
-
- To create Onchain Transactions, simply follow the instruction at the beginning of this sub-heading and instantiate a new `Onchain` class.
|
94
|
-
- The following functions are available:
|
95
|
-
- send_bitcoin
|
96
|
-
- generate_address
|
97
|
-
- list_addresses
|
98
105
|
|
106
|
+
> ### LNURL vs Lightning Address
|
107
|
+
|
108
|
+
> A Lightning Address is a wrapper around lnurl. A Lightning Address is an Internet Identifier that allows anyone to send you Bitcoin over the Lightning Network. No scanning of QR codes or pasting invoices necessary. The Lightning URL on the other hand, is a lot more technical and requires the embedding and scanning of lightning invoices to initiate payments
|
109
|
+
> The username you use to create the lnurl automatically becomes the lightning address in this case.
|
110
|
+
|
111
|
+
### Lightning URL (LNURL) :new
|
112
|
+
|
113
|
+
- To create Lightning URL Operations, simply follow the instruction at the beginning of this sub-heading and instantiate a new `LNURL` class.
|
114
|
+
- The following functions are available:
|
115
|
+
- create
|
116
|
+
- decode_lnurl
|
117
|
+
- pay_lnurl
|
118
|
+
- ln_withdrawal
|
119
|
+
- decode_ln_address
|
120
|
+
- pay_ln_address
|
121
|
+
- get_lnurls
|
122
|
+
- get_by_identifier
|
123
|
+
- get_id
|
124
|
+
- update_lnurl
|
125
|
+
|
126
|
+
### Onchain
|
127
|
+
|
128
|
+
- To create Onchain Transactions, simply follow the instruction at the beginning of this sub-heading and instantiate a new `Onchain` class.
|
129
|
+
- The following functions are available:
|
130
|
+
- send_bitcoin
|
131
|
+
- generate_address
|
132
|
+
- list_addresses
|
99
133
|
|
100
134
|
#### Full Transaction Workflow
|
101
135
|
|
@@ -119,27 +153,65 @@ By default the package assumes that you are currently working using a sandbox cr
|
|
119
153
|
|
120
154
|
```
|
121
155
|
|
122
|
-
### Wallets
|
123
|
-
- To get wallets information, simply follow the instruction at the beginning of this sub-heading and instantiate a new `Wallets` class.
|
124
|
-
- The following functions are available:
|
125
|
-
- fetch_wallets
|
126
|
-
- fetch_all_transactions
|
127
|
-
- fetch_transaction
|
128
|
-
|
156
|
+
### Wallets
|
129
157
|
|
158
|
+
- To get wallets information, simply follow the instruction at the beginning of this sub-heading and instantiate a new `Wallets` class.
|
159
|
+
- The following functions are available:
|
160
|
+
- fetch_wallets
|
161
|
+
- fetch_all_transactions
|
162
|
+
- fetch_transaction
|
163
|
+
- recommend_btc_fees :new:
|
164
|
+
|
165
|
+
### Virtual Cards :new
|
166
|
+
|
167
|
+
- To initiate any Virtual Card Operation, simply follow the instruction at the beginning of this sub-heading and instantiate a new `Cards` class.
|
168
|
+
- The following functions are available:
|
169
|
+
- register_user
|
170
|
+
- create
|
171
|
+
- top_up
|
172
|
+
- withdraw
|
173
|
+
- freeze
|
174
|
+
- unfreeze
|
175
|
+
- mock_transaction
|
176
|
+
- terminate
|
177
|
+
- block
|
178
|
+
- unblock
|
179
|
+
|
180
|
+
### Swap :new
|
181
|
+
|
182
|
+
- To initiate any currency SWAP Operation, simply follow the instruction at the beginning of this sub-heading and instantiate a new `Swap` class.
|
183
|
+
- The following functions are available:
|
184
|
+
- swap_btc_usd
|
185
|
+
- swap_usd_btc
|
186
|
+
|
187
|
+
### Checkout :new
|
188
|
+
|
189
|
+
- To initiate any Checkout Operation, simply follow the instruction at the beginning of this sub-heading and instantiate a new `Checkout` class.
|
190
|
+
- The following functions are available:
|
191
|
+
- create
|
192
|
+
- list_checkouts
|
193
|
+
- get_info
|
194
|
+
- get_status
|
195
|
+
|
196
|
+
### StableCoin :new
|
197
|
+
|
198
|
+
- To integrate any StableCoin Operation, simply follow the instruction at the beginning of this sub-heading and instantiate a new `StableCoin` class.
|
199
|
+
- The following functions are available:
|
200
|
+
- swap_btc_usd
|
201
|
+
- swap_usd_btc
|
130
202
|
|
131
203
|
### Webhook Authentication
|
132
204
|
|
133
|
-
- You simply check to see if your webhook requests returns the appropriate body by simply doing this
|
205
|
+
- You simply check to see if your webhook requests returns the appropriate body by simply doing this
|
134
206
|
|
135
|
-
```ruby
|
207
|
+
```ruby
|
136
208
|
|
137
209
|
require 'bitnob'
|
138
210
|
|
139
211
|
check_webhook = webhook_authentication(requests) # return true or false
|
140
212
|
```
|
141
213
|
|
142
|
-
|
214
|
+
## Important Note
|
143
215
|
|
144
216
|
- it is important that response from each function returns both the response headers, body and status code. To work with only the reponse body simply call the `BODY` object after each function call :
|
145
217
|
|
@@ -154,18 +226,16 @@ By default the package assumes that you are currently working using a sandbox cr
|
|
154
226
|
|
155
227
|
```
|
156
228
|
|
157
|
-
## Development
|
229
|
+
## Development
|
158
230
|
|
159
231
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run rake spec to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
160
232
|
|
161
233
|
To install this gem onto your local machine, run `bundle install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.
|
162
234
|
|
235
|
+
## Contributing
|
163
236
|
|
164
|
-
|
165
|
-
|
166
|
-
Bug reports and pull requests are welcome on GitHub at [https://github.com/bitnob/bitnob_ruby_SDK](https://github.com/bitnob/bitnob_ruby_SDK). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct. Simply create a new branch and raise a Pull Request, we would review and merge.
|
237
|
+
Bug reports and pull requests are welcome on GitHub at [https://github.com/bitnob/bitnob_ruby_SDK](https://github.com/bitnob/bitnob_ruby_SDK). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct. Simply create a new branch and raise a Pull Request, we would review and merge.
|
167
238
|
|
168
239
|
## License
|
169
240
|
|
170
241
|
The gem is available as open source under the terms of the [BSD License](https://opensource.org/licenses/BSD-3-Clause)
|
171
|
-
|
data/bitnob.gemspec
CHANGED
@@ -26,12 +26,12 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.metadata['changelog_uri'] = spec.homepage
|
27
27
|
|
28
28
|
# Dev dependencies
|
29
|
-
spec.add_development_dependency 'bundler'
|
30
|
-
spec.add_development_dependency 'rake'
|
31
|
-
spec.add_development_dependency 'rspec'
|
32
|
-
spec.add_development_dependency 'rubocop'
|
33
|
-
spec.add_development_dependency 'rubocop-performance'
|
34
|
-
spec.add_development_dependency 'rubocop-rspec'
|
29
|
+
spec.add_development_dependency 'bundler', '~> 2.3'
|
30
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
31
|
+
spec.add_development_dependency 'rspec', '~> 3.11'
|
32
|
+
spec.add_development_dependency 'rubocop', '~> 1.25'
|
33
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.13'
|
34
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.9'
|
35
35
|
|
36
36
|
# Dependencies
|
37
37
|
spec.required_ruby_version = '>= 2.5.0'
|
@@ -34,7 +34,7 @@ class Checkout < Base
|
|
34
34
|
# limit : int
|
35
35
|
# order: string ASC or DESC
|
36
36
|
|
37
|
-
def
|
37
|
+
def list_checkouts(page=1, limit=10, order='ASC')
|
38
38
|
get_request("#{base_url}#{BaseEndpoints::CHECKOUT}/?order=#{order}&page=#{page}&limit=#{limit}")
|
39
39
|
|
40
40
|
end
|
@@ -83,4 +83,41 @@ class Lightning < Base
|
|
83
83
|
|
84
84
|
post_request("#{base_url}#{BaseEndpoints::LN}/getinvoice", payload)
|
85
85
|
end
|
86
|
+
|
87
|
+
# - Ln Pay
|
88
|
+
#
|
89
|
+
# - Required Function Parameters
|
90
|
+
# data: {
|
91
|
+
# request: "string",
|
92
|
+
# reference: "string",
|
93
|
+
# customerEmail: "string",
|
94
|
+
# description: "string"
|
95
|
+
# }
|
96
|
+
|
97
|
+
def ln_pay(data)
|
98
|
+
payload = data.to_json
|
99
|
+
post_request("#{base_url}#{BaseEndpoints::LN}/pay", payload)
|
100
|
+
end
|
101
|
+
|
102
|
+
# - Probe For Route
|
103
|
+
#
|
104
|
+
# - Required Function Parameters
|
105
|
+
# data: {
|
106
|
+
# destination: "string",
|
107
|
+
# tokens: "string",
|
108
|
+
# total_mtokens: 0,
|
109
|
+
# payment: "string"
|
110
|
+
# }
|
111
|
+
|
112
|
+
def probe_for_route(data)
|
113
|
+
payload = data.to_json
|
114
|
+
post_request("#{base_url}#{BaseEndpoints::LN}/probeforroute", payload)
|
115
|
+
end
|
116
|
+
|
117
|
+
# - Probe Route
|
118
|
+
#
|
119
|
+
def probe_route()
|
120
|
+
payload= {}
|
121
|
+
post_request("#{base_url}#{BaseEndpoints::LN}/proberoute", paylod.to_json)
|
122
|
+
end
|
86
123
|
end
|
@@ -0,0 +1,148 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'base/base'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
|
7
|
+
class LNURL < Base
|
8
|
+
# Create Lightning URL & LN address
|
9
|
+
#
|
10
|
+
# - Required Function Parameters:
|
11
|
+
#
|
12
|
+
#
|
13
|
+
# data: {
|
14
|
+
# identifier: string,
|
15
|
+
# identifierType: string,
|
16
|
+
# customerEmail: string,
|
17
|
+
# tld: string,
|
18
|
+
# image: string #jpg,png,svg url link
|
19
|
+
# description: string,
|
20
|
+
# satMinSendable: int
|
21
|
+
# satMaxSendable: int
|
22
|
+
# }
|
23
|
+
|
24
|
+
def create(data)
|
25
|
+
required_parameters = %w[identifier identifierType tld image customerEmail description satMinSendable satMaxSendable]
|
26
|
+
|
27
|
+
checked_passed_parameters(required_parameters, data)
|
28
|
+
payload = data.to_json
|
29
|
+
post_request("#{base_url}#{BaseEndpoints::LNURL}", payload)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Decoding LN URL
|
33
|
+
#
|
34
|
+
# - Required Function Parameters:
|
35
|
+
# encoded_ln_url: string
|
36
|
+
def decode_lnurl(encoded_ln_url)
|
37
|
+
payload = {encodedLnUrl: encoded_ln_url}
|
38
|
+
post_request("#{base_url}#{BaseEndpoints::LNURL}", payload.to_json)
|
39
|
+
end
|
40
|
+
|
41
|
+
# PAY LNURL
|
42
|
+
#
|
43
|
+
# - Required Function Parameters:
|
44
|
+
#
|
45
|
+
#
|
46
|
+
# data: {
|
47
|
+
#
|
48
|
+
# encodedLnUrl: string,
|
49
|
+
# customerEmail: string,
|
50
|
+
# satoshis: int,
|
51
|
+
# reference: string,
|
52
|
+
# comment: string // optional
|
53
|
+
# }
|
54
|
+
def pay_lnurl(data)
|
55
|
+
required_parameters = %w[encodedLnUrl customerEmail satoshis reference ]
|
56
|
+
checked_passed_parameters(required_parameters, data)
|
57
|
+
payload = data.to_json
|
58
|
+
post_request("#{base_url}#{BaseEndpoints::LNURL}/paylnurl", payload)
|
59
|
+
end
|
60
|
+
|
61
|
+
# CREATE LN WITHDRAWAL
|
62
|
+
#
|
63
|
+
# - Required Function Parameters:
|
64
|
+
#
|
65
|
+
#
|
66
|
+
# data: {
|
67
|
+
#
|
68
|
+
# customerEmail: string,
|
69
|
+
# satoshis: int,
|
70
|
+
# description: string,
|
71
|
+
# }
|
72
|
+
def ln_withdrawal(data)
|
73
|
+
required_parameters = %w[description customerEmail satoshis ]
|
74
|
+
checked_passed_parameters(required_parameters, data)
|
75
|
+
payload = data.to_json
|
76
|
+
post_request("#{base_url}#{BaseEndpoints::LNURL}/createLnUrlWithdrawal", payload)
|
77
|
+
end
|
78
|
+
|
79
|
+
# DECODE LN ADDRESS
|
80
|
+
#
|
81
|
+
# - Required Function Parameters:
|
82
|
+
#
|
83
|
+
#
|
84
|
+
# data: {
|
85
|
+
#
|
86
|
+
# lnAddress: string,
|
87
|
+
# }
|
88
|
+
def decode_ln_address(data)
|
89
|
+
required_parameters = %w[lnAddress]
|
90
|
+
checked_passed_parameters(required_parameters, data)
|
91
|
+
payload = data.to_json
|
92
|
+
post_request("#{base_url}#{BaseEndpoints::LNURL}/decodelnaddress", payload)
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
# PAY LIGHTNING ADDRESS
|
97
|
+
#
|
98
|
+
# - Required Function Parameters:
|
99
|
+
#
|
100
|
+
#
|
101
|
+
# data: {
|
102
|
+
# lnAddress: string,
|
103
|
+
# customerEmail: string,
|
104
|
+
# satoshis: int,
|
105
|
+
# reference: string
|
106
|
+
# }
|
107
|
+
def pay_ln_address(data)
|
108
|
+
required_parameters = %w[lnAddress customerEmail satoshis reference ]
|
109
|
+
checked_passed_parameters(required_parameters, data)
|
110
|
+
payload = data.to_json
|
111
|
+
post_request("#{base_url}#{BaseEndpoints::LNURL}/paylnaddress", payload)
|
112
|
+
end
|
113
|
+
|
114
|
+
# get all lnurls
|
115
|
+
def get_lnurls()
|
116
|
+
get_request("#{base_url}#{BaseEndpoints::LNURL}/")
|
117
|
+
end
|
118
|
+
|
119
|
+
# Get lnurl by identifier e.g email, username
|
120
|
+
def get_by_identifier(identifier)
|
121
|
+
get_request("#{base_url}#{BaseEndpoints::LNURL}/fetchlnurl/#{identifier}")
|
122
|
+
end
|
123
|
+
|
124
|
+
# Get lnurl by id
|
125
|
+
def get_id(id)
|
126
|
+
get_request("#{base_url}#{BaseEndpoints::LNURL}/#{id}")
|
127
|
+
end
|
128
|
+
|
129
|
+
# PAY LNURL
|
130
|
+
#
|
131
|
+
# - Required Function Parameters:
|
132
|
+
#
|
133
|
+
# id,
|
134
|
+
# data: {
|
135
|
+
# identifier: string,
|
136
|
+
# customerEmail: string,
|
137
|
+
# tld: string,
|
138
|
+
# image: string #jpg,png,svg url link
|
139
|
+
# description: string,
|
140
|
+
# satMinSendable: int
|
141
|
+
# satMaxSendable: int
|
142
|
+
# }
|
143
|
+
def update_lnurl(id, data)
|
144
|
+
required_parameters = %w[identifier customerEmail tld image description satMinSendable satMinSendable ]
|
145
|
+
checked_passed_parameters(required_parameters, data)
|
146
|
+
put_request("#{base_url}#{BaseEndpoints::LNURL}/#{id}")
|
147
|
+
end
|
148
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require_relative 'base/base'
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
class StableCoin < Base
|
6
|
+
# Sending USDC
|
7
|
+
|
8
|
+
# - Required Parameters
|
9
|
+
|
10
|
+
# data {
|
11
|
+
|
12
|
+
# amount : int
|
13
|
+
# address: string
|
14
|
+
# description: string
|
15
|
+
# chain: "BSC"
|
16
|
+
#
|
17
|
+
# }
|
18
|
+
|
19
|
+
def send_usdc(data)
|
20
|
+
required_parameters = %w[amount address description chain]
|
21
|
+
|
22
|
+
checked_passed_parameters(required_parameters, data)
|
23
|
+
|
24
|
+
payload = data.to_json
|
25
|
+
post_request("#{base_url}#{BaseEndpoints::ONCHAIN}/send-usdc", payload)
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
# Sending USDT
|
30
|
+
|
31
|
+
# - Required Parameters
|
32
|
+
|
33
|
+
# data {
|
34
|
+
|
35
|
+
# amount : int
|
36
|
+
# address: string
|
37
|
+
# description: string
|
38
|
+
# chain: "BSC"
|
39
|
+
#
|
40
|
+
# }
|
41
|
+
|
42
|
+
def send_usdt(data)
|
43
|
+
required_parameters = %w[amount address description chain]
|
44
|
+
|
45
|
+
checked_passed_parameters(required_parameters, data)
|
46
|
+
|
47
|
+
payload = data.to_json
|
48
|
+
post_request("#{base_url}#{BaseEndpoints::ONCHAIN}/send-usdt", payload)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Creating USDC Address
|
52
|
+
|
53
|
+
# - Required Parameters
|
54
|
+
|
55
|
+
# data {
|
56
|
+
|
57
|
+
# label : string
|
58
|
+
# customerEmail: string
|
59
|
+
# chain: "BSC"
|
60
|
+
#
|
61
|
+
# }
|
62
|
+
|
63
|
+
def create_usdc_address(data)
|
64
|
+
required_parameters = %w[label customerEmail chain]
|
65
|
+
|
66
|
+
checked_passed_parameters(required_parameters, data)
|
67
|
+
|
68
|
+
payload = data.to_json
|
69
|
+
post_request("#{base_url}#{BaseEndpoints::ADDRESS}/generate/usdc", payload)
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
# Creating USDT Address
|
74
|
+
|
75
|
+
# - Required Parameters
|
76
|
+
|
77
|
+
# data {
|
78
|
+
|
79
|
+
# label : string
|
80
|
+
# customerEmail: string
|
81
|
+
# chain: "BSC"
|
82
|
+
#
|
83
|
+
# }
|
84
|
+
|
85
|
+
def create_usdt_address(data)
|
86
|
+
required_parameters = %w[label customerEmail chain]
|
87
|
+
|
88
|
+
checked_passed_parameters(required_parameters, data)
|
89
|
+
|
90
|
+
payload = data.to_json
|
91
|
+
post_request("#{base_url}#{BaseEndpoints::ADDRESS}/generate/usdt", payload)
|
92
|
+
end
|
93
|
+
end
|
@@ -20,4 +20,9 @@ class Wallets < Base
|
|
20
20
|
def fetch_transaction(transaction_id)
|
21
21
|
get_request("#{base_url}#{BaseEndpoints::ONCHAIN}/#{transaction_id}")
|
22
22
|
end
|
23
|
+
|
24
|
+
# Recommend btc fees
|
25
|
+
def recommend_btc_fees()
|
26
|
+
get_request("#{base_url}#{BaseEndpoints::ONCHAIN}/recommend-fees/btc")
|
27
|
+
end
|
23
28
|
end
|
data/lib/bitnob/version.rb
CHANGED
data/lib/bitnob.rb
CHANGED
@@ -6,7 +6,8 @@ require_relative 'bitnob/objects/lightning'
|
|
6
6
|
require_relative 'bitnob/objects/onchain'
|
7
7
|
require_relative 'bitnob/objects/wallets'
|
8
8
|
require_relative 'bitnob/objects/swap'
|
9
|
-
require_relative 'bitnob/objects/
|
9
|
+
require_relative 'bitnob/objects/stablecoins'
|
10
|
+
require_relative 'bitnob/objects/lnurl'
|
10
11
|
require_relative 'bitnob/objects/checkout'
|
11
12
|
require_relative 'bitnob/objects/virtual_cards'
|
12
13
|
require_relative 'bitnob/version'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitnob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bitnob
|
@@ -9,92 +9,92 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-02
|
12
|
+
date: 2022-03-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '2.3'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - "
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '2.3'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
34
|
+
version: '13.0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - "
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
41
|
+
version: '13.0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rspec
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "
|
46
|
+
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
48
|
+
version: '3.11'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - "
|
53
|
+
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
55
|
+
version: '3.11'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rubocop
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - "
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
62
|
+
version: '1.25'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '1.25'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rubocop-performance
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - "
|
74
|
+
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
76
|
+
version: '1.13'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - "
|
81
|
+
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
83
|
+
version: '1.13'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: rubocop-rspec
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- - "
|
88
|
+
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: '
|
90
|
+
version: '2.9'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- - "
|
95
|
+
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '
|
97
|
+
version: '2.9'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: dotenv
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -154,9 +154,10 @@ files:
|
|
154
154
|
- lib/bitnob/objects/checkout.rb
|
155
155
|
- lib/bitnob/objects/customer.rb
|
156
156
|
- lib/bitnob/objects/lightning.rb
|
157
|
+
- lib/bitnob/objects/lnurl.rb
|
157
158
|
- lib/bitnob/objects/onchain.rb
|
159
|
+
- lib/bitnob/objects/stablecoins.rb
|
158
160
|
- lib/bitnob/objects/swap.rb
|
159
|
-
- lib/bitnob/objects/usdc.rb
|
160
161
|
- lib/bitnob/objects/utils.rb
|
161
162
|
- lib/bitnob/objects/virtual_cards.rb
|
162
163
|
- lib/bitnob/objects/wallets.rb
|
data/lib/bitnob/objects/usdc.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
require_relative 'base/base'
|
2
|
-
|
3
|
-
require 'json'
|
4
|
-
|
5
|
-
class USDC < Base
|
6
|
-
# Sending USDC
|
7
|
-
|
8
|
-
# - Required Parameters
|
9
|
-
|
10
|
-
# data {
|
11
|
-
|
12
|
-
# amount : int
|
13
|
-
# address: string
|
14
|
-
# description: string
|
15
|
-
#
|
16
|
-
# }
|
17
|
-
|
18
|
-
def send(data)
|
19
|
-
required_parameters = %w[amount, address, description]
|
20
|
-
|
21
|
-
checked_passed_parameters(required_parameters, data)
|
22
|
-
|
23
|
-
payload = data.to_json
|
24
|
-
post_request("#{base_url}#{BaseEndpoints::ONCHAIN}/send-usdc", payload)
|
25
|
-
end
|
26
|
-
|
27
|
-
# Creating Address
|
28
|
-
|
29
|
-
# - Required Parameters
|
30
|
-
|
31
|
-
# data {
|
32
|
-
|
33
|
-
# label : string
|
34
|
-
# customerEmail: string
|
35
|
-
#
|
36
|
-
# }
|
37
|
-
|
38
|
-
def create_address(data)
|
39
|
-
required_parameters = %w[label, customerEmail]
|
40
|
-
|
41
|
-
checked_passed_parameters(required_parameters, data)
|
42
|
-
|
43
|
-
payload = data.to_json
|
44
|
-
post_request("#{base_url}#{BaseEndpoints::ADDRESS}/generate/usdc", payload)
|
45
|
-
end
|
46
|
-
end
|