Class: TridentAssistant::CLI::NFO
- Defined in:
- lib/trident_assistant/cli/nfo.rb
Overview
CLI to mint NFTs
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
#api, #bot, #client, #keystore
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from TridentAssistant::CLI::Base
Instance Method Details
#bulkmint(dir) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/trident_assistant/cli/nfo.rb', line 21 def bulkmint(dir) raise "#{dir} is not a directory" unless Dir.exist?(dir) files = Dir.glob("#{dir}/*.json") minted = [] files.each do |file| log "-" * 80 log UI.fmt("{{v}} found #{file}") attempt = 0 success = begin attempt += 1 _mint file rescue Errno::ECONNRESET, OpenSSL::SSL::SSLError, MixinBot::HttpError, TridentAssistant::Client::HttpError, TridentAssistant::Client::RequestError, MixinBot::RequestError => e log UI.fmt("{{x}} #{e.inspect}") log UI.fmt("Retrying #{attempt} times...") sleep 0.5 retry end minted.push(file) if success rescue TridentAssistant::Utils::Metadata::InvalidFormatError, JSON::ParserError, RuntimeError => e log UI.fmt("{{x}} #{file} failed: #{e.inspect}") next end ensure log UI.fmt("Found #{files.size} json file, minted #{minted.size}") end |
#mint ⇒ Object
12 13 14 15 16 17 |
# File 'lib/trident_assistant/cli/nfo.rb', line 12 def mint _mint [:metadata] rescue JSON::ParserError, Client::RequestError, TridentAssistant::Utils::Metadata::InvalidFormatError, MixinBot::Error, RuntimeError => e log UI.fmt("{{x}} #{e.inspect}") end |