@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
package/dist/lib/wallet/index.js
DELETED
|
@@ -1,306 +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
|
-
import { Buffer } from 'buffer';
|
|
21
|
-
import { Core } from '@walletconnect/core';
|
|
22
|
-
import { WalletKit } from '@reown/walletkit';
|
|
23
|
-
import { buildApprovedNamespaces, getSdkError } from '@walletconnect/utils';
|
|
24
|
-
import { Wallet as HederaWallet, Client, AccountId } from '@hashgraph/sdk';
|
|
25
|
-
import { HederaChainId, HederaSessionEvent, HederaJsonRpcMethod, base64StringToQuery, Uint8ArrayToBase64String, stringToSignerMessage, signatureMapToBase64String, signerSignaturesToSignatureMap, base64StringToTransaction, getHederaError, } from '../shared';
|
|
26
|
-
import { proto } from '@hashgraph/proto';
|
|
27
|
-
import Provider from './provider';
|
|
28
|
-
export { default as WalletProvider } from './provider';
|
|
29
|
-
/*
|
|
30
|
-
*
|
|
31
|
-
* @see {@link https://github.com/WalletConnect/walletconnect-monorepo/blob/v2.0/packages/web3wallet/src/client.ts}
|
|
32
|
-
*/
|
|
33
|
-
export class HederaWeb3Wallet extends WalletKit {
|
|
34
|
-
/*
|
|
35
|
-
* Set default values for chains, methods, events
|
|
36
|
-
*/
|
|
37
|
-
constructor(opts, chains = Object.values(HederaChainId), methods = Object.values(HederaJsonRpcMethod), sessionEvents = Object.values(HederaSessionEvent)) {
|
|
38
|
-
super(opts);
|
|
39
|
-
this.chains = chains;
|
|
40
|
-
this.methods = methods;
|
|
41
|
-
this.sessionEvents = sessionEvents;
|
|
42
|
-
}
|
|
43
|
-
// wrapper to reduce needing to instantiate Core object on client, also add hedera sensible defaults
|
|
44
|
-
static async create(projectId, metadata, chains, methods, sessionEvents) {
|
|
45
|
-
const wallet = new HederaWeb3Wallet({ core: new Core({ projectId }), metadata }, chains, methods, sessionEvents);
|
|
46
|
-
//https://github.com/WalletConnect/walletconnect-monorepo/blob/14f54684c3d89a5986a68f4dd700a79a958f1604/packages/web3wallet/src/client.ts#L178
|
|
47
|
-
wallet.logger.trace(`Initialized`);
|
|
48
|
-
try {
|
|
49
|
-
await wallet.engine.init();
|
|
50
|
-
wallet.logger.info(`Web3Wallet Initialization Success`);
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
wallet.logger.info(`Web3Wallet Initialization Failure`);
|
|
54
|
-
wallet.logger.error(error.message);
|
|
55
|
-
throw error;
|
|
56
|
-
}
|
|
57
|
-
return wallet;
|
|
58
|
-
}
|
|
59
|
-
/*
|
|
60
|
-
* Hedera Wallet Signer
|
|
61
|
-
*/
|
|
62
|
-
getHederaWallet(chainId, accountId, privateKey, _provider) {
|
|
63
|
-
const network = chainId.split(':')[1];
|
|
64
|
-
const client = Client.forName(network);
|
|
65
|
-
const provider = _provider !== null && _provider !== void 0 ? _provider : new Provider(client);
|
|
66
|
-
return new HederaWallet(accountId, privateKey, provider);
|
|
67
|
-
}
|
|
68
|
-
/*
|
|
69
|
-
* Session proposal
|
|
70
|
-
*/
|
|
71
|
-
async buildAndApproveSession(accounts, { id, params }) {
|
|
72
|
-
// filter to get unique chains
|
|
73
|
-
const chains = accounts
|
|
74
|
-
.map((account) => account.split(':').slice(0, 2).join(':'))
|
|
75
|
-
.filter((x, i, a) => a.indexOf(x) == i);
|
|
76
|
-
return await this.approveSession({
|
|
77
|
-
id,
|
|
78
|
-
namespaces: buildApprovedNamespaces({
|
|
79
|
-
proposal: params,
|
|
80
|
-
supportedNamespaces: {
|
|
81
|
-
hedera: {
|
|
82
|
-
chains,
|
|
83
|
-
methods: this.methods,
|
|
84
|
-
events: this.sessionEvents,
|
|
85
|
-
accounts,
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
}),
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
/*
|
|
92
|
-
* Session Requests
|
|
93
|
-
*/
|
|
94
|
-
validateParam(name, value, expectedType) {
|
|
95
|
-
if (expectedType === 'array' && Array.isArray(value))
|
|
96
|
-
return;
|
|
97
|
-
if (typeof value === expectedType)
|
|
98
|
-
return;
|
|
99
|
-
throw getHederaError('INVALID_PARAMS', `Invalid paramameter value for ${name}, expected ${expectedType} but got ${typeof value}`);
|
|
100
|
-
}
|
|
101
|
-
parseSessionRequest(event,
|
|
102
|
-
// optional arg to throw error if request is invalid, call with shouldThrow = false when calling from rejectSessionRequest as we only need id and top to send reject response
|
|
103
|
-
shouldThrow = true) {
|
|
104
|
-
const { id, topic } = event;
|
|
105
|
-
const { request: { method, params }, chainId, } = event.params;
|
|
106
|
-
let body;
|
|
107
|
-
// get account id from optional second param for transactions and queries or from transaction id
|
|
108
|
-
// this allows for the case where the requested signer is not the payer, but defaults to the payer if a second param is not provided
|
|
109
|
-
let signerAccountId;
|
|
110
|
-
// First test for valid params for each method
|
|
111
|
-
// then convert params to a body that the respective function expects
|
|
112
|
-
try {
|
|
113
|
-
switch (method) {
|
|
114
|
-
case HederaJsonRpcMethod.GetNodeAddresses: {
|
|
115
|
-
// 1
|
|
116
|
-
if (params)
|
|
117
|
-
throw getHederaError('INVALID_PARAMS');
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
case HederaJsonRpcMethod.ExecuteTransaction: {
|
|
121
|
-
// 2
|
|
122
|
-
const { transactionList } = params;
|
|
123
|
-
this.validateParam('transactionList', transactionList, 'string');
|
|
124
|
-
body = base64StringToTransaction(transactionList);
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
case HederaJsonRpcMethod.SignMessage: {
|
|
128
|
-
// 3
|
|
129
|
-
const { signerAccountId: _accountId, message } = params;
|
|
130
|
-
this.validateParam('signerAccountId', _accountId, 'string');
|
|
131
|
-
this.validateParam('message', message, 'string');
|
|
132
|
-
signerAccountId = AccountId.fromString(_accountId.replace(chainId + ':', ''));
|
|
133
|
-
body = message;
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
case HederaJsonRpcMethod.SignAndExecuteQuery: {
|
|
137
|
-
// 4
|
|
138
|
-
const { signerAccountId: _accountId, query } = params;
|
|
139
|
-
this.validateParam('signerAccountId', _accountId, 'string');
|
|
140
|
-
this.validateParam('query', query, 'string');
|
|
141
|
-
signerAccountId = AccountId.fromString(_accountId.replace(chainId + ':', ''));
|
|
142
|
-
body = base64StringToQuery(query);
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
145
|
-
case HederaJsonRpcMethod.SignAndExecuteTransaction: {
|
|
146
|
-
// 5
|
|
147
|
-
const { signerAccountId: _accountId, transactionList } = params;
|
|
148
|
-
this.validateParam('signerAccountId', _accountId, 'string');
|
|
149
|
-
this.validateParam('transactionList', transactionList, 'string');
|
|
150
|
-
signerAccountId = AccountId.fromString(_accountId.replace(chainId + ':', ''));
|
|
151
|
-
body = base64StringToTransaction(transactionList);
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
case HederaJsonRpcMethod.SignTransaction: {
|
|
155
|
-
// 6
|
|
156
|
-
const { signerAccountId: _accountId, transactionBody } = params;
|
|
157
|
-
this.validateParam('signerAccountId', _accountId, 'string');
|
|
158
|
-
this.validateParam('transactionBody', transactionBody, 'string');
|
|
159
|
-
signerAccountId = AccountId.fromString(_accountId.replace(chainId + ':', ''));
|
|
160
|
-
body = Buffer.from(transactionBody, 'base64');
|
|
161
|
-
break;
|
|
162
|
-
}
|
|
163
|
-
default:
|
|
164
|
-
throw getSdkError('INVALID_METHOD');
|
|
165
|
-
}
|
|
166
|
-
// error parsing request params
|
|
167
|
-
}
|
|
168
|
-
catch (e) {
|
|
169
|
-
if (shouldThrow)
|
|
170
|
-
throw e;
|
|
171
|
-
}
|
|
172
|
-
return {
|
|
173
|
-
method: method,
|
|
174
|
-
chainId: chainId,
|
|
175
|
-
id,
|
|
176
|
-
topic,
|
|
177
|
-
body,
|
|
178
|
-
accountId: signerAccountId,
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
async executeSessionRequest(event, hederaWallet) {
|
|
182
|
-
const { method, id, topic, body } = this.parseSessionRequest(event);
|
|
183
|
-
return await this[method](id, topic, body, hederaWallet);
|
|
184
|
-
}
|
|
185
|
-
// https://docs.walletconnect.com/web3wallet/wallet-usage#responding-to-session-requests
|
|
186
|
-
async rejectSessionRequest(event, error) {
|
|
187
|
-
const { id, topic } = this.parseSessionRequest(event, false);
|
|
188
|
-
return await this.respondSessionRequest({
|
|
189
|
-
topic,
|
|
190
|
-
response: { id, error, jsonrpc: '2.0' },
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
/*
|
|
194
|
-
* JSON RPC Methods
|
|
195
|
-
*/
|
|
196
|
-
// 1. hedera_getNodeAddresses
|
|
197
|
-
async hedera_getNodeAddresses(id, topic, _, // ignore this param to be consistent call signature with other functions
|
|
198
|
-
signer) {
|
|
199
|
-
const nodesAccountIds = signer.getNetwork();
|
|
200
|
-
const nodes = Object.values(nodesAccountIds).map((nodeAccountId) => nodeAccountId.toString());
|
|
201
|
-
const response = {
|
|
202
|
-
topic,
|
|
203
|
-
response: {
|
|
204
|
-
jsonrpc: '2.0',
|
|
205
|
-
id,
|
|
206
|
-
result: {
|
|
207
|
-
nodes,
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
};
|
|
211
|
-
return await this.respondSessionRequest(response);
|
|
212
|
-
}
|
|
213
|
-
// 2. hedera_executeTransaction
|
|
214
|
-
async hedera_executeTransaction(id, topic, body, signer) {
|
|
215
|
-
const response = {
|
|
216
|
-
topic,
|
|
217
|
-
response: {
|
|
218
|
-
id,
|
|
219
|
-
result: (await signer.call(body)).toJSON(),
|
|
220
|
-
jsonrpc: '2.0',
|
|
221
|
-
},
|
|
222
|
-
};
|
|
223
|
-
return await this.respondSessionRequest(response);
|
|
224
|
-
}
|
|
225
|
-
// 3. hedera_signMessage
|
|
226
|
-
async hedera_signMessage(id, topic, body, signer) {
|
|
227
|
-
// signer takes an array of Uint8Arrays though spec allows for 1 message to be signed
|
|
228
|
-
const signerSignatures = await signer.sign(stringToSignerMessage(body));
|
|
229
|
-
const _signatureMap = proto.SignatureMap.create(signerSignaturesToSignatureMap(signerSignatures));
|
|
230
|
-
const signatureMap = signatureMapToBase64String(_signatureMap);
|
|
231
|
-
const response = {
|
|
232
|
-
topic,
|
|
233
|
-
response: {
|
|
234
|
-
jsonrpc: '2.0',
|
|
235
|
-
id,
|
|
236
|
-
result: {
|
|
237
|
-
signatureMap,
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
};
|
|
241
|
-
return await this.respondSessionRequest(response);
|
|
242
|
-
}
|
|
243
|
-
// 4. hedera_signAndExecuteQuery
|
|
244
|
-
async hedera_signAndExecuteQuery(id, topic, body, signer) {
|
|
245
|
-
/*
|
|
246
|
-
* Can be used with return values the have a toBytes method implemented
|
|
247
|
-
* For example:
|
|
248
|
-
* https://github.com/hashgraph/hedera-sdk-js/blob/c4438cbaa38074d8bfc934dba84e3b430344ed89/src/account/AccountInfo.js#L402
|
|
249
|
-
*/
|
|
250
|
-
const queryResult = await body.executeWithSigner(signer);
|
|
251
|
-
let queryResponse = '';
|
|
252
|
-
if (Array.isArray(queryResult)) {
|
|
253
|
-
queryResponse = queryResult.map((qr) => Uint8ArrayToBase64String(qr.toBytes())).join(',');
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
queryResponse = Uint8ArrayToBase64String(queryResult.toBytes());
|
|
257
|
-
}
|
|
258
|
-
const response = {
|
|
259
|
-
topic,
|
|
260
|
-
response: {
|
|
261
|
-
jsonrpc: '2.0',
|
|
262
|
-
id,
|
|
263
|
-
result: {
|
|
264
|
-
response: queryResponse,
|
|
265
|
-
},
|
|
266
|
-
},
|
|
267
|
-
};
|
|
268
|
-
return await this.respondSessionRequest(response);
|
|
269
|
-
}
|
|
270
|
-
// 5. hedera_signAndExecuteTransaction
|
|
271
|
-
async hedera_signAndExecuteTransaction(id, topic, body, signer) {
|
|
272
|
-
// check transaction is incomplete (HIP-745)
|
|
273
|
-
if (!body.isFrozen()) {
|
|
274
|
-
// set multiple nodeAccountIds and transactionId if not present
|
|
275
|
-
await body.freezeWithSigner(signer);
|
|
276
|
-
}
|
|
277
|
-
const signedTransaction = await signer.signTransaction(body);
|
|
278
|
-
const response = {
|
|
279
|
-
topic,
|
|
280
|
-
response: {
|
|
281
|
-
id,
|
|
282
|
-
result: (await signer.call(signedTransaction)).toJSON(),
|
|
283
|
-
jsonrpc: '2.0',
|
|
284
|
-
},
|
|
285
|
-
};
|
|
286
|
-
return await this.respondSessionRequest(response);
|
|
287
|
-
}
|
|
288
|
-
// 6. hedera_signTransaction
|
|
289
|
-
async hedera_signTransaction(id, topic, body, signer) {
|
|
290
|
-
const signerSignatures = await signer.sign([body]);
|
|
291
|
-
const _signatureMap = proto.SignatureMap.create(signerSignaturesToSignatureMap(signerSignatures));
|
|
292
|
-
const signatureMap = signatureMapToBase64String(_signatureMap);
|
|
293
|
-
const response = {
|
|
294
|
-
topic,
|
|
295
|
-
response: {
|
|
296
|
-
jsonrpc: '2.0',
|
|
297
|
-
id,
|
|
298
|
-
result: {
|
|
299
|
-
signatureMap,
|
|
300
|
-
},
|
|
301
|
-
},
|
|
302
|
-
};
|
|
303
|
-
return await this.respondSessionRequest(response);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
export default HederaWeb3Wallet;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Client, type AccountId, type Executable, type Provider as HederaWalletProvider, type TransactionId, type TransactionResponse, type TransactionReceipt } from '@hashgraph/sdk';
|
|
2
|
-
export default class Provider implements HederaWalletProvider {
|
|
3
|
-
private client;
|
|
4
|
-
constructor(client: Client);
|
|
5
|
-
static fromClient(client: Client): Provider;
|
|
6
|
-
getLedgerId(): import("@hashgraph/sdk").LedgerId | null;
|
|
7
|
-
getNetwork(): {
|
|
8
|
-
[key: string]: string | AccountId;
|
|
9
|
-
};
|
|
10
|
-
getMirrorNetwork(): string[];
|
|
11
|
-
getAccountBalance(accountId: AccountId | string): Promise<import("@hashgraph/sdk").AccountBalance>;
|
|
12
|
-
getAccountInfo(accountId: AccountId | string): Promise<import("@hashgraph/sdk").AccountInfo>;
|
|
13
|
-
getAccountRecords(accountId: string | AccountId): Promise<import("@hashgraph/sdk").TransactionRecord[]>;
|
|
14
|
-
getTransactionReceipt(transactionId: TransactionId | string): Promise<TransactionReceipt>;
|
|
15
|
-
waitForReceipt(response: TransactionResponse): Promise<TransactionReceipt>;
|
|
16
|
-
call<Request, Response, Output>(request: Executable<Request, Response, Output>): Promise<Output>;
|
|
17
|
-
}
|
|
@@ -1,58 +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
|
-
import { AccountBalanceQuery, AccountInfoQuery, AccountRecordsQuery, TransactionReceiptQuery, } from '@hashgraph/sdk';
|
|
21
|
-
export default class Provider {
|
|
22
|
-
constructor(client) {
|
|
23
|
-
this.client = client;
|
|
24
|
-
}
|
|
25
|
-
static fromClient(client) {
|
|
26
|
-
return new Provider(client);
|
|
27
|
-
}
|
|
28
|
-
getLedgerId() {
|
|
29
|
-
return this.client.ledgerId;
|
|
30
|
-
}
|
|
31
|
-
getNetwork() {
|
|
32
|
-
return this.client.network;
|
|
33
|
-
}
|
|
34
|
-
getMirrorNetwork() {
|
|
35
|
-
return this.client.mirrorNetwork;
|
|
36
|
-
}
|
|
37
|
-
getAccountBalance(accountId) {
|
|
38
|
-
return new AccountBalanceQuery().setAccountId(accountId).execute(this.client);
|
|
39
|
-
}
|
|
40
|
-
getAccountInfo(accountId) {
|
|
41
|
-
return new AccountInfoQuery().setAccountId(accountId).execute(this.client);
|
|
42
|
-
}
|
|
43
|
-
getAccountRecords(accountId) {
|
|
44
|
-
return new AccountRecordsQuery().setAccountId(accountId).execute(this.client);
|
|
45
|
-
}
|
|
46
|
-
getTransactionReceipt(transactionId) {
|
|
47
|
-
return new TransactionReceiptQuery().setTransactionId(transactionId).execute(this.client);
|
|
48
|
-
}
|
|
49
|
-
waitForReceipt(response) {
|
|
50
|
-
return new TransactionReceiptQuery()
|
|
51
|
-
.setNodeAccountIds([response.nodeId])
|
|
52
|
-
.setTransactionId(response.transactionId)
|
|
53
|
-
.execute(this.client);
|
|
54
|
-
}
|
|
55
|
-
call(request) {
|
|
56
|
-
return request.execute(this.client);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { WalletKitTypes } from '@reown/walletkit';
|
|
2
|
-
import type { SessionTypes } from '@walletconnect/types';
|
|
3
|
-
import type { Transaction, Query, AccountId, Wallet as HederaWallet } from '@hashgraph/sdk';
|
|
4
|
-
import type { HederaJsonRpcMethod, HederaChainId } from '../shared';
|
|
5
|
-
import type Provider from './provider';
|
|
6
|
-
export interface HederaNativeWallet {
|
|
7
|
-
buildAndApproveSession(accounts: string[], { id, params }: WalletKitTypes.SessionProposal): Promise<SessionTypes.Struct>;
|
|
8
|
-
parseSessionRequest(event: WalletKitTypes.SessionRequest, shouldThrow: boolean): {
|
|
9
|
-
method: HederaJsonRpcMethod;
|
|
10
|
-
chainId: HederaChainId;
|
|
11
|
-
id: number;
|
|
12
|
-
topic: string;
|
|
13
|
-
body?: Transaction | Query<any> | string | Uint8Array | undefined;
|
|
14
|
-
accountId?: AccountId;
|
|
15
|
-
};
|
|
16
|
-
executeSessionRequest(event: WalletKitTypes.SessionRequest, hederaWallet: HederaWallet): Promise<void>;
|
|
17
|
-
rejectSessionRequest(event: WalletKitTypes.SessionRequest, error: {
|
|
18
|
-
code: number;
|
|
19
|
-
message: string;
|
|
20
|
-
}): Promise<void>;
|
|
21
|
-
getHederaWallet(chainId: HederaChainId, accountId: AccountId | string, privateKey: string, _provider?: Provider): HederaWallet;
|
|
22
|
-
[HederaJsonRpcMethod.GetNodeAddresses](id: number, topic: string, _: any, // ignore this param to be consistent call signature with other functions
|
|
23
|
-
signer: HederaWallet): Promise<void>;
|
|
24
|
-
[HederaJsonRpcMethod.ExecuteTransaction](id: number, topic: string, body: Transaction, signer: HederaWallet): Promise<void>;
|
|
25
|
-
[HederaJsonRpcMethod.SignMessage](id: number, topic: string, body: string, signer: HederaWallet): Promise<void>;
|
|
26
|
-
[HederaJsonRpcMethod.SignAndExecuteQuery](id: number, topic: string, body: Query<any>, signer: HederaWallet): Promise<void>;
|
|
27
|
-
[HederaJsonRpcMethod.SignAndExecuteTransaction](id: number, topic: string, body: Transaction, signer: HederaWallet): Promise<void>;
|
|
28
|
-
[HederaJsonRpcMethod.SignTransaction](id: number, topic: string, body: Uint8Array, signer: HederaWallet): Promise<void>;
|
|
29
|
-
}
|
|
30
|
-
export interface HederaEvmCompatibleWallet {
|
|
31
|
-
}
|
package/dist/lib/wallet/types.js
DELETED
|
@@ -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 {};
|
package/dist/reown/adapter.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { CaipNetwork } from '@reown/appkit';
|
|
2
|
-
import { type ChainNamespace } from '@reown/appkit-common';
|
|
3
|
-
import { AdapterBlueprint } from '@reown/appkit-controllers';
|
|
4
|
-
type UniversalProvider = Parameters<AdapterBlueprint['setUniversalProvider']>[0];
|
|
5
|
-
type AdapterSendTransactionParams = AdapterBlueprint.SendTransactionParams & {
|
|
6
|
-
address: string;
|
|
7
|
-
};
|
|
8
|
-
type GetEnsAddressParams = {
|
|
9
|
-
name: string;
|
|
10
|
-
caipNetwork?: CaipNetwork;
|
|
11
|
-
};
|
|
12
|
-
type GetEnsAddressResult = {
|
|
13
|
-
address: string | false;
|
|
14
|
-
};
|
|
15
|
-
type GetProfileResult = {
|
|
16
|
-
profileImage: string;
|
|
17
|
-
profileName: string;
|
|
18
|
-
};
|
|
19
|
-
export declare class HederaAdapter extends AdapterBlueprint {
|
|
20
|
-
private logger;
|
|
21
|
-
constructor(params: HederaAdapter.Params);
|
|
22
|
-
setUniversalProvider(universalProvider: UniversalProvider): Promise<void>;
|
|
23
|
-
connect(params: AdapterBlueprint.ConnectParams): Promise<AdapterBlueprint.ConnectResult>;
|
|
24
|
-
disconnect(_params?: AdapterBlueprint.DisconnectParams): Promise<AdapterBlueprint.DisconnectResult>;
|
|
25
|
-
getAccounts({ namespace, }: AdapterBlueprint.GetAccountsParams & {
|
|
26
|
-
namespace: ChainNamespace;
|
|
27
|
-
}): Promise<AdapterBlueprint.GetAccountsResult>;
|
|
28
|
-
syncConnectors(): Promise<void>;
|
|
29
|
-
syncConnections(_params: AdapterBlueprint.SyncConnectionsParams): Promise<void>;
|
|
30
|
-
getBalance(params: AdapterBlueprint.GetBalanceParams): Promise<AdapterBlueprint.GetBalanceResult>;
|
|
31
|
-
signMessage(params: AdapterBlueprint.SignMessageParams): Promise<AdapterBlueprint.SignMessageResult>;
|
|
32
|
-
estimateGas(params: AdapterBlueprint.EstimateGasTransactionArgs): Promise<AdapterBlueprint.EstimateGasTransactionResult>;
|
|
33
|
-
sendTransaction(params: AdapterSendTransactionParams): Promise<AdapterBlueprint.SendTransactionResult>;
|
|
34
|
-
writeContract(params: AdapterBlueprint.WriteContractParams): Promise<AdapterBlueprint.WriteContractResult>;
|
|
35
|
-
getEnsAddress(params: GetEnsAddressParams): Promise<GetEnsAddressResult>;
|
|
36
|
-
parseUnits(params: AdapterBlueprint.ParseUnitsParams): AdapterBlueprint.ParseUnitsResult;
|
|
37
|
-
formatUnits(params: AdapterBlueprint.FormatUnitsParams): AdapterBlueprint.FormatUnitsResult;
|
|
38
|
-
getCapabilities(params: AdapterBlueprint.GetCapabilitiesParams): Promise<unknown>;
|
|
39
|
-
getProfile(): Promise<GetProfileResult>;
|
|
40
|
-
grantPermissions(): Promise<unknown>;
|
|
41
|
-
revokePermissions(): Promise<`0x${string}`>;
|
|
42
|
-
syncConnection(params: AdapterBlueprint.SyncConnectionParams): Promise<{
|
|
43
|
-
id: string;
|
|
44
|
-
type: "WALLET_CONNECT";
|
|
45
|
-
chainId: string | number;
|
|
46
|
-
provider: UniversalProvider;
|
|
47
|
-
address: string;
|
|
48
|
-
}>;
|
|
49
|
-
switchNetwork(params: AdapterBlueprint.SwitchNetworkParams): Promise<void>;
|
|
50
|
-
protected getWalletConnectConnector(): ReturnType<AdapterBlueprint['getWalletConnectConnector']>;
|
|
51
|
-
getWalletConnectProvider(): UniversalProvider;
|
|
52
|
-
walletGetAssets(_params: AdapterBlueprint.WalletGetAssetsParams): Promise<AdapterBlueprint.WalletGetAssetsResponse>;
|
|
53
|
-
}
|
|
54
|
-
export declare namespace HederaAdapter {
|
|
55
|
-
type Params = AdapterBlueprint.Params & {
|
|
56
|
-
namespaceMode?: 'optional' | 'required';
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
export {};
|