lbd_sdk 0.1.1 → 0.1.4
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 -0
- data/.rubocop.yml +3 -0
- data/.vscode/settings.json +7 -1
- data/CHANGELOG.md +31 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +3 -1
- data/README.md +69 -40
- data/lib/lbd_sdk/client.rb +547 -146
- data/lib/lbd_sdk/hash_converter.rb +17 -0
- data/lib/lbd_sdk/http_client.rb +3 -7
- data/lib/lbd_sdk/request.rb +275 -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,
|
@@ -9,25 +15,103 @@ module LbdSdk
|
|
9
15
|
orderBy: options[:order_by] || 'desc',
|
10
16
|
}
|
11
17
|
end
|
12
|
-
|
18
|
+
|
19
|
+
def cursor_page_request(options)
|
20
|
+
{
|
21
|
+
limit: options[:limit] || 10,
|
22
|
+
orderBy: options[:order_by] || 'desc',
|
23
|
+
pageToken: options[:page_token] || '',
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
13
27
|
def transaction_page_request(options)
|
14
28
|
params = {
|
15
29
|
limit: options[:limit] || 10,
|
16
30
|
page: options[:page] || 1,
|
17
31
|
orderBy: options[:order_by] || 'desc',
|
18
32
|
}
|
19
|
-
if !options[:before].nil?
|
20
|
-
|
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'
|
21
44
|
end
|
22
|
-
|
23
|
-
|
45
|
+
|
46
|
+
if is_valid_wallet_address(options[:service_wallet_address]) == false
|
47
|
+
raise ArgumentError, 'service_wallet_address is invalid'
|
24
48
|
end
|
25
|
-
|
26
|
-
|
49
|
+
|
50
|
+
if is_valid_token_name(options[:name]) == false
|
51
|
+
raise ArgumentError, 'name is invalid'
|
27
52
|
end
|
28
|
-
|
53
|
+
|
54
|
+
if is_valid_base_uri(options[:base_img_uri]) == false
|
55
|
+
raise ArgumentError, 'base_img_uri is invalid'
|
56
|
+
end
|
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)
|
29
69
|
end
|
30
|
-
|
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)
|
103
|
+
end
|
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
|
+
|
31
115
|
def update_service_token_request(options)
|
32
116
|
if options[:owner_address].nil? || options[:owner_secret].nil?
|
33
117
|
raise ArgumentError, 'owner_address and owner_secret are required'
|
@@ -37,18 +121,16 @@ module LbdSdk
|
|
37
121
|
ownerAddress: options[:owner_address],
|
38
122
|
ownerSecret: options[:owner_secret],
|
39
123
|
}
|
40
|
-
if !options[:name].nil?
|
41
|
-
|
42
|
-
end
|
43
|
-
if !options[:meta].nil?
|
44
|
-
params[:meta] = options[:meta]
|
45
|
-
end
|
124
|
+
params[:name] = options[:name] if !options[:name].nil?
|
125
|
+
params[:meta] = options[:meta] if !options[:meta].nil?
|
46
126
|
params
|
47
127
|
end
|
48
|
-
|
128
|
+
|
49
129
|
def mint_service_token_request(options)
|
50
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
51
|
-
|
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'
|
52
134
|
end
|
53
135
|
|
54
136
|
params = {
|
@@ -65,10 +147,12 @@ module LbdSdk
|
|
65
147
|
end
|
66
148
|
params
|
67
149
|
end
|
68
|
-
|
150
|
+
|
69
151
|
def burn_from_service_token_request(options)
|
70
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
71
|
-
|
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'
|
72
156
|
end
|
73
157
|
|
74
158
|
params = {
|
@@ -85,21 +169,17 @@ module LbdSdk
|
|
85
169
|
end
|
86
170
|
params
|
87
171
|
end
|
88
|
-
|
172
|
+
|
89
173
|
def user_proxy_request(options)
|
90
174
|
if options[:owner_address].nil?
|
91
175
|
raise ArgumentError, 'owner_address is required'
|
92
176
|
end
|
93
177
|
|
94
|
-
params = {
|
95
|
-
|
96
|
-
}
|
97
|
-
if !options[:landing_uri].nil?
|
98
|
-
params[:landingUri] = options[:landing_uri]
|
99
|
-
end
|
178
|
+
params = { ownerAddress: options[:owner_address] }
|
179
|
+
params[:landingUri] = options[:landing_uri] if !options[:landing_uri].nil?
|
100
180
|
params
|
101
181
|
end
|
102
|
-
|
182
|
+
|
103
183
|
def issue_transfer_session_token_request(options)
|
104
184
|
if options[:amount].nil?
|
105
185
|
raise ArgumentError, 'amount is required'
|
@@ -107,14 +187,10 @@ module LbdSdk
|
|
107
187
|
raise ArgumentError, 'Invalid amount - $amount is less than zero'
|
108
188
|
end
|
109
189
|
|
110
|
-
params = {
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
if !options[:landing_uri].nil?
|
115
|
-
params[:landingUri] = options[:landing_uri]
|
116
|
-
end
|
117
|
-
|
190
|
+
params = { amount: options[:amount].to_s }
|
191
|
+
|
192
|
+
params[:landingUri] = options[:landing_uri] if !options[:landing_uri].nil?
|
193
|
+
|
118
194
|
if !options[:to_user_id].nil?
|
119
195
|
params[:toUserId] = options[:to_user_id]
|
120
196
|
elsif !options[:to_address].nil?
|
@@ -124,10 +200,12 @@ module LbdSdk
|
|
124
200
|
end
|
125
201
|
params
|
126
202
|
end
|
127
|
-
|
203
|
+
|
128
204
|
def transfer_service_token_proxy_request(options)
|
129
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
130
|
-
|
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'
|
131
209
|
end
|
132
210
|
|
133
211
|
params = {
|
@@ -144,10 +222,12 @@ module LbdSdk
|
|
144
222
|
end
|
145
223
|
params
|
146
224
|
end
|
147
|
-
|
225
|
+
|
148
226
|
def transfer_fungible_token_proxy_request(options)
|
149
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
150
|
-
|
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'
|
151
231
|
end
|
152
232
|
|
153
233
|
params = {
|
@@ -164,7 +244,7 @@ module LbdSdk
|
|
164
244
|
end
|
165
245
|
params
|
166
246
|
end
|
167
|
-
|
247
|
+
|
168
248
|
def transfer_non_fungible_token_proxy_request(options)
|
169
249
|
if options[:owner_address].nil? || options[:owner_secret].nil?
|
170
250
|
raise ArgumentError, 'owner_address and owner_secret are required'
|
@@ -183,7 +263,7 @@ module LbdSdk
|
|
183
263
|
end
|
184
264
|
params
|
185
265
|
end
|
186
|
-
|
266
|
+
|
187
267
|
def batch_transfer_non_fungible_token_proxy_request(options)
|
188
268
|
if options[:owner_address].nil? || options[:owner_secret].nil?
|
189
269
|
raise ArgumentError, 'owner_address and owner_secret are required'
|
@@ -193,18 +273,18 @@ module LbdSdk
|
|
193
273
|
ownerAddress: options[:owner_address],
|
194
274
|
ownerSecret: options[:owner_secret],
|
195
275
|
}
|
196
|
-
|
276
|
+
|
197
277
|
if !options[:transfer_list].nil? &&
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
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
|
204
284
|
else
|
205
285
|
raise ArgumentError, 'transfer_list is inappropriate'
|
206
286
|
end
|
207
|
-
|
287
|
+
|
208
288
|
if !options[:to_user_id].nil?
|
209
289
|
params[:toUserId] = options[:to_user_id]
|
210
290
|
elsif !options[:to_address].nil?
|
@@ -214,7 +294,7 @@ module LbdSdk
|
|
214
294
|
end
|
215
295
|
params
|
216
296
|
end
|
217
|
-
|
297
|
+
|
218
298
|
def transfer_base_coin_request(options)
|
219
299
|
if options[:wallet_secret].nil? || options[:amount].nil?
|
220
300
|
raise ArgumentError, 'amount and wallet_secret are required'
|
@@ -233,7 +313,7 @@ module LbdSdk
|
|
233
313
|
end
|
234
314
|
params
|
235
315
|
end
|
236
|
-
|
316
|
+
|
237
317
|
def transfer_service_token_request(options)
|
238
318
|
if options[:wallet_secret].nil? || options[:amount].nil?
|
239
319
|
raise ArgumentError, 'amount and wallet_secret are required'
|
@@ -253,7 +333,7 @@ module LbdSdk
|
|
253
333
|
end
|
254
334
|
params
|
255
335
|
end
|
256
|
-
|
336
|
+
|
257
337
|
def transfer_fungible_token_request(options)
|
258
338
|
if options[:wallet_secret].nil? || options[:amount].nil?
|
259
339
|
raise ArgumentError, 'amount and wallet_secret are required'
|
@@ -273,15 +353,13 @@ module LbdSdk
|
|
273
353
|
end
|
274
354
|
params
|
275
355
|
end
|
276
|
-
|
356
|
+
|
277
357
|
def transfer_non_fungible_token_request(options)
|
278
358
|
if options[:wallet_secret].nil?
|
279
359
|
raise ArgumentError, 'wallet_secret is required'
|
280
360
|
end
|
281
361
|
|
282
|
-
params = {
|
283
|
-
walletSecret: options[:wallet_secret],
|
284
|
-
}
|
362
|
+
params = { walletSecret: options[:wallet_secret] }
|
285
363
|
if !options[:to_user_id].nil?
|
286
364
|
params[:toUserId] = options[:to_user_id]
|
287
365
|
elsif !options[:to_address].nil?
|
@@ -291,27 +369,25 @@ module LbdSdk
|
|
291
369
|
end
|
292
370
|
params
|
293
371
|
end
|
294
|
-
|
372
|
+
|
295
373
|
def batch_transfer_non_fungible_token_request(options)
|
296
374
|
if options[:wallet_secret].nil?
|
297
375
|
raise ArgumentError, 'wallet_secret are required'
|
298
376
|
end
|
299
377
|
|
300
|
-
params = {
|
301
|
-
|
302
|
-
}
|
303
|
-
|
378
|
+
params = { walletSecret: options[:wallet_secret] }
|
379
|
+
|
304
380
|
if !options[:transfer_list].nil? &&
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
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
|
311
387
|
else
|
312
388
|
raise ArgumentError, 'transfer_list is inappropriate'
|
313
389
|
end
|
314
|
-
|
390
|
+
|
315
391
|
if !options[:to_user_id].nil?
|
316
392
|
params[:toUserId] = options[:to_user_id]
|
317
393
|
elsif !options[:to_address].nil?
|
@@ -321,10 +397,12 @@ module LbdSdk
|
|
321
397
|
end
|
322
398
|
params
|
323
399
|
end
|
324
|
-
|
400
|
+
|
325
401
|
def fungible_token_create_update_request(options)
|
326
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
327
|
-
|
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'
|
328
406
|
end
|
329
407
|
|
330
408
|
params = {
|
@@ -333,15 +411,15 @@ module LbdSdk
|
|
333
411
|
name: options[:name],
|
334
412
|
}
|
335
413
|
|
336
|
-
if !options[:meta].nil?
|
337
|
-
params[:meta] = options[:meta]
|
338
|
-
end
|
414
|
+
params[:meta] = options[:meta] if !options[:meta].nil?
|
339
415
|
params
|
340
416
|
end
|
341
|
-
|
417
|
+
|
342
418
|
def non_fungible_token_create_update_request(options)
|
343
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
344
|
-
|
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'
|
345
423
|
end
|
346
424
|
|
347
425
|
params = {
|
@@ -350,15 +428,16 @@ module LbdSdk
|
|
350
428
|
name: options[:name],
|
351
429
|
}
|
352
430
|
|
353
|
-
if !options[:meta].nil?
|
354
|
-
params[:meta] = options[:meta]
|
355
|
-
end
|
431
|
+
params[:meta] = options[:meta] if !options[:meta].nil?
|
356
432
|
params
|
357
433
|
end
|
358
|
-
|
434
|
+
|
359
435
|
def non_fungible_token_attach_request(options)
|
360
|
-
if options[:parent_token_id].nil? ||
|
361
|
-
|
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'
|
362
441
|
end
|
363
442
|
|
364
443
|
params = {
|
@@ -372,14 +451,17 @@ module LbdSdk
|
|
372
451
|
elsif !options[:token_holder_user_id].nil?
|
373
452
|
params[:tokenHolderUserId] = options[:token_holder_user_id]
|
374
453
|
else
|
375
|
-
raise ArgumentError,
|
454
|
+
raise ArgumentError,
|
455
|
+
'token_holder_address or token_holder_user_id, one of them is required'
|
376
456
|
end
|
377
457
|
params
|
378
458
|
end
|
379
|
-
|
459
|
+
|
380
460
|
def non_fungible_token_detach_request(options)
|
381
|
-
if options[:service_wallet_address].nil? ||
|
382
|
-
|
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'
|
383
465
|
end
|
384
466
|
|
385
467
|
params = {
|
@@ -392,14 +474,17 @@ module LbdSdk
|
|
392
474
|
elsif !options[:token_holder_user_id].nil?
|
393
475
|
params[:tokenHolderUserId] = options[:token_holder_user_id]
|
394
476
|
else
|
395
|
-
raise ArgumentError,
|
477
|
+
raise ArgumentError,
|
478
|
+
'token_holder_address or token_holder_user_id, one of them is required'
|
396
479
|
end
|
397
480
|
params
|
398
481
|
end
|
399
|
-
|
482
|
+
|
400
483
|
def fungible_token_mint_request(options)
|
401
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
402
|
-
|
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'
|
403
488
|
end
|
404
489
|
|
405
490
|
params = {
|
@@ -417,10 +502,12 @@ module LbdSdk
|
|
417
502
|
end
|
418
503
|
params
|
419
504
|
end
|
420
|
-
|
505
|
+
|
421
506
|
def fungible_token_burn_request(options)
|
422
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
423
|
-
|
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'
|
424
511
|
end
|
425
512
|
|
426
513
|
params = {
|
@@ -438,10 +525,12 @@ module LbdSdk
|
|
438
525
|
end
|
439
526
|
params
|
440
527
|
end
|
441
|
-
|
528
|
+
|
442
529
|
def non_fungible_token_mint_request(options)
|
443
|
-
if options[:owner_address].nil? || options[:owner_secret].nil? ||
|
444
|
-
|
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'
|
445
534
|
end
|
446
535
|
|
447
536
|
params = {
|
@@ -449,11 +538,9 @@ module LbdSdk
|
|
449
538
|
ownerSecret: options[:owner_secret],
|
450
539
|
name: options[:name],
|
451
540
|
}
|
452
|
-
|
453
|
-
if !options[:meta].nil?
|
454
|
-
|
455
|
-
end
|
456
|
-
|
541
|
+
|
542
|
+
params[:meta] = options[:meta] if !options[:meta].nil?
|
543
|
+
|
457
544
|
if !options[:to_user_id].nil?
|
458
545
|
params[:toUserId] = options[:to_user_id]
|
459
546
|
elsif !options[:to_address].nil?
|
@@ -463,7 +550,7 @@ module LbdSdk
|
|
463
550
|
end
|
464
551
|
params
|
465
552
|
end
|
466
|
-
|
553
|
+
|
467
554
|
def non_fungible_token_multi_mint_request(options)
|
468
555
|
if options[:owner_address].nil? || options[:owner_secret].nil?
|
469
556
|
raise ArgumentError, 'owner_address and owner_secret are required'
|
@@ -474,28 +561,28 @@ module LbdSdk
|
|
474
561
|
ownerSecret: options[:owner_secret],
|
475
562
|
mintList: options[:mint_list],
|
476
563
|
}
|
477
|
-
|
478
|
-
if !options[:mint_list].nil? && options[:mint_list].is_a?(Array) && !options[:mint_list].empty?
|
479
|
-
params[:mintList] = options[:mint_list].map do |option|
|
480
|
-
if option[:token_type].nil? || option[:name].nil?
|
481
|
-
raise ArgumentError, 'token_type and name are required'
|
482
|
-
end
|
483
564
|
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
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
|
491
581
|
end
|
492
|
-
|
493
|
-
inner_params
|
494
|
-
end
|
495
582
|
else
|
496
583
|
raise ArgumentError, 'mint_list is required and must be an Array'
|
497
584
|
end
|
498
|
-
|
585
|
+
|
499
586
|
if !options[:to_user_id].nil?
|
500
587
|
params[:toUserId] = options[:to_user_id]
|
501
588
|
elsif !options[:to_address].nil?
|
@@ -503,10 +590,10 @@ module LbdSdk
|
|
503
590
|
else
|
504
591
|
raise ArgumentError, 'to_user_id or to_address is required'
|
505
592
|
end
|
506
|
-
|
593
|
+
|
507
594
|
params
|
508
595
|
end
|
509
|
-
|
596
|
+
|
510
597
|
def non_fungible_token_multi_mint_multi_recipients_request(options)
|
511
598
|
if options[:owner_address].nil? || options[:owner_secret].nil?
|
512
599
|
raise ArgumentError, 'owner_address and owner_secret are required'
|
@@ -517,39 +604,39 @@ module LbdSdk
|
|
517
604
|
ownerSecret: options[:owner_secret],
|
518
605
|
mintList: options[:mint_list],
|
519
606
|
}
|
520
|
-
|
521
|
-
if !options[:mint_list].nil? && options[:mint_list].is_a?(Array) && !options[:mint_list].empty?
|
522
|
-
params[:mintList] = options[:mint_list].map do |option|
|
523
|
-
if option[:token_type].nil? || option[:name].nil?
|
524
|
-
raise ArgumentError, 'token_type and name are required'
|
525
|
-
end
|
526
607
|
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
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
|
542
632
|
end
|
543
|
-
|
544
|
-
inner_params
|
545
|
-
end
|
546
633
|
else
|
547
634
|
raise ArgumentError, 'mint_list is required and must be an Array'
|
548
635
|
end
|
549
|
-
|
636
|
+
|
550
637
|
params
|
551
638
|
end
|
552
|
-
|
639
|
+
|
553
640
|
def non_fungible_token_burn_request(options)
|
554
641
|
if options[:owner_address].nil? || options[:owner_secret].nil?
|
555
642
|
raise ArgumentError, 'owner_address and owner_secret are required'
|
@@ -568,58 +655,56 @@ module LbdSdk
|
|
568
655
|
end
|
569
656
|
params
|
570
657
|
end
|
571
|
-
|
658
|
+
|
572
659
|
def fungible_token_media_resources_request(options)
|
573
|
-
params = {
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
options[:update_list].
|
579
|
-
|
580
|
-
|
581
|
-
|
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] }
|
582
670
|
end
|
583
|
-
{
|
584
|
-
tokenType: option[:token_type] || option[:tokenType],
|
585
|
-
}
|
586
|
-
end
|
587
671
|
else
|
588
672
|
raise ArgumentError, 'update_list is required and must be an Array'
|
589
673
|
end
|
590
|
-
|
674
|
+
|
591
675
|
params
|
592
676
|
end
|
593
|
-
|
677
|
+
|
594
678
|
def non_fungible_token_media_resources_request(options)
|
595
|
-
params = {
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
options[:update_list].
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
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
|
+
}
|
606
695
|
end
|
607
|
-
|
608
|
-
{
|
609
|
-
tokenType: option[:token_type] || option[:tokenType],
|
610
|
-
tokenIndex: option[:token_index] || option[:tokenIndex],
|
611
|
-
}
|
612
|
-
end
|
613
696
|
else
|
614
697
|
raise ArgumentError, 'update_list is required and must be an Array'
|
615
698
|
end
|
616
|
-
|
699
|
+
|
617
700
|
params
|
618
701
|
end
|
619
|
-
|
702
|
+
|
620
703
|
def memo_request(options)
|
621
|
-
if options[:wallet_address].nil? || options[:wallet_secret].nil? ||
|
622
|
-
|
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'
|
623
708
|
end
|
624
709
|
|
625
710
|
{
|
@@ -629,4 +714,4 @@ module LbdSdk
|
|
629
714
|
}
|
630
715
|
end
|
631
716
|
end
|
632
|
-
end
|
717
|
+
end
|