From 4d233b004962a12ddb9f1281b3e669adf5f5eb0f Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Tue, 30 Jul 2024 12:53:48 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API --- .stats.yml | 2 +- src/resources/evm/post-transaction.ts | 9 +++ src/resources/evm/transaction.ts | 66 ++++++++++++++++++- src/resources/site.ts | 9 +++ src/resources/token.ts | 17 +++-- .../evm/post-transaction.test.ts | 4 +- tests/api-resources/evm/transaction.test.ts | 4 +- tests/api-resources/site.test.ts | 4 +- tests/api-resources/token.test.ts | 4 +- 9 files changed, 104 insertions(+), 15 deletions(-) diff --git a/.stats.yml b/.stats.yml index be4489d..c195556 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 16 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-2cfc3ae022f20f690e636e25c6f9ce092c728cb9e2b571efc2d91c8d9ba24cb2.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-405ea9ac81572c603a02de9b49e0358296e9198e80fb3687d4ab86c1e73c12e4.yml diff --git a/src/resources/evm/post-transaction.ts b/src/resources/evm/post-transaction.ts index de619bb..23a3737 100644 --- a/src/resources/evm/post-transaction.ts +++ b/src/resources/evm/post-transaction.ts @@ -28,6 +28,9 @@ export class PostTransaction extends APIResource { export type PostTransactionReportResponse = unknown; export interface PostTransactionReportParams { + /** + * Details about the report. + */ details: string; /** @@ -35,6 +38,9 @@ export interface PostTransactionReportParams { */ event: 'FALSE_POSITIVE' | 'FALSE_NEGATIVE'; + /** + * The report parameters. + */ report: | PostTransactionReportParams.ParamReportChainTransactionHashParams | PostTransactionReportParams.RequestIDReport; @@ -54,6 +60,9 @@ export namespace PostTransactionReportParams { */ chain: EvmAPI.TransactionScanSupportedChain; + /** + * The transaction hash to report on. + */ tx_hash: string; } } diff --git a/src/resources/evm/transaction.ts b/src/resources/evm/transaction.ts index 342d5b3..f0cf023 100644 --- a/src/resources/evm/transaction.ts +++ b/src/resources/evm/transaction.ts @@ -29,6 +29,9 @@ export class Transaction extends APIResource { export type TransactionReportResponse = unknown; export interface TransactionReportParams { + /** + * Details about the report. + */ details: string; /** @@ -36,6 +39,9 @@ export interface TransactionReportParams { */ event: 'FALSE_POSITIVE' | 'FALSE_NEGATIVE'; + /** + * The report parameters. + */ report: | TransactionReportParams.ParamReportTransactionReportParams | TransactionReportParams.RequestIDReport; @@ -50,6 +56,10 @@ export namespace TransactionReportParams { export namespace ParamReportTransactionReportParams { export interface Params { + /** + * The address to relate the transaction to. Account address determines in which + * perspective the transaction is simulated and validated. + */ account_address: string; /** @@ -57,9 +67,61 @@ export namespace TransactionReportParams { */ chain: EvmAPI.TransactionScanSupportedChain; - data: unknown; + /** + * Transaction parameters + */ + data: Params.Transaction | Params.JsonRpc; + + /** + * Object of additional information to validate against. + */ + metadata: EvmAPI.Metadata; + } - metadata: unknown; + export namespace Params { + export interface Transaction { + /** + * The source address of the transaction in hex string format + */ + from: string; + + /** + * The encoded call data of the transaction in hex string format + */ + data?: string; + + /** + * The gas required for the transaction in hex string format. + */ + gas?: string; + + /** + * The gas price for the transaction in hex string format. + */ + gas_price?: string; + + /** + * The destination address of the transaction in hex string format + */ + to?: string; + + /** + * The value of the transaction in Wei in hex string format + */ + value?: string; + } + + export interface JsonRpc { + /** + * The method of the JSON-RPC request + */ + method: string; + + /** + * The parameters of the JSON-RPC request in JSON format + */ + params: Array; + } } } diff --git a/src/resources/site.ts b/src/resources/site.ts index 92f4d08..af4049e 100644 --- a/src/resources/site.ts +++ b/src/resources/site.ts @@ -77,6 +77,9 @@ export type SiteReportResponse = unknown; export type SiteScanResponse = SiteScanHitResponse | SiteScanMissResponse; export interface SiteReportParams { + /** + * Details about the report. + */ details: string; /** @@ -84,6 +87,9 @@ export interface SiteReportParams { */ event: 'FALSE_POSITIVE' | 'FALSE_NEGATIVE'; + /** + * The report parameters. + */ report: SiteReportParams.ParamReportSiteReportParams | SiteReportParams.RequestIDReport; } @@ -96,6 +102,9 @@ export namespace SiteReportParams { export namespace ParamReportSiteReportParams { export interface Params { + /** + * The url of the site to report on. + */ url: string; } } diff --git a/src/resources/token.ts b/src/resources/token.ts index 150ea24..2381385 100644 --- a/src/resources/token.ts +++ b/src/resources/token.ts @@ -61,6 +61,9 @@ export namespace TokenScanResponse { } export interface TokenReportParams { + /** + * Details about the report. + */ details: string; /** @@ -68,18 +71,24 @@ export interface TokenReportParams { */ event: 'FALSE_POSITIVE' | 'FALSE_NEGATIVE'; - report: TokenReportParams.ParamReportAddressChainReportParams | TokenReportParams.RequestIDReport; + /** + * The report parameters. + */ + report: TokenReportParams.ParamReportTokenReportParams | TokenReportParams.RequestIDReport; } export namespace TokenReportParams { - export interface ParamReportAddressChainReportParams { - params: ParamReportAddressChainReportParams.Params; + export interface ParamReportTokenReportParams { + params: ParamReportTokenReportParams.Params; type: 'params'; } - export namespace ParamReportAddressChainReportParams { + export namespace ParamReportTokenReportParams { export interface Params { + /** + * The address of the token to report on. + */ address: string; /** diff --git a/tests/api-resources/evm/post-transaction.test.ts b/tests/api-resources/evm/post-transaction.test.ts index 90f864c..7bfde21 100644 --- a/tests/api-resources/evm/post-transaction.test.ts +++ b/tests/api-resources/evm/post-transaction.test.ts @@ -13,7 +13,7 @@ describe('resource postTransaction', () => { const responsePromise = client.evm.postTransaction.report({ details: 'Details about the report', event: 'FALSE_NEGATIVE', - report: { type: 'request_id', request_id: 'ghi123' }, + report: { type: 'request_id', request_id: '11111111-1111-1111-1111-111111111111' }, }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -28,7 +28,7 @@ describe('resource postTransaction', () => { const response = await client.evm.postTransaction.report({ details: 'Details about the report', event: 'FALSE_NEGATIVE', - report: { type: 'request_id', request_id: 'ghi123' }, + report: { type: 'request_id', request_id: '11111111-1111-1111-1111-111111111111' }, }); }); diff --git a/tests/api-resources/evm/transaction.test.ts b/tests/api-resources/evm/transaction.test.ts index 4c59e64..8f0c8f9 100644 --- a/tests/api-resources/evm/transaction.test.ts +++ b/tests/api-resources/evm/transaction.test.ts @@ -13,7 +13,7 @@ describe('resource transaction', () => { const responsePromise = client.evm.transaction.report({ details: 'Details about the report', event: 'FALSE_POSITIVE', - report: { type: 'request_id', request_id: 'jkl456' }, + report: { type: 'request_id', request_id: '11111111-1111-1111-1111-111111111111' }, }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -28,7 +28,7 @@ describe('resource transaction', () => { const response = await client.evm.transaction.report({ details: 'Details about the report', event: 'FALSE_POSITIVE', - report: { type: 'request_id', request_id: 'jkl456' }, + report: { type: 'request_id', request_id: '11111111-1111-1111-1111-111111111111' }, }); }); diff --git a/tests/api-resources/site.test.ts b/tests/api-resources/site.test.ts index 26cdcc1..51de6cc 100644 --- a/tests/api-resources/site.test.ts +++ b/tests/api-resources/site.test.ts @@ -13,7 +13,7 @@ describe('resource site', () => { const responsePromise = client.site.report({ details: 'Details about the report', event: 'FALSE_POSITIVE', - report: { type: 'request_id', request_id: 'abc123' }, + report: { type: 'request_id', request_id: '11111111-1111-1111-1111-111111111111' }, }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -28,7 +28,7 @@ describe('resource site', () => { const response = await client.site.report({ details: 'Details about the report', event: 'FALSE_POSITIVE', - report: { type: 'request_id', request_id: 'abc123' }, + report: { type: 'request_id', request_id: '11111111-1111-1111-1111-111111111111' }, }); }); diff --git a/tests/api-resources/token.test.ts b/tests/api-resources/token.test.ts index 85a9cc3..9ca002d 100644 --- a/tests/api-resources/token.test.ts +++ b/tests/api-resources/token.test.ts @@ -13,7 +13,7 @@ describe('resource token', () => { const responsePromise = client.token.report({ details: 'Details about the report', event: 'FALSE_POSITIVE', - report: { type: 'request_id', request_id: 'def456' }, + report: { type: 'request_id', request_id: '11111111-1111-1111-1111-111111111111' }, }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -28,7 +28,7 @@ describe('resource token', () => { const response = await client.token.report({ details: 'Details about the report', event: 'FALSE_POSITIVE', - report: { type: 'request_id', request_id: 'def456' }, + report: { type: 'request_id', request_id: '11111111-1111-1111-1111-111111111111' }, }); });