@keplr-wallet/router 0.10.2 → 0.10.4-rc.3

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.
@@ -0,0 +1,5 @@
1
+ export declare class KeplrError extends Error {
2
+ readonly module: string;
3
+ readonly code: number;
4
+ constructor(module: string, code: number, message?: string);
5
+ }
package/build/error.js ADDED
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KeplrError = void 0;
4
+ class KeplrError extends Error {
5
+ constructor(module, code, message) {
6
+ super(message);
7
+ this.module = module;
8
+ this.code = code;
9
+ Object.setPrototypeOf(this, KeplrError.prototype);
10
+ }
11
+ }
12
+ exports.KeplrError = KeplrError;
13
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";;;AAAA,MAAa,UAAW,SAAQ,KAAK;IAInC,YAAY,MAAc,EAAE,IAAY,EAAE,OAAgB;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;CACF;AAXD,gCAWC"}
package/build/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from "./router";
2
2
  export * from "./handler";
3
3
  export * from "./interfaces";
4
4
  export * from "./types";
5
+ export * from "./error";
5
6
  export * from "./message";
6
7
  export * from "./constant";
7
8
  export * from "./encoding";
package/build/index.js CHANGED
@@ -14,6 +14,7 @@ __exportStar(require("./router"), exports);
14
14
  __exportStar(require("./handler"), exports);
15
15
  __exportStar(require("./interfaces"), exports);
16
16
  __exportStar(require("./types"), exports);
17
+ __exportStar(require("./error"), exports);
17
18
  __exportStar(require("./message"), exports);
18
19
  __exportStar(require("./constant"), exports);
19
20
  __exportStar(require("./encoding"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,4CAA0B;AAC1B,+CAA6B;AAC7B,0CAAwB;AACxB,4CAA0B;AAC1B,6CAA2B;AAC3B,6CAA2B;AAC3B,qDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,4CAA0B;AAC1B,+CAA6B;AAC7B,0CAAwB;AACxB,0CAAwB;AACxB,4CAA0B;AAC1B,6CAA2B;AAC3B,6CAA2B;AAC3B,qDAAmC"}
@@ -1,4 +1,12 @@
1
1
  export interface Result {
2
- error?: string;
2
+ /**
3
+ * NOTE: If `error` is of type `{ module:string; code: number; message: string }`,
4
+ * it should be considered and processed as `KeplrError`.
5
+ */
6
+ error?: string | {
7
+ module: string;
8
+ code: number;
9
+ message: string;
10
+ };
3
11
  return?: any;
4
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keplr-wallet/router",
3
- "version": "0.10.2",
3
+ "version": "0.10.4-rc.3",
4
4
  "main": "build/index.js",
5
5
  "author": "chainapsis",
6
6
  "license": "Apache-2.0",
@@ -16,5 +16,5 @@
16
16
  "lint-test": "eslint \"src/**/*\" && prettier --check \"src/**/*\"",
17
17
  "lint-fix": "eslint --fix \"src/**/*\" && prettier --write \"src/**/*\""
18
18
  },
19
- "gitHead": "c6ea69512ee7487fe3dcd9ce89f928a96dbf44a2"
19
+ "gitHead": "3f7ae10d991b2e04acefb7328bb0afe5c1c5e998"
20
20
  }
package/src/error.ts ADDED
@@ -0,0 +1,12 @@
1
+ export class KeplrError extends Error {
2
+ public readonly module: string;
3
+ public readonly code: number;
4
+
5
+ constructor(module: string, code: number, message?: string) {
6
+ super(message);
7
+ this.module = module;
8
+ this.code = code;
9
+
10
+ Object.setPrototypeOf(this, KeplrError.prototype);
11
+ }
12
+ }
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@ export * from "./router";
2
2
  export * from "./handler";
3
3
  export * from "./interfaces";
4
4
  export * from "./types";
5
+ export * from "./error";
5
6
  export * from "./message";
6
7
  export * from "./constant";
7
8
  export * from "./encoding";
package/src/interfaces.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  export interface Result {
2
- error?: string;
2
+ /**
3
+ * NOTE: If `error` is of type `{ module:string; code: number; message: string }`,
4
+ * it should be considered and processed as `KeplrError`.
5
+ */
6
+ error?: string | { module: string; code: number; message: string };
3
7
  return?: any;
4
8
  }