2024-01-15 13:27:35 +00:00
|
|
|
#import "AccountManager.h"
|
|
|
|
#import "React/RCTBridge.h"
|
|
|
|
#import "React/RCTEventDispatcher.h"
|
|
|
|
#import "Statusgo.h"
|
|
|
|
#import "Utils.h"
|
2024-11-19 10:50:01 +00:00
|
|
|
#import "StatusBackendClient.h"
|
2024-01-15 13:27:35 +00:00
|
|
|
|
|
|
|
@implementation AccountManager
|
|
|
|
|
|
|
|
RCT_EXPORT_MODULE();
|
|
|
|
|
|
|
|
RCT_EXPORT_METHOD(createAccountAndLogin:(NSString *)request) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"createAccountAndLogin() method called");
|
|
|
|
#endif
|
2024-11-19 10:50:01 +00:00
|
|
|
[StatusBackendClient executeStatusGoRequest:@"CreateAccountAndLogin"
|
|
|
|
body:request
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoCreateAccountAndLogin(request);
|
|
|
|
}];
|
2024-01-15 13:27:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RCT_EXPORT_METHOD(restoreAccountAndLogin:(NSString *)request) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"restoreAccountAndLogin() method called");
|
|
|
|
#endif
|
2024-11-19 10:50:01 +00:00
|
|
|
[StatusBackendClient executeStatusGoRequest:@"RestoreAccountAndLogin"
|
|
|
|
body:request
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoRestoreAccountAndLogin(request);
|
|
|
|
}];
|
2024-01-15 13:27:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
-(NSString *) prepareDirAndUpdateConfig:(NSString *)config
|
|
|
|
withKeyUID:(NSString *)keyUID {
|
|
|
|
NSFileManager *fileManager = [NSFileManager defaultManager];
|
|
|
|
NSError *error = nil;
|
2024-11-19 10:50:01 +00:00
|
|
|
NSURL *rootUrl =[Utils getRootUrl];
|
2024-01-15 13:27:35 +00:00
|
|
|
NSURL *absTestnetFolderName = [rootUrl URLByAppendingPathComponent:@"ethereum/testnet"];
|
|
|
|
|
|
|
|
if (![fileManager fileExistsAtPath:absTestnetFolderName.path])
|
|
|
|
[fileManager createDirectoryAtPath:absTestnetFolderName.path withIntermediateDirectories:YES attributes:nil error:&error];
|
|
|
|
|
|
|
|
NSURL *flagFolderUrl = [rootUrl URLByAppendingPathComponent:@"ropsten_flag"];
|
|
|
|
|
|
|
|
if(![fileManager fileExistsAtPath:flagFolderUrl.path]){
|
|
|
|
NSLog(@"remove lightchaindata");
|
|
|
|
NSURL *absLightChainDataUrl = [absTestnetFolderName URLByAppendingPathComponent:@"StatusIM/lightchaindata"];
|
|
|
|
if([fileManager fileExistsAtPath:absLightChainDataUrl.path]) {
|
|
|
|
[fileManager removeItemAtPath:absLightChainDataUrl.path
|
|
|
|
error:nil];
|
|
|
|
}
|
|
|
|
[fileManager createDirectoryAtPath:flagFolderUrl.path
|
|
|
|
withIntermediateDirectories:NO
|
|
|
|
attributes:nil
|
|
|
|
error:&error];
|
|
|
|
}
|
|
|
|
|
|
|
|
NSLog(@"after remove lightchaindata");
|
|
|
|
|
|
|
|
NSString *keystore = @"keystore";
|
|
|
|
NSURL *absTestnetKeystoreUrl = [absTestnetFolderName URLByAppendingPathComponent:keystore];
|
|
|
|
NSURL *absKeystoreUrl = [rootUrl URLByAppendingPathComponent:keystore];
|
|
|
|
if([fileManager fileExistsAtPath:absTestnetKeystoreUrl.path]){
|
|
|
|
NSLog(@"copy keystore");
|
|
|
|
[fileManager copyItemAtPath:absTestnetKeystoreUrl.path toPath:absKeystoreUrl.path error:nil];
|
|
|
|
[fileManager removeItemAtPath:absTestnetKeystoreUrl.path error:nil];
|
|
|
|
}
|
|
|
|
|
|
|
|
NSLog(@"after lightChainData");
|
|
|
|
|
|
|
|
NSLog(@"preconfig: %@", config);
|
|
|
|
NSData *configData = [config dataUsingEncoding:NSUTF8StringEncoding];
|
|
|
|
NSDictionary *configJSON = [NSJSONSerialization JSONObjectWithData:configData options:NSJSONReadingMutableContainers error:nil];
|
|
|
|
NSString *relativeDataDir = [configJSON objectForKey:@"DataDir"];
|
2024-04-25 04:13:52 +00:00
|
|
|
if (relativeDataDir == nil) {
|
|
|
|
relativeDataDir = @"";
|
|
|
|
}
|
2024-01-15 13:27:35 +00:00
|
|
|
NSString *absDataDir = [rootUrl.path stringByAppendingString:relativeDataDir];
|
|
|
|
NSURL *absDataDirUrl = [NSURL fileURLWithPath:absDataDir];
|
|
|
|
NSString *keystoreDir = [@"/keystore/" stringByAppendingString:keyUID];
|
|
|
|
[configJSON setValue:keystoreDir forKey:@"KeyStoreDir"];
|
|
|
|
[configJSON setValue:@"" forKey:@"LogDir"];
|
|
|
|
[configJSON setValue:@"geth.log" forKey:@"LogFile"];
|
|
|
|
NSString *resultingConfig = [Utils jsonStringWithPrettyPrint:NO fromDictionary:configJSON];
|
|
|
|
|
|
|
|
NSLog(@"node config %@", resultingConfig);
|
|
|
|
|
|
|
|
if(![fileManager fileExistsAtPath:absDataDir]) {
|
|
|
|
[fileManager createDirectoryAtPath:absDataDir
|
|
|
|
withIntermediateDirectories:YES attributes:nil error:nil];
|
|
|
|
}
|
|
|
|
|
|
|
|
NSLog(@"logUrlPath %@ rootDir %@", @"geth.log", rootUrl.path);
|
|
|
|
NSURL *absLogUrl = [absDataDirUrl URLByAppendingPathComponent:@"geth.log"];
|
|
|
|
if(![fileManager fileExistsAtPath:absLogUrl.path]) {
|
|
|
|
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
|
|
|
|
[dict setObject:[NSNumber numberWithInt:511] forKey:NSFilePosixPermissions];
|
|
|
|
[fileManager createFileAtPath:absLogUrl.path contents:nil attributes:dict];
|
|
|
|
}
|
|
|
|
|
|
|
|
return resultingConfig;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
RCT_EXPORT_METHOD(deleteMultiaccount:(NSString *)keyUID
|
|
|
|
callback:(RCTResponseSenderBlock)callback) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"DeleteMultiaccount() method called");
|
|
|
|
#endif
|
|
|
|
NSURL *multiaccountKeystoreDir = [Utils getKeyStoreDirForKeyUID:keyUID];
|
2024-11-19 10:50:01 +00:00
|
|
|
NSDictionary *params = @{
|
|
|
|
@"keyUID": keyUID,
|
|
|
|
@"keyStoreDir": multiaccountKeystoreDir.path
|
|
|
|
};
|
|
|
|
NSError *error;
|
|
|
|
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:params options:0 error:&error];
|
|
|
|
if (error) {
|
|
|
|
NSLog(@"Error creating JSON: %@", error);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
|
|
|
|
|
|
[StatusBackendClient executeStatusGoRequestWithCallback:@"DeleteMultiaccountV2"
|
|
|
|
body:jsonString
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoDeleteMultiaccountV2(jsonString);
|
|
|
|
}
|
|
|
|
callback:callback];
|
2024-01-15 13:27:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RCT_EXPORT_METHOD(prepareDirAndUpdateConfig:(NSString *)keyUID
|
|
|
|
config:(NSString *)config
|
|
|
|
callback:(RCTResponseSenderBlock)callback) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"PrepareDirAndUpdateConfig() method called");
|
|
|
|
#endif
|
|
|
|
NSString *updatedConfig = [self prepareDirAndUpdateConfig:config
|
|
|
|
withKeyUID:keyUID];
|
|
|
|
callback(@[updatedConfig]);
|
|
|
|
}
|
|
|
|
|
|
|
|
RCT_EXPORT_METHOD(saveAccountAndLoginWithKeycard:(NSString *)multiaccountData
|
|
|
|
password:(NSString *)password
|
|
|
|
settings:(NSString *)settings
|
|
|
|
config:(NSString *)config
|
|
|
|
accountsData:(NSString *)accountsData
|
|
|
|
chatKey:(NSString *)chatKey) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"SaveAccountAndLoginWithKeycard() method called");
|
|
|
|
#endif
|
|
|
|
[Utils getExportDbFilePath];
|
|
|
|
NSString *keyUID = [Utils getKeyUID:multiaccountData];
|
|
|
|
NSString *finalConfig = [self prepareDirAndUpdateConfig:config
|
|
|
|
withKeyUID:keyUID];
|
|
|
|
NSString *result = StatusgoSaveAccountAndLoginWithKeycard(multiaccountData, password, settings, finalConfig, accountsData, chatKey);
|
|
|
|
NSLog(@"%@", result);
|
|
|
|
}
|
|
|
|
|
|
|
|
RCT_EXPORT_METHOD(loginWithKeycard:(NSString *)accountData
|
|
|
|
password:(NSString *)password
|
|
|
|
chatKey:(NSString *)chatKey
|
|
|
|
nodeConfigJSON:(NSString *)nodeConfigJSON) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"LoginWithKeycard() method called");
|
|
|
|
#endif
|
|
|
|
[Utils getExportDbFilePath];
|
|
|
|
[Utils migrateKeystore:accountData password:password];
|
|
|
|
|
|
|
|
NSString *result = StatusgoLoginWithKeycard(accountData, password, chatKey, nodeConfigJSON);
|
|
|
|
|
|
|
|
NSLog(@"%@", result);
|
|
|
|
}
|
|
|
|
|
|
|
|
RCT_EXPORT_METHOD(loginWithConfig:(NSString *)accountData
|
|
|
|
password:(NSString *)password
|
|
|
|
configJSON:(NSString *)configJSON) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"LoginWithConfig() method called");
|
|
|
|
#endif
|
|
|
|
[Utils getExportDbFilePath];
|
|
|
|
[Utils migrateKeystore:accountData password:password];
|
|
|
|
NSString *result = StatusgoLoginWithConfig(accountData, password, configJSON);
|
|
|
|
NSLog(@"%@", result);
|
|
|
|
}
|
|
|
|
|
|
|
|
RCT_EXPORT_METHOD(loginAccount:(NSString *)request) {
|
|
|
|
#if DEBUG
|
2024-11-19 10:50:01 +00:00
|
|
|
NSLog(@"loginAccount() method called");
|
2024-01-15 13:27:35 +00:00
|
|
|
#endif
|
2024-11-19 10:50:01 +00:00
|
|
|
[StatusBackendClient executeStatusGoRequest:@"LoginAccount"
|
|
|
|
body:request
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoLoginAccount(request);
|
|
|
|
}];
|
2024-01-15 13:27:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RCT_EXPORT_METHOD(verify:(NSString *)address
|
|
|
|
password:(NSString *)password
|
|
|
|
callback:(RCTResponseSenderBlock)callback) {
|
|
|
|
#if DEBUG
|
2024-11-19 10:50:01 +00:00
|
|
|
NSLog(@"VerifyAccountPasswordV2() method called");
|
2024-01-15 13:27:35 +00:00
|
|
|
#endif
|
2024-11-19 10:50:01 +00:00
|
|
|
NSURL *rootUrl = [Utils getRootUrl];
|
|
|
|
NSString *keystorePath = [rootUrl.path stringByAppendingPathComponent:@"keystore"];
|
|
|
|
|
|
|
|
NSDictionary *params = @{
|
|
|
|
@"keyStoreDir": keystorePath,
|
|
|
|
@"address": address,
|
|
|
|
@"password": password
|
|
|
|
};
|
|
|
|
NSError *error;
|
|
|
|
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:params options:0 error:&error];
|
|
|
|
if (error) {
|
|
|
|
NSLog(@"Error creating JSON: %@", error);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
|
|
|
|
|
|
[StatusBackendClient executeStatusGoRequestWithCallback:@"VerifyAccountPasswordV2"
|
|
|
|
body:jsonString
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoVerifyAccountPasswordV2(jsonString);
|
|
|
|
}
|
|
|
|
callback:callback];
|
2024-01-15 13:27:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RCT_EXPORT_METHOD(verifyDatabasePassword:(NSString *)keyUID
|
|
|
|
password:(NSString *)password
|
|
|
|
callback:(RCTResponseSenderBlock)callback) {
|
|
|
|
#if DEBUG
|
2024-11-19 10:50:01 +00:00
|
|
|
NSLog(@"VerifyDatabasePasswordV2() method called");
|
2024-01-15 13:27:35 +00:00
|
|
|
#endif
|
2024-11-19 10:50:01 +00:00
|
|
|
NSDictionary *params = @{
|
|
|
|
@"keyUID": keyUID,
|
|
|
|
@"password": password
|
|
|
|
};
|
|
|
|
NSError *error;
|
|
|
|
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:params options:0 error:&error];
|
|
|
|
if (error) {
|
|
|
|
NSLog(@"Error creating JSON: %@", error);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
|
|
|
|
|
|
[StatusBackendClient executeStatusGoRequestWithCallback:@"VerifyDatabasePasswordV2"
|
|
|
|
body:jsonString
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoVerifyDatabasePasswordV2(jsonString);
|
|
|
|
}
|
|
|
|
callback:callback];
|
2024-01-15 13:27:35 +00:00
|
|
|
}
|
|
|
|
|
2024-07-04 15:45:00 +00:00
|
|
|
RCT_EXPORT_METHOD(initializeApplication:(NSString *)request
|
|
|
|
callback:(RCTResponseSenderBlock)callback) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"initializeApplication() method called");
|
|
|
|
#endif
|
2024-11-19 10:50:01 +00:00
|
|
|
[StatusBackendClient executeStatusGoRequestWithCallback:@"InitializeApplication"
|
|
|
|
body:request
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoInitializeApplication(request);
|
|
|
|
}
|
|
|
|
callback:callback];
|
2024-07-04 15:45:00 +00:00
|
|
|
}
|
|
|
|
|
2024-10-23 14:26:29 +00:00
|
|
|
RCT_EXPORT_METHOD(acceptTerms:(RCTResponseSenderBlock)callback) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"acceptTerms() method called");
|
|
|
|
#endif
|
2024-11-19 10:50:01 +00:00
|
|
|
[StatusBackendClient executeStatusGoRequestWithCallback:@"AcceptTerms"
|
|
|
|
body:@""
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoAcceptTerms();
|
|
|
|
}
|
|
|
|
callback:callback];
|
2024-10-23 14:26:29 +00:00
|
|
|
}
|
|
|
|
|
2024-01-15 13:27:35 +00:00
|
|
|
RCT_EXPORT_METHOD(openAccounts:(RCTResponseSenderBlock)callback) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"OpenAccounts() method called");
|
|
|
|
#endif
|
2024-11-19 10:50:01 +00:00
|
|
|
NSURL *rootUrl =[Utils getRootUrl];
|
2024-01-15 13:27:35 +00:00
|
|
|
NSString *result = StatusgoOpenAccounts(rootUrl.path);
|
|
|
|
callback(@[result]);
|
|
|
|
}
|
|
|
|
|
|
|
|
RCT_EXPORT_METHOD(logout) {
|
|
|
|
#if DEBUG
|
2024-11-19 10:50:01 +00:00
|
|
|
NSLog(@"Logout() method called");
|
2024-01-15 13:27:35 +00:00
|
|
|
#endif
|
2024-11-19 10:50:01 +00:00
|
|
|
[StatusBackendClient executeStatusGoRequest:@"Logout"
|
|
|
|
body:@""
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoLogout();
|
|
|
|
}];
|
|
|
|
}
|
2024-01-15 13:27:35 +00:00
|
|
|
|
2024-11-19 10:50:01 +00:00
|
|
|
RCT_EXPORT_METHOD(multiAccountStoreAccount:(NSString *)json
|
|
|
|
callback:(RCTResponseSenderBlock)callback) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"MultiAccountStoreAccount() method called");
|
|
|
|
#endif
|
|
|
|
[StatusBackendClient executeStatusGoRequestWithCallback:@"MultiAccountStoreAccount"
|
|
|
|
body:json
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoMultiAccountStoreAccount(json);
|
|
|
|
}
|
|
|
|
callback:callback];
|
|
|
|
}
|
|
|
|
|
|
|
|
RCT_EXPORT_METHOD(multiAccountLoadAccount:(NSString *)json
|
|
|
|
callback:(RCTResponseSenderBlock)callback) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"MultiAccountLoadAccount() method called");
|
|
|
|
#endif
|
|
|
|
[StatusBackendClient executeStatusGoRequestWithCallback:@"MultiAccountLoadAccount"
|
|
|
|
body:json
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoMultiAccountLoadAccount(json);
|
|
|
|
}
|
|
|
|
callback:callback];
|
|
|
|
}
|
|
|
|
|
|
|
|
RCT_EXPORT_METHOD(multiAccountDeriveAddresses:(NSString *)json
|
|
|
|
callback:(RCTResponseSenderBlock)callback) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"multiAccountDeriveAddresses() method called");
|
|
|
|
#endif
|
|
|
|
[StatusBackendClient executeStatusGoRequestWithCallback:@"MultiAccountDeriveAddresses"
|
|
|
|
body:json
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoMultiAccountDeriveAddresses(json);
|
|
|
|
}
|
|
|
|
callback:callback];
|
|
|
|
}
|
|
|
|
|
|
|
|
RCT_EXPORT_METHOD(multiAccountGenerateAndDeriveAddresses:(NSString *)json
|
|
|
|
callback:(RCTResponseSenderBlock)callback) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"MultiAccountGenerateAndDeriveAddresses() method called");
|
|
|
|
#endif
|
|
|
|
[StatusBackendClient executeStatusGoRequestWithCallback:@"MultiAccountGenerateAndDeriveAddresses"
|
|
|
|
body:json
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoMultiAccountGenerateAndDeriveAddresses(json);
|
|
|
|
}
|
|
|
|
callback:callback];
|
|
|
|
}
|
|
|
|
|
|
|
|
RCT_EXPORT_METHOD(multiAccountStoreDerived:(NSString *)json
|
|
|
|
callback:(RCTResponseSenderBlock)callback) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"MultiAccountStoreDerived() method called");
|
|
|
|
#endif
|
|
|
|
[StatusBackendClient executeStatusGoRequestWithCallback:@"MultiAccountStoreDerivedAccounts"
|
|
|
|
body:json
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoMultiAccountStoreDerivedAccounts(json);
|
|
|
|
}
|
|
|
|
callback:callback];
|
|
|
|
}
|
|
|
|
|
|
|
|
RCT_EXPORT_METHOD(multiAccountImportMnemonic:(NSString *)json
|
|
|
|
callback:(RCTResponseSenderBlock)callback) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"MultiAccountImportMnemonic() method called");
|
|
|
|
#endif
|
|
|
|
[StatusBackendClient executeStatusGoRequestWithCallback:@"MultiAccountImportMnemonic"
|
|
|
|
body:json
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoMultiAccountImportMnemonic(json);
|
|
|
|
}
|
|
|
|
callback:callback];
|
|
|
|
}
|
|
|
|
|
|
|
|
RCT_EXPORT_METHOD(multiAccountImportPrivateKey:(NSString *)json
|
|
|
|
callback:(RCTResponseSenderBlock)callback) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"MultiAccountImportPrivateKey() method called");
|
|
|
|
#endif
|
|
|
|
[StatusBackendClient executeStatusGoRequestWithCallback:@"MultiAccountImportPrivateKey"
|
|
|
|
body:json
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoMultiAccountImportPrivateKey(json);
|
|
|
|
}
|
|
|
|
callback:callback];
|
2024-01-15 13:27:35 +00:00
|
|
|
}
|
|
|
|
|
2024-02-21 11:53:14 +00:00
|
|
|
RCT_EXPORT_METHOD(getRandomMnemonic:(RCTResponseSenderBlock)callback) {
|
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"GetRandomMnemonic() method called");
|
|
|
|
#endif
|
2024-11-19 10:50:01 +00:00
|
|
|
[StatusBackendClient executeStatusGoRequestWithCallback:@"GetRandomMnemonic"
|
|
|
|
body:@""
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoGetRandomMnemonic();
|
|
|
|
}
|
|
|
|
callback:callback];
|
2024-02-21 11:53:14 +00:00
|
|
|
}
|
|
|
|
|
2024-11-19 10:50:01 +00:00
|
|
|
RCT_EXPORT_METHOD(createAccountFromMnemonicAndDeriveAccountsForPaths:(NSString *)mnemonic
|
|
|
|
callback:(RCTResponseSenderBlock)callback) {
|
2024-02-21 11:53:14 +00:00
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"createAccountFromMnemonicAndDeriveAccountsForPaths() method called");
|
|
|
|
#endif
|
2024-11-19 10:50:01 +00:00
|
|
|
[StatusBackendClient executeStatusGoRequestWithCallback:@"CreateAccountFromMnemonicAndDeriveAccountsForPaths"
|
|
|
|
body:mnemonic
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoCreateAccountFromMnemonicAndDeriveAccountsForPaths(mnemonic);
|
|
|
|
}
|
|
|
|
callback:callback];
|
2024-02-21 11:53:14 +00:00
|
|
|
}
|
|
|
|
|
2024-11-19 10:50:01 +00:00
|
|
|
RCT_EXPORT_METHOD(createAccountFromPrivateKey:(NSString *)json
|
|
|
|
callback:(RCTResponseSenderBlock)callback) {
|
2024-06-11 12:05:10 +00:00
|
|
|
#if DEBUG
|
|
|
|
NSLog(@"createAccountFromPrivateKey() method called");
|
|
|
|
#endif
|
2024-11-19 10:50:01 +00:00
|
|
|
[StatusBackendClient executeStatusGoRequestWithCallback:@"CreateAccountFromPrivateKey"
|
|
|
|
body:json
|
|
|
|
statusgoFunction:^NSString *{
|
|
|
|
return StatusgoCreateAccountFromPrivateKey(json);
|
|
|
|
}
|
|
|
|
callback:callback];
|
2024-06-11 12:05:10 +00:00
|
|
|
}
|
|
|
|
|
2024-01-15 13:27:35 +00:00
|
|
|
@end
|