@palindromepay/sdk 1.9.8 → 1.9.9

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.
@@ -235,7 +235,6 @@ export declare class PalindromePaySDK {
235
235
  /** Cache for token decimals (rarely changes, no eviction needed) */
236
236
  private tokenDecimalsCache;
237
237
  /** Cache for immutable contract values */
238
- private walletBytecodeHashCache;
239
238
  private feeReceiverCache;
240
239
  /** Cached multicall support status per chain (null = not yet detected) */
241
240
  private multicallSupported;
@@ -199,7 +199,6 @@ class PalindromePaySDK {
199
199
  /** Cache for token decimals (rarely changes, no eviction needed) */
200
200
  this.tokenDecimalsCache = new Map();
201
201
  /** Cache for immutable contract values */
202
- this.walletBytecodeHashCache = null;
203
202
  this.feeReceiverCache = null;
204
203
  /** Cached multicall support status per chain (null = not yet detected) */
205
204
  this.multicallSupported = null;
@@ -647,22 +646,15 @@ class PalindromePaySDK {
647
646
  * Predict the wallet address for a given escrow ID (before creation)
648
647
  */
649
648
  async predictWalletAddress(escrowId) {
650
- const salt = (0, viem_1.keccak256)((0, viem_1.pad)((0, viem_1.toBytes)(escrowId), { size: 32 }));
651
- // Get wallet bytecode hash from contract (cached - immutable value)
652
- if (!this.walletBytecodeHashCache) {
653
- this.walletBytecodeHashCache = await this.publicClient.readContract({
654
- address: this.contractAddress,
655
- abi: this.abiEscrow,
656
- functionName: "WALLET_BYTECODE_HASH",
657
- });
658
- }
659
- // Compute CREATE2 address
660
- const encodedArgs = (0, viem_1.encodeAbiParameters)([{ type: "address" }, { type: "uint256" }], [this.contractAddress, escrowId]);
661
- // Note: For accurate prediction, need actual bytecode + args hash
662
- // This is a simplified version - in production, use the contract's computation
663
- const initCodeHash = (0, viem_1.keccak256)((PalindromePayWallet_json_1.default.bytecode + encodedArgs.slice(2)));
664
- const raw = (0, viem_1.keccak256)((`0xff${this.contractAddress.slice(2)}${salt.slice(2)}${initCodeHash.slice(2)}`));
665
- return (0, viem_1.getAddress)(`0x${raw.slice(26)}`);
649
+ // Use the contract's computeWalletAddress function for accurate prediction
650
+ // This ensures the SDK always matches the contract's CREATE2 computation
651
+ const walletAddress = await this.publicClient.readContract({
652
+ address: this.contractAddress,
653
+ abi: this.abiEscrow,
654
+ functionName: "computeWalletAddress",
655
+ args: [escrowId],
656
+ });
657
+ return walletAddress;
666
658
  }
667
659
  // ==========================================================================
668
660
  // ESCROW DATA READING
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@palindromepay/sdk",
3
- "version": "1.9.8",
3
+ "version": "1.9.9",
4
4
  "description": "TypeScript SDK for PalindromeCryptoEscrow - Secure blockchain escrow with buyer/seller protection",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",