From 4cacf4ca68e724c1975c78092ed310b453ee15b2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 21 Jul 2024 10:02:08 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#113) --- .github/workflows/release-doctor.yml | 2 + .stats.yml | 4 +- README.md | 20 ++---- api.md | 4 -- src/resources/stellar/index.ts | 2 +- src/resources/stellar/stellar.ts | 1 - src/resources/stellar/transaction.ts | 69 +------------------ .../api-resources/stellar/transaction.test.ts | 37 ---------- 8 files changed, 12 insertions(+), 127 deletions(-) delete mode 100644 tests/api-resources/stellar/transaction.test.ts diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 475c511..65ae983 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -1,6 +1,8 @@ name: Release Doctor on: pull_request: + branches: + - main workflow_dispatch: jobs: diff --git a/.stats.yml b/.stats.yml index a89705f..575fd91 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 12 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-84bcb7b94ca6b21e8d486402a12eb18576497eff38b7cd846e509c49c58e8b2e.yml +configured_endpoints: 11 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-e201805908610f3980464949d264407cb96388191245bb8544bd03999e67f017.yml diff --git a/README.md b/README.md index b2819a7..f9a992e 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ The full API of this library can be found in [api.md](api.md). ```js import Blockaid from '@blockaid/client'; -const blockaid = new Blockaid({ +const client = new Blockaid({ apiKey: process.env['BLOCKAID_CLIENT_API_KEY'], // This is the default and can be omitted }); @@ -53,7 +53,7 @@ This library includes TypeScript definitions for all request params and response ```ts import Blockaid from '@blockaid/client'; -const blockaid = new Blockaid({ +const client = new Blockaid({ apiKey: process.env['BLOCKAID_CLIENT_API_KEY'], // This is the default and can be omitted }); @@ -136,7 +136,7 @@ You can use the `maxRetries` option to configure or disable this: ```js // Configure the default for all requests: -const blockaid = new Blockaid({ +const client = new Blockaid({ maxRetries: 0, // default is 2 }); @@ -153,7 +153,7 @@ Requests time out after 1 minute by default. You can configure this with a `time ```ts // Configure the default for all requests: -const blockaid = new Blockaid({ +const client = new Blockaid({ timeout: 20 * 1000, // 20 seconds (default is 1 minute) }); @@ -177,7 +177,7 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi ```ts -const blockaid = new Blockaid(); +const client = new Blockaid(); const response = await blockaid.evm.jsonRpc .scan({ @@ -308,7 +308,7 @@ import http from 'http'; import { HttpsProxyAgent } from 'https-proxy-agent'; // Configure the default for all requests: -const blockaid = new Blockaid({ +const client = new Blockaid({ httpAgent: new HttpsProxyAgent(process.env.PROXY_URL), }); @@ -349,14 +349,6 @@ TypeScript >= 4.5 is supported. The following runtimes are supported: -- Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions. -- Deno v1.28.0 or higher, using `import Blockaid from "npm:@blockaid/client"`. -- Bun 1.0 or later. -- Cloudflare Workers. -- Vercel Edge Runtime. -- Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time). -- Nitro v2.6 or greater. - Note that React Native is not supported at this time. If you are interested in other runtime environments, please open or upvote an issue on GitHub. diff --git a/api.md b/api.md index c4a337f..2b3f0ba 100644 --- a/api.md +++ b/api.md @@ -134,10 +134,6 @@ Types: ## Transaction -Methods: - -- client.stellar.transaction.scan({ ...params }) -> StellarTransactionScanResponse - # Site Types: diff --git a/src/resources/stellar/index.ts b/src/resources/stellar/index.ts index cc3e524..4404b2d 100644 --- a/src/resources/stellar/index.ts +++ b/src/resources/stellar/index.ts @@ -7,4 +7,4 @@ export { StellarTransactionScanResponse, Stellar, } from './stellar'; -export { TransactionScanParams, Transaction } from './transaction'; +export { Transaction } from './transaction'; diff --git a/src/resources/stellar/stellar.ts b/src/resources/stellar/stellar.ts index 2405bf7..2526141 100644 --- a/src/resources/stellar/stellar.ts +++ b/src/resources/stellar/stellar.ts @@ -524,5 +524,4 @@ export namespace Stellar { export import StellarTransactionScanRequest = StellarAPI.StellarTransactionScanRequest; export import StellarTransactionScanResponse = StellarAPI.StellarTransactionScanResponse; export import Transaction = TransactionAPI.Transaction; - export import TransactionScanParams = TransactionAPI.TransactionScanParams; } diff --git a/src/resources/stellar/transaction.ts b/src/resources/stellar/transaction.ts index 7c59632..3c253bd 100644 --- a/src/resources/stellar/transaction.ts +++ b/src/resources/stellar/transaction.ts @@ -1,72 +1,5 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '@blockaid/client/resource'; -import * as Core from '@blockaid/client/core'; -import * as TransactionAPI from '@blockaid/client/resources/stellar/transaction'; -import * as StellarAPI from '@blockaid/client/resources/stellar/stellar'; -export class Transaction extends APIResource { - /** - * Scan Transactions - */ - scan( - body: TransactionScanParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post('/v0/stellar/scan/transaction', { body, ...options }); - } -} - -export interface TransactionScanParams { - account_address: string; - - /** - * A CAIP-2 chain ID or a Stellar network name - */ - chain: 'pubnet' | 'futurenet' | 'testnet'; - - /** - * Metadata - */ - metadata: - | TransactionScanParams.StellarWalletRequestMetadata - | TransactionScanParams.StellarInAppRequestMetadata; - - /** - * List of XDR-encoded transactions to be scanned - */ - transactions: Array; - - /** - * List of options to include in the response - * - * - `simulation`: Include simulation output in the response - * - `validation`: Include security validation of the transaction in the response - */ - options?: Array<'validation' | 'simulation'>; -} - -export namespace TransactionScanParams { - export interface StellarWalletRequestMetadata { - /** - * Metadata for wallet requests - */ - type: 'wallet'; - - /** - * URL of the dApp originating the transaction - */ - url: string; - } - - export interface StellarInAppRequestMetadata { - /** - * Metadata for in-app requests - */ - type: 'in_app'; - } -} - -export namespace Transaction { - export import TransactionScanParams = TransactionAPI.TransactionScanParams; -} +export class Transaction extends APIResource {} diff --git a/tests/api-resources/stellar/transaction.test.ts b/tests/api-resources/stellar/transaction.test.ts deleted file mode 100644 index a40ae78..0000000 --- a/tests/api-resources/stellar/transaction.test.ts +++ /dev/null @@ -1,37 +0,0 @@ -// 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 transaction', () => { - test('scan: only required params', async () => { - const responsePromise = blockaid.stellar.transaction.scan({ - account_address: 'account_address', - chain: 'pubnet', - metadata: { type: 'wallet', url: 'url' }, - transactions: ['string', 'string', '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.stellar.transaction.scan({ - account_address: 'account_address', - chain: 'pubnet', - metadata: { type: 'wallet', url: 'url' }, - transactions: ['string', 'string', 'string'], - options: ['validation'], - }); - }); -});