ZKWallet
Objective-C
@interface ZKWallet : NSObject
Swift
class ZKWallet : NSObject
User wallet provides methods for transfer and exchange of fiat and cryptocurrency funds.
Sending a transaction or making an exchange is a two step process. First a transaction or
exchange has to be composed via one of the compose methods, then ZKComposedTransaction or
ZKComposedExchange can be submitted.
User wallet instance can be obtained by creating, unlocking or recovering user wallet via ZKUser instance.
-
Compose BTC or BSV transaction. Refer to Send Transactions guide for usage details.
On success
ZKComposedTransactionis returned via callback.Declaration
Objective-C
- (void)composeTransaction:(nonnull NSString *)fromAccountId changeAccountId:(nonnull NSString *)changeAccountId destination:(nonnull NSString *)destination amount:(nullable NSDecimalNumber *)amount feeRate:(nonnull NSDecimalNumber *)feeRate sendMax:(BOOL)sendMax callback:(nullable id<ZKComposeTransactionCallback>)callback;Parameters
fromAccountIdZKAccountidentifierchangeAccountIdchange
ZKAccountidentifier, which can be the same as fromAccountIddestinationdestination wallet address
amountamount in BTC or BSV
feeRatefee rate in satoshis/byte
sendMaxsend maximum possible funds to destination
callbackan interface to receive the result or error
-
Compose Ethereum transaction. Refer to Send Transactions guide for usage details.
On success
ZKComposedTransactionis returned via callback.Declaration
Objective-C
- (void)composeEthTransaction:(nonnull NSString *)fromAccountId gasPrice:(nonnull NSDecimalNumber *)gasPrice gasLimit:(int32_t)gasLimit destination:(nullable NSString *)destination amount:(nullable NSDecimalNumber *)amount data:(nullable NSString *)data nonce:(nullable NSNumber *)nonce sendMax:(BOOL)sendMax callback: (nullable id<ZKComposeTransactionCallback>)callback;Parameters
fromAccountIdZKAccountidentifiergasPricegas price in gwei
gasLimitgas limit
destinationdestination wallet address
amountamount in ETH
datadata in string format or null
noncenext transaction nonce or null
sendMaxsend maximum possible funds to destination
callbackan interface to receive the result or error
-
composeEthTransactioncompletion handler extension.Declaration
Objective-C
- (void)composeEthTransaction:(nonnull NSString *)fromAccountId gasPrice:(nonnull NSDecimalNumber *)gasPrice gasLimit:(int32_t)gasLimit destination:(nullable NSString *)destination amount:(nullable NSDecimalNumber *)amount data:(nullable NSString *)data nonce:(nullable NSNumber *)nonce sendMax:(BOOL)sendMax completion:(ZKComposeTransactionCompletionBlock _Nonnull) completionHandler;Swift
func composeEthTransaction(_ fromAccountId: String, gasPrice: NSDecimalNumber, gasLimit: Int32, destination: String?, amount: NSDecimalNumber?, data: String?, nonce: NSNumber?, sendMax: Bool) async throws -> ZKComposedTransaction -
composeTransactioncompletion handler extension.Declaration
Objective-C
- (void)composeTransaction:(nonnull NSString *)fromAccountId changeAccountId:(nonnull NSString *)changeAccountId destination:(nonnull NSString *)destination amount:(nullable NSDecimalNumber *)amount feeRate:(nonnull NSDecimalNumber *)feeRate sendMax:(BOOL)sendMax completion:(ZKComposeTransactionCompletionBlock _Nonnull) completionHandler;Swift
func composeTransaction(_ fromAccountId: String, changeAccountId: String, destination: String, amount: NSDecimalNumber?, feeRate: NSDecimalNumber, sendMax: Bool) async throws -> ZKComposedTransaction
View on GitHub
ZKWallet Class Reference