fireblocks-sdk
Advanced tools
Comparing version 2.3.2 to 2.4.0
@@ -5,2 +5,8 @@ ### Changelog | ||
#### [v2.4.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v2.3.2...v2.4.0) | ||
> 26 October 2022 | ||
- Add network related functionality [`#101`](https://github.com/fireblocks/fireblocks-sdk-js/pull/101) | ||
#### [v2.3.2](https://github.com/fireblocks/fireblocks-sdk-js/compare/v2.3.1...v2.3.2) | ||
@@ -7,0 +13,0 @@ |
@@ -14,3 +14,4 @@ import { IAuthProvider } from "./iauth-provider"; | ||
issuePutRequest(path: string, body: any): Promise<any>; | ||
issuePatchRequest(path: string, body: any): Promise<any>; | ||
issueDeleteRequest(path: string): Promise<any>; | ||
} |
@@ -77,2 +77,15 @@ "use strict"; | ||
} | ||
issuePatchRequest(path, body) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const token = this.authProvider.signJwt(path, body); | ||
const headers = { | ||
"X-API-Key": this.authProvider.getApiKey(), | ||
"Authorization": `Bearer ${token}`, | ||
}; | ||
return (yield this.axiosInstance.patch(path, body, { | ||
headers, | ||
timeout: this.options.timeoutInMs | ||
})).data; | ||
}); | ||
} | ||
issueDeleteRequest(path) { | ||
@@ -79,0 +92,0 @@ return __awaiter(this, void 0, void 0, function* () { |
import { IAuthProvider } from "./iauth-provider"; | ||
import { AllocateFundsRequest, AssetResponse, AssetTypeResponse, CancelTransactionResponse, ConvertExchangeAssetResponse, CreateTransactionResponse, CreateTransferTicketArgs, CreateTransferTicketResponse, DeallocateFundsRequest, DepositAddressResponse, EstimateFeeResponse, EstimateTransactionFeeResponse, ExchangeResponse, ExecuteTermArgs, ExternalWalletAsset, FiatAccountResponse, GasStationInfo, GenerateAddressResponse, InternalWalletAsset, MaxSpendableAmountResponse, NetworkConnectionResponse, OffExchangeEntityResponse, OperationSuccessResponse, PagedVaultAccountsRequestFilters, PagedVaultAccountsResponse, PublicKeyInfoArgs, PublicKeyInfoForVaultAccountArgs, RequestOptions, ResendWebhooksResponse, TermResponse, TransactionArguments, TransactionFilter, TransactionPageFilter, TransactionPageResponse, TransactionResponse, TransferTicketResponse, User, ValidateAddressResponse, VaultAccountResponse, VaultAccountsFilter, VaultAssetResponse, VaultBalancesFilter, WalletContainerResponse, SetFeePayerConfiguration, FeePayerConfiguration } from "./types"; | ||
import { AllocateFundsRequest, AssetResponse, AssetTypeResponse, CancelTransactionResponse, ConvertExchangeAssetResponse, CreateTransactionResponse, CreateTransferTicketArgs, CreateTransferTicketResponse, DeallocateFundsRequest, DepositAddressResponse, EstimateFeeResponse, EstimateTransactionFeeResponse, ExchangeResponse, ExecuteTermArgs, ExternalWalletAsset, FiatAccountResponse, GasStationInfo, GenerateAddressResponse, InternalWalletAsset, MaxSpendableAmountResponse, NetworkConnectionResponse, OffExchangeEntityResponse, OperationSuccessResponse, PagedVaultAccountsRequestFilters, PagedVaultAccountsResponse, PublicKeyInfoArgs, PublicKeyInfoForVaultAccountArgs, RequestOptions, ResendWebhooksResponse, TermResponse, TransactionArguments, TransactionFilter, TransactionPageFilter, TransactionPageResponse, TransactionResponse, TransferTicketResponse, User, ValidateAddressResponse, VaultAccountResponse, VaultAccountsFilter, VaultAssetResponse, VaultBalancesFilter, WalletContainerResponse, SetFeePayerConfiguration, FeePayerConfiguration, NetworkConnectionRoutingPolicy, NetworkIdRoutingPolicy, NetworkIdResponse, TimePeriod, AuditsResponse } from "./types"; | ||
export * from "./types"; | ||
@@ -90,9 +90,64 @@ export interface SDKOptions { | ||
* Gets all network connections | ||
* @returns NetworkConnectionResponse | ||
*/ | ||
getNetworkConnections(): Promise<NetworkConnectionResponse[]>; | ||
/** | ||
* Gets a single network connection by id | ||
* Creates a network connection | ||
* @param localNetworkId The local netowrk profile's id | ||
* @param remoteNetworkId The remote network profile's id | ||
* @param routingPolicy The desired routing policy for the connection | ||
* @returns NetworkConnectionResponse | ||
*/ | ||
createNetworkConnection(localNetworkId: string, remoteNetworkId: string, routingPolicy?: NetworkConnectionRoutingPolicy): Promise<NetworkConnectionResponse>; | ||
/** | ||
* Gets a single network connection | ||
* @param connectionId The network connection's id | ||
* @returns NetworkConnectionResponse | ||
*/ | ||
getNetworkConnectionById(connectionId: string): Promise<NetworkConnectionResponse>; | ||
/** | ||
* Removes a network connection | ||
* @param connectionId The network connection's id | ||
* @returns OperationSuccessResponse | ||
*/ | ||
removeNetworkConnection(connectionId: string): Promise<OperationSuccessResponse>; | ||
/** | ||
* Sets routing policy for a network connection | ||
* @param connectionId The network connection's id | ||
* @param routingPolicy The desired routing policy | ||
*/ | ||
setNetworkConnectionRoutingPolicy(connectionId: string, routingPolicy: NetworkConnectionRoutingPolicy): Promise<any>; | ||
/** | ||
* Gets all discoverable network profiles | ||
* @returns NetworkIdResponse | ||
*/ | ||
getDiscoverableNetworkIds(): Promise<NetworkIdResponse[]>; | ||
/** | ||
* Creates a new network profile | ||
* @param name A name for the new network profile | ||
* @param routingPolicy The desired routing policy for the network | ||
* @returns NetworkConnectionResponse | ||
*/ | ||
createNetworkId(name: string, routingPolicy?: NetworkIdRoutingPolicy): Promise<NetworkIdResponse>; | ||
/** | ||
* Gets a single network profile | ||
* @param networkId The network profile's id | ||
* @returns NetworkIdResponse | ||
*/ | ||
getNetworkId(networkId: string): Promise<NetworkIdResponse>; | ||
/** | ||
* Sets discoverability for network profile | ||
* @param networkId The network profile's id | ||
* @param isDiscoverable The desired discoverability to set | ||
* @returns OperationSuccessResponse | ||
*/ | ||
setNetworkIdDiscoverability(networkId: string, isDiscoverable: boolean): Promise<OperationSuccessResponse>; | ||
/** | ||
* Sets routing policy for network profile | ||
* @param networkId The network profile's id | ||
* @param routingPolicy The desired routing policy | ||
* @returns OperationSuccessResponse | ||
*/ | ||
setNetworkIdRoutingPolicy(networkId: string, routingPolicy: NetworkIdRoutingPolicy): Promise<any>; | ||
/** | ||
* Gets all exchange accounts for your tenant | ||
@@ -577,2 +632,7 @@ */ | ||
removeFeePayerConfiguration(baseAsset: string): Promise<void>; | ||
/** | ||
* Gets all audits for selected time period | ||
* @param timePeriod | ||
*/ | ||
getAudits(timePeriod?: TimePeriod): Promise<AuditsResponse>; | ||
} |
@@ -168,2 +168,3 @@ "use strict"; | ||
* Gets all network connections | ||
* @returns NetworkConnectionResponse | ||
*/ | ||
@@ -176,4 +177,19 @@ getNetworkConnections() { | ||
/** | ||
* Gets a single network connection by id | ||
* Creates a network connection | ||
* @param localNetworkId The local netowrk profile's id | ||
* @param remoteNetworkId The remote network profile's id | ||
* @param routingPolicy The desired routing policy for the connection | ||
* @returns NetworkConnectionResponse | ||
*/ | ||
createNetworkConnection(localNetworkId, remoteNetworkId, routingPolicy) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const body = { localNetworkId, remoteNetworkId, routingPolicy }; | ||
return yield this.apiClient.issuePostRequest(`/v1/network_connections`, body); | ||
}); | ||
} | ||
/** | ||
* Gets a single network connection | ||
* @param connectionId The network connection's id | ||
* @returns NetworkConnectionResponse | ||
*/ | ||
getNetworkConnectionById(connectionId) { | ||
@@ -185,2 +201,78 @@ return __awaiter(this, void 0, void 0, function* () { | ||
/** | ||
* Removes a network connection | ||
* @param connectionId The network connection's id | ||
* @returns OperationSuccessResponse | ||
*/ | ||
removeNetworkConnection(connectionId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.apiClient.issueDeleteRequest(`/v1/network_connections/${connectionId}`); | ||
}); | ||
} | ||
/** | ||
* Sets routing policy for a network connection | ||
* @param connectionId The network connection's id | ||
* @param routingPolicy The desired routing policy | ||
*/ | ||
setNetworkConnectionRoutingPolicy(connectionId, routingPolicy) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const body = { routingPolicy }; | ||
return yield this.apiClient.issuePatchRequest(`/v1/network_connections/${connectionId}/set_routing_policy`, body); | ||
}); | ||
} | ||
/** | ||
* Gets all discoverable network profiles | ||
* @returns NetworkIdResponse | ||
*/ | ||
getDiscoverableNetworkIds() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.apiClient.issueGetRequest(`/v1/network_ids`); | ||
}); | ||
} | ||
/** | ||
* Creates a new network profile | ||
* @param name A name for the new network profile | ||
* @param routingPolicy The desired routing policy for the network | ||
* @returns NetworkConnectionResponse | ||
*/ | ||
createNetworkId(name, routingPolicy) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const body = { name, routingPolicy }; | ||
return yield this.apiClient.issuePostRequest(`/v1/network_ids`, body); | ||
}); | ||
} | ||
/** | ||
* Gets a single network profile | ||
* @param networkId The network profile's id | ||
* @returns NetworkIdResponse | ||
*/ | ||
getNetworkId(networkId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.apiClient.issueGetRequest(`/v1/network_ids/${networkId}`); | ||
}); | ||
} | ||
/** | ||
* Sets discoverability for network profile | ||
* @param networkId The network profile's id | ||
* @param isDiscoverable The desired discoverability to set | ||
* @returns OperationSuccessResponse | ||
*/ | ||
setNetworkIdDiscoverability(networkId, isDiscoverable) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const body = { isDiscoverable }; | ||
return yield this.apiClient.issuePatchRequest(`/v1/network_ids/${networkId}/set_discoverability`, body); | ||
}); | ||
} | ||
/** | ||
* Sets routing policy for network profile | ||
* @param networkId The network profile's id | ||
* @param routingPolicy The desired routing policy | ||
* @returns OperationSuccessResponse | ||
*/ | ||
setNetworkIdRoutingPolicy(networkId, routingPolicy) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const body = { routingPolicy }; | ||
return yield this.apiClient.issuePatchRequest(`/v1/network_ids/${networkId}/set_routing_policy`, body); | ||
}); | ||
} | ||
/** | ||
* Gets all exchange accounts for your tenant | ||
@@ -1087,4 +1179,17 @@ */ | ||
} | ||
/** | ||
* Gets all audits for selected time period | ||
* @param timePeriod | ||
*/ | ||
getAudits(timePeriod) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let url = `/v1/audits`; | ||
if (timePeriod) { | ||
url += `?timePeriod=${timePeriod}`; | ||
} | ||
return yield this.apiClient.issueGetRequest(url); | ||
}); | ||
} | ||
} | ||
exports.FireblocksSDK = FireblocksSDK; | ||
//# sourceMappingURL=fireblocks-sdk.js.map |
@@ -348,4 +348,10 @@ export interface VaultAccountResponse { | ||
localNetworkId: NetworkId; | ||
routingPolicy?: RoutingPolicy; | ||
routingPolicy?: NetworkConnectionRoutingPolicy; | ||
} | ||
export interface NetworkIdResponse { | ||
id: string; | ||
name: string; | ||
isDiscoverable: boolean; | ||
routingPolicy?: NetworkIdRoutingPolicy; | ||
} | ||
interface NetworkId { | ||
@@ -355,22 +361,47 @@ id: string; | ||
} | ||
export interface RoutingPolicy { | ||
crypto?: RoutingDest; | ||
sen?: RoutingDest; | ||
signet?: RoutingDest; | ||
sen_test?: RoutingDest; | ||
signet_test?: RoutingDest; | ||
export interface CustomCryptoRoutingDest { | ||
scheme: NetworkScheme.CUSTOM; | ||
dstType: NetworkDestType.EXCHANGE_ACCOUNT | NetworkDestType.VAULT_ACCOUNT; | ||
dstId: string; | ||
} | ||
export interface RoutingDest { | ||
scheme: Scheme; | ||
dstType: NetworkDestType; | ||
export interface CustomFiatRoutingDest { | ||
scheme: NetworkScheme.CUSTOM; | ||
dstType: NetworkDestType.FIAT_ACCOUNT; | ||
dstId: string; | ||
} | ||
export declare enum Scheme { | ||
export interface DefaultNetworkRoutingDest { | ||
scheme: NetworkScheme.DEFAULT; | ||
} | ||
export interface AutoNetworkRoutingDest { | ||
scheme: NetworkScheme.AUTO; | ||
} | ||
export interface NoneNetworkRoutingDest { | ||
scheme: NetworkScheme.NONE; | ||
} | ||
export declare type NetworkConnectionCryptoRoutingDest = CustomCryptoRoutingDest | DefaultNetworkRoutingDest | NoneNetworkRoutingDest; | ||
export declare type NetworkConnectionFiatRoutingDest = CustomFiatRoutingDest | DefaultNetworkRoutingDest | NoneNetworkRoutingDest; | ||
export declare type NetworkIdCryptoRoutingDest = CustomCryptoRoutingDest | AutoNetworkRoutingDest | NoneNetworkRoutingDest; | ||
export declare type NetworkIdFiatRoutingDest = CustomFiatRoutingDest | AutoNetworkRoutingDest | NoneNetworkRoutingDest; | ||
export interface NetworkConnectionRoutingPolicy { | ||
crypto?: NetworkConnectionCryptoRoutingDest; | ||
sen?: NetworkConnectionFiatRoutingDest; | ||
signet?: NetworkConnectionFiatRoutingDest; | ||
sen_test?: NetworkConnectionFiatRoutingDest; | ||
signet_test?: NetworkConnectionFiatRoutingDest; | ||
} | ||
export interface NetworkIdRoutingPolicy { | ||
crypto?: NetworkIdCryptoRoutingDest; | ||
sen?: NetworkIdFiatRoutingDest; | ||
signet?: NetworkIdFiatRoutingDest; | ||
sen_test?: NetworkIdFiatRoutingDest; | ||
signet_test?: NetworkIdFiatRoutingDest; | ||
} | ||
export declare enum NetworkScheme { | ||
DEFAULT = "DEFAULT", | ||
CUSTOM = "CUSTOM", | ||
AUTO = "AUTO", | ||
DEFAULT = "DEFAULT", | ||
CUSTOM = "CUSTOM" | ||
NONE = "NONE" | ||
} | ||
export declare enum NetworkDestType { | ||
VAULT_ACCOUNT = "VAULT", | ||
UNMANAGED_WALLET = "UNMANAGED", | ||
EXCHANGE_ACCOUNT = "EXCHANGE", | ||
@@ -627,2 +658,76 @@ FIAT_ACCOUNT = "FIAT_ACCOUNT" | ||
} | ||
export declare enum TimePeriod { | ||
DAY = "DAY", | ||
WEEK = "WEEK" | ||
} | ||
export interface Audit { | ||
data?: any; | ||
vendorId?: string; | ||
tenantId?: string; | ||
severity?: string; | ||
createdAt?: string; | ||
subject?: string; | ||
event?: string; | ||
user?: string; | ||
email?: string; | ||
txId?: string; | ||
amount?: string; | ||
transactionId?: string; | ||
walletType?: string; | ||
walletName?: string; | ||
confirmationThreshold?: string; | ||
sourceType?: string; | ||
sourceName?: string; | ||
sourceId?: string; | ||
destination?: string; | ||
destAddress?: string; | ||
newNote?: string; | ||
remoteType?: string; | ||
destName?: string; | ||
remoteId?: string; | ||
note?: string; | ||
signedBy?: string; | ||
approvedBy?: string; | ||
setBy?: string; | ||
cancelType?: string; | ||
fee?: string; | ||
rule?: string; | ||
screeningStatus?: string; | ||
verdict?: string; | ||
bypassReason?: string; | ||
status?: string; | ||
subStatus?: string; | ||
ruleJsonStr?: string; | ||
rejectedReason?: string; | ||
failReason?: string; | ||
oldRole?: string; | ||
role?: string; | ||
subjectUser?: string; | ||
ip?: string; | ||
accountName?: string; | ||
tag?: string; | ||
address?: string; | ||
accountType?: string; | ||
counterpartyName?: string; | ||
initiatedBy?: string; | ||
asset?: string; | ||
newIpAddress?: string; | ||
approverList?: string; | ||
removedUserName?: string; | ||
removedUserEmail?: string; | ||
action?: string; | ||
description?: string; | ||
userAgent?: string; | ||
authorizationInfo?: string; | ||
reEnrolledUser?: string; | ||
oldThreshold?: string; | ||
newThreshold?: string; | ||
oldAmount?: string; | ||
newAmount?: string; | ||
draftPolicyJson?: string; | ||
} | ||
export interface AuditsResponse { | ||
data: Audit[]; | ||
total: number; | ||
} | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TransferTicketTermStatus = exports.TransferTicketStatus = exports.TransactionOperation = exports.VirtualType = exports.PeerType = exports.TransactionStatus = exports.TransactionOrder = exports.NetworkDestType = exports.Scheme = exports.FeeLevel = exports.SigningAlgorithm = exports.VaultAssetActivationStatus = exports.VirtualAffiliation = void 0; | ||
exports.TimePeriod = exports.TransferTicketTermStatus = exports.TransferTicketStatus = exports.TransactionOperation = exports.VirtualType = exports.PeerType = exports.TransactionStatus = exports.TransactionOrder = exports.NetworkDestType = exports.NetworkScheme = exports.FeeLevel = exports.SigningAlgorithm = exports.VaultAssetActivationStatus = exports.VirtualAffiliation = void 0; | ||
var VirtualAffiliation; | ||
@@ -27,12 +27,12 @@ (function (VirtualAffiliation) { | ||
})(FeeLevel = exports.FeeLevel || (exports.FeeLevel = {})); | ||
var Scheme; | ||
(function (Scheme) { | ||
Scheme["AUTO"] = "AUTO"; | ||
Scheme["DEFAULT"] = "DEFAULT"; | ||
Scheme["CUSTOM"] = "CUSTOM"; | ||
})(Scheme = exports.Scheme || (exports.Scheme = {})); | ||
var NetworkScheme; | ||
(function (NetworkScheme) { | ||
NetworkScheme["DEFAULT"] = "DEFAULT"; | ||
NetworkScheme["CUSTOM"] = "CUSTOM"; | ||
NetworkScheme["AUTO"] = "AUTO"; | ||
NetworkScheme["NONE"] = "NONE"; | ||
})(NetworkScheme = exports.NetworkScheme || (exports.NetworkScheme = {})); | ||
var NetworkDestType; | ||
(function (NetworkDestType) { | ||
NetworkDestType["VAULT_ACCOUNT"] = "VAULT"; | ||
NetworkDestType["UNMANAGED_WALLET"] = "UNMANAGED"; | ||
NetworkDestType["EXCHANGE_ACCOUNT"] = "EXCHANGE"; | ||
@@ -117,2 +117,7 @@ NetworkDestType["FIAT_ACCOUNT"] = "FIAT_ACCOUNT"; | ||
})(TransferTicketTermStatus = exports.TransferTicketTermStatus || (exports.TransferTicketTermStatus = {})); | ||
var TimePeriod; | ||
(function (TimePeriod) { | ||
TimePeriod["DAY"] = "DAY"; | ||
TimePeriod["WEEK"] = "WEEK"; | ||
})(TimePeriod = exports.TimePeriod || (exports.TimePeriod = {})); | ||
//# sourceMappingURL=types.js.map |
{ | ||
"name": "fireblocks-sdk", | ||
"version": "2.3.2", | ||
"version": "2.4.0", | ||
"main": "dist/fireblocks-sdk.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/fireblocks-sdk.d.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
156734
2844