Skip to content

Commit

Permalink
Merge pull request #66 from blockaid-official/release-please--branche…
Browse files Browse the repository at this point in the history
…s--main--changes--next--components--client

release: 0.11.0
  • Loading branch information
guye1296 authored Jul 2, 2024
2 parents 6f7b115 + 6de620b commit 2c16687
Show file tree
Hide file tree
Showing 28 changed files with 964 additions and 28 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.prism.log
node_modules
yarn-error.log
codegen.log
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.10.0"
".": "0.11.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
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-dbdb9cdcb11bf5cff7ce744d33b91fdfd6eda085a453d524224d4abe7c77379c.yml
configured_endpoints: 10
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-e8ecae43fd5292c14cf5cb9a99736c35a93daf50bd94032c522348d8b522436d.yml
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Changelog

## 0.11.0 (2024-07-02)

Full Changelog: [v0.10.0...v0.11.0](https://github.com/blockaid-official/blockaid-client-node/compare/v0.10.0...v0.11.0)

### Features

* **api:** OpenAPI spec update via Stainless API ([#68](https://github.com/blockaid-official/blockaid-client-node/issues/68)) ([39bd161](https://github.com/blockaid-official/blockaid-client-node/commit/39bd161b9e18bfa90fc708c9bd7a3c12da259ddf))
* **api:** OpenAPI spec update via Stainless API ([#69](https://github.com/blockaid-official/blockaid-client-node/issues/69)) ([af99003](https://github.com/blockaid-official/blockaid-client-node/commit/af99003a7751afe0b7232ea6fce8e4165030db2d))
* **api:** OpenAPI spec update via Stainless API ([#70](https://github.com/blockaid-official/blockaid-client-node/issues/70)) ([0b87914](https://github.com/blockaid-official/blockaid-client-node/commit/0b87914c1299c3b8f3f894c9a65e65aaa75d8675))
* **api:** OpenAPI spec update via Stainless API ([#71](https://github.com/blockaid-official/blockaid-client-node/issues/71)) ([cd39c1a](https://github.com/blockaid-official/blockaid-client-node/commit/cd39c1ae1e2581466b4f1d1bb6f9bc7c5fd7d1c8))
* **api:** OpenAPI spec update via Stainless API ([#72](https://github.com/blockaid-official/blockaid-client-node/issues/72)) ([e9c7dc6](https://github.com/blockaid-official/blockaid-client-node/commit/e9c7dc6a8ec4d068e69c0b9d541cff8c16904dad))
* **api:** OpenAPI spec update via Stainless API ([#73](https://github.com/blockaid-official/blockaid-client-node/issues/73)) ([83176e6](https://github.com/blockaid-official/blockaid-client-node/commit/83176e60bbd9c62c2f829dcb69b69b99a83e9c97))
* **api:** OpenAPI spec update via Stainless API ([#74](https://github.com/blockaid-official/blockaid-client-node/issues/74)) ([ede6899](https://github.com/blockaid-official/blockaid-client-node/commit/ede6899d5757aa3832bc6b4d4eabc6b3cb884302))
* **api:** OpenAPI spec update via Stainless API ([#75](https://github.com/blockaid-official/blockaid-client-node/issues/75)) ([69c28bd](https://github.com/blockaid-official/blockaid-client-node/commit/69c28bd04ab100ceb6e0e5d94c94467abd878d85))
* **api:** OpenAPI spec update via Stainless API ([#76](https://github.com/blockaid-official/blockaid-client-node/issues/76)) ([989c2df](https://github.com/blockaid-official/blockaid-client-node/commit/989c2df13d9bdd140a2e0bf6cebd3fbd50ecb833))
* **api:** OpenAPI spec update via Stainless API ([#77](https://github.com/blockaid-official/blockaid-client-node/issues/77)) ([62f489c](https://github.com/blockaid-official/blockaid-client-node/commit/62f489c913a4025a81587146d2bf3e38d328e006))
* **api:** OpenAPI spec update via Stainless API ([#78](https://github.com/blockaid-official/blockaid-client-node/issues/78)) ([9b26c89](https://github.com/blockaid-official/blockaid-client-node/commit/9b26c8928c8e7af4549cbf8bab51ab5b33320e8a))
* **api:** OpenAPI spec update via Stainless API ([#79](https://github.com/blockaid-official/blockaid-client-node/issues/79)) ([f772fc3](https://github.com/blockaid-official/blockaid-client-node/commit/f772fc32cefc1eb6494ac081c54de5c0e22ac8f5))
* **api:** OpenAPI spec update via Stainless API ([#80](https://github.com/blockaid-official/blockaid-client-node/issues/80)) ([2fd700e](https://github.com/blockaid-official/blockaid-client-node/commit/2fd700e246eec3941fe6b667fde7ae1829a7d88d))
* **api:** OpenAPI spec update via Stainless API ([#81](https://github.com/blockaid-official/blockaid-client-node/issues/81)) ([43d8394](https://github.com/blockaid-official/blockaid-client-node/commit/43d8394da993fa86925540f889924c8ab3d8db2d))
* **api:** OpenAPI spec update via Stainless API ([#82](https://github.com/blockaid-official/blockaid-client-node/issues/82)) ([b1ce8c4](https://github.com/blockaid-official/blockaid-client-node/commit/b1ce8c4d16f30bc85adbfa7fcf3090d4d1a4f183))
* **api:** OpenAPI spec update via Stainless API ([#83](https://github.com/blockaid-official/blockaid-client-node/issues/83)) ([81e0487](https://github.com/blockaid-official/blockaid-client-node/commit/81e0487640257cd7f225c30c03e410b422150245))
* **api:** OpenAPI spec update via Stainless API ([#84](https://github.com/blockaid-official/blockaid-client-node/issues/84)) ([ff8e660](https://github.com/blockaid-official/blockaid-client-node/commit/ff8e66025db78d2ea018143615ae64e42203c08c))
* **api:** OpenAPI spec update via Stainless API ([#85](https://github.com/blockaid-official/blockaid-client-node/issues/85)) ([10dc244](https://github.com/blockaid-official/blockaid-client-node/commit/10dc2445d408479b566d970eb0076fdd4cc52184))
* **api:** update via SDK Studio ([#65](https://github.com/blockaid-official/blockaid-client-node/issues/65)) ([721434c](https://github.com/blockaid-official/blockaid-client-node/commit/721434cbe255939269a5d8db665a7954a91e77b6))
* **api:** update via SDK Studio ([#67](https://github.com/blockaid-official/blockaid-client-node/issues/67)) ([94bd942](https://github.com/blockaid-official/blockaid-client-node/commit/94bd942f6ab851b02b7009a066d8aaef37a8f930))

## 0.10.0 (2024-06-02)

Full Changelog: [v0.9.2...v0.10.0](https://github.com/blockaid-official/blockaid-client-node/compare/v0.9.2...v0.10.0)
Expand Down
31 changes: 31 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,37 @@ Methods:

- <code title="post /v0/evm/user-operation/scan">client.evm.userOperation.<a href="./src/resources/evm/user-operation.ts">scan</a>({ ...params }) -> TransactionScanResponse</code>

## PostTransaction

Methods:

- <code title="post /v0/evm/post-transaction/scan">client.evm.postTransaction.<a href="./src/resources/evm/post-transaction.ts">scan</a>({ ...params }) -> TransactionScanResponse</code>

## PostTransactionBulk

Types:

- <code><a href="./src/resources/evm/post-transaction-bulk.ts">PostTransactionBulkScanResponse</a></code>

Methods:

- <code title="post /v0/evm/post-transaction-bulk/scan">client.evm.postTransactionBulk.<a href="./src/resources/evm/post-transaction-bulk.ts">scan</a>({ ...params }) -> PostTransactionBulkScanResponse</code>

# Stellar

Types:

- <code><a href="./src/resources/stellar/stellar.ts">StellarAssetContractDetailsSchema</a></code>
- <code><a href="./src/resources/stellar/stellar.ts">StellarAssetTransferDetailsSchema</a></code>
- <code><a href="./src/resources/stellar/stellar.ts">StellarTransactionScanRequest</a></code>
- <code><a href="./src/resources/stellar/stellar.ts">StellarTransactionScanResponse</a></code>

## Transaction

Methods:

- <code title="post /v0/stellar/scan/transaction">client.stellar.transaction.<a href="./src/resources/stellar/transaction.ts">scan</a>({ ...params }) -> StellarTransactionScanResponse</code>

# Site

Types:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@blockaid/client",
"version": "0.10.0",
"version": "0.11.0",
"description": "The official TypeScript library for the Blockaid API",
"author": "Blockaid <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
35 changes: 27 additions & 8 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
type HeadersInit,
} from './_shims/index';
export { type Response };
import { isMultipartBody } from './uploads';
import { BlobLike, isBlobLike, isMultipartBody } from './uploads';
export {
maybeMultipartFormRequestOptions,
multipartFormRequestOptions,
Expand Down Expand Up @@ -235,7 +235,17 @@ export abstract class APIClient {
path: string,
opts?: PromiseOrValue<RequestOptions<Req>>,
): APIPromise<Rsp> {
return this.request(Promise.resolve(opts).then((opts) => ({ method, path, ...opts })));
return this.request(
Promise.resolve(opts).then(async (opts) => {
const body =
opts && isBlobLike(opts?.body) ? new DataView(await opts.body.arrayBuffer())
: opts?.body instanceof DataView ? opts.body
: opts?.body instanceof ArrayBuffer ? new DataView(opts.body)
: opts && ArrayBuffer.isView(opts?.body) ? new DataView(opts.body.buffer)
: opts?.body;
return { method, path, ...opts, body };
}),
);
}

getAPIList<Item, PageClass extends AbstractPage<Item> = AbstractPage<Item>>(
Expand All @@ -257,6 +267,8 @@ export abstract class APIClient {
const encoded = encoder.encode(body);
return encoded.length.toString();
}
} else if (ArrayBuffer.isView(body)) {
return body.byteLength.toString();
}

return null;
Expand All @@ -266,7 +278,9 @@ export abstract class APIClient {
const { method, path, query, headers: headers = {} } = options;

const body =
isMultipartBody(options.body) ? options.body.body
ArrayBuffer.isView(options.body) || (options.__binaryRequest && typeof options.body === 'string') ?
options.body
: isMultipartBody(options.body) ? options.body.body
: options.body ? JSON.stringify(options.body, null, 2)
: null;
const contentLength = this.calculateContentLength(body);
Expand Down Expand Up @@ -721,7 +735,9 @@ export type Headers = Record<string, string | null | undefined>;
export type DefaultQuery = Record<string, string | undefined>;
export type KeysEnum<T> = { [P in keyof Required<T>]: true };

export type RequestOptions<Req = unknown | Record<string, unknown> | Readable> = {
export type RequestOptions<
Req = unknown | Record<string, unknown> | Readable | BlobLike | ArrayBufferView | ArrayBuffer,
> = {
method?: HTTPMethod;
path?: string;
query?: Req | undefined;
Expand All @@ -735,6 +751,7 @@ export type RequestOptions<Req = unknown | Record<string, unknown> | Readable> =
signal?: AbortSignal | undefined | null;
idempotencyKey?: string;

__binaryRequest?: boolean | undefined;
__binaryResponse?: boolean | undefined;
};

Expand All @@ -755,6 +772,7 @@ const requestOptionsKeys: KeysEnum<RequestOptions> = {
signal: true,
idempotencyKey: true,

__binaryRequest: true,
__binaryResponse: true,
};

Expand All @@ -767,10 +785,11 @@ export const isRequestOptions = (obj: unknown): obj is RequestOptions => {
);
};

export type FinalRequestOptions<Req = unknown | Record<string, unknown> | Readable> = RequestOptions<Req> & {
method: HTTPMethod;
path: string;
};
export type FinalRequestOptions<Req = unknown | Record<string, unknown> | Readable | DataView> =
RequestOptions<Req> & {
method: HTTPMethod;
path: string;
};

declare const Deno: any;
declare const EdgeRuntime: any;
Expand Down
16 changes: 13 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from './core';
import * as Errors from './error';
import { type Agent } from './_shims/index';
import * as Uploads from './uploads';
import { type Agent } from './_shims/index';
import * as Core from '@blockaid/client/core';
import * as API from '@blockaid/client/resources/index';

export interface ClientOptions {
Expand Down Expand Up @@ -69,7 +69,9 @@ export interface ClientOptions {
defaultQuery?: Core.DefaultQuery;
}

/** API Client for interfacing with the Blockaid API. */
/**
* API Client for interfacing with the Blockaid API.
*/
export class Blockaid extends Core.APIClient {
apiKey: string;

Expand Down Expand Up @@ -111,12 +113,14 @@ export class Blockaid extends Core.APIClient {
maxRetries: options.maxRetries,
fetch: options.fetch,
});

this._options = options;

this.apiKey = apiKey;
}

evm: API.Evm = new API.Evm(this);
stellar: API.Stellar = new API.Stellar(this);
site: API.Site = new API.Site(this);
token: API.Token = new API.Token(this);

Expand Down Expand Up @@ -206,6 +210,12 @@ export namespace Blockaid {
export import TransactionValidationError = API.TransactionValidationError;
export import UsdDiff = API.UsdDiff;

export import Stellar = API.Stellar;
export import StellarAssetContractDetailsSchema = API.StellarAssetContractDetailsSchema;
export import StellarAssetTransferDetailsSchema = API.StellarAssetTransferDetailsSchema;
export import StellarTransactionScanRequest = API.StellarTransactionScanRequest;
export import StellarTransactionScanResponse = API.StellarTransactionScanResponse;

export import Site = API.Site;
export import SiteScanHitResponse = API.SiteScanHitResponse;
export import SiteScanMissResponse = API.SiteScanMissResponse;
Expand Down
14 changes: 14 additions & 0 deletions src/resources/evm/evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import { APIResource } from '@blockaid/client/resource';
import * as EvmAPI from '@blockaid/client/resources/evm/evm';
import * as JsonRpcAPI from '@blockaid/client/resources/evm/json-rpc';
import * as PostTransactionAPI from '@blockaid/client/resources/evm/post-transaction';
import * as PostTransactionBulkAPI from '@blockaid/client/resources/evm/post-transaction-bulk';
import * as TransactionAPI from '@blockaid/client/resources/evm/transaction';
import * as TransactionBulkAPI from '@blockaid/client/resources/evm/transaction-bulk';
import * as TransactionRawAPI from '@blockaid/client/resources/evm/transaction-raw';
Expand All @@ -14,6 +16,9 @@ export class Evm extends APIResource {
transactionBulk: TransactionBulkAPI.TransactionBulk = new TransactionBulkAPI.TransactionBulk(this._client);
transactionRaw: TransactionRawAPI.TransactionRaw = new TransactionRawAPI.TransactionRaw(this._client);
userOperation: UserOperationAPI.UserOperation = new UserOperationAPI.UserOperation(this._client);
postTransaction: PostTransactionAPI.PostTransaction = new PostTransactionAPI.PostTransaction(this._client);
postTransactionBulk: PostTransactionBulkAPI.PostTransactionBulk =
new PostTransactionBulkAPI.PostTransactionBulk(this._client);
}

export interface AddressAssetExposure {
Expand Down Expand Up @@ -358,6 +363,7 @@ export type TokenScanSupportedChain =
| 'polygon'
| 'zora'
| 'solana'
| 'stellar'
| 'unknown';

export interface TransactionScanFeature {
Expand Down Expand Up @@ -387,6 +393,8 @@ export interface TransactionScanResponse {

chain: string;

account_address?: string;

events?: Array<TransactionScanResponse.Event>;

features?: unknown;
Expand Down Expand Up @@ -455,6 +463,7 @@ export type TransactionScanSupportedChain =
| 'optimism'
| 'polygon'
| 'zksync'
| 'zksync-sepolia'
| 'zora'
| 'linea'
| 'blast'
Expand Down Expand Up @@ -682,4 +691,9 @@ export namespace Evm {
export import TransactionRawScanParams = TransactionRawAPI.TransactionRawScanParams;
export import UserOperation = UserOperationAPI.UserOperation;
export import UserOperationScanParams = UserOperationAPI.UserOperationScanParams;
export import PostTransaction = PostTransactionAPI.PostTransaction;
export import PostTransactionScanParams = PostTransactionAPI.PostTransactionScanParams;
export import PostTransactionBulk = PostTransactionBulkAPI.PostTransactionBulk;
export import PostTransactionBulkScanResponse = PostTransactionBulkAPI.PostTransactionBulkScanResponse;
export import PostTransactionBulkScanParams = PostTransactionBulkAPI.PostTransactionBulkScanParams;
}
6 changes: 6 additions & 0 deletions src/resources/evm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export {
Evm,
} from './evm';
export { JsonRpcScanParams, JsonRpc } from './json-rpc';
export {
PostTransactionBulkScanResponse,
PostTransactionBulkScanParams,
PostTransactionBulk,
} from './post-transaction-bulk';
export { PostTransactionScanParams, PostTransaction } from './post-transaction';
export { TransactionBulkScanResponse, TransactionBulkScanParams, TransactionBulk } from './transaction-bulk';
export { TransactionRawScanParams, TransactionRaw } from './transaction-raw';
export { TransactionScanParams, Transaction } from './transaction';
Expand Down
2 changes: 1 addition & 1 deletion src/resources/evm/json-rpc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 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 Core from '@blockaid/client/core';
import * as JsonRpcAPI from '@blockaid/client/resources/evm/json-rpc';
import * as EvmAPI from '@blockaid/client/resources/evm/evm';

Expand Down
50 changes: 50 additions & 0 deletions src/resources/evm/post-transaction-bulk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// 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 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 hashes to scan
*/
data: Array<string>;

/**
* 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 PostTransactionBulk {
export import PostTransactionBulkScanResponse = PostTransactionBulkAPI.PostTransactionBulkScanResponse;
export import PostTransactionBulkScanParams = PostTransactionBulkAPI.PostTransactionBulkScanParams;
}
Loading

0 comments on commit 2c16687

Please sign in to comment.