@0xtorch/evm 0.0.31 → 0.0.33
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/_cjs/decoder/decode.js +1 -0
- package/_cjs/decoder/decode.js.map +1 -1
- package/_cjs/index.js +1 -7
- package/_cjs/index.js.map +1 -1
- package/_esm/decoder/decode.js +1 -0
- package/_esm/decoder/decode.js.map +1 -1
- package/_esm/index.js +0 -2
- package/_esm/index.js.map +1 -1
- package/_types/chains/definitions/arbitrumOne.d.ts +1 -0
- package/_types/chains/definitions/arbitrumOne.d.ts.map +1 -1
- package/_types/chains/definitions/astar.d.ts +1 -0
- package/_types/chains/definitions/astar.d.ts.map +1 -1
- package/_types/chains/definitions/avalancheC.d.ts +1 -0
- package/_types/chains/definitions/avalancheC.d.ts.map +1 -1
- package/_types/chains/definitions/base.d.ts +1 -0
- package/_types/chains/definitions/base.d.ts.map +1 -1
- package/_types/chains/definitions/bsc.d.ts +1 -0
- package/_types/chains/definitions/bsc.d.ts.map +1 -1
- package/_types/chains/definitions/ethereum.d.ts +1 -0
- package/_types/chains/definitions/ethereum.d.ts.map +1 -1
- package/_types/chains/definitions/fantom.d.ts +1 -0
- package/_types/chains/definitions/fantom.d.ts.map +1 -1
- package/_types/chains/definitions/linea.d.ts +1 -0
- package/_types/chains/definitions/linea.d.ts.map +1 -1
- package/_types/chains/definitions/mantle.d.ts +1 -0
- package/_types/chains/definitions/mantle.d.ts.map +1 -1
- package/_types/chains/definitions/metis.d.ts +1 -0
- package/_types/chains/definitions/metis.d.ts.map +1 -1
- package/_types/chains/definitions/moonbeam.d.ts +1 -0
- package/_types/chains/definitions/moonbeam.d.ts.map +1 -1
- package/_types/chains/definitions/moonriver.d.ts +1 -0
- package/_types/chains/definitions/moonriver.d.ts.map +1 -1
- package/_types/chains/definitions/oasys.d.ts +1 -0
- package/_types/chains/definitions/oasys.d.ts.map +1 -1
- package/_types/chains/definitions/optimism.d.ts +1 -0
- package/_types/chains/definitions/optimism.d.ts.map +1 -1
- package/_types/chains/definitions/polygonPos.d.ts +1 -0
- package/_types/chains/definitions/polygonPos.d.ts.map +1 -1
- package/_types/chains/definitions/ronin.d.ts +1 -0
- package/_types/chains/definitions/ronin.d.ts.map +1 -1
- package/_types/decoder/tests.d.ts +1 -0
- package/_types/decoder/tests.d.ts.map +1 -1
- package/_types/explorers/definitions/blockscout.d.ts +4 -0
- package/_types/explorers/definitions/blockscout.d.ts.map +1 -1
- package/_types/explorers/definitions/etherscan.d.ts +4 -0
- package/_types/explorers/definitions/etherscan.d.ts.map +1 -1
- package/_types/explorers/definitions/roninExplorer.d.ts +4 -0
- package/_types/explorers/definitions/roninExplorer.d.ts.map +1 -1
- package/_types/index.d.ts +0 -2
- package/_types/index.d.ts.map +1 -1
- package/decoder/decode.ts +1 -0
- package/index.ts +0 -8
- package/package.json +2 -2
- package/_cjs/getAccountsTransactionFulls/getAccountsTransactionFulls.js +0 -22
- package/_cjs/getAccountsTransactionFulls/getAccountsTransactionFulls.js.map +0 -1
- package/_cjs/getAccountsTransactionFulls/getAccountsTransactionFullsCustom.js +0 -52
- package/_cjs/getAccountsTransactionFulls/getAccountsTransactionFullsCustom.js.map +0 -1
- package/_cjs/getAccountsTransactionFulls/getDecodedTransactionsPrices.js +0 -55
- package/_cjs/getAccountsTransactionFulls/getDecodedTransactionsPrices.js.map +0 -1
- package/_cjs/getAccountsTransactionFulls/getHashesAndInternalTxs.js +0 -49
- package/_cjs/getAccountsTransactionFulls/getHashesAndInternalTxs.js.map +0 -1
- package/_cjs/getAccountsTransactionFulls/getTransactionDetails.js +0 -28
- package/_cjs/getAccountsTransactionFulls/getTransactionDetails.js.map +0 -1
- package/_cjs/getAccountsTransactionFulls/getTransactionsApps.js +0 -24
- package/_cjs/getAccountsTransactionFulls/getTransactionsApps.js.map +0 -1
- package/_cjs/getAccountsTransactionFulls/index.js +0 -8
- package/_cjs/getAccountsTransactionFulls/index.js.map +0 -1
- package/_cjs/getAccountsTransactionFulls/types.js +0 -3
- package/_cjs/getAccountsTransactionFulls/types.js.map +0 -1
- package/_cjs/getAccountsTransactionFulls/withD.js +0 -41
- package/_cjs/getAccountsTransactionFulls/withD.js.map +0 -1
- package/_cjs/getAccountsTransactionFulls/withDA.js +0 -59
- package/_cjs/getAccountsTransactionFulls/withDA.js.map +0 -1
- package/_cjs/getAccountsTransactionFulls/withP.js +0 -61
- package/_cjs/getAccountsTransactionFulls/withP.js.map +0 -1
- package/_cjs/getAccountsTransactionFulls/withPD.js +0 -73
- package/_cjs/getAccountsTransactionFulls/withPD.js.map +0 -1
- package/_cjs/getAccountsTransactionFulls/withPDA.js +0 -89
- package/_cjs/getAccountsTransactionFulls/withPDA.js.map +0 -1
- package/_cjs/getAccountsTransactionFulls/withUndefined.js +0 -46
- package/_cjs/getAccountsTransactionFulls/withUndefined.js.map +0 -1
- package/_cjs/getTransactionFull/getTransactionFull.js +0 -18
- package/_cjs/getTransactionFull/getTransactionFull.js.map +0 -1
- package/_cjs/getTransactionFull/getTransactionFullCustom.js +0 -52
- package/_cjs/getTransactionFull/getTransactionFullCustom.js.map +0 -1
- package/_cjs/getTransactionFull/index.js +0 -8
- package/_cjs/getTransactionFull/index.js.map +0 -1
- package/_cjs/getTransactionFull/types.js +0 -3
- package/_cjs/getTransactionFull/types.js.map +0 -1
- package/_cjs/getTransactionFull/withD.js +0 -34
- package/_cjs/getTransactionFull/withD.js.map +0 -1
- package/_cjs/getTransactionFull/withDA.js +0 -48
- package/_cjs/getTransactionFull/withDA.js.map +0 -1
- package/_cjs/getTransactionFull/withP.js +0 -46
- package/_cjs/getTransactionFull/withP.js.map +0 -1
- package/_cjs/getTransactionFull/withPD.js +0 -78
- package/_cjs/getTransactionFull/withPD.js.map +0 -1
- package/_cjs/getTransactionFull/withPDA.js +0 -92
- package/_cjs/getTransactionFull/withPDA.js.map +0 -1
- package/_cjs/getTransactionFull/withUndefined.js +0 -29
- package/_cjs/getTransactionFull/withUndefined.js.map +0 -1
- package/_esm/getAccountsTransactionFulls/getAccountsTransactionFulls.js +0 -18
- package/_esm/getAccountsTransactionFulls/getAccountsTransactionFulls.js.map +0 -1
- package/_esm/getAccountsTransactionFulls/getAccountsTransactionFullsCustom.js +0 -48
- package/_esm/getAccountsTransactionFulls/getAccountsTransactionFullsCustom.js.map +0 -1
- package/_esm/getAccountsTransactionFulls/getDecodedTransactionsPrices.js +0 -55
- package/_esm/getAccountsTransactionFulls/getDecodedTransactionsPrices.js.map +0 -1
- package/_esm/getAccountsTransactionFulls/getHashesAndInternalTxs.js +0 -45
- package/_esm/getAccountsTransactionFulls/getHashesAndInternalTxs.js.map +0 -1
- package/_esm/getAccountsTransactionFulls/getTransactionDetails.js +0 -24
- package/_esm/getAccountsTransactionFulls/getTransactionDetails.js.map +0 -1
- package/_esm/getAccountsTransactionFulls/getTransactionsApps.js +0 -21
- package/_esm/getAccountsTransactionFulls/getTransactionsApps.js.map +0 -1
- package/_esm/getAccountsTransactionFulls/index.js +0 -3
- package/_esm/getAccountsTransactionFulls/index.js.map +0 -1
- package/_esm/getAccountsTransactionFulls/types.js +0 -2
- package/_esm/getAccountsTransactionFulls/types.js.map +0 -1
- package/_esm/getAccountsTransactionFulls/withD.js +0 -41
- package/_esm/getAccountsTransactionFulls/withD.js.map +0 -1
- package/_esm/getAccountsTransactionFulls/withDA.js +0 -60
- package/_esm/getAccountsTransactionFulls/withDA.js.map +0 -1
- package/_esm/getAccountsTransactionFulls/withP.js +0 -62
- package/_esm/getAccountsTransactionFulls/withP.js.map +0 -1
- package/_esm/getAccountsTransactionFulls/withPD.js +0 -74
- package/_esm/getAccountsTransactionFulls/withPD.js.map +0 -1
- package/_esm/getAccountsTransactionFulls/withPDA.js +0 -91
- package/_esm/getAccountsTransactionFulls/withPDA.js.map +0 -1
- package/_esm/getAccountsTransactionFulls/withUndefined.js +0 -45
- package/_esm/getAccountsTransactionFulls/withUndefined.js.map +0 -1
- package/_esm/getTransactionFull/getTransactionFull.js +0 -14
- package/_esm/getTransactionFull/getTransactionFull.js.map +0 -1
- package/_esm/getTransactionFull/getTransactionFullCustom.js +0 -48
- package/_esm/getTransactionFull/getTransactionFullCustom.js.map +0 -1
- package/_esm/getTransactionFull/index.js +0 -3
- package/_esm/getTransactionFull/index.js.map +0 -1
- package/_esm/getTransactionFull/types.js +0 -2
- package/_esm/getTransactionFull/types.js.map +0 -1
- package/_esm/getTransactionFull/withD.js +0 -33
- package/_esm/getTransactionFull/withD.js.map +0 -1
- package/_esm/getTransactionFull/withDA.js +0 -48
- package/_esm/getTransactionFull/withDA.js.map +0 -1
- package/_esm/getTransactionFull/withP.js +0 -45
- package/_esm/getTransactionFull/withP.js.map +0 -1
- package/_esm/getTransactionFull/withPD.js +0 -78
- package/_esm/getTransactionFull/withPD.js.map +0 -1
- package/_esm/getTransactionFull/withPDA.js +0 -94
- package/_esm/getTransactionFull/withPDA.js.map +0 -1
- package/_esm/getTransactionFull/withUndefined.js +0 -25
- package/_esm/getTransactionFull/withUndefined.js.map +0 -1
- package/_types/getAccountsTransactionFulls/getAccountsTransactionFulls.d.ts +0 -23
- package/_types/getAccountsTransactionFulls/getAccountsTransactionFulls.d.ts.map +0 -1
- package/_types/getAccountsTransactionFulls/getAccountsTransactionFullsCustom.d.ts +0 -4
- package/_types/getAccountsTransactionFulls/getAccountsTransactionFullsCustom.d.ts.map +0 -1
- package/_types/getAccountsTransactionFulls/getDecodedTransactionsPrices.d.ts +0 -5
- package/_types/getAccountsTransactionFulls/getDecodedTransactionsPrices.d.ts.map +0 -1
- package/_types/getAccountsTransactionFulls/getHashesAndInternalTxs.d.ts +0 -8
- package/_types/getAccountsTransactionFulls/getHashesAndInternalTxs.d.ts.map +0 -1
- package/_types/getAccountsTransactionFulls/getTransactionDetails.d.ts +0 -5
- package/_types/getAccountsTransactionFulls/getTransactionDetails.d.ts.map +0 -1
- package/_types/getAccountsTransactionFulls/getTransactionsApps.d.ts +0 -8
- package/_types/getAccountsTransactionFulls/getTransactionsApps.d.ts.map +0 -1
- package/_types/getAccountsTransactionFulls/index.d.ts +0 -3
- package/_types/getAccountsTransactionFulls/index.d.ts.map +0 -1
- package/_types/getAccountsTransactionFulls/types.d.ts +0 -87
- package/_types/getAccountsTransactionFulls/types.d.ts.map +0 -1
- package/_types/getAccountsTransactionFulls/withD.d.ts +0 -4
- package/_types/getAccountsTransactionFulls/withD.d.ts.map +0 -1
- package/_types/getAccountsTransactionFulls/withDA.d.ts +0 -4
- package/_types/getAccountsTransactionFulls/withDA.d.ts.map +0 -1
- package/_types/getAccountsTransactionFulls/withP.d.ts +0 -4
- package/_types/getAccountsTransactionFulls/withP.d.ts.map +0 -1
- package/_types/getAccountsTransactionFulls/withPD.d.ts +0 -4
- package/_types/getAccountsTransactionFulls/withPD.d.ts.map +0 -1
- package/_types/getAccountsTransactionFulls/withPDA.d.ts +0 -4
- package/_types/getAccountsTransactionFulls/withPDA.d.ts.map +0 -1
- package/_types/getAccountsTransactionFulls/withUndefined.d.ts +0 -4
- package/_types/getAccountsTransactionFulls/withUndefined.d.ts.map +0 -1
- package/_types/getTransactionFull/getTransactionFull.d.ts +0 -19
- package/_types/getTransactionFull/getTransactionFull.d.ts.map +0 -1
- package/_types/getTransactionFull/getTransactionFullCustom.d.ts +0 -4
- package/_types/getTransactionFull/getTransactionFullCustom.d.ts.map +0 -1
- package/_types/getTransactionFull/index.d.ts +0 -3
- package/_types/getTransactionFull/index.d.ts.map +0 -1
- package/_types/getTransactionFull/types.d.ts +0 -63
- package/_types/getTransactionFull/types.d.ts.map +0 -1
- package/_types/getTransactionFull/withD.d.ts +0 -4
- package/_types/getTransactionFull/withD.d.ts.map +0 -1
- package/_types/getTransactionFull/withDA.d.ts +0 -4
- package/_types/getTransactionFull/withDA.d.ts.map +0 -1
- package/_types/getTransactionFull/withP.d.ts +0 -4
- package/_types/getTransactionFull/withP.d.ts.map +0 -1
- package/_types/getTransactionFull/withPD.d.ts +0 -4
- package/_types/getTransactionFull/withPD.d.ts.map +0 -1
- package/_types/getTransactionFull/withPDA.d.ts +0 -4
- package/_types/getTransactionFull/withPDA.d.ts.map +0 -1
- package/_types/getTransactionFull/withUndefined.d.ts +0 -4
- package/_types/getTransactionFull/withUndefined.d.ts.map +0 -1
- package/getAccountsTransactionFulls/getAccountsTransactionFulls.ts +0 -46
- package/getAccountsTransactionFulls/getAccountsTransactionFullsCustom.ts +0 -106
- package/getAccountsTransactionFulls/getDecodedTransactionsPrices.ts +0 -97
- package/getAccountsTransactionFulls/getHashesAndInternalTxs.ts +0 -65
- package/getAccountsTransactionFulls/getTransactionDetails.ts +0 -41
- package/getAccountsTransactionFulls/getTransactionsApps.ts +0 -42
- package/getAccountsTransactionFulls/index.ts +0 -2
- package/getAccountsTransactionFulls/types.ts +0 -122
- package/getAccountsTransactionFulls/withD.ts +0 -80
- package/getAccountsTransactionFulls/withDA.ts +0 -112
- package/getAccountsTransactionFulls/withP.ts +0 -120
- package/getAccountsTransactionFulls/withPD.ts +0 -141
- package/getAccountsTransactionFulls/withPDA.ts +0 -167
- package/getAccountsTransactionFulls/withUndefined.ts +0 -88
- package/getTransactionFull/getTransactionFull.ts +0 -30
- package/getTransactionFull/getTransactionFullCustom.ts +0 -91
- package/getTransactionFull/index.ts +0 -2
- package/getTransactionFull/types.ts +0 -98
- package/getTransactionFull/withD.ts +0 -57
- package/getTransactionFull/withDA.ts +0 -78
- package/getTransactionFull/withP.ts +0 -69
- package/getTransactionFull/withPD.ts +0 -119
- package/getTransactionFull/withPDA.ts +0 -147
- package/getTransactionFull/withUndefined.ts +0 -39
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import type { Config } from '@0xtorch/core'
|
|
2
|
-
import type {
|
|
3
|
-
GetTransactionFullCustomParameters,
|
|
4
|
-
GetTransactionFullCustomParametersAllUndefined,
|
|
5
|
-
GetTransactionFullCustomParametersD,
|
|
6
|
-
GetTransactionFullCustomParametersDA,
|
|
7
|
-
GetTransactionFullCustomParametersP,
|
|
8
|
-
GetTransactionFullCustomParametersPD,
|
|
9
|
-
GetTransactionFullCustomParametersPDA,
|
|
10
|
-
GetTransactionFullCustomReturnType,
|
|
11
|
-
} from './types'
|
|
12
|
-
import { getTransactionFullCustomWithD } from './withD'
|
|
13
|
-
import { getTransactionFullCustomWithDA } from './withDA'
|
|
14
|
-
import { getTransactionFullCustomWithP } from './withP'
|
|
15
|
-
import { getTransactionFullCustomWithPD } from './withPD'
|
|
16
|
-
import { getTransactionFullCustomWithPDA } from './withPDA'
|
|
17
|
-
import { getTransactionFullCustomWithAllUndefined } from './withUndefined'
|
|
18
|
-
|
|
19
|
-
export const getTransactionFullCustom = async <
|
|
20
|
-
T extends GetTransactionFullCustomParameters,
|
|
21
|
-
>(
|
|
22
|
-
parameters: T,
|
|
23
|
-
config?: Config,
|
|
24
|
-
): Promise<GetTransactionFullCustomReturnType<T>> => {
|
|
25
|
-
if (isParametersAllUndefined(parameters)) {
|
|
26
|
-
const data = await getTransactionFullCustomWithAllUndefined(
|
|
27
|
-
parameters,
|
|
28
|
-
config,
|
|
29
|
-
)
|
|
30
|
-
return data as GetTransactionFullCustomReturnType<T>
|
|
31
|
-
}
|
|
32
|
-
if (isParametersP(parameters)) {
|
|
33
|
-
const data = await getTransactionFullCustomWithP(parameters, config)
|
|
34
|
-
return data as GetTransactionFullCustomReturnType<T>
|
|
35
|
-
}
|
|
36
|
-
if (isParametersPD(parameters)) {
|
|
37
|
-
const data = await getTransactionFullCustomWithPD(parameters, config)
|
|
38
|
-
return data as GetTransactionFullCustomReturnType<T>
|
|
39
|
-
}
|
|
40
|
-
if (isParametersPDA(parameters)) {
|
|
41
|
-
const data = await getTransactionFullCustomWithPDA(parameters, config)
|
|
42
|
-
return data as GetTransactionFullCustomReturnType<T>
|
|
43
|
-
}
|
|
44
|
-
if (isParametersD(parameters)) {
|
|
45
|
-
const data = await getTransactionFullCustomWithD(parameters, config)
|
|
46
|
-
return data as GetTransactionFullCustomReturnType<T>
|
|
47
|
-
}
|
|
48
|
-
if (isParametersDA(parameters)) {
|
|
49
|
-
const data = await getTransactionFullCustomWithDA(parameters, config)
|
|
50
|
-
return data as GetTransactionFullCustomReturnType<T>
|
|
51
|
-
}
|
|
52
|
-
throw new Error('not implemented')
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const isParametersAllUndefined = (
|
|
56
|
-
parameters: GetTransactionFullCustomParameters,
|
|
57
|
-
): parameters is GetTransactionFullCustomParametersAllUndefined =>
|
|
58
|
-
parameters.priceDataSource === undefined && parameters.decoder === undefined
|
|
59
|
-
|
|
60
|
-
const isParametersP = (
|
|
61
|
-
parameters: GetTransactionFullCustomParameters,
|
|
62
|
-
): parameters is GetTransactionFullCustomParametersP =>
|
|
63
|
-
parameters.priceDataSource !== undefined && parameters.decoder === undefined
|
|
64
|
-
|
|
65
|
-
const isParametersPD = (
|
|
66
|
-
parameters: GetTransactionFullCustomParameters,
|
|
67
|
-
): parameters is GetTransactionFullCustomParametersPD =>
|
|
68
|
-
parameters.priceDataSource !== undefined &&
|
|
69
|
-
parameters.decoder !== undefined &&
|
|
70
|
-
parameters.analyzer === undefined
|
|
71
|
-
|
|
72
|
-
const isParametersPDA = (
|
|
73
|
-
parameters: GetTransactionFullCustomParameters,
|
|
74
|
-
): parameters is GetTransactionFullCustomParametersPDA =>
|
|
75
|
-
parameters.priceDataSource !== undefined &&
|
|
76
|
-
parameters.decoder !== undefined &&
|
|
77
|
-
parameters.analyzer !== undefined
|
|
78
|
-
|
|
79
|
-
const isParametersD = (
|
|
80
|
-
parameters: GetTransactionFullCustomParameters,
|
|
81
|
-
): parameters is GetTransactionFullCustomParametersD =>
|
|
82
|
-
parameters.priceDataSource === undefined &&
|
|
83
|
-
parameters.decoder !== undefined &&
|
|
84
|
-
parameters.analyzer === undefined
|
|
85
|
-
|
|
86
|
-
const isParametersDA = (
|
|
87
|
-
parameters: GetTransactionFullCustomParameters,
|
|
88
|
-
): parameters is GetTransactionFullCustomParametersDA =>
|
|
89
|
-
parameters.priceDataSource === undefined &&
|
|
90
|
-
parameters.decoder !== undefined &&
|
|
91
|
-
parameters.analyzer !== undefined
|
|
@@ -1,98 +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 { Hex, TransactionFull } from '../types'
|
|
11
|
-
|
|
12
|
-
export type GetTransactionFullCustomParameters =
|
|
13
|
-
| GetTransactionFullCustomParametersAllUndefined
|
|
14
|
-
| GetTransactionFullCustomParametersP
|
|
15
|
-
| GetTransactionFullCustomParametersPD
|
|
16
|
-
| GetTransactionFullCustomParametersPDA
|
|
17
|
-
| GetTransactionFullCustomParametersD
|
|
18
|
-
| GetTransactionFullCustomParametersDA
|
|
19
|
-
|
|
20
|
-
export type GetTransactionFullCustomParametersAllUndefined = {
|
|
21
|
-
readonly chain: Chain
|
|
22
|
-
readonly hash: Hex
|
|
23
|
-
readonly appDataSource: AppDataSource | undefined
|
|
24
|
-
readonly priceDataSource: undefined
|
|
25
|
-
readonly fiat: undefined
|
|
26
|
-
readonly decoder: undefined
|
|
27
|
-
readonly analyzer: undefined
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type GetTransactionFullCustomParametersP = {
|
|
31
|
-
readonly chain: Chain
|
|
32
|
-
readonly hash: Hex
|
|
33
|
-
readonly appDataSource: AppDataSource | undefined
|
|
34
|
-
readonly priceDataSource: CryptoCurrencyDataSource
|
|
35
|
-
readonly fiat: FiatCurrency
|
|
36
|
-
readonly decoder: undefined
|
|
37
|
-
readonly analyzer: undefined
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export type GetTransactionFullCustomParametersPD = {
|
|
41
|
-
readonly chain: Chain
|
|
42
|
-
readonly hash: Hex
|
|
43
|
-
readonly appDataSource: AppDataSource | undefined
|
|
44
|
-
readonly priceDataSource: CryptoCurrencyDataSource
|
|
45
|
-
readonly fiat: FiatCurrency
|
|
46
|
-
readonly decoder: Decoder
|
|
47
|
-
readonly analyzer: undefined
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export type GetTransactionFullCustomParametersPDA = {
|
|
51
|
-
readonly chain: Chain
|
|
52
|
-
readonly hash: Hex
|
|
53
|
-
readonly appDataSource: AppDataSource | undefined
|
|
54
|
-
readonly priceDataSource: CryptoCurrencyDataSource
|
|
55
|
-
readonly fiat: FiatCurrency
|
|
56
|
-
readonly decoder: Decoder
|
|
57
|
-
readonly analyzer: Analyzer<CryptoCurrencyPrice | undefined>
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export type GetTransactionFullCustomParametersD = {
|
|
61
|
-
readonly chain: Chain
|
|
62
|
-
readonly hash: Hex
|
|
63
|
-
readonly appDataSource: AppDataSource | undefined
|
|
64
|
-
readonly priceDataSource: undefined
|
|
65
|
-
readonly fiat: undefined
|
|
66
|
-
readonly decoder: Decoder
|
|
67
|
-
readonly analyzer: undefined
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export type GetTransactionFullCustomParametersDA = {
|
|
71
|
-
readonly chain: Chain
|
|
72
|
-
readonly hash: Hex
|
|
73
|
-
readonly appDataSource: AppDataSource | undefined
|
|
74
|
-
readonly priceDataSource: undefined
|
|
75
|
-
readonly fiat: undefined
|
|
76
|
-
readonly decoder: Decoder
|
|
77
|
-
readonly analyzer: Analyzer<undefined>
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export type GetTransactionFullCustomReturnType<
|
|
81
|
-
T extends GetTransactionFullCustomParameters,
|
|
82
|
-
> = T extends GetTransactionFullCustomParametersAllUndefined
|
|
83
|
-
? TransactionFull<undefined, false, false> | undefined
|
|
84
|
-
: T extends GetTransactionFullCustomParametersP
|
|
85
|
-
? TransactionFull<CryptoCurrencyPrice | undefined, false, false> | undefined
|
|
86
|
-
: T extends GetTransactionFullCustomParametersPD
|
|
87
|
-
?
|
|
88
|
-
| TransactionFull<CryptoCurrencyPrice | undefined, true, false>
|
|
89
|
-
| undefined
|
|
90
|
-
: T extends GetTransactionFullCustomParametersPDA
|
|
91
|
-
?
|
|
92
|
-
| TransactionFull<CryptoCurrencyPrice | undefined, true, true>
|
|
93
|
-
| undefined
|
|
94
|
-
: T extends GetTransactionFullCustomParametersD
|
|
95
|
-
? TransactionFull<undefined, true, false> | undefined
|
|
96
|
-
: T extends GetTransactionFullCustomParametersDA
|
|
97
|
-
? TransactionFull<undefined, true, true> | undefined
|
|
98
|
-
: never
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { Config } from '@0xtorch/core'
|
|
2
|
-
import { getTransactionDetail } from '../getTransactionDetail'
|
|
3
|
-
import { toLowerHex } from '../types'
|
|
4
|
-
import type {
|
|
5
|
-
GetTransactionFullCustomParametersD,
|
|
6
|
-
GetTransactionFullCustomReturnType,
|
|
7
|
-
} from './types'
|
|
8
|
-
|
|
9
|
-
export const getTransactionFullCustomWithD = async (
|
|
10
|
-
parameters: GetTransactionFullCustomParametersD,
|
|
11
|
-
config?: Config,
|
|
12
|
-
): Promise<
|
|
13
|
-
GetTransactionFullCustomReturnType<GetTransactionFullCustomParametersD>
|
|
14
|
-
> => {
|
|
15
|
-
const timeoutTimestamp =
|
|
16
|
-
Date.now() + (config?.timeout === undefined ? 60_000 : config.timeout)
|
|
17
|
-
|
|
18
|
-
const { chain, hash, appDataSource, decoder } = parameters
|
|
19
|
-
|
|
20
|
-
// get transaction detail
|
|
21
|
-
const transactionDetail = await getTransactionDetail({ chain, hash }, config)
|
|
22
|
-
if (transactionDetail === undefined) {
|
|
23
|
-
return undefined
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// decode
|
|
27
|
-
const decodedData = await decoder.decode(
|
|
28
|
-
{
|
|
29
|
-
chain,
|
|
30
|
-
transactions: [transactionDetail],
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
timeout: timeoutTimestamp - Date.now(),
|
|
34
|
-
logger: config?.logger,
|
|
35
|
-
},
|
|
36
|
-
)
|
|
37
|
-
const transactionDecoded = decodedData.transactions[0]
|
|
38
|
-
|
|
39
|
-
// get app from data source
|
|
40
|
-
const app =
|
|
41
|
-
appDataSource === undefined || transactionDecoded.to === null
|
|
42
|
-
? undefined
|
|
43
|
-
: await appDataSource.getApp(
|
|
44
|
-
chain.id,
|
|
45
|
-
toLowerHex(transactionDecoded.to),
|
|
46
|
-
{
|
|
47
|
-
timeout: timeoutTimestamp - Date.now(),
|
|
48
|
-
logger: config?.logger,
|
|
49
|
-
},
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
return {
|
|
53
|
-
...transactionDecoded,
|
|
54
|
-
app,
|
|
55
|
-
nativeTokenPrice: undefined,
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/* eslint-disable unicorn/filename-case */
|
|
2
|
-
import type { Config } from '@0xtorch/core'
|
|
3
|
-
import { getTransactionDetail } from '../getTransactionDetail'
|
|
4
|
-
import { toLowerHex } from '../types'
|
|
5
|
-
import type {
|
|
6
|
-
GetTransactionFullCustomParametersDA,
|
|
7
|
-
GetTransactionFullCustomReturnType,
|
|
8
|
-
} from './types'
|
|
9
|
-
|
|
10
|
-
export const getTransactionFullCustomWithDA = async (
|
|
11
|
-
parameters: GetTransactionFullCustomParametersDA,
|
|
12
|
-
config?: Config,
|
|
13
|
-
): Promise<
|
|
14
|
-
GetTransactionFullCustomReturnType<GetTransactionFullCustomParametersDA>
|
|
15
|
-
> => {
|
|
16
|
-
const timeoutTimestamp =
|
|
17
|
-
Date.now() + (config?.timeout === undefined ? 60_000 : config.timeout)
|
|
18
|
-
|
|
19
|
-
const { chain, hash, appDataSource, decoder, analyzer } = parameters
|
|
20
|
-
|
|
21
|
-
// get transaction detail
|
|
22
|
-
const transactionDetail = await getTransactionDetail({ chain, hash }, config)
|
|
23
|
-
if (transactionDetail === undefined) {
|
|
24
|
-
return undefined
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// decode
|
|
28
|
-
const decodedData = await decoder.decode(
|
|
29
|
-
{
|
|
30
|
-
chain,
|
|
31
|
-
transactions: [transactionDetail],
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
timeout: timeoutTimestamp - Date.now(),
|
|
35
|
-
logger: config?.logger,
|
|
36
|
-
},
|
|
37
|
-
)
|
|
38
|
-
const transactionDecoded = decodedData.transactions[0]
|
|
39
|
-
|
|
40
|
-
// get app from data sourc
|
|
41
|
-
const app =
|
|
42
|
-
appDataSource === undefined || transactionDecoded.to === null
|
|
43
|
-
? undefined
|
|
44
|
-
: await appDataSource.getApp(
|
|
45
|
-
chain.id,
|
|
46
|
-
toLowerHex(transactionDecoded.to),
|
|
47
|
-
{
|
|
48
|
-
timeout: timeoutTimestamp - Date.now(),
|
|
49
|
-
logger: config?.logger,
|
|
50
|
-
},
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
const transactionForAnalyzer = {
|
|
54
|
-
...transactionDecoded,
|
|
55
|
-
app,
|
|
56
|
-
nativeTokenPrice: undefined,
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// analyze
|
|
60
|
-
const { actions, accountActions } = await analyzer.analyze(
|
|
61
|
-
{
|
|
62
|
-
chain,
|
|
63
|
-
transaction: transactionForAnalyzer,
|
|
64
|
-
accountAddresses: [],
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
timeout: timeoutTimestamp - Date.now(),
|
|
68
|
-
logger: config?.logger,
|
|
69
|
-
},
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
return {
|
|
73
|
-
...transactionForAnalyzer,
|
|
74
|
-
accountAddresses: [],
|
|
75
|
-
actions,
|
|
76
|
-
accountActions,
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { Config, CryptoCurrencyPrice } from '@0xtorch/core'
|
|
2
|
-
import { getTransactionDetail } from '../getTransactionDetail'
|
|
3
|
-
import { toLowerHex } from '../types'
|
|
4
|
-
import type {
|
|
5
|
-
GetTransactionFullCustomParametersP,
|
|
6
|
-
GetTransactionFullCustomReturnType,
|
|
7
|
-
} from './types'
|
|
8
|
-
|
|
9
|
-
export const getTransactionFullCustomWithP = async (
|
|
10
|
-
parameters: GetTransactionFullCustomParametersP,
|
|
11
|
-
config?: Config,
|
|
12
|
-
): Promise<
|
|
13
|
-
GetTransactionFullCustomReturnType<GetTransactionFullCustomParametersP>
|
|
14
|
-
> => {
|
|
15
|
-
const timeoutTimestamp =
|
|
16
|
-
Date.now() + (config?.timeout === undefined ? 60_000 : config.timeout)
|
|
17
|
-
|
|
18
|
-
const { chain, hash, appDataSource, priceDataSource, fiat } = parameters
|
|
19
|
-
|
|
20
|
-
// get transaction detail
|
|
21
|
-
const transactionDetail = await getTransactionDetail({ chain, hash }, config)
|
|
22
|
-
if (transactionDetail === undefined) {
|
|
23
|
-
return undefined
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const timestampMs = Number(transactionDetail.block.timestamp) * 1000
|
|
27
|
-
const from = timestampMs - 1000 * 60 * 60
|
|
28
|
-
const to = timestampMs + 1000 * 60 * 60
|
|
29
|
-
|
|
30
|
-
const timeoutForDataSources = timeoutTimestamp - Date.now()
|
|
31
|
-
const [app, prices] = await Promise.all([
|
|
32
|
-
// get app
|
|
33
|
-
appDataSource === undefined || transactionDetail.to === null
|
|
34
|
-
? undefined
|
|
35
|
-
: appDataSource.getApp(chain.id, toLowerHex(transactionDetail.to), {
|
|
36
|
-
timeout: timeoutForDataSources,
|
|
37
|
-
logger: config?.logger,
|
|
38
|
-
}),
|
|
39
|
-
// get native token prices
|
|
40
|
-
priceDataSource.getHistoricalPrices(
|
|
41
|
-
{
|
|
42
|
-
targetCurrencies: [chain.nativeToken.currency],
|
|
43
|
-
vsCurrency: fiat,
|
|
44
|
-
from,
|
|
45
|
-
to,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
timeout: timeoutForDataSources,
|
|
49
|
-
logger: config?.logger,
|
|
50
|
-
},
|
|
51
|
-
),
|
|
52
|
-
])
|
|
53
|
-
|
|
54
|
-
const closestPrice = prices.reduce(
|
|
55
|
-
(closestPrice: CryptoCurrencyPrice | undefined, price) =>
|
|
56
|
-
closestPrice === undefined ||
|
|
57
|
-
Math.abs(price.timestamp - timestampMs) <
|
|
58
|
-
Math.abs(closestPrice.timestamp - timestampMs)
|
|
59
|
-
? price
|
|
60
|
-
: closestPrice,
|
|
61
|
-
undefined,
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
return {
|
|
65
|
-
...transactionDetail,
|
|
66
|
-
app,
|
|
67
|
-
nativeTokenPrice: closestPrice,
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/* eslint-disable unicorn/filename-case */
|
|
2
|
-
import type { Config, CryptoCurrency, CryptoCurrencyPrice } from '@0xtorch/core'
|
|
3
|
-
import { getTransactionDetail } from '../getTransactionDetail'
|
|
4
|
-
import { toLowerHex } from '../types'
|
|
5
|
-
import type {
|
|
6
|
-
GetTransactionFullCustomParametersPD,
|
|
7
|
-
GetTransactionFullCustomReturnType,
|
|
8
|
-
} from './types'
|
|
9
|
-
|
|
10
|
-
export const getTransactionFullCustomWithPD = async (
|
|
11
|
-
parameters: GetTransactionFullCustomParametersPD,
|
|
12
|
-
config?: Config,
|
|
13
|
-
): Promise<
|
|
14
|
-
GetTransactionFullCustomReturnType<GetTransactionFullCustomParametersPD>
|
|
15
|
-
> => {
|
|
16
|
-
const timeoutTimestamp =
|
|
17
|
-
Date.now() + (config?.timeout === undefined ? 60_000 : config.timeout)
|
|
18
|
-
|
|
19
|
-
const { chain, hash, appDataSource, priceDataSource, fiat, decoder } =
|
|
20
|
-
parameters
|
|
21
|
-
|
|
22
|
-
// get transaction detail
|
|
23
|
-
const transactionDetail = await getTransactionDetail({ chain, hash }, config)
|
|
24
|
-
if (transactionDetail === undefined) {
|
|
25
|
-
return undefined
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// decode
|
|
29
|
-
const decodedData = await decoder.decode(
|
|
30
|
-
{
|
|
31
|
-
chain,
|
|
32
|
-
transactions: [transactionDetail],
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
timeout: timeoutTimestamp - Date.now(),
|
|
36
|
-
logger: config?.logger,
|
|
37
|
-
},
|
|
38
|
-
)
|
|
39
|
-
const transactionDecoded = decodedData.transactions[0]
|
|
40
|
-
|
|
41
|
-
const mut_currencies: CryptoCurrency[] = [chain.nativeToken.currency]
|
|
42
|
-
for (const { token } of transactionDecoded.erc20Transfers) {
|
|
43
|
-
if (token.currency.market.coingeckoId === undefined) {
|
|
44
|
-
continue
|
|
45
|
-
}
|
|
46
|
-
if (mut_currencies.some((currency) => currency.id === token.currency.id)) {
|
|
47
|
-
continue
|
|
48
|
-
}
|
|
49
|
-
mut_currencies.push(token.currency)
|
|
50
|
-
}
|
|
51
|
-
const currencies = mut_currencies
|
|
52
|
-
|
|
53
|
-
const timestampMs = Number(transactionDecoded.block.timestamp) * 1000
|
|
54
|
-
const from = timestampMs - 1000 * 60 * 60
|
|
55
|
-
const to = timestampMs + 1000 * 60 * 60
|
|
56
|
-
|
|
57
|
-
const timeoutForDataSources = timeoutTimestamp - Date.now()
|
|
58
|
-
const [app, prices] = await Promise.all([
|
|
59
|
-
// get app
|
|
60
|
-
appDataSource === undefined || transactionDecoded.to === null
|
|
61
|
-
? undefined
|
|
62
|
-
: appDataSource.getApp(chain.id, toLowerHex(transactionDecoded.to), {
|
|
63
|
-
timeout: timeoutForDataSources,
|
|
64
|
-
logger: config?.logger,
|
|
65
|
-
}),
|
|
66
|
-
// get native token prices
|
|
67
|
-
priceDataSource.getHistoricalPrices(
|
|
68
|
-
{
|
|
69
|
-
targetCurrencies: currencies,
|
|
70
|
-
vsCurrency: fiat,
|
|
71
|
-
from,
|
|
72
|
-
to,
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
timeout: timeoutForDataSources,
|
|
76
|
-
logger: config?.logger,
|
|
77
|
-
},
|
|
78
|
-
),
|
|
79
|
-
])
|
|
80
|
-
|
|
81
|
-
const closestPrices = currencies.map((currency) =>
|
|
82
|
-
prices
|
|
83
|
-
.filter((price) => price.cryptoCurrencyId === currency.id)
|
|
84
|
-
.reduce(
|
|
85
|
-
(closestPrice: CryptoCurrencyPrice | undefined, price) =>
|
|
86
|
-
closestPrice === undefined ||
|
|
87
|
-
Math.abs(price.timestamp - timestampMs) <
|
|
88
|
-
Math.abs(closestPrice.timestamp - timestampMs)
|
|
89
|
-
? price
|
|
90
|
-
: closestPrice,
|
|
91
|
-
undefined,
|
|
92
|
-
),
|
|
93
|
-
)
|
|
94
|
-
const nativeTokenPrice = closestPrices.find(
|
|
95
|
-
(price) =>
|
|
96
|
-
price !== undefined &&
|
|
97
|
-
price.cryptoCurrencyId === chain.nativeToken.currency.id,
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
return {
|
|
101
|
-
...transactionDecoded,
|
|
102
|
-
app,
|
|
103
|
-
nativeTokenPrice,
|
|
104
|
-
internalTransactions: transactionDecoded.internalTransactions.map(
|
|
105
|
-
(internalTransaction) => ({
|
|
106
|
-
...internalTransaction,
|
|
107
|
-
price: nativeTokenPrice,
|
|
108
|
-
}),
|
|
109
|
-
),
|
|
110
|
-
erc20Transfers: transactionDecoded.erc20Transfers.map((transfer) => ({
|
|
111
|
-
...transfer,
|
|
112
|
-
price: closestPrices.find(
|
|
113
|
-
(price) =>
|
|
114
|
-
price !== undefined &&
|
|
115
|
-
price.cryptoCurrencyId === transfer.token.currency.id,
|
|
116
|
-
),
|
|
117
|
-
})),
|
|
118
|
-
}
|
|
119
|
-
}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
/* eslint-disable unicorn/filename-case */
|
|
2
|
-
import type { Config, CryptoCurrency, CryptoCurrencyPrice } from '@0xtorch/core'
|
|
3
|
-
import { getTransactionDetail } from '../getTransactionDetail'
|
|
4
|
-
import { toLowerHex } from '../types'
|
|
5
|
-
import type {
|
|
6
|
-
GetTransactionFullCustomParametersPDA,
|
|
7
|
-
GetTransactionFullCustomReturnType,
|
|
8
|
-
} from './types'
|
|
9
|
-
|
|
10
|
-
export const getTransactionFullCustomWithPDA = async (
|
|
11
|
-
parameters: GetTransactionFullCustomParametersPDA,
|
|
12
|
-
config?: Config,
|
|
13
|
-
): Promise<
|
|
14
|
-
GetTransactionFullCustomReturnType<GetTransactionFullCustomParametersPDA>
|
|
15
|
-
> => {
|
|
16
|
-
const timeoutTimestamp =
|
|
17
|
-
Date.now() + (config?.timeout === undefined ? 60_000 : config.timeout)
|
|
18
|
-
|
|
19
|
-
const {
|
|
20
|
-
chain,
|
|
21
|
-
hash,
|
|
22
|
-
appDataSource,
|
|
23
|
-
priceDataSource,
|
|
24
|
-
fiat,
|
|
25
|
-
decoder,
|
|
26
|
-
analyzer,
|
|
27
|
-
} = parameters
|
|
28
|
-
|
|
29
|
-
// get transaction detail
|
|
30
|
-
const transactionDetail = await getTransactionDetail({ chain, hash }, config)
|
|
31
|
-
if (transactionDetail === undefined) {
|
|
32
|
-
return undefined
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// decode
|
|
36
|
-
const decodedData = await decoder.decode(
|
|
37
|
-
{
|
|
38
|
-
chain,
|
|
39
|
-
transactions: [transactionDetail],
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
timeout: timeoutTimestamp - Date.now(),
|
|
43
|
-
logger: config?.logger,
|
|
44
|
-
},
|
|
45
|
-
)
|
|
46
|
-
const transactionDecoded = decodedData.transactions[0]
|
|
47
|
-
|
|
48
|
-
// get data from datasources
|
|
49
|
-
const mut_currencies: CryptoCurrency[] = [chain.nativeToken.currency]
|
|
50
|
-
for (const { token } of transactionDecoded.erc20Transfers) {
|
|
51
|
-
if (token.currency.market.coingeckoId === undefined) {
|
|
52
|
-
continue
|
|
53
|
-
}
|
|
54
|
-
if (mut_currencies.some((currency) => currency.id === token.currency.id)) {
|
|
55
|
-
continue
|
|
56
|
-
}
|
|
57
|
-
mut_currencies.push(token.currency)
|
|
58
|
-
}
|
|
59
|
-
const currencies = mut_currencies
|
|
60
|
-
|
|
61
|
-
const timestampMs = Number(transactionDecoded.block.timestamp) * 1000
|
|
62
|
-
const from = timestampMs - 1000 * 60 * 60
|
|
63
|
-
const to = timestampMs + 1000 * 60 * 60
|
|
64
|
-
|
|
65
|
-
const timeoutForDataSources = timeoutTimestamp - Date.now()
|
|
66
|
-
const [app, prices] = await Promise.all([
|
|
67
|
-
// get app
|
|
68
|
-
appDataSource === undefined || transactionDecoded.to === null
|
|
69
|
-
? undefined
|
|
70
|
-
: appDataSource.getApp(chain.id, toLowerHex(transactionDecoded.to), {
|
|
71
|
-
timeout: timeoutForDataSources,
|
|
72
|
-
logger: config?.logger,
|
|
73
|
-
}),
|
|
74
|
-
// get native token prices
|
|
75
|
-
priceDataSource.getHistoricalPrices(
|
|
76
|
-
{
|
|
77
|
-
targetCurrencies: currencies,
|
|
78
|
-
vsCurrency: fiat,
|
|
79
|
-
from,
|
|
80
|
-
to,
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
timeout: timeoutForDataSources,
|
|
84
|
-
logger: config?.logger,
|
|
85
|
-
},
|
|
86
|
-
),
|
|
87
|
-
])
|
|
88
|
-
|
|
89
|
-
const closestPrices = currencies.map((currency) =>
|
|
90
|
-
prices
|
|
91
|
-
.filter((price) => price.cryptoCurrencyId === currency.id)
|
|
92
|
-
.reduce(
|
|
93
|
-
(closestPrice: CryptoCurrencyPrice | undefined, price) =>
|
|
94
|
-
closestPrice === undefined ||
|
|
95
|
-
Math.abs(price.timestamp - timestampMs) <
|
|
96
|
-
Math.abs(closestPrice.timestamp - timestampMs)
|
|
97
|
-
? price
|
|
98
|
-
: closestPrice,
|
|
99
|
-
undefined,
|
|
100
|
-
),
|
|
101
|
-
)
|
|
102
|
-
const nativeTokenPrice = closestPrices.find(
|
|
103
|
-
(price) =>
|
|
104
|
-
price !== undefined &&
|
|
105
|
-
price.cryptoCurrencyId === chain.nativeToken.currency.id,
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
const transactionForAnalyzer = {
|
|
109
|
-
...transactionDecoded,
|
|
110
|
-
app,
|
|
111
|
-
nativeTokenPrice,
|
|
112
|
-
internalTransactions: transactionDecoded.internalTransactions.map(
|
|
113
|
-
(internalTransaction) => ({
|
|
114
|
-
...internalTransaction,
|
|
115
|
-
price: nativeTokenPrice,
|
|
116
|
-
}),
|
|
117
|
-
),
|
|
118
|
-
erc20Transfers: transactionDecoded.erc20Transfers.map((transfer) => ({
|
|
119
|
-
...transfer,
|
|
120
|
-
price: closestPrices.find(
|
|
121
|
-
(price) =>
|
|
122
|
-
price !== undefined &&
|
|
123
|
-
price.cryptoCurrencyId === transfer.token.currency.id,
|
|
124
|
-
),
|
|
125
|
-
})),
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// analyze
|
|
129
|
-
const { actions, accountActions } = await analyzer.analyze(
|
|
130
|
-
{
|
|
131
|
-
chain,
|
|
132
|
-
transaction: transactionForAnalyzer,
|
|
133
|
-
accountAddresses: [],
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
timeout: timeoutTimestamp - Date.now(),
|
|
137
|
-
logger: config?.logger,
|
|
138
|
-
},
|
|
139
|
-
)
|
|
140
|
-
|
|
141
|
-
return {
|
|
142
|
-
...transactionForAnalyzer,
|
|
143
|
-
accountAddresses: [],
|
|
144
|
-
actions,
|
|
145
|
-
accountActions,
|
|
146
|
-
}
|
|
147
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { Config } from '@0xtorch/core'
|
|
2
|
-
import { getTransactionDetail } from '../getTransactionDetail'
|
|
3
|
-
import { toLowerHex } from '../types'
|
|
4
|
-
import type {
|
|
5
|
-
GetTransactionFullCustomParametersAllUndefined,
|
|
6
|
-
GetTransactionFullCustomReturnType,
|
|
7
|
-
} from './types'
|
|
8
|
-
|
|
9
|
-
export const getTransactionFullCustomWithAllUndefined = async (
|
|
10
|
-
parameters: GetTransactionFullCustomParametersAllUndefined,
|
|
11
|
-
config?: Config,
|
|
12
|
-
): Promise<
|
|
13
|
-
GetTransactionFullCustomReturnType<GetTransactionFullCustomParametersAllUndefined>
|
|
14
|
-
> => {
|
|
15
|
-
const timeoutTimestamp =
|
|
16
|
-
Date.now() + (config?.timeout === undefined ? 60_000 : config.timeout)
|
|
17
|
-
|
|
18
|
-
const { chain, hash, appDataSource } = parameters
|
|
19
|
-
const transactionDetail = await getTransactionDetail({ chain, hash }, config)
|
|
20
|
-
if (transactionDetail === undefined) {
|
|
21
|
-
return undefined
|
|
22
|
-
}
|
|
23
|
-
const app =
|
|
24
|
-
appDataSource === undefined || transactionDetail.to === null
|
|
25
|
-
? undefined
|
|
26
|
-
: await appDataSource.getApp(chain.id, toLowerHex(transactionDetail.to), {
|
|
27
|
-
timeout: timeoutTimestamp - Date.now(),
|
|
28
|
-
logger: config?.logger,
|
|
29
|
-
})
|
|
30
|
-
if (transactionDetail === undefined) {
|
|
31
|
-
return undefined
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
...transactionDetail,
|
|
36
|
-
app,
|
|
37
|
-
nativeTokenPrice: undefined,
|
|
38
|
-
}
|
|
39
|
-
}
|