@0xtorch/evm 0.0.31 → 0.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/decoder/decode.ts CHANGED
@@ -537,6 +537,7 @@ const getErc20Token = async (
537
537
  coingeckoId: coin?.id,
538
538
  marketCapUsd: undefined,
539
539
  },
540
+ priceDatasourceId: undefined,
540
541
  updatedAt: Date.now(),
541
542
  },
542
543
  }
package/index.ts CHANGED
@@ -92,15 +92,7 @@ export {
92
92
  createRoninExplorer,
93
93
  } from './explorers'
94
94
  export type { Explorer } from './explorers'
95
- export {
96
- getAccountsTransactionFulls,
97
- getAccountsTransactionFullsCustom,
98
- } from './getAccountsTransactionFulls'
99
95
  export { getTransactionDetail } from './getTransactionDetail'
100
- export {
101
- getTransactionFull,
102
- getTransactionFullCustom,
103
- } from './getTransactionFull'
104
96
  export { isHex, parsedLogSchema, toLowerHex } from './types'
105
97
  export type {
106
98
  Erc1155NftId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xtorch/evm",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "description": "Cryptorch EVM extension",
5
5
  "keywords": [
6
6
  "cryptorch",
@@ -38,7 +38,7 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@0xtorch/big-decimal": "^0.0.10",
41
- "@0xtorch/core": "^0.0.28",
41
+ "@0xtorch/core": "^0.0.29",
42
42
  "@supercharge/promise-pool": "^3.1.1",
43
43
  "viem": "^2.9.16",
44
44
  "zod": "^3.22.4"
@@ -1,46 +0,0 @@
1
- import type { Config, FiatCurrency } from '@0xtorch/core'
2
- import { coingeckoCryptoCurrencyDataSource, usd } from '@0xtorch/core'
3
- import { analyzer } from '../analyzer'
4
- import type { Chain } from '../chains'
5
- import { decoder } from '../decoder'
6
- import type { LowerHex } from '../types'
7
- import { getAccountsTransactionFullsCustom } from './getAccountsTransactionFullsCustom'
8
-
9
- type GetAccountsTransactionFullsParameters = {
10
- readonly chain: Chain
11
- readonly addresses: readonly LowerHex[]
12
- readonly fromBlock: bigint
13
- readonly toBlock: bigint
14
- readonly fiat?: FiatCurrency
15
- readonly onFetchHashes?: (hashes: readonly LowerHex[]) => void
16
- readonly onFetchTransaction?: (hash: LowerHex) => void
17
- }
18
-
19
- export const getAccountsTransactionFulls = async (
20
- {
21
- chain,
22
- addresses,
23
- fromBlock,
24
- toBlock,
25
- fiat = usd,
26
- onFetchHashes,
27
- onFetchTransaction,
28
- }: GetAccountsTransactionFullsParameters,
29
- config?: Config,
30
- ) =>
31
- await getAccountsTransactionFullsCustom(
32
- {
33
- chain,
34
- addresses,
35
- fromBlock,
36
- toBlock,
37
- appDataSource: undefined,
38
- priceDataSource: coingeckoCryptoCurrencyDataSource,
39
- fiat,
40
- decoder,
41
- analyzer,
42
- onFetchHashes,
43
- onFetchTransaction,
44
- },
45
- config,
46
- )
@@ -1,106 +0,0 @@
1
- import type { Config } from '@0xtorch/core'
2
- import type {
3
- GetAccountsTransactionFullsCustomParameters,
4
- GetAccountsTransactionFullsCustomParametersAllUndefined,
5
- GetAccountsTransactionFullsCustomParametersD,
6
- GetAccountsTransactionFullsCustomParametersDA,
7
- GetAccountsTransactionFullsCustomParametersP,
8
- GetAccountsTransactionFullsCustomParametersPD,
9
- GetAccountsTransactionFullsCustomParametersPDA,
10
- GetAccountsTransactionFullsCustomReturnType,
11
- } from './types'
12
- import { getAccountsTransactionFullsCustomWithD } from './withD'
13
- import { getAccountsTransactionFullsCustomWithDA } from './withDA'
14
- import { getAccountsTransactionFullsCustomWithP } from './withP'
15
- import { getAccountsTransactionFullsCustomWithPD } from './withPD'
16
- import { getAccountsTransactionFullsCustomWithPDA } from './withPDA'
17
- import { getAccountsTransactionFullsCustomWithAllUndefined } from './withUndefined'
18
-
19
- export const getAccountsTransactionFullsCustom = async <
20
- T extends GetAccountsTransactionFullsCustomParameters,
21
- >(
22
- parameters: T,
23
- config?: Config,
24
- ): Promise<GetAccountsTransactionFullsCustomReturnType<T>> => {
25
- if (isParametersAllUndefined(parameters)) {
26
- const data = await getAccountsTransactionFullsCustomWithAllUndefined(
27
- parameters,
28
- config,
29
- )
30
- return data as GetAccountsTransactionFullsCustomReturnType<T>
31
- }
32
- if (isParametersP(parameters)) {
33
- const data = await getAccountsTransactionFullsCustomWithP(
34
- parameters,
35
- config,
36
- )
37
- return data as GetAccountsTransactionFullsCustomReturnType<T>
38
- }
39
- if (isParametersPD(parameters)) {
40
- const data = await getAccountsTransactionFullsCustomWithPD(
41
- parameters,
42
- config,
43
- )
44
- return data as GetAccountsTransactionFullsCustomReturnType<T>
45
- }
46
- if (isParametersPDA(parameters)) {
47
- const data = await getAccountsTransactionFullsCustomWithPDA(
48
- parameters,
49
- config,
50
- )
51
- return data as GetAccountsTransactionFullsCustomReturnType<T>
52
- }
53
- if (isParametersD(parameters)) {
54
- const data = await getAccountsTransactionFullsCustomWithD(
55
- parameters,
56
- config,
57
- )
58
- return data as GetAccountsTransactionFullsCustomReturnType<T>
59
- }
60
- if (isParametersDA(parameters)) {
61
- const data = await getAccountsTransactionFullsCustomWithDA(
62
- parameters,
63
- config,
64
- )
65
- return data as GetAccountsTransactionFullsCustomReturnType<T>
66
- }
67
- throw new Error('not implemented')
68
- }
69
-
70
- const isParametersAllUndefined = (
71
- parameters: GetAccountsTransactionFullsCustomParameters,
72
- ): parameters is GetAccountsTransactionFullsCustomParametersAllUndefined =>
73
- parameters.priceDataSource === undefined && parameters.decoder === undefined
74
-
75
- const isParametersP = (
76
- parameters: GetAccountsTransactionFullsCustomParameters,
77
- ): parameters is GetAccountsTransactionFullsCustomParametersP =>
78
- parameters.priceDataSource !== undefined && parameters.decoder === undefined
79
-
80
- const isParametersPD = (
81
- parameters: GetAccountsTransactionFullsCustomParameters,
82
- ): parameters is GetAccountsTransactionFullsCustomParametersPD =>
83
- parameters.priceDataSource !== undefined &&
84
- parameters.decoder !== undefined &&
85
- parameters.analyzer === undefined
86
-
87
- const isParametersPDA = (
88
- parameters: GetAccountsTransactionFullsCustomParameters,
89
- ): parameters is GetAccountsTransactionFullsCustomParametersPDA =>
90
- parameters.priceDataSource !== undefined &&
91
- parameters.decoder !== undefined &&
92
- parameters.analyzer !== undefined
93
-
94
- const isParametersD = (
95
- parameters: GetAccountsTransactionFullsCustomParameters,
96
- ): parameters is GetAccountsTransactionFullsCustomParametersD =>
97
- parameters.priceDataSource === undefined &&
98
- parameters.decoder !== undefined &&
99
- parameters.analyzer === undefined
100
-
101
- const isParametersDA = (
102
- parameters: GetAccountsTransactionFullsCustomParameters,
103
- ): parameters is GetAccountsTransactionFullsCustomParametersDA =>
104
- parameters.priceDataSource === undefined &&
105
- parameters.decoder !== undefined &&
106
- parameters.analyzer !== undefined
@@ -1,97 +0,0 @@
1
- import type {
2
- Config,
3
- CryptoCurrency,
4
- CryptoCurrencyDataSource,
5
- CryptoCurrencyPrice,
6
- FiatCurrency,
7
- } from '@0xtorch/core'
8
- import type { Chain } from '../chains'
9
- import type { TransactionDecoded } from '../types'
10
-
11
- export const getDecodedTransactionsPrices = async (
12
- chain: Chain,
13
- priceDataSource: CryptoCurrencyDataSource,
14
- fiat: FiatCurrency,
15
- transactions: readonly TransactionDecoded<undefined>[],
16
- config?: Config,
17
- ): Promise<readonly CryptoCurrencyPrice[]> => {
18
- const timeoutTimestamp =
19
- Date.now() + (config?.timeout === undefined ? 60_000 : config.timeout)
20
-
21
- // create currency timestamp range
22
- const mut_currencyTimestamps: {
23
- readonly currency: CryptoCurrency
24
- minTimestamp: number
25
- maxTimestamp: number
26
- }[] = []
27
- for (const transaction of transactions) {
28
- const timestampMs = Number(transaction.block.timestamp) * 1000
29
-
30
- // native token currency
31
- const mut_nativeCurrency = mut_currencyTimestamps.find(
32
- ({ currency }) => currency.id === chain.nativeToken.currency.id,
33
- )
34
- if (mut_nativeCurrency === undefined) {
35
- mut_currencyTimestamps.push({
36
- currency: chain.nativeToken.currency,
37
- minTimestamp: timestampMs,
38
- maxTimestamp: timestampMs,
39
- })
40
- } else {
41
- mut_nativeCurrency.minTimestamp = Math.min(
42
- mut_nativeCurrency.minTimestamp,
43
- timestampMs,
44
- )
45
- mut_nativeCurrency.maxTimestamp = Math.max(
46
- mut_nativeCurrency.maxTimestamp,
47
- timestampMs,
48
- )
49
- }
50
-
51
- // erc20 token currency
52
- for (const { token } of transaction.erc20Transfers) {
53
- if (token.currency.market.coingeckoId === undefined) {
54
- continue
55
- }
56
- const mut_currency = mut_currencyTimestamps.find(
57
- ({ currency }) => currency.id === token.currency.id,
58
- )
59
- if (mut_currency === undefined) {
60
- mut_currencyTimestamps.push({
61
- currency: token.currency,
62
- minTimestamp: timestampMs,
63
- maxTimestamp: timestampMs,
64
- })
65
- } else {
66
- mut_currency.minTimestamp = Math.min(
67
- mut_currency.minTimestamp,
68
- timestampMs,
69
- )
70
- mut_currency.maxTimestamp = Math.max(
71
- mut_currency.maxTimestamp,
72
- timestampMs,
73
- )
74
- }
75
- }
76
- }
77
-
78
- // get token price
79
- const mut_prices: CryptoCurrencyPrice[] = []
80
- for (const currencyTimestamp of mut_currencyTimestamps) {
81
- const prices = await priceDataSource.getHistoricalPrices(
82
- {
83
- targetCurrencies: [currencyTimestamp.currency],
84
- vsCurrency: fiat,
85
- from: currencyTimestamp.minTimestamp - 1000 * 60 * 60,
86
- to: currencyTimestamp.maxTimestamp + 1000 * 60 * 60,
87
- },
88
- {
89
- timeout: timeoutTimestamp - Date.now(),
90
- logger: config?.logger,
91
- },
92
- )
93
- mut_prices.push(...prices)
94
- }
95
-
96
- return mut_prices
97
- }
@@ -1,65 +0,0 @@
1
- import type { Config } from '@0xtorch/core'
2
- import type { Chain } from '../chains'
3
- import type { Hex, InternalTransaction, LowerHex } from '../types'
4
- import { checkTimeout } from '../utils'
5
-
6
- export const getHashesAndInternalTxs = async (
7
- chain: Chain,
8
- addresses: readonly LowerHex[],
9
- fromBlock: bigint,
10
- toBlock: bigint,
11
- config?: Config,
12
- ): Promise<{
13
- readonly hashes: readonly Hex[]
14
- readonly internalTransactions: readonly InternalTransaction<undefined>[]
15
- }> => {
16
- const timeoutTimestamp =
17
- Date.now() + (config?.timeout === undefined ? 60_000 : config.timeout)
18
-
19
- const mut_internalTransactions: InternalTransaction<undefined>[] = []
20
- const hashSet = new Set<Hex>()
21
- for (const address of addresses) {
22
- const normalTxHashes = await chain.explorer.getAddressTransactionHashes({
23
- address,
24
- startBlock: fromBlock,
25
- endBlock: toBlock,
26
- logger: config?.logger,
27
- })
28
- checkTimeout(timeoutTimestamp)
29
-
30
- for (const hash of normalTxHashes) {
31
- hashSet.add(hash)
32
- }
33
- const transferTxHashes = await chain.explorer.getAddressTokenTransferHashes(
34
- {
35
- address,
36
- startBlock: fromBlock,
37
- endBlock: toBlock,
38
- logger: config?.logger,
39
- },
40
- )
41
- checkTimeout(timeoutTimestamp)
42
-
43
- for (const hash of transferTxHashes) {
44
- hashSet.add(hash)
45
- }
46
- const internalTransactions =
47
- await chain.explorer.getAddressInternalTransactions({
48
- address,
49
- startBlock: fromBlock,
50
- endBlock: toBlock,
51
- nativeCurrency: chain.nativeToken.currency,
52
- logger: config?.logger,
53
- })
54
- checkTimeout(timeoutTimestamp)
55
-
56
- for (const internalTransaction of internalTransactions) {
57
- mut_internalTransactions.push(internalTransaction)
58
- hashSet.add(internalTransaction.transactionHash)
59
- }
60
- }
61
- return {
62
- hashes: [...hashSet],
63
- internalTransactions: mut_internalTransactions,
64
- }
65
- }
@@ -1,41 +0,0 @@
1
- import type { Config } from '@0xtorch/core'
2
- import { PromisePool } from '@supercharge/promise-pool'
3
- import type { Chain } from '../chains'
4
- import { getTransactionDetail } from '../getTransactionDetail'
5
- import type { Hex, InternalTransaction, TransactionDetail } from '../types'
6
- import { toLowerHex } from '../types'
7
-
8
- export const getTransactionDetails = async (
9
- chain: Chain,
10
- hashes: readonly Hex[],
11
- internalTransactions: readonly InternalTransaction<undefined>[],
12
- onFetchTransaction: ((hash: `0x${Lowercase<string>}`) => void) | undefined,
13
- config?: Config,
14
- ): Promise<readonly TransactionDetail[]> => {
15
- const mut_transactions: TransactionDetail[] = []
16
-
17
- const { errors } = await PromisePool.for(hashes)
18
- .withConcurrency(chain.client.httpRpcCount)
19
- .process(async (hash) => {
20
- const transactionDetail = await getTransactionDetail(
21
- {
22
- chain,
23
- hash,
24
- internalTransactions: internalTransactions.filter(
25
- ({ transactionHash }) => transactionHash === hash,
26
- ),
27
- },
28
- config,
29
- )
30
- if (onFetchTransaction !== undefined) {
31
- onFetchTransaction(toLowerHex(hash))
32
- }
33
- mut_transactions.push(transactionDetail)
34
- })
35
-
36
- if (errors.length > 0) {
37
- throw errors[0]
38
- }
39
-
40
- return mut_transactions
41
- }
@@ -1,42 +0,0 @@
1
- import type { App, Config } from '@0xtorch/core'
2
- import type { AppDataSource } from '../apps'
3
- import type { LowerHex, TransactionDetail } from '../types'
4
- import { toLowerHex } from '../types'
5
-
6
- export const getTransactionsApps = async (
7
- appDataSource: AppDataSource | undefined,
8
- transactionos: readonly TransactionDetail[],
9
- config?: Config,
10
- ): Promise<
11
- {
12
- readonly address: LowerHex
13
- readonly app: App | undefined
14
- }[]
15
- > => {
16
- if (transactionos.length === 0) {
17
- return []
18
- }
19
- const { chainId } = transactionos[0]
20
-
21
- // to addresses
22
- const toAddresses = [
23
- ...new Set(
24
- transactionos
25
- .map(({ to }) => (to === null ? undefined : toLowerHex(to)))
26
- .filter((toAddress): toAddress is LowerHex => toAddress !== undefined),
27
- ),
28
- ]
29
-
30
- const apps = await Promise.all(
31
- toAddresses.map((toAddress) =>
32
- appDataSource === undefined
33
- ? undefined
34
- : appDataSource.getApp(chainId, toAddress, config),
35
- ),
36
- )
37
-
38
- return toAddresses.map((address, index) => ({
39
- address,
40
- app: apps[index],
41
- }))
42
- }
@@ -1,2 +0,0 @@
1
- export { getAccountsTransactionFulls } from './getAccountsTransactionFulls'
2
- export { getAccountsTransactionFullsCustom } from './getAccountsTransactionFullsCustom'
@@ -1,122 +0,0 @@
1
- import type {
2
- CryptoCurrencyDataSource,
3
- CryptoCurrencyPrice,
4
- FiatCurrency,
5
- } from '@0xtorch/core'
6
- import type { Analyzer } from '../analyzer'
7
- import type { AppDataSource } from '../apps'
8
- import type { Chain } from '../chains'
9
- import type { Decoder } from '../decoder'
10
- import type { LowerHex, TransactionFull } from '../types'
11
-
12
- export type GetAccountsTransactionFullsCustomParameters =
13
- | GetAccountsTransactionFullsCustomParametersAllUndefined
14
- | GetAccountsTransactionFullsCustomParametersP
15
- | GetAccountsTransactionFullsCustomParametersPD
16
- | GetAccountsTransactionFullsCustomParametersPDA
17
- | GetAccountsTransactionFullsCustomParametersD
18
- | GetAccountsTransactionFullsCustomParametersDA
19
-
20
- export type GetAccountsTransactionFullsCustomParametersAllUndefined = {
21
- readonly chain: Chain
22
- readonly addresses: readonly LowerHex[]
23
- readonly fromBlock: bigint
24
- readonly toBlock: bigint
25
- readonly appDataSource: AppDataSource | undefined
26
- readonly priceDataSource: undefined
27
- readonly fiat: undefined
28
- readonly decoder: undefined
29
- readonly analyzer: undefined
30
- readonly onFetchHashes?: (hashes: readonly LowerHex[]) => void
31
- readonly onFetchTransaction?: (hash: LowerHex) => void
32
- }
33
-
34
- export type GetAccountsTransactionFullsCustomParametersP = {
35
- readonly chain: Chain
36
- readonly addresses: readonly LowerHex[]
37
- readonly fromBlock: bigint
38
- readonly toBlock: bigint
39
- readonly appDataSource: AppDataSource | undefined
40
- readonly priceDataSource: CryptoCurrencyDataSource
41
- readonly fiat: FiatCurrency
42
- readonly decoder: undefined
43
- readonly analyzer: undefined
44
- readonly onFetchHashes?: (hashes: readonly LowerHex[]) => void
45
- readonly onFetchTransaction?: (hash: LowerHex) => void
46
- }
47
-
48
- export type GetAccountsTransactionFullsCustomParametersPD = {
49
- readonly chain: Chain
50
- readonly addresses: readonly LowerHex[]
51
- readonly fromBlock: bigint
52
- readonly toBlock: bigint
53
- readonly appDataSource: AppDataSource | undefined
54
- readonly priceDataSource: CryptoCurrencyDataSource
55
- readonly fiat: FiatCurrency
56
- readonly decoder: Decoder
57
- readonly analyzer: undefined
58
- readonly onFetchHashes?: (hashes: readonly LowerHex[]) => void
59
- readonly onFetchTransaction?: (hash: LowerHex) => void
60
- }
61
-
62
- export type GetAccountsTransactionFullsCustomParametersPDA = {
63
- readonly chain: Chain
64
- readonly addresses: readonly LowerHex[]
65
- readonly fromBlock: bigint
66
- readonly toBlock: bigint
67
- readonly appDataSource: AppDataSource | undefined
68
- readonly priceDataSource: CryptoCurrencyDataSource
69
- readonly fiat: FiatCurrency
70
- readonly decoder: Decoder
71
- readonly analyzer: Analyzer<CryptoCurrencyPrice | undefined>
72
- readonly onFetchHashes?: (hashes: readonly LowerHex[]) => void
73
- readonly onFetchTransaction?: (hash: LowerHex) => void
74
- }
75
-
76
- export type GetAccountsTransactionFullsCustomParametersD = {
77
- readonly chain: Chain
78
- readonly addresses: readonly LowerHex[]
79
- readonly fromBlock: bigint
80
- readonly toBlock: bigint
81
- readonly appDataSource: AppDataSource | undefined
82
- readonly priceDataSource: undefined
83
- readonly fiat: undefined
84
- readonly decoder: Decoder
85
- readonly analyzer: undefined
86
- readonly onFetchHashes?: (hashes: readonly LowerHex[]) => void
87
- readonly onFetchTransaction?: (hash: LowerHex) => void
88
- }
89
-
90
- export type GetAccountsTransactionFullsCustomParametersDA = {
91
- readonly chain: Chain
92
- readonly addresses: readonly LowerHex[]
93
- readonly fromBlock: bigint
94
- readonly toBlock: bigint
95
- readonly appDataSource: AppDataSource | undefined
96
- readonly priceDataSource: undefined
97
- readonly fiat: undefined
98
- readonly decoder: Decoder
99
- readonly analyzer: Analyzer<undefined>
100
- readonly onFetchHashes?: (hashes: readonly LowerHex[]) => void
101
- readonly onFetchTransaction?: (hash: LowerHex) => void
102
- }
103
-
104
- export type GetAccountsTransactionFullsCustomReturnType<
105
- T extends GetAccountsTransactionFullsCustomParameters,
106
- > = T extends GetAccountsTransactionFullsCustomParametersAllUndefined
107
- ? readonly TransactionFull<undefined, false, false>[]
108
- : T extends GetAccountsTransactionFullsCustomParametersP
109
- ? readonly TransactionFull<CryptoCurrencyPrice | undefined, false, false>[]
110
- : T extends GetAccountsTransactionFullsCustomParametersPD
111
- ? readonly TransactionFull<CryptoCurrencyPrice | undefined, true, false>[]
112
- : T extends GetAccountsTransactionFullsCustomParametersPDA
113
- ? readonly TransactionFull<
114
- CryptoCurrencyPrice | undefined,
115
- true,
116
- true
117
- >[]
118
- : T extends GetAccountsTransactionFullsCustomParametersD
119
- ? readonly TransactionFull<undefined, true, false>[]
120
- : T extends GetAccountsTransactionFullsCustomParametersDA
121
- ? readonly TransactionFull<undefined, true, true>[]
122
- : never
@@ -1,80 +0,0 @@
1
- import type { Config } from '@0xtorch/core'
2
- import { toLowerHex } from '../types'
3
- import { getHashesAndInternalTxs } from './getHashesAndInternalTxs'
4
- import { getTransactionDetails } from './getTransactionDetails'
5
- import { getTransactionsApps } from './getTransactionsApps'
6
- import type {
7
- GetAccountsTransactionFullsCustomParametersD,
8
- GetAccountsTransactionFullsCustomReturnType,
9
- } from './types'
10
-
11
- export const getAccountsTransactionFullsCustomWithD = async (
12
- {
13
- chain,
14
- addresses,
15
- fromBlock,
16
- toBlock,
17
- appDataSource,
18
- decoder,
19
- onFetchHashes,
20
- onFetchTransaction,
21
- }: GetAccountsTransactionFullsCustomParametersD,
22
- config?: Config,
23
- ): Promise<
24
- GetAccountsTransactionFullsCustomReturnType<GetAccountsTransactionFullsCustomParametersD>
25
- > => {
26
- const timeoutTimestamp =
27
- Date.now() + (config?.timeout === undefined ? 60_000 : config.timeout)
28
-
29
- // get transaction hash & internal transaction by explorer
30
- const { hashes, internalTransactions } = await getHashesAndInternalTxs(
31
- chain,
32
- addresses,
33
- fromBlock,
34
- toBlock,
35
- config,
36
- )
37
- if (hashes.length === 0) {
38
- return []
39
- }
40
- if (onFetchHashes !== undefined) {
41
- onFetchHashes(hashes.map((hash) => toLowerHex(hash)))
42
- }
43
-
44
- // get transaction detail of hashes
45
- const timeoutForGetTransactionDetail = timeoutTimestamp - Date.now()
46
- const transactionDetails = await getTransactionDetails(
47
- chain,
48
- hashes,
49
- internalTransactions,
50
- onFetchTransaction,
51
- {
52
- timeout: timeoutForGetTransactionDetail,
53
- logger: config?.logger,
54
- },
55
- )
56
-
57
- // decode
58
- const { transactions: transactionsDecoded } = await decoder.decode({
59
- chain,
60
- transactions: transactionDetails,
61
- })
62
-
63
- // get apps
64
- const apps = await getTransactionsApps(appDataSource, transactionDetails, {
65
- timeout: timeoutTimestamp - Date.now(),
66
- logger: config?.logger,
67
- })
68
-
69
- return transactionsDecoded.map((transaction) => {
70
- const lowerTo =
71
- transaction.to === null ? undefined : toLowerHex(transaction.to)
72
- const app = apps.find(({ address }) => address === lowerTo)?.app
73
-
74
- return {
75
- ...transaction,
76
- app,
77
- nativeTokenPrice: undefined,
78
- }
79
- })
80
- }