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

Add registerNewAsset function #264

Merged
merged 8 commits into from
Apr 1, 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
16 changes: 15 additions & 1 deletion src/fireblocks-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ import {
TokenLinkStatus,
SupportedContractTemplateType,
AbiFunction,
TokenOwnershipSpamUpdatePayload, ScreeningSupportedAssetResponse, ScreeningSupportedProviders,
TokenOwnershipSpamUpdatePayload,
ScreeningSupportedAssetResponse,
ScreeningSupportedProviders,
RegisterAssetResponse,
} from "./types";
import { AxiosProxyConfig, AxiosResponse, InternalAxiosRequestConfig } from "axios";
import { PIIEncryption } from "./pii-client";
Expand Down Expand Up @@ -859,6 +862,17 @@ export class FireblocksSDK {
return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}`, {}, requestOptions);
}

/**
* Registers new asset
* @param blockchainId Native asset of blockchain
* @param address Asset contract address
* @param symbol Asset symbol
* @param requestOptions
*/
public async registerNewAsset(blockchainId: string, address: string, symbol?: string, requestOptions?: RequestOptions): Promise<RegisterAssetResponse> {
return await this.apiClient.issuePostRequest(`/v1/assets`, { blockchainId, address, symbol }, requestOptions);
}

/**
* Retry to create a vault asset for a vault asset that failed
* @param vaultAccountId The vault account ID
Expand Down
32 changes: 32 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,38 @@ export interface UnfreezeTransactionResponse {
success: boolean;
}

export interface RegisterAssetResponse {
legacyId: string;
assetClass: AssetClass;
onchain: OnchainAsset;
metadata: AssetMetadata;
}

export enum AssetClass {
NATIVE = "NATIVE",
FT = "FT",
NFT = "NFT",
SFT = "SFT",
}

export interface OnchainAsset {
symbol: string;
name: string;
address?: string;
decimals: number;
standard: string;
}

export interface AssetMetadata {
scope: AssetScope;
deprecated: boolean;
}

export enum AssetScope {
GLOBAL = "Global",
LOCAL = "Local",
}

export interface VaultAssetResponse {
id: string;
address: string;
Expand Down
Loading