Skip to content

Commit

Permalink
clean up artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcgroul committed Sep 24, 2024
1 parent 9c7fb1d commit 61d2f81
Show file tree
Hide file tree
Showing 12 changed files with 228 additions and 264 deletions.
3 changes: 1 addition & 2 deletions common/config/rush/deploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
"@subsquid/substrate-ingest",
"@subsquid/substrate-metadata-service",
"@subsquid/tron-dump",
"@subsquid/tron-ingest",
"chain-status-service"
"@subsquid/tron-ingest"
],

/**
Expand Down
33 changes: 0 additions & 33 deletions package-lock.json

This file was deleted.

5 changes: 0 additions & 5 deletions package.json

This file was deleted.

3 changes: 1 addition & 2 deletions substrate/substrate-ingest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"@subsquid/util-internal-json": "^1.2.3"
},
"devDependencies": {
"@types/node": "^18.18.14",
"typescript": "~5.2.2"
"@types/node": "^18.18.14"
}
}
2 changes: 2 additions & 0 deletions test/tron-usdt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
},
"devDependencies": {
"@subsquid/evm-typegen": "^4.3.0",
"@subsquid/evm-codec": "^0.3.0",
"@subsquid/evm-abi": "^0.3.1",
"@subsquid/typeorm-codegen": "^2.0.2",
"@types/node": "^18.18.14",
"typescript": "~5.3.2"
Expand Down
375 changes: 199 additions & 176 deletions test/tron-usdt/src/abi/erc20.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tron/tron-ingest/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# @subsquid/tron-ingest

Data fetcher for tron based chains.
Data ingestion tool for tron based chains.
5 changes: 3 additions & 2 deletions tron/tron-stream/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# @subsquid/tron-processor
# @subsquid/tron-stream

Data fetcher and mappings executor for tron chains.
Tron block data source, that allows to request and fetch block data from both Subsquid Network
and traditional HTTP API endpoint.
1 change: 0 additions & 1 deletion tron/tron-stream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
},
"dependencies": {
"@subsquid/http-client": "^1.5.0",
"@subsquid/logger": "^1.3.3",
"@subsquid/tron-data": "^0.0.0",
"@subsquid/tron-normalization": "^0.0.0",
"@subsquid/util-internal": "^3.2.0",
Expand Down
28 changes: 14 additions & 14 deletions tron/tron-stream/src/data/data-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ export interface DataRequest {


export interface LogRequestWhere {
address?: string[]
topic0?: string[]
topic1?: string[]
topic2?: string[]
topic3?: string[]
address?: Bytes[]
topic0?: Bytes[]
topic1?: Bytes[]
topic2?: Bytes[]
topic3?: Bytes[]
}


Expand Down Expand Up @@ -51,8 +51,8 @@ export interface TransactionRequest {


export interface TransferTransactionRequestWhere {
owner?: string[]
to?: string[]
owner?: Bytes[]
to?: Bytes[]
}


Expand All @@ -69,8 +69,8 @@ export interface TransferTransactionRequest {


export interface TransferAssetTransactionRequestWhere {
owner?: string[]
to?: string[]
owner?: Bytes[]
to?: Bytes[]
asset?: string[]
}

Expand All @@ -88,9 +88,9 @@ export interface TransferAssetTransactionRequest {


export interface TriggerSmartContractTransactionRequestWhere {
owner?: string[]
contract?: string[]
sighash?: string[]
owner?: Bytes[]
contract?: Bytes[]
sighash?: Bytes[]
}


Expand All @@ -107,8 +107,8 @@ export interface TriggerSmartContractTransactionRequest {


export interface InternalTransactionRequestWhere {
caller?: string[]
transferTo?: string[]
caller?: Bytes[]
transferTo?: Bytes[]
}


Expand Down
5 changes: 4 additions & 1 deletion tron/tron-stream/src/data/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ export const DEFAULT_FIELDS = {
data: true,
topics: true
},
internalTransaction: {}
internalTransaction: {
callerAddress: true,
transferToAddress: true
}
} as const


Expand Down
30 changes: 3 additions & 27 deletions util/http-client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,17 @@ export interface HttpClientOptions {
}


export interface RequestOptions<R=any> {
export interface RequestOptions {
query?: Record<string, string | number | bigint>
headers?: HeadersInit
retryAttempts?: number
retrySchedule?: number[]
httpTimeout?: number
abort?: AbortSignal
stream?: boolean
/**
* Result validator/transformer
*
* This option is mainly a way to utilize built-in retry machinery by throwing {@link RetryError}.
* Otherwise, `client.request(...).then(validateResult)` is a better option.
*/
validateResult?: ResultValidator<R>
}


type ResultValidator<R=any> = (result: HttpResponse, req: FetchRequest) => R


export interface GraphqlRequestOptions extends RequestOptions {
variables?: Record<string, any>
url?: string
Expand All @@ -56,14 +46,13 @@ export interface GraphqlRequestOptions extends RequestOptions {
}


export interface FetchRequest<R=any> extends RequestInit {
export interface FetchRequest extends RequestInit {
id: number
url: string
headers: Headers
timeout?: number
signal?: AbortSignal
stream?: boolean
validateResult?: ResultValidator<R>
}


Expand Down Expand Up @@ -188,10 +177,6 @@ export class HttpClient {
httpResponseBody
}, 'http body')
}

if (req.validateResult) {
req.validateResult(res, req)
}
}

protected async prepareRequest(
Expand All @@ -209,8 +194,7 @@ export class HttpClient {
signal: options.abort,
compress: true,
timeout: options.httpTimeout ?? this.httpTimeout,
stream: options.stream,
validateResult: options.validateResult,
stream: options.stream
}

this.handleBasicAuth(req)
Expand Down Expand Up @@ -336,7 +320,6 @@ export class HttpClient {
}

isRetryableError(error: HttpResponse | Error, req?: FetchRequest): boolean {
if (error instanceof RetryError) return true
if (isHttpConnectionError(error)) return true
if (error instanceof HttpTimeoutError) return true
if (error instanceof HttpError) {
Expand Down Expand Up @@ -495,10 +478,3 @@ export function isHttpConnectionError(err: unknown): boolean {
&& err.type == 'system'
&& (err.message.startsWith('request to') || err.code == 'ERR_STREAM_PREMATURE_CLOSE')
}


/**
* This error can be thrown from `RequestOptions.validateResult()` to invoke built-in
* retry machinery
*/
export class RetryError extends Error {}

0 comments on commit 61d2f81

Please sign in to comment.