Class: SilaRuby::Transactions
- Inherits:
-
Object
- Object
- SilaRuby::Transactions
- Includes:
- ApiHelpers
- Defined in:
- lib/sila-ruby/transactions.rb
Overview
TRANSACTIONS =================================
Class Method Summary collapse
-
.cancel_transaction(handle, params = {}, user_key) ⇒ Object
——————————————– CANCEL-TRANSACTION ————————- ——————————————– Cancel a pending transaction under certain circumstances.
-
.get_transactions(handle, params = {}, user_key) ⇒ Object
——————————————– GET-TRANSACTIONS ————————— ——————————————– Gets array of user handle’s transactions with detailed status information.
-
.issue_sila(handle, params = {}, user_key) ⇒ Object
——————————————– ISSUE-SILA ——————————— ——————————————– Debits a specified account and issues tokens to the address belonging to the requested handle.
-
.redeem_sila(handle, params = {}, user_key) ⇒ Object
——————————————– REDEEM-SILA ——————————– ——————————————– Burns given amount of SILA at the handle’s blockchain address and credits their named bank account in the equivalent monetary amount.
-
.transfer_sila(handle, params = {}, user_key) ⇒ Object
——————————————– TRANSFER-SILA —————————— ——————————————– Starts a transfer of the requested amount of SILA to the requested destination handle.
Methods included from ApiHelpers
Class Method Details
.cancel_transaction(handle, params = {}, user_key) ⇒ Object
CANCEL-TRANSACTION ————————-
Cancel a pending transaction under certain circumstances.
112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/sila-ruby/transactions.rb', line 112 def self.cancel_transaction(handle, params={}, user_key) header = { user_handle: handle } = 'header_msg' # Example of params passed # # params = { # transaction_id: "80aea226-76a3-4b60-a629-25a2db572ec8" # } sila_post_signed('cancel_transaction', header, , params, user_key, nil) end |
.get_transactions(handle, params = {}, user_key) ⇒ Object
GET-TRANSACTIONS —————————
Gets array of user handle’s transactions with detailed status information.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/sila-ruby/transactions.rb', line 82 def self.get_transactions(handle, params={}, user_key) header = { user_handle: handle } = 'get_transactions_msg' # Example of params passed # # params = { # search_filters: { # transaction_id: "some UUID string assigned by Sila", # reference_id: "the reference string sent in the header object when transaction request was made", # show_timelines: true, # sort_ascending: false, # max_sila_amount: 1300, # min_sila_amount: 1000, # statuses: ["queued", "pending", "failed", "success", "rollback", "review"], # start_epoch: 1234567860, # end_epoch: 1234567891, # page: 1, # per_page: 20, # transaction_types: ["issue", "redeem", "transfer"] # } # } sila_post_signed('get_transactions', header, , params, user_key, nil) end |
.issue_sila(handle, params = {}, user_key) ⇒ Object
ISSUE-SILA ———————————
Debits a specified account and issues tokens to the address belonging to the requested handle.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/sila-ruby/transactions.rb', line 20 def self.issue_sila(handle, params={}, user_key) header = { user_handle: handle } = 'issue_msg' # Example of params passed # # params = { # amount: 1000, # account_name: "default", # descriptor: "optional transaction descriptor", # business_uuid: "UUID of a business with an approved ACH name", # processing_type: "STANDARD_ACH" # SAME_DAY_ACH # } sila_post_signed('issue_sila', header, , params, user_key, nil) end |
.redeem_sila(handle, params = {}, user_key) ⇒ Object
REDEEM-SILA ——————————–
Burns given amount of SILA at the handle’s blockchain address and credits their named bank account in the equivalent monetary amount.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/sila-ruby/transactions.rb', line 61 def self.redeem_sila(handle, params={}, user_key) header = { user_handle: handle } = 'redeem_msg' # Example of params passed # # params = { # amount: 1000, # account_name: "default", # descriptor: "optional transaction descriptor", # business_uuid: "UUID of a business with an approved ACH name", # processing_type: "STANDARD_ACH" # SAME_DAY_ACH # } sila_post_signed('redeem_sila', header, , params, user_key, nil) end |
.transfer_sila(handle, params = {}, user_key) ⇒ Object
TRANSFER-SILA ——————————
Starts a transfer of the requested amount of SILA to the requested destination handle.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/sila-ruby/transactions.rb', line 41 def self.transfer_sila(handle, params={}, user_key) header = { user_handle: handle } = 'transfer_msg' # Example of params passed # # params = { # destination_handle: "user2.silamoney.eth", # amount: 1000, # descriptor: "optional transaction descriptor", # business_uuid: "UUID of a business with an approved ACH name" # } sila_post_signed('transfer_sila', header, , params, user_key, nil) end |