Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): api update #320

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .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-a8d116e345ec36054b1a8cc6fa98564ede39989a9b9ce1383f9e37738dcf33ff.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-ea8d982a096c639a061ee5f1a2b05747ff416b95357d92f56d01e6c537098066.yml
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ Types:
- <code><a href="./src/resources/starknet/starknet.ts">StarknetErc20Diff</a></code>
- <code><a href="./src/resources/starknet/starknet.ts">StarknetErc721Details</a></code>
- <code><a href="./src/resources/starknet/starknet.ts">StarknetErc721Diff</a></code>
- <code><a href="./src/resources/starknet/starknet.ts">StarknetTransactionScanRequest</a></code>
- <code><a href="./src/resources/starknet/starknet.ts">StarknetTransactionScanResponse</a></code>

## Transaction
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ import {
StarknetErc20Diff,
StarknetErc721Details,
StarknetErc721Diff,
StarknetTransactionScanRequest,
StarknetTransactionScanResponse,
} from './resources/starknet/starknet';
import {
Expand Down Expand Up @@ -436,6 +437,7 @@ export declare namespace Blockaid {
type StarknetErc20Diff as StarknetErc20Diff,
type StarknetErc721Details as StarknetErc721Details,
type StarknetErc721Diff as StarknetErc721Diff,
type StarknetTransactionScanRequest as StarknetTransactionScanRequest,
type StarknetTransactionScanResponse as StarknetTransactionScanResponse,
};

Expand Down
1 change: 1 addition & 0 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export {
type StarknetErc20Diff,
type StarknetErc721Details,
type StarknetErc721Diff,
type StarknetTransactionScanRequest,
type StarknetTransactionScanResponse,
} from './starknet/starknet';
export {
Expand Down
1 change: 1 addition & 0 deletions src/resources/starknet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export {
type StarknetErc20Diff,
type StarknetErc721Details,
type StarknetErc721Diff,
type StarknetTransactionScanRequest,
type StarknetTransactionScanResponse,
} from './starknet';
export { Transaction, type TransactionScanParams } from './transaction';
191 changes: 191 additions & 0 deletions src/resources/starknet/starknet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,196 @@ export interface StarknetErc721Diff {
summary?: string | null;
}

export interface StarknetTransactionScanRequest {
account_address: string;

/**
* The chain name or chain ID
*/
chain: 'mainnet' | 'sepolia' | 'sepolia_integration' | (string & {});

/**
* Metadata
*/
metadata:
| StarknetTransactionScanRequest.StarknetWalletRequestMetadata
| StarknetTransactionScanRequest.StarknetInAppRequestMetadata;

transaction:
| StarknetTransactionScanRequest.StarknetInvokeV1TransactionSchema
| StarknetTransactionScanRequest.StarknetInvokeV3TransactionSchema
| StarknetTransactionScanRequest.StarknetDeployAccountV1TransactionSchema
| StarknetTransactionScanRequest.StarknetDeployAccountV3TransactionSchema;

/**
* Optional block number or tag context for the simulation
*/
block_number?: string | null;

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

export namespace StarknetTransactionScanRequest {
export interface StarknetWalletRequestMetadata {
/**
* Metadata for wallet requests
*/
type: 'wallet';

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

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

export interface StarknetInvokeV1TransactionSchema {
/**
* The maximum fee that the sender is willing to pay.
*/
max_fee: string;

/**
* The nonce of the transaction.
*/
nonce: string;

/**
* The address of the sender.
*/
sender_address: string;

/**
* The version of the transaction.
*/
version: 1;

/**
* The arguments that are passed to the validate and execute functions.
*/
calldata?: Array<string>;
}

export interface StarknetInvokeV3TransactionSchema {
/**
* The arguments that are passed to the validate and execute functions.
*/
calldata: Array<string>;

/**
* 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<string>;

/**
* The nonce data availability mode.
*/
nonce_data_availability_mode?: 0;

/**
* For future use. Currently this value is always empty.
*/
paymaster_data?: Array<string>;
}

export interface StarknetDeployAccountV1TransactionSchema {
/**
* The hash of the contract class.
*/
class_hash: string;

/**
* The arguments that are passed to the constructor function.
*/
constructor_calldata: Array<string>;

/**
* 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<string>;

/**
* The salt of the contract address.
*/
contract_address_salt: string;

/**
* The maximum fee that the sender is willing to pay.
*/
max_fee: string;

/**
* The nonce of the transaction.
*/
nonce: string;

/**
* The version of the transaction.
*/
version: 3;
}
}

export interface StarknetTransactionScanResponse {
/**
* Simulation result; Only present if simulation option is included in the request
Expand Down Expand Up @@ -643,6 +833,7 @@ export declare namespace Starknet {
type StarknetErc20Diff as StarknetErc20Diff,
type StarknetErc721Details as StarknetErc721Details,
type StarknetErc721Diff as StarknetErc721Diff,
type StarknetTransactionScanRequest as StarknetTransactionScanRequest,
type StarknetTransactionScanResponse as StarknetTransactionScanResponse,
};

Expand Down