diff --git a/src/fireblocks-sdk.ts b/src/fireblocks-sdk.ts index a5794f51..bc01087e 100644 --- a/src/fireblocks-sdk.ts +++ b/src/fireblocks-sdk.ts @@ -29,10 +29,10 @@ import { GasStationInfo, MaxSpendableAmountResponse, VaultAccountsFilter, - RequestOptions, VaultBalancesFilter, ValidateAddressResponse, - CreateVaultAssetResponse + CreateVaultAssetResponse, + RequestOptions, AllocateFundsRequest, DeallocateFundsRequest } from "./types"; export * from "./types"; @@ -640,6 +640,30 @@ export class FireblocksSDK { return await this.apiClient.issueGetRequest(url); } + /** + * allocate funds from you default balance to a private ledger + * @param vaultAccountId + * @param asset + * @param vaultAccountId + * @param asset + * @param args + */ + public async allocateFundsToPrivateLedger(vaultAccountId: string, asset: string, args: AllocateFundsRequest) { + const url = `/v1/vault/accounts/${vaultAccountId}/${asset}/lock_allocation`; + return await this.apiClient.issuePostRequest(url, args); + } + + /** + * deallocate funds from a private ledger to your default balance + * @param vaultAccountId + * @param asset + * @param args + */ + public async deallocateFundsFromPrivateLedger(vaultAccountId: string, asset: string, args: DeallocateFundsRequest) { + const url = `/v1/vault/accounts/${vaultAccountId}/${asset}/release_allocation`; + return await this.apiClient.issuePostRequest(url, args); + } + /** * Get the public key information for a vault account * @param args diff --git a/src/types.ts b/src/types.ts index 77ec1b53..50186e38 100644 --- a/src/types.ts +++ b/src/types.ts @@ -83,12 +83,16 @@ export interface EstimatedTransactionFee { export interface TransferPeerPath { type?: PeerType; id?: string; + virtualId?: string; + virtualType?: VirtualType; address?: string; } interface DestinationTransferPeerPath { type: PeerType; id: string; + virtualId?: string; + virtualType?: VirtualType; oneTimeAddress?: IOneTimeAddress; } @@ -324,6 +328,11 @@ export enum PeerType { ONE_TIME_ADDRESS = "ONE_TIME_ADDRESS" } +export enum VirtualType { + OFF_EXCHANGE = "OFF_EXCHANGE", + DEFAULT = "DEFAULT" +} + export enum TransactionOperation { TRANSFER = "TRANSFER", MINT = "MINT", @@ -331,7 +340,17 @@ export enum TransactionOperation { SUPPLY_TO_COMPOUND = "SUPPLY_TO_COMPOUND", REDEEM_FROM_COMPOUND = "REDEEM_FROM_COMPOUND", RAW = "RAW", - CONTRACT_CALL = "CONTRACT_CALL" + CONTRACT_CALL = "CONTRACT_CALL", +} + +export interface AllocateFundsRequest { + allocationId: string; + amount: string; +} + +export interface DeallocateFundsRequest { + allocationId: string; + amount: string; } export interface CreateTransferTicketArgs {