Skip to content

Commit

Permalink
ready
Browse files Browse the repository at this point in the history
  • Loading branch information
0xBeycan committed Oct 4, 2024
1 parent d8d8e11 commit 1ed1d30
Show file tree
Hide file tree
Showing 12 changed files with 147 additions and 134 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tronsocket/types",
"version": "0.1.1",
"version": "0.2.0",
"type": "module",
"main": "./src/index.ts",
"types": "./src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/block.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default interface Block {
export interface Block {
timeStamp: number
triggerName: string
blockNumber: number
Expand Down
44 changes: 44 additions & 0 deletions src/contract.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { DataMap, RawData, TopicMap } from './parts'

export interface ContractLog {
timeStamp: number
triggerName: string
uniqueId: string
transactionId: string
contractAddress: string
callerAddress: string
originAddress: string
creatorAddress: string
blockNumber: number
blockHash: string
removed: boolean
latestSolidifiedBlockNumber: number
logInfo: unknown
rawData: RawData
abi: unknown
topicList: string[]
data: string
}

export interface ContractEvent {
timeStamp: number
triggerName: string
uniqueId: string
transactionId: string
contractAddress: string
callerAddress: string
originAddress: string
creatorAddress: string
blockNumber: number
blockHash: string
removed: boolean
latestSolidifiedBlockNumber: number
logInfo: unknown
rawData: RawData
abi: unknown
eventSignature: string
eventSignatureFull: string
eventName: string
topicMap: TopicMap
dataMap: DataMap
}
33 changes: 0 additions & 33 deletions src/contractevent.ts

This file was deleted.

23 changes: 0 additions & 23 deletions src/contractlog.ts

This file was deleted.

25 changes: 25 additions & 0 deletions src/filter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export interface BlockFilter {
transactionSize?: number
}

export interface TransactionFilter {
assetName?: string | null
assetAmount?: number
contractType?: string
fromAddress?: string
toAddress?: string
}

export interface SolidityFilter {
contractAddress?: string
creatorAddress?: string
originAddress?: string
eventName?: string
}

export interface EventFilters {
block: BlockFilter
contract: SolidityFilter
solidity: SolidityFilter
transaction: TransactionFilter
}
27 changes: 11 additions & 16 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
import Block from './block'
import Solidity from './solidity'
import Transaction from './transaction'
import ContractLog from './contractlog'
import SolidityLog from './soliditylog'
import ContractEvent from './contractevent'
import SolidityEvent from './solidityevent'
import { Block } from './block'
import { Transaction } from './transaction'
import { ContractLog, ContractEvent } from './contract'
import { Solidity, SolidityEvent, SolidityLog } from './solidity'

export default interface EventTypes {
export * from './block'
export * from './filter'
export * from './contract'
export * from './solidity'
export * from './transaction'

export interface EventTypes {
block: Block
transaction: Transaction
contract: ContractLog | ContractEvent
solidity: Solidity | SolidityEvent | SolidityLog
}

export type { default as Block } from './block'
export type { default as Solidity } from './solidity'
export type { default as Transaction } from './transaction'
export type { default as ContractLog } from './contractlog'
export type { default as SolidityLog } from './soliditylog'
export type { default as ContractEvent } from './contractevent'
export type { default as SolidityEvent } from './solidityevent'
16 changes: 16 additions & 0 deletions src/parts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export interface RawData {
address: string
topics: string[]
data: string
}

export interface TopicMap {
[x: string]: string
from: string
to: string
}

export interface DataMap {
[x: string]: string
value: string
}
47 changes: 46 additions & 1 deletion src/solidity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,49 @@
export default interface Solidity {
import { DataMap, RawData, TopicMap } from './parts'

export interface SolidityLog {
timeStamp: number
triggerName: string
uniqueId: string
transactionId: string
contractAddress: string
callerAddress: string
originAddress: string
creatorAddress: string
blockNumber: number
blockHash: string
removed: boolean
latestSolidifiedBlockNumber: number
logInfo: unknown
rawData: DataMap
abi: unknown
topicList: string[]
data: string
}

export interface SolidityEvent {
timeStamp: number
triggerName: string
uniqueId: string
transactionId: string
contractAddress: string
callerAddress: string
originAddress: string
creatorAddress: string
blockNumber: number
blockHash: string
removed: boolean
latestSolidifiedBlockNumber: number
logInfo: unknown
rawData: RawData
abi: unknown
eventSignature: string
eventSignatureFull: string
eventName: string
topicMap: TopicMap
dataMap: DataMap
}

export interface Solidity {
timeStamp: number
triggerName: string
latestSolidifiedBlockNumber: number
Expand Down
33 changes: 0 additions & 33 deletions src/solidityevent.ts

This file was deleted.

23 changes: 0 additions & 23 deletions src/soliditylog.ts

This file was deleted.

6 changes: 3 additions & 3 deletions src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export type InternalTransaction = {
extra: string
}

export default interface Transaction {
export interface Transaction {
timeStamp: number
triggerName: string
transactionId: string
Expand All @@ -39,9 +39,9 @@ export default interface Transaction {
feeLimit: number
contractCallValue: number
contractResult: string | null
fromAddress: string | null
fromAddress: string
toAddress: string
assetName: string
assetName: string | null
assetAmount: number
latestSolidifiedBlockNumber: number
internalTransactionList: InternalTransaction[]
Expand Down

0 comments on commit 1ed1d30

Please sign in to comment.