Class: Sdp::PreparedTokenTransaction
- Inherits:
-
Struct
- Object
- Struct
- Sdp::PreparedTokenTransaction
- Defined in:
- lib/sdp/resources/issuance.rb
Overview
Result of a …/prepare issuance call: the unsigned transaction the caller must sign and submit before blockhash expiry, plus context. SDP nests this two different ways and from_action/from_deploy normalize both:
-
mint/burn prepare → the provisional record under :transaction, the unsigned tx under :prepared_transaction (transaction is a TokenTransaction).
-
deploy prepare → :transaction IS the unsigned tx envelope and the new mint address rides alongside under :mint (transaction is nil — there is no action record yet).
The mint/burn associated token account lives on #transaction (TokenTransaction) when SDP returns one; deploy carries no action record. There is deliberately no top-level token_account — it would only ever duplicate transaction.token_account.
Instance Attribute Summary collapse
-
#blockhash ⇒ Object
Returns the value of attribute blockhash.
-
#last_valid_block_height ⇒ Object
Returns the value of attribute last_valid_block_height.
-
#mint ⇒ Object
Returns the value of attribute mint.
-
#serialized ⇒ Object
Returns the value of attribute serialized.
-
#simulation ⇒ Object
Returns the value of attribute simulation.
-
#transaction ⇒ Object
Returns the value of attribute transaction.
Class Method Summary collapse
Instance Attribute Details
#blockhash ⇒ Object
Returns the value of attribute blockhash
89 90 91 |
# File 'lib/sdp/resources/issuance.rb', line 89 def blockhash @blockhash end |
#last_valid_block_height ⇒ Object
Returns the value of attribute last_valid_block_height
89 90 91 |
# File 'lib/sdp/resources/issuance.rb', line 89 def last_valid_block_height @last_valid_block_height end |
#mint ⇒ Object
Returns the value of attribute mint
89 90 91 |
# File 'lib/sdp/resources/issuance.rb', line 89 def mint @mint end |
#serialized ⇒ Object
Returns the value of attribute serialized
89 90 91 |
# File 'lib/sdp/resources/issuance.rb', line 89 def serialized @serialized end |
#simulation ⇒ Object
Returns the value of attribute simulation
89 90 91 |
# File 'lib/sdp/resources/issuance.rb', line 89 def simulation @simulation end |
#transaction ⇒ Object
Returns the value of attribute transaction
89 90 91 |
# File 'lib/sdp/resources/issuance.rb', line 89 def transaction @transaction end |
Class Method Details
.from_action(hash) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/sdp/resources/issuance.rb', line 92 def self.from_action(hash) hash ||= {} prepared = hash[:prepared_transaction] || {} new( transaction: TokenTransaction.from_hash(hash[:transaction], token_account: hash[:token_account]), serialized: prepared[:serialized], blockhash: prepared[:blockhash], last_valid_block_height: prepared[:last_valid_block_height], mint: nil, simulation: hash[:simulation] ) end |
.from_deploy(hash) ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/sdp/resources/issuance.rb', line 105 def self.from_deploy(hash) hash ||= {} tx = hash[:transaction] || {} new( transaction: nil, serialized: tx[:serialized], blockhash: tx[:blockhash], last_valid_block_height: tx[:last_valid_block_height], mint: hash[:mint], simulation: hash[:simulation] ) end |