<commit_before>require 'nis'
hr = '-' * 64

# Account A (Source)
A_ADDRESS = 'TAH4MBR6MNLZKJAVW5ZJCMFAL7RS5U2YODUQKLCT'.freeze
A_PRIVATE_KEY = '<KEY>'.freeze
A_PUBLIC_KEY  = '5aff2e991f85d44eed8f449ede365a920abbefc22f1a2f731d4a002258673519'.freeze

# Account B (Dist)
B_ADDRESS = 'TA4TX6U5HG2MROAESH2JE5524T4ZOY2EQKQ6ELHF'.freeze

# build Transaction Object
tx = Nis::Struct::Transaction.new(
  amount:  1_000_000,
  fee:     3_000_000,
  recipient: B_ADDRESS,
  signer: A_PUBLIC_KEY,
  message: Nis::Struct::Message.new('Hello'),
  type: Nis::Struct::Transaction::TRANSFER,
  timeStamp: Nis::Util.timestamp,
  deadline:  Nis::Util.timestamp + 43_200,
  version:   Nis::Struct::Transaction::TESTNET_VERSION_1
)

# build RequestPrepareAnnounce Object
rpa = Nis::Struct::RequestPrepareAnnounce.new(
  transaction: tx,
  privateKey: A_PRIVATE_KEY
)

# Create NIS instance
nis = Nis.new

# check banalces before sending XEM.
puts 'Account A => balance: %d' %
  (nis.account_get address: A_ADDRESS)[:account][:balance]
puts 'Account B => balance: %d' %
  (nis.account_get address: B_ADDRESS)[:account][:balance]
puts hr

# Send XEM request.
res = nis.transaction_prepare_announce(request_prepare_announce: rpa)
puts res.message

# After several minutes, check to see Account B received XEM.<commit_msg>update samples/request_transaction<commit_after>require 'nis'
hr = '-' * 64

# Account A (Source)
A_ADDRESS = 'TAH4MBR6MNLZKJAVW5ZJCMFAL7RS5U2YODUQKLCT'.freeze
A_PRIVATE_KEY = '<KEY>'.freeze
A_PUBLIC_KEY  = '5aff2e991f85d44eed8f449ede365a920abbefc22f1a2f731d4a002258673519'.freeze

# Account B (Dist)
B_ADDRESS = 'TA4TX6U5HG2MROAESH2JE5524T4ZOY2EQKQ6ELHF'.freeze

# build Transaction Object
tx = Nis::Struct::Transaction.new(
  amount:  1_000_000,
  # fee:     3_000_000, # see below.
  recipient: B_ADDRESS,
  signer: A_PUBLIC_KEY,
  message: Nis::Struct::Message.new('Hello'),
  type: Nis::Struct::Transaction::TRANSFER,
  timeStamp: Nis::Util.timestamp,
  deadline:  Nis::Util.timestamp + 43_200,
  version:   Nis::Struct::Transaction::TESTNET_VERSION_1
)

# automatically calculate minimum fee if fee is not set.
puts 'Fee: %d' % tx.fee

# build RequestPrepareAnnounce Object
rpa = Nis::Struct::RequestPrepareAnnounce.new(
  transaction: tx,
  privateKey: A_PRIVATE_KEY
)

# Create NIS instance
nis = Nis.new

# check banalces before sending XEM.
puts 'Account A => balance: %d' %
  (nis.account_get address: A_ADDRESS)[:account][:balance]
puts 'Account B => balance: %d' %
  (nis.account_get address: B_ADDRESS)[:account][:balance]
puts hr

# Send XEM request.
res = nis.transaction_prepare_announce(request_prepare_announce: rpa)
puts res.message

# After several minutes, check Account A and B Balance.
{'fraction_non_alphanumeric': 0.11529933481152993, 'fraction_numerical': 0.058388765705838876, 'mean_word_length': 5.923273657289003, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7224301', 'n_tokens_mistral': 1134, 'n_tokens_neox': 1048, 'n_words': 208}