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.
@@ -1,9 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'base64'
4
- require 'net/http'
5
- require 'openssl'
6
- require 'uri'
3
+ require 'lbd_sdk/request'
7
4
 
8
5
  module LbdSdk
9
6
  # Client for the LINE Blockchain API
@@ -14,14 +11,14 @@ module LbdSdk
14
11
  # config.api_secret_key = 'your_secret_key'
15
12
  # end
16
13
  class Client
14
+ include Request
15
+
17
16
  attr_accessor :endpoint, :api_key, :api_secret_key
18
17
 
19
18
  DEFAULT_ENDPOINT = 'https://test-api.blockchain.line.me/'
20
19
 
21
20
  def initialize(options = {})
22
- options.each do |key, value|
23
- instance_variable_set("@#{key}", value)
24
- end
21
+ options.each { |key, value| instance_variable_set("@#{key}", value) }
25
22
  yield(self) if block_given?
26
23
 
27
24
  @endpoint ||= DEFAULT_ENDPOINT
@@ -36,7 +33,10 @@ module LbdSdk
36
33
  end
37
34
 
38
35
  def user_transactions(user_id, query_params = {})
39
- get("/v1/users/#{user_id}/transactions", query_params: transaction_page_request(query_params))
36
+ get(
37
+ "/v1/users/#{user_id}/transactions",
38
+ query_params: transaction_page_request(query_params),
39
+ )
40
40
  end
41
41
 
42
42
  def base_coin_balance_of_user(user_id)
@@ -44,7 +44,10 @@ module LbdSdk
44
44
  end
45
45
 
46
46
  def service_token_balances_of_user(user_id, query_params = {})
47
- get("/v1/users/#{user_id}/service-tokens", query_params: page_request(query_params))
47
+ get(
48
+ "/v1/users/#{user_id}/service-tokens",
49
+ query_params: page_request(query_params),
50
+ )
48
51
  end
49
52
 
50
53
  def service_token_balance_of_user(user_id, contract_id)
@@ -52,43 +55,124 @@ module LbdSdk
52
55
  end
53
56
 
54
57
  def fungible_token_balances_of_user(user_id, contractId, query_params = {})
55
- get("/v1/users/#{user_id}/item-tokens/#{contractId}/fungibles", query_params: page_request(query_params))
58
+ get(
59
+ "/v1/users/#{user_id}/item-tokens/#{contractId}/fungibles",
60
+ query_params: page_request(query_params),
61
+ )
56
62
  end
57
63
 
58
64
  def fungible_token_balance_of_user(user_id, contractId, token_type)
59
- get("/v1/users/#{user_id}/item-tokens/#{contractId}/fungibles/#{token_type}")
60
- end
61
-
62
- def non_fungible_token_balances_of_user(user_id, contractId, query_params = {})
63
- get("/v1/users/#{user_id}/item-tokens/#{contractId}/non-fungibles", query_params: page_request(query_params))
64
- end
65
-
66
- def non_fungible_token_balances_by_type_of_user(user_id, contractId, token_type, query_params = {})
67
- get("/v1/users/#{user_id}/item-tokens/#{contractId}/non-fungibles/#{token_type}", query_params: page_request(query_params))
68
- end
69
-
70
- def non_fungible_token_balance_of_user(user_id, contractId, token_type, token_index)
71
- get("/v1/users/#{user_id}/item-tokens/#{contractId}/non-fungibles/#{token_type}/#{token_index}")
65
+ get(
66
+ "/v1/users/#{user_id}/item-tokens/#{contractId}/fungibles/#{token_type}",
67
+ )
68
+ end
69
+
70
+ def non_fungible_token_balances_of_user(
71
+ user_id,
72
+ contractId,
73
+ query_params = {}
74
+ )
75
+ get(
76
+ "/v1/users/#{user_id}/item-tokens/#{contractId}/non-fungibles",
77
+ query_params: page_request(query_params),
78
+ )
79
+ end
80
+
81
+ def non_fungible_token_balances_with_type_of_user(
82
+ user_id,
83
+ contractId,
84
+ query_params = {}
85
+ )
86
+ get(
87
+ "/v1/users/#{user_id}/item-tokens/#{contractId}/non-fungibles/with-type",
88
+ query_params: cursor_page_request(query_params),
89
+ )
90
+ end
91
+
92
+ def non_fungible_token_balances_by_type_of_user(
93
+ user_id,
94
+ contractId,
95
+ token_type,
96
+ query_params = {}
97
+ )
98
+ get(
99
+ "/v1/users/#{user_id}/item-tokens/#{contractId}/non-fungibles/#{token_type}",
100
+ query_params: page_request(query_params),
101
+ )
102
+ end
103
+
104
+ def non_fungible_token_balance_of_user(
105
+ user_id,
106
+ contractId,
107
+ token_type,
108
+ token_index
109
+ )
110
+ get(
111
+ "/v1/users/#{user_id}/item-tokens/#{contractId}/non-fungibles/#{token_type}/#{token_index}",
112
+ )
72
113
  end
73
114
 
74
115
  def retrieve_session_token_status(request_session_token)
75
116
  get("/v1/user-requests/#{request_session_token}")
76
117
  end
77
118
 
