@ckb-ccc/uni-sat 0.0.9-alpha.2 → 0.0.10-alpha.0
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/signer.d.ts +1 -1
- package/dist/signer.d.ts.map +1 -1
- package/dist/signer.js +14 -6
- package/dist.commonjs/signer.d.ts +1 -1
- package/dist.commonjs/signer.d.ts.map +1 -1
- package/dist.commonjs/signer.js +14 -6
- package/package.json +3 -3
- package/src/signer.ts +16 -6
package/dist/signer.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare class Signer extends ccc.SignerBtc {
|
|
|
33
33
|
* @returns {Promise<void>} A promise that resolves when the connection is established.
|
|
34
34
|
*/
|
|
35
35
|
connect(): Promise<void>;
|
|
36
|
-
|
|
36
|
+
onReplaced(listener: () => void): () => void;
|
|
37
37
|
/**
|
|
38
38
|
* Checks if the signer is connected.
|
|
39
39
|
* @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
|
package/dist/signer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,GAAG,CAAC,SAAS;aAQrB,QAAQ,EAAE,QAAQ;IAClC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IARpC;;;;OAIG;gBAED,MAAM,EAAE,GAAG,CAAC,MAAM,EACF,QAAQ,EAAE,QAAQ,EACjB,iBAAiB,GAAE,GAAG,CAAC,iBAAiB,EAWxD;IAKH;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IA0CpC;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAItC;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAIzC;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,GAAG,CAAC,SAAS;aAQrB,QAAQ,EAAE,QAAQ;IAClC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IARpC;;;;OAIG;gBAED,MAAM,EAAE,GAAG,CAAC,MAAM,EACF,QAAQ,EAAE,QAAQ,EACjB,iBAAiB,GAAE,GAAG,CAAC,iBAAiB,EAWxD;IAKH;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IA0CpC;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAItC;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAIzC;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAK9B,UAAU,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAiB5C;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAKrC;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;CAMvE"}
|
package/dist/signer.js
CHANGED
|
@@ -84,18 +84,26 @@ export class Signer extends ccc.SignerBtc {
|
|
|
84
84
|
await this.provider.requestAccounts();
|
|
85
85
|
await this.ensureNetwork();
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
onReplaced(listener) {
|
|
88
|
+
const stop = [];
|
|
89
|
+
const replacer = async () => {
|
|
90
|
+
listener();
|
|
91
|
+
stop[0]?.();
|
|
92
|
+
};
|
|
93
|
+
stop.push(() => {
|
|
94
|
+
this.provider.removeListener("accountsChanged", replacer);
|
|
95
|
+
this.provider.removeListener("networkChanged", replacer);
|
|
96
|
+
});
|
|
97
|
+
this.provider.on("accountsChanged", replacer);
|
|
98
|
+
this.provider.on("networkChanged", replacer);
|
|
99
|
+
return stop[0];
|
|
93
100
|
}
|
|
94
101
|
/**
|
|
95
102
|
* Checks if the signer is connected.
|
|
96
103
|
* @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
|
|
97
104
|
*/
|
|
98
105
|
async isConnected() {
|
|
106
|
+
await this.ensureNetwork();
|
|
99
107
|
return (await this.provider.getAccounts()).length !== 0;
|
|
100
108
|
}
|
|
101
109
|
/**
|
|
@@ -33,7 +33,7 @@ export declare class Signer extends ccc.SignerBtc {
|
|
|
33
33
|
* @returns {Promise<void>} A promise that resolves when the connection is established.
|
|
34
34
|
*/
|
|
35
35
|
connect(): Promise<void>;
|
|
36
|
-
|
|
36
|
+
onReplaced(listener: () => void): () => void;
|
|
37
37
|
/**
|
|
38
38
|
* Checks if the signer is connected.
|
|
39
39
|
* @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,GAAG,CAAC,SAAS;aAQrB,QAAQ,EAAE,QAAQ;IAClC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IARpC;;;;OAIG;gBAED,MAAM,EAAE,GAAG,CAAC,MAAM,EACF,QAAQ,EAAE,QAAQ,EACjB,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extends core_1.ccc.SignerBtc {
|
|
|
87
87
|
await this.provider.requestAccounts();
|
|
88
88
|
await this.ensureNetwork();
|
|
89
89
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
onReplaced(listener) {
|
|
91
|
+
const stop = [];
|
|
92
|
+
const replacer = async () => {
|
|
93
|
+
listener();
|
|
94
|
+
stop[0]?.();
|
|
95
|
+
};
|
|
96
|
+
stop.push(() => {
|
|
97
|
+
this.provider.removeListener("accountsChanged", replacer);
|
|
98
|
+
this.provider.removeListener("networkChanged", replacer);
|
|
99
|
+
});
|
|
100
|
+
this.provider.on("accountsChanged", replacer);
|
|
101
|
+
this.provider.on("networkChanged", replacer);
|
|
102
|
+
return stop[0];
|
|
96
103
|
}
|
|
97
104
|
/**
|
|
98
105
|
* Checks if the signer is connected.
|
|
99
106
|
* @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
|
|
100
107
|
*/
|
|
101
108
|
async isConnected() {
|
|
109
|
+
await this.ensureNetwork();
|
|
102
110
|
return (await this.provider.getAccounts()).length !== 0;
|
|
103
111
|
}
|
|
104
112
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckb-ccc/uni-sat",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10-alpha.0",
|
|
4
4
|
"description": "CCC - CKBer's Codebase. Common Chains Connector's support for UniSat",
|
|
5
5
|
"author": "Hanssen0 <hanssen0@hanssen0.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@ckb-ccc/core": "0.0.
|
|
53
|
+
"@ckb-ccc/core": "0.0.10-alpha.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "8a4c789419f5e12e1f230cead213c59373834a1a"
|
|
56
56
|
}
|
package/src/signer.ts
CHANGED
|
@@ -101,12 +101,21 @@ export class Signer extends ccc.SignerBtc {
|
|
|
101
101
|
await this.ensureNetwork();
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
onReplaced(listener: () => void): () => void {
|
|
105
|
+
const stop: (() => void)[] = [];
|
|
106
|
+
const replacer = async () => {
|
|
107
|
+
listener();
|
|
108
|
+
stop[0]?.();
|
|
109
|
+
};
|
|
110
|
+
stop.push(() => {
|
|
111
|
+
this.provider.removeListener("accountsChanged", replacer);
|
|
112
|
+
this.provider.removeListener("networkChanged", replacer);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
this.provider.on("accountsChanged", replacer);
|
|
116
|
+
this.provider.on("networkChanged", replacer);
|
|
117
|
+
|
|
118
|
+
return stop[0];
|
|
110
119
|
}
|
|
111
120
|
|
|
112
121
|
/**
|
|
@@ -114,6 +123,7 @@ export class Signer extends ccc.SignerBtc {
|
|
|
114
123
|
* @returns {Promise<boolean>} A promise that resolves to true if connected, false otherwise.
|
|
115
124
|
*/
|
|
116
125
|
async isConnected(): Promise<boolean> {
|
|
126
|
+
await this.ensureNetwork();
|
|
117
127
|
return (await this.provider.getAccounts()).length !== 0;
|
|
118
128
|
}
|
|
119
129
|
|