SPB Git

spb/os-vault Public

Self-custody, multi-chain crypto wallet for macOS. One recovery phrase, six chain families, zero API keys — nothing leaves your Mac.

Swift 96% Shell 3.4% Makefile 0.6%
1.0 KB · 37 lines swift
Raw Blame History
1import Foundation23public struct TransactionMessage {4    var instructions: [TransactionInstruction]5    var recentBlockhash: String6    var payerKey: PublicKey78    public init(instructions: [TransactionInstruction], recentBlockhash: String, payerKey: PublicKey) {9        self.instructions = instructions10        self.recentBlockhash = recentBlockhash11        self.payerKey = payerKey12    }1314    // TODO: implement15    // static func decompile() {}1617    public func compileToLegacyMessage() throws -> Message {18        try Transaction(19            instructions: instructions,20            recentBlockhash: recentBlockhash,21            feePayer: payerKey22        )23        .compileMessage()24    }2526    public func compileToV0Message(27        addressLookupTableAccounts: [AddressLookupTableAccount]? = nil28    ) throws -> MessageV0 {29        try MessageV0.compile(30            payerKey: payerKey,31            instructions: instructions,32            recentBlockHash: recentBlockhash,33            addressLookupTableAccounts: addressLookupTableAccounts34        )35    }36}37