78
- def issue_session_token_for_base_coin_transfer(user_id, request_type, payload = {})
79
- post("/v1/users/#{user_id}/base-coin/request-transfer", query_params: {requestType: request_type}, payload: issue_transfer_session_token_request(payload))
80
- end
81
-
82
- def issue_session_token_for_service_token_transfer(user_id, contract_id, request_type, payload = {})
83
- post("/v1/users/#{user_id}/service-tokens/#{contract_id}/request-transfer", query_params: {requestType: request_type}, payload: issue_transfer_session_token_request(payload))
84
- end
85
-
86
- def issue_service_token_proxy_request(user_id, contract_id, request_type, payload = {})
87
- post("/v1/users/#{user_id}/service-tokens/#{contract_id}/request-proxy", query_params: {requestType: request_type}, payload: user_proxy_request(payload))
88
- end
89
-
90
- def issue_item_token_proxy_request(user_id, contract_id, request_type, payload = {})
91
- post("/v1/users/#{user_id}/item-tokens/#{contract_id}/request-proxy", query_params: {requestType: request_type}, payload: user_proxy_request(payload))
119
+ def issue_session_token_for_base_coin_transfer(
120
+ user_id,
121
+ request_type,
122
+ payload = {}
123
+ )
124
+ post(
125
+ "/v1/users/#{user_id}/base-coin/request-transfer",
126
+ query_params: {
127
+ requestType: request_type,
128
+ },
129
+ payload: issue_transfer_session_token_request(payload),
130
+ )
131
+ end
132
+
133
+ def issue_session_token_for_service_token_transfer(
134
+ user_id,
135
+ contract_id,
136
+ request_type,
137
+ payload = {}
138
+ )
139
+ post(
140
+ "/v1/users/#{user_id}/service-tokens/#{contract_id}/request-transfer",
141
+ query_params: {
142
+ requestType: request_type,
143
+ },
144
+ payload: issue_transfer_session_token_request(payload),
145
+ )
146
+ end
147
+
148
+ def issue_service_token_proxy_request(
149
+ user_id,
150
+ contract_id,
151
+ request_type,
152
+ payload = {}
153
+ )
154
+ post(
155
+ "/v1/users/#{user_id}/service-tokens/#{contract_id}/request-proxy",
156
+ query_params: {
157
+ requestType: request_type,
158
+ },
159
+ payload: user_proxy_request(payload),
160
+ )
161
+ end
162
+
163
+ def issue_item_token_proxy_request(
164
+ user_id,
165
+ contract_id,
166
+ request_type,
167
+ payload = {}
168
+ )
169
+ post(
170
+ "/v1/users/#{user_id}/item-tokens/#{contract_id}/request-proxy",
171
+ query_params: {
172
+ requestType: request_type,
173
+ },
174
+ payload: user_proxy_request(payload),
175
+ )
92
176
  end
93
177
 
94
178
  def commit_proxy_request(request_session_token)
@@ -96,19 +180,46 @@ module LbdSdk
96
180
  end
97
181
 
98
182
  def transfer_service_token_of_user(user_id, contract_id, payload = {})
99
- post("/v1/users/#{user_id}/service-tokens/#{contract_id}/transfer", payload: transfer_service_token_proxy_request(payload))
100
- end
101
-
102
- def transfer_fungible_token_of_user(user_id, contract_id, token_type, payload = {})
103
- post("/v1/users/#{user_id}/item-tokens/#{contract_id}/fungibles/#{token_type}/transfer", payload: transfer_fungible_token_proxy_request(payload))
104
- end
105
-
106
- def transfer_non_fungible_token_of_user(user_id, contract_id, token_type, token_index, payload = {})
107
- post("/v1/users/#{user_id}/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/transfer", payload: transfer_non_fungible_token_proxy_request(payload))
108
- end
109
-
110
- def batch_transfer_non_fungible_token_of_user(user_id, contract_id, payload = {})
111
- post("/v1/users/#{user_id}/item-tokens/#{contract_id}/non-fungibles/batch-transfer", payload: batch_transfer_non_fungible_token_proxy_request(payload))
183
+ post(
184
+ "/v1/users/#{user_id}/service-tokens/#{contract_id}/transfer",
185
+ payload: transfer_service_token_proxy_request(payload),
186
+ )
187
+ end
188
+
189
+ def transfer_fungible_token_of_user(
190
+ user_id,
191
+ contract_id,
192
+ token_type,
193
+ payload = {}
194
+ )
195
+ post(
196
+ "/v1/users/#{user_id}/item-tokens/#{contract_id}/fungibles/#{token_type}/transfer",
197
+ payload: transfer_fungible_token_proxy_request(payload),
198
+ )
199
+ end
200
+
201
+ def transfer_non_fungible_token_of_user(
202
+ user_id,
203
+ contract_id,
204
+ token_type,
205
+ token_index,
206
+ payload = {}
207
+ )
208
+ post(
209
+ "/v1/users/#{user_id}/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/transfer",
210
+ payload: transfer_non_fungible_token_proxy_request(payload),
211
+ )
212
+ end
213
+
214
+ def batch_transfer_non_fungible_token_of_user(
215
+ user_id,
216
+ contract_id,
217
+ payload = {}
218
+ )
219
+ post(
220
+ "/v1/users/#{user_id}/item-tokens/#{contract_id}/non-fungibles/batch-transfer",
221
+ payload: batch_transfer_non_fungible_token_proxy_request(payload),
222
+ )
112
223
  end
113
224
 
114
225
  def service_token_proxy_status_of_user(user_id, contract_id)
@@ -128,7 +239,10 @@ module LbdSdk
128
239
  end
129
240
 
130
241
  def wallet_transactions(wallet_address, query_params = {})
131
- get("/v1/wallets/#{wallet_address}/transactions", query_params: transaction_page_request(query_params))
242
+ get(
243
+ "/v1/wallets/#{wallet_address}/transactions",
244
+ query_params: transaction_page_request(query_params),
245
+ )
132
246
  end
133
247
 
134
248
  def base_coin_balance_of_wallet(wallet_address)
@@ -136,51 +250,123 @@ module LbdSdk
136
250
  end
137
251
 
138
252
  def service_token_balances_of_wallet(wallet_address, query_params = {})
139
- get("/v1/wallets/#{wallet_address}/service-tokens", query_params: page_request(query_params))
253
+ get(
254
+ "/v1/wallets/#{wallet_address}/service-tokens",
255
+ query_params: page_request(query_params),
256
+ )
140
257
  end
141
258
 
142
259
  def service_token_balance_of_wallet(wallet_address, contract_id)
143
260
  get("/v1/wallets/#{wallet_address}/service-tokens/#{contract_id}")
144
261
  end
145
262
 
