@gobob/bob-sdk 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export * from './ordinals';
5
5
  export * from './helpers';
6
6
  export * from './wallet';
7
7
  export * from './gateway';
8
+ export * from './mempool';
package/dist/index.js CHANGED
@@ -21,4 +21,5 @@ __exportStar(require("./ordinals"), exports);
21
21
  __exportStar(require("./helpers"), exports);
22
22
  __exportStar(require("./wallet"), exports);
23
23
  __exportStar(require("./gateway"), exports);
24
+ __exportStar(require("./mempool"), exports);
24
25
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,0CAAwB;AACxB,0CAAwB;AACxB,6CAA2B;AAC3B,4CAA0B;AAC1B,2CAAyB;AACzB,4CAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,0CAAwB;AACxB,0CAAwB;AACxB,6CAA2B;AAC3B,4CAA0B;AAC1B,2CAAyB;AACzB,4CAA0B;AAC1B,4CAA0B"}
@@ -0,0 +1,16 @@
1
+ export declare const MAINNET_MEMPOOL_BASE_PATH = "https://mempool.space/api/v1/";
2
+ export declare const TESTNET_MEMPOOL_BASE_PATH = "https://mempool.space/testnet4/api/v1";
3
+ export declare const REGTEST_MEMPOOL_BASE_PATH = "http://localhost:3003";
4
+ export type MempoolRecomendedFee = {
5
+ fastestFee: number;
6
+ halfHourFee: number;
7
+ hourFee: number;
8
+ economyFee: number;
9
+ minimumFee: number;
10
+ };
11
+ export declare class MempoolClient {
12
+ private basePath;
13
+ constructor(networkOrUrl?: string);
14
+ getRecommendedFees(): Promise<MempoolRecomendedFee>;
15
+ private getJson;
16
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MempoolClient = exports.REGTEST_MEMPOOL_BASE_PATH = exports.TESTNET_MEMPOOL_BASE_PATH = exports.MAINNET_MEMPOOL_BASE_PATH = void 0;
4
+ exports.MAINNET_MEMPOOL_BASE_PATH = 'https://mempool.space/api/v1/';
5
+ exports.TESTNET_MEMPOOL_BASE_PATH = 'https://mempool.space/testnet4/api/v1';
6
+ exports.REGTEST_MEMPOOL_BASE_PATH = 'http://localhost:3003';
7
+ class MempoolClient {
8
+ constructor(networkOrUrl = 'mainnet') {
9
+ switch (networkOrUrl) {
10
+ case 'mainnet':
11
+ this.basePath = exports.MAINNET_MEMPOOL_BASE_PATH;
12
+ break;
13
+ case 'testnet':
14
+ this.basePath = exports.TESTNET_MEMPOOL_BASE_PATH;
15
+ break;
16
+ case 'regtest':
17
+ this.basePath = exports.REGTEST_MEMPOOL_BASE_PATH;
18
+ break;
19
+ default:
20
+ this.basePath = networkOrUrl;
21
+ }
22
+ }
23
+ async getRecommendedFees() {
24
+ return this.getJson(`${this.basePath}/fees/recommended`);
25
+ }
26
+ async getJson(url) {
27
+ const response = await fetch(url);
28
+ if (!response.ok) {
29
+ throw new Error(response.statusText);
30
+ }
31
+ return (await response.json());
32
+ }
33
+ }
34
+ exports.MempoolClient = MempoolClient;
35
+ //# sourceMappingURL=mempool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mempool.js","sourceRoot":"","sources":["../src/mempool.ts"],"names":[],"mappings":";;;AAIa,QAAA,yBAAyB,GAAG,+BAA+B,CAAC;AAK5D,QAAA,yBAAyB,GAAG,uCAAuC,CAAC;AAKpE,QAAA,yBAAyB,GAAG,uBAAuB,CAAC;AAajE,MAAa,aAAa;IAmBtB,YAAY,eAAuB,SAAS;QACxC,QAAQ,YAAY,EAAE,CAAC;YACnB,KAAK,SAAS;gBACV,IAAI,CAAC,QAAQ,GAAG,iCAAyB,CAAC;gBAC1C,MAAM;YACV,KAAK,SAAS;gBACV,IAAI,CAAC,QAAQ,GAAG,iCAAyB,CAAC;gBAC1C,MAAM;YACV,KAAK,SAAS;gBACV,IAAI,CAAC,QAAQ,GAAG,iCAAyB,CAAC;gBAC1C,MAAM;YACV;gBACI,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC;QACrC,CAAC;IACL,CAAC;IA2BD,KAAK,CAAC,kBAAkB;QACpB,OAAO,IAAI,CAAC,OAAO,CAAuB,GAAG,IAAI,CAAC,QAAQ,mBAAmB,CAAC,CAAC;IACnF,CAAC;IAKO,KAAK,CAAC,OAAO,CAAI,GAAW;QAChC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAe,CAAC;IACjD,CAAC;CACJ;AA1ED,sCA0EC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobob/bob-sdk",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {