@zondax/beryx
Advanced tools
Comparing version 0.11.0 to 1.0.0
@@ -10,2 +10,3 @@ import { AxiosInstance, AxiosRequestConfig } from 'axios'; | ||
import Tipset from './types/responses/tipset'; | ||
import TransactionWithMetadata from './types/responses/transactionWithMetadata'; | ||
import Transactions from './types/responses/transactions'; | ||
@@ -59,2 +60,3 @@ export declare class Filecoin implements FilecoinITF { | ||
getTransactions: (heightOrHash?: number | string) => Promise<Transactions | ApiError>; | ||
getTransactionWithMetadata: (id: string) => Promise<TransactionWithMetadata | ApiError>; | ||
getAccountBalance: (address: string) => Promise<AccountBalance | ApiError>; | ||
@@ -61,0 +63,0 @@ getAccountVesting: (address: string) => Promise<AccountVesting | ApiError>; |
@@ -25,2 +25,3 @@ "use strict"; | ||
const tipset_validator_1 = __importDefault(require("./types/responses/tipset.validator")); | ||
const transactionWithMetadata_validator_1 = __importDefault(require("./types/responses/transactionWithMetadata.validator")); | ||
const transactions_validator_1 = __importDefault(require("./types/responses/transactions.validator")); | ||
@@ -35,3 +36,3 @@ const utils_1 = require("./utils"); | ||
const axiosConfig = Filecoin.getAxiosConfig(config); | ||
const { network = constants_1.defaultNetwork, version = types_1.VersionAPI.V1 } = config; | ||
const { network = constants_1.defaultNetwork, version = types_1.VersionAPI.V2 } = config; | ||
const client = axios_1.default.create(axiosConfig); | ||
@@ -128,2 +129,6 @@ this.data = new FilecoinData(client, `/${types_1.DataPrefixPath}/${version}/${network}`); | ||
}); | ||
this.getTransactionWithMetadata = (id) => __awaiter(this, void 0, void 0, function* () { | ||
const response = yield this.client.get(`${this.servicePath}/transactions/id/${id}`); | ||
return (0, utils_1.isApiError)(response.data) ? (0, apiError_validator_1.default)(response.data) : (0, transactionWithMetadata_validator_1.default)(response.data); | ||
}); | ||
this.getAccountBalance = (address) => __awaiter(this, void 0, void 0, function* () { | ||
@@ -130,0 +135,0 @@ const response = yield this.client.get(`${this.servicePath}/account/balance/${address}`); |
@@ -1,3 +0,3 @@ | ||
import { Metadata } from '../common'; | ||
export type Transaction = { | ||
id: string; | ||
amount: number; | ||
@@ -12,5 +12,2 @@ canonical: boolean; | ||
tx_hash: string; | ||
tx_metadata: Metadata; | ||
tx_params: string | null; | ||
tx_return: string; | ||
tx_timestamp: string; | ||
@@ -17,0 +14,0 @@ tx_to: string; |
@@ -28,2 +28,5 @@ import Transactions from './transactions'; | ||
}; | ||
id: { | ||
type: string; | ||
}; | ||
level: { | ||
@@ -41,13 +44,2 @@ type: string; | ||
}; | ||
tx_metadata: { | ||
additionalProperties: {}; | ||
defaultProperties: never[]; | ||
type: string; | ||
}; | ||
tx_params: { | ||
type: string[]; | ||
}; | ||
tx_return: { | ||
type: string; | ||
}; | ||
tx_timestamp: { | ||
@@ -54,0 +46,0 @@ type: string; |
@@ -41,2 +41,5 @@ "use strict"; | ||
}, | ||
id: { | ||
type: 'string', | ||
}, | ||
level: { | ||
@@ -54,13 +57,2 @@ type: 'number', | ||
}, | ||
tx_metadata: { | ||
additionalProperties: {}, | ||
defaultProperties: [], | ||
type: 'object', | ||
}, | ||
tx_params: { | ||
type: ['null', 'string'], | ||
}, | ||
tx_return: { | ||
type: 'string', | ||
}, | ||
tx_timestamp: { | ||
@@ -82,2 +74,3 @@ type: 'string', | ||
'height', | ||
'id', | ||
'level', | ||
@@ -87,5 +80,2 @@ 'status', | ||
'tx_hash', | ||
'tx_metadata', | ||
'tx_params', | ||
'tx_return', | ||
'tx_timestamp', | ||
@@ -92,0 +82,0 @@ 'tx_to', |
import { AxiosRequestConfig } from 'axios'; | ||
export type Network = 'mainnet' | 'calibration'; | ||
export declare enum VersionAPI { | ||
V1 = "v1" | ||
V2 = "v2" | ||
} | ||
@@ -6,0 +6,0 @@ export declare const DataPrefixPath: Readonly<string>; |
@@ -6,5 +6,5 @@ "use strict"; | ||
(function (VersionAPI) { | ||
VersionAPI["V1"] = "v1"; | ||
VersionAPI["V2"] = "v2"; | ||
})(VersionAPI = exports.VersionAPI || (exports.VersionAPI = {})); | ||
exports.DataPrefixPath = 'fil/data'; | ||
exports.ToolsPrefixPath = 'fil/tools'; |
{ | ||
"name": "@zondax/beryx", | ||
"version": "0.11.0", | ||
"version": "1.0.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,4 +15,5 @@ "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 prebuild:apiError && yarn add --dev @types/jest", | ||
"prebuild": "yarn remove @types/jest && yarn prebuild:transactions && yarn prebuild:transactionWithMetadata && 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", | ||
"prebuild:transactionWithMetadata": "npx typescript-json-validator ./src/filecoin/api/types/responses/transactionWithMetadata.ts TransactionWithMetadata", | ||
"prebuild:accountBalance": "npx typescript-json-validator ./src/filecoin/api/types/responses/accountBalance.ts AccountBalance", | ||
@@ -19,0 +20,0 @@ "prebuild:deals": "npx typescript-json-validator ./src/filecoin/api/types/responses/deals.ts Deals", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
64821
55
1376
1