Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: DI openSSLBytes #496

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines +318 to +321
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EVM takes it in the params, COSMOS like takes it as a second param...

);
});

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) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting.

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