@openzeppelin/ui-builder-adapter-stellar 1.8.0 → 1.8.1

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.cjs CHANGED
@@ -1486,17 +1486,34 @@ async function checkStellarFunctionStateMutability(contractAddress, functionName
1486
1486
  );
1487
1487
  return true;
1488
1488
  }
1489
- const hasStateChanges = simulationResult.stateChanges && simulationResult.stateChanges.length > 0;
1489
+ const storageChanges = (simulationResult.stateChanges ?? []).filter((change) => {
1490
+ try {
1491
+ const keyType = change.key.switch();
1492
+ if (keyType === import_stellar_sdk7.xdr.LedgerEntryType.contractCode()) {
1493
+ return false;
1494
+ }
1495
+ if (keyType === import_stellar_sdk7.xdr.LedgerEntryType.contractData()) {
1496
+ const dataKey = change.key.contractData().key();
1497
+ if (dataKey.switch() === import_stellar_sdk7.xdr.ScValType.scvLedgerKeyContractInstance()) {
1498
+ return false;
1499
+ }
1500
+ }
1501
+ return true;
1502
+ } catch {
1503
+ return true;
1504
+ }
1505
+ });
1506
+ const hasStorageChanges = storageChanges.length > 0;
1490
1507
  import_ui_utils9.logger.info(
1491
1508
  "checkStellarFunctionStateMutability",
1492
1509
  `[Check ${functionName}] State mutability check complete:`,
1493
1510
  {
1494
- hasStateChanges,
1495
- stateChangesCount: simulationResult.stateChanges?.length || 0,
1496
- modifiesState: Boolean(hasStateChanges)
1511
+ totalStateChanges: simulationResult.stateChanges?.length || 0,
1512
+ storageChangesCount: storageChanges.length,
1513
+ modifiesState: hasStorageChanges
1497
1514
  }
1498
1515
  );
1499
- return Boolean(hasStateChanges);
1516
+ return hasStorageChanges;
1500
1517
  } catch (error) {
1501
1518
  import_ui_utils9.logger.warn(
1502
1519
  "checkStellarFunctionStateMutability",
@@ -2166,14 +2183,14 @@ var WalletsKitImplementation = class {
2166
2183
  * @param address - The account address
2167
2184
  * @returns Promise resolving to signed transaction
2168
2185
  */
2169
- async signTransaction(xdr13, address) {
2186
+ async signTransaction(xdr14, address) {
2170
2187
  if (!this.initialized) {
2171
2188
  throw new Error("Wallet implementation not initialized");
2172
2189
  }
2173
2190
  const kit = this.getKitToUse();
2174
2191
  const networkPassphrase = this.getWalletNetwork();
2175
2192
  import_ui_utils12.logger.info(LOG_SYSTEM, "Signing transaction with wallet");
2176
- return await kit.signTransaction(xdr13, {
2193
+ return await kit.signTransaction(xdr14, {
2177
2194
  address,
2178
2195
  networkPassphrase
2179
2196
  });
@@ -2640,9 +2657,9 @@ function onStellarWalletConnectionChange(callback) {
2640
2657
  }
2641
2658
  });
2642
2659
  }
2643
- async function signTransaction(xdr13, address) {
2660
+ async function signTransaction(xdr14, address) {
2644
2661
  const impl = await getStellarWalletImplementation();
2645
- return impl.signTransaction(xdr13, address);
2662
+ return impl.signTransaction(xdr14, address);
2646
2663
  }
2647
2664
 
2648
2665
  // src/transaction/eoa.ts