Skip to content

Commit

Permalink
feat(api): api update (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Dec 22, 2024
1 parent 51f5d7d commit 6b0536e
Show file tree
Hide file tree
Showing 15 changed files with 373 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 19
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-902cd766caf621526e262bf78c4164900f08418da206c2133d25143dc66f29c2.yml
configured_endpoints: 23
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-63288e66fdf1e5107e6d267fd12a78568d07024b6b2808f9c0c9474d00b1a2ca.yml
21 changes: 20 additions & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,13 @@ Types:

## Transaction

Types:

- <code><a href="./src/resources/stellar/transaction.ts">TransactionReportResponse</a></code>

Methods:

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

# Bitcoin
Expand All @@ -160,7 +165,16 @@ Types:
- <code><a href="./src/resources/bitcoin/bitcoin.ts">BitcoinTransactionScanRequest</a></code>
- <code><a href="./src/resources/bitcoin/bitcoin.ts">BitcoinTransactionScanResponse</a></code>

## Transaction
## TransactionRaw

Types:

- <code><a href="./src/resources/bitcoin/transaction-raw.ts">TransactionRawReportResponse</a></code>

Methods:

- <code title="post /v0/bitcoin/transaction/report">client.bitcoin.transactionRaw.<a href="./src/resources/bitcoin/transaction-raw.ts">report</a>({ ...params }) -> TransactionRawReportResponse</code>
- <code title="post /v0/bitcoin/transaction-raw/scan">client.bitcoin.transactionRaw.<a href="./src/resources/bitcoin/transaction-raw.ts">scan</a>({ ...params }) -> BitcoinTransactionScanResponse</code>

# Starknet

Expand All @@ -177,8 +191,13 @@ Types:

## Transaction

Types:

- <code><a href="./src/resources/starknet/transaction.ts">TransactionReportResponse</a></code>

Methods:

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

# Site
Expand Down
20 changes: 15 additions & 5 deletions src/resources/bitcoin/bitcoin.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../resource';
import * as TransactionAPI from './transaction';
import { Transaction } from './transaction';
import * as TransactionRawAPI from './transaction-raw';
import {
TransactionRaw,
TransactionRawReportParams,
TransactionRawReportResponse,
TransactionRawScanParams,
} from './transaction-raw';

export class Bitcoin extends APIResource {
transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client);
transactionRaw: TransactionRawAPI.TransactionRaw = new TransactionRawAPI.TransactionRaw(this._client);
}

export interface BitcoinTransactionScanRequest {
Expand Down Expand Up @@ -812,13 +817,18 @@ export namespace BitcoinTransactionScanResponse {
}
}

Bitcoin.Transaction = Transaction;
Bitcoin.TransactionRaw = TransactionRaw;

export declare namespace Bitcoin {
export {
type BitcoinTransactionScanRequest as BitcoinTransactionScanRequest,
type BitcoinTransactionScanResponse as BitcoinTransactionScanResponse,
};

export { Transaction as Transaction };
export {
TransactionRaw as TransactionRaw,
type TransactionRawReportResponse as TransactionRawReportResponse,
type TransactionRawReportParams as TransactionRawReportParams,
type TransactionRawScanParams as TransactionRawScanParams,
};
}
7 changes: 6 additions & 1 deletion src/resources/bitcoin/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export { Bitcoin, type BitcoinTransactionScanRequest, type BitcoinTransactionScanResponse } from './bitcoin';
export { Transaction } from './transaction';
export {
TransactionRaw,
type TransactionRawReportResponse,
type TransactionRawReportParams,
type TransactionRawScanParams,
} from './transaction-raw';
106 changes: 106 additions & 0 deletions src/resources/bitcoin/transaction-raw.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../resource';
import * as Core from '../../core';
import * as BitcoinAPI from './bitcoin';

export class TransactionRaw extends APIResource {
/**
* Report Transaction
*/
report(
body: TransactionRawReportParams,
options?: Core.RequestOptions,
): Core.APIPromise<TransactionRawReportResponse> {
return this._client.post('/v0/bitcoin/transaction/report', { body, ...options });
}

/**
* Scan Transaction
*/
scan(
body: TransactionRawScanParams,
options?: Core.RequestOptions,
): Core.APIPromise<BitcoinAPI.BitcoinTransactionScanResponse> {
return this._client.post('/v0/bitcoin/transaction-raw/scan', { body, ...options });
}
}

export type TransactionRawReportResponse = number;

export interface TransactionRawReportParams {
details: string;

event: 'should_be_malicious' | 'should_be_benign' | 'wrong_simulation_result';

report:
| TransactionRawReportParams.BitcoinAppealRequestID
| TransactionRawReportParams.BitcoinAppealTransactionDataReport;
}

export namespace TransactionRawReportParams {
export interface BitcoinAppealRequestID {
id: string;

type?: 'request_id';
}

export interface BitcoinAppealTransactionDataReport {
params: BitcoinAPI.BitcoinTransactionScanRequest;

type?: 'params';
}
}

