update sth
This commit is contained in:
parent
ba9a266247
commit
491a6dba6c
@ -283,6 +283,7 @@
|
||||
D53541272880633900372C0F /* base64.c in Sources */ = {isa = PBXBuildFile; fileRef = D53541252880633900372C0F /* base64.c */; };
|
||||
D5538B9F287D6F9C000BDFB6 /* native-crypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D5538B9D287D6F9B000BDFB6 /* native-crypto.cpp */; };
|
||||
D5538BA0287D6F9C000BDFB6 /* native-crypto.h in Headers */ = {isa = PBXBuildFile; fileRef = D5538B9E287D6F9B000BDFB6 /* native-crypto.h */; };
|
||||
D59AB429292DE3CF00714392 /* librustwallet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D59AB428292DE3CE00714392 /* librustwallet.a */; };
|
||||
ED18118623D6A9B600DED444 /* edtaa3func.h in Headers */ = {isa = PBXBuildFile; fileRef = ED18118323D6A9B500DED444 /* edtaa3func.h */; };
|
||||
ED18118823D6A9B600DED444 /* edtaa3func.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ED18118423D6A9B600DED444 /* edtaa3func.cpp */; };
|
||||
ED18119823D6AA6700DED444 /* libfreetype.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ED18119723D6AA6700DED444 /* libfreetype.a */; };
|
||||
@ -647,6 +648,7 @@
|
||||
D53541252880633900372C0F /* base64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = base64.c; sourceTree = "<group>"; };
|
||||
D5538B9D287D6F9B000BDFB6 /* native-crypto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "native-crypto.cpp"; sourceTree = "<group>"; };
|
||||
D5538B9E287D6F9B000BDFB6 /* native-crypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "native-crypto.h"; sourceTree = "<group>"; };
|
||||
D59AB428292DE3CE00714392 /* librustwallet.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = librustwallet.a; path = ../external/ios/libs/librustwallet.a; sourceTree = "<group>"; };
|
||||
ED18118323D6A9B500DED444 /* edtaa3func.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = edtaa3func.h; path = ../external/sources/edtaa3func/edtaa3func.h; sourceTree = "<group>"; };
|
||||
ED18118423D6A9B600DED444 /* edtaa3func.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = edtaa3func.cpp; path = ../external/sources/edtaa3func/edtaa3func.cpp; sourceTree = "<group>"; };
|
||||
ED18119523D6AA4C00DED444 /* libfreetype.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfreetype.a; path = ../external/mac/libs/libfreetype.a; sourceTree = "<group>"; };
|
||||
@ -695,6 +697,7 @@
|
||||
468A968722F440AC005034BE /* libuv_a.a in Frameworks */,
|
||||
468A968522F43F8F005034BE /* libv8_monolith.a in Frameworks */,
|
||||
EDE5DFF81C0D6B3F0014147A /* libwebsockets.a in Frameworks */,
|
||||
D59AB429292DE3CF00714392 /* librustwallet.a in Frameworks */,
|
||||
1ACF6A3C1E4AFDC80033C137 /* libcrypto.a in Frameworks */,
|
||||
1ACF6A3D1E4AFDC80033C137 /* libssl.a in Frameworks */,
|
||||
A07A4CAF1783777C0073F6A7 /* Foundation.framework in Frameworks */,
|
||||
@ -1325,6 +1328,7 @@
|
||||
B291B5161D4A0FEA00BBB345 /* ios */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D59AB428292DE3CE00714392 /* librustwallet.a */,
|
||||
B291B5171D4A106A00BBB345 /* libjpeg.a */,
|
||||
B291B5181D4A106A00BBB345 /* libpng.a */,
|
||||
B291B5191D4A106A00BBB345 /* libtiff.a */,
|
||||
@ -1894,9 +1898,10 @@
|
||||
baseConfigurationReference = 051C016F21E2F85C00D4A347 /* CCModuleConfigIOS.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = arm64;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
ENABLE_BITCODE = YES;
|
||||
ENABLE_BITCODE = NO;
|
||||
EXCLUDED_ARCHS = "";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
@ -1928,8 +1933,8 @@
|
||||
OTHER_LDFLAGS = "-llibsql3";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/sources $(SRCROOT)/../external/ios/include $(SRCROOT)/../external/ios/include/freetype $(SRCROOT)/../cocos/editor-support/ $(SRCROOT)/../external/ios/include/v8 $(SRCROOT)/../external/ios/include/uv";
|
||||
"USER_HEADER_SEARCH_PATHS[arch=*]" = "$(inherited) $(SRCROOT)/../external/sources $(SRCROOT)/../external/ios/include $(SRCROOT)/../external/ios/include/freetype $(SRCROOT)/../cocos/editor-support/";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/sources $(SRCROOT)/../external/ios/include $(SRCROOT)/../external/ios/include/freetype $(SRCROOT)/../cocos/editor-support/ $(SRCROOT)/../external/ios/include/v8 $(SRCROOT)/../external/ios/include/uv $(SRCROOT)/../external/ios/include/rustwallet";
|
||||
"USER_HEADER_SEARCH_PATHS[arch=*]" = "$(inherited) $(SRCROOT)/../external/sources $(SRCROOT)/../external/ios/include $(SRCROOT)/../external/ios/include/freetype $(SRCROOT)/../cocos/editor-support/ $(SRCROOT)/../external/ios/include/rustwallet";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@ -1938,10 +1943,11 @@
|
||||
baseConfigurationReference = 051C017021E2F85C00D4A347 /* CCModuleConfigIOS.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = arm64;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_BITCODE = YES;
|
||||
ENABLE_BITCODE = NO;
|
||||
EXCLUDED_ARCHS = "";
|
||||
EXECUTABLE_PREFIX = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
@ -1974,8 +1980,8 @@
|
||||
OTHER_LDFLAGS = "-llibsql3";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/sources $(SRCROOT)/../external/ios/include $(SRCROOT)/../external/ios/include/freetype $(SRCROOT)/../cocos/editor-support/ $(SRCROOT)/../external/ios/include/v8";
|
||||
"USER_HEADER_SEARCH_PATHS[arch=*]" = "$(inherited) $(SRCROOT)/../external/sources $(SRCROOT)/../external/ios/include $(SRCROOT)/../external/ios/include/freetype $(SRCROOT)/../cocos/editor-support/ $(SRCROOT)/../external/ios/include/v8 $(SRCROOT)/../external/ios/include/uv";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/sources $(SRCROOT)/../external/ios/include $(SRCROOT)/../external/ios/include/freetype $(SRCROOT)/../cocos/editor-support/ $(SRCROOT)/../external/ios/include/v8 $(SRCROOT)/../external/ios/include/rustwallet";
|
||||
"USER_HEADER_SEARCH_PATHS[arch=*]" = "$(inherited) $(SRCROOT)/../external/sources $(SRCROOT)/../external/ios/include $(SRCROOT)/../external/ios/include/freetype $(SRCROOT)/../cocos/editor-support/ $(SRCROOT)/../external/ios/include/v8 $(SRCROOT)/../external/ios/include/uv $(SRCROOT)/../external/ios/include/rustwallet";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -205,13 +205,13 @@ public:
|
||||
|
||||
void copyTextToClipboard(const std::string &text);
|
||||
|
||||
void scanQRCode(const std::string &funid, const std::string &title);
|
||||
|
||||
void signWithGoogle(const std::string &funid);
|
||||
|
||||
void signOutGoogle(const std::string &funid);
|
||||
void showQRCode(const std::string &content, const std::string &title, const std::string &val);
|
||||
|
||||
void toWallet(const std::string &url);
|
||||
|
||||
void saveKeyLocal(const std::string &account, const std::string &key);
|
||||
|
||||
void loadKeyLocal(const std::string &account, std::string *outItem);
|
||||
|
||||
std::string getSystemVersion();
|
||||
|
||||
|
@ -34,6 +34,7 @@ THE SOFTWARE.
|
||||
#include "base/CCConfiguration.h"
|
||||
#include "scripting/js-bindings/jswrapper/SeApi.h"
|
||||
#include "scripting/js-bindings/event/EventDispatcher.h"
|
||||
#include "storage/local-storage/LocalStorage.h"
|
||||
|
||||
#define LOG_APP_TAG "CCApplication_android Debug"
|
||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_APP_TAG,__VA_ARGS__)
|
||||
@ -292,22 +293,23 @@ void Application::copyTextToClipboard(const std::string &text)
|
||||
copyTextToClipboardJNI(text);
|
||||
}
|
||||
|
||||
void Application::scanQRCode(const std::string &funid, const std::string &title) {
|
||||
scanQRCodeJNI(funid, title);
|
||||
}
|
||||
|
||||
void Application::signWithGoogle(const std::string &funid) {
|
||||
signWithGoogleJNI(funid);
|
||||
}
|
||||
|
||||
void Application::signOutGoogle(const std::string &funid) {
|
||||
signOutGoogleJNI(funid);
|
||||
void Application::showQRCode(const std::string &content, const std::string &title, const std::string &val) {
|
||||
showQRCodeJNI("", content, title, val);
|
||||
}
|
||||
|
||||
void Application::toWallet(const std::string &url) {
|
||||
toWalletJNI(url);
|
||||
}
|
||||
|
||||
void Application::saveKeyLocal(const std::string &account, const std::string &key) {
|
||||
localStorageSetItem(account, key);
|
||||
}
|
||||
|
||||
void Application::loadKeyLocal(const std::string &account, std::string *outItem) {
|
||||
localStorageGetItem(account, outItem);
|
||||
}
|
||||
|
||||
std::string Application::getSystemVersion()
|
||||
{
|
||||
return getSystemVersionJNI();
|
||||
|
@ -331,16 +331,32 @@ void Application::copyTextToClipboard(const std::string &text)
|
||||
pasteboard.string = [NSString stringWithCString:text.c_str() encoding:NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
void Application::scanQRCode(const std::string &funid, const std::string &title) {
|
||||
|
||||
void Application::showQRCode(const std::string &content, const std::string &title, const std::string &val) {
|
||||
NSString *ntitle = [NSString stringWithCString:title.c_str() encoding:NSUTF8StringEncoding];
|
||||
NSString *ncontent = [NSString stringWithCString:content.c_str() encoding:NSUTF8StringEncoding];
|
||||
NSString *noid = [NSString stringWithCString:val.c_str() encoding:NSUTF8StringEncoding];
|
||||
UIWindow* window = [[[UIApplication sharedApplication] delegate] window];
|
||||
[window.rootViewController showQRCode:ncontent title:ntitle oid: noid];
|
||||
}
|
||||
|
||||
void Application::signWithGoogle(const std::string &funid) {
|
||||
|
||||
void Application::saveKeyLocal(const std::string &account, const std::string &key) {
|
||||
NSString *naccount = [NSString stringWithCString:account.c_str() encoding:NSUTF8StringEncoding];
|
||||
NSString *nkey = [NSString stringWithCString:key.c_str() encoding:NSUTF8StringEncoding];
|
||||
UIWindow* window = [[[UIApplication sharedApplication] delegate] window];
|
||||
[window.rootViewController saveKey:naccount key: nkey];
|
||||
}
|
||||
|
||||
void Application::signOutGoogle(const std::string &funid) {
|
||||
|
||||
void Application::loadKeyLocal(const std::string &account, std::string *outItem) {
|
||||
NSString *naccount = [NSString stringWithCString:account.c_str() encoding:NSUTF8StringEncoding];
|
||||
UIWindow* window = [[[UIApplication sharedApplication] delegate] window];
|
||||
NSString * nkey = [window.rootViewController loadKey: naccount];
|
||||
if (nkey != nil) {
|
||||
std::string key = std::string([nkey UTF8String]);
|
||||
outItem->assign(key.c_str());
|
||||
} else {
|
||||
outItem->assign("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Application::toWallet(const std::string &url) {
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "network/HttpClient.h"
|
||||
#include "platform/CCApplication.h"
|
||||
#include "base/ccUTF8.h"
|
||||
#include "storage/local-storage/LocalStorage.h"
|
||||
extern "C"
|
||||
{
|
||||
#include "rustwallet/rustwallet.h"
|
||||
@ -41,7 +40,7 @@ extern "C"
|
||||
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
|
||||
#include "platform/android/jni/JniImp.h"
|
||||
#endif
|
||||
#endif // CC_PLATFORM_ANDROID
|
||||
|
||||
#include <regex>
|
||||
#include "scrypt/native-crypto.h"
|
||||
@ -804,32 +803,6 @@ static bool JSB_cryptoScrypt(se::State& s)
|
||||
SE_BIND_FUNC(JSB_cryptoScrypt)
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
static bool JSB_showQRCode(se::State& s)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc > 4) {
|
||||
std::string funid;
|
||||
ok = seval_to_std_string(args[0], &funid);
|
||||
SE_PRECONDITION2(ok, false, "funid is invalid!");
|
||||
std::string text;
|
||||
ok = seval_to_std_string(args[1], &text);
|
||||
SE_PRECONDITION2(ok, false, "content is invalid!");
|
||||
std::string title;
|
||||
ok = seval_to_std_string(args[2], &title);
|
||||
SE_PRECONDITION2(ok, false, "title is invalid!");
|
||||
std::string id;
|
||||
ok = seval_to_std_string(args[3], &id);
|
||||
SE_PRECONDITION2(ok, false, "data id is invalid!");
|
||||
showQRCodeJNI(funid, text, title, id);
|
||||
return true;
|
||||
}
|
||||
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 4);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(JSB_showQRCode)
|
||||
static bool JSB_scanQRCode(se::State& s)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@ -882,7 +855,6 @@ static bool JSB_signWithGoogle(se::State& s)
|
||||
std::string funid;
|
||||
ok = seval_to_std_string(args[0], &funid);
|
||||
SE_PRECONDITION2(ok, false, "funid is invalid!");
|
||||
// Application::getInstance()->signWithGoogle(funid);
|
||||
signWithGoogleJNI(funid);
|
||||
return true;
|
||||
}
|
||||
@ -908,7 +880,7 @@ static bool JSB_signOutGoogle(se::State& s)
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(JSB_signOutGoogle)
|
||||
#endif
|
||||
|
||||
|
||||
static bool JSB_toWallet(se::State& s)
|
||||
{
|
||||
@ -919,7 +891,7 @@ static bool JSB_toWallet(se::State& s)
|
||||
std::string text;
|
||||
ok = seval_to_std_string(args[0], &text);
|
||||
SE_PRECONDITION2(ok, false, "url is invalid!");
|
||||
// Application::getInstance()->toWallet(text);
|
||||
Application::getInstance()->toWallet(text);
|
||||
toWalletJNI(text);
|
||||
return true;
|
||||
}
|
||||
@ -928,12 +900,38 @@ static bool JSB_toWallet(se::State& s)
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(JSB_toWallet)
|
||||
#endif
|
||||
static bool JSB_showQRCode(se::State& s)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc >= 4) {
|
||||
std::string funid;
|
||||
ok = seval_to_std_string(args[0], &funid);
|
||||
SE_PRECONDITION2(ok, false, "funid is invalid!");
|
||||
std::string text;
|
||||
ok = seval_to_std_string(args[1], &text);
|
||||
SE_PRECONDITION2(ok, false, "content is invalid!");
|
||||
std::string title;
|
||||
ok = seval_to_std_string(args[2], &title);
|
||||
SE_PRECONDITION2(ok, false, "title is invalid!");
|
||||
std::string id;
|
||||
ok = seval_to_std_string(args[3], &id);
|
||||
SE_PRECONDITION2(ok, false, "data id is invalid!");
|
||||
// showQRCodeJNI(funid, text, title, id);
|
||||
Application::getInstance()->showQRCode(text, title, id);
|
||||
return true;
|
||||
}
|
||||
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 4);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(JSB_showQRCode)
|
||||
static bool JSB_generateWallet(se::State& s)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CCLOG("JSB_generateWallet\n");
|
||||
CC_UNUSED bool ok = true;
|
||||
|
||||
if (argc > 0) {
|
||||
@ -943,29 +941,22 @@ static bool JSB_generateWallet(se::State& s)
|
||||
std::string seed;
|
||||
ok = seval_to_std_string(args[1], &seed);
|
||||
SE_PRECONDITION2(ok, false, "Error processing seed");
|
||||
CCLOG("JSB_generateWallet 1 %s\n", seed.c_str());
|
||||
CWallet wallet = new_wallet(seed.c_str());
|
||||
CCLOG("JSB_generateWallet 2 %s\n", wallet.master_key);
|
||||
std::string address = get_address(
|
||||
seed.c_str(),
|
||||
wallet.master_key,
|
||||
wallet.second_key,
|
||||
""
|
||||
);
|
||||
CCLOG("JSB_generateWallet 3 %s\n", address.c_str());
|
||||
std::string localSKey = StringUtils::format("cebg_wallet_s_%s", id.c_str());
|
||||
localStorageSetItem(localSKey, wallet.second_key);
|
||||
CCLOG("JSB_generateWallet 4 \n");
|
||||
// localStorageSetItem(localSKey, wallet.second_key);
|
||||
Application::getInstance()->saveKeyLocal(localSKey, wallet.second_key);
|
||||
Application::getInstance()->setKeySeed(wallet.msg_key);
|
||||
Application::getInstance()->setKeyMaster(wallet.master_key);
|
||||
Application::getInstance()->setKeySecond(wallet.second_key);
|
||||
Application::getInstance()->setKeyBackup(wallet.backup_key);
|
||||
CCLOG("JSB_generateWallet 5 \n");
|
||||
|
||||
size_t msgLen = strlen(wallet.backup_key);
|
||||
char* msg_cpy = (char*)malloc(msgLen + 1);
|
||||
strcpy(msg_cpy, wallet.backup_key);
|
||||
showQRCodeJNI("", msg_cpy, "save this qrcode plz", id);
|
||||
std::string title = "save this qrcode plz";
|
||||
Application::getInstance()->showQRCode(wallet.backup_key, title, id);
|
||||
std::string result = StringUtils::format("{\"master\": \"%s\",\"backup\": \"%s\", \"address\": \"%s\"}\n",
|
||||
wallet.master_key,
|
||||
wallet.backup_key,
|
||||
@ -999,9 +990,11 @@ static bool JSB_prepareWallet(se::State& s)
|
||||
std::string storageSKey = StringUtils::format("cebg_wallet_s_%s", id.c_str());
|
||||
std::string storageBKey = StringUtils::format("cebg_wallet_b_%s", id.c_str());
|
||||
std::string localSKey;
|
||||
localStorageGetItem(storageSKey, &localSKey);
|
||||
Application::getInstance()->loadKeyLocal(storageSKey, &localSKey);
|
||||
// localStorageGetItem(storageSKey, &localSKey);
|
||||
std::string localBKey;
|
||||
localStorageGetItem(storageBKey, &localBKey);
|
||||
Application::getInstance()->loadKeyLocal(storageBKey, &localBKey);
|
||||
// localStorageGetItem(storageBKey, &localBKey);
|
||||
|
||||
Application::getInstance()->setKeyMaster(keyMaster.c_str());
|
||||
Application::getInstance()->setKeySecond(localSKey.c_str());
|
||||
@ -1027,6 +1020,7 @@ static bool JSB_prepareWallet(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(JSB_prepareWallet)
|
||||
|
||||
|
||||
static bool JSB_restoreWallet(se::State& s)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@ -1058,7 +1052,8 @@ static bool JSB_restoreWallet(se::State& s)
|
||||
keyBackup.c_str()
|
||||
);
|
||||
std::string storageKey =StringUtils::format("cebg_wallet_b_%s", id.c_str());
|
||||
localStorageSetItem(storageKey, Application::getInstance()->getKeyBackup());
|
||||
// localStorageSetItem(storageKey, Application::getInstance()->getKeyBackup());
|
||||
Application::getInstance()->saveKeyLocal(storageKey, Application::getInstance()->getKeyBackup());
|
||||
std::string result = StringUtils::format("{\"address\": \"%s\"}\n",
|
||||
address.c_str()
|
||||
);
|
||||
@ -1097,6 +1092,26 @@ static bool JSB_walletSign(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(JSB_walletSign)
|
||||
|
||||
static bool JSB_loadLocalStorage(se::State& s)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc > 0) {
|
||||
std::string key;
|
||||
ok = seval_to_std_string(args[0], &key);
|
||||
SE_PRECONDITION2(ok, false, "Error processing seed");
|
||||
std::string val;
|
||||
Application::getInstance()->loadKeyLocal(key, &val);
|
||||
s.rval().setString(val);
|
||||
return true;
|
||||
}
|
||||
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(JSB_loadLocalStorage)
|
||||
|
||||
static bool JSB_walletSecKey(se::State& s)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@ -1126,6 +1141,7 @@ static bool JSB_walletSignTran(se::State& s)
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
CCLOG("JSB_walletSignTran\n");
|
||||
if (argc > 0) {
|
||||
std::string msg;
|
||||
ok = seval_to_std_string(args[0], &msg);
|
||||
@ -1146,6 +1162,7 @@ static bool JSB_walletSignTran(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(JSB_walletSignTran)
|
||||
|
||||
|
||||
bool jsb_register_global_variables(se::Object* global)
|
||||
{
|
||||
g_threadPool.reset(ThreadPool::newFixedThreadPool(3));
|
||||
@ -1170,18 +1187,20 @@ bool jsb_register_global_variables(se::Object* global)
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
__jsbObj->defineFunction("scanQRCode", _SE(JSB_scanQRCode));
|
||||
__jsbObj->defineFunction("restoreKey", _SE(JSB_restoreKey));
|
||||
__jsbObj->defineFunction("showQRCode", _SE(JSB_showQRCode));
|
||||
__jsbObj->defineFunction("signWithGoogle", _SE(JSB_signWithGoogle));
|
||||
__jsbObj->defineFunction("signOutGoogle", _SE(JSB_signOutGoogle));
|
||||
__jsbObj->defineFunction("toWallet", _SE(JSB_toWallet));
|
||||
|
||||
#endif
|
||||
__jsbObj->defineFunction("showQRCode", _SE(JSB_showQRCode));
|
||||
__jsbObj->defineFunction("generateWallet", _SE(JSB_generateWallet));
|
||||
__jsbObj->defineFunction("prepareWallet", _SE(JSB_prepareWallet));
|
||||
__jsbObj->defineFunction("restoreWallet", _SE(JSB_restoreWallet));
|
||||
__jsbObj->defineFunction("walletSign", _SE(JSB_walletSign));
|
||||
__jsbObj->defineFunction("walletSignTran", _SE(JSB_walletSignTran));
|
||||
__jsbObj->defineFunction("walletSecKey", _SE(JSB_walletSecKey));
|
||||
#endif
|
||||
__jsbObj->defineFunction("toWallet", _SE(JSB_toWallet));
|
||||
|
||||
__jsbObj->defineFunction("loadLocalStorage", _SE(JSB_loadLocalStorage));
|
||||
|
||||
__jsbObj->defineFunction("setPreferredFramesPerSecond", _SE(JSB_setPreferredFramesPerSecond));
|
||||
|
||||
global->defineFunction("__getPlatform", _SE(JSBCore_platform));
|
||||
|
29
external/ios/include/rustwallet/rustwallet.h
vendored
29
external/ios/include/rustwallet/rustwallet.h
vendored
@ -12,16 +12,31 @@ typedef struct CWallet {
|
||||
|
||||
struct CWallet new_wallet(const char *msg);
|
||||
|
||||
struct CWallet restore_wallet(const struct CWallet *cw);
|
||||
|
||||
struct CWallet reset_wallet(const struct CWallet *cw);
|
||||
struct CWallet reset_wallet(const char *msg_key,
|
||||
const char *master_key,
|
||||
const char *second_key,
|
||||
const char *backup_key);
|
||||
|
||||
void free_cwallet(struct CWallet cw);
|
||||
|
||||
char *get_address(const struct CWallet *cw);
|
||||
char *get_address(const char *msg_key,
|
||||
const char *master_key,
|
||||
const char *second_key,
|
||||
const char *backup_key);
|
||||
|
||||
char *generate_sec_key(const struct CWallet *cw);
|
||||
char *generate_sec_key(const char *msg_key,
|
||||
const char *master_key,
|
||||
const char *second_key,
|
||||
const char *backup_key);
|
||||
|
||||
char *sign(const struct CWallet *cw, const char *msg);
|
||||
char *sign(const char *msg_key,
|
||||
const char *master_key,
|
||||
const char *second_key,
|
||||
const char *backup_key,
|
||||
const char *msg);
|
||||
|
||||
char *sign_for_tran(const struct CWallet *cw, const char *msg);
|
||||
char *sign_for_tran(const char *msg_key,
|
||||
const char *master_key,
|
||||
const char *second_key,
|
||||
const char *backup_key,
|
||||
const char *msg);
|
||||
|
BIN
external/ios/libs/librustwallet.a
vendored
BIN
external/ios/libs/librustwallet.a
vendored
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user