@ckb-ccc/joy-id 0.0.5-alpha.0 → 0.0.5-alpha.10

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.
Files changed (57) hide show
  1. package/dist/advancedBarrel.d.ts +1 -0
  2. package/dist/advancedBarrel.d.ts.map +1 -1
  3. package/dist/advancedBarrel.js +1 -0
  4. package/dist/barrel.d.ts +1 -0
  5. package/dist/barrel.d.ts.map +1 -1
  6. package/dist/barrel.js +1 -0
  7. package/dist/btc/index.d.ts +6 -4
  8. package/dist/btc/index.d.ts.map +1 -1
  9. package/dist/btc/index.js +26 -18
  10. package/dist/ckb/index.d.ts +9 -4
  11. package/dist/ckb/index.d.ts.map +1 -1
  12. package/dist/ckb/index.js +59 -33
  13. package/dist/common/index.d.ts +24 -0
  14. package/dist/common/index.d.ts.map +1 -0
  15. package/dist/common/index.js +50 -0
  16. package/dist/evm/index.d.ts +19 -0
  17. package/dist/evm/index.d.ts.map +1 -0
  18. package/dist/evm/index.js +75 -0
  19. package/dist/signerFactory/index.d.ts +1 -1
  20. package/dist/signerFactory/index.d.ts.map +1 -1
  21. package/dist/signerFactory/index.js +17 -9
  22. package/dist.commonjs/advanced.d.ts +1 -1
  23. package/dist.commonjs/advanced.js +40 -19
  24. package/dist.commonjs/advancedBarrel.d.ts +2 -1
  25. package/dist.commonjs/advancedBarrel.d.ts.map +1 -1
  26. package/dist.commonjs/advancedBarrel.js +31 -14
  27. package/dist.commonjs/barrel.d.ts +2 -1
  28. package/dist.commonjs/barrel.d.ts.map +1 -1
  29. package/dist.commonjs/barrel.js +31 -14
  30. package/dist.commonjs/btc/index.d.ts +22 -13
  31. package/dist.commonjs/btc/index.d.ts.map +1 -1
  32. package/dist.commonjs/btc/index.js +100 -66
  33. package/dist.commonjs/ckb/index.d.ts +33 -21
  34. package/dist.commonjs/ckb/index.d.ts.map +1 -1
  35. package/dist.commonjs/ckb/index.js +205 -136
  36. package/dist.commonjs/common/index.d.ts +37 -0
  37. package/dist.commonjs/common/index.d.ts.map +1 -0
  38. package/dist.commonjs/common/index.js +59 -0
  39. package/dist.commonjs/connectionsStorage/index.d.ts +23 -14
  40. package/dist.commonjs/connectionsStorage/index.js +28 -25
  41. package/dist.commonjs/evm/index.d.ts +25 -0
  42. package/dist.commonjs/evm/index.d.ts.map +1 -0
  43. package/dist.commonjs/evm/index.js +101 -0
  44. package/dist.commonjs/index.d.ts +1 -1
  45. package/dist.commonjs/index.js +40 -19
  46. package/dist.commonjs/signerFactory/index.d.ts +6 -2
  47. package/dist.commonjs/signerFactory/index.d.ts.map +1 -1
  48. package/dist.commonjs/signerFactory/index.js +41 -22
  49. package/package.json +3 -3
  50. package/src/advancedBarrel.ts +1 -0
  51. package/src/barrel.ts +1 -0
  52. package/src/btc/index.ts +35 -20
  53. package/src/ckb/index.ts +84 -48
  54. package/src/common/index.ts +100 -0
  55. package/src/evm/index.ts +108 -0
  56. package/src/signerFactory/index.ts +28 -9
  57. package/dist.commonjs/tsconfig.commonjs.tsbuildinfo +0 -1
