增加本地网络配置

This commit is contained in:
cebgcontract 2022-11-01 15:23:37 +08:00
parent c32e60076a
commit c83682e16e
5 changed files with 284 additions and 208 deletions

View File

@ -25,3 +25,19 @@
4. JazzIcon的hashicon 4. JazzIcon的hashicon
5. 使用WalletConnect与第三方钱包交互 5. 使用WalletConnect与第三方钱包交互
## 第三方包的修改
```
// 理论上npm install时候会根据patches里的更改,自动修改第三方包
// 如果没有的话, 就运行如下命令
npm run postinstall
// 签名方法的修改
web3.eth.signTransaction
@ethereumjs/tx/node_modules/ethereumjs-util/dist.browser/signature.js的ecsign方法
@metamask/eth-sig-util/signTypedData
@metamask/eth-sig-util/node_modules/ethereumjs-util/dist/signature.js的ecsign方法
```

View File

@ -73,6 +73,26 @@ export const DEFALUT_TOKENS = {
decimal: 18, decimal: 18,
}, },
], ],
1338: [
{
type: "eth",
address: "eth",
symbol: "ETH",
decimal: 18,
},
{
type: "erc20",
address: "0x4d46f75Be6E98dBA8E8384802a68d550DeB69770",
symbol: "CEC",
decimal: 18,
},
{
type: "erc20",
address: "0xb3212b66C337F83D277172D891Daf31776FF9D79",
symbol: "CEG",
decimal: 18,
},
],
}; };
export const DEFAULT_NFT_TYPES = { export const DEFAULT_NFT_TYPES = {
@ -148,6 +168,24 @@ export const DEFAULT_NFT_TYPES = {
type: "erc1155", type: "erc1155",
}, },
}, },
1338: {
hero: {
address: "0xCd36bFD6f5c9685A5b1DD953E8279eeC7d41e1E1",
type: "erc721",
},
weapon: {
address: "0xf1486cC376555A5035cFa85A761279c9876Daddc",
type: "erc721",
},
chip: {
address: "0xc56a7B89639738382abF20E1829d1ff1a4e21e33",
type: "erc1155",
},
shard: {
address: "0x8BaA4d31B46a272b5a90F192Dcf20348E1845719",
type: "erc1155",
},
},
}; };
export const JC_CONTRACTS = { export const JC_CONTRACTS = {
@ -171,4 +209,9 @@ export const JC_CONTRACTS = {
evolveFactory: "0x07Bad070e403a4Bad2Eec3BA3894c4524d3d2674", evolveFactory: "0x07Bad070e403a4Bad2Eec3BA3894c4524d3d2674",
minterFactory: "0x5ecEFA2707e3f09B9A169ae696B36Df8dB7410ED", minterFactory: "0x5ecEFA2707e3f09B9A169ae696B36Df8dB7410ED",
}, },
1338: {
nftMall: "0x68731C006E8a7Fa45c6eAb579f8F7507b10f5571",
evolveFactory: "0xa390Fa8d4F032cCfCeC1CFF34f2eb549928DcEad",
minterFactory: "0x0DB24A927FFC3622884B7A3B6f1C694ED8092A01",
},
}; };

View File

