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.4 KB · 45 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 Foundation1112/// Filecoin-Ethereum address converter.13public struct FilecoinAddressConverter {1415    /// Converts a Filecoin address to Ethereum.16    ///17    /// - Parameter filecoinAddress:: a Filecoin address.18    /// - Returns:s the Ethereum address. On invalid input empty string is returned. Returned object needs to be deleted after use.19    public static func convertToEthereum(filecoinAddress: String) -> String {20        let filecoinAddressString = TWStringCreateWithNSString(filecoinAddress)21        defer {22            TWStringDelete(filecoinAddressString)23        }24        return TWStringNSString(TWFilecoinAddressConverterConvertToEthereum(filecoinAddressString))25    }2627    /// Converts an Ethereum address to Filecoin.28    ///29    /// - Parameter ethAddress:: an Ethereum address.30    /// - Returns:s the Filecoin address. On invalid input empty string is returned. Returned object needs to be deleted after use.31    public static func convertFromEthereum(ethAddress: String) -> String {32        let ethAddressString = TWStringCreateWithNSString(ethAddress)33        defer {34            TWStringDelete(ethAddressString)35        }36        return TWStringNSString(TWFilecoinAddressConverterConvertFromEthereum(ethAddressString))37    }383940    init() {41    }424344}45