stellar_core_commander 0.0.5 → 0.0.6
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/examples/non_native_payment.rb +3 -3
 - data/examples/pathed_payment.rb +2 -0
 - data/examples/simple_payment.rb +4 -0
 - data/lib/stellar_core_commander/operation_builder.rb +17 -3
 - data/lib/stellar_core_commander/transactor.rb +8 -1
 - data/lib/stellar_core_commander/version.rb +1 -1
 - data/stellar_core_commander.gemspec +1 -1
 - metadata +4 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 7404e814b58b7ea5012e5cca8cf96b30223d9723
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: d0d48ebcbd0658d51a7565fc986a0182d28277ab
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: c54e845ba8da423c8205d6014d61cde2139a10f0f8d5f51b959aef968ce4fdf029fb47ab022bb5ec68e1846ee5295c9cff9202e6dc6bcee41a1cca83951e61ec
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 693ca68613c2b5e3252828ca7286ee24741437f3639e5819313b6445ba263edd12be576d458f78b8ff4bb25e3053aedc488ed1428ca4c832c58181f4be29468b
         
     | 
| 
         @@ -2,9 +2,9 @@ account :usd_gateway 
     | 
|
| 
       2 
2 
     | 
    
         
             
            account :scott
         
     | 
| 
       3 
3 
     | 
    
         
             
            account :andrew
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 5 
     | 
    
         
            +
            create_account :usd_gateway
         
     | 
| 
      
 6 
     | 
    
         
            +
            create_account :scott
         
     | 
| 
      
 7 
     | 
    
         
            +
            create_account :andrew
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
            close_ledger
         
     | 
| 
       10 
10 
     | 
    
         | 
    
        data/examples/pathed_payment.rb
    CHANGED
    
    
    
        data/examples/simple_payment.rb
    CHANGED
    
    
| 
         @@ -34,13 +34,27 @@ module StellarCoreCommander 
     | 
|
| 
       34 
34 
     | 
    
         
             
                    amount:      amount,
         
     | 
| 
       35 
35 
     | 
    
         
             
                  }
         
     | 
| 
       36 
36 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
                   
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                   
     | 
| 
      
 37 
     | 
    
         
            +
                  # TODO: Fix pathed payments
         
     | 
| 
      
 38 
     | 
    
         
            +
                  # if options[:path]
         
     | 
| 
      
 39 
     | 
    
         
            +
                  #   attrs[:path] = options[:path].map{|p| make_currency p}
         
     | 
| 
      
 40 
     | 
    
         
            +
                  # end
         
     | 
| 
       40 
41 
     | 
    
         | 
| 
       41 
42 
     | 
    
         
             
                  Stellar::Transaction.payment(attrs).to_envelope(from)
         
     | 
| 
       42 
43 
     | 
    
         
             
                end
         
     | 
| 
       43 
44 
     | 
    
         | 
| 
      
 45 
     | 
    
         
            +
                Contract Symbol, Symbol, Num => Any
         
     | 
| 
      
 46 
     | 
    
         
            +
                def create_account(account, funder=:master, starting_balance=1000_0000000)
         
     | 
| 
      
 47 
     | 
    
         
            +
                  account = get_account account
         
     | 
| 
      
 48 
     | 
    
         
            +
                  funder  = get_account funder
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                  Stellar::Transaction.create_account({
         
     | 
| 
      
 51 
     | 
    
         
            +
                    account:          funder,
         
     | 
| 
      
 52 
     | 
    
         
            +
                    destination:      account,
         
     | 
| 
      
 53 
     | 
    
         
            +
                    sequence:         next_sequence(funder),
         
     | 
| 
      
 54 
     | 
    
         
            +
                    starting_balance: starting_balance,
         
     | 
| 
      
 55 
     | 
    
         
            +
                  }).to_envelope(funder)
         
     | 
| 
      
 56 
     | 
    
         
            +
                end 
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
       44 
