From b7cb1f2361edca4d653e2e0f4915e96ec9d84954 Mon Sep 17 00:00:00 2001 From: CoNET Project Date: Sun, 21 Apr 2024 13:51:06 -0700 Subject: [PATCH] added stop mining --- src/API/index.ts | 2 +- src/API/platform.ts | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/API/index.ts b/src/API/index.ts index 20f8ed4..c5610ce 100644 --- a/src/API/index.ts +++ b/src/API/index.ts @@ -12,7 +12,7 @@ type WorkerCommandType = 'READY'|'testPasscode'|'getCONETBalance'|'getRegiestNod 'isAddress'|'getFaucet'|'syncAsset'|'sendAsset'|'getUSDCPrice'|'registerReferrer'|'showSRP'|'getAllProfiles'| 'buyUSDC'|'mintCoNETCash'|'getSINodes'|'getRecipientCoNETCashAddress'|'setRegion'|'ipaddress'|'startLiveness'|'stopLiveness'| 'isLivenessRunning'|'getRefereesList'|'getAllNodes'|'getContainer'|'importWallet'|'updateProfile'|'resetPasscode'|'recoverAccount'|'addProfile'| -'getAssetsPrice'|'CONETFaucet'|'prePurchase'|'guardianPurchase'|'fx168PrePurchase'|'startMining' +'getAssetsPrice'|'CONETFaucet'|'prePurchase'|'guardianPurchase'|'fx168PrePurchase'|'startMining'|'stoptMining' export type WorkerCallStatus = 'SUCCESS' | 'NOT_READY' | 'UNKNOWN_COMMAND' | 'TIME_OUT' | 'SYSTEM_ERROR' diff --git a/src/API/platform.ts b/src/API/platform.ts index cf137cf..e05a096 100644 --- a/src/API/platform.ts +++ b/src/API/platform.ts @@ -429,4 +429,19 @@ export class platform { return resolve (data[0]) }) }) + + public stopMining: () => Promise = () => new Promise(async resolve=> { + const cmd: WorkerCommand = { + cmd: 'stoptMining', + uuid: v4(), + data: [] + } + return postMessage (cmd, false, null, (err: any, data: any) => { + if (err) { + return resolve (err) + } + + return resolve (data[0]) + }) + }) } \ No newline at end of file