@hashgraph/hedera-wallet-connect 2.0.1-canary.7e04cff.0 → 2.0.1-canary.8bde0e3.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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/dapp/DAppSigner.d.ts +2 -0
- package/dist/lib/dapp/DAppSigner.js +16 -2
- package/dist/lib/dapp/index.d.ts +7 -5
- package/dist/lib/dapp/index.js +36 -4
- package/dist/lib/shared/accountInfo.d.ts +30 -0
- package/dist/lib/shared/accountInfo.js +1 -0
- package/dist/lib/shared/index.d.ts +2 -0
- package/dist/lib/shared/index.js +2 -0
- package/dist/lib/shared/mirrorNode.d.ts +3 -0
- package/dist/lib/shared/mirrorNode.js +17 -0
- package/dist/lib/shared/payloads.d.ts +1 -1
- package/dist/lib/shared/utils.d.ts +1 -2
- package/dist/lib/shared/utils.js +2 -3
- package/dist/reown/adapter.d.ts +37 -0
- package/dist/reown/adapter.js +255 -0
- package/dist/reown/connectors/HederaConnector.d.ts +29 -0
- package/dist/reown/connectors/HederaConnector.js +35 -0
- package/dist/reown/connectors/index.d.ts +1 -0
- package/dist/reown/connectors/index.js +1 -0
- package/dist/reown/index.d.ts +4 -0
- package/dist/reown/index.js +4 -0
- package/dist/reown/providers/EIP155Provider.d.ts +33 -0
- package/dist/reown/providers/EIP155Provider.js +187 -0
- package/dist/reown/providers/HIP820Provider.d.ts +26 -0
- package/dist/reown/providers/HIP820Provider.js +69 -0
- package/dist/reown/providers/HederaProvider.d.ts +164 -0
- package/dist/reown/providers/HederaProvider.js +471 -0
- package/dist/reown/providers/index.d.ts +3 -0
- package/dist/reown/providers/index.js +3 -0
- package/dist/reown/utils/chains.d.ts +18 -0
- package/dist/reown/utils/chains.js +152 -0
- package/dist/reown/utils/constants.d.ts +16 -0
- package/dist/reown/utils/constants.js +18 -0
- package/dist/reown/utils/helpers.d.ts +12 -0
- package/dist/reown/utils/helpers.js +25 -0
- package/dist/reown/utils/index.d.ts +4 -0
- package/dist/reown/utils/index.js +4 -0
- package/dist/reown/utils/types.d.ts +9 -0
- package/dist/reown/utils/types.js +1 -0
- package/dist/reown/wallets/EIP155Wallet.d.ts +46 -0
- package/dist/reown/wallets/EIP155Wallet.js +124 -0
- package/dist/reown/wallets/HIP820Wallet.d.ts +53 -0
- package/dist/reown/wallets/HIP820Wallet.js +236 -0
- package/dist/reown/wallets/index.d.ts +2 -0
- package/dist/reown/wallets/index.js +2 -0
- package/package.json +5 -3
@@ -0,0 +1 @@
|
|
1
|
+
export * from './HederaConnector';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './HederaConnector';
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { EventEmitter } from 'events';
|
2
|
+
import Client from '@walletconnect/sign-client';
|
3
|
+
import { SessionTypes } from '@walletconnect/types';
|
4
|
+
import { IProvider, SessionNamespace, RpcProvidersMap, RequestParams, Namespace } from '@walletconnect/universal-provider';
|
5
|
+
declare class EIP155Provider implements IProvider {
|
6
|
+
name: string;
|
7
|
+
client: Client;
|
8
|
+
chainId: number;
|
9
|
+
namespace: SessionNamespace;
|
10
|
+
httpProviders: RpcProvidersMap;
|
11
|
+
events: EventEmitter;
|
12
|
+
constructor({ client, events, namespace, }: {
|
13
|
+
client: IProvider['client'];
|
14
|
+
events: EventEmitter;
|
15
|
+
namespace: Namespace;
|
16
|
+
});
|
17
|
+
request<T = unknown>(args: RequestParams): Promise<T>;
|
18
|
+
updateNamespace(namespace: SessionTypes.Namespace): void;
|
19
|
+
setDefaultChain(chainId: string, rpcUrl?: string | undefined): void;
|
20
|
+
requestAccounts(): string[];
|
21
|
+
getDefaultChain(): string;
|
22
|
+
private createHttpProvider;
|
23
|
+
private setHttpProvider;
|
24
|
+
private createHttpProviders;
|
25
|
+
private getAccounts;
|
26
|
+
private getHttpProvider;
|
27
|
+
private switchChain;
|
28
|
+
private isChainApproved;
|
29
|
+
private getCallStatus;
|
30
|
+
private getUserOperationReceipt;
|
31
|
+
private getBundlerUrl;
|
32
|
+
}
|
33
|
+
export default EIP155Provider;
|
@@ -0,0 +1,187 @@
|
|
1
|
+
import { JsonRpcProvider } from '@walletconnect/jsonrpc-provider';
|
2
|
+
import { HttpConnection } from '@walletconnect/jsonrpc-http-connection';
|
3
|
+
import { formatJsonRpcRequest } from '@walletconnect/jsonrpc-utils';
|
4
|
+
import { BUNDLER_URL, getChainId, HederaChainDefinition } from '../utils';
|
5
|
+
class EIP155Provider {
|
6
|
+
constructor({ client, events, namespace, }) {
|
7
|
+
this.name = 'eip155';
|
8
|
+
this.namespace = namespace;
|
9
|
+
this.events = events;
|
10
|
+
this.client = client;
|
11
|
+
this.httpProviders = this.createHttpProviders();
|
12
|
+
this.chainId = parseInt(this.getDefaultChain());
|
13
|
+
}
|
14
|
+
async request(args) {
|
15
|
+
switch (args.request.method) {
|
16
|
+
case 'eth_requestAccounts':
|
17
|
+
return this.getAccounts();
|
18
|
+
case 'eth_accounts':
|
19
|
+
return this.getAccounts();
|
20
|
+
case 'wallet_switchEthereumChain': {
|
21
|
+
return (await this.switchChain(args));
|
22
|
+
}
|
23
|
+
case 'eth_chainId':
|
24
|
+
return parseInt(this.getDefaultChain());
|
25
|
+
case 'wallet_getCallsStatus':
|
26
|
+
return (await this.getCallStatus(args));
|
27
|
+
default:
|
28
|
+
break;
|
29
|
+
}
|
30
|
+
if (this.namespace.methods.includes(args.request.method)) {
|
31
|
+
return await this.client.request(args);
|
32
|
+
}
|
33
|
+
return this.getHttpProvider().request(args.request);
|
34
|
+
}
|
35
|
+
updateNamespace(namespace) {
|
36
|
+
this.namespace = Object.assign(this.namespace, namespace);
|
37
|
+
}
|
38
|
+
setDefaultChain(chainId, rpcUrl) {
|
39
|
+
// http provider exists so just set the chainId
|
40
|
+
if (!this.httpProviders[chainId]) {
|
41
|
+
this.setHttpProvider(parseInt(chainId), rpcUrl);
|
42
|
+
}
|
43
|
+
this.chainId = parseInt(chainId);
|
44
|
+
this.events.emit('default_chain_changed', `${this.name}:${chainId}`);
|
45
|
+
}
|
46
|
+
requestAccounts() {
|
47
|
+
return this.getAccounts();
|
48
|
+
}
|
49
|
+
getDefaultChain() {
|
50
|
+
if (this.chainId)
|
51
|
+
return this.chainId.toString();
|
52
|
+
if (this.namespace.defaultChain)
|
53
|
+
return this.namespace.defaultChain;
|
54
|
+
const chainId = this.namespace.chains[0];
|
55
|
+
if (!chainId)
|
56
|
+
throw new Error(`ChainId not found`);
|
57
|
+
return chainId.split(':')[1];
|
58
|
+
}
|
59
|
+
// ---------- Private ----------------------------------------------- //
|
60
|
+
createHttpProvider(chainId, rpcUrl) {
|
61
|
+
if (!chainId)
|
62
|
+
return undefined;
|
63
|
+
const { Testnet, Mainnet } = HederaChainDefinition.EVM;
|
64
|
+
const caipNetwork = [Mainnet, Testnet].find((network) => network.id == chainId);
|
65
|
+
const rpc = (caipNetwork === null || caipNetwork === void 0 ? void 0 : caipNetwork.rpcUrls.default.http[0]) || rpcUrl;
|
66
|
+
if (!rpc) {
|
67
|
+
throw new Error(`No RPC url provided for chainId: ${chainId}`);
|
68
|
+
}
|
69
|
+
const http = new JsonRpcProvider(new HttpConnection(rpc, false));
|
70
|
+
return http;
|
71
|
+
}
|
72
|
+
setHttpProvider(chainId, rpcUrl) {
|
73
|
+
const http = this.createHttpProvider(chainId, rpcUrl);
|
74
|
+
if (http) {
|
75
|
+
this.httpProviders[chainId] = http;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
createHttpProviders() {
|
79
|
+
const http = {};
|
80
|
+
this.namespace.chains.forEach((chain) => {
|
81
|
+
var _a;
|
82
|
+
const parsedChain = parseInt(getChainId(chain));
|
83
|
+
http[parsedChain] = this.createHttpProvider(parsedChain, (_a = this.namespace.rpcMap) === null || _a === void 0 ? void 0 : _a[chain]);
|
84
|
+
});
|
85
|
+
return http;
|
86
|
+
}
|
87
|
+
getAccounts() {
|
88
|
+
const accounts = this.namespace.accounts;
|
89
|
+
if (!accounts) {
|
90
|
+
return [];
|
91
|
+
}
|
92
|
+
return Array.from(new Set(accounts
|
93
|
+
.filter((account) => account.split(':')[1] === this.chainId.toString())
|
94
|
+
.map((account) => account.split(':')[2])));
|
95
|
+
}
|
96
|
+
getHttpProvider() {
|
97
|
+
const chain = this.chainId;
|
98
|
+
const http = this.httpProviders[chain];
|
99
|
+
if (typeof http === 'undefined') {
|
100
|
+
throw new Error(`JSON-RPC provider for ${chain} not found`);
|
101
|
+
}
|
102
|
+
return http;
|
103
|
+
}
|
104
|
+
async switchChain(args) {
|
105
|
+
var _a, _b;
|
106
|
+
let hexChainId = args.request.params
|
107
|
+
? (_a = args.request.params[0]) === null || _a === void 0 ? void 0 : _a.chainId
|
108
|
+
: '0x0';
|
109
|
+
hexChainId = hexChainId.startsWith('0x') ? hexChainId : `0x${hexChainId}`;
|
110
|
+
const parsedChainId = parseInt(hexChainId, 16);
|
111
|
+
// if chainId is already approved, switch locally
|
112
|
+
if (this.isChainApproved(parsedChainId)) {
|
113
|
+
this.setDefaultChain(`${parsedChainId}`);
|
114
|
+
}
|
115
|
+
else if (this.namespace.methods.includes('wallet_switchEthereumChain')) {
|
116
|
+
// try to switch chain within the wallet
|
117
|
+
await this.client.request({
|
118
|
+
topic: args.topic,
|
119
|
+
request: {
|
120
|
+
method: args.request.method,
|
121
|
+
params: [
|
122
|
+
{
|
123
|
+
chainId: hexChainId,
|
124
|
+
},
|
125
|
+
],
|
126
|
+
},
|
127
|
+
chainId: (_b = this.namespace.chains) === null || _b === void 0 ? void 0 : _b[0], // Sending a previously unapproved chainId will cause namespace validation failure so we must set request chainId to the first chainId in the namespace to avoid it
|
128
|
+
});
|
129
|
+
this.setDefaultChain(`${parsedChainId}`);
|
130
|
+
}
|
131
|
+
else {
|
132
|
+
throw new Error(`Failed to switch to chain 'eip155:${parsedChainId}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);
|
133
|
+
}
|
134
|
+
return null;
|
135
|
+
}
|
136
|
+
isChainApproved(chainId) {
|
137
|
+
return this.namespace.chains.includes(`${this.name}:${chainId}`);
|
138
|
+
}
|
139
|
+
async getCallStatus(args) {
|
140
|
+
var _a, _b;
|
141
|
+
const session = this.client.session.get(args.topic);
|
142
|
+
const bundlerName = (_a = session.sessionProperties) === null || _a === void 0 ? void 0 : _a.bundler_name;
|
143
|
+
if (bundlerName) {
|
144
|
+
const bundlerUrl = this.getBundlerUrl(args.chainId, bundlerName);
|
145
|
+
try {
|
146
|
+
return await this.getUserOperationReceipt(bundlerUrl, args);
|
147
|
+
}
|
148
|
+
catch (error) {
|
149
|
+
console.warn('Failed to fetch call status from bundler', error, bundlerUrl);
|
150
|
+
}
|
151
|
+
}
|
152
|
+
const customUrl = (_b = session.sessionProperties) === null || _b === void 0 ? void 0 : _b.bundler_url;
|
153
|
+
if (customUrl) {
|
154
|
+
try {
|
155
|
+
return await this.getUserOperationReceipt(customUrl, args);
|
156
|
+
}
|
157
|
+
catch (error) {
|
158
|
+
console.warn('Failed to fetch call status from custom bundler', error, customUrl);
|
159
|
+
}
|
160
|
+
}
|
161
|
+
if (this.namespace.methods.includes(args.request.method)) {
|
162
|
+
return await this.client.request(args);
|
163
|
+
}
|
164
|
+
throw new Error('Fetching call status not approved by the wallet.');
|
165
|
+
}
|
166
|
+
async getUserOperationReceipt(bundlerUrl, args) {
|
167
|
+
var _a, _b;
|
168
|
+
const url = new URL(bundlerUrl);
|
169
|
+
const response = await fetch(url, {
|
170
|
+
method: 'POST',
|
171
|
+
headers: {
|
172
|
+
'Content-Type': 'application/json',
|
173
|
+
},
|
174
|
+
body: JSON.stringify(formatJsonRpcRequest('eth_getUserOperationReceipt', [
|
175
|
+
(_b = (_a = args.request) === null || _a === void 0 ? void 0 : _a.params) === null || _b === void 0 ? void 0 : _b[0],
|
176
|
+
])),
|
177
|
+
});
|
178
|
+
if (!response.ok) {
|
179
|
+
throw new Error(`Failed to fetch user operation receipt - ${response.status}`);
|
180
|
+
}
|
181
|
+
return await response.json();
|
182
|
+
}
|
183
|
+
getBundlerUrl(cap2ChainId, bundlerName) {
|
184
|
+
return `${BUNDLER_URL}?projectId=${this.client.core.projectId}&chainId=${cap2ChainId}&bundler=${bundlerName}`;
|
185
|
+
}
|
186
|
+
}
|
187
|
+
export default EIP155Provider;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { EventEmitter } from 'events';
|
2
|
+
import { DAppSigner } from '../..';
|
3
|
+
import { SessionNamespace, RequestParams, IProvider } from '@walletconnect/universal-provider';
|
4
|
+
import { SessionTypes } from '@walletconnect/types';
|
5
|
+
import { Transaction } from '@hashgraph/sdk';
|
6
|
+
declare class HIP820Provider implements IProvider {
|
7
|
+
events: EventEmitter;
|
8
|
+
client: IProvider['client'];
|
9
|
+
namespace: SessionNamespace;
|
10
|
+
chainId: string;
|
11
|
+
constructor(opts: {
|
12
|
+
namespace: SessionNamespace;
|
13
|
+
client: IProvider['client'];
|
14
|
+
events: EventEmitter;
|
15
|
+
});
|
16
|
+
get httpProviders(): {};
|
17
|
+
updateNamespace(namespace: SessionTypes.Namespace): void;
|
18
|
+
request<T = unknown>(args: RequestParams): Promise<T>;
|
19
|
+
signTransaction<T extends Transaction>(transaction: T, topic: string): Promise<T>;
|
20
|
+
requestAccounts(): string[];
|
21
|
+
setDefaultChain(chainId: string): void;
|
22
|
+
getDefaultChain(): string;
|
23
|
+
getSigner(topic: string): DAppSigner;
|
24
|
+
getSigners(topic: string): DAppSigner[];
|
25
|
+
}
|
26
|
+
export default HIP820Provider;
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import { CAIPChainIdToLedgerId, DAppSigner } from '../..';
|
2
|
+
import { AccountId } from '@hashgraph/sdk';
|
3
|
+
class HIP820Provider {
|
4
|
+
constructor(opts) {
|
5
|
+
this.namespace = opts.namespace;
|
6
|
+
this.chainId = this.getDefaultChain();
|
7
|
+
this.events = opts.events;
|
8
|
+
this.client = opts.client;
|
9
|
+
}
|
10
|
+
get httpProviders() {
|
11
|
+
return {};
|
12
|
+
}
|
13
|
+
updateNamespace(namespace) {
|
14
|
+
this.namespace = Object.assign(this.namespace, namespace);
|
15
|
+
}
|
16
|
+
request(args) {
|
17
|
+
return this.getSigner(args.topic).request({
|
18
|
+
method: args.request.method,
|
19
|
+
params: args.request.params,
|
20
|
+
});
|
21
|
+
}
|
22
|
+
async signTransaction(transaction, topic) {
|
23
|
+
return this.getSigner(topic).signTransaction(transaction);
|
24
|
+
}
|
25
|
+
requestAccounts() {
|
26
|
+
const accounts = this.namespace.accounts;
|
27
|
+
if (!accounts) {
|
28
|
+
return [];
|
29
|
+
}
|
30
|
+
return Array.from(new Set(accounts
|
31
|
+
// get the accounts from the active chain
|
32
|
+
.filter((account) => account.split(':')[1] === this.chainId.toString())
|
33
|
+
// remove namespace & chainId from the string
|
34
|
+
.map((account) => account.split(':')[2])));
|
35
|
+
}
|
36
|
+
setDefaultChain(chainId) {
|
37
|
+
this.chainId = chainId;
|
38
|
+
this.namespace.defaultChain = chainId;
|
39
|
+
}
|
40
|
+
getDefaultChain() {
|
41
|
+
if (this.chainId)
|
42
|
+
return this.chainId;
|
43
|
+
if (this.namespace.defaultChain)
|
44
|
+
return this.namespace.defaultChain;
|
45
|
+
const chainId = this.namespace.chains[0];
|
46
|
+
if (!chainId)
|
47
|
+
throw new Error(`ChainId not found`);
|
48
|
+
return chainId.split(':')[1];
|
49
|
+
}
|
50
|
+
// create signer on demand
|
51
|
+
getSigner(topic) {
|
52
|
+
return this.getSigners(topic)[0];
|
53
|
+
}
|
54
|
+
getSigners(topic) {
|
55
|
+
var _a;
|
56
|
+
const accounts = (_a = this.namespace.accounts) === null || _a === void 0 ? void 0 : _a.map((account) => {
|
57
|
+
const [chain, network, acc] = account.split(':');
|
58
|
+
return {
|
59
|
+
ledgerId: CAIPChainIdToLedgerId(`${chain}:${network}`),
|
60
|
+
accountId: AccountId.fromString(acc),
|
61
|
+
};
|
62
|
+
});
|
63
|
+
if (!accounts) {
|
64
|
+
throw new Error('Accounts not found');
|
65
|
+
}
|
66
|
+
return accounts.map(({ accountId, ledgerId }) => new DAppSigner(accountId, this.client, topic, ledgerId));
|
67
|
+
}
|
68
|
+
}
|
69
|
+
export default HIP820Provider;
|
@@ -0,0 +1,164 @@
|
|
1
|
+
import { TransactionRequest } from 'ethers';
|
2
|
+
import { CaipNetwork, RequestArguments } from '@reown/appkit';
|
3
|
+
import type { EstimateGasTransactionArgs, SendTransactionArgs, WriteContractArgs } from '@reown/appkit';
|
4
|
+
import UniversalProvider, { RpcProviderMap, UniversalProviderOpts } from '@walletconnect/universal-provider';
|
5
|
+
import { Transaction } from '@hashgraph/sdk';
|
6
|
+
import { ExecuteTransactionParams, SignMessageParams, SignAndExecuteQueryParams, SignAndExecuteTransactionParams, SignTransactionParams } from '../..';
|
7
|
+
import { EthFilter } from '../utils';
|
8
|
+
import HIP820Provider from './HIP820Provider';
|
9
|
+
import EIP155Provider from './EIP155Provider';
|
10
|
+
export type HederaWalletConnectProviderConfig = {
|
11
|
+
chains: CaipNetwork[];
|
12
|
+
} & UniversalProviderOpts;
|
13
|
+
export declare class HederaProvider extends UniversalProvider {
|
14
|
+
nativeProvider?: HIP820Provider;
|
15
|
+
eip155Provider?: EIP155Provider;
|
16
|
+
constructor(opts: UniversalProviderOpts);
|
17
|
+
static init(opts: UniversalProviderOpts): Promise<HederaProvider>;
|
18
|
+
emit(event: string, data?: unknown): void;
|
19
|
+
getAccountAddresses(): string[];
|
20
|
+
request<T = unknown>(args: RequestArguments, chain?: string | undefined, expiry?: number | undefined): Promise<T>;
|
21
|
+
/**
|
22
|
+
* Retrieves the node addresses associated with the current Hedera network.
|
23
|
+
*
|
24
|
+
* When there is no active session or an error occurs during the request.
|
25
|
+
* @returns Promise\<{@link GetNodeAddressesResult}\>
|
26
|
+
*/
|
27
|
+
hedera_getNodeAddresses(): Promise<{
|
28
|
+
nodes: string[];
|
29
|
+
}>;
|
30
|
+
/**
|
31
|
+
* Executes a transaction on the Hedera network.
|
32
|
+
*
|
33
|
+
* @param {ExecuteTransactionParams} params - The parameters of type {@link ExecuteTransactionParams | `ExecuteTransactionParams`} required for the transaction execution.
|
34
|
+
* @param {string[]} params.signedTransaction - Array of Base64-encoded `Transaction`'s
|
35
|
+
* @returns Promise\<{@link ExecuteTransactionResult}\>
|
36
|
+
* @example
|
37
|
+
* Use helper `transactionToBase64String` to encode `Transaction` to Base64 string
|
38
|
+
* ```ts
|
39
|
+
* const params = {
|
40
|
+
* signedTransaction: [transactionToBase64String(transaction)]
|
41
|
+
* }
|
42
|
+
*
|
43
|
+
* const result = await dAppConnector.executeTransaction(params)
|
44
|
+
* ```
|
45
|
+
*/
|
46
|
+
hedera_executeTransaction(params: ExecuteTransactionParams): Promise<import("@hashgraph/sdk/lib/transaction/TransactionResponse").TransactionResponseJSON>;
|
47
|
+
/**
|
48
|
+
* Signs a provided `message` with provided `signerAccountId`.
|
49
|
+
*
|
50
|
+
* @param {SignMessageParams} params - The parameters of type {@link SignMessageParams | `SignMessageParams`} required for signing message.
|
51
|
+
* @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.
|
52
|
+
* @param {string} params.message - a plain UTF-8 string
|
53
|
+
* @returns Promise\<{@link SignMessageResult}\>
|
54
|
+
* @example
|
55
|
+
* ```ts
|
56
|
+
* const params = {
|
57
|
+
* signerAccountId: 'hedera:testnet:0.0.12345',
|
58
|
+
* message: 'Hello World!'
|
59
|
+
* }
|
60
|
+
*
|
61
|
+
* const result = await dAppConnector.signMessage(params)
|
62
|
+
* ```
|
63
|
+
*/
|
64
|
+
hedera_signMessage(params: SignMessageParams): Promise<{
|
65
|
+
signatureMap: string;
|
66
|
+
}>;
|
67
|
+
/**
|
68
|
+
* Signs and send `Query` on the Hedera network.
|
69
|
+
*
|
70
|
+
* @param {SignAndExecuteQueryParams} params - The parameters of type {@link SignAndExecuteQueryParams | `SignAndExecuteQueryParams`} required for the Query execution.
|
71
|
+
* @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.
|
72
|
+
* @param {string} params.query - `Query` object represented as Base64 string
|
73
|
+
* @returns Promise\<{@link SignAndExecuteQueryResult}\>
|
74
|
+
* @example
|
75
|
+
* Use helper `queryToBase64String` to encode `Query` to Base64 string
|
76
|
+
* ```ts
|
77
|
+
* const params = {
|
78
|
+
* signerAccountId: '0.0.12345',
|
79
|
+
* query: queryToBase64String(query),
|
80
|
+
* }
|
81
|
+
*
|
82
|
+
* const result = await dAppConnector.signAndExecuteQuery(params)
|
83
|
+
* ```
|
84
|
+
*/
|
85
|
+
hedera_signAndExecuteQuery(params: SignAndExecuteQueryParams): Promise<{
|
86
|
+
response: string;
|
87
|
+
}>;
|
88
|
+
/**
|
89
|
+
* Signs and executes Transactions on the Hedera network.
|
90
|
+
*
|
91
|
+
* @param {SignAndExecuteTransactionParams} params - The parameters of type {@link SignAndExecuteTransactionParams | `SignAndExecuteTransactionParams`} required for `Transaction` signing and execution.
|
92
|
+
* @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.
|
93
|
+
* @param {string[]} params.transaction - Array of Base64-encoded `Transaction`'s
|
94
|
+
* @returns Promise\<{@link SignAndExecuteTransactionResult}\>
|
95
|
+
* @example
|
96
|
+
* Use helper `transactionToBase64String` to encode `Transaction` to Base64 string
|
97
|
+
* ```ts
|
98
|
+
* const params = {
|
99
|
+
* signerAccountId: '0.0.12345'
|
100
|
+
* transaction: [transactionToBase64String(transaction)]
|
101
|
+
* }
|
102
|
+
*
|
103
|
+
* const result = await dAppConnector.signAndExecuteTransaction(params)
|
104
|
+
* ```
|
105
|
+
*/
|
106
|
+
hedera_signAndExecuteTransaction(params: SignAndExecuteTransactionParams): Promise<import("@hashgraph/sdk/lib/transaction/TransactionResponse").TransactionResponseJSON>;
|
107
|
+
/**
|
108
|
+
* Signs and executes Transactions on the Hedera network.
|
109
|
+
*
|
110
|
+
* @param {SignTransactionParams} params - The parameters of type {@link SignTransactionParams | `SignTransactionParams`} required for `Transaction` signing.
|
111
|
+
* @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.
|
112
|
+
* @param {Transaction} params.transactionBody - a Transaction object built with the @hgraph/sdk
|
113
|
+
* @returns Promise\<{@link SignTransactionResult}\>
|
114
|
+
* @example
|
115
|
+
* ```ts
|
116
|
+
*
|
117
|
+
* const params = {
|
118
|
+
* signerAccountId: '0.0.12345',
|
119
|
+
* transactionBody
|
120
|
+
* }
|
121
|
+
*
|
122
|
+
* const result = await dAppConnector.signTransaction(params)
|
123
|
+
* ```
|
124
|
+
*/
|
125
|
+
hedera_signTransaction(params: SignTransactionParams): Promise<Transaction>;
|
126
|
+
eth_signMessage(message: string, address: string): Promise<`0x${string}`>;
|
127
|
+
eth_estimateGas(data: EstimateGasTransactionArgs, address: string, networkId: number): Promise<bigint>;
|
128
|
+
eth_sendTransaction(data: SendTransactionArgs, address: string, networkId: number): Promise<`0x${string}`>;
|
129
|
+
eth_writeContract(data: WriteContractArgs, address: string, chainId: number): Promise<string>;
|
130
|
+
eth_blockNumber(): Promise<string>;
|
131
|
+
eth_call(tx: TransactionRequest, block?: string): Promise<string>;
|
132
|
+
eth_feeHistory(blockCount: number, newestBlock: string, rewardPercentiles: number[]): Promise<string>;
|
133
|
+
eth_gasPrice(): Promise<string>;
|
134
|
+
eth_getBlockByHash(hash: string, fullTx?: boolean): Promise<string>;
|
135
|
+
eth_getBlockByNumber(block: string, fullTx?: boolean): Promise<unknown>;
|
136
|
+
eth_getBlockTransactionCountByHash(hash: string): Promise<string>;
|
137
|
+
eth_getBlockTransactionCountByNumber(block: string): Promise<string>;
|
138
|
+
eth_getCode(address: string, block?: string): Promise<string>;
|
139
|
+
eth_getFilterLogs(filterId: string): Promise<string>;
|
140
|
+
eth_getFilterChanges(filterId: string): Promise<string>;
|
141
|
+
eth_getLogs(filter: EthFilter): Promise<string>;
|
142
|
+
eth_getStorageAt(address: string, position: string, block?: string): Promise<string>;
|
143
|
+
eth_getTransactionByBlockHashAndIndex(hash: string, index: string): Promise<string>;
|
144
|
+
eth_getTransactionByBlockNumberAndIndex(block: string, index: string): Promise<string>;
|
145
|
+
eth_getTransactionByHash(hash: string): Promise<string>;
|
146
|
+
eth_getTransactionCount(address: string, block?: string): Promise<string>;
|
147
|
+
eth_getTransactionReceipt(hash: string): Promise<string>;
|
148
|
+
eth_hashrate(): Promise<string>;
|
149
|
+
eth_maxPriorityFeePerGas(): Promise<string>;
|
150
|
+
eth_mining(): Promise<string>;
|
151
|
+
eth_newBlockFilter(): Promise<string>;
|
152
|
+
eth_newFilter(filter: EthFilter): Promise<string>;
|
153
|
+
eth_submitWork(params: string[]): Promise<string>;
|
154
|
+
eth_syncing(): Promise<string>;
|
155
|
+
eth_uninstallFilter(filterId: string): Promise<string>;
|
156
|
+
net_listening(): Promise<string>;
|
157
|
+
net_version(): Promise<string>;
|
158
|
+
web3_clientVersion(): Promise<string>;
|
159
|
+
eth_chainId(): Promise<string>;
|
160
|
+
pair(pairingTopic: string | undefined): ReturnType<UniversalProvider['pair']>;
|
161
|
+
private initProviders;
|
162
|
+
get rpcProviders(): RpcProviderMap;
|
163
|
+
set rpcProviders(_: RpcProviderMap);
|
164
|
+
}
|