146
- def fungible_token_balances_of_wallet(wallet_address, contract_id, query_params = {})
147
- get("/v1/wallets/#{wallet_address}/item-tokens/#{contract_id}/fungibles", query_params: page_request(query_params))
148
- end
149
-
150
- def fungible_token_balance_of_wallet(wallet_address, contract_id, token_type)
151
- get("/v1/wallets/#{wallet_address}/item-tokens/#{contract_id}/fungibles/#{token_type}")
152
- end
153
-
154
- def non_fungible_token_balances_of_wallet(wallet_address, contract_id, query_params = {})
155
- get("/v1/wallets/#{wallet_address}/item-tokens/#{contract_id}/non-fungibles", query_params: page_request(query_params))
156
- end
157
-
158
- def non_fungible_token_balances_by_type_of_wallet(wallet_address, contract_id, token_type, query_params = {})
159
- get("/v1/wallets/#{wallet_address}/item-tokens/#{contract_id}/non-fungibles/#{token_type}", query_params: page_request(query_params))
160
- end
161
-
162
- def non_fungible_token_balance_of_wallet(wallet_address, contract_id, token_type, token_index)
163
- get("/v1/wallets/#{wallet_address}/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}")
263
+ def fungible_token_balances_of_wallet(
264
+ wallet_address,
265
+ contract_id,
266
+ query_params = {}
267
+ )
268
+ get(
269
+ "/v1/wallets/#{wallet_address}/item-tokens/#{contract_id}/fungibles",
270
+ query_params: page_request(query_params),
271
+ )
272
+ end
273
+
274
+ def fungible_token_balance_of_wallet(
275
+ wallet_address,
276
+ contract_id,
277
+ token_type
278
+ )
279
+ get(
280
+ "/v1/wallets/#{wallet_address}/item-tokens/#{contract_id}/fungibles/#{token_type}",
281
+ )
282
+ end
283
+
284
+ def non_fungible_token_balances_of_wallet(
285
+ wallet_address,
286
+ contract_id,
287
+ query_params = {}
288
+ )
289
+ get(
290
+ "/v1/wallets/#{wallet_address}/item-tokens/#{contract_id}/non-fungibles",
291
+ query_params: page_request(query_params),
292
+ )
293
+ end
294
+
295
+ def non_fungible_token_balances_by_type_of_wallet(
296
+ wallet_address,
297
+ contract_id,
298
+ token_type,
299
+ query_params = {}
300
+ )
301
+ get(
302
+ "/v1/wallets/#{wallet_address}/item-tokens/#{contract_id}/non-fungibles/#{token_type}",
303
+ query_params: page_request(query_params),
304
+ )
305
+ end
306
+
307
+ def non_fungible_token_balance_of_wallet(
308
+ wallet_address,
309
+ contract_id,
310
+ token_type,
311
+ token_index
312
+ )
313
+ get(
314
+ "/v1/wallets/#{wallet_address}/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}",
315
+ )
164
316
  end
165
317
 
166
318
  def transfer_base_coin_of_wallet(wallet_address, payload = {})
167
- post("/v1/wallets/#{wallet_address}/base-coin/transfer", payload: transfer_base_coin_request(payload))
168
- end
169
-
170
- def transfer_service_token_of_wallet(wallet_address, contract_id, payload = {})
171
- post("/v1/wallets/#{wallet_address}/service-tokens/#{contract_id}/transfer", payload: transfer_service_token_request(payload))
172
- end
173
-
174
- def transfer_fungible_token_of_wallet(wallet_address, contract_id, token_type, payload = {})
175
- post("/v1/wallets/#{wallet_address}/item-tokens/#{contract_id}/fungibles/#{token_type}/transfer", payload: transfer_fungible_token_request(payload))
176
- end
177
-
178
- def transfer_non_fungible_token_of_wallet(wallet_address, contract_id, token_type, token_index, payload = {})
179
- post("/v1/wallets/#{wallet_address}/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/transfer", payload: transfer_non_fungible_token_request(payload))
180
- end
181
-
182
- def batch_transfer_non_fungible_token_of_wallet(wallet_address, contract_id, payload = {})
183
- post("/v1/wallets/#{wallet_address}/item-tokens/#{contract_id}/non-fungibles/batch-transfer", payload: batch_transfer_non_fungible_token_request(payload))
319
+ post(
320
+ "/v1/wallets/#{wallet_address}/base-coin/transfer",
321
+ payload: transfer_base_coin_request(payload),
322
+ )
323
+ end
324
+
325
+ def transfer_service_token_of_wallet(
326
+ wallet_address,
327
+ contract_id,
328
+ payload = {}
329
+ )
330
+ post(
331
+ "/v1/wallets/#{wallet_address}/service-tokens/#{contract_id}/transfer",
332
+ payload: transfer_service_token_request(payload),
333
+ )
334
+ end
335
+
336
+ def transfer_fungible_token_of_wallet(
337
+ wallet_address,
338
+ contract_id,
339
+ token_type,
340
+ payload = {}
341
+ )
342
+ post(
343
+ "/v1/wallets/#{wallet_address}/item-tokens/#{contract_id}/fungibles/#{token_type}/transfer",
344
+ payload: transfer_fungible_token_request(payload),
345
+ )
346
+ end
347
+
348
+ def transfer_non_fungible_token_of_wallet(
349
+ wallet_address,
350
+ contract_id,
351
+ token_type,
352
+ token_index,
353
+ payload = {}
354
+ )
355
+ post(
356
+ "/v1/wallets/#{wallet_address}/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/transfer",
357
+ payload: transfer_non_fungible_token_request(payload),
358
+ )
359
+ end
360
+
361
+ def batch_transfer_non_fungible_token_of_wallet(
362
+ wallet_address,
363
+ contract_id,
364
+ payload = {}
365
+ )
366
+ post(
367
+ "/v1/wallets/#{wallet_address}/item-tokens/#{contract_id}/non-fungibles/batch-transfer",
368
+ payload: batch_transfer_non_fungible_token_request(payload),
369
+ )
184
370
  end
185
371
 
186
372
  def service_detail(service_id)
@@ -195,20 +381,57 @@ module LbdSdk
195
381
  get("/v1/service-tokens/#{contract_id}")
196
382
  end
197
383
 
384
+ def issue_service_token(payload)
385
+ post('/v1/service-tokens', payload: issue_service_token_request(payload))
386
+ end
387
+
388
+ def issued_service_token_by_tx_hash(tx_hash, query_params = {})
389
+ get(
390
+ "/v1/service-tokens/by-txHash/#{tx_hash}",
391
+ query_params: issued_service_token_by_tx_hash_request(query_params),
392
+ )
393
+ end
394
+
198
395
  def update_service_token(contract_id, payload = {})