@ -1,274 +1,282 @@
export const AllChains = [ export const AllChains = [
{ {
name: 'Ethereum Mainnet RPC', name: "Ethereum Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://rpc.ankr.com/eth', rpc: "https://rpc.ankr.com/eth",
id: 1, id: 1,
symbol: 'ETH', symbol: "ETH",
explorerurl: 'https://etherscan.io' explorerurl: "https://etherscan.io",
}, },
{ {
name: 'Ethereum Ropsten Testnet RPC', name: "Ethereum Ropsten Testnet RPC",
type: 'Testnet', type: "Testnet",
rpc: 'https://ropsten.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161', rpc: "https://ropsten.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161",
id: 3, id: 3,
symbol: 'ETH', symbol: "ETH",
explorerurl: 'https://ropsten.etherscan.io' explorerurl: "https://ropsten.etherscan.io",
}, },
{ {
name: 'Ethereum Rinkeby Testnet RPC', name: "Ethereum Rinkeby Testnet RPC",
type: 'Testnet', type: "Testnet",
rpc: 'https://rinkey.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161', rpc: "https://rinkey.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161",
id: 4, id: 4,
symbol: 'ETH', symbol: "ETH",
explorerurl: 'https://rinkey.etherscan.io' explorerurl: "https://rinkey.etherscan.io",
}, },
{ {
name: 'Ethereum Goerli Testnet RPC', name: "Ethereum Goerli Testnet RPC",
type: 'Testnet', type: "Testnet",
rpc: 'https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161', rpc: "https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161",
id: 5, id: 5,
symbol: 'ETH', symbol: "ETH",
explorerurl: 'https://goerli.etherscan.io' explorerurl: "https://goerli.etherscan.io",
}, },
{ {
name: 'Ethereum Kovan Testnet RPC', name: "Ethereum Kovan Testnet RPC",
type: 'Testnet', type: "Testnet",
rpc: 'https://kovan.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161', rpc: "https://kovan.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161",
id: 6, id: 6,
symbol: 'ETH', symbol: "ETH",
explorerurl: 'https://kovan.etherscan.io' explorerurl: "https://kovan.etherscan.io",
}, },
{ {
name: 'Ubiq Mainnet RPC', name: "Ubiq Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://rpc.octano.dev/', rpc: "https://rpc.octano.dev/",
id: 8, id: 8,
symbol: 'UBQ', symbol: "UBQ",
explorerurl: 'https://ubiqscan.io/' explorerurl: "https://ubiqscan.io/",
}, },
{ {
name: 'Elastos ETH Mainnet RPC', name: "Elastos ETH Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://api.elastos.io/eth', rpc: "https://api.elastos.io/eth",
id: 20, id: 20,
symbol: 'ELA', symbol: "ELA",
explorerurl: 'https://explorer.elaeth.io/' explorerurl: "https://explorer.elaeth.io/",
}, },
{ {
name: 'Cronos Mainnet RPC', name: "Cronos Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://evm-cronos.crypto.org', rpc: "https://evm-cronos.crypto.org",
id: 25, id: 25,
symbol: 'CRO', symbol: "CRO",
explorerurl: 'https://cronos.crypto.org/explorer/' explorerurl: "https://cronos.crypto.org/explorer/",
}, },
{ {
name: 'Telos EVM Mainnet RPC', name: "Telos EVM Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://mainnet.telos.net/evm', rpc: "https://mainnet.telos.net/evm",
id: 40, id: 40,
symbol: 'TLOS', symbol: "TLOS",
explorerurl: 'https://telos.net/' explorerurl: "https://telos.net/",
}, },
{ {
name: 'Binance Smart Chain', name: "Binance Smart Chain",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://rpc.ankr.com/bsc', rpc: "https://rpc.ankr.com/bsc",
id: 56, id: 56,
symbol: 'BNB', symbol: "BNB",
explorerurl: 'https://bscscan.com' explorerurl: "https://bscscan.com",
}, },
{ {
name: 'OKExChain Mainnet RPC', name: "OKExChain Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://exchainrpc.okex.org', rpc: "https://exchainrpc.okex.org",
id: 66, id: 66,
symbol: 'OKT', symbol: "OKT",
explorerurl: 'https://www.oklink.com/okexchain' explorerurl: "https://www.oklink.com/okexchain",
}, },
{ {
name: 'Hoo Mainnet RPC', name: "Hoo Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://http-mainnet.hoosmartchain.com', rpc: "https://http-mainnet.hoosmartchain.com",
id: 70, id: 70,
symbol: 'HOO', symbol: "HOO",
explorerurl: 'https://hooscan.com' explorerurl: "https://hooscan.com",
}, },
{ {
name: 'Binance Testnet', name: "Binance Testnet",
type: 'Testnet', type: "Testnet",
rpc: 'https://data-seed-prebsc-1-s1.binance.org:8545/', rpc: "https://data-seed-prebsc-1-s1.binance.org:8545/",
id: 97, id: 97,
symbol: 'BNB', symbol: "BNB",
explorerurl: 'https://testnet.bscscan.com' explorerurl: "https://testnet.bscscan.com",
}, },
{ {
name: 'xDai Mainnet RPC', name: "xDai Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://rpc.xdaichain.com/', rpc: "https://rpc.xdaichain.com/",
id: 100, id: 100,
symbol: 'XDAI', symbol: "XDAI",
explorerurl: 'https://blockscout.com/xdai/mainnet/' explorerurl: "https://blockscout.com/xdai/mainnet/",
}, },
{ {
name: 'Fuse Mainnet RPC', name: "Fuse Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://rpc.fuse.io', rpc: "https://rpc.fuse.io",
id: 122, id: 122,
symbol: 'FUSE', symbol: "FUSE",
explorerurl: 'https://explorer.fuse.io/' explorerurl: "https://explorer.fuse.io/",
}, },
{ {
name: 'HECO Mainnet RPC', name: "HECO Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://http-mainnet-node.huobichain.com/', rpc: "https://http-mainnet-node.huobichain.com/",
id: 128, id: 128,
symbol: 'HT', symbol: "HT",
explorerurl: 'https://hecoinfo.com/' explorerurl: "https://hecoinfo.com/",
}, },
{ {
name: 'Matic Mainnet RPC', name: "Matic Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://polygon-rpc.com', rpc: "https://polygon-rpc.com",
id: 137, id: 137,
symbol: 'MATIC', symbol: "MATIC",
explorerurl: 'https://explorer.matic.network/' explorerurl: "https://explorer.matic.network/",
}, },
{ {
name: 'Fantom Opera Mainnet RPC', name: "Fantom Opera Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://rpc.ftm.tools/', rpc: "https://rpc.ftm.tools/",
id: 250, id: 250,
symbol: 'FTM', symbol: "FTM",
explorerurl: 'https://ftmscan.com' explorerurl: "https://ftmscan.com",
}, },
{ {
name: 'HECO Testnet RPC', name: "HECO Testnet RPC",
type: 'Testnet', type: "Testnet",
rpc: 'https://http-testnet.hecochain.com', rpc: "https://http-testnet.hecochain.com",
id: 256, id: 256,
symbol: 'HT', symbol: "HT",
explorerurl: 'https://testnet.hecoinfo.com/' explorerurl: "https://testnet.hecoinfo.com/",
}, },
{ {
name: 'KCC Mainnet', name: "KCC Mainnet",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://rpc-mainnet.kcc.network', rpc: "https://rpc-mainnet.kcc.network",
id: 321, id: 321,
symbol: 'KCS', symbol: "KCS",
explorerurl: 'https://scan.kcc.network' explorerurl: "https://scan.kcc.network",
}, },
{ {
name: 'KCC Testnet', name: "KCC Testnet",
type: 'Testnet', type: "Testnet",
rpc: 'https://rpc-testnet.kcc.network', rpc: "https://rpc-testnet.kcc.network",
id: 322, id: 322,
symbol: 'tKCS', symbol: "tKCS",
explorerurl: 'https://scan-testnet.kcc.network' explorerurl: "https://scan-testnet.kcc.network",
}, },
{ {
name: 'Moonriver Mainnet RPC', name: "Moonriver Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://rpc.moonriver.moonbeam.network', rpc: "https://rpc.moonriver.moonbeam.network",
id: 1285, id: 1285,
symbol: 'MOVR', symbol: "MOVR",
explorerurl: 'https://blockscout.moonriver.moonbeam.network/' explorerurl: "https://blockscout.moonriver.moonbeam.network/",
}, },
{ {
name: 'Fantom Testnet RPC', name: "Fantom Testnet RPC",
type: 'Testnet', type: "Testnet",
rpc: 'https://rpc.testnet.fantom.network/', rpc: "https://rpc.testnet.fantom.network/",
id: 4002, id: 4002,
symbol: 'FTM', symbol: "FTM",
explorerurl: 'https://testnet.ftmscan.com' explorerurl: "https://testnet.ftmscan.com",
}, },
{ {
name: 'IoTeX Mainnet RPC', name: "IoTeX Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://babel-api.mainnet.iotex.io', rpc: "https://babel-api.mainnet.iotex.io",
id: 4689, id: 4689,
symbol: 'IOTEX', symbol: "IOTEX",
explorerurl: 'https://iotexscan.io/' explorerurl: "https://iotexscan.io/",
}, },
{ {
name: 'Nahmii Mainnet RPC', name: "Nahmii Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://l2.nahmii.io/', rpc: "https://l2.nahmii.io/",
id: 5551, id: 5551,
symbol: 'ETH', symbol: "ETH",
explorerurl: 'https://explorer.nahmii.io/' explorerurl: "https://explorer.nahmii.io/",
}, },
{ {
name: 'Nahmii Testnet RPC', name: "Nahmii Testnet RPC",
type: 'Testnet', type: "Testnet",
rpc: 'https://l2.testnet.nahmii.io/', rpc: "https://l2.testnet.nahmii.io/",
id: 5553, id: 5553,
symbol: 'ETH', symbol: "ETH",
explorerurl: 'https://explorer.testnet.nahmii.io/' explorerurl: "https://explorer.testnet.nahmii.io/",
}, },
{ {
name: 'Arbitrum Mainnet RPC', name: "Arbitrum Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://rpc.ankr.com/arbitrum', rpc: "https://rpc.ankr.com/arbitrum",
id: 42161, id: 42161,
symbol: 'ETH', symbol: "ETH",
explorerurl: 'https://arbiscan.io/' explorerurl: "https://arbiscan.io/",
}, },
{ {
name: 'Celo Mainnet RPC', name: "Celo Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://rpc.ankr.com/celo', rpc: "https://rpc.ankr.com/celo",
id: 42220, id: 42220,
symbol: 'CELO', symbol: "CELO",
explorerurl: 'https://celoscan.com' explorerurl: "https://celoscan.com",
}, },
{ {
name: 'Avalanche C Chain Local RPC', name: "Avalanche C Chain Local RPC",
type: 'Testnet', type: "Testnet",
rpc: 'https://localhost:9650/ext/bc/C/rpc', rpc: "https://localhost:9650/ext/bc/C/rpc",
id: 43112, id: 43112,
symbol: 'AVAX', symbol: "AVAX",
explorerurl: 'https://snowtrace.io' explorerurl: "https://snowtrace.io",
}, },
{ {
name: 'Avalanche FUJI Testnet RPC', name: "Avalanche FUJI Testnet RPC",
type: 'Testnet', type: "Testnet",
rpc: 'https://api.avax-test.network/ext/bc/C/rpc', rpc: "https://api.avax-test.network/ext/bc/C/rpc",
id: 43113, id: 43113,
symbol: 'AVAX', symbol: "AVAX",
explorerurl: 'https://testnet.explorer.avax.network/' explorerurl: "https://testnet.explorer.avax.network/",
}, },
{ {
name: 'Avalanche C Chain Mainnet RPC', name: "Avalanche C Chain Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://rpc.ankr.com/avalanche', rpc: "https://rpc.ankr.com/avalanche",
id: 43114, id: 43114,
symbol: 'AVAX', symbol: "AVAX",
explorerurl: 'https://snowtrace.io' explorerurl: "https://snowtrace.io",
}, },
{ {
name: 'Matic Testnet RPC', name: "Matic Testnet RPC",
type: 'Testnet', type: "Testnet",
rpc: 'https://rpc-mumbai.maticvigil.com', rpc: "https://rpc-mumbai.maticvigil.com",
id: 80001, id: 80001,
symbol: 'MATIC', symbol: "MATIC",
explorerurl: 'https://mumbai.polygonscan.com/' explorerurl: "https://mumbai.polygonscan.com/",
}, },
{ {
name: 'Harmony Mainnet RPC', name: "Harmony Mainnet RPC",
type: 'Mainnet', type: "Mainnet",
rpc: 'https://api.harmony.one/', rpc: "https://api.harmony.one/",
id: 1666600000, id: 1666600000,
symbol: 'ONE', symbol: "ONE",
explorerurl: 'https://explorer.harmony.one' explorerurl: "https://explorer.harmony.one",
}, },
{ {
name: 'Harmony Testnet RPC', name: "Harmony Testnet RPC",
type: 'Testnet', type: "Testnet",
rpc: 'https://api.s0.b.hmny.io/', rpc: "https://api.s0.b.hmny.io/",
id: 1666700000, id: 1666700000,
symbol: 'ONE', symbol: "ONE",
explorerurl: 'https://explorer.harmony.one' explorerurl: "https://explorer.harmony.one",
} },
] {
name: "Local Testnet",
type: "Local",
rpc: "http://192.168.100.22:8545",
id: 1337,
symbol: "ETH",
explorerurl: "https://explorer.harmony.one",
},
];

