-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: fetch token transfers with blockscout api (#2020)
* refactor: create IBlockscoutTokenTransfer interface Co-authored-by: Mark Nardi <[email protected]> * feat: add getTokenTransfersAddress to blockscout api * feat: fetch token transfers when fetching transactions Co-authored-by: Mark Nardi <[email protected]> * fix: add store name --------- Co-authored-by: Mark Nardi <[email protected]>
- Loading branch information
1 parent
17ff5e6
commit 6201493
Showing
13 changed files
with
185 additions
and
42 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
7 changes: 7 additions & 0 deletions
7
packages/shared/src/lib/auxiliary/blockscout/enums/blockscout-transaction-type.enum.ts
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,7 @@ | ||
export enum BlockscoutTransactionType { | ||
TokenTransfer = 'token_transfer', | ||
ContractCreation = 'contract_creation', | ||
ContractCall = 'contract_call', | ||
TokenCreation = 'token_creation', | ||
CoinTransfer = 'coin_transfer', | ||
} |
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 +1,2 @@ | ||
export * from './blockscout-transaction-status.enum' | ||
export * from './blockscout-transaction-type.enum' |
12 changes: 12 additions & 0 deletions
12
...ages/shared/src/lib/auxiliary/blockscout/interfaces/blockscout-address-param.interface.ts
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,12 @@ | ||
import { IAddressTag, IWatchlistName } from './blockscout-transaction.interface' | ||
|
||
export interface IBlockscoutAddressParam { | ||
hash: string | ||
implementation_name: string | ||
name: string | ||
is_contract: boolean | ||
private_tags: IAddressTag[] | ||
watchlist_names: IWatchlistName[] | ||
public_tags: IAddressTag[] | ||
is_verified: boolean | ||
} |
4 changes: 2 additions & 2 deletions
4
packages/shared/src/lib/auxiliary/blockscout/interfaces/blockscout-api.interface.ts
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
4 changes: 2 additions & 2 deletions
4
packages/shared/src/lib/auxiliary/blockscout/interfaces/blockscout-asset.interface.ts
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
2 changes: 1 addition & 1 deletion
2
...es/blockscout-asset-metadata.interface.ts → ...rfaces/blockscout-token-info.interface.ts
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
19 changes: 19 additions & 0 deletions
19
...ges/shared/src/lib/auxiliary/blockscout/interfaces/blockscout-token-transfer.interface.ts
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,19 @@ | ||
import { IBlockscoutAddressParam } from './blockscout-address-param.interface' | ||
import { BlockscoutTransactionType } from '../enums/blockscout-transaction-type.enum' | ||
import { IBlockscoutTokenInfo } from './blockscout-token-info.interface' | ||
|
||
export interface IBlockscoutTokenTransfer { | ||
block_hash: string | ||
from: IBlockscoutAddressParam | ||
log_index: string | ||
method: string // could be an enum? | ||
timestamp: string | ||
to: IBlockscoutAddressParam | ||
token: IBlockscoutTokenInfo | ||
total: { | ||
decimals: number | ||
value: number | ||
} | ||
tx_hash: string | ||
type: BlockscoutTransactionType.TokenTransfer | ||
} |
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
4 changes: 3 additions & 1 deletion
4
packages/shared/src/lib/auxiliary/blockscout/interfaces/index.ts
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,4 +1,6 @@ | ||
export * from './blockscout-address-param.interface' | ||
export * from './blockscout-api.interface' | ||
export * from './blockscout-asset.interface' | ||
export * from './blockscout-asset-metadata.interface' | ||
export * from './blockscout-token-info.interface' | ||
export * from './blockscout-token-transfer.interface' | ||
export * from './blockscout-transaction.interface' |
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
10 changes: 9 additions & 1 deletion
10
packages/shared/src/lib/core/transactions/types/persisted-transaction.type.ts
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,16 +1,24 @@ | ||
import { IBlockscoutTransaction } from '@auxiliary/blockscout/interfaces' | ||
import { IBlockscoutTokenTransfer, IBlockscoutTransaction } from '@auxiliary/blockscout/interfaces' | ||
import { PersistedEvmTransaction } from '@core/activity' | ||
|
||
export type PersistedTransaction = | ||
| { | ||
blockscout: IBlockscoutTransaction | ||
tokenTransfer: IBlockscoutTokenTransfer | ||
local: PersistedEvmTransaction | ||
} | ||
| { | ||
blockscout?: IBlockscoutTransaction | ||
tokenTransfer: IBlockscoutTokenTransfer | ||
local: PersistedEvmTransaction | ||
} | ||
| { | ||
blockscout: IBlockscoutTransaction | ||
tokenTransfer: IBlockscoutTokenTransfer | ||
local?: PersistedEvmTransaction | ||
} | ||
| { | ||
blockscout?: IBlockscoutTransaction | ||
tokenTransfer: IBlockscoutTokenTransfer | ||
local?: PersistedEvmTransaction | ||
} |