Skip to content

Commit

Permalink
feat: Adding non-bitgo recovery support for bera
Browse files Browse the repository at this point in the history
Tikcet: COIN-4386
  • Loading branch information
mohitkh7 committed Jan 22, 2025
1 parent 480c0a2 commit da9ad24
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 64 deletions.
8 changes: 8 additions & 0 deletions electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ 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';
import { Bera, Tbera } from '@bitgo/sdk-coin-bera';

const bip32 = BIP32Factory(ecc);

Expand Down Expand Up @@ -156,6 +157,8 @@ sdk.register('sui', Sui.createInstance);
sdk.register('tsui', Tsui.createInstance);
sdk.register('thorchain:rune', Rune.createInstance);
sdk.register('tthorchain:rune', Trune.createInstance);
sdk.register('bera', Bera.createInstance);
sdk.register('tbera', Tbera.createInstance);

Erc20Token.createTokenConstructors().forEach(({ name, coinConstructor }) => {
sdk.register(name, coinConstructor);
Expand Down Expand Up @@ -304,6 +307,11 @@ async function createWindow() {
case 'bsc':
case 'tbsc':
sdk = new BitGoAPI({ env: environment, bscscanApiToken: apiKey });
break;
case 'bera':
case 'tbera':
sdk = new BitGoAPI({ env: environment })

Check notice

Code scanning / CodeQL

Semicolon insertion Note

Avoid automated semicolon insertion (93% of all statements in
the enclosing function
have an explicit semicolon).
break;
default:
sdk = new BitGoAPI({ env: environment });
}
Expand Down
99 changes: 40 additions & 59 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 @@ -19,6 +19,7 @@
"@bitgo/sdk-coin-avaxc": "5.2.8",
"@bitgo/sdk-coin-bch": "2.1.8",
"@bitgo/sdk-coin-bcha": "2.2.8",
"@bitgo/sdk-coin-bera": "^2.3.4",
"@bitgo/sdk-coin-bld": "3.0.27",
"@bitgo/sdk-coin-bsc": "22.2.11",
"@bitgo/sdk-coin-bsv": "2.1.8",
Expand Down
3 changes: 2 additions & 1 deletion scripts/build-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ const coins = [
'algo',
'bsc',
'sui',
'thorchain:rune'
'thorchain:rune',
'bera'
];

const paths = fs
Expand Down
8 changes: 4 additions & 4 deletions src/components/CryptocurrencyIcon/CryptocurrencyIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ export interface CryptocurrencyIconProps {
}

export function CryptocurrencyIcon({
Name,
Size,
...hostProps
}: CryptocurrencyIconProps & JSX.IntrinsicElements['svg']) {
Name,
Size,
...hostProps
}: CryptocurrencyIconProps & JSX.IntrinsicElements['svg']) {
switch (Name) {
case 'ada':
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ function Form() {
case 'tpolygon':
case 'bsc':
case 'tbsc':
case 'bera':
return (
<EthereumForm
key={coin}
Expand Down
16 changes: 16 additions & 0 deletions src/helpers/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@ export const allCoinMetas: Record<string, CoinMetadata> = {
Icon: 'thorchain:rune',
value: 'thorchain:rune'
},
bera: {
Title: 'BERA',
Description: 'Bera',
Icon: 'bera',
value: 'bera'
},
suiToken: {
Title: 'SUI Token',
Description: 'Sui Token',
Expand Down Expand Up @@ -622,6 +628,12 @@ export const allCoinMetas: Record<string, CoinMetadata> = {
Icon: 'baseeth',
value: 'tbaseeth',
},
tbera: {
Title: 'TBERA',
Description: 'Bera Testnet',
Icon: 'bera',
value: 'tbera',
}
} as const;

export const buildUnsignedConsolidationCoins: Record<
Expand Down Expand Up @@ -689,6 +701,7 @@ export const buildUnsignedSweepCoins: Record<
allCoinMetas.algo,
allCoinMetas.sui,
allCoinMetas.suiToken,
allCoinMetas.bera
] as const,
test: [
allCoinMetas.tbtc,
Expand Down Expand Up @@ -719,6 +732,7 @@ export const buildUnsignedSweepCoins: Record<
allCoinMetas.tbsc,
allCoinMetas.tsui,
allCoinMetas.tsuiToken,
allCoinMetas.tbera
] as const,
};

Expand Down Expand Up @@ -770,6 +784,7 @@ export const nonBitgoRecoveryCoins: Record<BitgoEnv, readonly CoinMetadata[]> =
allCoinMetas.sui,
allCoinMetas.suiToken,
allCoinMetas['thorchain:rune'],
allCoinMetas.bera,
] as const,
test: [
allCoinMetas.tbtc,
Expand Down Expand Up @@ -811,6 +826,7 @@ export const nonBitgoRecoveryCoins: Record<BitgoEnv, readonly CoinMetadata[]> =
allCoinMetas.tsui,
allCoinMetas.tsuiToken,
allCoinMetas['tthorchain:rune'],
allCoinMetas.tbera
] as const,
};

Expand Down

0 comments on commit da9ad24

Please sign in to comment.