@hashgraph/hedera-wallet-connect 1.0.2 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. package/dist/browser-cjs-metafile.json +1 -1
  2. package/dist/browser-cjs.js +1 -1
  3. package/dist/browser-esm-metafile.json +1 -1
  4. package/dist/browser-esm.js +1 -1
  5. package/dist/node-cjs-metafile.json +1 -1
  6. package/dist/node-cjs.js +5 -4
  7. package/dist/node-esm-metafile.json +1 -1
  8. package/dist/node-esm.js +5 -4
  9. package/dist/types/src/index.d.ts +2 -0
  10. package/dist/types/src/index.d.ts.map +1 -0
  11. package/dist/types/src/lib/dapp/DAppSigner.d.ts +29 -0
  12. package/dist/types/src/lib/dapp/DAppSigner.d.ts.map +1 -0
  13. package/dist/types/src/lib/dapp/index.d.ts +177 -0
  14. package/dist/types/src/lib/dapp/index.d.ts.map +1 -0
  15. package/dist/types/src/lib/index.d.ts +4 -0
  16. package/dist/types/src/lib/index.d.ts.map +1 -0
  17. package/dist/types/src/lib/shared/chainIds.d.ts +12 -0
  18. package/dist/types/src/lib/shared/chainIds.d.ts.map +1 -0
  19. package/dist/types/src/lib/shared/errors.d.ts +49 -0
  20. package/dist/types/src/lib/shared/errors.d.ts.map +1 -0
  21. package/dist/types/src/lib/shared/events.d.ts +8 -0
  22. package/dist/types/src/lib/shared/events.d.ts.map +1 -0
  23. package/dist/types/src/lib/shared/index.d.ts +7 -0
  24. package/dist/types/src/lib/shared/index.d.ts.map +1 -0
  25. package/dist/types/src/lib/shared/methods.d.ts +13 -0
  26. package/dist/types/src/lib/shared/methods.d.ts.map +1 -0
  27. package/dist/types/src/lib/shared/payloads.d.ts +102 -0
  28. package/dist/types/src/lib/shared/payloads.d.ts.map +1 -0
  29. package/dist/types/src/lib/shared/utils.d.ts +269 -0
  30. package/dist/types/src/lib/shared/utils.d.ts.map +1 -0
  31. package/dist/types/src/lib/wallet/index.d.ts +40 -0
  32. package/dist/types/src/lib/wallet/index.d.ts.map +1 -0
  33. package/dist/types/src/lib/wallet/provider.d.ts +18 -0
  34. package/dist/types/src/lib/wallet/provider.d.ts.map +1 -0
  35. package/dist/types/src/lib/wallet/types.d.ts +32 -0
  36. package/dist/types/src/lib/wallet/types.d.ts.map +1 -0
  37. package/dist/types/test/_helpers.d.ts +35 -0
  38. package/dist/types/test/_helpers.d.ts.map +1 -0
  39. package/dist/types/test/dapp/DAppConnector.test.d.ts +2 -0
  40. package/dist/types/test/dapp/DAppConnector.test.d.ts.map +1 -0
  41. package/dist/types/test/utils.test.d.ts +2 -0
  42. package/dist/types/test/utils.test.d.ts.map +1 -0
  43. package/dist/types/test/wallet/methods/wallet-executeTransaction.test.d.ts +2 -0
  44. package/dist/types/test/wallet/methods/wallet-executeTransaction.test.d.ts.map +1 -0
  45. package/dist/types/test/wallet/methods/wallet-getNodeAddresses.test.d.ts +2 -0
  46. package/dist/types/test/wallet/methods/wallet-getNodeAddresses.test.d.ts.map +1 -0
  47. package/dist/types/test/wallet/methods/wallet-signAndExecuteQuery.test.d.ts +2 -0
  48. package/dist/types/test/wallet/methods/wallet-signAndExecuteQuery.test.d.ts.map +1 -0
  49. package/dist/types/test/wallet/methods/wallet-signAndExecuteTransaction.test.d.ts +2 -0
  50. package/dist/types/test/wallet/methods/wallet-signAndExecuteTransaction.test.d.ts.map +1 -0
  51. package/dist/types/test/wallet/methods/wallet-signMessage.test.d.ts +2 -0
  52. package/dist/types/test/wallet/methods/wallet-signMessage.test.d.ts.map +1 -0
  53. package/dist/types/test/wallet/methods/wallet-signTransaction.test.d.ts +2 -0
  54. package/dist/types/test/wallet/methods/wallet-signTransaction.test.d.ts.map +1 -0
  55. package/dist/types/test/wallet/wallet-init.test.d.ts +2 -0
  56. package/dist/types/test/wallet/wallet-init.test.d.ts.map +1 -0
  57. package/package.json +6 -6
  58. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -35
  59. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -17
  60. package/.github/ISSUE_TEMPLATE/hip_820.md +0 -16
  61. package/.github/dependabot.yml +0 -17
  62. package/.github/workflows/prettier.yml +0 -28
  63. package/.github/workflows/publish.yml +0 -35
  64. package/.github/workflows/test.yml +0 -32
  65. package/.husky/pre-commit +0 -4
  66. package/.lintstagedrc.json +0 -5
  67. package/.prettierignore +0 -3
  68. package/jest.config.ts +0 -33
  69. package/scripts/examples/build.mjs +0 -54
  70. package/scripts/examples/dev.mjs +0 -54
  71. package/scripts/lib/build.mjs +0 -40
  72. package/scripts/lib/context.mjs +0 -71
  73. package/scripts/lib/watch.mjs +0 -28
  74. package/typedoc.json +0 -10
