-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jeesun Kim
authored and
Jeesun Kim
committed
Apr 11, 2024
1 parent
b6d1993
commit fadbaba
Showing
3 changed files
with
152 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from "react"; | ||
import { | ||
Input, | ||
InputProps, | ||
Textarea, | ||
TextareaProps, | ||
} from "@stellar/design-system"; | ||
|
||
const MIN_LENGTH_FOR_FULL_WIDTH_FIELD = 30; | ||
|
||
interface FieldViewerProps extends Omit<InputProps, "fieldSize"> { | ||
id: string; | ||
fieldSize?: "sm" | "md" | "lg"; | ||
label: string; | ||
labelSuffix?: string | React.ReactNode; | ||
placeholder?: string; | ||
readOnly?: boolean; | ||
value: string; | ||
error: string | undefined; | ||
onChange?: (e: React.ChangeEvent<any>) => void; | ||
} | ||
|
||
// length > 30 to be a full width | ||
|
||
export const FieldViewer = ({ | ||
id, | ||
fieldSize = "md", | ||
label, | ||
labelSuffix, | ||
placeholder = "Ex: GCEXAMPLE5HWNK4AYSTEQ4UWDKHTCKADVS2AHF3UI2ZMO3DPUSM6Q4UG", | ||
value, | ||
error, | ||
readOnly, | ||
...props | ||
}: FieldViewerProps) => ( | ||
<Input | ||
id={id} | ||
fieldSize={fieldSize} | ||
label={label} | ||
labelSuffix={labelSuffix} | ||
placeholder={placeholder} | ||
value={value} | ||
error={error} | ||
{...props} | ||
/> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,95 @@ | ||
import { FeeBumpTransaction } from "@stellar/stellar-sdk"; | ||
import { FeeBumpTransaction, Transaction } from "@stellar/stellar-sdk"; | ||
|
||
import { Routes } from "@/constants/routes"; | ||
import { AnyObject } from "@/types/types"; | ||
|
||
type SignTransactionPagesProps = { | ||
overview: [ | ||
{ | ||
label: "Signing for"; | ||
type: "all"; | ||
// component type | ||
}, | ||
{ | ||
label: "Transaction Envelope XDR"; | ||
type: "all"; | ||
// component type | ||
}, | ||
{ | ||
label: "Transaction Hash"; | ||
type: "all"; | ||
// component type | ||
}, | ||
{ | ||
label: "Fee source account"; | ||
type: FeeBumpTransaction; | ||
// component type | ||
}, | ||
{ | ||
label: "Transaction Fee (stroops)"; | ||
type: FeeBumpTransaction; | ||
// component type | ||
}, | ||
{ | ||
label: "Number of existing signatures"; | ||
type: FeeBumpTransaction; | ||
// component type | ||
}, | ||
{ | ||
label: "Inner transaction hash"; | ||
type: FeeBumpTransaction; | ||
// component type | ||
}, | ||
{ | ||
label: "Inner transaction source account"; | ||
type: FeeBumpTransaction; | ||
// component type | ||
}, | ||
{ | ||
label: "Inner transaction sequence number"; | ||
type: FeeBumpTransaction; | ||
// component type | ||
}, | ||
{ | ||
label: "Inner transaction fee (stroops)"; | ||
type: FeeBumpTransaction; | ||
// component type | ||
}, | ||
{ | ||
label: "Inner transaction number of operations"; | ||
type: FeeBumpTransaction; | ||
// component type | ||
}, | ||
{ | ||
label: "Inner transaction number of existing signatures"; | ||
type: FeeBumpTransaction; | ||
// component type | ||
}, | ||
{ | ||
label: "Source account"; | ||
type: FeeBumpTransaction; | ||
// component type | ||
}, | ||
{ | ||
label: "Sequence number"; | ||
type: FeeBumpTransaction; | ||
// component type | ||
}, | ||
{ | ||
label: "Transaction Fee (stroops)"; | ||
type: FeeBumpTransaction; | ||
// component type | ||
}, | ||
{ | ||
label: "Number of operations"; | ||
type: FeeBumpTransaction; | ||
// component type | ||
}, | ||
{ | ||
label: "Number of existing signatures"; | ||
type: FeeBumpTransaction; | ||
// component type | ||
}, | ||
]; | ||
}; | ||
// { | ||
// label: "Signing for", | ||
// type: "all", | ||
// // component type | ||
// }, | ||
// { | ||
// label: "Transaction Envelope XDR", | ||
// type: "all", | ||
// // component type | ||
// }, | ||
// { | ||
// label: "Transaction Hash", | ||
// type: "all", | ||
// // component type | ||
// }, | ||
|
||
const getFeeBumpTxFields = (feeBumpTx: FeeBumpTransaction) => [ | ||
{ | ||
label: "Fee source account", | ||
value: feeBumpTx.feeSource, | ||
// component type | ||
}, | ||
{ | ||
label: "Transaction Fee (stroops)", | ||
value: feeBumpTx.fee, | ||
// component type | ||
}, | ||
{ | ||
label: "Number of existing signatures", | ||
value: feeBumpTx.signatures.length, | ||
// component type | ||
}, | ||
{ | ||
label: "Inner transaction hash", | ||
value: feeBumpTx.innerTransaction.hash().toString("hex"), | ||
// component type | ||
}, | ||
{ | ||
label: "Inner transaction source account", | ||
value: feeBumpTx.innerTransaction.source, | ||
// component type | ||
}, | ||
{ | ||
label: "Inner transaction sequence number", | ||
value: feeBumpTx.innerTransaction.sequence, | ||
// component type | ||
}, | ||
{ | ||
label: "Inner transaction fee (stroops)", | ||
value: feeBumpTx.innerTransaction.fee, | ||
// component type | ||
}, | ||
{ | ||
label: "Inner transaction number of operations", | ||
value: feeBumpTx.innerTransaction.operations.length, | ||
// component type | ||
}, | ||
{ | ||
label: "Inner transaction number of existing signatures", | ||
value: feeBumpTx.innerTransaction.signatures.length, | ||
// component type | ||
}, | ||
]; | ||
const getTxFields = (transaction: Transaction) => [ | ||
{ | ||
label: "Source account", | ||
value: transaction.source, | ||
// component type | ||
}, | ||
{ | ||
label: "Sequence number", | ||
value: transaction.sequence, | ||
// component type | ||
}, | ||
{ | ||
label: "Transaction Fee (stroops)", | ||
value: transaction.fee, | ||
// component type | ||
}, | ||
{ | ||
label: "Number of operations", | ||
value: transaction.operations.length, | ||
// component type | ||
}, | ||
{ | ||
label: "Number of existing signatures", | ||
value: transaction.signatures.length, | ||
// component type | ||
}, | ||
]; |