New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fireblocks-sdk

Package Overview
Dependencies
Maintainers
6
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fireblocks-sdk - npm Package Compare versions

Comparing version

to
3.0.0

6

CHANGELOG.md

@@ -5,2 +5,8 @@ ### Changelog

### [v3.0.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v2.5.4...v3.0.0)
> 5 January 2023
- Feat/web3 api phase B [`#130`](https://github.com/fireblocks/fireblocks-sdk-js/pull/130)
#### [v2.5.4](https://github.com/fireblocks/fireblocks-sdk-js/compare/v2.5.3...v2.5.4)

@@ -7,0 +13,0 @@

49

dist/fireblocks-sdk.d.ts
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, SignerConnectionPayload, CreateConnectionResponse, Session, NetworkConnectionRoutingPolicy, NetworkIdRoutingPolicy, NetworkIdResponse, TimePeriod, AuditsResponse, NFTOwnershipFilter, Token, TokenWithBalance, APIPagedResponse } 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, CreateWeb3ConnectionResponse, Session, NetworkConnectionRoutingPolicy, NetworkIdRoutingPolicy, NetworkIdResponse, TimePeriod, AuditsResponse, NFTOwnershipFilter, Token, TokenWithBalance, APIPagedResponse, CreateWalletConnectPayload, Web3ConnectionType, GetWeb3ConnectionsPayload, PublicKeyResponse, AllocateFundsResponse, SettleOffExchangeAccountResponse } from "./types";
import { AxiosProxyConfig } from "axios";

@@ -89,3 +89,3 @@ export * from "./types";

