@ckb-ccc/joy-id 1.0.33 → 1.1.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/CHANGELOG.md +13 -0
- package/dist/advanced.d.mts +2 -0
- package/dist/advanced.mjs +1 -0
- package/dist/advancedBarrel.d.mts +44 -0
- package/dist/advancedBarrel.d.mts.map +1 -0
- package/dist/advancedBarrel.mjs +2 -0
- package/dist/advancedBarrel.mjs.map +1 -0
- package/dist/barrel.d.mts +339 -0
- package/dist/barrel.d.mts.map +1 -0
- package/dist/barrel.mjs +2 -0
- package/dist/barrel.mjs.map +1 -0
- package/dist/connectionsStorage-BloUSPun.mjs +2 -0
- package/dist/connectionsStorage-BloUSPun.mjs.map +1 -0
- package/dist/index-DGqAOLbu.d.mts +91 -0
- package/dist/index-DGqAOLbu.d.mts.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1 -0
- package/dist/rolldown-runtime-DK3Fl9T5.mjs +1 -0
- package/dist.commonjs/advanced.d.ts +2 -2
- package/dist.commonjs/advanced.js +1 -37
- package/dist.commonjs/advancedBarrel.d.ts +43 -2
- package/dist.commonjs/advancedBarrel.d.ts.map +1 -1
- package/dist.commonjs/advancedBarrel.js +2 -18
- package/dist.commonjs/advancedBarrel.js.map +1 -0
- package/dist.commonjs/barrel.d.ts +338 -5
- package/dist.commonjs/barrel.d.ts.map +1 -1
- package/dist.commonjs/barrel.js +2 -21
- package/dist.commonjs/barrel.js.map +1 -0
- package/dist.commonjs/connectionsStorage-CQE3XNWI.js +2 -0
- package/dist.commonjs/connectionsStorage-CQE3XNWI.js.map +1 -0
- package/dist.commonjs/index-CJeW3ePH.d.ts +93 -0
- package/dist.commonjs/index-CJeW3ePH.d.ts.map +1 -0
- package/dist.commonjs/index.d.ts +2 -2
- package/dist.commonjs/index.js +1 -37
- package/package.json +32 -20
- package/tsdown.config.mts +43 -0
- package/dist/advanced.d.ts +0 -2
- package/dist/advanced.d.ts.map +0 -1
- package/dist/advanced.js +0 -1
- package/dist/advancedBarrel.d.ts +0 -3
- package/dist/advancedBarrel.d.ts.map +0 -1
- package/dist/advancedBarrel.js +0 -2
- package/dist/barrel.d.ts +0 -6
- package/dist/barrel.d.ts.map +0 -1
- package/dist/barrel.js +0 -5
- package/dist/btc/index.d.ts +0 -81
- package/dist/btc/index.d.ts.map +0 -1
- package/dist/btc/index.js +0 -197
- package/dist/ckb/index.d.ts +0 -117
- package/dist/ckb/index.d.ts.map +0 -1
- package/dist/ckb/index.js +0 -267
- package/dist/common/index.d.ts +0 -36
- package/dist/common/index.d.ts.map +0 -1
- package/dist/common/index.js +0 -61
- package/dist/connectionsStorage/index.d.ts +0 -87
- package/dist/connectionsStorage/index.d.ts.map +0 -1
- package/dist/connectionsStorage/index.js +0 -65
- package/dist/evm/index.d.ts +0 -66
- package/dist/evm/index.d.ts.map +0 -1
- package/dist/evm/index.js +0 -129
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -1
- package/dist/nostr/index.d.ts +0 -57
- package/dist/nostr/index.d.ts.map +0 -1
- package/dist/nostr/index.js +0 -116
- package/dist/signerFactory/index.d.ts +0 -14
- package/dist/signerFactory/index.d.ts.map +0 -1
- package/dist/signerFactory/index.js +0 -51
- package/dist.commonjs/advanced.d.ts.map +0 -1
- package/dist.commonjs/btc/index.d.ts +0 -81
- package/dist.commonjs/btc/index.d.ts.map +0 -1
- package/dist.commonjs/btc/index.js +0 -201
- package/dist.commonjs/ckb/index.d.ts +0 -117
- package/dist.commonjs/ckb/index.d.ts.map +0 -1
- package/dist.commonjs/ckb/index.js +0 -271
- package/dist.commonjs/common/index.d.ts +0 -36
- package/dist.commonjs/common/index.d.ts.map +0 -1
- package/dist.commonjs/common/index.js +0 -64
- package/dist.commonjs/connectionsStorage/index.d.ts +0 -87
- package/dist.commonjs/connectionsStorage/index.d.ts.map +0 -1
- package/dist.commonjs/connectionsStorage/index.js +0 -70
- package/dist.commonjs/evm/index.d.ts +0 -66
- package/dist.commonjs/evm/index.d.ts.map +0 -1
- package/dist.commonjs/evm/index.js +0 -133
- package/dist.commonjs/index.d.ts.map +0 -1
- package/dist.commonjs/nostr/index.d.ts +0 -57
- package/dist.commonjs/nostr/index.d.ts.map +0 -1
- package/dist.commonjs/nostr/index.js +0 -120
- package/dist.commonjs/signerFactory/index.d.ts +0 -14
- package/dist.commonjs/signerFactory/index.d.ts.map +0 -1
- package/dist.commonjs/signerFactory/index.js +0 -54
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { AuthResponseData, DappRequestType, EvmWeb2LoginResponse, PopupConfigOptions, SignCkbTxResponseData, SignCotaNFTResponseData, SignEvmTxResponseData, SignMessageResponseData, SignNostrEventData } from "@joyid/common";
|
|
2
|
-
/**
|
|
3
|
-
* Interface representing the return type for various Dapp request types.
|
|
4
|
-
*/
|
|
5
|
-
export interface PopupReturnType {
|
|
6
|
-
[DappRequestType.Auth]: AuthResponseData;
|
|
7
|
-
[DappRequestType.SignMessage]: SignMessageResponseData;
|
|
8
|
-
[DappRequestType.SignEvm]: SignEvmTxResponseData;
|
|
9
|
-
[DappRequestType.SignPsbt]: SignEvmTxResponseData;
|
|
10
|
-
[DappRequestType.BatchSignPsbt]: {
|
|
11
|
-
psbts: string[];
|
|
12
|
-
};
|
|
13
|
-
[DappRequestType.SignCkbTx]: SignCkbTxResponseData;
|
|
14
|
-
[DappRequestType.SignCotaNFT]: SignCotaNFTResponseData;
|
|
15
|
-
[DappRequestType.SignCkbRawTx]: SignCkbTxResponseData;
|
|
16
|
-
[DappRequestType.SignNostrEvent]: SignNostrEventData;
|
|
17
|
-
[DappRequestType.EncryptNostrMessage]: unknown;
|
|
18
|
-
[DappRequestType.DecryptNostrMessage]: unknown;
|
|
19
|
-
[DappRequestType.AuthMiniApp]: unknown;
|
|
20
|
-
[DappRequestType.SignMiniAppEvm]: unknown;
|
|
21
|
-
[DappRequestType.SignMiniAppMessage]: unknown;
|
|
22
|
-
[DappRequestType.EvmWeb2Login]: EvmWeb2LoginResponse;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Creates a popup window for JoyID Dapp requests.
|
|
26
|
-
* @param url - The URL to open in the popup.
|
|
27
|
-
* @param config - The popup configuration options.
|
|
28
|
-
* @returns A promise that resolves to the response data of the requested type.
|
|
29
|
-
* @throws {PopupNotSupportedError} If popups are not supported in the current browser.
|
|
30
|
-
* @throws {PopupCancelledError} If the popup is closed by the user.
|
|
31
|
-
* @throws {PopupTimeoutError} If the popup operation times out.
|
|
32
|
-
*/
|
|
33
|
-
export declare function createPopup<T extends DappRequestType>(url: string, config: PopupConfigOptions<T> & {
|
|
34
|
-
joyidAppURL: string;
|
|
35
|
-
}): Promise<PopupReturnType[T]>;
|
|
36
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EAEpB,kBAAkB,EAGlB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAInB,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACzC,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACvD,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC;IACjD,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IAClD,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE;QAC/B,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,CAAC;IACF,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE,qBAAqB,CAAC;IACnD,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACvD,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACtD,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACrD,CAAC,eAAe,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC/C,CAAC,eAAe,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC/C,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IACvC,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAC1C,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC9C,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACtD;AAED;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,CAAC,SAAS,eAAe,EACzD,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GACtD,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CA0D7B"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPopup = createPopup;
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
6
|
-
const common_1 = require("@joyid/common");
|
|
7
|
-
/**
|
|
8
|
-
* Creates a popup window for JoyID Dapp requests.
|
|
9
|
-
* @param url - The URL to open in the popup.
|
|
10
|
-
* @param config - The popup configuration options.
|
|
11
|
-
* @returns A promise that resolves to the response data of the requested type.
|
|
12
|
-
* @throws {PopupNotSupportedError} If popups are not supported in the current browser.
|
|
13
|
-
* @throws {PopupCancelledError} If the popup is closed by the user.
|
|
14
|
-
* @throws {PopupTimeoutError} If the popup operation times out.
|
|
15
|
-
*/
|
|
16
|
-
async function createPopup(url, config) {
|
|
17
|
-
if (config.popup == null) {
|
|
18
|
-
config.popup = (0, common_1.openPopup)("");
|
|
19
|
-
if (config.popup == null) {
|
|
20
|
-
return (0, common_1.createBlockDialog)(async () => createPopup(url, config));
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
config.popup.location.href = url;
|
|
24
|
-
return new Promise((resolve, reject) => {
|
|
25
|
-
if ((0, common_1.isStandaloneBrowser)()) {
|
|
26
|
-
reject(new common_1.PopupNotSupportedError(config.popup));
|
|
27
|
-
}
|
|
28
|
-
let popupEventListener;
|
|
29
|
-
let timeoutId;
|
|
30
|
-
// Check each second if the popup is closed triggering a PopupCancelledError
|
|
31
|
-
const popupTimer = setInterval(() => {
|
|
32
|
-
if (config.popup?.closed) {
|
|
33
|
-
clearInterval(popupTimer);
|
|
34
|
-
clearTimeout(timeoutId);
|
|
35
|
-
window.removeEventListener("message", popupEventListener, false);
|
|
36
|
-
reject(new common_1.PopupCancelledError(config.popup));
|
|
37
|
-
}
|
|
38
|
-
}, 1000);
|
|
39
|
-
timeoutId = setTimeout(() => {
|
|
40
|
-
clearInterval(popupTimer);
|
|
41
|
-
reject(new common_1.PopupTimeoutError(config.popup));
|
|
42
|
-
window.removeEventListener("message", popupEventListener, false);
|
|
43
|
-
}, (config.timeoutInSeconds ?? 3000) * 1000);
|
|
44
|
-
popupEventListener = (e) => {
|
|
45
|
-
const { joyidAppURL } = config;
|
|
46
|
-
const appURL = new URL(joyidAppURL);
|
|
47
|
-
if (e.origin !== appURL.origin) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
if (!e.data || e.data?.type !== config.type) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
clearTimeout(timeoutId);
|
|
54
|
-
clearInterval(popupTimer);
|
|
55
|
-
window.removeEventListener("message", popupEventListener, false);
|
|
56
|
-
config.popup.close();
|
|
57
|
-
if (e.data.error) {
|
|
58
|
-
reject(new Error(e.data.error));
|
|
59
|
-
}
|
|
60
|
-
resolve(e.data.data);
|
|
61
|
-
};
|
|
62
|
-
window.addEventListener("message", popupEventListener);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { ccc } from "@ckb-ccc/core";
|
|
2
|
-
/**
|
|
3
|
-
* Type representing an account selector with a URI and address type.
|
|
4
|
-
*/
|
|
5
|
-
export type AccountSelector = {
|
|
6
|
-
/**
|
|
7
|
-
* The URI of the account.
|
|
8
|
-
*/
|
|
9
|
-
uri: string;
|
|
10
|
-
/**
|
|
11
|
-
* The address type of the account.
|
|
12
|
-
*/
|
|
13
|
-
addressType: string;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Checks if a AccountSelector matches the filter
|
|
17
|
-
* @param a - The first account selector.
|
|
18
|
-
* @param filter - The account selector filter.
|
|
19
|
-
* @returns True if the selector matches the filter
|
|
20
|
-
*/
|
|
21
|
-
export declare function isSelectorMatch(a: AccountSelector, filter: AccountSelector): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Type representing a connection with an address, public key, and key type.
|
|
24
|
-
*/
|
|
25
|
-
export type Connection = {
|
|
26
|
-
/**
|
|
27
|
-
* The address of the connection.
|
|
28
|
-
*/
|
|
29
|
-
readonly address: string;
|
|
30
|
-
/**
|
|
31
|
-
* The public key of the connection.
|
|
32
|
-
*/
|
|
33
|
-
readonly publicKey: ccc.Hex;
|
|
34
|
-
/**
|
|
35
|
-
* The key type of the connection.
|
|
36
|
-
*/
|
|
37
|
-
readonly keyType: string;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Interface representing a repository for managing connections.
|
|
41
|
-
*/
|
|
42
|
-
export interface ConnectionsRepo {
|
|
43
|
-
/**
|
|
44
|
-
* Gets a connection for the given selector.
|
|
45
|
-
* @param selector - The account selector.
|
|
46
|
-
* @returns A promise that resolves to the connection, if found.
|
|
47
|
-
*/
|
|
48
|
-
get(selector: AccountSelector): Promise<Connection | undefined>;
|
|
49
|
-
/**
|
|
50
|
-
* Sets a connection for the given selector.
|
|
51
|
-
* @param selector - The account selector.
|
|
52
|
-
* @param connection - The connection to set.
|
|
53
|
-
* @returns A promise that resolves when the connection is set.
|
|
54
|
-
*/
|
|
55
|
-
set(selector: AccountSelector, connection: Connection | undefined): Promise<void>;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Class representing a local storage-based repository for managing connections.
|
|
59
|
-
*/
|
|
60
|
-
export declare class ConnectionsRepoLocalStorage implements ConnectionsRepo {
|
|
61
|
-
private readonly storageKey;
|
|
62
|
-
private operationLock;
|
|
63
|
-
/**
|
|
64
|
-
* Creates an instance of ConnectionsRepoLocalStorage.
|
|
65
|
-
* @param [storageKey="ccc-joy-id-signer"] - The local storage key.
|
|
66
|
-
*/
|
|
67
|
-
constructor(storageKey?: string);
|
|
68
|
-
/**
|
|
69
|
-
* Reads all connections from local storage.
|
|
70
|
-
* @returns A promise that resolves to an array of selectors and connections.
|
|
71
|
-
*/
|
|
72
|
-
readConnections(): Promise<[AccountSelector, Connection][]>;
|
|
73
|
-
/**
|
|
74
|
-
* Gets a connection for the given selector.
|
|
75
|
-
* @param selector - The account selector.
|
|
76
|
-
* @returns A promise that resolves to the connection, if found.
|
|
77
|
-
*/
|
|
78
|
-
get(selector: AccountSelector): Promise<Connection | undefined>;
|
|
79
|
-
/**
|
|
80
|
-
* Sets a connection for the given selector.
|
|
81
|
-
* @param selector - The account selector.
|
|
82
|
-
* @param connection - The connection to set.
|
|
83
|
-
* @returns
|
|
84
|
-
*/
|
|
85
|
-
set(selector: AccountSelector, connection: Connection | undefined): Promise<void>;
|
|
86
|
-
}
|
|
87
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connectionsStorage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,CAAC,EAAE,eAAe,EAClB,MAAM,EAAE,eAAe,GACtB,OAAO,CAET;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,GAAG,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,GAAG,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IAEhE;;;;;OAKG;IACH,GAAG,CACD,QAAQ,EAAE,eAAe,EACzB,UAAU,EAAE,UAAU,GAAG,SAAS,GACjC,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB;AAED;;GAEG;AACH,qBAAa,2BAA4B,YAAW,eAAe;IAOrD,OAAO,CAAC,QAAQ,CAAC,UAAU;IANvC,OAAO,CAAC,aAAa,CAAoC;IAEzD;;;OAGG;gBAC0B,UAAU,SAAsB;IAE7D;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,CAAC,eAAe,EAAE,UAAU,CAAC,EAAE,CAAC;IAOjE;;;;OAIG;IACG,GAAG,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAMrE;;;;;OAKG;IACG,GAAG,CACP,QAAQ,EAAE,eAAe,EACzB,UAAU,EAAE,UAAU,GAAG,SAAS,GACjC,OAAO,CAAC,IAAI,CAAC;CAgCjB"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConnectionsRepoLocalStorage = void 0;
|
|
4
|
-
exports.isSelectorMatch = isSelectorMatch;
|
|
5
|
-
/**
|
|
6
|
-
* Checks if a AccountSelector matches the filter
|
|
7
|
-
* @param a - The first account selector.
|
|
8
|
-
* @param filter - The account selector filter.
|
|
9
|
-
* @returns True if the selector matches the filter
|
|
10
|
-
*/
|
|
11
|
-
function isSelectorMatch(a, filter) {
|
|
12
|
-
return a.uri === filter.uri && a.addressType.startsWith(filter.addressType);
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Class representing a local storage-based repository for managing connections.
|
|
16
|
-
*/
|
|
17
|
-
class ConnectionsRepoLocalStorage {
|
|
18
|
-
/**
|
|
19
|
-
* Creates an instance of ConnectionsRepoLocalStorage.
|
|
20
|
-
* @param [storageKey="ccc-joy-id-signer"] - The local storage key.
|
|
21
|
-
*/
|
|
22
|
-
constructor(storageKey = "ccc-joy-id-signer") {
|
|
23
|
-
this.storageKey = storageKey;
|
|
24
|
-
this.operationLock = Promise.resolve();
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Reads all connections from local storage.
|
|
28
|
-
* @returns A promise that resolves to an array of selectors and connections.
|
|
29
|
-
*/
|
|
30
|
-
async readConnections() {
|
|
31
|
-
return JSON.parse(window.localStorage.getItem(this.storageKey) ?? "[]");
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Gets a connection for the given selector.
|
|
35
|
-
* @param selector - The account selector.
|
|
36
|
-
* @returns A promise that resolves to the connection, if found.
|
|
37
|
-
*/
|
|
38
|
-
async get(selector) {
|
|
39
|
-
return (await this.readConnections()).find(([s]) => isSelectorMatch(selector, s))?.[1];
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Sets a connection for the given selector.
|
|
43
|
-
* @param selector - The account selector.
|
|
44
|
-
* @param connection - The connection to set.
|
|
45
|
-
* @returns
|
|
46
|
-
*/
|
|
47
|
-
async set(selector, connection) {
|
|
48
|
-
const operation = this.operationLock
|
|
49
|
-
.catch(() => undefined)
|
|
50
|
-
.then(async () => {
|
|
51
|
-
const connections = await this.readConnections();
|
|
52
|
-
if (connection) {
|
|
53
|
-
const existed = connections.find(([s]) => isSelectorMatch(s, selector));
|
|
54
|
-
if (existed) {
|
|
55
|
-
existed[1] = connection;
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
connections.push([selector, connection]);
|
|
59
|
-
}
|
|
60
|
-
window.localStorage.setItem(this.storageKey, JSON.stringify(connections));
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
window.localStorage.setItem(this.storageKey, JSON.stringify(connections.filter(([s]) => !isSelectorMatch(s, selector))));
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
this.operationLock = operation;
|
|
67
|
-
await operation;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.ConnectionsRepoLocalStorage = ConnectionsRepoLocalStorage;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { ccc } from "@ckb-ccc/core";
|
|
2
|
-
import { ConnectionsRepo } from "../connectionsStorage/index.js";
|
|
3
|
-
/**
|
|
4
|
-
* Class representing an EVM signer that extends SignerEvm
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export declare class EvmSigner extends ccc.SignerEvm {
|
|
8
|
-
private readonly name;
|
|
9
|
-
private readonly icon;
|
|
10
|
-
private readonly _appUri?;
|
|
11
|
-
private readonly connectionsRepo;
|
|
12
|
-
private connection?;
|
|
13
|
-
/**
|
|
14
|
-
* Ensures that the signer is connected and returns the connection.
|
|
15
|
-
* @throws Will throw an error if not connected.
|
|
16
|
-
* @returns The current connection.
|
|
17
|
-
*/
|
|
18
|
-
private assertConnection;
|
|
19
|
-
/**
|
|
20
|
-
* Creates an instance of EvmSigner.
|
|
21
|
-
* @param client - The client instance.
|
|
22
|
-
* @param name - The name of the signer.
|
|
23
|
-
* @param icon - The icon URL of the signer.
|
|
24
|
-
* @param _appUri - The application URI.
|
|
25
|
-
* @param connectionsRepo - The connections repository.
|
|
26
|
-
*/
|
|
27
|
-
constructor(client: ccc.Client, name: string, icon: string, _appUri?: string | undefined, connectionsRepo?: ConnectionsRepo);
|
|
28
|
-
/**
|
|
29
|
-
* Gets the configuration for JoyID.
|
|
30
|
-
* @returns The configuration object.
|
|
31
|
-
*/
|
|
32
|
-
private getConfig;
|
|
33
|
-
/**
|
|
34
|
-
* Gets the EVM account address.
|
|
35
|
-
* @returns A promise that resolves to the EVM account address.
|
|
36
|
-
*/
|
|
37
|
-
getEvmAccount(): Promise<ccc.Hex>;
|
|
38
|
-
/**
|
|
39
|
-
* Connects to the provider by requesting authentication.
|
|
40
|
-
* @returns A promise that resolves when the connection is established.
|
|
41
|
-
*/
|
|
42
|
-
connect(): Promise<void>;
|
|
43
|
-
disconnect(): Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* Checks if the signer is connected.
|
|
46
|
-
* @returns A promise that resolves to true if connected, false otherwise.
|
|
47
|
-
*/
|
|
48
|
-
isConnected(): Promise<boolean>;
|
|
49
|
-
/**
|
|
50
|
-
* Signs a raw message with the EVM account.
|
|
51
|
-
* @param message - The message to sign.
|
|
52
|
-
* @returns A promise that resolves to the signed message.
|
|
53
|
-
*/
|
|
54
|
-
signMessageRaw(message: string | ccc.BytesLike): Promise<ccc.Hex>;
|
|
55
|
-
/**
|
|
56
|
-
* Saves the current connection.
|
|
57
|
-
* @returns
|
|
58
|
-
*/
|
|
59
|
-
private saveConnection;
|
|
60
|
-
/**
|
|
61
|
-
* Restores the previous connection.
|
|
62
|
-
* @returns
|
|
63
|
-
*/
|
|
64
|
-
private restoreConnection;
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/evm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAExC;;;GAGG;AACH,qBAAa,SAAU,SAAQ,GAAG,CAAC,SAAS;IA0BxC,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,eAAe;IA5BlC,OAAO,CAAC,UAAU,CAAC,CAAa;IAEhC;;;;OAIG;YACW,gBAAgB;IAQ9B;;;;;;;OAOG;gBAED,MAAM,EAAE,GAAG,CAAC,MAAM,EACD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,YAAA,EAChB,eAAe,GAAE,eAAmD;IAKvF;;;OAGG;IACH,OAAO,CAAC,SAAS;IAcjB;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAIvC;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBxB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAOjC;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAQrC;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAuBvE;;;OAGG;YACW,cAAc;IAU5B;;;OAGG;YACW,iBAAiB;CAMhC"}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EvmSigner = void 0;
|
|
4
|
-
const core_1 = require("@ckb-ccc/core");
|
|
5
|
-
const common_1 = require("@joyid/common");
|
|
6
|
-
const index_js_1 = require("../common/index.js");
|
|
7
|
-
const index_js_2 = require("../connectionsStorage/index.js");
|
|
8
|
-
/**
|
|
9
|
-
* Class representing an EVM signer that extends SignerEvm
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
class EvmSigner extends core_1.ccc.SignerEvm {
|
|
13
|
-
/**
|
|
14
|
-
* Ensures that the signer is connected and returns the connection.
|
|
15
|
-
* @throws Will throw an error if not connected.
|
|
16
|
-
* @returns The current connection.
|
|
17
|
-
*/
|
|
18
|
-
async assertConnection() {
|
|
19
|
-
if (!(await this.isConnected()) || !this.connection) {
|
|
20
|
-
throw new Error("Not connected");
|
|
21
|
-
}
|
|
22
|
-
return this.connection;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Creates an instance of EvmSigner.
|
|
26
|
-
* @param client - The client instance.
|
|
27
|
-
* @param name - The name of the signer.
|
|
28
|
-
* @param icon - The icon URL of the signer.
|
|
29
|
-
* @param _appUri - The application URI.
|
|
30
|
-
* @param connectionsRepo - The connections repository.
|
|
31
|
-
*/
|
|
32
|
-
constructor(client, name, icon, _appUri, connectionsRepo = new index_js_2.ConnectionsRepoLocalStorage()) {
|
|
33
|
-
super(client);
|
|
34
|
-
this.name = name;
|
|
35
|
-
this.icon = icon;
|
|
36
|
-
this._appUri = _appUri;
|
|
37
|
-
this.connectionsRepo = connectionsRepo;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Gets the configuration for JoyID.
|
|
41
|
-
* @returns The configuration object.
|
|
42
|
-
*/
|
|
43
|
-
getConfig() {
|
|
44
|
-
return {
|
|
45
|
-
redirectURL: location.href,
|
|
46
|
-
joyidAppURL: this._appUri ??
|
|
47
|
-
(this.client.addressPrefix === "ckb"
|
|
48
|
-
? "https://app.joy.id"
|
|
49
|
-
: "https://testnet.joyid.dev"),
|
|
50
|
-
requestNetwork: `ethereum`,
|
|
51
|
-
name: this.name,
|
|
52
|
-
logo: this.icon,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Gets the EVM account address.
|
|
57
|
-
* @returns A promise that resolves to the EVM account address.
|
|
58
|
-
*/
|
|
59
|
-
async getEvmAccount() {
|
|
60
|
-
return (await this.assertConnection()).address;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Connects to the provider by requesting authentication.
|
|
64
|
-
* @returns A promise that resolves when the connection is established.
|
|
65
|
-
*/
|
|
66
|
-
async connect() {
|
|
67
|
-
const config = this.getConfig();
|
|
68
|
-
const res = await (0, index_js_1.createPopup)((0, common_1.buildJoyIDURL)(config, "popup", "/auth"), {
|
|
69
|
-
...config,
|
|
70
|
-
type: common_1.DappRequestType.Auth,
|
|
71
|
-
});
|
|
72
|
-
this.connection = {
|
|
73
|
-
address: res.ethAddress,
|
|
74
|
-
publicKey: core_1.ccc.hexFrom(res.pubkey),
|
|
75
|
-
keyType: res.keyType,
|
|
76
|
-
};
|
|
77
|
-
await this.saveConnection();
|
|
78
|
-
}
|
|
79
|
-
async disconnect() {
|
|
80
|
-
await super.disconnect();
|
|
81
|
-
this.connection = undefined;
|
|
82
|
-
await this.saveConnection();
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Checks if the signer is connected.
|
|
86
|
-
* @returns A promise that resolves to true if connected, false otherwise.
|
|
87
|
-
*/
|
|
88
|
-
async isConnected() {
|
|
89
|
-
if (this.connection) {
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
await this.restoreConnection();
|
|
93
|
-
return this.connection !== undefined;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Signs a raw message with the EVM account.
|
|
97
|
-
* @param message - The message to sign.
|
|
98
|
-
* @returns A promise that resolves to the signed message.
|
|
99
|
-
*/
|
|
100
|
-
async signMessageRaw(message) {
|
|
101
|
-
const { address } = await this.assertConnection();
|
|
102
|
-
const challenge = typeof message === "string" ? message : core_1.ccc.hexFrom(message).slice(2);
|
|
103
|
-
const config = this.getConfig();
|
|
104
|
-
const { signature } = await (0, index_js_1.createPopup)((0, common_1.buildJoyIDURL)({
|
|
105
|
-
...config,
|
|
106
|
-
challenge,
|
|
107
|
-
isData: typeof message !== "string",
|
|
108
|
-
address,
|
|
109
|
-
}, "popup", "/sign-message"), { ...config, type: common_1.DappRequestType.SignMessage });
|
|
110
|
-
return core_1.ccc.hexFrom(signature);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Saves the current connection.
|
|
114
|
-
* @returns
|
|
115
|
-
*/
|
|
116
|
-
async saveConnection() {
|
|
117
|
-
return this.connectionsRepo.set({
|
|
118
|
-
uri: this.getConfig().joyidAppURL,
|
|
119
|
-
addressType: "ethereum",
|
|
120
|
-
}, this.connection);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Restores the previous connection.
|
|
124
|
-
* @returns
|
|
125
|
-
*/
|
|
126
|
-
async restoreConnection() {
|
|
127
|
-
this.connection = await this.connectionsRepo.get({
|
|
128
|
-
uri: this.getConfig().joyidAppURL,
|
|
129
|
-
addressType: "ethereum",
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
exports.EvmSigner = EvmSigner;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { ccc } from "@ckb-ccc/core";
|
|
2
|
-
import { ConnectionsRepo } from "../connectionsStorage/index.js";
|
|
3
|
-
/**
|
|
4
|
-
* Class representing a Nostr signer that extends SignerNostr
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export declare class NostrSigner extends ccc.SignerNostr {
|
|
8
|
-
private readonly name;
|
|
9
|
-
private readonly icon;
|
|
10
|
-
private readonly _appUri?;
|
|
11
|
-
private readonly connectionsRepo;
|
|
12
|
-
private connection?;
|
|
13
|
-
/**
|
|
14
|
-
* Ensures that the signer is connected and returns the connection.
|
|
15
|
-
* @throws Will throw an error if not connected.
|
|
16
|
-
* @returns The current connection.
|
|
17
|
-
*/
|
|
18
|
-
private assertConnection;
|
|
19
|
-
/**
|
|
20
|
-
* Creates an instance of NostrSigner.
|
|
21
|
-
* @param client - The client instance.
|
|
22
|
-
* @param name - The name of the signer.
|
|
23
|
-
* @param icon - The icon URL of the signer.
|
|
24
|
-
* @param _appUri - The application URI.
|
|
25
|
-
* @param connectionsRepo - The connections repository.
|
|
26
|
-
*/
|
|
27
|
-
constructor(client: ccc.Client, name: string, icon: string, _appUri?: string | undefined, connectionsRepo?: ConnectionsRepo);
|
|
28
|
-
/**
|
|
29
|
-
* Gets the configuration for JoyID.
|
|
30
|
-
* @returns The configuration object.
|
|
31
|
-
*/
|
|
32
|
-
private getConfig;
|
|
33
|
-
/**
|
|
34
|
-
* Connects to the provider by requesting authentication.
|
|
35
|
-
* @returns A promise that resolves when the connection is established.
|
|
36
|
-
*/
|
|
37
|
-
connect(): Promise<void>;
|
|
38
|
-
disconnect(): Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* Checks if the signer is connected.
|
|
41
|
-
* @returns A promise that resolves to true if connected, false otherwise.
|
|
42
|
-
*/
|
|
43
|
-
isConnected(): Promise<boolean>;
|
|
44
|
-
getNostrPublicKey(): Promise<ccc.Hex>;
|
|
45
|
-
signNostrEvent(event: ccc.NostrEvent): Promise<Required<ccc.NostrEvent>>;
|
|
46
|
-
/**
|
|
47
|
-
* Saves the current connection.
|
|
48
|
-
* @returns
|
|
49
|
-
*/
|
|
50
|
-
private saveConnection;
|
|
51
|
-
/**
|
|
52
|
-
* Restores the previous connection.
|
|
53
|
-
* @returns
|
|
54
|
-
*/
|
|
55
|
-
private restoreConnection;
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/nostr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAExC;;;GAGG;AACH,qBAAa,WAAY,SAAQ,GAAG,CAAC,WAAW;IA0B5C,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,eAAe;IA5BlC,OAAO,CAAC,UAAU,CAAC,CAAa;IAEhC;;;;OAIG;YACW,gBAAgB;IAQ9B;;;;;;;OAOG;gBAED,MAAM,EAAE,GAAG,CAAC,MAAM,EACD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,YAAA,EAChB,eAAe,GAAE,eAAmD;IAKvF;;;OAGG;IACH,OAAO,CAAC,SAAS;IAcjB;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAexB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAOjC;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAS/B,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAIrC,cAAc,CAClB,KAAK,EAAE,GAAG,CAAC,UAAU,GACpB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAYpC;;;OAGG;YACW,cAAc;IAU5B;;;OAGG;YACW,iBAAiB;CAMhC"}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NostrSigner = void 0;
|
|
4
|
-
const core_1 = require("@ckb-ccc/core");
|
|
5
|
-
const common_1 = require("@joyid/common");
|
|
6
|
-
const index_js_1 = require("../common/index.js");
|
|
7
|
-
const index_js_2 = require("../connectionsStorage/index.js");
|
|
8
|
-
/**
|
|
9
|
-
* Class representing a Nostr signer that extends SignerNostr
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
class NostrSigner extends core_1.ccc.SignerNostr {
|
|
13
|
-
/**
|
|
14
|
-
* Ensures that the signer is connected and returns the connection.
|
|
15
|
-
* @throws Will throw an error if not connected.
|
|
16
|
-
* @returns The current connection.
|
|
17
|
-
*/
|
|
18
|
-
async assertConnection() {
|
|
19
|
-
if (!(await this.isConnected()) || !this.connection) {
|
|
20
|
-
throw new Error("Not connected");
|
|
21
|
-
}
|
|
22
|
-
return this.connection;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Creates an instance of NostrSigner.
|
|
26
|
-
* @param client - The client instance.
|
|
27
|
-
* @param name - The name of the signer.
|
|
28
|
-
* @param icon - The icon URL of the signer.
|
|
29
|
-
* @param _appUri - The application URI.
|
|
30
|
-
* @param connectionsRepo - The connections repository.
|
|
31
|
-
*/
|
|
32
|
-
constructor(client, name, icon, _appUri, connectionsRepo = new index_js_2.ConnectionsRepoLocalStorage()) {
|
|
33
|
-
super(client);
|
|
34
|
-
this.name = name;
|
|
35
|
-
this.icon = icon;
|
|
36
|
-
this._appUri = _appUri;
|
|
37
|
-
this.connectionsRepo = connectionsRepo;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Gets the configuration for JoyID.
|
|
41
|
-
* @returns The configuration object.
|
|
42
|
-
*/
|
|
43
|
-
getConfig() {
|
|
44
|
-
return {
|
|
45
|
-
redirectURL: location.href,
|
|
46
|
-
joyidAppURL: this._appUri ??
|
|
47
|
-
(this.client.addressPrefix === "ckb"
|
|
48
|
-
? "https://app.joy.id"
|
|
49
|
-
: "https://testnet.joyid.dev"),
|
|
50
|
-
requestNetwork: "nostr",
|
|
51
|
-
name: this.name,
|
|
52
|
-
logo: this.icon,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Connects to the provider by requesting authentication.
|
|
57
|
-
* @returns A promise that resolves when the connection is established.
|
|
58
|
-
*/
|
|
59
|
-
async connect() {
|
|
60
|
-
const config = this.getConfig();
|
|
61
|
-
const res = await (0, index_js_1.createPopup)((0, common_1.buildJoyIDURL)(config, "popup", "/auth"), {
|
|
62
|
-
...config,
|
|
63
|
-
type: common_1.DappRequestType.Auth,
|
|
64
|
-
});
|
|
65
|
-
this.connection = {
|
|
66
|
-
address: "",
|
|
67
|
-
publicKey: core_1.ccc.hexFrom(res.nostrPubkey),
|
|
68
|
-
keyType: res.keyType,
|
|
69
|
-
};
|
|
70
|
-
await this.saveConnection();
|
|
71
|
-
}
|
|
72
|
-
async disconnect() {
|
|
73
|
-
await super.disconnect();
|
|
74
|
-
this.connection = undefined;
|
|
75
|
-
await this.saveConnection();
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Checks if the signer is connected.
|
|
79
|
-
* @returns A promise that resolves to true if connected, false otherwise.
|
|
80
|
-
*/
|
|
81
|
-
async isConnected() {
|
|
82
|
-
if (this.connection) {
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
await this.restoreConnection();
|
|
86
|
-
return this.connection !== undefined;
|
|
87
|
-
}
|
|
88
|
-
async getNostrPublicKey() {
|
|
89
|
-
return (await this.assertConnection()).publicKey;
|
|
90
|
-
}
|
|
91
|
-
async signNostrEvent(event) {
|
|
92
|
-
const config = this.getConfig();
|
|
93
|
-
const res = await (0, index_js_1.createPopup)((0, common_1.buildJoyIDURL)({ ...config, event }, "popup", "/sign-nostr-event"), {
|
|
94
|
-
...config,
|
|
95
|
-
type: common_1.DappRequestType.SignNostrEvent,
|
|
96
|
-
});
|
|
97
|
-
return res.event;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Saves the current connection.
|
|
101
|
-
* @returns
|
|
102
|
-
*/
|
|
103
|
-
async saveConnection() {
|
|
104
|
-
return this.connectionsRepo.set({
|
|
105
|
-
uri: this.getConfig().joyidAppURL,
|
|
106
|
-
addressType: "nostr",
|
|
107
|
-
}, this.connection);
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Restores the previous connection.
|
|
111
|
-
* @returns
|
|
112
|
-
*/
|
|
113
|
-
async restoreConnection() {
|
|
114
|
-
this.connection = await this.connectionsRepo.get({
|
|
115
|
-
uri: this.getConfig().joyidAppURL,
|
|
116
|
-
addressType: "nostr",
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
exports.NostrSigner = NostrSigner;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ccc } from "@ckb-ccc/core";
|
|
2
|
-
/**
|
|
3
|
-
* Gets the JoyID signers based on the client, name, and icon.
|
|
4
|
-
* If the browser is standalone or a webview, returns SignerAlwaysError instances.
|
|
5
|
-
* Otherwise, returns instances of CkbSigner, BitcoinSigner, and EvmSigner.
|
|
6
|
-
* @public
|
|
7
|
-
*
|
|
8
|
-
* @param client - The client instance.
|
|
9
|
-
* @param name - The name of the signer.
|
|
10
|
-
* @param icon - The icon URL of the signer.
|
|
11
|
-
* @returns An array of signer information objects.
|
|
12
|
-
*/
|
|
13
|
-
export declare function getJoyIdSigners(client: ccc.Client, name: string, icon: string, preferredNetworks?: ccc.NetworkPreference[]): ccc.SignerInfo[];
|
|
14
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/signerFactory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOpC;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,iBAAiB,CAAC,EAAE,GAAG,CAAC,iBAAiB,EAAE,GAC1C,GAAG,CAAC,UAAU,EAAE,CA8ClB"}
|