lbd_sdk 0.1.0 → 0.1.3
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/.github/workflows/push.yml +27 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +3 -0
- data/.vscode/settings.json +7 -1
- data/CHANGELOG.md +15 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +3 -1
- data/README.md +62 -36
- data/lib/lbd_sdk/client.rb +517 -605
- data/lib/lbd_sdk/hash_converter.rb +17 -0
- data/lib/lbd_sdk/http_client.rb +3 -7
- data/lib/lbd_sdk/request.rb +717 -0
- data/lib/lbd_sdk/request_body_flattener.rb +10 -6
- data/lib/lbd_sdk/request_param_validator.rb +31 -0
- data/lib/lbd_sdk/signature_generator.rb +36 -16
- data/lib/lbd_sdk/version.rb +1 -1
- data/lib/lbd_sdk.rb +1 -0
- data/package-lock.json +53 -0
- data/package.json +5 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f464551eba6200365069c1ba80d422a746e0ba869ae0473ef3c919ed82876e73
|
4
|
+
data.tar.gz: 01a2ed334e9f1cdae2525f351354c552e5688faffc6e128782c16bfa827966b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cc3d4d3bec1aad18027755b8e6092543fe2511ffcf91ed039c734f66a5be5cccd784e656b7cd4aa725c92f3755ff39a0cc5e3ad7519aeabeafc72cf5161c66f
|
7
|
+
data.tar.gz: 57ec0a30603dd83e31b75bea1e59df3f53c33d2538eba3fe0691faee920e2101585fa158b10a943d2adc241743ed838379bbc638e710c6e688471ae1d23bf567
|
@@ -0,0 +1,27 @@
|
|
1
|
+
name: Publish Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
release:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
name: Ruby v3.0
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
- name: Install Ruby 3.0
|
15
|
+
uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: 3.0
|
18
|
+
- name: Publish gem to rubygems.org
|
19
|
+
run: |
|
20
|
+
mkdir -p $HOME/.gem
|
21
|
+
touch $HOME/.gem/credentials
|
22
|
+
chmod 0600 $HOME/.gem/credentials
|
23
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
24
|
+
gem build *.gemspec
|
25
|
+
gem push *.gem
|
26
|
+
env:
|
27
|
+
GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_AUTH_TOKEN }}"
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.vscode/settings.json
CHANGED
@@ -2,5 +2,11 @@
|
|
2
2
|
"ruby.useLanguageServer": true,
|
3
3
|
"ruby.useBundler": true,
|
4
4
|
"ruby.format": "rubocop",
|
5
|
-
"ruby.lint": {
|
5
|
+
"ruby.lint": {
|
6
|
+
"rubocop": true
|
7
|
+
},
|
8
|
+
"[ruby]": {
|
9
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
10
|
+
"editor.formatOnSave": true
|
11
|
+
}
|
6
12
|
}
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
# 0.1.3(2022-03-23)
|
2
|
+
|
3
|
+
- Add `GET /v1/item-tokens`.
|
4
|
+
- Add `POST /v1/item-tokens`.
|
5
|
+
- Add `GET /v1/service-tokens/by-txHash/{txHash}`.
|
6
|
+
- Add `POST /v1/service-tokens`.
|
7
|
+
|
8
|
+
# 0.1.2(2021-12-22)
|
9
|
+
|
10
|
+
- Add `GET /v1/users/{userId}/item-tokens/{contractId}/non-fungibles/with-type`.
|
11
|
+
|
12
|
+
# 0.1.1(2021-12-04)
|
13
|
+
|
14
|
+
- Refactor payload handling.
|
15
|
+
|
1
16
|
# 0.1.0(2021-12-03)
|
2
17
|
|
3
18
|
- Implemented all LINE Blockchain Developer API client.
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lbd_sdk (0.1.
|
4
|
+
lbd_sdk (0.1.3)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -16,6 +16,7 @@ GEM
|
|
16
16
|
parallel (1.21.0)
|
17
17
|
parser (3.0.3.1)
|
18
18
|
ast (~> 2.4.1)
|
19
|
+
prettier (2.0.0)
|
19
20
|
public_suffix (4.0.6)
|
20
21
|
rainbow (3.0.0)
|
21
22
|
rake (12.3.3)
|
@@ -57,6 +58,7 @@ PLATFORMS
|
|
57
58
|
|
58
59
|
DEPENDENCIES
|
59
60
|
lbd_sdk!
|
61
|
+
prettier (~> 2.0.0)
|
60
62
|
rake (~> 12.0)
|
61
63
|
rspec (~> 3.0)
|
62
64
|
rubocop (~> 1.12.1)
|
data/README.md
CHANGED
@@ -24,42 +24,60 @@ Or install it yourself as:
|
|
24
24
|
## Usage
|
25
25
|
|
26
26
|
```ruby
|
27
|
-
client =
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
27
|
+
client =
|
28
|
+
LbdSdk::Client.new do |config|
|
29
|
+
config.endpoint = 'https://test-api.blockchain.line.me'
|
30
|
+
config.api_key = 'your_api_key'
|
31
|
+
config.api_secret_key = 'your_secret_key'
|
32
|
+
end
|
33
|
+
|
34
|
+
client.time
|
35
|
+
|
36
|
+
client.user_detail('<your-user-id>')
|
37
|
+
|
38
|
+
client.user_transactions('<your-user-id>', { page: 1, limit: 1 })
|
39
|
+
|
40
|
+
client.create_non_fungible_token(
|
41
|
+
'<contract_id>',
|
42
|
+
{
|
43
|
+
owner_address: 'owner_address',
|
44
|
+
owner_secret: 'owner_secret',
|
45
|
+
name: 'SampleToken',
|
46
|
+
},
|
47
|
+
)
|
48
|
+
|
49
|
+
client.mint_non_fungible_token(
|
50
|
+
'contract_id',
|
51
|
+
'token_type',
|
52
|
+
{
|
53
|
+
owner_address: 'owner_address',
|
54
|
+
owner_secret: 'owner_secret',
|
55
|
+
name: 'SampleToken',
|
56
|
+
to_user_id: 'yout-user-id',
|
57
|
+
},
|
58
|
+
)
|
59
|
+
|
60
|
+
client.update_non_fungible_token(
|
61
|
+
'contract_id',
|
62
|
+
'token_type',
|
63
|
+
'token_index',
|
64
|
+
{
|
65
|
+
owner_address: 'owner_address',
|
66
|
+
owner_secret: 'owner_secret',
|
67
|
+
name: 'SampleToken2',
|
68
|
+
},
|
69
|
+
)
|
70
|
+
|
71
|
+
client.burn_non_fungible_token(
|
72
|
+
'contract_id',
|
73
|
+
'token_type',
|
74
|
+
'token_index',
|
75
|
+
{
|
76
|
+
owner_address: 'owner_address',
|
77
|
+
owner_secret: 'owner_secret',
|
78
|
+
from_user_id: 'yout-user-id',
|
79
|
+
},
|
80
|
+
)
|
63
81
|
```
|
64
82
|
|
65
83
|
## TODO
|
@@ -67,15 +85,19 @@ client.burn_non_fungible_token("contract_id", "token_type", "token_index", {
|
|
67
85
|
- [x] GET /v1/services/{serviceId}
|
68
86
|
- [x] GET /v1/service-tokens/
|
69
87
|
- [x] GET /v1/service-tokens/{contractId}
|
88
|
+
- [x] GET /v1/service-tokens/by-txHash/{txHash}
|
70
89
|
- [x] PUT /v1/service-tokens/{contractId}
|
71
90
|
- [x] POST /v1/service-tokens/{contractId}/mint
|
72
91
|
- [x] POST /v1/service-tokens/{contractId}/burn-from
|
92
|
+
- [x] POST /v1/service-tokens
|
73
93
|
- [x] GET /v1/service-tokens/{contractId}/holders
|
74
94
|
- [x] GET /v1/item-tokens/{contractId}
|
75
95
|
- [x] GET /v1/item-tokens/{contractId}/fungibles
|
76
96
|
- [x] GET /v1/item-tokens/{contractId}/fungibles/{tokenType}
|
77
97
|
- [x] GET /v1/item-tokens/{contractId}/fungibles/{tokenType}/holders
|
78
98
|
- [x] GET /v1/item-tokens/{contractId}/non-fungibles
|
99
|
+
- [x] POST /v1/item-tokens
|
100
|
+
- [x] GET /v1/item-tokens
|
79
101
|
- [x] GET /v1/item-tokens/{contractId}/non-fungibles/{tokenType}
|
80
102
|
- [x] GET /v1/item-tokens/{contractId}/non-fungibles/{tokenType}/{tokenIndex}
|
81
103
|
- [x] GET /v1/item-tokens/{contractId}/non-fungibles/{tokenType}/holders
|
@@ -108,6 +130,7 @@ client.burn_non_fungible_token("contract_id", "token_type", "token_index", {
|
|
108
130
|
- [x] GET /v1/users/{userId}/item-tokens/{contractId}/fungibles
|
109
131
|
- [x] GET /v1/users/{userId}/item-tokens/{contractId}/fungibles/{tokenType}
|
110
132
|
- [x] GET /v1/users/{userId}/item-tokens/{contractId}/non-fungibles
|
133
|
+
- [x] GET /v1/users/{userId}/item-tokens/{contractId}/non-fungibles/with-type
|
111
134
|
- [x] GET /v1/users/{userId}/item-tokens/{contractId}/non-fungibles/{tokenType}
|
112
135
|
- [x] GET /v1/users/{userId}/item-tokens/{contractId}/non-fungibles/{tokenType}/{tokenIndex}
|
113
136
|
- [x] GET /v1/user-requests/{requestSessionToken}
|
@@ -142,11 +165,14 @@ client.burn_non_fungible_token("contract_id", "token_type", "token_index", {
|
|
142
165
|
- [x] GET /v1/memos/{txHash}
|
143
166
|
- [x] GET /v1/time
|
144
167
|
- [x] GET /v1/transactions/{txHash}
|
168
|
+
- [ ] API payloads test. All payloads at least should be checked if the inputs are required or optional.
|
145
169
|
|
146
170
|
## Development
|
147
171
|
|
148
172
|
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.
|
149
173
|
|
174
|
+
To work prettier, run `npm i -D @prettier/plugin-ruby`.
|
175
|
+
|
150
176
|
To install this gem onto your local machine, run `bundle exec rake 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](https://rubygems.org).
|
151
177
|
|
152
178
|
## Contributing
|