From d99c7b28e1a1378d5717805b35ca83351bad9272 Mon Sep 17 00:00:00 2001 From: Jake Urban Date: Tue, 31 Mar 2020 12:48:41 -0700 Subject: [PATCH] Updated README.md with example and stellar links --- README.md | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 7e807262..2b1d289a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Ruby Stellar -[![Build Status](https://travis-ci.org/bloom-solutions/ruby-stellar-sdk.svg)](https://travis-ci.org/bloom-solutions/ruby-stellar-sdk) -[![Code Climate](https://codeclimate.com/github/bloom-solutions/ruby-stellar-sdk/badges/gpa.svg)](https://codeclimate.com/github/bloom-solutions/ruby-stellar-sdk) +[![Build Status](https://travis-ci.org/stellar/ruby-stellar-sdk.svg)](https://travis-ci.org/stellar/ruby-stellar-sdk) This library helps you to integrate your application into the [Stellar network](http://stellar.org). @@ -27,7 +26,7 @@ Also requires libsodium. Installable via `brew install libsodium` on OS X. See [examples](examples). -A simple payment from the root account to some random accounts +A simple payment from the root account to some random account ```ruby require 'stellar-sdk' @@ -36,14 +35,21 @@ account = Stellar::Account.master client = Stellar::Client.default_testnet() recipient = Stellar::Account.random -client.send_payment({ - from: account, - to: recipient, - amount: Stellar::Amount.new(100_000_000) -}) +next_seq_num = client.account_info(account).sequence.to_i + 1 +tx = Stellar::TransactionBuilder.new( + source_account: account.keypair, + sequence_number: next_seq_num +).add_operation( + Stellar::Operation.payment({ + destination: recipient, + amount: [Stellar::Asset.native, 100] + }) +).add_timeout(600).build() +envelope = tx.to_envelope(account.keypair) +client.submit_transaction(tx_envelope: envelope) ``` -Be sure to set the network when submitting to the public network (more information in [stellar-base](https://www.github.com/bloom-solutions/ruby-stellar-base)): +Be sure to set the network when submitting to the public network (more information in [stellar-base](https://www.github.com/stellar/ruby-stellar-base)): ```ruby Stellar.default_network = Stellar::Networks::PUBLIC @@ -61,7 +67,7 @@ Stellar.default_network = Stellar::Networks::PUBLIC ## Contributing 1. Sign the [Contributor License Agreement](https://docs.google.com/forms/d/1g7EF6PERciwn7zfmfke5Sir2n10yddGGSXyZsq98tVY/viewform?usp=send_form) -2. Fork it ( https://github.com/bloom-solutions/ruby-stellar-lib/fork ) +2. Fork it ( https://github.com/stellar/ruby-stellar-sdk/fork ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`)