source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
58bits/partial-date
https://github.com/58bits/partial-date
spec/date_spec.rb
Ruby
mit
19
master
8,512
require 'spec_helper' require 'partial-date' describe PartialDate::Date do let(:date) { PartialDate::Date.new } it "should have a VERSION constant" do PartialDate.const_get('VERSION').should_not be_empty end it "should return an empty string for an empty date" do date.to_s.should == "" end it "...
github
58bits/partial-date
https://github.com/58bits/partial-date
spec/to_s_spec.rb
Ruby
mit
19
master
873
require 'spec_helper' require 'partial-date' describe PartialDate::Date do let(:date) { PartialDate::Date.new } describe "to string" do it "should be fast" do date.year = 2012; date.month = 12; date.day = 1 puts date.to_s end it "should not have a dash at the end if day is missing" do ...
github
heavysixer/acts_as_dismissible
https://github.com/heavysixer/acts_as_dismissible
lib/dismissible.rb
Ruby
mit
19
master
1,511
module Dismissible module Controller def self.included(base) base.send :helper_method, :cookies end end module Helpers def dismissible_message(id, opts={}, &block) opts.reverse_merge!({ :message => "Don't show this again.", :class => "dismissible_message", :...
github
heavysixer/acts_as_dismissible
https://github.com/heavysixer/acts_as_dismissible
test/acts_as_dismissible_test.rb
Ruby
mit
19
master
1,890
$:.unshift(File.dirname(__FILE__) + '/../lib') require File.dirname(__FILE__) + '/../../../../config/environment' require 'test/unit' require 'rubygems' require 'breakpoint' require 'action_controller/test_process' require File.join(File.dirname(__FILE__), 'book_controller') ActionController::Base.logger = nil Action...
github
heavysixer/acts_as_dismissible
https://github.com/heavysixer/acts_as_dismissible
test/book_controller.rb
Ruby
mit
19
master
308
class BookController < ActionController::Base # Override the normal location of the views for tests. #This will not work for rails 2.0 it has been changed to allow # multiple view paths. self.template_root = File.expand_path(File.join(File.dirname(__FILE__),'/views/')) def index end end
github
cyberark/slosilo
https://github.com/cyberark/slosilo
slosilo.gemspec
Ruby
mit
19
master
1,399
# -*- encoding: utf-8 -*- begin require File.expand_path('../lib/slosilo/version', __FILE__) rescue LoadError # so that bundle can be run without the app code module Slosilo VERSION = '0.0.0' end end Gem::Specification.new do |gem| gem.authors = ["Rafa\305\202 Rzepecki"] gem.email = ["div...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
Rakefile
Ruby
mit
19
master
373
#!/usr/bin/env rake require "bundler/gem_tasks" begin require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) rescue LoadError $stderr.puts "RSpec Rake tasks not available in environment #{ENV['RACK_ENV']}" end task :jenkins do require 'ci/reporter/rake/rspec' Rake::Task["ci:setup:rspec"].invoke R...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
spec/key_spec.rb
Ruby
mit
19
master
11,680
require 'spec_helper' require 'active_support' require 'active_support/core_ext/numeric/time' describe Slosilo::Key do include_context "with example key" subject { key } describe '#to_der' do subject { super().to_der } it { is_expected.to eq(rsa.to_der) } end describe '#to_s' do subject { s...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
spec/keystore_spec.rb
Ruby
mit
19
master
693
require 'spec_helper' describe Slosilo::Keystore do include_context "with example key" include_context "with mock adapter" describe '#put' do it "handles Slosilo::Keys" do subject.put(:test, key) expect(adapter['test'].to_der).to eq(rsa.to_der) end it "refuses to store a key with a ni...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
spec/symmetric_spec.rb
Ruby
mit
19
master
3,499
require 'spec_helper' describe Slosilo::Symmetric do # TODO transform it to class methods only? let(:plaintext) { "quick brown fox jumped over the lazy dog" } let(:auth_data) { "some record id" } let(:key) { "^\xBAIv\xDB1\x0Fi\x04\x11\xFD\x14\xA7\xCD\xDFf\x93\xFE\x93}\v\x01\x11\x98\x14\xE0;\xC1\xE2 v\xA5".forc...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
spec/spec_helper.rb
Ruby
mit
19
master
4,095
require "simplecov" require "simplecov-cobertura" SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter SimpleCov.start require 'slosilo' shared_context "with mock adapter" do require 'slosilo/adapters/mock_adapter' let(:adapter) { Slosilo::Adapters::MockAdapter.new } before { Slosilo::adapter = adap...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
spec/random_spec.rb
Ruby
mit
19
master
395
require 'spec_helper' describe Slosilo::Random do subject { Slosilo::Random } let(:other_salt) { Slosilo::Random::salt } describe '#salt' do subject { super().salt } describe '#length' do subject { super().length } it { is_expected.to eq(32) } end end describe '#salt' do subje...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
spec/slosilo_spec.rb
Ruby
mit
19
master
3,895
require 'spec_helper' describe Slosilo do include_context "with mock adapter" include_context "with example key" before { Slosilo['test'] = key } describe '[]' do it "returns a Slosilo::Key" do expect(Slosilo[:test]).to be_instance_of Slosilo::Key end it "allows looking up by fingerprint"...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
spec/jwt_spec.rb
Ruby
mit
19
master
4,627
require 'spec_helper' # (Mostly) integration tests for JWT token format describe Slosilo::Key do include_context "with example key" describe '#issue_jwt' do it 'issues an JWT token with given claims' do allow(Time).to receive(:now) { DateTime.parse('2014-06-04 23:22:32 -0400').to_time } tok = key...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
spec/file_adapter_spec.rb
Ruby
mit
19
master
2,287
require 'spec_helper' require 'tmpdir' require 'slosilo/adapters/file_adapter' describe Slosilo::Adapters::FileAdapter do include_context "with example key" let(:dir) { Dir.mktmpdir } let(:adapter) { Slosilo::Adapters::FileAdapter.new dir } subject { adapter } describe "#get_key" do context "when gi...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
spec/sequel_adapter_spec.rb
Ruby
mit
19
master
4,760
require 'spec_helper' require 'sequel' require 'io/grab' require 'slosilo/adapters/sequel_adapter' describe Slosilo::Adapters::SequelAdapter do include_context "with example key" let(:model) { double "model" } before { allow(subject).to receive_messages create_model: model } describe "#get_key" do con...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
spec/encrypted_attributes_spec.rb
Ruby
mit
19
master
3,020
require 'spec_helper' require 'slosilo/attr_encrypted' describe Slosilo::EncryptedAttributes do before(:all) do Slosilo::encryption_key = OpenSSL::Cipher.new("aes-256-gcm").random_key end let(:aad) { proc{ |_| "hithere" } } let(:base){ Class.new do attr_accessor :normal_ivar,:with_aad def...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
lib/slosilo.rb
Ruby
mit
19
master
409
require "slosilo/jwt" require "slosilo/version" require "slosilo/keystore" require "slosilo/symmetric" require "slosilo/attr_encrypted" require "slosilo/random" require "slosilo/errors" if defined? Sequel require 'slosilo/adapters/sequel_adapter' Slosilo::adapter = Slosilo::Adapters::SequelAdapter.new end Dir[File...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
lib/tasks/slosilo.rake
Ruby
mit
19
master
815
namespace :slosilo do desc "Dump a public key" task :dump, [:name] => :environment do |t, args| args.with_defaults(:name => :own) puts Slosilo[args[:name]] end desc "Enroll a key" task :enroll, [:name] => :environment do |t, args| key = Slosilo::Key.new STDIN.read Slosilo[args[:name]] = key...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
lib/slosilo/attr_encrypted.rb
Ruby
mit
19
master
3,045
require 'slosilo/symmetric' module Slosilo # we don't trust the database to keep all backups safe from the prying eyes # so we encrypt sensitive attributes before storing them module EncryptedAttributes module ClassMethods # @param options [Hash] # @option :aad [#to_proc, #to_s] Provide additio...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
lib/slosilo/symmetric.rb
Ruby
mit
19
master
1,865
module Slosilo class Symmetric VERSION_MAGIC = 'G' TAG_LENGTH = 16 def initialize @cipher = OpenSSL::Cipher.new 'aes-256-gcm' # NB: has to be lower case for whatever reason. @cipher_mutex = Mutex.new end # This lets us do a final sanity check in migrations from older encryption versi...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
lib/slosilo/jwt.rb
Ruby
mit
19
master
3,433
require 'json' module Slosilo # A JWT-formatted Slosilo token. # @note This is not intended to be a general-purpose JWT implementation. class JWT # Create a new unsigned token with the given claims. # @param claims [#to_h] claims to embed in this token. def initialize claims = {} @claims = JSON...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
lib/slosilo/key.rb
Ruby
mit
19
master
6,143
require 'openssl' require 'json' require 'base64' require 'time' require 'slosilo/errors' module Slosilo class Key def initialize raw_key = nil @key = if raw_key.is_a? OpenSSL::PKey::RSA raw_key elsif !raw_key.nil? OpenSSL::PKey.read raw_key else OpenSSL::PKey::RSA.new ...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
lib/slosilo/keystore.rb
Ruby
mit
19
master
1,902
require 'slosilo/key' module Slosilo class Keystore def adapter Slosilo::adapter or raise "No Slosilo adapter is configured or available" end def put id, key id = id.to_s fail ArgumentError, "id can't be empty" if id.empty? adapter.put_key id, key end def get op...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
lib/slosilo/errors.rb
Ruby
mit
19
master
460
module Slosilo class Error < RuntimeError # An error thrown when attempting to store a private key in an unecrypted # storage. Set Slosilo.encryption_key to secure the storage or make sure # to store just the public keys (using Key#public). class InsecureKeyStorage < Error def initialize msg = "...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
lib/slosilo/adapters/file_adapter.rb
Ruby
mit
19
master
1,041
require 'slosilo/adapters/abstract_adapter' module Slosilo module Adapters class FileAdapter < AbstractAdapter attr_reader :dir def initialize(dir) @dir = dir @keys = {} @fingerprints = {} Dir[File.join(@dir, "*.key")].each do |f| key = Slosilo::Encryp...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
lib/slosilo/adapters/sequel_adapter.rb
Ruby
mit
19
master
2,440
require 'slosilo/adapters/abstract_adapter' module Slosilo module Adapters class SequelAdapter < AbstractAdapter def model @model ||= create_model end def secure? !Slosilo.encryption_key.nil? end def create_model model = Sequel::Model(:slosilo_keystor...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
lib/slosilo/adapters/memory_adapter.rb
Ruby
mit
19
master
604
require 'slosilo/adapters/abstract_adapter' module Slosilo module Adapters class MemoryAdapter < AbstractAdapter def initialize @keys = {} @fingerprints = {} end def put_key id, key key = Slosilo::Key.new(key) if key.is_a?(String) @keys[id] = key @...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
lib/slosilo/adapters/abstract_adapter.rb
Ruby
mit
19
master
396
require 'slosilo/attr_encrypted' module Slosilo module Adapters class AbstractAdapter def get_key id raise NotImplementedError end def get_by_fingerprint fp raise NotImplementedError end def put_key id, key raise NotImplementedError end ...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
lib/slosilo/adapters/mock_adapter.rb
Ruby
mit
19
master
335
module Slosilo module Adapters class MockAdapter < Hash def initialize @fp = {} end def put_key id, key @fp[key.fingerprint] = id self[id] = key end alias :get_key :[] def get_by_fingerprint fp id = @fp[fp] [self[id], id] end ...
github
cyberark/slosilo
https://github.com/cyberark/slosilo
lib/slosilo/adapters/sequel_adapter/migration.rb
Ruby
mit
19
master
1,305
require 'sequel' module Slosilo module Adapters::SequelAdapter::Migration # The default name of the table to hold the keys DEFAULT_KEYSTORE_TABLE = :slosilo_keystore # Sets up default keystore table name def self.extended(db) db.keystore_table ||= DEFAULT_KEYSTORE_TABLE end # Keys...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
tezos_client.gemspec
Ruby
mit
19
master
2,182
# frozen_string_literal: true lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "tezos_client/version" Gem::Specification.new do |spec| spec.name = "tezos_client" spec.version = TezosClient::VERSION spec.authors = ["Pierre Michard", "Séba...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/spec_helper.rb
Ruby
mit
19
master
984
# frozen_string_literal: true require "bundler/setup" require "tezos_client" require "securerandom" require "pry" require_relative "../lib/tezos_client/string_utils" Dir["./spec/support/**/*.rb"].each { |f| require f } Dir["./spec/shared/**/*.rb"].each { |f| require f } # # tzalpha client --addr alphanet-node.tzsc...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/tezos_client_spec.rb
Ruby
mit
19
master
18,723
# frozen_string_literal: true RSpec.describe TezosClient, vcr: true do include_context "public rpc interface" include_context "contract origination" subject { tezos_client } context "with monitoring block" do before do wait_new_block end describe "#transfer" do it "works" do r...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/shared/shared_wallet.rb
Ruby
mit
19
master
764
# frozen_string_literal: true RSpec.shared_context "shared wallet", shared_context: :metadata do let(:rich_wallet) { "rich_wallet" } let(:test_wallet) { "test_wallet" } before(:all) do import_wallet end def import_wallet rich_wallet_secret_key = "edsk4EcqupPmaebat5mP57ZQ3zo8NDkwv8vQmafdYZyeXxrSc72p...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/shared/public_rpc_interface.rb
Ruby
mit
19
master
391
# frozen_string_literal: true RSpec.shared_context "public rpc interface", shared_context: :metadata do let(:rpc_node_address) { "tezos-node" } let(:rpc_node_port) { 8094 } let(:tezos_client) { TezosClient.new(rpc_node_address: rpc_node_address, rpc_node_port: rpc_node_port) } let(:rpc_interface) { TezosClien...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/shared/contract_origination.rb
Ruby
mit
19
master
585
# frozen_string_literal: true RSpec.shared_context "contract origination", shared_context: :metadata do include_context "public rpc interface" FROM ||= "tz1ZWiiPXowuhN1UqNGVTrgNyf5tdxp4XUUq" SECRET_KEY ||= "edsk4EcqupPmaebat5mP57ZQ3zo8NDkwv8vQmafdYZyeXxrSc72pjN" def originate_demo_contract res = tezos_cl...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/tezos_client/encode_utils_spec.rb
Ruby
mit
19
master
2,373
# frozen_string_literal: true RSpec.describe TezosClient::EncodeUtils do let(:test_klass) do Class.new do include TezosClient::EncodeUtils end end subject { test_klass.new } describe "#encode_args" do it "works with a string" do res = subject.encode_args('"test"') expect(res).to ...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/tezos_client/compute_operation_args_counters_spec.rb
Ruby
mit
19
master
3,926
# frozen_string_literal: true RSpec.describe TezosClient::ComputeOperationArgsCounters do subject { described_class.new(pending_operations: pending_operations, operation_args: operation_args).call } context "when there is no pending operation" do let(:pending_operations) { { "applied" => [] } } let(:opera...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/tezos_client/crypto_spec.rb
Ruby
mit
19
master
6,446
# frozen_string_literal: true RSpec.describe TezosClient::Crypto do subject { TezosClient.new } describe "#generate_key" do it "generates keys" do key = subject.generate_key puts key expect(key).to be_a Hash end it "generates correct secret key" do key = subject.generate_key ...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/tezos_client/smartpy_interface_spec.rb
Ruby
mit
19
master
1,817
# frozen_string_literal: true RSpec.describe TezosClient::SmartpyInterface do let(:script) { File.expand_path("./spec/fixtures/demo.py") } subject { described_class.new } describe "#origination_script" do context "with empty hash" do let(:init_params) { [{}, {}] } it "works" do origina...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/tezos_client/logger_spec.rb
Ruby
mit
19
master
690
# frozen_string_literal: true RSpec.describe TezosClient::Logger do subject { TezosClient.new } describe "#logger=" do context "pass logger class" do let(:logger) { [] } it "updates logger" do TezosClient.logger = logger expect { subject.log("hello") }.to change { logger }.from([])...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/tezos_client/rpc_interface_spec.rb
Ruby
mit
19
master
433
# frozen_string_literal: true RSpec.describe TezosClient::RpcInterface, :vcr do include_context "public rpc interface" subject { rpc_interface } describe "#get" do it "works" do res = subject.get "/monitor/bootstrapped" expect(res).to be_a Hash end end describe "#get block head" do ...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/tezos_client/rpc_interface/helper_spec.rb
Ruby
mit
19
master
6,082
# frozen_string_literal: true RSpec.describe TezosClient::RpcInterface::Helper, :vcr do using TezosClient::StringUtils include_context "public rpc interface" subject { TezosClient::RpcInterface.new(host: rpc_node_address, port: rpc_node_port) } let(:secret_key) { "edsk4EcqupPmaebat5mP57ZQ3zo8NDkwv8vQmafdY...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/tezos_client/rpc_interface/blocks_spec.rb
Ruby
mit
19
master
5,782
# frozen_string_literal: true RSpec.describe TezosClient::RpcInterface::Blocks, :vcr do include_context "public rpc interface" subject { rpc_interface } let(:block_hash) { subject.block_header.fetch(:hash) } describe "#blocks" do context "default arguments" do it "returns the last 50 blocks" do ...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/tezos_client/rpc_interface/monitor_spec.rb
Ruby
mit
19
master
993
# frozen_string_literal: true RSpec.describe TezosClient::RpcInterface::Monitor, :require_node do include_context "public rpc interface" subject { rpc_interface } describe "#monitor" do around do |example| disabling_vcr { example.call } end it "works" do res = subject.bootstrapped ...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/tezos_client/rpc_interface/contracts_spec.rb
Ruby
mit
19
master
3,991
# frozen_string_literal: true RSpec.describe TezosClient::RpcInterface::Contracts, :vcr do include_context "public rpc interface" subject { rpc_interface } let(:script) { File.expand_path("./spec/fixtures/demo.py") } let(:source) { "tz1bRiJ6wkVNnSF6AFV5ZDE2kon97ewBiQFG" } let(:secret_key) { "edsk3udS2CzqXNY...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/tezos_client/rpc_interface/context_spec.rb
Ruby
mit
19
master
715
# frozen_string_literal: true RSpec.describe TezosClient::RpcInterface, :vcr do include_context "public rpc interface" subject { rpc_interface } describe "#constants" do it "returns the constants" do res = subject.constants expect(res).to be_a Hash expect(res).to have_key "proof_of_work_n...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/tezos_client/tools/convert_to_hash_spec.rb
Ruby
mit
19
master
19,797
# frozen_string_literal: true RSpec.describe TezosClient::Tools::ConvertToHash do subject { described_class.run!(data: data, type: type) } before do Time.zone = "UTC" end context "convert timestamp" do let(:type) do { prim: "timestamp" } end context "with date data format: timestamp(int...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/tezos_client/tools/find_big_maps_in_storage_spec.rb
Ruby
mit
19
master
1,997
# frozen_string_literal: true RSpec.describe TezosClient::Tools::FindBigMapsInStorage do subject { described_class.run!(storage: storage, storage_type: storage_type) } context "complexe struct" do let(:storage) do { prim: "Pair", args: [ { prim: "Pair", ...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/tezos_client/tools/hash_to_micheline_spec.rb
Ruby
mit
19
master
13,474
# frozen_string_literal: true RSpec.describe TezosClient::Tools::HashToMicheline do subject { described_class.run(params) } context "when the params are valid" do context "when storage_type is provided" do context "when there is multiple parameters" do let(:params) do { sto...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/tezos_client/tools/annots_to_type_spec.rb
Ruby
mit
19
master
3,815
# frozen_string_literal: true RSpec.describe TezosClient::Tools::AnnotsToType do subject { described_class.run(typed_annots: typed_annots) } context "when typed_annots is valid" do context "when typed_annots contains one element" do let(:typed_annots) { { spending_ref: "string" } } it "returns a ...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/support/vcr.rb
Ruby
mit
19
master
854
# frozen_string_literal: true require "vcr" VCR.configure do |c| c.cassette_library_dir = "spec/cassettes" c.hook_into :webmock c.configure_rspec_metadata! c.allow_http_connections_when_no_cassette = true end module VcrDisabler @@disabling_cont = 0 def disabling_vcr if @@disabling_cont.zero? We...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/support/deploying_simple_contract.rb
Ruby
mit
19
master
801
# frozen_string_literal: true module DeployingSimpleContract extend RSpec::SharedContext let(:address) { "tz1ZWiiPXowuhN1UqNGVTrgNyf5tdxp4XUUq" } let(:public_key) { "edpkugJHjEZLNyTuX3wW2dT4P7PY5crLqq3zeDFvXohAs3tnRAaZKR" } let(:secret_key) { "edsk4EcqupPmaebat5mP57ZQ3zo8NDkwv8vQmafdYZyeXxrSc72pjN" } let!(...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
spec/support/monitor_tezos.rb
Ruby
mit
19
master
819
# frozen_string_literal: true module MonitorTezos def monitor_operation(operation_id) disabling_vcr { tezos_client.monitor_operation(operation_id) } unless reading_vcr_cassette? end def wait_new_block(timeout: 20) return if reading_vcr_cassette? disabling_vcr do blocks_to_wait = 2 recei...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client.rb
Ruby
mit
19
master
9,514
# frozen_string_literal: true require "pp" require "active_support/core_ext/hash/indifferent_access" require "active_support/core_ext/string/inflections" require "active_support/core_ext/module/delegation" require "active_support/core_ext/time" require "active_support/core_ext/array" require "timeout" require "benchma...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/smartpy_interface.rb
Ruby
mit
19
master
2,119
# frozen_string_literal: true require_relative "smartpy_inteface/smartpy_wrapper" class TezosClient class SmartpyInterface include Logger include SmartpyWrapper attr_reader :options def json_scripts(args) compile_to_michelson(args) do |contract_script_filename, init_script_filename| ...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/exceptions.rb
Ruby
mit
19
master
2,669
# frozen_string_literal: true class TezosClient class RpcRequestFailure < StandardError attr_reader :status_code attr_reader :error def initialize(error:, url:, status_code:) @status_code = status_code @error = error if @message.nil? @message = "#{url} failed with status #{sta...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/compute_operation_args_counters.rb
Ruby
mit
19
master
1,342
# frozen_string_literal: true class TezosClient class ComputeOperationArgsCounters def initialize(pending_operations:, operation_args:) @pending_operations = pending_operations @operation_args = Marshal.load(Marshal.dump(operation_args)) # deep copy of the object end def call max_count...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/operation_mgr.rb
Ruby
mit
19
master
6,659
# frozen_string_literal: true require "tezos_client/compute_operation_args_counters" class TezosClient class OperationMgr include Crypto using CurrencyUtils attr_accessor :rpc_interface, :rpc_operation_args def initialize(rpc_interface:, rpc_operation_args:, **args) @rpc_in...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/string_utils.rb
Ruby
mit
19
master
215
# frozen_string_literal: true class TezosClient module StringUtils refine String do def to_hex unpack("H*")[0] end def to_bin [self].pack("H*") end end end end
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/commands.rb
Ruby
mit
19
master
916
# frozen_string_literal: true require "forwardable" class TezosClient module Commands extend Forwardable def_delegators :rpc_interface, :bootstrapped, :monitor_block, :head_hash, :contract_counter, :block_header,...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/currency_utils.rb
Ruby
mit
19
master
326
# frozen_string_literal: true require "bigdecimal" require "bigdecimal/util" class TezosClient module CurrencyUtils TEZOS_SATOSHI = 1000000.0 refine Numeric do def from_satoshi self.to_d / TEZOS_SATOSHI end def to_satoshi (self * TEZOS_SATOSHI).to_i end end en...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/encode_utils.rb
Ruby
mit
19
master
2,918
# frozen_string_literal: true class TezosClient module EncodeUtils class ArgsEncoder attr_accessor :expr, :popen, :sopen, :escaped, :pl, :ret def initialize(expr) @expr = expr.gsub(/(?:@[a-z_]+)|(?:#.*$)/m, "") .gsub(/\s+/, " ") .strip initial...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/rpc_interface.rb
Ruby
mit
19
master
689
# frozen_string_literal: true require "httparty" require "rest-client" require_relative "rpc_interface/monitor" require_relative "rpc_interface/contracts" require_relative "rpc_interface/context" require_relative "rpc_interface/helper" require_relative "rpc_interface/operations" require_relative "rpc_interface/reques...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/logger.rb
Ruby
mit
19
master
2,381
# frozen_string_literal: true require "active_support/concern" class TezosClient module Logger extend ActiveSupport::Concern @@logger = nil @@env_logger = nil def log(out) return unless self.class.logger self.class.logger << out + "\n" end FILTERED_KEYS = [:code, :contractCode,...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/crypto.rb
Ruby
mit
19
master
6,769
# frozen_string_literal: true require "base58" require "rbnacl" require "digest" require "money-tree" require "bip_mnemonic" class TezosClient module Crypto using StringUtils PREFIXES = { tz1: [6, 161, 159], tz2: [6, 161, 161], tz3: [6, 161, 164], KT: [2, 90, 121], ...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/operations/reveal_operation.rb
Ruby
mit
19
master
284
# frozen_string_literal: true class TezosClient class RevealOperation < Operation def rpc_operation_args @rpc_operation_args ||= rpc_interface.reveal_operation( @args.slice(:from, :fee, :gas_limit, :storage_limit, :counter, :public_key) ) end end end
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/operations/origination_operation.rb
Ruby
mit
19
master
425
# frozen_string_literal: true class TezosClient class OriginationOperation < Operation def rpc_operation_args @rpc_operation_args ||= rpc_interface.origination_operation( @args.slice( :delegatable, :spendable, :amount, :from, :gas_limit, :...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/operations/transactions_operation.rb
Ruby
mit
19
master
684
# frozen_string_literal: true class TezosClient class TransactionsOperation < Operation def rpc_operation_args @rpc_operation_args ||= OperationArray.new( operations: operations, secret_key: @args.fetch(:secret_key), from: @args.fetch(:from), rpc_interface: rpc_inter...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/operations/operation_array.rb
Ruby
mit
19
master
704
# frozen_string_literal: true class TezosClient class OperationArray < RawOperationArray def post_initialize(operations:, **args) @raw_operations = operations.map do |operation| operation_kind = operation.delete(:kind) operation_object = operation_klass(operation_kind) operation_obj...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/operations/raw_operation_array.rb
Ruby
mit
19
master
601
# frozen_string_literal: true class TezosClient class RawOperationArray < Operation def post_initialize(raw_operations:, **args) @raw_operations = raw_operations.clone end def rpc_operation_args @rpc_operation_args ||= begin initial_counter = rpc_interface.contract_counter(@args.fetc...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/operations/activate_account_operation.rb
Ruby
mit
19
master
359
# frozen_string_literal: true class TezosClient class ActivateAccountOperation < Operation def rpc_operation_args @rpc_operation_args ||= rpc_interface.activate_account_operation( operation_args ) end def operation_args { pkh: @args.fetch(:pkh), secret: @args.fe...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/operations/operation.rb
Ruby
mit
19
master
879
# frozen_string_literal: true class TezosClient class Operation delegate :run, :preapply, :test_and_broadcast, :broadcast, :simulate, :signed_hex, to: :operation_mgr def initialize(rpc_interface:, **args) @rpc_interface = rpc_interface @args = args.clone post_initialize(**args) end ...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/operations/transaction_operation.rb
Ruby
mit
19
master
903
# frozen_string_literal: true class TezosClient class TransactionOperation < Operation include EncodeUtils def rpc_operation_args @rpc_operation_args ||= rpc_interface.transaction_operation(**operation_args) end private def operation_args operation_args = @args.slice( ...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/rpc_interface/monitor.rb
Ruby
mit
19
master
373
# frozen_string_literal: true require "date" class TezosClient class RpcInterface module Monitor def bootstrapped res = get "/monitor/bootstrapped" res["timestamp"] = DateTime.parse(res["timestamp"]) res end def monitor_block(&block_reader) monitor("monitor/hea...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/rpc_interface/contracts.rb
Ruby
mit
19
master
1,786
# frozen_string_literal: true class TezosClient class RpcInterface using CurrencyUtils include Crypto module Contracts def contract_link(contract_id) "/chains/main/blocks/head/context/contracts/#{contract_id}" end def contract_detail(contract_id) get contract_link(cont...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/rpc_interface/helper.rb
Ruby
mit
19
master
2,369
# frozen_string_literal: true class TezosClient class RpcInterface module Helper using CurrencyUtils def transaction_operation(args) operation = { kind: "transaction", amount: args.fetch(:amount).to_satoshi.to_s, source: args.fetch(:from), destination:...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/rpc_interface/blocks.rb
Ruby
mit
19
master
810
# frozen_string_literal: true class TezosClient class RpcInterface module Blocks def block(block_hash = "head") get "chains/main/blocks/#{block_hash}" end def blocks(length: 50, head: nil, min_date: nil) query = { length: length, head: head, min_da...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/rpc_interface/context.rb
Ruby
mit
19
master
508
# frozen_string_literal: true class TezosClient class RpcInterface module Context def constants get "/chains/main/blocks/head/context/constants" end def head_hash get "/chains/main/blocks/head/hash" end def chain_id get "/chains/main/chain_id" end ...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/rpc_interface/operations.rb
Ruby
mit
19
master
1,568
# frozen_string_literal: true class TezosClient class RpcInterface module Operations using CurrencyUtils def preapply_operations(operations:, **options) content = { protocol: options.fetch(:protocol), branch: options.fetch(:branch), contents: operations, ...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/rpc_interface/request_manager.rb
Ruby
mit
19
master
3,820
# frozen_string_literal: true class TezosClient class RpcInterface module RequestManager def get(path, query: {}) url = "http://#{@host}:#{@port}/#{path}" response = nil exec_time = Benchmark.realtime do response = HTTParty.get(url, headers: { "Content-Type" => "applicatio...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/smartpy_inteface/smartpy_wrapper.rb
Ruby
mit
19
master
411
# frozen_string_literal: true class TezosClient class SmartpyInterface # Wrapper used to call the tezos-client binary module SmartpyWrapper def call_smartpy(command) cmd = smartpy_cmd + command Tools::SystemCall.execute(cmd) rescue SysCallError => e raise SmartPyError, e....
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/tools/system_call.rb
Ruby
mit
19
master
586
# frozen_string_literal: true class TezosClient module Tools module SystemCall def self.execute(cmd) Open3.popen3(*cmd) do |_stdin, stdout, stderr, wait_thr| status = wait_thr.value.exitstatus if status != 0 err = stdout.read + stderr.read raise ::Tezos...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/tools/annots_to_type.rb
Ruby
mit
19
master
1,951
# frozen_string_literal: true class TezosClient::Tools::AnnotsToType < ActiveInteraction::Base # example of typed_annots : # { # spending_ref: "string", # remainder_amount: "nat", # expires_at: "timestamp" # } hash :typed_annots, strip: false validate :validate_types TYPES_MAPPING = { int...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/tools/convert_to_hash.rb
Ruby
mit
19
master
435
# frozen_string_literal: true require_relative "convert_to_hash/base" Dir[File.join(__dir__, "convert_to_hash", "*.rb")].each { |file| require file } class TezosClient module Tools class ConvertToHash < ActiveInteraction::Base interface :data, methods: [] interface :type, methods: [] def exe...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/tools/hash_to_micheline.rb
Ruby
mit
19
master
1,686
# frozen_string_literal: true require_relative "hash_to_micheline/base" Dir[File.join(__dir__, "hash_to_micheline", "*.rb")].each { |file| require file } class TezosClient::Tools::HashToMicheline < ActiveInteraction::Base string :contract_address, default: nil string :entrypoint, default: nil # example of par...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/tools/find_big_maps_in_storage.rb
Ruby
mit
19
master
515
# frozen_string_literal: true class TezosClient::Tools::FindBigMapsInStorage < ActiveInteraction::Base hash :storage, strip: false hash :storage_type, strip: false def execute hash_storage .map(&:last) .select { |value| value.is_a? TezosClient::BigMap } .map(&:to_h) .ma...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/tools/temporary_file.rb
Ruby
mit
19
master
794
# frozen_string_literal: true class TezosClient module Tools module TemporaryFile def self.with_file_copy(source_file_path) source_file = File.open(source_file_path, "r") source_extention = File.extname(source_file_path) file_copy_path = nil res = Tools::TemporaryFile.with...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/tools/convert_to_hash/pair.rb
Ruby
mit
19
master
1,712
# frozen_string_literal: true class TezosClient module Tools class ConvertToHash < ActiveInteraction::Base class Pair < Base def decode raise "Not a 'Pair' type" unless normalized_data[:prim] == "Pair" raise "Difference detected between data and type \nDATA: #{normalized_data} \...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/tools/convert_to_hash/nat.rb
Ruby
mit
19
master
222
# frozen_string_literal: true class TezosClient module Tools class ConvertToHash < ActiveInteraction::Base class Nat < Base def decode data[:int].to_i end end end end end
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/tools/convert_to_hash/address.rb
Ruby
mit
19
master
785
# frozen_string_literal: true class TezosClient module Tools class ConvertToHash < ActiveInteraction::Base class Address < Base include TezosClient::Crypto def decode if data.key?(:bytes) if data[:bytes].start_with?("0000") encode_tz(:tz1, data[:bytes][4...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/tools/convert_to_hash/bytes.rb
Ruby
mit
19
master
238
# frozen_string_literal: true class TezosClient module Tools class ConvertToHash < ActiveInteraction::Base class Bytes < Base def decode data[:bytes] || data[:string] end end end end end
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/tools/convert_to_hash/key.rb
Ruby
mit
19
master
635
# frozen_string_literal: true class TezosClient module Tools class ConvertToHash < ActiveInteraction::Base class Key < Base include TezosClient::Crypto def decode if tmp_data.start_with?("00") encode_tz(:edpk, tmp_data[2..-1]) elsif tmp_data.start_with?("01"...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/tools/convert_to_hash/signature.rb
Ruby
mit
19
master
369
# frozen_string_literal: true class TezosClient module Tools class ConvertToHash < ActiveInteraction::Base class Signature < Base include TezosClient::Crypto def decode if data.key?(:bytes) encode_tz(:edsig, data[:bytes]) else data[:string] ...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/tools/convert_to_hash/timestamp.rb
Ruby
mit
19
master
521
# frozen_string_literal: true class TezosClient module Tools class ConvertToHash < ActiveInteraction::Base class Timestamp < Base def decode if data.key? :int Time.zone.at(data[:int].to_i) elsif data.key? :string return Time.zone.at(data[:string].to_i) if...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/tools/convert_to_hash/base.rb
Ruby
mit
19
master
1,061
# frozen_string_literal: true class TezosClient module Tools class ConvertToHash < ActiveInteraction::Base class Base def initialize(data:, type:) @data = data @type = type end attr_accessor :data, :type def value anonymous? ? decode : { var_n...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/tools/convert_to_hash/map.rb
Ruby
mit
19
master
708
# frozen_string_literal: true class TezosClient module Tools class ConvertToHash < ActiveInteraction::Base class Map < Base def decode new_map = {} data.each do |elem| raise "Not a 'Map' type" unless elem[:prim] == "Elt" key = TezosClient::Tools::Conver...
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/tools/convert_to_hash/set.rb
Ruby
mit
19
master
253
# frozen_string_literal: true class TezosClient module Tools class ConvertToHash < ActiveInteraction::Base class Set < Base def decode List.new(data: data, type: type).decode.to_set end end end end end
github
moneytrackio/tezos_client
https://github.com/moneytrackio/tezos_client
lib/tezos_client/tools/convert_to_hash/int.rb
Ruby
mit
19
master
222
# frozen_string_literal: true class TezosClient module Tools class ConvertToHash < ActiveInteraction::Base class Int < Base def decode data[:int].to_i end end end end end