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(kda): added support for kadena #32

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
49ae777
feat(kda): added support for kadena
lawRathod Jun 25, 2024
94c38c3
feat(kda): remove console.log
rllola Jul 1, 2024
65bac1d
feat(kda): fix wrong derivation path
rllola Jul 1, 2024
41f59dd
feat(kda): remove link; add test send max;
rllola Jul 1, 2024
0ffd692
feat(KDA): fix the import; no more hw-transpot dep;
rllola Jul 1, 2024
445b6a1
refac(kda): use updated `hw-app-kda`
lawRathod Jul 8, 2024
a2baf56
chore: changeset
lawRathod Jul 8, 2024
044c0e2
tests(kda): fix bot tests
lawRathod Jul 8, 2024
96336c1
tests(kda): enable send max bot test
lawRathod Jul 8, 2024
d264e55
feat(kda): LLM integration
rllola Jul 10, 2024
f076dcf
added mobile field for chainID
rllola Jul 16, 2024
ca6a6c0
feat(kda): run prettier
ayelenmurano Aug 27, 2024
aa009c8
feat(kda): get api endpoint from config
ayelenmurano Aug 27, 2024
338af5a
refactor(kda): change to ledger-kadena-js from Zondax, add unit tests…
ayelenmurano Sep 23, 2024
23fe7b3
refactor(kda): adjust file names
ayelenmurano Sep 23, 2024
4e5e431
feat: upgrade kadena, add sender and receiver chain id inputs in mobile
ayelenmurano Oct 11, 2024
59d0d04
feat(kda): integration test
ayelenmurano Nov 1, 2024
8b09db6
feat(kda): add warning and info in cross chain transfers
ayelenmurano Nov 1, 2024
1bc653c
feat(kda): improve warning in cross chain transfers
ayelenmurano Nov 1, 2024
49db3b1
refac(kda): change kadena endpoint
ayelenmurano Nov 20, 2024
87e6a4b
feat(kda): add crosschain warning in mobile and adjust it in desktop
ayelenmurano Nov 26, 2024
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
13 changes: 13 additions & 0 deletions .changeset/gentle-news-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@ledgerhq/types-cryptoassets": minor
"@ledgerhq/cryptoassets": minor
"@ledgerhq/coin-kadena": minor
"@ledgerhq/crypto-icons-ui": minor
"ledger-live-desktop": minor
"@ledgerhq/live-common": minor
"@ledgerhq/coin-framework": minor
"@ledgerhq/live-cli": minor
"@ledgerhq/live-env": minor
---

add kadena blockchain to ledger live
1 change: 1 addition & 0 deletions apps/cli/src/live-common-setup-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ setSupportedCurrencies([
"scroll",
"scroll_sepolia",
"etherlink",
"kadena",
]);

