From 81e0487640257cd7f225c30c03e410b422150245 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 2 Jul 2024 11:16:33 +0000
Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#83)
---
.stats.yml | 4 +-
api.md | 17 +
src/index.ts | 9 +
src/resources/index.ts | 9 +
src/resources/stellar/index.ts | 12 +
src/resources/stellar/stellar.ts | 980 ++++++++++++++++++
src/resources/stellar/transaction.ts | 72 ++
.../api-resources/stellar/transaction.test.ts | 37 +
8 files changed, 1138 insertions(+), 2 deletions(-)
create mode 100644 src/resources/stellar/index.ts
create mode 100644 src/resources/stellar/stellar.ts
create mode 100644 src/resources/stellar/transaction.ts
create mode 100644 tests/api-resources/stellar/transaction.test.ts
diff --git a/.stats.yml b/.stats.yml
index 909f7f0..e257de3 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 9
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-9684a76da98c474d096bc704e8055953248d10b97ecb58dd0638570b670c3bea.yml
+configured_endpoints: 10
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-f0a1ec68a92db2d2ff553b810979b641e4ce57d06466c5399ff5ec9ac80d4961.yml
diff --git a/api.md b/api.md
index e8f1b7c..009f7d0 100644
--- a/api.md
+++ b/api.md
@@ -77,6 +77,23 @@ Methods:
- client.evm.postTransactionBulk.scan({ ...params }) -> PostTransactionBulkScanResponse
+# Stellar
+
+Types:
+
+- StellarAssetContractDetailsSchema
+- StellarAssetTransferDetailsSchema
+- StellarTransactionScanRequest
+- StellarTransactionScanResponse
+- TransactionScanRequest
+- TransactionScanResponse
+
+## Transaction
+
+Methods:
+
+- client.stellar.transaction.scan({ ...params }) -> TransactionScanResponse
+
# Site
Types:
diff --git a/src/index.ts b/src/index.ts
index ef34dc3..401601f 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -120,6 +120,7 @@ export class Blockaid extends Core.APIClient {
}
evm: API.Evm = new API.Evm(this);
+ stellar: API.Stellar = new API.Stellar(this);
site: API.Site = new API.Site(this);
token: API.Token = new API.Token(this);
@@ -209,6 +210,14 @@ export namespace Blockaid {
export import TransactionValidationError = API.TransactionValidationError;
export import UsdDiff = API.UsdDiff;
+ export import Stellar = API.Stellar;
+ export import StellarAssetContractDetailsSchema = API.StellarAssetContractDetailsSchema;
+ export import StellarAssetTransferDetailsSchema = API.StellarAssetTransferDetailsSchema;
+ export import StellarTransactionScanRequest = API.StellarTransactionScanRequest;
+ export import StellarTransactionScanResponse = API.StellarTransactionScanResponse;
+ export import TransactionScanRequest = API.TransactionScanRequest;
+ export import TransactionScanResponse = API.TransactionScanResponse;
+
export import Site = API.Site;
export import SiteScanHitResponse = API.SiteScanHitResponse;
export import SiteScanMissResponse = API.SiteScanMissResponse;
diff --git a/src/resources/index.ts b/src/resources/index.ts
index cc35f1b..e92187f 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -31,4 +31,13 @@ export {
Evm,
} from './evm/evm';
export { SiteScanHitResponse, SiteScanMissResponse, SiteScanResponse, SiteScanParams, Site } from './site';
+export {
+ StellarAssetContractDetailsSchema,
+ StellarAssetTransferDetailsSchema,
+ StellarTransactionScanRequest,
+ StellarTransactionScanResponse,
+ TransactionScanRequest,
+ TransactionScanResponse,
+ Stellar,
+} from './stellar/stellar';
export { TokenScanResponse, TokenScanParams, Token } from './token';
diff --git a/src/resources/stellar/index.ts b/src/resources/stellar/index.ts
new file mode 100644
index 0000000..cfde6e5
--- /dev/null
+++ b/src/resources/stellar/index.ts
@@ -0,0 +1,12 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+export {
+ StellarAssetContractDetailsSchema,
+ StellarAssetTransferDetailsSchema,
+ StellarTransactionScanRequest,
+ StellarTransactionScanResponse,
+ TransactionScanRequest,
+ TransactionScanResponse,
+ Stellar,
+} from './stellar';
+export { TransactionScanParams, Transaction } from './transaction';
diff --git a/src/resources/stellar/stellar.ts b/src/resources/stellar/stellar.ts
new file mode 100644
index 0000000..49b3f3e
--- /dev/null
+++ b/src/resources/stellar/stellar.ts
@@ -0,0 +1,980 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import { APIResource } from '@blockaid/client/resource';
+import * as StellarAPI from '@blockaid/client/resources/stellar/stellar';
+import * as TransactionAPI from '@blockaid/client/resources/stellar/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;
+
+ /**
+ * 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;
+
+ /**
+ * A CAIP-2 chain ID or a Stellar network name
+ */
+ chain: 'pubnet' | 'futurenet';
+
+ /**
+ * Metadata
+ */
+ metadata:
+ | StellarTransactionScanRequest.StellarWalletRequestMetadata
+ | StellarTransactionScanRequest.StellarInAppRequestMetadata;
+
+ /**
+ * List of XDR-encoded transactions to be scanned
+ */
+ transactions: Array;
+
+ /**
+ * List of options to include in the response
+ *
+ * - `simulation`: Include simulation output in the response
+ * - `validation`: Include security validation of the transaction in the response
+ */
+ options?: Array<'validation' | 'simulation'>;
+}
+
+export namespace StellarTransactionScanRequest {
+ export interface StellarWalletRequestMetadata {
+ /**
+ * URL of the dApp that originated the transaction
+ */
+ url: string;
+
+ /**
+ * Metadata for wallet requests
+ */
+ type?: 'wallet';
+ }
+
+ 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.StellarSimulationResultSchema
+ | StellarTransactionScanResponse.StellarSimulationErrorSchema
+ | null;
+
+ /**
+ * Validation result; Only present if validation option is included in the request
+ */
+ 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: AccountSummary.AccountExposures;
+
+ /**
+ * Account ownerships diff of the requested account address
+ */
+ account_ownerships_diff: AccountSummary.AccountOwnershipsDiff;
+
+ /**
+ * 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 {
+ /**
+ * Exposures made by the requested account address
+ */
+ export interface AccountExposures {
+ asset: StellarAPI.StellarAssetContractDetailsSchema;
+
+ /**
+ * Mapping between the address of a Spender to the exposure of the asset during the
+ * transaction
+ */
+ spenders?: Record;
+ }
+
+ export namespace AccountExposures {
+ export interface Spenders {
+ /**
+ * Raw value of the exposure
+ */
+ raw_value: number;
+
+ /**
+ * Value of the exposure
+ */
+ value: number;
+
+ /**
+ * Summarized description of the exposure
+ */
+ summary?: string | null;
+ }
+ }
+
+ /**
+ * Account ownerships diff of the requested account address
+ */
+ 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;
+ }
+
+ /**
+ * 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;
+ }
+
+ export interface Exposures {
+ asset: StellarAPI.StellarAssetContractDetailsSchema;
+
+ /**
+ * Mapping between the address of a Spender to the exposure of the asset during the
+ * transaction
+ */
+ spenders?: Record;
+ }
+
+ export namespace Exposures {
+ export interface Spenders {
+ /**
+ * Raw value of the exposure
+ */
+ raw_value: 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:
+ | ''
+ | 'known_attacker'
+ | 'known_fraudulent_asset'
+ | 'malicious_memo'
+ | 'unfair_trade'
+ | 'transfer_farming'
+ | 'native_ownership_change'
+ | 'other';
+
+ /**
+ * 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';
+ }
+}
+
+export interface TransactionScanRequest {
+ account_address: string;
+
+ /**
+ * A CAIP-2 chain ID or a Stellar network name
+ */
+ chain: 'pubnet' | 'futurenet';
+
+ /**
+ * Metadata
+ */
+ metadata:
+ | TransactionScanRequest.StellarWalletRequestMetadata
+ | TransactionScanRequest.StellarInAppRequestMetadata;
+
+ /**
+ * List of XDR-encoded transactions to be scanned
+ */
+ transactions: Array;
+
+ /**
+ * List of options to include in the response
+ *
+ * - `simulation`: Include simulation output in the response
+ * - `validation`: Include security validation of the transaction in the response
+ */
+ options?: Array<'validation' | 'simulation'>;
+}
+
+export namespace TransactionScanRequest {
+ export interface StellarWalletRequestMetadata {
+ /**
+ * URL of the dApp that originated the transaction
+ */
+ url: string;
+
+ /**
+ * Metadata for wallet requests
+ */
+ type?: 'wallet';
+ }
+
+ export interface StellarInAppRequestMetadata {
+ /**
+ * Metadata for in-app requests
+ */
+ type?: 'in_app';
+ }
+}
+
+export interface TransactionScanResponse {
+ /**
+ * Simulation result; Only present if simulation option is included in the request
+ */
+ simulation?:
+ | TransactionScanResponse.StellarSimulationResultSchema
+ | TransactionScanResponse.StellarSimulationErrorSchema
+ | null;
+
+ /**
+ * Validation result; Only present if validation option is included in the request
+ */
+ validation?:
+ | TransactionScanResponse.StellarValidationResultSchema
+ | TransactionScanResponse.StellarValidationErrorSchema
+ | null;
+}
+
+export namespace TransactionScanResponse {
+ 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: AccountSummary.AccountExposures;
+
+ /**
+ * Account ownerships diff of the requested account address
+ */
+ account_ownerships_diff: AccountSummary.AccountOwnershipsDiff;
+
+ /**
+ * 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 {
+ /**
+ * Exposures made by the requested account address
+ */
+ export interface AccountExposures {
+ asset: StellarAPI.StellarAssetContractDetailsSchema;
+
+ /**
+ * Mapping between the address of a Spender to the exposure of the asset during the
+ * transaction
+ */
+ spenders?: Record;
+ }
+
+ export namespace AccountExposures {
+ export interface Spenders {
+ /**
+ * Raw value of the exposure
+ */
+ raw_value: number;
+
+ /**
+ * Value of the exposure
+ */
+ value: number;
+
+ /**
+ * Summarized description of the exposure
+ */
+ summary?: string | null;
+ }
+ }
+
+ /**
+ * Account ownerships diff of the requested account address
+ */
+ 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;
+ }
+
+ /**
+ * 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;
+ }
+
+ export interface Exposures {
+ asset: StellarAPI.StellarAssetContractDetailsSchema;
+
+ /**
+ * Mapping between the address of a Spender to the exposure of the asset during the
+ * transaction
+ */
+ spenders?: Record;
+ }
+
+ export namespace Exposures {
+ export interface Spenders {
+ /**
+ * Raw value of the exposure
+ */
+ raw_value: 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:
+ | ''
+ | 'known_attacker'
+ | 'known_fraudulent_asset'
+ | 'malicious_memo'
+ | 'unfair_trade'
+ | 'transfer_farming'
+ | 'native_ownership_change'
+ | 'other';
+
+ /**
+ * 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';
+ }
+}
+
+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 TransactionScanRequest = StellarAPI.TransactionScanRequest;
+ export import TransactionScanResponse = StellarAPI.TransactionScanResponse;
+ export import Transaction = TransactionAPI.Transaction;
+ export import TransactionScanParams = TransactionAPI.TransactionScanParams;
+}
diff --git a/src/resources/stellar/transaction.ts b/src/resources/stellar/transaction.ts
new file mode 100644
index 0000000..3dbeba1
--- /dev/null
+++ b/src/resources/stellar/transaction.ts
@@ -0,0 +1,72 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import { APIResource } from '@blockaid/client/resource';
+import * as Core from '@blockaid/client/core';
+import * as TransactionAPI from '@blockaid/client/resources/stellar/transaction';
+import * as StellarAPI from '@blockaid/client/resources/stellar/stellar';
+
+export class Transaction extends APIResource {
+ /**
+ * Scan Transactions
+ */
+ scan(
+ body: TransactionScanParams,
+ options?: Core.RequestOptions,
+ ): Core.APIPromise {
+ return this._client.post('/v0/stellar/scan/transaction', { body, ...options });
+ }
+}
+
+export interface TransactionScanParams {
+ account_address: string;
+
+ /**
+ * A CAIP-2 chain ID or a Stellar network name
+ */
+ chain: 'pubnet' | 'futurenet';
+
+ /**
+ * Metadata
+ */
+ metadata:
+ | TransactionScanParams.StellarWalletRequestMetadata
+ | TransactionScanParams.StellarInAppRequestMetadata;
+
+ /**
+ * List of XDR-encoded transactions to be scanned
+ */
+ transactions: Array;
+
+ /**
+ * List of options to include in the response
+ *
+ * - `simulation`: Include simulation output in the response
+ * - `validation`: Include security validation of the transaction in the response
+ */
+ options?: Array<'validation' | 'simulation'>;
+}
+
+export namespace TransactionScanParams {
+ export interface StellarWalletRequestMetadata {
+ /**
+ * URL of the dApp that originated the transaction
+ */
+ url: string;
+
+ /**
+ * Metadata for wallet requests
+ */
+ type?: 'wallet';
+ }
+
+ export interface StellarInAppRequestMetadata {
+ /**
+ * Metadata for in-app requests
+ */
+ type?: 'in_app';
+ }
+}
+
+export namespace Transaction {
+ export import TransactionScanParams = TransactionAPI.TransactionScanParams;
+}
diff --git a/tests/api-resources/stellar/transaction.test.ts b/tests/api-resources/stellar/transaction.test.ts
new file mode 100644
index 0000000..3ab943a
--- /dev/null
+++ b/tests/api-resources/stellar/transaction.test.ts
@@ -0,0 +1,37 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import Blockaid from '@blockaid/client';
+import { Response } from 'node-fetch';
+
+const blockaid = new Blockaid({
+ apiKey: 'My API Key',
+ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
+});
+
+describe('resource transaction', () => {
+ test('scan: only required params', async () => {
+ const responsePromise = blockaid.stellar.transaction.scan({
+ account_address: 'string',
+ chain: 'pubnet',
+ metadata: { url: 'string' },
+ transactions: ['string', 'string', 'string'],
+ });
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ test('scan: required and optional params', async () => {
+ const response = await blockaid.stellar.transaction.scan({
+ account_address: 'string',
+ chain: 'pubnet',
+ metadata: { type: 'wallet', url: 'string' },
+ transactions: ['string', 'string', 'string'],
+ options: ['validation'],
+ });
+ });
+});