class Gitstamp::Transaction
A Gitstamp
transaction is an Arweave transaction with specific tags.
Attributes
commit[R]
The transaction's associated commit.
@return [Commit] commit
Public Class Methods
new(commit)
click to toggle source
Constructs a transaction from a commit.
@param [Commit] commit @return [void]
# File lib/gitstamp/transaction.rb, line 17 def initialize(commit) @commit = commit end
Public Instance Methods
publish!(wallet)
click to toggle source
Submits this transaction to the Arweave network.
@param [Arweave::Wallet] wallet @return [String] the posted Arweave transaction ID
# File lib/gitstamp/transaction.rb, line 39 def publish!(wallet) tx = self.sign(wallet) tx.commit tx.attributes[:id] end
sign(wallet)
click to toggle source
Signs this transaction as originating from the given wallet.
@param [Arweave::Wallet] wallet @return [Arweave::Transaction] the signed Arweave transaction
# File lib/gitstamp/transaction.rb, line 26 def sign(wallet) tx = Arweave::Transaction.new(data: @commit.message.to_s) @commit.to_tags.each do |name, value| tx.add_tag(name: name, value: value) end tx.sign(wallet) end