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.8 KB · 48 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 final class TONWallet {1415    /// Constructs a TON Wallet V4R2 stateInit encoded as BoC (BagOfCells) for the given `public_key`.16    /// 17    /// - Parameter public_key: wallet's public key.18    /// - Parameter workchain: TON workchain to which the wallet belongs. Usually, base chain is used (0).19    /// - Parameter wallet_id: wallet's ID allows to create multiple wallets for the same private key.20    /// - Returns: Pointer to a base64 encoded Bag Of Cells (BoC) StateInit. Null if invalid public key provided.21    public static func buildV4R2StateInit(publicKey: PublicKey, workchain: Int32, walletId: Int32) -> String? {22        guard let result = TWTONWalletBuildV4R2StateInit(publicKey.rawValue, workchain, walletId) else {23            return nil24        }25        return TWStringNSString(result)26    }2728    /// 29    /// - Parameter public_key: wallet's public key.30    /// - Parameter workchain: TON workchain to which the wallet belongs. Usually, base chain is used (0).31    /// - Parameter wallet_id: wallet's ID allows to create multiple wallets for the same private key.32    /// - Returns: Pointer to a base64 encoded Bag Of Cells (BoC) StateInit. Null if invalid public key provided.33    public static func buildV5R1StateInit(publicKey: PublicKey, workchain: Int32, walletId: Int32) -> String? {34        guard let result = TWTONWalletBuildV5R1StateInit(publicKey.rawValue, workchain, walletId) else {35            return nil36        }37        return TWStringNSString(result)38    }3940    let rawValue: OpaquePointer4142    init(rawValue: OpaquePointer) {43        self.rawValue = rawValue44    }454647}48