Class: Stellar::TransactionV0

Inherits:
Object
  • Object
show all
Includes:
Concerns::Transaction
Defined in:
lib/stellar/transaction_v0.rb

Instance Method Summary collapse

Methods included from Concerns::Transaction

#apply_defaults, #hash, #merge, #sign, #sign_decorated, #to_operations

Instance Method Details

#signature_baseObject

Backwards Compatibility: Use ENVELOPE_TYPE_TX to sign ENVELOPE_TYPE_TX_V0 we need a Transaction to generate the signature base



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/stellar/transaction_v0.rb', line 31

def signature_base
  tx = Stellar::Transaction.from_xdr(
    # TransactionV0 is a transaction with the AccountID discriminant
    # stripped off, we need to put it back to build a valid transaction
    # which we can use to build a TransactionSignaturePayloadTaggedTransaction
    Stellar::PublicKeyType.to_xdr(Stellar::PublicKeyType.public_key_type_ed25519) + to_xdr
  )

  tagged_tx = Stellar::TransactionSignaturePayload::TaggedTransaction.new(:envelope_type_tx, tx)

  Stellar::TransactionSignaturePayload.new(
    network_id: Stellar.current_network_id,
    tagged_transaction: tagged_tx
  ).to_xdr
end

#signature_base_prefixObject



23
24
25
26
27
# File 'lib/stellar/transaction_v0.rb', line 23

def signature_base_prefix
  val = Stellar::EnvelopeType.envelope_type_tx_v0

  Stellar.current_network_id + Stellar::EnvelopeType.to_xdr(val)
end

#source_accountObject



47
48
49
# File 'lib/stellar/transaction_v0.rb', line 47

def 
  
end

#to_envelope(*key_pairs) ⇒ Object



17
18
19
20
21
# File 'lib/stellar/transaction_v0.rb', line 17

def to_envelope(*key_pairs)
  signatures = (key_pairs || []).map(&method(:sign_decorated))

  TransactionEnvelope.v0(signatures: signatures, tx: self)
end

#to_v1Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/stellar/transaction_v0.rb', line 5

def to_v1
  Transaction.new(
    source_account: Stellar::MuxedAccount.new(:key_type_ed25519, ),
    seq_num: seq_num,
    operations: operations,
    fee: fee,
    memo: memo,
    time_bounds: time_bounds,
    ext: ext
  )
end