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): OpenAPI spec update via Stainless API #256

Merged
merged 1 commit into from
Sep 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-cbd51756ac7452c36818b539beb7290b102260a1bbd4adaab6a71d87c66d3270.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-eae472593d02f56a6a609d7f7feb00ba233294ddae078cbfa69b906af1f41500.yml
5 changes: 0 additions & 5 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -978,11 +978,6 @@ const validatePositiveInteger = (name: string, n: unknown): number => {

export const castToError = (err: any): Error => {
if (err instanceof Error) return err;
if (typeof err === 'object' && err !== null) {
try {
return new Error(JSON.stringify(err));
} catch {}
}
return new Error(err);
};

Expand Down
4 changes: 2 additions & 2 deletions src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class APIError extends BlockaidError {
headers: Headers | undefined,
) {
if (!status) {
return new APIConnectionError({ message, cause: castToError(errorResponse) });
return new APIConnectionError({ cause: castToError(errorResponse) });
}

const error = errorResponse as Record<string, any>;
Expand Down Expand Up @@ -101,7 +101,7 @@ export class APIUserAbortError extends APIError {
export class APIConnectionError extends APIError {
override readonly status: undefined = undefined;

constructor({ message, cause }: { message?: string | undefined; cause?: Error | undefined }) {
constructor({ message, cause }: { message?: string; cause?: Error | undefined }) {
super(undefined, undefined, message || 'Connection error.', undefined);
// in some environments the 'cause' property is already declared
// @ts-ignore
Expand Down
3 changes: 2 additions & 1 deletion src/resources/evm/evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ export type TokenScanSupportedChain =
| 'blast'
| 'zksync'
| 'scroll'
| 'degen';
| 'degen'
| 'bitcoin';

export interface TransactionScanFeature {
/**
Expand Down
158 changes: 156 additions & 2 deletions src/resources/token-bulk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export namespace TokenBulkScanResponse {
/**
* Metadata of the token
*/
metadata: Results.SolanaMetadata | Results.BasicMetadataToken;
metadata: Results.SolanaMetadata | Results.BitcoinMetadataToken | Results.EvmMetadataToken;

/**
* An enumeration.
Expand Down Expand Up @@ -134,6 +134,16 @@ export namespace TokenBulkScanResponse {
}

export interface SolanaMetadata {
/**
* Contract balance
*/
contract_balance?: SolanaMetadata.ContractBalance;

/**
* Contract deploy date
*/
creation_timestamp?: string;

/**
* Address of the deployer of the fungible token
*/
Expand All @@ -144,20 +154,41 @@ export namespace TokenBulkScanResponse {
*/
description?: string;

/**
* social links of the token
*/
external_links?: SolanaMetadata.ExternalLinks;

/**
* Solana token freeze authority account
*/
freeze_authority?: string;

/**
* URL of the token image
*/
image_url?: string;

/**
* Solana token mint authority account
*/
mint_authority?: string;

/**
* Name of the token
*/
name?: string;

/**
* Contract owner address
*/
owner?: string;

/**
* Contract owner balance
*/
owner_balance?: SolanaMetadata.OwnerBalance;

/**
* Symbol of the token
*/
Expand All @@ -168,10 +199,86 @@ export namespace TokenBulkScanResponse {
*/
type?: string;

/**
* Solana token update authority account
*/
update_authority?: string;
}

export interface BasicMetadataToken {
export namespace SolanaMetadata {
/**
* Contract balance
*/
export interface ContractBalance {
amount?: number;

amount_wei?: string;
}

/**
* social links of the token
*/
export interface ExternalLinks {
homepage?: string;

telegram_channel_id?: string;

twitter_page?: string;
}

/**
* Contract owner balance
*/
export interface OwnerBalance {
amount?: number;

amount_wei?: string;
}
}

export interface BitcoinMetadataToken {
/**
* The unique ID for the Rune
*/
id?: string;

/**
* The formatted name of the rune, with spacers
*/
formatted_name?: string;

/**
* Name of the token
*/
name?: string;

/**
* The rune's unique sequential number.
*/
number?: number;

/**
* Symbol of the token
*/
symbol?: string;

/**
* Type of the token
*/
type?: string;
}

export interface EvmMetadataToken {
/**
* Contract balance
*/
contract_balance?: EvmMetadataToken.ContractBalance;

/**
* Contract deploy date
*/
creation_timestamp?: string;

/**
* Address of the deployer of the fungible token
*/
Expand All @@ -182,6 +289,11 @@ export namespace TokenBulkScanResponse {
*/
description?: string;

/**
* social links of the token
*/
external_links?: EvmMetadataToken.ExternalLinks;

/**
* URL of the token image
*/
Expand All @@ -192,6 +304,16 @@ export namespace TokenBulkScanResponse {
*/
name?: string;

/**
* Contract owner address
*/
owner?: string;

/**
* Contract owner balance
*/
owner_balance?: EvmMetadataToken.OwnerBalance;

/**
* Symbol of the token
*/
Expand All @@ -203,6 +325,37 @@ export namespace TokenBulkScanResponse {
type?: string;
}

export namespace EvmMetadataToken {
/**
* Contract balance
*/
export interface ContractBalance {
amount?: number;

amount_wei?: string;
}

/**
* social links of the token
*/
export interface ExternalLinks {
homepage?: string;

telegram_channel_id?: string;

twitter_page?: string;
}

/**
* Contract owner balance
*/
export interface OwnerBalance {
amount?: number;

amount_wei?: string;
}
}

/**
* Trading limits of the token
*/
Expand Down Expand Up @@ -256,6 +409,7 @@ export namespace TokenBulkScanResponse {
| 'HIGH_TRADE_VOLUME'
| 'MARKET_PLACE_SALES_HISTORY'
| 'HIGH_REPUTATION_TOKEN'
| 'ONCHAIN_ACTIVITY_VALIDATOR'
| 'STATIC_CODE_SIGNATURE'
| 'KNOWN_MALICIOUS'
| 'METADATA'
Expand Down
Loading