@palindromepay/sdk 2.0.0 → 2.0.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.
|
@@ -355,7 +355,7 @@ export declare class PalindromePaySDK {
|
|
|
355
355
|
isSignatureDeadlineExpired(deadline: bigint, safetySeconds?: number): boolean;
|
|
356
356
|
/**
|
|
357
357
|
* Predict the wallet address for a given escrow ID (before creation)
|
|
358
|
-
*
|
|
358
|
+
* Calls the contract's computeWalletAddress function - single source of truth
|
|
359
359
|
*/
|
|
360
360
|
predictWalletAddress(escrowId: bigint): Promise<Address>;
|
|
361
361
|
/**
|
package/dist/PalindromePaySDK.js
CHANGED
|
@@ -671,28 +671,16 @@ class PalindromePaySDK {
|
|
|
671
671
|
// ==========================================================================
|
|
672
672
|
/**
|
|
673
673
|
* Predict the wallet address for a given escrow ID (before creation)
|
|
674
|
-
*
|
|
674
|
+
* Calls the contract's computeWalletAddress function - single source of truth
|
|
675
675
|
*/
|
|
676
676
|
async predictWalletAddress(escrowId) {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
const initCode = (0, viem_1.concat)([walletBytecode, encodedArgs]);
|
|
685
|
-
const initCodeHash = (0, viem_1.keccak256)(initCode);
|
|
686
|
-
// CREATE2 address: keccak256(0xff ++ deployer ++ salt ++ initCodeHash)[12:]
|
|
687
|
-
const data = (0, viem_1.concat)([
|
|
688
|
-
"0xff",
|
|
689
|
-
this.contractAddress,
|
|
690
|
-
salt,
|
|
691
|
-
initCodeHash,
|
|
692
|
-
]);
|
|
693
|
-
const hash = (0, viem_1.keccak256)(data);
|
|
694
|
-
// Take the last 20 bytes (address is derived from bytes 12-31)
|
|
695
|
-
return (0, viem_1.getAddress)(`0x${hash.slice(26)}`);
|
|
677
|
+
const predicted = await (0, actions_1.readContract)(this.publicClient, {
|
|
678
|
+
address: this.contractAddress,
|
|
679
|
+
abi: PalindromePay_json_1.default.abi,
|
|
680
|
+
functionName: "computeWalletAddress",
|
|
681
|
+
args: [escrowId],
|
|
682
|
+
});
|
|
683
|
+
return predicted;
|
|
696
684
|
}
|
|
697
685
|
// ==========================================================================
|
|
698
686
|
// ESCROW DATA READING
|