From 134f1084eb24b9d753e398b55f21fa2242bd3421 Mon Sep 17 00:00:00 2001 From: Kesha Antonov Date: Fri, 2 Feb 2024 21:10:47 +0300 Subject: [PATCH] removed extra calls to wallets --- send_multigpu.ts | 66 ++++++++++++++++++++++++----------------------- send_universal.ts | 66 ++++++++++++++++++++++++----------------------- 2 files changed, 68 insertions(+), 64 deletions(-) diff --git a/send_multigpu.ts b/send_multigpu.ts index e21b2f5..cd2a7b5 100644 --- a/send_multigpu.ts +++ b/send_multigpu.ts @@ -314,20 +314,6 @@ async function sendMinedBoc( boc: Cell ) { - const wallets: OpenedContract[] = [] - const ton4Client = await getTon4Client() - const tonOrbsClient = await getTon4ClientOrbs() - const w2 = ton4Client.open(wallet) - const w3 = tonOrbsClient.open(wallet) - wallets.push(w2) - wallets.push(w3) - - if (args['--api'] === 'lite') { - const liteServerClient = await getLiteClient(args['-c'] ?? 'https://ton-blockchain.github.io/global.config.json') - const w1 = liteServerClient.open(wallet) - wallets.push(w1) - } - if (args['--api'] === 'tonapi') { const tonapiClient = await getTonapiClient() @@ -371,23 +357,39 @@ async function sendMinedBoc( } } - } else { - for (let i = 0; i < 3; i++) { - for (const w of wallets) { - w.sendTransfer({ - seqno, - secretKey: keyPair.secretKey, - messages: [internal({ - to: giverAddress, - value: toNano('0.05'), - bounce: true, - body: boc, - })], - sendMode: 3 as any, - }).catch(e => { - // - }) - } + + return + } + + const wallets: OpenedContract[] = [] + const ton4Client = await getTon4Client() + const tonOrbsClient = await getTon4ClientOrbs() + const w2 = ton4Client.open(wallet) + const w3 = tonOrbsClient.open(wallet) + wallets.push(w2) + wallets.push(w3) + + if (args['--api'] === 'lite') { + const liteServerClient = await getLiteClient(args['-c'] ?? 'https://ton-blockchain.github.io/global.config.json') + const w1 = liteServerClient.open(wallet) + wallets.push(w1) + } + + for (let i = 0; i < 3; i++) { + for (const w of wallets) { + w.sendTransfer({ + seqno, + secretKey: keyPair.secretKey, + messages: [internal({ + to: giverAddress, + value: toNano('0.05'), + bounce: true, + body: boc, + })], + sendMode: 3 as any, + }).catch(e => { + // + }) } } } @@ -465,4 +467,4 @@ function formatTime() { year: "numeric", second: "numeric" }); -} \ No newline at end of file +} diff --git a/send_universal.ts b/send_universal.ts index a7261fc..8df6fba 100644 --- a/send_universal.ts +++ b/send_universal.ts @@ -272,20 +272,6 @@ async function sendMinedBoc( boc: Cell ) { - const wallets: OpenedContract[] = [] - const ton4Client = await getTon4Client() - const tonOrbsClient = await getTon4ClientOrbs() - const w2 = ton4Client.open(wallet) - const w3 = tonOrbsClient.open(wallet) - wallets.push(w2) - wallets.push(w3) - - if (args['--api'] === 'lite') { - const liteServerClient = await getLiteClient(args['-c'] ?? 'https://ton-blockchain.github.io/global.config.json') - const w1 = liteServerClient.open(wallet) - wallets.push(w1) - } - if (args['--api'] === 'tonapi') { const tonapiClient = await getTonapiClient() @@ -329,23 +315,39 @@ async function sendMinedBoc( } } - } else { - for (let i = 0; i < 3; i++) { - for (const w of wallets) { - w.sendTransfer({ - seqno, - secretKey: keyPair.secretKey, - messages: [internal({ - to: giverAddress, - value: toNano('0.05'), - bounce: true, - body: boc, - })], - sendMode: 3 as any, - }).catch(e => { - // - }) - } + + return + } + + const wallets: OpenedContract[] = [] + const ton4Client = await getTon4Client() + const tonOrbsClient = await getTon4ClientOrbs() + const w2 = ton4Client.open(wallet) + const w3 = tonOrbsClient.open(wallet) + wallets.push(w2) + wallets.push(w3) + + if (args['--api'] === 'lite') { + const liteServerClient = await getLiteClient(args['-c'] ?? 'https://ton-blockchain.github.io/global.config.json') + const w1 = liteServerClient.open(wallet) + wallets.push(w1) + } + + for (let i = 0; i < 3; i++) { + for (const w of wallets) { + w.sendTransfer({ + seqno, + secretKey: keyPair.secretKey, + messages: [internal({ + to: giverAddress, + value: toNano('0.05'), + bounce: true, + body: boc, + })], + sendMode: 3 as any, + }).catch(e => { + // + }) } } } @@ -419,4 +421,4 @@ function formatTime() { year: "numeric", second: "numeric" }); -} \ No newline at end of file +}