Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): OpenAPI spec update via Stainless API #127

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions src/resources/evm/post-transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@ export class PostTransaction extends APIResource {
export type PostTransactionReportResponse = unknown;

export interface PostTransactionReportParams {
/**
* Details about the report.
*/
details: string;

/**
* An enumeration.
*/
event: 'FALSE_POSITIVE' | 'FALSE_NEGATIVE';

/**
* The report parameters.
*/
report:
| PostTransactionReportParams.ParamReportChainTransactionHashParams
| PostTransactionReportParams.RequestIDReport;
Expand All @@ -54,6 +60,9 @@ export namespace PostTransactionReportParams {
*/
chain: EvmAPI.TransactionScanSupportedChain;

/**
* The transaction hash to report on.
*/
tx_hash: string;
}
}
Expand Down
66 changes: 64 additions & 2 deletions src/resources/evm/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,19 @@ export class Transaction extends APIResource {
export type TransactionReportResponse = unknown;

export interface TransactionReportParams {
/**
* Details about the report.
*/
details: string;

/**
* An enumeration.
*/
event: 'FALSE_POSITIVE' | 'FALSE_NEGATIVE';

/**
* The report parameters.
*/
report:
| TransactionReportParams.ParamReportTransactionReportParams
| TransactionReportParams.RequestIDReport;
Expand All @@ -50,16 +56,72 @@ 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;

/**
* The chain name
*/
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<unknown>;
}
}
}

Expand Down
9 changes: 9 additions & 0 deletions src/resources/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,19 @@ export type SiteReportResponse = unknown;
export type SiteScanResponse = SiteScanHitResponse | SiteScanMissResponse;

export interface SiteReportParams {
/**
* Details about the report.
*/
details: string;

/**
* An enumeration.
*/
event: 'FALSE_POSITIVE' | 'FALSE_NEGATIVE';

/**
* The report parameters.
*/
report: SiteReportParams.ParamReportSiteReportParams | SiteReportParams.RequestIDReport;
}

Expand All @@ -96,6 +102,9 @@ export namespace SiteReportParams {

export namespace ParamReportSiteReportParams {
export interface Params {
/**
* The url of the site to report on.
*/
url: string;
}
}
Expand Down
17 changes: 13 additions & 4 deletions src/resources/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,34 @@ export namespace TokenScanResponse {
}

export interface TokenReportParams {
/**
* Details about the report.
*/
details: string;

/**
* An enumeration.
*/
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;

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/api-resources/evm/post-transaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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' },
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/api-resources/evm/transaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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' },
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/api-resources/site.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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' },
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/api-resources/token.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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' },
});
});

Expand Down