@@ -1,27 +1,48 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
2
+ var __createBinding =
3
+ (this && this.__createBinding) ||
4
+ (Object.create
5
+ ? function (o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (
9
+ !desc ||
10
+ ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
11
+ ) {
12
+ desc = {
13
+ enumerable: true,
14
+ get: function () {
15
+ return m[k];
16
+ },
17
+ };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }
21
+ : function (o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ o[k2] = m[k];
24
+ });
25
+ var __setModuleDefault =
26
+ (this && this.__setModuleDefault) ||
27
+ (Object.create
28
+ ? function (o, v) {
29
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
30
+ }
31
+ : function (o, v) {
32
+ o["default"] = v;
33
+ });
34
+ var __importStar =
35
+ (this && this.__importStar) ||
36
+ function (mod) {
19
37
  if (mod && mod.__esModule) return mod;
20
38
  var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
39
+ if (mod != null)
40
+ for (var k in mod)
41
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
42
+ __createBinding(result, mod, k);
22
43
  __setModuleDefault(result, mod);
23
44
  return result;
24
- };
45
+ };
25
46
  Object.defineProperty(exports, "__esModule", { value: true });
26
47
  exports.JoyIdA = void 0;
27
48
  exports.JoyIdA = __importStar(require("./advancedBarrel"));
@@ -1,2 +1,3 @@
1
+ export * from "./common";
1
2
  export * from "./connectionsStorage";
2
- //# sourceMappingURL=advancedBarrel.d.ts.map
3
+ //# sourceMappingURL=advancedBarrel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"advancedBarrel.d.ts","sourceRoot":"","sources":["../src/advancedBarrel.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"advancedBarrel.d.ts","sourceRoot":"","sources":["../src/advancedBarrel.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC"}
@@ -1,17 +1,34 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
2
+ var __createBinding =
3
+ (this && this.__createBinding) ||
4
+ (Object.create
5
+ ? function (o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (
9
+ !desc ||
10
+ ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
11
+ ) {
12
+ desc = {
13
+ enumerable: true,
14
+ get: function () {
15
+ return m[k];
16
+ },
17
+ };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }
21
+ : function (o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ o[k2] = m[k];
24
+ });
25
+ var __exportStar =
26
+ (this && this.__exportStar) ||
27
+ function (m, exports) {
28
+ for (var p in m)
29
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p))
30
+ __createBinding(exports, m, p);
31
+ };
16
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
+ __exportStar(require("./common"), exports);
17
34
  __exportStar(require("./connectionsStorage"), exports);
@@ -1,4 +1,5 @@
1
1
  export * from "./btc";
2
2
  export * from "./ckb";
3
+ export * from "./evm";
3
4
  export * from "./signerFactory";
4
- //# sourceMappingURL=barrel.d.ts.map
5
+ //# sourceMappingURL=barrel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"barrel.d.ts","sourceRoot":"","sources":["../src/barrel.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"barrel.d.ts","sourceRoot":"","sources":["../src/barrel.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,OAAO,CAAC;AACtB,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC"}
@@ -1,19 +1,36 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
2
+ var __createBinding =
3
+ (this && this.__createBinding) ||
4
+ (Object.create
5
+ ? function (o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (
9
+ !desc ||
10
+ ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
11
+ ) {
12
+ desc = {
13
+ enumerable: true,
14
+ get: function () {
15
+ return m[k];
16
+ },
17
+ };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }
21
+ : function (o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ o[k2] = m[k];
24
+ });
25
+ var __exportStar =
26
+ (this && this.__exportStar) ||
27
+ function (m, exports) {
28
+ for (var p in m)
29
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p))
30
+ __createBinding(exports, m, p);
31
+ };
16
32
  Object.defineProperty(exports, "__esModule", { value: true });
17
33
  __exportStar(require("./btc"), exports);
18
34
  __exportStar(require("./ckb"), exports);
35
+ __exportStar(require("./evm"), exports);
19
36
  __exportStar(require("./signerFactory"), exports);
@@ -1,17 +1,26 @@
1
1
  import { ccc } from "@ckb-ccc/core";
2
2
  import { ConnectionsRepo } from "../connectionsStorage";
