Skip to content

Commit

Permalink
chore: fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
khanti42 committed Dec 11, 2024
1 parent 7d66f83 commit 87ff473
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Meta } from '@storybook/react';
import { Transaction } from 'types';
import { Transaction, TransactionStatus } from 'types';
import { TransactionListItemView } from './TransactionListItem.view';

export default {
Expand All @@ -13,9 +13,11 @@ const transaction: Transaction = {
chainId: '0x534e5f5345504f4c4941',
senderAddress:
'0x5ccc9fc2d7ce9e2b0f2cee1a4b898570bb4d03ba23ad6f72f0db971bd04552c',
status: 'RECEIVED',
contractAddress:
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7',
executionStatus: TransactionStatus.SUCCEEDED,
finalityStatus: TransactionStatus.RECEIVED,
failureReason: '',
eventIds: [],
timestamp: 1655869759,
accountCalls: {
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7': [
Expand All @@ -30,6 +32,10 @@ const transaction: Transaction = {
},
],
},
maxFee: null,
actualFee: null,
version: 1,
dataVersion: '2',
};

export const FullWidth = () => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ export const getTxnDate = (transaction: Transaction): string => {

export const getTxnStatus = (transaction: Transaction): string => {
let statusStr = [];
if (transaction.executionStatus) {
statusStr.push(formatStatus(transaction.executionStatus));
}
if (transaction.finalityStatus === transaction.executionStatus) {
return transaction.finalityStatus
? formatStatus(transaction.finalityStatus)
Expand All @@ -76,9 +79,6 @@ export const getTxnStatus = (transaction: Transaction): string => {
if (transaction.finalityStatus) {
statusStr.push(formatStatus(transaction.finalityStatus));
}
if (transaction.executionStatus) {
statusStr.push(formatStatus(transaction.executionStatus));
}
return statusStr.join(' / ');
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Meta } from '@storybook/react';
import { Transaction } from 'types';
import { Transaction, TransactionStatus } from 'types';
import { TransactionsListView } from './TransactionsList.view';

export default {
Expand All @@ -15,9 +15,11 @@ const transactions: Transaction[] = [
chainId: '0x534e5f5345504f4c4941',
senderAddress:
'0x5ccc9fc2d7ce9e2b0f2cee1a4b898570bb4d03ba23ad6f72f0db971bd04552c',
status: 'RECEIVED',
contractAddress:
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7',
executionStatus: TransactionStatus.SUCCEEDED,
finalityStatus: TransactionStatus.RECEIVED,
failureReason: '',
eventIds: [],
timestamp: 1655869759,
accountCalls: {
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7': [
Expand All @@ -32,6 +34,10 @@ const transactions: Transaction[] = [
},
],
},
maxFee: null,
actualFee: null,
version: 1,
dataVersion: '2',
},
{
txnHash:
Expand All @@ -40,9 +46,11 @@ const transactions: Transaction[] = [
chainId: '0x534e5f5345504f4c4941',
senderAddress:
'0x05ccc9fc2d7ce9e2b0f2cee1a4b898570bb4d03ba23ad6f72f0db971bd04552c',
contractAddress:
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7',
timestamp: 1655705597,
status: 'Accepted on L2',
eventIds: ['245417_20_0'],
executionStatus: TransactionStatus.SUCCEEDED,
finalityStatus: TransactionStatus.ACCEPTED_ON_L2,
failureReason: '',
accountCalls: {
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7': [
Expand All @@ -57,6 +65,10 @@ const transactions: Transaction[] = [
},
],
},
maxFee: null,
actualFee: null,
version: 1,
dataVersion: '2',
},
{
txnHash:
Expand All @@ -65,10 +77,12 @@ const transactions: Transaction[] = [
chainId: '0x534e5f5345504f4c4941',
senderAddress:
'0x5ccc9fc2d7ce9e2b0f2cee1a4b898570bb4d03ba23ad6f72f0db971bd04552c',
status: 'REJECTED',
contractAddress:
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7',
executionStatus: TransactionStatus.REJECTED,
finalityStatus: TransactionStatus.NOT_RECEIVED,
failureReason:
'Actual fee exceeded max fee.\n13056675060932 > 9585012591398',
eventIds: [],
timestamp: 1655695493,
accountCalls: {
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7': [
Expand All @@ -83,6 +97,10 @@ const transactions: Transaction[] = [
},
],
},
maxFee: null,
actualFee: null,
version: 1,
dataVersion: '2',
},
{
txnHash:
Expand All @@ -91,9 +109,11 @@ const transactions: Transaction[] = [
chainId: '0x534e5f5345504f4c4941',
senderAddress:
'0x05ccc9fc2d7ce9e2b0f2cee1a4b898570bb4d03ba23ad6f72f0db971bd04552c',
contractAddress:
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7',
timestamp: 1654745214,
status: 'Accepted on L1',
eventIds: ['233927_16_0'],
executionStatus: TransactionStatus.SUCCEEDED,
finalityStatus: TransactionStatus.ACCEPTED_ON_L1,
failureReason: '',
accountCalls: {
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7': [
Expand All @@ -108,6 +128,10 @@ const transactions: Transaction[] = [
},
],
},
maxFee: null,
actualFee: null,
version: 1,
dataVersion: '2',
},
{
txnHash:
Expand All @@ -116,9 +140,11 @@ const transactions: Transaction[] = [
chainId: '0x534e5f5345504f4c4941',
senderAddress:
'0x05ccc9fc2d7ce9e2b0f2cee1a4b898570bb4d03ba23ad6f72f0db971bd04552c',
contractAddress:
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7',
timestamp: 1654708040,
status: 'Accepted on L1',
eventIds: ['233510_7_0'],
executionStatus: TransactionStatus.SUCCEEDED,
finalityStatus: TransactionStatus.ACCEPTED_ON_L1,
failureReason: '',
accountCalls: {
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7': [
Expand All @@ -133,6 +159,10 @@ const transactions: Transaction[] = [
},
],
},
maxFee: null,
actualFee: null,
version: 1,
dataVersion: '2',
},
{
txnHash:
Expand All @@ -141,9 +171,11 @@ const transactions: Transaction[] = [
chainId: '0x534e5f5345504f4c4941',
senderAddress:
'0x05ccc9fc2d7ce9e2b0f2cee1a4b898570bb4d03ba23ad6f72f0db971bd04552c',
contractAddress:
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7',
timestamp: 1654701586,
status: 'Accepted on L1',
eventIds: ['233442_14_0'],
executionStatus: TransactionStatus.SUCCEEDED,
finalityStatus: TransactionStatus.ACCEPTED_ON_L1,
failureReason: '',
accountCalls: {
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7': [
Expand All @@ -158,16 +190,22 @@ const transactions: Transaction[] = [
},
],
},
maxFee: null,
actualFee: null,
version: 1,
dataVersion: '2',
},
{
txnHash: '0x81fab4268648483028b9be3353d6551ca35041fb2a03c2f372b19f3ab109b1',
txnType: 'invoke',
chainId: '0x534e5f5345504f4c4941',
senderAddress:
'0x05ccc9fc2d7ce9e2b0f2cee1a4b898570bb4d03ba23ad6f72f0db971bd04552c',
contractAddress:
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7',
timestamp: 1654678571,
status: 'Accepted on L1',
eventIds: ['233196_29_0'],
executionStatus: TransactionStatus.SUCCEEDED,
finalityStatus: TransactionStatus.ACCEPTED_ON_L1,
failureReason: '',
accountCalls: {
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7': [
Expand All @@ -182,6 +220,10 @@ const transactions: Transaction[] = [
},
],
},
maxFee: null,
actualFee: null,
version: 1,
dataVersion: '2',
},
{
txnHash:
Expand All @@ -190,9 +232,11 @@ const transactions: Transaction[] = [
chainId: '0x534e5f5345504f4c4941',
senderAddress:
'0x05ccc9fc2d7ce9e2b0f2cee1a4b898570bb4d03ba23ad6f72f0db971bd04552c',
contractAddress:
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7',
timestamp: 1654670913,
status: 'Accepted on L1',
eventIds: ['233116_23_0'],
executionStatus: TransactionStatus.SUCCEEDED,
finalityStatus: TransactionStatus.ACCEPTED_ON_L1,
failureReason: '',
accountCalls: {
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7': [
Expand All @@ -207,6 +251,10 @@ const transactions: Transaction[] = [
},
],
},
maxFee: null,
actualFee: null,
version: 1,
dataVersion: '2',
},
{
txnHash:
Expand All @@ -215,9 +263,11 @@ const transactions: Transaction[] = [
chainId: '0x534e5f5345504f4c4941',
senderAddress:
'0x05ccc9fc2d7ce9e2b0f2cee1a4b898570bb4d03ba23ad6f72f0db971bd04552c',
contractAddress:
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7',
timestamp: 1654662459,
status: 'Accepted on L1',
eventIds: ['233027_3_0'],
executionStatus: TransactionStatus.SUCCEEDED,
finalityStatus: TransactionStatus.ACCEPTED_ON_L1,
failureReason: '',
accountCalls: {
'0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7': [
Expand All @@ -229,6 +279,10 @@ const transactions: Transaction[] = [
},
],
},
maxFee: null,
actualFee: null,
version: 1,
dataVersion: '2',
},
];

Expand Down
18 changes: 11 additions & 7 deletions packages/wallet-ui/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ export type Transaction = {
txnType: string;
chainId: string; // in hex
senderAddress: string; // in hex
status?: TransactionStatus | string;
executionStatus?: TransactionStatus | string;
finalityStatus?: TransactionStatus | string;
contractAddress: string; // in hex
executionStatus: TransactionStatus | string;
finalityStatus: TransactionStatus | string;
failureReason: string;
eventIds: string[];
actualFee: string | null;
maxFee: string | null;
timestamp: number;
accountCalls: AccountCalls;
version: number;
dataVersion: string;
};

export type Account = {
Expand Down Expand Up @@ -56,19 +59,20 @@ export type TransactionStatusOptions =
| 'Rejected'
| 'Not Received';

export enum StarkscanTransactionType { // for retrieving txns from Voyager
export enum StarkscanTransactionType {
DEPLOY = 'DEPLOY',
DEPLOY_ACCOUNT = 'DEPLOY_ACCOUNT',
INVOKE = 'INVOKE_FUNCTION',
}

export enum TransactionStatus { // for retrieving txn from Starknet feeder gateway
NOT_RECEIVED = 'NOT_RECEIVED',
RECEIVED = 'RECEIVED',
PENDING = 'PENDING',
ACCEPTED_ON_L2 = 'ACCEPTED_ON_L2',
ACCEPTED_ON_L1 = 'ACCEPTED_ON_L1',
NOT_RECEIVED = 'NOT_RECEIVED',
REJECTED = 'REJECTED',
REVERTED = 'REVERTED',
SUCCEEDED = 'SUCCEEDED',
}

export enum BalanceType {
Expand Down

0 comments on commit 87ff473

Please sign in to comment.