*/
setAddressDescription(vaultAccountId: string, assetId: string, address: string, tag?: string, description?: string): Promise<GenerateAddressResponse>;
setAddressDescription(vaultAccountId: string, assetId: string, address: string, tag?: string, description?: string): Promise<OperationSuccessResponse>;
/**

@@ -174,3 +174,3 @@ * Gets all network connections

*/
getExchangeAsset(exchangeAccountId: string, assetId: string): Promise<ExchangeResponse>;
getExchangeAsset(exchangeAccountId: string, assetId: string): Promise<AssetResponse>;
/**

@@ -533,3 +533,3 @@ * Convert an asset at an Exchange Account

*/
allocateFundsToPrivateLedger(vaultAccountId: string, asset: string, args: AllocateFundsRequest, requestOptions?: RequestOptions): Promise<any>;
allocateFundsToPrivateLedger(vaultAccountId: string, asset: string, args: AllocateFundsRequest, requestOptions?: RequestOptions): Promise<AllocateFundsResponse>;
/**

@@ -542,3 +542,3 @@ * deallocate funds from a private ledger to your default balance

*/
deallocateFundsFromPrivateLedger(vaultAccountId: string, asset: string, args: DeallocateFundsRequest, requestOptions?: RequestOptions): Promise<any>;
deallocateFundsFromPrivateLedger(vaultAccountId: string, asset: string, args: DeallocateFundsRequest, requestOptions?: RequestOptions): Promise<AllocateFundsResponse>;
/**

@@ -548,3 +548,3 @@ * Get the public key information for a vault account

*/
getPublicKeyInfoForVaultAccount(args: PublicKeyInfoForVaultAccountArgs): Promise<any>;
getPublicKeyInfoForVaultAccount(args: PublicKeyInfoForVaultAccountArgs): Promise<PublicKeyResponse>;
/**

@@ -620,3 +620,3 @@ * Get configuration and status of the Gas Station account

*/
settleOffExchangeAccountById(id: string, requestOptions?: RequestOptions): Promise<void>;
settleOffExchangeAccountById(id: string, requestOptions?: RequestOptions): Promise<SettleOffExchangeAccountResponse>;
/**

@@ -639,12 +639,25 @@ * Set Fee Payer configuration

removeFeePayerConfiguration(baseAsset: string): Promise<void>;
private getWeb3ConnectionPath;
/**
* Get all signer connections of the current user
* @returns Array of sessions
* Get all signer connections of the current tenant
* @param {Object} payload The payload for getting the current tenant's sessions
* @param payload.pageCursor The cursor for the next page
* @param payload.pageSize The amount of results to return on the next page
* @param payload.sort The property to sort the results by
* @param payload.filter The filter object, containing properties as keys and the values to filter by as values
* @param payload.desc Should the results be ordered in ascending order (false) or descending (true)
*
* @returns An object containing the data returned and the cursor for the next page
*/
getAllSignerConnections(): Promise<Session[]>;
getWeb3Connections({ pageCursor, pageSize, sort, filter, order }?: GetWeb3ConnectionsPayload): Promise<APIPagedResponse<Session>>;
/**
* Initiate a new signer connection
* @param payload The required parameters for the connection type
* @param requestOptions
* @returns The created session's ID and its metadata
* Initiate a new web3 connection
* @param type The type of the connection
* @param payload The payload for creating a new web3 connection
* @param payload.vaultAccountId The vault account to link with the dapp
* @param payload.feeLevel The fee level for the connection
* @param payload.uri The WalletConnect URI, as provided by the dapp
* @param payload.chainIds Array of the approved chains for the connection
*
* @returns The created session's ID and it's metadata
* @example {

@@ -658,14 +671,16 @@ * vaultAccountId: 0

*/
createSignerConnection(payload: SignerConnectionPayload, requestOptions?: RequestOptions): Promise<CreateConnectionResponse>;
createWeb3Connection(type: Web3ConnectionType.WALLET_CONNECT, payload: CreateWalletConnectPayload, requestOptions?: RequestOptions): Promise<CreateWeb3ConnectionResponse>;
/**
* Approve or Reject the initiated connection
* @param type The type of the connection
* @param sessionId The ID of the session
* @param approve Whether you approve the connection or not
*/
submitSignerConnection(sessionId: string, approve: boolean): Promise<void>;
submitWeb3Connection(type: Web3ConnectionType.WALLET_CONNECT, sessionId: string, approve: boolean): Promise<void>;
/**
* Remove an existing connection
* @param type The type of the connection
* @param sessionId The ID of the session
*/
removeSignerConnection(sessionId: string): Promise<void>;
removeWeb3Connection(type: Web3ConnectionType.WALLET_CONNECT, sessionId: string): Promise<void>;
/**

@@ -672,0 +687,0 @@ * Gets all audits for selected time period

@@ -29,2 +29,4 @@ "use strict";

const query_string_1 = __importDefault(require("query-string"));
const qs_1 = require("qs");
const types_1 = require("./types");
__exportStar(require("./types"), exports);

@@ -1177,46 +1179,46 @@ class FireblocksSDK {

}
getWeb3ConnectionPath(type) {
const basePath = `/v1/connections`;
switch (type) {
case (types_1.Web3ConnectionType.WALLET_CONNECT): {
return `${basePath}/wc`;
}
default: {
throw new Error(`Invalid Web3 connection type`);
}
}
}
/**
* Get all signer connections of the current user
* @returns Array of sessions
* Get all signer connections of the current tenant
* @param {Object} payload The payload for getting the current tenant's sessions
* @param payload.pageCursor The cursor for the next page
* @param payload.pageSize The amount of results to return on the next page
* @param payload.sort The property to sort the results by
* @param payload.filter The filter object, containing properties as keys and the values to filter by as values
* @param payload.desc Should the results be ordered in ascending order (false) or descending (true)
*
* @returns An object containing the data returned and the cursor for the next page
*/
getAllSignerConnections() {
getWeb3Connections({ pageCursor, pageSize, sort, filter, order } = {}) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.apiClient.issueGetRequest(`/v1/connections`);
const params = new URLSearchParams(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (pageCursor && { next: pageCursor })), (pageSize && { pageSize: pageSize.toString() })), (sort && { sort })), (filter && { filter: qs_1.stringify(filter, { delimiter: "," }) })), (order && { order })));
return yield this.apiClient.issueGetRequest(`/v1/connections?${params.toString()}`);
});
}
/**
* Initiate a new signer connection
* @param payload The required parameters for the connection type
* @param requestOptions
* @returns The created session's ID and its metadata
* @example {
* vaultAccountId: 0
* feeLevel: "MEDIUM"
* connectionType: "WalletConnect"
* uri: "wc:77752975-906f-48f5-b59f-047826ee947e@1?bridge=https%3A%2F%2F0.bridge.walletconnect.org&key=64be99adc6086b7a729b0ec8c7e1f174927ab92e84f5c6f9527050225344a637"
* chainIds: ["ETH", "ETH_TEST"]
* }
*/
createSignerConnection(payload, requestOptions) {
createWeb3Connection(type, payload, requestOptions) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.apiClient.issuePostRequest(`/v1/connections`, payload, requestOptions);
const path = this.getWeb3ConnectionPath(type);
return yield this.apiClient.issuePostRequest(path, payload, requestOptions);
});
}
/**
* Approve or Reject the initiated connection
* @param sessionId The ID of the session
* @param approve Whether you approve the connection or not
*/
submitSignerConnection(sessionId, approve) {
submitWeb3Connection(type, sessionId, approve) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.apiClient.issuePutRequest(`/v1/connections/${sessionId}`, { approve });
const path = this.getWeb3ConnectionPath(type);
return yield this.apiClient.issuePutRequest(`${path}/${sessionId}`, { approve });
});
}
/**
* Remove an existing connection
* @param sessionId The ID of the session
*/
removeSignerConnection(sessionId) {
removeWeb3Connection(type, sessionId) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.apiClient.issueDeleteRequest(`/v1/connections/${sessionId}`);
const path = this.getWeb3ConnectionPath(type);
return yield this.apiClient.issueDeleteRequest(`${path}/${sessionId}`);
});

