@ckb-ccc/nip07 0.0.12-alpha.1 → 0.0.12
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/CHANGELOG.md +16 -0
- package/README.md +5 -5
- package/dist/signer.d.ts +3 -0
- package/dist/signer.d.ts.map +1 -1
- package/dist/signer.js +8 -2
- package/dist/signersFactory.d.ts +3 -0
- package/dist/signersFactory.d.ts.map +1 -1
- package/dist/signersFactory.js +3 -0
- package/dist.commonjs/signer.d.ts +3 -0
- package/dist.commonjs/signer.d.ts.map +1 -1
- package/dist.commonjs/signer.js +8 -2
- package/dist.commonjs/signersFactory.d.ts +3 -0
- package/dist.commonjs/signersFactory.d.ts.map +1 -1
- package/dist.commonjs/signersFactory.js +3 -0
- package/package.json +8 -9
- package/src/signer.ts +8 -2
- package/src/signersFactory.ts +3 -0
- package/typedoc.json +6 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# @ckb-ccc/nip07
|
|
2
|
+
|
|
3
|
+
## 0.0.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`6bee006`](https://github.com/ckb-ecofund/ccc/commit/6bee006fbcb96986c65ca4d2d896fca21db2503b) Thanks [@Hanssen0](https://github.com/Hanssen0)! - fix(connector): catch connecting error
|
|
8
|
+
|
|
9
|
+
- Updated dependencies []:
|
|
10
|
+
- @ckb-ccc/core@0.0.12
|
|
11
|
+
|
|
12
|
+
## 0.0.12-alpha.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- fix(connector): catch connecting error
|
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="https://ckbccc
|
|
2
|
+
<a href="https://app.ckbccc.com/">
|
|
3
3
|
<img alt="Logo" src="https://raw.githubusercontent.com/ckb-ecofund/ccc/master/assets/logo.svg" width="20%" />
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/ckb-ecofund/ccc" />
|
|
16
16
|
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/ckb-ecofund/ccc/master" />
|
|
17
17
|
<img alt="GitHub deployments" src="https://img.shields.io/github/deployments/ckb-ecofund/ccc/production" />
|
|
18
|
-
<a href="https://ckbccc
|
|
18
|
+
<a href="https://app.ckbccc.com/"><img
|
|
19
19
|
alt="Demo" src="https://img.shields.io/website?url=https%3A%2F%2Fckbccc-demo.vercel.app%2F&label=Demo"
|
|
20
20
|
/></a>
|
|
21
21
|
</p>
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
## Preview
|
|
34
34
|
|
|
35
35
|
<p align="center">
|
|
36
|
-
<a href="https://ckbccc
|
|
36
|
+
<a href="https://app.ckbccc.com/">
|
|
37
37
|
<img src="https://raw.githubusercontent.com/ckb-ecofund/ccc/master/assets/preview.png" width="30%" />
|
|
38
38
|
</a>
|
|
39
39
|
</p>
|
|
40
40
|
|
|
41
|
-
This project is still under active development, and we are looking forward to your feedback. [Try its demo now here](https://ckbccc
|
|
41
|
+
This project is still under active development, and we are looking forward to your feedback. [Try its demo now here](https://app.ckbccc.com/). It showcases how to use CCC for some basic scenarios in CKB.
|
|
42
42
|
|
|
43
43
|
<h3 align="center">
|
|
44
|
-
Read more about CCC on
|
|
44
|
+
Read more about CCC on <a href="https://docs.ckbccc.com">our website</a> or <a href="https://github.com/ckb-ecofund/ccc">GitHub Repo</a>.
|
|
45
45
|
</h3>
|
package/dist/signer.d.ts
CHANGED
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,qBAAqB,CAAC;AAE/C,qBAAa,MAAO,SAAQ,GAAG,CAAC,WAAW;aAKvB,QAAQ,EAAE,QAAQ;IAJpC,OAAO,CAAC,cAAc,CAAC,CAA8B;gBAGnD,MAAM,EAAE,GAAG,CAAC,MAAM,EACF,QAAQ,EAAE,QAAQ;IAK9B,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,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,qBAAqB,CAAC;AAE/C;;GAEG;AACH,qBAAa,MAAO,SAAQ,GAAG,CAAC,WAAW;aAKvB,QAAQ,EAAE,QAAQ;IAJpC,OAAO,CAAC,cAAc,CAAC,CAA8B;gBAGnD,MAAM,EAAE,GAAG,CAAC,MAAM,EACF,QAAQ,EAAE,QAAQ;IAK9B,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAWrC,cAAc,CAClB,KAAK,EAAE,GAAG,CAAC,UAAU,GACpB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAO9B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;CAGtC"}
|
package/dist/signer.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { ccc } from "@ckb-ccc/core";
|
|
2
|
+
/**
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
2
5
|
export class Signer extends ccc.SignerNostr {
|
|
3
6
|
constructor(client, provider) {
|
|
4
7
|
super(client);
|
|
@@ -7,7 +10,10 @@ export class Signer extends ccc.SignerNostr {
|
|
|
7
10
|
}
|
|
8
11
|
async getNostrPublicKey() {
|
|
9
12
|
if (!this.publicKeyCache) {
|
|
10
|
-
this.publicKeyCache = this.provider.getPublicKey()
|
|
13
|
+
this.publicKeyCache = this.provider.getPublicKey().catch((e) => {
|
|
14
|
+
this.publicKeyCache = undefined;
|
|
15
|
+
throw e;
|
|
16
|
+
});
|
|
11
17
|
}
|
|
12
18
|
return ccc.hexFrom(await this.publicKeyCache);
|
|
13
19
|
}
|
|
@@ -18,7 +24,7 @@ export class Signer extends ccc.SignerNostr {
|
|
|
18
24
|
});
|
|
19
25
|
}
|
|
20
26
|
async connect() {
|
|
21
|
-
|
|
27
|
+
await this.getNostrPublicKey();
|
|
22
28
|
}
|
|
23
29
|
async isConnected() {
|
|
24
30
|
return true;
|
package/dist/signersFactory.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signersFactory.d.ts","sourceRoot":"","sources":["../src/signersFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,wBAAgB,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,SAAS,CAQrE"}
|
|
1
|
+
{"version":3,"file":"signersFactory.d.ts","sourceRoot":"","sources":["../src/signersFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,SAAS,CAQrE"}
|
package/dist/signersFactory.js
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,qBAAqB,CAAC;AAE/C,qBAAa,MAAO,SAAQ,GAAG,CAAC,WAAW;aAKvB,QAAQ,EAAE,QAAQ;IAJpC,OAAO,CAAC,cAAc,CAAC,CAA8B;gBAGnD,MAAM,EAAE,GAAG,CAAC,MAAM,EACF,QAAQ,EAAE,QAAQ;IAK9B,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,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,qBAAqB,CAAC;AAE/C;;GAEG;AACH,qBAAa,MAAO,SAAQ,GAAG,CAAC,WAAW;aAKvB,QAAQ,EAAE,QAAQ;IAJpC,OAAO,CAAC,cAAc,CAAC,CAA8B;gBAGnD,MAAM,EAAE,GAAG,CAAC,MAAM,EACF,QAAQ,EAAE,QAAQ;IAK9B,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAWrC,cAAc,CAClB,KAAK,EAAE,GAAG,CAAC,UAAU,GACpB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAO9B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;CAGtC"}
|
package/dist.commonjs/signer.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Signer = void 0;
|
|
4
4
|
const core_1 = require("@ckb-ccc/core");
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
5
8
|
class Signer extends core_1.ccc.SignerNostr {
|
|
6
9
|
constructor(client, provider) {
|
|
7
10
|
super(client);
|
|
@@ -10,7 +13,10 @@ class Signer extends core_1.ccc.SignerNostr {
|
|
|
10
13
|
}
|
|
11
14
|
async getNostrPublicKey() {
|
|
12
15
|
if (!this.publicKeyCache) {
|
|
13
|
-
this.publicKeyCache = this.provider.getPublicKey()
|
|
16
|
+
this.publicKeyCache = this.provider.getPublicKey().catch((e) => {
|
|
17
|
+
this.publicKeyCache = undefined;
|
|
18
|
+
throw e;
|
|
19
|
+
});
|
|
14
20
|
}
|
|
15
21
|
return core_1.ccc.hexFrom(await this.publicKeyCache);
|
|
16
22
|
}
|
|
@@ -21,7 +27,7 @@ class Signer extends core_1.ccc.SignerNostr {
|
|
|
21
27
|
});
|
|
22
28
|
}
|
|
23
29
|
async connect() {
|
|
24
|
-
|
|
30
|
+
await this.getNostrPublicKey();
|
|
25
31
|
}
|
|
26
32
|
async isConnected() {
|
|
27
33
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signersFactory.d.ts","sourceRoot":"","sources":["../src/signersFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,wBAAgB,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,SAAS,CAQrE"}
|
|
1
|
+
{"version":3,"file":"signersFactory.d.ts","sourceRoot":"","sources":["../src/signersFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,SAAS,CAQrE"}
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNip07Signer = void 0;
|
|
4
4
|
const signer_js_1 = require("./signer.js");
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
5
8
|
function getNip07Signer(client) {
|
|
6
9
|
const windowRef = window;
|
|
7
10
|
if (typeof windowRef.nostr === "undefined") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckb-ccc/nip07",
|
|
3
|
-
"version": "0.0.12
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "CCC - CKBer's Codebase. Common Chains Connector's support for NIP07",
|
|
5
5
|
"author": "Hanssen0 <hanssen0@hanssen0.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,11 +22,6 @@
|
|
|
22
22
|
"default": "./dist.commonjs/advanced.js"
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
-
"scripts": {
|
|
26
|
-
"build": "rimraf ./dist && rimraf ./dist.commonjs && tsc && tsc --project tsconfig.commonjs.json && copyfiles -u 2 misc/basedirs/**/* .",
|
|
27
|
-
"lint": "eslint",
|
|
28
|
-
"format": "prettier --write . && eslint --fix"
|
|
29
|
-
},
|
|
30
25
|
"devDependencies": {
|
|
31
26
|
"@eslint/js": "^9.1.1",
|
|
32
27
|
"copyfiles": "^2.4.1",
|
|
@@ -43,7 +38,11 @@
|
|
|
43
38
|
"access": "public"
|
|
44
39
|
},
|
|
45
40
|
"dependencies": {
|
|
46
|
-
"@ckb-ccc/core": "0.0.12
|
|
41
|
+
"@ckb-ccc/core": "0.0.12"
|
|
47
42
|
},
|
|
48
|
-
"
|
|
49
|
-
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "rimraf ./dist && rimraf ./dist.commonjs && tsc && tsc --project tsconfig.commonjs.json && copyfiles -u 2 misc/basedirs/**/* .",
|
|
45
|
+
"lint": "eslint",
|
|
46
|
+
"format": "prettier --write . && eslint --fix"
|
|
47
|
+
}
|
|
48
|
+
}
|
package/src/signer.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ccc } from "@ckb-ccc/core";
|
|
2
2
|
import { Provider } from "./nip07.advanced.js";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
4
7
|
export class Signer extends ccc.SignerNostr {
|
|
5
8
|
private publicKeyCache?: Promise<string> = undefined;
|
|
6
9
|
|
|
@@ -13,7 +16,10 @@ export class Signer extends ccc.SignerNostr {
|
|
|
13
16
|
|
|
14
17
|
async getNostrPublicKey(): Promise<ccc.Hex> {
|
|
15
18
|
if (!this.publicKeyCache) {
|
|
16
|
-
this.publicKeyCache = this.provider.getPublicKey()
|
|
19
|
+
this.publicKeyCache = this.provider.getPublicKey().catch((e) => {
|
|
20
|
+
this.publicKeyCache = undefined;
|
|
21
|
+
throw e;
|
|
22
|
+
});
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
return ccc.hexFrom(await this.publicKeyCache);
|
|
@@ -29,7 +35,7 @@ export class Signer extends ccc.SignerNostr {
|
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
async connect(): Promise<void> {
|
|
32
|
-
|
|
38
|
+
await this.getNostrPublicKey();
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
async isConnected(): Promise<boolean> {
|
package/src/signersFactory.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { ccc } from "@ckb-ccc/core";
|
|
|
2
2
|
import { Provider } from "./nip07.advanced.js";
|
|
3
3
|
import { Signer } from "./signer.js";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
5
8
|
export function getNip07Signer(client: ccc.Client): Signer | undefined {
|
|
6
9
|
const windowRef = window as { nostr?: Provider };
|
|
7
10
|
|