199
- put("/v1/service-tokens/#{contract_id}", payload: update_service_token_request(payload))
396
+ put(
397
+ "/v1/service-tokens/#{contract_id}",
398
+ payload: update_service_token_request(payload),
399
+ )
200
400
  end
201
401
 
202
402
  def mint_service_token(contract_id, payload = {})
203
- post("/v1/service-tokens/#{contract_id}/mint", payload: mint_service_token_request(payload))
403
+ post(
404
+ "/v1/service-tokens/#{contract_id}/mint",
405
+ payload: mint_service_token_request(payload),
406
+ )
204
407
  end
205
408
 
206
409
  def burn_from_service_token(contract_id, payload = {})
207
- post("/v1/service-tokens/#{contract_id}/burn-from", payload: burn_from_service_token_request(payload))
410
+ post(
411
+ "/v1/service-tokens/#{contract_id}/burn-from",
412
+ payload: burn_from_service_token_request(payload),
413
+ )
208
414
  end
209
415
 
210
416
  def service_token_holders(contract_id, query_params = {})
211
- get("/v1/service-tokens/#{contract_id}/holders", query_params: page_request(query_params))
417
+ get(
418
+ "/v1/service-tokens/#{contract_id}/holders",
419
+ query_params: page_request(query_params),
420
+ )
421
+ end
422
+
423
+ def create_item_token_contract(payload)
424
+ post(
425
+ '/v1/item-tokens',
426
+ payload: create_item_token_contract_request(payload),
427
+ )
428
+ end
429
+
430
+ def created_item_token_contract(query_params = {})
431
+ get(
432
+ '/v1/item-tokens',
433
+ query_params: created_item_token_contract_request(query_params),
434
+ )
212
435
  end
213
436
 
214
437
  def item_token(contract_id)
@@ -216,19 +439,31 @@ module LbdSdk
216
439
  end
217
440
 
218
441
  def fungible_tokens(contract_id, query_params = {})
219
- get("/v1/item-tokens/#{contract_id}/fungibles", query_params: page_request(query_params))
442
+ get(
443
+ "/v1/item-tokens/#{contract_id}/fungibles",
444
+ query_params: page_request(query_params),
445
+ )
220
446
  end
221
447
 
222
448
  def create_fungible_token(contract_id, payload = {})
223
- post("/v1/item-tokens/#{contract_id}/fungibles", payload: fungible_token_create_update_request(payload))
449
+ post(
450
+ "/v1/item-tokens/#{contract_id}/fungibles",
451
+ payload: fungible_token_create_update_request(payload),
452
+ )
224
453
  end
225
454
 
226
455
  def mint_fungible_token(contract_id, token_type, payload = {})
227
- post("/v1/item-tokens/#{contract_id}/fungibles/#{token_type}/mint", payload: fungible_token_mint_request(payload))
456
+ post(
457
+ "/v1/item-tokens/#{contract_id}/fungibles/#{token_type}/mint",
458
+ payload: fungible_token_mint_request(payload),
459
+ )
228
460
  end
229
461
 
230
462
  def burn_fungible_token(contract_id, token_type, payload = {})
231
- post("/v1/item-tokens/#{contract_id}/fungibles/#{token_type}/burn", payload: fungible_token_burn_request(payload))
463
+ post(
464
+ "/v1/item-tokens/#{contract_id}/fungibles/#{token_type}/burn",
465
+ payload: fungible_token_burn_request(payload),
466
+ )
232
467
  end
233
468
 
234
469
  def fungible_token(contract_id, token_type)
@@ -236,80 +471,166 @@ module LbdSdk
236
471
  end
237
472
 
238
473
  def update_fungible_token(contract_id, token_type, payload = {})
239
- put("/v1/item-tokens/#{contract_id}/fungibles/#{token_type}", payload: fungible_token_create_update_request(payload))
474
+ put(
475
+ "/v1/item-tokens/#{contract_id}/fungibles/#{token_type}",
476
+ payload: fungible_token_create_update_request(payload),
477
+ )
240
478
  end
241
479
 
242
480
  def fungible_token_holders(contract_id, token_type, query_params = {})
243
- get("/v1/item-tokens/#{contract_id}/fungibles/#{token_type}/holders", query_params: page_request(query_params))
481
+ get(
482
+ "/v1/item-tokens/#{contract_id}/fungibles/#{token_type}/holders",
483
+ query_params: page_request(query_params),
484
+ )
244
485
  end
245
486
 
246
487
  def non_fungible_tokens(contract_id, query_params = {})
247
- get("/v1/item-tokens/#{contract_id}/non-fungibles", query_params: page_request(query_params))
488
+ get(
489
+ "/v1/item-tokens/#{contract_id}/non-fungibles",
490
+ query_params: page_request(query_params),
491
+ )
248
492
  end
249
493
 
250
494
  def non_fungible_token_type(contract_id, token_type, query_params = {})
251
- get("/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}", query_params: page_request(query_params))
495
+ get(
496
+ "/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}",
497
+ query_params: page_request(query_params),
498
+ )
252
499
  end
253
500
 
254
501
  def create_non_fungible_token(contract_id, payload = {})
255
- post("/v1/item-tokens/#{contract_id}/non-fungibles", payload: non_fungible_token_create_update_request(payload))
502
+ post(
503
+ "/v1/item-tokens/#{contract_id}/non-fungibles",
504
+ payload: non_fungible_token_create_update_request(payload),
505
+ )
256
506
  end
257
507
 
258
508
  def mint_non_fungible_token(contract_id, token_type, payload = {})
259
- post("/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/mint", payload: non_fungible_token_mint_request(payload))
509
+ post(
510
+ "/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/mint",
511
+ payload: non_fungible_token_mint_request(payload),
512
+ )
260
513
  end
261
514
 
262
515
  def multi_mint_non_fungible_token(contract_id, payload = {})