@@ -1223,0 +1225,0 @@ }

export interface VaultAccountResponse {
id: string;
name: string;
hiddenOnUI: boolean;
assets: AssetResponse[];
hiddenOnUI?: boolean;
assets?: AssetResponse[];
customerRefId?: string;
autoFuel: boolean;
autoFuel?: boolean;
}

@@ -24,4 +24,4 @@ export declare enum VirtualAffiliation {

lockedAmount?: string;
available: string;
pending: string;
available?: string;
pending?: string;
selfStakedCPU?: string;

@@ -57,3 +57,3 @@ selfStakedNetwork?: string;

tag: string;
eosAccountName: string;
eosAccountName?: string;
status?: VaultAssetActivationStatus;

@@ -76,4 +76,4 @@ activationTxId?: string;

status: string;
address: string;
tag: string;
address?: string;
tag?: string;
activationTime?: string;

@@ -133,9 +133,9 @@ }

export interface DepositAddressResponse {
assetId: string;
assetId?: string;
address: string;
tag?: string;
description?: string;
type: string;
type?: string;
customerRefId?: string;
addressFormat: string;
addressFormat?: string;
legacyAddress?: string;

@@ -198,3 +198,3 @@ enterpriseAddress?: string;

}
export declare enum SignerConnectionFeeLevel {
export declare enum Web3ConnectionFeeLevel {
HIGH = "HIGH",

@@ -535,6 +535,6 @@ MEDIUM = "MEDIUM"

}
export declare enum SignerConnectionType {
export declare enum Web3ConnectionType {
WALLET_CONNECT = "WalletConnect"
}
export declare enum SignerConnectionMethod {
export declare enum Web3ConnectionMethod {
MOBILE = "MOBILE",

@@ -553,2 +553,6 @@ DESKTOP = "DESKTOP",

}
export interface AllocateFundsResponse {
id: string;
status: string;
}
export interface CreateTransferTicketArgs {

@@ -626,3 +630,3 @@ externalTicketId: string;

}
export interface PublicKeyResonse {
export interface PublicKeyResponse {
status: number;

@@ -654,8 +658,8 @@ algorithm: string;

accounts: VaultAccountResponse[];
paging: {
before: string;
after: string;
paging?: {
before?: string;
after?: string;
};
previousUrl: string;
nextUrl: string;
previousUrl?: string;
nextUrl?: string;
}

@@ -706,2 +710,10 @@ export interface VaultBalancesFilter {

}
export interface SettleOffExchangeAccountResponse {
message: string;
code: SettleResponseCode;
}
export declare enum SettleResponseCode {
NONE = 0,
NOTHING_TO_SETTLE = 1
}
export interface SetFeePayerConfiguration {

@@ -713,13 +725,20 @@ feePayerAccountId: string;

}
export interface SignerConnectionPayload {
export interface CreateWeb3ConnectionPayload {
vaultAccountId: number;
feeLevel: SignerConnectionFeeLevel;
connectionType: SignerConnectionType;
feeLevel: Web3ConnectionFeeLevel;
}
export interface WalletConnectPayload extends SignerConnectionPayload {
connectionType: SignerConnectionType.WALLET_CONNECT;
export interface CreateWalletConnectPayload extends CreateWeb3ConnectionPayload {
uri: string;
chainIds: string[];
}
export interface CreateConnectionResponse {
export interface GetWeb3ConnectionsPayload {
pageCursor?: string;
pageSize?: number;
sort?: string;
filter?: {
[filterProp: string]: string;
};
order?: "ASC" | "DESC";
}
export interface CreateWeb3ConnectionResponse {
id: string;

@@ -745,6 +764,6 @@ sessionMetadata: {

chainIds?: string[];
feeLevel: SignerConnectionFeeLevel;
feeLevel: Web3ConnectionFeeLevel;
creationDate: Date;
connectionType: SignerConnectionType;
connectionMethod?: SignerConnectionMethod;
connectionType: Web3ConnectionType;
connectionMethod?: Web3ConnectionMethod;
sessionMetadata?: SessionMetadata;

@@ -751,0 +770,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TimePeriod = exports.TransferTicketTermStatus = exports.TransferTicketStatus = exports.SignerConnectionMethod = exports.SignerConnectionType = exports.TransactionOperation = exports.VirtualType = exports.PeerType = exports.TransactionStatus = exports.TransactionOrder = exports.NetworkDestType = exports.NetworkScheme = exports.FeeLevel = exports.SignerConnectionFeeLevel = exports.SigningAlgorithm = exports.VaultAssetActivationStatus = exports.VirtualAffiliation = void 0;
exports.TimePeriod = exports.SettleResponseCode = exports.TransferTicketTermStatus = exports.TransferTicketStatus = exports.Web3ConnectionMethod = exports.Web3ConnectionType = exports.TransactionOperation = exports.VirtualType = exports.PeerType = exports.TransactionStatus = exports.TransactionOrder = exports.NetworkDestType = exports.NetworkScheme = exports.FeeLevel = exports.Web3ConnectionFeeLevel = exports.SigningAlgorithm = exports.VaultAssetActivationStatus = exports.VirtualAffiliation = void 0;
var VirtualAffiliation;

@@ -21,7 +21,7 @@ (function (VirtualAffiliation) {

})(SigningAlgorithm = exports.SigningAlgorithm || (exports.SigningAlgorithm = {}));
var SignerConnectionFeeLevel;
(function (SignerConnectionFeeLevel) {
SignerConnectionFeeLevel["HIGH"] = "HIGH";
SignerConnectionFeeLevel["MEDIUM"] = "MEDIUM";
})(SignerConnectionFeeLevel = exports.SignerConnectionFeeLevel || (exports.SignerConnectionFeeLevel = {}));
var Web3ConnectionFeeLevel;
(function (Web3ConnectionFeeLevel) {
Web3ConnectionFeeLevel["HIGH"] = "HIGH";
Web3ConnectionFeeLevel["MEDIUM"] = "MEDIUM";
})(Web3ConnectionFeeLevel = exports.Web3ConnectionFeeLevel || (exports.Web3ConnectionFeeLevel = {}));
var FeeLevel;

@@ -110,12 +110,12 @@ (function (FeeLevel) {

})(TransactionOperation = exports.TransactionOperation || (exports.TransactionOperation = {}));
var SignerConnectionType;
(function (SignerConnectionType) {
SignerConnectionType["WALLET_CONNECT"] = "WalletConnect";
})(SignerConnectionType = exports.SignerConnectionType || (exports.SignerConnectionType = {}));
var SignerConnectionMethod;
(function (SignerConnectionMethod) {
SignerConnectionMethod["MOBILE"] = "MOBILE";
SignerConnectionMethod["DESKTOP"] = "DESKTOP";
SignerConnectionMethod["API"] = "API";
})(SignerConnectionMethod = exports.SignerConnectionMethod || (exports.SignerConnectionMethod = {}));
var Web3ConnectionType;
(function (Web3ConnectionType) {
Web3ConnectionType["WALLET_CONNECT"] = "WalletConnect";
})(Web3ConnectionType = exports.Web3ConnectionType || (exports.Web3ConnectionType = {}));
var Web3ConnectionMethod;
(function (Web3ConnectionMethod) {
Web3ConnectionMethod["MOBILE"] = "MOBILE";
Web3ConnectionMethod["DESKTOP"] = "DESKTOP";
Web3ConnectionMethod["API"] = "API";
})(Web3ConnectionMethod = exports.Web3ConnectionMethod || (exports.Web3ConnectionMethod = {}));
var TransferTicketStatus;

@@ -134,2 +134,7 @@ (function (TransferTicketStatus) {

})(TransferTicketTermStatus = exports.TransferTicketTermStatus || (exports.TransferTicketTermStatus = {}));
var SettleResponseCode;
(function (SettleResponseCode) {
SettleResponseCode[SettleResponseCode["NONE"] = 0] = "NONE";
SettleResponseCode[SettleResponseCode["NOTHING_TO_SETTLE"] = 1] = "NOTHING_TO_SETTLE";
})(SettleResponseCode = exports.SettleResponseCode || (exports.SettleResponseCode = {}));
var TimePeriod;

@@ -136,0 +141,0 @@ (function (TimePeriod) {

{
"name": "fireblocks-sdk",
"version": "2.5.4",
"version": "3.0.0",
"main": "dist/fireblocks-sdk.js",

@@ -19,2 +19,3 @@ "types": "dist/fireblocks-sdk.d.ts",

"axios": "^0.24.0",
"qs": "^6.11.0",
"jsonwebtoken": "9.0.0",

@@ -26,2 +27,3 @@ "query-string": "^7.1.3",

"@types/jsonwebtoken": "8.5.0",
"@types/qs": "^6.9.7",
"@types/uuid": "^8.3.1",

@@ -28,0 +30,0 @@ "tslint": "6.1.3",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet