lbd_sdk 0.1.2 → 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/.gitignore +2 -1
- data/.rubocop.yml +3 -0
- data/.vscode/settings.json +7 -1
- data/CHANGELOG.md +7 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +3 -1
- data/README.md +60 -36
- data/lib/lbd_sdk/client.rb +514 -151
- data/lib/lbd_sdk/hash_converter.rb +17 -0
- data/lib/lbd_sdk/http_client.rb +3 -7
- data/lib/lbd_sdk/request.rb +267 -190
- 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/package-lock.json +53 -0
- data/package.json +5 -0
- metadata +6 -2
data/lib/lbd_sdk/request.rb
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'lbd_sdk/request_param_validator'
|
4
|
+
require 'lbd_sdk/hash_converter'
|
5
|
+
|
3
6
|
module LbdSdk
|
4
7
|
module Request
|
8
|
+
include RequestParamValidator
|
9
|
+
include HashConverter
|
10
|
+
|
5
11
|
def page_request(options)
|
6
12
|
{
|
7
13
|
limit: options[:limit] || 10,
|
@@ -17,25 +23,95 @@ module LbdSdk
|
|
17
23
|
pageToken: options[:page_token] || '',
|
18
24
|
}
|
19
25
|
end
|
20
|
-
|
26
|
+
|
21
27
|
def transaction_page_request(options)
|
22
28
|
params = {
|
23
29
|
limit: options[:limit] || 10,
|
24
30
|
page: options[:page] || 1,
|
25
31
|
orderBy: options[:order_by] || 'desc',
|
26
32
|
}
|
27
|
-
if !options[:before].nil?
|
28
|
-
|
33
|
+
params[:before] = options[:before] if !options[:before].nil?
|
34
|
+
params[:after] = options[:after] if !options[:after].nil?
|
35
|
+
params[:msgType] = options[:msgType] if !options[:msgType].nil?
|
36
|
+
params
|
37
|
+
end
|
38
|
+
|
39
|
+
def create_item_token_contract_request(options)
|
40
|
+
if options[:service_wallet_address].nil? ||
|
41
|
+
options[:service_wallet_secret].nil?
|
42
|
+
raise ArgumentError,
|
43
|
+
'service_wallet_address and service_wallet_secret are required'
|
44
|
+
end
|
45
|
+
|
46
|
+
if is_valid_wallet_address(options[:service_wallet_address]) == false
|
47
|
+
raise ArgumentError, 'service_wallet_address is invalid'
|
29
48
|
end
|
30
|
-
|
31
|
-
|
49
|
+
|
50
|
+
if is_valid_token_name(options[:name]) == false
|
51
|
+
raise ArgumentError, 'name is invalid'
|
32
52
|
end
|
33
|
-
|
34
|
-
|
53
|
+
|
54
|
+
if is_valid_base_uri(options[:base_img_uri]) == false
|
55
|
+
raise ArgumentError, 'base_img_uri is invalid'
|
35
56
|
end
|
36
|
-
|
57
|
+
|
58
|
+
camelize(options)
|
59
|
+
end
|
60
|
+
|
61
|
+
def created_item_token_contract_request(options)
|
62
|
+
options[:is_only_contract_id] =
|
63
|
+
if options[:is_only_contract_id].nil?
|
64
|
+
false
|
65
|
+
else
|
66
|
+
options[:is_only_contract_id]
|
67
|
+
end
|
68
|
+
camelize(options)
|
69
|
+
end
|
70
|
+
|
71
|
+
def issue_service_token_request(options)
|
72
|
+
if options[:service_wallet_address].nil? ||
|
73
|
+
options[:service_wallet_secret].nil?
|
74
|
+
raise ArgumentError,
|
75
|
+
'service_wallet_address and service_wallet_secret are required'
|
76
|
+
end
|
77
|
+
|
78
|
+
if is_valid_wallet_address(options[:service_wallet_address]) == false
|
79
|
+
raise ArgumentError, 'service_wallet_address is invalid'
|
80
|
+
end
|
81
|
+
|
82
|
+
if is_valid_token_name(options[:name]) == false
|
83
|
+
raise ArgumentError, 'name is invalid'
|
84
|
+
end
|
85
|
+
|
86
|
+
if is_valid_symbol(options[:symbol]) == false
|
87
|
+
raise ArgumentError, 'symbol is invalid'
|
88
|
+
end
|
89
|
+
|
90
|
+
if is_valid_initial_supply(options[:initial_supply]) == false
|
91
|
+
raise ArgumentError, 'initial_supply is invalid'
|
92
|
+
end
|
93
|
+
|
94
|
+
if is_valid_wallet_address(options[:recipient_wallet_address]) == false
|
95
|
+
raise ArgumentError, 'recipient_wallet_address is invalid'
|
96
|
+
end
|
97
|
+
|
98
|
+
if is_valid_base_uri(options[:img_uri]) == false
|
99
|
+
raise ArgumentError, 'img_uri is invalid'
|
100
|
+
end
|
101
|
+
|
102
|
+
camelize(options)
|
37
103
|
end
|
38
|
-
|
104
|
+
|
105
|
+
def issued_service_token_by_tx_hash_request(options)
|
106
|
+
options[:is_only_contract_id] =
|
107
|
+
if options[:is_only_contract_id].nil?
|
108
|
+
false
|
109
|
+
else
|
110
|
+
options[:is_only_contract_id]
|
111
|
+
end
|
112
|
+
camelize(options)
|
113
|
+
end
|
114
|
+
|
39
115
|
def update_service_token_request(options)
|
40
116
|
if options[:owner_address].nil? || options[:owner_secret].nil?
|
41
117
|
raise ArgumentError, 'owner_address and owner_secret are required'
|
@@ -45,18 +121,16 @@ module LbdSdk
|
|
45
121
|
ownerAddress: options[:owner_address],
|
46
122
|
ownerSecret: options[:owner_secret],
|
47
123
|
}
|
48
|
-
if !options[:name].nil?
|
49
|
-
|
50
|
-
end
|
51
|
-
if !options[:meta].nil?
|
52
|
-
params[:meta] = options[:meta]
|
53
|
-
end
|
124
|
+
params[:name] = options[:name] if !options[:name].nil?
|
125
|
+
params[:meta] = options[:meta] if !options[:meta].nil?
|
54
126
|
params
|
55
127
|
end
|
56
|
-
|
128
|
+
|
57
129
|
def mint_service_token_request(options)
|
58
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
59
|
-
|
130
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
131
|
+
options[:amount].nil?
|
132
|
+
raise ArgumentError,
|
133
|
+
'owner_address and owner_secret and amount are required'
|
60
134
|
end
|
61
135
|
|
62
136
|
params = {
|
@@ -73,10 +147,12 @@ module LbdSdk
|
|
73
147
|
end
|
74
148
|
params
|
75
149
|
end
|
76
|
-
|
150
|
+
|
77
151
|
def burn_from_service_token_request(options)
|
78
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
79
|
-
|
152
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
153
|
+
options[:amount].nil?
|
154
|
+
raise ArgumentError,
|
155
|
+
'owner_address and owner_secret and amount are required'
|
80
156
|
end
|
81
157
|
|
82
158
|
params = {
|
@@ -93,21 +169,17 @@ module LbdSdk
|
|
93
169
|
end
|
94
170
|
params
|
95
171
|
end
|
96
|
-
|
172
|
+
|
97
173
|
def user_proxy_request(options)
|
98
174
|
if options[:owner_address].nil?
|
99
175
|
raise ArgumentError, 'owner_address is required'
|
100
176
|
end
|
101
177
|
|
102
|
-
params = {
|
103
|
-
|
104
|
-
}
|
105
|
-
if !options[:landing_uri].nil?
|
106
|
-
params[:landingUri] = options[:landing_uri]
|
107
|
-
end
|
178
|
+
params = { ownerAddress: options[:owner_address] }
|
179
|
+
params[:landingUri] = options[:landing_uri] if !options[:landing_uri].nil?
|
108
180
|
params
|
109
181
|
end
|
110
|
-
|
182
|
+
|
111
183
|
def issue_transfer_session_token_request(options)
|
112
184
|
if options[:amount].nil?
|
113
185
|
raise ArgumentError, 'amount is required'
|
@@ -115,14 +187,10 @@ module LbdSdk
|
|
115
187
|
raise ArgumentError, 'Invalid amount - $amount is less than zero'
|
116
188
|
end
|
117
189
|
|
118
|
-
params = {
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
if !options[:landing_uri].nil?
|
123
|
-
params[:landingUri] = options[:landing_uri]
|
124
|
-
end
|
125
|
-
|
190
|
+
params = { amount: options[:amount].to_s }
|
191
|
+
|
192
|
+
params[:landingUri] = options[:landing_uri] if !options[:landing_uri].nil?
|
193
|
+
|
126
194
|
if !options[:to_user_id].nil?
|
127
195
|
params[:toUserId] = options[:to_user_id]
|
128
196
|
elsif !options[:to_address].nil?
|
@@ -132,10 +200,12 @@ module LbdSdk
|
|
132
200
|
end
|
133
201
|
params
|
134
202
|
end
|
135
|
-
|
203
|
+
|
136
204
|
def transfer_service_token_proxy_request(options)
|
137
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
138
|
-
|
205
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
206
|
+
options[:amount].nil?
|
207
|
+
raise ArgumentError,
|
208
|
+
'owner_address and owner_secret and amount are required'
|
139
209
|
end
|
140
210
|
|
141
211
|
params = {
|
@@ -152,10 +222,12 @@ module LbdSdk
|
|
152
222
|
end
|
153
223
|
params
|
154
224
|
end
|
155
|
-
|
225
|
+
|
156
226
|
def transfer_fungible_token_proxy_request(options)
|
157
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
158
|
-
|
227
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
228
|
+
options[:amount].nil?
|
229
|
+
raise ArgumentError,
|
230
|
+
'owner_address and owner_secret and amount are required'
|
159
231
|
end
|
160
232
|
|
161
233
|
params = {
|
@@ -172,7 +244,7 @@ module LbdSdk
|
|
172
244
|
end
|
173
245
|
params
|
174
246
|
end
|
175
|
-
|
247
|
+
|
176
248
|
def transfer_non_fungible_token_proxy_request(options)
|
177
249
|
if options[:owner_address].nil? || options[:owner_secret].nil?
|
178
250
|
raise ArgumentError, 'owner_address and owner_secret are required'
|
@@ -191,7 +263,7 @@ module LbdSdk
|
|
191
263
|
end
|
192
264
|
params
|
193
265
|
end
|
194
|
-
|
266
|
+
|
195
267
|
def batch_transfer_non_fungible_token_proxy_request(options)
|
196
268
|
if options[:owner_address].nil? || options[:owner_secret].nil?
|
197
269
|
raise ArgumentError, 'owner_address and owner_secret are required'
|
@@ -201,18 +273,18 @@ module LbdSdk
|
|
201
273
|
ownerAddress: options[:owner_address],
|
202
274
|
ownerSecret: options[:owner_secret],
|
203
275
|
}
|
204
|
-
|
276
|
+
|
205
277
|
if !options[:transfer_list].nil? &&
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
278
|
+
options[:transfer_list].is_a?(Array) &&
|
279
|
+
!options[:transfer_list].empty?
|
280
|
+
params[:transferList] =
|
281
|
+
options[:transfer_list].map do |option|
|
282
|
+
{ tokenId: option[:token_id] || option[:tokenId] }
|
283
|
+
end
|
212
284
|
else
|
213
285
|
raise ArgumentError, 'transfer_list is inappropriate'
|
214
286
|
end
|
215
|
-
|
287
|
+
|
216
288
|
if !options[:to_user_id].nil?
|
217
289
|
params[:toUserId] = options[:to_user_id]
|
218
290
|
elsif !options[:to_address].nil?
|
@@ -222,7 +294,7 @@ module LbdSdk
|
|
222
294
|
end
|
223
295
|
params
|
224
296
|
end
|
225
|
-
|
297
|
+
|
226
298
|
def transfer_base_coin_request(options)
|
227
299
|
if options[:wallet_secret].nil? || options[:amount].nil?
|
228
300
|
raise ArgumentError, 'amount and wallet_secret are required'
|
@@ -241,7 +313,7 @@ module LbdSdk
|
|
241
313
|
end
|
242
314
|
params
|
243
315
|
end
|
244
|
-
|
316
|
+
|
245
317
|
def transfer_service_token_request(options)
|
246
318
|
if options[:wallet_secret].nil? || options[:amount].nil?
|
247
319
|
raise ArgumentError, 'amount and wallet_secret are required'
|
@@ -261,7 +333,7 @@ module LbdSdk
|
|
261
333
|
end
|
262
334
|
params
|
263
335
|
end
|
264
|
-
|
336
|
+
|
265
337
|
def transfer_fungible_token_request(options)
|
266
338
|
if options[:wallet_secret].nil? || options[:amount].nil?
|
267
339
|
raise ArgumentError, 'amount and wallet_secret are required'
|
@@ -281,15 +353,13 @@ module LbdSdk
|
|
281
353
|
end
|
282
354
|
params
|
283
355
|
end
|
284
|
-
|
356
|
+
|
285
357
|
def transfer_non_fungible_token_request(options)
|
286
358
|
if options[:wallet_secret].nil?
|
287
359
|
raise ArgumentError, 'wallet_secret is required'
|
288
360
|
end
|
289
361
|
|
290
|
-
params = {
|
291
|
-
walletSecret: options[:wallet_secret],
|
292
|
-
}
|
362
|
+
params = { walletSecret: options[:wallet_secret] }
|
293
363
|
if !options[:to_user_id].nil?
|
294
364
|
params[:toUserId] = options[:to_user_id]
|
295
365
|
elsif !options[:to_address].nil?
|
@@ -299,27 +369,25 @@ module LbdSdk
|
|
299
369
|
end
|
300
370
|
params
|
301
371
|
end
|
302
|
-
|
372
|
+
|
303
373
|
def batch_transfer_non_fungible_token_request(options)
|
304
374
|
if options[:wallet_secret].nil?
|
305
375
|
raise ArgumentError, 'wallet_secret are required'
|
306
376
|
end
|
307
377
|
|
308
|
-
params = {
|
309
|
-
|
310
|
-
}
|
311
|
-
|
378
|
+
params = { walletSecret: options[:wallet_secret] }
|
379
|
+
|
312
380
|
if !options[:transfer_list].nil? &&
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
381
|
+
options[:transfer_list].is_a?(Array) &&
|
382
|
+
!options[:transfer_list].empty?
|
383
|
+
params[:transferList] =
|
384
|
+
options[:transfer_list].map do |option|
|
385
|
+
{ tokenId: option[:token_id] || option[:tokenId] }
|
386
|
+
end
|
319
387
|
else
|
320
388
|
raise ArgumentError, 'transfer_list is inappropriate'
|
321
389
|
end
|
322
|
-
|
390
|
+
|
323
391
|
if !options[:to_user_id].nil?
|
324
392
|
params[:toUserId] = options[:to_user_id]
|
325
393
|
elsif !options[:to_address].nil?
|
@@ -329,10 +397,12 @@ module LbdSdk
|
|
329
397
|
end
|
330
398
|
params
|
331
399
|
end
|
332
|
-
|
400
|
+
|
333
401
|
def fungible_token_create_update_request(options)
|
334
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
335
|
-
|
402
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
403
|
+
options[:name].nil?
|
404
|
+
raise ArgumentError,
|
405
|
+
'owner_address and owner_secret and name are required'
|
336
406
|
end
|
337
407
|
|
338
408
|
params = {
|
@@ -341,15 +411,15 @@ module LbdSdk
|
|
341
411
|
name: options[:name],
|
342
412
|
}
|
343
413
|
|
344
|
-
if !options[:meta].nil?
|
345
|
-
params[:meta] = options[:meta]
|
346
|
-
end
|
414
|
+
params[:meta] = options[:meta] if !options[:meta].nil?
|
347
415
|
params
|
348
416
|
end
|
349
|
-
|
417
|
+
|
350
418
|
def non_fungible_token_create_update_request(options)
|
351
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
352
|
-
|
419
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
420
|
+
options[:name].nil?
|
421
|
+
raise ArgumentError,
|
422
|
+
'owner_address and owner_secret and name are required'
|
353
423
|
end
|
354
424
|
|
355
425
|
params = {
|
@@ -358,15 +428,16 @@ module LbdSdk
|
|
358
428
|
name: options[:name],
|
359
429
|
}
|
360
430
|
|
361
|
-
if !options[:meta].nil?
|
362
|
-
params[:meta] = options[:meta]
|
363
|
-
end
|
431
|
+
params[:meta] = options[:meta] if !options[:meta].nil?
|
364
432
|
params
|
365
433
|
end
|
366
|
-
|
434
|
+
|
367
435
|
def non_fungible_token_attach_request(options)
|
368
|
-
if options[:parent_token_id].nil? ||
|
369
|
-
|
436
|
+
if options[:parent_token_id].nil? ||
|
437
|
+
options[:service_wallet_address].nil? ||
|
438
|
+
options[:service_wallet_secret].nil?
|
439
|
+
raise ArgumentError,
|
440
|
+
'parent_token_id and service_wallet_address and service_wallet_secret are required'
|
370
441
|
end
|
371
442
|
|
372
443
|
params = {
|
@@ -380,14 +451,17 @@ module LbdSdk
|
|
380
451
|
elsif !options[:token_holder_user_id].nil?
|
381
452
|
params[:tokenHolderUserId] = options[:token_holder_user_id]
|
382
453
|
else
|
383
|
-
raise ArgumentError,
|
454
|
+
raise ArgumentError,
|
455
|
+
'token_holder_address or token_holder_user_id, one of them is required'
|
384
456
|
end
|
385
457
|
params
|
386
458
|
end
|
387
|
-
|
459
|
+
|
388
460
|
def non_fungible_token_detach_request(options)
|
389
|
-
if options[:service_wallet_address].nil? ||
|
390
|
-
|
461
|
+
if options[:service_wallet_address].nil? ||
|
462
|
+
options[:service_wallet_secret].nil?
|
463
|
+
raise ArgumentError,
|
464
|
+
'service_wallet_address and service_wallet_secret are required'
|
391
465
|
end
|
392
466
|
|
393
467
|
params = {
|
@@ -400,14 +474,17 @@ module LbdSdk
|
|
400
474
|
elsif !options[:token_holder_user_id].nil?
|
401
475
|
params[:tokenHolderUserId] = options[:token_holder_user_id]
|
402
476
|
else
|
403
|
-
raise ArgumentError,
|
477
|
+
raise ArgumentError,
|
478
|
+
'token_holder_address or token_holder_user_id, one of them is required'
|
404
479
|
end
|
405
480
|
params
|
406
481
|
end
|
407
|
-
|
482
|
+
|
408
483
|
def fungible_token_mint_request(options)
|
409
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
410
|
-
|
484
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
485
|
+
options[:amount].nil?
|
486
|
+
raise ArgumentError,
|
487
|
+
'owner_address and owner_secret and amount are required'
|
411
488
|
end
|
412
489
|
|
413
490
|
params = {
|
@@ -425,10 +502,12 @@ module LbdSdk
|
|
425
502
|
end
|
426
503
|
params
|
427
504
|
end
|
428
|
-
|
505
|
+
|
429
506
|
def fungible_token_burn_request(options)
|
430
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
431
|
-
|
507
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
508
|
+
options[:amount].nil?
|
509
|
+
raise ArgumentError,
|
510
|
+
'owner_address and owner_secret and amount are required'
|
432
511
|
end
|
433
512
|
|
434
513
|
params = {
|
@@ -446,10 +525,12 @@ module LbdSdk
|
|
446
525
|
end
|
447
526
|
params
|
448
527
|
end
|
449
|
-
|
528
|
+
|
450
529
|
def non_fungible_token_mint_request(options)
|
451
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
452
|
-
|
530
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
531
|
+
options[:name].nil?
|
532
|
+
raise ArgumentError,
|
533
|
+
'owner_address and owner_secret and name are required'
|
453
534
|
end
|
454
535
|
|
455
536
|
params = {
|
@@ -457,11 +538,9 @@ module LbdSdk
|
|
457
538
|
ownerSecret: options[:owner_secret],
|
458
539
|
name: options[:name],
|
459
540
|
}
|
460
|
-
|
461
|
-
if !options[:meta].nil?
|
462
|
-
|
463
|
-
end
|
464
|
-
|
541
|
+
|
542
|
+
params[:meta] = options[:meta] if !options[:meta].nil?
|
543
|
+
|
465
544
|
if !options[:to_user_id].nil?
|
466
545
|
params[:toUserId] = options[:to_user_id]
|
467
546
|
elsif !options[:to_address].nil?
|
@@ -471,7 +550,7 @@ module LbdSdk
|
|
471
550
|
end
|
472
551
|
params
|
473
552
|
end
|
474
|
-
|
553
|
+
|
475
554
|
def non_fungible_token_multi_mint_request(options)
|
476
555
|
if options[:owner_address].nil? || options[:owner_secret].nil?
|
477
556
|
raise ArgumentError, 'owner_address and owner_secret are required'
|
@@ -482,28 +561,28 @@ module LbdSdk
|
|
482
561
|
ownerSecret: options[:owner_secret],
|
483
562
|
mintList: options[:mint_list],
|
484
563
|
}
|
485
|
-
|
486
|
-
if !options[:mint_list].nil? && options[:mint_list].is_a?(Array) && !options[:mint_list].empty?
|
487
|
-
params[:mintList] = options[:mint_list].map do |option|
|
488
|
-
if option[:token_type].nil? || option[:name].nil?
|
489
|
-
raise ArgumentError, 'token_type and name are required'
|
490
|
-
end
|
491
564
|
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
565
|
+
if !options[:mint_list].nil? && options[:mint_list].is_a?(Array) &&
|
566
|
+
!options[:mint_list].empty?
|
567
|
+
params[:mintList] =
|
568
|
+
options[:mint_list].map do |option|
|
569
|
+
if option[:token_type].nil? || option[:name].nil?
|
570
|
+
raise ArgumentError, 'token_type and name are required'
|
571
|
+
end
|
572
|
+
|
573
|
+
inner_params = {
|
574
|
+
tokenType: option[:token_type],
|
575
|
+
name: option[:name],
|
576
|
+
}
|
577
|
+
|
578
|
+
inner_params[:meta] = option[:meta] if !option[:meta].nil?
|
579
|
+
|
580
|
+
inner_params
|
499
581
|
end
|
500
|
-
|
501
|
-
inner_params
|
502
|
-
end
|
503
582
|
else
|
504
583
|
raise ArgumentError, 'mint_list is required and must be an Array'
|
505
584
|
end
|
506
|
-
|
585
|
+
|
507
586
|
if !options[:to_user_id].nil?
|
508
587
|
params[:toUserId] = options[:to_user_id]
|
509
588
|
elsif !options[:to_address].nil?
|
@@ -511,10 +590,10 @@ module LbdSdk
|
|
511
590
|
else
|
512
591
|
raise ArgumentError, 'to_user_id or to_address is required'
|
513
592
|
end
|
514
|
-
|
593
|
+
|
515
594
|
params
|
516
595
|
end
|
517
|
-
|
596
|
+
|
518
597
|
def non_fungible_token_multi_mint_multi_recipients_request(options)
|
519
598
|
if options[:owner_address].nil? || options[:owner_secret].nil?
|
520
599
|
raise ArgumentError, 'owner_address and owner_secret are required'
|
@@ -525,39 +604,39 @@ module LbdSdk
|
|
525
604
|
ownerSecret: options[:owner_secret],
|
526
605
|
mintList: options[:mint_list],
|
527
606
|
}
|
528
|
-
|
529
|
-
if !options[:mint_list].nil? && options[:mint_list].is_a?(Array) && !options[:mint_list].empty?
|
530
|
-
params[:mintList] = options[:mint_list].map do |option|
|
531
|
-
if option[:token_type].nil? || option[:name].nil?
|
532
|
-
raise ArgumentError, 'token_type and name are required'
|
533
|
-
end
|
534
607
|
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
608
|
+
if !options[:mint_list].nil? && options[:mint_list].is_a?(Array) &&
|
609
|
+
!options[:mint_list].empty?
|
610
|
+
params[:mintList] =
|
611
|
+
options[:mint_list].map do |option|
|
612
|
+
if option[:token_type].nil? || option[:name].nil?
|
613
|
+
raise ArgumentError, 'token_type and name are required'
|
614
|
+
end
|
615
|
+
|
616
|
+
inner_params = {
|
617
|
+
tokenType: option[:token_type],
|
618
|
+
name: option[:name],
|
619
|
+
}
|
620
|
+
|
621
|
+
inner_params[:meta] = option[:meta] if !option[:meta].nil?
|
622
|
+
|
623
|
+
if !option[:to_user_id].nil?
|
624
|
+
inner_params[:toUserId] = option[:to_user_id]
|
625
|
+
elsif !option[:to_address].nil?
|
626
|
+
inner_params[:toAddress] = option[:to_address]
|
627
|
+
else
|
628
|
+
raise ArgumentError, 'to_user_id or to_address is required'
|
629
|
+
end
|
630
|
+
|
631
|
+
inner_params
|
550
632
|
end
|
551
|
-
|
552
|
-
inner_params
|
553
|
-
end
|
554
633
|
else
|
555
634
|
raise ArgumentError, 'mint_list is required and must be an Array'
|
556
635
|
end
|
557
|
-
|
636
|
+
|
558
637
|
params
|
559
638
|
end
|
560
|
-
|
639
|
+
|
561
640
|
def non_fungible_token_burn_request(options)
|
562
641
|
if options[:owner_address].nil? || options[:owner_secret].nil?
|
563
642
|
raise ArgumentError, 'owner_address and owner_secret are required'
|
@@ -576,58 +655,56 @@ module LbdSdk
|
|
576
655
|
end
|
577
656
|
params
|
578
657
|
end
|
579
|
-
|
658
|
+
|
580
659
|
def fungible_token_media_resources_request(options)
|
581
|
-
params = {
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
options[:update_list].
|
587
|
-
|
588
|
-
|
589
|
-
|
660
|
+
params = { updateList: options[:update_list] }
|
661
|
+
|
662
|
+
if !options[:update_list].nil? && options[:update_list].is_a?(Array) &&
|
663
|
+
!options[:update_list].empty?
|
664
|
+
params[:updateList] =
|
665
|
+
options[:update_list].map do |option|
|
666
|
+
if option[:token_type].nil? && option[:tokenType].nil?
|
667
|
+
raise ArgumentError, 'token_type is required'
|
668
|
+
end
|
669
|
+
{ tokenType: option[:token_type] || option[:tokenType] }
|
590
670
|
end
|
591
|
-
{
|
592
|
-
tokenType: option[:token_type] || option[:tokenType],
|
593
|
-
}
|
594
|
-
end
|
595
671
|
else
|
596
672
|
raise ArgumentError, 'update_list is required and must be an Array'
|
597
673
|
end
|
598
|
-
|
674
|
+
|
599
675
|
params
|
600
676
|
end
|
601
|
-
|
677
|
+
|
602
678
|
def non_fungible_token_media_resources_request(options)
|
603
|
-
params = {
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
options[:update_list].
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
679
|
+
params = { updateList: options[:update_list] }
|
680
|
+
|
681
|
+
if !options[:update_list].nil? && options[:update_list].is_a?(Array) &&
|
682
|
+
!options[:update_list].empty?
|
683
|
+
params[:updateList] =
|
684
|
+
options[:update_list].map do |option|
|
685
|
+
if option[:token_type].nil? && option[:tokenType].nil?
|
686
|
+
raise ArgumentError, 'token_type is required'
|
687
|
+
elsif option[:token_index].nil? && option[:tokenIndex].nil?
|
688
|
+
raise ArgumentError, 'token_index is required'
|
689
|
+
end
|
690
|
+
|
691
|
+
{
|
692
|
+
tokenType: option[:token_type] || option[:tokenType],
|
693
|
+
tokenIndex: option[:token_index] || option[:tokenIndex],
|
694
|
+
}
|
614
695
|
end
|
615
|
-
|
616
|
-
{
|
617
|
-
tokenType: option[:token_type] || option[:tokenType],
|
618
|
-
tokenIndex: option[:token_index] || option[:tokenIndex],
|
619
|
-
}
|
620
|
-
end
|
621
696
|
else
|
622
697
|
raise ArgumentError, 'update_list is required and must be an Array'
|
623
698
|
end
|
624
|
-
|
699
|
+
|
625
700
|
params
|
626
701
|
end
|
627
|
-
|
702
|
+
|
628
703
|
def memo_request(options)
|
629
|
-
if options[:wallet_address].nil? || options[:wallet_secret].nil? ||
|
630
|
-
|
704
|
+
if options[:wallet_address].nil? || options[:wallet_secret].nil? ||
|
705
|
+
options[:memo].nil?
|
706
|
+
raise ArgumentError,
|
707
|
+
'wallet_address and wallet_secret and memo are required'
|
631
708
|
end
|
632
709
|
|
633
710
|
{
|
@@ -637,4 +714,4 @@ module LbdSdk
|
|
637
714
|
}
|
638
715
|
end
|
639
716
|
end
|
640
|
-
end
|
717
|
+
end
|