View File

@ -16,15 +16,9 @@ import {
import { ERC20Standard } from "./standards/ERC20Standard"; import { ERC20Standard } from "./standards/ERC20Standard";
import { ERC721Standard } from "./standards/ERC721Standard"; import { ERC721Standard } from "./standards/ERC721Standard";
import { IAccount, INFT, initAccount, initNFT } from "./data/DataModel"; import { IAccount, INFT, initAccount, initNFT } from "./data/DataModel";
import { import { loadToken, saveData } from "./manage/DataManage";
checkPassword,
loadData,
loadToken,
saveData,
savePassword,
} from "./manage/DataManage";
import { WALLET_STORAGE_KEY_NAME } from "./config/constants"; import { WALLET_STORAGE_KEY_NAME } from "./config/constants";
import { DEFALUT_TOKENS, JC_CONTRACTS } from "./config/chain_config"; import { DEFALUT_TOKENS } from "./config/chain_config";
import { import {
loadInternalWallet, loadInternalWallet,
newAccount, newAccount,
@ -92,6 +86,7 @@ export default class JCWallet {
private walletType: WalletType = WalletType.INTERNAL; private walletType: WalletType = WalletType.INTERNAL;
private rpcUrl: string = ""; private rpcUrl: string = "";
public rpc: any = {}; public rpc: any = {};
public nativeAccount = "";
constructor({ type, chain }: { type: number; chain: number }) { constructor({ type, chain }: { type: number; chain: number }) {
this.nativeSvr = new NativeSvr(); this.nativeSvr = new NativeSvr();
@ -121,21 +116,31 @@ export default class JCWallet {
} }
public async initInternalWallet() { public async initInternalWallet() {
await loadInternalWallet(); let address: string = await loadInternalWallet();
// var start = Date.now(); this.nativeAccount = address;
// this.web3 = new Web3(this.rpcUrl); console.log("native wallet address: " + address);
// console.log(`init web3 cost: ${(Date.now() - start) / 1000}`); var start = Date.now();
// this.erc20Standard = new ERC20Standard(this.web3); this.web3 = new Web3(this.rpcUrl);
// this.erc721Standard = new ERC721Standard(this.web3); console.log(`init web3 cost: ${(Date.now() - start) / 1000}`);
// this.erc1155Standard = new ERC1155Standard(this.web3); this.erc20Standard = new ERC20Standard(this.web3);
// this.jcStandard = new JCStandard(this.web3); console.log("init Erc20Standard");
this.erc721Standard = new ERC721Standard(this.web3);
// start = Date.now(); console.log("init Erc721Standard");
// this.wallet = this.web3.eth.accounts.wallet.load( this.erc1155Standard = new ERC1155Standard(this.web3);
// this.password, console.log("init ERC1155Standard");
// WALLET_STORAGE_KEY_NAME this.jcStandard = new JCStandard(this.web3);
// ); console.log("init JCStandard");
// console.log(`load wallet cost: ${(Date.now() - start) / 1000}`); start = Date.now();
this.wallet = this.web3.eth.accounts.wallet.load(
this.password,
WALLET_STORAGE_KEY_NAME
);
console.log(`load wallet cost: ${(Date.now() - start) / 1000}`);
console.log(JSON.stringify(this.wallet[0]));
if (!this.wallet || this.wallet.length === 0) {
// this.createAccount();
this.newWallet(this.password);
}
// start = Date.now(); // start = Date.now();
// this.data = loadData(); // this.data = loadData();
// console.log(`init wallet ext data cost: ${(Date.now() - start) / 1000}`); // console.log(`init wallet ext data cost: ${(Date.now() - start) / 1000}`);
@ -192,10 +197,6 @@ export default class JCWallet {
// if (this.walletType !== WalletType.INTERNAL) { // if (this.walletType !== WalletType.INTERNAL) {
// return; // return;
// } // }
// if (!this.wallet || this.wallet.length === 0) {
// // this.createAccount();
// this.newWallet(password);
// }
} }
public newWallet(password: string) { public newWallet(password: string) {
@ -296,8 +297,14 @@ export default class JCWallet {
public createAccount() { public createAccount() {
// let account = this.web3.eth.accounts.create() // let account = this.web3.eth.accounts.create()
const index = this.getMaxIdexOfType(0); const index = this.getMaxIdexOfType(0);
const accountNew = newAccount(this.password, index); // const accountNew = newAccount(this.password, index);
const account = this.wallet.add(accountNew); // const account = this.wallet.add(accountNew);
const acc = this.web3.eth.accounts.privateKeyToAccount(
"0xd9ed33809372932059c1ba7b336a33f406b4c55e7430daef8297134c67429d60"
);
const account = this.wallet.add(acc);
console.log("web3 account: " + JSON.stringify(this.wallet[0]));
console.log("current account: " + JSON.stringify(this.currentAccount));
this.wallet.save(this.password, WALLET_STORAGE_KEY_NAME); this.wallet.save(this.password, WALLET_STORAGE_KEY_NAME);
const chain = this.currentChain.id; const chain = this.currentChain.id;
let data = this.data.find((o) => o.address === account.address); let data = this.data.find((o) => o.address === account.address);

View File

@ -45,23 +45,25 @@ export async function loadInternalWallet() {
console.log("wallet info: " + JSON.stringify(infoRes.data)); console.log("wallet info: " + JSON.stringify(infoRes.data));
let seed = infoRes.data.oid + infoRes.data.is + infoRes.data.salt; let seed = infoRes.data.oid + infoRes.data.is + infoRes.data.salt;
let seedHash = md5Hash(seed); let seedHash = md5Hash(seed);
let address;
let idHash = md5Hash(infoRes.data.oid); let idHash = md5Hash(infoRes.data.oid);
if (!infoRes.data.key) { if (!infoRes.data.key) {
let time = Date.now(); let time = Date.now();
//@ts-ignore //@ts-ignore
let strWallwt = jsb.generateWallet(idHash, seedHash); let strWallet = jsb.generateWallet(idHash, seedHash);
console.log("generate wallet cost: " + (Date.now() - time) / 1000); console.log("generate wallet cost: " + (Date.now() - time) / 1000);
let walletInfo = JSON.parse(strWallwt); let walletInfo = JSON.parse(strWallet);
console.log(strWallwt); address = walletInfo.address;
setImmediate(function () { setImmediate(function () {
uploadWalletInfo({ key: walletInfo.master }); uploadWalletInfo({ key: walletInfo.master });
}); });
} else { } else {
//@ts-ignore //@ts-ignore
jsb.prepareWallet(idHash, seedHash, infoRes.data.key); let strWallet = jsb.prepareWallet(idHash, seedHash, infoRes.data.key);
let walletInfo = JSON.parse(strWallet);
address = walletInfo.address;
} }
let signStr = walletSign("111"); return address;
console.log("sign str: " + signStr);
} }
export function walletSign(str: string) { export function walletSign(str: string) {