@hashgraph/hedera-wallet-connect 2.0.4-canary.f71fa76.0 → 2.0.5-canary.09073be.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.
Files changed (70) hide show
  1. package/README.md +141 -8
  2. package/package.json +4 -2
  3. package/dist/index.d.ts +0 -2
  4. package/dist/index.js +0 -21
  5. package/dist/lib/dapp/DAppSigner.d.ts +0 -60
  6. package/dist/lib/dapp/DAppSigner.js +0 -301
  7. package/dist/lib/dapp/SessionNotFoundError.d.ts +0 -3
  8. package/dist/lib/dapp/SessionNotFoundError.js +0 -6
  9. package/dist/lib/dapp/index.d.ts +0 -216
  10. package/dist/lib/dapp/index.js +0 -580
  11. package/dist/lib/index.d.ts +0 -3
  12. package/dist/lib/index.js +0 -22
  13. package/dist/lib/shared/chainIds.d.ts +0 -11
  14. package/dist/lib/shared/chainIds.js +0 -31
  15. package/dist/lib/shared/errors.d.ts +0 -48
  16. package/dist/lib/shared/errors.js +0 -51
  17. package/dist/lib/shared/events.d.ts +0 -7
  18. package/dist/lib/shared/events.js +0 -27
  19. package/dist/lib/shared/extensionController.d.ts +0 -21
  20. package/dist/lib/shared/extensionController.js +0 -42
  21. package/dist/lib/shared/index.d.ts +0 -7
  22. package/dist/lib/shared/index.js +0 -26
  23. package/dist/lib/shared/logger.d.ts +0 -18
  24. package/dist/lib/shared/logger.js +0 -33
  25. package/dist/lib/shared/methods.d.ts +0 -12
  26. package/dist/lib/shared/methods.js +0 -32
  27. package/dist/lib/shared/payloads.d.ts +0 -101
  28. package/dist/lib/shared/payloads.js +0 -20
  29. package/dist/lib/shared/utils.d.ts +0 -275
  30. package/dist/lib/shared/utils.js +0 -420
  31. package/dist/lib/wallet/index.d.ts +0 -39
  32. package/dist/lib/wallet/index.js +0 -306
  33. package/dist/lib/wallet/provider.d.ts +0 -17
  34. package/dist/lib/wallet/provider.js +0 -58
  35. package/dist/lib/wallet/types.d.ts +0 -31
  36. package/dist/lib/wallet/types.js +0 -20
  37. package/dist/reown/adapter.d.ts +0 -59
  38. package/dist/reown/adapter.js +0 -261
  39. package/dist/reown/connectors/HederaConnector.d.ts +0 -31
  40. package/dist/reown/connectors/HederaConnector.js +0 -38
  41. package/dist/reown/connectors/index.d.ts +0 -1
  42. package/dist/reown/connectors/index.js +0 -1
  43. package/dist/reown/index.d.ts +0 -4
  44. package/dist/reown/index.js +0 -4
  45. package/dist/reown/providers/EIP155Provider.d.ts +0 -32
  46. package/dist/reown/providers/EIP155Provider.js +0 -187
  47. package/dist/reown/providers/HIP820Provider.d.ts +0 -26
  48. package/dist/reown/providers/HIP820Provider.js +0 -69
  49. package/dist/reown/providers/HederaProvider.d.ts +0 -164
  50. package/dist/reown/providers/HederaProvider.js +0 -471
  51. package/dist/reown/providers/index.d.ts +0 -3
  52. package/dist/reown/providers/index.js +0 -3
  53. package/dist/reown/utils/account.d.ts +0 -2
  54. package/dist/reown/utils/account.js +0 -20
  55. package/dist/reown/utils/chains.d.ts +0 -18
  56. package/dist/reown/utils/chains.js +0 -152
  57. package/dist/reown/utils/constants.d.ts +0 -16
  58. package/dist/reown/utils/constants.js +0 -18
  59. package/dist/reown/utils/helpers.d.ts +0 -12
  60. package/dist/reown/utils/helpers.js +0 -25
  61. package/dist/reown/utils/index.d.ts +0 -5
  62. package/dist/reown/utils/index.js +0 -5
  63. package/dist/reown/utils/types.d.ts +0 -9
  64. package/dist/reown/utils/types.js +0 -1
  65. package/dist/reown/wallets/EIP155Wallet.d.ts +0 -46
  66. package/dist/reown/wallets/EIP155Wallet.js +0 -124
  67. package/dist/reown/wallets/HIP820Wallet.d.ts +0 -53
  68. package/dist/reown/wallets/HIP820Wallet.js +0 -236
  69. package/dist/reown/wallets/index.d.ts +0 -2
  70. package/dist/reown/wallets/index.js +0 -2
