@hashgraph/hedera-wallet-connect 2.0.4-canary.94cb472.0 → 2.0.4-canary.953461d.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/README.md CHANGED
@@ -226,10 +226,12 @@ refer to how to send transactions to wallets using the `hedera:(mainnet|testnet)
226
226
  While minimal, the main breaking changes are:
227
227
 
228
228
  - remove WalletConnect v1 modals
229
+
229
230
  - these are very old, though in the spirit of semver, we kept the dependency until this
230
231
  library's v2 release
231
232
 
232
233
  - remove setting node id's within this library for transactions
234
+
233
235
  - initially, a transaction created by the Hedera Javascript SDK needed to have one or more
234
236
  consensus node ids set to be able to serialize into bytes, sent over a network, and
235
237
  deserialized by the SDK
@@ -146,15 +146,7 @@ export class DAppSigner {
146
146
  * @returns transaction - `Transaction` object with signature
147
147
  */
148
148
  async signTransaction(transaction) {
149
- var _a, _b;
150
- // Ensure transaction is frozen with node account IDs before signing
151
- // This is required so the transaction can be executed later by any client
152
- if (!transaction.isFrozen()) {
153
- transaction.freezeWith(this._getHederaClient());
154
- }
155
- // Extract the first node account ID from the frozen transaction to preserve it in the transaction body
156
- const nodeAccountId = (_b = (_a = transaction.nodeAccountIds) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : null;
157
- const transactionBody = transactionToTransactionBody(transaction, nodeAccountId);
149
+ const transactionBody = transactionToTransactionBody(transaction);
158
150
  if (!transactionBody)
159
151
  throw new Error('Failed to serialize transaction body');
160
152
  const transactionBodyBase64 = transactionBodyToBase64String(transactionBody);
@@ -166,44 +158,9 @@ export class DAppSigner {
166
158
  },
167
159
  });
168
160
  const sigMap = base64StringToSignatureMap(signatureMap);
169
- // Get the original transaction bytes to preserve the full transaction structure
170
- // including all node account IDs
171
- const originalTransactionBytes = transaction.toBytes();
172
- const originalTransactionList = proto.TransactionList.decode(originalTransactionBytes);
173
- // Add the signature to all transactions in the list
174
- // Each transaction in the list corresponds to a different node
175
- const signedTransactionList = originalTransactionList.transactionList.map((tx) => {
176
- // Check if the transaction has signedTransactionBytes (frozen transactions)
177
- if (tx.signedTransactionBytes) {
178
- // Decode the SignedTransaction to access the bodyBytes and existing sigMap
179
- const signedTx = proto.SignedTransaction.decode(tx.signedTransactionBytes);
180
- const existingSigMap = signedTx.sigMap || proto.SignatureMap.create({});
181
- // Merge the new signatures with existing signatures
182
- const mergedSigPairs = [...(existingSigMap.sigPair || []), ...(sigMap.sigPair || [])];
183
- // Create updated SignedTransaction with merged signatures
184
- const updatedSignedTx = proto.SignedTransaction.encode({
185
- bodyBytes: signedTx.bodyBytes,
186
- sigMap: proto.SignatureMap.create({
187
- sigPair: mergedSigPairs,
188
- }),
189
- }).finish();
190
- return {
191
- signedTransactionBytes: updatedSignedTx,
192
- };
193
- }
194
- else {
195
- // Transaction has bodyBytes and sigMap at the top level (not frozen)
196
- const existingSigMap = tx.sigMap || proto.SignatureMap.create({});
197
- // Merge the new signatures with existing signatures
198
- const mergedSigPairs = [...(existingSigMap.sigPair || []), ...(sigMap.sigPair || [])];
199
- return Object.assign(Object.assign({}, tx), { sigMap: Object.assign(Object.assign({}, existingSigMap), { sigPair: mergedSigPairs }) });
200
- }
201
- });
202
- // Encode the signed transaction list back to bytes
203
- const signedBytes = proto.TransactionList.encode({
204
- transactionList: signedTransactionList,
205
- }).finish();
206
- return Transaction.fromBytes(signedBytes);
161
+ const bodyBytes = base64StringToUint8Array(transactionBodyBase64);
162
+ const bytes = proto.Transaction.encode({ bodyBytes, sigMap }).finish();
163
+ return Transaction.fromBytes(bytes);
207
164
  }
208
165
  async _tryExecuteTransactionRequest(request) {
209
166
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashgraph/hedera-wallet-connect",
3
- "version": "2.0.4-canary.94cb472.0",
3
+ "version": "2.0.4-canary.953461d.0",
4
4
  "description": "A library to facilitate integrating Hedera with WalletConnect",
5
5
  "repository": {
6
6
  "type": "git",