export interface TransactionRawScanParams {
account_address: string;

chain: 'bitcoin';

/**
* Metadata
*/
metadata:
| TransactionRawScanParams.BitcoinWalletRequestMetadata
| TransactionRawScanParams.BitcoinInAppRequestMetadata;

transaction: string;

/**
* List of options to include in the response
*
* - `Options.validation`: Include Options.validation output in the response
*
* - `Options.simulation`: Include Options.simulation output in the response
*/
options?: Array<'validation' | 'simulation'>;
}

export namespace TransactionRawScanParams {
export interface BitcoinWalletRequestMetadata {
/**
* Metadata for wallet requests
*/
type: 'wallet';

/**
* URL of the dApp originating the transaction
*/
url: string;
}

export interface BitcoinInAppRequestMetadata {
/**
* Metadata for in-app requests
*/
type?: 'in_app';
}
}

export declare namespace TransactionRaw {
export {
type TransactionRawReportResponse as TransactionRawReportResponse,
type TransactionRawReportParams as TransactionRawReportParams,
type TransactionRawScanParams as TransactionRawScanParams,
};
}
5 changes: 0 additions & 5 deletions src/resources/bitcoin/transaction.ts

This file was deleted.

7 changes: 6 additions & 1 deletion src/resources/starknet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ export {
type StarknetTransactionScanRequest,
type StarknetTransactionScanResponse,
} from './starknet';
export { Transaction, type TransactionScanParams } from './transaction';
export {
Transaction,
type TransactionReportResponse,
type TransactionReportParams,
type TransactionScanParams,
} from './transaction';
14 changes: 12 additions & 2 deletions src/resources/starknet/starknet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
import { APIResource } from '../../resource';
import * as StarknetAPI from './starknet';
import * as TransactionAPI from './transaction';
import { Transaction, TransactionScanParams } from './transaction';
import {
Transaction,
TransactionReportParams,
TransactionReportResponse,
TransactionScanParams,
} from './transaction';

export class Starknet extends APIResource {
transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client);
Expand Down Expand Up @@ -837,5 +842,10 @@ export declare namespace Starknet {
type StarknetTransactionScanResponse as StarknetTransactionScanResponse,
};

export { Transaction as Transaction, type TransactionScanParams as TransactionScanParams };
export {
Transaction as Transaction,
type TransactionReportResponse as TransactionReportResponse,
type TransactionReportParams as TransactionReportParams,
type TransactionScanParams as TransactionScanParams,
};
}
42 changes: 41 additions & 1 deletion src/resources/starknet/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TransactionReportResponse> {
return this._client.post('/v0/starknet/transaction/report', { body, ...options });
}

/**
* Scan Transactions
*/
Expand All @@ -16,6 +26,32 @@ export class Transaction extends APIResource {
}
}

export type TransactionReportResponse = number;

export interface TransactionReportParams {
details: string;

event: 'should_be_malicious' | 'should_be_benign';

report:
| TransactionReportParams.StarknetAppealRequestID
| TransactionReportParams.StarknetAppealTransactionDataReport;
}

export namespace TransactionReportParams {
export interface StarknetAppealRequestID {
id: string;

type?: 'request_id';
}

export interface StarknetAppealTransactionDataReport {
params: StarknetAPI.StarknetTransactionScanRequest;

type?: 'params';
}
}

export interface TransactionScanParams {
account_address: string;

Expand Down Expand Up @@ -207,5 +243,9 @@ export namespace TransactionScanParams {
}

export declare namespace Transaction {
export { type TransactionScanParams as TransactionScanParams };
export {
type TransactionReportResponse as TransactionReportResponse,
type TransactionReportParams as TransactionReportParams,
type TransactionScanParams as TransactionScanParams,
};
}
7 changes: 6 additions & 1 deletion src/resources/stellar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ export {
type StellarTransactionScanRequest,
type StellarTransactionScanResponse,
} from './stellar';
export { Transaction, type TransactionScanParams } from './transaction';
export {
Transaction,
type TransactionReportResponse,
type TransactionReportParams,
type TransactionScanParams,
} from './transaction';
14 changes: 12 additions & 2 deletions src/resources/stellar/stellar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
import { APIResource } from '../../resource';
import * as StellarAPI from './stellar';
import * as TransactionAPI from './transaction';
import { Transaction, TransactionScanParams } from './transaction';
import {
Transaction,
TransactionReportParams,
TransactionReportResponse,
TransactionScanParams,
} from './transaction';

export class Stellar extends APIResource {
transaction: TransactionAPI.Transaction = new TransactionAPI.Transaction(this._client);
Expand Down Expand Up @@ -579,5 +584,10 @@ export declare namespace Stellar {
type StellarTransactionScanResponse as StellarTransactionScanResponse,
};

export { Transaction as Transaction, type TransactionScanParams as TransactionScanParams };
export {
Transaction as Transaction,
type TransactionReportResponse as TransactionReportResponse,
type TransactionReportParams as TransactionReportParams,
type TransactionScanParams as TransactionScanParams,
};
}
Loading

0 comments on commit 6b0536e

Please sign in to comment.