@hashgraph/hedera-wallet-connect 1.1.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +82 -0
- package/dist/browser-cjs-metafile.json +1 -1
- package/dist/browser-cjs.js +1 -1
- package/dist/browser-esm-metafile.json +1 -1
- package/dist/browser-esm.js +1 -1
- package/dist/node-cjs-metafile.json +1 -1
- package/dist/node-cjs.js +112 -111
- package/dist/node-esm-metafile.json +1 -1
- package/dist/node-esm.js +112 -111
- package/dist/types/src/lib/dapp/DAppSigner.d.ts +2 -1
- package/dist/types/src/lib/dapp/DAppSigner.d.ts.map +1 -1
- package/dist/types/src/lib/dapp/index.d.ts +17 -3
- package/dist/types/src/lib/dapp/index.d.ts.map +1 -1
- package/dist/types/src/lib/shared/extensionController.d.ts +22 -0
- package/dist/types/src/lib/shared/extensionController.d.ts.map +1 -0
- package/dist/types/src/lib/shared/index.d.ts +1 -0
- package/dist/types/src/lib/shared/index.d.ts.map +1 -1
- package/package.json +7 -2
@@ -5,7 +5,8 @@ export declare class DAppSigner implements Signer {
|
|
5
5
|
private readonly signClient;
|
6
6
|
readonly topic: string;
|
7
7
|
private readonly ledgerId;
|
8
|
-
|
8
|
+
readonly extensionId?: string | undefined;
|
9
|
+
constructor(accountId: AccountId, signClient: ISignClient, topic: string, ledgerId?: LedgerId, extensionId?: string | undefined);
|
9
10
|
private _getHederaClient;
|
10
11
|
private get _signerAccountId();
|
11
12
|
private _getRandomNodes;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DAppSigner.d.ts","sourceRoot":"","sources":["../../../../../src/lib/dapp/DAppSigner.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,MAAM,EACN,cAAc,EACd,SAAS,EACT,WAAW,EACX,UAAU,EACV,GAAG,EACH,QAAQ,EACR,eAAe,EACf,WAAW,EACX,iBAAiB,EAWlB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;
|
1
|
+
{"version":3,"file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,CAAC,MAAM,EAAE,GAAG,CAAC,GAChC,OAAO,CAAC,eAAe,EAAE,CAAC;IAsBvB,gBAAgB,CAAC,CAAC,SAAS,WAAW,EAAE,WAAW,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAInE,mBAAmB,CAAC,CAAC,SAAS,WAAW,EAAE,WAAW,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAMtE,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,WAAW,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;YAqB1D,6BAA6B;YAsB7B,mBAAmB;YAsBnB,uBAAuB;IAuB/B,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EACrC,OAAO,EAAE,UAAU,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,GAChD,OAAO,CAAC,OAAO,CAAC;CAgCpB"}
|
@@ -2,7 +2,7 @@ import { AccountId, LedgerId } from '@hashgraph/sdk';
|
|
2
2
|
import { SessionTypes, SignClientTypes } from '@walletconnect/types';
|
3
3
|
import { WalletConnectModal } from '@walletconnect/modal';
|
4
4
|
import SignClient from '@walletconnect/sign-client';
|
5
|
-
import { GetNodeAddressesResult, ExecuteTransactionParams, ExecuteTransactionResult, SignMessageParams, SignMessageResult, SignAndExecuteQueryResult, SignAndExecuteQueryParams, SignAndExecuteTransactionParams, SignAndExecuteTransactionResult, SignTransactionParams, SignTransactionResult } from '../shared';
|
5
|
+
import { GetNodeAddressesResult, ExecuteTransactionParams, ExecuteTransactionResult, SignMessageParams, SignMessageResult, SignAndExecuteQueryResult, SignAndExecuteQueryParams, SignAndExecuteTransactionParams, SignAndExecuteTransactionResult, SignTransactionParams, SignTransactionResult, ExtensionData } from '../shared';
|
6
6
|
import { DAppSigner } from './DAppSigner';
|
7
7
|
export * from './DAppSigner';
|
8
8
|
type BaseLogger = 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'fatal';
|
@@ -13,6 +13,8 @@ export declare class DAppConnector {
|
|
13
13
|
supportedMethods: string[];
|
14
14
|
supportedEvents: string[];
|
15
15
|
supportedChains: string[];
|
16
|
+
extensions: ExtensionData[];
|
17
|
+
onSessionIframeCreated: ((session: SessionTypes.Struct) => void) | null;
|
16
18
|
walletConnectClient: SignClient | undefined;
|
17
19
|
walletConnectModal: WalletConnectModal;
|
18
20
|
signers: DAppSigner[];
|
@@ -24,7 +26,7 @@ export declare class DAppConnector {
|
|
24
26
|
* @param projectId - Project ID for the WalletConnect client.
|
25
27
|
* @param methods - Array of supported methods for the DApp (optional).
|
26
28
|
* @param events - Array of supported events for the DApp (optional).
|
27
|
-
* @param
|
29
|
+
* @param chains - Array of supported chains for the DApp (optional).
|
28
30
|
*/
|
29
31
|
constructor(metadata: SignClientTypes.Metadata, network: LedgerId, projectId: string, methods?: string[], events?: string[], chains?: string[]);
|
30
32
|
/**
|
@@ -50,9 +52,21 @@ export declare class DAppConnector {
|
|
50
52
|
/**
|
51
53
|
* Initiates the WallecConnect connection flow using URI.
|
52
54
|
* @param pairingTopic - The pairing topic for the connection (optional).
|
55
|
+
* @param extensionId - The id for the extension used to connect (optional).
|
53
56
|
* @returns A Promise that resolves when the connection process is complete.
|
54
57
|
*/
|
55
|
-
connect(launchCallback: (uri: string) => void, pairingTopic?: string): Promise<
|
58
|
+
connect(launchCallback: (uri: string) => void, pairingTopic?: string, extensionId?: string): Promise<SessionTypes.Struct>;
|
59
|
+
/**
|
60
|
+
* Initiates the WallecConnect connection flow sending a message to the extension.
|
61
|
+
* @param extensionId - The id for the extension used to connect.
|
62
|
+
* @param pairingTopic - The pairing topic for the connection (optional).
|
63
|
+
* @returns A Promise that resolves when the connection process is complete.
|
64
|
+
*/
|
65
|
+
connectExtension(extensionId: string, pairingTopic?: string): Promise<SessionTypes.Struct>;
|
66
|
+
/**
|
67
|
+
* Initiates the WallecConnect connection if the wallet in iframe mode is detected.
|
68
|
+
*/
|
69
|
+
private checkIframeConnect;
|
56
70
|
private abortableConnect;
|
57
71
|
/**
|
58
72
|
* Disconnects the current session associated with the specified topic.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/dapp/index.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAe,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD,OAAO,UAAU,MAAM,4BAA4B,CAAA;AAEnD,OAAO,EAKL,sBAAsB,EACtB,wBAAwB,EAExB,wBAAwB,EACxB,iBAAiB,EAEjB,iBAAiB,EAEjB,yBAAyB,EACzB,yBAAyB,EACzB,+BAA+B,EAE/B,+BAA+B,EAC/B,qBAAqB,EAErB,qBAAqB,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/dapp/index.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAe,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD,OAAO,UAAU,MAAM,4BAA4B,CAAA;AAEnD,OAAO,EAKL,sBAAsB,EACtB,wBAAwB,EAExB,wBAAwB,EACxB,iBAAiB,EAEjB,iBAAiB,EAEjB,yBAAyB,EACzB,yBAAyB,EACzB,+BAA+B,EAE/B,+BAA+B,EAC/B,qBAAqB,EAErB,qBAAqB,EACrB,aAAa,EAGd,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAGzC,cAAc,cAAc,CAAA;AAE5B,KAAK,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAA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AAY,CAAC,MAAM,CAAC;IAqB/B;;;;;OAKG;IACU,gBAAgB,CAC3B,WAAW,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC;IAY/B;;OAEG;YACW,kBAAkB;IAQhC,OAAO,CAAC,gBAAgB,CAgBvB;IAED;;;;OAIG;IACU,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOrD;;;;;OAKG;IACU,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAgC3C,OAAO,CAAC,aAAa;YAcP,kBAAkB;YAIlB,UAAU;YAgBV,OAAO;IAerB;;;;;OAKG;IACU,gBAAgB;IAO7B;;;;;;;;;;;;;;;OAeG;IACU,kBAAkB,CAAC,MAAM,EAAE,wBAAwB;IAOhE;;;;;;;;;;;;;;;;OAgBG;IACU,WAAW,CAAC,MAAM,EAAE,iBAAiB;IAOlD;;;;;;;;;;;;;;;;;OAiBG;IACU,mBAAmB,CAAC,MAAM,EAAE,yBAAyB;IAOlE;;;;;;;;;;;;;;;;;OAiBG;IACU,yBAAyB,CAAC,MAAM,EAAE,+BAA+B;IAU9E;;;;;;;;;;;;;;;;;;;OAmBG;IACU,eAAe,CAAC,MAAM,EAAE,qBAAqB;CAM3D;AAED,eAAe,aAAa,CAAA"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
export declare enum EVENTS {
|
2
|
+
extensionQuery = "hedera-extension-query",
|
3
|
+
extensionConnect = "hedera-extension-connect-",
|
4
|
+
extensionOpen = "hedera-extension-open-",
|
5
|
+
extensionResponse = "hedera-extension-response",
|
6
|
+
iframeQuery = "hedera-iframe-query",
|
7
|
+
iframeQueryResponse = "hedera-iframe-response",
|
8
|
+
iframeConnect = "hedera-iframe-connect"
|
9
|
+
}
|
10
|
+
export type ExtensionData = {
|
11
|
+
id: string;
|
12
|
+
name?: string;
|
13
|
+
icon?: string;
|
14
|
+
url?: string;
|
15
|
+
available: boolean;
|
16
|
+
availableInIframe: boolean;
|
17
|
+
};
|
18
|
+
export declare const findExtensions: (onFound: (_metadata: ExtensionData, isIframe: boolean) => void) => void;
|
19
|
+
export declare const extensionQuery: () => void;
|
20
|
+
export declare const extensionConnect: (id: string, isIframe: boolean, pairingString: string) => void;
|
21
|
+
export declare const extensionOpen: (id: string) => void;
|
22
|
+
//# sourceMappingURL=extensionController.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"extensionController.d.ts","sourceRoot":"","sources":["../../../../../src/lib/shared/extensionController.ts"],"names":[],"mappings":"AAAA,oBAAY,MAAM;IAChB,cAAc,2BAA2B;IACzC,gBAAgB,8BAA8B;IAC9C,aAAa,2BAA2B;IACxC,iBAAiB,8BAA8B;IAC/C,WAAW,wBAAwB;IACnC,mBAAmB,2BAA2B;IAC9C,aAAa,0BAA0B;CACxC;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,OAAO,CAAA;IAClB,iBAAiB,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,cAAc,YAChB,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,KAC7D,IAeF,CAAA;AAED,eAAO,MAAM,cAAc,YAK1B,CAAA;AAED,eAAO,MAAM,gBAAgB,OAAQ,MAAM,YAAY,OAAO,iBAAiB,MAAM,SAMpF,CAAA;AAED,eAAO,MAAM,aAAa,OAAQ,MAAM,SAEvC,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/shared/index.ts"],"names":[],"mappings":"AAoBA,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/shared/index.ts"],"names":[],"mappings":"AAoBA,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,uBAAuB,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hashgraph/hedera-wallet-connect",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.3.0",
|
4
4
|
"description": "A library to facilitate integrating Hedera with WalletConnect",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -24,19 +24,22 @@
|
|
24
24
|
"@hashgraph/hedera-wallet-connect": "^1.0.5",
|
25
25
|
"@types/jest": "^29.5.3",
|
26
26
|
"@types/node": "^20.11.10",
|
27
|
+
"@types/react-dom": "^18.2.21",
|
27
28
|
"@walletconnect/modal": "^2.6.2",
|
28
29
|
"@walletconnect/sign-client": "^2.11.0",
|
29
30
|
"@walletconnect/types": "^2.11.0",
|
30
31
|
"concurrently": "^8.2.2",
|
31
32
|
"esbuild": "^0.21.2",
|
32
33
|
"esbuild-plugin-copy": "^2.1.1",
|
33
|
-
"eslint-plugin-tsdoc": "^0.
|
34
|
+
"eslint-plugin-tsdoc": "^0.3.0",
|
34
35
|
"husky": "^9.0.6",
|
35
36
|
"jest": "^29.7.0",
|
36
37
|
"lint-staged": "^15.1.0",
|
37
38
|
"lokijs": "^1.5.12",
|
38
39
|
"nodemon": "^3.0.3",
|
39
40
|
"prettier": "^3.2.4",
|
41
|
+
"react": "^18.2.0",
|
42
|
+
"react-dom": "^18.2.0",
|
40
43
|
"rimraf": "^5.0.5",
|
41
44
|
"ts-jest": "^29.1.2",
|
42
45
|
"ts-node": "^10.9.2",
|
@@ -55,9 +58,11 @@
|
|
55
58
|
"build": "npm run build:types && node scripts/lib/build.mjs",
|
56
59
|
"build:types": "tsc --emitDeclarationOnly --declaration --declarationMap --outDir dist/types",
|
57
60
|
"build:example": "node scripts/examples/build.mjs",
|
61
|
+
"build:demos": "node scripts/demos/build.mjs",
|
58
62
|
"build:docs": "typedoc --options typedoc.json",
|
59
63
|
"watch": "nodemon --watch src/lib/ --ext ts --exec \"npm run build\"",
|
60
64
|
"dev": "rimraf dist && npm run build && concurrently --raw \"npm run watch\" \"node scripts/examples/dev.mjs\"",
|
65
|
+
"dev:demos": "rimraf dist && npm run build && concurrently --raw \"npm run watch\" \"node scripts/demos/dev.mjs\"",
|
61
66
|
"test": "jest",
|
62
67
|
"test:connect": "jest --testMatch '**/DAppConnector.test.ts' --verbose",
|
63
68
|
"test:signer": "jest --testMatch '**/DAppSigner.test.ts' --verbose",
|