From cd397f987cbd5f335c0f36367cfee6473d5ad198 Mon Sep 17 00:00:00 2001 From: Daniel Savu Date: Wed, 28 Apr 2021 22:32:08 +0100 Subject: [PATCH] refactor: Expose utilities for bot --- package.json | 4 ++-- src/external/index.ts | 2 +- src/parachain/index.ts | 26 +++++++++++++------------- src/utils/bitcoin-core-client.ts | 6 +++++- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 47047d3e7..ce25b6993 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@interlay/polkabtc", - "version": "0.14.1", + "version": "0.14.2", "description": "JavaScript library to interact with PolkaBTC", "main": "build/index.js", "typings": "build/index.d.ts", @@ -40,7 +40,7 @@ "dependencies": { "@interlay/esplora-btc-api": "0.4.0", "@interlay/polkabtc-types": "0.6.2", - "@types/big.js": "^4.0.5", + "@types/big.js": "4.0.5", "big.js": "6.0.3", "bitcoinjs-lib": "^5.2.0", "cross-fetch": "^3.0.6", diff --git a/src/external/index.ts b/src/external/index.ts index 921ea8d27..83c6e5d03 100644 --- a/src/external/index.ts +++ b/src/external/index.ts @@ -1 +1 @@ -export { ElectrsAPI } from "./electrs"; +export { ElectrsAPI, DefaultElectrsAPI } from "./electrs"; diff --git a/src/parachain/index.ts b/src/parachain/index.ts index cef1f72db..2e812c3e8 100644 --- a/src/parachain/index.ts +++ b/src/parachain/index.ts @@ -1,14 +1,14 @@ -export { VaultsAPI } from "./vaults"; -export { IssueAPI, IssueRequestExt } from "./issue"; -export { RedeemAPI, RedeemRequestExt } from "./redeem"; -export { RefundAPI, RefundRequestExt } from "./refund"; -export { StakedRelayerAPI } from "./staked-relayer"; -export { OracleAPI } from "./oracle"; -export { BTCRelayAPI } from "./btc-relay"; -export { CollateralAPI } from "./collateral"; -export { TreasuryAPI } from "./treasury"; -export { SystemAPI } from "./system"; -export { ConstantsAPI } from "./constants"; -export { ReplaceAPI, ReplaceRequestExt } from "./replace"; -export { FeeAPI } from "./fee"; +export { VaultsAPI, DefaultVaultsAPI } from "./vaults"; +export { IssueAPI, DefaultIssueAPI, IssueRequestExt } from "./issue"; +export { RedeemAPI, DefaultRedeemAPI, RedeemRequestExt } from "./redeem"; +export { RefundAPI, DefaultRefundAPI, RefundRequestExt } from "./refund"; +export { StakedRelayerAPI, DefaultStakedRelayerAPI } from "./staked-relayer"; +export { OracleAPI, DefaultOracleAPI } from "./oracle"; +export { BTCRelayAPI, DefaultBTCRelayAPI } from "./btc-relay"; +export { CollateralAPI, DefaultCollateralAPI } from "./collateral"; +export { TreasuryAPI, DefaultTreasuryAPI } from "./treasury"; +export { SystemAPI , DefaultSystemAPI} from "./system"; +export { ConstantsAPI, DefaultConstantsAPI } from "./constants"; +export { ReplaceAPI, DefaultReplaceAPI, ReplaceRequestExt } from "./replace"; +export { FeeAPI, DefaultFeeAPI } from "./fee"; export * from "./transaction"; diff --git a/src/utils/bitcoin-core-client.ts b/src/utils/bitcoin-core-client.ts index a0c94e07b..d5980f8cb 100644 --- a/src/utils/bitcoin-core-client.ts +++ b/src/utils/bitcoin-core-client.ts @@ -83,9 +83,13 @@ export class BitcoinCoreClient { }; } - async mineBlocks(n: number): Promise { + async mineBlocksWithoutDelay(n: number): Promise { const newWalletAddress = await this.client.command("getnewaddress"); await this.client.command("generatetoaddress", n, newWalletAddress); + } + + async mineBlocks(n: number): Promise { + await this.mineBlocksWithoutDelay(n); // A block is relayed every 6000ms by the staked-relayer. // Wait an additional 100ms to be sure const relayPeriodWithBuffer = 6100;