3
3
  export declare class BitcoinSigner extends ccc.SignerBtc {
4
- private readonly addressType;
5
- private readonly uri;
6
- private readonly connectionsRepo;
7
- private connection?;
8
- private assertConnection;
9
- constructor(client: ccc.Client, addressType?: "auto" | "p2wpkh" | "p2tr", uri?: string, connectionsRepo?: ConnectionsRepo);
10
- replaceClient(client: ccc.Client): Promise<BitcoinSigner>;
11
- getBtcAccount(): Promise<string>;
12
- getBtcPublicKey(): Promise<ccc.Hex>;
13
- connect(): Promise<void>;
14
- isConnected(): Promise<boolean>;
15
- signMessage(message: string | ccc.BytesLike): Promise<string>;
4
+ private readonly name;
5
+ private readonly icon;
6
+ private readonly addressType;
7
+ private readonly appUri;
8
+ private readonly connectionsRepo;
9
+ private connection?;
10
+ private assertConnection;
11
+ constructor(
12
+ client: ccc.Client,
13
+ name: string,
14
+ icon: string,
15
+ addressType?: "auto" | "p2wpkh" | "p2tr",
16
+ appUri?: string,
17
+ connectionsRepo?: ConnectionsRepo,
18
+ );
19
+ private getConfig;
20
+ getBtcAccount(): Promise<string>;
21
+ getBtcPublicKey(): Promise<ccc.Hex>;
22
+ connect(): Promise<void>;
23
+ isConnected(): Promise<boolean>;
24
+ signMessageRaw(message: string | ccc.BytesLike): Promise<string>;
16
25
  }
17
- //# sourceMappingURL=index.d.ts.map
26
+ //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/btc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAA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AAO,CAAC,gBAAgB;gBAStB,MAAM,EAAE,GAAG,CAAC,MAAM,EACD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,WAAW,GAAE,MAAM,GAAG,QAAQ,GAAG,MAAe,EAChD,MAAM,SAAuB,EAC7B,eAAe,GAAE,eAAmD;IAKvF,OAAO,CAAC,SAAS;IAUX,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAKhC,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAKnC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA+BxB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAY/B,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;CAsBvE"}
@@ -3,75 +3,109 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BitcoinSigner = void 0;
4
4
  const core_1 = require("@ckb-ccc/core");
5
5
  const common_1 = require("@joyid/common");
6
+ const common_2 = require("../common");
6
7
  const connectionsStorage_1 = require("../connectionsStorage");
7
8
  class BitcoinSigner extends core_1.ccc.SignerBtc {
8
- assertConnection() {
9
- if (!this.isConnected() || !this.connection) {
10
- throw new Error("Not connected");
11
- }
12
- return this.connection;
9
+ assertConnection() {
10
+ if (!this.isConnected() || !this.connection) {
11
+ throw new Error("Not connected");
13
12
  }
14
- constructor(client, addressType = "auto", uri = "https://app.joy.id", connectionsRepo = new connectionsStorage_1.ConnectionsRepoLocalStorage()) {
15
- super(client);
16
- this.addressType = addressType;
17
- this.uri = uri;
18
- this.connectionsRepo = connectionsRepo;
19
- }
20
- async replaceClient(client) {
21
- return new BitcoinSigner(client, this.addressType, this.uri);
22
- }
23
- async getBtcAccount() {
24
- const { address } = this.assertConnection();
25
- return address;
26
- }
27
- async getBtcPublicKey() {
28
- const { publicKey } = this.assertConnection();
29
- return publicKey;
30
- }
31
- async connect() {
32
- const res = await (0, common_1.authWithPopup)({
33
- joyidAppURL: this.uri,
34
- redirectURL: location.href,
35
- requestNetwork: `btc-${this.addressType}`,
36
- });
37
- const { address, pubkey } = (() => {
38
- if (this.addressType === "auto") {
39
- return res.btcAddressType === "p2wpkh" ? res.nativeSegwit : res.taproot;
40
- }
41
- return res.btcAddressType === "p2wpkh" ? res.nativeSegwit : res.taproot;
42
- })();
43
- this.connection = {
44
- address,
45
- publicKey: core_1.ccc.hexFrom(pubkey),
46
- keyType: res.keyType,
47
- };
48
- await Promise.all([
49
- this.connectionsRepo.set({ uri: this.uri, addressType: `btc-${res.btcAddressType}` }, this.connection),
50
- this.connectionsRepo.set({ uri: this.uri, addressType: "btc-auto" }, this.connection),
51
- ]);
52
- }
53
- async isConnected() {
54
- if (this.connection) {
55
- return true;
56
- }
57
- this.connection = await this.connectionsRepo.get({
58
- uri: this.uri,
59
- addressType: `btc-${this.addressType}`,
60
- });
61
- return this.connection !== undefined;
62
- }
63
- async signMessage(message) {
64
- const { address } = this.assertConnection();
65
- const challenge = typeof message === "string" ? message : core_1.ccc.hexFrom(message).slice(2);
66
- const { signature } = await (0, common_1.signMessageWithPopup)({
67
- joyidAppURL: this.uri,
68
- requestNetwork: `btc-${this.addressType}`,
69
- challenge,
70
- address,
71
- signMessageType: "ecdsa",
72
- redirectURL: location.href,
73
- });
74
- return signature;
13
+ return this.connection;
14
+ }
15
+ constructor(
16
+ client,
17
+ name,
18
+ icon,
19
+ addressType = "auto",
20
+ appUri = "https://app.joy.id",
21
+ connectionsRepo = new connectionsStorage_1.ConnectionsRepoLocalStorage(),
22
+ ) {
23
+ super(client);
24
+ this.name = name;
25
+ this.icon = icon;
26
+ this.addressType = addressType;
27
+ this.appUri = appUri;
28
+ this.connectionsRepo = connectionsRepo;
29
+ }
30
+ getConfig() {
31
+ return {
32
+ redirectURL: location.href,
33
+ joyidAppURL: this.appUri,
34
+ requestNetwork: `btc-${this.addressType}`,
35
+ name: this.name,
36
+ logo: this.icon,
37
+ };
38
+ }
39
+ async getBtcAccount() {
40
+ const { address } = this.assertConnection();
41
+ return address;
42
+ }
43
+ async getBtcPublicKey() {
44
+ const { publicKey } = this.assertConnection();
45
+ return publicKey;
46
+ }
47
+ async connect() {
48
+ const config = this.getConfig();
49
+ const res = await (0, common_2.createPopup)(
50
+ (0, common_1.buildJoyIDURL)(config, "popup", "/auth"),
51
+ {
52
+ ...config,
53
+ type: common_1.DappRequestType.Auth,
54
+ },
55
+ );
56
+ const { address, pubkey } = (() => {
57
+ if (this.addressType === "auto") {
58
+ return res.btcAddressType === "p2wpkh" ? res.nativeSegwit : res.taproot;
59
+ }
60
+ return res.btcAddressType === "p2wpkh" ? res.nativeSegwit : res.taproot;
61
+ })();
62
+ this.connection = {
63
+ address,
64
+ publicKey: core_1.ccc.hexFrom(pubkey),
65
+ keyType: res.keyType,
66
+ };
67
+ await Promise.all([
68
+ this.connectionsRepo.set(
69
+ { uri: this.appUri, addressType: `btc-${res.btcAddressType}` },
70
+ this.connection,
71
+ ),
72
+ this.connectionsRepo.set(
73
+ { uri: this.appUri, addressType: "btc-auto" },
74
+ this.connection,
75
+ ),
76
+ ]);
77
+ }
78
+ async isConnected() {
79
+ if (this.connection) {
80
+ return true;
75
81
  }
82
+ this.connection = await this.connectionsRepo.get({
83
+ uri: this.appUri,
84
+ addressType: `btc-${this.addressType}`,
85
+ });
86
+ return this.connection !== undefined;
87
+ }
88
+ async signMessageRaw(message) {
89
+ const { address } = this.assertConnection();
90
+ const challenge =
91
+ typeof message === "string"
92
+ ? message
93
+ : core_1.ccc.hexFrom(message).slice(2);
94
+ const config = this.getConfig();
95
+ const { signature } = await (0, common_2.createPopup)(
96
+ (0, common_1.buildJoyIDURL)(
97
+ {
98
+ ...config,
99
+ challenge,
100
+ address,
101
+ signMessageType: "ecdsa",
102
+ },
103
+ "popup",
104
+ "/sign-message",
105
+ ),
106
+ { ...config, type: common_1.DappRequestType.SignMessage },
107
+ );
108
+ return signature;
109
+ }
76
110
  }
77
111
  exports.BitcoinSigner = BitcoinSigner;
@@ -1,25 +1,37 @@
1
1
  import { ccc } from "@ckb-ccc/core";
2
2
  import { ConnectionsRepo } from "../connectionsStorage";
3
3
  export declare class CkbSigner extends ccc.Signer {
4
- private readonly _uri?;
5
- private readonly _aggregatorUri?;
6
- private readonly connectionsRepo;
7
- private connection?;
8
- private assertConnection;
9
- constructor(client: ccc.Client, _uri?: string | undefined, _aggregatorUri?: string | undefined, connectionsRepo?: ConnectionsRepo);
10
- replaceClient(client: ccc.Client): Promise<CkbSigner>;
11
- private getUri;
12
- private getAggregatorUri;
13
- connect(): Promise<void>;
14
- disconnect(): Promise<void>;
15
- isConnected(): Promise<boolean>;
16
- getInternalAddress(): Promise<string>;
17
- getAddressObj(): Promise<ccc.Address>;
18
- getAddressObjs(): Promise<ccc.Address[]>;
19
- prepareTransaction(txLike: ccc.TransactionLike): Promise<ccc.Transaction>;
20
- private prepareTransactionForSubKey;
21
- signOnlyTransaction(txLike: ccc.TransactionLike): Promise<ccc.Transaction>;
22
- private saveConnection;
23
- private restoreConnection;
4
+ private readonly name;
5
+ private readonly icon;
6
+ private readonly _appUri?;
7
+ private readonly _aggregatorUri?;
8
+ private readonly connectionsRepo;
9
+ get type(): ccc.SignerType;
10
+ get signType(): ccc.SignerSignType;
11
+ private connection?;
12
+ private assertConnection;
13
+ constructor(
14
+ client: ccc.Client,
15
+ name: string,
16
+ icon: string,
17
+ _appUri?: string | undefined,
18
+ _aggregatorUri?: string | undefined,
19
+ connectionsRepo?: ConnectionsRepo,
20
+ );
21
+ private getConfig;
22
+ private getAggregatorUri;
23
+ connect(): Promise<void>;
24
+ disconnect(): Promise<void>;
25
+ isConnected(): Promise<boolean>;
26
+ getInternalAddress(): Promise<string>;
27
+ getIdentity(): Promise<string>;
28
+ getAddressObj(): Promise<ccc.Address>;
29
+ getAddressObjs(): Promise<ccc.Address[]>;
30
+ prepareTransaction(txLike: ccc.TransactionLike): Promise<ccc.Transaction>;
31
+ private prepareTransactionForSubKey;
32
+ signOnlyTransaction(txLike: ccc.TransactionLike): Promise<ccc.Transaction>;
33
+ signMessageRaw(message: string | ccc.BytesLike): Promise<string>;
34
+ private saveConnection;
35
+ private restoreConnection;
24
36
  }
25
- //# sourceMappingURL=index.d.ts.map
37
+ //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ckb/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAUpC,OAAO,EAEL,eAAe,EAEhB,MAAM,uBAAuB,CAAC;AAE/B,qBAAa,SAAU,SAAQ,GAAG,CAAC,MAAM;IAarC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;IACtB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;IAChC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAdlC,OAAO,CAAC,UAAU,CAAC,CAAa;YAElB,gBAAgB;gBAS5B,MAAM,EAAE,GAAG,CAAC,MAAM,EACD,IAAI,CAAC,oBAAQ,EACb,cAAc,CAAC,oBAAQ,EACvB,eAAe,GAAE,eAAmD;IAKjF,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;YAI7C,MAAM;YAUN,gBAAgB;IAUxB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAexB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3B,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAQ/B,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAIrC,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;IAOrC,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IAIxC,kBAAkB,CACtB,MAAM,EAAE,GAAG,CAAC,eAAe,GAC1B,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;YAgBb,2BAA2B;IAuCnC,mBAAmB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