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%
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 final class TONAddressConverter {1415 /// Converts a TON user address into a Bag of Cells (BoC) with a single root Cell.16 /// The function is mostly used to request a Jetton user address via `get_wallet_address` RPC.17 /// https://docs.ton.org/develop/dapps/asset-processing/jettons#retrieving-jetton-wallet-addresses-for-a-given-user18 /// 19 /// - Parameter address: Address to be converted into a Bag Of Cells (BoC).20 /// - Returns: Pointer to a base64 encoded Bag Of Cells (BoC). Null if invalid address provided.21 public static func toBoc(address: String) -> String? {22 let addressString = TWStringCreateWithNSString(address)23 defer {24 TWStringDelete(addressString)25 }26 guard let result = TWTONAddressConverterToBoc(addressString) else {27 return nil28 }29 return TWStringNSString(result)30 }3132 /// Parses a TON address from a Bag of Cells (BoC) with a single root Cell.33 /// The function is mostly used to parse a Jetton user address received on `get_wallet_address` RPC.34 /// https://docs.ton.org/develop/dapps/asset-processing/jettons#retrieving-jetton-wallet-addresses-for-a-given-user35 /// 36 /// - Parameter boc: Base64 encoded Bag Of Cells (BoC).37 /// - Returns: Pointer to a Jetton address.38 public static func fromBoc(boc: String) -> String? {39 let bocString = TWStringCreateWithNSString(boc)40 defer {41 TWStringDelete(bocString)42 }43 guard let result = TWTONAddressConverterFromBoc(bocString) else {44 return nil45 }46 return TWStringNSString(result)47 }4849 /// Converts any TON address format to user friendly with the given parameters.50 /// 51 /// - Parameter address: raw or user-friendly address to be converted.52 /// - Parameter bounceable: whether the result address should be bounceable.53 /// - Parameter testnet: whether the result address should be testnet.54 /// - Returns: user-friendly address str.55 public static func toUserFriendly(address: String, bounceable: Bool, testnet: Bool) -> String? {56 let addressString = TWStringCreateWithNSString(address)57 defer {58 TWStringDelete(addressString)59 }60 guard let result = TWTONAddressConverterToUserFriendly(addressString, bounceable, testnet) else {61 return nil62 }63 return TWStringNSString(result)64 }6566 let rawValue: OpaquePointer6768 init(rawValue: OpaquePointer) {69 self.rawValue = rawValue70 }717273}74