trident_assistant 0.1.0 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8dc10e88acd41b1155e43177a48f310d7c7e56ea7a316cf79f24a039c73eb1fa
4
- data.tar.gz: 2a2764a29a51a7b4f0806fa54c1eb00430133b235b322ae528a199110bbcf274
3
+ metadata.gz: 5ca51a3b40da71d8ead06326ccd1377008aafe793e3881b9c4aaede46df73351
4
+ data.tar.gz: 9bf39cd480e433eab5443db26c57bec9e7c0445bb57aebdeddc2e2c439de03df
5
5
  SHA512:
6
- metadata.gz: 78e76d0f250fc3447e546d3886e1bc7d5643d49f06cbd375de5d02fd39df718a10c4e1261923322bfe502778ead6f194e2cf392670228b073c45bc834a26827f
7
- data.tar.gz: 72677e15222934ad2eaae5c96bf56d2d0c413a25e67bb34ba7f9d82db72b9640e6f102552683c80654ae33100a6e93698e1e48cbfa4c46979fd1f064973f4016
6
+ metadata.gz: 2dd9e5df04ccfb3d41bc4c6b2ce1bc3a8b7f48453d692bff4cae9901e3da1c11fd6c2d2cfe9d5cb8dac8e4601b77bdcaea5a75c167b83622027558bd2a57bcb2
7
+ data.tar.gz: 3791ef7f7ec907f6b0f2a9ce807a1a157b92999291f60c99b24fc27f578af1c33751ac1d86a6c6c0143ddcc2b2cfb75300283cd832dc749e9eeb080af45a0890
data/.rubocop.yml CHANGED
@@ -25,6 +25,8 @@ Metrics/PerceivedComplexity:
25
25
  Enabled: false
26
26
  Metrics/CyclomaticComplexity:
27
27
  Enabled: false
28
+ Metrics/ModuleLength:
29
+ Enabled: false
28
30
 
29
31
  Gemspec/DateAssignment: # new in 1.10
30
32
  Enabled: true
data/README.md CHANGED
@@ -21,11 +21,76 @@ Commands:
21
21
  ta version # Display TridentAssistant version
22
22
 
23
23
  Options:
