Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@zondax/beryx

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zondax/beryx - npm Package Compare versions

Comparing version 0.8.3 to 0.9.0

dist/filecoin/api/types/index.d.ts

36

dist/filecoin/api/index.d.ts

@@ -7,2 +7,3 @@ import { AxiosInstance, AxiosRequestConfig } from 'axios';

import AccountVesting from './types/responses/accountVesting';
import ApiError from './types/responses/apiError';
import Deals from './types/responses/deals';

@@ -15,2 +16,5 @@ import Tipset from './types/responses/tipset';

tools: FilecoinTools;
utils: {
isApiError: (response: unknown) => response is ApiError;
};
constructor(config: ClientConfig);

@@ -21,23 +25,23 @@ static getAxiosConfig: (config: ClientConfig) => AxiosRequestConfig;

*/
get getTipset(): (height?: number | undefined) => Promise<Tipset>;
get getTipset(): (height?: number | undefined) => Promise<ApiError | Tipset>;
/**
* @deprecated call function from "data" object instead
*/
get getTransactions(): (heightOrHash?: string | number | undefined) => Promise<Transactions>;
get getTransactions(): (heightOrHash?: string | number | undefined) => Promise<ApiError | Transactions>;
/**
* @deprecated call function from "data" object instead
*/
get getAccountBalance(): (address: string) => Promise<AccountBalance>;
get getAccountBalance(): (address: string) => Promise<AccountBalance | ApiError>;
/**
* @deprecated call function from "data" object instead
*/
get getAccountVesting(): (address: string) => Promise<AccountVesting>;
get getAccountVesting(): (address: string) => Promise<AccountVesting | ApiError>;
/**
* @deprecated call function from "data" object instead
*/
get getAccountTransactions(): (address: string) => Promise<Transactions>;
get getAccountTransactions(): (address: string) => Promise<ApiError | Transactions>;
/**
* @deprecated call function from "data" object instead
*/
get getAccountInfo(): (address: string) => Promise<AccountInfo>;
get getAccountInfo(): (address: string) => Promise<AccountInfo | ApiError>;
}

@@ -55,13 +59,13 @@ declare class FilecoinTools implements FilecoinToolsITF {

constructor(client: AxiosInstance, servicePath: string);
getTipset: (height?: number) => Promise<Tipset>;
getTransactions: (heightOrHash?: number | string) => Promise<Transactions>;
getAccountBalance: (address: string) => Promise<AccountBalance>;
getAccountVesting: (address: string) => Promise<AccountVesting>;
getAccountTransactions: (address: string) => Promise<Transactions>;
getAccountInfo: (address: string) => Promise<AccountInfo>;
getDealsByCid: (cid: string) => Promise<Deals>;
getDealsByClient: (client: string) => Promise<Deals>;
getDealsByProvider: (provider: string) => Promise<Deals>;
getDealsByHeight: (height?: number) => Promise<Deals>;
getTipset: (height?: number) => Promise<Tipset | ApiError>;
getTransactions: (heightOrHash?: number | string) => Promise<Transactions | ApiError>;
getAccountBalance: (address: string) => Promise<AccountBalance | ApiError>;
getAccountVesting: (address: string) => Promise<AccountVesting | ApiError>;
getAccountTransactions: (address: string) => Promise<Transactions | ApiError>;
getAccountInfo: (address: string) => Promise<AccountInfo | ApiError>;
getDealsByCid: (cid: string) => Promise<Deals | ApiError>;
getDealsByClient: (client: string) => Promise<Deals | ApiError>;
getDealsByProvider: (provider: string) => Promise<Deals | ApiError>;
getDealsByHeight: (height?: number) => Promise<Deals | ApiError>;
}
export {};

@@ -22,8 +22,13 @@ "use strict";

const accountVesting_validator_1 = __importDefault(require("./types/responses/accountVesting.validator"));
const apiError_validator_1 = __importDefault(require("./types/responses/apiError.validator"));
const deals_validator_1 = __importDefault(require("./types/responses/deals.validator"));
const tipset_validator_1 = __importDefault(require("./types/responses/tipset.validator"));
const transactions_validator_1 = __importDefault(require("./types/responses/transactions.validator"));
const utils_1 = require("./utils");
class Filecoin {
constructor(config) {
this.config = config;
this.utils = {
isApiError: utils_1.isApiError,
};
const axiosConfig = Filecoin.getAxiosConfig(config);

@@ -106,3 +111,3 @@ const { network = constants_1.defaultNetwork, version = types_1.VersionAPI.V1 } = config;

response = yield this.client.get(`${this.servicePath}/tipset/latest`);
return (0, tipset_validator_1.default)(response.data);
return (0, utils_1.isApiError)(response.data) ? (0, apiError_validator_1.default)(response.data) : (0, tipset_validator_1.default)(response.data);
});