58 
     | 
    
         
             
                Contract Symbol, Symbol, String => Any
         
     | 
| 
       45 
59 
     | 
    
         
             
                def trust(account, issuer, code)
         
     | 
| 
       46 
60 
     | 
    
         
             
                  change_trust account, issuer, code, (2**63)-1
         
     | 
| 
         @@ -62,6 +62,13 @@ module StellarCoreCommander 
     | 
|
| 
       62 
62 
     | 
    
         
             
                  end
         
     | 
| 
       63 
63 
     | 
    
         
             
                end
         
     | 
| 
       64 
64 
     | 
    
         | 
| 
      
 65 
     | 
    
         
            +
                # 
         
     | 
| 
      
 66 
     | 
    
         
            +
                # @see StellarCoreCommander::OperationBuilder#create_account
         
     | 
| 
      
 67 
     | 
    
         
            +
                def create_account(*args)
         
     | 
| 
      
 68 
     | 
    
         
            +
                  envelope = @operation_builder.create_account(*args)
         
     | 
| 
      
 69 
     | 
    
         
            +
                  submit_transaction envelope
         
     | 
| 
      
 70 
     | 
    
         
            +
                end 
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
       65 
72 
     | 
    
         
             
                # 
         
     | 
| 
       66 
73 
     | 
    
         
             
                # @see StellarCoreCommander::OperationBuilder#trust
         
     | 
| 
       67 
74 
     | 
    
         
             
                def trust(*args)
         
     | 
| 
         @@ -141,7 +148,7 @@ module StellarCoreCommander 
     | 
|
| 
       141 
148 
     | 
    
         
             
                def next_sequence(account)
         
     | 
| 
       142 
149 
     | 
    
         
             
                  base_sequence  = @process.sequence_for(account)
         
     | 
| 
       143 
150 
     | 
    
         
             
                  inflight_count = @unverified.select{|e| e.first.tx.source_account == account.public_key}.length
         
     | 
| 
       144 
     | 
    
         
            -
             
     | 
| 
      
 151 
     | 
    
         
            +
             
     | 
| 
       145 
152 
     | 
    
         
             
                  base_sequence + inflight_count + 1
         
     | 
| 
       146 
153 
     | 
    
         
             
                end
         
     | 
| 
       147 
154 
     | 
    
         | 
| 
         @@ -17,7 +17,7 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       17 
17 
     | 
    
         
             
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
       18 
18 
     | 
    
         
             
              spec.require_paths = ["lib"]
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
              spec.add_dependency "stellar-base", "= 0.0. 
     | 
| 
      
 20 
     | 
    
         
            +
              spec.add_dependency "stellar-base", "= 0.0.8"
         
     | 
| 
       21 
21 
     | 
    
         
             
              spec.add_dependency "slop", "~> 3.6.0"
         
     | 
| 
       22 
22 
     | 
    
         
             
              spec.add_dependency "faraday", "~> 0.9.1"
         
     | 
| 
       23 
23 
     | 
    
         
             
              spec.add_dependency "faraday_middleware", "~> 0.9.1"
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: stellar_core_commander
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.6
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Scott Fleckenstein
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015-05- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-05-13 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: stellar-base
         
     | 
| 
         @@ -16,14 +16,14 @@ dependencies: 
     | 
|
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
17 
     | 
    
         
             
                - - '='
         
     | 
| 
       18 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
     | 
    
         
            -
                    version: 0.0. 
     | 
| 
      
 19 
     | 
    
         
            +
                    version: 0.0.8
         
     | 
| 
       20 
20 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       21 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       22 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       23 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       24 
24 
     | 
    
         
             
                - - '='
         
     | 
| 
       25 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
     | 
    
         
            -
                    version: 0.0. 
     | 
| 
      
 26 
     | 
    
         
            +
                    version: 0.0.8
         
     | 
| 
       27 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
28 
     | 
    
         
             
              name: slop
         
     | 
| 
       29 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     |