@@ -0,0 +1,2 @@
1
+ export * from './lib';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAoBA,cAAc,OAAO,CAAA"}
@@ -0,0 +1,29 @@
1
+ import { Signer, AccountBalance, AccountId, AccountInfo, Executable, Key, LedgerId, SignerSignature, Transaction, TransactionRecord } from '@hashgraph/sdk';
2
+ import type { ISignClient } from '@walletconnect/types';
3
+ export declare class DAppSigner implements Signer {
4
+ private readonly accountId;
5
+ private readonly signClient;
6
+ readonly topic: string;
7
+ private readonly ledgerId;
8
+ constructor(accountId: AccountId, signClient: ISignClient, topic: string, ledgerId?: LedgerId);
9
+ request<T>(request: {
10
+ method: string;
11
+ params: any;
12
+ }): Promise<T>;
13
+ getAccountId(): AccountId;
14
+ getAccountKey(): Key;
15
+ getLedgerId(): LedgerId;
16
+ getNetwork(): {
17
+ [key: string]: string | AccountId;
18
+ };
19
+ getMirrorNetwork(): string[];
20
+ getAccountBalance(): Promise<AccountBalance>;
21
+ getAccountInfo(): Promise<AccountInfo>;
22
+ getAccountRecords(): Promise<TransactionRecord[]>;
23
+ sign(data: Uint8Array[], signOptions?: Record<string, any>): Promise<SignerSignature[]>;
24
+ checkTransaction<T extends Transaction>(transaction: T): Promise<T>;
25
+ populateTransaction<T extends Transaction>(transaction: T): Promise<T>;
26
+ signTransaction<T extends Transaction>(transaction: T): Promise<T>;
27
+ call<RequestT, ResponseT, OutputT>(request: Executable<RequestT, ResponseT, OutputT>): Promise<OutputT>;
28
+ }
29
+ //# sourceMappingURL=DAppSigner.d.ts.map
@@ -0,0 +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,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAIvD,qBAAa,UAAW,YAAW,MAAM;IAErC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,UAAU;aACX,KAAK,EAAE,MAAM;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAHR,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,WAAW,EACxB,KAAK,EAAE,MAAM,EACZ,QAAQ,GAAE,QAA2B;IAGxD,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,GAAG,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IAQhE,YAAY,IAAI,SAAS;IAIzB,aAAa,IAAI,GAAG;IAIpB,WAAW,IAAI,QAAQ;IAIvB,UAAU,IAAI;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;KAAE;IAInD,gBAAgB,IAAI,MAAM,EAAE;IAI5B,iBAAiB,IAAI,OAAO,CAAC,cAAc,CAAC;IAI5C,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC;IAItC,iBAAiB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAI3C,IAAI,CACR,IAAI,EAAE,UAAU,EAAE,EAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAChC,OAAO,CAAC,eAAe,EAAE,CAAC;IAIvB,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;IAItE,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,WAAW,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAIlE,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EACrC,OAAO,EAAE,UAAU,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,GAChD,OAAO,CAAC,OAAO,CAAC;CAGpB"}
@@ -0,0 +1,177 @@
1
+ import { LedgerId } from '@hashgraph/sdk';
2
+ import { SignClientTypes } from '@walletconnect/types';
3
+ import SignClient from '@walletconnect/sign-client';
4
+ import { GetNodeAddressesResult, ExecuteTransactionParams, ExecuteTransactionResult, SignMessageParams, SignMessageResult, SignAndExecuteQueryResult, SignAndExecuteQueryParams, SignAndExecuteTransactionParams, SignAndExecuteTransactionResult, SignTransactionParams, SignTransactionResult } from '../shared';
5
+ import { DAppSigner } from './DAppSigner';
6
+ export * from './DAppSigner';
7
+ type BaseLogger = 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'fatal';
8
+ export declare class DAppConnector {
9
+ dAppMetadata: SignClientTypes.Metadata;
10
+ network: LedgerId;
11
+ projectId: string;
12
+ supportedMethods: string[];
13
+ supportedEvents: string[];
14
+ supportedChains: string[];
15
+ walletConnectClient: SignClient | undefined;
16
+ signers: DAppSigner[];
17
+ isInitializing: boolean;
18
+ /**
19
+ * Initializes the DAppConnector instance.
20
+ * @param metadata - SignClientTypes.Metadata object for the DApp metadata.
21
+ * @param network - LedgerId representing the network (default: LedgerId.TESTNET).
22
+ * @param projectId - Project ID for the WalletConnect client.
23
+ * @param methods - Array of supported methods for the DApp (optional).
24
+ * @param events - Array of supported events for the DApp (optional).
25
+ * @param events - Array of supported chains for the DApp (optional).
26
+ */
27
+ constructor(metadata: SignClientTypes.Metadata, network: LedgerId, projectId: string, methods?: string[], events?: string[], chains?: string[]);
28
+ /**
29
+ * Initializes the DAppConnector instance.
30
+ * @param logger - `BaseLogger` for logging purposes (optional).
31
+ */
32
+ init({ logger }?: {
33
+ logger?: BaseLogger;
34
+ }): Promise<void>;
35
+ /**
36
+ * Initiates the WalletConnect connection flow using a QR code.
37
+ * @param pairingTopic - The pairing topic for the connection (optional).
38
+ * @returns A Promise that resolves when the connection process is complete.
39
+ */
40
+ connectQR(pairingTopic?: string): Promise<void>;
41
+ /**
42
+ * Initiates the WalletConnect connection flow using a QR code.
43
+ * @param pairingTopic - The pairing topic for the connection (optional).
44
+ * @returns A Promise that resolves when the connection process is complete.
45
+ */
46
+ openModal(pairingTopic?: string): Promise<void>;
47
+ /**
48
+ * Initiates the WallecConnect connection flow using URI.
49
+ * @param pairingTopic - The pairing topic for the connection (optional).
50
+ * @returns A Promise that resolves when the connection process is complete.
51
+ */
52
+ connect(launchCallback: (uri: string) => void, pairingTopic?: string): Promise<void>;
53
+ private abortableConnect;
54
+ /**
55
+ * Disconnects the current session associated with the specified topic.
56
+ * @param topic - The topic of the session to disconnect.
57
+ * @returns A Promise that resolves when the session is disconnected.
58
+ */
59
+ disconnect(topic: string): Promise<void>;
60
+ /**
61
+ * Disconnects all active sessions and pairings.
62
+ *
63
+ * Throws error when WalletConnect is not initialized or there are no active sessions/pairings.
64
+ * @returns A Promise that resolves when all active sessions and pairings are disconnected.
65
+ */
66
+ disconnectAll(): Promise<void>;
67
+ private createSigners;
68
+ private onSessionConnected;
69
+ private pingWithTimeout;
70
+ private pingWithRetry;
71
+ private checkPersistedState;
72
+ private connectURI;
73
+ private request;
74
+ /**
75
+ * Retrieves the node addresses associated with the current Hedera network.
76
+ *
77
+ * When there is no active session or an error occurs during the request.
78
+ * @returns Promise\<{@link GetNodeAddressesResult}\>
79
+ */
80
+ getNodeAddresses(): Promise<GetNodeAddressesResult>;
81
+ /**
82
+ * Executes a transaction on the Hedera network.
83
+ *
84
+ * @param {ExecuteTransactionParams} params - The parameters of type {@link ExecuteTransactionParams | `ExecuteTransactionParams`} required for the transaction execution.
85
+ * @param {string[]} params.signedTransaction - Array of Base64-encoded `Transaction`'s
86
+ * @returns Promise\<{@link ExecuteTransactionResult}\>
87
+ * @example
88
+ * Use helper `transactionToBase64String` to encode `Transaction` to Base64 string
89
+ * ```ts
90
+ * const params = {
91
+ * signedTransaction: [transactionToBase64String(transaction)]
92
+ * }
93
+ *
94
+ * const result = await dAppConnector.executeTransaction(params)
95
+ * ```
96
+ */
97
+ executeTransaction(params: ExecuteTransactionParams): Promise<ExecuteTransactionResult>;
98
+ /**
99
+ * Signs a provided `message` with provided `signerAccountId`.
100
+ *
101
+ * @param {SignMessageParams} params - The parameters of type {@link SignMessageParams | `SignMessageParams`} required for signing message.
102
+ * @param {string} params.signerAccountId - a signer Hedera Account identifier in {@link https://hips.hedera.com/hip/hip-30 | HIP-30} (`<nework>:<shard>.<realm>.<num>`) form.
103
+ * @param {string} params.message - a plain UTF-8 string
104
+ * @returns Promise\<{@link SignMessageResult}\>
105
+ * @example
106
+ * ```ts
107
+ * const params = {
108
+ * signerAccountId: '0.0.12345',
109
+ * message: 'Hello World!'
110
+ * }
111
+ *
112
+ * const result = await dAppConnector.signMessage(params)
113
+ * ```
114
+ */
115
+ signMessage(params: SignMessageParams): Promise<SignMessageResult>;
116
+ /**
117
+ * Signs and send `Query` on the Hedera network.
118
+ *
119
+ * @param {SignAndExecuteQueryParams} params - The parameters of type {@link SignAndExecuteQueryParams | `SignAndExecuteQueryParams`} required for the Query execution.
120
+ * @param {string} params.signerAccountId - a signer Hedera Account identifier in {@link https://hips.hedera.com/hip/hip-30 | HIP-30} (`<nework>:<shard>.<realm>.<num>`) form.
121
+ * @param {string} params.query - `Query` object represented as Base64 string
122
+ * @returns Promise\<{@link SignAndExecuteQueryResult}\>
123
+ * @example
124
+ * Use helper `queryToBase64String` to encode `Query` to Base64 string
125
+ * ```ts
126
+ * const params = {
127
+ * signerAccountId: '0.0.12345',
128
+ * query: queryToBase64String(query),
129
+ * }
130
+ *
131
+ * const result = await dAppConnector.signAndExecuteQuery(params)
132
+ * ```
133
+ */
134
+ signAndExecuteQuery(params: SignAndExecuteQueryParams): Promise<SignAndExecuteQueryResult>;
135
+ /**
136
+ * Signs and executes Transactions on the Hedera network.
137
+ *
138
+ * @param {SignAndExecuteTransactionParams} params - The parameters of type {@link SignAndExecuteTransactionParams | `SignAndExecuteTransactionParams`} required for `Transaction` signing and execution.
139
+ * @param {string} params.signerAccountId - a signer Hedera Account identifier in {@link https://hips.hedera.com/hip/hip-30 | HIP-30} (`<nework>:<shard>.<realm>.<num>`) form.
140
+ * @param {string[]} params.transaction - Array of Base64-encoded `Transaction`'s
141
+ * @returns Promise\<{@link SignAndExecuteTransactionResult}\>
142
+ * @example
143
+ * Use helper `transactionToBase64String` to encode `Transaction` to Base64 string
144
+ * ```ts
145
+ * const params = {
146
+ * signerAccountId: '0.0.12345'
147
+ * transaction: [transactionToBase64String(transaction)]
148
+ * }
149
+ *
150
+ * const result = await dAppConnector.signAndExecuteTransaction(params)
151
+ * ```
152
+ */
153
+ signAndExecuteTransaction(params: SignAndExecuteTransactionParams): Promise<SignAndExecuteTransactionResult>;
154
+ /**
155
+ * Signs and executes Transactions on the Hedera network.
156
+ *
157
+ * @param {SignTransactionParams} params - The parameters of type {@link SignTransactionParams | `SignTransactionParams`} required for `Transaction` signing.
158
+ * @param {string} params.signerAccountId - a signer Hedera Account identifier in {@link https://hips.hedera.com/hip/hip-30 | HIP-30} (`<nework>:<shard>.<realm>.<num>`) form.
159
+ * @param {string[]} params.transaction - Array of Base64-encoded `Transaction`'s
160
+ * @returns Promise\<{@link SignTransactionResult}\>
161
+ * @example
162
+ * ```ts
163
+ * const transactionBodyObject = transactionToTransactionBody(transaction, AccountId.fromString('0.0.3'))
164
+ * const transactionBody = transactionBodyToBase64String(transactionBodyObject)
165
+ *
166
+ * const params = {
167
+ * signerAccountId: '0.0.12345',
168
+ * transactionBody
169
+ * }
170
+ *
171
+ * const result = await dAppConnector.signTransaction(params)
172
+ * ```
173
+ */
174
+ signTransaction(params: SignTransactionParams): Promise<SignTransactionResult>;
175
+ }
176
+ export default DAppConnector;
177
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/dapp/index.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAa,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAA6B,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAIjF,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,EACtB,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;AAEzE,qBAAa,aAAa;IACxB,YAAY,EAAE,eAAe,CAAC,QAAQ,CAAA;IACtC,OAAO,EAAE,QAAQ,CAAmB;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,EAAE,MAAM,EAAE,CAAK;IAC/B,eAAe,EAAE,MAAM,EAAE,CAAK;IAC9B,eAAe,EAAE,MAAM,EAAE,CAAK;IAE9B,mBAAmB,EAAE,UAAU,GAAG,SAAS,CA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,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,4 @@
1
+ export * from './shared';
2
+ export { default as Wallet } from './wallet';
3
+ export * from './dapp';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/index.ts"],"names":[],"mappings":"AAoBA,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA;AAC5C,cAAc,QAAQ,CAAA"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Enum representing different Hedera network chain IDs.
3
+ *
4
+ * @see {@link https://github.com/hashgraph/hedera-improvement-proposal/blob/main/HIP/hip-820.md#specification | HIP-820 Specification}
5
+ */
6
+ export declare enum HederaChainId {
7
+ Mainnet = "hedera:mainnet",
8
+ Testnet = "hedera:testnet",
9
+ Previewnet = "hedera:previewnet",
10
+ Devnet = "hedera:devnet"
11
+ }
12
+ //# sourceMappingURL=chainIds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chainIds.d.ts","sourceRoot":"","sources":["../../../../../src/lib/shared/chainIds.ts"],"names":[],"mappings":"AAoBA;;;;GAIG;AAEH,oBAAY,aAAa;IACvB,OAAO,mBAAmB;IAC1B,OAAO,mBAAmB;IAC1B,UAAU,sBAAsB;IAChC,MAAM,kBAAkB;CACzB"}
@@ -0,0 +1,49 @@
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>;
49
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../../src/lib/shared/errors.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,aAAa,CAAA;AAEvD;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM;IACtD,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,CAAC,CAAA;CACT;AAED;;;;;;;GAOG;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;CAKzF,CAAA;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM;IACrD,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,KAAK,CAAA;IACd,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAA;CAC9B;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EACzB,IAAI,CAAC,EAAE,CAAC,GACP,mBAAmB,CAAC,CAAC,CAAC,CAOxB"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Represents different events related to a Hedera session.
3
+ */
4
+ export declare enum HederaSessionEvent {
5
+ AccountsChanged = "accountsChanged",
6
+ ChainChanged = "chainChanged"
7
+ }
8
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../src/lib/shared/events.ts"],"names":[],"mappings":"AAoBA;;GAEG;AACH,oBAAY,kBAAkB;IAC5B,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;CAC9B"}
@@ -0,0 +1,7 @@
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
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,13 @@
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
+ }
13
+ //# sourceMappingURL=methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../../../../src/lib/shared/methods.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AACH,oBAAY,mBAAmB;IAC7B,gBAAgB,4BAA4B,CAAE,IAAI;IAClD,kBAAkB,8BAA8B,CAAE,IAAI;IACtD,WAAW,uBAAuB,CAAE,IAAI;IACxC,mBAAmB,+BAA+B,CAAE,IAAI;IACxD,yBAAyB,qCAAqC,CAAE,IAAI;IACpE,eAAe,2BAA2B;CAC3C"}
@@ -0,0 +1,102 @@
1
+ import { JsonRpcResult } from '@walletconnect/jsonrpc-types';
2
+ import { EngineTypes } from '@walletconnect/types';
3
+ import type { 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: 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
+ }
102
+ //# sourceMappingURL=payloads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payloads.d.ts","sourceRoot":"","sources":["../../../../../src/lib/shared/payloads.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAE/C;;GAEG;AAMH,MAAM,MAAM,sBAAsB,GAAG,SAAS,CAAA;AAE9C,MAAM,WAAW,uBAAwB,SAAQ,WAAW,CAAC,aAAa;IACxE,OAAO,EAAE;QACP,MAAM,EAAE,mBAAmB,CAAC,gBAAgB,CAAA;QAC5C,MAAM,EAAE,sBAAsB,CAAA;KAC/B,CAAA;CACF;AAED,MAAM,WAAW,sBAAuB,SAAQ,aAAa,CAAC;IAAE,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;CAAG;AAErF,MAAM,WAAW,uBAAwB,SAAQ,WAAW,CAAC,aAAa;IACxE,QAAQ,EAAE,sBAAsB,CAAA;CACjC;AAOD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