@@ -112,2 +117,4 @@ this.getTransactions = (heightOrHash) => __awaiter(this, void 0, void 0, function* () {

const tipset = yield this.getTipset();
if ((0, utils_1.isApiError)(tipset))
throw new Error('current tipset cannot be fetched');
heightOrHash = tipset.height;

@@ -117,34 +124,34 @@ }

const response = yield this.client.get(`${this.servicePath}/transactions/height/${heightOrHash}`);
return (0, transactions_validator_1.default)(response.data);
return (0, utils_1.isApiError)(response.data) ? (0, apiError_validator_1.default)(response.data) : (0, transactions_validator_1.default)(response.data);
}
const response = yield this.client.get(`${this.servicePath}/transactions/hash/${heightOrHash}`);
return (0, transactions_validator_1.default)(response.data);
return (0, utils_1.isApiError)(response.data) ? (0, apiError_validator_1.default)(response.data) : (0, transactions_validator_1.default)(response.data);
});
this.getAccountBalance = (address) => __awaiter(this, void 0, void 0, function* () {
const response = yield this.client.get(`${this.servicePath}/account/balance/${address}`);
return (0, accountBalance_validator_1.default)(response.data);
return (0, utils_1.isApiError)(response.data) ? (0, apiError_validator_1.default)(response.data) : (0, accountBalance_validator_1.default)(response.data);
});
this.getAccountVesting = (address) => __awaiter(this, void 0, void 0, function* () {
const response = yield this.client.get(`${this.servicePath}/account/vesting/${address}`);
return (0, accountVesting_validator_1.default)(response.data);
return (0, utils_1.isApiError)(response.data) ? (0, apiError_validator_1.default)(response.data) : (0, accountVesting_validator_1.default)(response.data);
});
this.getAccountTransactions = (address) => __awaiter(this, void 0, void 0, function* () {
const response = yield this.client.get(`${this.servicePath}/transactions/address/${address}`);
return (0, transactions_validator_1.default)(response.data);
return (0, utils_1.isApiError)(response.data) ? (0, apiError_validator_1.default)(response.data) : (0, transactions_validator_1.default)(response.data);
});
this.getAccountInfo = (address) => __awaiter(this, void 0, void 0, function* () {
const response = yield this.client.get(`${this.servicePath}/account/info/${address}`);
return (0, accountInfo_validator_1.default)(response.data);
return (0, utils_1.isApiError)(response.data) ? (0, apiError_validator_1.default)(response.data) : (0, accountInfo_validator_1.default)(response.data);
});
this.getDealsByCid = (cid) => __awaiter(this, void 0, void 0, function* () {
const response = yield this.client.get(`${this.servicePath}/deals/cid/${cid}`);
return (0, deals_validator_1.default)(response.data);
return (0, utils_1.isApiError)(response.data) ? (0, apiError_validator_1.default)(response.data) : (0, deals_validator_1.default)(response.data);
});
this.getDealsByClient = (client) => __awaiter(this, void 0, void 0, function* () {
const response = yield this.client.get(`${this.servicePath}/deals/client/${client}`);
return (0, deals_validator_1.default)(response.data);
return (0, utils_1.isApiError)(response.data) ? (0, apiError_validator_1.default)(response.data) : (0, deals_validator_1.default)(response.data);
});
this.getDealsByProvider = (provider) => __awaiter(this, void 0, void 0, function* () {
const response = yield this.client.get(`${this.servicePath}/deals/provider/${provider}`);
return (0, deals_validator_1.default)(response.data);
return (0, utils_1.isApiError)(response.data) ? (0, apiError_validator_1.default)(response.data) : (0, deals_validator_1.default)(response.data);
});

@@ -154,8 +161,10 @@ this.getDealsByHeight = (height) => __awaiter(this, void 0, void 0, function* () {

const tipset = yield this.getTipset();
if ((0, utils_1.isApiError)(tipset))
throw new Error('current tipset cannot be fetched');
height = tipset.height;
}
const response = yield this.client.get(`${this.servicePath}/deals/height/${height}`);
return (0, deals_validator_1.default)(response.data);
return (0, utils_1.isApiError)(response.data) ? (0, apiError_validator_1.default)(response.data) : (0, deals_validator_1.default)(response.data);
});
}
}
export declare type Token = {
token: string;
};
export declare type Tipset = {
height: number;
timestamp: string;
};
export declare type Currency = {

@@ -16,4 +12,8 @@ decimals: number;

};
export declare type BlockIdentifier = {
hash: string;
index: number;
};
export declare type Metadata = {
[key: string]: any;
};
import AccountBalance from './responses/accountBalance';
import AccountInfo from './responses/accountInfo';
import AccountVesting from './responses/accountVesting';
import ApiError from './responses/apiError';
import Deals from './responses/deals';

