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

Noves integration #1398

Merged
merged 38 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5947511
noves integration
juanlenoves Dec 6, 2023
96e2def
code refactored
NahuelNoves Dec 31, 2023
df51e51
Merge branch 'main' into noves
NahuelNoves Jan 16, 2024
18230d4
Merge main into noves - pull changes from blockscout
NahuelNoves Jan 16, 2024
0fca6be
PR changes added
NahuelNoves Jan 30, 2024
e29e77b
Code set up for new proxy 'describeTxs'
NahuelNoves Feb 2, 2024
8c4a911
minor fix
NahuelNoves Feb 2, 2024
8f4b695
Merge branch 'main' into noves
NahuelNoves Feb 6, 2024
6a7a1ba
Rename Novestranslate.ts to NovesTranslate.ts
juanlenoves Feb 8, 2024
e03304a
some quick stuff
juanlenoves Feb 8, 2024
32b7cf5
Merge branch 'main' into noves
juanlenoves Feb 8, 2024
0875d00
partial fixes and commit for changing how useDescribeTxs and txsConte…
juanlenoves Feb 9, 2024
67f9821
Pending PR fixes
NahuelNoves Feb 12, 2024
ba04f7b
tx asset flows pageSize of 50
juanlenoves Feb 12, 2024
d857327
PR comments fixes
NahuelNoves Feb 17, 2024
2dc925d
rename expected api endpoint for the describe_txs endpoint, more accu…
juanlenoves Feb 18, 2024
926ed8b
one final re-name for api endpoint (make it clear it's an object vs a…
juanlenoves Feb 18, 2024
8d66a3e
scrollRef fix
NahuelNoves Feb 20, 2024
830665a
Merge branch 'main' into noves
NahuelNoves Feb 20, 2024
85b006a
build error fix
NahuelNoves Feb 23, 2024
b68a924
design fixes
NahuelNoves Mar 3, 2024
bac02c0
Merge branch 'main' into noves
NahuelNoves Mar 3, 2024
fe5875f
sub heading fix
NahuelNoves Mar 3, 2024
ad72727
Removed pagination in account history
francisco-noves Mar 5, 2024
b0a21ac
remove duplicate route
juanlenoves Mar 6, 2024
79e7316
updated table theme and icon gap
francisco-noves Mar 7, 2024
48cf473
Removed wrong color in table
francisco-noves Mar 7, 2024
9aeb7d6
removed null validation in page params
francisco-noves Mar 8, 2024
301ff00
updated margin
francisco-noves Mar 11, 2024
674f102
margin fix
NahuelNoves Mar 12, 2024
3c288c6
Merge branch 'main' into noves
NahuelNoves Mar 12, 2024
fd3dfa7
add icons to contracts
NahuelNoves Mar 13, 2024
aa7bd83
Sub-heading interpretation simplified
NahuelNoves Mar 20, 2024
fd90cf1
token alignment fix
NahuelNoves Mar 20, 2024
cb0d8e7
tests added for new functions
NahuelNoves Mar 20, 2024
d19d1f3
Merge branch 'main' into noves
NahuelNoves Mar 20, 2024
0c74939
margin fix
NahuelNoves Mar 20, 2024
b18f25d
remove divider on mobile asset flows
NahuelNoves Mar 22, 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
4 changes: 2 additions & 2 deletions icons/lightning.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 20 additions & 1 deletion lib/api/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import type { L2OutputRootsResponse } from 'types/api/l2OutputRoots';
import type { L2TxnBatchesResponse } from 'types/api/l2TxnBatches';
import type { L2WithdrawalsResponse } from 'types/api/l2Withdrawals';
import type { LogsResponseTx, LogsResponseAddress } from 'types/api/log';
import type { NovesAccountHistoryResponse, NovesDescribeResponse, NovesResponseData } from 'types/api/noves';
import type { RawTracesResponse } from 'types/api/rawTrace';
import type { SearchRedirectResult, SearchResult, SearchResultFilters, SearchResultItem } from 'types/api/search';
import type { Counters, StatsCharts, StatsChart, HomeStats } from 'types/api/stats';
Expand Down Expand Up @@ -580,6 +581,21 @@ export const RESOURCES = {
filterFields: [],
},

// NOVES-FI
noves_transaction: {
path: '/api/v2/proxy/noves-fi/transactions/:hash',
pathParams: [ 'hash' as const ],
},
noves_address_history: {
path: '/api/v2/proxy/noves-fi/addresses/:address/transactions',
pathParams: [ 'address' as const ],
filterFields: [],
},
noves_describe_tx: {
path: '/api/v2/proxy/noves-fi/transactions/:hash/describe',
pathParams: [ 'hash' as const ],
},

// USER OPS
user_ops: {
path: '/api/v2/proxy/account-abstraction/operations',
Expand Down Expand Up @@ -666,7 +682,7 @@ export type PaginatedResources = 'blocks' | 'block_txs' |
'zkevm_l2_txn_batches' | 'zkevm_l2_txn_batch_txs' |
'withdrawals' | 'address_withdrawals' | 'block_withdrawals' |
'watchlist' | 'private_tags_address' | 'private_tags_tx' |
'domains_lookup' | 'addresses_lookup' | 'user_ops';
'domains_lookup' | 'addresses_lookup' | 'user_ops' | 'noves_address_history';

export type PaginatedResponse<Q extends PaginatedResources> = ResourcePayload<Q>;

Expand Down Expand Up @@ -765,6 +781,9 @@ Q extends 'zkevm_l2_txn_batches_count' ? number :
Q extends 'zkevm_l2_txn_batch' ? ZkEvmL2TxnBatch :
Q extends 'zkevm_l2_txn_batch_txs' ? ZkEvmL2TxnBatchTxs :
Q extends 'config_backend_version' ? BackendVersionConfig :
Q extends 'noves_transaction' ? NovesResponseData :
Q extends 'noves_address_history' ? NovesAccountHistoryResponse :
Q extends 'noves_describe_tx' ? NovesDescribeResponse :
Q extends 'addresses_lookup' ? EnsAddressLookupResponse :
Q extends 'domain_info' ? EnsDomainDetailed :
Q extends 'domain_events' ? EnsDomainEventsResponse :
Expand Down
103 changes: 103 additions & 0 deletions mocks/noves/transaction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import type { NovesResponseData } from 'types/api/noves';

import type { TokensData } from 'ui/tx/assetFlows/utils/getTokensData';

export const hash = '0x380400d04ebb4179a35b1d7fdef260776915f015e978f8587ef2704b843d4e53';

export const transaction: NovesResponseData = {
accountAddress: '0xef6595A423c99f3f2821190A4d96fcE4DcD89a80',
chain: 'eth-goerli',
classificationData: {
description: 'Called function \'stake\' on contract 0xef326CdAdA59D3A740A76bB5f4F88Fb2.',
protocol: {
name: null,
},
received: [],
sent: [
{
action: 'sent',
actionFormatted: 'Sent',
amount: '3000',
from: {
address: '0xef6595A423c99f3f2821190A4d96fcE4DcD89a80',
name: 'This wallet',
},
to: {
address: '0xdD15D2650387Fb6FEDE27ae7392C402a393F8A37',
name: null,
},
token: {
address: '0x1bfe4298796198f8664b18a98640cec7c89b5baa',
decimals: 18,
name: 'PQR-Test',
symbol: 'PQR',
},
},
{
action: 'paidGas',
actionFormatted: 'Paid Gas',
amount: '0.000395521502109448',
from: {
address: '0xef6595A423c99f3f2821190A4d96fcE4DcD89a80',
name: 'This wallet',
},
to: {
address: null,
name: 'Validators',
},
token: {
address: 'ETH',
decimals: 18,
name: 'ETH',
symbol: 'ETH',
},
},
],
source: {
type: null,
},
type: 'unclassified',
typeFormatted: 'Unclassified',
},
rawTransactionData: {
blockNumber: 10388918,
fromAddress: '0xef6595A423c99f3f2821190A4d96fcE4DcD89a80',
gas: 275079,
gasPrice: 1500000008,
timestamp: 1705488588,
toAddress: '0xef326CdAdA59D3A740A76bB5f4F88Fb2f1076164',
transactionFee: {
amount: '395521502109448',
token: {
decimals: 18,
symbol: 'ETH',
},
},
transactionHash: '0x380400d04ebb4179a35b1d7fdef260776915f015e978f8587ef2704b843d4e53',
},
txTypeVersion: 2,
};

export const tokenData: TokensData = {
nameList: [ 'PQR-Test', 'ETH' ],
symbolList: [ 'PQR' ],
idList: [],
byName: {
'PQR-Test': {
name: 'PQR-Test',
symbol: 'PQR',
address: '0x1bfe4298796198f8664b18a98640cec7c89b5baa',
id: undefined,
},
ETH: { name: 'ETH', symbol: undefined, address: 'ETH', id: undefined },
},
bySymbol: {
PQR: {
name: 'PQR-Test',
symbol: 'PQR',
address: '0x1bfe4298796198f8664b18a98640cec7c89b5baa',
id: undefined,
},
undefined: { name: 'ETH', symbol: undefined, address: 'ETH', id: undefined },
},
};
8 changes: 4 additions & 4 deletions nextjs/nextjs-routes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ declare module "nextjs-routes" {
| StaticRoute<"/api/media-type">
| StaticRoute<"/api/proxy">
| StaticRoute<"/api-docs">
| DynamicRoute<"/apps/[id]", { "id": string }>
| StaticRoute<"/apps">
| DynamicRoute<"/apps/[id]", { "id": string }>
| StaticRoute<"/auth/auth0">
| StaticRoute<"/auth/profile">
| StaticRoute<"/auth/unverified-email">
| DynamicRoute<"/batches/[number]", { "number": string }>
| StaticRoute<"/batches">
| DynamicRoute<"/batches/[number]", { "number": string }>
| DynamicRoute<"/block/[height_or_hash]", { "height_or_hash": string }>
| StaticRoute<"/blocks">
| StaticRoute<"/contract-verification">
Expand All @@ -36,11 +36,11 @@ declare module "nextjs-routes" {
| StaticRoute<"/graphiql">
| StaticRoute<"/">
| StaticRoute<"/login">
| DynamicRoute<"/name-domains/[name]", { "name": string }>
| StaticRoute<"/name-domains">
| StaticRoute<"/output-roots">
| DynamicRoute<"/name-domains/[name]", { "name": string }>
| DynamicRoute<"/op/[hash]", { "hash": string }>
| StaticRoute<"/ops">
| StaticRoute<"/output-roots">
| StaticRoute<"/search-results">
| StaticRoute<"/stats">
| DynamicRoute<"/token/[hash]", { "hash": string }>
Expand Down
43 changes: 43 additions & 0 deletions stubs/noves/NovesTranslate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import type { NovesResponseData, NovesClassificationData, NovesRawTransactionData } from 'types/api/noves';

const NOVES_TRANSLATE_CLASSIFIED: NovesClassificationData = {
description: 'Sent 0.04 ETH',
received: [ {
action: 'Sent Token',
actionFormatted: 'Sent Token',
amount: '45',
from: { name: '', address: '0xa0393A76b132526a70450273CafeceB45eea6dEE' },
to: { name: '', address: '0xa0393A76b132526a70450273CafeceB45eea6dEE' },
token: {
address: '',
name: 'ETH',
symbol: 'ETH',
decimals: 18,
},
} ],
sent: [],
source: {
type: '',
},
type: '0x2',
typeFormatted: 'Send NFT',
};

const NOVES_TRANSLATE_RAW: NovesRawTransactionData = {
blockNumber: 1,
fromAddress: '0xCFC123a23dfeD71bDAE054e487989d863C525C73',
gas: 2,
gasPrice: 3,
timestamp: 20000,
toAddress: '0xCFC123a23dfeD71bDAE054e487989d863C525C73',
transactionFee: 2,
transactionHash: '0x128b79937a0eDE33258992c9668455f997f1aF24',
};

export const NOVES_TRANSLATE: NovesResponseData = {
accountAddress: '0x2b824349b320cfa72f292ab26bf525adb00083ba9fa097141896c3c8c74567cc',
chain: 'base',
txTypeVersion: 2,
rawTransactionData: NOVES_TRANSLATE_RAW,
classificationData: NOVES_TRANSLATE_CLASSIFIED,
};
111 changes: 111 additions & 0 deletions types/api/noves.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
export interface NovesResponseData {
txTypeVersion: number;
chain: string;
accountAddress: string;
classificationData: NovesClassificationData;
rawTransactionData: NovesRawTransactionData;
}

export interface NovesClassificationData {
type: string;
typeFormatted?: string;
description: string;
sent: Array<NovesSentReceived>;
received: Array<NovesSentReceived>;
protocol?: {
name: string | null;
};
source: {
type: string | null;
};
message?: string;
}

export interface NovesSentReceived {
action: string;
actionFormatted?: string;
amount: string;
to: NovesTo;
from: NovesFrom;
token?: NovesToken;
nft?: NovesNft;
}

export interface NovesToken {
symbol: string;
name: string;
decimals: number;
address: string;
id?: string;
}

export interface NovesNft {
name: string;
id: string;
symbol: string;
address: string;
}

export interface NovesFrom {
name: string | null;
address: string;
}

export interface NovesTo {
name: string | null;
address: string | null;
}

export interface NovesRawTransactionData {
transactionHash: string;
fromAddress: string;
toAddress: string;
blockNumber: number;
gas: number;
gasPrice: number;
transactionFee: NovesTransactionFee | number;
timestamp: number;
}

export interface NovesTransactionFee {
amount: string;
currency?: string;
token?: {
decimals: number;
symbol: string;
};
}

export interface NovesAccountHistoryResponse {
hasNextPage: boolean;
items: Array<NovesResponseData>;
pageNumber: number;
pageSize: number;
next_page_params?: {
startBlock: null;
endBlock: string;
pageNumber: number;
pageSize: number;
ignoreTransactions: string;
viewAsAccountAddress: string;
};
}

export const NovesHistoryFilterValues = [ 'received', 'sent' ] as const;

export type NovesHistoryFilterValue = typeof NovesHistoryFilterValues[number] | undefined;

export interface NovesHistoryFilters {
filter?: NovesHistoryFilterValue;
}

export interface NovesDescribeResponse {
type: string;
description: string;
}

export interface NovesDescribeTxsResponse {
txHash: string;
type: string;
description: string;
}[];
1 change: 1 addition & 0 deletions types/client/txInterpretation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ArrayElement } from 'types/utils';

export const PROVIDERS = [
'blockscout',
'noves',
'none',
] as const;

Expand Down
Loading