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
ZKComposedTransaction
is 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
fromAccountId
ZKAccount
identifierchangeAccountId
change
ZKAccount
identifier, which can be the same as fromAccountIddestination
destination wallet address
amount
amount in BTC or BSV
feeRate
fee rate in satoshis/byte
sendMax
send maximum possible funds to destination
callback
an interface to receive the result or error
-
Compose Ethereum transaction. Refer to Send Transactions guide for usage details.
On success
ZKComposedTransaction
is 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
fromAccountId
ZKAccount
identifiergasPrice
gas price in gwei
gasLimit
gas limit
destination
destination wallet address
amount
amount in ETH
data
data in string format or null
nonce
next transaction nonce or null
sendMax
send maximum possible funds to destination
callback
an interface to receive the result or error
-
composeEthTransaction
completion 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
-
composeTransaction
completion 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