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%
953 B · 37 lines swift
Raw Blame History
1import WalletCoreC2import Foundation3// SPDX-License-Identifier: Apache-2.04//5// Copyright © 2017 Trust Wallet.6//7// This is a GENERATED FILE, changes made here WILL BE LOST.8//910import Foundation111213public struct TransactionUtil {1415    /// Calculate the TX hash of a transaction.16    ///17    /// - Parameter coin: coin type.18    /// - Parameter encodedTx: encoded transaction data.19    /// - Returns: The TX hash of a transaction, If the input is invalid or the chain is unsupported, null is returned.20    public static func calcTxHash(coinType: CoinType, encodedTx: String) -> String? {21        let encodedTxString = TWStringCreateWithNSString(encodedTx)22        defer {23            TWStringDelete(encodedTxString)24        }25        guard let result = TWTransactionUtilCalcTxHash(TWCoinType(rawValue: coinType.rawValue), encodedTxString) else {26            return nil27        }28        return TWStringNSString(result)29    }303132    init() {33    }343536}37