stellar-sdk 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bcb695f6a12a6d6f2f7d787b7513789282b27f8c
4
- data.tar.gz: ca4316bf5764d1f216bdc24ad0fdb0ef6ac25f5b
3
+ metadata.gz: e4aa578fb224a0afd75fbf3c65f3fa87cec56ede
4
+ data.tar.gz: 35db6e2fe51dec1846ae32ec545352bfd46ed2ef
5
5
  SHA512:
6
- metadata.gz: 968c2c164363bae509d3c79e9a68e4b5bacad6e8cc2d04a1dd3f3bf5c1d22110e62263ced21369544232a9e0b7d88289ac17013c63bb86d5478e96cf17e99dfa
7
- data.tar.gz: caf0ae6d1968bbae1b45805b31298fa722bbcfd2749cc5896d3113f46687c112c3c6d9c11aaee56dcdc56f8a26d8a8e4e009d15f07f8155ddaf92dcbe6258cc5
6
+ metadata.gz: 714339c880444dd968673f8db1ee42348f2dca63b9097fc36f1e6c46fbccf6e42721d5c1b8824188891e902ec92577ccd3078c61a08197fcad4bb8b43d8d9594
7
+ data.tar.gz: 6a47049ff8c0908a34377989f67e50feec2cf14e88dbef924448d3103ef606e5244e257ec20d791e8f41d6db2e2946b073a01381d8174189f749925fd05776a6
@@ -4,9 +4,9 @@ account = Stellar::Account.from_seed("s3fu5vCMrfYouKuk2uB1gCD7EsuuBKY9M4qmnniQMB
4
4
  client = Stellar::Client.default_testnet()
5
5
 
6
6
  issuer = Stellar::Account.lookup("issuer@haste.co.nz"))
7
- currency = Stellar::Currency.iso4217("USD", issuer)
7
+ asset = Stellar::Asset.credit_alphanum4("USD", issuer)
8
8
 
9
9
  client.trust({
10
10
  account: account
11
- currency: currency
11
+ asset: asset
12
12
  })
@@ -4,10 +4,10 @@ account = Stellar::Account.from_seed("s3fu5vCMrfYouKuk2uB1gCD7EsuuBKY9M4qmnniQMB
4
4
  client = Stellar::Client.default_testnet()
5
5
 
6
6
  issuer = Stellar::Account.lookup("issuer@haste.co.nz"))
7
- currency = Stellar::Currency.iso4217("USD", issuer)
7
+ asset = Stellar::Asset.credit_alphanum4("USD", issuer)
8
8
 
9
9
  client.send({
10
10
  from: account,
11
11
  to: recipient,
12
- amount: Stellar::Amount.new(100, currency, issuer)
12
+ amount: Stellar::Amount.new(100, asset, issuer)
13
13
  }) # => #<OK>
@@ -3,35 +3,38 @@ module Stellar
3
3
  include Contracts
4
4
 
5
5
  attr_reader :amount
6
- attr_reader :currency
6
+ attr_reader :asset
7
7
 
8
- Contract Pos, Currency => Any
9
- def initialize(amount, currency=Stellar::Currency.native())
8
+ Contract Pos, Asset => Any
9
+ def initialize(amount, asset=Stellar::Asset.native())
10
10
  # TODO: how are we going to handle decimal considerations?
11
11
 
12
- @amount = amount
13
- @currency = currency
12
+ @amount = amount
13
+ @asset = asset
14
14
  end
15
15
 
16
16
 
17
17
  Contract None => Or[
18
- [:iso4217, String, KeyPair, Pos],
18
+ [Or[:credit_alphanum4, :credit_alphanum12], String, KeyPair, Pos],
19
19
  [:native, Pos],
20
20
  ]
21
21
  def to_payment
22
- case currency.type
23
- when CurrencyType.currency_type_native
22
+ case asset.type
23
+ when AssetType.asset_type_native
24
24
  [:native, amount]
25
- when CurrencyType.currency_type_alphanum
26
- keypair = KeyPair.from_public_key(currency.issuer)
27
- [:iso4217, currency, keypair, amount]
25
+ when AssetType.asset_type_credit_alphanum4
26
+ keypair = KeyPair.from_public_key(asset.issuer)
27
+ [:credit_alphanum4, asset, keypair, amount]
28
+ when AssetType.asset_type_credit_alphanum12
29
+ keypair = KeyPair.from_public_key(asset.issuer)
30
+ [:credit_alphanum12, asset, keypair, amount]
28
31
  else
29
- raise "Unknown currency type: #{currency.type}"
32
+ raise "Unknown asset type: #{asset.type}"
30
33
  end
31
34
  end
32
35
 
33
36
  def inspect
34
- "#<Stellar::Amount #{currency}(#{amount})>"
37
+ "#<Stellar::Amount #{asset}(#{amount})>"
35
38
  end
36
39
  end
37
40
  end
@@ -1,3 +1,3 @@
1
1
  module Stellar
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -5,7 +5,7 @@ require 'simplecov'
5
5
  SimpleCov.start
6
6
 
7
7
  require 'pry'
8
- require 'stellar'
8
+ require 'stellar-sdk'
9
9
 
10
10
  SPEC_ROOT = File.dirname(__FILE__)
11
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stellar-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Fleckenstein