@hashgraph/hedera-wallet-connect 2.0.4 → 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.
- package/package.json +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -21
- package/dist/lib/dapp/DAppSigner.d.ts +0 -60
- package/dist/lib/dapp/DAppSigner.js +0 -344
- package/dist/lib/dapp/SessionNotFoundError.d.ts +0 -3
- package/dist/lib/dapp/SessionNotFoundError.js +0 -6
- package/dist/lib/dapp/index.d.ts +0 -216
- package/dist/lib/dapp/index.js +0 -588
- package/dist/lib/index.d.ts +0 -3
- package/dist/lib/index.js +0 -22
- package/dist/lib/shared/chainIds.d.ts +0 -11
- package/dist/lib/shared/chainIds.js +0 -31
- package/dist/lib/shared/errors.d.ts +0 -48
- package/dist/lib/shared/errors.js +0 -51
- package/dist/lib/shared/events.d.ts +0 -7
- package/dist/lib/shared/events.js +0 -27
- package/dist/lib/shared/extensionController.d.ts +0 -21
- package/dist/lib/shared/extensionController.js +0 -42
- package/dist/lib/shared/index.d.ts +0 -7
- package/dist/lib/shared/index.js +0 -26
- package/dist/lib/shared/logger.d.ts +0 -21
- package/dist/lib/shared/logger.js +0 -63
- package/dist/lib/shared/methods.d.ts +0 -12
- package/dist/lib/shared/methods.js +0 -32
- package/dist/lib/shared/payloads.d.ts +0 -101
- package/dist/lib/shared/payloads.js +0 -20
- package/dist/lib/shared/utils.d.ts +0 -280
- package/dist/lib/shared/utils.js +0 -461
- package/dist/lib/wallet/index.d.ts +0 -39
- package/dist/lib/wallet/index.js +0 -306
- package/dist/lib/wallet/provider.d.ts +0 -17
- package/dist/lib/wallet/provider.js +0 -58
- package/dist/lib/wallet/types.d.ts +0 -31
- package/dist/lib/wallet/types.js +0 -20
- package/dist/reown/adapter.d.ts +0 -59
- package/dist/reown/adapter.js +0 -290
- package/dist/reown/connectors/HederaConnector.d.ts +0 -29
- package/dist/reown/connectors/HederaConnector.js +0 -32
- package/dist/reown/connectors/index.d.ts +0 -1
- package/dist/reown/connectors/index.js +0 -1
- package/dist/reown/index.d.ts +0 -4
- package/dist/reown/index.js +0 -4
- package/dist/reown/providers/EIP155Provider.d.ts +0 -33
- package/dist/reown/providers/EIP155Provider.js +0 -187
- package/dist/reown/providers/HIP820Provider.d.ts +0 -26
- package/dist/reown/providers/HIP820Provider.js +0 -67
- package/dist/reown/providers/HederaProvider.d.ts +0 -166
- package/dist/reown/providers/HederaProvider.js +0 -506
- package/dist/reown/providers/index.d.ts +0 -3
- package/dist/reown/providers/index.js +0 -3
- package/dist/reown/utils/account.d.ts +0 -2
- package/dist/reown/utils/account.js +0 -41
- package/dist/reown/utils/chains.d.ts +0 -18
- package/dist/reown/utils/chains.js +0 -152
- package/dist/reown/utils/constants.d.ts +0 -16
- package/dist/reown/utils/constants.js +0 -18
- package/dist/reown/utils/helpers.d.ts +0 -12
- package/dist/reown/utils/helpers.js +0 -25
- package/dist/reown/utils/index.d.ts +0 -5
- package/dist/reown/utils/index.js +0 -5
- package/dist/reown/utils/types.d.ts +0 -9
- package/dist/reown/utils/types.js +0 -1
- package/dist/reown/wallets/EIP155Wallet.d.ts +0 -46
- package/dist/reown/wallets/EIP155Wallet.js +0 -124
- package/dist/reown/wallets/HIP820Wallet.d.ts +0 -53
- package/dist/reown/wallets/HIP820Wallet.js +0 -236
- package/dist/reown/wallets/index.d.ts +0 -2
- package/dist/reown/wallets/index.js +0 -2
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
import { AccountId, PublicKey, PrivateKey, Transaction, LedgerId, Query, SignerSignature } from '@hashgraph/sdk';
|
|
2
|
-
import { ProposalTypes, SessionTypes } from '@walletconnect/types';
|
|
3
|
-
import { proto } from '@hashgraph/proto';
|
|
4
|
-
/**
|
|
5
|
-
* Converts `Transaction` to a Base64-string.
|
|
6
|
-
*
|
|
7
|
-
* Converts a transaction to bytes and then encodes it as a Base64-string. Allow incomplete transaction (HIP-745).
|
|
8
|
-
* @param transaction - Any instance of a class that extends `Transaction`
|
|
9
|
-
* @returns Base64 encoded representation of the input `Transaction` object
|
|
10
|
-
*/
|
|
11
|
-
export declare function transactionToBase64String<T extends Transaction>(transaction: T): string;
|
|
12
|
-
/**
|
|
13
|
-
* Recreates a `Transaction` from a base64 encoded string.
|
|
14
|
-
*
|
|
15
|
-
* Decodes the string to a buffer,
|
|
16
|
-
* then passes to `Transaction.fromBytes`. For greater flexibility, this function uses the base
|
|
17
|
-
* `Transaction` class, but takes an optional type parameter if the type of transaction is known,
|
|
18
|
-
* allowing stronger typeing.
|
|
19
|
-
* @param transactionBytes - a base64 encoded string
|
|
20
|
-
* @returns `Transaction`
|
|
21
|
-
* @example
|
|
22
|
-
* ```ts
|
|
23
|
-
* const txn1 = base64StringToTransaction(bytesString)
|
|
24
|
-
* const txn2 = base64StringToTransaction<TransferTransaction>(bytesString)
|
|
25
|
-
* // txn1 type: Transaction
|
|
26
|
-
* // txn2 type: TransferTransaction
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export declare function base64StringToTransaction<T extends Transaction>(transactionBytes: string): T;
|
|
30
|
-
/**
|
|
31
|
-
* @param transaction - a base64 encoded string of proto.TransactionBody.encode().finish()
|
|
32
|
-
* @param nodeAccountId - an optional `AccountId` to set the node account ID for the transaction
|
|
33
|
-
* @returns `string`
|
|
34
|
-
* */
|
|
35
|
-
export declare function transactionToTransactionBody<T extends Transaction>(transaction: T, nodeAccountId?: AccountId | null): proto.ITransactionBody;
|
|
36
|
-
export declare function transactionBodyToBase64String(transactionBody: proto.ITransactionBody): string;
|
|
37
|
-
/**
|
|
38
|
-
* @param transactionList - a proto.TransactionList object
|
|
39
|
-
* @returns `string`
|
|
40
|
-
* */
|
|
41
|
-
export declare function transactionListToBase64String(transactionList: proto.TransactionList): string;
|
|
42
|
-
/**
|
|
43
|
-
* Extracts the first signature from a proto.SignatureMap object.
|
|
44
|
-
* @param signatureMap - a proto.SignatureMap object
|
|
45
|
-
* @returns `Uint8Array`
|
|
46
|
-
* */
|
|
47
|
-
export declare const extractFirstSignature: (signatureMap: proto.ISignatureMap) => Uint8Array;
|
|
48
|
-
/**
|
|
49
|
-
* Decodes base64 encoded proto.TransactionBody bytes to a `proto.TransactionBody` object.
|
|
50
|
-
*
|
|
51
|
-
* @param transactionBody - a base64 encoded string of proto.TransactionBody.encode().finish()
|
|
52
|
-
* @returns `Transaction`
|
|
53
|
-
*
|
|
54
|
-
* */
|
|
55
|
-
export declare function base64StringToTransactionBody(transactionBody: string): proto.TransactionBody;
|
|
56
|
-
/**
|
|
57
|
-
* Converts a `proto.SignatureMap` to a base64 encoded string.
|
|
58
|
-
*
|
|
59
|
-
* First converts the `proto.SignatureMap` object to a JSON.
|
|
60
|
-
* Then encodes the JSON to a base64 encoded string.
|
|
61
|
-
* @param signatureMap - The `proto.SignatureMap` object to be converted
|
|
62
|
-
* @returns Base64-encoded string representation of the input `proto.SignatureMap`
|
|
63
|
-
*/
|
|
64
|
-
export declare function signatureMapToBase64String(signatureMap: proto.SignatureMap): string;
|
|
65
|
-
/**
|
|
66
|
-
* Converts a Base64-encoded string to a `proto.SignatureMap`.
|
|
67
|
-
* @param base64string - Base64-encoded string
|
|
68
|
-
* @returns `proto.SignatureMap`
|
|
69
|
-
*/
|
|
70
|
-
export declare function base64StringToSignatureMap(base64string: string): proto.SignatureMap;
|
|
71
|
-
/**
|
|
72
|
-
* Encodes the binary data represented by the `Uint8Array` to a Base64 string.
|
|
73
|
-
* @param binary - The `Uint8Array` containing binary data to be converted
|
|
74
|
-
* @returns Base64-encoded string representation of the input `Uint8Array`
|
|
75
|
-
*/
|
|
76
|
-
export declare function Uint8ArrayToBase64String(binary: Uint8Array): string;
|
|
77
|
-
/**
|
|
78
|
-
* Encodes the binary data represented by the `Uint8Array` to a UTF-8 string.
|
|
79
|
-
* @param binary - The `Uint8Array` containing binary data to be converted
|
|
80
|
-
* @returns UTF-8 string representation of the input `Uint8Array`
|
|
81
|
-
*/
|
|
82
|
-
export declare function Uint8ArrayToString(binary: Uint8Array): string;
|
|
83
|
-
/**
|
|
84
|
-
* Converts a Base64-encoded string to a `Uint8Array`.
|
|
85
|
-
* @param base64string - Base64-encoded string to be converted
|
|
86
|
-
* @returns A `Uint8Array` representing the decoded binary data
|
|
87
|
-
*/
|
|
88
|
-
export declare function base64StringToUint8Array(base64string: string): Uint8Array;
|
|
89
|
-
/**
|
|
90
|
-
* Converts a `Query` object to a Base64-encoded string.
|
|
91
|
-
* First utilizes the `toBytes` method of the `Query` instance to obtain its binary `Uint8Array` representation.
|
|
92
|
-
* Then encodes the binary `Uint8Array` to a Base64 string representation.
|
|
93
|
-
* @param query - A `Query` object to be converted
|
|
94
|
-
* @returns Base64 encoded representation of the input `Query` object
|
|
95
|
-
*/
|
|
96
|
-
export declare function queryToBase64String<T, Q extends Query<T>>(query: Q): string;
|
|
97
|
-
/**
|
|
98
|
-
* Recreates a `Query` from a Base64-encoded string. First decodes the string to a buffer,
|
|
99
|
-
* then passes to `Query.fromBytes`. For greater flexibility, this function uses the base
|
|
100
|
-
* `Query` class, but takes an optional type parameter if the type of query is known,
|
|
101
|
-
* allowing stronger typeing.
|
|
102
|
-
* @param bytesString - Base64-encoded string
|
|
103
|
-
* @returns `Query<T>`
|
|
104
|
-
* @example
|
|
105
|
-
* ```ts
|
|
106
|
-
* const query1 = base64StringToQuery(bytesString)
|
|
107
|
-
* const query2 = base64StringToQuery<AccountInfoQuery>(bytesString)
|
|
108
|
-
* // query1 type: Query<any>
|
|
109
|
-
* // query2 type: AccountInfoQuery
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
112
|
-
export declare function base64StringToQuery<Q extends Query<any>>(bytesString: string): Q;
|
|
113
|
-
export declare function prefixMessageToSign(message: string): string;
|
|
114
|
-
/**
|
|
115
|
-
* Incorporates additional data (salt) into the message to alter the output signature.
|
|
116
|
-
* This alteration ensures that passing a transaction here for signing will yield an invalid signature,
|
|
117
|
-
* as the additional data modifies the signature text.
|
|
118
|
-
*
|
|
119
|
-
* @param message - A plain text string
|
|
120
|
-
* @returns An array of Uint8Array containing the prepared message for signing
|
|
121
|
-
*/
|
|
122
|
-
export declare function stringToSignerMessage(message: string): Uint8Array[];
|
|
123
|
-
/**
|
|
124
|
-
* This implementation expects a plain text string, which is prefixed and then signed by a wallet.
|
|
125
|
-
* Because the spec calls for 1 message to be signed and 1 signer, this function expects a single
|
|
126
|
-
* signature and used the first item in the sigPair array.
|
|
127
|
-
*
|
|
128
|
-
* @param message - A plain text string
|
|
129
|
-
* @param base64SignatureMap - A base64 encoded proto.SignatureMap object
|
|
130
|
-
* @param publicKey - A PublicKey object use to verify the signature
|
|
131
|
-
* @returns boolean - whether or not the first signature in the sigPair is valid for the message and public key
|
|
132
|
-
*/
|
|
133
|
-
export declare function verifyMessageSignature(message: string, base64SignatureMap: string, publicKey: PublicKey): boolean;
|
|
134
|
-
/**
|
|
135
|
-
* This implementation expects a plain text string, which is prefixed and then signed by a wallet.
|
|
136
|
-
* Because the spec calls for 1 message to be signed and 1 signer, this function expects a single
|
|
137
|
-
* signature and used the first item in the sigPair array.
|
|
138
|
-
*
|
|
139
|
-
* @param message - A plain text string
|
|
140
|
-
* @param signerSignature - A SignerSignature object
|
|
141
|
-
* @param publicKey - A PublicKey object use to verify the signature
|
|
142
|
-
* @returns boolean - whether or not the first signature in the sigPair is valid for the message and public key
|
|
143
|
-
*/
|
|
144
|
-
export declare function verifySignerSignature(message: string, signerSignature: SignerSignature, publicKey: PublicKey): boolean;
|
|
145
|
-
/**
|
|
146
|
-
*
|
|
147
|
-
* https://github.com/hashgraph/hedera-sdk-js/blob/c78512b1d43eedf1d8bf2926a5b7ed3368fc39d1/src/PublicKey.js#L258
|
|
148
|
-
* a signature pair is a protobuf object with a signature and a public key, it is the responsibility of a dApp to ensure the public key matches the account id
|
|
149
|
-
* @param signerSignatures - An array of `SignerSignature` objects
|
|
150
|
-
* @returns `proto.SignatureMap` object
|
|
151
|
-
*/
|
|
152
|
-
export declare function signerSignaturesToSignatureMap(signerSignatures: SignerSignature[]): proto.SignatureMap;
|
|
153
|
-
/**
|
|
154
|
-
* A mapping of `LedgerId` to EIP chain id and CAIP-2 network name.
|
|
155
|
-
*
|
|
156
|
-
* Structure: [`LedgerId`, `number` (EIP155 chain id), `string` (CAIP-2 chain id)][]
|
|
157
|
-
*
|
|
158
|
-
* @see {@link https://namespaces.chainagnostic.org/hedera/README | Hedera Namespaces}
|
|
159
|
-
* @see {@link https://hips.hedera.com/hip/hip-30 | CAIP Identifiers for the Hedera Network (HIP-30)}
|
|
160
|
-
*/
|
|
161
|
-
export declare const LEDGER_ID_MAPPINGS: [LedgerId, number, string][];
|
|
162
|
-
/**
|
|
163
|
-
* Converts an EIP chain id to a LedgerId object.
|
|
164
|
-
*
|
|
165
|
-
* If no mapping is found, returns `LedgerId.LOCAL_NODE`.
|
|
166
|
-
*
|
|
167
|
-
* @param chainId - The EIP chain ID (number) to be converted
|
|
168
|
-
* @returns A `LedgerId` corresponding to the provided chain ID
|
|
169
|
-
* @example
|
|
170
|
-
* ```ts
|
|
171
|
-
* const localnodeLedgerId = EIPChainIdToLedgerId(298)
|
|
172
|
-
* console.log(localnodeLedgerId) // LedgerId.LOCAL_NODE
|
|
173
|
-
* const mainnetLedgerId = EIPChainIdToLedgerId(295)
|
|
174
|
-
* console.log(mainnetLedgerId) // LedgerId.MAINNET
|
|
175
|
-
* ```
|
|
176
|
-
*/
|
|
177
|
-
export declare function EIPChainIdToLedgerId(chainId: number): LedgerId;
|
|
178
|
-
/**
|
|
179
|
-
* Converts a LedgerId object to an EIP chain id.
|
|
180
|
-
*
|
|
181
|
-
* If no mapping is found, returns the EIP chain id for `LedgerId.LOCAL_NODE`.
|
|
182
|
-
*
|
|
183
|
-
* @param ledgerId - The `LedgerId` object to be converted
|
|
184
|
-
* @returns A `number` representing the EIP chain id for the provided `LedgerId`
|
|
185
|
-
* @example
|
|
186
|
-
* ```ts
|
|
187
|
-
* const previewnetChainId = ledgerIdToEIPChainId(LedgerId.PREVIEWNET)
|
|
188
|
-
* console.log(previewnetChainId) // 297
|
|
189
|
-
* const testnetChainId = ledgerIdToEIPChainId(LedgerId.TESTNET)
|
|
190
|
-
* console.log(testnetChainId) // 296
|
|
191
|
-
* ```
|
|
192
|
-
*/
|
|
193
|
-
export declare function ledgerIdToEIPChainId(ledgerId: LedgerId): number;
|
|
194
|
-
/**
|
|
195
|
-
* Converts a network name to an EIP chain id.
|
|
196
|
-
* If no mapping is found, returns the EIP chain id for `LedgerId.LOCAL_NODE`.
|
|
197
|
-
*
|
|
198
|
-
* @param networkName - The network name (string) to be converted
|
|
199
|
-
* @returns A `number` representing the EIP chain id for the provided network name
|
|
200
|
-
* @example
|
|
201
|
-
* ```ts
|
|
202
|
-
* const mainnetChainId = networkNameToEIPChainId('mainnet')
|
|
203
|
-
* console.log(mainnetChainId) // 295
|
|
204
|
-
* const testnetChainId = networkNameToEIPChainId('testnet')
|
|
205
|
-
* console.log(mainnetChainId) // 296
|
|
206
|
-
* ```
|
|
207
|
-
*/
|
|
208
|
-
export declare function networkNameToEIPChainId(networkName: string): number;
|
|
209
|
-
/**
|
|
210
|
-
* Converts a CAIP chain id to a LedgerId object.
|
|
211
|
-
*
|
|
212
|
-
* If no mapping is found, returns `LedgerId.LOCAL_NODE`.
|
|
213
|
-
*
|
|
214
|
-
* @param chainId - The CAIP chain ID (string) to be converted
|
|
215
|
-
* @returns A `LedgerId` corresponding to the provided CAIP chain ID
|
|
216
|
-
* @example
|
|
217
|
-
* ```ts
|
|
218
|
-
* const previewnetLedgerId = CAIPChainIdToLedgerId(HederaChainId.Previewnet)
|
|
219
|
-
* console.log(previewnetLedgerId) // LedgerId.PREVIEWNET
|
|
220
|
-
* const testnetLedgerId = CAIPChainIdToLedgerId(HederaChainId.Testnet)
|
|
221
|
-
* console.log(testnetLedgerId) // LedgerId.TESTNET
|
|
222
|
-
* ```
|
|
223
|
-
*/
|
|
224
|
-
export declare function CAIPChainIdToLedgerId(chainId: string): LedgerId;
|
|
225
|
-
/**
|
|
226
|
-
* Converts a LedgerId object to a CAIP chain id.
|
|
227
|
-
*
|
|
228
|
-
* If no mapping is found, returns the CAIP chain id for `LedgerId.LOCAL_NODE`.
|
|
229
|
-
*
|
|
230
|
-
* @param ledgerId - The `LedgerId` object to be converted
|
|
231
|
-
* @returns A `string` representing the CAIP chain id for the provided `LedgerId`
|
|
232
|
-
* @example
|
|
233
|
-
* ```ts
|
|
234
|
-
* const mainnetChainId = ledgerIdToCAIPChainId(HederaChainId.Mainnet)
|
|
235
|
-
* console.log(mainnetChainId) // LedgerId.PREVIEWNET
|
|
236
|
-
* const testnetChainId = ledgerIdToCAIPChainId(HederaChainId.Testnet)
|
|
237
|
-
* console.log(testnetChainId) // LedgerId.TESTNET
|
|
238
|
-
* ```
|
|
239
|
-
*/
|
|
240
|
-
export declare function ledgerIdToCAIPChainId(ledgerId: LedgerId): string;
|
|
241
|
-
/**
|
|
242
|
-
* Converts a network name to a CAIP chain id.
|
|
243
|
-
*
|
|
244
|
-
* If no mapping is found, returns the CAIP chain id for `LedgerId.LOCAL_NODE`.
|
|
245
|
-
*
|
|
246
|
-
* @param networkName - The network name (string) to be converted
|
|
247
|
-
* @returns A `string` representing the CAIP chain id for the provided network name
|
|
248
|
-
* @example
|
|
249
|
-
* ```ts
|
|
250
|
-
* const previewnetChainId = networkNameToCAIPChainId('previewnet')
|
|
251
|
-
* console.log(previewnetChainId) // HederaChainId.Previewnet
|
|
252
|
-
* const devnetChainId = networkNameToCAIPChainId('devnet')
|
|
253
|
-
* console.log(devnetChainId) // HederaChainId.Devnet
|
|
254
|
-
* ```
|
|
255
|
-
*/
|
|
256
|
-
export declare function networkNameToCAIPChainId(networkName: string): string;
|
|
257
|
-
/**
|
|
258
|
-
* Create a `ProposalTypes.RequiredNamespaces` object for a given ledgerId.
|
|
259
|
-
*
|
|
260
|
-
* @param ledgerId - The `LedgerId` for which the namespaces are created
|
|
261
|
-
* @param methods - An array of strings representing methods
|
|
262
|
-
* @param events - An array of strings representing events
|
|
263
|
-
* @returns A `ProposalTypes.RequiredNamespaces` object
|
|
264
|
-
*/
|
|
265
|
-
export declare const networkNamespaces: (ledgerId: LedgerId, methods: string[], events: string[]) => ProposalTypes.RequiredNamespaces;
|
|
266
|
-
/**
|
|
267
|
-
* Get the account and ledger from a `SessionTypes.Struct` object.
|
|
268
|
-
*
|
|
269
|
-
* @param session - The `SessionTypes.Struct` object containing namespaces
|
|
270
|
-
* @returns `ProposalTypes.RequiredNamespaces` - an array of objects containing network (LedgerId) and account (AccountId)
|
|
271
|
-
*/
|
|
272
|
-
export declare const accountAndLedgerFromSession: (session: SessionTypes.Struct) => {
|
|
273
|
-
network: LedgerId;
|
|
274
|
-
account: AccountId;
|
|
275
|
-
}[];
|
|
276
|
-
/**
|
|
277
|
-
* Adds an additional signature to an already-signed transaction.
|
|
278
|
-
* Uses proto-level manipulation to preserve existing signatures.
|
|
279
|
-
*/
|
|
280
|
-
export declare function addSignatureToTransaction<T extends Transaction>(transaction: T, privateKey: PrivateKey): Promise<T>;
|