From 807fdecbb07a69dee0ffde87cfa163a8d7bfac1e Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Sun, 10 Nov 2024 10:03:27 +0000 Subject: [PATCH 01/18] feat(api): api update (#302) --- api.md | 8 +- package.json | 2 +- src/index.ts | 2 - src/resources/index.ts | 2 - src/resources/stellar/index.ts | 10 +- src/resources/stellar/stellar.ts | 468 +---------------- src/resources/stellar/transaction.ts | 759 ++++++++++++++++++++++++++- 7 files changed, 766 insertions(+), 485 deletions(-) diff --git a/api.md b/api.md index 30382f9c..ce379d2c 100644 --- a/api.md +++ b/api.md @@ -149,14 +149,16 @@ Types: - StellarAssetContractDetailsSchema - StellarAssetTransferDetailsSchema -- StellarTransactionScanRequest -- StellarTransactionScanResponse ## Transaction +Types: + +- TransactionScanResponse + Methods: -- client.stellar.transaction.scan({ ...params }) -> StellarTransactionScanResponse +- client.stellar.transaction.scan({ ...params }) -> TransactionScanResponse # Bitcoin diff --git a/package.json b/package.json index c0e637d8..57e6fd28 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "packageManager": "yarn@1.22.22", "files": [ - "*" + "**/*" ], "private": false, "scripts": { diff --git a/src/index.ts b/src/index.ts index 44a82f94..0f5614fb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -329,8 +329,6 @@ export namespace Blockaid { 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 Bitcoin = API.Bitcoin; diff --git a/src/resources/index.ts b/src/resources/index.ts index c8b9c239..162a19d3 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -85,8 +85,6 @@ export { StarknetErc1155Diff, StarknetErc20Diff, StarknetErc721Diff, Starknet } export { StellarAssetContractDetailsSchema, StellarAssetTransferDetailsSchema, - StellarTransactionScanRequest, - StellarTransactionScanResponse, Stellar, } from './stellar/stellar'; export { TokenBulkScanResponse, TokenBulkScanParams, TokenBulk } from './token-bulk'; diff --git a/src/resources/stellar/index.ts b/src/resources/stellar/index.ts index cc3e5243..89e99239 100644 --- a/src/resources/stellar/index.ts +++ b/src/resources/stellar/index.ts @@ -1,10 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { - StellarAssetContractDetailsSchema, - StellarAssetTransferDetailsSchema, - StellarTransactionScanRequest, - StellarTransactionScanResponse, - Stellar, -} from './stellar'; -export { TransactionScanParams, Transaction } from './transaction'; +export { StellarAssetContractDetailsSchema, StellarAssetTransferDetailsSchema, Stellar } from './stellar'; +export { TransactionScanResponse, TransactionScanParams, Transaction } from './transaction'; diff --git a/src/resources/stellar/stellar.ts b/src/resources/stellar/stellar.ts index f8d8516b..bc8965ee 100644 --- a/src/resources/stellar/stellar.ts +++ b/src/resources/stellar/stellar.ts @@ -36,482 +36,26 @@ export interface StellarAssetTransferDetailsSchema { */ raw_value: number; - /** - * Value of the transfer - */ - value: number; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - /** * USD price of the asset */ - usd_price?: number; -} - -export interface StellarTransactionScanRequest { - account_address: string; + usd_price: string; /** - * A CAIP-2 chain ID or a Stellar network name - */ - chain: 'pubnet' | 'futurenet' | 'testnet'; - - /** - * Metadata - */ - metadata: - | StellarTransactionScanRequest.StellarWalletRequestMetadata - | StellarTransactionScanRequest.StellarInAppRequestMetadata; - - transaction: string; - - /** - * 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 StellarTransactionScanRequest { - 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 interface StellarTransactionScanResponse { - /** - * Simulation result; Only present if simulation option is included in the request + * Value of the transfer */ - simulation?: - | StellarTransactionScanResponse.StellarSimulationResultSchema - | StellarTransactionScanResponse.StellarSimulationErrorSchema - | null; + value: string; /** - * Validation result; Only present if validation option is included in the request + * Summarized description of the transfer */ - validation?: - | StellarTransactionScanResponse.StellarValidationResultSchema - | StellarTransactionScanResponse.StellarValidationErrorSchema - | null; -} - -export namespace StellarTransactionScanResponse { - export interface StellarSimulationResultSchema { - /** - * Summary of the actions and asset transfers that were made by the requested - * account address - */ - account_summary: StellarSimulationResultSchema.AccountSummary; - - status: 'Success'; - - /** - * Details of addresses involved in the transaction - */ - address_details?: Array; - - /** - * Mapping between the address of an account to the assets diff during the - * transaction - */ - assets_diffs?: Record>; - - /** - * Mapping between the address of an account to the ownership diff of the account - * during the transaction - */ - assets_ownership_diff?: Record>; - - /** - * Mapping between the address of an account to the exposure of the assets during - * the transaction - */ - exposures?: Record>; - } - - export namespace StellarSimulationResultSchema { - /** - * Summary of the actions and asset transfers that were made by the requested - * account address - */ - export interface AccountSummary { - /** - * Exposures made by the requested account address - */ - account_exposures: Array; - - /** - * Account ownerships diff of the requested account address - */ - account_ownerships_diff: Array; - - /** - * Total USD diff for the requested account address - */ - total_usd_diff: AccountSummary.TotalUsdDiff; - - /** - * Assets diffs of the requested account address - */ - assets_diffs?: Array; - - /** - * Total USD exposure for each of the spender addresses during the transaction - */ - total_usd_exposure?: Record; - } - - export namespace AccountSummary { - export interface AccountExposure { - asset: StellarAPI.StellarAssetContractDetailsSchema; - - /** - * Mapping between the address of a Spender to the exposure of the asset during the - * transaction - */ - spenders?: Record; - } - - export namespace AccountExposure { - export interface Spenders { - /** - * Raw value of the exposure - */ - raw_value: number; - - /** - * USD value of the exposure - */ - usd_price: number; - - /** - * Value of the exposure - */ - value: number; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - } - - export interface AccountOwnershipsDiff { - /** - * List of public keys that can sign on behalf of the account post-transaction - */ - post_signers: Array; - - /** - * List of public keys that can sign on behalf of the account pre-transaction - */ - pre_signers: Array; - - type: 'SET_OPTIONS'; - } - - /** - * Total USD diff for the requested account address - */ - export interface TotalUsdDiff { - /** - * Total incoming USD transfers - */ - in: number; - - /** - * Total outgoing USD transfers - */ - out: number; - - /** - * Total USD transfers - */ - total?: number; - } - - export interface AssetsDiff { - /** - * Asset involved in the transfer - */ - asset: - | AssetsDiff.StellarLegacyAssetDetailsSchema - | AssetsDiff.StellarNativeAssetDetailsSchema - | StellarAPI.StellarAssetContractDetailsSchema; - - /** - * Incoming transfers of the asset - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Outgoing transfers of the asset - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - - export namespace AssetsDiff { - export interface StellarLegacyAssetDetailsSchema { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; - } - - export interface StellarNativeAssetDetailsSchema { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - } - } - - export interface AddressDetail { - /** - * Encoded public key of the account - */ - account_address: string; - - /** - * Description of the account - */ - description?: string | null; - } - - export interface AssetsDiff { - /** - * Asset involved in the transfer - */ - asset: - | AssetsDiff.StellarLegacyAssetDetailsSchema - | AssetsDiff.StellarNativeAssetDetailsSchema - | StellarAPI.StellarAssetContractDetailsSchema; - - /** - * Incoming transfers of the asset - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Outgoing transfers of the asset - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - - export namespace AssetsDiff { - export interface StellarLegacyAssetDetailsSchema { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; - } - - export interface StellarNativeAssetDetailsSchema { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - } - - export interface AssetsOwnershipDiff { - /** - * List of public keys that can sign on behalf of the account post-transaction - */ - post_signers: Array; - - /** - * List of public keys that can sign on behalf of the account pre-transaction - */ - pre_signers: Array; - - type: 'SET_OPTIONS'; - } - - export interface Exposure { - asset: StellarAPI.StellarAssetContractDetailsSchema; - - /** - * Mapping between the address of a Spender to the exposure of the asset during the - * transaction - */ - spenders?: Record; - } - - export namespace Exposure { - export interface Spenders { - /** - * Raw value of the exposure - */ - raw_value: number; - - /** - * USD value of the exposure - */ - usd_price: number; - - /** - * Value of the exposure - */ - value: number; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - } - } - - export interface StellarSimulationErrorSchema { - /** - * Error message - */ - error: string; - - status: 'Error'; - } - - export interface StellarValidationResultSchema { - /** - * A textual classification that can be presented to the user explaining the - * reason. - */ - classification: string; - - /** - * A textual description about the validation result - */ - description: string; - - /** - * A list of features about this transaction explaining the validation - */ - features: Array; - - /** - * A textual description about the reasons the transaction was flagged with - * result_type - */ - reason: string; - - /** - * Verdict of the validation - */ - result_type: 'Benign' | 'Warning' | 'Malicious'; - - status: 'Success'; - } - - export namespace StellarValidationResultSchema { - export interface Feature { - /** - * Address the feature refers to - */ - address: string; - - /** - * Textual description - */ - description: string; - - feature_id: string; - - /** - * Feature Classification - */ - type: 'Benign' | 'Warning' | 'Malicious' | 'Info'; - } - } - - export interface StellarValidationErrorSchema { - /** - * Error message - */ - error: string; - - status: 'Error'; - } + summary?: string | null; } export namespace Stellar { export import StellarAssetContractDetailsSchema = StellarAPI.StellarAssetContractDetailsSchema; export import StellarAssetTransferDetailsSchema = StellarAPI.StellarAssetTransferDetailsSchema; - export import StellarTransactionScanRequest = StellarAPI.StellarTransactionScanRequest; - export import StellarTransactionScanResponse = StellarAPI.StellarTransactionScanResponse; export import Transaction = TransactionAPI.Transaction; + export import TransactionScanResponse = TransactionAPI.TransactionScanResponse; export import TransactionScanParams = TransactionAPI.TransactionScanParams; } diff --git a/src/resources/stellar/transaction.ts b/src/resources/stellar/transaction.ts index 89def815..7c9e914a 100644 --- a/src/resources/stellar/transaction.ts +++ b/src/resources/stellar/transaction.ts @@ -9,14 +9,757 @@ export class Transaction extends APIResource { /** * Scan Transaction */ - scan( - body: TransactionScanParams, - options?: Core.RequestOptions, - ): Core.APIPromise { + scan(body: TransactionScanParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.post('/v0/stellar/transaction/scan', { body, ...options }); } } +export interface TransactionScanResponse { + /** + * Simulation result; Only present if simulation option is included in the request + */ + simulation?: + | TransactionScanResponse.StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration + | TransactionScanResponse.StellarSimulationErrorSchema + | null; + + /** + * Validation result; Only present if validation option is included in the request + */ + validation?: + | TransactionScanResponse.StellarValidationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchema + | TransactionScanResponse.StellarValidationErrorSchema + | null; +} + +export namespace TransactionScanResponse { + export interface StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration { + /** + * Summary of the actions and asset transfers that were made by the requested + * account address + */ + account_summary: StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.AccountSummary; + + /** + * Ownership diffs of the account addresses + */ + assets_ownership_diff: Record< + string, + Array + >; + + status: 'Success'; + + /** + * Details of addresses involved in the transaction + */ + address_details?: Array; + + /** + * Mapping between the address of an account to the assets diff during the + * transaction + */ + assets_diffs?: Record< + string, + Array< + | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema + | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema + | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchema + > + >; + + /** + * Mapping between the address of an account to the exposure of the assets during + * the transaction + */ + exposures?: Record< + string, + Array< + | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema + | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema + > + >; + } + + export namespace StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration { + /** + * Summary of the actions and asset transfers that were made by the requested + * account address + */ + export interface AccountSummary { + /** + * Exposures made by the requested account address + */ + account_exposures: Array< + | AccountSummary.StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema + | AccountSummary.StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema + >; + + /** + * Ownership diffs of the requested account address + */ + account_ownerships_diff: Array; + + /** + * Total USD diff for the requested account address + */ + total_usd_diff: AccountSummary.TotalUsdDiff; + + /** + * Assets diffs of the requested account address + */ + account_assets_diffs?: Array< + | AccountSummary.StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema + | AccountSummary.StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema + | AccountSummary.StellarAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchema + >; + + /** + * Total USD exposure for each of the spender addresses during the transaction + */ + total_usd_exposure?: Record; + } + + export namespace AccountSummary { + export interface StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema { + asset: StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema.Asset; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record< + string, + StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema.Spenders + >; + } + + export namespace StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema { + export interface Asset { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; + + /** + * Organization name + */ + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; + } + + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + } + + export interface StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema { + asset: StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema.Asset; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record< + string, + StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema.Spenders + >; + } + + export namespace StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema { + export interface Asset { + /** + * Asset code + */ + code?: 'XLM'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; + } + + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + } + + export interface AccountOwnershipsDiff { + /** + * List of public keys that can sign on behalf of the account post-transaction + */ + post_signers: Array; + + /** + * List of public keys that can sign on behalf of the account pre-transaction + */ + pre_signers: Array; + + type?: 'SET_OPTIONS'; + } + + /** + * Total USD diff for the requested account address + */ + export interface TotalUsdDiff { + /** + * Total incoming USD transfers + */ + in: number; + + /** + * Total outgoing USD transfers + */ + out: number; + + /** + * Total USD transfers + */ + total?: number; + } + + export interface StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema { + asset: StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export namespace StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema { + export interface Asset { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; + + /** + * Organization name + */ + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; + } + } + + export interface StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema { + asset: StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export namespace StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema { + export interface Asset { + /** + * Asset code + */ + code?: 'XLM'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; + } + } + + export interface StellarAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchema { + asset: StellarAPI.StellarAssetContractDetailsSchema; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + } + + export interface AssetsOwnershipDiff { + /** + * List of public keys that can sign on behalf of the account post-transaction + */ + post_signers: Array; + + /** + * List of public keys that can sign on behalf of the account pre-transaction + */ + pre_signers: Array; + + type?: 'SET_OPTIONS'; + } + + export interface AddressDetail { + /** + * Encoded public key of the account + */ + account_address: unknown; + + /** + * Description of the account + */ + description?: string | null; + } + + export interface StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema { + asset: StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export namespace StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema { + export interface Asset { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; + + /** + * Organization name + */ + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; + } + } + + export interface StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema { + asset: StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export namespace StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema { + export interface Asset { + /** + * Asset code + */ + code?: 'XLM'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; + } + } + + export interface StellarAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchema { + asset: StellarAPI.StellarAssetContractDetailsSchema; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export interface StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema { + asset: StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema.Asset; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record< + string, + StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema.Spenders + >; + } + + export namespace StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema { + export interface Asset { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; + + /** + * Organization name + */ + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; + } + + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + } + + export interface StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema { + asset: StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema.Asset; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record< + string, + StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema.Spenders + >; + } + + export namespace StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema { + export interface Asset { + /** + * Asset code + */ + code?: 'XLM'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; + } + + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + } + } + + export interface StellarSimulationErrorSchema { + /** + * Error message + */ + error: string; + + status: 'Error'; + } + + export interface StellarValidationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchema { + /** + * A textual classification that can be presented to the user explaining the + * reason. + */ + classification: string; + + /** + * A textual description about the validation result + */ + description: string; + + /** + * A list of features about this transaction explaining the validation + */ + features: Array; + + /** + * A textual description about the reasons the transaction was flagged with + * result_type + */ + reason: string; + + /** + * Verdict of the validation + */ + result_type: 'Benign' | 'Warning' | 'Malicious'; + + status: 'Success'; + } + + export namespace StellarValidationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchema { + export interface Feature { + /** + * Address the feature refers to + */ + address: string; + + /** + * Textual description + */ + description: string; + + feature_id: string; + + /** + * Feature Classification + */ + type: 'Benign' | 'Warning' | 'Malicious' | 'Info'; + } + } + + export interface StellarValidationErrorSchema { + /** + * Error message + */ + error: string; + + status: 'Error'; + } +} + export interface TransactionScanParams { account_address: string; @@ -37,8 +780,9 @@ export interface TransactionScanParams { /** * 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.validation`: Include Options.validation output in the response + * + * - `Options.simulation`: Include Options.simulation output in the response */ options?: Array<'validation' | 'simulation'>; } @@ -60,10 +804,11 @@ export namespace TransactionScanParams { /** * Metadata for in-app requests */ - type: 'in_app'; + type?: 'in_app'; } } export namespace Transaction { + export import TransactionScanResponse = TransactionAPI.TransactionScanResponse; export import TransactionScanParams = TransactionAPI.TransactionScanParams; } From 41acd8dff941c9d348c2ae3ce2eac104d7121713 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Sun, 10 Nov 2024 10:23:23 +0000 Subject: [PATCH 02/18] feat(api): api update (#304) --- .gitignore | 2 +- .stats.yml | 2 +- api.md | 3 - scripts/build | 2 +- src/core.ts | 10 +- src/error.ts | 2 +- src/index.ts | 317 ++++++++++++++------- src/resources/bitcoin/bitcoin.ts | 13 +- src/resources/bitcoin/index.ts | 2 +- src/resources/bitcoin/transaction.ts | 9 +- src/resources/evm/evm.ts | 145 ++++++---- src/resources/evm/index.ts | 98 ++++--- src/resources/evm/json-rpc.ts | 5 +- src/resources/evm/post-transaction-bulk.ts | 9 +- src/resources/evm/post-transaction.ts | 11 +- src/resources/evm/transaction-bulk.ts | 9 +- src/resources/evm/transaction-raw.ts | 5 +- src/resources/evm/transaction.ts | 11 +- src/resources/evm/user-operation.ts | 5 +- src/resources/index.ts | 168 +++++------ src/resources/site.ts | 17 +- src/resources/solana/address.ts | 5 +- src/resources/solana/index.ts | 67 +++-- src/resources/solana/message.ts | 5 +- src/resources/solana/solana.ts | 240 ++++++++++------ src/resources/starknet/index.ts | 9 +- src/resources/starknet/starknet.ts | 23 +- src/resources/starknet/transaction.ts | 9 +- src/resources/stellar/index.ts | 8 +- src/resources/stellar/stellar.ts | 21 +- src/resources/stellar/transaction.ts | 9 +- src/resources/token-bulk.ts | 9 +- src/resources/token.ts | 13 +- tsconfig.deno.json | 11 +- tsconfig.json | 3 +- 35 files changed, 768 insertions(+), 509 deletions(-) diff --git a/.gitignore b/.gitignore index 3eed6ddf..d98d51a8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ yarn-error.log codegen.log Brewfile.lock.json dist -/deno +dist-deno /*.tgz .idea/ diff --git a/.stats.yml b/.stats.yml index 6cfc969f..b74b3b45 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 19 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-247e47596e9ade7b9e7bb4e1ae9f3febeff30e98066b7fef4daae8eb60673fd2.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-68190ea619cfe126cdb1d0d08d55d0701e87c1cb45aaaf714807e2fc0bdde5e6.yml diff --git a/api.md b/api.md index ce379d2c..e1d4a1b7 100644 --- a/api.md +++ b/api.md @@ -109,8 +109,6 @@ Types: - DelegatedAssetDetailsSchema - FungibleMintAccountDetailsSchema - InstructionErrorDetails -- NativeSolDetailsSchema -- NativeSolDiffSchema - NativeSolOwnershipDiffSchema - NonFungibleMintAccountDetailsSchema - PdaAccountSchema @@ -121,7 +119,6 @@ Types: - SplNonFungibleTokenDetailsSchema - SplNonFungibleTokenDiffSchema - SplTokenOwnershipDiffSchema -- StakedSolAssetDetailsSchema - StakedSolWithdrawAuthorityDiffSchema - SuccessfulSimulationResultSchema - SystemAccountDetailsSchema diff --git a/scripts/build b/scripts/build index 44e3c050..736a6557 100755 --- a/scripts/build +++ b/scripts/build @@ -50,7 +50,7 @@ node scripts/utils/postprocess-files.cjs (cd dist && node -e 'require("@blockaid/client")') (cd dist && node -e 'import("@blockaid/client")' --input-type=module) -if command -v deno &> /dev/null && [ -e ./scripts/build-deno ] +if [ -e ./scripts/build-deno ] then ./scripts/build-deno fi diff --git a/src/core.ts b/src/core.ts index 3bdcb54c..950c2397 100644 --- a/src/core.ts +++ b/src/core.ts @@ -396,7 +396,7 @@ export abstract class APIClient { error: Object | undefined, message: string | undefined, headers: Headers | undefined, - ) { + ): APIError { return APIError.generate(status, error, message, headers); } @@ -668,9 +668,9 @@ export abstract class AbstractPage implements AsyncIterable { return await this.#client.requestAPIList(this.constructor as any, nextOptions); } - async *iterPages() { + async *iterPages(): AsyncGenerator { // eslint-disable-next-line @typescript-eslint/no-this-alias - let page: AbstractPage = this; + let page: this = this; yield page; while (page.hasNextPage()) { page = await page.getNextPage(); @@ -678,7 +678,7 @@ export abstract class AbstractPage implements AsyncIterable { } } - async *[Symbol.asyncIterator]() { + async *[Symbol.asyncIterator](): AsyncGenerator { for await (const page of this.iterPages()) { for (const item of page.getPaginatedItems()) { yield item; @@ -721,7 +721,7 @@ export class PagePromise< * console.log(item) * } */ - async *[Symbol.asyncIterator]() { + async *[Symbol.asyncIterator](): AsyncGenerator { const page = await this; for await (const item of page) { yield item; diff --git a/src/error.ts b/src/error.ts index 354059a9..847a3022 100644 --- a/src/error.ts +++ b/src/error.ts @@ -47,7 +47,7 @@ export class APIError extends BlockaidError { errorResponse: Object | undefined, message: string | undefined, headers: Headers | undefined, - ) { + ): APIError { if (!status) { return new APIConnectionError({ message, cause: castToError(errorResponse) }); } diff --git a/src/index.ts b/src/index.ts index 0f5614fb..7f1443d8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,99 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Errors from './error'; -import * as Uploads from './uploads'; import { type Agent } from './_shims/index'; import * as Core from './core'; +import * as Errors from './error'; +import * as Uploads from './uploads'; import * as API from './resources/index'; +import { + Site, + SiteReportParams, + SiteReportResponse, + SiteScanHitResponse, + SiteScanMissResponse, + SiteScanParams, + SiteScanResponse, +} from './resources/site'; +import { + Token, + TokenReportParams, + TokenReportResponse, + TokenScanParams, + TokenScanResponse, +} from './resources/token'; +import { TokenBulk, TokenBulkScanParams, TokenBulkScanResponse } from './resources/token-bulk'; +import { Bitcoin } from './resources/bitcoin/bitcoin'; +import { + AddressAssetExposure, + AssetDiff, + Erc1155Diff, + Erc1155Exposure, + Erc1155TokenDetails, + Erc20Diff, + Erc20Exposure, + Erc20TokenDetails, + Erc721Diff, + Erc721Exposure, + Erc721TokenDetails, + Evm, + Metadata, + NativeAssetDetails, + NativeDiff, + NonercTokenDetails, + TokenScanSupportedChain, + TransactionScanFeature, + TransactionScanResponse, + TransactionScanSupportedChain, + TransactionSimulation, + TransactionSimulationError, + TransactionValidation, + TransactionValidationError, + UsdDiff, +} from './resources/evm/evm'; +import { + APIErrorDetails, + AccountSummarySchema, + AddressScanRequestSchema, + AddressScanResponseSchema, + AssetTransferDetailsSchema, + CnftDetailsSchema, + CnftDiffSchema, + CnftMintAccountDetailsSchema, + CombinedValidationResult, + DelegatedAssetDetailsSchema, + FungibleMintAccountDetailsSchema, + InstructionErrorDetails, + NativeSolOwnershipDiffSchema, + NonFungibleMintAccountDetailsSchema, + PdaAccountSchema, + ProgramAccountDetailsSchema, + ResponseSchema, + Solana, + SplFungibleTokenDetailsSchema, + SplFungibleTokenDiffSchema, + SplNonFungibleTokenDetailsSchema, + SplNonFungibleTokenDiffSchema, + SplTokenOwnershipDiffSchema, + StakedSolWithdrawAuthorityDiffSchema, + SuccessfulSimulationResultSchema, + SystemAccountDetailsSchema, + TokenAccountDetailsSchema, + TotalUsdDiffSchema, + TransactionErrorDetails, + TxScanRequestSchema, + ValidationFeature, +} from './resources/solana/solana'; +import { + Starknet, + StarknetErc1155Diff, + StarknetErc20Diff, + StarknetErc721Diff, +} from './resources/starknet/starknet'; +import { + Stellar, + StellarAssetContractDetailsSchema, + StellarAssetTransferDetailsSchema, +} from './resources/stellar/stellar'; const environments = { production: 'https://api.blockaid.io', @@ -235,7 +324,7 @@ export class Blockaid extends Core.APIClient { static fileFromPath = Uploads.fileFromPath; } -export const { +export { BlockaidError, APIError, APIConnectionError, @@ -249,111 +338,131 @@ export const { InternalServerError, PermissionDeniedError, UnprocessableEntityError, -} = Errors; +} from './error'; export import toFile = Uploads.toFile; export import fileFromPath = Uploads.fileFromPath; -export namespace Blockaid { - export import RequestOptions = Core.RequestOptions; - - export import Evm = API.Evm; - export import AddressAssetExposure = API.AddressAssetExposure; - export import AssetDiff = API.AssetDiff; - export import Erc1155AddressAssetExposure = API.Erc1155AddressAssetExposure; - export import Erc1155Diff = API.Erc1155Diff; - export import Erc1155Exposure = API.Erc1155Exposure; - export import Erc1155TokenDetails = API.Erc1155TokenDetails; - export import Erc20AddressAssetExposure = API.Erc20AddressAssetExposure; - export import Erc20Diff = API.Erc20Diff; - export import Erc20Exposure = API.Erc20Exposure; - export import Erc20TokenDetails = API.Erc20TokenDetails; - export import Erc721AddressAssetExposure = API.Erc721AddressAssetExposure; - export import Erc721Diff = API.Erc721Diff; - export import Erc721Exposure = API.Erc721Exposure; - export import Erc721TokenDetails = API.Erc721TokenDetails; - export import Metadata = API.Metadata; - export import NativeAssetDetails = API.NativeAssetDetails; - export import NativeDiff = API.NativeDiff; - export import NonercAddressAssetExposure = API.NonercAddressAssetExposure; - export import NonercDiff = API.NonercDiff; - export import NonercExposure = API.NonercExposure; - export import NonercTokenDetails = API.NonercTokenDetails; - export import TokenScanSupportedChain = API.TokenScanSupportedChain; - export import TransactionScanFeature = API.TransactionScanFeature; - export import TransactionScanResponse = API.TransactionScanResponse; - export import TransactionScanSupportedChain = API.TransactionScanSupportedChain; - export import TransactionSimulationResponse = API.TransactionSimulationResponse; - export import TransactionSimulation = API.TransactionSimulation; - export import TransactionSimulationError = API.TransactionSimulationError; - export import TransactionValidationResponse = API.TransactionValidationResponse; - export import TransactionValidation = API.TransactionValidation; - export import TransactionValidationError = API.TransactionValidationError; - export import UsdDiff = API.UsdDiff; - - export import Solana = API.Solana; - export import AccountSummarySchema = API.AccountSummarySchema; - export import AddressScanRequestSchema = API.AddressScanRequestSchema; - export import AddressScanResponseSchema = API.AddressScanResponseSchema; - export import APIErrorDetails = API.APIErrorDetails; - export import AssetTransferDetailsSchema = API.AssetTransferDetailsSchema; - export import CnftDetailsSchema = API.CnftDetailsSchema; - export import CnftDiffSchema = API.CnftDiffSchema; - export import CnftMintAccountDetailsSchema = API.CnftMintAccountDetailsSchema; - export import CombinedValidationResult = API.CombinedValidationResult; - export import DelegatedAssetDetailsSchema = API.DelegatedAssetDetailsSchema; - export import FungibleMintAccountDetailsSchema = API.FungibleMintAccountDetailsSchema; - export import InstructionErrorDetails = API.InstructionErrorDetails; - export import NativeSolDetailsSchema = API.NativeSolDetailsSchema; - export import NativeSolDiffSchema = API.NativeSolDiffSchema; - export import NativeSolOwnershipDiffSchema = API.NativeSolOwnershipDiffSchema; - export import NonFungibleMintAccountDetailsSchema = API.NonFungibleMintAccountDetailsSchema; - export import PdaAccountSchema = API.PdaAccountSchema; - export import ProgramAccountDetailsSchema = API.ProgramAccountDetailsSchema; - export import ResponseSchema = API.ResponseSchema; - export import SplFungibleTokenDetailsSchema = API.SplFungibleTokenDetailsSchema; - export import SplFungibleTokenDiffSchema = API.SplFungibleTokenDiffSchema; - export import SplNonFungibleTokenDetailsSchema = API.SplNonFungibleTokenDetailsSchema; - export import SplNonFungibleTokenDiffSchema = API.SplNonFungibleTokenDiffSchema; - export import SplTokenOwnershipDiffSchema = API.SplTokenOwnershipDiffSchema; - export import StakedSolAssetDetailsSchema = API.StakedSolAssetDetailsSchema; - export import StakedSolWithdrawAuthorityDiffSchema = API.StakedSolWithdrawAuthorityDiffSchema; - export import SuccessfulSimulationResultSchema = API.SuccessfulSimulationResultSchema; - export import SystemAccountDetailsSchema = API.SystemAccountDetailsSchema; - export import TokenAccountDetailsSchema = API.TokenAccountDetailsSchema; - export import TotalUsdDiffSchema = API.TotalUsdDiffSchema; - export import TransactionErrorDetails = API.TransactionErrorDetails; - export import TxScanRequestSchema = API.TxScanRequestSchema; - export import ValidationFeature = API.ValidationFeature; - - export import Stellar = API.Stellar; - export import StellarAssetContractDetailsSchema = API.StellarAssetContractDetailsSchema; - export import StellarAssetTransferDetailsSchema = API.StellarAssetTransferDetailsSchema; - - export import Bitcoin = API.Bitcoin; - - export import Starknet = API.Starknet; - export import StarknetErc1155Diff = API.StarknetErc1155Diff; - export import StarknetErc20Diff = API.StarknetErc20Diff; - export import StarknetErc721Diff = API.StarknetErc721Diff; - - export import Site = API.Site; - export import SiteScanHitResponse = API.SiteScanHitResponse; - export import SiteScanMissResponse = API.SiteScanMissResponse; - export import SiteReportResponse = API.SiteReportResponse; - export import SiteScanResponse = API.SiteScanResponse; - export import SiteReportParams = API.SiteReportParams; - export import SiteScanParams = API.SiteScanParams; - - export import Token = API.Token; - export import TokenReportResponse = API.TokenReportResponse; - export import TokenScanResponse = API.TokenScanResponse; - export import TokenReportParams = API.TokenReportParams; - export import TokenScanParams = API.TokenScanParams; - - export import TokenBulk = API.TokenBulk; - export import TokenBulkScanResponse = API.TokenBulkScanResponse; - export import TokenBulkScanParams = API.TokenBulkScanParams; +Blockaid.Evm = Evm; +Blockaid.Solana = Solana; +Blockaid.Stellar = Stellar; +Blockaid.Bitcoin = Bitcoin; +Blockaid.Starknet = Starknet; +Blockaid.Site = Site; +Blockaid.Token = Token; +Blockaid.TokenBulk = TokenBulk; + +export declare namespace Blockaid { + export type RequestOptions = Core.RequestOptions; + + export { + Evm as Evm, + type AddressAssetExposure as AddressAssetExposure, + type AssetDiff as AssetDiff, + type Erc1155AddressAssetExposure as Erc1155AddressAssetExposure, + type Erc1155Diff as Erc1155Diff, + type Erc1155Exposure as Erc1155Exposure, + type Erc1155TokenDetails as Erc1155TokenDetails, + type Erc20AddressAssetExposure as Erc20AddressAssetExposure, + type Erc20Diff as Erc20Diff, + type Erc20Exposure as Erc20Exposure, + type Erc20TokenDetails as Erc20TokenDetails, + type Erc721AddressAssetExposure as Erc721AddressAssetExposure, + type Erc721Diff as Erc721Diff, + type Erc721Exposure as Erc721Exposure, + type Erc721TokenDetails as Erc721TokenDetails, + type Metadata as Metadata, + type NativeAssetDetails as NativeAssetDetails, + type NativeDiff as NativeDiff, + type NonercAddressAssetExposure as NonercAddressAssetExposure, + type NonercDiff as NonercDiff, + type NonercExposure as NonercExposure, + type NonercTokenDetails as NonercTokenDetails, + type TokenScanSupportedChain as TokenScanSupportedChain, + type TransactionScanFeature as TransactionScanFeature, + type TransactionScanResponse as TransactionScanResponse, + type TransactionScanSupportedChain as TransactionScanSupportedChain, + type TransactionSimulationResponse as TransactionSimulationResponse, + type TransactionSimulation as TransactionSimulation, + type TransactionSimulationError as TransactionSimulationError, + type TransactionValidationResponse as TransactionValidationResponse, + type TransactionValidation as TransactionValidation, + type TransactionValidationError as TransactionValidationError, + type UsdDiff as UsdDiff, + }; + + export { + Solana as Solana, + type AccountSummarySchema as AccountSummarySchema, + type AddressScanRequestSchema as AddressScanRequestSchema, + type AddressScanResponseSchema as AddressScanResponseSchema, + type APIErrorDetails as APIErrorDetails, + type AssetTransferDetailsSchema as AssetTransferDetailsSchema, + type CnftDetailsSchema as CnftDetailsSchema, + type CnftDiffSchema as CnftDiffSchema, + type CnftMintAccountDetailsSchema as CnftMintAccountDetailsSchema, + type CombinedValidationResult as CombinedValidationResult, + type DelegatedAssetDetailsSchema as DelegatedAssetDetailsSchema, + type FungibleMintAccountDetailsSchema as FungibleMintAccountDetailsSchema, + type InstructionErrorDetails as InstructionErrorDetails, + type NativeSolOwnershipDiffSchema as NativeSolOwnershipDiffSchema, + type NonFungibleMintAccountDetailsSchema as NonFungibleMintAccountDetailsSchema, + type PdaAccountSchema as PdaAccountSchema, + type ProgramAccountDetailsSchema as ProgramAccountDetailsSchema, + type ResponseSchema as ResponseSchema, + type SplFungibleTokenDetailsSchema as SplFungibleTokenDetailsSchema, + type SplFungibleTokenDiffSchema as SplFungibleTokenDiffSchema, + type SplNonFungibleTokenDetailsSchema as SplNonFungibleTokenDetailsSchema, + type SplNonFungibleTokenDiffSchema as SplNonFungibleTokenDiffSchema, + type SplTokenOwnershipDiffSchema as SplTokenOwnershipDiffSchema, + type StakedSolWithdrawAuthorityDiffSchema as StakedSolWithdrawAuthorityDiffSchema, + type SuccessfulSimulationResultSchema as SuccessfulSimulationResultSchema, + type SystemAccountDetailsSchema as SystemAccountDetailsSchema, + type TokenAccountDetailsSchema as TokenAccountDetailsSchema, + type TotalUsdDiffSchema as TotalUsdDiffSchema, + type TransactionErrorDetails as TransactionErrorDetails, + type TxScanRequestSchema as TxScanRequestSchema, + type ValidationFeature as ValidationFeature, + }; + + export { + Stellar as Stellar, + type StellarAssetContractDetailsSchema as StellarAssetContractDetailsSchema, + type StellarAssetTransferDetailsSchema as StellarAssetTransferDetailsSchema, + }; + + export { Bitcoin as Bitcoin }; + + export { + Starknet as Starknet, + type StarknetErc1155Diff as StarknetErc1155Diff, + type StarknetErc20Diff as StarknetErc20Diff, + type StarknetErc721Diff as StarknetErc721Diff, + }; + + export { + Site as Site, + type SiteScanHitResponse as SiteScanHitResponse, + type SiteScanMissResponse as SiteScanMissResponse, + type SiteReportResponse as SiteReportResponse, + type SiteScanResponse as SiteScanResponse, + type SiteReportParams as SiteReportParams, + type SiteScanParams as SiteScanParams, + }; + + export { + Token as Token, + type TokenReportResponse as TokenReportResponse, + type TokenScanResponse as TokenScanResponse, + type TokenReportParams as TokenReportParams, + type TokenScanParams as TokenScanParams, + }; + + export { + TokenBulk as TokenBulk, + type TokenBulkScanResponse as TokenBulkScanResponse, + type TokenBulkScanParams as TokenBulkScanParams, + }; } export default Blockaid; diff --git a/src/resources/bitcoin/bitcoin.ts b/src/resources/bitcoin/bitcoin.ts index 7c3680f8..e6ba4f57 100644 --- a/src/resources/bitcoin/bitcoin.ts +++ b/src/resources/bitcoin/bitcoin.ts @@ -2,13 +2,18 @@ import { APIResource } from '../../resource'; import * as TransactionAPI from './transaction'; +import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; export class Bitcoin extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); } -export namespace Bitcoin { - export import Transaction = TransactionAPI.Transaction; - export import TransactionScanResponse = TransactionAPI.TransactionScanResponse; - export import TransactionScanParams = TransactionAPI.TransactionScanParams; +Bitcoin.Transaction = Transaction; + +export declare namespace Bitcoin { + export { + Transaction as Transaction, + type TransactionScanResponse as TransactionScanResponse, + type TransactionScanParams as TransactionScanParams, + }; } diff --git a/src/resources/bitcoin/index.ts b/src/resources/bitcoin/index.ts index a11d87dd..5692cbb7 100644 --- a/src/resources/bitcoin/index.ts +++ b/src/resources/bitcoin/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Bitcoin } from './bitcoin'; -export { TransactionScanResponse, TransactionScanParams, Transaction } from './transaction'; +export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; diff --git a/src/resources/bitcoin/transaction.ts b/src/resources/bitcoin/transaction.ts index 236edba6..3988851a 100644 --- a/src/resources/bitcoin/transaction.ts +++ b/src/resources/bitcoin/transaction.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as TransactionAPI from './transaction'; export class Transaction extends APIResource { /** @@ -475,7 +474,9 @@ export namespace TransactionScanParams { } } -export namespace Transaction { - export import TransactionScanResponse = TransactionAPI.TransactionScanResponse; - export import TransactionScanParams = TransactionAPI.TransactionScanParams; +export declare namespace Transaction { + export { + type TransactionScanResponse as TransactionScanResponse, + type TransactionScanParams as TransactionScanParams, + }; } diff --git a/src/resources/evm/evm.ts b/src/resources/evm/evm.ts index 339877cc..1697a8f0 100644 --- a/src/resources/evm/evm.ts +++ b/src/resources/evm/evm.ts @@ -3,12 +3,33 @@ import { APIResource } from '../../resource'; import * as EvmAPI from './evm'; import * as JsonRpcAPI from './json-rpc'; +import { JsonRpc, JsonRpcScanParams } from './json-rpc'; import * as PostTransactionAPI from './post-transaction'; +import { + PostTransaction, + PostTransactionReportParams, + PostTransactionReportResponse, + PostTransactionScanParams, +} from './post-transaction'; import * as PostTransactionBulkAPI from './post-transaction-bulk'; +import { + PostTransactionBulk, + PostTransactionBulkScanParams, + PostTransactionBulkScanResponse, +} from './post-transaction-bulk'; import * as TransactionAPI from './transaction'; +import { + Transaction, + TransactionReportParams, + TransactionReportResponse, + TransactionScanParams, +} from './transaction'; import * as TransactionBulkAPI from './transaction-bulk'; +import { TransactionBulk, TransactionBulkScanParams, TransactionBulkScanResponse } from './transaction-bulk'; import * as TransactionRawAPI from './transaction-raw'; +import { TransactionRaw, TransactionRawScanParams } from './transaction-raw'; import * as UserOperationAPI from './user-operation'; +import { UserOperation, UserOperationScanParams } from './user-operation'; export class Evm extends APIResource { jsonRpc: JsonRpcAPI.JsonRpc = new JsonRpcAPI.JsonRpc(this._client); @@ -1051,53 +1072,79 @@ export interface UsdDiff { total: string; } -export namespace Evm { - export import AddressAssetExposure = EvmAPI.AddressAssetExposure; - export import AssetDiff = EvmAPI.AssetDiff; - export import Erc1155AddressAssetExposure = EvmAPI.Erc1155AddressAssetExposure; - export import Erc1155Diff = EvmAPI.Erc1155Diff; - export import Erc1155Exposure = EvmAPI.Erc1155Exposure; - export import Erc1155TokenDetails = EvmAPI.Erc1155TokenDetails; - export import Erc20AddressAssetExposure = EvmAPI.Erc20AddressAssetExposure; - export import Erc20Diff = EvmAPI.Erc20Diff; - export import Erc20Exposure = EvmAPI.Erc20Exposure; - export import Erc20TokenDetails = EvmAPI.Erc20TokenDetails; - export import Erc721AddressAssetExposure = EvmAPI.Erc721AddressAssetExposure; - export import Erc721Diff = EvmAPI.Erc721Diff; - export import Erc721Exposure = EvmAPI.Erc721Exposure; - export import Erc721TokenDetails = EvmAPI.Erc721TokenDetails; - export import Metadata = EvmAPI.Metadata; - export import NativeAssetDetails = EvmAPI.NativeAssetDetails; - export import NativeDiff = EvmAPI.NativeDiff; - export import NonercAddressAssetExposure = EvmAPI.NonercAddressAssetExposure; - export import NonercDiff = EvmAPI.NonercDiff; - export import NonercExposure = EvmAPI.NonercExposure; - export import NonercTokenDetails = EvmAPI.NonercTokenDetails; - export import TokenScanSupportedChain = EvmAPI.TokenScanSupportedChain; - export import TransactionScanFeature = EvmAPI.TransactionScanFeature; - export import TransactionScanResponse = EvmAPI.TransactionScanResponse; - export import TransactionScanSupportedChain = EvmAPI.TransactionScanSupportedChain; - export import TransactionSimulationResponse = EvmAPI.TransactionSimulationResponse; - export import TransactionSimulation = EvmAPI.TransactionSimulation; - export import TransactionSimulationError = EvmAPI.TransactionSimulationError; - export import TransactionValidationResponse = EvmAPI.TransactionValidationResponse; - export import TransactionValidation = EvmAPI.TransactionValidation; - export import TransactionValidationError = EvmAPI.TransactionValidationError; - export import UsdDiff = EvmAPI.UsdDiff; - export import JsonRpc = JsonRpcAPI.JsonRpc; - export import JsonRpcScanParams = JsonRpcAPI.JsonRpcScanParams; - export import Transaction = TransactionAPI.Transaction; - export import TransactionScanParams = TransactionAPI.TransactionScanParams; - export import TransactionBulk = TransactionBulkAPI.TransactionBulk; - export import TransactionBulkScanResponse = TransactionBulkAPI.TransactionBulkScanResponse; - export import TransactionBulkScanParams = TransactionBulkAPI.TransactionBulkScanParams; - export import TransactionRaw = TransactionRawAPI.TransactionRaw; - 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; +Evm.JsonRpc = JsonRpc; +Evm.Transaction = Transaction; +Evm.TransactionBulk = TransactionBulk; +Evm.TransactionRaw = TransactionRaw; +Evm.UserOperation = UserOperation; +Evm.PostTransaction = PostTransaction; +Evm.PostTransactionBulk = PostTransactionBulk; + +export declare namespace Evm { + export { + type AddressAssetExposure as AddressAssetExposure, + type AssetDiff as AssetDiff, + type Erc1155AddressAssetExposure as Erc1155AddressAssetExposure, + type Erc1155Diff as Erc1155Diff, + type Erc1155Exposure as Erc1155Exposure, + type Erc1155TokenDetails as Erc1155TokenDetails, + type Erc20AddressAssetExposure as Erc20AddressAssetExposure, + type Erc20Diff as Erc20Diff, + type Erc20Exposure as Erc20Exposure, + type Erc20TokenDetails as Erc20TokenDetails, + type Erc721AddressAssetExposure as Erc721AddressAssetExposure, + type Erc721Diff as Erc721Diff, + type Erc721Exposure as Erc721Exposure, + type Erc721TokenDetails as Erc721TokenDetails, + type Metadata as Metadata, + type NativeAssetDetails as NativeAssetDetails, + type NativeDiff as NativeDiff, + type NonercAddressAssetExposure as NonercAddressAssetExposure, + type NonercDiff as NonercDiff, + type NonercExposure as NonercExposure, + type NonercTokenDetails as NonercTokenDetails, + type TokenScanSupportedChain as TokenScanSupportedChain, + type TransactionScanFeature as TransactionScanFeature, + type TransactionScanResponse as TransactionScanResponse, + type TransactionScanSupportedChain as TransactionScanSupportedChain, + type TransactionSimulationResponse as TransactionSimulationResponse, + type TransactionSimulation as TransactionSimulation, + type TransactionSimulationError as TransactionSimulationError, + type TransactionValidationResponse as TransactionValidationResponse, + type TransactionValidation as TransactionValidation, + type TransactionValidationError as TransactionValidationError, + type UsdDiff as UsdDiff, + }; + + export { JsonRpc as JsonRpc, type JsonRpcScanParams as JsonRpcScanParams }; + + export { + Transaction as Transaction, + type TransactionReportResponse as TransactionReportResponse, + type TransactionReportParams as TransactionReportParams, + type TransactionScanParams as TransactionScanParams, + }; + + export { + TransactionBulk as TransactionBulk, + type TransactionBulkScanResponse as TransactionBulkScanResponse, + type TransactionBulkScanParams as TransactionBulkScanParams, + }; + + export { TransactionRaw as TransactionRaw, type TransactionRawScanParams as TransactionRawScanParams }; + + export { UserOperation as UserOperation, type UserOperationScanParams as UserOperationScanParams }; + + export { + PostTransaction as PostTransaction, + type PostTransactionReportResponse as PostTransactionReportResponse, + type PostTransactionReportParams as PostTransactionReportParams, + type PostTransactionScanParams as PostTransactionScanParams, + }; + + export { + PostTransactionBulk as PostTransactionBulk, + type PostTransactionBulkScanResponse as PostTransactionBulkScanResponse, + type PostTransactionBulkScanParams as PostTransactionBulkScanParams, + }; } diff --git a/src/resources/evm/index.ts b/src/resources/evm/index.ts index d9eef4e8..d066df35 100644 --- a/src/resources/evm/index.ts +++ b/src/resources/evm/index.ts @@ -1,58 +1,62 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - AddressAssetExposure, - AssetDiff, - Erc1155AddressAssetExposure, - Erc1155Diff, - Erc1155Exposure, - Erc1155TokenDetails, - Erc20AddressAssetExposure, - Erc20Diff, - Erc20Exposure, - Erc20TokenDetails, - Erc721AddressAssetExposure, - Erc721Diff, - Erc721Exposure, - Erc721TokenDetails, - Metadata, - NativeAssetDetails, - NativeDiff, - NonercAddressAssetExposure, - NonercDiff, - NonercExposure, - NonercTokenDetails, - TokenScanSupportedChain, - TransactionScanFeature, - TransactionScanResponse, - TransactionScanSupportedChain, - TransactionSimulationResponse, - TransactionSimulation, - TransactionSimulationError, - TransactionValidationResponse, - TransactionValidation, - TransactionValidationError, - UsdDiff, Evm, + type AddressAssetExposure, + type AssetDiff, + type Erc1155AddressAssetExposure, + type Erc1155Diff, + type Erc1155Exposure, + type Erc1155TokenDetails, + type Erc20AddressAssetExposure, + type Erc20Diff, + type Erc20Exposure, + type Erc20TokenDetails, + type Erc721AddressAssetExposure, + type Erc721Diff, + type Erc721Exposure, + type Erc721TokenDetails, + type Metadata, + type NativeAssetDetails, + type NativeDiff, + type NonercAddressAssetExposure, + type NonercDiff, + type NonercExposure, + type NonercTokenDetails, + type TokenScanSupportedChain, + type TransactionScanFeature, + type TransactionScanResponse, + type TransactionScanSupportedChain, + type TransactionSimulationResponse, + type TransactionSimulation, + type TransactionSimulationError, + type TransactionValidationResponse, + type TransactionValidation, + type TransactionValidationError, + type UsdDiff, } from './evm'; -export { JsonRpcScanParams, JsonRpc } from './json-rpc'; +export { JsonRpc, type JsonRpcScanParams } from './json-rpc'; export { - PostTransactionBulkScanResponse, - PostTransactionBulkScanParams, - PostTransactionBulk, -} from './post-transaction-bulk'; -export { - PostTransactionReportResponse, - PostTransactionReportParams, - PostTransactionScanParams, PostTransaction, + type PostTransactionReportResponse, + type PostTransactionReportParams, + type PostTransactionScanParams, } from './post-transaction'; -export { TransactionBulkScanResponse, TransactionBulkScanParams, TransactionBulk } from './transaction-bulk'; -export { TransactionRawScanParams, TransactionRaw } from './transaction-raw'; export { - TransactionReportResponse, - TransactionReportParams, - TransactionScanParams, + PostTransactionBulk, + type PostTransactionBulkScanResponse, + type PostTransactionBulkScanParams, +} from './post-transaction-bulk'; +export { Transaction, + type TransactionReportResponse, + type TransactionReportParams, + type TransactionScanParams, } from './transaction'; -export { UserOperationScanParams, UserOperation } from './user-operation'; +export { + TransactionBulk, + type TransactionBulkScanResponse, + type TransactionBulkScanParams, +} from './transaction-bulk'; +export { TransactionRaw, type TransactionRawScanParams } from './transaction-raw'; +export { UserOperation, type UserOperationScanParams } from './user-operation'; diff --git a/src/resources/evm/json-rpc.ts b/src/resources/evm/json-rpc.ts index 7bbd207c..f6baad49 100644 --- a/src/resources/evm/json-rpc.ts +++ b/src/resources/evm/json-rpc.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as JsonRpcAPI from './json-rpc'; import * as EvmAPI from './evm'; export class JsonRpc extends APIResource { @@ -70,6 +69,6 @@ export namespace JsonRpcScanParams { } } -export namespace JsonRpc { - export import JsonRpcScanParams = JsonRpcAPI.JsonRpcScanParams; +export declare namespace JsonRpc { + export { type JsonRpcScanParams as JsonRpcScanParams }; } diff --git a/src/resources/evm/post-transaction-bulk.ts b/src/resources/evm/post-transaction-bulk.ts index 7cefedc0..64c0031f 100644 --- a/src/resources/evm/post-transaction-bulk.ts +++ b/src/resources/evm/post-transaction-bulk.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as PostTransactionBulkAPI from './post-transaction-bulk'; import * as EvmAPI from './evm'; export class PostTransactionBulk extends APIResource { @@ -49,7 +48,9 @@ export interface PostTransactionBulkScanParams { options?: Array<'validation' | 'simulation' | 'gas_estimation' | 'events'>; } -export namespace PostTransactionBulk { - export import PostTransactionBulkScanResponse = PostTransactionBulkAPI.PostTransactionBulkScanResponse; - export import PostTransactionBulkScanParams = PostTransactionBulkAPI.PostTransactionBulkScanParams; +export declare namespace PostTransactionBulk { + export { + type PostTransactionBulkScanResponse as PostTransactionBulkScanResponse, + type PostTransactionBulkScanParams as PostTransactionBulkScanParams, + }; } diff --git a/src/resources/evm/post-transaction.ts b/src/resources/evm/post-transaction.ts index 23a37371..622f0fb3 100644 --- a/src/resources/evm/post-transaction.ts +++ b/src/resources/evm/post-transaction.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as PostTransactionAPI from './post-transaction'; import * as EvmAPI from './evm'; export class PostTransaction extends APIResource { @@ -109,8 +108,10 @@ export namespace PostTransactionScanParams { } } -export namespace PostTransaction { - export import PostTransactionReportResponse = PostTransactionAPI.PostTransactionReportResponse; - export import PostTransactionReportParams = PostTransactionAPI.PostTransactionReportParams; - export import PostTransactionScanParams = PostTransactionAPI.PostTransactionScanParams; +export declare namespace PostTransaction { + export { + type PostTransactionReportResponse as PostTransactionReportResponse, + type PostTransactionReportParams as PostTransactionReportParams, + type PostTransactionScanParams as PostTransactionScanParams, + }; } diff --git a/src/resources/evm/transaction-bulk.ts b/src/resources/evm/transaction-bulk.ts index c45a78c6..58ca7f97 100644 --- a/src/resources/evm/transaction-bulk.ts +++ b/src/resources/evm/transaction-bulk.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as TransactionBulkAPI from './transaction-bulk'; import * as EvmAPI from './evm'; export class TransactionBulk extends APIResource { @@ -85,7 +84,9 @@ export namespace TransactionBulkScanParams { } } -export namespace TransactionBulk { - export import TransactionBulkScanResponse = TransactionBulkAPI.TransactionBulkScanResponse; - export import TransactionBulkScanParams = TransactionBulkAPI.TransactionBulkScanParams; +export declare namespace TransactionBulk { + export { + type TransactionBulkScanResponse as TransactionBulkScanResponse, + type TransactionBulkScanParams as TransactionBulkScanParams, + }; } diff --git a/src/resources/evm/transaction-raw.ts b/src/resources/evm/transaction-raw.ts index 12a7ab50..231f2b85 100644 --- a/src/resources/evm/transaction-raw.ts +++ b/src/resources/evm/transaction-raw.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as TransactionRawAPI from './transaction-raw'; import * as EvmAPI from './evm'; export class TransactionRaw extends APIResource { @@ -54,6 +53,6 @@ export interface TransactionRawScanParams { options?: Array<'validation' | 'simulation' | 'gas_estimation' | 'events'>; } -export namespace TransactionRaw { - export import TransactionRawScanParams = TransactionRawAPI.TransactionRawScanParams; +export declare namespace TransactionRaw { + export { type TransactionRawScanParams as TransactionRawScanParams }; } diff --git a/src/resources/evm/transaction.ts b/src/resources/evm/transaction.ts index f0cf0237..e9842fe7 100644 --- a/src/resources/evm/transaction.ts +++ b/src/resources/evm/transaction.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as TransactionAPI from './transaction'; import * as EvmAPI from './evm'; export class Transaction extends APIResource { @@ -204,8 +203,10 @@ export namespace TransactionScanParams { } } -export namespace Transaction { - export import TransactionReportResponse = TransactionAPI.TransactionReportResponse; - export import TransactionReportParams = TransactionAPI.TransactionReportParams; - export import TransactionScanParams = TransactionAPI.TransactionScanParams; +export declare namespace Transaction { + export { + type TransactionReportResponse as TransactionReportResponse, + type TransactionReportParams as TransactionReportParams, + type TransactionScanParams as TransactionScanParams, + }; } diff --git a/src/resources/evm/user-operation.ts b/src/resources/evm/user-operation.ts index 8da06b47..3efcdfcf 100644 --- a/src/resources/evm/user-operation.ts +++ b/src/resources/evm/user-operation.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as UserOperationAPI from './user-operation'; import * as EvmAPI from './evm'; export class UserOperation extends APIResource { @@ -132,6 +131,6 @@ export namespace UserOperationScanParams { } } -export namespace UserOperation { - export import UserOperationScanParams = UserOperationAPI.UserOperationScanParams; +export declare namespace UserOperation { + export { type UserOperationScanParams as UserOperationScanParams }; } diff --git a/src/resources/index.ts b/src/resources/index.ts index 162a19d3..b787a44f 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -1,91 +1,99 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { Bitcoin } from './bitcoin/bitcoin'; export { - AccountSummarySchema, - AddressScanRequestSchema, - AddressScanResponseSchema, - APIErrorDetails, - AssetTransferDetailsSchema, - CnftDetailsSchema, - CnftDiffSchema, - CnftMintAccountDetailsSchema, - CombinedValidationResult, - DelegatedAssetDetailsSchema, - FungibleMintAccountDetailsSchema, - InstructionErrorDetails, - NativeSolDetailsSchema, - NativeSolDiffSchema, - NativeSolOwnershipDiffSchema, - NonFungibleMintAccountDetailsSchema, - PdaAccountSchema, - ProgramAccountDetailsSchema, - ResponseSchema, - SplFungibleTokenDetailsSchema, - SplFungibleTokenDiffSchema, - SplNonFungibleTokenDetailsSchema, - SplNonFungibleTokenDiffSchema, - SplTokenOwnershipDiffSchema, - StakedSolAssetDetailsSchema, - StakedSolWithdrawAuthorityDiffSchema, - SuccessfulSimulationResultSchema, - SystemAccountDetailsSchema, - TokenAccountDetailsSchema, - TotalUsdDiffSchema, - TransactionErrorDetails, - TxScanRequestSchema, - ValidationFeature, - Solana, -} from './solana/solana'; -export { - AddressAssetExposure, - AssetDiff, - Erc1155AddressAssetExposure, - Erc1155Diff, - Erc1155Exposure, - Erc1155TokenDetails, - Erc20AddressAssetExposure, - Erc20Diff, - Erc20Exposure, - Erc20TokenDetails, - Erc721AddressAssetExposure, - Erc721Diff, - Erc721Exposure, - Erc721TokenDetails, - Metadata, - NativeAssetDetails, - NativeDiff, - NonercAddressAssetExposure, - NonercDiff, - NonercExposure, - NonercTokenDetails, - TokenScanSupportedChain, - TransactionScanFeature, - TransactionScanResponse, - TransactionScanSupportedChain, - TransactionSimulationResponse, - TransactionSimulation, - TransactionSimulationError, - TransactionValidationResponse, - TransactionValidation, - TransactionValidationError, - UsdDiff, Evm, + type AddressAssetExposure, + type AssetDiff, + type Erc1155AddressAssetExposure, + type Erc1155Diff, + type Erc1155Exposure, + type Erc1155TokenDetails, + type Erc20AddressAssetExposure, + type Erc20Diff, + type Erc20Exposure, + type Erc20TokenDetails, + type Erc721AddressAssetExposure, + type Erc721Diff, + type Erc721Exposure, + type Erc721TokenDetails, + type Metadata, + type NativeAssetDetails, + type NativeDiff, + type NonercAddressAssetExposure, + type NonercDiff, + type NonercExposure, + type NonercTokenDetails, + type TokenScanSupportedChain, + type TransactionScanFeature, + type TransactionScanResponse, + type TransactionScanSupportedChain, + type TransactionSimulationResponse, + type TransactionSimulation, + type TransactionSimulationError, + type TransactionValidationResponse, + type TransactionValidation, + type TransactionValidationError, + type UsdDiff, } from './evm/evm'; -export { Bitcoin } from './bitcoin/bitcoin'; export { - SiteScanHitResponse, - SiteScanMissResponse, - SiteReportResponse, - SiteScanResponse, - SiteReportParams, - SiteScanParams, Site, + type SiteScanHitResponse, + type SiteScanMissResponse, + type SiteReportResponse, + type SiteScanResponse, + type SiteReportParams, + type SiteScanParams, } from './site'; -export { StarknetErc1155Diff, StarknetErc20Diff, StarknetErc721Diff, Starknet } from './starknet/starknet'; export { - StellarAssetContractDetailsSchema, - StellarAssetTransferDetailsSchema, + Solana, + type AccountSummarySchema, + type AddressScanRequestSchema, + type AddressScanResponseSchema, + type APIErrorDetails, + type AssetTransferDetailsSchema, + type CnftDetailsSchema, + type CnftDiffSchema, + type CnftMintAccountDetailsSchema, + type CombinedValidationResult, + type DelegatedAssetDetailsSchema, + type FungibleMintAccountDetailsSchema, + type InstructionErrorDetails, + type NativeSolOwnershipDiffSchema, + type NonFungibleMintAccountDetailsSchema, + type PdaAccountSchema, + type ProgramAccountDetailsSchema, + type ResponseSchema, + type SplFungibleTokenDetailsSchema, + type SplFungibleTokenDiffSchema, + type SplNonFungibleTokenDetailsSchema, + type SplNonFungibleTokenDiffSchema, + type SplTokenOwnershipDiffSchema, + type StakedSolWithdrawAuthorityDiffSchema, + type SuccessfulSimulationResultSchema, + type SystemAccountDetailsSchema, + type TokenAccountDetailsSchema, + type TotalUsdDiffSchema, + type TransactionErrorDetails, + type TxScanRequestSchema, + type ValidationFeature, +} from './solana/solana'; +export { + Starknet, + type StarknetErc1155Diff, + type StarknetErc20Diff, + type StarknetErc721Diff, +} from './starknet/starknet'; +export { Stellar, + type StellarAssetContractDetailsSchema, + type StellarAssetTransferDetailsSchema, } from './stellar/stellar'; -export { TokenBulkScanResponse, TokenBulkScanParams, TokenBulk } from './token-bulk'; -export { TokenReportResponse, TokenScanResponse, TokenReportParams, TokenScanParams, Token } from './token'; +export { + Token, + type TokenReportResponse, + type TokenScanResponse, + type TokenReportParams, + type TokenScanParams, +} from './token'; +export { TokenBulk, type TokenBulkScanResponse, type TokenBulkScanParams } from './token-bulk'; diff --git a/src/resources/site.ts b/src/resources/site.ts index 5c7e8347..d072df31 100644 --- a/src/resources/site.ts +++ b/src/resources/site.ts @@ -2,7 +2,6 @@ import { APIResource } from '../resource'; import * as Core from '../core'; -import * as SiteAPI from './site'; export class Site extends APIResource { /** @@ -156,11 +155,13 @@ export namespace SiteScanParams { } } -export namespace Site { - export import SiteScanHitResponse = SiteAPI.SiteScanHitResponse; - export import SiteScanMissResponse = SiteAPI.SiteScanMissResponse; - export import SiteReportResponse = SiteAPI.SiteReportResponse; - export import SiteScanResponse = SiteAPI.SiteScanResponse; - export import SiteReportParams = SiteAPI.SiteReportParams; - export import SiteScanParams = SiteAPI.SiteScanParams; +export declare namespace Site { + export { + type SiteScanHitResponse as SiteScanHitResponse, + type SiteScanMissResponse as SiteScanMissResponse, + type SiteReportResponse as SiteReportResponse, + type SiteScanResponse as SiteScanResponse, + type SiteReportParams as SiteReportParams, + type SiteScanParams as SiteScanParams, + }; } diff --git a/src/resources/solana/address.ts b/src/resources/solana/address.ts index 4861d5a3..4eaa545f 100644 --- a/src/resources/solana/address.ts +++ b/src/resources/solana/address.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as AddressAPI from './address'; import * as SolanaAPI from './solana'; export class Address extends APIResource { @@ -42,6 +41,6 @@ export namespace AddressScanParams { } } -export namespace Address { - export import AddressScanParams = AddressAPI.AddressScanParams; +export declare namespace Address { + export { type AddressScanParams as AddressScanParams }; } diff --git a/src/resources/solana/index.ts b/src/resources/solana/index.ts index 21812c88..34d17466 100644 --- a/src/resources/solana/index.ts +++ b/src/resources/solana/index.ts @@ -1,40 +1,37 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { Address, type AddressScanParams } from './address'; +export { Message, type MessageScanParams } from './message'; export { - AccountSummarySchema, - AddressScanRequestSchema, - AddressScanResponseSchema, - APIErrorDetails, - AssetTransferDetailsSchema, - CnftDetailsSchema, - CnftDiffSchema, - CnftMintAccountDetailsSchema, - CombinedValidationResult, - DelegatedAssetDetailsSchema, - FungibleMintAccountDetailsSchema, - InstructionErrorDetails, - NativeSolDetailsSchema, - NativeSolDiffSchema, - NativeSolOwnershipDiffSchema, - NonFungibleMintAccountDetailsSchema, - PdaAccountSchema, - ProgramAccountDetailsSchema, - ResponseSchema, - SplFungibleTokenDetailsSchema, - SplFungibleTokenDiffSchema, - SplNonFungibleTokenDetailsSchema, - SplNonFungibleTokenDiffSchema, - SplTokenOwnershipDiffSchema, - StakedSolAssetDetailsSchema, - StakedSolWithdrawAuthorityDiffSchema, - SuccessfulSimulationResultSchema, - SystemAccountDetailsSchema, - TokenAccountDetailsSchema, - TotalUsdDiffSchema, - TransactionErrorDetails, - TxScanRequestSchema, - ValidationFeature, Solana, + type AccountSummarySchema, + type AddressScanRequestSchema, + type AddressScanResponseSchema, + type APIErrorDetails, + type AssetTransferDetailsSchema, + type CnftDetailsSchema, + type CnftDiffSchema, + type CnftMintAccountDetailsSchema, + type CombinedValidationResult, + type DelegatedAssetDetailsSchema, + type FungibleMintAccountDetailsSchema, + type InstructionErrorDetails, + type NativeSolOwnershipDiffSchema, + type NonFungibleMintAccountDetailsSchema, + type PdaAccountSchema, + type ProgramAccountDetailsSchema, + type ResponseSchema, + type SplFungibleTokenDetailsSchema, + type SplFungibleTokenDiffSchema, + type SplNonFungibleTokenDetailsSchema, + type SplNonFungibleTokenDiffSchema, + type SplTokenOwnershipDiffSchema, + type StakedSolWithdrawAuthorityDiffSchema, + type SuccessfulSimulationResultSchema, + type SystemAccountDetailsSchema, + type TokenAccountDetailsSchema, + type TotalUsdDiffSchema, + type TransactionErrorDetails, + type TxScanRequestSchema, + type ValidationFeature, } from './solana'; -export { AddressScanParams, Address } from './address'; -export { MessageScanParams, Message } from './message'; diff --git a/src/resources/solana/message.ts b/src/resources/solana/message.ts index 6175a69e..a3ee9610 100644 --- a/src/resources/solana/message.ts +++ b/src/resources/solana/message.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as MessageAPI from './message'; import * as SolanaAPI from './solana'; export class Message extends APIResource { @@ -54,6 +53,6 @@ export namespace MessageScanParams { } } -export namespace Message { - export import MessageScanParams = MessageAPI.MessageScanParams; +export declare namespace Message { + export { type MessageScanParams as MessageScanParams }; } diff --git a/src/resources/solana/solana.ts b/src/resources/solana/solana.ts index 191a5a9f..4530f483 100644 --- a/src/resources/solana/solana.ts +++ b/src/resources/solana/solana.ts @@ -3,7 +3,9 @@ import { APIResource } from '../../resource'; import * as SolanaAPI from './solana'; import * as AddressAPI from './address'; +import { Address, AddressScanParams } from './address'; import * as MessageAPI from './message'; +import { Message, MessageScanParams } from './message'; export class Solana extends APIResource { message: MessageAPI.Message = new MessageAPI.Message(this._client); @@ -20,7 +22,10 @@ export interface AccountSummarySchema { * Assets diff of the requested account address */ account_assets_diff?: Array< - NativeSolDiffSchema | SplFungibleTokenDiffSchema | SplNonFungibleTokenDiffSchema | CnftDiffSchema + | AccountSummarySchema.NativeDiffSchema + | SplFungibleTokenDiffSchema + | SplNonFungibleTokenDiffSchema + | CnftDiffSchema >; /** @@ -36,6 +41,40 @@ export interface AccountSummarySchema { >; } +export namespace AccountSummarySchema { + export interface NativeDiffSchema { + asset: NativeDiffSchema.Asset; + + /** + * Type of the asset involved in the transfer + */ + asset_type: string; + + /** + * Incoming transfers of the asset + */ + in?: SolanaAPI.AssetTransferDetailsSchema | null; + + out?: SolanaAPI.AssetTransferDetailsSchema | null; + } + + export namespace NativeDiffSchema { + export interface Asset { + decimals?: number; + + /** + * Logo of the native currency + */ + logo?: string | null; + + /** + * Type of the asset (`"NativeToken"`) + */ + type?: string; + } + } +} + export interface AddressScanRequestSchema { /** * Encoded public key @@ -322,38 +361,8 @@ export interface InstructionErrorDetails { type?: string; } -export interface NativeSolDetailsSchema { - decimals?: number; - - /** - * Logo of Sol - */ - logo?: string | null; - - /** - * Type of the asset (`"SOL"`) - */ - type?: string; -} - -export interface NativeSolDiffSchema { - asset: NativeSolDetailsSchema; - - /** - * Type of the asset involved in the transfer - */ - asset_type: string; - - /** - * Incoming transfers of the asset - */ - in?: AssetTransferDetailsSchema | null; - - out?: AssetTransferDetailsSchema | null; -} - export interface NativeSolOwnershipDiffSchema { - asset: NativeSolDetailsSchema; + asset: NativeSolOwnershipDiffSchema.Asset; /** * Type of the asset involved in the transfer @@ -381,6 +390,22 @@ export interface NativeSolOwnershipDiffSchema { pre_owner?: string | null; } +export namespace NativeSolOwnershipDiffSchema { + export interface Asset { + decimals?: number; + + /** + * Logo of the native currency + */ + logo?: string | null; + + /** + * Type of the asset (`"NativeToken"`) + */ + type?: string; + } +} + export interface NonFungibleMintAccountDetailsSchema { /** * Encoded public key of the account @@ -590,20 +615,6 @@ export interface SplTokenOwnershipDiffSchema { pre_owner?: string | null; } -export interface StakedSolAssetDetailsSchema { - decimals?: number; - - /** - * Logo of Sol - */ - logo?: string | null; - - /** - * Type of the asset (`"STAKED_SOL"`) - */ - type?: string; -} - export interface StakedSolWithdrawAuthorityDiffSchema { /** * Type of the asset involved in the transfer @@ -615,7 +626,7 @@ export interface StakedSolWithdrawAuthorityDiffSchema { */ post_owner: string; - asset?: StakedSolAssetDetailsSchema; + asset?: StakedSolWithdrawAuthorityDiffSchema.Asset; /** * Incoming transfers of the asset @@ -633,6 +644,22 @@ export interface StakedSolWithdrawAuthorityDiffSchema { pre_owner?: string | null; } +export namespace StakedSolWithdrawAuthorityDiffSchema { + export interface Asset { + decimals?: number; + + /** + * Logo of the native currency + */ + logo?: string | null; + + /** + * Type of the asset (`"STAKED_NATIVE"`) + */ + type?: string; + } +} + export interface SuccessfulSimulationResultSchema { /** * Summary of the requested account address @@ -657,7 +684,12 @@ export interface SuccessfulSimulationResultSchema { */ assets_diff: Record< string, - Array + Array< + | SuccessfulSimulationResultSchema.NativeDiffSchema + | SplFungibleTokenDiffSchema + | SplNonFungibleTokenDiffSchema + | CnftDiffSchema + > >; /** @@ -674,6 +706,40 @@ export interface SuccessfulSimulationResultSchema { delegations: Record>; } +export namespace SuccessfulSimulationResultSchema { + export interface NativeDiffSchema { + asset: NativeDiffSchema.Asset; + + /** + * Type of the asset involved in the transfer + */ + asset_type: string; + + /** + * Incoming transfers of the asset + */ + in?: SolanaAPI.AssetTransferDetailsSchema | null; + + out?: SolanaAPI.AssetTransferDetailsSchema | null; + } + + export namespace NativeDiffSchema { + export interface Asset { + decimals?: number; + + /** + * Logo of the native currency + */ + logo?: string | null; + + /** + * Type of the asset (`"NativeToken"`) + */ + type?: string; + } + } +} + export interface SystemAccountDetailsSchema { /** * Encoded public key of the account @@ -825,42 +891,44 @@ export interface ValidationFeature { address?: string | null; } -export namespace Solana { - export import AccountSummarySchema = SolanaAPI.AccountSummarySchema; - export import AddressScanRequestSchema = SolanaAPI.AddressScanRequestSchema; - export import AddressScanResponseSchema = SolanaAPI.AddressScanResponseSchema; - export import APIErrorDetails = SolanaAPI.APIErrorDetails; - export import AssetTransferDetailsSchema = SolanaAPI.AssetTransferDetailsSchema; - export import CnftDetailsSchema = SolanaAPI.CnftDetailsSchema; - export import CnftDiffSchema = SolanaAPI.CnftDiffSchema; - export import CnftMintAccountDetailsSchema = SolanaAPI.CnftMintAccountDetailsSchema; - export import CombinedValidationResult = SolanaAPI.CombinedValidationResult; - export import DelegatedAssetDetailsSchema = SolanaAPI.DelegatedAssetDetailsSchema; - export import FungibleMintAccountDetailsSchema = SolanaAPI.FungibleMintAccountDetailsSchema; - export import InstructionErrorDetails = SolanaAPI.InstructionErrorDetails; - export import NativeSolDetailsSchema = SolanaAPI.NativeSolDetailsSchema; - export import NativeSolDiffSchema = SolanaAPI.NativeSolDiffSchema; - export import NativeSolOwnershipDiffSchema = SolanaAPI.NativeSolOwnershipDiffSchema; - export import NonFungibleMintAccountDetailsSchema = SolanaAPI.NonFungibleMintAccountDetailsSchema; - export import PdaAccountSchema = SolanaAPI.PdaAccountSchema; - export import ProgramAccountDetailsSchema = SolanaAPI.ProgramAccountDetailsSchema; - export import ResponseSchema = SolanaAPI.ResponseSchema; - export import SplFungibleTokenDetailsSchema = SolanaAPI.SplFungibleTokenDetailsSchema; - export import SplFungibleTokenDiffSchema = SolanaAPI.SplFungibleTokenDiffSchema; - export import SplNonFungibleTokenDetailsSchema = SolanaAPI.SplNonFungibleTokenDetailsSchema; - export import SplNonFungibleTokenDiffSchema = SolanaAPI.SplNonFungibleTokenDiffSchema; - export import SplTokenOwnershipDiffSchema = SolanaAPI.SplTokenOwnershipDiffSchema; - export import StakedSolAssetDetailsSchema = SolanaAPI.StakedSolAssetDetailsSchema; - export import StakedSolWithdrawAuthorityDiffSchema = SolanaAPI.StakedSolWithdrawAuthorityDiffSchema; - export import SuccessfulSimulationResultSchema = SolanaAPI.SuccessfulSimulationResultSchema; - export import SystemAccountDetailsSchema = SolanaAPI.SystemAccountDetailsSchema; - export import TokenAccountDetailsSchema = SolanaAPI.TokenAccountDetailsSchema; - export import TotalUsdDiffSchema = SolanaAPI.TotalUsdDiffSchema; - export import TransactionErrorDetails = SolanaAPI.TransactionErrorDetails; - export import TxScanRequestSchema = SolanaAPI.TxScanRequestSchema; - export import ValidationFeature = SolanaAPI.ValidationFeature; - export import Message = MessageAPI.Message; - export import MessageScanParams = MessageAPI.MessageScanParams; - export import Address = AddressAPI.Address; - export import AddressScanParams = AddressAPI.AddressScanParams; +Solana.Message = Message; +Solana.Address = Address; + +export declare namespace Solana { + export { + type AccountSummarySchema as AccountSummarySchema, + type AddressScanRequestSchema as AddressScanRequestSchema, + type AddressScanResponseSchema as AddressScanResponseSchema, + type APIErrorDetails as APIErrorDetails, + type AssetTransferDetailsSchema as AssetTransferDetailsSchema, + type CnftDetailsSchema as CnftDetailsSchema, + type CnftDiffSchema as CnftDiffSchema, + type CnftMintAccountDetailsSchema as CnftMintAccountDetailsSchema, + type CombinedValidationResult as CombinedValidationResult, + type DelegatedAssetDetailsSchema as DelegatedAssetDetailsSchema, + type FungibleMintAccountDetailsSchema as FungibleMintAccountDetailsSchema, + type InstructionErrorDetails as InstructionErrorDetails, + type NativeSolOwnershipDiffSchema as NativeSolOwnershipDiffSchema, + type NonFungibleMintAccountDetailsSchema as NonFungibleMintAccountDetailsSchema, + type PdaAccountSchema as PdaAccountSchema, + type ProgramAccountDetailsSchema as ProgramAccountDetailsSchema, + type ResponseSchema as ResponseSchema, + type SplFungibleTokenDetailsSchema as SplFungibleTokenDetailsSchema, + type SplFungibleTokenDiffSchema as SplFungibleTokenDiffSchema, + type SplNonFungibleTokenDetailsSchema as SplNonFungibleTokenDetailsSchema, + type SplNonFungibleTokenDiffSchema as SplNonFungibleTokenDiffSchema, + type SplTokenOwnershipDiffSchema as SplTokenOwnershipDiffSchema, + type StakedSolWithdrawAuthorityDiffSchema as StakedSolWithdrawAuthorityDiffSchema, + type SuccessfulSimulationResultSchema as SuccessfulSimulationResultSchema, + type SystemAccountDetailsSchema as SystemAccountDetailsSchema, + type TokenAccountDetailsSchema as TokenAccountDetailsSchema, + type TotalUsdDiffSchema as TotalUsdDiffSchema, + type TransactionErrorDetails as TransactionErrorDetails, + type TxScanRequestSchema as TxScanRequestSchema, + type ValidationFeature as ValidationFeature, + }; + + export { Message as Message, type MessageScanParams as MessageScanParams }; + + export { Address as Address, type AddressScanParams as AddressScanParams }; } diff --git a/src/resources/starknet/index.ts b/src/resources/starknet/index.ts index 3a1a7074..40596a5a 100644 --- a/src/resources/starknet/index.ts +++ b/src/resources/starknet/index.ts @@ -1,4 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { StarknetErc1155Diff, StarknetErc20Diff, StarknetErc721Diff, Starknet } from './starknet'; -export { TransactionScanResponse, TransactionScanParams, Transaction } from './transaction'; +export { + Starknet, + type StarknetErc1155Diff, + type StarknetErc20Diff, + type StarknetErc721Diff, +} from './starknet'; +export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; diff --git a/src/resources/starknet/starknet.ts b/src/resources/starknet/starknet.ts index 3a5d01a5..a3a33651 100644 --- a/src/resources/starknet/starknet.ts +++ b/src/resources/starknet/starknet.ts @@ -1,8 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as StarknetAPI from './starknet'; import * as TransactionAPI from './transaction'; +import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; export class Starknet extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); @@ -69,11 +69,18 @@ export interface StarknetErc721Diff { summary?: string | null; } -export namespace Starknet { - export import StarknetErc1155Diff = StarknetAPI.StarknetErc1155Diff; - export import StarknetErc20Diff = StarknetAPI.StarknetErc20Diff; - export import StarknetErc721Diff = StarknetAPI.StarknetErc721Diff; - export import Transaction = TransactionAPI.Transaction; - export import TransactionScanResponse = TransactionAPI.TransactionScanResponse; - export import TransactionScanParams = TransactionAPI.TransactionScanParams; +Starknet.Transaction = Transaction; + +export declare namespace Starknet { + export { + type StarknetErc1155Diff as StarknetErc1155Diff, + type StarknetErc20Diff as StarknetErc20Diff, + type StarknetErc721Diff as StarknetErc721Diff, + }; + + export { + Transaction as Transaction, + type TransactionScanResponse as TransactionScanResponse, + type TransactionScanParams as TransactionScanParams, + }; } diff --git a/src/resources/starknet/transaction.ts b/src/resources/starknet/transaction.ts index 036b1945..324744c1 100644 --- a/src/resources/starknet/transaction.ts +++ b/src/resources/starknet/transaction.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as TransactionAPI from './transaction'; import * as StarknetAPI from './starknet'; export class Transaction extends APIResource { @@ -1028,7 +1027,9 @@ export namespace TransactionScanParams { } } -export namespace Transaction { - export import TransactionScanResponse = TransactionAPI.TransactionScanResponse; - export import TransactionScanParams = TransactionAPI.TransactionScanParams; +export declare namespace Transaction { + export { + type TransactionScanResponse as TransactionScanResponse, + type TransactionScanParams as TransactionScanParams, + }; } diff --git a/src/resources/stellar/index.ts b/src/resources/stellar/index.ts index 89e99239..80722a0c 100644 --- a/src/resources/stellar/index.ts +++ b/src/resources/stellar/index.ts @@ -1,4 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { StellarAssetContractDetailsSchema, StellarAssetTransferDetailsSchema, Stellar } from './stellar'; -export { TransactionScanResponse, TransactionScanParams, Transaction } from './transaction'; +export { + Stellar, + type StellarAssetContractDetailsSchema, + type StellarAssetTransferDetailsSchema, +} from './stellar'; +export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; diff --git a/src/resources/stellar/stellar.ts b/src/resources/stellar/stellar.ts index bc8965ee..497d7ee5 100644 --- a/src/resources/stellar/stellar.ts +++ b/src/resources/stellar/stellar.ts @@ -1,8 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as StellarAPI from './stellar'; import * as TransactionAPI from './transaction'; +import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; export class Stellar extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); @@ -52,10 +52,17 @@ export interface StellarAssetTransferDetailsSchema { summary?: string | null; } -export namespace Stellar { - export import StellarAssetContractDetailsSchema = StellarAPI.StellarAssetContractDetailsSchema; - export import StellarAssetTransferDetailsSchema = StellarAPI.StellarAssetTransferDetailsSchema; - export import Transaction = TransactionAPI.Transaction; - export import TransactionScanResponse = TransactionAPI.TransactionScanResponse; - export import TransactionScanParams = TransactionAPI.TransactionScanParams; +Stellar.Transaction = Transaction; + +export declare namespace Stellar { + export { + type StellarAssetContractDetailsSchema as StellarAssetContractDetailsSchema, + type StellarAssetTransferDetailsSchema as StellarAssetTransferDetailsSchema, + }; + + export { + Transaction as Transaction, + type TransactionScanResponse as TransactionScanResponse, + type TransactionScanParams as TransactionScanParams, + }; } diff --git a/src/resources/stellar/transaction.ts b/src/resources/stellar/transaction.ts index 7c9e914a..5ed2ba1a 100644 --- a/src/resources/stellar/transaction.ts +++ b/src/resources/stellar/transaction.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as TransactionAPI from './transaction'; import * as StellarAPI from './stellar'; export class Transaction extends APIResource { @@ -808,7 +807,9 @@ export namespace TransactionScanParams { } } -export namespace Transaction { - export import TransactionScanResponse = TransactionAPI.TransactionScanResponse; - export import TransactionScanParams = TransactionAPI.TransactionScanParams; +export declare namespace Transaction { + export { + type TransactionScanResponse as TransactionScanResponse, + type TransactionScanParams as TransactionScanParams, + }; } diff --git a/src/resources/token-bulk.ts b/src/resources/token-bulk.ts index 90f01bef..0b33b1ac 100644 --- a/src/resources/token-bulk.ts +++ b/src/resources/token-bulk.ts @@ -2,7 +2,6 @@ import { APIResource } from '../resource'; import * as Core from '../core'; -import * as TokenBulkAPI from './token-bulk'; import * as EvmAPI from './evm/evm'; export class TokenBulk extends APIResource { @@ -472,7 +471,9 @@ export namespace TokenBulkScanParams { } } -export namespace TokenBulk { - export import TokenBulkScanResponse = TokenBulkAPI.TokenBulkScanResponse; - export import TokenBulkScanParams = TokenBulkAPI.TokenBulkScanParams; +export declare namespace TokenBulk { + export { + type TokenBulkScanResponse as TokenBulkScanResponse, + type TokenBulkScanParams as TokenBulkScanParams, + }; } diff --git a/src/resources/token.ts b/src/resources/token.ts index c1711ad5..f3de04c8 100644 --- a/src/resources/token.ts +++ b/src/resources/token.ts @@ -2,7 +2,6 @@ import { APIResource } from '../resource'; import * as Core from '../core'; -import * as TokenAPI from './token'; import * as EvmAPI from './evm/evm'; export class Token extends APIResource { @@ -523,9 +522,11 @@ export namespace TokenScanParams { } } -export namespace Token { - export import TokenReportResponse = TokenAPI.TokenReportResponse; - export import TokenScanResponse = TokenAPI.TokenScanResponse; - export import TokenReportParams = TokenAPI.TokenReportParams; - export import TokenScanParams = TokenAPI.TokenScanParams; +export declare namespace Token { + export { + type TokenReportResponse as TokenReportResponse, + type TokenScanResponse as TokenScanResponse, + type TokenReportParams as TokenReportParams, + type TokenScanParams as TokenScanParams, + }; } diff --git a/tsconfig.deno.json b/tsconfig.deno.json index 6a5302ce..849e070d 100644 --- a/tsconfig.deno.json +++ b/tsconfig.deno.json @@ -1,19 +1,14 @@ { "extends": "./tsconfig.json", - "include": ["deno"], + "include": ["dist-deno"], "exclude": [], "compilerOptions": { - "rootDir": "./deno", + "rootDir": "./dist-deno", "lib": ["es2020", "DOM"], - "paths": { - "@blockaid/client/_shims/auto/*": ["deno/_shims/auto/*-deno"], - "@blockaid/client/*": ["deno/*"], - "@blockaid/client": ["deno/index.ts"], - }, "noEmit": true, "declaration": true, "declarationMap": true, - "outDir": "deno", + "outDir": "dist-deno", "pretty": true, "sourceMap": true } diff --git a/tsconfig.json b/tsconfig.json index 6737b3b4..c30756fb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ "paths": { "@blockaid/client/_shims/auto/*": ["src/_shims/auto/*-node"], "@blockaid/client/*": ["src/*"], - "@blockaid/client": ["src/index.ts"], + "@blockaid/client": ["src/index.ts"] }, "noEmit": true, @@ -32,6 +32,7 @@ "noUncheckedIndexedAccess": true, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, + "isolatedModules": false, "skipLibCheck": true } From fd62a3b15e10ebae48d70359b047e39ac113f050 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 10 Nov 2024 09:16:58 +0000 Subject: [PATCH 03/18] feat(api): api update (#305) --- .stats.yml | 2 +- src/resources/bitcoin/transaction.ts | 23 ++++++++++++++---- src/resources/starknet/transaction.ts | 34 +++++++++++++++++++++++++-- 3 files changed, 52 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index b74b3b45..d372aa5b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 19 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-68190ea619cfe126cdb1d0d08d55d0701e87c1cb45aaaf714807e2fc0bdde5e6.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-24c4d07c90fb94cf6b67b0392c0295590f6d013639f617269d26761adbb1f503.yml diff --git a/src/resources/bitcoin/transaction.ts b/src/resources/bitcoin/transaction.ts index 3988851a..0bfb1f36 100644 --- a/src/resources/bitcoin/transaction.ts +++ b/src/resources/bitcoin/transaction.ts @@ -71,6 +71,11 @@ export namespace TransactionScanResponse { export interface BitcoinAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaNativeDiffSchema { asset: BitcoinAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaNativeDiffSchema.Asset; + /** + * The type of the assets in this diff + */ + asset_type: string; + /** * Details of the incoming transfer */ @@ -164,6 +169,11 @@ export namespace TransactionScanResponse { export interface BitcoinAccountSingleAssetDiffSchemaTypeOrdinalDetailsSchemaOrdinalDiffSchema { asset: BitcoinAccountSingleAssetDiffSchemaTypeOrdinalDetailsSchemaOrdinalDiffSchema.Asset; + /** + * The type of the assets in this diff + */ + asset_type: string; + /** * Details of the incoming transfer */ @@ -257,6 +267,11 @@ export namespace TransactionScanResponse { export interface BitcoinAccountSingleAssetDiffSchemaTypeRuneDetailsSchemaRuneDiffSchema { asset: BitcoinAccountSingleAssetDiffSchemaTypeRuneDetailsSchemaRuneDiffSchema.Asset; + /** + * The type of the assets in this diff + */ + asset_type: string; + /** * Details of the incoming transfer */ @@ -364,7 +379,7 @@ export namespace TransactionScanResponse { */ error: string; - status?: 'Error'; + status: 'Error'; } export interface BitcoinValidationResultSchemaTypeAnnotatedStrSkipValidationPlainSerializerGetPydanticSchema { @@ -439,7 +454,7 @@ export interface TransactionScanParams { */ metadata: | TransactionScanParams.BitcoinblockaidApplicationRunnerAppSchemasTransactionScanningAPIWalletRequestMetadata - | TransactionScanParams.BitcoinInAppRequestMetadata; + | TransactionScanParams.BitcoinblockaidApplicationRunnerAppSchemasTransactionScanningAPIInAppRequestMetadata; transaction: string; @@ -466,11 +481,11 @@ export namespace TransactionScanParams { url: string; } - export interface BitcoinInAppRequestMetadata { + export interface BitcoinblockaidApplicationRunnerAppSchemasTransactionScanningAPIInAppRequestMetadata { /** * Metadata for in-app requests */ - type: 'in_app'; + type?: 'in_app'; } } diff --git a/src/resources/starknet/transaction.ts b/src/resources/starknet/transaction.ts index 324744c1..f740899f 100644 --- a/src/resources/starknet/transaction.ts +++ b/src/resources/starknet/transaction.ts @@ -101,7 +101,7 @@ export namespace TransactionScanResponse { /** * Assets diffs of the requested account address */ - assets_diffs?: Array< + account_assets_diffs?: Array< | AccountSummary.StarknetAccountSingleAssetDiffSchemaTypeErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DiffSchema | AccountSummary.StarknetAccountSingleAssetDiffSchemaTypeErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DiffSchema | AccountSummary.StarknetAccountSingleAssetDiffSchemaTypeErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DiffSchema @@ -312,6 +312,11 @@ export namespace TransactionScanResponse { export interface StarknetAccountSingleAssetDiffSchemaTypeErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DiffSchema { asset: StarknetAccountSingleAssetDiffSchemaTypeErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DiffSchema.Asset; + /** + * The type of the assets in this diff + */ + asset_type: string; + /** * Details of the incoming transfer */ @@ -360,6 +365,11 @@ export namespace TransactionScanResponse { export interface StarknetAccountSingleAssetDiffSchemaTypeErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DiffSchema { asset: StarknetAccountSingleAssetDiffSchemaTypeErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DiffSchema.Asset; + /** + * The type of the assets in this diff + */ + asset_type: string; + /** * Details of the incoming transfer */ @@ -403,6 +413,11 @@ export namespace TransactionScanResponse { export interface StarknetAccountSingleAssetDiffSchemaTypeErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DiffSchema { asset: StarknetAccountSingleAssetDiffSchemaTypeErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DiffSchema.Asset; + /** + * The type of the assets in this diff + */ + asset_type: string; + /** * Details of the incoming transfer */ @@ -459,6 +474,11 @@ export namespace TransactionScanResponse { export interface StarknetAccountSingleAssetDiffSchemaTypeErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DiffSchema { asset: StarknetAccountSingleAssetDiffSchemaTypeErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DiffSchema.Asset; + /** + * The type of the assets in this diff + */ + asset_type: string; + /** * Details of the incoming transfer */ @@ -507,6 +527,11 @@ export namespace TransactionScanResponse { export interface StarknetAccountSingleAssetDiffSchemaTypeErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DiffSchema { asset: StarknetAccountSingleAssetDiffSchemaTypeErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DiffSchema.Asset; + /** + * The type of the assets in this diff + */ + asset_type: string; + /** * Details of the incoming transfer */ @@ -550,6 +575,11 @@ export namespace TransactionScanResponse { export interface StarknetAccountSingleAssetDiffSchemaTypeErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DiffSchema { asset: StarknetAccountSingleAssetDiffSchemaTypeErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DiffSchema.Asset; + /** + * The type of the assets in this diff + */ + asset_type: string; + /** * Details of the incoming transfer */ @@ -890,7 +920,7 @@ export namespace TransactionScanParams { /** * Metadata for in-app requests */ - type: 'in_app'; + type?: 'in_app'; } export interface StarknetInvokeV1TransactionSchema { From 557a745e5065c6fdc903540f9a3c116dffe82d39 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 10 Nov 2024 09:34:56 +0000 Subject: [PATCH 04/18] feat(api): api update (#306) --- .stats.yml | 2 +- src/resources/evm/evm.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index d372aa5b..a04bb9b6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 19 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-24c4d07c90fb94cf6b67b0392c0295590f6d013639f617269d26761adbb1f503.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-34fa03d4f05a285eca8165627cf5f6ad33251ef75d860dbe679a649f5d9da7ea.yml diff --git a/src/resources/evm/evm.ts b/src/resources/evm/evm.ts index 1697a8f0..996c0843 100644 --- a/src/resources/evm/evm.ts +++ b/src/resources/evm/evm.ts @@ -686,7 +686,8 @@ export type TransactionScanSupportedChain = | 'worldchain' | 'soneium-minato' | 'ronin' - | 'apechain'; + | 'apechain' + | 'zero-network'; export interface TransactionSimulation { /** From e74673c33e3a6af27b9bb8150f92598f62cfc600 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Mon, 11 Nov 2024 10:13:26 +0000 Subject: [PATCH 05/18] feat(api): api update (#309) --- .stats.yml | 2 +- api.md | 3 - src/index.ts | 5 - src/resources/evm/evm.ts | 903 +++++++++++++++++++++++++++---------- src/resources/evm/index.ts | 3 - src/resources/index.ts | 3 - 6 files changed, 678 insertions(+), 241 deletions(-) diff --git a/.stats.yml b/.stats.yml index a04bb9b6..19a19564 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 19 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-34fa03d4f05a285eca8165627cf5f6ad33251ef75d860dbe679a649f5d9da7ea.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-45800f1aa42276b5d55d613d6b586c35fdc605496753c575443096a26655a4cd.yml diff --git a/api.md b/api.md index e1d4a1b7..d7140b3b 100644 --- a/api.md +++ b/api.md @@ -2,9 +2,6 @@ Types: -- AddressAssetExposure -- AssetDiff -- Erc1155AddressAssetExposure - Erc1155Diff - Erc1155Exposure - Erc1155TokenDetails diff --git a/src/index.ts b/src/index.ts index 7f1443d8..4b826f2c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,8 +24,6 @@ import { import { TokenBulk, TokenBulkScanParams, TokenBulkScanResponse } from './resources/token-bulk'; import { Bitcoin } from './resources/bitcoin/bitcoin'; import { - AddressAssetExposure, - AssetDiff, Erc1155Diff, Erc1155Exposure, Erc1155TokenDetails, @@ -357,9 +355,6 @@ export declare namespace Blockaid { export { Evm as Evm, - type AddressAssetExposure as AddressAssetExposure, - type AssetDiff as AssetDiff, - type Erc1155AddressAssetExposure as Erc1155AddressAssetExposure, type Erc1155Diff as Erc1155Diff, type Erc1155Exposure as Erc1155Exposure, type Erc1155TokenDetails as Erc1155TokenDetails, diff --git a/src/resources/evm/evm.ts b/src/resources/evm/evm.ts index 996c0843..b954fced 100644 --- a/src/resources/evm/evm.ts +++ b/src/resources/evm/evm.ts @@ -42,181 +42,6 @@ export class Evm extends APIResource { new PostTransactionBulkAPI.PostTransactionBulk(this._client); } -export type AddressAssetExposure = - | Erc20AddressAssetExposure - | Erc721AddressAssetExposure - | Erc1155AddressAssetExposure - | NonercAddressAssetExposure; - -export interface Erc20AddressAssetExposure { - /** - * description of the asset for the current diff - */ - asset: Erc20TokenDetails; - - /** - * dictionary of spender addresses where the exposure has changed during this - * transaction for the current address and asset - */ - spenders: Record; -} - -export interface Erc721AddressAssetExposure { - /** - * description of the asset for the current diff - */ - asset: Erc721TokenDetails; - - /** - * dictionary of spender addresses where the exposure has changed during this - * transaction for the current address and asset - */ - spenders: Record; -} - -export interface Erc1155AddressAssetExposure { - /** - * description of the asset for the current diff - */ - asset: Erc1155TokenDetails; - - /** - * dictionary of spender addresses where the exposure has changed during this - * transaction for the current address and asset - */ - spenders: Record; -} - -export interface NonercAddressAssetExposure { - /** - * description of the asset for the current diff - */ - asset: NonercTokenDetails; - - /** - * dictionary of spender addresses where the exposure has changed during this - * transaction for the current address and asset - */ - spenders: Record; -} - -export type AssetDiff = - | Erc20AssetDiff - | Erc1155AssetDiff - | Erc721AssetDiff - | NativeAssetDiff - | NonercAssetDiff; - -export interface Erc20AssetDiff { - /** - * description of the asset for the current diff - */ - asset: Erc20TokenDetails; - - /** - * An enumeration. - */ - asset_type: 'ERC20'; - - /** - * amount of the asset that was transferred to the address in this transaction - */ - in: Array; - - /** - * amount of the asset that was transferred from the address in this transaction - */ - out: Array; -} - -export interface Erc1155AssetDiff { - /** - * description of the asset for the current diff - */ - asset: Erc1155TokenDetails; - - /** - * An enumeration. - */ - asset_type: 'ERC1155'; - - /** - * amount of the asset that was transferred to the address in this transaction - */ - in: Array; - - /** - * amount of the asset that was transferred from the address in this transaction - */ - out: Array; -} - -export interface Erc721AssetDiff { - /** - * description of the asset for the current diff - */ - asset: Erc721TokenDetails; - - /** - * An enumeration. - */ - asset_type: 'ERC721'; - - /** - * amount of the asset that was transferred to the address in this transaction - */ - in: Array; - - /** - * amount of the asset that was transferred from the address in this transaction - */ - out: Array; -} - -export interface NativeAssetDiff { - /** - * description of the asset for the current diff - */ - asset: NativeAssetDetails; - - /** - * An enumeration. - */ - asset_type: 'NATIVE'; - - /** - * amount of the asset that was transferred to the address in this transaction - */ - in: Array; - - /** - * amount of the asset that was transferred from the address in this transaction - */ - out: Array; -} - -export interface NonercAssetDiff { - /** - * description of the asset for the current diff - */ - asset: NonercTokenDetails; - - /** - * An enumeration. - */ - asset_type: 'NONERC'; - - /** - * amount of the asset that was transferred to the address in this transaction - */ - in: Array; - - /** - * amount of the asset that was transferred from the address in this transaction - */ - out: Array; -} - export interface Erc1155Diff { /** * Indicates whether the token ID represents an arbitrary token from a collection, @@ -707,14 +532,29 @@ export interface TransactionSimulation { * dictionary describes the assets differences as a result of this transaction for * every involved address */ - assets_diffs: Record>; + assets_diffs: Record< + string, + Array< + | TransactionSimulation.Erc20AddressAssetDiff + | TransactionSimulation.Erc721AddressAssetDiff + | TransactionSimulation.Erc1155AddressAssetDiff + | TransactionSimulation.NativeAddressAssetDiff + > + >; /** * dictionary describes the exposure differences as a result of this transaction * for every involved address (as a result of any approval / setApproval / permit * function) */ - exposures: Record>; + exposures: Record< + string, + Array< + | TransactionSimulation.Erc20AddressExposure + | TransactionSimulation.Erc721AddressExposure + | TransactionSimulation.Erc1155AddressExposure + > + >; /** * A string indicating if the simulation was successful or not. @@ -737,7 +577,14 @@ export interface TransactionSimulation { * Describes the state differences as a result of this transaction for every * involved address */ - contract_management?: Record>; + contract_management?: Record< + string, + Array< + | TransactionSimulation.ProxyUpgradeManagement + | TransactionSimulation.OwnershipChangeManagement + | TransactionSimulation.ModulesChangeManagement + > + >; /** * The parameters of the transaction that was simulated. @@ -755,12 +602,21 @@ export namespace TransactionSimulation { /** * All assets diffs related to the account address */ - assets_diffs: Array; + assets_diffs: Array< + | AccountSummary.Erc20AddressAssetBalanceChangeDiff + | AccountSummary.Erc721AddressAssetBalanceChangeDiff + | AccountSummary.Erc1155AddressAssetBalanceChangeDiff + | AccountSummary.NativeAddressAssetBalanceChangeDiff + >; /** * All assets exposures related to the account address */ - exposures: Array; + exposures: Array< + | AccountSummary.Erc20AddressExposure + | AccountSummary.Erc721AddressExposure + | AccountSummary.Erc1155AddressExposure + >; /** * Total usd diff related to the account address @@ -771,14 +627,81 @@ export namespace TransactionSimulation { * Total usd exposure related to the account address */ total_usd_exposure: Record; - } - export type AccountSummaryAssetsDiff = AssetDiff & { /** - * shows the balance before making the transaction and after + * All assets traces related to the account address */ - balance_changes?: AccountSummaryAssetsDiff.BalanceChanges; - }; + traces: Array< + | AccountSummary.Erc20AssetTrace + | AccountSummary.Erc721AssetTrace + | AccountSummary.Erc1155AssetTrace + | AccountSummary.NativeAssetTrace + | AccountSummary.Erc20ExposureTrace + | AccountSummary.Erc721ExposureTrace + | AccountSummary.Erc1155ExposureTrace + >; + } + + export namespace AccountSummary { + export interface Erc20AddressAssetBalanceChangeDiff { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc20TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC20'; + + /** + * amount of the asset that was transferred to the address in this transaction + */ + in: Array; + + /** + * amount of the asset that was transferred from the address in this transaction + */ + out: Array; + + /** + * shows the balance before making the transaction and after + */ + balance_changes?: Erc20AddressAssetBalanceChangeDiff.BalanceChanges; + } + + export namespace Erc20AddressAssetBalanceChangeDiff { + /** + * shows the balance before making the transaction and after + */ + export interface BalanceChanges { + /** + * balance of the account after making the transaction + */ + after: EvmAPI.Erc20Diff; + + /** + * balance of the account before making the transaction + */ + before: EvmAPI.Erc20Diff; + } + } + + export interface Erc721AddressAssetBalanceChangeDiff { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc721TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC721'; + + /** + * amount of the asset that was transferred to the address in this transaction + */ + in: Array; export namespace AccountSummaryAssetsDiff { /** @@ -788,15 +711,15 @@ export namespace TransactionSimulation { /** * balance of the account after making the transaction */ - after: BalanceChanges.After; + out: Array; /** * balance of the account before making the transaction */ - before: BalanceChanges.Before; + balance_changes?: Erc721AddressAssetBalanceChangeDiff.BalanceChanges; } - export namespace BalanceChanges { + export namespace Erc721AddressAssetBalanceChangeDiff { /** * balance of the account after making the transaction */ @@ -804,39 +727,378 @@ export namespace TransactionSimulation { /** * value before divided by decimal, that was transferred from this address */ - raw_value: string; + after: EvmAPI.Erc721Diff; + + /** + * usd equal of the asset that was transferred from this address + */ + before: EvmAPI.Erc721Diff; + } + } + + export interface Erc1155AddressAssetBalanceChangeDiff { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc1155TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC1155'; + + /** + * amount of the asset that was transferred to the address in this transaction + */ + in: Array; + /** + * amount of the asset that was transferred from the address in this transaction + */ + out: Array; + + /** + * shows the balance before making the transaction and after + */ + balance_changes?: Erc1155AddressAssetBalanceChangeDiff.BalanceChanges; + } + + export namespace Erc1155AddressAssetBalanceChangeDiff { + /** + * shows the balance before making the transaction and after + */ + export interface BalanceChanges { /** * usd equal of the asset that was transferred from this address */ - usd_price?: string; + after: EvmAPI.Erc1155Diff; /** * value after divided by decimals, that was transferred from this address */ - value?: string; + before: EvmAPI.Erc1155Diff; } + } + export interface NativeAddressAssetBalanceChangeDiff { /** - * balance of the account before making the transaction + * description of the asset for the current diff */ - export interface Before { - /** - * value before divided by decimal, that was transferred from this address - */ - raw_value: string; + asset: EvmAPI.NativeAssetDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'NATIVE'; + + /** + * amount of the asset that was transferred to the address in this transaction + */ + in: Array; + + /** + * amount of the asset that was transferred from the address in this transaction + */ + out: Array; + + /** + * shows the balance before making the transaction and after + */ + balance_changes?: NativeAddressAssetBalanceChangeDiff.BalanceChanges; + } + export namespace NativeAddressAssetBalanceChangeDiff { + /** + * shows the balance before making the transaction and after + */ + export interface BalanceChanges { /** - * usd equal of the asset that was transferred from this address + * balance of the account after making the transaction */ - usd_price?: string; + after: EvmAPI.NativeDiff; /** - * value after divided by decimals, that was transferred from this address + * balance of the account before making the transaction */ - value?: string; + before: EvmAPI.NativeDiff; } } + + export interface Erc20AddressExposure { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc20TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC20'; + + /** + * dictionary of spender addresses where the exposure has changed during this + * transaction for the current address and asset + */ + spenders: Record; + } + + export interface Erc721AddressExposure { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc721TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC721'; + + /** + * dictionary of spender addresses where the exposure has changed during this + * transaction for the current address and asset + */ + spenders: Record; + } + + export interface Erc1155AddressExposure { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc1155TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC1155'; + + /** + * dictionary of spender addresses where the exposure has changed during this + * transaction for the current address and asset + */ + spenders: Record; + } + + export interface Erc20AssetTrace { + /** + * Description of the asset in the trace + */ + asset: EvmAPI.Erc20TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * The difference in value for the asset in the trace + */ + diff: EvmAPI.Erc20Diff; + + /** + * The address where the assets are moved from + */ + from_address: string; + + /** + * The address where the assets are moved to + */ + to_address: string; + + /** + * type of the trace + */ + trace_type: 'AssetTrace'; + + /** + * The type of the model + */ + type: 'ERC20AssetTrace'; + } + + export interface Erc721AssetTrace { + /** + * Description of the asset in the trace + */ + asset: EvmAPI.Erc721TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * The difference in value for the asset in the trace + */ + diff: EvmAPI.Erc721Diff; + + /** + * The address where the assets are moved from + */ + from_address: string; + + /** + * The address where the assets are moved to + */ + to_address: string; + + /** + * type of the trace + */ + trace_type: 'AssetTrace'; + + /** + * The type of the model + */ + type: 'ERC721AssetTrace'; + } + + export interface Erc1155AssetTrace { + /** + * Description of the asset in the trace + */ + asset: EvmAPI.Erc1155TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * The difference in value for the asset in the trace + */ + diff: EvmAPI.Erc1155Diff; + + /** + * The address where the assets are moved from + */ + from_address: string; + + /** + * The address where the assets are moved to + */ + to_address: string; + + /** + * type of the trace + */ + trace_type: 'AssetTrace'; + + /** + * The type of the model + */ + type: 'ERC1155AssetTrace'; + } + + export interface NativeAssetTrace { + /** + * Description of the asset in the trace + */ + asset: EvmAPI.NativeAssetDetails; + + /** + * The difference in value for the asset in the trace + */ + diff: EvmAPI.NativeDiff; + + /** + * The address where the assets are moved from + */ + from_address: string; + + /** + * The address where the assets are moved to + */ + to_address: string; + + /** + * type of the trace + */ + trace_type: 'AssetTrace'; + + /** + * The type of the model + */ + type: 'NativeAssetTrace'; + } + + export interface Erc20ExposureTrace { + exposed: Erc20ExposureTrace.Exposed; + + /** + * The owner of the assets + */ + owner: string; + + /** + * The spender of the assets + */ + spender: string; + + /** + * type of the trace + */ + trace_type: 'ExposureTrace'; + + /** + * The type of the model + */ + type: 'ERC20ExposureTrace'; + } + + export namespace Erc20ExposureTrace { + export interface Exposed { + raw_value: string; + + usd_price?: number; + + value?: number; + } + } + + export interface Erc721ExposureTrace { + exposed: Erc721ExposureTrace.Exposed; + + /** + * The owner of the assets + */ + owner: string; + + /** + * The spender of the assets + */ + spender: string; + + /** + * type of the trace + */ + trace_type: 'ExposureTrace'; + + /** + * The type of the model + */ + type: 'ERC721ExposureTrace'; + } + + export namespace Erc721ExposureTrace { + export interface Exposed { + amount: number; + + token_id: string; + + is_mint?: boolean; + + logo_url?: string; + + usd_price?: number; + } + } + + export interface Erc1155ExposureTrace { + /** + * The owner of the assets + */ + owner: string; + + /** + * The spender of the assets + */ + spender: string; + + /** + * type of the trace + */ + trace_type: 'ExposureTrace'; + + /** + * The type of the model + */ + type: 'ERC1155ExposureTrace'; + } } export interface AddressDetails { @@ -856,51 +1118,243 @@ export namespace TransactionSimulation { name_tag?: string; } - export interface ContractManagement { + export interface Erc20AddressAssetDiff { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc20TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC20'; + + /** + * amount of the asset that was transferred to the address in this transaction + */ + in: Array; + + /** + * amount of the asset that was transferred from the address in this transaction + */ + out: Array; + } + + export interface Erc721AddressAssetDiff { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc721TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC721'; + + /** + * amount of the asset that was transferred to the address in this transaction + */ + in: Array; + + /** + * amount of the asset that was transferred from the address in this transaction + */ + out: Array; + } + + export interface Erc1155AddressAssetDiff { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc1155TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC1155'; + + /** + * amount of the asset that was transferred to the address in this transaction + */ + in: Array; + + /** + * amount of the asset that was transferred from the address in this transaction + */ + out: Array; + } + + export interface NativeAddressAssetDiff { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.NativeAssetDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'NATIVE'; + + /** + * amount of the asset that was transferred to the address in this transaction + */ + in: Array; + + /** + * amount of the asset that was transferred from the address in this transaction + */ + out: Array; + } + + export interface Erc20AddressExposure { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc20TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC20'; + + /** + * dictionary of spender addresses where the exposure has changed during this + * transaction for the current address and asset + */ + spenders: Record; + } + + export interface Erc721AddressExposure { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc721TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC721'; + + /** + * dictionary of spender addresses where the exposure has changed during this + * transaction for the current address and asset + */ + spenders: Record; + } + + export interface Erc1155AddressExposure { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc1155TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC1155'; + + /** + * dictionary of spender addresses where the exposure has changed during this + * transaction for the current address and asset + */ + spenders: Record; + } + + export interface ProxyUpgradeManagement { /** * The state after the transaction */ - after: - | ContractManagement.AddressChange - | ContractManagement.OwnershipChange - | ContractManagement.ModulesChange; + after: ProxyUpgradeManagement.After; /** * The state before the transaction */ - before: - | ContractManagement.AddressChange - | ContractManagement.OwnershipChange - | ContractManagement.ModulesChange; + before: ProxyUpgradeManagement.Before; /** - * An enumeration. + * The type of the state change */ - type: 'PROXY_UPGRADE' | 'OWNERSHIP_CHANGE' | 'MODULE_CHANGE'; + type: 'PROXY_UPGRADE'; } - export namespace ContractManagement { - export interface AddressChange { + export namespace ProxyUpgradeManagement { + /** + * The state after the transaction + */ + export interface After { address: string; } - export interface OwnershipChange { - owners: Array; + /** + * The state before the transaction + */ + export interface Before { + address: string; } + } - export interface ModulesChange { - modules: Array; - } + export interface OwnershipChangeManagement { + /** + * The state after the transaction + */ + after: OwnershipChangeManagement.After; - export interface AddressChange { - address: string; + /** + * The state before the transaction + */ + before: OwnershipChangeManagement.Before; + + /** + * The type of the state change + */ + type: 'OWNERSHIP_CHANGE'; + } + + export namespace OwnershipChangeManagement { + /** + * The state after the transaction + */ + export interface After { + owners: Array; } - export interface OwnershipChange { + /** + * The state before the transaction + */ + export interface Before { owners: Array; } + } + + export interface ModulesChangeManagement { + /** + * The state after the transaction + */ + after: ModulesChangeManagement.After; + + /** + * The state before the transaction + */ + before: ModulesChangeManagement.Before; + + /** + * The type of the state change + */ + type: 'MODULE_CHANGE'; + } + + export namespace ModulesChangeManagement { + /** + * The state after the transaction + */ + export interface After { + modules: Array; + } - export interface ModulesChange { + /** + * The state before the transaction + */ + export interface Before { modules: Array; } } @@ -1083,9 +1537,6 @@ Evm.PostTransactionBulk = PostTransactionBulk; export declare namespace Evm { export { - type AddressAssetExposure as AddressAssetExposure, - type AssetDiff as AssetDiff, - type Erc1155AddressAssetExposure as Erc1155AddressAssetExposure, type Erc1155Diff as Erc1155Diff, type Erc1155Exposure as Erc1155Exposure, type Erc1155TokenDetails as Erc1155TokenDetails, diff --git a/src/resources/evm/index.ts b/src/resources/evm/index.ts index d066df35..9957e852 100644 --- a/src/resources/evm/index.ts +++ b/src/resources/evm/index.ts @@ -2,9 +2,6 @@ export { Evm, - type AddressAssetExposure, - type AssetDiff, - type Erc1155AddressAssetExposure, type Erc1155Diff, type Erc1155Exposure, type Erc1155TokenDetails, diff --git a/src/resources/index.ts b/src/resources/index.ts index b787a44f..30b5b491 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -3,9 +3,6 @@ export { Bitcoin } from './bitcoin/bitcoin'; export { Evm, - type AddressAssetExposure, - type AssetDiff, - type Erc1155AddressAssetExposure, type Erc1155Diff, type Erc1155Exposure, type Erc1155TokenDetails, From 6b34d682b9f6c6d47f1fc5fad6feefb893ad7a9c Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Mon, 11 Nov 2024 10:34:54 +0000 Subject: [PATCH 06/18] chore: remove custom code --- api.md | 5 --- src/index.ts | 7 ---- src/resources/evm/evm.ts | 74 +++++++------------------------------- src/resources/evm/index.ts | 7 ---- src/resources/index.ts | 7 ---- 5 files changed, 13 insertions(+), 87 deletions(-) diff --git a/api.md b/api.md index d7140b3b..d35b281b 100644 --- a/api.md +++ b/api.md @@ -5,20 +5,15 @@ Types: - Erc1155Diff - Erc1155Exposure - Erc1155TokenDetails -- Erc20AddressAssetExposure - Erc20Diff - Erc20Exposure - Erc20TokenDetails -- Erc721AddressAssetExposure - Erc721Diff - Erc721Exposure - Erc721TokenDetails - Metadata - NativeAssetDetails - NativeDiff -- NonercAddressAssetExposure -- NonercDiff -- NonercExposure - NonercTokenDetails - TokenScanSupportedChain - TransactionScanFeature diff --git a/src/index.ts b/src/index.ts index 4b826f2c..998a08a5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -358,29 +358,22 @@ export declare namespace Blockaid { type Erc1155Diff as Erc1155Diff, type Erc1155Exposure as Erc1155Exposure, type Erc1155TokenDetails as Erc1155TokenDetails, - type Erc20AddressAssetExposure as Erc20AddressAssetExposure, type Erc20Diff as Erc20Diff, type Erc20Exposure as Erc20Exposure, type Erc20TokenDetails as Erc20TokenDetails, - type Erc721AddressAssetExposure as Erc721AddressAssetExposure, type Erc721Diff as Erc721Diff, type Erc721Exposure as Erc721Exposure, type Erc721TokenDetails as Erc721TokenDetails, type Metadata as Metadata, type NativeAssetDetails as NativeAssetDetails, type NativeDiff as NativeDiff, - type NonercAddressAssetExposure as NonercAddressAssetExposure, - type NonercDiff as NonercDiff, - type NonercExposure as NonercExposure, type NonercTokenDetails as NonercTokenDetails, type TokenScanSupportedChain as TokenScanSupportedChain, type TransactionScanFeature as TransactionScanFeature, type TransactionScanResponse as TransactionScanResponse, type TransactionScanSupportedChain as TransactionScanSupportedChain, - type TransactionSimulationResponse as TransactionSimulationResponse, type TransactionSimulation as TransactionSimulation, type TransactionSimulationError as TransactionSimulationError, - type TransactionValidationResponse as TransactionValidationResponse, type TransactionValidation as TransactionValidation, type TransactionValidationError as TransactionValidationError, type UsdDiff as UsdDiff, diff --git a/src/resources/evm/evm.ts b/src/resources/evm/evm.ts index b954fced..818029b4 100644 --- a/src/resources/evm/evm.ts +++ b/src/resources/evm/evm.ts @@ -76,7 +76,7 @@ export interface Erc1155Diff { } export interface Erc1155Exposure { - exposure: Array; + exposure: Array; /** * boolean indicates whether an is_approved_for_all function was used (missing in @@ -146,7 +146,7 @@ export interface Erc20Exposure { */ approval: string; - exposure: Array; + exposure: Array; /** * the expiration time of the permit2 protocol @@ -220,7 +220,7 @@ export interface Erc721Diff { } export interface Erc721Exposure { - exposure: Array; + exposure: Array; /** * boolean indicates whether an is_approved_for_all function was used (missing in @@ -261,21 +261,6 @@ export interface Erc721TokenDetails { symbol?: string; } -export interface NonercExposure { - /** - * the amount that was asked in the approval request for this spender from the - * current address and asset - */ - approval: number; - - exposure: Array; - - /** - * user friendly description of the approval - */ - summary?: string; -} - export interface Metadata { /** * cross reference transaction against the domain. @@ -357,27 +342,6 @@ export interface NonercTokenDetails { symbol?: string; } -export interface NonercDiff { - /** - * value before divided by decimal, that was transferred from this address - */ - raw_value: string; - - /** - * user friendly description of the asset transfer - */ - summary?: string; - - /** - * value after divided by decimals, that was transferred from this address - */ - value?: string; -} - -export type TransactionSimulationResponse = TransactionSimulation | TransactionSimulationError; - -export type TransactionValidationResponse = TransactionValidation | TransactionValidationError; - /** * The chain name */ @@ -437,9 +401,9 @@ export interface TransactionScanResponse { | TransactionScanResponse.TransactionScanGasEstimation | TransactionScanResponse.TransactionScanGasEstimationError; - simulation?: TransactionSimulationResponse; + simulation?: TransactionSimulation | TransactionSimulationError; - validation?: TransactionValidationResponse; + validation?: TransactionValidation | TransactionValidationError; } export namespace TransactionScanResponse { @@ -703,34 +667,29 @@ export namespace TransactionSimulation { */ in: Array; - export namespace AccountSummaryAssetsDiff { - /** - * shows the balance before making the transaction and after - */ - export interface BalanceChanges { /** - * balance of the account after making the transaction + * amount of the asset that was transferred from the address in this transaction */ out: Array; /** - * balance of the account before making the transaction + * shows the balance before making the transaction and after */ balance_changes?: Erc721AddressAssetBalanceChangeDiff.BalanceChanges; } export namespace Erc721AddressAssetBalanceChangeDiff { /** - * balance of the account after making the transaction + * shows the balance before making the transaction and after */ - export interface After { + export interface BalanceChanges { /** - * value before divided by decimal, that was transferred from this address + * balance of the account after making the transaction */ after: EvmAPI.Erc721Diff; /** - * usd equal of the asset that was transferred from this address + * balance of the account before making the transaction */ before: EvmAPI.Erc721Diff; } @@ -769,12 +728,12 @@ export namespace TransactionSimulation { */ export interface BalanceChanges { /** - * usd equal of the asset that was transferred from this address + * balance of the account after making the transaction */ after: EvmAPI.Erc1155Diff; /** - * value after divided by decimals, that was transferred from this address + * balance of the account before making the transaction */ before: EvmAPI.Erc1155Diff; } @@ -1540,29 +1499,22 @@ export declare namespace Evm { type Erc1155Diff as Erc1155Diff, type Erc1155Exposure as Erc1155Exposure, type Erc1155TokenDetails as Erc1155TokenDetails, - type Erc20AddressAssetExposure as Erc20AddressAssetExposure, type Erc20Diff as Erc20Diff, type Erc20Exposure as Erc20Exposure, type Erc20TokenDetails as Erc20TokenDetails, - type Erc721AddressAssetExposure as Erc721AddressAssetExposure, type Erc721Diff as Erc721Diff, type Erc721Exposure as Erc721Exposure, type Erc721TokenDetails as Erc721TokenDetails, type Metadata as Metadata, type NativeAssetDetails as NativeAssetDetails, type NativeDiff as NativeDiff, - type NonercAddressAssetExposure as NonercAddressAssetExposure, - type NonercDiff as NonercDiff, - type NonercExposure as NonercExposure, type NonercTokenDetails as NonercTokenDetails, type TokenScanSupportedChain as TokenScanSupportedChain, type TransactionScanFeature as TransactionScanFeature, type TransactionScanResponse as TransactionScanResponse, type TransactionScanSupportedChain as TransactionScanSupportedChain, - type TransactionSimulationResponse as TransactionSimulationResponse, type TransactionSimulation as TransactionSimulation, type TransactionSimulationError as TransactionSimulationError, - type TransactionValidationResponse as TransactionValidationResponse, type TransactionValidation as TransactionValidation, type TransactionValidationError as TransactionValidationError, type UsdDiff as UsdDiff, diff --git a/src/resources/evm/index.ts b/src/resources/evm/index.ts index 9957e852..9c5612b6 100644 --- a/src/resources/evm/index.ts +++ b/src/resources/evm/index.ts @@ -5,29 +5,22 @@ export { type Erc1155Diff, type Erc1155Exposure, type Erc1155TokenDetails, - type Erc20AddressAssetExposure, type Erc20Diff, type Erc20Exposure, type Erc20TokenDetails, - type Erc721AddressAssetExposure, type Erc721Diff, type Erc721Exposure, type Erc721TokenDetails, type Metadata, type NativeAssetDetails, type NativeDiff, - type NonercAddressAssetExposure, - type NonercDiff, - type NonercExposure, type NonercTokenDetails, type TokenScanSupportedChain, type TransactionScanFeature, type TransactionScanResponse, type TransactionScanSupportedChain, - type TransactionSimulationResponse, type TransactionSimulation, type TransactionSimulationError, - type TransactionValidationResponse, type TransactionValidation, type TransactionValidationError, type UsdDiff, diff --git a/src/resources/index.ts b/src/resources/index.ts index 30b5b491..8beaaa19 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -6,29 +6,22 @@ export { type Erc1155Diff, type Erc1155Exposure, type Erc1155TokenDetails, - type Erc20AddressAssetExposure, type Erc20Diff, type Erc20Exposure, type Erc20TokenDetails, - type Erc721AddressAssetExposure, type Erc721Diff, type Erc721Exposure, type Erc721TokenDetails, type Metadata, type NativeAssetDetails, type NativeDiff, - type NonercAddressAssetExposure, - type NonercDiff, - type NonercExposure, type NonercTokenDetails, type TokenScanSupportedChain, type TransactionScanFeature, type TransactionScanResponse, type TransactionScanSupportedChain, - type TransactionSimulationResponse, type TransactionSimulation, type TransactionSimulationError, - type TransactionValidationResponse, type TransactionValidation, type TransactionValidationError, type UsdDiff, From c10997ec4c8efec4e36dfe844961a1f5605b76d6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 10:58:19 +0000 Subject: [PATCH 07/18] feat(api): manual updates (#311) --- .stats.yml | 4 +- api.md | 10 +- src/index.ts | 2 + src/resources/bitcoin/bitcoin.ts | 10 +- src/resources/bitcoin/index.ts | 8 +- src/resources/bitcoin/transaction.ts | 85 ++ src/resources/evm/evm.ts | 736 +++-------------- src/resources/index.ts | 1 + src/resources/starknet/index.ts | 8 +- src/resources/starknet/starknet.ts | 10 +- src/resources/starknet/transaction.ts | 228 ++++++ src/resources/stellar/index.ts | 8 +- src/resources/stellar/stellar.ts | 739 ++++++++++++++++- src/resources/stellar/transaction.ts | 766 ++---------------- .../api-resources/bitcoin/transaction.test.ts | 23 + .../starknet/transaction.test.ts | 23 + .../api-resources/stellar/transaction.test.ts | 23 + 17 files changed, 1325 insertions(+), 1359 deletions(-) diff --git a/.stats.yml b/.stats.yml index 19a19564..340daf85 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 19 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-45800f1aa42276b5d55d613d6b586c35fdc605496753c575443096a26655a4cd.yml +configured_endpoints: 22 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-87ee3fdeb9a606656f22829350b26c4844d0071379d4718d0dc1495381eae9ba.yml diff --git a/api.md b/api.md index d35b281b..b556558b 100644 --- a/api.md +++ b/api.md @@ -138,16 +138,18 @@ Types: - StellarAssetContractDetailsSchema - StellarAssetTransferDetailsSchema +- StellarTransactionScanResponse ## Transaction Types: -- TransactionScanResponse +- TransactionReportResponse Methods: -- client.stellar.transaction.scan({ ...params }) -> TransactionScanResponse +- client.stellar.transaction.report({ ...params }) -> TransactionReportResponse +- client.stellar.transaction.scan({ ...params }) -> StellarTransactionScanResponse # Bitcoin @@ -155,10 +157,12 @@ Methods: Types: +- TransactionReportResponse - TransactionScanResponse Methods: +- client.bitcoin.transaction.report({ ...params }) -> TransactionReportResponse - client.bitcoin.transaction.scan({ ...params }) -> TransactionScanResponse # Starknet @@ -173,10 +177,12 @@ Types: Types: +- TransactionReportResponse - TransactionScanResponse Methods: +- client.starknet.transaction.report({ ...params }) -> TransactionReportResponse - client.starknet.transaction.scan({ ...params }) -> TransactionScanResponse # Site diff --git a/src/index.ts b/src/index.ts index 998a08a5..dbd97f8c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -91,6 +91,7 @@ import { Stellar, StellarAssetContractDetailsSchema, StellarAssetTransferDetailsSchema, + StellarTransactionScanResponse, } from './resources/stellar/stellar'; const environments = { @@ -417,6 +418,7 @@ export declare namespace Blockaid { Stellar as Stellar, type StellarAssetContractDetailsSchema as StellarAssetContractDetailsSchema, type StellarAssetTransferDetailsSchema as StellarAssetTransferDetailsSchema, + type StellarTransactionScanResponse as StellarTransactionScanResponse, }; export { Bitcoin as Bitcoin }; diff --git a/src/resources/bitcoin/bitcoin.ts b/src/resources/bitcoin/bitcoin.ts index e6ba4f57..e77dbbcd 100644 --- a/src/resources/bitcoin/bitcoin.ts +++ b/src/resources/bitcoin/bitcoin.ts @@ -2,7 +2,13 @@ import { APIResource } from '../../resource'; import * as TransactionAPI from './transaction'; -import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; +import { + Transaction, + TransactionReportParams, + TransactionReportResponse, + TransactionScanParams, + TransactionScanResponse, +} from './transaction'; export class Bitcoin extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); @@ -13,7 +19,9 @@ Bitcoin.Transaction = Transaction; export declare namespace Bitcoin { export { Transaction as Transaction, + type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/bitcoin/index.ts b/src/resources/bitcoin/index.ts index 5692cbb7..e259b401 100644 --- a/src/resources/bitcoin/index.ts +++ b/src/resources/bitcoin/index.ts @@ -1,4 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Bitcoin } from './bitcoin'; -export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; +export { + Transaction, + type TransactionReportResponse, + type TransactionScanResponse, + type TransactionReportParams, + type TransactionScanParams, +} from './transaction'; diff --git a/src/resources/bitcoin/transaction.ts b/src/resources/bitcoin/transaction.ts index 0bfb1f36..98c120b6 100644 --- a/src/resources/bitcoin/transaction.ts +++ b/src/resources/bitcoin/transaction.ts @@ -4,6 +4,16 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; export class Transaction extends APIResource { + /** + * Report Transaction + */ + report( + body: TransactionReportParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post('/v0/bitcoin/transaction/report', { body, ...options }); + } + /** * Scan Transaction */ @@ -12,6 +22,8 @@ export class Transaction extends APIResource { } } +export type TransactionReportResponse = number; + export interface TransactionScanResponse { /** * Simulation result; Only present if simulation option is included in the request @@ -444,6 +456,77 @@ export namespace TransactionScanResponse { } } +export interface TransactionReportParams { + details: string; + + event: 'should_be_malicious' | 'should_be_benign'; + + report: + | TransactionReportParams.BitcoinAppealRequestID + | TransactionReportParams.BitcoinAppealTransactionDataReportRequestSchemaTypeChainSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedSetOptionsFieldInfoAnnotationNoneTypeRequiredFalseValidationSimulationTitleOptionsSimulationMetadataMinLenMinLength1; +} + +export namespace TransactionReportParams { + export interface BitcoinAppealRequestID { + id: string; + + type?: 'request_id'; + } + + export interface BitcoinAppealTransactionDataReportRequestSchemaTypeChainSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedSetOptionsFieldInfoAnnotationNoneTypeRequiredFalseValidationSimulationTitleOptionsSimulationMetadataMinLenMinLength1 { + params: BitcoinAppealTransactionDataReportRequestSchemaTypeChainSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedSetOptionsFieldInfoAnnotationNoneTypeRequiredFalseValidationSimulationTitleOptionsSimulationMetadataMinLenMinLength1.Params; + + type?: 'params'; + } + + export namespace BitcoinAppealTransactionDataReportRequestSchemaTypeChainSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedSetOptionsFieldInfoAnnotationNoneTypeRequiredFalseValidationSimulationTitleOptionsSimulationMetadataMinLenMinLength1 { + export interface Params { + account_address: string; + + chain: 'bitcoin'; + + /** + * Metadata + */ + metadata: + | Params.BitcoinblockaidApplicationRunnerAppSchemasTransactionScanningAPIWalletRequestMetadata + | Params.BitcoinblockaidApplicationRunnerAppSchemasTransactionScanningAPIInAppRequestMetadata; + + transaction: string; + + /** + * List of options to include in the response + * + * - `Options.validation`: Include Options.validation output in the response + * + * - `Options.simulation`: Include Options.simulation output in the response + */ + options?: Array<'validation' | 'simulation'>; + } + + export namespace Params { + export interface BitcoinblockaidApplicationRunnerAppSchemasTransactionScanningAPIWalletRequestMetadata { + /** + * Metadata for wallet requests + */ + type: 'wallet'; + + /** + * URL of the dApp originating the transaction + */ + url: string; + } + + export interface BitcoinblockaidApplicationRunnerAppSchemasTransactionScanningAPIInAppRequestMetadata { + /** + * Metadata for in-app requests + */ + type?: 'in_app'; + } + } + } +} + export interface TransactionScanParams { account_address: string; @@ -491,7 +574,9 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { + type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/evm/evm.ts b/src/resources/evm/evm.ts index 818029b4..347b9619 100644 --- a/src/resources/evm/evm.ts +++ b/src/resources/evm/evm.ts @@ -496,29 +496,14 @@ export interface TransactionSimulation { * dictionary describes the assets differences as a result of this transaction for * every involved address */ - assets_diffs: Record< - string, - Array< - | TransactionSimulation.Erc20AddressAssetDiff - | TransactionSimulation.Erc721AddressAssetDiff - | TransactionSimulation.Erc1155AddressAssetDiff - | TransactionSimulation.NativeAddressAssetDiff - > - >; + assets_diffs: Record>; /** * dictionary describes the exposure differences as a result of this transaction * for every involved address (as a result of any approval / setApproval / permit * function) */ - exposures: Record< - string, - Array< - | TransactionSimulation.Erc20AddressExposure - | TransactionSimulation.Erc721AddressExposure - | TransactionSimulation.Erc1155AddressExposure - > - >; + exposures: Record>; /** * A string indicating if the simulation was successful or not. @@ -541,14 +526,7 @@ export interface TransactionSimulation { * Describes the state differences as a result of this transaction for every * involved address */ - contract_management?: Record< - string, - Array< - | TransactionSimulation.ProxyUpgradeManagement - | TransactionSimulation.OwnershipChangeManagement - | TransactionSimulation.ModulesChangeManagement - > - >; + contract_management?: Record>; /** * The parameters of the transaction that was simulated. @@ -566,21 +544,12 @@ export namespace TransactionSimulation { /** * All assets diffs related to the account address */ - assets_diffs: Array< - | AccountSummary.Erc20AddressAssetBalanceChangeDiff - | AccountSummary.Erc721AddressAssetBalanceChangeDiff - | AccountSummary.Erc1155AddressAssetBalanceChangeDiff - | AccountSummary.NativeAddressAssetBalanceChangeDiff - >; + assets_diffs: Array; /** * All assets exposures related to the account address */ - exposures: Array< - | AccountSummary.Erc20AddressExposure - | AccountSummary.Erc721AddressExposure - | AccountSummary.Erc1155AddressExposure - >; + exposures: Array; /** * Total usd diff related to the account address @@ -591,138 +560,42 @@ export namespace TransactionSimulation { * Total usd exposure related to the account address */ total_usd_exposure: Record; - - /** - * All assets traces related to the account address - */ - traces: Array< - | AccountSummary.Erc20AssetTrace - | AccountSummary.Erc721AssetTrace - | AccountSummary.Erc1155AssetTrace - | AccountSummary.NativeAssetTrace - | AccountSummary.Erc20ExposureTrace - | AccountSummary.Erc721ExposureTrace - | AccountSummary.Erc1155ExposureTrace - >; } export namespace AccountSummary { - export interface Erc20AddressAssetBalanceChangeDiff { - /** - * description of the asset for the current diff - */ - asset: EvmAPI.Erc20TokenDetails | EvmAPI.NonercTokenDetails; - - /** - * type of the asset for the current diff - */ - asset_type: 'ERC20'; - - /** - * amount of the asset that was transferred to the address in this transaction - */ - in: Array; - - /** - * amount of the asset that was transferred from the address in this transaction - */ - out: Array; - - /** - * shows the balance before making the transaction and after - */ - balance_changes?: Erc20AddressAssetBalanceChangeDiff.BalanceChanges; - } - - export namespace Erc20AddressAssetBalanceChangeDiff { - /** - * shows the balance before making the transaction and after - */ - export interface BalanceChanges { - /** - * balance of the account after making the transaction - */ - after: EvmAPI.Erc20Diff; - - /** - * balance of the account before making the transaction - */ - before: EvmAPI.Erc20Diff; - } - } - - export interface Erc721AddressAssetBalanceChangeDiff { - /** - * description of the asset for the current diff - */ - asset: EvmAPI.Erc721TokenDetails | EvmAPI.NonercTokenDetails; - - /** - * type of the asset for the current diff - */ - asset_type: 'ERC721'; - - /** - * amount of the asset that was transferred to the address in this transaction - */ - in: Array; - - /** - * amount of the asset that was transferred from the address in this transaction - */ - out: Array; - - /** - * shows the balance before making the transaction and after - */ - balance_changes?: Erc721AddressAssetBalanceChangeDiff.BalanceChanges; - } - - export namespace Erc721AddressAssetBalanceChangeDiff { - /** - * shows the balance before making the transaction and after - */ - export interface BalanceChanges { - /** - * balance of the account after making the transaction - */ - after: EvmAPI.Erc721Diff; - - /** - * balance of the account before making the transaction - */ - before: EvmAPI.Erc721Diff; - } - } - - export interface Erc1155AddressAssetBalanceChangeDiff { + export interface AssetsDiff { /** * description of the asset for the current diff */ - asset: EvmAPI.Erc1155TokenDetails | EvmAPI.NonercTokenDetails; + asset: + | EvmAPI.Erc20TokenDetails + | EvmAPI.Erc1155TokenDetails + | EvmAPI.Erc721TokenDetails + | EvmAPI.NonercTokenDetails + | EvmAPI.NativeAssetDetails; /** - * type of the asset for the current diff + * An enumeration. */ - asset_type: 'ERC1155'; + asset_type: 'ERC20' | 'ERC1155' | 'ERC721' | 'NONERC' | 'NATIVE'; /** * amount of the asset that was transferred to the address in this transaction */ - in: Array; + in: Array; /** * amount of the asset that was transferred from the address in this transaction */ - out: Array; + out: Array; /** * shows the balance before making the transaction and after */ - balance_changes?: Erc1155AddressAssetBalanceChangeDiff.BalanceChanges; + balance_changes?: AssetsDiff.BalanceChanges; } - export namespace Erc1155AddressAssetBalanceChangeDiff { + export namespace AssetsDiff { /** * shows the balance before making the transaction and after */ @@ -730,333 +603,72 @@ export namespace TransactionSimulation { /** * balance of the account after making the transaction */ - after: EvmAPI.Erc1155Diff; + after: BalanceChanges.After; /** * balance of the account before making the transaction */ - before: EvmAPI.Erc1155Diff; + before: BalanceChanges.Before; } - } - export interface NativeAddressAssetBalanceChangeDiff { - /** - * description of the asset for the current diff - */ - asset: EvmAPI.NativeAssetDetails; - - /** - * type of the asset for the current diff - */ - asset_type: 'NATIVE'; - - /** - * amount of the asset that was transferred to the address in this transaction - */ - in: Array; - - /** - * amount of the asset that was transferred from the address in this transaction - */ - out: Array; - - /** - * shows the balance before making the transaction and after - */ - balance_changes?: NativeAddressAssetBalanceChangeDiff.BalanceChanges; - } - - export namespace NativeAddressAssetBalanceChangeDiff { - /** - * shows the balance before making the transaction and after - */ - export interface BalanceChanges { + export namespace BalanceChanges { /** * balance of the account after making the transaction */ - after: EvmAPI.NativeDiff; + export interface After { + /** + * value before divided by decimal, that was transferred from this address + */ + raw_value: string; + + /** + * usd equal of the asset that was transferred from this address + */ + usd_price?: string; + + /** + * value after divided by decimals, that was transferred from this address + */ + value?: string; + } /** * balance of the account before making the transaction */ - before: EvmAPI.NativeDiff; + export interface Before { + /** + * value before divided by decimal, that was transferred from this address + */ + raw_value: string; + + /** + * usd equal of the asset that was transferred from this address + */ + usd_price?: string; + + /** + * value after divided by decimals, that was transferred from this address + */ + value?: string; + } } } - export interface Erc20AddressExposure { + export interface Exposure { /** * description of the asset for the current diff */ - asset: EvmAPI.Erc20TokenDetails | EvmAPI.NonercTokenDetails; - - /** - * type of the asset for the current diff - */ - asset_type: 'ERC20'; - - /** - * dictionary of spender addresses where the exposure has changed during this - * transaction for the current address and asset - */ - spenders: Record; - } - - export interface Erc721AddressExposure { - /** - * description of the asset for the current diff - */ - asset: EvmAPI.Erc721TokenDetails | EvmAPI.NonercTokenDetails; - - /** - * type of the asset for the current diff - */ - asset_type: 'ERC721'; - - /** - * dictionary of spender addresses where the exposure has changed during this - * transaction for the current address and asset - */ - spenders: Record; - } - - export interface Erc1155AddressExposure { - /** - * description of the asset for the current diff - */ - asset: EvmAPI.Erc1155TokenDetails | EvmAPI.NonercTokenDetails; - - /** - * type of the asset for the current diff - */ - asset_type: 'ERC1155'; + asset: + | EvmAPI.Erc20TokenDetails + | EvmAPI.Erc1155TokenDetails + | EvmAPI.Erc721TokenDetails + | EvmAPI.NonercTokenDetails; /** * dictionary of spender addresses where the exposure has changed during this * transaction for the current address and asset */ - spenders: Record; - } - - export interface Erc20AssetTrace { - /** - * Description of the asset in the trace - */ - asset: EvmAPI.Erc20TokenDetails | EvmAPI.NonercTokenDetails; - - /** - * The difference in value for the asset in the trace - */ - diff: EvmAPI.Erc20Diff; - - /** - * The address where the assets are moved from - */ - from_address: string; - - /** - * The address where the assets are moved to - */ - to_address: string; - - /** - * type of the trace - */ - trace_type: 'AssetTrace'; - - /** - * The type of the model - */ - type: 'ERC20AssetTrace'; - } - - export interface Erc721AssetTrace { - /** - * Description of the asset in the trace - */ - asset: EvmAPI.Erc721TokenDetails | EvmAPI.NonercTokenDetails; - - /** - * The difference in value for the asset in the trace - */ - diff: EvmAPI.Erc721Diff; - - /** - * The address where the assets are moved from - */ - from_address: string; - - /** - * The address where the assets are moved to - */ - to_address: string; - - /** - * type of the trace - */ - trace_type: 'AssetTrace'; - - /** - * The type of the model - */ - type: 'ERC721AssetTrace'; - } - - export interface Erc1155AssetTrace { - /** - * Description of the asset in the trace - */ - asset: EvmAPI.Erc1155TokenDetails | EvmAPI.NonercTokenDetails; - - /** - * The difference in value for the asset in the trace - */ - diff: EvmAPI.Erc1155Diff; - - /** - * The address where the assets are moved from - */ - from_address: string; - - /** - * The address where the assets are moved to - */ - to_address: string; - - /** - * type of the trace - */ - trace_type: 'AssetTrace'; - - /** - * The type of the model - */ - type: 'ERC1155AssetTrace'; - } - - export interface NativeAssetTrace { - /** - * Description of the asset in the trace - */ - asset: EvmAPI.NativeAssetDetails; - - /** - * The difference in value for the asset in the trace - */ - diff: EvmAPI.NativeDiff; - - /** - * The address where the assets are moved from - */ - from_address: string; - - /** - * The address where the assets are moved to - */ - to_address: string; - - /** - * type of the trace - */ - trace_type: 'AssetTrace'; - - /** - * The type of the model - */ - type: 'NativeAssetTrace'; - } - - export interface Erc20ExposureTrace { - exposed: Erc20ExposureTrace.Exposed; - - /** - * The owner of the assets - */ - owner: string; - - /** - * The spender of the assets - */ - spender: string; - - /** - * type of the trace - */ - trace_type: 'ExposureTrace'; - - /** - * The type of the model - */ - type: 'ERC20ExposureTrace'; - } - - export namespace Erc20ExposureTrace { - export interface Exposed { - raw_value: string; - - usd_price?: number; - - value?: number; - } - } - - export interface Erc721ExposureTrace { - exposed: Erc721ExposureTrace.Exposed; - - /** - * The owner of the assets - */ - owner: string; - - /** - * The spender of the assets - */ - spender: string; - - /** - * type of the trace - */ - trace_type: 'ExposureTrace'; - - /** - * The type of the model - */ - type: 'ERC721ExposureTrace'; - } - - export namespace Erc721ExposureTrace { - export interface Exposed { - amount: number; - - token_id: string; - - is_mint?: boolean; - - logo_url?: string; - - usd_price?: number; - } - } - - export interface Erc1155ExposureTrace { - /** - * The owner of the assets - */ - owner: string; - - /** - * The spender of the assets - */ - spender: string; - - /** - * type of the trace - */ - trace_type: 'ExposureTrace'; - - /** - * The type of the model - */ - type: 'ERC1155ExposureTrace'; + spenders: Record; } } @@ -1077,243 +689,95 @@ export namespace TransactionSimulation { name_tag?: string; } - export interface Erc20AddressAssetDiff { - /** - * description of the asset for the current diff - */ - asset: EvmAPI.Erc20TokenDetails | EvmAPI.NonercTokenDetails; - - /** - * type of the asset for the current diff - */ - asset_type: 'ERC20'; - - /** - * amount of the asset that was transferred to the address in this transaction - */ - in: Array; - - /** - * amount of the asset that was transferred from the address in this transaction - */ - out: Array; - } - - export interface Erc721AddressAssetDiff { - /** - * description of the asset for the current diff - */ - asset: EvmAPI.Erc721TokenDetails | EvmAPI.NonercTokenDetails; - - /** - * type of the asset for the current diff - */ - asset_type: 'ERC721'; - - /** - * amount of the asset that was transferred to the address in this transaction - */ - in: Array; - - /** - * amount of the asset that was transferred from the address in this transaction - */ - out: Array; - } - - export interface Erc1155AddressAssetDiff { + export interface AssetsDiff { /** * description of the asset for the current diff */ - asset: EvmAPI.Erc1155TokenDetails | EvmAPI.NonercTokenDetails; + asset: + | EvmAPI.Erc20TokenDetails + | EvmAPI.Erc1155TokenDetails + | EvmAPI.Erc721TokenDetails + | EvmAPI.NonercTokenDetails + | EvmAPI.NativeAssetDetails; /** - * type of the asset for the current diff + * An enumeration. */ - asset_type: 'ERC1155'; + asset_type: 'ERC20' | 'ERC1155' | 'ERC721' | 'NONERC' | 'NATIVE'; /** * amount of the asset that was transferred to the address in this transaction */ - in: Array; + in: Array; /** * amount of the asset that was transferred from the address in this transaction */ - out: Array; + out: Array; } - export interface NativeAddressAssetDiff { + export interface Exposure { /** * description of the asset for the current diff */ - asset: EvmAPI.NativeAssetDetails; - - /** - * type of the asset for the current diff - */ - asset_type: 'NATIVE'; - - /** - * amount of the asset that was transferred to the address in this transaction - */ - in: Array; - - /** - * amount of the asset that was transferred from the address in this transaction - */ - out: Array; - } - - export interface Erc20AddressExposure { - /** - * description of the asset for the current diff - */ - asset: EvmAPI.Erc20TokenDetails | EvmAPI.NonercTokenDetails; - - /** - * type of the asset for the current diff - */ - asset_type: 'ERC20'; - - /** - * dictionary of spender addresses where the exposure has changed during this - * transaction for the current address and asset - */ - spenders: Record; - } - - export interface Erc721AddressExposure { - /** - * description of the asset for the current diff - */ - asset: EvmAPI.Erc721TokenDetails | EvmAPI.NonercTokenDetails; - - /** - * type of the asset for the current diff - */ - asset_type: 'ERC721'; - - /** - * dictionary of spender addresses where the exposure has changed during this - * transaction for the current address and asset - */ - spenders: Record; - } - - export interface Erc1155AddressExposure { - /** - * description of the asset for the current diff - */ - asset: EvmAPI.Erc1155TokenDetails | EvmAPI.NonercTokenDetails; - - /** - * type of the asset for the current diff - */ - asset_type: 'ERC1155'; + asset: + | EvmAPI.Erc20TokenDetails + | EvmAPI.Erc1155TokenDetails + | EvmAPI.Erc721TokenDetails + | EvmAPI.NonercTokenDetails; /** * dictionary of spender addresses where the exposure has changed during this * transaction for the current address and asset */ - spenders: Record; + spenders: Record; } - export interface ProxyUpgradeManagement { + export interface ContractManagement { /** * The state after the transaction */ - after: ProxyUpgradeManagement.After; + after: + | ContractManagement.AddressChange + | ContractManagement.OwnershipChange + | ContractManagement.ModulesChange; /** * The state before the transaction */ - before: ProxyUpgradeManagement.Before; + before: + | ContractManagement.AddressChange + | ContractManagement.OwnershipChange + | ContractManagement.ModulesChange; /** - * The type of the state change + * An enumeration. */ - type: 'PROXY_UPGRADE'; + type: 'PROXY_UPGRADE' | 'OWNERSHIP_CHANGE' | 'MODULE_CHANGE'; } - export namespace ProxyUpgradeManagement { - /** - * The state after the transaction - */ - export interface After { + export namespace ContractManagement { + export interface AddressChange { address: string; } - /** - * The state before the transaction - */ - export interface Before { - address: string; - } - } - - export interface OwnershipChangeManagement { - /** - * The state after the transaction - */ - after: OwnershipChangeManagement.After; - - /** - * The state before the transaction - */ - before: OwnershipChangeManagement.Before; - - /** - * The type of the state change - */ - type: 'OWNERSHIP_CHANGE'; - } - - export namespace OwnershipChangeManagement { - /** - * The state after the transaction - */ - export interface After { + export interface OwnershipChange { owners: Array; } - /** - * The state before the transaction - */ - export interface Before { - owners: Array; + export interface ModulesChange { + modules: Array; } - } - - export interface ModulesChangeManagement { - /** - * The state after the transaction - */ - after: ModulesChangeManagement.After; - /** - * The state before the transaction - */ - before: ModulesChangeManagement.Before; - - /** - * The type of the state change - */ - type: 'MODULE_CHANGE'; - } + export interface AddressChange { + address: string; + } - export namespace ModulesChangeManagement { - /** - * The state after the transaction - */ - export interface After { - modules: Array; + export interface OwnershipChange { + owners: Array; } - /** - * The state before the transaction - */ - export interface Before { + export interface ModulesChange { modules: Array; } } diff --git a/src/resources/index.ts b/src/resources/index.ts index 8beaaa19..71fc5de4 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -78,6 +78,7 @@ export { Stellar, type StellarAssetContractDetailsSchema, type StellarAssetTransferDetailsSchema, + type StellarTransactionScanResponse, } from './stellar/stellar'; export { Token, diff --git a/src/resources/starknet/index.ts b/src/resources/starknet/index.ts index 40596a5a..0c18a5fc 100644 --- a/src/resources/starknet/index.ts +++ b/src/resources/starknet/index.ts @@ -6,4 +6,10 @@ export { type StarknetErc20Diff, type StarknetErc721Diff, } from './starknet'; -export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; +export { + Transaction, + type TransactionReportResponse, + type TransactionScanResponse, + type TransactionReportParams, + type TransactionScanParams, +} from './transaction'; diff --git a/src/resources/starknet/starknet.ts b/src/resources/starknet/starknet.ts index a3a33651..d7d97f05 100644 --- a/src/resources/starknet/starknet.ts +++ b/src/resources/starknet/starknet.ts @@ -2,7 +2,13 @@ import { APIResource } from '../../resource'; import * as TransactionAPI from './transaction'; -import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; +import { + Transaction, + TransactionReportParams, + TransactionReportResponse, + TransactionScanParams, + TransactionScanResponse, +} from './transaction'; export class Starknet extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); @@ -80,7 +86,9 @@ export declare namespace Starknet { export { Transaction as Transaction, + type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/starknet/transaction.ts b/src/resources/starknet/transaction.ts index f740899f..d80780b9 100644 --- a/src/resources/starknet/transaction.ts +++ b/src/resources/starknet/transaction.ts @@ -5,6 +5,16 @@ import * as Core from '../../core'; import * as StarknetAPI from './starknet'; export class Transaction extends APIResource { + /** + * Report Transaction + */ + report( + body: TransactionReportParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post('/v0/starknet/transaction/report', { body, ...options }); + } + /** * Scan Transactions */ @@ -13,6 +23,8 @@ export class Transaction extends APIResource { } } +export type TransactionReportResponse = number; + export interface TransactionScanResponse { /** * Simulation result; Only present if simulation option is included in the request @@ -867,6 +879,220 @@ export namespace TransactionScanResponse { } } +export interface TransactionReportParams { + details: string; + + event: 'should_be_malicious' | 'should_be_benign'; + + report: + | TransactionReportParams.StarknetAppealRequestID + | TransactionReportParams.StarknetAppealTransactionDataReportStarknetRequestSchemaType; +} + +export namespace TransactionReportParams { + export interface StarknetAppealRequestID { + id: string; + + type?: 'request_id'; + } + + export interface StarknetAppealTransactionDataReportStarknetRequestSchemaType { + params: StarknetAppealTransactionDataReportStarknetRequestSchemaType.Params; + + type?: 'params'; + } + + export namespace StarknetAppealTransactionDataReportStarknetRequestSchemaType { + export interface Params { + account_address: string; + + /** + * The chain name or chain ID + */ + chain: 'mainnet' | 'sepolia' | 'sepolia_integration' | (string & {}); + + /** + * Metadata + */ + metadata: Params.StarknetWalletRequestMetadata | Params.StarknetInAppRequestMetadata; + + transaction: + | Params.StarknetInvokeV1TransactionSchema + | Params.StarknetInvokeV3TransactionSchema + | Params.StarknetDeployAccountV1TransactionSchema + | Params.StarknetDeployAccountV3TransactionSchema; + + /** + * Optional block number or tag context for the simulation + */ + block_number?: string | null; + + /** + * List of options to include in the response + * + * - `Options.validation`: Include Options.validation output in the response + * + * - `Options.simulation`: Include Options.simulation output in the response + */ + options?: Array<'validation' | 'simulation'>; + } + + export namespace Params { + export interface StarknetWalletRequestMetadata { + /** + * Metadata for wallet requests + */ + type: 'wallet'; + + /** + * URL of the dApp originating the transaction + */ + url: string; + } + + export interface StarknetInAppRequestMetadata { + /** + * Metadata for in-app requests + */ + type?: 'in_app'; + } + + export interface StarknetInvokeV1TransactionSchema { + /** + * The maximum fee that the sender is willing to pay. + */ + max_fee: string; + + /** + * The nonce of the transaction. + */ + nonce: string; + + /** + * The address of the sender. + */ + sender_address: string; + + /** + * The version of the transaction. + */ + version: 1; + + /** + * The arguments that are passed to the validate and execute functions. + */ + calldata?: Array; + } + + export interface StarknetInvokeV3TransactionSchema { + /** + * The arguments that are passed to the validate and execute functions. + */ + calldata: Array; + + /** + * The id of the chain to which the transaction is sent. + */ + chain_id: string; + + /** + * The nonce of the transaction. + */ + nonce: string; + + /** + * The address of the sender. + */ + sender_address: string; + + /** + * The version of the transaction. + */ + version: 3; + + /** + * For future use. Currently this value is always empty. + */ + account_deployment_data?: Array; + + /** + * The nonce data availability mode. + */ + nonce_data_availability_mode?: 0; + + /** + * For future use. Currently this value is always empty. + */ + paymaster_data?: Array; + } + + export interface StarknetDeployAccountV1TransactionSchema { + /** + * The hash of the contract class. + */ + class_hash: string; + + /** + * The arguments that are passed to the constructor function. + */ + constructor_calldata: Array; + + /** + * The salt of the contract address. + */ + contract_address_salt: string; + + /** + * The maximum fee that the sender is willing to pay. + */ + max_fee: string; + + /** + * The nonce of the transaction. + */ + nonce: string; + + /** + * The version of the transaction. + */ + version: 1; + } + + export interface StarknetDeployAccountV3TransactionSchema { + /** + * The hash of the contract class. + */ + class_hash: string; + + /** + * The arguments that are passed to the constructor function. + */ + constructor_calldata: Array; + + /** + * The salt of the contract address. + */ + contract_address_salt: string; + + /** + * The maximum fee that the sender is willing to pay. + */ + max_fee: string; + + /** + * The nonce of the transaction. + */ + nonce: string; + + /** + * The version of the transaction. + */ + version: 3; + } + } + } +} + export interface TransactionScanParams { account_address: string; @@ -1059,7 +1285,9 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { + type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/stellar/index.ts b/src/resources/stellar/index.ts index 80722a0c..53d949b3 100644 --- a/src/resources/stellar/index.ts +++ b/src/resources/stellar/index.ts @@ -4,5 +4,11 @@ export { Stellar, type StellarAssetContractDetailsSchema, type StellarAssetTransferDetailsSchema, + type StellarTransactionScanResponse, } from './stellar'; -export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; +export { + Transaction, + type TransactionReportResponse, + type TransactionReportParams, + type TransactionScanParams, +} from './transaction'; diff --git a/src/resources/stellar/stellar.ts b/src/resources/stellar/stellar.ts index 497d7ee5..2ae6713b 100644 --- a/src/resources/stellar/stellar.ts +++ b/src/resources/stellar/stellar.ts @@ -1,8 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; +import * as StellarAPI from './stellar'; import * as TransactionAPI from './transaction'; -import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; +import { + Transaction, + TransactionReportParams, + TransactionReportResponse, + TransactionScanParams, +} from './transaction'; export class Stellar extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); @@ -52,17 +58,746 @@ export interface StellarAssetTransferDetailsSchema { summary?: string | null; } +export interface StellarTransactionScanResponse { + /** + * Simulation result; Only present if simulation option is included in the request + */ + simulation?: + | StellarTransactionScanResponse.StellarSimulationResultSchemaType + | StellarTransactionScanResponse.StellarSimulationErrorSchema + | null; + + /** + * Validation result; Only present if validation option is included in the request + */ + validation?: + | StellarTransactionScanResponse.StellarValidationSuccessfulResultSchema + | StellarTransactionScanResponse.StellarValidationErrorSchema + | null; +} + +export namespace StellarTransactionScanResponse { + export interface StellarSimulationResultSchemaType { + /** + * Summary of the actions and asset transfers that were made by the requested + * account address + */ + account_summary: StellarSimulationResultSchemaType.AccountSummary; + + /** + * Ownership diffs of the account addresses + */ + assets_ownership_diff: Record>; + + status: 'Success'; + + /** + * Details of addresses involved in the transaction + */ + address_details?: Array; + + /** + * Mapping between the address of an account to the assets diff during the + * transaction + */ + assets_diffs?: Record< + string, + Array< + | StellarSimulationResultSchemaType.StellarLegacyAssetDiff + | StellarSimulationResultSchemaType.StellarNativeAssetDiff + | StellarSimulationResultSchemaType.StellarContractAssetDiff + > + >; + + /** + * Mapping between the address of an account to the exposure of the assets during + * the transaction + */ + exposures?: Record< + string, + Array< + | StellarSimulationResultSchemaType.StellarLegacyAssetExposure + | StellarSimulationResultSchemaType.StellarNativeAssetExposure + > + >; + } + + export namespace StellarSimulationResultSchemaType { + /** + * Summary of the actions and asset transfers that were made by the requested + * account address + */ + export interface AccountSummary { + /** + * Exposures made by the requested account address + */ + account_exposures: Array< + AccountSummary.StellarLegacyAssetExposure | AccountSummary.StellarNativeAssetExposure + >; + + /** + * Ownership diffs of the requested account address + */ + account_ownerships_diff: Array; + + /** + * Total USD diff for the requested account address + */ + total_usd_diff: AccountSummary.TotalUsdDiff; + + /** + * Assets diffs of the requested account address + */ + account_assets_diffs?: Array< + | AccountSummary.StellarLegacyAssetDiff + | AccountSummary.StellarNativeAssetDiff + | AccountSummary.StellarContractAssetDiff + >; + + /** + * Total USD exposure for each of the spender addresses during the transaction + */ + total_usd_exposure?: Record; + } + + export namespace AccountSummary { + export interface StellarLegacyAssetExposure { + asset: StellarLegacyAssetExposure.Asset; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export namespace StellarLegacyAssetExposure { + export interface Asset { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; + + /** + * Organization name + */ + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; + } + + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + } + + export interface StellarNativeAssetExposure { + asset: StellarNativeAssetExposure.Asset; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export namespace StellarNativeAssetExposure { + export interface Asset { + /** + * Asset code + */ + code?: 'XLM'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; + } + + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + } + + export interface AccountOwnershipsDiff { + /** + * List of public keys that can sign on behalf of the account post-transaction + */ + post_signers: Array; + + /** + * List of public keys that can sign on behalf of the account pre-transaction + */ + pre_signers: Array; + + type?: 'SET_OPTIONS'; + } + + /** + * Total USD diff for the requested account address + */ + export interface TotalUsdDiff { + /** + * Total incoming USD transfers + */ + in: number; + + /** + * Total outgoing USD transfers + */ + out: number; + + /** + * Total USD transfers + */ + total?: number; + } + + export interface StellarLegacyAssetDiff { + asset: StellarLegacyAssetDiff.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export namespace StellarLegacyAssetDiff { + export interface Asset { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; + + /** + * Organization name + */ + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; + } + } + + export interface StellarNativeAssetDiff { + asset: StellarNativeAssetDiff.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export namespace StellarNativeAssetDiff { + export interface Asset { + /** + * Asset code + */ + code?: 'XLM'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; + } + } + + export interface StellarContractAssetDiff { + asset: StellarAPI.StellarAssetContractDetailsSchema; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + } + + export interface AssetsOwnershipDiff { + /** + * List of public keys that can sign on behalf of the account post-transaction + */ + post_signers: Array; + + /** + * List of public keys that can sign on behalf of the account pre-transaction + */ + pre_signers: Array; + + type?: 'SET_OPTIONS'; + } + + export interface AddressDetail { + /** + * Encoded public key of the account + */ + account_address: unknown; + + /** + * Description of the account + */ + description?: string | null; + } + + export interface StellarLegacyAssetDiff { + asset: StellarLegacyAssetDiff.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export namespace StellarLegacyAssetDiff { + export interface Asset { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; + + /** + * Organization name + */ + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; + } + } + + export interface StellarNativeAssetDiff { + asset: StellarNativeAssetDiff.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export namespace StellarNativeAssetDiff { + export interface Asset { + /** + * Asset code + */ + code?: 'XLM'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; + } + } + + export interface StellarContractAssetDiff { + asset: StellarAPI.StellarAssetContractDetailsSchema; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export interface StellarLegacyAssetExposure { + asset: StellarLegacyAssetExposure.Asset; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export namespace StellarLegacyAssetExposure { + export interface Asset { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; + + /** + * Organization name + */ + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; + } + + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + } + + export interface StellarNativeAssetExposure { + asset: StellarNativeAssetExposure.Asset; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export namespace StellarNativeAssetExposure { + export interface Asset { + /** + * Asset code + */ + code?: 'XLM'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; + } + + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + } + } + + export interface StellarSimulationErrorSchema { + /** + * Error message + */ + error: string; + + status: 'Error'; + } + + export interface StellarValidationSuccessfulResultSchema { + /** + * A textual classification that can be presented to the user explaining the + * reason. + */ + classification: string; + + /** + * A textual description about the validation result + */ + description: string; + + features: Array; + + /** + * A textual description about the reasons the transaction was flagged with + * result_type + */ + reason: string; + + /** + * Verdict of the validation + */ + result_type: 'Benign' | 'Warning' | 'Malicious'; + + status: 'Success'; + } + + export namespace StellarValidationSuccessfulResultSchema { + export interface Feature { + /** + * Address the feature refers to + */ + address: string; + + /** + * Textual description + */ + description: string; + + feature_id: string; + + /** + * Feature Classification + */ + type: 'Benign' | 'Warning' | 'Malicious' | 'Info'; + } + } + + export interface StellarValidationErrorSchema { + /** + * Error message + */ + error: string; + + status: 'Error'; + } +} + Stellar.Transaction = Transaction; export declare namespace Stellar { export { type StellarAssetContractDetailsSchema as StellarAssetContractDetailsSchema, type StellarAssetTransferDetailsSchema as StellarAssetTransferDetailsSchema, + type StellarTransactionScanResponse as StellarTransactionScanResponse, }; export { Transaction as Transaction, - type TransactionScanResponse as TransactionScanResponse, + type TransactionReportResponse as TransactionReportResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/stellar/transaction.ts b/src/resources/stellar/transaction.ts index 5ed2ba1a..e03d65d9 100644 --- a/src/resources/stellar/transaction.ts +++ b/src/resources/stellar/transaction.ts @@ -6,757 +6,98 @@ import * as StellarAPI from './stellar'; export class Transaction extends APIResource { /** - * Scan Transaction + * Report Transaction */ - scan(body: TransactionScanParams, options?: Core.RequestOptions): Core.APIPromise { - return this._client.post('/v0/stellar/transaction/scan', { body, ...options }); + report( + body: TransactionReportParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post('/v0/stellar/transaction/report', { body, ...options }); } -} - -export interface TransactionScanResponse { - /** - * Simulation result; Only present if simulation option is included in the request - */ - simulation?: - | TransactionScanResponse.StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration - | TransactionScanResponse.StellarSimulationErrorSchema - | null; /** - * Validation result; Only present if validation option is included in the request + * Scan Transaction */ - validation?: - | TransactionScanResponse.StellarValidationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchema - | TransactionScanResponse.StellarValidationErrorSchema - | null; + scan( + body: TransactionScanParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post('/v0/stellar/transaction/scan', { body, ...options }); + } } -export namespace TransactionScanResponse { - export interface StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration { - /** - * Summary of the actions and asset transfers that were made by the requested - * account address - */ - account_summary: StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.AccountSummary; +export type TransactionReportResponse = number; - /** - * Ownership diffs of the account addresses - */ - assets_ownership_diff: Record< - string, - Array - >; +export interface TransactionReportParams { + details: string; - status: 'Success'; + event: 'should_be_malicious' | 'should_be_benign'; - /** - * Details of addresses involved in the transaction - */ - address_details?: Array; + report: + | TransactionReportParams.StellarAppealRequestID + | TransactionReportParams.StellarAppealTransactionDataReport; +} - /** - * Mapping between the address of an account to the assets diff during the - * transaction - */ - assets_diffs?: Record< - string, - Array< - | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema - | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema - | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchema - > - >; +export namespace TransactionReportParams { + export interface StellarAppealRequestID { + id: string; - /** - * Mapping between the address of an account to the exposure of the assets during - * the transaction - */ - exposures?: Record< - string, - Array< - | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema - | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema - > - >; + type?: 'request_id'; } - export namespace StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration { - /** - * Summary of the actions and asset transfers that were made by the requested - * account address - */ - export interface AccountSummary { - /** - * Exposures made by the requested account address - */ - account_exposures: Array< - | AccountSummary.StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema - | AccountSummary.StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema - >; - - /** - * Ownership diffs of the requested account address - */ - account_ownerships_diff: Array; - - /** - * Total USD diff for the requested account address - */ - total_usd_diff: AccountSummary.TotalUsdDiff; - - /** - * Assets diffs of the requested account address - */ - account_assets_diffs?: Array< - | AccountSummary.StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema - | AccountSummary.StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema - | AccountSummary.StellarAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchema - >; - - /** - * Total USD exposure for each of the spender addresses during the transaction - */ - total_usd_exposure?: Record; - } - - export namespace AccountSummary { - export interface StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema { - asset: StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema.Asset; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record< - string, - StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema.Spenders - >; - } - - export namespace StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema { - export interface Asset { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; - } - - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - - export interface StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema { - asset: StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema.Asset; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record< - string, - StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema.Spenders - >; - } - - export namespace StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema { - export interface Asset { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - - export interface AccountOwnershipsDiff { - /** - * List of public keys that can sign on behalf of the account post-transaction - */ - post_signers: Array; - - /** - * List of public keys that can sign on behalf of the account pre-transaction - */ - pre_signers: Array; - - type?: 'SET_OPTIONS'; - } - - /** - * Total USD diff for the requested account address - */ - export interface TotalUsdDiff { - /** - * Total incoming USD transfers - */ - in: number; - - /** - * Total outgoing USD transfers - */ - out: number; - - /** - * Total USD transfers - */ - total?: number; - } - - export interface StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema { - asset: StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - - export namespace StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema { - export interface Asset { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; - } - } - - export interface StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema { - asset: StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - - export namespace StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema { - export interface Asset { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - } - - export interface StellarAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchema { - asset: StellarAPI.StellarAssetContractDetailsSchema; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - } - - export interface AssetsOwnershipDiff { - /** - * List of public keys that can sign on behalf of the account post-transaction - */ - post_signers: Array; - - /** - * List of public keys that can sign on behalf of the account pre-transaction - */ - pre_signers: Array; - - type?: 'SET_OPTIONS'; - } - - export interface AddressDetail { - /** - * Encoded public key of the account - */ - account_address: unknown; - - /** - * Description of the account - */ - description?: string | null; - } - - export interface StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema { - asset: StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - - export namespace StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema { - export interface Asset { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; - } - } - - export interface StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema { - asset: StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; + export interface StellarAppealTransactionDataReport { + params: StellarAppealTransactionDataReport.Params; - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - - export namespace StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema { - export interface Asset { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - } - - export interface StellarAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchema { - asset: StellarAPI.StellarAssetContractDetailsSchema; + type?: 'params'; + } - /** - * The type of the assets in this diff - */ - asset_type: string; + export namespace StellarAppealTransactionDataReport { + export interface Params { + account_address: string; /** - * Details of the incoming transfer + * A CAIP-2 chain ID or a Stellar network name */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + chain: 'pubnet' | 'futurenet' | 'testnet'; /** - * Details of the outgoing transfer + * Metadata */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } + metadata: Params.StellarWalletRequestMetadata | Params.StellarInAppRequestMetadata; - export interface StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema { - asset: StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema.Asset; + transaction: string; /** - * Mapping between the spender address and the exposure of the asset + * List of options to include in the response + * + * - `Options.validation`: Include Options.validation output in the response + * + * - `Options.simulation`: Include Options.simulation output in the response */ - spenders?: Record< - string, - StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema.Spenders - >; + options?: Array<'validation' | 'simulation'>; } - export namespace StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema { - export interface Asset { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - + export namespace Params { + export interface StellarWalletRequestMetadata { /** - * Organization URL + * Metadata for wallet requests */ - org_url: string; + type: 'wallet'; /** - * Type of the asset (`ASSET`) + * URL of the dApp originating the transaction */ - type?: 'ASSET'; + url: string; } - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - + export interface StellarInAppRequestMetadata { /** - * Expiration date of the approval + * Metadata for in-app requests */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; + type?: 'in_app'; } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - - export interface StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema { - asset: StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema.Asset; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record< - string, - StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema.Spenders - >; - } - - export namespace StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema { - export interface Asset { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - } - - export interface StellarSimulationErrorSchema { - /** - * Error message - */ - error: string; - - status: 'Error'; - } - - export interface StellarValidationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchema { - /** - * A textual classification that can be presented to the user explaining the - * reason. - */ - classification: string; - - /** - * A textual description about the validation result - */ - description: string; - - /** - * A list of features about this transaction explaining the validation - */ - features: Array; - - /** - * A textual description about the reasons the transaction was flagged with - * result_type - */ - reason: string; - - /** - * Verdict of the validation - */ - result_type: 'Benign' | 'Warning' | 'Malicious'; - - status: 'Success'; - } - - export namespace StellarValidationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchema { - export interface Feature { - /** - * Address the feature refers to - */ - address: string; - - /** - * Textual description - */ - description: string; - - feature_id: string; - - /** - * Feature Classification - */ - type: 'Benign' | 'Warning' | 'Malicious' | 'Info'; } } - - export interface StellarValidationErrorSchema { - /** - * Error message - */ - error: string; - - status: 'Error'; - } } export interface TransactionScanParams { @@ -809,7 +150,8 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { - type TransactionScanResponse as TransactionScanResponse, + type TransactionReportResponse as TransactionReportResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/tests/api-resources/bitcoin/transaction.test.ts b/tests/api-resources/bitcoin/transaction.test.ts index 16e50953..55196b47 100644 --- a/tests/api-resources/bitcoin/transaction.test.ts +++ b/tests/api-resources/bitcoin/transaction.test.ts @@ -9,6 +9,29 @@ const client = new Blockaid({ }); describe('resource transaction', () => { + test('report: only required params', async () => { + const responsePromise = client.bitcoin.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id' }, + }); + 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('report: required and optional params', async () => { + const response = await client.bitcoin.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id', type: 'request_id' }, + }); + }); + test('scan: only required params', async () => { const responsePromise = client.bitcoin.transaction.scan({ account_address: 'account_address', diff --git a/tests/api-resources/starknet/transaction.test.ts b/tests/api-resources/starknet/transaction.test.ts index cdd0d343..92070907 100644 --- a/tests/api-resources/starknet/transaction.test.ts +++ b/tests/api-resources/starknet/transaction.test.ts @@ -9,6 +9,29 @@ const client = new Blockaid({ }); describe('resource transaction', () => { + test('report: only required params', async () => { + const responsePromise = client.starknet.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id' }, + }); + 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('report: required and optional params', async () => { + const response = await client.starknet.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id', type: 'request_id' }, + }); + }); + test('scan: only required params', async () => { const responsePromise = client.starknet.transaction.scan({ account_address: '0x62a2959fa6502b30cbfb51199fbbe72e72ee4f5a86ec754b4172c7d7beb6ff4', diff --git a/tests/api-resources/stellar/transaction.test.ts b/tests/api-resources/stellar/transaction.test.ts index 529fd3d5..3cb0f617 100644 --- a/tests/api-resources/stellar/transaction.test.ts +++ b/tests/api-resources/stellar/transaction.test.ts @@ -9,6 +9,29 @@ const client = new Blockaid({ }); describe('resource transaction', () => { + test('report: only required params', async () => { + const responsePromise = client.stellar.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id' }, + }); + 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('report: required and optional params', async () => { + const response = await client.stellar.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id', type: 'request_id' }, + }); + }); + test('scan: only required params', async () => { const responsePromise = client.stellar.transaction.scan({ account_address: 'GDPMFLKUGASUTWBN2XGYYKD27QGHCYH4BUFUTER4L23INYQ4JHDWFOIE', From c16b46fd4e08af73d6a0cdb012c82df0609d21a4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 13:01:21 +0000 Subject: [PATCH 08/18] feat(api): api update (#312) --- .stats.yml | 4 +- api.md | 10 +- src/index.ts | 2 - src/resources/bitcoin/bitcoin.ts | 10 +- src/resources/bitcoin/index.ts | 8 +- src/resources/bitcoin/transaction.ts | 85 -- src/resources/evm/evm.ts | 736 ++++++++++++++--- src/resources/index.ts | 1 - src/resources/starknet/index.ts | 8 +- src/resources/starknet/starknet.ts | 10 +- src/resources/starknet/transaction.ts | 228 ------ src/resources/stellar/index.ts | 8 +- src/resources/stellar/stellar.ts | 739 +---------------- src/resources/stellar/transaction.ts | 766 ++++++++++++++++-- .../api-resources/bitcoin/transaction.test.ts | 23 - .../starknet/transaction.test.ts | 23 - .../api-resources/stellar/transaction.test.ts | 23 - 17 files changed, 1359 insertions(+), 1325 deletions(-) diff --git a/.stats.yml b/.stats.yml index 340daf85..14f629e4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 22 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-87ee3fdeb9a606656f22829350b26c4844d0071379d4718d0dc1495381eae9ba.yml +configured_endpoints: 19 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-8f7d9864c68d27433277000fd14bacc24ffbe9c8dfde41466764a18aee4f958d.yml diff --git a/api.md b/api.md index b556558b..d35b281b 100644 --- a/api.md +++ b/api.md @@ -138,18 +138,16 @@ Types: - StellarAssetContractDetailsSchema - StellarAssetTransferDetailsSchema -- StellarTransactionScanResponse ## Transaction Types: -- TransactionReportResponse +- TransactionScanResponse Methods: -- client.stellar.transaction.report({ ...params }) -> TransactionReportResponse -- client.stellar.transaction.scan({ ...params }) -> StellarTransactionScanResponse +- client.stellar.transaction.scan({ ...params }) -> TransactionScanResponse # Bitcoin @@ -157,12 +155,10 @@ Methods: Types: -- TransactionReportResponse - TransactionScanResponse Methods: -- client.bitcoin.transaction.report({ ...params }) -> TransactionReportResponse - client.bitcoin.transaction.scan({ ...params }) -> TransactionScanResponse # Starknet @@ -177,12 +173,10 @@ Types: Types: -- TransactionReportResponse - TransactionScanResponse Methods: -- client.starknet.transaction.report({ ...params }) -> TransactionReportResponse - client.starknet.transaction.scan({ ...params }) -> TransactionScanResponse # Site diff --git a/src/index.ts b/src/index.ts index dbd97f8c..998a08a5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -91,7 +91,6 @@ import { Stellar, StellarAssetContractDetailsSchema, StellarAssetTransferDetailsSchema, - StellarTransactionScanResponse, } from './resources/stellar/stellar'; const environments = { @@ -418,7 +417,6 @@ export declare namespace Blockaid { Stellar as Stellar, type StellarAssetContractDetailsSchema as StellarAssetContractDetailsSchema, type StellarAssetTransferDetailsSchema as StellarAssetTransferDetailsSchema, - type StellarTransactionScanResponse as StellarTransactionScanResponse, }; export { Bitcoin as Bitcoin }; diff --git a/src/resources/bitcoin/bitcoin.ts b/src/resources/bitcoin/bitcoin.ts index e77dbbcd..e6ba4f57 100644 --- a/src/resources/bitcoin/bitcoin.ts +++ b/src/resources/bitcoin/bitcoin.ts @@ -2,13 +2,7 @@ import { APIResource } from '../../resource'; import * as TransactionAPI from './transaction'; -import { - Transaction, - TransactionReportParams, - TransactionReportResponse, - TransactionScanParams, - TransactionScanResponse, -} from './transaction'; +import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; export class Bitcoin extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); @@ -19,9 +13,7 @@ Bitcoin.Transaction = Transaction; export declare namespace Bitcoin { export { Transaction as Transaction, - type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, - type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/bitcoin/index.ts b/src/resources/bitcoin/index.ts index e259b401..5692cbb7 100644 --- a/src/resources/bitcoin/index.ts +++ b/src/resources/bitcoin/index.ts @@ -1,10 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Bitcoin } from './bitcoin'; -export { - Transaction, - type TransactionReportResponse, - type TransactionScanResponse, - type TransactionReportParams, - type TransactionScanParams, -} from './transaction'; +export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; diff --git a/src/resources/bitcoin/transaction.ts b/src/resources/bitcoin/transaction.ts index 98c120b6..0bfb1f36 100644 --- a/src/resources/bitcoin/transaction.ts +++ b/src/resources/bitcoin/transaction.ts @@ -4,16 +4,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; export class Transaction extends APIResource { - /** - * Report Transaction - */ - report( - body: TransactionReportParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post('/v0/bitcoin/transaction/report', { body, ...options }); - } - /** * Scan Transaction */ @@ -22,8 +12,6 @@ export class Transaction extends APIResource { } } -export type TransactionReportResponse = number; - export interface TransactionScanResponse { /** * Simulation result; Only present if simulation option is included in the request @@ -456,77 +444,6 @@ export namespace TransactionScanResponse { } } -export interface TransactionReportParams { - details: string; - - event: 'should_be_malicious' | 'should_be_benign'; - - report: - | TransactionReportParams.BitcoinAppealRequestID - | TransactionReportParams.BitcoinAppealTransactionDataReportRequestSchemaTypeChainSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedSetOptionsFieldInfoAnnotationNoneTypeRequiredFalseValidationSimulationTitleOptionsSimulationMetadataMinLenMinLength1; -} - -export namespace TransactionReportParams { - export interface BitcoinAppealRequestID { - id: string; - - type?: 'request_id'; - } - - export interface BitcoinAppealTransactionDataReportRequestSchemaTypeChainSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedSetOptionsFieldInfoAnnotationNoneTypeRequiredFalseValidationSimulationTitleOptionsSimulationMetadataMinLenMinLength1 { - params: BitcoinAppealTransactionDataReportRequestSchemaTypeChainSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedSetOptionsFieldInfoAnnotationNoneTypeRequiredFalseValidationSimulationTitleOptionsSimulationMetadataMinLenMinLength1.Params; - - type?: 'params'; - } - - export namespace BitcoinAppealTransactionDataReportRequestSchemaTypeChainSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedSetOptionsFieldInfoAnnotationNoneTypeRequiredFalseValidationSimulationTitleOptionsSimulationMetadataMinLenMinLength1 { - export interface Params { - account_address: string; - - chain: 'bitcoin'; - - /** - * Metadata - */ - metadata: - | Params.BitcoinblockaidApplicationRunnerAppSchemasTransactionScanningAPIWalletRequestMetadata - | Params.BitcoinblockaidApplicationRunnerAppSchemasTransactionScanningAPIInAppRequestMetadata; - - transaction: string; - - /** - * List of options to include in the response - * - * - `Options.validation`: Include Options.validation output in the response - * - * - `Options.simulation`: Include Options.simulation output in the response - */ - options?: Array<'validation' | 'simulation'>; - } - - export namespace Params { - export interface BitcoinblockaidApplicationRunnerAppSchemasTransactionScanningAPIWalletRequestMetadata { - /** - * Metadata for wallet requests - */ - type: 'wallet'; - - /** - * URL of the dApp originating the transaction - */ - url: string; - } - - export interface BitcoinblockaidApplicationRunnerAppSchemasTransactionScanningAPIInAppRequestMetadata { - /** - * Metadata for in-app requests - */ - type?: 'in_app'; - } - } - } -} - export interface TransactionScanParams { account_address: string; @@ -574,9 +491,7 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { - type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, - type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/evm/evm.ts b/src/resources/evm/evm.ts index 347b9619..818029b4 100644 --- a/src/resources/evm/evm.ts +++ b/src/resources/evm/evm.ts @@ -496,14 +496,29 @@ export interface TransactionSimulation { * dictionary describes the assets differences as a result of this transaction for * every involved address */ - assets_diffs: Record>; + assets_diffs: Record< + string, + Array< + | TransactionSimulation.Erc20AddressAssetDiff + | TransactionSimulation.Erc721AddressAssetDiff + | TransactionSimulation.Erc1155AddressAssetDiff + | TransactionSimulation.NativeAddressAssetDiff + > + >; /** * dictionary describes the exposure differences as a result of this transaction * for every involved address (as a result of any approval / setApproval / permit * function) */ - exposures: Record>; + exposures: Record< + string, + Array< + | TransactionSimulation.Erc20AddressExposure + | TransactionSimulation.Erc721AddressExposure + | TransactionSimulation.Erc1155AddressExposure + > + >; /** * A string indicating if the simulation was successful or not. @@ -526,7 +541,14 @@ export interface TransactionSimulation { * Describes the state differences as a result of this transaction for every * involved address */ - contract_management?: Record>; + contract_management?: Record< + string, + Array< + | TransactionSimulation.ProxyUpgradeManagement + | TransactionSimulation.OwnershipChangeManagement + | TransactionSimulation.ModulesChangeManagement + > + >; /** * The parameters of the transaction that was simulated. @@ -544,12 +566,21 @@ export namespace TransactionSimulation { /** * All assets diffs related to the account address */ - assets_diffs: Array; + assets_diffs: Array< + | AccountSummary.Erc20AddressAssetBalanceChangeDiff + | AccountSummary.Erc721AddressAssetBalanceChangeDiff + | AccountSummary.Erc1155AddressAssetBalanceChangeDiff + | AccountSummary.NativeAddressAssetBalanceChangeDiff + >; /** * All assets exposures related to the account address */ - exposures: Array; + exposures: Array< + | AccountSummary.Erc20AddressExposure + | AccountSummary.Erc721AddressExposure + | AccountSummary.Erc1155AddressExposure + >; /** * Total usd diff related to the account address @@ -560,42 +591,138 @@ export namespace TransactionSimulation { * Total usd exposure related to the account address */ total_usd_exposure: Record; + + /** + * All assets traces related to the account address + */ + traces: Array< + | AccountSummary.Erc20AssetTrace + | AccountSummary.Erc721AssetTrace + | AccountSummary.Erc1155AssetTrace + | AccountSummary.NativeAssetTrace + | AccountSummary.Erc20ExposureTrace + | AccountSummary.Erc721ExposureTrace + | AccountSummary.Erc1155ExposureTrace + >; } export namespace AccountSummary { - export interface AssetsDiff { + export interface Erc20AddressAssetBalanceChangeDiff { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc20TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC20'; + + /** + * amount of the asset that was transferred to the address in this transaction + */ + in: Array; + + /** + * amount of the asset that was transferred from the address in this transaction + */ + out: Array; + + /** + * shows the balance before making the transaction and after + */ + balance_changes?: Erc20AddressAssetBalanceChangeDiff.BalanceChanges; + } + + export namespace Erc20AddressAssetBalanceChangeDiff { + /** + * shows the balance before making the transaction and after + */ + export interface BalanceChanges { + /** + * balance of the account after making the transaction + */ + after: EvmAPI.Erc20Diff; + + /** + * balance of the account before making the transaction + */ + before: EvmAPI.Erc20Diff; + } + } + + export interface Erc721AddressAssetBalanceChangeDiff { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc721TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC721'; + + /** + * amount of the asset that was transferred to the address in this transaction + */ + in: Array; + + /** + * amount of the asset that was transferred from the address in this transaction + */ + out: Array; + + /** + * shows the balance before making the transaction and after + */ + balance_changes?: Erc721AddressAssetBalanceChangeDiff.BalanceChanges; + } + + export namespace Erc721AddressAssetBalanceChangeDiff { + /** + * shows the balance before making the transaction and after + */ + export interface BalanceChanges { + /** + * balance of the account after making the transaction + */ + after: EvmAPI.Erc721Diff; + + /** + * balance of the account before making the transaction + */ + before: EvmAPI.Erc721Diff; + } + } + + export interface Erc1155AddressAssetBalanceChangeDiff { /** * description of the asset for the current diff */ - asset: - | EvmAPI.Erc20TokenDetails - | EvmAPI.Erc1155TokenDetails - | EvmAPI.Erc721TokenDetails - | EvmAPI.NonercTokenDetails - | EvmAPI.NativeAssetDetails; + asset: EvmAPI.Erc1155TokenDetails | EvmAPI.NonercTokenDetails; /** - * An enumeration. + * type of the asset for the current diff */ - asset_type: 'ERC20' | 'ERC1155' | 'ERC721' | 'NONERC' | 'NATIVE'; + asset_type: 'ERC1155'; /** * amount of the asset that was transferred to the address in this transaction */ - in: Array; + in: Array; /** * amount of the asset that was transferred from the address in this transaction */ - out: Array; + out: Array; /** * shows the balance before making the transaction and after */ - balance_changes?: AssetsDiff.BalanceChanges; + balance_changes?: Erc1155AddressAssetBalanceChangeDiff.BalanceChanges; } - export namespace AssetsDiff { + export namespace Erc1155AddressAssetBalanceChangeDiff { /** * shows the balance before making the transaction and after */ @@ -603,72 +730,333 @@ export namespace TransactionSimulation { /** * balance of the account after making the transaction */ - after: BalanceChanges.After; + after: EvmAPI.Erc1155Diff; /** * balance of the account before making the transaction */ - before: BalanceChanges.Before; + before: EvmAPI.Erc1155Diff; } + } - export namespace BalanceChanges { + export interface NativeAddressAssetBalanceChangeDiff { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.NativeAssetDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'NATIVE'; + + /** + * amount of the asset that was transferred to the address in this transaction + */ + in: Array; + + /** + * amount of the asset that was transferred from the address in this transaction + */ + out: Array; + + /** + * shows the balance before making the transaction and after + */ + balance_changes?: NativeAddressAssetBalanceChangeDiff.BalanceChanges; + } + + export namespace NativeAddressAssetBalanceChangeDiff { + /** + * shows the balance before making the transaction and after + */ + export interface BalanceChanges { /** * balance of the account after making the transaction */ - export interface After { - /** - * value before divided by decimal, that was transferred from this address - */ - raw_value: string; - - /** - * usd equal of the asset that was transferred from this address - */ - usd_price?: string; - - /** - * value after divided by decimals, that was transferred from this address - */ - value?: string; - } + after: EvmAPI.NativeDiff; /** * balance of the account before making the transaction */ - export interface Before { - /** - * value before divided by decimal, that was transferred from this address - */ - raw_value: string; - - /** - * usd equal of the asset that was transferred from this address - */ - usd_price?: string; - - /** - * value after divided by decimals, that was transferred from this address - */ - value?: string; - } + before: EvmAPI.NativeDiff; } } - export interface Exposure { + export interface Erc20AddressExposure { /** * description of the asset for the current diff */ - asset: - | EvmAPI.Erc20TokenDetails - | EvmAPI.Erc1155TokenDetails - | EvmAPI.Erc721TokenDetails - | EvmAPI.NonercTokenDetails; + asset: EvmAPI.Erc20TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC20'; + + /** + * dictionary of spender addresses where the exposure has changed during this + * transaction for the current address and asset + */ + spenders: Record; + } + + export interface Erc721AddressExposure { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc721TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC721'; + + /** + * dictionary of spender addresses where the exposure has changed during this + * transaction for the current address and asset + */ + spenders: Record; + } + + export interface Erc1155AddressExposure { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc1155TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC1155'; /** * dictionary of spender addresses where the exposure has changed during this * transaction for the current address and asset */ - spenders: Record; + spenders: Record; + } + + export interface Erc20AssetTrace { + /** + * Description of the asset in the trace + */ + asset: EvmAPI.Erc20TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * The difference in value for the asset in the trace + */ + diff: EvmAPI.Erc20Diff; + + /** + * The address where the assets are moved from + */ + from_address: string; + + /** + * The address where the assets are moved to + */ + to_address: string; + + /** + * type of the trace + */ + trace_type: 'AssetTrace'; + + /** + * The type of the model + */ + type: 'ERC20AssetTrace'; + } + + export interface Erc721AssetTrace { + /** + * Description of the asset in the trace + */ + asset: EvmAPI.Erc721TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * The difference in value for the asset in the trace + */ + diff: EvmAPI.Erc721Diff; + + /** + * The address where the assets are moved from + */ + from_address: string; + + /** + * The address where the assets are moved to + */ + to_address: string; + + /** + * type of the trace + */ + trace_type: 'AssetTrace'; + + /** + * The type of the model + */ + type: 'ERC721AssetTrace'; + } + + export interface Erc1155AssetTrace { + /** + * Description of the asset in the trace + */ + asset: EvmAPI.Erc1155TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * The difference in value for the asset in the trace + */ + diff: EvmAPI.Erc1155Diff; + + /** + * The address where the assets are moved from + */ + from_address: string; + + /** + * The address where the assets are moved to + */ + to_address: string; + + /** + * type of the trace + */ + trace_type: 'AssetTrace'; + + /** + * The type of the model + */ + type: 'ERC1155AssetTrace'; + } + + export interface NativeAssetTrace { + /** + * Description of the asset in the trace + */ + asset: EvmAPI.NativeAssetDetails; + + /** + * The difference in value for the asset in the trace + */ + diff: EvmAPI.NativeDiff; + + /** + * The address where the assets are moved from + */ + from_address: string; + + /** + * The address where the assets are moved to + */ + to_address: string; + + /** + * type of the trace + */ + trace_type: 'AssetTrace'; + + /** + * The type of the model + */ + type: 'NativeAssetTrace'; + } + + export interface Erc20ExposureTrace { + exposed: Erc20ExposureTrace.Exposed; + + /** + * The owner of the assets + */ + owner: string; + + /** + * The spender of the assets + */ + spender: string; + + /** + * type of the trace + */ + trace_type: 'ExposureTrace'; + + /** + * The type of the model + */ + type: 'ERC20ExposureTrace'; + } + + export namespace Erc20ExposureTrace { + export interface Exposed { + raw_value: string; + + usd_price?: number; + + value?: number; + } + } + + export interface Erc721ExposureTrace { + exposed: Erc721ExposureTrace.Exposed; + + /** + * The owner of the assets + */ + owner: string; + + /** + * The spender of the assets + */ + spender: string; + + /** + * type of the trace + */ + trace_type: 'ExposureTrace'; + + /** + * The type of the model + */ + type: 'ERC721ExposureTrace'; + } + + export namespace Erc721ExposureTrace { + export interface Exposed { + amount: number; + + token_id: string; + + is_mint?: boolean; + + logo_url?: string; + + usd_price?: number; + } + } + + export interface Erc1155ExposureTrace { + /** + * The owner of the assets + */ + owner: string; + + /** + * The spender of the assets + */ + spender: string; + + /** + * type of the trace + */ + trace_type: 'ExposureTrace'; + + /** + * The type of the model + */ + type: 'ERC1155ExposureTrace'; } } @@ -689,95 +1077,243 @@ export namespace TransactionSimulation { name_tag?: string; } - export interface AssetsDiff { + export interface Erc20AddressAssetDiff { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc20TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC20'; + + /** + * amount of the asset that was transferred to the address in this transaction + */ + in: Array; + + /** + * amount of the asset that was transferred from the address in this transaction + */ + out: Array; + } + + export interface Erc721AddressAssetDiff { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc721TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC721'; + + /** + * amount of the asset that was transferred to the address in this transaction + */ + in: Array; + + /** + * amount of the asset that was transferred from the address in this transaction + */ + out: Array; + } + + export interface Erc1155AddressAssetDiff { /** * description of the asset for the current diff */ - asset: - | EvmAPI.Erc20TokenDetails - | EvmAPI.Erc1155TokenDetails - | EvmAPI.Erc721TokenDetails - | EvmAPI.NonercTokenDetails - | EvmAPI.NativeAssetDetails; + asset: EvmAPI.Erc1155TokenDetails | EvmAPI.NonercTokenDetails; /** - * An enumeration. + * type of the asset for the current diff */ - asset_type: 'ERC20' | 'ERC1155' | 'ERC721' | 'NONERC' | 'NATIVE'; + asset_type: 'ERC1155'; /** * amount of the asset that was transferred to the address in this transaction */ - in: Array; + in: Array; /** * amount of the asset that was transferred from the address in this transaction */ - out: Array; + out: Array; } - export interface Exposure { + export interface NativeAddressAssetDiff { /** * description of the asset for the current diff */ - asset: - | EvmAPI.Erc20TokenDetails - | EvmAPI.Erc1155TokenDetails - | EvmAPI.Erc721TokenDetails - | EvmAPI.NonercTokenDetails; + asset: EvmAPI.NativeAssetDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'NATIVE'; + + /** + * amount of the asset that was transferred to the address in this transaction + */ + in: Array; + + /** + * amount of the asset that was transferred from the address in this transaction + */ + out: Array; + } + + export interface Erc20AddressExposure { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc20TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC20'; + + /** + * dictionary of spender addresses where the exposure has changed during this + * transaction for the current address and asset + */ + spenders: Record; + } + + export interface Erc721AddressExposure { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc721TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC721'; + + /** + * dictionary of spender addresses where the exposure has changed during this + * transaction for the current address and asset + */ + spenders: Record; + } + + export interface Erc1155AddressExposure { + /** + * description of the asset for the current diff + */ + asset: EvmAPI.Erc1155TokenDetails | EvmAPI.NonercTokenDetails; + + /** + * type of the asset for the current diff + */ + asset_type: 'ERC1155'; /** * dictionary of spender addresses where the exposure has changed during this * transaction for the current address and asset */ - spenders: Record; + spenders: Record; } - export interface ContractManagement { + export interface ProxyUpgradeManagement { /** * The state after the transaction */ - after: - | ContractManagement.AddressChange - | ContractManagement.OwnershipChange - | ContractManagement.ModulesChange; + after: ProxyUpgradeManagement.After; /** * The state before the transaction */ - before: - | ContractManagement.AddressChange - | ContractManagement.OwnershipChange - | ContractManagement.ModulesChange; + before: ProxyUpgradeManagement.Before; /** - * An enumeration. + * The type of the state change */ - type: 'PROXY_UPGRADE' | 'OWNERSHIP_CHANGE' | 'MODULE_CHANGE'; + type: 'PROXY_UPGRADE'; } - export namespace ContractManagement { - export interface AddressChange { + export namespace ProxyUpgradeManagement { + /** + * The state after the transaction + */ + export interface After { address: string; } - export interface OwnershipChange { - owners: Array; + /** + * The state before the transaction + */ + export interface Before { + address: string; } + } - export interface ModulesChange { - modules: Array; - } + export interface OwnershipChangeManagement { + /** + * The state after the transaction + */ + after: OwnershipChangeManagement.After; - export interface AddressChange { - address: string; + /** + * The state before the transaction + */ + before: OwnershipChangeManagement.Before; + + /** + * The type of the state change + */ + type: 'OWNERSHIP_CHANGE'; + } + + export namespace OwnershipChangeManagement { + /** + * The state after the transaction + */ + export interface After { + owners: Array; } - export interface OwnershipChange { + /** + * The state before the transaction + */ + export interface Before { owners: Array; } + } + + export interface ModulesChangeManagement { + /** + * The state after the transaction + */ + after: ModulesChangeManagement.After; - export interface ModulesChange { + /** + * The state before the transaction + */ + before: ModulesChangeManagement.Before; + + /** + * The type of the state change + */ + type: 'MODULE_CHANGE'; + } + + export namespace ModulesChangeManagement { + /** + * The state after the transaction + */ + export interface After { + modules: Array; + } + + /** + * The state before the transaction + */ + export interface Before { modules: Array; } } diff --git a/src/resources/index.ts b/src/resources/index.ts index 71fc5de4..8beaaa19 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -78,7 +78,6 @@ export { Stellar, type StellarAssetContractDetailsSchema, type StellarAssetTransferDetailsSchema, - type StellarTransactionScanResponse, } from './stellar/stellar'; export { Token, diff --git a/src/resources/starknet/index.ts b/src/resources/starknet/index.ts index 0c18a5fc..40596a5a 100644 --- a/src/resources/starknet/index.ts +++ b/src/resources/starknet/index.ts @@ -6,10 +6,4 @@ export { type StarknetErc20Diff, type StarknetErc721Diff, } from './starknet'; -export { - Transaction, - type TransactionReportResponse, - type TransactionScanResponse, - type TransactionReportParams, - type TransactionScanParams, -} from './transaction'; +export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; diff --git a/src/resources/starknet/starknet.ts b/src/resources/starknet/starknet.ts index d7d97f05..a3a33651 100644 --- a/src/resources/starknet/starknet.ts +++ b/src/resources/starknet/starknet.ts @@ -2,13 +2,7 @@ import { APIResource } from '../../resource'; import * as TransactionAPI from './transaction'; -import { - Transaction, - TransactionReportParams, - TransactionReportResponse, - TransactionScanParams, - TransactionScanResponse, -} from './transaction'; +import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; export class Starknet extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); @@ -86,9 +80,7 @@ export declare namespace Starknet { export { Transaction as Transaction, - type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, - type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/starknet/transaction.ts b/src/resources/starknet/transaction.ts index d80780b9..f740899f 100644 --- a/src/resources/starknet/transaction.ts +++ b/src/resources/starknet/transaction.ts @@ -5,16 +5,6 @@ import * as Core from '../../core'; import * as StarknetAPI from './starknet'; export class Transaction extends APIResource { - /** - * Report Transaction - */ - report( - body: TransactionReportParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post('/v0/starknet/transaction/report', { body, ...options }); - } - /** * Scan Transactions */ @@ -23,8 +13,6 @@ export class Transaction extends APIResource { } } -export type TransactionReportResponse = number; - export interface TransactionScanResponse { /** * Simulation result; Only present if simulation option is included in the request @@ -879,220 +867,6 @@ export namespace TransactionScanResponse { } } -export interface TransactionReportParams { - details: string; - - event: 'should_be_malicious' | 'should_be_benign'; - - report: - | TransactionReportParams.StarknetAppealRequestID - | TransactionReportParams.StarknetAppealTransactionDataReportStarknetRequestSchemaType; -} - -export namespace TransactionReportParams { - export interface StarknetAppealRequestID { - id: string; - - type?: 'request_id'; - } - - export interface StarknetAppealTransactionDataReportStarknetRequestSchemaType { - params: StarknetAppealTransactionDataReportStarknetRequestSchemaType.Params; - - type?: 'params'; - } - - export namespace StarknetAppealTransactionDataReportStarknetRequestSchemaType { - export interface Params { - account_address: string; - - /** - * The chain name or chain ID - */ - chain: 'mainnet' | 'sepolia' | 'sepolia_integration' | (string & {}); - - /** - * Metadata - */ - metadata: Params.StarknetWalletRequestMetadata | Params.StarknetInAppRequestMetadata; - - transaction: - | Params.StarknetInvokeV1TransactionSchema - | Params.StarknetInvokeV3TransactionSchema - | Params.StarknetDeployAccountV1TransactionSchema - | Params.StarknetDeployAccountV3TransactionSchema; - - /** - * Optional block number or tag context for the simulation - */ - block_number?: string | null; - - /** - * List of options to include in the response - * - * - `Options.validation`: Include Options.validation output in the response - * - * - `Options.simulation`: Include Options.simulation output in the response - */ - options?: Array<'validation' | 'simulation'>; - } - - export namespace Params { - export interface StarknetWalletRequestMetadata { - /** - * Metadata for wallet requests - */ - type: 'wallet'; - - /** - * URL of the dApp originating the transaction - */ - url: string; - } - - export interface StarknetInAppRequestMetadata { - /** - * Metadata for in-app requests - */ - type?: 'in_app'; - } - - export interface StarknetInvokeV1TransactionSchema { - /** - * The maximum fee that the sender is willing to pay. - */ - max_fee: string; - - /** - * The nonce of the transaction. - */ - nonce: string; - - /** - * The address of the sender. - */ - sender_address: string; - - /** - * The version of the transaction. - */ - version: 1; - - /** - * The arguments that are passed to the validate and execute functions. - */ - calldata?: Array; - } - - export interface StarknetInvokeV3TransactionSchema { - /** - * The arguments that are passed to the validate and execute functions. - */ - calldata: Array; - - /** - * The id of the chain to which the transaction is sent. - */ - chain_id: string; - - /** - * The nonce of the transaction. - */ - nonce: string; - - /** - * The address of the sender. - */ - sender_address: string; - - /** - * The version of the transaction. - */ - version: 3; - - /** - * For future use. Currently this value is always empty. - */ - account_deployment_data?: Array; - - /** - * The nonce data availability mode. - */ - nonce_data_availability_mode?: 0; - - /** - * For future use. Currently this value is always empty. - */ - paymaster_data?: Array; - } - - export interface StarknetDeployAccountV1TransactionSchema { - /** - * The hash of the contract class. - */ - class_hash: string; - - /** - * The arguments that are passed to the constructor function. - */ - constructor_calldata: Array; - - /** - * The salt of the contract address. - */ - contract_address_salt: string; - - /** - * The maximum fee that the sender is willing to pay. - */ - max_fee: string; - - /** - * The nonce of the transaction. - */ - nonce: string; - - /** - * The version of the transaction. - */ - version: 1; - } - - export interface StarknetDeployAccountV3TransactionSchema { - /** - * The hash of the contract class. - */ - class_hash: string; - - /** - * The arguments that are passed to the constructor function. - */ - constructor_calldata: Array; - - /** - * The salt of the contract address. - */ - contract_address_salt: string; - - /** - * The maximum fee that the sender is willing to pay. - */ - max_fee: string; - - /** - * The nonce of the transaction. - */ - nonce: string; - - /** - * The version of the transaction. - */ - version: 3; - } - } - } -} - export interface TransactionScanParams { account_address: string; @@ -1285,9 +1059,7 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { - type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, - type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/stellar/index.ts b/src/resources/stellar/index.ts index 53d949b3..80722a0c 100644 --- a/src/resources/stellar/index.ts +++ b/src/resources/stellar/index.ts @@ -4,11 +4,5 @@ export { Stellar, type StellarAssetContractDetailsSchema, type StellarAssetTransferDetailsSchema, - type StellarTransactionScanResponse, } from './stellar'; -export { - Transaction, - type TransactionReportResponse, - type TransactionReportParams, - type TransactionScanParams, -} from './transaction'; +export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; diff --git a/src/resources/stellar/stellar.ts b/src/resources/stellar/stellar.ts index 2ae6713b..497d7ee5 100644 --- a/src/resources/stellar/stellar.ts +++ b/src/resources/stellar/stellar.ts @@ -1,14 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as StellarAPI from './stellar'; import * as TransactionAPI from './transaction'; -import { - Transaction, - TransactionReportParams, - TransactionReportResponse, - TransactionScanParams, -} from './transaction'; +import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; export class Stellar extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); @@ -58,746 +52,17 @@ export interface StellarAssetTransferDetailsSchema { summary?: string | null; } -export interface StellarTransactionScanResponse { - /** - * Simulation result; Only present if simulation option is included in the request - */ - simulation?: - | StellarTransactionScanResponse.StellarSimulationResultSchemaType - | StellarTransactionScanResponse.StellarSimulationErrorSchema - | null; - - /** - * Validation result; Only present if validation option is included in the request - */ - validation?: - | StellarTransactionScanResponse.StellarValidationSuccessfulResultSchema - | StellarTransactionScanResponse.StellarValidationErrorSchema - | null; -} - -export namespace StellarTransactionScanResponse { - export interface StellarSimulationResultSchemaType { - /** - * Summary of the actions and asset transfers that were made by the requested - * account address - */ - account_summary: StellarSimulationResultSchemaType.AccountSummary; - - /** - * Ownership diffs of the account addresses - */ - assets_ownership_diff: Record>; - - status: 'Success'; - - /** - * Details of addresses involved in the transaction - */ - address_details?: Array; - - /** - * Mapping between the address of an account to the assets diff during the - * transaction - */ - assets_diffs?: Record< - string, - Array< - | StellarSimulationResultSchemaType.StellarLegacyAssetDiff - | StellarSimulationResultSchemaType.StellarNativeAssetDiff - | StellarSimulationResultSchemaType.StellarContractAssetDiff - > - >; - - /** - * Mapping between the address of an account to the exposure of the assets during - * the transaction - */ - exposures?: Record< - string, - Array< - | StellarSimulationResultSchemaType.StellarLegacyAssetExposure - | StellarSimulationResultSchemaType.StellarNativeAssetExposure - > - >; - } - - export namespace StellarSimulationResultSchemaType { - /** - * Summary of the actions and asset transfers that were made by the requested - * account address - */ - export interface AccountSummary { - /** - * Exposures made by the requested account address - */ - account_exposures: Array< - AccountSummary.StellarLegacyAssetExposure | AccountSummary.StellarNativeAssetExposure - >; - - /** - * Ownership diffs of the requested account address - */ - account_ownerships_diff: Array; - - /** - * Total USD diff for the requested account address - */ - total_usd_diff: AccountSummary.TotalUsdDiff; - - /** - * Assets diffs of the requested account address - */ - account_assets_diffs?: Array< - | AccountSummary.StellarLegacyAssetDiff - | AccountSummary.StellarNativeAssetDiff - | AccountSummary.StellarContractAssetDiff - >; - - /** - * Total USD exposure for each of the spender addresses during the transaction - */ - total_usd_exposure?: Record; - } - - export namespace AccountSummary { - export interface StellarLegacyAssetExposure { - asset: StellarLegacyAssetExposure.Asset; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StellarLegacyAssetExposure { - export interface Asset { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; - } - - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - - export interface StellarNativeAssetExposure { - asset: StellarNativeAssetExposure.Asset; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StellarNativeAssetExposure { - export interface Asset { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - - export interface AccountOwnershipsDiff { - /** - * List of public keys that can sign on behalf of the account post-transaction - */ - post_signers: Array; - - /** - * List of public keys that can sign on behalf of the account pre-transaction - */ - pre_signers: Array; - - type?: 'SET_OPTIONS'; - } - - /** - * Total USD diff for the requested account address - */ - export interface TotalUsdDiff { - /** - * Total incoming USD transfers - */ - in: number; - - /** - * Total outgoing USD transfers - */ - out: number; - - /** - * Total USD transfers - */ - total?: number; - } - - export interface StellarLegacyAssetDiff { - asset: StellarLegacyAssetDiff.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - - export namespace StellarLegacyAssetDiff { - export interface Asset { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; - } - } - - export interface StellarNativeAssetDiff { - asset: StellarNativeAssetDiff.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - - export namespace StellarNativeAssetDiff { - export interface Asset { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - } - - export interface StellarContractAssetDiff { - asset: StellarAPI.StellarAssetContractDetailsSchema; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - } - - export interface AssetsOwnershipDiff { - /** - * List of public keys that can sign on behalf of the account post-transaction - */ - post_signers: Array; - - /** - * List of public keys that can sign on behalf of the account pre-transaction - */ - pre_signers: Array; - - type?: 'SET_OPTIONS'; - } - - export interface AddressDetail { - /** - * Encoded public key of the account - */ - account_address: unknown; - - /** - * Description of the account - */ - description?: string | null; - } - - export interface StellarLegacyAssetDiff { - asset: StellarLegacyAssetDiff.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - - export namespace StellarLegacyAssetDiff { - export interface Asset { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; - } - } - - export interface StellarNativeAssetDiff { - asset: StellarNativeAssetDiff.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - - export namespace StellarNativeAssetDiff { - export interface Asset { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - } - - export interface StellarContractAssetDiff { - asset: StellarAPI.StellarAssetContractDetailsSchema; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - - export interface StellarLegacyAssetExposure { - asset: StellarLegacyAssetExposure.Asset; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StellarLegacyAssetExposure { - export interface Asset { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; - } - - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - - export interface StellarNativeAssetExposure { - asset: StellarNativeAssetExposure.Asset; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StellarNativeAssetExposure { - export interface Asset { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - } - - export interface StellarSimulationErrorSchema { - /** - * Error message - */ - error: string; - - status: 'Error'; - } - - export interface StellarValidationSuccessfulResultSchema { - /** - * A textual classification that can be presented to the user explaining the - * reason. - */ - classification: string; - - /** - * A textual description about the validation result - */ - description: string; - - features: Array; - - /** - * A textual description about the reasons the transaction was flagged with - * result_type - */ - reason: string; - - /** - * Verdict of the validation - */ - result_type: 'Benign' | 'Warning' | 'Malicious'; - - status: 'Success'; - } - - export namespace StellarValidationSuccessfulResultSchema { - export interface Feature { - /** - * Address the feature refers to - */ - address: string; - - /** - * Textual description - */ - description: string; - - feature_id: string; - - /** - * Feature Classification - */ - type: 'Benign' | 'Warning' | 'Malicious' | 'Info'; - } - } - - export interface StellarValidationErrorSchema { - /** - * Error message - */ - error: string; - - status: 'Error'; - } -} - Stellar.Transaction = Transaction; export declare namespace Stellar { export { type StellarAssetContractDetailsSchema as StellarAssetContractDetailsSchema, type StellarAssetTransferDetailsSchema as StellarAssetTransferDetailsSchema, - type StellarTransactionScanResponse as StellarTransactionScanResponse, }; export { Transaction as Transaction, - type TransactionReportResponse as TransactionReportResponse, - type TransactionReportParams as TransactionReportParams, + type TransactionScanResponse as TransactionScanResponse, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/stellar/transaction.ts b/src/resources/stellar/transaction.ts index e03d65d9..5ed2ba1a 100644 --- a/src/resources/stellar/transaction.ts +++ b/src/resources/stellar/transaction.ts @@ -6,98 +6,757 @@ import * as StellarAPI from './stellar'; export class Transaction extends APIResource { /** - * Report Transaction + * Scan Transaction */ - report( - body: TransactionReportParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post('/v0/stellar/transaction/report', { body, ...options }); + scan(body: TransactionScanParams, options?: Core.RequestOptions): Core.APIPromise { + return this._client.post('/v0/stellar/transaction/scan', { body, ...options }); } +} +export interface TransactionScanResponse { /** - * Scan Transaction + * Simulation result; Only present if simulation option is included in the request */ - scan( - body: TransactionScanParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post('/v0/stellar/transaction/scan', { body, ...options }); - } + simulation?: + | TransactionScanResponse.StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration + | TransactionScanResponse.StellarSimulationErrorSchema + | null; + + /** + * Validation result; Only present if validation option is included in the request + */ + validation?: + | TransactionScanResponse.StellarValidationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchema + | TransactionScanResponse.StellarValidationErrorSchema + | null; } -export type TransactionReportResponse = number; +export namespace TransactionScanResponse { + export interface StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration { + /** + * Summary of the actions and asset transfers that were made by the requested + * account address + */ + account_summary: StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.AccountSummary; -export interface TransactionReportParams { - details: string; + /** + * Ownership diffs of the account addresses + */ + assets_ownership_diff: Record< + string, + Array + >; - event: 'should_be_malicious' | 'should_be_benign'; + status: 'Success'; - report: - | TransactionReportParams.StellarAppealRequestID - | TransactionReportParams.StellarAppealTransactionDataReport; -} + /** + * Details of addresses involved in the transaction + */ + address_details?: Array; -export namespace TransactionReportParams { - export interface StellarAppealRequestID { - id: string; + /** + * Mapping between the address of an account to the assets diff during the + * transaction + */ + assets_diffs?: Record< + string, + Array< + | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema + | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema + | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchema + > + >; - type?: 'request_id'; + /** + * Mapping between the address of an account to the exposure of the assets during + * the transaction + */ + exposures?: Record< + string, + Array< + | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema + | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema + > + >; } - export interface StellarAppealTransactionDataReport { - params: StellarAppealTransactionDataReport.Params; + export namespace StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration { + /** + * Summary of the actions and asset transfers that were made by the requested + * account address + */ + export interface AccountSummary { + /** + * Exposures made by the requested account address + */ + account_exposures: Array< + | AccountSummary.StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema + | AccountSummary.StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema + >; - type?: 'params'; - } + /** + * Ownership diffs of the requested account address + */ + account_ownerships_diff: Array; + + /** + * Total USD diff for the requested account address + */ + total_usd_diff: AccountSummary.TotalUsdDiff; + + /** + * Assets diffs of the requested account address + */ + account_assets_diffs?: Array< + | AccountSummary.StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema + | AccountSummary.StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema + | AccountSummary.StellarAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchema + >; + + /** + * Total USD exposure for each of the spender addresses during the transaction + */ + total_usd_exposure?: Record; + } + + export namespace AccountSummary { + export interface StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema { + asset: StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema.Asset; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record< + string, + StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema.Spenders + >; + } + + export namespace StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema { + export interface Asset { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; + + /** + * Organization name + */ + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; + } + + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + } + + export interface StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema { + asset: StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema.Asset; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record< + string, + StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema.Spenders + >; + } + + export namespace StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema { + export interface Asset { + /** + * Asset code + */ + code?: 'XLM'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; + } + + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + } + + export interface AccountOwnershipsDiff { + /** + * List of public keys that can sign on behalf of the account post-transaction + */ + post_signers: Array; + + /** + * List of public keys that can sign on behalf of the account pre-transaction + */ + pre_signers: Array; + + type?: 'SET_OPTIONS'; + } + + /** + * Total USD diff for the requested account address + */ + export interface TotalUsdDiff { + /** + * Total incoming USD transfers + */ + in: number; + + /** + * Total outgoing USD transfers + */ + out: number; + + /** + * Total USD transfers + */ + total?: number; + } + + export interface StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema { + asset: StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export namespace StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema { + export interface Asset { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; + + /** + * Organization name + */ + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; + } + } + + export interface StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema { + asset: StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export namespace StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema { + export interface Asset { + /** + * Asset code + */ + code?: 'XLM'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; + } + } + + export interface StellarAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchema { + asset: StellarAPI.StellarAssetContractDetailsSchema; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + } + + export interface AssetsOwnershipDiff { + /** + * List of public keys that can sign on behalf of the account post-transaction + */ + post_signers: Array; + + /** + * List of public keys that can sign on behalf of the account pre-transaction + */ + pre_signers: Array; + + type?: 'SET_OPTIONS'; + } + + export interface AddressDetail { + /** + * Encoded public key of the account + */ + account_address: unknown; + + /** + * Description of the account + */ + description?: string | null; + } - export namespace StellarAppealTransactionDataReport { - export interface Params { - account_address: string; + export interface StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema { + asset: StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema.Asset; /** - * A CAIP-2 chain ID or a Stellar network name + * The type of the assets in this diff */ - chain: 'pubnet' | 'futurenet' | 'testnet'; + asset_type: string; /** - * Metadata + * Details of the incoming transfer */ - metadata: Params.StellarWalletRequestMetadata | Params.StellarInAppRequestMetadata; + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - transaction: string; + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export namespace StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema { + export interface Asset { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; + + /** + * Organization name + */ + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; + } + } + + export interface StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema { + asset: StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; /** - * List of options to include in the response - * - * - `Options.validation`: Include Options.validation output in the response - * - * - `Options.simulation`: Include Options.simulation output in the response + * Details of the incoming transfer */ - options?: Array<'validation' | 'simulation'>; + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; } - export namespace Params { - export interface StellarWalletRequestMetadata { + export namespace StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema { + export interface Asset { /** - * Metadata for wallet requests + * Asset code */ - type: 'wallet'; + code?: 'XLM'; /** - * URL of the dApp originating the transaction + * Type of the asset (`NATIVE`) */ - url: string; + type?: 'NATIVE'; } + } + + export interface StellarAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchema { + asset: StellarAPI.StellarAssetContractDetailsSchema; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export interface StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema { + asset: StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema.Asset; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record< + string, + StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema.Spenders + >; + } + + export namespace StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema { + export interface Asset { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; - export interface StellarInAppRequestMetadata { /** - * Metadata for in-app requests + * Organization name */ - type?: 'in_app'; + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; + } + + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + } + + export interface StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema { + asset: StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema.Asset; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record< + string, + StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema.Spenders + >; + } + + export namespace StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema { + export interface Asset { + /** + * Asset code + */ + code?: 'XLM'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; + } + + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + } + } + + export interface StellarSimulationErrorSchema { + /** + * Error message + */ + error: string; + + status: 'Error'; + } + + export interface StellarValidationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchema { + /** + * A textual classification that can be presented to the user explaining the + * reason. + */ + classification: string; + + /** + * A textual description about the validation result + */ + description: string; + + /** + * A list of features about this transaction explaining the validation + */ + features: Array; + + /** + * A textual description about the reasons the transaction was flagged with + * result_type + */ + reason: string; + + /** + * Verdict of the validation + */ + result_type: 'Benign' | 'Warning' | 'Malicious'; + + status: 'Success'; + } + + export namespace StellarValidationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchema { + export interface Feature { + /** + * Address the feature refers to + */ + address: string; + + /** + * Textual description + */ + description: string; + + feature_id: string; + + /** + * Feature Classification + */ + type: 'Benign' | 'Warning' | 'Malicious' | 'Info'; } } + + export interface StellarValidationErrorSchema { + /** + * Error message + */ + error: string; + + status: 'Error'; + } } export interface TransactionScanParams { @@ -150,8 +809,7 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { - type TransactionReportResponse as TransactionReportResponse, - type TransactionReportParams as TransactionReportParams, + type TransactionScanResponse as TransactionScanResponse, type TransactionScanParams as TransactionScanParams, }; } diff --git a/tests/api-resources/bitcoin/transaction.test.ts b/tests/api-resources/bitcoin/transaction.test.ts index 55196b47..16e50953 100644 --- a/tests/api-resources/bitcoin/transaction.test.ts +++ b/tests/api-resources/bitcoin/transaction.test.ts @@ -9,29 +9,6 @@ const client = new Blockaid({ }); describe('resource transaction', () => { - test('report: only required params', async () => { - const responsePromise = client.bitcoin.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id' }, - }); - 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('report: required and optional params', async () => { - const response = await client.bitcoin.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id', type: 'request_id' }, - }); - }); - test('scan: only required params', async () => { const responsePromise = client.bitcoin.transaction.scan({ account_address: 'account_address', diff --git a/tests/api-resources/starknet/transaction.test.ts b/tests/api-resources/starknet/transaction.test.ts index 92070907..cdd0d343 100644 --- a/tests/api-resources/starknet/transaction.test.ts +++ b/tests/api-resources/starknet/transaction.test.ts @@ -9,29 +9,6 @@ const client = new Blockaid({ }); describe('resource transaction', () => { - test('report: only required params', async () => { - const responsePromise = client.starknet.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id' }, - }); - 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('report: required and optional params', async () => { - const response = await client.starknet.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id', type: 'request_id' }, - }); - }); - test('scan: only required params', async () => { const responsePromise = client.starknet.transaction.scan({ account_address: '0x62a2959fa6502b30cbfb51199fbbe72e72ee4f5a86ec754b4172c7d7beb6ff4', diff --git a/tests/api-resources/stellar/transaction.test.ts b/tests/api-resources/stellar/transaction.test.ts index 3cb0f617..529fd3d5 100644 --- a/tests/api-resources/stellar/transaction.test.ts +++ b/tests/api-resources/stellar/transaction.test.ts @@ -9,29 +9,6 @@ const client = new Blockaid({ }); describe('resource transaction', () => { - test('report: only required params', async () => { - const responsePromise = client.stellar.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id' }, - }); - 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('report: required and optional params', async () => { - const response = await client.stellar.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id', type: 'request_id' }, - }); - }); - test('scan: only required params', async () => { const responsePromise = client.stellar.transaction.scan({ account_address: 'GDPMFLKUGASUTWBN2XGYYKD27QGHCYH4BUFUTER4L23INYQ4JHDWFOIE', From 1a19626b4dbf697a8d2c802f18c1d985b737da8a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 19:11:50 +0000 Subject: [PATCH 09/18] feat(api): api update (#313) --- .stats.yml | 2 +- src/index.ts | 38 ++++--- src/resources/bitcoin/transaction.ts | 65 ++++++------ src/resources/starknet/transaction.ts | 139 +++++++++++--------------- src/resources/stellar/transaction.ts | 117 +++++++++------------- 5 files changed, 157 insertions(+), 204 deletions(-) diff --git a/.stats.yml b/.stats.yml index 14f629e4..0bcc787e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 19 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-8f7d9864c68d27433277000fd14bacc24ffbe9c8dfde41466764a18aee4f958d.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-9074805d4822d26da6e3f769edeb3bb4294de7586358fa0a4901990a405ab1e9.yml diff --git a/src/index.ts b/src/index.ts index 998a08a5..0eafdf11 100644 --- a/src/index.ts +++ b/src/index.ts @@ -98,7 +98,6 @@ const environments = { client: 'https://client.blockaid.io', }; type Environment = keyof typeof environments; - export interface ClientOptions { /** * Authentication method to api.blockaid.io @@ -322,25 +321,6 @@ export class Blockaid extends Core.APIClient { static fileFromPath = Uploads.fileFromPath; } -export { - BlockaidError, - APIError, - APIConnectionError, - APIConnectionTimeoutError, - APIUserAbortError, - NotFoundError, - ConflictError, - RateLimitError, - BadRequestError, - AuthenticationError, - InternalServerError, - PermissionDeniedError, - UnprocessableEntityError, -} from './error'; - -export import toFile = Uploads.toFile; -export import fileFromPath = Uploads.fileFromPath; - Blockaid.Evm = Evm; Blockaid.Solana = Solana; Blockaid.Stellar = Stellar; @@ -349,7 +329,6 @@ Blockaid.Starknet = Starknet; Blockaid.Site = Site; Blockaid.Token = Token; Blockaid.TokenBulk = TokenBulk; - export declare namespace Blockaid { export type RequestOptions = Core.RequestOptions; @@ -453,4 +432,21 @@ export declare namespace Blockaid { }; } +export { toFile, fileFromPath } from '@blockaid/client/uploads'; +export { + BlockaidError, + APIError, + APIConnectionError, + APIConnectionTimeoutError, + APIUserAbortError, + NotFoundError, + ConflictError, + RateLimitError, + BadRequestError, + AuthenticationError, + InternalServerError, + PermissionDeniedError, + UnprocessableEntityError, +} from '@blockaid/client/error'; + export default Blockaid; diff --git a/src/resources/bitcoin/transaction.ts b/src/resources/bitcoin/transaction.ts index 0bfb1f36..09d0ba87 100644 --- a/src/resources/bitcoin/transaction.ts +++ b/src/resources/bitcoin/transaction.ts @@ -17,7 +17,7 @@ export interface TransactionScanResponse { * Simulation result; Only present if simulation option is included in the request */ simulation?: - | TransactionScanResponse.BitcoinBitcoinSimulationSchemaTypeAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaNativeDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeOrdinalDetailsSchemaOrdinalDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleOrdinalAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeRuneDetailsSchemaRuneDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleRunesAssetDiffEmptyModelEmptyModelAddressDetailsBaseSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedEmptyModelSimulationSchemaConfiguration + | TransactionScanResponse.BitcoinSimulationResponse | TransactionScanResponse.BitcoinSimulationErrorSchema | null; @@ -25,13 +25,13 @@ export interface TransactionScanResponse { * Validation result; Only present if validation option is included in the request */ validation?: - | TransactionScanResponse.BitcoinValidationResultSchemaTypeAnnotatedStrSkipValidationPlainSerializerGetPydanticSchema + | TransactionScanResponse.BitcoinValidationResult | TransactionScanResponse.BitcoinValidationErrorSchema | null; } export namespace TransactionScanResponse { - export interface BitcoinBitcoinSimulationSchemaTypeAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaNativeDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeOrdinalDetailsSchemaOrdinalDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleOrdinalAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeRuneDetailsSchemaRuneDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleRunesAssetDiffEmptyModelEmptyModelAddressDetailsBaseSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedEmptyModelSimulationSchemaConfiguration { + export interface BitcoinSimulationResponse { status: 'Success'; account_summary?: null; @@ -39,7 +39,7 @@ export namespace TransactionScanResponse { /** * Details of addresses involved in the transaction */ - address_details?: Array; + address_details?: Array; /** * Mapping between the address of an account to the assets diff during the @@ -48,19 +48,19 @@ export namespace TransactionScanResponse { assets_diffs?: Record< string, Array< - | BitcoinBitcoinSimulationSchemaTypeAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaNativeDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeOrdinalDetailsSchemaOrdinalDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleOrdinalAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeRuneDetailsSchemaRuneDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleRunesAssetDiffEmptyModelEmptyModelAddressDetailsBaseSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.BitcoinAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaNativeDiffSchema - | BitcoinBitcoinSimulationSchemaTypeAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaNativeDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeOrdinalDetailsSchemaOrdinalDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleOrdinalAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeRuneDetailsSchemaRuneDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleRunesAssetDiffEmptyModelEmptyModelAddressDetailsBaseSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.BitcoinAccountSingleAssetDiffSchemaTypeOrdinalDetailsSchemaOrdinalDiffSchema - | BitcoinBitcoinSimulationSchemaTypeAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaNativeDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeOrdinalDetailsSchemaOrdinalDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleOrdinalAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeRuneDetailsSchemaRuneDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleRunesAssetDiffEmptyModelEmptyModelAddressDetailsBaseSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.BitcoinAccountSingleAssetDiffSchemaTypeRuneDetailsSchemaRuneDiffSchema + | BitcoinSimulationResponse.BitcoinNativeAssetDiff + | BitcoinSimulationResponse.BitcoinOrdinalAssetDiff + | BitcoinSimulationResponse.BitcoinRunesAssetDiff > >; } - export namespace BitcoinBitcoinSimulationSchemaTypeAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaNativeDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeOrdinalDetailsSchemaOrdinalDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleOrdinalAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeRuneDetailsSchemaRuneDiffSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleRunesAssetDiffEmptyModelEmptyModelAddressDetailsBaseSchemaAnnotatedStrSkipValidationPlainSerializerGetPydanticSchemaAnnotatedEmptyModelSimulationSchemaConfiguration { + export namespace BitcoinSimulationResponse { export interface AddressDetail { /** * Encoded public key of the account */ - account_address: string; + account_address: unknown; /** * Description of the account @@ -68,8 +68,8 @@ export namespace TransactionScanResponse { description?: string | null; } - export interface BitcoinAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaNativeDiffSchema { - asset: BitcoinAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaNativeDiffSchema.Asset; + export interface BitcoinNativeAssetDiff { + asset: BitcoinNativeAssetDiff.Asset; /** * The type of the assets in this diff @@ -79,15 +79,15 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: BitcoinAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaNativeDiffSchema.In | null; + in?: BitcoinNativeAssetDiff.In | null; /** * Details of the outgoing transfer */ - out?: BitcoinAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaNativeDiffSchema.Out | null; + out?: BitcoinNativeAssetDiff.Out | null; } - export namespace BitcoinAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaNativeDiffSchema { + export namespace BitcoinNativeAssetDiff { export interface Asset { /** * URL of the asset's logo @@ -166,8 +166,8 @@ export namespace TransactionScanResponse { } } - export interface BitcoinAccountSingleAssetDiffSchemaTypeOrdinalDetailsSchemaOrdinalDiffSchema { - asset: BitcoinAccountSingleAssetDiffSchemaTypeOrdinalDetailsSchemaOrdinalDiffSchema.Asset; + export interface BitcoinOrdinalAssetDiff { + asset: BitcoinOrdinalAssetDiff.Asset; /** * The type of the assets in this diff @@ -177,15 +177,15 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: BitcoinAccountSingleAssetDiffSchemaTypeOrdinalDetailsSchemaOrdinalDiffSchema.In | null; + in?: BitcoinOrdinalAssetDiff.In | null; /** * Details of the outgoing transfer */ - out?: BitcoinAccountSingleAssetDiffSchemaTypeOrdinalDetailsSchemaOrdinalDiffSchema.Out | null; + out?: BitcoinOrdinalAssetDiff.Out | null; } - export namespace BitcoinAccountSingleAssetDiffSchemaTypeOrdinalDetailsSchemaOrdinalDiffSchema { + export namespace BitcoinOrdinalAssetDiff { export interface Asset { /** * token's name @@ -264,8 +264,8 @@ export namespace TransactionScanResponse { } } - export interface BitcoinAccountSingleAssetDiffSchemaTypeRuneDetailsSchemaRuneDiffSchema { - asset: BitcoinAccountSingleAssetDiffSchemaTypeRuneDetailsSchemaRuneDiffSchema.Asset; + export interface BitcoinRunesAssetDiff { + asset: BitcoinRunesAssetDiff.Asset; /** * The type of the assets in this diff @@ -275,15 +275,15 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: BitcoinAccountSingleAssetDiffSchemaTypeRuneDetailsSchemaRuneDiffSchema.In | null; + in?: BitcoinRunesAssetDiff.In | null; /** * Details of the outgoing transfer */ - out?: BitcoinAccountSingleAssetDiffSchemaTypeRuneDetailsSchemaRuneDiffSchema.Out | null; + out?: BitcoinRunesAssetDiff.Out | null; } - export namespace BitcoinAccountSingleAssetDiffSchemaTypeRuneDetailsSchemaRuneDiffSchema { + export namespace BitcoinRunesAssetDiff { export interface Asset { /** * The Rune ID @@ -382,7 +382,7 @@ export namespace TransactionScanResponse { status: 'Error'; } - export interface BitcoinValidationResultSchemaTypeAnnotatedStrSkipValidationPlainSerializerGetPydanticSchema { + export interface BitcoinValidationResult { /** * A textual classification that can be presented to the user explaining the * reason. @@ -394,10 +394,7 @@ export namespace TransactionScanResponse { */ description: string; - /** - * A list of features about this transaction explaining the validation - */ - features: Array; + features: Array; /** * A textual description about the reasons the transaction was flagged with @@ -413,7 +410,7 @@ export namespace TransactionScanResponse { status: 'Success'; } - export namespace BitcoinValidationResultSchemaTypeAnnotatedStrSkipValidationPlainSerializerGetPydanticSchema { + export namespace BitcoinValidationResult { export interface Feature { /** * Address the feature refers to @@ -453,8 +450,8 @@ export interface TransactionScanParams { * Metadata */ metadata: - | TransactionScanParams.BitcoinblockaidApplicationRunnerAppSchemasTransactionScanningAPIWalletRequestMetadata - | TransactionScanParams.BitcoinblockaidApplicationRunnerAppSchemasTransactionScanningAPIInAppRequestMetadata; + | TransactionScanParams.BitcoinWalletRequestMetadata + | TransactionScanParams.BitcoinInAppRequestMetadata; transaction: string; @@ -469,7 +466,7 @@ export interface TransactionScanParams { } export namespace TransactionScanParams { - export interface BitcoinblockaidApplicationRunnerAppSchemasTransactionScanningAPIWalletRequestMetadata { + export interface BitcoinWalletRequestMetadata { /** * Metadata for wallet requests */ @@ -481,7 +478,7 @@ export namespace TransactionScanParams { url: string; } - export interface BitcoinblockaidApplicationRunnerAppSchemasTransactionScanningAPIInAppRequestMetadata { + export interface BitcoinInAppRequestMetadata { /** * Metadata for in-app requests */ diff --git a/src/resources/starknet/transaction.ts b/src/resources/starknet/transaction.ts index f740899f..6b2a999b 100644 --- a/src/resources/starknet/transaction.ts +++ b/src/resources/starknet/transaction.ts @@ -26,7 +26,7 @@ export interface TransactionScanResponse { * Validation result; Only present if validation option is included in the request */ validation?: - | TransactionScanResponse.StarknetValidationResultSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchema + | TransactionScanResponse.StarknetValidationResult | TransactionScanResponse.StarknetValidationErrorSchema | null; } @@ -53,9 +53,9 @@ export namespace TransactionScanResponse { assets_diffs?: Record< string, Array< - | StarknetStarknetSimulationResultSchema.StarknetAccountSingleAssetDiffSchemaTypeErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DiffSchema - | StarknetStarknetSimulationResultSchema.StarknetAccountSingleAssetDiffSchemaTypeErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DiffSchema - | StarknetStarknetSimulationResultSchema.StarknetAccountSingleAssetDiffSchemaTypeErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DiffSchema + | StarknetStarknetSimulationResultSchema.StarknetErc20AssetDiff + | StarknetStarknetSimulationResultSchema.StarknetErc721AssetDiff + | StarknetStarknetSimulationResultSchema.StarknetErc1155AssetDiff > >; @@ -71,9 +71,9 @@ export namespace TransactionScanResponse { exposures?: Record< string, Array< - | StarknetStarknetSimulationResultSchema.StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20ExposureSchema - | StarknetStarknetSimulationResultSchema.StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721ExposureSchema - | StarknetStarknetSimulationResultSchema.StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155ExposureSchema + | StarknetStarknetSimulationResultSchema.StarknetErc20Exposure + | StarknetStarknetSimulationResultSchema.StarknetErc721Exposure + | StarknetStarknetSimulationResultSchema.StarknetErc1155Exposure > >; } @@ -88,9 +88,9 @@ export namespace TransactionScanResponse { * Exposures made by the requested account address */ account_exposures: Array< - | AccountSummary.StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20ExposureSchema - | AccountSummary.StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721ExposureSchema - | AccountSummary.StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155ExposureSchema + | AccountSummary.StarknetErc20Exposure + | AccountSummary.StarknetErc721Exposure + | AccountSummary.StarknetErc1155Exposure >; /** @@ -102,9 +102,9 @@ export namespace TransactionScanResponse { * Assets diffs of the requested account address */ account_assets_diffs?: Array< - | AccountSummary.StarknetAccountSingleAssetDiffSchemaTypeErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DiffSchema - | AccountSummary.StarknetAccountSingleAssetDiffSchemaTypeErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DiffSchema - | AccountSummary.StarknetAccountSingleAssetDiffSchemaTypeErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DiffSchema + | AccountSummary.StarknetErc20AssetDiff + | AccountSummary.StarknetErc721AssetDiff + | AccountSummary.StarknetErc1155AssetDiff >; /** @@ -114,19 +114,16 @@ export namespace TransactionScanResponse { } export namespace AccountSummary { - export interface StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20ExposureSchema { - asset: StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20ExposureSchema.Asset; + export interface StarknetErc20Exposure { + asset: StarknetErc20Exposure.Asset; /** * Mapping between the spender address and the exposure of the asset */ - spenders?: Record< - string, - StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20ExposureSchema.Spenders - >; + spenders?: Record; } - export namespace StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20ExposureSchema { + export namespace StarknetErc20Exposure { export interface Asset { /** * Address of the token's contract @@ -179,19 +176,16 @@ export namespace TransactionScanResponse { } } - export interface StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721ExposureSchema { - asset: StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721ExposureSchema.Asset; + export interface StarknetErc721Exposure { + asset: StarknetErc721Exposure.Asset; /** * Mapping between the spender address and the exposure of the asset */ - spenders?: Record< - string, - StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721ExposureSchema.Spenders - >; + spenders?: Record; } - export namespace StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721ExposureSchema { + export namespace StarknetErc721Exposure { export interface Asset { /** * Address of the token's contract @@ -234,19 +228,16 @@ export namespace TransactionScanResponse { } } - export interface StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155ExposureSchema { - asset: StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155ExposureSchema.Asset; + export interface StarknetErc1155Exposure { + asset: StarknetErc1155Exposure.Asset; /** * Mapping between the spender address and the exposure of the asset */ - spenders?: Record< - string, - StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155ExposureSchema.Spenders - >; + spenders?: Record; } - export namespace StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155ExposureSchema { + export namespace StarknetErc1155Exposure { export interface Asset { /** * Address of the token's contract @@ -309,8 +300,8 @@ export namespace TransactionScanResponse { total?: number; } - export interface StarknetAccountSingleAssetDiffSchemaTypeErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DiffSchema { - asset: StarknetAccountSingleAssetDiffSchemaTypeErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DiffSchema.Asset; + export interface StarknetErc20AssetDiff { + asset: StarknetErc20AssetDiff.Asset; /** * The type of the assets in this diff @@ -328,7 +319,7 @@ export namespace TransactionScanResponse { out?: StarknetAPI.StarknetErc20Diff | null; } - export namespace StarknetAccountSingleAssetDiffSchemaTypeErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DiffSchema { + export namespace StarknetErc20AssetDiff { export interface Asset { /** * Address of the token's contract @@ -362,8 +353,8 @@ export namespace TransactionScanResponse { } } - export interface StarknetAccountSingleAssetDiffSchemaTypeErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DiffSchema { - asset: StarknetAccountSingleAssetDiffSchemaTypeErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DiffSchema.Asset; + export interface StarknetErc721AssetDiff { + asset: StarknetErc721AssetDiff.Asset; /** * The type of the assets in this diff @@ -381,7 +372,7 @@ export namespace TransactionScanResponse { out?: StarknetAPI.StarknetErc721Diff | null; } - export namespace StarknetAccountSingleAssetDiffSchemaTypeErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DiffSchema { + export namespace StarknetErc721AssetDiff { export interface Asset { /** * Address of the token's contract @@ -410,8 +401,8 @@ export namespace TransactionScanResponse { } } - export interface StarknetAccountSingleAssetDiffSchemaTypeErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DiffSchema { - asset: StarknetAccountSingleAssetDiffSchemaTypeErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DiffSchema.Asset; + export interface StarknetErc1155AssetDiff { + asset: StarknetErc1155AssetDiff.Asset; /** * The type of the assets in this diff @@ -429,7 +420,7 @@ export namespace TransactionScanResponse { out?: StarknetAPI.StarknetErc1155Diff | null; } - export namespace StarknetAccountSingleAssetDiffSchemaTypeErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DiffSchema { + export namespace StarknetErc1155AssetDiff { export interface Asset { /** * Address of the token's contract @@ -463,7 +454,7 @@ export namespace TransactionScanResponse { /** * Encoded public key of the account */ - account_address: string; + account_address: unknown; /** * Description of the account @@ -471,8 +462,8 @@ export namespace TransactionScanResponse { description?: string | null; } - export interface StarknetAccountSingleAssetDiffSchemaTypeErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DiffSchema { - asset: StarknetAccountSingleAssetDiffSchemaTypeErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DiffSchema.Asset; + export interface StarknetErc20AssetDiff { + asset: StarknetErc20AssetDiff.Asset; /** * The type of the assets in this diff @@ -490,7 +481,7 @@ export namespace TransactionScanResponse { out?: StarknetAPI.StarknetErc20Diff | null; } - export namespace StarknetAccountSingleAssetDiffSchemaTypeErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DiffSchema { + export namespace StarknetErc20AssetDiff { export interface Asset { /** * Address of the token's contract @@ -524,8 +515,8 @@ export namespace TransactionScanResponse { } } - export interface StarknetAccountSingleAssetDiffSchemaTypeErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DiffSchema { - asset: StarknetAccountSingleAssetDiffSchemaTypeErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DiffSchema.Asset; + export interface StarknetErc721AssetDiff { + asset: StarknetErc721AssetDiff.Asset; /** * The type of the assets in this diff @@ -543,7 +534,7 @@ export namespace TransactionScanResponse { out?: StarknetAPI.StarknetErc721Diff | null; } - export namespace StarknetAccountSingleAssetDiffSchemaTypeErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DiffSchema { + export namespace StarknetErc721AssetDiff { export interface Asset { /** * Address of the token's contract @@ -572,8 +563,8 @@ export namespace TransactionScanResponse { } } - export interface StarknetAccountSingleAssetDiffSchemaTypeErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DiffSchema { - asset: StarknetAccountSingleAssetDiffSchemaTypeErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DiffSchema.Asset; + export interface StarknetErc1155AssetDiff { + asset: StarknetErc1155AssetDiff.Asset; /** * The type of the assets in this diff @@ -591,7 +582,7 @@ export namespace TransactionScanResponse { out?: StarknetAPI.StarknetErc1155Diff | null; } - export namespace StarknetAccountSingleAssetDiffSchemaTypeErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DiffSchema { + export namespace StarknetErc1155AssetDiff { export interface Asset { /** * Address of the token's contract @@ -620,19 +611,16 @@ export namespace TransactionScanResponse { } } - export interface StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20ExposureSchema { - asset: StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20ExposureSchema.Asset; + export interface StarknetErc20Exposure { + asset: StarknetErc20Exposure.Asset; /** * Mapping between the spender address and the exposure of the asset */ - spenders?: Record< - string, - StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20ExposureSchema.Spenders - >; + spenders?: Record; } - export namespace StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc20ExposureSchema { + export namespace StarknetErc20Exposure { export interface Asset { /** * Address of the token's contract @@ -685,19 +673,16 @@ export namespace TransactionScanResponse { } } - export interface StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721ExposureSchema { - asset: StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721ExposureSchema.Asset; + export interface StarknetErc721Exposure { + asset: StarknetErc721Exposure.Asset; /** * Mapping between the spender address and the exposure of the asset */ - spenders?: Record< - string, - StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721ExposureSchema.Spenders - >; + spenders?: Record; } - export namespace StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc721ExposureSchema { + export namespace StarknetErc721Exposure { export interface Asset { /** * Address of the token's contract @@ -740,19 +725,16 @@ export namespace TransactionScanResponse { } } - export interface StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155ExposureSchema { - asset: StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155ExposureSchema.Asset; + export interface StarknetErc1155Exposure { + asset: StarknetErc1155Exposure.Asset; /** * Mapping between the spender address and the exposure of the asset */ - spenders?: Record< - string, - StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155ExposureSchema.Spenders - >; + spenders?: Record; } - export namespace StarknetAddressAssetExposureSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155DetailsSchemaAnnotatedIntSkipValidationPlainSerializerGetPydanticSchemaErc1155ExposureSchema { + export namespace StarknetErc1155Exposure { export interface Asset { /** * Address of the token's contract @@ -805,7 +787,7 @@ export namespace TransactionScanResponse { status: 'Error'; } - export interface StarknetValidationResultSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchema { + export interface StarknetValidationResult { /** * A textual classification that can be presented to the user explaining the * reason. @@ -817,10 +799,7 @@ export namespace TransactionScanResponse { */ description: string; - /** - * A list of features about this transaction explaining the validation - */ - features: Array; + features: Array; /** * A textual description about the reasons the transaction was flagged with @@ -836,7 +815,7 @@ export namespace TransactionScanResponse { status: 'Success'; } - export namespace StarknetValidationResultSchemaTypeAnnotatedIntSkipValidationPlainSerializerGetPydanticSchema { + export namespace StarknetValidationResult { export interface Feature { /** * Address the feature refers to diff --git a/src/resources/stellar/transaction.ts b/src/resources/stellar/transaction.ts index 5ed2ba1a..d297eacc 100644 --- a/src/resources/stellar/transaction.ts +++ b/src/resources/stellar/transaction.ts @@ -18,7 +18,7 @@ export interface TransactionScanResponse { * Simulation result; Only present if simulation option is included in the request */ simulation?: - | TransactionScanResponse.StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration + | TransactionScanResponse.StellarSimulationResponse | TransactionScanResponse.StellarSimulationErrorSchema | null; @@ -26,33 +26,30 @@ export interface TransactionScanResponse { * Validation result; Only present if validation option is included in the request */ validation?: - | TransactionScanResponse.StellarValidationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchema + | TransactionScanResponse.StellarValidationResult | TransactionScanResponse.StellarValidationErrorSchema | null; } export namespace TransactionScanResponse { - export interface StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration { + export interface StellarSimulationResponse { /** * Summary of the actions and asset transfers that were made by the requested * account address */ - account_summary: StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.AccountSummary; + account_summary: StellarSimulationResponse.AccountSummary; /** * Ownership diffs of the account addresses */ - assets_ownership_diff: Record< - string, - Array - >; + assets_ownership_diff: Record>; status: 'Success'; /** * Details of addresses involved in the transaction */ - address_details?: Array; + address_details?: Array; /** * Mapping between the address of an account to the assets diff during the @@ -61,9 +58,9 @@ export namespace TransactionScanResponse { assets_diffs?: Record< string, Array< - | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema - | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema - | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchema + | StellarSimulationResponse.StellarLegacyAssetDiff + | StellarSimulationResponse.StellarNativeAssetDiff + | StellarSimulationResponse.StellarContractAssetDiff > >; @@ -74,13 +71,13 @@ export namespace TransactionScanResponse { exposures?: Record< string, Array< - | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema - | StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration.StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema + | StellarSimulationResponse.StellarLegacyAssetExposure + | StellarSimulationResponse.StellarNativeAssetExposure > >; } - export namespace StellarSimulationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaUnionAnnotatedAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetDiffAnnotatedAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleContractBackedAssetDiffUnionAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleLegacyAssetExposureAnnotatedAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchemaFieldInfoAnnotationNoneTypeRequiredTrueTitleNativeAssetExposureAccountSetOptionsOwnershipDiffSchemaAddressDetailsBaseSchemaAnnotatedEmptyModelSimulationSchemaConfiguration { + export namespace StellarSimulationResponse { /** * Summary of the actions and asset transfers that were made by the requested * account address @@ -90,8 +87,7 @@ export namespace TransactionScanResponse { * Exposures made by the requested account address */ account_exposures: Array< - | AccountSummary.StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema - | AccountSummary.StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema + AccountSummary.StellarLegacyAssetExposure | AccountSummary.StellarNativeAssetExposure >; /** @@ -108,9 +104,9 @@ export namespace TransactionScanResponse { * Assets diffs of the requested account address */ account_assets_diffs?: Array< - | AccountSummary.StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema - | AccountSummary.StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema - | AccountSummary.StellarAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchema + | AccountSummary.StellarLegacyAssetDiff + | AccountSummary.StellarNativeAssetDiff + | AccountSummary.StellarContractAssetDiff >; /** @@ -120,19 +116,16 @@ export namespace TransactionScanResponse { } export namespace AccountSummary { - export interface StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema { - asset: StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema.Asset; + export interface StellarLegacyAssetExposure { + asset: StellarLegacyAssetExposure.Asset; /** * Mapping between the spender address and the exposure of the asset */ - spenders?: Record< - string, - StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema.Spenders - >; + spenders?: Record; } - export namespace StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema { + export namespace StellarLegacyAssetExposure { export interface Asset { /** * Asset code @@ -204,19 +197,16 @@ export namespace TransactionScanResponse { } } - export interface StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema { - asset: StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema.Asset; + export interface StellarNativeAssetExposure { + asset: StellarNativeAssetExposure.Asset; /** * Mapping between the spender address and the exposure of the asset */ - spenders?: Record< - string, - StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema.Spenders - >; + spenders?: Record; } - export namespace StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema { + export namespace StellarNativeAssetExposure { export interface Asset { /** * Asset code @@ -307,8 +297,8 @@ export namespace TransactionScanResponse { total?: number; } - export interface StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema { - asset: StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema.Asset; + export interface StellarLegacyAssetDiff { + asset: StellarLegacyAssetDiff.Asset; /** * The type of the assets in this diff @@ -326,7 +316,7 @@ export namespace TransactionScanResponse { out?: StellarAPI.StellarAssetTransferDetailsSchema | null; } - export namespace StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema { + export namespace StellarLegacyAssetDiff { export interface Asset { /** * Asset code @@ -355,8 +345,8 @@ export namespace TransactionScanResponse { } } - export interface StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema { - asset: StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema.Asset; + export interface StellarNativeAssetDiff { + asset: StellarNativeAssetDiff.Asset; /** * The type of the assets in this diff @@ -374,7 +364,7 @@ export namespace TransactionScanResponse { out?: StellarAPI.StellarAssetTransferDetailsSchema | null; } - export namespace StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema { + export namespace StellarNativeAssetDiff { export interface Asset { /** * Asset code @@ -388,7 +378,7 @@ export namespace TransactionScanResponse { } } - export interface StellarAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchema { + export interface StellarContractAssetDiff { asset: StellarAPI.StellarAssetContractDetailsSchema; /** @@ -434,8 +424,8 @@ export namespace TransactionScanResponse { description?: string | null; } - export interface StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema { - asset: StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema.Asset; + export interface StellarLegacyAssetDiff { + asset: StellarLegacyAssetDiff.Asset; /** * The type of the assets in this diff @@ -453,7 +443,7 @@ export namespace TransactionScanResponse { out?: StellarAPI.StellarAssetTransferDetailsSchema | null; } - export namespace StellarAccountSingleAssetDiffSchemaTypeLegacyAssetDetailsSchemaAssetTransferDetailsSchema { + export namespace StellarLegacyAssetDiff { export interface Asset { /** * Asset code @@ -482,8 +472,8 @@ export namespace TransactionScanResponse { } } - export interface StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema { - asset: StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema.Asset; + export interface StellarNativeAssetDiff { + asset: StellarNativeAssetDiff.Asset; /** * The type of the assets in this diff @@ -501,7 +491,7 @@ export namespace TransactionScanResponse { out?: StellarAPI.StellarAssetTransferDetailsSchema | null; } - export namespace StellarAccountSingleAssetDiffSchemaTypeNativeAssetDetailsSchemaAssetTransferDetailsSchema { + export namespace StellarNativeAssetDiff { export interface Asset { /** * Asset code @@ -515,7 +505,7 @@ export namespace TransactionScanResponse { } } - export interface StellarAccountSingleAssetDiffSchemaTypeAssetContractDetailsSchemaAssetTransferDetailsSchema { + export interface StellarContractAssetDiff { asset: StellarAPI.StellarAssetContractDetailsSchema; /** @@ -534,19 +524,16 @@ export namespace TransactionScanResponse { out?: StellarAPI.StellarAssetTransferDetailsSchema | null; } - export interface StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema { - asset: StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema.Asset; + export interface StellarLegacyAssetExposure { + asset: StellarLegacyAssetExposure.Asset; /** * Mapping between the spender address and the exposure of the asset */ - spenders?: Record< - string, - StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema.Spenders - >; + spenders?: Record; } - export namespace StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaLegacyAssetDetailsSchemaSingleAssetExposureSchema { + export namespace StellarLegacyAssetExposure { export interface Asset { /** * Asset code @@ -618,19 +605,16 @@ export namespace TransactionScanResponse { } } - export interface StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema { - asset: StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema.Asset; + export interface StellarNativeAssetExposure { + asset: StellarNativeAssetExposure.Asset; /** * Mapping between the spender address and the exposure of the asset */ - spenders?: Record< - string, - StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema.Spenders - >; + spenders?: Record; } - export namespace StellarAddressAssetExposureSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchemaNativeAssetDetailsSchemaSingleAssetExposureSchema { + export namespace StellarNativeAssetExposure { export interface Asset { /** * Asset code @@ -697,7 +681,7 @@ export namespace TransactionScanResponse { status: 'Error'; } - export interface StellarValidationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchema { + export interface StellarValidationResult { /** * A textual classification that can be presented to the user explaining the * reason. @@ -709,10 +693,7 @@ export namespace TransactionScanResponse { */ description: string; - /** - * A list of features about this transaction explaining the validation - */ - features: Array; + features: Array; /** * A textual description about the reasons the transaction was flagged with @@ -728,7 +709,7 @@ export namespace TransactionScanResponse { status: 'Success'; } - export namespace StellarValidationResultSchemaTypeAnnotatedUnionMuxedAccountContractAddressSkipValidationPlainSerializerGetPydanticSchema { + export namespace StellarValidationResult { export interface Feature { /** * Address the feature refers to From 319bc69256c3b78bb85fbc5a920d268ced13e969 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 19:14:10 +0000 Subject: [PATCH 10/18] feat(api): manual updates (#314) --- .stats.yml | 2 +- api.md | 17 +- src/index.ts | 26 +- src/resources/bitcoin/bitcoin.ts | 10 +- src/resources/bitcoin/index.ts | 8 +- src/resources/bitcoin/transaction.ts | 83 +++ src/resources/index.ts | 13 +- src/resources/starknet/index.ts | 13 +- src/resources/starknet/starknet.ts | 77 +- src/resources/starknet/transaction.ts | 679 +++++++++++++++++- src/resources/stellar/index.ts | 12 +- src/resources/stellar/stellar.ts | 59 +- src/resources/stellar/transaction.ts | 463 +++++++++++- .../api-resources/bitcoin/transaction.test.ts | 23 + .../starknet/transaction.test.ts | 23 + .../api-resources/stellar/transaction.test.ts | 23 + 16 files changed, 1321 insertions(+), 210 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0bcc787e..75064ee7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 19 +configured_endpoints: 22 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-9074805d4822d26da6e3f769edeb3bb4294de7586358fa0a4901990a405ab1e9.yml diff --git a/api.md b/api.md index d35b281b..b18549b8 100644 --- a/api.md +++ b/api.md @@ -134,19 +134,16 @@ Methods: # Stellar -Types: - -- StellarAssetContractDetailsSchema -- StellarAssetTransferDetailsSchema - ## Transaction Types: +- TransactionReportResponse - TransactionScanResponse Methods: +- client.stellar.transaction.report({ ...params }) -> TransactionReportResponse - client.stellar.transaction.scan({ ...params }) -> TransactionScanResponse # Bitcoin @@ -155,28 +152,26 @@ Methods: Types: +- TransactionReportResponse - TransactionScanResponse Methods: +- client.bitcoin.transaction.report({ ...params }) -> TransactionReportResponse - client.bitcoin.transaction.scan({ ...params }) -> TransactionScanResponse # Starknet -Types: - -- StarknetErc1155Diff -- StarknetErc20Diff -- StarknetErc721Diff - ## Transaction Types: +- TransactionReportResponse - TransactionScanResponse Methods: +- client.starknet.transaction.report({ ...params }) -> TransactionReportResponse - client.starknet.transaction.scan({ ...params }) -> TransactionScanResponse # Site diff --git a/src/index.ts b/src/index.ts index 0eafdf11..b12339db 100644 --- a/src/index.ts +++ b/src/index.ts @@ -81,17 +81,8 @@ import { TxScanRequestSchema, ValidationFeature, } from './resources/solana/solana'; -import { - Starknet, - StarknetErc1155Diff, - StarknetErc20Diff, - StarknetErc721Diff, -} from './resources/starknet/starknet'; -import { - Stellar, - StellarAssetContractDetailsSchema, - StellarAssetTransferDetailsSchema, -} from './resources/stellar/stellar'; +import { Starknet } from './resources/starknet/starknet'; +import { Stellar } from './resources/stellar/stellar'; const environments = { production: 'https://api.blockaid.io', @@ -392,20 +383,11 @@ export declare namespace Blockaid { type ValidationFeature as ValidationFeature, }; - export { - Stellar as Stellar, - type StellarAssetContractDetailsSchema as StellarAssetContractDetailsSchema, - type StellarAssetTransferDetailsSchema as StellarAssetTransferDetailsSchema, - }; + export { Stellar as Stellar }; export { Bitcoin as Bitcoin }; - export { - Starknet as Starknet, - type StarknetErc1155Diff as StarknetErc1155Diff, - type StarknetErc20Diff as StarknetErc20Diff, - type StarknetErc721Diff as StarknetErc721Diff, - }; + export { Starknet as Starknet }; export { Site as Site, diff --git a/src/resources/bitcoin/bitcoin.ts b/src/resources/bitcoin/bitcoin.ts index e6ba4f57..e77dbbcd 100644 --- a/src/resources/bitcoin/bitcoin.ts +++ b/src/resources/bitcoin/bitcoin.ts @@ -2,7 +2,13 @@ import { APIResource } from '../../resource'; import * as TransactionAPI from './transaction'; -import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; +import { + Transaction, + TransactionReportParams, + TransactionReportResponse, + TransactionScanParams, + TransactionScanResponse, +} from './transaction'; export class Bitcoin extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); @@ -13,7 +19,9 @@ Bitcoin.Transaction = Transaction; export declare namespace Bitcoin { export { Transaction as Transaction, + type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/bitcoin/index.ts b/src/resources/bitcoin/index.ts index 5692cbb7..e259b401 100644 --- a/src/resources/bitcoin/index.ts +++ b/src/resources/bitcoin/index.ts @@ -1,4 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Bitcoin } from './bitcoin'; -export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; +export { + Transaction, + type TransactionReportResponse, + type TransactionScanResponse, + type TransactionReportParams, + type TransactionScanParams, +} from './transaction'; diff --git a/src/resources/bitcoin/transaction.ts b/src/resources/bitcoin/transaction.ts index 09d0ba87..7054426e 100644 --- a/src/resources/bitcoin/transaction.ts +++ b/src/resources/bitcoin/transaction.ts @@ -4,6 +4,16 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; export class Transaction extends APIResource { + /** + * Report Transaction + */ + report( + body: TransactionReportParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post('/v0/bitcoin/transaction/report', { body, ...options }); + } + /** * Scan Transaction */ @@ -12,6 +22,8 @@ export class Transaction extends APIResource { } } +export type TransactionReportResponse = number; + export interface TransactionScanResponse { /** * Simulation result; Only present if simulation option is included in the request @@ -441,6 +453,75 @@ export namespace TransactionScanResponse { } } +export interface TransactionReportParams { + details: string; + + event: 'should_be_malicious' | 'should_be_benign'; + + report: + | TransactionReportParams.BitcoinAppealRequestID + | TransactionReportParams.BitcoinAppealTransactionDataReport; +} + +export namespace TransactionReportParams { + export interface BitcoinAppealRequestID { + id: string; + + type?: 'request_id'; + } + + export interface BitcoinAppealTransactionDataReport { + params: BitcoinAppealTransactionDataReport.Params; + + type?: 'params'; + } + + export namespace BitcoinAppealTransactionDataReport { + export interface Params { + account_address: string; + + chain: 'bitcoin'; + + /** + * Metadata + */ + metadata: Params.BitcoinWalletRequestMetadata | Params.BitcoinInAppRequestMetadata; + + transaction: string; + + /** + * List of options to include in the response + * + * - `Options.validation`: Include Options.validation output in the response + * + * - `Options.simulation`: Include Options.simulation output in the response + */ + options?: Array<'validation' | 'simulation'>; + } + + export namespace Params { + export interface BitcoinWalletRequestMetadata { + /** + * Metadata for wallet requests + */ + type: 'wallet'; + + /** + * URL of the dApp originating the transaction + */ + url: string; + } + + export interface BitcoinInAppRequestMetadata { + /** + * Metadata for in-app requests + */ + type?: 'in_app'; + } + } + } +} + export interface TransactionScanParams { account_address: string; @@ -488,7 +569,9 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { + type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/index.ts b/src/resources/index.ts index 8beaaa19..0e60defe 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -68,17 +68,8 @@ export { type TxScanRequestSchema, type ValidationFeature, } from './solana/solana'; -export { - Starknet, - type StarknetErc1155Diff, - type StarknetErc20Diff, - type StarknetErc721Diff, -} from './starknet/starknet'; -export { - Stellar, - type StellarAssetContractDetailsSchema, - type StellarAssetTransferDetailsSchema, -} from './stellar/stellar'; +export { Starknet } from './starknet/starknet'; +export { Stellar } from './stellar/stellar'; export { Token, type TokenReportResponse, diff --git a/src/resources/starknet/index.ts b/src/resources/starknet/index.ts index 40596a5a..f0a05636 100644 --- a/src/resources/starknet/index.ts +++ b/src/resources/starknet/index.ts @@ -1,9 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { Starknet } from './starknet'; export { - Starknet, - type StarknetErc1155Diff, - type StarknetErc20Diff, - type StarknetErc721Diff, -} from './starknet'; -export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; + Transaction, + type TransactionReportResponse, + type TransactionScanResponse, + type TransactionReportParams, + type TransactionScanParams, +} from './transaction'; diff --git a/src/resources/starknet/starknet.ts b/src/resources/starknet/starknet.ts index a3a33651..e680c4bc 100644 --- a/src/resources/starknet/starknet.ts +++ b/src/resources/starknet/starknet.ts @@ -2,85 +2,26 @@ import { APIResource } from '../../resource'; import * as TransactionAPI from './transaction'; -import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; +import { + Transaction, + TransactionReportParams, + TransactionReportResponse, + TransactionScanParams, + TransactionScanResponse, +} from './transaction'; export class Starknet extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); } -export interface StarknetErc1155Diff { - /** - * Token ID of the transfer - */ - token_id: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: number; - - /** - * Summarized description of the transfer - */ - summary?: string | null; -} - -export interface StarknetErc20Diff { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; -} - -export interface StarknetErc721Diff { - /** - * Token ID of the transfer - */ - token_id: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; -} - Starknet.Transaction = Transaction; export declare namespace Starknet { - export { - type StarknetErc1155Diff as StarknetErc1155Diff, - type StarknetErc20Diff as StarknetErc20Diff, - type StarknetErc721Diff as StarknetErc721Diff, - }; - export { Transaction as Transaction, + type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/starknet/transaction.ts b/src/resources/starknet/transaction.ts index 6b2a999b..ce8bd5b2 100644 --- a/src/resources/starknet/transaction.ts +++ b/src/resources/starknet/transaction.ts @@ -2,9 +2,18 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as StarknetAPI from './starknet'; export class Transaction extends APIResource { + /** + * Report Transaction + */ + report( + body: TransactionReportParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post('/v0/starknet/transaction/report', { body, ...options }); + } + /** * Scan Transactions */ @@ -13,6 +22,8 @@ export class Transaction extends APIResource { } } +export type TransactionReportResponse = number; + export interface TransactionScanResponse { /** * Simulation result; Only present if simulation option is included in the request @@ -162,7 +173,7 @@ export namespace TransactionScanResponse { */ approval: string; - exposure: Array; + exposure: Array; /** * Expiration date of the approval @@ -174,6 +185,30 @@ export namespace TransactionScanResponse { */ summary?: string | null; } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } } export interface StarknetErc721Exposure { @@ -214,7 +249,7 @@ export namespace TransactionScanResponse { } export interface Spenders { - exposure: Array; + exposure: Array; /** * Whether `setApprovalForAll` was invoked @@ -226,6 +261,25 @@ export namespace TransactionScanResponse { */ summary?: string | null; } + + export namespace Spenders { + export interface Exposure { + /** + * Token ID of the transfer + */ + token_id: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } } export interface StarknetErc1155Exposure { @@ -266,7 +320,7 @@ export namespace TransactionScanResponse { } export interface Spenders { - exposure: Array; + exposure: Array; /** * Whether `setApprovalForAll` was invoked @@ -278,6 +332,30 @@ export namespace TransactionScanResponse { */ summary?: string | null; } + + export namespace Spenders { + export interface Exposure { + /** + * Token ID of the transfer + */ + token_id: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: number; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } } /** @@ -311,12 +389,12 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StarknetAPI.StarknetErc20Diff | null; + in?: StarknetErc20AssetDiff.In | null; /** * Details of the outgoing transfer */ - out?: StarknetAPI.StarknetErc20Diff | null; + out?: StarknetErc20AssetDiff.Out | null; } export namespace StarknetErc20AssetDiff { @@ -351,6 +429,56 @@ export namespace TransactionScanResponse { */ type?: 'ERC20'; } + + /** + * Details of the incoming transfer + */ + export interface In { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + + /** + * Details of the outgoing transfer + */ + export interface Out { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } } export interface StarknetErc721AssetDiff { @@ -364,12 +492,12 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StarknetAPI.StarknetErc721Diff | null; + in?: StarknetErc721AssetDiff.In | null; /** * Details of the outgoing transfer */ - out?: StarknetAPI.StarknetErc721Diff | null; + out?: StarknetErc721AssetDiff.Out | null; } export namespace StarknetErc721AssetDiff { @@ -399,6 +527,46 @@ export namespace TransactionScanResponse { */ type?: 'ERC721'; } + + /** + * Details of the incoming transfer + */ + export interface In { + /** + * Token ID of the transfer + */ + token_id: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + + /** + * Details of the outgoing transfer + */ + export interface Out { + /** + * Token ID of the transfer + */ + token_id: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } } export interface StarknetErc1155AssetDiff { @@ -412,12 +580,12 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StarknetAPI.StarknetErc1155Diff | null; + in?: StarknetErc1155AssetDiff.In | null; /** * Details of the outgoing transfer */ - out?: StarknetAPI.StarknetErc1155Diff | null; + out?: StarknetErc1155AssetDiff.Out | null; } export namespace StarknetErc1155AssetDiff { @@ -447,6 +615,56 @@ export namespace TransactionScanResponse { */ type?: 'ERC1155'; } + + /** + * Details of the incoming transfer + */ + export interface In { + /** + * Token ID of the transfer + */ + token_id: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: number; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + + /** + * Details of the outgoing transfer + */ + export interface Out { + /** + * Token ID of the transfer + */ + token_id: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: number; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } } } @@ -473,12 +691,12 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StarknetAPI.StarknetErc20Diff | null; + in?: StarknetErc20AssetDiff.In | null; /** * Details of the outgoing transfer */ - out?: StarknetAPI.StarknetErc20Diff | null; + out?: StarknetErc20AssetDiff.Out | null; } export namespace StarknetErc20AssetDiff { @@ -513,6 +731,56 @@ export namespace TransactionScanResponse { */ type?: 'ERC20'; } + + /** + * Details of the incoming transfer + */ + export interface In { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + + /** + * Details of the outgoing transfer + */ + export interface Out { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } } export interface StarknetErc721AssetDiff { @@ -526,12 +794,12 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StarknetAPI.StarknetErc721Diff | null; + in?: StarknetErc721AssetDiff.In | null; /** * Details of the outgoing transfer */ - out?: StarknetAPI.StarknetErc721Diff | null; + out?: StarknetErc721AssetDiff.Out | null; } export namespace StarknetErc721AssetDiff { @@ -561,6 +829,46 @@ export namespace TransactionScanResponse { */ type?: 'ERC721'; } + + /** + * Details of the incoming transfer + */ + export interface In { + /** + * Token ID of the transfer + */ + token_id: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + + /** + * Details of the outgoing transfer + */ + export interface Out { + /** + * Token ID of the transfer + */ + token_id: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } } export interface StarknetErc1155AssetDiff { @@ -574,12 +882,12 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StarknetAPI.StarknetErc1155Diff | null; + in?: StarknetErc1155AssetDiff.In | null; /** * Details of the outgoing transfer */ - out?: StarknetAPI.StarknetErc1155Diff | null; + out?: StarknetErc1155AssetDiff.Out | null; } export namespace StarknetErc1155AssetDiff { @@ -609,6 +917,56 @@ export namespace TransactionScanResponse { */ type?: 'ERC1155'; } + + /** + * Details of the incoming transfer + */ + export interface In { + /** + * Token ID of the transfer + */ + token_id: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: number; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + + /** + * Details of the outgoing transfer + */ + export interface Out { + /** + * Token ID of the transfer + */ + token_id: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: number; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } } export interface StarknetErc20Exposure { @@ -659,7 +1017,7 @@ export namespace TransactionScanResponse { */ approval: string; - exposure: Array; + exposure: Array; /** * Expiration date of the approval @@ -671,6 +1029,30 @@ export namespace TransactionScanResponse { */ summary?: string | null; } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } } export interface StarknetErc721Exposure { @@ -711,7 +1093,7 @@ export namespace TransactionScanResponse { } export interface Spenders { - exposure: Array; + exposure: Array; /** * Whether `setApprovalForAll` was invoked @@ -723,6 +1105,25 @@ export namespace TransactionScanResponse { */ summary?: string | null; } + + export namespace Spenders { + export interface Exposure { + /** + * Token ID of the transfer + */ + token_id: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } } export interface StarknetErc1155Exposure { @@ -763,7 +1164,7 @@ export namespace TransactionScanResponse { } export interface Spenders { - exposure: Array; + exposure: Array; /** * Whether `setApprovalForAll` was invoked @@ -775,6 +1176,30 @@ export namespace TransactionScanResponse { */ summary?: string | null; } + + export namespace Spenders { + export interface Exposure { + /** + * Token ID of the transfer + */ + token_id: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: number; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } } } @@ -846,6 +1271,220 @@ export namespace TransactionScanResponse { } } +export interface TransactionReportParams { + details: string; + + event: 'should_be_malicious' | 'should_be_benign'; + + report: + | TransactionReportParams.StarknetAppealRequestID + | TransactionReportParams.StarknetAppealTransactionDataReport; +} + +export namespace TransactionReportParams { + export interface StarknetAppealRequestID { + id: string; + + type?: 'request_id'; + } + + export interface StarknetAppealTransactionDataReport { + params: StarknetAppealTransactionDataReport.Params; + + type?: 'params'; + } + + export namespace StarknetAppealTransactionDataReport { + export interface Params { + account_address: string; + + /** + * The chain name or chain ID + */ + chain: 'mainnet' | 'sepolia' | 'sepolia_integration' | (string & {}); + + /** + * Metadata + */ + metadata: Params.StarknetWalletRequestMetadata | Params.StarknetInAppRequestMetadata; + + transaction: + | Params.StarknetInvokeV1TransactionSchema + | Params.StarknetInvokeV3TransactionSchema + | Params.StarknetDeployAccountV1TransactionSchema + | Params.StarknetDeployAccountV3TransactionSchema; + + /** + * Optional block number or tag context for the simulation + */ + block_number?: string | null; + + /** + * List of options to include in the response + * + * - `Options.validation`: Include Options.validation output in the response + * + * - `Options.simulation`: Include Options.simulation output in the response + */ + options?: Array<'validation' | 'simulation'>; + } + + export namespace Params { + export interface StarknetWalletRequestMetadata { + /** + * Metadata for wallet requests + */ + type: 'wallet'; + + /** + * URL of the dApp originating the transaction + */ + url: string; + } + + export interface StarknetInAppRequestMetadata { + /** + * Metadata for in-app requests + */ + type?: 'in_app'; + } + + export interface StarknetInvokeV1TransactionSchema { + /** + * The maximum fee that the sender is willing to pay. + */ + max_fee: string; + + /** + * The nonce of the transaction. + */ + nonce: string; + + /** + * The address of the sender. + */ + sender_address: string; + + /** + * The version of the transaction. + */ + version: 1; + + /** + * The arguments that are passed to the validate and execute functions. + */ + calldata?: Array; + } + + export interface StarknetInvokeV3TransactionSchema { + /** + * The arguments that are passed to the validate and execute functions. + */ + calldata: Array; + + /** + * The id of the chain to which the transaction is sent. + */ + chain_id: string; + + /** + * The nonce of the transaction. + */ + nonce: string; + + /** + * The address of the sender. + */ + sender_address: string; + + /** + * The version of the transaction. + */ + version: 3; + + /** + * For future use. Currently this value is always empty. + */ + account_deployment_data?: Array; + + /** + * The nonce data availability mode. + */ + nonce_data_availability_mode?: 0; + + /** + * For future use. Currently this value is always empty. + */ + paymaster_data?: Array; + } + + export interface StarknetDeployAccountV1TransactionSchema { + /** + * The hash of the contract class. + */ + class_hash: string; + + /** + * The arguments that are passed to the constructor function. + */ + constructor_calldata: Array; + + /** + * The salt of the contract address. + */ + contract_address_salt: string; + + /** + * The maximum fee that the sender is willing to pay. + */ + max_fee: string; + + /** + * The nonce of the transaction. + */ + nonce: string; + + /** + * The version of the transaction. + */ + version: 1; + } + + export interface StarknetDeployAccountV3TransactionSchema { + /** + * The hash of the contract class. + */ + class_hash: string; + + /** + * The arguments that are passed to the constructor function. + */ + constructor_calldata: Array; + + /** + * The salt of the contract address. + */ + contract_address_salt: string; + + /** + * The maximum fee that the sender is willing to pay. + */ + max_fee: string; + + /** + * The nonce of the transaction. + */ + nonce: string; + + /** + * The version of the transaction. + */ + version: 3; + } + } + } +} + export interface TransactionScanParams { account_address: string; @@ -1038,7 +1677,9 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { + type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/stellar/index.ts b/src/resources/stellar/index.ts index 80722a0c..66f5663d 100644 --- a/src/resources/stellar/index.ts +++ b/src/resources/stellar/index.ts @@ -1,8 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { Stellar } from './stellar'; export { - Stellar, - type StellarAssetContractDetailsSchema, - type StellarAssetTransferDetailsSchema, -} from './stellar'; -export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; + Transaction, + type TransactionReportResponse, + type TransactionScanResponse, + type TransactionReportParams, + type TransactionScanParams, +} from './transaction'; diff --git a/src/resources/stellar/stellar.ts b/src/resources/stellar/stellar.ts index 497d7ee5..a2e48da1 100644 --- a/src/resources/stellar/stellar.ts +++ b/src/resources/stellar/stellar.ts @@ -2,67 +2,26 @@ import { APIResource } from '../../resource'; import * as TransactionAPI from './transaction'; -import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; +import { + Transaction, + TransactionReportParams, + TransactionReportResponse, + TransactionScanParams, + TransactionScanResponse, +} from './transaction'; export class Stellar extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); } -export interface StellarAssetContractDetailsSchema { - /** - * Address of the asset's contract - */ - address: string; - - /** - * Asset code - */ - name: string; - - /** - * Asset symbol - */ - symbol: string; - - /** - * Type of the asset (`CONTRACT`) - */ - type?: 'CONTRACT'; -} - -export interface StellarAssetTransferDetailsSchema { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; -} - Stellar.Transaction = Transaction; export declare namespace Stellar { - export { - type StellarAssetContractDetailsSchema as StellarAssetContractDetailsSchema, - type StellarAssetTransferDetailsSchema as StellarAssetTransferDetailsSchema, - }; - export { Transaction as Transaction, + type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/stellar/transaction.ts b/src/resources/stellar/transaction.ts index d297eacc..eb81e4bd 100644 --- a/src/resources/stellar/transaction.ts +++ b/src/resources/stellar/transaction.ts @@ -2,9 +2,18 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as StellarAPI from './stellar'; export class Transaction extends APIResource { + /** + * Report Transaction + */ + report( + body: TransactionReportParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post('/v0/stellar/transaction/report', { body, ...options }); + } + /** * Scan Transaction */ @@ -13,6 +22,8 @@ export class Transaction extends APIResource { } } +export type TransactionReportResponse = number; + export interface TransactionScanResponse { /** * Simulation result; Only present if simulation option is included in the request @@ -308,12 +319,12 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + in?: StellarLegacyAssetDiff.In | null; /** * Details of the outgoing transfer */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + out?: StellarLegacyAssetDiff.Out | null; } export namespace StellarLegacyAssetDiff { @@ -343,6 +354,56 @@ export namespace TransactionScanResponse { */ type?: 'ASSET'; } + + /** + * Details of the incoming transfer + */ + export interface In { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + + /** + * Details of the outgoing transfer + */ + export interface Out { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } } export interface StellarNativeAssetDiff { @@ -356,12 +417,12 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + in?: StellarNativeAssetDiff.In | null; /** * Details of the outgoing transfer */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + out?: StellarNativeAssetDiff.Out | null; } export namespace StellarNativeAssetDiff { @@ -376,10 +437,60 @@ export namespace TransactionScanResponse { */ type?: 'NATIVE'; } + + /** + * Details of the incoming transfer + */ + export interface In { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + + /** + * Details of the outgoing transfer + */ + export interface Out { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } } export interface StellarContractAssetDiff { - asset: StellarAPI.StellarAssetContractDetailsSchema; + asset: StellarContractAssetDiff.Asset; /** * The type of the assets in this diff @@ -389,12 +500,86 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + in?: StellarContractAssetDiff.In | null; /** * Details of the outgoing transfer */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + out?: StellarContractAssetDiff.Out | null; + } + + export namespace StellarContractAssetDiff { + export interface Asset { + /** + * Address of the asset's contract + */ + address: string; + + /** + * Asset code + */ + name: string; + + /** + * Asset symbol + */ + symbol: string; + + /** + * Type of the asset (`CONTRACT`) + */ + type?: 'CONTRACT'; + } + + /** + * Details of the incoming transfer + */ + export interface In { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + + /** + * Details of the outgoing transfer + */ + export interface Out { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } } } @@ -435,12 +620,12 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + in?: StellarLegacyAssetDiff.In | null; /** * Details of the outgoing transfer */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + out?: StellarLegacyAssetDiff.Out | null; } export namespace StellarLegacyAssetDiff { @@ -470,6 +655,56 @@ export namespace TransactionScanResponse { */ type?: 'ASSET'; } + + /** + * Details of the incoming transfer + */ + export interface In { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + + /** + * Details of the outgoing transfer + */ + export interface Out { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } } export interface StellarNativeAssetDiff { @@ -483,12 +718,12 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + in?: StellarNativeAssetDiff.In | null; /** * Details of the outgoing transfer */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + out?: StellarNativeAssetDiff.Out | null; } export namespace StellarNativeAssetDiff { @@ -503,10 +738,60 @@ export namespace TransactionScanResponse { */ type?: 'NATIVE'; } + + /** + * Details of the incoming transfer + */ + export interface In { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + + /** + * Details of the outgoing transfer + */ + export interface Out { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } } export interface StellarContractAssetDiff { - asset: StellarAPI.StellarAssetContractDetailsSchema; + asset: StellarContractAssetDiff.Asset; /** * The type of the assets in this diff @@ -516,12 +801,86 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + in?: StellarContractAssetDiff.In | null; /** * Details of the outgoing transfer */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + out?: StellarContractAssetDiff.Out | null; + } + + export namespace StellarContractAssetDiff { + export interface Asset { + /** + * Address of the asset's contract + */ + address: string; + + /** + * Asset code + */ + name: string; + + /** + * Asset symbol + */ + symbol: string; + + /** + * Type of the asset (`CONTRACT`) + */ + type?: 'CONTRACT'; + } + + /** + * Details of the incoming transfer + */ + export interface In { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + + /** + * Details of the outgoing transfer + */ + export interface Out { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } } export interface StellarLegacyAssetExposure { @@ -740,6 +1099,78 @@ export namespace TransactionScanResponse { } } +export interface TransactionReportParams { + details: string; + + event: 'should_be_malicious' | 'should_be_benign'; + + report: + | TransactionReportParams.StellarAppealRequestID + | TransactionReportParams.StellarAppealTransactionDataReport; +} + +export namespace TransactionReportParams { + export interface StellarAppealRequestID { + id: string; + + type?: 'request_id'; + } + + export interface StellarAppealTransactionDataReport { + params: StellarAppealTransactionDataReport.Params; + + type?: 'params'; + } + + export namespace StellarAppealTransactionDataReport { + export interface Params { + account_address: string; + + /** + * A CAIP-2 chain ID or a Stellar network name + */ + chain: 'pubnet' | 'futurenet' | 'testnet'; + + /** + * Metadata + */ + metadata: Params.StellarWalletRequestMetadata | Params.StellarInAppRequestMetadata; + + transaction: string; + + /** + * List of options to include in the response + * + * - `Options.validation`: Include Options.validation output in the response + * + * - `Options.simulation`: Include Options.simulation output in the response + */ + options?: Array<'validation' | 'simulation'>; + } + + export namespace Params { + 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 interface TransactionScanParams { account_address: string; @@ -790,7 +1221,9 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { + type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/tests/api-resources/bitcoin/transaction.test.ts b/tests/api-resources/bitcoin/transaction.test.ts index 16e50953..55196b47 100644 --- a/tests/api-resources/bitcoin/transaction.test.ts +++ b/tests/api-resources/bitcoin/transaction.test.ts @@ -9,6 +9,29 @@ const client = new Blockaid({ }); describe('resource transaction', () => { + test('report: only required params', async () => { + const responsePromise = client.bitcoin.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id' }, + }); + 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('report: required and optional params', async () => { + const response = await client.bitcoin.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id', type: 'request_id' }, + }); + }); + test('scan: only required params', async () => { const responsePromise = client.bitcoin.transaction.scan({ account_address: 'account_address', diff --git a/tests/api-resources/starknet/transaction.test.ts b/tests/api-resources/starknet/transaction.test.ts index cdd0d343..92070907 100644 --- a/tests/api-resources/starknet/transaction.test.ts +++ b/tests/api-resources/starknet/transaction.test.ts @@ -9,6 +9,29 @@ const client = new Blockaid({ }); describe('resource transaction', () => { + test('report: only required params', async () => { + const responsePromise = client.starknet.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id' }, + }); + 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('report: required and optional params', async () => { + const response = await client.starknet.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id', type: 'request_id' }, + }); + }); + test('scan: only required params', async () => { const responsePromise = client.starknet.transaction.scan({ account_address: '0x62a2959fa6502b30cbfb51199fbbe72e72ee4f5a86ec754b4172c7d7beb6ff4', diff --git a/tests/api-resources/stellar/transaction.test.ts b/tests/api-resources/stellar/transaction.test.ts index 529fd3d5..3cb0f617 100644 --- a/tests/api-resources/stellar/transaction.test.ts +++ b/tests/api-resources/stellar/transaction.test.ts @@ -9,6 +9,29 @@ const client = new Blockaid({ }); describe('resource transaction', () => { + test('report: only required params', async () => { + const responsePromise = client.stellar.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id' }, + }); + 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('report: required and optional params', async () => { + const response = await client.stellar.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id', type: 'request_id' }, + }); + }); + test('scan: only required params', async () => { const responsePromise = client.stellar.transaction.scan({ account_address: 'GDPMFLKUGASUTWBN2XGYYKD27QGHCYH4BUFUTER4L23INYQ4JHDWFOIE', From 94a4e8cca931d5e292692ab7fc108545e2d4764e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 19:35:40 +0000 Subject: [PATCH 11/18] feat(api): manual updates (#315) --- api.md | 25 +- src/index.ts | 48 +- src/resources/index.ts | 24 +- src/resources/solana/index.ts | 3 + src/resources/solana/solana.ts | 163 ++-- src/resources/starknet/index.ts | 10 +- src/resources/starknet/starknet.ts | 156 ++++ src/resources/starknet/transaction.ts | 831 +----------------- src/resources/stellar/index.ts | 12 +- src/resources/stellar/stellar.ts | 570 ++++++++++++- src/resources/stellar/transaction.ts | 1132 +------------------------ 11 files changed, 923 insertions(+), 2051 deletions(-) diff --git a/api.md b/api.md index b18549b8..47f45615 100644 --- a/api.md +++ b/api.md @@ -101,6 +101,8 @@ Types: - DelegatedAssetDetailsSchema - FungibleMintAccountDetailsSchema - InstructionErrorDetails +- NativeDetailsSchema +- NativeDiffSchema - NativeSolOwnershipDiffSchema - NonFungibleMintAccountDetailsSchema - PdaAccountSchema @@ -111,6 +113,7 @@ Types: - SplNonFungibleTokenDetailsSchema - SplNonFungibleTokenDiffSchema - SplTokenOwnershipDiffSchema +- StakedAssetDetailsSchema - StakedSolWithdrawAuthorityDiffSchema - SuccessfulSimulationResultSchema - SystemAccountDetailsSchema @@ -134,17 +137,26 @@ Methods: # Stellar +Types: + +- StellarAssetContractDetails +- StellarAssetTransferDetails +- StellarLegacyAssetDetails +- StellarNativeAssetDetails +- StellarSingleAssetExposure +- StellarTransactionScanRequest +- StellarTransactionScanResponse + ## Transaction Types: - TransactionReportResponse -- TransactionScanResponse Methods: - client.stellar.transaction.report({ ...params }) -> TransactionReportResponse -- client.stellar.transaction.scan({ ...params }) -> TransactionScanResponse +- client.stellar.transaction.scan({ ...params }) -> StellarTransactionScanResponse # Bitcoin @@ -162,6 +174,15 @@ Methods: # Starknet +Types: + +- StarknetAccountErc1155Exposure +- StarknetAccountErc20Exposure +- StarknetAccountErc721Exposure +- StarknetErc1155Diff +- StarknetErc20Diff +- StarknetErc721Diff + ## Transaction Types: diff --git a/src/index.ts b/src/index.ts index b12339db..a38a9737 100644 --- a/src/index.ts +++ b/src/index.ts @@ -61,6 +61,8 @@ import { DelegatedAssetDetailsSchema, FungibleMintAccountDetailsSchema, InstructionErrorDetails, + NativeDetailsSchema, + NativeDiffSchema, NativeSolOwnershipDiffSchema, NonFungibleMintAccountDetailsSchema, PdaAccountSchema, @@ -72,6 +74,7 @@ import { SplNonFungibleTokenDetailsSchema, SplNonFungibleTokenDiffSchema, SplTokenOwnershipDiffSchema, + StakedAssetDetailsSchema, StakedSolWithdrawAuthorityDiffSchema, SuccessfulSimulationResultSchema, SystemAccountDetailsSchema, @@ -81,8 +84,25 @@ import { TxScanRequestSchema, ValidationFeature, } from './resources/solana/solana'; -import { Starknet } from './resources/starknet/starknet'; -import { Stellar } from './resources/stellar/stellar'; +import { + Starknet, + StarknetAccountErc1155Exposure, + StarknetAccountErc20Exposure, + StarknetAccountErc721Exposure, + StarknetErc1155Diff, + StarknetErc20Diff, + StarknetErc721Diff, +} from './resources/starknet/starknet'; +import { + Stellar, + StellarAssetContractDetails, + StellarAssetTransferDetails, + StellarLegacyAssetDetails, + StellarNativeAssetDetails, + StellarSingleAssetExposure, + StellarTransactionScanRequest, + StellarTransactionScanResponse, +} from './resources/stellar/stellar'; const environments = { production: 'https://api.blockaid.io', @@ -363,6 +383,8 @@ export declare namespace Blockaid { type DelegatedAssetDetailsSchema as DelegatedAssetDetailsSchema, type FungibleMintAccountDetailsSchema as FungibleMintAccountDetailsSchema, type InstructionErrorDetails as InstructionErrorDetails, + type NativeDetailsSchema as NativeDetailsSchema, + type NativeDiffSchema as NativeDiffSchema, type NativeSolOwnershipDiffSchema as NativeSolOwnershipDiffSchema, type NonFungibleMintAccountDetailsSchema as NonFungibleMintAccountDetailsSchema, type PdaAccountSchema as PdaAccountSchema, @@ -373,6 +395,7 @@ export declare namespace Blockaid { type SplNonFungibleTokenDetailsSchema as SplNonFungibleTokenDetailsSchema, type SplNonFungibleTokenDiffSchema as SplNonFungibleTokenDiffSchema, type SplTokenOwnershipDiffSchema as SplTokenOwnershipDiffSchema, + type StakedAssetDetailsSchema as StakedAssetDetailsSchema, type StakedSolWithdrawAuthorityDiffSchema as StakedSolWithdrawAuthorityDiffSchema, type SuccessfulSimulationResultSchema as SuccessfulSimulationResultSchema, type SystemAccountDetailsSchema as SystemAccountDetailsSchema, @@ -383,11 +406,28 @@ export declare namespace Blockaid { type ValidationFeature as ValidationFeature, }; - export { Stellar as Stellar }; + export { + Stellar as Stellar, + type StellarAssetContractDetails as StellarAssetContractDetails, + type StellarAssetTransferDetails as StellarAssetTransferDetails, + type StellarLegacyAssetDetails as StellarLegacyAssetDetails, + type StellarNativeAssetDetails as StellarNativeAssetDetails, + type StellarSingleAssetExposure as StellarSingleAssetExposure, + type StellarTransactionScanRequest as StellarTransactionScanRequest, + type StellarTransactionScanResponse as StellarTransactionScanResponse, + }; export { Bitcoin as Bitcoin }; - export { Starknet as Starknet }; + export { + Starknet as Starknet, + type StarknetAccountErc1155Exposure as StarknetAccountErc1155Exposure, + type StarknetAccountErc20Exposure as StarknetAccountErc20Exposure, + type StarknetAccountErc721Exposure as StarknetAccountErc721Exposure, + type StarknetErc1155Diff as StarknetErc1155Diff, + type StarknetErc20Diff as StarknetErc20Diff, + type StarknetErc721Diff as StarknetErc721Diff, + }; export { Site as Site, diff --git a/src/resources/index.ts b/src/resources/index.ts index 0e60defe..6b87458c 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -49,6 +49,8 @@ export { type DelegatedAssetDetailsSchema, type FungibleMintAccountDetailsSchema, type InstructionErrorDetails, + type NativeDetailsSchema, + type NativeDiffSchema, type NativeSolOwnershipDiffSchema, type NonFungibleMintAccountDetailsSchema, type PdaAccountSchema, @@ -59,6 +61,7 @@ export { type SplNonFungibleTokenDetailsSchema, type SplNonFungibleTokenDiffSchema, type SplTokenOwnershipDiffSchema, + type StakedAssetDetailsSchema, type StakedSolWithdrawAuthorityDiffSchema, type SuccessfulSimulationResultSchema, type SystemAccountDetailsSchema, @@ -68,8 +71,25 @@ export { type TxScanRequestSchema, type ValidationFeature, } from './solana/solana'; -export { Starknet } from './starknet/starknet'; -export { Stellar } from './stellar/stellar'; +export { + Starknet, + type StarknetAccountErc1155Exposure, + type StarknetAccountErc20Exposure, + type StarknetAccountErc721Exposure, + type StarknetErc1155Diff, + type StarknetErc20Diff, + type StarknetErc721Diff, +} from './starknet/starknet'; +export { + Stellar, + type StellarAssetContractDetails, + type StellarAssetTransferDetails, + type StellarLegacyAssetDetails, + type StellarNativeAssetDetails, + type StellarSingleAssetExposure, + type StellarTransactionScanRequest, + type StellarTransactionScanResponse, +} from './stellar/stellar'; export { Token, type TokenReportResponse, diff --git a/src/resources/solana/index.ts b/src/resources/solana/index.ts index 34d17466..79328d37 100644 --- a/src/resources/solana/index.ts +++ b/src/resources/solana/index.ts @@ -16,6 +16,8 @@ export { type DelegatedAssetDetailsSchema, type FungibleMintAccountDetailsSchema, type InstructionErrorDetails, + type NativeDetailsSchema, + type NativeDiffSchema, type NativeSolOwnershipDiffSchema, type NonFungibleMintAccountDetailsSchema, type PdaAccountSchema, @@ -26,6 +28,7 @@ export { type SplNonFungibleTokenDetailsSchema, type SplNonFungibleTokenDiffSchema, type SplTokenOwnershipDiffSchema, + type StakedAssetDetailsSchema, type StakedSolWithdrawAuthorityDiffSchema, type SuccessfulSimulationResultSchema, type SystemAccountDetailsSchema, diff --git a/src/resources/solana/solana.ts b/src/resources/solana/solana.ts index 4530f483..964b6e33 100644 --- a/src/resources/solana/solana.ts +++ b/src/resources/solana/solana.ts @@ -22,10 +22,7 @@ export interface AccountSummarySchema { * Assets diff of the requested account address */ account_assets_diff?: Array< - | AccountSummarySchema.NativeDiffSchema - | SplFungibleTokenDiffSchema - | SplNonFungibleTokenDiffSchema - | CnftDiffSchema + NativeDiffSchema | SplFungibleTokenDiffSchema | SplNonFungibleTokenDiffSchema | CnftDiffSchema >; /** @@ -41,40 +38,6 @@ export interface AccountSummarySchema { >; } -export namespace AccountSummarySchema { - export interface NativeDiffSchema { - asset: NativeDiffSchema.Asset; - - /** - * Type of the asset involved in the transfer - */ - asset_type: string; - - /** - * Incoming transfers of the asset - */ - in?: SolanaAPI.AssetTransferDetailsSchema | null; - - out?: SolanaAPI.AssetTransferDetailsSchema | null; - } - - export namespace NativeDiffSchema { - export interface Asset { - decimals?: number; - - /** - * Logo of the native currency - */ - logo?: string | null; - - /** - * Type of the asset (`"NativeToken"`) - */ - type?: string; - } - } -} - export interface AddressScanRequestSchema { /** * Encoded public key @@ -361,8 +324,38 @@ export interface InstructionErrorDetails { type?: string; } +export interface NativeDetailsSchema { + decimals?: number; + + /** + * Logo of the native currency + */ + logo?: string | null; + + /** + * Type of the asset (`"NativeToken"`) + */ + type?: string; +} + +export interface NativeDiffSchema { + asset: NativeDetailsSchema; + + /** + * Type of the asset involved in the transfer + */ + asset_type: string; + + /** + * Incoming transfers of the asset + */ + in?: AssetTransferDetailsSchema | null; + + out?: AssetTransferDetailsSchema | null; +} + export interface NativeSolOwnershipDiffSchema { - asset: NativeSolOwnershipDiffSchema.Asset; + asset: NativeDetailsSchema; /** * Type of the asset involved in the transfer @@ -390,22 +383,6 @@ export interface NativeSolOwnershipDiffSchema { pre_owner?: string | null; } -export namespace NativeSolOwnershipDiffSchema { - export interface Asset { - decimals?: number; - - /** - * Logo of the native currency - */ - logo?: string | null; - - /** - * Type of the asset (`"NativeToken"`) - */ - type?: string; - } -} - export interface NonFungibleMintAccountDetailsSchema { /** * Encoded public key of the account @@ -615,6 +592,20 @@ export interface SplTokenOwnershipDiffSchema { pre_owner?: string | null; } +export interface StakedAssetDetailsSchema { + decimals?: number; + + /** + * Logo of the native currency + */ + logo?: string | null; + + /** + * Type of the asset (`"STAKED_NATIVE"`) + */ + type?: string; +} + export interface StakedSolWithdrawAuthorityDiffSchema { /** * Type of the asset involved in the transfer @@ -626,7 +617,7 @@ export interface StakedSolWithdrawAuthorityDiffSchema { */ post_owner: string; - asset?: StakedSolWithdrawAuthorityDiffSchema.Asset; + asset?: StakedAssetDetailsSchema; /** * Incoming transfers of the asset @@ -644,22 +635,6 @@ export interface StakedSolWithdrawAuthorityDiffSchema { pre_owner?: string | null; } -export namespace StakedSolWithdrawAuthorityDiffSchema { - export interface Asset { - decimals?: number; - - /** - * Logo of the native currency - */ - logo?: string | null; - - /** - * Type of the asset (`"STAKED_NATIVE"`) - */ - type?: string; - } -} - export interface SuccessfulSimulationResultSchema { /** * Summary of the requested account address @@ -684,12 +659,7 @@ export interface SuccessfulSimulationResultSchema { */ assets_diff: Record< string, - Array< - | SuccessfulSimulationResultSchema.NativeDiffSchema - | SplFungibleTokenDiffSchema - | SplNonFungibleTokenDiffSchema - | CnftDiffSchema - > + Array >; /** @@ -706,40 +676,6 @@ export interface SuccessfulSimulationResultSchema { delegations: Record>; } -export namespace SuccessfulSimulationResultSchema { - export interface NativeDiffSchema { - asset: NativeDiffSchema.Asset; - - /** - * Type of the asset involved in the transfer - */ - asset_type: string; - - /** - * Incoming transfers of the asset - */ - in?: SolanaAPI.AssetTransferDetailsSchema | null; - - out?: SolanaAPI.AssetTransferDetailsSchema | null; - } - - export namespace NativeDiffSchema { - export interface Asset { - decimals?: number; - - /** - * Logo of the native currency - */ - logo?: string | null; - - /** - * Type of the asset (`"NativeToken"`) - */ - type?: string; - } - } -} - export interface SystemAccountDetailsSchema { /** * Encoded public key of the account @@ -908,6 +844,8 @@ export declare namespace Solana { type DelegatedAssetDetailsSchema as DelegatedAssetDetailsSchema, type FungibleMintAccountDetailsSchema as FungibleMintAccountDetailsSchema, type InstructionErrorDetails as InstructionErrorDetails, + type NativeDetailsSchema as NativeDetailsSchema, + type NativeDiffSchema as NativeDiffSchema, type NativeSolOwnershipDiffSchema as NativeSolOwnershipDiffSchema, type NonFungibleMintAccountDetailsSchema as NonFungibleMintAccountDetailsSchema, type PdaAccountSchema as PdaAccountSchema, @@ -918,6 +856,7 @@ export declare namespace Solana { type SplNonFungibleTokenDetailsSchema as SplNonFungibleTokenDetailsSchema, type SplNonFungibleTokenDiffSchema as SplNonFungibleTokenDiffSchema, type SplTokenOwnershipDiffSchema as SplTokenOwnershipDiffSchema, + type StakedAssetDetailsSchema as StakedAssetDetailsSchema, type StakedSolWithdrawAuthorityDiffSchema as StakedSolWithdrawAuthorityDiffSchema, type SuccessfulSimulationResultSchema as SuccessfulSimulationResultSchema, type SystemAccountDetailsSchema as SystemAccountDetailsSchema, diff --git a/src/resources/starknet/index.ts b/src/resources/starknet/index.ts index f0a05636..0ae73f0e 100644 --- a/src/resources/starknet/index.ts +++ b/src/resources/starknet/index.ts @@ -1,6 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Starknet } from './starknet'; +export { + Starknet, + type StarknetAccountErc1155Exposure, + type StarknetAccountErc20Exposure, + type StarknetAccountErc721Exposure, + type StarknetErc1155Diff, + type StarknetErc20Diff, + type StarknetErc721Diff, +} from './starknet'; export { Transaction, type TransactionReportResponse, diff --git a/src/resources/starknet/starknet.ts b/src/resources/starknet/starknet.ts index e680c4bc..df3eb584 100644 --- a/src/resources/starknet/starknet.ts +++ b/src/resources/starknet/starknet.ts @@ -14,9 +14,165 @@ export class Starknet extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); } +export interface StarknetAccountErc1155Exposure { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC1155`) + */ + type?: 'ERC1155'; +} + +export interface StarknetAccountErc20Exposure { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's decimals + */ + decimals: number; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC20`) + */ + type?: 'ERC20'; +} + +export interface StarknetAccountErc721Exposure { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC721`) + */ + type?: 'ERC721'; +} + +export interface StarknetErc1155Diff { + /** + * Token ID of the transfer + */ + token_id: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: number; + + /** + * Summarized description of the transfer + */ + summary?: string | null; +} + +export interface StarknetErc20Diff { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; +} + +export interface StarknetErc721Diff { + /** + * Token ID of the transfer + */ + token_id: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; +} + Starknet.Transaction = Transaction; export declare namespace Starknet { + export { + type StarknetAccountErc1155Exposure as StarknetAccountErc1155Exposure, + type StarknetAccountErc20Exposure as StarknetAccountErc20Exposure, + type StarknetAccountErc721Exposure as StarknetAccountErc721Exposure, + type StarknetErc1155Diff as StarknetErc1155Diff, + type StarknetErc20Diff as StarknetErc20Diff, + type StarknetErc721Diff as StarknetErc721Diff, + }; + export { Transaction as Transaction, type TransactionReportResponse as TransactionReportResponse, diff --git a/src/resources/starknet/transaction.ts b/src/resources/starknet/transaction.ts index ce8bd5b2..4d5fe97b 100644 --- a/src/resources/starknet/transaction.ts +++ b/src/resources/starknet/transaction.ts @@ -2,6 +2,7 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; +import * as StarknetAPI from './starknet'; export class Transaction extends APIResource { /** @@ -126,7 +127,7 @@ export namespace TransactionScanResponse { export namespace AccountSummary { export interface StarknetErc20Exposure { - asset: StarknetErc20Exposure.Asset; + asset: StarknetAPI.StarknetAccountErc20Exposure; /** * Mapping between the spender address and the exposure of the asset @@ -135,45 +136,13 @@ export namespace TransactionScanResponse { } export namespace StarknetErc20Exposure { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's decimals - */ - decimals: number; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC20`) - */ - type?: 'ERC20'; - } - export interface Spenders { /** * Approval value of the ERC20 token */ approval: string; - exposure: Array; + exposure: Array; /** * Expiration date of the approval @@ -185,34 +154,10 @@ export namespace TransactionScanResponse { */ summary?: string | null; } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } } export interface StarknetErc721Exposure { - asset: StarknetErc721Exposure.Asset; + asset: StarknetAPI.StarknetAccountErc721Exposure; /** * Mapping between the spender address and the exposure of the asset @@ -221,35 +166,8 @@ export namespace TransactionScanResponse { } export namespace StarknetErc721Exposure { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC721`) - */ - type?: 'ERC721'; - } - export interface Spenders { - exposure: Array; + exposure: Array; /** * Whether `setApprovalForAll` was invoked @@ -261,29 +179,10 @@ export namespace TransactionScanResponse { */ summary?: string | null; } - - export namespace Spenders { - export interface Exposure { - /** - * Token ID of the transfer - */ - token_id: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } } export interface StarknetErc1155Exposure { - asset: StarknetErc1155Exposure.Asset; + asset: StarknetAPI.StarknetAccountErc1155Exposure; /** * Mapping between the spender address and the exposure of the asset @@ -292,35 +191,8 @@ export namespace TransactionScanResponse { } export namespace StarknetErc1155Exposure { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC1155`) - */ - type?: 'ERC1155'; - } - export interface Spenders { - exposure: Array; + exposure: Array; /** * Whether `setApprovalForAll` was invoked @@ -332,30 +204,6 @@ export namespace TransactionScanResponse { */ summary?: string | null; } - - export namespace Spenders { - export interface Exposure { - /** - * Token ID of the transfer - */ - token_id: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: number; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } } /** @@ -379,7 +227,7 @@ export namespace TransactionScanResponse { } export interface StarknetErc20AssetDiff { - asset: StarknetErc20AssetDiff.Asset; + asset: StarknetAPI.StarknetAccountErc20Exposure; /** * The type of the assets in this diff @@ -389,100 +237,16 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StarknetErc20AssetDiff.In | null; + in?: StarknetAPI.StarknetErc20Diff | null; /** * Details of the outgoing transfer */ - out?: StarknetErc20AssetDiff.Out | null; - } - - export namespace StarknetErc20AssetDiff { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's decimals - */ - decimals: number; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC20`) - */ - type?: 'ERC20'; - } - - /** - * Details of the incoming transfer - */ - export interface In { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - - /** - * Details of the outgoing transfer - */ - export interface Out { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } + out?: StarknetAPI.StarknetErc20Diff | null; } export interface StarknetErc721AssetDiff { - asset: StarknetErc721AssetDiff.Asset; + asset: StarknetAPI.StarknetAccountErc721Exposure; /** * The type of the assets in this diff @@ -492,85 +256,16 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StarknetErc721AssetDiff.In | null; + in?: StarknetAPI.StarknetErc721Diff | null; /** * Details of the outgoing transfer */ - out?: StarknetErc721AssetDiff.Out | null; - } - - export namespace StarknetErc721AssetDiff { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC721`) - */ - type?: 'ERC721'; - } - - /** - * Details of the incoming transfer - */ - export interface In { - /** - * Token ID of the transfer - */ - token_id: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - - /** - * Details of the outgoing transfer - */ - export interface Out { - /** - * Token ID of the transfer - */ - token_id: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } + out?: StarknetAPI.StarknetErc721Diff | null; } export interface StarknetErc1155AssetDiff { - asset: StarknetErc1155AssetDiff.Asset; + asset: StarknetAPI.StarknetAccountErc1155Exposure; /** * The type of the assets in this diff @@ -580,91 +275,12 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StarknetErc1155AssetDiff.In | null; - - /** - * Details of the outgoing transfer - */ - out?: StarknetErc1155AssetDiff.Out | null; - } - - export namespace StarknetErc1155AssetDiff { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC1155`) - */ - type?: 'ERC1155'; - } - - /** - * Details of the incoming transfer - */ - export interface In { - /** - * Token ID of the transfer - */ - token_id: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: number; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } + in?: StarknetAPI.StarknetErc1155Diff | null; /** * Details of the outgoing transfer */ - export interface Out { - /** - * Token ID of the transfer - */ - token_id: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: number; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } + out?: StarknetAPI.StarknetErc1155Diff | null; } } @@ -681,7 +297,7 @@ export namespace TransactionScanResponse { } export interface StarknetErc20AssetDiff { - asset: StarknetErc20AssetDiff.Asset; + asset: StarknetAPI.StarknetAccountErc20Exposure; /** * The type of the assets in this diff @@ -691,100 +307,16 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StarknetErc20AssetDiff.In | null; - - /** - * Details of the outgoing transfer - */ - out?: StarknetErc20AssetDiff.Out | null; - } - - export namespace StarknetErc20AssetDiff { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's decimals - */ - decimals: number; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC20`) - */ - type?: 'ERC20'; - } - - /** - * Details of the incoming transfer - */ - export interface In { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } + in?: StarknetAPI.StarknetErc20Diff | null; /** * Details of the outgoing transfer */ - export interface Out { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } + out?: StarknetAPI.StarknetErc20Diff | null; } export interface StarknetErc721AssetDiff { - asset: StarknetErc721AssetDiff.Asset; + asset: StarknetAPI.StarknetAccountErc721Exposure; /** * The type of the assets in this diff @@ -794,85 +326,16 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StarknetErc721AssetDiff.In | null; + in?: StarknetAPI.StarknetErc721Diff | null; /** * Details of the outgoing transfer */ - out?: StarknetErc721AssetDiff.Out | null; - } - - export namespace StarknetErc721AssetDiff { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC721`) - */ - type?: 'ERC721'; - } - - /** - * Details of the incoming transfer - */ - export interface In { - /** - * Token ID of the transfer - */ - token_id: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - - /** - * Details of the outgoing transfer - */ - export interface Out { - /** - * Token ID of the transfer - */ - token_id: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } + out?: StarknetAPI.StarknetErc721Diff | null; } export interface StarknetErc1155AssetDiff { - asset: StarknetErc1155AssetDiff.Asset; + asset: StarknetAPI.StarknetAccountErc1155Exposure; /** * The type of the assets in this diff @@ -882,95 +345,16 @@ export namespace TransactionScanResponse { /** * Details of the incoming transfer */ - in?: StarknetErc1155AssetDiff.In | null; + in?: StarknetAPI.StarknetErc1155Diff | null; /** * Details of the outgoing transfer */ - out?: StarknetErc1155AssetDiff.Out | null; - } - - export namespace StarknetErc1155AssetDiff { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC1155`) - */ - type?: 'ERC1155'; - } - - /** - * Details of the incoming transfer - */ - export interface In { - /** - * Token ID of the transfer - */ - token_id: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: number; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - - /** - * Details of the outgoing transfer - */ - export interface Out { - /** - * Token ID of the transfer - */ - token_id: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: number; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } + out?: StarknetAPI.StarknetErc1155Diff | null; } export interface StarknetErc20Exposure { - asset: StarknetErc20Exposure.Asset; + asset: StarknetAPI.StarknetAccountErc20Exposure; /** * Mapping between the spender address and the exposure of the asset @@ -979,45 +363,13 @@ export namespace TransactionScanResponse { } export namespace StarknetErc20Exposure { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's decimals - */ - decimals: number; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC20`) - */ - type?: 'ERC20'; - } - export interface Spenders { /** * Approval value of the ERC20 token */ approval: string; - exposure: Array; + exposure: Array; /** * Expiration date of the approval @@ -1029,34 +381,10 @@ export namespace TransactionScanResponse { */ summary?: string | null; } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } } export interface StarknetErc721Exposure { - asset: StarknetErc721Exposure.Asset; + asset: StarknetAPI.StarknetAccountErc721Exposure; /** * Mapping between the spender address and the exposure of the asset @@ -1065,35 +393,8 @@ export namespace TransactionScanResponse { } export namespace StarknetErc721Exposure { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC721`) - */ - type?: 'ERC721'; - } - export interface Spenders { - exposure: Array; + exposure: Array; /** * Whether `setApprovalForAll` was invoked @@ -1105,29 +406,10 @@ export namespace TransactionScanResponse { */ summary?: string | null; } - - export namespace Spenders { - export interface Exposure { - /** - * Token ID of the transfer - */ - token_id: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } } export interface StarknetErc1155Exposure { - asset: StarknetErc1155Exposure.Asset; + asset: StarknetAPI.StarknetAccountErc1155Exposure; /** * Mapping between the spender address and the exposure of the asset @@ -1136,35 +418,8 @@ export namespace TransactionScanResponse { } export namespace StarknetErc1155Exposure { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC1155`) - */ - type?: 'ERC1155'; - } - export interface Spenders { - exposure: Array; + exposure: Array; /** * Whether `setApprovalForAll` was invoked @@ -1176,30 +431,6 @@ export namespace TransactionScanResponse { */ summary?: string | null; } - - export namespace Spenders { - export interface Exposure { - /** - * Token ID of the transfer - */ - token_id: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: number; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } } } diff --git a/src/resources/stellar/index.ts b/src/resources/stellar/index.ts index 66f5663d..800a3094 100644 --- a/src/resources/stellar/index.ts +++ b/src/resources/stellar/index.ts @@ -1,10 +1,18 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Stellar } from './stellar'; +export { + Stellar, + type StellarAssetContractDetails, + type StellarAssetTransferDetails, + type StellarLegacyAssetDetails, + type StellarNativeAssetDetails, + type StellarSingleAssetExposure, + type StellarTransactionScanRequest, + type StellarTransactionScanResponse, +} from './stellar'; export { Transaction, type TransactionReportResponse, - type TransactionScanResponse, type TransactionReportParams, type TransactionScanParams, } from './transaction'; diff --git a/src/resources/stellar/stellar.ts b/src/resources/stellar/stellar.ts index a2e48da1..219a2613 100644 --- a/src/resources/stellar/stellar.ts +++ b/src/resources/stellar/stellar.ts @@ -1,26 +1,592 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; +import * as StellarAPI from './stellar'; import * as TransactionAPI from './transaction'; import { Transaction, TransactionReportParams, TransactionReportResponse, TransactionScanParams, - TransactionScanResponse, } from './transaction'; export class Stellar extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); } +export interface StellarAssetContractDetails { + /** + * Address of the asset's contract + */ + address: string; + + /** + * Asset code + */ + name: string; + + /** + * Asset symbol + */ + symbol: string; + + /** + * Type of the asset (`CONTRACT`) + */ + type?: 'CONTRACT'; +} + +export interface StellarAssetTransferDetails { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; +} + +export interface StellarLegacyAssetDetails { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; + + /** + * Organization name + */ + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; +} + +export interface StellarNativeAssetDetails { + /** + * Asset code + */ + code?: 'XLM'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; +} + +export interface StellarSingleAssetExposure { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; +} + +export namespace StellarSingleAssetExposure { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } +} + +export interface StellarTransactionScanRequest { + account_address: string; + + /** + * A CAIP-2 chain ID or a Stellar network name + */ + chain: 'pubnet' | 'futurenet' | 'testnet'; + + /** + * Metadata + */ + metadata: + | StellarTransactionScanRequest.StellarWalletRequestMetadata + | StellarTransactionScanRequest.StellarInAppRequestMetadata; + + transaction: string; + + /** + * List of options to include in the response + * + * - `Options.validation`: Include Options.validation output in the response + * + * - `Options.simulation`: Include Options.simulation output in the response + */ + options?: Array<'validation' | 'simulation'>; +} + +export namespace StellarTransactionScanRequest { + 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 interface StellarTransactionScanResponse { + /** + * Simulation result; Only present if simulation option is included in the request + */ + simulation?: + | StellarTransactionScanResponse.StellarSimulationResponse + | StellarTransactionScanResponse.StellarSimulationErrorSchema + | null; + + /** + * Validation result; Only present if validation option is included in the request + */ + validation?: + | StellarTransactionScanResponse.StellarValidationResult + | StellarTransactionScanResponse.StellarValidationErrorSchema + | null; +} + +export namespace StellarTransactionScanResponse { + export interface StellarSimulationResponse { + /** + * Summary of the actions and asset transfers that were made by the requested + * account address + */ + account_summary: StellarSimulationResponse.AccountSummary; + + /** + * Ownership diffs of the account addresses + */ + assets_ownership_diff: Record>; + + status: 'Success'; + + /** + * Details of addresses involved in the transaction + */ + address_details?: Array; + + /** + * Mapping between the address of an account to the assets diff during the + * transaction + */ + assets_diffs?: Record< + string, + Array< + | StellarSimulationResponse.StellarLegacyAssetDiff + | StellarSimulationResponse.StellarNativeAssetDiff + | StellarSimulationResponse.StellarContractAssetDiff + > + >; + + /** + * Mapping between the address of an account to the exposure of the assets during + * the transaction + */ + exposures?: Record< + string, + Array< + | StellarSimulationResponse.StellarLegacyAssetExposure + | StellarSimulationResponse.StellarNativeAssetExposure + > + >; + } + + export namespace StellarSimulationResponse { + /** + * Summary of the actions and asset transfers that were made by the requested + * account address + */ + export interface AccountSummary { + /** + * Exposures made by the requested account address + */ + account_exposures: Array< + AccountSummary.StellarLegacyAssetExposure | AccountSummary.StellarNativeAssetExposure + >; + + /** + * Ownership diffs of the requested account address + */ + account_ownerships_diff: Array; + + /** + * Total USD diff for the requested account address + */ + total_usd_diff: AccountSummary.TotalUsdDiff; + + /** + * Assets diffs of the requested account address + */ + account_assets_diffs?: Array< + | AccountSummary.StellarLegacyAssetDiff + | AccountSummary.StellarNativeAssetDiff + | AccountSummary.StellarContractAssetDiff + >; + + /** + * Total USD exposure for each of the spender addresses during the transaction + */ + total_usd_exposure?: Record; + } + + export namespace AccountSummary { + export interface StellarLegacyAssetExposure { + asset: StellarAPI.StellarLegacyAssetDetails; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export interface StellarNativeAssetExposure { + asset: StellarAPI.StellarNativeAssetDetails; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export interface AccountOwnershipsDiff { + /** + * List of public keys that can sign on behalf of the account post-transaction + */ + post_signers: Array; + + /** + * List of public keys that can sign on behalf of the account pre-transaction + */ + pre_signers: Array; + + type?: 'SET_OPTIONS'; + } + + /** + * Total USD diff for the requested account address + */ + export interface TotalUsdDiff { + /** + * Total incoming USD transfers + */ + in: number; + + /** + * Total outgoing USD transfers + */ + out: number; + + /** + * Total USD transfers + */ + total?: number; + } + + export interface StellarLegacyAssetDiff { + asset: StellarAPI.StellarLegacyAssetDetails; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetails | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetails | null; + } + + export interface StellarNativeAssetDiff { + asset: StellarAPI.StellarNativeAssetDetails; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetails | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetails | null; + } + + export interface StellarContractAssetDiff { + asset: StellarAPI.StellarAssetContractDetails; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetails | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetails | null; + } + } + + export interface AssetsOwnershipDiff { + /** + * List of public keys that can sign on behalf of the account post-transaction + */ + post_signers: Array; + + /** + * List of public keys that can sign on behalf of the account pre-transaction + */ + pre_signers: Array; + + type?: 'SET_OPTIONS'; + } + + export interface AddressDetail { + /** + * Encoded public key of the account + */ + account_address: unknown; + + /** + * Description of the account + */ + description?: string | null; + } + + export interface StellarLegacyAssetDiff { + asset: StellarAPI.StellarLegacyAssetDetails; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetails | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetails | null; + } + + export interface StellarNativeAssetDiff { + asset: StellarAPI.StellarNativeAssetDetails; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetails | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetails | null; + } + + export interface StellarContractAssetDiff { + asset: StellarAPI.StellarAssetContractDetails; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetails | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetails | null; + } + + export interface StellarLegacyAssetExposure { + asset: StellarAPI.StellarLegacyAssetDetails; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export interface StellarNativeAssetExposure { + asset: StellarAPI.StellarNativeAssetDetails; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + } + + export interface StellarSimulationErrorSchema { + /** + * Error message + */ + error: string; + + status: 'Error'; + } + + export interface StellarValidationResult { + /** + * A textual classification that can be presented to the user explaining the + * reason. + */ + classification: string; + + /** + * A textual description about the validation result + */ + description: string; + + features: Array; + + /** + * A textual description about the reasons the transaction was flagged with + * result_type + */ + reason: string; + + /** + * Verdict of the validation + */ + result_type: 'Benign' | 'Warning' | 'Malicious'; + + status: 'Success'; + } + + export namespace StellarValidationResult { + export interface Feature { + /** + * Address the feature refers to + */ + address: string; + + /** + * Textual description + */ + description: string; + + feature_id: string; + + /** + * Feature Classification + */ + type: 'Benign' | 'Warning' | 'Malicious' | 'Info'; + } + } + + export interface StellarValidationErrorSchema { + /** + * Error message + */ + error: string; + + status: 'Error'; + } +} + Stellar.Transaction = Transaction; export declare namespace Stellar { + export { + type StellarAssetContractDetails as StellarAssetContractDetails, + type StellarAssetTransferDetails as StellarAssetTransferDetails, + type StellarLegacyAssetDetails as StellarLegacyAssetDetails, + type StellarNativeAssetDetails as StellarNativeAssetDetails, + type StellarSingleAssetExposure as StellarSingleAssetExposure, + type StellarTransactionScanRequest as StellarTransactionScanRequest, + type StellarTransactionScanResponse as StellarTransactionScanResponse, + }; + export { Transaction as Transaction, type TransactionReportResponse as TransactionReportResponse, - type TransactionScanResponse as TransactionScanResponse, type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; diff --git a/src/resources/stellar/transaction.ts b/src/resources/stellar/transaction.ts index eb81e4bd..3483f4f4 100644 --- a/src/resources/stellar/transaction.ts +++ b/src/resources/stellar/transaction.ts @@ -2,6 +2,7 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; +import * as StellarAPI from './stellar'; export class Transaction extends APIResource { /** @@ -17,1088 +18,16 @@ export class Transaction extends APIResource { /** * Scan Transaction */ - scan(body: TransactionScanParams, options?: Core.RequestOptions): Core.APIPromise { + scan( + body: TransactionScanParams, + options?: Core.RequestOptions, + ): Core.APIPromise { return this._client.post('/v0/stellar/transaction/scan', { body, ...options }); } } export type TransactionReportResponse = number; -export interface TransactionScanResponse { - /** - * Simulation result; Only present if simulation option is included in the request - */ - simulation?: - | TransactionScanResponse.StellarSimulationResponse - | TransactionScanResponse.StellarSimulationErrorSchema - | null; - - /** - * Validation result; Only present if validation option is included in the request - */ - validation?: - | TransactionScanResponse.StellarValidationResult - | TransactionScanResponse.StellarValidationErrorSchema - | null; -} - -export namespace TransactionScanResponse { - export interface StellarSimulationResponse { - /** - * Summary of the actions and asset transfers that were made by the requested - * account address - */ - account_summary: StellarSimulationResponse.AccountSummary; - - /** - * Ownership diffs of the account addresses - */ - assets_ownership_diff: Record>; - - status: 'Success'; - - /** - * Details of addresses involved in the transaction - */ - address_details?: Array; - - /** - * Mapping between the address of an account to the assets diff during the - * transaction - */ - assets_diffs?: Record< - string, - Array< - | StellarSimulationResponse.StellarLegacyAssetDiff - | StellarSimulationResponse.StellarNativeAssetDiff - | StellarSimulationResponse.StellarContractAssetDiff - > - >; - - /** - * Mapping between the address of an account to the exposure of the assets during - * the transaction - */ - exposures?: Record< - string, - Array< - | StellarSimulationResponse.StellarLegacyAssetExposure - | StellarSimulationResponse.StellarNativeAssetExposure - > - >; - } - - export namespace StellarSimulationResponse { - /** - * Summary of the actions and asset transfers that were made by the requested - * account address - */ - export interface AccountSummary { - /** - * Exposures made by the requested account address - */ - account_exposures: Array< - AccountSummary.StellarLegacyAssetExposure | AccountSummary.StellarNativeAssetExposure - >; - - /** - * Ownership diffs of the requested account address - */ - account_ownerships_diff: Array; - - /** - * Total USD diff for the requested account address - */ - total_usd_diff: AccountSummary.TotalUsdDiff; - - /** - * Assets diffs of the requested account address - */ - account_assets_diffs?: Array< - | AccountSummary.StellarLegacyAssetDiff - | AccountSummary.StellarNativeAssetDiff - | AccountSummary.StellarContractAssetDiff - >; - - /** - * Total USD exposure for each of the spender addresses during the transaction - */ - total_usd_exposure?: Record; - } - - export namespace AccountSummary { - export interface StellarLegacyAssetExposure { - asset: StellarLegacyAssetExposure.Asset; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StellarLegacyAssetExposure { - export interface Asset { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; - } - - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - - export interface StellarNativeAssetExposure { - asset: StellarNativeAssetExposure.Asset; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StellarNativeAssetExposure { - export interface Asset { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - - export interface AccountOwnershipsDiff { - /** - * List of public keys that can sign on behalf of the account post-transaction - */ - post_signers: Array; - - /** - * List of public keys that can sign on behalf of the account pre-transaction - */ - pre_signers: Array; - - type?: 'SET_OPTIONS'; - } - - /** - * Total USD diff for the requested account address - */ - export interface TotalUsdDiff { - /** - * Total incoming USD transfers - */ - in: number; - - /** - * Total outgoing USD transfers - */ - out: number; - - /** - * Total USD transfers - */ - total?: number; - } - - export interface StellarLegacyAssetDiff { - asset: StellarLegacyAssetDiff.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarLegacyAssetDiff.In | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarLegacyAssetDiff.Out | null; - } - - export namespace StellarLegacyAssetDiff { - export interface Asset { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; - } - - /** - * Details of the incoming transfer - */ - export interface In { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - - /** - * Details of the outgoing transfer - */ - export interface Out { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - - export interface StellarNativeAssetDiff { - asset: StellarNativeAssetDiff.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarNativeAssetDiff.In | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarNativeAssetDiff.Out | null; - } - - export namespace StellarNativeAssetDiff { - export interface Asset { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - - /** - * Details of the incoming transfer - */ - export interface In { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - - /** - * Details of the outgoing transfer - */ - export interface Out { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - - export interface StellarContractAssetDiff { - asset: StellarContractAssetDiff.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarContractAssetDiff.In | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarContractAssetDiff.Out | null; - } - - export namespace StellarContractAssetDiff { - export interface Asset { - /** - * Address of the asset's contract - */ - address: string; - - /** - * Asset code - */ - name: string; - - /** - * Asset symbol - */ - symbol: string; - - /** - * Type of the asset (`CONTRACT`) - */ - type?: 'CONTRACT'; - } - - /** - * Details of the incoming transfer - */ - export interface In { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - - /** - * Details of the outgoing transfer - */ - export interface Out { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - - export interface AssetsOwnershipDiff { - /** - * List of public keys that can sign on behalf of the account post-transaction - */ - post_signers: Array; - - /** - * List of public keys that can sign on behalf of the account pre-transaction - */ - pre_signers: Array; - - type?: 'SET_OPTIONS'; - } - - export interface AddressDetail { - /** - * Encoded public key of the account - */ - account_address: unknown; - - /** - * Description of the account - */ - description?: string | null; - } - - export interface StellarLegacyAssetDiff { - asset: StellarLegacyAssetDiff.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarLegacyAssetDiff.In | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarLegacyAssetDiff.Out | null; - } - - export namespace StellarLegacyAssetDiff { - export interface Asset { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; - } - - /** - * Details of the incoming transfer - */ - export interface In { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - - /** - * Details of the outgoing transfer - */ - export interface Out { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - - export interface StellarNativeAssetDiff { - asset: StellarNativeAssetDiff.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarNativeAssetDiff.In | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarNativeAssetDiff.Out | null; - } - - export namespace StellarNativeAssetDiff { - export interface Asset { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - - /** - * Details of the incoming transfer - */ - export interface In { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - - /** - * Details of the outgoing transfer - */ - export interface Out { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - - export interface StellarContractAssetDiff { - asset: StellarContractAssetDiff.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarContractAssetDiff.In | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarContractAssetDiff.Out | null; - } - - export namespace StellarContractAssetDiff { - export interface Asset { - /** - * Address of the asset's contract - */ - address: string; - - /** - * Asset code - */ - name: string; - - /** - * Asset symbol - */ - symbol: string; - - /** - * Type of the asset (`CONTRACT`) - */ - type?: 'CONTRACT'; - } - - /** - * Details of the incoming transfer - */ - export interface In { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - - /** - * Details of the outgoing transfer - */ - export interface Out { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - - export interface StellarLegacyAssetExposure { - asset: StellarLegacyAssetExposure.Asset; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StellarLegacyAssetExposure { - export interface Asset { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; - } - - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - - export interface StellarNativeAssetExposure { - asset: StellarNativeAssetExposure.Asset; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StellarNativeAssetExposure { - export interface Asset { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - } - - export interface StellarSimulationErrorSchema { - /** - * Error message - */ - error: string; - - status: 'Error'; - } - - export interface StellarValidationResult { - /** - * A textual classification that can be presented to the user explaining the - * reason. - */ - classification: string; - - /** - * A textual description about the validation result - */ - description: string; - - features: Array; - - /** - * A textual description about the reasons the transaction was flagged with - * result_type - */ - reason: string; - - /** - * Verdict of the validation - */ - result_type: 'Benign' | 'Warning' | 'Malicious'; - - status: 'Success'; - } - - export namespace StellarValidationResult { - export interface Feature { - /** - * Address the feature refers to - */ - address: string; - - /** - * Textual description - */ - description: string; - - feature_id: string; - - /** - * Feature Classification - */ - type: 'Benign' | 'Warning' | 'Malicious' | 'Info'; - } - } - - export interface StellarValidationErrorSchema { - /** - * Error message - */ - error: string; - - status: 'Error'; - } -} - export interface TransactionReportParams { details: string; @@ -1117,58 +46,10 @@ export namespace TransactionReportParams { } export interface StellarAppealTransactionDataReport { - params: StellarAppealTransactionDataReport.Params; + params: StellarAPI.StellarTransactionScanRequest; type?: 'params'; } - - export namespace StellarAppealTransactionDataReport { - export interface Params { - account_address: string; - - /** - * A CAIP-2 chain ID or a Stellar network name - */ - chain: 'pubnet' | 'futurenet' | 'testnet'; - - /** - * Metadata - */ - metadata: Params.StellarWalletRequestMetadata | Params.StellarInAppRequestMetadata; - - transaction: string; - - /** - * List of options to include in the response - * - * - `Options.validation`: Include Options.validation output in the response - * - * - `Options.simulation`: Include Options.simulation output in the response - */ - options?: Array<'validation' | 'simulation'>; - } - - export namespace Params { - 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 interface TransactionScanParams { @@ -1222,7 +103,6 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { type TransactionReportResponse as TransactionReportResponse, - type TransactionScanResponse as TransactionScanResponse, type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; From e63fddda1580e67f2befea6a772e8d40e0b2576a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:07:50 +0000 Subject: [PATCH 12/18] feat(api): api update (#316) --- .stats.yml | 4 +- api.md | 24 +- src/index.ts | 30 +- src/resources/bitcoin/bitcoin.ts | 10 +- src/resources/bitcoin/index.ts | 8 +- src/resources/bitcoin/transaction.ts | 83 -- src/resources/index.ts | 15 +- src/resources/solana/index.ts | 3 - src/resources/solana/solana.ts | 163 ++-- src/resources/starknet/index.ts | 11 +- src/resources/starknet/starknet.ts | 99 +-- src/resources/starknet/transaction.ts | 608 ++++++++------ src/resources/stellar/index.ts | 16 +- src/resources/stellar/stellar.ts | 537 +------------ src/resources/stellar/transaction.ts | 747 +++++++++++++++++- .../api-resources/bitcoin/transaction.test.ts | 23 - .../starknet/transaction.test.ts | 23 - .../api-resources/stellar/transaction.test.ts | 23 - 18 files changed, 1222 insertions(+), 1205 deletions(-) diff --git a/.stats.yml b/.stats.yml index 75064ee7..5444cd43 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 22 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-9074805d4822d26da6e3f769edeb3bb4294de7586358fa0a4901990a405ab1e9.yml +configured_endpoints: 19 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-f41ac491b9d7fa4596ebc394c2f2b22c93ad45da2dd3de08574022091afed10e.yml diff --git a/api.md b/api.md index 47f45615..d35b281b 100644 --- a/api.md +++ b/api.md @@ -101,8 +101,6 @@ Types: - DelegatedAssetDetailsSchema - FungibleMintAccountDetailsSchema - InstructionErrorDetails -- NativeDetailsSchema -- NativeDiffSchema - NativeSolOwnershipDiffSchema - NonFungibleMintAccountDetailsSchema - PdaAccountSchema @@ -113,7 +111,6 @@ Types: - SplNonFungibleTokenDetailsSchema - SplNonFungibleTokenDiffSchema - SplTokenOwnershipDiffSchema -- StakedAssetDetailsSchema - StakedSolWithdrawAuthorityDiffSchema - SuccessfulSimulationResultSchema - SystemAccountDetailsSchema @@ -139,24 +136,18 @@ Methods: Types: -- StellarAssetContractDetails -- StellarAssetTransferDetails -- StellarLegacyAssetDetails -- StellarNativeAssetDetails -- StellarSingleAssetExposure -- StellarTransactionScanRequest -- StellarTransactionScanResponse +- StellarAssetContractDetailsSchema +- StellarAssetTransferDetailsSchema ## Transaction Types: -- TransactionReportResponse +- TransactionScanResponse Methods: -- client.stellar.transaction.report({ ...params }) -> TransactionReportResponse -- client.stellar.transaction.scan({ ...params }) -> StellarTransactionScanResponse +- client.stellar.transaction.scan({ ...params }) -> TransactionScanResponse # Bitcoin @@ -164,21 +155,16 @@ Methods: Types: -- TransactionReportResponse - TransactionScanResponse Methods: -- client.bitcoin.transaction.report({ ...params }) -> TransactionReportResponse - client.bitcoin.transaction.scan({ ...params }) -> TransactionScanResponse # Starknet Types: -- StarknetAccountErc1155Exposure -- StarknetAccountErc20Exposure -- StarknetAccountErc721Exposure - StarknetErc1155Diff - StarknetErc20Diff - StarknetErc721Diff @@ -187,12 +173,10 @@ Types: Types: -- TransactionReportResponse - TransactionScanResponse Methods: -- client.starknet.transaction.report({ ...params }) -> TransactionReportResponse - client.starknet.transaction.scan({ ...params }) -> TransactionScanResponse # Site diff --git a/src/index.ts b/src/index.ts index a38a9737..0eafdf11 100644 --- a/src/index.ts +++ b/src/index.ts @@ -61,8 +61,6 @@ import { DelegatedAssetDetailsSchema, FungibleMintAccountDetailsSchema, InstructionErrorDetails, - NativeDetailsSchema, - NativeDiffSchema, NativeSolOwnershipDiffSchema, NonFungibleMintAccountDetailsSchema, PdaAccountSchema, @@ -74,7 +72,6 @@ import { SplNonFungibleTokenDetailsSchema, SplNonFungibleTokenDiffSchema, SplTokenOwnershipDiffSchema, - StakedAssetDetailsSchema, StakedSolWithdrawAuthorityDiffSchema, SuccessfulSimulationResultSchema, SystemAccountDetailsSchema, @@ -86,22 +83,14 @@ import { } from './resources/solana/solana'; import { Starknet, - StarknetAccountErc1155Exposure, - StarknetAccountErc20Exposure, - StarknetAccountErc721Exposure, StarknetErc1155Diff, StarknetErc20Diff, StarknetErc721Diff, } from './resources/starknet/starknet'; import { Stellar, - StellarAssetContractDetails, - StellarAssetTransferDetails, - StellarLegacyAssetDetails, - StellarNativeAssetDetails, - StellarSingleAssetExposure, - StellarTransactionScanRequest, - StellarTransactionScanResponse, + StellarAssetContractDetailsSchema, + StellarAssetTransferDetailsSchema, } from './resources/stellar/stellar'; const environments = { @@ -383,8 +372,6 @@ export declare namespace Blockaid { type DelegatedAssetDetailsSchema as DelegatedAssetDetailsSchema, type FungibleMintAccountDetailsSchema as FungibleMintAccountDetailsSchema, type InstructionErrorDetails as InstructionErrorDetails, - type NativeDetailsSchema as NativeDetailsSchema, - type NativeDiffSchema as NativeDiffSchema, type NativeSolOwnershipDiffSchema as NativeSolOwnershipDiffSchema, type NonFungibleMintAccountDetailsSchema as NonFungibleMintAccountDetailsSchema, type PdaAccountSchema as PdaAccountSchema, @@ -395,7 +382,6 @@ export declare namespace Blockaid { type SplNonFungibleTokenDetailsSchema as SplNonFungibleTokenDetailsSchema, type SplNonFungibleTokenDiffSchema as SplNonFungibleTokenDiffSchema, type SplTokenOwnershipDiffSchema as SplTokenOwnershipDiffSchema, - type StakedAssetDetailsSchema as StakedAssetDetailsSchema, type StakedSolWithdrawAuthorityDiffSchema as StakedSolWithdrawAuthorityDiffSchema, type SuccessfulSimulationResultSchema as SuccessfulSimulationResultSchema, type SystemAccountDetailsSchema as SystemAccountDetailsSchema, @@ -408,22 +394,14 @@ export declare namespace Blockaid { export { Stellar as Stellar, - type StellarAssetContractDetails as StellarAssetContractDetails, - type StellarAssetTransferDetails as StellarAssetTransferDetails, - type StellarLegacyAssetDetails as StellarLegacyAssetDetails, - type StellarNativeAssetDetails as StellarNativeAssetDetails, - type StellarSingleAssetExposure as StellarSingleAssetExposure, - type StellarTransactionScanRequest as StellarTransactionScanRequest, - type StellarTransactionScanResponse as StellarTransactionScanResponse, + type StellarAssetContractDetailsSchema as StellarAssetContractDetailsSchema, + type StellarAssetTransferDetailsSchema as StellarAssetTransferDetailsSchema, }; export { Bitcoin as Bitcoin }; export { Starknet as Starknet, - type StarknetAccountErc1155Exposure as StarknetAccountErc1155Exposure, - type StarknetAccountErc20Exposure as StarknetAccountErc20Exposure, - type StarknetAccountErc721Exposure as StarknetAccountErc721Exposure, type StarknetErc1155Diff as StarknetErc1155Diff, type StarknetErc20Diff as StarknetErc20Diff, type StarknetErc721Diff as StarknetErc721Diff, diff --git a/src/resources/bitcoin/bitcoin.ts b/src/resources/bitcoin/bitcoin.ts index e77dbbcd..e6ba4f57 100644 --- a/src/resources/bitcoin/bitcoin.ts +++ b/src/resources/bitcoin/bitcoin.ts @@ -2,13 +2,7 @@ import { APIResource } from '../../resource'; import * as TransactionAPI from './transaction'; -import { - Transaction, - TransactionReportParams, - TransactionReportResponse, - TransactionScanParams, - TransactionScanResponse, -} from './transaction'; +import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; export class Bitcoin extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); @@ -19,9 +13,7 @@ Bitcoin.Transaction = Transaction; export declare namespace Bitcoin { export { Transaction as Transaction, - type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, - type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/bitcoin/index.ts b/src/resources/bitcoin/index.ts index e259b401..5692cbb7 100644 --- a/src/resources/bitcoin/index.ts +++ b/src/resources/bitcoin/index.ts @@ -1,10 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Bitcoin } from './bitcoin'; -export { - Transaction, - type TransactionReportResponse, - type TransactionScanResponse, - type TransactionReportParams, - type TransactionScanParams, -} from './transaction'; +export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; diff --git a/src/resources/bitcoin/transaction.ts b/src/resources/bitcoin/transaction.ts index 7054426e..09d0ba87 100644 --- a/src/resources/bitcoin/transaction.ts +++ b/src/resources/bitcoin/transaction.ts @@ -4,16 +4,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; export class Transaction extends APIResource { - /** - * Report Transaction - */ - report( - body: TransactionReportParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post('/v0/bitcoin/transaction/report', { body, ...options }); - } - /** * Scan Transaction */ @@ -22,8 +12,6 @@ export class Transaction extends APIResource { } } -export type TransactionReportResponse = number; - export interface TransactionScanResponse { /** * Simulation result; Only present if simulation option is included in the request @@ -453,75 +441,6 @@ export namespace TransactionScanResponse { } } -export interface TransactionReportParams { - details: string; - - event: 'should_be_malicious' | 'should_be_benign'; - - report: - | TransactionReportParams.BitcoinAppealRequestID - | TransactionReportParams.BitcoinAppealTransactionDataReport; -} - -export namespace TransactionReportParams { - export interface BitcoinAppealRequestID { - id: string; - - type?: 'request_id'; - } - - export interface BitcoinAppealTransactionDataReport { - params: BitcoinAppealTransactionDataReport.Params; - - type?: 'params'; - } - - export namespace BitcoinAppealTransactionDataReport { - export interface Params { - account_address: string; - - chain: 'bitcoin'; - - /** - * Metadata - */ - metadata: Params.BitcoinWalletRequestMetadata | Params.BitcoinInAppRequestMetadata; - - transaction: string; - - /** - * List of options to include in the response - * - * - `Options.validation`: Include Options.validation output in the response - * - * - `Options.simulation`: Include Options.simulation output in the response - */ - options?: Array<'validation' | 'simulation'>; - } - - export namespace Params { - export interface BitcoinWalletRequestMetadata { - /** - * Metadata for wallet requests - */ - type: 'wallet'; - - /** - * URL of the dApp originating the transaction - */ - url: string; - } - - export interface BitcoinInAppRequestMetadata { - /** - * Metadata for in-app requests - */ - type?: 'in_app'; - } - } - } -} - export interface TransactionScanParams { account_address: string; @@ -569,9 +488,7 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { - type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, - type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/index.ts b/src/resources/index.ts index 6b87458c..8beaaa19 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -49,8 +49,6 @@ export { type DelegatedAssetDetailsSchema, type FungibleMintAccountDetailsSchema, type InstructionErrorDetails, - type NativeDetailsSchema, - type NativeDiffSchema, type NativeSolOwnershipDiffSchema, type NonFungibleMintAccountDetailsSchema, type PdaAccountSchema, @@ -61,7 +59,6 @@ export { type SplNonFungibleTokenDetailsSchema, type SplNonFungibleTokenDiffSchema, type SplTokenOwnershipDiffSchema, - type StakedAssetDetailsSchema, type StakedSolWithdrawAuthorityDiffSchema, type SuccessfulSimulationResultSchema, type SystemAccountDetailsSchema, @@ -73,22 +70,14 @@ export { } from './solana/solana'; export { Starknet, - type StarknetAccountErc1155Exposure, - type StarknetAccountErc20Exposure, - type StarknetAccountErc721Exposure, type StarknetErc1155Diff, type StarknetErc20Diff, type StarknetErc721Diff, } from './starknet/starknet'; export { Stellar, - type StellarAssetContractDetails, - type StellarAssetTransferDetails, - type StellarLegacyAssetDetails, - type StellarNativeAssetDetails, - type StellarSingleAssetExposure, - type StellarTransactionScanRequest, - type StellarTransactionScanResponse, + type StellarAssetContractDetailsSchema, + type StellarAssetTransferDetailsSchema, } from './stellar/stellar'; export { Token, diff --git a/src/resources/solana/index.ts b/src/resources/solana/index.ts index 79328d37..34d17466 100644 --- a/src/resources/solana/index.ts +++ b/src/resources/solana/index.ts @@ -16,8 +16,6 @@ export { type DelegatedAssetDetailsSchema, type FungibleMintAccountDetailsSchema, type InstructionErrorDetails, - type NativeDetailsSchema, - type NativeDiffSchema, type NativeSolOwnershipDiffSchema, type NonFungibleMintAccountDetailsSchema, type PdaAccountSchema, @@ -28,7 +26,6 @@ export { type SplNonFungibleTokenDetailsSchema, type SplNonFungibleTokenDiffSchema, type SplTokenOwnershipDiffSchema, - type StakedAssetDetailsSchema, type StakedSolWithdrawAuthorityDiffSchema, type SuccessfulSimulationResultSchema, type SystemAccountDetailsSchema, diff --git a/src/resources/solana/solana.ts b/src/resources/solana/solana.ts index 964b6e33..4530f483 100644 --- a/src/resources/solana/solana.ts +++ b/src/resources/solana/solana.ts @@ -22,7 +22,10 @@ export interface AccountSummarySchema { * Assets diff of the requested account address */ account_assets_diff?: Array< - NativeDiffSchema | SplFungibleTokenDiffSchema | SplNonFungibleTokenDiffSchema | CnftDiffSchema + | AccountSummarySchema.NativeDiffSchema + | SplFungibleTokenDiffSchema + | SplNonFungibleTokenDiffSchema + | CnftDiffSchema >; /** @@ -38,6 +41,40 @@ export interface AccountSummarySchema { >; } +export namespace AccountSummarySchema { + export interface NativeDiffSchema { + asset: NativeDiffSchema.Asset; + + /** + * Type of the asset involved in the transfer + */ + asset_type: string; + + /** + * Incoming transfers of the asset + */ + in?: SolanaAPI.AssetTransferDetailsSchema | null; + + out?: SolanaAPI.AssetTransferDetailsSchema | null; + } + + export namespace NativeDiffSchema { + export interface Asset { + decimals?: number; + + /** + * Logo of the native currency + */ + logo?: string | null; + + /** + * Type of the asset (`"NativeToken"`) + */ + type?: string; + } + } +} + export interface AddressScanRequestSchema { /** * Encoded public key @@ -324,38 +361,8 @@ export interface InstructionErrorDetails { type?: string; } -export interface NativeDetailsSchema { - decimals?: number; - - /** - * Logo of the native currency - */ - logo?: string | null; - - /** - * Type of the asset (`"NativeToken"`) - */ - type?: string; -} - -export interface NativeDiffSchema { - asset: NativeDetailsSchema; - - /** - * Type of the asset involved in the transfer - */ - asset_type: string; - - /** - * Incoming transfers of the asset - */ - in?: AssetTransferDetailsSchema | null; - - out?: AssetTransferDetailsSchema | null; -} - export interface NativeSolOwnershipDiffSchema { - asset: NativeDetailsSchema; + asset: NativeSolOwnershipDiffSchema.Asset; /** * Type of the asset involved in the transfer @@ -383,6 +390,22 @@ export interface NativeSolOwnershipDiffSchema { pre_owner?: string | null; } +export namespace NativeSolOwnershipDiffSchema { + export interface Asset { + decimals?: number; + + /** + * Logo of the native currency + */ + logo?: string | null; + + /** + * Type of the asset (`"NativeToken"`) + */ + type?: string; + } +} + export interface NonFungibleMintAccountDetailsSchema { /** * Encoded public key of the account @@ -592,20 +615,6 @@ export interface SplTokenOwnershipDiffSchema { pre_owner?: string | null; } -export interface StakedAssetDetailsSchema { - decimals?: number; - - /** - * Logo of the native currency - */ - logo?: string | null; - - /** - * Type of the asset (`"STAKED_NATIVE"`) - */ - type?: string; -} - export interface StakedSolWithdrawAuthorityDiffSchema { /** * Type of the asset involved in the transfer @@ -617,7 +626,7 @@ export interface StakedSolWithdrawAuthorityDiffSchema { */ post_owner: string; - asset?: StakedAssetDetailsSchema; + asset?: StakedSolWithdrawAuthorityDiffSchema.Asset; /** * Incoming transfers of the asset @@ -635,6 +644,22 @@ export interface StakedSolWithdrawAuthorityDiffSchema { pre_owner?: string | null; } +export namespace StakedSolWithdrawAuthorityDiffSchema { + export interface Asset { + decimals?: number; + + /** + * Logo of the native currency + */ + logo?: string | null; + + /** + * Type of the asset (`"STAKED_NATIVE"`) + */ + type?: string; + } +} + export interface SuccessfulSimulationResultSchema { /** * Summary of the requested account address @@ -659,7 +684,12 @@ export interface SuccessfulSimulationResultSchema { */ assets_diff: Record< string, - Array + Array< + | SuccessfulSimulationResultSchema.NativeDiffSchema + | SplFungibleTokenDiffSchema + | SplNonFungibleTokenDiffSchema + | CnftDiffSchema + > >; /** @@ -676,6 +706,40 @@ export interface SuccessfulSimulationResultSchema { delegations: Record>; } +export namespace SuccessfulSimulationResultSchema { + export interface NativeDiffSchema { + asset: NativeDiffSchema.Asset; + + /** + * Type of the asset involved in the transfer + */ + asset_type: string; + + /** + * Incoming transfers of the asset + */ + in?: SolanaAPI.AssetTransferDetailsSchema | null; + + out?: SolanaAPI.AssetTransferDetailsSchema | null; + } + + export namespace NativeDiffSchema { + export interface Asset { + decimals?: number; + + /** + * Logo of the native currency + */ + logo?: string | null; + + /** + * Type of the asset (`"NativeToken"`) + */ + type?: string; + } + } +} + export interface SystemAccountDetailsSchema { /** * Encoded public key of the account @@ -844,8 +908,6 @@ export declare namespace Solana { type DelegatedAssetDetailsSchema as DelegatedAssetDetailsSchema, type FungibleMintAccountDetailsSchema as FungibleMintAccountDetailsSchema, type InstructionErrorDetails as InstructionErrorDetails, - type NativeDetailsSchema as NativeDetailsSchema, - type NativeDiffSchema as NativeDiffSchema, type NativeSolOwnershipDiffSchema as NativeSolOwnershipDiffSchema, type NonFungibleMintAccountDetailsSchema as NonFungibleMintAccountDetailsSchema, type PdaAccountSchema as PdaAccountSchema, @@ -856,7 +918,6 @@ export declare namespace Solana { type SplNonFungibleTokenDetailsSchema as SplNonFungibleTokenDetailsSchema, type SplNonFungibleTokenDiffSchema as SplNonFungibleTokenDiffSchema, type SplTokenOwnershipDiffSchema as SplTokenOwnershipDiffSchema, - type StakedAssetDetailsSchema as StakedAssetDetailsSchema, type StakedSolWithdrawAuthorityDiffSchema as StakedSolWithdrawAuthorityDiffSchema, type SuccessfulSimulationResultSchema as SuccessfulSimulationResultSchema, type SystemAccountDetailsSchema as SystemAccountDetailsSchema, diff --git a/src/resources/starknet/index.ts b/src/resources/starknet/index.ts index 0ae73f0e..40596a5a 100644 --- a/src/resources/starknet/index.ts +++ b/src/resources/starknet/index.ts @@ -2,17 +2,8 @@ export { Starknet, - type StarknetAccountErc1155Exposure, - type StarknetAccountErc20Exposure, - type StarknetAccountErc721Exposure, type StarknetErc1155Diff, type StarknetErc20Diff, type StarknetErc721Diff, } from './starknet'; -export { - Transaction, - type TransactionReportResponse, - type TransactionScanResponse, - type TransactionReportParams, - type TransactionScanParams, -} from './transaction'; +export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; diff --git a/src/resources/starknet/starknet.ts b/src/resources/starknet/starknet.ts index df3eb584..a3a33651 100644 --- a/src/resources/starknet/starknet.ts +++ b/src/resources/starknet/starknet.ts @@ -2,104 +2,12 @@ import { APIResource } from '../../resource'; import * as TransactionAPI from './transaction'; -import { - Transaction, - TransactionReportParams, - TransactionReportResponse, - TransactionScanParams, - TransactionScanResponse, -} from './transaction'; +import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; export class Starknet extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); } -export interface StarknetAccountErc1155Exposure { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC1155`) - */ - type?: 'ERC1155'; -} - -export interface StarknetAccountErc20Exposure { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's decimals - */ - decimals: number; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC20`) - */ - type?: 'ERC20'; -} - -export interface StarknetAccountErc721Exposure { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC721`) - */ - type?: 'ERC721'; -} - export interface StarknetErc1155Diff { /** * Token ID of the transfer @@ -165,9 +73,6 @@ Starknet.Transaction = Transaction; export declare namespace Starknet { export { - type StarknetAccountErc1155Exposure as StarknetAccountErc1155Exposure, - type StarknetAccountErc20Exposure as StarknetAccountErc20Exposure, - type StarknetAccountErc721Exposure as StarknetAccountErc721Exposure, type StarknetErc1155Diff as StarknetErc1155Diff, type StarknetErc20Diff as StarknetErc20Diff, type StarknetErc721Diff as StarknetErc721Diff, @@ -175,9 +80,7 @@ export declare namespace Starknet { export { Transaction as Transaction, - type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, - type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/starknet/transaction.ts b/src/resources/starknet/transaction.ts index 4d5fe97b..6b2a999b 100644 --- a/src/resources/starknet/transaction.ts +++ b/src/resources/starknet/transaction.ts @@ -5,16 +5,6 @@ import * as Core from '../../core'; import * as StarknetAPI from './starknet'; export class Transaction extends APIResource { - /** - * Report Transaction - */ - report( - body: TransactionReportParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post('/v0/starknet/transaction/report', { body, ...options }); - } - /** * Scan Transactions */ @@ -23,8 +13,6 @@ export class Transaction extends APIResource { } } -export type TransactionReportResponse = number; - export interface TransactionScanResponse { /** * Simulation result; Only present if simulation option is included in the request @@ -127,7 +115,7 @@ export namespace TransactionScanResponse { export namespace AccountSummary { export interface StarknetErc20Exposure { - asset: StarknetAPI.StarknetAccountErc20Exposure; + asset: StarknetErc20Exposure.Asset; /** * Mapping between the spender address and the exposure of the asset @@ -136,6 +124,38 @@ export namespace TransactionScanResponse { } export namespace StarknetErc20Exposure { + export interface Asset { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's decimals + */ + decimals: number; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC20`) + */ + type?: 'ERC20'; + } + export interface Spenders { /** * Approval value of the ERC20 token @@ -157,7 +177,7 @@ export namespace TransactionScanResponse { } export interface StarknetErc721Exposure { - asset: StarknetAPI.StarknetAccountErc721Exposure; + asset: StarknetErc721Exposure.Asset; /** * Mapping between the spender address and the exposure of the asset @@ -166,6 +186,33 @@ export namespace TransactionScanResponse { } export namespace StarknetErc721Exposure { + export interface Asset { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC721`) + */ + type?: 'ERC721'; + } + export interface Spenders { exposure: Array; @@ -182,7 +229,7 @@ export namespace TransactionScanResponse { } export interface StarknetErc1155Exposure { - asset: StarknetAPI.StarknetAccountErc1155Exposure; + asset: StarknetErc1155Exposure.Asset; /** * Mapping between the spender address and the exposure of the asset @@ -191,6 +238,33 @@ export namespace TransactionScanResponse { } export namespace StarknetErc1155Exposure { + export interface Asset { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC1155`) + */ + type?: 'ERC1155'; + } + export interface Spenders { exposure: Array; @@ -227,7 +301,7 @@ export namespace TransactionScanResponse { } export interface StarknetErc20AssetDiff { - asset: StarknetAPI.StarknetAccountErc20Exposure; + asset: StarknetErc20AssetDiff.Asset; /** * The type of the assets in this diff @@ -245,8 +319,42 @@ export namespace TransactionScanResponse { out?: StarknetAPI.StarknetErc20Diff | null; } + export namespace StarknetErc20AssetDiff { + export interface Asset { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's decimals + */ + decimals: number; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC20`) + */ + type?: 'ERC20'; + } + } + export interface StarknetErc721AssetDiff { - asset: StarknetAPI.StarknetAccountErc721Exposure; + asset: StarknetErc721AssetDiff.Asset; /** * The type of the assets in this diff @@ -264,8 +372,37 @@ export namespace TransactionScanResponse { out?: StarknetAPI.StarknetErc721Diff | null; } + export namespace StarknetErc721AssetDiff { + export interface Asset { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC721`) + */ + type?: 'ERC721'; + } + } + export interface StarknetErc1155AssetDiff { - asset: StarknetAPI.StarknetAccountErc1155Exposure; + asset: StarknetErc1155AssetDiff.Asset; /** * The type of the assets in this diff @@ -282,6 +419,35 @@ export namespace TransactionScanResponse { */ out?: StarknetAPI.StarknetErc1155Diff | null; } + + export namespace StarknetErc1155AssetDiff { + export interface Asset { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC1155`) + */ + type?: 'ERC1155'; + } + } } export interface AddressDetail { @@ -297,7 +463,7 @@ export namespace TransactionScanResponse { } export interface StarknetErc20AssetDiff { - asset: StarknetAPI.StarknetAccountErc20Exposure; + asset: StarknetErc20AssetDiff.Asset; /** * The type of the assets in this diff @@ -315,8 +481,42 @@ export namespace TransactionScanResponse { out?: StarknetAPI.StarknetErc20Diff | null; } + export namespace StarknetErc20AssetDiff { + export interface Asset { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's decimals + */ + decimals: number; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC20`) + */ + type?: 'ERC20'; + } + } + export interface StarknetErc721AssetDiff { - asset: StarknetAPI.StarknetAccountErc721Exposure; + asset: StarknetErc721AssetDiff.Asset; /** * The type of the assets in this diff @@ -334,8 +534,37 @@ export namespace TransactionScanResponse { out?: StarknetAPI.StarknetErc721Diff | null; } + export namespace StarknetErc721AssetDiff { + export interface Asset { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC721`) + */ + type?: 'ERC721'; + } + } + export interface StarknetErc1155AssetDiff { - asset: StarknetAPI.StarknetAccountErc1155Exposure; + asset: StarknetErc1155AssetDiff.Asset; /** * The type of the assets in this diff @@ -353,8 +582,37 @@ export namespace TransactionScanResponse { out?: StarknetAPI.StarknetErc1155Diff | null; } + export namespace StarknetErc1155AssetDiff { + export interface Asset { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC1155`) + */ + type?: 'ERC1155'; + } + } + export interface StarknetErc20Exposure { - asset: StarknetAPI.StarknetAccountErc20Exposure; + asset: StarknetErc20Exposure.Asset; /** * Mapping between the spender address and the exposure of the asset @@ -363,6 +621,38 @@ export namespace TransactionScanResponse { } export namespace StarknetErc20Exposure { + export interface Asset { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's decimals + */ + decimals: number; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC20`) + */ + type?: 'ERC20'; + } + export interface Spenders { /** * Approval value of the ERC20 token @@ -384,7 +674,7 @@ export namespace TransactionScanResponse { } export interface StarknetErc721Exposure { - asset: StarknetAPI.StarknetAccountErc721Exposure; + asset: StarknetErc721Exposure.Asset; /** * Mapping between the spender address and the exposure of the asset @@ -393,6 +683,33 @@ export namespace TransactionScanResponse { } export namespace StarknetErc721Exposure { + export interface Asset { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC721`) + */ + type?: 'ERC721'; + } + export interface Spenders { exposure: Array; @@ -409,7 +726,7 @@ export namespace TransactionScanResponse { } export interface StarknetErc1155Exposure { - asset: StarknetAPI.StarknetAccountErc1155Exposure; + asset: StarknetErc1155Exposure.Asset; /** * Mapping between the spender address and the exposure of the asset @@ -418,6 +735,33 @@ export namespace TransactionScanResponse { } export namespace StarknetErc1155Exposure { + export interface Asset { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC1155`) + */ + type?: 'ERC1155'; + } + export interface Spenders { exposure: Array; @@ -502,220 +846,6 @@ export namespace TransactionScanResponse { } } -export interface TransactionReportParams { - details: string; - - event: 'should_be_malicious' | 'should_be_benign'; - - report: - | TransactionReportParams.StarknetAppealRequestID - | TransactionReportParams.StarknetAppealTransactionDataReport; -} - -export namespace TransactionReportParams { - export interface StarknetAppealRequestID { - id: string; - - type?: 'request_id'; - } - - export interface StarknetAppealTransactionDataReport { - params: StarknetAppealTransactionDataReport.Params; - - type?: 'params'; - } - - export namespace StarknetAppealTransactionDataReport { - export interface Params { - account_address: string; - - /** - * The chain name or chain ID - */ - chain: 'mainnet' | 'sepolia' | 'sepolia_integration' | (string & {}); - - /** - * Metadata - */ - metadata: Params.StarknetWalletRequestMetadata | Params.StarknetInAppRequestMetadata; - - transaction: - | Params.StarknetInvokeV1TransactionSchema - | Params.StarknetInvokeV3TransactionSchema - | Params.StarknetDeployAccountV1TransactionSchema - | Params.StarknetDeployAccountV3TransactionSchema; - - /** - * Optional block number or tag context for the simulation - */ - block_number?: string | null; - - /** - * List of options to include in the response - * - * - `Options.validation`: Include Options.validation output in the response - * - * - `Options.simulation`: Include Options.simulation output in the response - */ - options?: Array<'validation' | 'simulation'>; - } - - export namespace Params { - export interface StarknetWalletRequestMetadata { - /** - * Metadata for wallet requests - */ - type: 'wallet'; - - /** - * URL of the dApp originating the transaction - */ - url: string; - } - - export interface StarknetInAppRequestMetadata { - /** - * Metadata for in-app requests - */ - type?: 'in_app'; - } - - export interface StarknetInvokeV1TransactionSchema { - /** - * The maximum fee that the sender is willing to pay. - */ - max_fee: string; - - /** - * The nonce of the transaction. - */ - nonce: string; - - /** - * The address of the sender. - */ - sender_address: string; - - /** - * The version of the transaction. - */ - version: 1; - - /** - * The arguments that are passed to the validate and execute functions. - */ - calldata?: Array; - } - - export interface StarknetInvokeV3TransactionSchema { - /** - * The arguments that are passed to the validate and execute functions. - */ - calldata: Array; - - /** - * The id of the chain to which the transaction is sent. - */ - chain_id: string; - - /** - * The nonce of the transaction. - */ - nonce: string; - - /** - * The address of the sender. - */ - sender_address: string; - - /** - * The version of the transaction. - */ - version: 3; - - /** - * For future use. Currently this value is always empty. - */ - account_deployment_data?: Array; - - /** - * The nonce data availability mode. - */ - nonce_data_availability_mode?: 0; - - /** - * For future use. Currently this value is always empty. - */ - paymaster_data?: Array; - } - - export interface StarknetDeployAccountV1TransactionSchema { - /** - * The hash of the contract class. - */ - class_hash: string; - - /** - * The arguments that are passed to the constructor function. - */ - constructor_calldata: Array; - - /** - * The salt of the contract address. - */ - contract_address_salt: string; - - /** - * The maximum fee that the sender is willing to pay. - */ - max_fee: string; - - /** - * The nonce of the transaction. - */ - nonce: string; - - /** - * The version of the transaction. - */ - version: 1; - } - - export interface StarknetDeployAccountV3TransactionSchema { - /** - * The hash of the contract class. - */ - class_hash: string; - - /** - * The arguments that are passed to the constructor function. - */ - constructor_calldata: Array; - - /** - * The salt of the contract address. - */ - contract_address_salt: string; - - /** - * The maximum fee that the sender is willing to pay. - */ - max_fee: string; - - /** - * The nonce of the transaction. - */ - nonce: string; - - /** - * The version of the transaction. - */ - version: 3; - } - } - } -} - export interface TransactionScanParams { account_address: string; @@ -908,9 +1038,7 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { - type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, - type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/stellar/index.ts b/src/resources/stellar/index.ts index 800a3094..80722a0c 100644 --- a/src/resources/stellar/index.ts +++ b/src/resources/stellar/index.ts @@ -2,17 +2,7 @@ export { Stellar, - type StellarAssetContractDetails, - type StellarAssetTransferDetails, - type StellarLegacyAssetDetails, - type StellarNativeAssetDetails, - type StellarSingleAssetExposure, - type StellarTransactionScanRequest, - type StellarTransactionScanResponse, + type StellarAssetContractDetailsSchema, + type StellarAssetTransferDetailsSchema, } from './stellar'; -export { - Transaction, - type TransactionReportResponse, - type TransactionReportParams, - type TransactionScanParams, -} from './transaction'; +export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; diff --git a/src/resources/stellar/stellar.ts b/src/resources/stellar/stellar.ts index 219a2613..497d7ee5 100644 --- a/src/resources/stellar/stellar.ts +++ b/src/resources/stellar/stellar.ts @@ -1,20 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as StellarAPI from './stellar'; import * as TransactionAPI from './transaction'; -import { - Transaction, - TransactionReportParams, - TransactionReportResponse, - TransactionScanParams, -} from './transaction'; +import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; export class Stellar extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); } -export interface StellarAssetContractDetails { +export interface StellarAssetContractDetailsSchema { /** * Address of the asset's contract */ @@ -36,7 +30,7 @@ export interface StellarAssetContractDetails { type?: 'CONTRACT'; } -export interface StellarAssetTransferDetails { +export interface StellarAssetTransferDetailsSchema { /** * Raw value of the transfer */ @@ -58,536 +52,17 @@ export interface StellarAssetTransferDetails { summary?: string | null; } -export interface StellarLegacyAssetDetails { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; -} - -export interface StellarNativeAssetDetails { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; -} - -export interface StellarSingleAssetExposure { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; -} - -export namespace StellarSingleAssetExposure { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } -} - -export interface StellarTransactionScanRequest { - account_address: string; - - /** - * A CAIP-2 chain ID or a Stellar network name - */ - chain: 'pubnet' | 'futurenet' | 'testnet'; - - /** - * Metadata - */ - metadata: - | StellarTransactionScanRequest.StellarWalletRequestMetadata - | StellarTransactionScanRequest.StellarInAppRequestMetadata; - - transaction: string; - - /** - * List of options to include in the response - * - * - `Options.validation`: Include Options.validation output in the response - * - * - `Options.simulation`: Include Options.simulation output in the response - */ - options?: Array<'validation' | 'simulation'>; -} - -export namespace StellarTransactionScanRequest { - 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 interface StellarTransactionScanResponse { - /** - * Simulation result; Only present if simulation option is included in the request - */ - simulation?: - | StellarTransactionScanResponse.StellarSimulationResponse - | StellarTransactionScanResponse.StellarSimulationErrorSchema - | null; - - /** - * Validation result; Only present if validation option is included in the request - */ - validation?: - | StellarTransactionScanResponse.StellarValidationResult - | StellarTransactionScanResponse.StellarValidationErrorSchema - | null; -} - -export namespace StellarTransactionScanResponse { - export interface StellarSimulationResponse { - /** - * Summary of the actions and asset transfers that were made by the requested - * account address - */ - account_summary: StellarSimulationResponse.AccountSummary; - - /** - * Ownership diffs of the account addresses - */ - assets_ownership_diff: Record>; - - status: 'Success'; - - /** - * Details of addresses involved in the transaction - */ - address_details?: Array; - - /** - * Mapping between the address of an account to the assets diff during the - * transaction - */ - assets_diffs?: Record< - string, - Array< - | StellarSimulationResponse.StellarLegacyAssetDiff - | StellarSimulationResponse.StellarNativeAssetDiff - | StellarSimulationResponse.StellarContractAssetDiff - > - >; - - /** - * Mapping between the address of an account to the exposure of the assets during - * the transaction - */ - exposures?: Record< - string, - Array< - | StellarSimulationResponse.StellarLegacyAssetExposure - | StellarSimulationResponse.StellarNativeAssetExposure - > - >; - } - - export namespace StellarSimulationResponse { - /** - * Summary of the actions and asset transfers that were made by the requested - * account address - */ - export interface AccountSummary { - /** - * Exposures made by the requested account address - */ - account_exposures: Array< - AccountSummary.StellarLegacyAssetExposure | AccountSummary.StellarNativeAssetExposure - >; - - /** - * Ownership diffs of the requested account address - */ - account_ownerships_diff: Array; - - /** - * Total USD diff for the requested account address - */ - total_usd_diff: AccountSummary.TotalUsdDiff; - - /** - * Assets diffs of the requested account address - */ - account_assets_diffs?: Array< - | AccountSummary.StellarLegacyAssetDiff - | AccountSummary.StellarNativeAssetDiff - | AccountSummary.StellarContractAssetDiff - >; - - /** - * Total USD exposure for each of the spender addresses during the transaction - */ - total_usd_exposure?: Record; - } - - export namespace AccountSummary { - export interface StellarLegacyAssetExposure { - asset: StellarAPI.StellarLegacyAssetDetails; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export interface StellarNativeAssetExposure { - asset: StellarAPI.StellarNativeAssetDetails; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export interface AccountOwnershipsDiff { - /** - * List of public keys that can sign on behalf of the account post-transaction - */ - post_signers: Array; - - /** - * List of public keys that can sign on behalf of the account pre-transaction - */ - pre_signers: Array; - - type?: 'SET_OPTIONS'; - } - - /** - * Total USD diff for the requested account address - */ - export interface TotalUsdDiff { - /** - * Total incoming USD transfers - */ - in: number; - - /** - * Total outgoing USD transfers - */ - out: number; - - /** - * Total USD transfers - */ - total?: number; - } - - export interface StellarLegacyAssetDiff { - asset: StellarAPI.StellarLegacyAssetDetails; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetails | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetails | null; - } - - export interface StellarNativeAssetDiff { - asset: StellarAPI.StellarNativeAssetDetails; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetails | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetails | null; - } - - export interface StellarContractAssetDiff { - asset: StellarAPI.StellarAssetContractDetails; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetails | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetails | null; - } - } - - export interface AssetsOwnershipDiff { - /** - * List of public keys that can sign on behalf of the account post-transaction - */ - post_signers: Array; - - /** - * List of public keys that can sign on behalf of the account pre-transaction - */ - pre_signers: Array; - - type?: 'SET_OPTIONS'; - } - - export interface AddressDetail { - /** - * Encoded public key of the account - */ - account_address: unknown; - - /** - * Description of the account - */ - description?: string | null; - } - - export interface StellarLegacyAssetDiff { - asset: StellarAPI.StellarLegacyAssetDetails; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetails | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetails | null; - } - - export interface StellarNativeAssetDiff { - asset: StellarAPI.StellarNativeAssetDetails; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetails | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetails | null; - } - - export interface StellarContractAssetDiff { - asset: StellarAPI.StellarAssetContractDetails; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetails | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetails | null; - } - - export interface StellarLegacyAssetExposure { - asset: StellarAPI.StellarLegacyAssetDetails; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export interface StellarNativeAssetExposure { - asset: StellarAPI.StellarNativeAssetDetails; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - } - - export interface StellarSimulationErrorSchema { - /** - * Error message - */ - error: string; - - status: 'Error'; - } - - export interface StellarValidationResult { - /** - * A textual classification that can be presented to the user explaining the - * reason. - */ - classification: string; - - /** - * A textual description about the validation result - */ - description: string; - - features: Array; - - /** - * A textual description about the reasons the transaction was flagged with - * result_type - */ - reason: string; - - /** - * Verdict of the validation - */ - result_type: 'Benign' | 'Warning' | 'Malicious'; - - status: 'Success'; - } - - export namespace StellarValidationResult { - export interface Feature { - /** - * Address the feature refers to - */ - address: string; - - /** - * Textual description - */ - description: string; - - feature_id: string; - - /** - * Feature Classification - */ - type: 'Benign' | 'Warning' | 'Malicious' | 'Info'; - } - } - - export interface StellarValidationErrorSchema { - /** - * Error message - */ - error: string; - - status: 'Error'; - } -} - Stellar.Transaction = Transaction; export declare namespace Stellar { export { - type StellarAssetContractDetails as StellarAssetContractDetails, - type StellarAssetTransferDetails as StellarAssetTransferDetails, - type StellarLegacyAssetDetails as StellarLegacyAssetDetails, - type StellarNativeAssetDetails as StellarNativeAssetDetails, - type StellarSingleAssetExposure as StellarSingleAssetExposure, - type StellarTransactionScanRequest as StellarTransactionScanRequest, - type StellarTransactionScanResponse as StellarTransactionScanResponse, + type StellarAssetContractDetailsSchema as StellarAssetContractDetailsSchema, + type StellarAssetTransferDetailsSchema as StellarAssetTransferDetailsSchema, }; export { Transaction as Transaction, - type TransactionReportResponse as TransactionReportResponse, - type TransactionReportParams as TransactionReportParams, + type TransactionScanResponse as TransactionScanResponse, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/stellar/transaction.ts b/src/resources/stellar/transaction.ts index 3483f4f4..d297eacc 100644 --- a/src/resources/stellar/transaction.ts +++ b/src/resources/stellar/transaction.ts @@ -6,49 +6,737 @@ import * as StellarAPI from './stellar'; export class Transaction extends APIResource { /** - * Report Transaction + * Scan Transaction */ - report( - body: TransactionReportParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post('/v0/stellar/transaction/report', { body, ...options }); + scan(body: TransactionScanParams, options?: Core.RequestOptions): Core.APIPromise { + return this._client.post('/v0/stellar/transaction/scan', { body, ...options }); } +} +export interface TransactionScanResponse { /** - * Scan Transaction + * Simulation result; Only present if simulation option is included in the request */ - scan( - body: TransactionScanParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post('/v0/stellar/transaction/scan', { body, ...options }); - } + simulation?: + | TransactionScanResponse.StellarSimulationResponse + | TransactionScanResponse.StellarSimulationErrorSchema + | null; + + /** + * Validation result; Only present if validation option is included in the request + */ + validation?: + | TransactionScanResponse.StellarValidationResult + | TransactionScanResponse.StellarValidationErrorSchema + | null; } -export type TransactionReportResponse = number; +export namespace TransactionScanResponse { + export interface StellarSimulationResponse { + /** + * Summary of the actions and asset transfers that were made by the requested + * account address + */ + account_summary: StellarSimulationResponse.AccountSummary; + + /** + * Ownership diffs of the account addresses + */ + assets_ownership_diff: Record>; + + status: 'Success'; -export interface TransactionReportParams { - details: string; + /** + * Details of addresses involved in the transaction + */ + address_details?: Array; - event: 'should_be_malicious' | 'should_be_benign'; + /** + * Mapping between the address of an account to the assets diff during the + * transaction + */ + assets_diffs?: Record< + string, + Array< + | StellarSimulationResponse.StellarLegacyAssetDiff + | StellarSimulationResponse.StellarNativeAssetDiff + | StellarSimulationResponse.StellarContractAssetDiff + > + >; - report: - | TransactionReportParams.StellarAppealRequestID - | TransactionReportParams.StellarAppealTransactionDataReport; -} + /** + * Mapping between the address of an account to the exposure of the assets during + * the transaction + */ + exposures?: Record< + string, + Array< + | StellarSimulationResponse.StellarLegacyAssetExposure + | StellarSimulationResponse.StellarNativeAssetExposure + > + >; + } + + export namespace StellarSimulationResponse { + /** + * Summary of the actions and asset transfers that were made by the requested + * account address + */ + export interface AccountSummary { + /** + * Exposures made by the requested account address + */ + account_exposures: Array< + AccountSummary.StellarLegacyAssetExposure | AccountSummary.StellarNativeAssetExposure + >; + + /** + * Ownership diffs of the requested account address + */ + account_ownerships_diff: Array; + + /** + * Total USD diff for the requested account address + */ + total_usd_diff: AccountSummary.TotalUsdDiff; + + /** + * Assets diffs of the requested account address + */ + account_assets_diffs?: Array< + | AccountSummary.StellarLegacyAssetDiff + | AccountSummary.StellarNativeAssetDiff + | AccountSummary.StellarContractAssetDiff + >; + + /** + * Total USD exposure for each of the spender addresses during the transaction + */ + total_usd_exposure?: Record; + } + + export namespace AccountSummary { + export interface StellarLegacyAssetExposure { + asset: StellarLegacyAssetExposure.Asset; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export namespace StellarLegacyAssetExposure { + export interface Asset { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; + + /** + * Organization name + */ + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; + } + + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + } + + export interface StellarNativeAssetExposure { + asset: StellarNativeAssetExposure.Asset; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export namespace StellarNativeAssetExposure { + export interface Asset { + /** + * Asset code + */ + code?: 'XLM'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; + } + + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + } + + export interface AccountOwnershipsDiff { + /** + * List of public keys that can sign on behalf of the account post-transaction + */ + post_signers: Array; + + /** + * List of public keys that can sign on behalf of the account pre-transaction + */ + pre_signers: Array; + + type?: 'SET_OPTIONS'; + } + + /** + * Total USD diff for the requested account address + */ + export interface TotalUsdDiff { + /** + * Total incoming USD transfers + */ + in: number; + + /** + * Total outgoing USD transfers + */ + out: number; + + /** + * Total USD transfers + */ + total?: number; + } + + export interface StellarLegacyAssetDiff { + asset: StellarLegacyAssetDiff.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export namespace StellarLegacyAssetDiff { + export interface Asset { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; + + /** + * Organization name + */ + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; + } + } + + export interface StellarNativeAssetDiff { + asset: StellarNativeAssetDiff.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export namespace StellarNativeAssetDiff { + export interface Asset { + /** + * Asset code + */ + code?: 'XLM'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; + } + } + + export interface StellarContractAssetDiff { + asset: StellarAPI.StellarAssetContractDetailsSchema; -export namespace TransactionReportParams { - export interface StellarAppealRequestID { - id: string; + /** + * The type of the assets in this diff + */ + asset_type: string; - type?: 'request_id'; + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + } + + export interface AssetsOwnershipDiff { + /** + * List of public keys that can sign on behalf of the account post-transaction + */ + post_signers: Array; + + /** + * List of public keys that can sign on behalf of the account pre-transaction + */ + pre_signers: Array; + + type?: 'SET_OPTIONS'; + } + + export interface AddressDetail { + /** + * Encoded public key of the account + */ + account_address: unknown; + + /** + * Description of the account + */ + description?: string | null; + } + + export interface StellarLegacyAssetDiff { + asset: StellarLegacyAssetDiff.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export namespace StellarLegacyAssetDiff { + export interface Asset { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; + + /** + * Organization name + */ + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; + } + } + + export interface StellarNativeAssetDiff { + asset: StellarNativeAssetDiff.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export namespace StellarNativeAssetDiff { + export interface Asset { + /** + * Asset code + */ + code?: 'XLM'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; + } + } + + export interface StellarContractAssetDiff { + asset: StellarAPI.StellarAssetContractDetailsSchema; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetailsSchema | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetailsSchema | null; + } + + export interface StellarLegacyAssetExposure { + asset: StellarLegacyAssetExposure.Asset; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export namespace StellarLegacyAssetExposure { + export interface Asset { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; + + /** + * Organization name + */ + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; + } + + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + } + + export interface StellarNativeAssetExposure { + asset: StellarNativeAssetExposure.Asset; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export namespace StellarNativeAssetExposure { + export interface Asset { + /** + * Asset code + */ + code?: 'XLM'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; + } + + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + + export namespace Spenders { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + } + } + + export interface StellarSimulationErrorSchema { + /** + * Error message + */ + error: string; + + status: 'Error'; } - export interface StellarAppealTransactionDataReport { - params: StellarAPI.StellarTransactionScanRequest; + export interface StellarValidationResult { + /** + * A textual classification that can be presented to the user explaining the + * reason. + */ + classification: string; + + /** + * A textual description about the validation result + */ + description: string; + + features: Array; + + /** + * A textual description about the reasons the transaction was flagged with + * result_type + */ + reason: string; + + /** + * Verdict of the validation + */ + result_type: 'Benign' | 'Warning' | 'Malicious'; + + status: 'Success'; + } + + export namespace StellarValidationResult { + export interface Feature { + /** + * Address the feature refers to + */ + address: string; + + /** + * Textual description + */ + description: string; + + feature_id: string; + + /** + * Feature Classification + */ + type: 'Benign' | 'Warning' | 'Malicious' | 'Info'; + } + } + + export interface StellarValidationErrorSchema { + /** + * Error message + */ + error: string; - type?: 'params'; + status: 'Error'; } } @@ -102,8 +790,7 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { - type TransactionReportResponse as TransactionReportResponse, - type TransactionReportParams as TransactionReportParams, + type TransactionScanResponse as TransactionScanResponse, type TransactionScanParams as TransactionScanParams, }; } diff --git a/tests/api-resources/bitcoin/transaction.test.ts b/tests/api-resources/bitcoin/transaction.test.ts index 55196b47..16e50953 100644 --- a/tests/api-resources/bitcoin/transaction.test.ts +++ b/tests/api-resources/bitcoin/transaction.test.ts @@ -9,29 +9,6 @@ const client = new Blockaid({ }); describe('resource transaction', () => { - test('report: only required params', async () => { - const responsePromise = client.bitcoin.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id' }, - }); - 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('report: required and optional params', async () => { - const response = await client.bitcoin.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id', type: 'request_id' }, - }); - }); - test('scan: only required params', async () => { const responsePromise = client.bitcoin.transaction.scan({ account_address: 'account_address', diff --git a/tests/api-resources/starknet/transaction.test.ts b/tests/api-resources/starknet/transaction.test.ts index 92070907..cdd0d343 100644 --- a/tests/api-resources/starknet/transaction.test.ts +++ b/tests/api-resources/starknet/transaction.test.ts @@ -9,29 +9,6 @@ const client = new Blockaid({ }); describe('resource transaction', () => { - test('report: only required params', async () => { - const responsePromise = client.starknet.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id' }, - }); - 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('report: required and optional params', async () => { - const response = await client.starknet.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id', type: 'request_id' }, - }); - }); - test('scan: only required params', async () => { const responsePromise = client.starknet.transaction.scan({ account_address: '0x62a2959fa6502b30cbfb51199fbbe72e72ee4f5a86ec754b4172c7d7beb6ff4', diff --git a/tests/api-resources/stellar/transaction.test.ts b/tests/api-resources/stellar/transaction.test.ts index 3cb0f617..529fd3d5 100644 --- a/tests/api-resources/stellar/transaction.test.ts +++ b/tests/api-resources/stellar/transaction.test.ts @@ -9,29 +9,6 @@ const client = new Blockaid({ }); describe('resource transaction', () => { - test('report: only required params', async () => { - const responsePromise = client.stellar.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id' }, - }); - 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('report: required and optional params', async () => { - const response = await client.stellar.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id', type: 'request_id' }, - }); - }); - test('scan: only required params', async () => { const responsePromise = client.stellar.transaction.scan({ account_address: 'GDPMFLKUGASUTWBN2XGYYKD27QGHCYH4BUFUTER4L23INYQ4JHDWFOIE', From 85b6f49fca0cf0c9e81351c060bcf5e9ad4ce8d8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:22:19 +0000 Subject: [PATCH 13/18] feat(api): api update (#317) --- .stats.yml | 4 +- api.md | 24 +- src/index.ts | 30 +- src/resources/bitcoin/bitcoin.ts | 10 +- src/resources/bitcoin/index.ts | 8 +- src/resources/bitcoin/transaction.ts | 83 ++ src/resources/index.ts | 15 +- src/resources/solana/index.ts | 3 + src/resources/solana/solana.ts | 163 ++-- src/resources/starknet/index.ts | 11 +- src/resources/starknet/starknet.ts | 99 ++- src/resources/starknet/transaction.ts | 608 ++++++-------- src/resources/stellar/index.ts | 16 +- src/resources/stellar/stellar.ts | 537 ++++++++++++- src/resources/stellar/transaction.ts | 747 +----------------- .../api-resources/bitcoin/transaction.test.ts | 23 + .../starknet/transaction.test.ts | 23 + .../api-resources/stellar/transaction.test.ts | 23 + 18 files changed, 1205 insertions(+), 1222 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5444cd43..095978d0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 19 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-f41ac491b9d7fa4596ebc394c2f2b22c93ad45da2dd3de08574022091afed10e.yml +configured_endpoints: 22 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-a8d116e345ec36054b1a8cc6fa98564ede39989a9b9ce1383f9e37738dcf33ff.yml diff --git a/api.md b/api.md index d35b281b..55e18e0c 100644 --- a/api.md +++ b/api.md @@ -101,6 +101,8 @@ Types: - DelegatedAssetDetailsSchema - FungibleMintAccountDetailsSchema - InstructionErrorDetails +- NativeDetailsSchema +- NativeDiffSchema - NativeSolOwnershipDiffSchema - NonFungibleMintAccountDetailsSchema - PdaAccountSchema @@ -111,6 +113,7 @@ Types: - SplNonFungibleTokenDetailsSchema - SplNonFungibleTokenDiffSchema - SplTokenOwnershipDiffSchema +- StakedAssetDetailsSchema - StakedSolWithdrawAuthorityDiffSchema - SuccessfulSimulationResultSchema - SystemAccountDetailsSchema @@ -136,18 +139,24 @@ Methods: Types: -- StellarAssetContractDetailsSchema -- StellarAssetTransferDetailsSchema +- StellarAssetContractDetails +- StellarAssetTransferDetails +- StellarLegacyAssetDetails +- StellarNativeAssetDetails +- StellarSingleAssetExposure +- StellarTransactionScanRequest +- StellarTransactionScanResponse ## Transaction Types: -- TransactionScanResponse +- TransactionReportResponse Methods: -- client.stellar.transaction.scan({ ...params }) -> TransactionScanResponse +- client.stellar.transaction.report({ ...params }) -> TransactionReportResponse +- client.stellar.transaction.scan({ ...params }) -> StellarTransactionScanResponse # Bitcoin @@ -155,28 +164,35 @@ Methods: Types: +- TransactionReportResponse - TransactionScanResponse Methods: +- client.bitcoin.transaction.report({ ...params }) -> TransactionReportResponse - client.bitcoin.transaction.scan({ ...params }) -> TransactionScanResponse # Starknet Types: +- StarknetErc1155Details - StarknetErc1155Diff +- StarknetErc20Details - StarknetErc20Diff +- StarknetErc721Details - StarknetErc721Diff ## Transaction Types: +- TransactionReportResponse - TransactionScanResponse Methods: +- client.starknet.transaction.report({ ...params }) -> TransactionReportResponse - client.starknet.transaction.scan({ ...params }) -> TransactionScanResponse # Site diff --git a/src/index.ts b/src/index.ts index 0eafdf11..832f12da 100644 --- a/src/index.ts +++ b/src/index.ts @@ -61,6 +61,8 @@ import { DelegatedAssetDetailsSchema, FungibleMintAccountDetailsSchema, InstructionErrorDetails, + NativeDetailsSchema, + NativeDiffSchema, NativeSolOwnershipDiffSchema, NonFungibleMintAccountDetailsSchema, PdaAccountSchema, @@ -72,6 +74,7 @@ import { SplNonFungibleTokenDetailsSchema, SplNonFungibleTokenDiffSchema, SplTokenOwnershipDiffSchema, + StakedAssetDetailsSchema, StakedSolWithdrawAuthorityDiffSchema, SuccessfulSimulationResultSchema, SystemAccountDetailsSchema, @@ -83,14 +86,22 @@ import { } from './resources/solana/solana'; import { Starknet, + StarknetErc1155Details, StarknetErc1155Diff, + StarknetErc20Details, StarknetErc20Diff, + StarknetErc721Details, StarknetErc721Diff, } from './resources/starknet/starknet'; import { Stellar, - StellarAssetContractDetailsSchema, - StellarAssetTransferDetailsSchema, + StellarAssetContractDetails, + StellarAssetTransferDetails, + StellarLegacyAssetDetails, + StellarNativeAssetDetails, + StellarSingleAssetExposure, + StellarTransactionScanRequest, + StellarTransactionScanResponse, } from './resources/stellar/stellar'; const environments = { @@ -372,6 +383,8 @@ export declare namespace Blockaid { type DelegatedAssetDetailsSchema as DelegatedAssetDetailsSchema, type FungibleMintAccountDetailsSchema as FungibleMintAccountDetailsSchema, type InstructionErrorDetails as InstructionErrorDetails, + type NativeDetailsSchema as NativeDetailsSchema, + type NativeDiffSchema as NativeDiffSchema, type NativeSolOwnershipDiffSchema as NativeSolOwnershipDiffSchema, type NonFungibleMintAccountDetailsSchema as NonFungibleMintAccountDetailsSchema, type PdaAccountSchema as PdaAccountSchema, @@ -382,6 +395,7 @@ export declare namespace Blockaid { type SplNonFungibleTokenDetailsSchema as SplNonFungibleTokenDetailsSchema, type SplNonFungibleTokenDiffSchema as SplNonFungibleTokenDiffSchema, type SplTokenOwnershipDiffSchema as SplTokenOwnershipDiffSchema, + type StakedAssetDetailsSchema as StakedAssetDetailsSchema, type StakedSolWithdrawAuthorityDiffSchema as StakedSolWithdrawAuthorityDiffSchema, type SuccessfulSimulationResultSchema as SuccessfulSimulationResultSchema, type SystemAccountDetailsSchema as SystemAccountDetailsSchema, @@ -394,16 +408,24 @@ export declare namespace Blockaid { export { Stellar as Stellar, - type StellarAssetContractDetailsSchema as StellarAssetContractDetailsSchema, - type StellarAssetTransferDetailsSchema as StellarAssetTransferDetailsSchema, + type StellarAssetContractDetails as StellarAssetContractDetails, + type StellarAssetTransferDetails as StellarAssetTransferDetails, + type StellarLegacyAssetDetails as StellarLegacyAssetDetails, + type StellarNativeAssetDetails as StellarNativeAssetDetails, + type StellarSingleAssetExposure as StellarSingleAssetExposure, + type StellarTransactionScanRequest as StellarTransactionScanRequest, + type StellarTransactionScanResponse as StellarTransactionScanResponse, }; export { Bitcoin as Bitcoin }; export { Starknet as Starknet, + type StarknetErc1155Details as StarknetErc1155Details, type StarknetErc1155Diff as StarknetErc1155Diff, + type StarknetErc20Details as StarknetErc20Details, type StarknetErc20Diff as StarknetErc20Diff, + type StarknetErc721Details as StarknetErc721Details, type StarknetErc721Diff as StarknetErc721Diff, }; diff --git a/src/resources/bitcoin/bitcoin.ts b/src/resources/bitcoin/bitcoin.ts index e6ba4f57..e77dbbcd 100644 --- a/src/resources/bitcoin/bitcoin.ts +++ b/src/resources/bitcoin/bitcoin.ts @@ -2,7 +2,13 @@ import { APIResource } from '../../resource'; import * as TransactionAPI from './transaction'; -import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; +import { + Transaction, + TransactionReportParams, + TransactionReportResponse, + TransactionScanParams, + TransactionScanResponse, +} from './transaction'; export class Bitcoin extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); @@ -13,7 +19,9 @@ Bitcoin.Transaction = Transaction; export declare namespace Bitcoin { export { Transaction as Transaction, + type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/bitcoin/index.ts b/src/resources/bitcoin/index.ts index 5692cbb7..e259b401 100644 --- a/src/resources/bitcoin/index.ts +++ b/src/resources/bitcoin/index.ts @@ -1,4 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Bitcoin } from './bitcoin'; -export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; +export { + Transaction, + type TransactionReportResponse, + type TransactionScanResponse, + type TransactionReportParams, + type TransactionScanParams, +} from './transaction'; diff --git a/src/resources/bitcoin/transaction.ts b/src/resources/bitcoin/transaction.ts index 09d0ba87..7054426e 100644 --- a/src/resources/bitcoin/transaction.ts +++ b/src/resources/bitcoin/transaction.ts @@ -4,6 +4,16 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; export class Transaction extends APIResource { + /** + * Report Transaction + */ + report( + body: TransactionReportParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post('/v0/bitcoin/transaction/report', { body, ...options }); + } + /** * Scan Transaction */ @@ -12,6 +22,8 @@ export class Transaction extends APIResource { } } +export type TransactionReportResponse = number; + export interface TransactionScanResponse { /** * Simulation result; Only present if simulation option is included in the request @@ -441,6 +453,75 @@ export namespace TransactionScanResponse { } } +export interface TransactionReportParams { + details: string; + + event: 'should_be_malicious' | 'should_be_benign'; + + report: + | TransactionReportParams.BitcoinAppealRequestID + | TransactionReportParams.BitcoinAppealTransactionDataReport; +} + +export namespace TransactionReportParams { + export interface BitcoinAppealRequestID { + id: string; + + type?: 'request_id'; + } + + export interface BitcoinAppealTransactionDataReport { + params: BitcoinAppealTransactionDataReport.Params; + + type?: 'params'; + } + + export namespace BitcoinAppealTransactionDataReport { + export interface Params { + account_address: string; + + chain: 'bitcoin'; + + /** + * Metadata + */ + metadata: Params.BitcoinWalletRequestMetadata | Params.BitcoinInAppRequestMetadata; + + transaction: string; + + /** + * List of options to include in the response + * + * - `Options.validation`: Include Options.validation output in the response + * + * - `Options.simulation`: Include Options.simulation output in the response + */ + options?: Array<'validation' | 'simulation'>; + } + + export namespace Params { + export interface BitcoinWalletRequestMetadata { + /** + * Metadata for wallet requests + */ + type: 'wallet'; + + /** + * URL of the dApp originating the transaction + */ + url: string; + } + + export interface BitcoinInAppRequestMetadata { + /** + * Metadata for in-app requests + */ + type?: 'in_app'; + } + } + } +} + export interface TransactionScanParams { account_address: string; @@ -488,7 +569,9 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { + type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/index.ts b/src/resources/index.ts index 8beaaa19..d2f344c2 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -49,6 +49,8 @@ export { type DelegatedAssetDetailsSchema, type FungibleMintAccountDetailsSchema, type InstructionErrorDetails, + type NativeDetailsSchema, + type NativeDiffSchema, type NativeSolOwnershipDiffSchema, type NonFungibleMintAccountDetailsSchema, type PdaAccountSchema, @@ -59,6 +61,7 @@ export { type SplNonFungibleTokenDetailsSchema, type SplNonFungibleTokenDiffSchema, type SplTokenOwnershipDiffSchema, + type StakedAssetDetailsSchema, type StakedSolWithdrawAuthorityDiffSchema, type SuccessfulSimulationResultSchema, type SystemAccountDetailsSchema, @@ -70,14 +73,22 @@ export { } from './solana/solana'; export { Starknet, + type StarknetErc1155Details, type StarknetErc1155Diff, + type StarknetErc20Details, type StarknetErc20Diff, + type StarknetErc721Details, type StarknetErc721Diff, } from './starknet/starknet'; export { Stellar, - type StellarAssetContractDetailsSchema, - type StellarAssetTransferDetailsSchema, + type StellarAssetContractDetails, + type StellarAssetTransferDetails, + type StellarLegacyAssetDetails, + type StellarNativeAssetDetails, + type StellarSingleAssetExposure, + type StellarTransactionScanRequest, + type StellarTransactionScanResponse, } from './stellar/stellar'; export { Token, diff --git a/src/resources/solana/index.ts b/src/resources/solana/index.ts index 34d17466..79328d37 100644 --- a/src/resources/solana/index.ts +++ b/src/resources/solana/index.ts @@ -16,6 +16,8 @@ export { type DelegatedAssetDetailsSchema, type FungibleMintAccountDetailsSchema, type InstructionErrorDetails, + type NativeDetailsSchema, + type NativeDiffSchema, type NativeSolOwnershipDiffSchema, type NonFungibleMintAccountDetailsSchema, type PdaAccountSchema, @@ -26,6 +28,7 @@ export { type SplNonFungibleTokenDetailsSchema, type SplNonFungibleTokenDiffSchema, type SplTokenOwnershipDiffSchema, + type StakedAssetDetailsSchema, type StakedSolWithdrawAuthorityDiffSchema, type SuccessfulSimulationResultSchema, type SystemAccountDetailsSchema, diff --git a/src/resources/solana/solana.ts b/src/resources/solana/solana.ts index 4530f483..964b6e33 100644 --- a/src/resources/solana/solana.ts +++ b/src/resources/solana/solana.ts @@ -22,10 +22,7 @@ export interface AccountSummarySchema { * Assets diff of the requested account address */ account_assets_diff?: Array< - | AccountSummarySchema.NativeDiffSchema - | SplFungibleTokenDiffSchema - | SplNonFungibleTokenDiffSchema - | CnftDiffSchema + NativeDiffSchema | SplFungibleTokenDiffSchema | SplNonFungibleTokenDiffSchema | CnftDiffSchema >; /** @@ -41,40 +38,6 @@ export interface AccountSummarySchema { >; } -export namespace AccountSummarySchema { - export interface NativeDiffSchema { - asset: NativeDiffSchema.Asset; - - /** - * Type of the asset involved in the transfer - */ - asset_type: string; - - /** - * Incoming transfers of the asset - */ - in?: SolanaAPI.AssetTransferDetailsSchema | null; - - out?: SolanaAPI.AssetTransferDetailsSchema | null; - } - - export namespace NativeDiffSchema { - export interface Asset { - decimals?: number; - - /** - * Logo of the native currency - */ - logo?: string | null; - - /** - * Type of the asset (`"NativeToken"`) - */ - type?: string; - } - } -} - export interface AddressScanRequestSchema { /** * Encoded public key @@ -361,8 +324,38 @@ export interface InstructionErrorDetails { type?: string; } +export interface NativeDetailsSchema { + decimals?: number; + + /** + * Logo of the native currency + */ + logo?: string | null; + + /** + * Type of the asset (`"NativeToken"`) + */ + type?: string; +} + +export interface NativeDiffSchema { + asset: NativeDetailsSchema; + + /** + * Type of the asset involved in the transfer + */ + asset_type: string; + + /** + * Incoming transfers of the asset + */ + in?: AssetTransferDetailsSchema | null; + + out?: AssetTransferDetailsSchema | null; +} + export interface NativeSolOwnershipDiffSchema { - asset: NativeSolOwnershipDiffSchema.Asset; + asset: NativeDetailsSchema; /** * Type of the asset involved in the transfer @@ -390,22 +383,6 @@ export interface NativeSolOwnershipDiffSchema { pre_owner?: string | null; } -export namespace NativeSolOwnershipDiffSchema { - export interface Asset { - decimals?: number; - - /** - * Logo of the native currency - */ - logo?: string | null; - - /** - * Type of the asset (`"NativeToken"`) - */ - type?: string; - } -} - export interface NonFungibleMintAccountDetailsSchema { /** * Encoded public key of the account @@ -615,6 +592,20 @@ export interface SplTokenOwnershipDiffSchema { pre_owner?: string | null; } +export interface StakedAssetDetailsSchema { + decimals?: number; + + /** + * Logo of the native currency + */ + logo?: string | null; + + /** + * Type of the asset (`"STAKED_NATIVE"`) + */ + type?: string; +} + export interface StakedSolWithdrawAuthorityDiffSchema { /** * Type of the asset involved in the transfer @@ -626,7 +617,7 @@ export interface StakedSolWithdrawAuthorityDiffSchema { */ post_owner: string; - asset?: StakedSolWithdrawAuthorityDiffSchema.Asset; + asset?: StakedAssetDetailsSchema; /** * Incoming transfers of the asset @@ -644,22 +635,6 @@ export interface StakedSolWithdrawAuthorityDiffSchema { pre_owner?: string | null; } -export namespace StakedSolWithdrawAuthorityDiffSchema { - export interface Asset { - decimals?: number; - - /** - * Logo of the native currency - */ - logo?: string | null; - - /** - * Type of the asset (`"STAKED_NATIVE"`) - */ - type?: string; - } -} - export interface SuccessfulSimulationResultSchema { /** * Summary of the requested account address @@ -684,12 +659,7 @@ export interface SuccessfulSimulationResultSchema { */ assets_diff: Record< string, - Array< - | SuccessfulSimulationResultSchema.NativeDiffSchema - | SplFungibleTokenDiffSchema - | SplNonFungibleTokenDiffSchema - | CnftDiffSchema - > + Array >; /** @@ -706,40 +676,6 @@ export interface SuccessfulSimulationResultSchema { delegations: Record>; } -export namespace SuccessfulSimulationResultSchema { - export interface NativeDiffSchema { - asset: NativeDiffSchema.Asset; - - /** - * Type of the asset involved in the transfer - */ - asset_type: string; - - /** - * Incoming transfers of the asset - */ - in?: SolanaAPI.AssetTransferDetailsSchema | null; - - out?: SolanaAPI.AssetTransferDetailsSchema | null; - } - - export namespace NativeDiffSchema { - export interface Asset { - decimals?: number; - - /** - * Logo of the native currency - */ - logo?: string | null; - - /** - * Type of the asset (`"NativeToken"`) - */ - type?: string; - } - } -} - export interface SystemAccountDetailsSchema { /** * Encoded public key of the account @@ -908,6 +844,8 @@ export declare namespace Solana { type DelegatedAssetDetailsSchema as DelegatedAssetDetailsSchema, type FungibleMintAccountDetailsSchema as FungibleMintAccountDetailsSchema, type InstructionErrorDetails as InstructionErrorDetails, + type NativeDetailsSchema as NativeDetailsSchema, + type NativeDiffSchema as NativeDiffSchema, type NativeSolOwnershipDiffSchema as NativeSolOwnershipDiffSchema, type NonFungibleMintAccountDetailsSchema as NonFungibleMintAccountDetailsSchema, type PdaAccountSchema as PdaAccountSchema, @@ -918,6 +856,7 @@ export declare namespace Solana { type SplNonFungibleTokenDetailsSchema as SplNonFungibleTokenDetailsSchema, type SplNonFungibleTokenDiffSchema as SplNonFungibleTokenDiffSchema, type SplTokenOwnershipDiffSchema as SplTokenOwnershipDiffSchema, + type StakedAssetDetailsSchema as StakedAssetDetailsSchema, type StakedSolWithdrawAuthorityDiffSchema as StakedSolWithdrawAuthorityDiffSchema, type SuccessfulSimulationResultSchema as SuccessfulSimulationResultSchema, type SystemAccountDetailsSchema as SystemAccountDetailsSchema, diff --git a/src/resources/starknet/index.ts b/src/resources/starknet/index.ts index 40596a5a..a8ae638e 100644 --- a/src/resources/starknet/index.ts +++ b/src/resources/starknet/index.ts @@ -2,8 +2,17 @@ export { Starknet, + type StarknetErc1155Details, type StarknetErc1155Diff, + type StarknetErc20Details, type StarknetErc20Diff, + type StarknetErc721Details, type StarknetErc721Diff, } from './starknet'; -export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; +export { + Transaction, + type TransactionReportResponse, + type TransactionScanResponse, + type TransactionReportParams, + type TransactionScanParams, +} from './transaction'; diff --git a/src/resources/starknet/starknet.ts b/src/resources/starknet/starknet.ts index a3a33651..cb3aea5c 100644 --- a/src/resources/starknet/starknet.ts +++ b/src/resources/starknet/starknet.ts @@ -2,12 +2,45 @@ import { APIResource } from '../../resource'; import * as TransactionAPI from './transaction'; -import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; +import { + Transaction, + TransactionReportParams, + TransactionReportResponse, + TransactionScanParams, + TransactionScanResponse, +} from './transaction'; export class Starknet extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); } +export interface StarknetErc1155Details { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC1155`) + */ + type?: 'ERC1155'; +} + export interface StarknetErc1155Diff { /** * Token ID of the transfer @@ -30,6 +63,38 @@ export interface StarknetErc1155Diff { summary?: string | null; } +export interface StarknetErc20Details { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's decimals + */ + decimals: number; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC20`) + */ + type?: 'ERC20'; +} + export interface StarknetErc20Diff { /** * Raw value of the transfer @@ -52,6 +117,33 @@ export interface StarknetErc20Diff { summary?: string | null; } +export interface StarknetErc721Details { + /** + * Address of the token's contract + */ + address: string; + + /** + * token's name + */ + name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ERC721`) + */ + type?: 'ERC721'; +} + export interface StarknetErc721Diff { /** * Token ID of the transfer @@ -73,14 +165,19 @@ Starknet.Transaction = Transaction; export declare namespace Starknet { export { + type StarknetErc1155Details as StarknetErc1155Details, type StarknetErc1155Diff as StarknetErc1155Diff, + type StarknetErc20Details as StarknetErc20Details, type StarknetErc20Diff as StarknetErc20Diff, + type StarknetErc721Details as StarknetErc721Details, type StarknetErc721Diff as StarknetErc721Diff, }; export { Transaction as Transaction, + type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/starknet/transaction.ts b/src/resources/starknet/transaction.ts index 6b2a999b..616826bc 100644 --- a/src/resources/starknet/transaction.ts +++ b/src/resources/starknet/transaction.ts @@ -5,6 +5,16 @@ import * as Core from '../../core'; import * as StarknetAPI from './starknet'; export class Transaction extends APIResource { + /** + * Report Transaction + */ + report( + body: TransactionReportParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post('/v0/starknet/transaction/report', { body, ...options }); + } + /** * Scan Transactions */ @@ -13,6 +23,8 @@ export class Transaction extends APIResource { } } +export type TransactionReportResponse = number; + export interface TransactionScanResponse { /** * Simulation result; Only present if simulation option is included in the request @@ -115,7 +127,7 @@ export namespace TransactionScanResponse { export namespace AccountSummary { export interface StarknetErc20Exposure { - asset: StarknetErc20Exposure.Asset; + asset: StarknetAPI.StarknetErc20Details; /** * Mapping between the spender address and the exposure of the asset @@ -124,38 +136,6 @@ export namespace TransactionScanResponse { } export namespace StarknetErc20Exposure { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's decimals - */ - decimals: number; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC20`) - */ - type?: 'ERC20'; - } - export interface Spenders { /** * Approval value of the ERC20 token @@ -177,7 +157,7 @@ export namespace TransactionScanResponse { } export interface StarknetErc721Exposure { - asset: StarknetErc721Exposure.Asset; + asset: StarknetAPI.StarknetErc721Details; /** * Mapping between the spender address and the exposure of the asset @@ -186,33 +166,6 @@ export namespace TransactionScanResponse { } export namespace StarknetErc721Exposure { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC721`) - */ - type?: 'ERC721'; - } - export interface Spenders { exposure: Array; @@ -229,7 +182,7 @@ export namespace TransactionScanResponse { } export interface StarknetErc1155Exposure { - asset: StarknetErc1155Exposure.Asset; + asset: StarknetAPI.StarknetErc1155Details; /** * Mapping between the spender address and the exposure of the asset @@ -238,33 +191,6 @@ export namespace TransactionScanResponse { } export namespace StarknetErc1155Exposure { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC1155`) - */ - type?: 'ERC1155'; - } - export interface Spenders { exposure: Array; @@ -301,7 +227,7 @@ export namespace TransactionScanResponse { } export interface StarknetErc20AssetDiff { - asset: StarknetErc20AssetDiff.Asset; + asset: StarknetAPI.StarknetErc20Details; /** * The type of the assets in this diff @@ -319,42 +245,8 @@ export namespace TransactionScanResponse { out?: StarknetAPI.StarknetErc20Diff | null; } - export namespace StarknetErc20AssetDiff { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's decimals - */ - decimals: number; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC20`) - */ - type?: 'ERC20'; - } - } - export interface StarknetErc721AssetDiff { - asset: StarknetErc721AssetDiff.Asset; + asset: StarknetAPI.StarknetErc721Details; /** * The type of the assets in this diff @@ -372,37 +264,8 @@ export namespace TransactionScanResponse { out?: StarknetAPI.StarknetErc721Diff | null; } - export namespace StarknetErc721AssetDiff { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC721`) - */ - type?: 'ERC721'; - } - } - export interface StarknetErc1155AssetDiff { - asset: StarknetErc1155AssetDiff.Asset; + asset: StarknetAPI.StarknetErc1155Details; /** * The type of the assets in this diff @@ -419,35 +282,6 @@ export namespace TransactionScanResponse { */ out?: StarknetAPI.StarknetErc1155Diff | null; } - - export namespace StarknetErc1155AssetDiff { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC1155`) - */ - type?: 'ERC1155'; - } - } } export interface AddressDetail { @@ -463,7 +297,7 @@ export namespace TransactionScanResponse { } export interface StarknetErc20AssetDiff { - asset: StarknetErc20AssetDiff.Asset; + asset: StarknetAPI.StarknetErc20Details; /** * The type of the assets in this diff @@ -481,42 +315,8 @@ export namespace TransactionScanResponse { out?: StarknetAPI.StarknetErc20Diff | null; } - export namespace StarknetErc20AssetDiff { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's decimals - */ - decimals: number; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC20`) - */ - type?: 'ERC20'; - } - } - export interface StarknetErc721AssetDiff { - asset: StarknetErc721AssetDiff.Asset; + asset: StarknetAPI.StarknetErc721Details; /** * The type of the assets in this diff @@ -534,37 +334,8 @@ export namespace TransactionScanResponse { out?: StarknetAPI.StarknetErc721Diff | null; } - export namespace StarknetErc721AssetDiff { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC721`) - */ - type?: 'ERC721'; - } - } - export interface StarknetErc1155AssetDiff { - asset: StarknetErc1155AssetDiff.Asset; + asset: StarknetAPI.StarknetErc1155Details; /** * The type of the assets in this diff @@ -582,37 +353,8 @@ export namespace TransactionScanResponse { out?: StarknetAPI.StarknetErc1155Diff | null; } - export namespace StarknetErc1155AssetDiff { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC1155`) - */ - type?: 'ERC1155'; - } - } - export interface StarknetErc20Exposure { - asset: StarknetErc20Exposure.Asset; + asset: StarknetAPI.StarknetErc20Details; /** * Mapping between the spender address and the exposure of the asset @@ -621,38 +363,6 @@ export namespace TransactionScanResponse { } export namespace StarknetErc20Exposure { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's decimals - */ - decimals: number; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC20`) - */ - type?: 'ERC20'; - } - export interface Spenders { /** * Approval value of the ERC20 token @@ -674,7 +384,7 @@ export namespace TransactionScanResponse { } export interface StarknetErc721Exposure { - asset: StarknetErc721Exposure.Asset; + asset: StarknetAPI.StarknetErc721Details; /** * Mapping between the spender address and the exposure of the asset @@ -683,33 +393,6 @@ export namespace TransactionScanResponse { } export namespace StarknetErc721Exposure { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC721`) - */ - type?: 'ERC721'; - } - export interface Spenders { exposure: Array; @@ -726,7 +409,7 @@ export namespace TransactionScanResponse { } export interface StarknetErc1155Exposure { - asset: StarknetErc1155Exposure.Asset; + asset: StarknetAPI.StarknetErc1155Details; /** * Mapping between the spender address and the exposure of the asset @@ -735,33 +418,6 @@ export namespace TransactionScanResponse { } export namespace StarknetErc1155Exposure { - export interface Asset { - /** - * Address of the token's contract - */ - address: string; - - /** - * token's name - */ - name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ERC1155`) - */ - type?: 'ERC1155'; - } - export interface Spenders { exposure: Array; @@ -846,6 +502,220 @@ export namespace TransactionScanResponse { } } +export interface TransactionReportParams { + details: string; + + event: 'should_be_malicious' | 'should_be_benign'; + + report: + | TransactionReportParams.StarknetAppealRequestID + | TransactionReportParams.StarknetAppealTransactionDataReport; +} + +export namespace TransactionReportParams { + export interface StarknetAppealRequestID { + id: string; + + type?: 'request_id'; + } + + export interface StarknetAppealTransactionDataReport { + params: StarknetAppealTransactionDataReport.Params; + + type?: 'params'; + } + + export namespace StarknetAppealTransactionDataReport { + export interface Params { + account_address: string; + + /** + * The chain name or chain ID + */ + chain: 'mainnet' | 'sepolia' | 'sepolia_integration' | (string & {}); + + /** + * Metadata + */ + metadata: Params.StarknetWalletRequestMetadata | Params.StarknetInAppRequestMetadata; + + transaction: + | Params.StarknetInvokeV1TransactionSchema + | Params.StarknetInvokeV3TransactionSchema + | Params.StarknetDeployAccountV1TransactionSchema + | Params.StarknetDeployAccountV3TransactionSchema; + + /** + * Optional block number or tag context for the simulation + */ + block_number?: string | null; + + /** + * List of options to include in the response + * + * - `Options.validation`: Include Options.validation output in the response + * + * - `Options.simulation`: Include Options.simulation output in the response + */ + options?: Array<'validation' | 'simulation'>; + } + + export namespace Params { + export interface StarknetWalletRequestMetadata { + /** + * Metadata for wallet requests + */ + type: 'wallet'; + + /** + * URL of the dApp originating the transaction + */ + url: string; + } + + export interface StarknetInAppRequestMetadata { + /** + * Metadata for in-app requests + */ + type?: 'in_app'; + } + + export interface StarknetInvokeV1TransactionSchema { + /** + * The maximum fee that the sender is willing to pay. + */ + max_fee: string; + + /** + * The nonce of the transaction. + */ + nonce: string; + + /** + * The address of the sender. + */ + sender_address: string; + + /** + * The version of the transaction. + */ + version: 1; + + /** + * The arguments that are passed to the validate and execute functions. + */ + calldata?: Array; + } + + export interface StarknetInvokeV3TransactionSchema { + /** + * The arguments that are passed to the validate and execute functions. + */ + calldata: Array; + + /** + * The id of the chain to which the transaction is sent. + */ + chain_id: string; + + /** + * The nonce of the transaction. + */ + nonce: string; + + /** + * The address of the sender. + */ + sender_address: string; + + /** + * The version of the transaction. + */ + version: 3; + + /** + * For future use. Currently this value is always empty. + */ + account_deployment_data?: Array; + + /** + * The nonce data availability mode. + */ + nonce_data_availability_mode?: 0; + + /** + * For future use. Currently this value is always empty. + */ + paymaster_data?: Array; + } + + export interface StarknetDeployAccountV1TransactionSchema { + /** + * The hash of the contract class. + */ + class_hash: string; + + /** + * The arguments that are passed to the constructor function. + */ + constructor_calldata: Array; + + /** + * The salt of the contract address. + */ + contract_address_salt: string; + + /** + * The maximum fee that the sender is willing to pay. + */ + max_fee: string; + + /** + * The nonce of the transaction. + */ + nonce: string; + + /** + * The version of the transaction. + */ + version: 1; + } + + export interface StarknetDeployAccountV3TransactionSchema { + /** + * The hash of the contract class. + */ + class_hash: string; + + /** + * The arguments that are passed to the constructor function. + */ + constructor_calldata: Array; + + /** + * The salt of the contract address. + */ + contract_address_salt: string; + + /** + * The maximum fee that the sender is willing to pay. + */ + max_fee: string; + + /** + * The nonce of the transaction. + */ + nonce: string; + + /** + * The version of the transaction. + */ + version: 3; + } + } + } +} + export interface TransactionScanParams { account_address: string; @@ -1038,7 +908,9 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { + type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/stellar/index.ts b/src/resources/stellar/index.ts index 80722a0c..800a3094 100644 --- a/src/resources/stellar/index.ts +++ b/src/resources/stellar/index.ts @@ -2,7 +2,17 @@ export { Stellar, - type StellarAssetContractDetailsSchema, - type StellarAssetTransferDetailsSchema, + type StellarAssetContractDetails, + type StellarAssetTransferDetails, + type StellarLegacyAssetDetails, + type StellarNativeAssetDetails, + type StellarSingleAssetExposure, + type StellarTransactionScanRequest, + type StellarTransactionScanResponse, } from './stellar'; -export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; +export { + Transaction, + type TransactionReportResponse, + type TransactionReportParams, + type TransactionScanParams, +} from './transaction'; diff --git a/src/resources/stellar/stellar.ts b/src/resources/stellar/stellar.ts index 497d7ee5..219a2613 100644 --- a/src/resources/stellar/stellar.ts +++ b/src/resources/stellar/stellar.ts @@ -1,14 +1,20 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; +import * as StellarAPI from './stellar'; import * as TransactionAPI from './transaction'; -import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; +import { + Transaction, + TransactionReportParams, + TransactionReportResponse, + TransactionScanParams, +} from './transaction'; export class Stellar extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); } -export interface StellarAssetContractDetailsSchema { +export interface StellarAssetContractDetails { /** * Address of the asset's contract */ @@ -30,7 +36,7 @@ export interface StellarAssetContractDetailsSchema { type?: 'CONTRACT'; } -export interface StellarAssetTransferDetailsSchema { +export interface StellarAssetTransferDetails { /** * Raw value of the transfer */ @@ -52,17 +58,536 @@ export interface StellarAssetTransferDetailsSchema { summary?: string | null; } +export interface StellarLegacyAssetDetails { + /** + * Asset code + */ + code: string; + + /** + * Asset issuer address + */ + issuer: string; + + /** + * Organization name + */ + org_name: string; + + /** + * Organization URL + */ + org_url: string; + + /** + * Type of the asset (`ASSET`) + */ + type?: 'ASSET'; +} + +export interface StellarNativeAssetDetails { + /** + * Asset code + */ + code?: 'XLM'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; +} + +export interface StellarSingleAssetExposure { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; +} + +export namespace StellarSingleAssetExposure { + export interface Exposure { + /** + * Raw value of the transfer + */ + raw_value: number; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } +} + +export interface StellarTransactionScanRequest { + account_address: string; + + /** + * A CAIP-2 chain ID or a Stellar network name + */ + chain: 'pubnet' | 'futurenet' | 'testnet'; + + /** + * Metadata + */ + metadata: + | StellarTransactionScanRequest.StellarWalletRequestMetadata + | StellarTransactionScanRequest.StellarInAppRequestMetadata; + + transaction: string; + + /** + * List of options to include in the response + * + * - `Options.validation`: Include Options.validation output in the response + * + * - `Options.simulation`: Include Options.simulation output in the response + */ + options?: Array<'validation' | 'simulation'>; +} + +export namespace StellarTransactionScanRequest { + 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 interface StellarTransactionScanResponse { + /** + * Simulation result; Only present if simulation option is included in the request + */ + simulation?: + | StellarTransactionScanResponse.StellarSimulationResponse + | StellarTransactionScanResponse.StellarSimulationErrorSchema + | null; + + /** + * Validation result; Only present if validation option is included in the request + */ + validation?: + | StellarTransactionScanResponse.StellarValidationResult + | StellarTransactionScanResponse.StellarValidationErrorSchema + | null; +} + +export namespace StellarTransactionScanResponse { + export interface StellarSimulationResponse { + /** + * Summary of the actions and asset transfers that were made by the requested + * account address + */ + account_summary: StellarSimulationResponse.AccountSummary; + + /** + * Ownership diffs of the account addresses + */ + assets_ownership_diff: Record>; + + status: 'Success'; + + /** + * Details of addresses involved in the transaction + */ + address_details?: Array; + + /** + * Mapping between the address of an account to the assets diff during the + * transaction + */ + assets_diffs?: Record< + string, + Array< + | StellarSimulationResponse.StellarLegacyAssetDiff + | StellarSimulationResponse.StellarNativeAssetDiff + | StellarSimulationResponse.StellarContractAssetDiff + > + >; + + /** + * Mapping between the address of an account to the exposure of the assets during + * the transaction + */ + exposures?: Record< + string, + Array< + | StellarSimulationResponse.StellarLegacyAssetExposure + | StellarSimulationResponse.StellarNativeAssetExposure + > + >; + } + + export namespace StellarSimulationResponse { + /** + * Summary of the actions and asset transfers that were made by the requested + * account address + */ + export interface AccountSummary { + /** + * Exposures made by the requested account address + */ + account_exposures: Array< + AccountSummary.StellarLegacyAssetExposure | AccountSummary.StellarNativeAssetExposure + >; + + /** + * Ownership diffs of the requested account address + */ + account_ownerships_diff: Array; + + /** + * Total USD diff for the requested account address + */ + total_usd_diff: AccountSummary.TotalUsdDiff; + + /** + * Assets diffs of the requested account address + */ + account_assets_diffs?: Array< + | AccountSummary.StellarLegacyAssetDiff + | AccountSummary.StellarNativeAssetDiff + | AccountSummary.StellarContractAssetDiff + >; + + /** + * Total USD exposure for each of the spender addresses during the transaction + */ + total_usd_exposure?: Record; + } + + export namespace AccountSummary { + export interface StellarLegacyAssetExposure { + asset: StellarAPI.StellarLegacyAssetDetails; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export interface StellarNativeAssetExposure { + asset: StellarAPI.StellarNativeAssetDetails; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export interface AccountOwnershipsDiff { + /** + * List of public keys that can sign on behalf of the account post-transaction + */ + post_signers: Array; + + /** + * List of public keys that can sign on behalf of the account pre-transaction + */ + pre_signers: Array; + + type?: 'SET_OPTIONS'; + } + + /** + * Total USD diff for the requested account address + */ + export interface TotalUsdDiff { + /** + * Total incoming USD transfers + */ + in: number; + + /** + * Total outgoing USD transfers + */ + out: number; + + /** + * Total USD transfers + */ + total?: number; + } + + export interface StellarLegacyAssetDiff { + asset: StellarAPI.StellarLegacyAssetDetails; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetails | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetails | null; + } + + export interface StellarNativeAssetDiff { + asset: StellarAPI.StellarNativeAssetDetails; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetails | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetails | null; + } + + export interface StellarContractAssetDiff { + asset: StellarAPI.StellarAssetContractDetails; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetails | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetails | null; + } + } + + export interface AssetsOwnershipDiff { + /** + * List of public keys that can sign on behalf of the account post-transaction + */ + post_signers: Array; + + /** + * List of public keys that can sign on behalf of the account pre-transaction + */ + pre_signers: Array; + + type?: 'SET_OPTIONS'; + } + + export interface AddressDetail { + /** + * Encoded public key of the account + */ + account_address: unknown; + + /** + * Description of the account + */ + description?: string | null; + } + + export interface StellarLegacyAssetDiff { + asset: StellarAPI.StellarLegacyAssetDetails; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetails | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetails | null; + } + + export interface StellarNativeAssetDiff { + asset: StellarAPI.StellarNativeAssetDetails; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetails | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetails | null; + } + + export interface StellarContractAssetDiff { + asset: StellarAPI.StellarAssetContractDetails; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StellarAPI.StellarAssetTransferDetails | null; + + /** + * Details of the outgoing transfer + */ + out?: StellarAPI.StellarAssetTransferDetails | null; + } + + export interface StellarLegacyAssetExposure { + asset: StellarAPI.StellarLegacyAssetDetails; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export interface StellarNativeAssetExposure { + asset: StellarAPI.StellarNativeAssetDetails; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + } + + export interface StellarSimulationErrorSchema { + /** + * Error message + */ + error: string; + + status: 'Error'; + } + + export interface StellarValidationResult { + /** + * A textual classification that can be presented to the user explaining the + * reason. + */ + classification: string; + + /** + * A textual description about the validation result + */ + description: string; + + features: Array; + + /** + * A textual description about the reasons the transaction was flagged with + * result_type + */ + reason: string; + + /** + * Verdict of the validation + */ + result_type: 'Benign' | 'Warning' | 'Malicious'; + + status: 'Success'; + } + + export namespace StellarValidationResult { + export interface Feature { + /** + * Address the feature refers to + */ + address: string; + + /** + * Textual description + */ + description: string; + + feature_id: string; + + /** + * Feature Classification + */ + type: 'Benign' | 'Warning' | 'Malicious' | 'Info'; + } + } + + export interface StellarValidationErrorSchema { + /** + * Error message + */ + error: string; + + status: 'Error'; + } +} + Stellar.Transaction = Transaction; export declare namespace Stellar { export { - type StellarAssetContractDetailsSchema as StellarAssetContractDetailsSchema, - type StellarAssetTransferDetailsSchema as StellarAssetTransferDetailsSchema, + type StellarAssetContractDetails as StellarAssetContractDetails, + type StellarAssetTransferDetails as StellarAssetTransferDetails, + type StellarLegacyAssetDetails as StellarLegacyAssetDetails, + type StellarNativeAssetDetails as StellarNativeAssetDetails, + type StellarSingleAssetExposure as StellarSingleAssetExposure, + type StellarTransactionScanRequest as StellarTransactionScanRequest, + type StellarTransactionScanResponse as StellarTransactionScanResponse, }; export { Transaction as Transaction, - type TransactionScanResponse as TransactionScanResponse, + type TransactionReportResponse as TransactionReportResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/stellar/transaction.ts b/src/resources/stellar/transaction.ts index d297eacc..3483f4f4 100644 --- a/src/resources/stellar/transaction.ts +++ b/src/resources/stellar/transaction.ts @@ -6,737 +6,49 @@ import * as StellarAPI from './stellar'; export class Transaction extends APIResource { /** - * Scan Transaction + * Report Transaction */ - scan(body: TransactionScanParams, options?: Core.RequestOptions): Core.APIPromise { - return this._client.post('/v0/stellar/transaction/scan', { body, ...options }); + report( + body: TransactionReportParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post('/v0/stellar/transaction/report', { body, ...options }); } -} - -export interface TransactionScanResponse { - /** - * Simulation result; Only present if simulation option is included in the request - */ - simulation?: - | TransactionScanResponse.StellarSimulationResponse - | TransactionScanResponse.StellarSimulationErrorSchema - | null; /** - * Validation result; Only present if validation option is included in the request + * Scan Transaction */ - validation?: - | TransactionScanResponse.StellarValidationResult - | TransactionScanResponse.StellarValidationErrorSchema - | null; -} - -export namespace TransactionScanResponse { - export interface StellarSimulationResponse { - /** - * Summary of the actions and asset transfers that were made by the requested - * account address - */ - account_summary: StellarSimulationResponse.AccountSummary; - - /** - * Ownership diffs of the account addresses - */ - assets_ownership_diff: Record>; - - status: 'Success'; - - /** - * Details of addresses involved in the transaction - */ - address_details?: Array; - - /** - * Mapping between the address of an account to the assets diff during the - * transaction - */ - assets_diffs?: Record< - string, - Array< - | StellarSimulationResponse.StellarLegacyAssetDiff - | StellarSimulationResponse.StellarNativeAssetDiff - | StellarSimulationResponse.StellarContractAssetDiff - > - >; - - /** - * Mapping between the address of an account to the exposure of the assets during - * the transaction - */ - exposures?: Record< - string, - Array< - | StellarSimulationResponse.StellarLegacyAssetExposure - | StellarSimulationResponse.StellarNativeAssetExposure - > - >; - } - - export namespace StellarSimulationResponse { - /** - * Summary of the actions and asset transfers that were made by the requested - * account address - */ - export interface AccountSummary { - /** - * Exposures made by the requested account address - */ - account_exposures: Array< - AccountSummary.StellarLegacyAssetExposure | AccountSummary.StellarNativeAssetExposure - >; - - /** - * Ownership diffs of the requested account address - */ - account_ownerships_diff: Array; - - /** - * Total USD diff for the requested account address - */ - total_usd_diff: AccountSummary.TotalUsdDiff; - - /** - * Assets diffs of the requested account address - */ - account_assets_diffs?: Array< - | AccountSummary.StellarLegacyAssetDiff - | AccountSummary.StellarNativeAssetDiff - | AccountSummary.StellarContractAssetDiff - >; - - /** - * Total USD exposure for each of the spender addresses during the transaction - */ - total_usd_exposure?: Record; - } - - export namespace AccountSummary { - export interface StellarLegacyAssetExposure { - asset: StellarLegacyAssetExposure.Asset; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StellarLegacyAssetExposure { - export interface Asset { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; - } - - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - - export interface StellarNativeAssetExposure { - asset: StellarNativeAssetExposure.Asset; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StellarNativeAssetExposure { - export interface Asset { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - - export interface AccountOwnershipsDiff { - /** - * List of public keys that can sign on behalf of the account post-transaction - */ - post_signers: Array; - - /** - * List of public keys that can sign on behalf of the account pre-transaction - */ - pre_signers: Array; - - type?: 'SET_OPTIONS'; - } - - /** - * Total USD diff for the requested account address - */ - export interface TotalUsdDiff { - /** - * Total incoming USD transfers - */ - in: number; - - /** - * Total outgoing USD transfers - */ - out: number; - - /** - * Total USD transfers - */ - total?: number; - } - - export interface StellarLegacyAssetDiff { - asset: StellarLegacyAssetDiff.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - - export namespace StellarLegacyAssetDiff { - export interface Asset { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; - } - } - - export interface StellarNativeAssetDiff { - asset: StellarNativeAssetDiff.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - - export namespace StellarNativeAssetDiff { - export interface Asset { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - } - - export interface StellarContractAssetDiff { - asset: StellarAPI.StellarAssetContractDetailsSchema; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - } - - export interface AssetsOwnershipDiff { - /** - * List of public keys that can sign on behalf of the account post-transaction - */ - post_signers: Array; - - /** - * List of public keys that can sign on behalf of the account pre-transaction - */ - pre_signers: Array; - - type?: 'SET_OPTIONS'; - } - - export interface AddressDetail { - /** - * Encoded public key of the account - */ - account_address: unknown; - - /** - * Description of the account - */ - description?: string | null; - } - - export interface StellarLegacyAssetDiff { - asset: StellarLegacyAssetDiff.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - - export namespace StellarLegacyAssetDiff { - export interface Asset { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; - } - } - - export interface StellarNativeAssetDiff { - asset: StellarNativeAssetDiff.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - - export namespace StellarNativeAssetDiff { - export interface Asset { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - } - - export interface StellarContractAssetDiff { - asset: StellarAPI.StellarAssetContractDetailsSchema; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StellarAPI.StellarAssetTransferDetailsSchema | null; - - /** - * Details of the outgoing transfer - */ - out?: StellarAPI.StellarAssetTransferDetailsSchema | null; - } - - export interface StellarLegacyAssetExposure { - asset: StellarLegacyAssetExposure.Asset; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StellarLegacyAssetExposure { - export interface Asset { - /** - * Asset code - */ - code: string; - - /** - * Asset issuer address - */ - issuer: string; - - /** - * Organization name - */ - org_name: string; - - /** - * Organization URL - */ - org_url: string; - - /** - * Type of the asset (`ASSET`) - */ - type?: 'ASSET'; - } - - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - - export interface StellarNativeAssetExposure { - asset: StellarNativeAssetExposure.Asset; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StellarNativeAssetExposure { - export interface Asset { - /** - * Asset code - */ - code?: 'XLM'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - - export namespace Spenders { - export interface Exposure { - /** - * Raw value of the transfer - */ - raw_value: number; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - } - - export interface StellarSimulationErrorSchema { - /** - * Error message - */ - error: string; - - status: 'Error'; + scan( + body: TransactionScanParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post('/v0/stellar/transaction/scan', { body, ...options }); } +} - export interface StellarValidationResult { - /** - * A textual classification that can be presented to the user explaining the - * reason. - */ - classification: string; - - /** - * A textual description about the validation result - */ - description: string; - - features: Array; - - /** - * A textual description about the reasons the transaction was flagged with - * result_type - */ - reason: string; - - /** - * Verdict of the validation - */ - result_type: 'Benign' | 'Warning' | 'Malicious'; +export type TransactionReportResponse = number; - status: 'Success'; - } +export interface TransactionReportParams { + details: string; - export namespace StellarValidationResult { - export interface Feature { - /** - * Address the feature refers to - */ - address: string; + event: 'should_be_malicious' | 'should_be_benign'; - /** - * Textual description - */ - description: string; + report: + | TransactionReportParams.StellarAppealRequestID + | TransactionReportParams.StellarAppealTransactionDataReport; +} - feature_id: string; +export namespace TransactionReportParams { + export interface StellarAppealRequestID { + id: string; - /** - * Feature Classification - */ - type: 'Benign' | 'Warning' | 'Malicious' | 'Info'; - } + type?: 'request_id'; } - export interface StellarValidationErrorSchema { - /** - * Error message - */ - error: string; + export interface StellarAppealTransactionDataReport { + params: StellarAPI.StellarTransactionScanRequest; - status: 'Error'; + type?: 'params'; } } @@ -790,7 +102,8 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { - type TransactionScanResponse as TransactionScanResponse, + type TransactionReportResponse as TransactionReportResponse, + type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/tests/api-resources/bitcoin/transaction.test.ts b/tests/api-resources/bitcoin/transaction.test.ts index 16e50953..55196b47 100644 --- a/tests/api-resources/bitcoin/transaction.test.ts +++ b/tests/api-resources/bitcoin/transaction.test.ts @@ -9,6 +9,29 @@ const client = new Blockaid({ }); describe('resource transaction', () => { + test('report: only required params', async () => { + const responsePromise = client.bitcoin.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id' }, + }); + 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('report: required and optional params', async () => { + const response = await client.bitcoin.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id', type: 'request_id' }, + }); + }); + test('scan: only required params', async () => { const responsePromise = client.bitcoin.transaction.scan({ account_address: 'account_address', diff --git a/tests/api-resources/starknet/transaction.test.ts b/tests/api-resources/starknet/transaction.test.ts index cdd0d343..92070907 100644 --- a/tests/api-resources/starknet/transaction.test.ts +++ b/tests/api-resources/starknet/transaction.test.ts @@ -9,6 +9,29 @@ const client = new Blockaid({ }); describe('resource transaction', () => { + test('report: only required params', async () => { + const responsePromise = client.starknet.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id' }, + }); + 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('report: required and optional params', async () => { + const response = await client.starknet.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id', type: 'request_id' }, + }); + }); + test('scan: only required params', async () => { const responsePromise = client.starknet.transaction.scan({ account_address: '0x62a2959fa6502b30cbfb51199fbbe72e72ee4f5a86ec754b4172c7d7beb6ff4', diff --git a/tests/api-resources/stellar/transaction.test.ts b/tests/api-resources/stellar/transaction.test.ts index 529fd3d5..3cb0f617 100644 --- a/tests/api-resources/stellar/transaction.test.ts +++ b/tests/api-resources/stellar/transaction.test.ts @@ -9,6 +9,29 @@ const client = new Blockaid({ }); describe('resource transaction', () => { + test('report: only required params', async () => { + const responsePromise = client.stellar.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id' }, + }); + 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('report: required and optional params', async () => { + const response = await client.stellar.transaction.report({ + details: 'details', + event: 'should_be_malicious', + report: { id: 'id', type: 'request_id' }, + }); + }); + test('scan: only required params', async () => { const responsePromise = client.stellar.transaction.scan({ account_address: 'GDPMFLKUGASUTWBN2XGYYKD27QGHCYH4BUFUTER4L23INYQ4JHDWFOIE', From 9579ef1a984c6a94c0859175761cb27ff0f72c0a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:25:22 +0000 Subject: [PATCH 14/18] feat(api): manual updates (#318) --- .stats.yml | 2 +- api.md | 9 - src/resources/bitcoin/bitcoin.ts | 10 +- src/resources/bitcoin/index.ts | 8 +- src/resources/bitcoin/transaction.ts | 83 ------- src/resources/starknet/index.ts | 8 +- src/resources/starknet/starknet.ts | 10 +- src/resources/starknet/transaction.ts | 228 ------------------ src/resources/stellar/index.ts | 7 +- src/resources/stellar/stellar.ts | 14 +- src/resources/stellar/transaction.ts | 42 +--- .../api-resources/bitcoin/transaction.test.ts | 23 -- .../starknet/transaction.test.ts | 23 -- .../api-resources/stellar/transaction.test.ts | 23 -- 14 files changed, 9 insertions(+), 481 deletions(-) diff --git a/.stats.yml b/.stats.yml index 095978d0..d92431ae 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 22 +configured_endpoints: 19 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-a8d116e345ec36054b1a8cc6fa98564ede39989a9b9ce1383f9e37738dcf33ff.yml diff --git a/api.md b/api.md index 55e18e0c..4ecce915 100644 --- a/api.md +++ b/api.md @@ -149,13 +149,8 @@ Types: ## Transaction -Types: - -- TransactionReportResponse - Methods: -- client.stellar.transaction.report({ ...params }) -> TransactionReportResponse - client.stellar.transaction.scan({ ...params }) -> StellarTransactionScanResponse # Bitcoin @@ -164,12 +159,10 @@ Methods: Types: -- TransactionReportResponse - TransactionScanResponse Methods: -- client.bitcoin.transaction.report({ ...params }) -> TransactionReportResponse - client.bitcoin.transaction.scan({ ...params }) -> TransactionScanResponse # Starknet @@ -187,12 +180,10 @@ Types: Types: -- TransactionReportResponse - TransactionScanResponse Methods: -- client.starknet.transaction.report({ ...params }) -> TransactionReportResponse - client.starknet.transaction.scan({ ...params }) -> TransactionScanResponse # Site diff --git a/src/resources/bitcoin/bitcoin.ts b/src/resources/bitcoin/bitcoin.ts index e77dbbcd..e6ba4f57 100644 --- a/src/resources/bitcoin/bitcoin.ts +++ b/src/resources/bitcoin/bitcoin.ts @@ -2,13 +2,7 @@ import { APIResource } from '../../resource'; import * as TransactionAPI from './transaction'; -import { - Transaction, - TransactionReportParams, - TransactionReportResponse, - TransactionScanParams, - TransactionScanResponse, -} from './transaction'; +import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; export class Bitcoin extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); @@ -19,9 +13,7 @@ Bitcoin.Transaction = Transaction; export declare namespace Bitcoin { export { Transaction as Transaction, - type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, - type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/bitcoin/index.ts b/src/resources/bitcoin/index.ts index e259b401..5692cbb7 100644 --- a/src/resources/bitcoin/index.ts +++ b/src/resources/bitcoin/index.ts @@ -1,10 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Bitcoin } from './bitcoin'; -export { - Transaction, - type TransactionReportResponse, - type TransactionScanResponse, - type TransactionReportParams, - type TransactionScanParams, -} from './transaction'; +export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; diff --git a/src/resources/bitcoin/transaction.ts b/src/resources/bitcoin/transaction.ts index 7054426e..09d0ba87 100644 --- a/src/resources/bitcoin/transaction.ts +++ b/src/resources/bitcoin/transaction.ts @@ -4,16 +4,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; export class Transaction extends APIResource { - /** - * Report Transaction - */ - report( - body: TransactionReportParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post('/v0/bitcoin/transaction/report', { body, ...options }); - } - /** * Scan Transaction */ @@ -22,8 +12,6 @@ export class Transaction extends APIResource { } } -export type TransactionReportResponse = number; - export interface TransactionScanResponse { /** * Simulation result; Only present if simulation option is included in the request @@ -453,75 +441,6 @@ export namespace TransactionScanResponse { } } -export interface TransactionReportParams { - details: string; - - event: 'should_be_malicious' | 'should_be_benign'; - - report: - | TransactionReportParams.BitcoinAppealRequestID - | TransactionReportParams.BitcoinAppealTransactionDataReport; -} - -export namespace TransactionReportParams { - export interface BitcoinAppealRequestID { - id: string; - - type?: 'request_id'; - } - - export interface BitcoinAppealTransactionDataReport { - params: BitcoinAppealTransactionDataReport.Params; - - type?: 'params'; - } - - export namespace BitcoinAppealTransactionDataReport { - export interface Params { - account_address: string; - - chain: 'bitcoin'; - - /** - * Metadata - */ - metadata: Params.BitcoinWalletRequestMetadata | Params.BitcoinInAppRequestMetadata; - - transaction: string; - - /** - * List of options to include in the response - * - * - `Options.validation`: Include Options.validation output in the response - * - * - `Options.simulation`: Include Options.simulation output in the response - */ - options?: Array<'validation' | 'simulation'>; - } - - export namespace Params { - export interface BitcoinWalletRequestMetadata { - /** - * Metadata for wallet requests - */ - type: 'wallet'; - - /** - * URL of the dApp originating the transaction - */ - url: string; - } - - export interface BitcoinInAppRequestMetadata { - /** - * Metadata for in-app requests - */ - type?: 'in_app'; - } - } - } -} - export interface TransactionScanParams { account_address: string; @@ -569,9 +488,7 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { - type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, - type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/starknet/index.ts b/src/resources/starknet/index.ts index a8ae638e..c9b06c23 100644 --- a/src/resources/starknet/index.ts +++ b/src/resources/starknet/index.ts @@ -9,10 +9,4 @@ export { type StarknetErc721Details, type StarknetErc721Diff, } from './starknet'; -export { - Transaction, - type TransactionReportResponse, - type TransactionScanResponse, - type TransactionReportParams, - type TransactionScanParams, -} from './transaction'; +export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; diff --git a/src/resources/starknet/starknet.ts b/src/resources/starknet/starknet.ts index cb3aea5c..ccf73a60 100644 --- a/src/resources/starknet/starknet.ts +++ b/src/resources/starknet/starknet.ts @@ -2,13 +2,7 @@ import { APIResource } from '../../resource'; import * as TransactionAPI from './transaction'; -import { - Transaction, - TransactionReportParams, - TransactionReportResponse, - TransactionScanParams, - TransactionScanResponse, -} from './transaction'; +import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; export class Starknet extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); @@ -175,9 +169,7 @@ export declare namespace Starknet { export { Transaction as Transaction, - type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, - type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/starknet/transaction.ts b/src/resources/starknet/transaction.ts index 616826bc..33c9651b 100644 --- a/src/resources/starknet/transaction.ts +++ b/src/resources/starknet/transaction.ts @@ -5,16 +5,6 @@ import * as Core from '../../core'; import * as StarknetAPI from './starknet'; export class Transaction extends APIResource { - /** - * Report Transaction - */ - report( - body: TransactionReportParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post('/v0/starknet/transaction/report', { body, ...options }); - } - /** * Scan Transactions */ @@ -23,8 +13,6 @@ export class Transaction extends APIResource { } } -export type TransactionReportResponse = number; - export interface TransactionScanResponse { /** * Simulation result; Only present if simulation option is included in the request @@ -502,220 +490,6 @@ export namespace TransactionScanResponse { } } -export interface TransactionReportParams { - details: string; - - event: 'should_be_malicious' | 'should_be_benign'; - - report: - | TransactionReportParams.StarknetAppealRequestID - | TransactionReportParams.StarknetAppealTransactionDataReport; -} - -export namespace TransactionReportParams { - export interface StarknetAppealRequestID { - id: string; - - type?: 'request_id'; - } - - export interface StarknetAppealTransactionDataReport { - params: StarknetAppealTransactionDataReport.Params; - - type?: 'params'; - } - - export namespace StarknetAppealTransactionDataReport { - export interface Params { - account_address: string; - - /** - * The chain name or chain ID - */ - chain: 'mainnet' | 'sepolia' | 'sepolia_integration' | (string & {}); - - /** - * Metadata - */ - metadata: Params.StarknetWalletRequestMetadata | Params.StarknetInAppRequestMetadata; - - transaction: - | Params.StarknetInvokeV1TransactionSchema - | Params.StarknetInvokeV3TransactionSchema - | Params.StarknetDeployAccountV1TransactionSchema - | Params.StarknetDeployAccountV3TransactionSchema; - - /** - * Optional block number or tag context for the simulation - */ - block_number?: string | null; - - /** - * List of options to include in the response - * - * - `Options.validation`: Include Options.validation output in the response - * - * - `Options.simulation`: Include Options.simulation output in the response - */ - options?: Array<'validation' | 'simulation'>; - } - - export namespace Params { - export interface StarknetWalletRequestMetadata { - /** - * Metadata for wallet requests - */ - type: 'wallet'; - - /** - * URL of the dApp originating the transaction - */ - url: string; - } - - export interface StarknetInAppRequestMetadata { - /** - * Metadata for in-app requests - */ - type?: 'in_app'; - } - - export interface StarknetInvokeV1TransactionSchema { - /** - * The maximum fee that the sender is willing to pay. - */ - max_fee: string; - - /** - * The nonce of the transaction. - */ - nonce: string; - - /** - * The address of the sender. - */ - sender_address: string; - - /** - * The version of the transaction. - */ - version: 1; - - /** - * The arguments that are passed to the validate and execute functions. - */ - calldata?: Array; - } - - export interface StarknetInvokeV3TransactionSchema { - /** - * The arguments that are passed to the validate and execute functions. - */ - calldata: Array; - - /** - * The id of the chain to which the transaction is sent. - */ - chain_id: string; - - /** - * The nonce of the transaction. - */ - nonce: string; - - /** - * The address of the sender. - */ - sender_address: string; - - /** - * The version of the transaction. - */ - version: 3; - - /** - * For future use. Currently this value is always empty. - */ - account_deployment_data?: Array; - - /** - * The nonce data availability mode. - */ - nonce_data_availability_mode?: 0; - - /** - * For future use. Currently this value is always empty. - */ - paymaster_data?: Array; - } - - export interface StarknetDeployAccountV1TransactionSchema { - /** - * The hash of the contract class. - */ - class_hash: string; - - /** - * The arguments that are passed to the constructor function. - */ - constructor_calldata: Array; - - /** - * The salt of the contract address. - */ - contract_address_salt: string; - - /** - * The maximum fee that the sender is willing to pay. - */ - max_fee: string; - - /** - * The nonce of the transaction. - */ - nonce: string; - - /** - * The version of the transaction. - */ - version: 1; - } - - export interface StarknetDeployAccountV3TransactionSchema { - /** - * The hash of the contract class. - */ - class_hash: string; - - /** - * The arguments that are passed to the constructor function. - */ - constructor_calldata: Array; - - /** - * The salt of the contract address. - */ - contract_address_salt: string; - - /** - * The maximum fee that the sender is willing to pay. - */ - max_fee: string; - - /** - * The nonce of the transaction. - */ - nonce: string; - - /** - * The version of the transaction. - */ - version: 3; - } - } - } -} - export interface TransactionScanParams { account_address: string; @@ -908,9 +682,7 @@ export namespace TransactionScanParams { export declare namespace Transaction { export { - type TransactionReportResponse as TransactionReportResponse, type TransactionScanResponse as TransactionScanResponse, - type TransactionReportParams as TransactionReportParams, type TransactionScanParams as TransactionScanParams, }; } diff --git a/src/resources/stellar/index.ts b/src/resources/stellar/index.ts index 800a3094..47d96825 100644 --- a/src/resources/stellar/index.ts +++ b/src/resources/stellar/index.ts @@ -10,9 +10,4 @@ export { type StellarTransactionScanRequest, type StellarTransactionScanResponse, } from './stellar'; -export { - Transaction, - type TransactionReportResponse, - type TransactionReportParams, - type TransactionScanParams, -} from './transaction'; +export { Transaction, type TransactionScanParams } from './transaction'; diff --git a/src/resources/stellar/stellar.ts b/src/resources/stellar/stellar.ts index 219a2613..e22b59aa 100644 --- a/src/resources/stellar/stellar.ts +++ b/src/resources/stellar/stellar.ts @@ -3,12 +3,7 @@ import { APIResource } from '../../resource'; import * as StellarAPI from './stellar'; import * as TransactionAPI from './transaction'; -import { - Transaction, - TransactionReportParams, - TransactionReportResponse, - TransactionScanParams, -} from './transaction'; +import { Transaction, TransactionScanParams } from './transaction'; export class Stellar extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); @@ -584,10 +579,5 @@ export declare namespace Stellar { type StellarTransactionScanResponse as StellarTransactionScanResponse, }; - export { - Transaction as Transaction, - type TransactionReportResponse as TransactionReportResponse, - type TransactionReportParams as TransactionReportParams, - type TransactionScanParams as TransactionScanParams, - }; + export { Transaction as Transaction, type TransactionScanParams as TransactionScanParams }; } diff --git a/src/resources/stellar/transaction.ts b/src/resources/stellar/transaction.ts index 3483f4f4..83f9c442 100644 --- a/src/resources/stellar/transaction.ts +++ b/src/resources/stellar/transaction.ts @@ -5,16 +5,6 @@ import * as Core from '../../core'; import * as StellarAPI from './stellar'; export class Transaction extends APIResource { - /** - * Report Transaction - */ - report( - body: TransactionReportParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post('/v0/stellar/transaction/report', { body, ...options }); - } - /** * Scan Transaction */ @@ -26,32 +16,6 @@ export class Transaction extends APIResource { } } -export type TransactionReportResponse = number; - -export interface TransactionReportParams { - details: string; - - event: 'should_be_malicious' | 'should_be_benign'; - - report: - | TransactionReportParams.StellarAppealRequestID - | TransactionReportParams.StellarAppealTransactionDataReport; -} - -export namespace TransactionReportParams { - export interface StellarAppealRequestID { - id: string; - - type?: 'request_id'; - } - - export interface StellarAppealTransactionDataReport { - params: StellarAPI.StellarTransactionScanRequest; - - type?: 'params'; - } -} - export interface TransactionScanParams { account_address: string; @@ -101,9 +65,5 @@ export namespace TransactionScanParams { } export declare namespace Transaction { - export { - type TransactionReportResponse as TransactionReportResponse, - type TransactionReportParams as TransactionReportParams, - type TransactionScanParams as TransactionScanParams, - }; + export { type TransactionScanParams as TransactionScanParams }; } diff --git a/tests/api-resources/bitcoin/transaction.test.ts b/tests/api-resources/bitcoin/transaction.test.ts index 55196b47..16e50953 100644 --- a/tests/api-resources/bitcoin/transaction.test.ts +++ b/tests/api-resources/bitcoin/transaction.test.ts @@ -9,29 +9,6 @@ const client = new Blockaid({ }); describe('resource transaction', () => { - test('report: only required params', async () => { - const responsePromise = client.bitcoin.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id' }, - }); - 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('report: required and optional params', async () => { - const response = await client.bitcoin.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id', type: 'request_id' }, - }); - }); - test('scan: only required params', async () => { const responsePromise = client.bitcoin.transaction.scan({ account_address: 'account_address', diff --git a/tests/api-resources/starknet/transaction.test.ts b/tests/api-resources/starknet/transaction.test.ts index 92070907..cdd0d343 100644 --- a/tests/api-resources/starknet/transaction.test.ts +++ b/tests/api-resources/starknet/transaction.test.ts @@ -9,29 +9,6 @@ const client = new Blockaid({ }); describe('resource transaction', () => { - test('report: only required params', async () => { - const responsePromise = client.starknet.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id' }, - }); - 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('report: required and optional params', async () => { - const response = await client.starknet.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id', type: 'request_id' }, - }); - }); - test('scan: only required params', async () => { const responsePromise = client.starknet.transaction.scan({ account_address: '0x62a2959fa6502b30cbfb51199fbbe72e72ee4f5a86ec754b4172c7d7beb6ff4', diff --git a/tests/api-resources/stellar/transaction.test.ts b/tests/api-resources/stellar/transaction.test.ts index 3cb0f617..529fd3d5 100644 --- a/tests/api-resources/stellar/transaction.test.ts +++ b/tests/api-resources/stellar/transaction.test.ts @@ -9,29 +9,6 @@ const client = new Blockaid({ }); describe('resource transaction', () => { - test('report: only required params', async () => { - const responsePromise = client.stellar.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id' }, - }); - 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('report: required and optional params', async () => { - const response = await client.stellar.transaction.report({ - details: 'details', - event: 'should_be_malicious', - report: { id: 'id', type: 'request_id' }, - }); - }); - test('scan: only required params', async () => { const responsePromise = client.stellar.transaction.scan({ account_address: 'GDPMFLKUGASUTWBN2XGYYKD27QGHCYH4BUFUTER4L23INYQ4JHDWFOIE', From 945e3f22cb00e7739efcc0a3e533015029586cde Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:32:38 +0000 Subject: [PATCH 15/18] feat(api): manual updates (#319) --- api.md | 16 +- src/index.ts | 14 +- src/resources/bitcoin/bitcoin.ts | 483 ++++++++++++++++++++++++- src/resources/bitcoin/index.ts | 4 +- src/resources/bitcoin/transaction.ts | 440 +---------------------- src/resources/index.ts | 7 +- src/resources/starknet/index.ts | 3 +- src/resources/starknet/starknet.ts | 487 +++++++++++++++++++++++++- src/resources/starknet/transaction.ts | 487 +------------------------- 9 files changed, 1000 insertions(+), 941 deletions(-) diff --git a/api.md b/api.md index 4ecce915..90cbe500 100644 --- a/api.md +++ b/api.md @@ -155,15 +155,16 @@ Methods: # Bitcoin -## Transaction - Types: -- TransactionScanResponse +- BitcoinTransactionScanRequest +- BitcoinTransactionScanResponse + +## Transaction Methods: -- client.bitcoin.transaction.scan({ ...params }) -> TransactionScanResponse +- client.bitcoin.transaction.scan({ ...params }) -> BitcoinTransactionScanResponse # Starknet @@ -175,16 +176,13 @@ Types: - StarknetErc20Diff - StarknetErc721Details - StarknetErc721Diff +- StarknetTransactionScanResponse ## Transaction -Types: - -- TransactionScanResponse - Methods: -- client.starknet.transaction.scan({ ...params }) -> TransactionScanResponse +- client.starknet.transaction.scan({ ...params }) -> StarknetTransactionScanResponse # Site diff --git a/src/index.ts b/src/index.ts index 832f12da..4439ff36 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,7 +22,11 @@ import { TokenScanResponse, } from './resources/token'; import { TokenBulk, TokenBulkScanParams, TokenBulkScanResponse } from './resources/token-bulk'; -import { Bitcoin } from './resources/bitcoin/bitcoin'; +import { + Bitcoin, + BitcoinTransactionScanRequest, + BitcoinTransactionScanResponse, +} from './resources/bitcoin/bitcoin'; import { Erc1155Diff, Erc1155Exposure, @@ -92,6 +96,7 @@ import { StarknetErc20Diff, StarknetErc721Details, StarknetErc721Diff, + StarknetTransactionScanResponse, } from './resources/starknet/starknet'; import { Stellar, @@ -417,7 +422,11 @@ export declare namespace Blockaid { type StellarTransactionScanResponse as StellarTransactionScanResponse, }; - export { Bitcoin as Bitcoin }; + export { + Bitcoin as Bitcoin, + type BitcoinTransactionScanRequest as BitcoinTransactionScanRequest, + type BitcoinTransactionScanResponse as BitcoinTransactionScanResponse, + }; export { Starknet as Starknet, @@ -427,6 +436,7 @@ export declare namespace Blockaid { type StarknetErc20Diff as StarknetErc20Diff, type StarknetErc721Details as StarknetErc721Details, type StarknetErc721Diff as StarknetErc721Diff, + type StarknetTransactionScanResponse as StarknetTransactionScanResponse, }; export { diff --git a/src/resources/bitcoin/bitcoin.ts b/src/resources/bitcoin/bitcoin.ts index e6ba4f57..8efe86e1 100644 --- a/src/resources/bitcoin/bitcoin.ts +++ b/src/resources/bitcoin/bitcoin.ts @@ -2,18 +2,493 @@ import { APIResource } from '../../resource'; import * as TransactionAPI from './transaction'; -import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; +import { Transaction, TransactionScanParams } from './transaction'; export class Bitcoin extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); } +export interface BitcoinTransactionScanRequest { + account_address: string; + + chain: 'bitcoin'; + + /** + * Metadata + */ + metadata: + | BitcoinTransactionScanRequest.BitcoinWalletRequestMetadata + | BitcoinTransactionScanRequest.BitcoinInAppRequestMetadata; + + transaction: string; + + /** + * List of options to include in the response + * + * - `Options.validation`: Include Options.validation output in the response + * + * - `Options.simulation`: Include Options.simulation output in the response + */ + options?: Array<'validation' | 'simulation'>; +} + +export namespace BitcoinTransactionScanRequest { + export interface BitcoinWalletRequestMetadata { + /** + * Metadata for wallet requests + */ + type: 'wallet'; + + /** + * URL of the dApp originating the transaction + */ + url: string; + } + + export interface BitcoinInAppRequestMetadata { + /** + * Metadata for in-app requests + */ + type?: 'in_app'; + } +} + +export interface BitcoinTransactionScanResponse { + /** + * Simulation result; Only present if simulation option is included in the request + */ + simulation?: + | BitcoinTransactionScanResponse.BitcoinSimulationResponse + | BitcoinTransactionScanResponse.BitcoinSimulationErrorSchema + | null; + + /** + * Validation result; Only present if validation option is included in the request + */ + validation?: + | BitcoinTransactionScanResponse.BitcoinValidationResult + | BitcoinTransactionScanResponse.BitcoinValidationErrorSchema + | null; +} + +export namespace BitcoinTransactionScanResponse { + export interface BitcoinSimulationResponse { + status: 'Success'; + + account_summary?: null; + + /** + * Details of addresses involved in the transaction + */ + address_details?: Array; + + /** + * Mapping between the address of an account to the assets diff during the + * transaction + */ + assets_diffs?: Record< + string, + Array< + | BitcoinSimulationResponse.BitcoinNativeAssetDiff + | BitcoinSimulationResponse.BitcoinOrdinalAssetDiff + | BitcoinSimulationResponse.BitcoinRunesAssetDiff + > + >; + } + + export namespace BitcoinSimulationResponse { + export interface AddressDetail { + /** + * Encoded public key of the account + */ + account_address: unknown; + + /** + * Description of the account + */ + description?: string | null; + } + + export interface BitcoinNativeAssetDiff { + asset: BitcoinNativeAssetDiff.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: BitcoinNativeAssetDiff.In | null; + + /** + * Details of the outgoing transfer + */ + out?: BitcoinNativeAssetDiff.Out | null; + } + + export namespace BitcoinNativeAssetDiff { + export interface Asset { + /** + * URL of the asset's logo + */ + logo_url: string | null; + + /** + * Decimals of the asset + */ + decimals?: 8; + + /** + * Name of the asset + */ + name?: 'Bitcoin'; + + /** + * Symbol of the asset + */ + symbol?: 'BTC'; + + /** + * Type of the asset (`NATIVE`) + */ + type?: 'NATIVE'; + } + + /** + * Details of the incoming transfer + */ + export interface In { + /** + * Raw value of the transfer + */ + raw_value: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + + /** + * Details of the outgoing transfer + */ + export interface Out { + /** + * Raw value of the transfer + */ + raw_value: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + + export interface BitcoinOrdinalAssetDiff { + asset: BitcoinOrdinalAssetDiff.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: BitcoinOrdinalAssetDiff.In | null; + + /** + * Details of the outgoing transfer + */ + out?: BitcoinOrdinalAssetDiff.Out | null; + } + + export namespace BitcoinOrdinalAssetDiff { + export interface Asset { + /** + * token's name + */ + name: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`ORDINAL`) + */ + type?: 'ORDINAL'; + } + + /** + * Details of the incoming transfer + */ + export interface In { + /** + * Id of the ordinal + */ + id: string; + + /** + * Raw value of the transfer + */ + raw_value: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + + /** + * Details of the outgoing transfer + */ + export interface Out { + /** + * Id of the ordinal + */ + id: string; + + /** + * Raw value of the transfer + */ + raw_value: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + + export interface BitcoinRunesAssetDiff { + asset: BitcoinRunesAssetDiff.Asset; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: BitcoinRunesAssetDiff.In | null; + + /** + * Details of the outgoing transfer + */ + out?: BitcoinRunesAssetDiff.Out | null; + } + + export namespace BitcoinRunesAssetDiff { + export interface Asset { + /** + * The Rune ID + */ + id: string; + + /** + * Decimals of the asset + */ + decimals: number; + + /** + * The Rune name + */ + name: string; + + /** + * The Rune spaced name + */ + spaced_name: string; + + /** + * token's symbol + */ + symbol: string; + + /** + * URL of the asset's logo + */ + logo_url?: string | null; + + /** + * Type of the asset (`RUNE`) + */ + type?: 'RUNE'; + } + + /** + * Details of the incoming transfer + */ + export interface In { + /** + * Raw value of the transfer + */ + raw_value: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + + /** + * Details of the outgoing transfer + */ + export interface Out { + /** + * Raw value of the transfer + */ + raw_value: string; + + /** + * USD price of the asset + */ + usd_price: string; + + /** + * Value of the transfer + */ + value: string; + + /** + * Summarized description of the transfer + */ + summary?: string | null; + } + } + } + + export interface BitcoinSimulationErrorSchema { + /** + * Error message + */ + error: string; + + status: 'Error'; + } + + export interface BitcoinValidationResult { + /** + * A textual classification that can be presented to the user explaining the + * reason. + */ + classification: string; + + /** + * A textual description about the validation result + */ + description: string; + + features: Array; + + /** + * A textual description about the reasons the transaction was flagged with + * result_type + */ + reason: string; + + /** + * Verdict of the validation + */ + result_type: 'Benign' | 'Warning' | 'Malicious'; + + status: 'Success'; + } + + export namespace BitcoinValidationResult { + export interface Feature { + /** + * Address the feature refers to + */ + address: string; + + /** + * Textual description + */ + description: string; + + feature_id: string; + + /** + * Feature Classification + */ + type: 'Benign' | 'Warning' | 'Malicious' | 'Info'; + } + } + + export interface BitcoinValidationErrorSchema { + /** + * Error message + */ + error: string; + + status: 'Error'; + } +} + Bitcoin.Transaction = Transaction; export declare namespace Bitcoin { export { - Transaction as Transaction, - type TransactionScanResponse as TransactionScanResponse, - type TransactionScanParams as TransactionScanParams, + type BitcoinTransactionScanRequest as BitcoinTransactionScanRequest, + type BitcoinTransactionScanResponse as BitcoinTransactionScanResponse, }; + + export { Transaction as Transaction, type TransactionScanParams as TransactionScanParams }; } diff --git a/src/resources/bitcoin/index.ts b/src/resources/bitcoin/index.ts index 5692cbb7..e7c7a49b 100644 --- a/src/resources/bitcoin/index.ts +++ b/src/resources/bitcoin/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Bitcoin } from './bitcoin'; -export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; +export { Bitcoin, type BitcoinTransactionScanRequest, type BitcoinTransactionScanResponse } from './bitcoin'; +export { Transaction, type TransactionScanParams } from './transaction'; diff --git a/src/resources/bitcoin/transaction.ts b/src/resources/bitcoin/transaction.ts index 09d0ba87..970a0096 100644 --- a/src/resources/bitcoin/transaction.ts +++ b/src/resources/bitcoin/transaction.ts @@ -2,445 +2,20 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; +import * as BitcoinAPI from './bitcoin'; export class Transaction extends APIResource { /** * Scan Transaction */ - scan(body: TransactionScanParams, options?: Core.RequestOptions): Core.APIPromise { + scan( + body: TransactionScanParams, + options?: Core.RequestOptions, + ): Core.APIPromise { return this._client.post('/v0/bitcoin/transaction/scan', { body, ...options }); } } -export interface TransactionScanResponse { - /** - * Simulation result; Only present if simulation option is included in the request - */ - simulation?: - | TransactionScanResponse.BitcoinSimulationResponse - | TransactionScanResponse.BitcoinSimulationErrorSchema - | null; - - /** - * Validation result; Only present if validation option is included in the request - */ - validation?: - | TransactionScanResponse.BitcoinValidationResult - | TransactionScanResponse.BitcoinValidationErrorSchema - | null; -} - -export namespace TransactionScanResponse { - export interface BitcoinSimulationResponse { - status: 'Success'; - - account_summary?: null; - - /** - * Details of addresses involved in the transaction - */ - address_details?: Array; - - /** - * Mapping between the address of an account to the assets diff during the - * transaction - */ - assets_diffs?: Record< - string, - Array< - | BitcoinSimulationResponse.BitcoinNativeAssetDiff - | BitcoinSimulationResponse.BitcoinOrdinalAssetDiff - | BitcoinSimulationResponse.BitcoinRunesAssetDiff - > - >; - } - - export namespace BitcoinSimulationResponse { - export interface AddressDetail { - /** - * Encoded public key of the account - */ - account_address: unknown; - - /** - * Description of the account - */ - description?: string | null; - } - - export interface BitcoinNativeAssetDiff { - asset: BitcoinNativeAssetDiff.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: BitcoinNativeAssetDiff.In | null; - - /** - * Details of the outgoing transfer - */ - out?: BitcoinNativeAssetDiff.Out | null; - } - - export namespace BitcoinNativeAssetDiff { - export interface Asset { - /** - * URL of the asset's logo - */ - logo_url: string | null; - - /** - * Decimals of the asset - */ - decimals?: 8; - - /** - * Name of the asset - */ - name?: 'Bitcoin'; - - /** - * Symbol of the asset - */ - symbol?: 'BTC'; - - /** - * Type of the asset (`NATIVE`) - */ - type?: 'NATIVE'; - } - - /** - * Details of the incoming transfer - */ - export interface In { - /** - * Raw value of the transfer - */ - raw_value: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - - /** - * Details of the outgoing transfer - */ - export interface Out { - /** - * Raw value of the transfer - */ - raw_value: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - - export interface BitcoinOrdinalAssetDiff { - asset: BitcoinOrdinalAssetDiff.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: BitcoinOrdinalAssetDiff.In | null; - - /** - * Details of the outgoing transfer - */ - out?: BitcoinOrdinalAssetDiff.Out | null; - } - - export namespace BitcoinOrdinalAssetDiff { - export interface Asset { - /** - * token's name - */ - name: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`ORDINAL`) - */ - type?: 'ORDINAL'; - } - - /** - * Details of the incoming transfer - */ - export interface In { - /** - * Id of the ordinal - */ - id: string; - - /** - * Raw value of the transfer - */ - raw_value: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - - /** - * Details of the outgoing transfer - */ - export interface Out { - /** - * Id of the ordinal - */ - id: string; - - /** - * Raw value of the transfer - */ - raw_value: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - - export interface BitcoinRunesAssetDiff { - asset: BitcoinRunesAssetDiff.Asset; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: BitcoinRunesAssetDiff.In | null; - - /** - * Details of the outgoing transfer - */ - out?: BitcoinRunesAssetDiff.Out | null; - } - - export namespace BitcoinRunesAssetDiff { - export interface Asset { - /** - * The Rune ID - */ - id: string; - - /** - * Decimals of the asset - */ - decimals: number; - - /** - * The Rune name - */ - name: string; - - /** - * The Rune spaced name - */ - spaced_name: string; - - /** - * token's symbol - */ - symbol: string; - - /** - * URL of the asset's logo - */ - logo_url?: string | null; - - /** - * Type of the asset (`RUNE`) - */ - type?: 'RUNE'; - } - - /** - * Details of the incoming transfer - */ - export interface In { - /** - * Raw value of the transfer - */ - raw_value: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - - /** - * Details of the outgoing transfer - */ - export interface Out { - /** - * Raw value of the transfer - */ - raw_value: string; - - /** - * USD price of the asset - */ - usd_price: string; - - /** - * Value of the transfer - */ - value: string; - - /** - * Summarized description of the transfer - */ - summary?: string | null; - } - } - } - - export interface BitcoinSimulationErrorSchema { - /** - * Error message - */ - error: string; - - status: 'Error'; - } - - export interface BitcoinValidationResult { - /** - * A textual classification that can be presented to the user explaining the - * reason. - */ - classification: string; - - /** - * A textual description about the validation result - */ - description: string; - - features: Array; - - /** - * A textual description about the reasons the transaction was flagged with - * result_type - */ - reason: string; - - /** - * Verdict of the validation - */ - result_type: 'Benign' | 'Warning' | 'Malicious'; - - status: 'Success'; - } - - export namespace BitcoinValidationResult { - export interface Feature { - /** - * Address the feature refers to - */ - address: string; - - /** - * Textual description - */ - description: string; - - feature_id: string; - - /** - * Feature Classification - */ - type: 'Benign' | 'Warning' | 'Malicious' | 'Info'; - } - } - - export interface BitcoinValidationErrorSchema { - /** - * Error message - */ - error: string; - - status: 'Error'; - } -} - export interface TransactionScanParams { account_address: string; @@ -487,8 +62,5 @@ export namespace TransactionScanParams { } export declare namespace Transaction { - export { - type TransactionScanResponse as TransactionScanResponse, - type TransactionScanParams as TransactionScanParams, - }; + export { type TransactionScanParams as TransactionScanParams }; } diff --git a/src/resources/index.ts b/src/resources/index.ts index d2f344c2..8271cf81 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -1,6 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Bitcoin } from './bitcoin/bitcoin'; +export { + Bitcoin, + type BitcoinTransactionScanRequest, + type BitcoinTransactionScanResponse, +} from './bitcoin/bitcoin'; export { Evm, type Erc1155Diff, @@ -79,6 +83,7 @@ export { type StarknetErc20Diff, type StarknetErc721Details, type StarknetErc721Diff, + type StarknetTransactionScanResponse, } from './starknet/starknet'; export { Stellar, diff --git a/src/resources/starknet/index.ts b/src/resources/starknet/index.ts index c9b06c23..8ac1617a 100644 --- a/src/resources/starknet/index.ts +++ b/src/resources/starknet/index.ts @@ -8,5 +8,6 @@ export { type StarknetErc20Diff, type StarknetErc721Details, type StarknetErc721Diff, + type StarknetTransactionScanResponse, } from './starknet'; -export { Transaction, type TransactionScanResponse, type TransactionScanParams } from './transaction'; +export { Transaction, type TransactionScanParams } from './transaction'; diff --git a/src/resources/starknet/starknet.ts b/src/resources/starknet/starknet.ts index ccf73a60..fb16c573 100644 --- a/src/resources/starknet/starknet.ts +++ b/src/resources/starknet/starknet.ts @@ -1,8 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; +import * as StarknetAPI from './starknet'; import * as TransactionAPI from './transaction'; -import { Transaction, TransactionScanParams, TransactionScanResponse } from './transaction'; +import { Transaction, TransactionScanParams } from './transaction'; export class Starknet extends APIResource { transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client); @@ -155,6 +156,483 @@ export interface StarknetErc721Diff { summary?: string | null; } +export interface StarknetTransactionScanResponse { + /** + * Simulation result; Only present if simulation option is included in the request + */ + simulation?: + | StarknetTransactionScanResponse.StarknetStarknetSimulationResultSchema + | StarknetTransactionScanResponse.StarknetSimulationErrorSchema + | null; + + /** + * Validation result; Only present if validation option is included in the request + */ + validation?: + | StarknetTransactionScanResponse.StarknetValidationResult + | StarknetTransactionScanResponse.StarknetValidationErrorSchema + | null; +} + +export namespace StarknetTransactionScanResponse { + export interface StarknetStarknetSimulationResultSchema { + /** + * Summary of the actions and asset transfers that were made by the requested + * account address + */ + account_summary: StarknetStarknetSimulationResultSchema.AccountSummary; + + status: 'Success'; + + /** + * Details of addresses involved in the transaction + */ + address_details?: Array; + + /** + * Mapping between the address of an account to the assets diff during the + * transaction + */ + assets_diffs?: Record< + string, + Array< + | StarknetStarknetSimulationResultSchema.StarknetErc20AssetDiff + | StarknetStarknetSimulationResultSchema.StarknetErc721AssetDiff + | StarknetStarknetSimulationResultSchema.StarknetErc1155AssetDiff + > + >; + + /** + * Optional block number or tag context for the simulation + */ + block_number?: string | null; + + /** + * Mapping between the address of an account to the exposure of the assets during + * the transaction + */ + exposures?: Record< + string, + Array< + | StarknetStarknetSimulationResultSchema.StarknetErc20Exposure + | StarknetStarknetSimulationResultSchema.StarknetErc721Exposure + | StarknetStarknetSimulationResultSchema.StarknetErc1155Exposure + > + >; + } + + export namespace StarknetStarknetSimulationResultSchema { + /** + * Summary of the actions and asset transfers that were made by the requested + * account address + */ + export interface AccountSummary { + /** + * Exposures made by the requested account address + */ + account_exposures: Array< + | AccountSummary.StarknetErc20Exposure + | AccountSummary.StarknetErc721Exposure + | AccountSummary.StarknetErc1155Exposure + >; + + /** + * Total USD diff for the requested account address + */ + total_usd_diff: AccountSummary.TotalUsdDiff; + + /** + * Assets diffs of the requested account address + */ + account_assets_diffs?: Array< + | AccountSummary.StarknetErc20AssetDiff + | AccountSummary.StarknetErc721AssetDiff + | AccountSummary.StarknetErc1155AssetDiff + >; + + /** + * Total USD exposure for each of the spender addresses during the transaction + */ + total_usd_exposure?: Record; + } + + export namespace AccountSummary { + export interface StarknetErc20Exposure { + asset: StarknetAPI.StarknetErc20Details; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export namespace StarknetErc20Exposure { + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + } + + export interface StarknetErc721Exposure { + asset: StarknetAPI.StarknetErc721Details; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export namespace StarknetErc721Exposure { + export interface Spenders { + exposure: Array; + + /** + * Whether `setApprovalForAll` was invoked + */ + is_approved_for_all: boolean; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + } + + export interface StarknetErc1155Exposure { + asset: StarknetAPI.StarknetErc1155Details; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export namespace StarknetErc1155Exposure { + export interface Spenders { + exposure: Array; + + /** + * Whether `setApprovalForAll` was invoked + */ + is_approved_for_all: boolean; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + } + + /** + * Total USD diff for the requested account address + */ + export interface TotalUsdDiff { + /** + * Total incoming USD transfers + */ + in: number; + + /** + * Total outgoing USD transfers + */ + out: number; + + /** + * Total USD transfers + */ + total?: number; + } + + export interface StarknetErc20AssetDiff { + asset: StarknetAPI.StarknetErc20Details; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StarknetAPI.StarknetErc20Diff | null; + + /** + * Details of the outgoing transfer + */ + out?: StarknetAPI.StarknetErc20Diff | null; + } + + export interface StarknetErc721AssetDiff { + asset: StarknetAPI.StarknetErc721Details; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StarknetAPI.StarknetErc721Diff | null; + + /** + * Details of the outgoing transfer + */ + out?: StarknetAPI.StarknetErc721Diff | null; + } + + export interface StarknetErc1155AssetDiff { + asset: StarknetAPI.StarknetErc1155Details; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StarknetAPI.StarknetErc1155Diff | null; + + /** + * Details of the outgoing transfer + */ + out?: StarknetAPI.StarknetErc1155Diff | null; + } + } + + export interface AddressDetail { + /** + * Encoded public key of the account + */ + account_address: unknown; + + /** + * Description of the account + */ + description?: string | null; + } + + export interface StarknetErc20AssetDiff { + asset: StarknetAPI.StarknetErc20Details; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StarknetAPI.StarknetErc20Diff | null; + + /** + * Details of the outgoing transfer + */ + out?: StarknetAPI.StarknetErc20Diff | null; + } + + export interface StarknetErc721AssetDiff { + asset: StarknetAPI.StarknetErc721Details; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StarknetAPI.StarknetErc721Diff | null; + + /** + * Details of the outgoing transfer + */ + out?: StarknetAPI.StarknetErc721Diff | null; + } + + export interface StarknetErc1155AssetDiff { + asset: StarknetAPI.StarknetErc1155Details; + + /** + * The type of the assets in this diff + */ + asset_type: string; + + /** + * Details of the incoming transfer + */ + in?: StarknetAPI.StarknetErc1155Diff | null; + + /** + * Details of the outgoing transfer + */ + out?: StarknetAPI.StarknetErc1155Diff | null; + } + + export interface StarknetErc20Exposure { + asset: StarknetAPI.StarknetErc20Details; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export namespace StarknetErc20Exposure { + export interface Spenders { + /** + * Approval value of the ERC20 token + */ + approval: string; + + exposure: Array; + + /** + * Expiration date of the approval + */ + expiration?: string | null; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + } + + export interface StarknetErc721Exposure { + asset: StarknetAPI.StarknetErc721Details; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export namespace StarknetErc721Exposure { + export interface Spenders { + exposure: Array; + + /** + * Whether `setApprovalForAll` was invoked + */ + is_approved_for_all: boolean; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + } + + export interface StarknetErc1155Exposure { + asset: StarknetAPI.StarknetErc1155Details; + + /** + * Mapping between the spender address and the exposure of the asset + */ + spenders?: Record; + } + + export namespace StarknetErc1155Exposure { + export interface Spenders { + exposure: Array; + + /** + * Whether `setApprovalForAll` was invoked + */ + is_approved_for_all: boolean; + + /** + * Summarized description of the exposure + */ + summary?: string | null; + } + } + } + + export interface StarknetSimulationErrorSchema { + /** + * Error message + */ + error: string; + + status: 'Error'; + } + + export interface StarknetValidationResult { + /** + * A textual classification that can be presented to the user explaining the + * reason. + */ + classification: string; + + /** + * A textual description about the validation result + */ + description: string; + + features: Array; + + /** + * A textual description about the reasons the transaction was flagged with + * result_type + */ + reason: string; + + /** + * Verdict of the validation + */ + result_type: 'Benign' | 'Warning' | 'Malicious'; + + status: 'Success'; + } + + export namespace StarknetValidationResult { + export interface Feature { + /** + * Address the feature refers to + */ + address: string; + + /** + * Textual description + */ + description: string; + + feature_id: string; + + /** + * Feature Classification + */ + type: 'Benign' | 'Warning' | 'Malicious' | 'Info'; + } + } + + export interface StarknetValidationErrorSchema { + /** + * Error message + */ + error: string; + + status: 'Error'; + } +} + Starknet.Transaction = Transaction; export declare namespace Starknet { @@ -165,11 +643,8 @@ export declare namespace Starknet { type StarknetErc20Diff as StarknetErc20Diff, type StarknetErc721Details as StarknetErc721Details, type StarknetErc721Diff as StarknetErc721Diff, + type StarknetTransactionScanResponse as StarknetTransactionScanResponse, }; - export { - Transaction as Transaction, - type TransactionScanResponse as TransactionScanResponse, - type TransactionScanParams as TransactionScanParams, - }; + export { Transaction as Transaction, type TransactionScanParams as TransactionScanParams }; } diff --git a/src/resources/starknet/transaction.ts b/src/resources/starknet/transaction.ts index 33c9651b..41b3af77 100644 --- a/src/resources/starknet/transaction.ts +++ b/src/resources/starknet/transaction.ts @@ -8,488 +8,14 @@ export class Transaction extends APIResource { /** * Scan Transactions */ - scan(body: TransactionScanParams, options?: Core.RequestOptions): Core.APIPromise { + scan( + body: TransactionScanParams, + options?: Core.RequestOptions, + ): Core.APIPromise { return this._client.post('/v0/starknet/transaction/scan', { body, ...options }); } } -export interface TransactionScanResponse { - /** - * Simulation result; Only present if simulation option is included in the request - */ - simulation?: - | TransactionScanResponse.StarknetStarknetSimulationResultSchema - | TransactionScanResponse.StarknetSimulationErrorSchema - | null; - - /** - * Validation result; Only present if validation option is included in the request - */ - validation?: - | TransactionScanResponse.StarknetValidationResult - | TransactionScanResponse.StarknetValidationErrorSchema - | null; -} - -export namespace TransactionScanResponse { - export interface StarknetStarknetSimulationResultSchema { - /** - * Summary of the actions and asset transfers that were made by the requested - * account address - */ - account_summary: StarknetStarknetSimulationResultSchema.AccountSummary; - - status: 'Success'; - - /** - * Details of addresses involved in the transaction - */ - address_details?: Array; - - /** - * Mapping between the address of an account to the assets diff during the - * transaction - */ - assets_diffs?: Record< - string, - Array< - | StarknetStarknetSimulationResultSchema.StarknetErc20AssetDiff - | StarknetStarknetSimulationResultSchema.StarknetErc721AssetDiff - | StarknetStarknetSimulationResultSchema.StarknetErc1155AssetDiff - > - >; - - /** - * Optional block number or tag context for the simulation - */ - block_number?: string | null; - - /** - * Mapping between the address of an account to the exposure of the assets during - * the transaction - */ - exposures?: Record< - string, - Array< - | StarknetStarknetSimulationResultSchema.StarknetErc20Exposure - | StarknetStarknetSimulationResultSchema.StarknetErc721Exposure - | StarknetStarknetSimulationResultSchema.StarknetErc1155Exposure - > - >; - } - - export namespace StarknetStarknetSimulationResultSchema { - /** - * Summary of the actions and asset transfers that were made by the requested - * account address - */ - export interface AccountSummary { - /** - * Exposures made by the requested account address - */ - account_exposures: Array< - | AccountSummary.StarknetErc20Exposure - | AccountSummary.StarknetErc721Exposure - | AccountSummary.StarknetErc1155Exposure - >; - - /** - * Total USD diff for the requested account address - */ - total_usd_diff: AccountSummary.TotalUsdDiff; - - /** - * Assets diffs of the requested account address - */ - account_assets_diffs?: Array< - | AccountSummary.StarknetErc20AssetDiff - | AccountSummary.StarknetErc721AssetDiff - | AccountSummary.StarknetErc1155AssetDiff - >; - - /** - * Total USD exposure for each of the spender addresses during the transaction - */ - total_usd_exposure?: Record; - } - - export namespace AccountSummary { - export interface StarknetErc20Exposure { - asset: StarknetAPI.StarknetErc20Details; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StarknetErc20Exposure { - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - } - - export interface StarknetErc721Exposure { - asset: StarknetAPI.StarknetErc721Details; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StarknetErc721Exposure { - export interface Spenders { - exposure: Array; - - /** - * Whether `setApprovalForAll` was invoked - */ - is_approved_for_all: boolean; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - } - - export interface StarknetErc1155Exposure { - asset: StarknetAPI.StarknetErc1155Details; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StarknetErc1155Exposure { - export interface Spenders { - exposure: Array; - - /** - * Whether `setApprovalForAll` was invoked - */ - is_approved_for_all: boolean; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - } - - /** - * Total USD diff for the requested account address - */ - export interface TotalUsdDiff { - /** - * Total incoming USD transfers - */ - in: number; - - /** - * Total outgoing USD transfers - */ - out: number; - - /** - * Total USD transfers - */ - total?: number; - } - - export interface StarknetErc20AssetDiff { - asset: StarknetAPI.StarknetErc20Details; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StarknetAPI.StarknetErc20Diff | null; - - /** - * Details of the outgoing transfer - */ - out?: StarknetAPI.StarknetErc20Diff | null; - } - - export interface StarknetErc721AssetDiff { - asset: StarknetAPI.StarknetErc721Details; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StarknetAPI.StarknetErc721Diff | null; - - /** - * Details of the outgoing transfer - */ - out?: StarknetAPI.StarknetErc721Diff | null; - } - - export interface StarknetErc1155AssetDiff { - asset: StarknetAPI.StarknetErc1155Details; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StarknetAPI.StarknetErc1155Diff | null; - - /** - * Details of the outgoing transfer - */ - out?: StarknetAPI.StarknetErc1155Diff | null; - } - } - - export interface AddressDetail { - /** - * Encoded public key of the account - */ - account_address: unknown; - - /** - * Description of the account - */ - description?: string | null; - } - - export interface StarknetErc20AssetDiff { - asset: StarknetAPI.StarknetErc20Details; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StarknetAPI.StarknetErc20Diff | null; - - /** - * Details of the outgoing transfer - */ - out?: StarknetAPI.StarknetErc20Diff | null; - } - - export interface StarknetErc721AssetDiff { - asset: StarknetAPI.StarknetErc721Details; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StarknetAPI.StarknetErc721Diff | null; - - /** - * Details of the outgoing transfer - */ - out?: StarknetAPI.StarknetErc721Diff | null; - } - - export interface StarknetErc1155AssetDiff { - asset: StarknetAPI.StarknetErc1155Details; - - /** - * The type of the assets in this diff - */ - asset_type: string; - - /** - * Details of the incoming transfer - */ - in?: StarknetAPI.StarknetErc1155Diff | null; - - /** - * Details of the outgoing transfer - */ - out?: StarknetAPI.StarknetErc1155Diff | null; - } - - export interface StarknetErc20Exposure { - asset: StarknetAPI.StarknetErc20Details; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StarknetErc20Exposure { - export interface Spenders { - /** - * Approval value of the ERC20 token - */ - approval: string; - - exposure: Array; - - /** - * Expiration date of the approval - */ - expiration?: string | null; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - } - - export interface StarknetErc721Exposure { - asset: StarknetAPI.StarknetErc721Details; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StarknetErc721Exposure { - export interface Spenders { - exposure: Array; - - /** - * Whether `setApprovalForAll` was invoked - */ - is_approved_for_all: boolean; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - } - - export interface StarknetErc1155Exposure { - asset: StarknetAPI.StarknetErc1155Details; - - /** - * Mapping between the spender address and the exposure of the asset - */ - spenders?: Record; - } - - export namespace StarknetErc1155Exposure { - export interface Spenders { - exposure: Array; - - /** - * Whether `setApprovalForAll` was invoked - */ - is_approved_for_all: boolean; - - /** - * Summarized description of the exposure - */ - summary?: string | null; - } - } - } - - export interface StarknetSimulationErrorSchema { - /** - * Error message - */ - error: string; - - status: 'Error'; - } - - export interface StarknetValidationResult { - /** - * A textual classification that can be presented to the user explaining the - * reason. - */ - classification: string; - - /** - * A textual description about the validation result - */ - description: string; - - features: Array; - - /** - * A textual description about the reasons the transaction was flagged with - * result_type - */ - reason: string; - - /** - * Verdict of the validation - */ - result_type: 'Benign' | 'Warning' | 'Malicious'; - - status: 'Success'; - } - - export namespace StarknetValidationResult { - export interface Feature { - /** - * Address the feature refers to - */ - address: string; - - /** - * Textual description - */ - description: string; - - feature_id: string; - - /** - * Feature Classification - */ - type: 'Benign' | 'Warning' | 'Malicious' | 'Info'; - } - } - - export interface StarknetValidationErrorSchema { - /** - * Error message - */ - error: string; - - status: 'Error'; - } -} - export interface TransactionScanParams { account_address: string; @@ -681,8 +207,5 @@ export namespace TransactionScanParams { } export declare namespace Transaction { - export { - type TransactionScanResponse as TransactionScanResponse, - type TransactionScanParams as TransactionScanParams, - }; + export { type TransactionScanParams as TransactionScanParams }; } From 91468ddf6d495db79bfc5b772afd5a376b7b0857 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:06:15 +0000 Subject: [PATCH 16/18] feat(api): api update (#320) --- .stats.yml | 2 +- api.md | 1 + src/index.ts | 2 + src/resources/index.ts | 1 + src/resources/starknet/index.ts | 1 + src/resources/starknet/starknet.ts | 191 +++++++++++++++++++++++++++++ 6 files changed, 197 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index d92431ae..eb54141e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 19 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-a8d116e345ec36054b1a8cc6fa98564ede39989a9b9ce1383f9e37738dcf33ff.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-ea8d982a096c639a061ee5f1a2b05747ff416b95357d92f56d01e6c537098066.yml diff --git a/api.md b/api.md index 90cbe500..bb51908a 100644 --- a/api.md +++ b/api.md @@ -176,6 +176,7 @@ Types: - StarknetErc20Diff - StarknetErc721Details - StarknetErc721Diff +- StarknetTransactionScanRequest - StarknetTransactionScanResponse ## Transaction diff --git a/src/index.ts b/src/index.ts index 4439ff36..a8c1de73 100644 --- a/src/index.ts +++ b/src/index.ts @@ -96,6 +96,7 @@ import { StarknetErc20Diff, StarknetErc721Details, StarknetErc721Diff, + StarknetTransactionScanRequest, StarknetTransactionScanResponse, } from './resources/starknet/starknet'; import { @@ -436,6 +437,7 @@ export declare namespace Blockaid { type StarknetErc20Diff as StarknetErc20Diff, type StarknetErc721Details as StarknetErc721Details, type StarknetErc721Diff as StarknetErc721Diff, + type StarknetTransactionScanRequest as StarknetTransactionScanRequest, type StarknetTransactionScanResponse as StarknetTransactionScanResponse, }; diff --git a/src/resources/index.ts b/src/resources/index.ts index 8271cf81..0f478c66 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -83,6 +83,7 @@ export { type StarknetErc20Diff, type StarknetErc721Details, type StarknetErc721Diff, + type StarknetTransactionScanRequest, type StarknetTransactionScanResponse, } from './starknet/starknet'; export { diff --git a/src/resources/starknet/index.ts b/src/resources/starknet/index.ts index 8ac1617a..107999c9 100644 --- a/src/resources/starknet/index.ts +++ b/src/resources/starknet/index.ts @@ -8,6 +8,7 @@ export { type StarknetErc20Diff, type StarknetErc721Details, type StarknetErc721Diff, + type StarknetTransactionScanRequest, type StarknetTransactionScanResponse, } from './starknet'; export { Transaction, type TransactionScanParams } from './transaction'; diff --git a/src/resources/starknet/starknet.ts b/src/resources/starknet/starknet.ts index fb16c573..e0b1d31f 100644 --- a/src/resources/starknet/starknet.ts +++ b/src/resources/starknet/starknet.ts @@ -156,6 +156,196 @@ export interface StarknetErc721Diff { summary?: string | null; } +export interface StarknetTransactionScanRequest { + account_address: string; + + /** + * The chain name or chain ID + */ + chain: 'mainnet' | 'sepolia' | 'sepolia_integration' | (string & {}); + + /** + * Metadata + */ + metadata: + | StarknetTransactionScanRequest.StarknetWalletRequestMetadata + | StarknetTransactionScanRequest.StarknetInAppRequestMetadata; + + transaction: + | StarknetTransactionScanRequest.StarknetInvokeV1TransactionSchema + | StarknetTransactionScanRequest.StarknetInvokeV3TransactionSchema + | StarknetTransactionScanRequest.StarknetDeployAccountV1TransactionSchema + | StarknetTransactionScanRequest.StarknetDeployAccountV3TransactionSchema; + + /** + * Optional block number or tag context for the simulation + */ + block_number?: string | null; + + /** + * List of options to include in the response + * + * - `Options.validation`: Include Options.validation output in the response + * + * - `Options.simulation`: Include Options.simulation output in the response + */ + options?: Array<'validation' | 'simulation'>; +} + +export namespace StarknetTransactionScanRequest { + export interface StarknetWalletRequestMetadata { + /** + * Metadata for wallet requests + */ + type: 'wallet'; + + /** + * URL of the dApp originating the transaction + */ + url: string; + } + + export interface StarknetInAppRequestMetadata { + /** + * Metadata for in-app requests + */ + type?: 'in_app'; + } + + export interface StarknetInvokeV1TransactionSchema { + /** + * The maximum fee that the sender is willing to pay. + */ + max_fee: string; + + /** + * The nonce of the transaction. + */ + nonce: string; + + /** + * The address of the sender. + */ + sender_address: string; + + /** + * The version of the transaction. + */ + version: 1; + + /** + * The arguments that are passed to the validate and execute functions. + */ + calldata?: Array; + } + + export interface StarknetInvokeV3TransactionSchema { + /** + * The arguments that are passed to the validate and execute functions. + */ + calldata: Array; + + /** + * The id of the chain to which the transaction is sent. + */ + chain_id: string; + + /** + * The nonce of the transaction. + */ + nonce: string; + + /** + * The address of the sender. + */ + sender_address: string; + + /** + * The version of the transaction. + */ + version: 3; + + /** + * For future use. Currently this value is always empty. + */ + account_deployment_data?: Array; + + /** + * The nonce data availability mode. + */ + nonce_data_availability_mode?: 0; + + /** + * For future use. Currently this value is always empty. + */ + paymaster_data?: Array; + } + + export interface StarknetDeployAccountV1TransactionSchema { + /** + * The hash of the contract class. + */ + class_hash: string; + + /** + * The arguments that are passed to the constructor function. + */ + constructor_calldata: Array; + + /** + * The salt of the contract address. + */ + contract_address_salt: string; + + /** + * The maximum fee that the sender is willing to pay. + */ + max_fee: string; + + /** + * The nonce of the transaction. + */ + nonce: string; + + /** + * The version of the transaction. + */ + version: 1; + } + + export interface StarknetDeployAccountV3TransactionSchema { + /** + * The hash of the contract class. + */ + class_hash: string; + + /** + * The arguments that are passed to the constructor function. + */ + constructor_calldata: Array; + + /** + * The salt of the contract address. + */ + contract_address_salt: string; + + /** + * The maximum fee that the sender is willing to pay. + */ + max_fee: string; + + /** + * The nonce of the transaction. + */ + nonce: string; + + /** + * The version of the transaction. + */ + version: 3; + } +} + export interface StarknetTransactionScanResponse { /** * Simulation result; Only present if simulation option is included in the request @@ -643,6 +833,7 @@ export declare namespace Starknet { type StarknetErc20Diff as StarknetErc20Diff, type StarknetErc721Details as StarknetErc721Details, type StarknetErc721Diff as StarknetErc721Diff, + type StarknetTransactionScanRequest as StarknetTransactionScanRequest, type StarknetTransactionScanResponse as StarknetTransactionScanResponse, }; From 066a0706775714db4bcd98b39b1aac3b7fbf8cab Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:57:12 +0000 Subject: [PATCH 17/18] feat(api): api update (#321) --- .stats.yml | 2 +- src/resources/bitcoin/bitcoin.ts | 14 +++++++------- src/resources/stellar/stellar.ts | 22 +++++++++++----------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.stats.yml b/.stats.yml index eb54141e..f57c3da3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 19 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-ea8d982a096c639a061ee5f1a2b05747ff416b95357d92f56d01e6c537098066.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-4074d2a2daa26c0381dcb705a69ca8142ec74086afd06240bc5e4ae452fe8ee7.yml diff --git a/src/resources/bitcoin/bitcoin.ts b/src/resources/bitcoin/bitcoin.ts index 8efe86e1..ae9da466 100644 --- a/src/resources/bitcoin/bitcoin.ts +++ b/src/resources/bitcoin/bitcoin.ts @@ -58,7 +58,7 @@ export interface BitcoinTransactionScanResponse { * Simulation result; Only present if simulation option is included in the request */ simulation?: - | BitcoinTransactionScanResponse.BitcoinSimulationResponse + | BitcoinTransactionScanResponse.BitcoinSimulationResult | BitcoinTransactionScanResponse.BitcoinSimulationErrorSchema | null; @@ -72,7 +72,7 @@ export interface BitcoinTransactionScanResponse { } export namespace BitcoinTransactionScanResponse { - export interface BitcoinSimulationResponse { + export interface BitcoinSimulationResult { status: 'Success'; account_summary?: null; @@ -80,7 +80,7 @@ export namespace BitcoinTransactionScanResponse { /** * Details of addresses involved in the transaction */ - address_details?: Array; + address_details?: Array; /** * Mapping between the address of an account to the assets diff during the @@ -89,14 +89,14 @@ export namespace BitcoinTransactionScanResponse { assets_diffs?: Record< string, Array< - | BitcoinSimulationResponse.BitcoinNativeAssetDiff - | BitcoinSimulationResponse.BitcoinOrdinalAssetDiff - | BitcoinSimulationResponse.BitcoinRunesAssetDiff + | BitcoinSimulationResult.BitcoinNativeAssetDiff + | BitcoinSimulationResult.BitcoinOrdinalAssetDiff + | BitcoinSimulationResult.BitcoinRunesAssetDiff > >; } - export namespace BitcoinSimulationResponse { + export namespace BitcoinSimulationResult { export interface AddressDetail { /** * Encoded public key of the account diff --git a/src/resources/stellar/stellar.ts b/src/resources/stellar/stellar.ts index e22b59aa..4a39ea73 100644 --- a/src/resources/stellar/stellar.ts +++ b/src/resources/stellar/stellar.ts @@ -188,7 +188,7 @@ export interface StellarTransactionScanResponse { * Simulation result; Only present if simulation option is included in the request */ simulation?: - | StellarTransactionScanResponse.StellarSimulationResponse + | StellarTransactionScanResponse.StellarSimulationResult | StellarTransactionScanResponse.StellarSimulationErrorSchema | null; @@ -202,24 +202,24 @@ export interface StellarTransactionScanResponse { } export namespace StellarTransactionScanResponse { - export interface StellarSimulationResponse { + export interface StellarSimulationResult { /** * Summary of the actions and asset transfers that were made by the requested * account address */ - account_summary: StellarSimulationResponse.AccountSummary; + account_summary: StellarSimulationResult.AccountSummary; /** * Ownership diffs of the account addresses */ - assets_ownership_diff: Record>; + assets_ownership_diff: Record>; status: 'Success'; /** * Details of addresses involved in the transaction */ - address_details?: Array; + address_details?: Array; /** * Mapping between the address of an account to the assets diff during the @@ -228,9 +228,9 @@ export namespace StellarTransactionScanResponse { assets_diffs?: Record< string, Array< - | StellarSimulationResponse.StellarLegacyAssetDiff - | StellarSimulationResponse.StellarNativeAssetDiff - | StellarSimulationResponse.StellarContractAssetDiff + | StellarSimulationResult.StellarLegacyAssetDiff + | StellarSimulationResult.StellarNativeAssetDiff + | StellarSimulationResult.StellarContractAssetDiff > >; @@ -241,13 +241,13 @@ export namespace StellarTransactionScanResponse { exposures?: Record< string, Array< - | StellarSimulationResponse.StellarLegacyAssetExposure - | StellarSimulationResponse.StellarNativeAssetExposure + | StellarSimulationResult.StellarLegacyAssetExposure + | StellarSimulationResult.StellarNativeAssetExposure > >; } - export namespace StellarSimulationResponse { + export namespace StellarSimulationResult { /** * Summary of the actions and asset transfers that were made by the requested * account address From 23b53e27748b4d9e31904ca876fbae646e1a9c8a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:57:37 +0000 Subject: [PATCH 18/18] release: 0.29.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ package.json | 2 +- src/version.ts | 2 +- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ad166586..8316a6de 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.28.1" + ".": "0.29.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b31fda6..b609fc6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,33 @@ # Changelog +## 0.29.0 (2024-11-12) + +Full Changelog: [v0.28.1...v0.29.0](https://github.com/blockaid-official/blockaid-client-node/compare/v0.28.1...v0.29.0) + +### Features + +* **api:** api update ([#302](https://github.com/blockaid-official/blockaid-client-node/issues/302)) ([807fdec](https://github.com/blockaid-official/blockaid-client-node/commit/807fdecbb07a69dee0ffde87cfa163a8d7bfac1e)) +* **api:** api update ([#304](https://github.com/blockaid-official/blockaid-client-node/issues/304)) ([41acd8d](https://github.com/blockaid-official/blockaid-client-node/commit/41acd8dff941c9d348c2ae3ce2eac104d7121713)) +* **api:** api update ([#305](https://github.com/blockaid-official/blockaid-client-node/issues/305)) ([fd62a3b](https://github.com/blockaid-official/blockaid-client-node/commit/fd62a3b15e10ebae48d70359b047e39ac113f050)) +* **api:** api update ([#306](https://github.com/blockaid-official/blockaid-client-node/issues/306)) ([557a745](https://github.com/blockaid-official/blockaid-client-node/commit/557a745e5065c6fdc903540f9a3c116dffe82d39)) +* **api:** api update ([#309](https://github.com/blockaid-official/blockaid-client-node/issues/309)) ([e74673c](https://github.com/blockaid-official/blockaid-client-node/commit/e74673c33e3a6af27b9bb8150f92598f62cfc600)) +* **api:** api update ([#312](https://github.com/blockaid-official/blockaid-client-node/issues/312)) ([c16b46f](https://github.com/blockaid-official/blockaid-client-node/commit/c16b46fd4e08af73d6a0cdb012c82df0609d21a4)) +* **api:** api update ([#313](https://github.com/blockaid-official/blockaid-client-node/issues/313)) ([1a19626](https://github.com/blockaid-official/blockaid-client-node/commit/1a19626b4dbf697a8d2c802f18c1d985b737da8a)) +* **api:** api update ([#316](https://github.com/blockaid-official/blockaid-client-node/issues/316)) ([e63fddd](https://github.com/blockaid-official/blockaid-client-node/commit/e63fddda1580e67f2befea6a772e8d40e0b2576a)) +* **api:** api update ([#317](https://github.com/blockaid-official/blockaid-client-node/issues/317)) ([85b6f49](https://github.com/blockaid-official/blockaid-client-node/commit/85b6f49fca0cf0c9e81351c060bcf5e9ad4ce8d8)) +* **api:** api update ([#320](https://github.com/blockaid-official/blockaid-client-node/issues/320)) ([91468dd](https://github.com/blockaid-official/blockaid-client-node/commit/91468ddf6d495db79bfc5b772afd5a376b7b0857)) +* **api:** api update ([#321](https://github.com/blockaid-official/blockaid-client-node/issues/321)) ([066a070](https://github.com/blockaid-official/blockaid-client-node/commit/066a0706775714db4bcd98b39b1aac3b7fbf8cab)) +* **api:** manual updates ([#311](https://github.com/blockaid-official/blockaid-client-node/issues/311)) ([c10997e](https://github.com/blockaid-official/blockaid-client-node/commit/c10997ec4c8efec4e36dfe844961a1f5605b76d6)) +* **api:** manual updates ([#314](https://github.com/blockaid-official/blockaid-client-node/issues/314)) ([319bc69](https://github.com/blockaid-official/blockaid-client-node/commit/319bc69256c3b78bb85fbc5a920d268ced13e969)) +* **api:** manual updates ([#315](https://github.com/blockaid-official/blockaid-client-node/issues/315)) ([94a4e8c](https://github.com/blockaid-official/blockaid-client-node/commit/94a4e8cca931d5e292692ab7fc108545e2d4764e)) +* **api:** manual updates ([#318](https://github.com/blockaid-official/blockaid-client-node/issues/318)) ([9579ef1](https://github.com/blockaid-official/blockaid-client-node/commit/9579ef1a984c6a94c0859175761cb27ff0f72c0a)) +* **api:** manual updates ([#319](https://github.com/blockaid-official/blockaid-client-node/issues/319)) ([945e3f2](https://github.com/blockaid-official/blockaid-client-node/commit/945e3f22cb00e7739efcc0a3e533015029586cde)) + + +### Chores + +* remove custom code ([6b34d68](https://github.com/blockaid-official/blockaid-client-node/commit/6b34d682b9f6c6d47f1fc5fad6feefb893ad7a9c)) + ## 0.28.1 (2024-10-28) Full Changelog: [v0.28.0...v0.28.1](https://github.com/blockaid-official/blockaid-client-node/compare/v0.28.0...v0.28.1) diff --git a/package.json b/package.json index 57e6fd28..f37144f2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@blockaid/client", - "version": "0.28.1", + "version": "0.29.0", "description": "The official TypeScript library for the Blockaid API", "author": "Blockaid ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 96229228..bef2b64d 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.28.1'; // x-release-please-version +export const VERSION = '0.29.0'; // x-release-please-version