263
- post("/v1/item-tokens/#{contract_id}/non-fungibles/multi-mint", payload: non_fungible_token_multi_mint_request(payload))
516
+ post(
517
+ "/v1/item-tokens/#{contract_id}/non-fungibles/multi-mint",
518
+ payload: non_fungible_token_multi_mint_request(payload),
519
+ )
264
520
  end
265
521
 
266
- def multi_mint_non_fungible_token_for_multi_recipients(contract_id, payload = {})
522
+ def multi_mint_non_fungible_token_for_multi_recipients(
523
+ contract_id,
524
+ payload = {}
525
+ )
267
526
  warn('Not Implemented yet')
268
- post("/v1/item-tokens/#{contract_id}/non-fungibles/multi-recipients/multi-mint", payload: non_fungible_token_multi_mint_multi_recipients_request(payload))
527
+ post(
528
+ "/v1/item-tokens/#{contract_id}/non-fungibles/multi-recipients/multi-mint",
529
+ payload:
530
+ non_fungible_token_multi_mint_multi_recipients_request(payload),
531
+ )
269
532
  end
270
533
 
271
- def burn_non_fungible_token(contract_id, token_type, token_index, payload = {})
272
- post("/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/burn", payload: non_fungible_token_burn_request(payload))
534
+ def burn_non_fungible_token(
535
+ contract_id,
536
+ token_type,
537
+ token_index,
538
+ payload = {}
539
+ )
540
+ post(
541
+ "/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/burn",
542
+ payload: non_fungible_token_burn_request(payload),
543
+ )
273
544
  end
274
545
 
275
546
  def non_fungible_token(contract_id, token_type, token_index)
276
- get("/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}")
547
+ get(
548
+ "/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}",
549
+ )
277
550
  end
278
551
 
279
552
  def update_non_fungible_token_type(contract_id, token_type, payload = {})
280
- put("/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}", payload: non_fungible_token_create_update_request(payload))
281
- end
282
-
283
- def update_non_fungible_token(contract_id, token_type, token_index, payload = {})
284
- put("/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}", payload: non_fungible_token_create_update_request(payload))
285
- end
286
-
287
- def non_fungible_token_type_holders(contract_id, token_type, query_params = {})
288
- get("/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/holders", query_params: page_request(query_params))
553
+ put(
554
+ "/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}",
555
+ payload: non_fungible_token_create_update_request(payload),
556
+ )
557
+ end
558
+
559
+ def update_non_fungible_token(
560
+ contract_id,
561
+ token_type,
562
+ token_index,
563
+ payload = {}
564
+ )
565
+ put(
566
+ "/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}",
567
+ payload: non_fungible_token_create_update_request(payload),
568
+ )
569
+ end
570
+
571
+ def non_fungible_token_type_holders(
572
+ contract_id,
573
+ token_type,
574
+ query_params = {}
575
+ )
576
+ get(
577
+ "/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/holders",
578
+ query_params: page_request(query_params),
579
+ )
289
580
  end
290
581
 
291
582
  def non_fungible_token_holder(contract_id, token_type, token_index)
292
- get("/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/holder")
293
- end
294
-
295
- def attach_non_fungible_token(contract_id, token_type, token_index, payload = {})
296
- post("/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/parent", payload: non_fungible_token_attach_request(payload))
297
- end
298
-
299
- def detach_non_fungible_token(contract_id, token_type, token_index, payload = {})
300
- delete("/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/parent", payload: non_fungible_token_detach_request(payload))
301
- end
302
-
303
- def children_of_non_fungible_token(contract_id, token_type, token_index, query_params = {})
304
- get("/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/children", query_params: page_request(query_params))
583
+ get(
584
+ "/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/holder",
585
+ )
586
+ end
587
+
588
+ def attach_non_fungible_token(
589
+ contract_id,
590
+ token_type,
591
+ token_index,
592
+ payload = {}
593
+ )
594
+ post(
595
+ "/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/parent",
596
+ payload: non_fungible_token_attach_request(payload),
597
+ )
598
+ end
599
+
600
+ def detach_non_fungible_token(
601
+ contract_id,
602
+ token_type,
603
+ token_index,
604
+ payload = {}
605
+ )
606
+ delete(
607
+ "/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/parent",
608
+ payload: non_fungible_token_detach_request(payload),
609
+ )
610
+ end
611
+
612
+ def children_of_non_fungible_token(
613
+ contract_id,
614
+ token_type,
615
+ token_index,
616
+ query_params = {}
617
+ )
618
+ get(
619
+ "/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/children",
620
+ query_params: page_request(query_params),
621
+ )
305
622
  end
306
623
 
307
624
  def parent_of_non_fungible_token(contract_id, token_type, token_index)
308
- get("/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/parent")
625
+ get(
626
+ "/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/parent",
627
+ )
309
628
  end
310
629
 
311
630
  def root_of_non_fungible_token(contract_id, token_type, token_index)
312
- get("/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/root")
631
+ get(
632
+ "/v1/item-tokens/#{contract_id}/non-fungibles/#{token_type}/#{token_index}/root",
633
+ )
313
634
  end
314
635
 
315
636
  def fungible_token_media_resources_update_status(contract_id, request_id)
@@ -317,15 +638,26 @@ module LbdSdk
317
638
  end
318
639
 
319
640
  def update_fungible_token_media_resources(contract_id, token_types)
320
- put("/v1/item-tokens/#{contract_id}/fungibles/icon", payload: fungible_token_media_resources_request(token_types))
641
+ put(
642
+ "/v1/item-tokens/#{contract_id}/fungibles/icon",
643
+ payload: fungible_token_media_resources_request(token_types),
644
+ )
321
645
  end
322
646
 
323
- def non_fungible_token_media_resources_update_status(contract_id, request_id)
324
- get("/v1/item-tokens/#{contract_id}/non-fungibles/icon/#{request_id}/status")
647
+ def non_fungible_token_media_resources_update_status(
648
+ contract_id,
649
+ request_id
650
+ )
651
+ get(
652
+ "/v1/item-tokens/#{contract_id}/non-fungibles/icon/#{request_id}/status",
653
+ )
325
654
  end
326
655
 
327
656
  def update_non_fungible_token_media_resources(contract_id, token_ids)
