Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Support filecoin #4589

Merged
6 commits merged into from
May 10, 2022
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,5 @@ ui-lib/lib
ui-lib/storybook-static/*

# IDE
.vscode/*
.vscode/*
.idea
1 change: 1 addition & 0 deletions src/live-common-set-supported-currencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ setSupportedCurrencies([
"ethereum_ropsten",
"ethereum_goerli",
"cosmos_testnet",
"filecoin",
]);
23 changes: 13 additions & 10 deletions src/renderer/drawers/OperationDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,16 +641,19 @@ type OperationDetailsExtraProps = {
};

const OperationDetailsExtra = ({ extra }: OperationDetailsExtraProps) => {
return Object.entries(extra).map(([key, value]) => (
<OpDetailsSection key={key}>
<OpDetailsTitle>
<Trans i18nKey={`operationDetails.extra.${key}`} defaults={key} />
</OpDetailsTitle>
<OpDetailsData>
<Ellipsis>{value}</Ellipsis>
</OpDetailsData>
</OpDetailsSection>
));
return Object.entries(extra).map(([key, value]) => {
if( typeof value == "object" || typeof value == "function") return null;
This conversation was marked as resolved.
Show resolved Hide resolved
return (
<OpDetailsSection key={key}>
<OpDetailsTitle>
<Trans i18nKey={`operationDetails.extra.${key}`} defaults={key} />
</OpDetailsTitle>
<OpDetailsData>
<Ellipsis>{value}</Ellipsis>
</OpDetailsData>
</OpDetailsSection>
);
});
};

const More = styled(Text).attrs(p => ({
Expand Down
37 changes: 37 additions & 0 deletions src/renderer/families/filecoin/TransactionConfirmFields.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// @flow

import invariant from "invariant";
import React from "react";
import TransactionConfirmField from "~/renderer/components/TransactionConfirm/TransactionConfirmField";
import Text from "~/renderer/components/Text";
import { DeviceTransactionField } from "@ledgerhq/live-common/lib/transaction";


const addressStyle = {
wordBreak: "break-all",
textAlign: "right",
maxWidth: "70%",
};

const FilecoinField = ({ transaction, field }: { transaction: Transaction, field: DeviceTransactionField }) => {
invariant(transaction.family === "filecoin", "filecoin transaction");

return (
<TransactionConfirmField label={field.label}>
<Text style={addressStyle} ml={1} ff="Inter|Medium" color="palette.text.shade80" fontSize={3}>
{field.value}
</Text>
</TransactionConfirmField>
);
};

const fieldComponents = {
"filecoin.gasFeeCap": FilecoinField,
"filecoin.gasPremium": FilecoinField,
"filecoin.gasLimit": FilecoinField,
"filecoin.method": FilecoinField,
};

export default {
fieldComponents,
};