@@ -8,12 +9,12 @@ import Tipset from './responses/tipset';

export interface FilecoinDataITF {
getTipset: (height?: number) => Promise<Tipset>;
getTransactions: (heightOrHash?: number | string) => Promise<Transactions>;
getAccountTransactions: (address: string) => Promise<Transactions>;
getAccountBalance: (address: string) => Promise<AccountBalance>;
getAccountVesting: (address: string) => Promise<AccountVesting>;
getAccountInfo: (address: string) => Promise<AccountInfo>;
getDealsByHeight: (height?: number) => Promise<Deals>;
getDealsByCid: (cid: string) => Promise<Deals>;
getDealsByClient: (client: string) => Promise<Deals>;
getDealsByProvider: (provider: string) => Promise<Deals>;
getTipset: (height?: number) => Promise<Tipset | ApiError>;
getTransactions: (heightOrHash?: number | string) => Promise<Transactions | ApiError>;
getAccountTransactions: (address: string) => Promise<Transactions | ApiError>;
getAccountBalance: (address: string) => Promise<AccountBalance | ApiError>;
getAccountVesting: (address: string) => Promise<AccountVesting | ApiError>;
getAccountInfo: (address: string) => Promise<AccountInfo | ApiError>;
getDealsByHeight: (height?: number) => Promise<Deals | ApiError>;
getDealsByCid: (cid: string) => Promise<Deals | ApiError>;
getDealsByClient: (client: string) => Promise<Deals | ApiError>;
getDealsByProvider: (provider: string) => Promise<Deals | ApiError>;
}

@@ -24,5 +25,9 @@ export interface FilecoinToolsITF {

}
export interface FilecoinUtilsITF {
isApiError: (response: unknown) => response is ApiError;
}
export interface FilecoinITF {
tools: FilecoinToolsITF;
data: FilecoinDataITF;
utils: FilecoinUtilsITF;
}

@@ -1,2 +0,2 @@

declare type Deal = {
export declare type Deal = {
client: string;

@@ -20,2 +20,1 @@ client_collateral: number;

}
export {};
import { Metadata } from '../common';
declare type Transaction = {
export declare type Transaction = {
amount: number;

@@ -22,2 +22,1 @@ canonical: boolean;

}
export {};
{
"name": "@zondax/beryx",
"version": "0.8.3",
"version": "0.9.0",
"description": "Beryx indexes and exposes via a public API Filecoin historical and real-time data. We provide historical transactions of every account, interactions with multisig accounts, fees details and many more.",

@@ -15,3 +15,3 @@ "main": "dist/index.js",

"build": "tsc",
"prebuild": "yarn remove @types/jest && yarn prebuild:transactions && yarn prebuild:accountBalance && yarn prebuild:deals && yarn prebuild:tipset && yarn prebuild:accountInfo && yarn prebuild:accountVesting && yarn add --dev @types/jest",
"prebuild": "yarn remove @types/jest && yarn prebuild:transactions && yarn prebuild:accountBalance && yarn prebuild:deals && yarn prebuild:tipset && yarn prebuild:accountInfo && yarn prebuild:accountVesting && yarn prebuild:apiError && yarn add --dev @types/jest",
"prebuild:transactions": "npx typescript-json-validator ./src/filecoin/api/types/responses/transactions.ts Transactions",

@@ -22,4 +22,20 @@ "prebuild:accountBalance": "npx typescript-json-validator ./src/filecoin/api/types/responses/accountBalance.ts AccountBalance",

"prebuild:accountInfo": "npx typescript-json-validator ./src/filecoin/api/types/responses/accountInfo.ts AccountInfo",
"prebuild:accountVesting": "npx typescript-json-validator ./src/filecoin/api/types/responses/accountVesting.ts AccountVesting"
"prebuild:accountVesting": "npx typescript-json-validator ./src/filecoin/api/types/responses/accountVesting.ts AccountVesting",
"prebuild:apiError": "npx typescript-json-validator ./src/filecoin/api/types/responses/apiError.ts ApiError"
},
"typesVersions": {
"*": {
"filecoin/types": "./dist/filecoin/api/types/index.d.ts"
}
},
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.js"
},
"./filecoin/types": {
"import": "./dist/filecoin/api/types/index.js",
"require": "./dist/filecoin/api/types/index.js"
}
},
"repository": {

@@ -26,0 +42,0 @@ "type": "git",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc