Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
meeh0w committed Nov 8, 2024
1 parent 26fa8ff commit 7a5079b
Show file tree
Hide file tree
Showing 4 changed files with 213 additions and 35 deletions.
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@
},
"dependencies": {
"@avalabs/avalanche-module": "0.0.0-feat-p-dynamic-fees-20241107092624",
"@avalabs/avalanchejs": "4.1.0-alpha.15",
"@avalabs/avalanchejs": "4.1.0-alpha.18",
"@avalabs/bitcoin-module": "0.0.0-feat-p-dynamic-fees-20241107092624",
"@avalabs/bridge-unified": "0.0.0-feat-ictt-configs-20241009072139",
"@avalabs/core-bridge-sdk": "3.1.0-canary.78916bb.0+78916bb",
"@avalabs/core-chains-sdk": "3.1.0-canary.78916bb.0+78916bb",
"@avalabs/core-coingecko-sdk": "3.1.0-canary.78916bb.0+78916bb",
"@avalabs/core-covalent-sdk": "3.1.0-canary.78916bb.0+78916bb",
"@avalabs/core-etherscan-sdk": "3.1.0-canary.78916bb.0+78916bb",
"@avalabs/core-bridge-sdk": "3.1.0-canary.c0d7afa.0",
"@avalabs/core-chains-sdk": "3.1.0-canary.c0d7afa.0",
"@avalabs/core-coingecko-sdk": "3.1.0-canary.c0d7afa.0",
"@avalabs/core-covalent-sdk": "3.1.0-canary.c0d7afa.0",
"@avalabs/core-etherscan-sdk": "3.1.0-canary.c0d7afa.0",
"@avalabs/core-k2-components": "4.18.0-alpha.47",
"@avalabs/core-snowtrace-sdk": "3.1.0-canary.78916bb.0+78916bb",
"@avalabs/core-token-prices-sdk": "3.1.0-canary.78916bb.0+78916bb",
"@avalabs/core-utils-sdk": "3.1.0-canary.78916bb.0+78916bb",
"@avalabs/core-wallets-sdk": "3.1.0-canary.78916bb.0+78916bb",
"@avalabs/core-snowtrace-sdk": "3.1.0-canary.c0d7afa.0",
"@avalabs/core-token-prices-sdk": "3.1.0-canary.c0d7afa.0",
"@avalabs/core-utils-sdk": "3.1.0-canary.c0d7afa.0",
"@avalabs/core-wallets-sdk": "3.1.0-canary.c0d7afa.0",
"@avalabs/evm-module": "0.0.0-feat-p-dynamic-fees-20241107092624",
"@avalabs/glacier-sdk": "3.1.0-canary.78916bb.0+78916bb",
"@avalabs/glacier-sdk": "3.1.0-canary.c0d7afa.0",
"@avalabs/hw-app-avalanche": "0.14.1",
"@avalabs/types": "3.1.0-canary.78916bb.0+78916bb",
"@avalabs/types": "3.1.0-canary.c0d7afa.0",
"@avalabs/vm-module-types": "0.0.0-feat-p-dynamic-fees-20241107092624",
"@blockaid/client": "0.10.0",
"@coinbase/cbpay-js": "1.6.0",
Expand Down
4 changes: 4 additions & 0 deletions src/pages/ApproveAction/AvalancheSignTx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
FunctionNames,
useIsFunctionAvailable,
} from '@src/hooks/useIsFunctionAvailable';
import { ApproveConvertSubnet } from './components/ApproveConvertSubnet';

export function AvalancheSignTx() {
const requestId = useGetRequestId();
Expand Down Expand Up @@ -136,6 +137,9 @@ export function AvalancheSignTx() {
return <ImportTxView tx={tx} avaxPrice={tokenPrice}></ImportTxView>;
} else if (Avalanche.isBaseTx(tx)) {
return <BaseTxView tx={tx} avaxPrice={tokenPrice}></BaseTxView>;
} else if (tx.type === Avalanche.TxType.ConvertSubnet) {
// TODO: use the helper
return <ApproveConvertSubnet tx={tx} avaxPrice={tokenPrice} />;
} else if (Avalanche.isCreateSubnetTx(tx)) {
return (
<ApproveCreateSubnet
Expand Down
99 changes: 99 additions & 0 deletions src/pages/ApproveAction/components/ApproveConvertSubnet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { useTranslation } from 'react-i18next';
import { Stack } from '@avalabs/core-k2-components';

import {
ApprovalSection,
ApprovalSectionBody,
ApprovalSectionHeader,
} from '@src/components/common/approval/ApprovalSection';
import { TxDetailsRow } from '@src/components/common/approval/TxDetailsRow';

import { TruncatedIdentifier } from './TruncatedIdentifier';
import { AvaxAmount } from './AvaxAmount';
import { Avalanche } from '@avalabs/core-wallets-sdk';

export function ApproveConvertSubnet({
tx,
avaxPrice,
}: {
tx: Avalanche.ConvertSubnetTx;
avaxPrice: number;
}) {
const { t } = useTranslation();
const { txFee, chainID, managerAddress, subnetID, validators } = tx;

return (
<>
<ApprovalSection sx={{ gap: 1 }}>
<ApprovalSectionHeader label={t('Subnet Details')} />
<ApprovalSectionBody sx={{ justifyContent: 'start', py: 2.25 }}>
<TxDetailsRow label={t('Subnet ID')}>
<TruncatedIdentifier identifier={subnetID} size={14} />
</TxDetailsRow>
<TxDetailsRow label={t('Chain ID')}>
<TruncatedIdentifier identifier={chainID} size={14} />
</TxDetailsRow>
<TxDetailsRow label={t('Manager Address')}>
<TruncatedIdentifier identifier={managerAddress} size={14} />
</TxDetailsRow>
</ApprovalSectionBody>
</ApprovalSection>
<ApprovalSection sx={{ gap: 1 }}>
<ApprovalSectionHeader label={t('Validators')} />
<ApprovalSectionBody sx={{ justifyContent: 'start', py: 2.25 }}>
{validators.map(
({
balance,
stake,
nodeId,
remainingBalanceOwners,
deactivationOwners,
}) => (
<Stack key={nodeId} sx={{ gap: 0.5 }}>
<TxDetailsRow label={t('Node ID')}>
<TruncatedIdentifier identifier={nodeId} size={14} />
</TxDetailsRow>
<TxDetailsRow label={t('Balance')}>
<AvaxAmount amount={balance} avaxPrice={avaxPrice} />
</TxDetailsRow>
<TxDetailsRow label={t('Stake')}>
<AvaxAmount amount={stake} avaxPrice={avaxPrice} />
</TxDetailsRow>
<TxDetailsRow label={t('Owners Able to Deactivate')}>
<Stack sx={{ gap: 0.5 }}>
{deactivationOwners.map((address) => (
<TruncatedIdentifier
key={address}
identifier={address}
size={14}
/>
))}
</Stack>
</TxDetailsRow>
<TxDetailsRow label={t('Owners of the Remaining Balance')}>
<Stack sx={{ gap: 0.5 }}>
{remainingBalanceOwners.map((address) => (
<TruncatedIdentifier
key={address}
identifier={address}
size={14}
/>
))}
</Stack>
</TxDetailsRow>
</Stack>
)
)}
</ApprovalSectionBody>
</ApprovalSection>
<ApprovalSection>
<ApprovalSectionHeader label={t('Network Fee')} />
<ApprovalSectionBody>
<TxDetailsRow label={t('Fee Amount')}>
<AvaxAmount amount={txFee} avaxPrice={avaxPrice} />
</TxDetailsRow>
</ApprovalSectionBody>
</ApprovalSection>
</>
);
}
121 changes: 98 additions & 23 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@
"@scure/base" "1.1.5"
micro-eth-signer "0.7.2"

"@avalabs/[email protected]":
version "4.1.0-alpha.18"
resolved "https://registry.yarnpkg.com/@avalabs/avalanchejs/-/avalanchejs-4.1.0-alpha.18.tgz#5bdefefebf456bdd9cfce1f1c1abe26f9277fbb7"
integrity sha512-erDvZwsst+hCegRF9qyVF03wM35EKplIz01W6FOMLq2jSE2tAy66QpVtB2Y5r9OphKU62Yx/7xtT0eqMDSosUA==
dependencies:
"@noble/curves" "1.3.0"
"@noble/hashes" "1.3.3"
"@noble/secp256k1" "2.0.0"
"@scure/base" "1.1.5"
micro-eth-signer "0.7.2"

"@avalabs/[email protected]":
version "0.0.0-feat-p-dynamic-fees-20241107092624"
resolved "https://registry.yarnpkg.com/@avalabs/bitcoin-module/-/bitcoin-module-0.0.0-feat-p-dynamic-fees-20241107092624.tgz#254a009eb34680606ac7fb084ac40713be7270d7"
Expand Down Expand Up @@ -86,14 +97,14 @@
viem "2.11.1"
zod "3.23.8"

"@avalabs/[email protected].78916bb.0+78916bb":
version "3.1.0-canary.78916bb.0"
resolved "https://registry.yarnpkg.com/@avalabs/core-bridge-sdk/-/core-bridge-sdk-3.1.0-canary.78916bb.0.tgz#7283ab66e0eeb3ca0fe92f62c08708809de65df0"
integrity sha512-5mr02Gt3vrEwLNQirqNDAQE55n6KOf3QVApt4F9GGpIYCN1YwLri8SBhKKyP/m34rMjha79a5mPno5LtqPdnmA==
"@avalabs/[email protected].c0d7afa.0":
version "3.1.0-canary.c0d7afa.0"
resolved "https://registry.yarnpkg.com/@avalabs/core-bridge-sdk/-/core-bridge-sdk-3.1.0-canary.c0d7afa.0.tgz#68a3c2626455cf923978b8be4172954b69ed5569"
integrity sha512-r2nLGbKmBMivHhN/U9EM4t8Rfccg9J3Un/IKCtr6Pb993YjhwZ136K+EFVIL3VoaJ02sDxZO6g3rmwpW0kBTQA==
dependencies:
"@avalabs/core-coingecko-sdk" "3.1.0-canary.78916bb.0+78916bb"
"@avalabs/core-utils-sdk" "3.1.0-canary.78916bb.0+78916bb"
"@avalabs/core-wallets-sdk" "3.1.0-canary.78916bb.0+78916bb"
"@avalabs/core-coingecko-sdk" "3.1.0-canary.c0d7afa.0+c0d7afa"
"@avalabs/core-utils-sdk" "3.1.0-canary.c0d7afa.0+c0d7afa"
"@avalabs/core-wallets-sdk" "3.1.0-canary.c0d7afa.0+c0d7afa"

"@avalabs/[email protected]+78916bb":
version "3.1.0-canary.78916bb.0"
Expand All @@ -102,19 +113,33 @@
dependencies:
"@avalabs/core-utils-sdk" "3.1.0-canary.78916bb.0+78916bb"

"@avalabs/[email protected]", "@avalabs/[email protected]+c0d7afa":
version "3.1.0-canary.c0d7afa.0"
resolved "https://registry.yarnpkg.com/@avalabs/core-chains-sdk/-/core-chains-sdk-3.1.0-canary.c0d7afa.0.tgz#0bb5064fb726b67f063e4ac47027f184b8906190"
integrity sha512-tVVrlISOG8wSIUc36E3kpDMrDoQpZoyg79tQXyPg+VdeCE+c2EC71yxA7a9pAOcsm1ZeYugw/4Iclv0fPKVZVg==
dependencies:
"@avalabs/core-utils-sdk" "3.1.0-canary.c0d7afa.0+c0d7afa"

"@avalabs/[email protected]+78916bb":
version "3.1.0-canary.78916bb.0"
resolved "https://registry.yarnpkg.com/@avalabs/core-coingecko-sdk/-/core-coingecko-sdk-3.1.0-canary.78916bb.0.tgz#ba2f5813a4da8a81ed3b365dbb41244042276ce0"
integrity sha512-qT+4HAga6sP9cytYkt0z/m4s7gZTlaE9MBmMef/RzQ0Az1eu4ovjDErg4zfDg/Rwtn7PefhXIXYr4/3p++jK/A==
dependencies:
"@avalabs/core-utils-sdk" "3.1.0-canary.78916bb.0+78916bb"

"@avalabs/core-covalent[email protected].78916bb.0+78916bb":
version "3.1.0-canary.78916bb.0"
resolved "https://registry.yarnpkg.com/@avalabs/core-covalent-sdk/-/core-covalent-sdk-3.1.0-canary.78916bb.0.tgz#ffcc021a83ef03987cdd88195cb15fab37383b18"
integrity sha512-Z0D0F6TGDSdRnm+KmFX4vK8OyLKSUi5ZJXTIYyHuubT9m/g16k0MzLPw/0PSh71ijb15vO7YUM9DAHclV4ZFIw==
"@avalabs/core-coingecko[email protected].c0d7afa.0", "@avalabs/[email protected]+c0d7afa":
version "3.1.0-canary.c0d7afa.0"
resolved "https://registry.yarnpkg.com/@avalabs/core-coingecko-sdk/-/core-coingecko-sdk-3.1.0-canary.c0d7afa.0.tgz#68a323f8b2ed4ce9f49ae346801098a63fb8a020"
integrity sha512-ipVME6K6EJVVfbtlV3pffs1XLnfBhBH7NAK21SpijulE2ca8QST5tp0UoxNjor6rZbZ9JSMmcLyU/6NxceEaYA==
dependencies:
"@avalabs/core-utils-sdk" "3.1.0-canary.78916bb.0+78916bb"
"@avalabs/core-utils-sdk" "3.1.0-canary.c0d7afa.0+c0d7afa"

"@avalabs/[email protected]":
version "3.1.0-canary.c0d7afa.0"
resolved "https://registry.yarnpkg.com/@avalabs/core-covalent-sdk/-/core-covalent-sdk-3.1.0-canary.c0d7afa.0.tgz#1658f431e53271d572f37697424a944441565224"
integrity sha512-JwxTpgnQzJX6n7WQt3rYduSPkAoG7Lx3VbJL6ifvZZ4ALQK09dpfBS5k2sHW0bN5JciPSIMPKcqW8v94Gauzkg==
dependencies:
"@avalabs/core-utils-sdk" "3.1.0-canary.c0d7afa.0+c0d7afa"

"@avalabs/[email protected]+78916bb":
version "3.1.0-canary.78916bb.0"
Expand All @@ -123,6 +148,13 @@
dependencies:
"@avalabs/core-utils-sdk" "3.1.0-canary.78916bb.0+78916bb"

"@avalabs/[email protected]":
version "3.1.0-canary.c0d7afa.0"
resolved "https://registry.yarnpkg.com/@avalabs/core-etherscan-sdk/-/core-etherscan-sdk-3.1.0-canary.c0d7afa.0.tgz#2ffa45f3bbc61cb9275b31ade3cf4a48a306020e"
integrity sha512-G/Owyp/k3pIvmuIMJu2jQhLGshbgSzRG1uhgwy6rY5D4OTqcVHr3LqHPSEDUD7HCyF1edsAndKpRoTgkln4i7A==
dependencies:
"@avalabs/core-utils-sdk" "3.1.0-canary.c0d7afa.0+c0d7afa"

"@avalabs/[email protected]":
version "4.18.0-alpha.47"
resolved "https://registry.yarnpkg.com/@avalabs/core-k2-components/-/core-k2-components-4.18.0-alpha.47.tgz#94d588cf109350fe57d246dbf36bc127a1fc0584"
Expand All @@ -146,20 +178,20 @@
react-hotkeys-hook "4.4.3"
uuid "9.0.1"

"@avalabs/[email protected].78916bb.0+78916bb":
version "3.1.0-canary.78916bb.0"
resolved "https://registry.yarnpkg.com/@avalabs/core-snowtrace-sdk/-/core-snowtrace-sdk-3.1.0-canary.78916bb.0.tgz#898acc85dc34c24377658cf05efca27bf67b211e"
integrity sha512-XyFsov84bf70bdP6QLtXqikRmWA6hzI7RTf8tUAN6excaIFCqXZrPZyYNs6DKFVjyzJe8W71xSPFzauh16Uu8A==
"@avalabs/[email protected].c0d7afa.0":
version "3.1.0-canary.c0d7afa.0"
resolved "https://registry.yarnpkg.com/@avalabs/core-snowtrace-sdk/-/core-snowtrace-sdk-3.1.0-canary.c0d7afa.0.tgz#9502850b8c342170419a2241c98090befda537bc"
integrity sha512-4jCKNvn1vfUE8plWOrpYGZfn8oSif7fxO+mlCo6rtkekH85pl44HxZA9SxfXARjKMuDCyk+xHqNP9qusgNoG/A==
dependencies:
"@avalabs/core-utils-sdk" "3.1.0-canary.78916bb.0+78916bb"
"@avalabs/core-utils-sdk" "3.1.0-canary.c0d7afa.0+c0d7afa"

"@avalabs/[email protected].78916bb.0+78916bb":
version "3.1.0-canary.78916bb.0"
resolved "https://registry.yarnpkg.com/@avalabs/core-token-prices-sdk/-/core-token-prices-sdk-3.1.0-canary.78916bb.0.tgz#a7fb97893c97c2867118ef6e5f944adde2cdbc44"
integrity sha512-e4BH3kpXOX72iL/934UxhC7CjtGkET4pS2lN0OsvcL2oYLWwe/HvfTEVaVfsPZUpd9q1d9n1lBEjy8r2XRf3QA==
"@avalabs/[email protected].c0d7afa.0":
version "3.1.0-canary.c0d7afa.0"
resolved "https://registry.yarnpkg.com/@avalabs/core-token-prices-sdk/-/core-token-prices-sdk-3.1.0-canary.c0d7afa.0.tgz#4e4a0dd1b26132d826ae09c2ea845384fa72f3c1"
integrity sha512-LHlLNUBg5E1jYCSPiJzuGbLhaDK9DxPu1GUmQQjgprBz3FNjsWD3PmBtGIaU2QuvQl7Z5ozbFX5qWtlWQMyIww==
dependencies:
"@avalabs/core-coingecko-sdk" "3.1.0-canary.78916bb.0+78916bb"
"@avalabs/core-utils-sdk" "3.1.0-canary.78916bb.0+78916bb"
"@avalabs/core-coingecko-sdk" "3.1.0-canary.c0d7afa.0+c0d7afa"
"@avalabs/core-utils-sdk" "3.1.0-canary.c0d7afa.0+c0d7afa"

"@avalabs/[email protected]+78916bb":
version "3.1.0-canary.78916bb.0"
Expand All @@ -170,6 +202,15 @@
"@hpke/core" "1.2.5"
is-ipfs "6.0.2"

"@avalabs/[email protected]", "@avalabs/[email protected]+c0d7afa":
version "3.1.0-canary.c0d7afa.0"
resolved "https://registry.yarnpkg.com/@avalabs/core-utils-sdk/-/core-utils-sdk-3.1.0-canary.c0d7afa.0.tgz#ee47a20814f58cf1d8d5ffa269ae7c480abe0bce"
integrity sha512-Y6BaNrc07ZigsocDJA+4eSCpjKr0/y1YibTMPtBufKDeHBHjMgaVwGFfIE53Oj1fBtTsTiLbsT5+RfMlYDLwUQ==
dependencies:
"@avalabs/avalanchejs" "4.1.0-alpha.18"
"@hpke/core" "1.2.5"
is-ipfs "6.0.2"

"@avalabs/[email protected]+78916bb":
version "3.1.0-canary.78916bb.0"
resolved "https://registry.yarnpkg.com/@avalabs/core-wallets-sdk/-/core-wallets-sdk-3.1.0-canary.78916bb.0.tgz#ab1e5510171bc49368fba3cae1382266ad8158af"
Expand All @@ -194,6 +235,30 @@
ledger-bitcoin "0.2.3"
xss "1.0.14"

"@avalabs/[email protected]", "@avalabs/[email protected]+c0d7afa":
version "3.1.0-canary.c0d7afa.0"
resolved "https://registry.yarnpkg.com/@avalabs/core-wallets-sdk/-/core-wallets-sdk-3.1.0-canary.c0d7afa.0.tgz#0cb99aa446b02f561d924a72dc0114ef102e7c6f"
integrity sha512-fOxkHdkb98KHEN6vs1zEE8yR97Oqv9beQEtiOo1qsGFwZHAXdAZ5mC/M33X5C7NSdHkJKKy/rbDtNV9hzQiKsQ==
dependencies:
"@avalabs/avalanchejs" "4.1.0-alpha.18"
"@avalabs/core-chains-sdk" "3.1.0-canary.c0d7afa.0+c0d7afa"
"@avalabs/glacier-sdk" "3.1.0-canary.c0d7afa.0+c0d7afa"
"@avalabs/hw-app-avalanche" "0.14.1"
"@ledgerhq/hw-app-btc" "10.2.4"
"@ledgerhq/hw-app-eth" "6.36.1"
"@ledgerhq/hw-transport" "6.30.6"
"@metamask/eth-sig-util" "7.0.2"
"@openzeppelin/contracts" "4.9.6"
bip32 "2.0.6"
bip32-path "0.4.2"
bip39 "3.0.4"
bitcoinjs-lib "5.2.0"
coinselect "3.1.13"
create-hash "1.2.0"
hdkey "2.0.1"
ledger-bitcoin "0.2.3"
xss "1.0.14"

"@avalabs/[email protected]":
version "0.0.0-feat-p-dynamic-fees-20241107092624"
resolved "https://registry.yarnpkg.com/@avalabs/evm-module/-/evm-module-0.0.0-feat-p-dynamic-fees-20241107092624.tgz#23087cb4d86a600bd354baa89a78011d01f773c3"
Expand All @@ -219,6 +284,11 @@
resolved "https://registry.yarnpkg.com/@avalabs/glacier-sdk/-/glacier-sdk-3.1.0-canary.78916bb.0.tgz#17969b409fddbeecb842dd5f130a09b13f1f2c8d"
integrity sha512-wNuQFi73aIQm54PP3i1YnoKzmVn8aLWS/bOaz0qV0gUcnvrQq02KkBbC7nlm1f+1p1LbdhyOZ613jU6Y6nXO1A==

"@avalabs/[email protected]", "@avalabs/[email protected]+c0d7afa":
version "3.1.0-canary.c0d7afa.0"
resolved "https://registry.yarnpkg.com/@avalabs/glacier-sdk/-/glacier-sdk-3.1.0-canary.c0d7afa.0.tgz#588dfafc1c4ee4a016f0badbb151fd66c782a04b"
integrity sha512-IOZ62iCfWt8svEpQCSbhaOEoHQnuIBz7loIVEp6Oi4yxKx6MBLRNm62jjCoXEodP6dETNU+gJJr/4LcvVuwpSg==

"@avalabs/[email protected]":
version "0.14.1"
resolved "https://registry.yarnpkg.com/@avalabs/hw-app-avalanche/-/hw-app-avalanche-0.14.1.tgz#70b6248e67cf7d64d0640517f88c19632524ac68"
Expand All @@ -235,6 +305,11 @@
resolved "https://registry.yarnpkg.com/@avalabs/types/-/types-3.1.0-canary.78916bb.0.tgz#3b0d7864fbdbafe7153ea744b95044b9393846f9"
integrity sha512-Jjvn47sa0ZjRS/JC6jE9SYTvW4vU2yxAoSai29M/7UB8wij5+g1FpiX6KUci//e0GrQxukqMWMMXZ/5E24h/UQ==

"@avalabs/[email protected]":
version "3.1.0-canary.c0d7afa.0"
resolved "https://registry.yarnpkg.com/@avalabs/types/-/types-3.1.0-canary.c0d7afa.0.tgz#be66029a154bbea532a51b533316b9489cf73a5c"
integrity sha512-1MprYg1h/36Kyo4mWkue+Ij1rCGsNTnfaaiv+6cwx5YEJLOhRUdBFp6N8ef4uZge45192lPypTusIJuHy7t/kQ==

"@avalabs/[email protected]":
version "0.0.0-feat-p-dynamic-fees-20241107092624"
resolved "https://registry.yarnpkg.com/@avalabs/vm-module-types/-/vm-module-types-0.0.0-feat-p-dynamic-fees-20241107092624.tgz#3bd50e2bb642814c27b011b6534aa6cc61a4a04c"
Expand Down

0 comments on commit 7a5079b

Please sign in to comment.