File tree Expand file tree Collapse file tree 3 files changed +20
-16
lines changed
Expand file tree Collapse file tree 3 files changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,10 @@ const GasToEth = 0.00000001
2929const mintCoNETCashEndpoint = `${ CoNET_SI_Network_Domain } /api/mint_conetcash`
3030const openSourceEndpoint = 'https://s3.us-east-1.wasabisys.com/conet-mvp/router/'
3131const databaseName = 'CoNET'
32+ const monitoredWalletsDatabase = 'monitoredWallets'
3233let activeNodes = null
3334let Liveness :XMLHttpRequest | null = null
35+
3436/**
3537 * CONET Platform
3638 *
Original file line number Diff line number Diff line change @@ -32,25 +32,26 @@ const checkStorage = async (plarformChannel: BroadcastChannel) => {
3232 nonce : 0
3333 }
3434
35- try {
35+ try {
3636 doc = await database . get ( 'init' , { latest : true } )
3737 initData = JSON . parse ( buffer . Buffer . from ( doc . title , 'base64' ) . toString ( ) )
3838 passObj = initData . id
3939 preferences = initData . preferences
4040
4141 } catch ( ex ) {
42- logger ( `checkStorage have no CoNET data in IndexDB, INIT CoNET data` )
42+ logger ( `checkStorage have no CoNET data in IndexDB, INIT CoNET data` )
4343 plarformChannel . postMessage ( 'NONE' )
4444 return returnInitNull ( cmd )
4545 }
46-
47- // if (initData.container) {
48- // containerKeyObj = {
49- // privateKeyArmor: initData.container.privateKeyArmor,
50- // publicKeyArmor: initData.container.publicKeyArmor
51- // }
52- // }
5346
47+ try {
48+ const monitoredWalletsString = await database . get ( monitoredWalletsDatabase )
49+ const monitoredWallets = JSON . parse ( monitoredWalletsString ?. title )
50+ CoNET_Data . monitoredWallets = monitoredWallets
51+ } catch ( error ) {
52+
53+ }
54+
5455 const data : systemInitialization = {
5556 preferences : preferences ,
5657 passcode : {
@@ -61,11 +62,6 @@ const checkStorage = async (plarformChannel: BroadcastChannel) => {
6162 cmd . data = [ data ]
6263 plarformChannel . postMessage ( 'LOCKED' )
6364 returnCommand ( cmd )
64-
65- // already init database
66- // fetchProxyData(`http://localhost:3001/connecting`, data => {
67- // processCmd (data)
68- // })
6965}
7066
7167
Original file line number Diff line number Diff line change @@ -3002,7 +3002,7 @@ const getReferrer = async (wallet, CNTP_Referrals) => {
30023002 return result
30033003}
30043004
3005- const addMonitoredWallet = ( cmd ) => {
3005+ const addMonitoredWallet = async ( cmd ) => {
30063006 const walletAddress = cmd . data [ 0 ]
30073007
30083008 if (
@@ -3026,10 +3026,12 @@ const addMonitoredWallet = (cmd) => {
30263026 CoNET_Data ?. monitoredWallets . push ( monitoredWallet )
30273027 }
30283028
3029+ await storageHashData ( monitoredWalletsDatabase , JSON . stringify ( CoNET_Data . monitoredWallets ) )
3030+
30293031 return returnUUIDChannel ( cmd )
30303032}
30313033
3032- const removeMonitoredWallet = ( cmd ) => {
3034+ const removeMonitoredWallet = async ( cmd ) => {
30333035 const walletAddress = cmd . data [ 0 ]
30343036
30353037 if (
@@ -3047,6 +3049,10 @@ const removeMonitoredWallet = (cmd) => {
30473049 if ( CoNET_Data . monitoredWallets . find ( w => w . address === walletAddress ) ) {
30483050 CoNET_Data . monitoredWallets = CoNET_Data ?. monitoredWallets . filter ( w => w . address !== walletAddress )
30493051 }
3052+
3053+ await storageHashData ( monitoredWalletsDatabase , JSON . stringify ( CoNET_Data . monitoredWallets ) )
3054+
3055+ return returnUUIDChannel ( cmd ) ;
30503056}
30513057
30523058const getBalanceOfMonitoredWallets = async ( ) => {
You can’t perform that action at this time.
0 commit comments