Skip to content

Commit

Permalink
Fees endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomer Vilensky committed Jul 15, 2020
1 parent 23c6bde commit 68cac47
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/fireblocks-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import {
TransferTicketResponse,
TermResponse,
ExecuteTermArgs,
CreateTransferTicketResponse
CreateTransferTicketResponse,
EstimateTransactionFeeResponse,
EstimateFeeResponse
} from "./types";

export * from "./types";
Expand Down Expand Up @@ -440,6 +442,20 @@ export class FireblocksSDK {
return await this.apiClient.issuePostRequest("/v1/transactions", options);
}

/**
* Estimates the fee for a transaction request
*/
public async estimateFeeForTransaction(options: TransactionArguments): Promise<EstimateTransactionFeeResponse> {
return await this.apiClient.issuePostRequest("/v1/transactions/estimate_fee", options);
}

/**
* Gets the estimated fees for an asset
*/
public async getFeeForAsset(asset: string): Promise<EstimateFeeResponse> {
return await this.apiClient.issueGetRequest(`/v1/estimate_network_fee?assetId=${asset}`);
}

/**
* Creates a new transfer ticket
*/
Expand Down
25 changes: 25 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,31 @@ export interface CreateTransactionResponse {
status: string;
}

export interface EstimateFeeResponse {
low: EstimatedFee;
medium: EstimatedFee;
high: EstimatedFee;
}

export interface EstimateTransactionFeeResponse {
low: EstimatedTransactionFee;
medium: EstimatedTransactionFee;
high: EstimatedTransactionFee;
}

export interface EstimatedFee {
networkFee?: string;
gasPrice?: string;
feePerByte?: string;
}

export interface EstimatedTransactionFee {
networkFee?: string;
gasPrice?: string;
gasLimit?: string;
feePerByte?: string;
}

export interface TransferPeerPath {
type: PeerType;
id: string;
Expand Down

0 comments on commit 68cac47

Please sign in to comment.