@@ -1,48 +0,0 @@
1
- /**
2
- * This file defines error handling related to Hedera operations.
3
- * @see {@link https://github.com/WalletConnect/walletconnect-monorepo/blob/v2.0/packages/utils/src/errors.ts | WalletConnect Errors}
4
- */
5
- /**
6
- * Represents keys of Hedera error types.
7
- */
8
- export type HederaErrorKey = keyof typeof HEDERA_ERRORS;
9
- /**
10
- * Represents a JSON-RPC error for Hedera operations.
11
- * @param T - Generic type for additional data in the error response.
12
- */
13
- export interface HederaErrorResponse<T = string | number> {
14
- code: number;
15
- message: string;
16
- data?: T;
17
- }
18
- /**
19
- * WalletConnect has certain
20
- * {@link https://github.com/WalletConnect/walletconnect-monorepo/blob/v2.0/packages/utils/src/errors.ts | error code ranges reserved}
21
- * for WalletConnect use.
22
- * The following schema uses negative codes to avoid conflicts.
23
- *
24
- * @see {@link https://github.com/WalletConnect/walletconnect-monorepo/blob/v2.0/packages/utils/src/errors.ts | WalletConnect Errors}
25
- */
26
- /**
27
- * Object containing specific Hedera errors with their respective codes and messages.
28
- */
29
- export declare const HEDERA_ERRORS: {
30
- [key: string]: Pick<HederaErrorResponse, 'code' | 'message'>;
31
- };
32
- /**
33
- * Represents a JSON-RPC error for Hedera operations.
34
- * @param T - Generic type for additional data in the error response.
35
- */
36
- export interface HederaJsonRpcError<T = string | number> {
37
- id: number;
38
- jsonrpc: '2.0';
39
- error: HederaErrorResponse<T>;
40
- }
41
- /**
42
- * Generates a Hedera error response based on the provided key, context, and additional data.
43
- * @param key - Key representing the specific error type.
44
- * @param context - Contextual information for the error (optional).
45
- * @param data - Additional data to include in the error response (optional).
46
- * @returns A HederaErrorResponse object with the specified code, message, and additional data.
47
- */
48
- export declare function getHederaError<T>(key: string, context?: string | number, data?: T): HederaErrorResponse<T>;
@@ -1,51 +0,0 @@
1
- /*
2
- *
3
- * Hedera Wallet Connect
4
- *
5
- * Copyright (C) 2023 Hedera Hashgraph, LLC
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- *
19
- */
20
- /**
21
- * WalletConnect has certain
22
- * {@link https://github.com/WalletConnect/walletconnect-monorepo/blob/v2.0/packages/utils/src/errors.ts | error code ranges reserved}
23
- * for WalletConnect use.
24
- * The following schema uses negative codes to avoid conflicts.
25
- *
26
- * @see {@link https://github.com/WalletConnect/walletconnect-monorepo/blob/v2.0/packages/utils/src/errors.ts | WalletConnect Errors}
27
- */
28
- /**
29
- * Object containing specific Hedera errors with their respective codes and messages.
30
- */
31
- export const HEDERA_ERRORS = {
32
- INVALID_PARAMS: {
33
- code: 9000,
34
- message: 'INVALID_PARAMS',
35
- },
36
- };
37
- /**
38
- * Generates a Hedera error response based on the provided key, context, and additional data.
39
- * @param key - Key representing the specific error type.
40
- * @param context - Contextual information for the error (optional).
41
- * @param data - Additional data to include in the error response (optional).
42
- * @returns A HederaErrorResponse object with the specified code, message, and additional data.
43
- */
44
- export function getHederaError(key, context, data) {
45
- const { code, message } = HEDERA_ERRORS[key];
46
- return {
47
- code,
48
- message: context ? `${message} ${context}` : message,
49
- data,
50
- };
51
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * Represents different events related to a Hedera session.
3
- */
4
- export declare enum HederaSessionEvent {
5
- AccountsChanged = "accountsChanged",
6
- ChainChanged = "chainChanged"
7
- }
@@ -1,27 +0,0 @@
1
- /*
2
- *
3
- * Hedera Wallet Connect
4
- *
5
- * Copyright (C) 2023 Hedera Hashgraph, LLC
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- *
19
- */
20
- /**
21
- * Represents different events related to a Hedera session.
22
- */
23
- export var HederaSessionEvent;
24
- (function (HederaSessionEvent) {
25
- HederaSessionEvent["AccountsChanged"] = "accountsChanged";
26
- HederaSessionEvent["ChainChanged"] = "chainChanged";
27
- })(HederaSessionEvent || (HederaSessionEvent = {}));
@@ -1,21 +0,0 @@
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;
@@ -1,42 +0,0 @@
1
- export var EVENTS;
2
- (function (EVENTS) {
3
- EVENTS["extensionQuery"] = "hedera-extension-query";
4
- EVENTS["extensionConnect"] = "hedera-extension-connect-";
5
- EVENTS["extensionOpen"] = "hedera-extension-open-";
6
- EVENTS["extensionResponse"] = "hedera-extension-response";
7
- EVENTS["iframeQuery"] = "hedera-iframe-query";
8
- EVENTS["iframeQueryResponse"] = "hedera-iframe-response";
9
- EVENTS["iframeConnect"] = "hedera-iframe-connect";
10
- })(EVENTS || (EVENTS = {}));
11
- export const findExtensions = (onFound) => {
12
- if (typeof window === 'undefined')
13
- return;
14
- window.addEventListener('message', (event) => {
15
- var _a, _b;
16
- if (((_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.type) == EVENTS.extensionResponse && event.data.metadata) {
17
- onFound(event.data.metadata, false);
18
- }
19
- if (((_b = event === null || event === void 0 ? void 0 : event.data) === null || _b === void 0 ? void 0 : _b.type) == EVENTS.iframeQueryResponse && event.data.metadata) {
20
- onFound(event.data.metadata, true);
21
- }
22
- });
23
- setTimeout(() => {
24
- extensionQuery();
25
- }, 200);
26
- };
27
- export const extensionQuery = () => {
28
- window.postMessage({ type: EVENTS.extensionQuery }, '*');
29
- if (window.parent) {
30
- window.parent.postMessage({ type: EVENTS.iframeQuery }, '*');
31
- }
32
- };
33
- export const extensionConnect = (id, isIframe, pairingString) => {
34
- if (isIframe) {
35
- window.parent.postMessage({ type: EVENTS.iframeConnect, pairingString }, '*');
36
- return;
37
- }
38
- window.postMessage({ type: EVENTS.extensionConnect + id, pairingString }, '*');
39
- };
40
- export const extensionOpen = (id) => {
41
- window.postMessage({ type: EVENTS.extensionOpen + id }, '*');
42
- };
@@ -1,7 +0,0 @@
1
- export * from './chainIds';
2
- export * from './errors';
3
- export * from './events';
4
- export * from './methods';
5
- export * from './payloads';
6
- export * from './utils';
7
- export * from './extensionController';
@@ -1,26 +0,0 @@
1
- /*
2
- *
3
- * Hedera Wallet Connect
4
- *
5
- * Copyright (C) 2023 Hedera Hashgraph, LLC
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- *
19
- */
20
- export * from './chainIds';
21
- export * from './errors';
22
- export * from './events';
23
- export * from './methods';
24
- export * from './payloads';
25
- export * from './utils';
26
- export * from './extensionController';
@@ -1,18 +0,0 @@
1
- export interface ILogger {
2
- error(message: string, ...args: any[]): void;
3
- warn(message: string, ...args: any[]): void;
4
- info(message: string, ...args: any[]): void;
5
- debug(message: string, ...args: any[]): void;
6
- }
7
- export type LogLevel = 'error' | 'warn' | 'info' | 'debug' | 'off';
8
- export declare class DefaultLogger implements ILogger {
9
- private logLevel;
10
- name: string;
11
- constructor(logLevel?: LogLevel, name?: string);
12
- setLogLevel(level: LogLevel): void;
13
- getLogLevel(): LogLevel;
14
- error(message: string, ...args: any[]): void;
15
- warn(message: string, ...args: any[]): void;
16
- info(message: string, ...args: any[]): void;
17
- debug(message: string, ...args: any[]): void;
18
- }
@@ -1,33 +0,0 @@
1
- export class DefaultLogger {
2
- constructor(logLevel = 'info', name) {
3
- this.logLevel = 'info';
4
- this.logLevel = logLevel;
5
- this.name = name || 'Logger';
6
- }
7
- setLogLevel(level) {
8
- this.logLevel = level;
9
- }
10
- getLogLevel() {
11
- return this.logLevel;
12
- }
13
- error(message, ...args) {
14
- if (['error', 'warn', 'info', 'debug'].includes(this.logLevel)) {
15
- console.error(`[ERROR - ${this.name}] ${message}`, ...args);
16
- }
17
- }
18
- warn(message, ...args) {
19
- if (['warn', 'info', 'debug'].includes(this.logLevel)) {
20
- console.warn(`[WARN - ${this.name}] ${message}`, ...args);
21
- }
22
- }
23
- info(message, ...args) {
24
- if (['info', 'debug'].includes(this.logLevel)) {
25
- console.info(`[INFO - ${this.name}] ${message}`, ...args);
26
- }
27
- }
28
- debug(message, ...args) {
29
- if (this.logLevel === 'debug') {
30
- console.debug(`[DEBUG - ${this.name}] ${message}`, ...args);
31
- }
32
- }
33
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * Enum representing different JSON-RPC methods related to Hedera.
3
- * The methods are ordered alphabetically for ease of use and readability.
4
- */
5
- export declare enum HederaJsonRpcMethod {
6
- GetNodeAddresses = "hedera_getNodeAddresses",// 1
7
- ExecuteTransaction = "hedera_executeTransaction",// 2
8
- SignMessage = "hedera_signMessage",// 3
9
- SignAndExecuteQuery = "hedera_signAndExecuteQuery",// 4
10
- SignAndExecuteTransaction = "hedera_signAndExecuteTransaction",// 5
11
- SignTransaction = "hedera_signTransaction"
12
- }
@@ -1,32 +0,0 @@
1
- /*
2
- *
3
- * Hedera Wallet Connect
4
- *
5
- * Copyright (C) 2023 Hedera Hashgraph, LLC
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- *
19
- */
20
- /**
21
- * Enum representing different JSON-RPC methods related to Hedera.
22
- * The methods are ordered alphabetically for ease of use and readability.
23
- */
24
- export var HederaJsonRpcMethod;
25
- (function (HederaJsonRpcMethod) {
26
- HederaJsonRpcMethod["GetNodeAddresses"] = "hedera_getNodeAddresses";
27
- HederaJsonRpcMethod["ExecuteTransaction"] = "hedera_executeTransaction";
28
- HederaJsonRpcMethod["SignMessage"] = "hedera_signMessage";
29
- HederaJsonRpcMethod["SignAndExecuteQuery"] = "hedera_signAndExecuteQuery";
30
- HederaJsonRpcMethod["SignAndExecuteTransaction"] = "hedera_signAndExecuteTransaction";
31
- HederaJsonRpcMethod["SignTransaction"] = "hedera_signTransaction";
32
- })(HederaJsonRpcMethod || (HederaJsonRpcMethod = {}));
@@ -1,101 +0,0 @@
1
- import { JsonRpcResult } from '@walletconnect/jsonrpc-types';
2
- import { EngineTypes } from '@walletconnect/types';
3
- import type { Transaction, TransactionResponseJSON } from '@hashgraph/sdk';
4
- import { HederaJsonRpcMethod } from './methods';
5
- /**
6
- * Defines various types and interfaces for Hedera JSON-RPC methods.
7
- */
8
- export type GetNodeAddressesParams = undefined;
9
- export interface GetNodeAddressesRequest extends EngineTypes.RequestParams {
10
- request: {
11
- method: HederaJsonRpcMethod.GetNodeAddresses;
12
- params: GetNodeAddressesParams;
13
- };
14
- }
15
- export interface GetNodeAddressesResult extends JsonRpcResult<{
16
- nodes: string[];
17
- }> {
18
- }
19
- export interface GetNodeAddresesResponse extends EngineTypes.RespondParams {
20
- response: GetNodeAddressesResult;
21
- }
22
- export interface ExecuteTransactionParams {
23
- transactionList: string;
24
- }
25
- export interface ExecuteTransactionRequest extends EngineTypes.RequestParams {
26
- request: {
27
- method: HederaJsonRpcMethod.ExecuteTransaction;
28
- params: ExecuteTransactionParams;
29
- };
30
- }
31
- export interface ExecuteTransactionResult extends JsonRpcResult<TransactionResponseJSON> {
32
- }
33
- export interface ExecuteTransactionResponse extends EngineTypes.RespondParams {
34
- response: ExecuteTransactionResult;
35
- }
36
- export interface SignMessageParams {
37
- signerAccountId: string;
38
- message: string;
39
- }
40
- export interface SignMessageRequest extends EngineTypes.RequestParams {
41
- request: {
42
- method: HederaJsonRpcMethod.SignMessage;
43
- params: SignMessageParams;
44
- };
45
- }
46
- export interface SignMessageResult extends JsonRpcResult<{
47
- signatureMap: string;
48
- }> {
49
- }
50
- export interface SignMessageResponse extends EngineTypes.RespondParams {
51
- response: SignMessageResult;
52
- }
53
- export interface SignAndExecuteQueryParams {
54
- signerAccountId: string;
55
- query: string;
56
- }
57
- export interface SignAndExecuteQueryRequest extends EngineTypes.RequestParams {
58
- request: {
59
- method: HederaJsonRpcMethod.SignAndExecuteQuery;
60
- params: SignAndExecuteQueryParams;
61
- };
62
- }
63
- export interface SignAndExecuteQueryResult extends JsonRpcResult<{
64
- response: string;
65
- }> {
66
- }
67
- export interface SignAndExecuteQueryResponse extends EngineTypes.RespondParams {
68
- response: SignAndExecuteQueryResult;
69
- }
70
- export interface SignAndExecuteTransactionParams {
71
- signerAccountId: string;
72
- transactionList: string;
73
- }
74
- export interface SignAndExecuteTransactionRequest extends EngineTypes.RequestParams {
75
- request: {
76
- method: HederaJsonRpcMethod.SignAndExecuteTransaction;
77
- params: SignAndExecuteTransactionParams;
78
- };
79
- }
80
- export interface SignAndExecuteTransactionResult extends JsonRpcResult<TransactionResponseJSON> {
81
- }
82
- export interface SignAndExecuteTransactionResponse extends EngineTypes.RespondParams {
83
- response: SignAndExecuteTransactionResult;
84
- }
85
- export interface SignTransactionParams {
86
- signerAccountId: string;
87
- transactionBody: Transaction | string;
88
- }
89
- export interface SignTransactionRequest extends EngineTypes.RequestParams {
90
- request: {
91
- method: HederaJsonRpcMethod.SignTransaction;
92
- params: SignTransactionParams;
93
- };
94
- }
95
- export interface SignTransactionResult extends JsonRpcResult<{
96
- signatureMap: string;
97
- }> {
98
- }
99
- export interface SignTransactionResponse extends EngineTypes.RespondParams {
100
- response: SignTransactionResult;
101
- }
@@ -1,20 +0,0 @@
1
- /*
2
- *
3
- * Hedera Wallet Connect
4
- *
5
- * Copyright (C) 2023 Hedera Hashgraph, LLC
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- *
19
- */
20
- export {};