for (const k in process.env) setEnvUnsafe(k as EnvName, process.env[k]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,5 @@ setSupportedCurrencies([
"scroll_sepolia",
"ton",
"etherlink",
"kadena",
]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from "react";
import AccountSubHeader from "../../components/AccountSubHeader/index";

export default function FilecoinAccountSubHeader() {
return <AccountSubHeader family="Kadena" team="Zondax"></AccountSubHeader>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { getAccountBridge } from "@ledgerhq/live-common/bridge/index";
import { Transaction, TransactionStatus } from "@ledgerhq/live-common/families/kadena/types";
import { Account } from "@ledgerhq/types-live";
import React, { useCallback } from "react";
import { Trans } from "react-i18next";
import Box from "~/renderer/components/Box";
import Input from "~/renderer/components/Input";
import Label from "~/renderer/components/Label";
import TranslatedError from "~/renderer/components/TranslatedError";
import WarnBox from "~/renderer/components/WarnBox";

type Props = {
onChange: (t: Transaction) => void;
account: Account;
transaction: Transaction;
status: TransactionStatus;
};

const Root = ({ onChange, account, transaction, status }: Props) => {
const bridge = getAccountBridge(account);

const onSenderChainIdValueChange = useCallback(
(senderChainIdValue: String) => {
onChange(
bridge.updateTransaction(transaction, { senderChainId: Number(senderChainIdValue) }),
);
},
[onChange, transaction, bridge],
);

const onReceiverChainIdValueChange = useCallback(
(receiverChainIdValue: String) => {
onChange(
bridge.updateTransaction(transaction, { receiverChainId: Number(receiverChainIdValue) }),
);
},
[onChange, transaction, bridge],
);

const chainIdsWarning = status.warnings.chainIds;

return (
<Box flow={1}>
<Box mb={10} horizontal grow alignItems="center" justifyContent="space-between">
<Box ml={0} grow={1}>
<Label>
<span>
<Trans i18nKey="send.steps.details.senderChainId" />
</span>
</Label>
<Input
type="number"
min={0}
max={99}
defaultValue={0}
onChange={onSenderChainIdValueChange}
/>
</Box>
<Box ml={0} grow={1} />
<Box ml={0} grow={1}>
<Label>
<span>
<Trans i18nKey="send.steps.details.receiverChainId" />
</span>
</Label>
<Input
type="number"
min={0}
max={99}
defaultValue={0}
onChange={onReceiverChainIdValueChange}
/>
</Box>
</Box>
{chainIdsWarning ? (
<WarnBox>
<TranslatedError error={chainIdsWarning} />
</WarnBox>
) : null}
</Box>
);
};

export default {
component: Root,
fields: ["senderChainId", "receiverChainId", "transaction"],
};
18 changes: 18 additions & 0 deletions apps/ledger-live-desktop/src/renderer/families/kadena/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {
KadenaOperation,
Transaction,
TransactionStatus,
} from "@ledgerhq/live-common/families/kadena/types";
import { Account } from "@ledgerhq/types-live";
import { LLDCoinFamily } from "../types";
import AccountSubHeader from "./AccountSubHeader";
import operationDetails from "./operationDetails";
import sendRecipientFields from "./SendRecipientFields";

const family: LLDCoinFamily<Account, Transaction, TransactionStatus, KadenaOperation> = {
AccountSubHeader,
sendRecipientFields,
operationDetails,
};

export default family;
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { KADENA_CROSS_CHAIN_TRANSFER_FINISHER_URL } from "@ledgerhq/live-common/families/kadena/constants";
import { KadenaOperation } from "@ledgerhq/live-common/families/kadena/types";
import { Account } from "@ledgerhq/types-live";
import React from "react";
import { Trans } from "react-i18next";
import LinkWithExternalIcon from "~/renderer/components/LinkWithExternalIcon";
import {
OpDetailsData,
OpDetailsSection,
OpDetailsTitle,
} from "~/renderer/drawers/OperationDetails/styledComponents";
import { openURL } from "~/renderer/linking";
import { OperationDetailsExtraProps } from "../types";

const OperationDetailsExtra = ({
operation,
}: OperationDetailsExtraProps<Account, KadenaOperation>) => {
return (
<>
<OpDetailsSection>
<OpDetailsTitle>
<Trans i18nKey={"operationDetails.extra.senderChainId"} />
</OpDetailsTitle>
<OpDetailsData>{operation.extra.senderChainId}</OpDetailsData>
</OpDetailsSection>
<OpDetailsSection>
<OpDetailsTitle>
<Trans i18nKey={"operationDetails.extra.receiverChainId"} />
</OpDetailsTitle>
<OpDetailsData>{operation.extra.receiverChainId}</OpDetailsData>
</OpDetailsSection>
{operation.extra.receiverChainId !== operation.extra.senderChainId &&
operation.type === "OUT" ? (
<OpDetailsSection>
<OpDetailsData
style={{ display: "flex", flexDirection: "column", alignItems: "flex-end" }}
>
<Trans i18nKey="send.steps.details.transferCrossChainWarning" />
<LinkWithExternalIcon
fontSize={4}
onClick={() =>
openURL(`${KADENA_CROSS_CHAIN_TRANSFER_FINISHER_URL}?reqKey=${operation.hash}`)
}
label={<Trans i18nKey={"operationDetails.extra.finishCrossChainTransfer"} />}
/>
</OpDetailsData>
</OpDetailsSection>
) : null}
</>
);
};

export default {
OperationDetailsExtra,
};
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const StepChooseCurrency = ({ currency, setCurrency }: StepProps) => {
const icon = useFeature("currencyIcon");
const ton = useFeature("currencyTon");
const etherlink = useFeature("currencyEtherlink");
const kadena = useFeature("currencyKadena");

const featureFlaggedCurrencies = useMemo(
(): Partial<Record<CryptoCurrencyId, Feature<unknown> | null>> => ({
Expand Down Expand Up @@ -132,6 +133,7 @@ const StepChooseCurrency = ({ currency, setCurrency }: StepProps) => {
scroll_sepolia: scrollSepolia,
icon,
etherlink,
kadena,
}),
[
axelar,
Expand Down Expand Up @@ -181,6 +183,7 @@ const StepChooseCurrency = ({ currency, setCurrency }: StepProps) => {
scrollSepolia,
icon,
etherlink,
kadena,
],
);

Expand Down
13 changes: 11 additions & 2 deletions apps/ledger-live-desktop/static/i18n/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,10 @@
"withdrawUnbondedAmount": "Withdrawn Amount",
"palletMethod": "Method",
"transferAmount": "Transfer Amount",
"validatorsCount": "Validators ({{number}})"
"validatorsCount": "Validators ({{number}})",
"senderChainId": "Sender Chain ID",
"receiverChainId": "Receiver Chain ID",
"finishCrossChainTransfer": "Finish Kadena Cross Chain Transfer"
}
},
"operationList": {
Expand Down Expand Up @@ -2333,7 +2336,10 @@
"suggested": "Suggested",
"unitPerByte": "{{unit}} per byte",
"nft": "NFT",
"nftQuantity": "Quantity"
"nftQuantity": "Quantity",
"senderChainId": "Sender Chain ID",
"receiverChainId": "Receiver Chain ID",
"transferCrossChainWarning": "Completion is required for this transaction involving an account in a different chain."
},
"verification": {
"streaming": {
Expand Down Expand Up @@ -6382,6 +6388,9 @@
"getHelp": "Get Help",
"technicalErrorTitle": "Technical error : ",
"saveLogs": "Save logs"
},
"KadenaCrossChainTransfer": {
"title": "Completion is required for this transaction involving an account in a different chain."
}
},
"cryptoOrg": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
import { Account, AccountLike, ProtoNFT } from "@ledgerhq/types-live";
import type { Device } from "@ledgerhq/live-common/hw/actions/types";
import type { Operation } from "@ledgerhq/types-live";
import type { Transaction, TransactionStatus } from "@ledgerhq/live-common/generated/types";
import type { Transaction as EvmTransaction, GasOptions } from "@ledgerhq/coin-evm/types/index";
import { Result } from "@ledgerhq/live-common/bridge/useBridgeTransaction";
import type {
CardanoAccount,
Transaction as CardanoTransaction,
} from "@ledgerhq/live-common/families/cardano/types";
AlgorandAccount,
AlgorandTransaction,
TransactionStatus as AlgorandTransactionStatus,
} from "@ledgerhq/live-common/families/algorand/types";
import type {
Transaction as BitcoinTransaction,
TransactionStatus as BitcoinTransactionStatus,
} from "@ledgerhq/live-common/families/bitcoin/types";
import type {
AlgorandAccount,
AlgorandTransaction,
TransactionStatus as AlgorandTransactionStatus,
} from "@ledgerhq/live-common/families/algorand/types";
CardanoAccount,
Transaction as CardanoTransaction,
} from "@ledgerhq/live-common/families/cardano/types";
import type { Transaction as CasperTransaction } from "@ledgerhq/live-common/families/casper/types";
import {
CosmosAccount,
Transaction as CosmosTransaction,
Expand All @@ -26,18 +23,22 @@ import {
Transaction as CryptoOrgTransaction,
} from "@ledgerhq/live-common/families/crypto_org/types";
import { Transaction as HederaTransaction } from "@ledgerhq/live-common/families/hedera/types";
import type { Transaction as ICPTransaction } from "@ledgerhq/live-common/families/internet_computer/types";
import { Transaction as KadenaTransaction } from "@ledgerhq/live-common/families/kadena/types";
import {
SolanaAccount,
Transaction as SolanaTransaction,
} from "@ledgerhq/live-common/families/solana/types";
import type { Transaction as RippleTransaction } from "@ledgerhq/live-common/families/xrp/types";
import type { Transaction as ICPTransaction } from "@ledgerhq/live-common/families/internet_computer/types";
import type { Transaction as StellarTransaction } from "@ledgerhq/live-common/families/stellar/types";
import type { Transaction as StacksTransaction } from "@ledgerhq/live-common/families/stacks/types";
import type { Transaction as CasperTransaction } from "@ledgerhq/live-common/families/casper/types";
import type { Transaction as StellarTransaction } from "@ledgerhq/live-common/families/stellar/types";
import type { Transaction as TonTransaction } from "@ledgerhq/live-common/families/ton/types";
import type { Transaction as RippleTransaction } from "@ledgerhq/live-common/families/xrp/types";
import type { Transaction, TransactionStatus } from "@ledgerhq/live-common/generated/types";
import type { Device } from "@ledgerhq/live-common/hw/actions/types";
import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
import type { Operation } from "@ledgerhq/types-live";
import { Account, AccountLike, ProtoNFT } from "@ledgerhq/types-live";
import BigNumber from "bignumber.js";
import { Result } from "@ledgerhq/live-common/bridge/useBridgeTransaction";
import { ScreenName } from "~/const";

export type SendFundsNavigatorStackParamList = {
Expand Down Expand Up @@ -359,4 +360,32 @@ export type SendFundsNavigatorStackParamList = {
| ScreenName.SendSelectDevice
| ScreenName.SwapForm;
};
[ScreenName.KadenaEditReceiverChainId]: {
accountId: string;
account: Account;
parentId?: string;
transaction: KadenaTransaction;
currentNavigation:
| ScreenName.SignTransactionSummary
| ScreenName.SendSummary
| ScreenName.SwapForm;
nextNavigation:
| ScreenName.SignTransactionSelectDevice
| ScreenName.SendSelectDevice
| ScreenName.SwapForm;
};
[ScreenName.KadenaEditSenderChainId]: {
accountId: string;
account: Account;
parentId?: string;
transaction: KadenaTransaction;
currentNavigation:
| ScreenName.SignTransactionSummary
| ScreenName.SendSummary
| ScreenName.SwapForm;
nextNavigation:
| ScreenName.SignTransactionSelectDevice
| ScreenName.SendSelectDevice
| ScreenName.SwapForm;
};
};
Loading