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

feat(sui): non-bitgo recovery for hot wallets #463

Closed
wants to merge 10 commits into from
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ playwright/.cache/

# electron-vite-react
.vscode/.debug.env

# Idea IntelliJ
.idea/
3 changes: 3 additions & 0 deletions electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import { join } from 'path';
import * as ecc from 'tiny-secp256k1';
import { Hbar, Thbar } from '@bitgo/sdk-coin-hbar';
import { Algo, Talgo } from '@bitgo/sdk-coin-algo';
import { Sui, Tsui } from '@bitgo-beta/sdk-coin-sui';
import { EthLikeCoin, TethLikeCoin } from '@bitgo/sdk-coin-ethlike';

const bip32 = BIP32Factory(ecc);
Expand Down Expand Up @@ -139,6 +140,8 @@ sdk.register('hbar', Hbar.createInstance);
sdk.register('thbar', Thbar.createInstance);
sdk.register('algo', Algo.createInstance);
sdk.register('talgo', Talgo.createInstance);
sdk.register('sui', Sui.createInstance);
sdk.register('tsui', Tsui.createInstance);
sdk.register('baseeth', EthLikeCoin.createInstance);
sdk.register('tbaseeth', TethLikeCoin.createInstance);

Expand Down
1,326 changes: 550 additions & 776 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
}
},
"dependencies": {
"@bitgo-beta/sdk-coin-sui": "^1.4.1-alpha.168",
"@bitgo/abstract-cosmos": "10.1.1",
"@bitgo/abstract-utxo": "8.12.1",
"@bitgo/sdk-api": "1.52.0",
Expand Down
1 change: 1 addition & 0 deletions scripts/build-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const coins = [
'hbar',
'algo',
'bsc',
'sui'
];

const paths = fs
Expand Down
21 changes: 20 additions & 1 deletion src/components/CryptocurrencyIcon/CryptocurrencyIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export interface CryptocurrencyIconProps {
| 'zeta'
| 'hbar'
| 'algo'
| 'etc';
| 'etc'
| 'sui';
Size: 'small' | 'medium' | 'large';
}

Expand Down Expand Up @@ -1792,6 +1793,24 @@ export function CryptocurrencyIcon({
</g>
</svg>
);
case 'sui':
return (
<svg
width="32"
height="32"
viewBox="0 0 500 500"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<rect width="500" height="500" rx="250" fill="#4DA2FF" />
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M320.749 225.119L320.744 225.132C333.044 240.478 340.395 259.915 340.395 281.056C340.395 302.512 332.824 322.213 320.192 337.663L319.104 338.993L318.816 337.303C318.57 335.865 318.282 334.413 317.947 332.95C311.625 305.312 291.027 281.612 257.125 262.422C234.232 249.5 221.127 233.939 217.687 216.259C215.465 204.827 217.117 193.343 220.309 183.508C223.501 173.675 228.249 165.437 232.282 160.477L232.284 160.474L245.472 144.429C247.785 141.615 252.113 141.615 254.426 144.429L320.749 225.119ZM341.608 209.088L341.611 209.082L253.216 101.54C251.529 99.4867 248.369 99.4867 246.681 101.54L158.286 209.083L158.288 209.089L158.001 209.444C141.734 229.528 132 255.051 132 282.835C132 347.542 184.806 400 249.949 400C315.091 400 367.897 347.542 367.897 282.835C367.897 255.051 358.163 229.528 341.897 209.444L341.608 209.088ZM179.436 224.772L179.44 224.768L187.346 215.148L187.585 216.924C187.774 218.331 188.004 219.745 188.276 221.165C193.392 247.872 211.667 270.14 242.221 287.387C268.779 302.427 284.242 319.721 288.698 338.689C290.557 346.605 290.888 354.393 290.083 361.202L290.033 361.624L289.65 361.81C277.663 367.637 264.188 370.907 249.946 370.907C199.994 370.907 159.497 330.681 159.497 281.056C159.497 259.751 166.962 240.174 179.436 224.772Z"
fill="#F7F7F8"
/>
</svg>
);
default:
return null;
}
Expand Down
2 changes: 2 additions & 0 deletions src/containers/NonBitGoRecoveryCoin/NonBitGoRecoveryCoin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,8 @@ function Form() {
case 'tzeta':
case 'coreum':
case 'tcoreum':
case 'sui':
case 'tsui':
return (
<CosmosForm
key={coin}
Expand Down
14 changes: 14 additions & 0 deletions src/helpers/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,18 @@ export const allCoinMetas: Record<string, CoinMetadata> = {
Icon: 'algo',
value: 'algo',
},
sui: {
Title: 'SUI',
Description: 'Sui',
Icon: 'sui',
value: 'sui',
},
tsui: {
Title: 'TSUI',
Description: 'Testnet Sui',
Icon: 'sui',
value: 'tsui',
},
tbtc: {
Title: 'TBTC',
Description: 'Testnet Bitcoin',
Expand Down Expand Up @@ -713,6 +725,7 @@ export const nonBitgoRecoveryCoins: Record<BitgoEnv, readonly CoinMetadata[]> =
allCoinMetas.coreum,
allCoinMetas.hbar,
allCoinMetas.algo,
allCoinMetas.sui,
] as const,
test: [
allCoinMetas.tbtc,
Expand Down Expand Up @@ -749,6 +762,7 @@ export const nonBitgoRecoveryCoins: Record<BitgoEnv, readonly CoinMetadata[]> =
allCoinMetas.tcoreum,
allCoinMetas.thbar,
allCoinMetas.talgo,
allCoinMetas.tsui
] as const,
};

Expand Down
3 changes: 2 additions & 1 deletion src/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ export function isRecoveryTransaction(
('transaction' in value && !!value['transaction']) ||
('txid' in value && !!value['txid']) ||
('serializedTx' in value && !!value['serializedTx']) ||
('txRequests' in value && !!value['txRequests'])
('txRequests' in value && !!value['txRequests']) ||
('transactions' in value && !!value['transactions'])
);
}

Expand Down