-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): OpenAPI spec update via Stainless API (#76)
- Loading branch information
1 parent
2fe2c29
commit 5278cd7
Showing
8 changed files
with
244 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
configured_endpoints: 7 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-11c3cc7e2c6dfdbb74ce960248f3c699de8e471595f0bb081f8d2e2da3012417.yml | ||
configured_endpoints: 9 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-721caa3b8b8fa19838e91b0b4aa8abc9d4e6694b5f2d14c072a70b3bb9fdafb3.yml |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import * as Core from '@blockaid/client/core'; | ||
import { APIResource } from '@blockaid/client/resource'; | ||
import * as PostTransactionBulkAPI from '@blockaid/client/resources/evm/post-transaction-bulk'; | ||
import * as EvmAPI from '@blockaid/client/resources/evm/evm'; | ||
|
||
export class PostTransactionBulk extends APIResource { | ||
/** | ||
* Scan transactions that were already executed on chain, returns validation with | ||
* features indicating address poisoning entites and malicious operators. | ||
*/ | ||
scan( | ||
body: PostTransactionBulkScanParams, | ||
options?: Core.RequestOptions, | ||
): Core.APIPromise<PostTransactionBulkScanResponse> { | ||
return this._client.post('/v0/evm/post-transaction-bulk/scan', { body, ...options }); | ||
} | ||
} | ||
|
||
export type PostTransactionBulkScanResponse = Array<EvmAPI.TransactionScanResponse>; | ||
|
||
export interface PostTransactionBulkScanParams { | ||
/** | ||
* The chain name or chain ID | ||
*/ | ||
chain: EvmAPI.TransactionScanSupportedChain | (string & {}); | ||
|
||
/** | ||
* Transaction bulk parameters | ||
*/ | ||
data: Array<PostTransactionBulkScanParams.Data>; | ||
|
||
/** | ||
* Object of additional information to validate against. | ||
*/ | ||
metadata: EvmAPI.Metadata; | ||
|
||
/** | ||
* List of one or both of options for the desired output. "simulation" - include | ||
* simulation output in your response. "validation" - include security validation | ||
* of the transaction in your response. Default is ["validation"] | ||
*/ | ||
options?: Array<'validation' | 'simulation' | 'gas_estimation' | 'events'>; | ||
} | ||
|
||
export namespace PostTransactionBulkScanParams { | ||
export interface Data { | ||
/** | ||
* 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 namespace PostTransactionBulk { | ||
export import PostTransactionBulkScanResponse = PostTransactionBulkAPI.PostTransactionBulkScanResponse; | ||
export import PostTransactionBulkScanParams = PostTransactionBulkAPI.PostTransactionBulkScanParams; | ||
} |
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,53 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import * as Core from '@blockaid/client/core'; | ||
import { APIResource } from '@blockaid/client/resource'; | ||
import * as PostTransactionAPI from '@blockaid/client/resources/evm/post-transaction'; | ||
import * as EvmAPI from '@blockaid/client/resources/evm/evm'; | ||
|
||
export class PostTransaction extends APIResource { | ||
/** | ||
* Scan a transaction that was already executed on chain, returns validation with | ||
* features indicating address poisoning entites and malicious operators. | ||
*/ | ||
scan( | ||
body: PostTransactionScanParams, | ||
options?: Core.RequestOptions, | ||
): Core.APIPromise<EvmAPI.TransactionScanResponse> { | ||
return this._client.post('/v0/evm/post-transaction/scan', { body, ...options }); | ||
} | ||
} | ||
|
||
export interface PostTransactionScanParams { | ||
/** | ||
* The chain name or chain ID | ||
*/ | ||
chain: EvmAPI.TransactionScanSupportedChain | (string & {}); | ||
|
||
data: PostTransactionScanParams.Data; | ||
|
||
/** | ||
* Object of additional information to validate against. | ||
*/ | ||
metadata: EvmAPI.Metadata; | ||
|
||
/** | ||
* list of one or both of options for the desired output. "simulation" - include | ||
* simulation output in your response. "validation" - include security validation | ||
* of the transaction in your response. Default is ["validation"] | ||
*/ | ||
options?: Array<'validation' | 'simulation' | 'gas_estimation' | 'events'>; | ||
} | ||
|
||
export namespace PostTransactionScanParams { | ||
export interface Data { | ||
/** | ||
* The transaction hash to scan | ||
*/ | ||
tx_hash: string; | ||
} | ||
} | ||
|
||
export namespace PostTransaction { | ||
export import PostTransactionScanParams = PostTransactionAPI.PostTransactionScanParams; | ||
} |
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,38 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import Blockaid from '@blockaid/client'; | ||
import { Response } from 'node-fetch'; | ||
|
||
const blockaid = new Blockaid({ | ||
apiKey: 'My API Key', | ||
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', | ||
}); | ||
|
||
describe('resource postTransactionBulk', () => { | ||
test('scan: only required params', async () => { | ||
const responsePromise = blockaid.evm.postTransactionBulk.scan({ | ||
chain: 'ethereum', | ||
data: [{ from: 'string' }, { from: 'string' }], | ||
metadata: { domain: 'string' }, | ||
}); | ||
const rawResponse = await responsePromise.asResponse(); | ||
expect(rawResponse).toBeInstanceOf(Response); | ||
const response = await responsePromise; | ||
expect(response).not.toBeInstanceOf(Response); | ||
const dataAndResponse = await responsePromise.withResponse(); | ||
expect(dataAndResponse.data).toBe(response); | ||
expect(dataAndResponse.response).toBe(rawResponse); | ||
}); | ||
|
||
test('scan: required and optional params', async () => { | ||
const response = await blockaid.evm.postTransactionBulk.scan({ | ||
chain: 'ethereum', | ||
data: [ | ||
{ from: 'string', to: 'string', data: 'string', value: 'string', gas: 'string', gas_price: 'string' }, | ||
{ from: 'string', to: 'string', data: 'string', value: 'string', gas: 'string', gas_price: 'string' }, | ||
], | ||
metadata: { domain: 'string' }, | ||
options: ['validation', 'simulation'], | ||
}); | ||
}); | ||
}); |
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,35 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import Blockaid from '@blockaid/client'; | ||
import { Response } from 'node-fetch'; | ||
|
||
const blockaid = new Blockaid({ | ||
apiKey: 'My API Key', | ||
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', | ||
}); | ||
|
||
describe('resource postTransaction', () => { | ||
test('scan: only required params', async () => { | ||
const responsePromise = blockaid.evm.postTransaction.scan({ | ||
chain: 'ethereum', | ||
data: { tx_hash: '0xc01780dadc107754b331250b4797606949cb3d0087facc0a737122d5e973c83c' }, | ||
metadata: { domain: 'string' }, | ||
}); | ||
const rawResponse = await responsePromise.asResponse(); | ||
expect(rawResponse).toBeInstanceOf(Response); | ||
const response = await responsePromise; | ||
expect(response).not.toBeInstanceOf(Response); | ||
const dataAndResponse = await responsePromise.withResponse(); | ||
expect(dataAndResponse.data).toBe(response); | ||
expect(dataAndResponse.response).toBe(rawResponse); | ||
}); | ||
|
||
test('scan: required and optional params', async () => { | ||
const response = await blockaid.evm.postTransaction.scan({ | ||
chain: 'ethereum', | ||
data: { tx_hash: '0xc01780dadc107754b331250b4797606949cb3d0087facc0a737122d5e973c83c' }, | ||
metadata: { domain: 'string' }, | ||
options: ['validation', 'simulation'], | ||
}); | ||
}); | ||
}); |