@hashgraph/hedera-wallet-connect 1.5.2-canary.aef7dea.0 → 1.5.2-canary.b168279.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.
@@ -16,7 +16,6 @@ export declare class DAppSigner implements Signer {
16
16
  setLogLevel(level: LogLevel): void;
17
17
  private _getHederaClient;
18
18
  private get _signerAccountId();
19
- private _getRandomNodes;
20
19
  request<T>(request: {
21
20
  method: string;
22
21
  params: any;
@@ -17,7 +17,7 @@
17
17
  * limitations under the License.
18
18
  *
19
19
  */
20
- import { AccountBalance, AccountId, AccountInfo, LedgerId, SignerSignature, Transaction, TransactionRecord, Client, PublicKey, TransactionId, TransactionResponse, Query, AccountRecordsQuery, AccountInfoQuery, AccountBalanceQuery, TransactionReceiptQuery, TransactionReceipt, TransactionRecordQuery, } from '@hashgraph/sdk';
20
+ import { AccountBalance, AccountInfo, LedgerId, SignerSignature, Transaction, TransactionRecord, Client, PublicKey, TransactionId, TransactionResponse, Query, AccountRecordsQuery, AccountInfoQuery, AccountBalanceQuery, TransactionReceiptQuery, TransactionReceipt, TransactionRecordQuery, } from '@hashgraph/sdk';
21
21
  import { proto } from '@hashgraph/proto';
22
22
  import { HederaJsonRpcMethod, base64StringToSignatureMap, base64StringToUint8Array, ledgerIdToCAIPChainId, queryToBase64String, transactionBodyToBase64String, transactionToBase64String, transactionToTransactionBody, extensionOpen, Uint8ArrayToBase64String, Uint8ArrayToString, } from '../shared';
23
23
  import { DefaultLogger } from '../shared/logger';
@@ -51,15 +51,6 @@ export class DAppSigner {
51
51
  get _signerAccountId() {
52
52
  return `${ledgerIdToCAIPChainId(this.ledgerId)}:${this.accountId.toString()}`;
53
53
  }
54
- _getRandomNodes(numberOfNodes) {
55
- const allNodes = Object.values(this._getHederaClient().network).map((o) => typeof o === 'string' ? AccountId.fromString(o) : o);
56
- // shuffle nodes
57
- for (let i = allNodes.length - 1; i > 0; i--) {
58
- const j = Math.floor(Math.random() * (i + 1));
59
- [allNodes[i], allNodes[j]] = [allNodes[j], allNodes[i]];
60
- }
61
- return allNodes.slice(0, numberOfNodes);
62
- }
63
54
  request(request) {
64
55
  var _a, _b;
65
56
  // Avoid a wallet call if the session is no longer valid
@@ -144,9 +135,7 @@ export class DAppSigner {
144
135
  throw new Error('Method not implemented.');
145
136
  }
146
137
  async populateTransaction(transaction) {
147
- return transaction
148
- .setNodeAccountIds(this._getRandomNodes(10)) // allow retrying on up to 10 nodes
149
- .setTransactionId(TransactionId.generate(this.getAccountId()));
138
+ return transaction.setTransactionId(TransactionId.generate(this.getAccountId()));
150
139
  }
151
140
  /**
152
141
  * Prepares a transaction object for signing using a single node account id.
@@ -157,12 +146,7 @@ export class DAppSigner {
157
146
  * @returns transaction - `Transaction` object with signature
158
147
  */
159
148
  async signTransaction(transaction) {
160
- let nodeAccountId;
161
- if (!transaction.nodeAccountIds || transaction.nodeAccountIds.length === 0)
162
- nodeAccountId = this._getRandomNodes(1)[0];
163
- else
164
- nodeAccountId = transaction.nodeAccountIds[0];
165
- const transactionBody = transactionToTransactionBody(transaction, nodeAccountId);
149
+ const transactionBody = transactionToTransactionBody(transaction);
166
150
  if (!transactionBody)
167
151
  throw new Error('Failed to serialize transaction body');
168
152
  const transactionBodyBase64 = transactionBodyToBase64String(transactionBody);
@@ -1,23 +1,6 @@
1
1
  import { AccountId, PublicKey, Transaction, LedgerId, Query, SignerSignature } from '@hashgraph/sdk';
2
2
  import { ProposalTypes, SessionTypes } from '@walletconnect/types';
3
3
  import { proto } from '@hashgraph/proto';
4
- /**
5
- * Freezes a transaction if it is not already frozen. Transactions must
6
- * be frozen before they can be converted to bytes.
7
- *
8
- * @param transaction - Any instance of a class that extends `Transaction`
9
- */
10
- export declare function freezeTransaction<T extends Transaction>(transaction: T): void;
11
- /**
12
- * Sets default consensus nodes that a transaction will be submitted to. Node Account ID(s)
13
- * must be set before a transaction can be frozen. If they have already been set, this
14
- * function will not modify the transaction.
15
- * @param transaction - any instance of a class that extends `Transaction`
16
- *
17
- * @see {@link https://docs.hedera.com/hedera/networks/testnet/testnet-nodes | Full list of Testnet-nodes}
18
- * @see {@link https://docs.hedera.com/hedera/networks/mainnet/mainnet-nodes | Full list of Mainnet-nodes}
19
- */
20
- export declare function setDefaultNodeAccountIds<T extends Transaction>(transaction: T): void;
21
4
  /**
22
5
  * Converts `Transaction` to a Base64-string.
23
6
  *
@@ -49,7 +32,7 @@ export declare function base64StringToTransaction<T extends Transaction>(transac
49
32
  * @param transaction - a base64 encoded string of proto.TransactionBody.encode().finish()
50
33
  * @returns `string`
51
34
  * */
52
- export declare function transactionToTransactionBody<T extends Transaction>(transaction: T, nodeAccountId: AccountId): any;
35
+ export declare function transactionToTransactionBody<T extends Transaction>(transaction: T): any;
53
36
  export declare function transactionBodyToBase64String(transactionBody: proto.ITransactionBody): string;
54
37
  /**
55
38
  * @param transactionList - a proto.TransactionList object
@@ -20,30 +20,6 @@
20
20
  import { Buffer } from 'buffer';
21
21
  import { AccountId, Transaction, LedgerId, Query, } from '@hashgraph/sdk';
22
22
  import { proto } from '@hashgraph/proto';
23
- /**
24
- * Freezes a transaction if it is not already frozen. Transactions must
25
- * be frozen before they can be converted to bytes.
26
- *
27
- * @param transaction - Any instance of a class that extends `Transaction`
28
- */
29
- export function freezeTransaction(transaction) {
30
- if (!transaction.isFrozen())
31
- transaction.freeze();
32
- }
33
- /**
34
- * Sets default consensus nodes that a transaction will be submitted to. Node Account ID(s)
35
- * must be set before a transaction can be frozen. If they have already been set, this
36
- * function will not modify the transaction.
37
- * @param transaction - any instance of a class that extends `Transaction`
38
- *
39
- * @see {@link https://docs.hedera.com/hedera/networks/testnet/testnet-nodes | Full list of Testnet-nodes}
40
- * @see {@link https://docs.hedera.com/hedera/networks/mainnet/mainnet-nodes | Full list of Mainnet-nodes}
41
- */
42
- export function setDefaultNodeAccountIds(transaction) {
43
- const isNodeAccountIdNotSet = !transaction.nodeAccountIds || transaction.nodeAccountIds.length === 0;
44
- if (!transaction.isFrozen() && isNodeAccountIdNotSet)
45
- transaction.setNodeAccountIds([new AccountId(3), new AccountId(4), new AccountId(5)]);
46
- }
47
23
  /**
48
24
  * Converts `Transaction` to a Base64-string.
49
25
  *
@@ -53,8 +29,6 @@ export function setDefaultNodeAccountIds(transaction) {
53
29
  * @returns Base64 encoded representation of the input `Transaction` object
54
30
  */
55
31
  export function transactionToBase64String(transaction) {
56
- setDefaultNodeAccountIds(transaction);
57
- freezeTransaction(transaction);
58
32
  const transactionBytes = transaction.toBytes();
59
33
  return Buffer.from(transactionBytes).toString('base64');
60
34
  }
@@ -83,10 +57,10 @@ export function base64StringToTransaction(transactionBytes) {
83
57
  * @param transaction - a base64 encoded string of proto.TransactionBody.encode().finish()
84
58
  * @returns `string`
85
59
  * */
86
- export function transactionToTransactionBody(transaction, nodeAccountId) {
60
+ export function transactionToTransactionBody(transaction) {
87
61
  // This is a private function, though provides the capabilities to construct a proto.TransactionBody
88
62
  //@ts-ignore
89
- return transaction._makeTransactionBody(nodeAccountId);
63
+ return transaction._makeTransactionBody(null);
90
64
  }
91
65
  export function transactionBodyToBase64String(transactionBody) {
92
66
  return Uint8ArrayToBase64String(proto.TransactionBody.encode(transactionBody).finish());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashgraph/hedera-wallet-connect",
3
- "version": "1.5.2-canary.aef7dea.0",
3
+ "version": "1.5.2-canary.b168279.0",
4
4
  "description": "A library to facilitate integrating Hedera with WalletConnect",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,7 +34,7 @@
34
34
  "eslint-plugin-tsdoc": "^0.4.0",
35
35
  "husky": "^9.0.6",
36
36
  "jest": "^29.7.0",
37
- "lint-staged": "^15.1.0",
37
+ "lint-staged": "^16.0.0",
38
38
  "lokijs": "^1.5.12",
39
39
  "long": "^5.2.3",
40
40
  "nodemon": "^3.0.3",