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',