Skip to content

Commit

Permalink
Merge pull request #496 from BitGo/WP-2604/gg18-recovery
Browse files Browse the repository at this point in the history
fix: DI openSSLBytes
  • Loading branch information
zahin-mohammad authored Sep 5, 2024
2 parents c085651 + 9137e62 commit 7d0505a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 17 deletions.
42 changes: 25 additions & 17 deletions electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ import { Dash } from '@bitgo/sdk-coin-dash';
import { Doge, Tdoge } from '@bitgo/sdk-coin-doge';
import { Dot, Tdot } from '@bitgo/sdk-coin-dot';
import { Eos, Teos } from '@bitgo/sdk-coin-eos';
import { AbstractEthLikeNewCoins, Erc20Token, Eth, Hteth } from '@bitgo/sdk-coin-eth';
import {
AbstractEthLikeNewCoins,
Erc20Token,
Eth,
Hteth,
} from '@bitgo/sdk-coin-eth';
import { Ethw } from '@bitgo/sdk-coin-ethw';
import { Etc, Tetc } from '@bitgo/sdk-coin-etc';
import { Ltc } from '@bitgo/sdk-coin-ltc';
Expand All @@ -56,6 +61,7 @@ import { Hbar, Thbar } from '@bitgo/sdk-coin-hbar';
import { Algo, Talgo } from '@bitgo/sdk-coin-algo';
import { EthLikeCoin, TethLikeCoin } from '@bitgo/sdk-coin-ethlike';
import { Sui, Tsui } from '@bitgo/sdk-coin-sui';
import { loadWebAssembly } from '@bitgo/sdk-opensslbytes';

const bip32 = BIP32Factory(ecc);

Expand Down Expand Up @@ -303,10 +309,17 @@ async function createWindow() {
const baseCoin = sdk.coin(coin) as AbstractEthLikeNewCoins;
if (parameters.ethCommonParams) {
parameters.common = EthereumCommon.custom({
...parameters.ethCommonParams
...parameters.ethCommonParams,
});
}
return await baseCoin.recover(parameters);
const openSSLBytes = loadWebAssembly().buffer;
return await baseCoin.recover(
{
...parameters,
openSSLBytes,
},
openSSLBytes
);
});

ipcMain.handle('broadcastTransaction', async (event, coin, parameters) => {
Expand Down Expand Up @@ -455,22 +468,17 @@ async function createWindow() {
return response;
});

ipcMain.handle(
'sweepV1',
async (event, coin, parameters) => {
switch (coin) {
case 'btc':
case 'tbtc': {
const coinInstance = sdk.coin(coin) as AbstractUtxoCoin;
return await coinInstance.sweepV1(parameters);
}
default:
return new Error(
`Coin: ${coin} does not support v1 wallets sweep`
);
ipcMain.handle('sweepV1', async (event, coin, parameters) => {
switch (coin) {
case 'btc':
case 'tbtc': {
const coinInstance = sdk.coin(coin) as AbstractUtxoCoin;
return await coinInstance.sweepV1(parameters);
}
default:
return new Error(`Coin: ${coin} does not support v1 wallets sweep`);
}
);
});
}

void app.whenReady().then(createWindow);
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"dependencies": {
"@bitgo/abstract-cosmos": "11.0.3",
"@bitgo/abstract-utxo": "8.14.0",
"@bitgo/sdk-opensslbytes": "^2.0.0",
"@bitgo/sdk-api": "1.53.3",
"@bitgo/sdk-coin-ada": "4.2.12",
"@bitgo/sdk-coin-algo": "2.1.32",
Expand Down

0 comments on commit 7d0505a

Please sign in to comment.