328
- put("/v1/item-tokens/#{contract_id}/non-fungibles/icon", payload: non_fungible_token_media_resources_request(token_ids))
657
+ put(
658
+ "/v1/item-tokens/#{contract_id}/non-fungibles/icon",
659
+ payload: non_fungible_token_media_resources_request(token_ids),
660
+ )
329
661
  end
330
662
 
331
663
  def memos(tx_hash)
@@ -345,7 +677,12 @@ module LbdSdk
345
677
  end
346
678
 
347
679
  def get(endpoint_path, query_params: {})
348
- headers = request_headers(endpoint_path: endpoint_path, method: 'GET', query_params: query_params)
680
+ headers =
681
+ request_headers(
682
+ endpoint_path: endpoint_path,
683
+ method: 'GET',
684
+ query_params: query_params,
685
+ )
349
686
  query_params = RequestParamFlattener.new.flatten(query_params)
350
687
  if query_params.empty?
351
688
  httpclient.get("#{@endpoint}#{endpoint_path}", headers)
@@ -355,23 +692,51 @@ module LbdSdk
355
692
  end
356
693
 
357
694
  def post(endpoint_path, query_params: {}, payload: {})
358
- headers = request_headers(endpoint_path: endpoint_path, method: 'POST', query_params: query_params, payload: payload)
695
+ headers =
696
+ request_headers(
697
+ endpoint_path: endpoint_path,
698
+ method: 'POST',
699
+ query_params: query_params,
700
+ payload: payload,
701
+ )
359
702
  query_params = RequestParamFlattener.new.flatten(query_params)
360
703
  if query_params.empty?
361
- httpclient.post("#{@endpoint}#{endpoint_path}", payload.to_json, headers)
704
+ httpclient.post(
705
+ "#{@endpoint}#{endpoint_path}",
706
+ payload.to_json,
707
+ headers,
708
+ )
362
709
  else
363
- httpclient.post("#{@endpoint}#{endpoint_path}?#{query_params}", payload.to_json, headers)
710
+ httpclient.post(
711
+ "#{@endpoint}#{endpoint_path}?#{query_params}",
712
+ payload.to_json,
713
+ headers,
714
+ )
364
715
  end
365
716
  end
366
717
 
367
718
  def put(endpoint_path, payload: {})
368
- headers = request_headers(endpoint_path: endpoint_path, method: 'PUT', payload: payload)
719
+ headers =
720
+ request_headers(
721
+ endpoint_path: endpoint_path,
722
+ method: 'PUT',
723
+ payload: payload,
724
+ )
369
725
  httpclient.put("#{@endpoint}#{endpoint_path}", payload.to_json, headers)
370
726
  end
371
727
 
372
728
  def delete(endpoint_path, payload: {})
373
- headers = request_headers(endpoint_path: endpoint_path, method: 'DELETE', payload: payload)
374
- httpclient.delete("#{@endpoint}#{endpoint_path}", payload.to_json, headers)
729
+ headers =
730
+ request_headers(
731
+ endpoint_path: endpoint_path,
732
+ method: 'DELETE',
733
+ payload: payload,
734
+ )
735
+ httpclient.delete(
736
+ "#{@endpoint}#{endpoint_path}",
737
+ payload.to_json,
738
+ headers,
739
+ )
375
740
  end
376
741
 
377
742
  def request_headers(endpoint_path:, method:, query_params: {}, payload: {})
@@ -383,469 +748,16 @@ module LbdSdk
383
748
  'Content-Type': 'application/json',
384
749
  Nonce: "#{nonce}",
385
750
  Timestamp: "#{timestamp}",