24
- -p, [--pretty], [--no-pretty] # Print output in pretty
25
- # Default: true
26
- -e, [--environment=ENVIRONMENT] # prod | test | dev
27
- # Default: prod
28
- -E, [--endpoint=ENDPOINT] # Specify an endpoint
24
+ -E, [--endpoint=ENDPOINT] # Specify an endpoint
25
+ -P, [--pretty], [--no-pretty] # Print output in pretty
26
+ # Default: true
27
+ ```
28
+
29
+ ### Collectible
30
+
31
+ $ ta collectible
32
+
33
+ ```
34
+ Commands:
35
+ ta collectible airdrop COLLECTION, TOKEN k, --keystore=KEYSTORE # airdrop NFT
36
+ ta collectible bulkairdrop DIR k, --keystore=KEYSTORE # Airdrop NFT in bulk
37
+ ta collectible deposit COLLECTION TOKEN k, --keystore=KEYSTORE # deposit NFT
38
+ ta collectible help [COMMAND] # Describe subcommands or one specific subcommand
39
+ ta collectible index k, --keystore=KEYSTORE # query collectibles in wallet
40
+ ta collectible show COLLECTION TOKEN k, --keystore=KEYSTORE # query collectible
41
+ ta collectible withdraw COLLECTION TOKEN k, --keystore=KEYSTORE # withdraw NFT
42
+ ```
43
+
44
+ ### collection
45
+
46
+ $ ta collection
47
+
48
+ ```
49
+ Commands:
50
+ ta collection create k, --keystore=KEYSTORE # create a new collection
51
+ ta collection help [COMMAND] # Describe subcommands or one specific subcommand
52
+ ta collection index k, --keystore=KEYSTORE # query all collections
53
+ ta collection show ID k, --keystore=KEYSTORE # query a collection
54
+ ta collection update ID k, --keystore=KEYSTORE # update collection
55
+ ```
56
+
57
+ ### metadata
58
+
59
+ $ ta metadata
60
+
61
+ ```
62
+ Commands:
63
+ ta metadata help [COMMAND] # Describe subcommands or one specific subcommand
64
+ ta metadata new k, --keystore=KEYSTORE # generate a new metadata
65
+ ta metadata show METAHASH k, --keystore=KEYSTORE # query metadata via metahash
66
+ ta metadata upload k, --keystore=KEYSTORE m, --metadata=METADATA # upload metadata to Trident
67
+ ```
68
+
69
+ ### nfo
70
+
71
+ $ ta nfo
72
+
73
+ ```
74
+ Commands:
75
+ ta nfo bulkmint DIR k, --keystore=KEYSTORE # Mint NFT in bulk
76
+ ta nfo help [COMMAND] # Describe subcommands or one specific subcommand
77
+ ta nfo mint k, --keystore=KEYSTORE m, --metadata=METADATA # Mint NFT from NFO
78
+ ```
79
+
80
+ ### order
81
+
82
+ $ ta order
83
+
84
+ ```
85
+ Commands:
86
+ ta order auction # auction NFT
87
+ ta order bid # bid NFT
88
+ ta order cancel ID k, --keystore=KEYSTORE # cancel order
89
+ ta order fill ID k, --keystore=KEYSTORE # fill order
90
+ ta order help [COMMAND] # Describe subcommands or one specific subcommand
91
+ ta order index k, --keystore=KEYSTORE # list orders
92
+ ta order sell # sell NFT at fixed price
93
+ ta order show ID k, --keystore=KEYSTORE # query order
29
94
  ```
30
95
 
31
96
  ## Development
@@ -56,6 +56,23 @@ module TridentAssistant
56
56
  )
57
57
  end
58
58
 
59
+ def transfer(collection, token, recipient, **_kwargs)
60
+ token_id = MixinBot::Utils::Nfo.new(collection: collection, token: token).unique_token_id
61
+ collectible = mixin_bot.collectibles(state: :unspent)["data"].find(&->(c) { c["token_id"] == token_id })
62
+ collectible ||= mixin_bot.collectibles(state: :signed)["data"].find(&->(c) { c["token_id"] == token_id })
63
+ raise "Cannot find collectible in wallet" if collectible.blank?
64
+
65
+ memo = "TRANSFER"
66
+ nfo = MixinBot::Utils::Nfo.new(extra: memo.unpack1("H*")).encode.hex
67
+
68
+ _transfer_nft(
69
+ collectible,
70
+ nfo,
71
+ receivers: [recipient],
72
+ threshold: 1
73
+ )
74
+ end
75
+
59
76
  private
60
77
 
61
78
  def _transfer_nft(collectible, nfo, **kwargs)
@@ -8,16 +8,18 @@ module TridentAssistant
8
8
  MINIMUM_AMOUNT = 0.000_000_01
9
9
 
10
10
  def orders(**kwargs)
11
+ authorization = mixin_bot ? mixin_bot.access_token("GET", "/me") : ""
11
12
  client.get(
12
13
  "api/orders",
13
14
  headers: {
14
- Authorization: "Bearer #{mixin_bot.access_token("GET", "/me")}"
15
+ Authorization: "Bearer #{authorization}"
15
16
  },
16
17
  params: {
17
18
  collection_id: kwargs[:collection_id],
18
19
  metahash: kwargs[:metahash],
19
20
  state: kwargs[:state],
20
- type: kwargs[:type]
21
+ type: kwargs[:type],
22
+ page: kwargs[:page]
21
23
  }
22
24
  )
23
25
  end
@@ -32,6 +34,96 @@ module TridentAssistant
32
34
  )
33
35
  end
34
36
 
37
+ def ask_order(collection, token, **kwargs)
38
+ raise ArgumentError, "price cannot be blank" if kwargs[:price].blank?
39
+ raise ArgumentError, "asset_id cannot be blank" if kwargs[:asset_id].blank?
40
+
41
+ trace_id = SecureRandom.uuid
42
+ token_id = MixinBot::Utils::Nfo.new(collection: collection, token: token).unique_token_id
43
+ memo =
44
+ TridentAssistant::Utils::Memo
45
+ .new(
46
+ type: "A",
47
+ order_id: trace_id,
48
+ token_id: token_id,
49
+ price: kwargs[:price],
50
+ asset_id: kwargs[:asset_id],
51
+ expire_at: kwargs[:expire_at]
52
+ )
53
+
54
+ mixin_bot.create_multisig_transaction(
55
+ keystore[:pin],
56
+ {
57
+ asset_id: EXCHANGE_ASSET_ID,
58
+ trace_id: trace_id,
59
+ amount: MINIMUM_AMOUNT,
60
+ memo: memo.encode,
61
+ receivers: TridentAssistant::Utils::TRIDENT_MTG[:members],
62
+ threshold: TridentAssistant::Utils::TRIDENT_MTG[:threshold]
63
+ }
64
+ )
65
+ end
66
+
67
+ def auction_order(collection, token, **kwargs)
68
+ raise ArgumentError, "price cannot be blank" if kwargs[:price].blank?
69
+ raise ArgumentError, "asset_id cannot be blank" if kwargs[:asset_id].blank?
70
+
71
+ trace_id = SecureRandom.uuid
72
+ token_id = MixinBot::Utils::Nfo.new(collection: collection, token: token).unique_token_id
73
+ memo =
74
+ TridentAssistant::Utils::Memo
75
+ .new(
76
+ type: "AU",
77
+ order_id: trace_id,
78
+ token_id: token_id,
79
+ price: kwargs[:price],
80
+ reserve_price: kwargs[:reserve_price],
81
+ asset_id: kwargs[:asset_id],
82
+ expire_at: kwargs[:expire_at]
83
+ )
84
+
85
+ mixin_bot.create_multisig_transaction(
86
+ keystore[:pin],
87
+ {
88
+ asset_id: EXCHANGE_ASSET_ID,
89
+ trace_id: trace_id,
90
+ amount: MINIMUM_AMOUNT,
91
+ memo: memo.encode,
92
+ receivers: TridentAssistant::Utils::TRIDENT_MTG[:members],
93
+ threshold: TridentAssistant::Utils::TRIDENT_MTG[:threshold]
94
+ }
95
+ )
96
+ end
97
+
98
+ def bid_order(collection, token, **kwargs)
99
+ raise ArgumentError, "price cannot be blank" if kwargs[:price].blank?
100
+ raise ArgumentError, "asset_id cannot be blank" if kwargs[:asset_id].blank?
101
+
102
+ trace_id = SecureRandom.uuid
103
+ token_id = MixinBot::Utils::Nfo.new(collection: collection, token: token).unique_token_id
104
+ memo =
105
+ TridentAssistant::Utils::Memo
106
+ .new(
107
+ type: "B",
108
+ order_id: trace_id,
109
+ token_id: token_id,
110
+ asset_id: kwargs[:asset_id],
111
+ expire_at: kwargs[:expire_at]
112
+ )
113
+
114
+ mixin_bot.create_multisig_transaction(
115
+ keystore[:pin],
116
+ {
117
+ asset_id: kwargs[:asset_id],
118
+ trace_id: trace_id,
119
+ amount: kwargs[:price],
120
+ memo: memo.encode,
121
+ receivers: TridentAssistant::Utils::TRIDENT_MTG[:members],
122
+ threshold: TridentAssistant::Utils::TRIDENT_MTG[:threshold]
123
+ }
124
+ )
125
+ end
126
+
35
127
  def fill_order(order_id)
36
128
  info = order order_id
37
129
  raise "Order state: #{info["state"]}" if info["state"] != "open"
@@ -42,9 +134,9 @@ module TridentAssistant
42
134
  mixin_bot.create_multisig_transaction(
43
135
  keystore[:pin],
44
136
  {
45
- asset_id: info["asset_id"],
137
+ asset_id: info["type"] == "BidOrder" ? EXCHANGE_ASSET_ID : info["asset_id"],
46
138
  trace_id: trace_id,
47
- amount: info["price"],
139
+ amount: info["type"] == "BidOrder" ? MINIMUM_AMOUNT : info["price"],
48
140
  memo: memo.encode,
49
141
  receivers: TridentAssistant::Utils::TRIDENT_MTG[:members],
50
142
  threshold: TridentAssistant::Utils::TRIDENT_MTG[:threshold]
@@ -63,9 +155,9 @@ module TridentAssistant
63
155
  mixin_bot.create_multisig_transaction(
64
156
  keystore[:pin],
65
157
  {
66
- asset_id: info["asset_id"],
158
+ asset_id: EXCHANGE_ASSET_ID,
67
159
  trace_id: trace_id,
68
- amount: info["price"],
160
+ amount: MINIMUM_AMOUNT,
69
161
  memo: memo.encode,
70
162
  receivers: TridentAssistant::Utils::TRIDENT_MTG[:members],
71
163
  threshold: TridentAssistant::Utils::TRIDENT_MTG[:threshold]
@@ -14,16 +14,8 @@ module TridentAssistant
14
14
  def initialize(*args)
15
15
  super
16
16
 
17
- endpoint =
18
- if options[:endpoint].present?
19
- options[:endpoint]
20
- else
21
- {
22
- prod: "https://thetrident.one",
23
- test: "https://trident-test.onrender.com",
24
- dev: "http://localhost:3000"
25
- }[options[:environment].to_sym]
26
- end
17
+ endpoint = options[:endpoint] || "https://thetrident.one"
18
+
27
19
  @api =
28
20
  begin
29
21
  TridentAssistant::API.new(
@@ -25,6 +25,15 @@ module TridentAssistant
25
25
  log r["data"]
26
26
  end
27
27
 
28
+ desc "transfer COLLECTION, TOKEN, RECIPIENT", "transfer NFT"
29
+ option :keystore, type: :string, aliases: "k", required: true, desc: "keystore or keystore.json file of Mixin bot"
30
+ def transfer(collection, token, recipient)
31
+ log api.transfer collection, token, recipient
32
+ log UI.fmt("{{v}} successfully transfer NFT")
33
+ rescue StandardError => e
34
+ log UI.fmt("{{x}} failed: #{e.inspect} #{e.backtrace.join("\n")}")
35
+ end
36
+
28
37
  desc "deposit COLLECTION TOKEN", "deposit NFT"
29
38
  option :keystore, type: :string, aliases: "k", required: true, desc: "keystore or keystore.json file of Mixin bot"
30
39
  def deposit(collection, token)
@@ -60,18 +69,19 @@ module TridentAssistant
60
69
  raise "#{dir} is not a directory" unless Dir.exist?(dir)
61
70
 
62
71
  Dir.glob("#{dir}/*.json").each do |file|
72
+ log "-" * 80
63
73
  log UI.fmt("{{v}} found #{file}")
64
74
  data = TridentAssistant::Utils.parse_json file
65
- metadata = TridentAssistant::Utils.parse_metadata data
66
- log UI.fmt("{{v}} metadata parsed")
67
- metadata.validate!
68
- log UI.fmt("{{v}} metadata validated")
69
-
70
75
  if data.dig("_airdrop", "hash").present?
71
76
  log UI.fmt("{{v}} NFT already transferred")
72
77
  next
73
78
  end
74
79
 
80
+ metadata = TridentAssistant::Utils.parse_metadata data
81
+ log UI.fmt("{{v}} metadata parsed")
82
+ metadata.validate!
83
+ log UI.fmt("{{v}} metadata validated")
84
+
75
85
  receiver_id = data.dig("_airdrop", "receiver_id")
76
86
  start_at = data.dig("_airdrop", "start_at")
77
87
  log UI.fmt("{{v}} airdrop receiver_id: #{receiver_id}")
@@ -93,8 +103,7 @@ module TridentAssistant
93
103
 
94
104
  private
95
105
 
96
- def _airdrop
97
- end
106
+ def _airdrop; end
98
107
  end
99
108
  end
100
109
  end
@@ -21,14 +21,19 @@ module TridentAssistant
21
21
  def bulkmint(dir)
22
22
  raise "#{dir} is not a directory" unless Dir.exist?(dir)
23
23
 
24
- Dir.glob("#{dir}/*.json").each do |file|
24
+ files = Dir.glob("#{dir}/*.json")
25
+ minted = []
26
+ files.each do |file|
27
+ log "-" * 80
25
28
  log UI.fmt("{{v}} found #{file}")
26
- _mint file
29
+ minted.push(file) if _mint(file)
27
30
  rescue TridentAssistant::Utils::Metadata::InvalidFormatError, JSON::ParserError, Client::RequestError,
28
31
  MixinBot::Error, RuntimeError => e
29
32
  log UI.fmt("{{x}} #{file} failed: #{e.inspect}")
30
33
  next
31
34
  end
35
+ ensure
36
+ log UI.fmt("Found #{files.size} json file, minted #{minted.size}")
32
37
  end
33
38
 
34
39
  private
@@ -45,6 +50,14 @@ module TridentAssistant
45
50
 
46
51
  raise "Creator ID incompatible with keystore" if metadata.creator[:id] != api.mixin_bot.client_id
47
52
 
53
+ # upload metadata
54
+ if data.dig("_mint", "metahash").blank?
55
+ api.upload_metadata metadata: metadata.json, metahash: metadata.metahash
56
+ data["_mint"] ||= {}
57
+ data["_mint"]["metahash"] = metadata.metahash
58
+ end
59
+ log UI.fmt("{{v}} metadata uploaded: #{options[:endpoint]}/api/collectibles/#{metadata.metahash}")
60
+
48
61
  token_id = MixinBot::Utils::Nfo.new(collection: metadata.collection[:id],
49
62
  token: metadata.token[:id]).unique_token_id
50
63
  collectible =
@@ -55,40 +68,44 @@ module TridentAssistant
55
68
  end
56
69
  if collectible.present?
57
70
  log UI.fmt("{{v}} already minted: #{token_id}")
58
- return
71
+ return true
59
72
  end
60
73
 
61
- # upload metadata
62
- if data.dig("_mint", "metahash").blank?
63
- api.upload_metadata metadata: metadata.json, metahash: metadata.metahash
64
- data["_mint"] ||= {}
65
- data["_mint"]["metahash"] = metadata.metahash
66
- end
67
- log UI.fmt("{{v}} metadata uploaded: #{options[:endpoint]}/api/collectibles/#{metadata.metahash}")
68
-
69
74
  # pay to NFO
70
75
  trace_id = data.dig("_mint", "trace_id") || SecureRandom.uuid
71
76
  memo = api.mixin_bot.nft_memo metadata.collection[:id], metadata.token[:id].to_i, metadata.metahash
72
- payment =
73
- api.mixin_bot.create_multisig_transaction(
74
- api.keystore[:pin],
75
- {
76
- asset_id: TridentAssistant::Utils::MINT_ASSET_ID,
77
- trace_id: trace_id,
78
- amount: TridentAssistant::Utils::MINT_AMOUNT,
79
- memo: memo,
80
- receivers: TridentAssistant::Utils::NFO_MTG[:members],
81
- threshold: TridentAssistant::Utils::NFO_MTG[:threshold]
82
- }
83
- )
84
77
 
85
78
  data["_mint"]["trace_id"] = trace_id
86
- if payment["errors"].blank?
79
+ loop do
80
+ payment =
81
+ begin
82
+ api.mixin_bot.create_multisig_transaction(
83
+ api.keystore[:pin],
84
+ {
85
+ asset_id: TridentAssistant::Utils::MINT_ASSET_ID,
86
+ trace_id: trace_id,
87
+ amount: TridentAssistant::Utils::MINT_AMOUNT,
88
+ memo: memo,
89
+ receivers: TridentAssistant::Utils::NFO_MTG[:members],
90
+ threshold: TridentAssistant::Utils::NFO_MTG[:threshold]
91
+ }
92
+ )
93
+ rescue MixinBot::InsufficientPoolError, MixinBot::HttpError => e
94
+ log UI.fmt("{{x}} #{e.inspect}")
95
+ log "Retrying to pay..."
96
+ sleep 1
97
+ nil
98
+ end
99
+
100
+ next if payment.blank? || payment["errors"].present?
101
+
87
102
  log UI.fmt("{{v}} NFT mint payment paid: #{payment["data"]}")
88
103
  data["_mint"]["token_id"] = token_id
104
+ log UI.fmt("{{v}} NFT successfully minted")
105
+ break
89
106
  end
90
107
 
91
- log UI.fmt("{{v}} NFT successfully minted")
108
+ data.dig("_mint", "token_id").present?
92
109
  ensure
93
110
  if File.file? raw
94
111
  File.write raw, data.to_json
@@ -10,17 +10,20 @@ module TridentAssistant
10
10
  MINIMUM_AMOUNT = 0.000_000_01
11
11
 
12
12
  desc "index", "list orders"
13
- option :keystore, type: :string, aliases: "k", required: true, desc: "keystore or keystore.json file of Mixin bot"
13
+ option :keystore, type: :string, aliases: "k", required: false,
14
+ desc: "keystore or keystore.json file of Mixin bot"
14
15
  option :collection, type: :string, aliases: "c", required: false, desc: "collection ID"
15
16
  option :metahash, type: :string, aliases: "m", required: false, desc: "metahash"
16
17
  option :type, type: :string, aliases: "t", required: false, desc: "ask | bid | auction"
17
18
  option :state, type: :string, aliases: "s", required: false, desc: "open | completed"
19
+ option :page, type: :numeric, aliases: "p", required: false, desc: "page"
18
20
  def index
19
21
  log api.orders(
20
22
  collection_id: options[:collection],
21
23
  metahash: options[:metahash],
22
24
  state: options[:state],
23
- type: options[:type]
25
+ type: options[:type],
26
+ page: options[:page]
24
27
  )
25
28
  end
26
29
 
@@ -30,14 +33,36 @@ module TridentAssistant
30
33
  log api.order id
31
34
  end
32
35
 
33
- desc "sell", "sell NFT at fixed price"
34
- def ask; end
36
+ desc "ask COLECTION TOKEN", "sell NFT at fixed price"
37
+ option :asset, type: :string, aliases: "a", required: true, desc: "Order asset ID"
38
+ option :price, type: :numeric, aliases: "p", required: true, desc: "Order price"
39
+ option :expiration, type: :string, aliases: "e", required: false, desc: "Order expiration"
40
+ option :keystore, type: :string, aliases: "k", required: true, desc: "keystore or keystore.json file of Mixin bot"
41
+ def ask(collection, token)
42
+ log api.ask_order collection, token, asset_id: options[:asset], price: options[:price],
43
+ expire_at: options[:expiration]
44
+ end
35
45
 
36
46
  desc "auction", "auction NFT"
37
- def auction; end
47
+ option :asset, type: :string, aliases: "a", required: true, desc: "Order asset ID"
48
+ option :price, type: :numeric, aliases: "p", required: true, desc: "Order price"
49
+ option :reserve_price, type: :numeric, aliases: "r", required: true, desc: "Order reserve price"
50
+ option :expiration, type: :string, aliases: "e", required: false, desc: "Order expiration"
51
+ option :keystore, type: :string, aliases: "k", required: true, desc: "keystore or keystore.json file of Mixin bot"
52
+ def auction(collection, token)
53
+ log api.auction_order collection, token, asset_id: options[:asset], price: options[:price],
54
+ reserve_price: options[:reserve_price], expire_at: options[:expiration]
55
+ end
38
56
 
39
- desc "bid", "bid NFT"
40
- def bid; end
57
+ desc "bid COLECTION TOKEN", "bid NFT"
58
+ option :asset, type: :string, aliases: "a", required: true, desc: "Order asset ID"
59
+ option :price, type: :numeric, aliases: "p", required: true, desc: "Order price"
60
+ option :expiration, type: :string, aliases: "e", required: false, desc: "Order expiration"
61
+ option :keystore, type: :string, aliases: "k", required: true, desc: "keystore or keystore.json file of Mixin bot"
62
+ def bid(collection, token)
63
+ log api.bid_order collection, token, asset_id: options[:asset], price: options[:price],
64
+ expire_at: options[:expiration]
65
+ end
41
66
 
42
67
  desc "fill ID", "fill order"
43
68
  option :keystore, type: :string, aliases: "k", required: true, desc: "keystore or keystore.json file of Mixin bot"
@@ -50,28 +75,6 @@ module TridentAssistant
50
75
  def cancel(id)
51
76
  log api.cancel_order id
52
77
  end
53
-
54
- desc "deposit TOKEN", "deposit NFT"
55
- def deposit(token)
56
- log api.deposit_nft token
57
- end
58
-
59
- desc "withdraw TOKEN", "withdraw NFT"
60
- option :keystore, type: :string, aliases: "k", required: true, desc: "keystore or keystore.json file of Mixin bot"
61
- def withdraw(token)
62
- payment =
63
- api.mixin_bot.create_multisig_transaction(
64
- keystore[:pin],
65
- asset_id: EXCHANGE_ASSET_ID,
66
- amount: MINIMUM_AMOUNT,
67
- receivers: TridentAssistant::Utils::TRIDENT_MTG[:members],
68
- threshold: TridentAssistant::Utils::TRIDENT_MTG[:threshold],
69
- memo: TridentAssistant::Utils::Memo.new(type: "W", token_id: token).encode,
70
- trace_id: SecureRandom.uuid
71
- )
72
-
73
- log UI.fmt("{{v}} payment: #{payment}")
74
- end
75
78
  end
76
79
  end
77
80
  end
@@ -13,9 +13,8 @@ module TridentAssistant
13
13
  module CLI
14
14
  # Main commands of CLI
15
15
  class Command < TridentAssistant::CLI::Base
16
- class_option :pretty, type: :boolean, aliases: "-p", default: true, desc: "Print output in pretty"
17
- class_option :environment, type: :string, aliases: "-e", default: "prod", desc: "prod | test | dev"
18
16
  class_option :endpoint, type: :string, aliases: "-E", desc: "Specify an endpoint"
17
+ class_option :pretty, type: :boolean, aliases: "-P", default: true, desc: "Print output in pretty"
19
18
 
20
19
  desc "version", "Display TridentAssistant version"
21
20
  def version
@@ -44,7 +44,7 @@ module TridentAssistant
44
44
  R: reserve_price && format("%.8f", reserve_price.to_f).gsub(/(0)+\z/, ""),
45
45
  RC: receiver_id && MixinBot::Utils::UUID.new(hex: receiver_id).packed,
46
46
  S: start_at && Time.parse(start_at).to_i,
47
- E: expire_at && Time.parse(start_at).to_i
47
+ E: expire_at && Time.parse(expire_at).to_i
48
48
  }.compact
49
49
 
50
50
  @encoded =
@@ -30,6 +30,14 @@ module TridentAssistant
30
30
  ].sort,
31
31
  threshold: 3
32
32
  }.freeze
33
+ # TRIDENT_MTG = {
34
+ # members: %w[
35
+ # 28d390c7-a31b-4c46-bec2-871c86aaec53
36
+ # 0508a116-1239-4e28-b150-85a8e3e6b400
37
+ # 7ed9292d-7c95-4333-aa48-a8c640064186
38
+ # ].sort,
39
+ # threshold: 2
40
+ # }.freeze
33
41
 
34
42
  class << self
35
43
  def hash_from_url(url)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TridentAssistant
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trident_assistant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - an-lee
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-07 00:00:00.000000000 Z
11
+ date: 2022-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixin_bot
@@ -36,7 +36,6 @@ files:
36
36
  - CHANGELOG.md
37
37
  - CODE_OF_CONDUCT.md
38
38
  - Gemfile
39
- - Gemfile.lock
40
39
  - LICENSE.txt
41
40
  - README.md
42
41
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,106 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- trident_assistant (0.1.0)
5
- mixin_bot (~> 0.8)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- activesupport (7.0.2.3)
11
- concurrent-ruby (~> 1.0, >= 1.0.2)
12
- i18n (>= 1.6, < 2)
13
- minitest (>= 5.1)
14
- tzinfo (~> 2.0)
15
- addressable (2.8.0)
16
- public_suffix (>= 2.0.2, < 5.0)
17
- ast (2.4.2)
18
- awesome_print (1.9.2)
19
- bcrypt (3.1.17)
20
- cli-ui (1.5.1)
21
- concurrent-ruby (1.1.10)
22
- domain_name (0.5.20190701)
23
- unf (>= 0.0.5, < 1.0.0)
24
- eventmachine (1.2.7)
25
- faye-websocket (0.11.1)
26
- eventmachine (>= 0.12.0)
27
- websocket-driver (>= 0.5.1)
28
- ffi (1.15.5)
29
- ffi-compiler (1.0.1)
30
- ffi (>= 1.0.0)
31
- rake
32
- hamster (3.0.0)
33
- concurrent-ruby (~> 1.0)
34
- http (4.4.1)
35
- addressable (~> 2.3)
36
- http-cookie (~> 1.0)
37
- http-form_data (~> 2.2)
38
- http-parser (~> 1.2.0)
39
- http-cookie (1.0.4)
40
- domain_name (~> 0.5)
41
- http-form_data (2.3.0)
42
- http-parser (1.2.3)
43
- ffi-compiler (>= 1.0, < 2.0)
44
- i18n (1.10.0)
45
- concurrent-ruby (~> 1.0)
46
- jose (1.1.3)
47
- hamster
48
- minitest (5.15.0)
49
- mixin_bot (0.8.4)
50
- activesupport (>= 5)
51
- awesome_print (~> 1.8)
52
- bcrypt (~> 3.1)
53
- cli-ui (~> 1.3)
54
- faye-websocket (>= 0.11)
55
- http (~> 4.1)
56
- jose (~> 1.1)
57
- msgpack (~> 1.3)
58
- rbnacl (~> 7.1)
59
- sha3 (~> 1.0)
60
- thor (~> 1.0)
61
- msgpack (1.5.1)
62
- parallel (1.22.1)
63
- parser (3.1.1.0)
64
- ast (~> 2.4.1)
65
- public_suffix (4.0.6)
66
- rainbow (3.1.1)
67
- rake (13.0.6)
68
- rbnacl (7.1.1)
69
- ffi
70
- regexp_parser (2.2.1)
71
- rexml (3.2.5)
72
- rubocop (1.26.1)
73
- parallel (~> 1.10)
74
- parser (>= 3.1.0.0)
75
- rainbow (>= 2.2.2, < 4.0)
76
- regexp_parser (>= 1.8, < 3.0)
77
- rexml
78
- rubocop-ast (>= 1.16.0, < 2.0)
79
- ruby-progressbar (~> 1.7)
80
- unicode-display_width (>= 1.4.0, < 3.0)
81
- rubocop-ast (1.16.0)
82
- parser (>= 3.1.1.0)
83
- ruby-progressbar (1.11.0)
84
- sha3 (1.0.4)
85
- thor (1.2.1)
86
- tzinfo (2.0.4)
87
- concurrent-ruby (~> 1.0)
88
- unf (0.1.4)
89
- unf_ext
90
- unf_ext (0.0.8.1)
91
- unicode-display_width (2.1.0)
92
- websocket-driver (0.7.5)
93
- websocket-extensions (>= 0.1.0)
94
- websocket-extensions (0.1.5)
95
-
96
- PLATFORMS
97
- x86_64-linux
98
-
99
- DEPENDENCIES
100
- minitest (~> 5.0)
101
- rake (~> 13.0)
102
- rubocop (~> 1.21)
103
- trident_assistant!
104
-
105
- BUNDLED WITH
106
- 2.2.30