lbd_sdk 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/push.yml +27 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/lib/lbd_sdk/client.rb +3 -458
- data/lib/lbd_sdk/request.rb +632 -0
- data/lib/lbd_sdk/version.rb +1 -1
- data/lib/lbd_sdk.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0b79e8aabf0155fbb6063b70a38b8fad46b0c05ebb3cc6c6094b52afdf9cb24
|
4
|
+
data.tar.gz: 58ecaac5aec2874b65eec1e7bb4d75c37b99a2e40a15cc802b9172e021318969
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dac71daadfed1033302bdb73cfa91ec608a2303922cf0d75ec731802ed6f9dbc2594a882f7dbfd268e8c0f121a93c29c180af8c5d9f4803fdc5e9bc9ea446a4c
|
7
|
+
data.tar.gz: e27b83b6e7d2f12e150d67649237a70d2c3e39387e929bf6f32a833143708a11a810a780b549f3a59b97021339fef3259b0736af3dfb1236164962e39dfe1a1c
|
@@ -0,0 +1,27 @@
|
|
1
|
+
name: Publish Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
release:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
name: Ruby v3.0
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
- name: Install Ruby 3.0
|
15
|
+
uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: 3.0
|
18
|
+
- name: Publish gem to rubygems.org
|
19
|
+
run: |
|
20
|
+
mkdir -p $HOME/.gem
|
21
|
+
touch $HOME/.gem/credentials
|
22
|
+
chmod 0600 $HOME/.gem/credentials
|
23
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
24
|
+
gem build *.gemspec
|
25
|
+
gem push *.gem
|
26
|
+
env:
|
27
|
+
GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_AUTH_TOKEN }}"
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -25,7 +25,7 @@ Or install it yourself as:
|
|
25
25
|
|
26
26
|
```ruby
|
27
27
|
client = LbdSdk::Client.new do |config|
|
28
|
-
config.endpoint = 'https://test-api.blockchain.line.me
|
28
|
+
config.endpoint = 'https://test-api.blockchain.line.me'
|
29
29
|
config.api_key = 'your_api_key'
|
30
30
|
config.api_secret_key = 'your_secret_key'
|
31
31
|
end
|
@@ -142,6 +142,7 @@ client.burn_non_fungible_token("contract_id", "token_type", "token_index", {
|
|
142
142
|
- [x] GET /v1/memos/{txHash}
|
143
143
|
- [x] GET /v1/time
|
144
144
|
- [x] GET /v1/transactions/{txHash}
|
145
|
+
- [ ] API payloads test. All payloads at least should be checked if the inputs are required or optional.
|
145
146
|
|
146
147
|
## Development
|
147
148
|
|
data/lib/lbd_sdk/client.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
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,6 +11,8 @@ 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/'
|
@@ -394,459 +393,5 @@ module LbdSdk
|
|
394
393
|
),
|
395
394
|
}
|
396
395
|
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],
|
849
|
-
}
|
850
|
-
end
|
851
396
|
end
|
852
397
|
end
|
@@ -0,0 +1,632 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module LbdSdk
|
4
|
+
module Request
|
5
|
+
def page_request(options)
|
6
|
+
{
|
7
|
+
limit: options[:limit] || 10,
|
8
|
+
page: options[:page] || 1,
|
9
|
+
orderBy: options[:order_by] || 'desc',
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
def transaction_page_request(options)
|
14
|
+
params = {
|
15
|
+
limit: options[:limit] || 10,
|
16
|
+
page: options[:page] || 1,
|
17
|
+
orderBy: options[:order_by] || 'desc',
|
18
|
+
}
|
19
|
+
if !options[:before].nil?
|
20
|
+
params[:before] = options[:before]
|
21
|
+
end
|
22
|
+
if !options[:after].nil?
|
23
|
+
params[:after] = options[:after]
|
24
|
+
end
|
25
|
+
if !options[:msgType].nil?
|
26
|
+
params[:msgType] = options[:msgType]
|
27
|
+
end
|
28
|
+
params
|
29
|
+
end
|
30
|
+
|
31
|
+
def update_service_token_request(options)
|
32
|
+
if options[:owner_address].nil? || options[:owner_secret].nil?
|
33
|
+
raise ArgumentError, 'owner_address and owner_secret are required'
|
34
|
+
end
|
35
|
+
|
36
|
+
params = {
|
37
|
+
ownerAddress: options[:owner_address],
|
38
|
+
ownerSecret: options[:owner_secret],
|
39
|
+
}
|
40
|
+
if !options[:name].nil?
|
41
|
+
params[:name] = options[:name]
|
42
|
+
end
|
43
|
+
if !options[:meta].nil?
|
44
|
+
params[:meta] = options[:meta]
|
45
|
+
end
|
46
|
+
params
|
47
|
+
end
|
48
|
+
|
49
|
+
def mint_service_token_request(options)
|
50
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? || options[:amount].nil?
|
51
|
+
raise ArgumentError, 'owner_address and owner_secret and amount are required'
|
52
|
+
end
|
53
|
+
|
54
|
+
params = {
|
55
|
+
ownerAddress: options[:owner_address],
|
56
|
+
ownerSecret: options[:owner_secret],
|
57
|
+
amount: options[:amount].to_s,
|
58
|
+
}
|
59
|
+
if !options[:to_user_id].nil?
|
60
|
+
params[:toUserId] = options[:to_user_id]
|
61
|
+
elsif !options[:to_address].nil?
|
62
|
+
params[:toAddress] = options[:to_address]
|
63
|
+
else
|
64
|
+
raise ArgumentError, 'to_user_id or to_address is required'
|
65
|
+
end
|
66
|
+
params
|
67
|
+
end
|
68
|
+
|
69
|
+
def burn_from_service_token_request(options)
|
70
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? || options[:amount].nil?
|
71
|
+
raise ArgumentError, 'owner_address and owner_secret and amount are required'
|
72
|
+
end
|
73
|
+
|
74
|
+
params = {
|
75
|
+
ownerAddress: options[:owner_address],
|
76
|
+
ownerSecret: options[:owner_secret],
|
77
|
+
amount: options[:amount].to_s,
|
78
|
+
}
|
79
|
+
if !options[:from_user_id].nil?
|
80
|
+
params[:fromUserId] = options[:from_user_id]
|
81
|
+
elsif !options[:from_address].nil?
|
82
|
+
params[:fromAddress] = options[:from_address]
|
83
|
+
else
|
84
|
+
raise ArgumentError, 'from_user_id or from_address is required'
|
85
|
+
end
|
86
|
+
params
|
87
|
+
end
|
88
|
+
|
89
|
+
def user_proxy_request(options)
|
90
|
+
if options[:owner_address].nil?
|
91
|
+
raise ArgumentError, 'owner_address is required'
|
92
|
+
end
|
93
|
+
|
94
|
+
params = {
|
95
|
+
ownerAddress: options[:owner_address],
|
96
|
+
}
|
97
|
+
if !options[:landing_uri].nil?
|
98
|
+
params[:landingUri] = options[:landing_uri]
|
99
|
+
end
|
100
|
+
params
|
101
|
+
end
|
102
|
+
|
103
|
+
def issue_transfer_session_token_request(options)
|
104
|
+
if options[:amount].nil?
|
105
|
+
raise ArgumentError, 'amount is required'
|
106
|
+
elsif options[:amount].to_i <= 0
|
107
|
+
raise ArgumentError, 'Invalid amount - $amount is less than zero'
|
108
|
+
end
|
109
|
+
|
110
|
+
params = {
|
111
|
+
amount: options[:amount].to_s,
|
112
|
+
}
|
113
|
+
|
114
|
+
if !options[:landing_uri].nil?
|
115
|
+
params[:landingUri] = options[:landing_uri]
|
116
|
+
end
|
117
|
+
|
118
|
+
if !options[:to_user_id].nil?
|
119
|
+
params[:toUserId] = options[:to_user_id]
|
120
|
+
elsif !options[:to_address].nil?
|
121
|
+
params[:toAddress] = options[:to_address]
|
122
|
+
else
|
123
|
+
raise ArgumentError, 'to_user_id or to_address is required'
|
124
|
+
end
|
125
|
+
params
|
126
|
+
end
|
127
|
+
|
128
|
+
def transfer_service_token_proxy_request(options)
|
129
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? || options[:amount].nil?
|
130
|
+
raise ArgumentError, 'owner_address and owner_secret and amount are required'
|
131
|
+
end
|
132
|
+
|
133
|
+
params = {
|
134
|
+
ownerAddress: options[:owner_address],
|
135
|
+
ownerSecret: options[:owner_secret],
|
136
|
+
amount: options[:amount].to_s,
|
137
|
+
}
|
138
|
+
if !options[:to_user_id].nil?
|
139
|
+
params[:toUserId] = options[:to_user_id]
|
140
|
+
elsif !options[:to_address].nil?
|
141
|
+
params[:toAddress] = options[:to_address]
|
142
|
+
else
|
143
|
+
raise ArgumentError, 'to_user_id or to_address is required'
|
144
|
+
end
|
145
|
+
params
|
146
|
+
end
|
147
|
+
|
148
|
+
def transfer_fungible_token_proxy_request(options)
|
149
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? || options[:amount].nil?
|
150
|
+
raise ArgumentError, 'owner_address and owner_secret and amount are required'
|
151
|
+
end
|
152
|
+
|
153
|
+
params = {
|
154
|
+
ownerAddress: options[:owner_address],
|
155
|
+
ownerSecret: options[:owner_secret],
|
156
|
+
amount: options[:amount].to_s,
|
157
|
+
}
|
158
|
+
if !options[:to_user_id].nil?
|
159
|
+
params[:toUserId] = options[:to_user_id]
|
160
|
+
elsif !options[:to_address].nil?
|
161
|
+
params[:toAddress] = options[:to_address]
|
162
|
+
else
|
163
|
+
raise ArgumentError, 'to_user_id or to_address is required'
|
164
|
+
end
|
165
|
+
params
|
166
|
+
end
|
167
|
+
|
168
|
+
def transfer_non_fungible_token_proxy_request(options)
|
169
|
+
if options[:owner_address].nil? || options[:owner_secret].nil?
|
170
|
+
raise ArgumentError, 'owner_address and owner_secret are required'
|
171
|
+
end
|
172
|
+
|
173
|
+
params = {
|
174
|
+
ownerAddress: options[:owner_address],
|
175
|
+
ownerSecret: options[:owner_secret],
|
176
|
+
}
|
177
|
+
if !options[:to_user_id].nil?
|
178
|
+
params[:toUserId] = options[:to_user_id]
|
179
|
+
elsif !options[:to_address].nil?
|
180
|
+
params[:toAddress] = options[:to_address]
|
181
|
+
else
|
182
|
+
raise ArgumentError, 'to_user_id or to_address is required'
|
183
|
+
end
|
184
|
+
params
|
185
|
+
end
|
186
|
+
|
187
|
+
def batch_transfer_non_fungible_token_proxy_request(options)
|
188
|
+
if options[:owner_address].nil? || options[:owner_secret].nil?
|
189
|
+
raise ArgumentError, 'owner_address and owner_secret are required'
|
190
|
+
end
|
191
|
+
|
192
|
+
params = {
|
193
|
+
ownerAddress: options[:owner_address],
|
194
|
+
ownerSecret: options[:owner_secret],
|
195
|
+
}
|
196
|
+
|
197
|
+
if !options[:transfer_list].nil? &&
|
198
|
+
options[:transfer_list].is_a?(Array) && !options[:transfer_list].empty?
|
199
|
+
params[:transferList] = options[:transfer_list].map do |option|
|
200
|
+
{
|
201
|
+
tokenId: option[:token_id] || option[:tokenId],
|
202
|
+
}
|
203
|
+
end
|
204
|
+
else
|
205
|
+
raise ArgumentError, 'transfer_list is inappropriate'
|
206
|
+
end
|
207
|
+
|
208
|
+
if !options[:to_user_id].nil?
|
209
|
+
params[:toUserId] = options[:to_user_id]
|
210
|
+
elsif !options[:to_address].nil?
|
211
|
+
params[:toAddress] = options[:to_address]
|
212
|
+
else
|
213
|
+
raise ArgumentError, 'to_user_id or to_address is required'
|
214
|
+
end
|
215
|
+
params
|
216
|
+
end
|
217
|
+
|
218
|
+
def transfer_base_coin_request(options)
|
219
|
+
if options[:wallet_secret].nil? || options[:amount].nil?
|
220
|
+
raise ArgumentError, 'amount and wallet_secret are required'
|
221
|
+
end
|
222
|
+
|
223
|
+
params = {
|
224
|
+
walletSecret: options[:wallet_secret],
|
225
|
+
amount: options[:amount].to_s,
|
226
|
+
}
|
227
|
+
if !options[:to_user_id].nil?
|
228
|
+
params[:toUserId] = options[:to_user_id]
|
229
|
+
elsif !options[:to_address].nil?
|
230
|
+
params[:toAddress] = options[:to_address]
|
231
|
+
else
|
232
|
+
raise ArgumentError, 'to_user_id or to_address is required'
|
233
|
+
end
|
234
|
+
params
|
235
|
+
end
|
236
|
+
|
237
|
+
def transfer_service_token_request(options)
|
238
|
+
if options[:wallet_secret].nil? || options[:amount].nil?
|
239
|
+
raise ArgumentError, 'amount and wallet_secret are required'
|
240
|
+
end
|
241
|
+
|
242
|
+
params = {
|
243
|
+
walletSecret: options[:wallet_secret],
|
244
|
+
amount: options[:amount].to_s,
|
245
|
+
}
|
246
|
+
|
247
|
+
if !options[:to_user_id].nil?
|
248
|
+
params[:toUserId] = options[:to_user_id]
|
249
|
+
elsif !options[:to_address].nil?
|
250
|
+
params[:toAddress] = options[:to_address]
|
251
|
+
else
|
252
|
+
raise ArgumentError, 'to_user_id or to_address is required'
|
253
|
+
end
|
254
|
+
params
|
255
|
+
end
|
256
|
+
|
257
|
+
def transfer_fungible_token_request(options)
|
258
|
+
if options[:wallet_secret].nil? || options[:amount].nil?
|
259
|
+
raise ArgumentError, 'amount and wallet_secret are required'
|
260
|
+
end
|
261
|
+
|
262
|
+
params = {
|
263
|
+
walletSecret: options[:wallet_secret],
|
264
|
+
amount: options[:amount].to_s,
|
265
|
+
}
|
266
|
+
|
267
|
+
if !options[:to_user_id].nil?
|
268
|
+
params[:toUserId] = options[:to_user_id]
|
269
|
+
elsif !options[:to_address].nil?
|
270
|
+
params[:toAddress] = options[:to_address]
|
271
|
+
else
|
272
|
+
raise ArgumentError, 'to_user_id or to_address is required'
|
273
|
+
end
|
274
|
+
params
|
275
|
+
end
|
276
|
+
|
277
|
+
def transfer_non_fungible_token_request(options)
|
278
|
+
if options[:wallet_secret].nil?
|
279
|
+
raise ArgumentError, 'wallet_secret is required'
|
280
|
+
end
|
281
|
+
|
282
|
+
params = {
|
283
|
+
walletSecret: options[:wallet_secret],
|
284
|
+
}
|
285
|
+
if !options[:to_user_id].nil?
|
286
|
+
params[:toUserId] = options[:to_user_id]
|
287
|
+
elsif !options[:to_address].nil?
|
288
|
+
params[:toAddress] = options[:to_address]
|
289
|
+
else
|
290
|
+
raise ArgumentError, 'to_user_id or to_address is required'
|
291
|
+
end
|
292
|
+
params
|
293
|
+
end
|
294
|
+
|
295
|
+
def batch_transfer_non_fungible_token_request(options)
|
296
|
+
if options[:wallet_secret].nil?
|
297
|
+
raise ArgumentError, 'wallet_secret are required'
|
298
|
+
end
|
299
|
+
|
300
|
+
params = {
|
301
|
+
walletSecret: options[:wallet_secret],
|
302
|
+
}
|
303
|
+
|
304
|
+
if !options[:transfer_list].nil? &&
|
305
|
+
options[:transfer_list].is_a?(Array) && !options[:transfer_list].empty?
|
306
|
+
params[:transferList] = options[:transfer_list].map do |option|
|
307
|
+
{
|
308
|
+
tokenId: option[:token_id] || option[:tokenId],
|
309
|
+
}
|
310
|
+
end
|
311
|
+
else
|
312
|
+
raise ArgumentError, 'transfer_list is inappropriate'
|
313
|
+
end
|
314
|
+
|
315
|
+
if !options[:to_user_id].nil?
|
316
|
+
params[:toUserId] = options[:to_user_id]
|
317
|
+
elsif !options[:to_address].nil?
|
318
|
+
params[:toAddress] = options[:to_address]
|
319
|
+
else
|
320
|
+
raise ArgumentError, 'to_user_id or to_address is required'
|
321
|
+
end
|
322
|
+
params
|
323
|
+
end
|
324
|
+
|
325
|
+
def fungible_token_create_update_request(options)
|
326
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? || options[:name].nil?
|
327
|
+
raise ArgumentError, 'owner_address and owner_secret and name are required'
|
328
|
+
end
|
329
|
+
|
330
|
+
params = {
|
331
|
+
ownerAddress: options[:owner_address],
|
332
|
+
ownerSecret: options[:owner_secret],
|
333
|
+
name: options[:name],
|
334
|
+
}
|
335
|
+
|
336
|
+
if !options[:meta].nil?
|
337
|
+
params[:meta] = options[:meta]
|
338
|
+
end
|
339
|
+
params
|
340
|
+
end
|
341
|
+
|
342
|
+
def non_fungible_token_create_update_request(options)
|
343
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? || options[:name].nil?
|
344
|
+
raise ArgumentError, 'owner_address and owner_secret and name are required'
|
345
|
+
end
|
346
|
+
|
347
|
+
params = {
|
348
|
+
ownerAddress: options[:owner_address],
|
349
|
+
ownerSecret: options[:owner_secret],
|
350
|
+
name: options[:name],
|
351
|
+
}
|
352
|
+
|
353
|
+
if !options[:meta].nil?
|
354
|
+
params[:meta] = options[:meta]
|
355
|
+
end
|
356
|
+
params
|
357
|
+
end
|
358
|
+
|
359
|
+
def non_fungible_token_attach_request(options)
|
360
|
+
if options[:parent_token_id].nil? || options[:service_wallet_address].nil? || options[:service_wallet_secret].nil?
|
361
|
+
raise ArgumentError, 'parent_token_id and service_wallet_address and service_wallet_secret are required'
|
362
|
+
end
|
363
|
+
|
364
|
+
params = {
|
365
|
+
parentTokenId: options[:parent_token_id],
|
366
|
+
serviceWalletAddress: options[:service_wallet_address],
|
367
|
+
serviceWalletSecret: options[:service_wallet_secret],
|
368
|
+
}
|
369
|
+
|
370
|
+
if !options[:token_holder_address].nil?
|
371
|
+
params[:tokenHolderAddress] = options[:token_holder_address]
|
372
|
+
elsif !options[:token_holder_user_id].nil?
|
373
|
+
params[:tokenHolderUserId] = options[:token_holder_user_id]
|
374
|
+
else
|
375
|
+
raise ArgumentError, 'token_holder_address or token_holder_user_id, one of them is required'
|
376
|
+
end
|
377
|
+
params
|
378
|
+
end
|
379
|
+
|
380
|
+
def non_fungible_token_detach_request(options)
|
381
|
+
if options[:service_wallet_address].nil? || options[:service_wallet_secret].nil?
|
382
|
+
raise ArgumentError, 'service_wallet_address and service_wallet_secret are required'
|
383
|
+
end
|
384
|
+
|
385
|
+
params = {
|
386
|
+
serviceWalletAddress: options[:service_wallet_address],
|
387
|
+
serviceWalletSecret: options[:service_wallet_secret],
|
388
|
+
}
|
389
|
+
|
390
|
+
if !options[:token_holder_address].nil?
|
391
|
+
params[:tokenHolderAddress] = options[:token_holder_address]
|
392
|
+
elsif !options[:token_holder_user_id].nil?
|
393
|
+
params[:tokenHolderUserId] = options[:token_holder_user_id]
|
394
|
+
else
|
395
|
+
raise ArgumentError, 'token_holder_address or token_holder_user_id, one of them is required'
|
396
|
+
end
|
397
|
+
params
|
398
|
+
end
|
399
|
+
|
400
|
+
def fungible_token_mint_request(options)
|
401
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? || options[:amount].nil?
|
402
|
+
raise ArgumentError, 'owner_address and owner_secret and amount are required'
|
403
|
+
end
|
404
|
+
|
405
|
+
params = {
|
406
|
+
ownerAddress: options[:owner_address],
|
407
|
+
ownerSecret: options[:owner_secret],
|
408
|
+
amount: options[:amount].to_s,
|
409
|
+
}
|
410
|
+
|
411
|
+
if !options[:to_user_id].nil?
|
412
|
+
params[:toUserId] = options[:to_user_id]
|
413
|
+
elsif !options[:to_address].nil?
|
414
|
+
params[:toAddress] = options[:to_address]
|
415
|
+
else
|
416
|
+
raise ArgumentError, 'to_user_id or to_address is required'
|
417
|
+
end
|
418
|
+
params
|
419
|
+
end
|
420
|
+
|
421
|
+
def fungible_token_burn_request(options)
|
422
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? || options[:amount].nil?
|
423
|
+
raise ArgumentError, 'owner_address and owner_secret and amount are required'
|
424
|
+
end
|
425
|
+
|
426
|
+
params = {
|
427
|
+
ownerAddress: options[:owner_address],
|
428
|
+
ownerSecret: options[:owner_secret],
|
429
|
+
amount: options[:amount].to_s,
|
430
|
+
}
|
431
|
+
|
432
|
+
if !options[:from_user_id].nil?
|
433
|
+
params[:fromUserId] = options[:from_user_id]
|
434
|
+
elsif !options[:from_address].nil?
|
435
|
+
params[:fromAddress] = options[:from_address]
|
436
|
+
else
|
437
|
+
raise ArgumentError, 'from_user_id or from_address is required'
|
438
|
+
end
|
439
|
+
params
|
440
|
+
end
|
441
|
+
|
442
|
+
def non_fungible_token_mint_request(options)
|
443
|
+
if options[:owner_address].nil? || options[:owner_secret].nil? || options[:name].nil?
|
444
|
+
raise ArgumentError, 'owner_address and owner_secret and name are required'
|
445
|
+
end
|
446
|
+
|
447
|
+
params = {
|
448
|
+
ownerAddress: options[:owner_address],
|
449
|
+
ownerSecret: options[:owner_secret],
|
450
|
+
name: options[:name],
|
451
|
+
}
|
452
|
+
|
453
|
+
if !options[:meta].nil?
|
454
|
+
params[:meta] = options[:meta]
|
455
|
+
end
|
456
|
+
|
457
|
+
if !options[:to_user_id].nil?
|
458
|
+
params[:toUserId] = options[:to_user_id]
|
459
|
+
elsif !options[:to_address].nil?
|
460
|
+
params[:toAddress] = options[:to_address]
|
461
|
+
else
|
462
|
+
raise ArgumentError, 'to_user_id or to_address is required'
|
463
|
+
end
|
464
|
+
params
|
465
|
+
end
|
466
|
+
|
467
|
+
def non_fungible_token_multi_mint_request(options)
|
468
|
+
if options[:owner_address].nil? || options[:owner_secret].nil?
|
469
|
+
raise ArgumentError, 'owner_address and owner_secret are required'
|
470
|
+
end
|
471
|
+
|
472
|
+
params = {
|
473
|
+
ownerAddress: options[:owner_address],
|
474
|
+
ownerSecret: options[:owner_secret],
|
475
|
+
mintList: options[:mint_list],
|
476
|
+
}
|
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
|
+
|
484
|
+
inner_params = {
|
485
|
+
tokenType: option[:token_type],
|
486
|
+
name: option[:name],
|
487
|
+
}
|
488
|
+
|
489
|
+
if !option[:meta].nil?
|
490
|
+
inner_params[:meta] = option[:meta]
|
491
|
+
end
|
492
|
+
|
493
|
+
inner_params
|
494
|
+
end
|
495
|
+
else
|
496
|
+
raise ArgumentError, 'mint_list is required and must be an Array'
|
497
|
+
end
|
498
|
+
|
499
|
+
if !options[:to_user_id].nil?
|
500
|
+
params[:toUserId] = options[:to_user_id]
|
501
|
+
elsif !options[:to_address].nil?
|
502
|
+
params[:toAddress] = options[:to_address]
|
503
|
+
else
|
504
|
+
raise ArgumentError, 'to_user_id or to_address is required'
|
505
|
+
end
|
506
|
+
|
507
|
+
params
|
508
|
+
end
|
509
|
+
|
510
|
+
def non_fungible_token_multi_mint_multi_recipients_request(options)
|
511
|
+
if options[:owner_address].nil? || options[:owner_secret].nil?
|
512
|
+
raise ArgumentError, 'owner_address and owner_secret are required'
|
513
|
+
end
|
514
|
+
|
515
|
+
params = {
|
516
|
+
ownerAddress: options[:owner_address],
|
517
|
+
ownerSecret: options[:owner_secret],
|
518
|
+
mintList: options[:mint_list],
|
519
|
+
}
|
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
|
+
|
527
|
+
inner_params = {
|
528
|
+
tokenType: option[:token_type],
|
529
|
+
name: option[:name],
|
530
|
+
}
|
531
|
+
|
532
|
+
if !option[:meta].nil?
|
533
|
+
inner_params[:meta] = option[:meta]
|
534
|
+
end
|
535
|
+
|
536
|
+
if !option[:to_user_id].nil?
|
537
|
+
inner_params[:toUserId] = option[:to_user_id]
|
538
|
+
elsif !option[:to_address].nil?
|
539
|
+
inner_params[:toAddress] = option[:to_address]
|
540
|
+
else
|
541
|
+
raise ArgumentError, 'to_user_id or to_address is required'
|
542
|
+
end
|
543
|
+
|
544
|
+
inner_params
|
545
|
+
end
|
546
|
+
else
|
547
|
+
raise ArgumentError, 'mint_list is required and must be an Array'
|
548
|
+
end
|
549
|
+
|
550
|
+
params
|
551
|
+
end
|
552
|
+
|
553
|
+
def non_fungible_token_burn_request(options)
|
554
|
+
if options[:owner_address].nil? || options[:owner_secret].nil?
|
555
|
+
raise ArgumentError, 'owner_address and owner_secret are required'
|
556
|
+
end
|
557
|
+
|
558
|
+
params = {
|
559
|
+
ownerAddress: options[:owner_address],
|
560
|
+
ownerSecret: options[:owner_secret],
|
561
|
+
}
|
562
|
+
if !options[:from_user_id].nil?
|
563
|
+
params[:fromUserId] = options[:from_user_id]
|
564
|
+
elsif !options[:from_address].nil?
|
565
|
+
params[:fromAddress] = options[:from_address]
|
566
|
+
else
|
567
|
+
raise ArgumentError, 'from_user_id or from_address is required'
|
568
|
+
end
|
569
|
+
params
|
570
|
+
end
|
571
|
+
|
572
|
+
def fungible_token_media_resources_request(options)
|
573
|
+
params = {
|
574
|
+
updateList: options[:update_list],
|
575
|
+
}
|
576
|
+
|
577
|
+
if !options[:update_list].nil? &&
|
578
|
+
options[:update_list].is_a?(Array) && !options[:update_list].empty?
|
579
|
+
params[:updateList] = options[:update_list].map do |option|
|
580
|
+
if option[:token_type].nil? && option[:tokenType].nil?
|
581
|
+
raise ArgumentError, 'token_type is required'
|
582
|
+
end
|
583
|
+
{
|
584
|
+
tokenType: option[:token_type] || option[:tokenType],
|
585
|
+
}
|
586
|
+
end
|
587
|
+
else
|
588
|
+
raise ArgumentError, 'update_list is required and must be an Array'
|
589
|
+
end
|
590
|
+
|
591
|
+
params
|
592
|
+
end
|
593
|
+
|
594
|
+
def non_fungible_token_media_resources_request(options)
|
595
|
+
params = {
|
596
|
+
updateList: options[:update_list],
|
597
|
+
}
|
598
|
+
|
599
|
+
if !options[:update_list].nil? &&
|
600
|
+
options[:update_list].is_a?(Array) && !options[:update_list].empty?
|
601
|
+
params[:updateList] = options[:update_list].map do |option|
|
602
|
+
if option[:token_type].nil? && option[:tokenType].nil?
|
603
|
+
raise ArgumentError, 'token_type is required'
|
604
|
+
elsif option[:token_index].nil? && option[:tokenIndex].nil?
|
605
|
+
raise ArgumentError, 'token_index is required'
|
606
|
+
end
|
607
|
+
|
608
|
+
{
|
609
|
+
tokenType: option[:token_type] || option[:tokenType],
|
610
|
+
tokenIndex: option[:token_index] || option[:tokenIndex],
|
611
|
+
}
|
612
|
+
end
|
613
|
+
else
|
614
|
+
raise ArgumentError, 'update_list is required and must be an Array'
|
615
|
+
end
|
616
|
+
|
617
|
+
params
|
618
|
+
end
|
619
|
+
|
620
|
+
def memo_request(options)
|
621
|
+
if options[:wallet_address].nil? || options[:wallet_secret].nil? || options[:memo].nil?
|
622
|
+
raise ArgumentError, 'wallet_address and wallet_secret and memo are required'
|
623
|
+
end
|
624
|
+
|
625
|
+
{
|
626
|
+
walletAddress: options[:wallet_address],
|
627
|
+
walletSecret: options[:wallet_secret],
|
628
|
+
memo: options[:memo],
|
629
|
+
}
|
630
|
+
end
|
631
|
+
end
|
632
|
+
end
|
data/lib/lbd_sdk/version.rb
CHANGED
data/lib/lbd_sdk.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lbd_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YuheiNakasaka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: LINE Blockchain Developer SDK for Ruby. This SDK is not official LINE
|
14
14
|
SDK.
|
@@ -19,6 +19,7 @@ extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
21
|
- ".github/workflows/pull-request.yml"
|
22
|
+
- ".github/workflows/push.yml"
|
22
23
|
- ".gitignore"
|
23
24
|
- ".rspec"
|
24
25
|
- ".rubocop.yml"
|
@@ -37,6 +38,7 @@ files:
|
|
37
38
|
- lib/lbd_sdk.rb
|
38
39
|
- lib/lbd_sdk/client.rb
|
39
40
|
- lib/lbd_sdk/http_client.rb
|
41
|
+
- lib/lbd_sdk/request.rb
|
40
42
|
- lib/lbd_sdk/request_body_flattener.rb
|
41
43
|
- lib/lbd_sdk/request_param_flattener.rb
|
42
44
|
- lib/lbd_sdk/signature_generator.rb
|