386
- Signature: SignatureGenerator.new.generate(
387
- secret: @api_secret_key,
388
- method: method,
389
- endpoint_path: endpoint_path,
390
- timestamp: timestamp,
391
- nonce: nonce,
392
- query_params: query_params,
393
- body: payload,
394
- ),
395
- }
396
- end
397
-
398
- def page_request(options)
399
- {
400
- limit: options[:limit] || 10,
401
- page: options[:page] || 1,
402
- orderBy: options[:order_by] || 'desc',
403
- }
404
- end
405
-
406
- def transaction_page_request(options)
407
- params = {
408
- limit: options[:limit] || 10,
409
- page: options[:page] || 1,
410
- orderBy: options[:order_by] || 'desc',
411
- }
412
- if !options[:before].nil?
413
- params[:before] = options[:before]
414
- end
415
- if !options[:after].nil?
416
- params[:after] = options[:after]
417
- end
418
- if !options[:msgType].nil?
419
- params[:msgType] = options[:msgType]
420
- end
421
- params
422
- end
423
-
424
- def update_service_token_request(options)
425
- params = {
426
- ownerAddress: options[:owner_address],
427
- ownerSecret: options[:owner_secret],
428
- }
429
- if !options[:name].nil?
430
- params[:name] = options[:name]
431
- end
432
- if !options[:meta].nil?
433
- params[:meta] = options[:meta]
434
- end
435
- params
436
- end
437
-
438
- def mint_service_token_request(options)
439
- params = {
440
- ownerAddress: options[:owner_address],
441
- ownerSecret: options[:owner_secret],
442
- amount: options[:amount].to_s,
443
- }
444
- if !options[:to_user_id].nil?
445
- params[:toUserId] = options[:to_user_id]
446
- elsif !options[:to_address].nil?
447
- params[:toAddress] = options[:to_address]
448
- end
449
- params
450
- end
451
-
452
- def burn_from_service_token_request(options)
453
- params = {
454
- ownerAddress: options[:owner_address],
455
- ownerSecret: options[:owner_secret],
456
- amount: options[:amount].to_s,
457
- }
458
- if !options[:from_user_id].nil?
459
- params[:fromUserId] = options[:from_user_id]
460
- elsif !options[:from_address].nil?
461
- params[:fromAddress] = options[:from_address]
462
- end
463
- params
464
- end
465
-
466
- def user_proxy_request(options)
467
- {
468
- ownerAddress: options[:owner_address],
469
- landingUri: options[:landing_uri],
470
- }
471
- end
472
-
473
- def issue_transfer_session_token_request(options)
474
- params = {
475
- amount: options[:amount].to_s,
476
- landingUri: options[:landing_uri],
477
- }
478
-
479
- if params[:amount].to_i <= 0
480
- raise ArgumentError, 'Invalid amount - $amount is less than zero '
481
- end
482
-
483
- if !options[:to_user_id].nil?
484
- params[:toUserId] = options[:to_user_id]
485
- elsif !options[:to_address].nil?
486
- params[:toAddress] = options[:to_address]
487
- end
488
- params
489
- end
490
-
491
- def transfer_service_token_proxy_request(options)
492
- params = {
493
- ownerAddress: options[:owner_address],
494
- ownerSecret: options[:owner_secret],
495
- amount: options[:amount].to_s,
496
- }
497
- if !options[:to_user_id].nil?
498
- params[:toUserId] = options[:to_user_id]
499
- elsif !options[:to_address].nil?
500
- params[:toAddress] = options[:to_address]
501
- end
502
- params
503
- end
504
-
505
- def transfer_fungible_token_proxy_request(options)
506
- params = {
507
- ownerAddress: options[:owner_address],
508
- ownerSecret: options[:owner_secret],
509
- amount: options[:amount].to_s,
510
- }
511
- if !options[:to_user_id].nil?
512
- params[:toUserId] = options[:to_user_id]
513
- elsif !options[:to_address].nil?
514
- params[:toAddress] = options[:to_address]
515
- end
516
- params
517
- end
518
-
519
- def transfer_non_fungible_token_proxy_request(options)
520
- params = {
521
- ownerAddress: options[:owner_address],
522
- ownerSecret: options[:owner_secret],
523
- }
524
- if !options[:to_user_id].nil?
525
- params[:toUserId] = options[:to_user_id]
526
- elsif !options[:to_address].nil?
527
- params[:toAddress] = options[:to_address]
528
- end
529
- params
530
- end
531
-
532
- def batch_transfer_non_fungible_token_proxy_request(options)
533
- params = {
534
- ownerAddress: options[:owner_address],
535
- ownerSecret: options[:owner_secret],
536
- }
537
-
538
- if !options[:transfer_list].nil? &&
539
- options[:transfer_list].is_a?(Array) && !options[:transfer_list].empty?
540
- params[:transferList] = options[:transfer_list].map do |option|
541
- {
542
- tokenId: option[:token_id] || option[:tokenId],
543
- }
544
- end
545
- end
546
-
547
- if !options[:to_user_id].nil?
548
- params[:toUserId] = options[:to_user_id]
549
- elsif !options[:to_address].nil?
550
- params[:toAddress] = options[:to_address]
551
- end
552
- params
553
- end
554
-
555
- def transfer_base_coin_request(options)
556
- params = {
557
- walletSecret: options[:wallet_secret],
558
- amount: options[:amount].to_s,
559
- }
560
- if !options[:to_user_id].nil?
561
- params[:toUserId] = options[:to_user_id]
562
- elsif !options[:to_address].nil?
563
- params[:toAddress] = options[:to_address]
564
- end
565
- params
566
- end
567
-
568
- def transfer_service_token_request(options)
569
- params = {
570
- walletSecret: options[:wallet_secret],
571
- amount: options[:amount].to_s,
572
- }
573
- if !options[:to_user_id].nil?
574
- params[:toUserId] = options[:to_user_id]
575
- elsif !options[:to_address].nil?
576
- params[:toAddress] = options[:to_address]
577
- end
578
- params
579
- end
580
-
581
- def transfer_fungible_token_request(options)
582
- params = {
583
- walletSecret: options[:wallet_secret],
584
- amount: options[:amount].to_s,
585
- }
586
- if !options[:to_user_id].nil?
587
- params[:toUserId] = options[:to_user_id]
588
- elsif !options[:to_address].nil?
589
- params[:toAddress] = options[:to_address]
590
- end
591
- params
592
- end
593
-
594
- def transfer_non_fungible_token_request(options)
595
- params = {
596
- walletSecret: options[:wallet_secret],
597
- }
598
- if !options[:to_user_id].nil?
599
- params[:toUserId] = options[:to_user_id]
600
- elsif !options[:to_address].nil?
601
- params[:toAddress] = options[:to_address]
602
- end
603
- params
604
- end
605
-
606
- def batch_transfer_non_fungible_token_request(options)
607
- params = {
608
- walletSecret: options[:wallet_secret],
609
- }
610
-
611
- if !options[:transfer_list].nil? &&
612
- options[:transfer_list].is_a?(Array) && !options[:transfer_list].empty?
613
- params[:transferList] = options[:transfer_list].map do |option|
614
- {
615
- tokenId: option[:token_id] || option[:tokenId],
616
- }
617
- end
618
- end
619
-
620
- if !options[:to_user_id].nil?
621
- params[:toUserId] = options[:to_user_id]
622
- elsif !options[:to_address].nil?
623
- params[:toAddress] = options[:to_address]
624
- end
625
- params
626
- end
627
-
628
- def fungible_token_create_update_request(options)
629
- params = {
630
- ownerAddress: options[:owner_address],
631
- ownerSecret: options[:owner_secret],
632
- }
633
- if !options[:name].nil?
634
- params[:name] = options[:name]
635
- end
636
- if !options[:meta].nil?
637
- params[:meta] = options[:meta]
638
- end
639
- params
640
- end
641
-
642
- def non_fungible_token_create_update_request(options)
643
- params = {
644
- ownerAddress: options[:owner_address],
645
- ownerSecret: options[:owner_secret],
646
- }
647
- if !options[:name].nil?
648
- params[:name] = options[:name]
649
- end
650
- if !options[:meta].nil?
651
- params[:meta] = options[:meta]
652
- end
653
- params
654
- end
655
-
656
- def non_fungible_token_attach_request(options)
657
- params = {
658
- parentTokenId: options[:parent_token_id],
659
- serviceWalletAddress: options[:service_wallet_address],
660
- serviceWalletSecret: options[:service_wallet_secret],
661
- }
662
- if !options[:token_holder_address].nil?
663
- params[:tokenHolderAddress] = options[:token_holder_address]
664
- elsif !options[:token_holder_user_id].nil?
665
- params[:tokenHolderUserId] = options[:token_holder_user_id]
666
- else
667
- raise ArgumentError, 'token_holder_address or token_holder_user_id, one of them is required'
668
- end
669
- params
670
- end
671
-
672
- def non_fungible_token_detach_request(options)
673
- params = {
674
- serviceWalletAddress: options[:service_wallet_address],
675
- serviceWalletSecret: options[:service_wallet_secret],
676
- }
677
- if !options[:token_holder_address].nil?
678
- params[:tokenHolderAddress] = options[:token_holder_address]
679
- elsif !options[:token_holder_user_id].nil?
680
- params[:tokenHolderUserId] = options[:token_holder_user_id]
681
- else
682
- raise ArgumentError, 'token_holder_address or token_holder_user_id, one of them is required'
683
- end
684
- params
685
- end
686
-
687
- def fungible_token_mint_request(options)
688
- params = {
689
- ownerAddress: options[:owner_address],
690
- ownerSecret: options[:owner_secret],
691
- amount: options[:amount].to_s,
692
- }
693
- if !options[:to_user_id].nil?
694
- params[:toUserId] = options[:to_user_id]
695
- elsif !options[:to_address].nil?
696
- params[:toAddress] = options[:to_address]
697
- end
698
- params
699
- end
700
-
701
- def fungible_token_burn_request(options)
702
- params = {
703
- ownerAddress: options[:owner_address],
704
- ownerSecret: options[:owner_secret],
705
- amount: options[:amount].to_s,
706
- }
707
- if !options[:from_user_id].nil?
708
- params[:fromUserId] = options[:from_user_id]
709
- elsif !options[:from_address].nil?
710
- params[:fromAddress] = options[:from_address]
711
- end
712
- params
713
- end
714
-
715
- def non_fungible_token_mint_request(options)
716
- params = {
717
- ownerAddress: options[:owner_address],
718
- ownerSecret: options[:owner_secret],
719
- name: options[:name],
720
- }
721
-
722
- if !options[:meta].nil?
723
- params[:meta] = options[:meta]
724
- end
725
-
726
- if !options[:to_user_id].nil?
727
- params[:toUserId] = options[:to_user_id]
728
- elsif !options[:to_address].nil?
729
- params[:toAddress] = options[:to_address]
730
- end
731
- params
732
- end
733
-
734
- def non_fungible_token_multi_mint_request(options)
735
- params = {
736
- ownerAddress: options[:owner_address],
737
- ownerSecret: options[:owner_secret],
738
- mintList: options[:mint_list],
739
- }
740
-
741
- if !options[:mint_list].nil? && options[:mint_list].is_a?(Array) && !options[:mint_list].empty?
742
- params[:mintList] = options[:mint_list].map do |option|
743
- inner_params = {
744
- tokenType: option[:token_type],
745
- name: option[:name],
746
- }
747
-
748
- if !option[:meta].nil?
749
- inner_params[:meta] = option[:meta]
750
- end
751
-
752
- inner_params
753
- end
754
- end
755
-
756
- if !options[:to_user_id].nil?
757
- params[:toUserId] = options[:to_user_id]
758
- elsif !options[:to_address].nil?
759
- params[:toAddress] = options[:to_address]
760
- end
761
-
762
- params
763
- end
764
-
765
- def non_fungible_token_multi_mint_multi_recipients_request(options)
766
- params = {
767
- ownerAddress: options[:owner_address],
768
- ownerSecret: options[:owner_secret],
769
- mintList: options[:mint_list],
770
- }
771
-
772
- if !options[:mint_list].nil? && options[:mint_list].is_a?(Array) && !options[:mint_list].empty?
773
- params[:mintList] = options[:mint_list].map do |option|
774
- inner_params = {
775
- tokenType: option[:token_type],
776
- name: option[:name],
777
- }
778
-
779
- if !option[:meta].nil?
780
- inner_params[:meta] = option[:meta]
781
- end
782
-
783
- if !option[:to_user_id].nil?
784
- inner_params[:toUserId] = option[:to_user_id]
785
- elsif !option[:to_address].nil?
786
- inner_params[:toAddress] = option[:to_address]
787
- end
788
-
789
- inner_params
790
- end
791
- end
792
-
793
- params
794
- end
795
-
796
- def non_fungible_token_burn_request(options)
797
- params = {
798
- ownerAddress: options[:owner_address],
799
- ownerSecret: options[:owner_secret],
800
- }
801
- if !options[:from_user_id].nil?
802
- params[:fromUserId] = options[:from_user_id]
803
- elsif !options[:from_address].nil?
804
- params[:fromAddress] = options[:from_address]
805
- end
806
- params
807
- end
808
-
809
- def fungible_token_media_resources_request(options)
810
- params = {
811
- updateList: options[:update_list],
812
- }
813
-
814
- if !options[:update_list].nil? &&
815
- options[:update_list].is_a?(Array) && !options[:update_list].empty?
816
- params[:updateList] = options[:update_list].map do |option|
817
- {
818
- tokenType: option[:token_type] || option[:tokenType],
819
- }
820
- end
821
- end
822
-
823
- params
824
- end
825
-
826
- def non_fungible_token_media_resources_request(options)
827
- params = {
828
- updateList: options[:update_list],
829
- }
830
-
831
- if !options[:update_list].nil? &&
832
- options[:update_list].is_a?(Array) && !options[:update_list].empty?
833
- params[:updateList] = options[:update_list].map do |option|
834
- {
835
- tokenType: option[:token_type] || option[:tokenType],
836
- tokenIndex: option[:token_index] || option[:tokenIndex],
837
- }
838
- end
839
- end
840
-
841
- params
842
- end
843
-
844
- def memo_request(options)
845
- {
846
- walletAddress: options[:wallet_address],
847
- walletSecret: options[:wallet_secret],
848
- memo: options[:memo],
751
+ Signature:
752
+ SignatureGenerator.new.generate(
753
+ secret: @api_secret_key,
754
+ method: method,
755
+ endpoint_path: endpoint_path,
756
+ timestamp: timestamp,
757
+ nonce: nonce,
758
+ query_params: query_params,
759
+ body: payload,
760
+ ),
849
761
  }
850
762
  end
851
763
  end