From d409cc644af00edc5f241f41974ee76e30f3d52f Mon Sep 17 00:00:00 2001 From: Atharva0506 Date: Thu, 6 Aug 2026 12:23:17 +0530 Subject: [PATCH] chore: sync ChainvoiceABI with deployed hash-based contract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The frontend ABI still described the pre-migration contract, which stored the full invoice payload on-chain as two strings: createInvoice(address, uint256, address, string, string) contracts/src/Chainvoice.sol has since moved to storing only a keccak256 commitment of the invoice data, and gained the public key registry: createInvoice(address, uint256, address, bytes32) Regenerated from `forge build` output so the ABI matches the contract source exactly. This also drops the `wakuPublicKeys` accessor, which is now a private mapping read through `getWakuPublicKey`. .env.example pointed at 0x54a5…, the old contract, where getWakuPublicKey reverts and getInvoice returns strings — following the setup docs would have produced an ABI/contract mismatch. Repointed at the Sepolia deployment of the current source. Ethereum Classic and Polygon still run the old contract and are flagged inline as needing redeployment. Callers in the invoice pages still pass the old string arguments and are updated separately; this commit only realigns the ABI with the contract. --- README.md | 24 ++++-- frontend/.env.example | 11 ++- frontend/README.md | 11 ++- frontend/src/contractsABI/ChainvoiceABI.js | 85 +++++----------------- 4 files changed, 53 insertions(+), 78 deletions(-) diff --git a/README.md b/README.md index ed16f6ae..606fda2e 100644 --- a/README.md +++ b/README.md @@ -145,18 +145,32 @@ npm run dev ### Frontend Configuration (`frontend/.env`) ```.env #Ethereum Sepolia (11155111) -VITE_CONTRACT_ADDRESS_11155111=0x54a542dCDC306eE281b5De4613EcEfe6e6ABc562 -#Ethereum Classic (61) -VITE_CONTRACT_ADDRESS_61=0xD044A85a5daC307217B9bF313A90E8a60AF7DdCe -#Polygon Mainnet (137) -VITE_CONTRACT_ADDRESS_137=0xD044A85a5daC307217B9bF313A90E8a60AF7DdCe +VITE_CONTRACT_ADDRESS_11155111=0x7bC4C5abb5b1B8355Aa65307C1cFDbe6254505d2 +#Ethereum Classic (61) — blank until redeployed, see note below +VITE_CONTRACT_ADDRESS_61= +#Polygon Mainnet (137) — blank until redeployed, see note below +VITE_CONTRACT_ADDRESS_137= #Project ID VITE_WALLETCONNECT_PROJECT_ID=Your Project ID can be obtained from https://dashboard.reown.com/ ``` + +> ⚠️ Ethereum Classic and Polygon are left blank on purpose. Both still run the +> v1 contract, which stores invoice payloads on-chain as strings and has no +> public key registry, so it does not match the current ABI. The app treats any +> non-empty address as supported, so filling these in would send calls those +> contracts cannot decode. Populate them only after redeploying. > ⚠️ **Security Note:** Never commit `.env` files to version control. Keep your private keys secure. ## Deployed Contracts + +### Current (hash-based invoice storage) +Stores only `keccak256` of the invoice data on-chain and exposes the public key +registry. This is the deployment the frontend is configured against. +- Ethereum Sepolia (11155111) +```0x7bC4C5abb5b1B8355Aa65307C1cFDbe6254505d2``` + ### v1 (Mainnet Deployment — Jan 1) +Stores the invoice payload on-chain as strings. Superseded, kept for reference. - Ethereum Sepolia (11155111) ```0x54a542dCDC306eE281b5De4613EcEfe6e6ABc562``` - Ethereum Classic (61) diff --git a/frontend/.env.example b/frontend/.env.example index 4c220784..2a2d125d 100644 --- a/frontend/.env.example +++ b/frontend/.env.example @@ -1,12 +1,17 @@ # env-copy #Ethereum Sepolia (11155111) -VITE_CONTRACT_ADDRESS_11155111=0x54a542dCDC306eE281b5De4613EcEfe6e6ABc562 +VITE_CONTRACT_ADDRESS_11155111=0x7bC4C5abb5b1B8355Aa65307C1cFDbe6254505d2 +# Left blank deliberately. Both chains still run the v1 contract, which stores +# invoice payloads on-chain as strings and has no public key registry, so it +# does not match this ABI. The app treats any non-empty address as a supported +# network, so filling these in would send bytes32-encoded calls to a contract +# that cannot decode them. Populate them only after redeploying. # Ethereum Classic (61) -VITE_CONTRACT_ADDRESS_61=0xD044A85a5daC307217B9bF313A90E8a60AF7DdCe +VITE_CONTRACT_ADDRESS_61= # Polygon Mainnet (137) -VITE_CONTRACT_ADDRESS_137=0xD044A85a5daC307217B9bF313A90E8a60AF7DdCe +VITE_CONTRACT_ADDRESS_137= VITE_WALLETCONNECT_PROJECT_ID= diff --git a/frontend/README.md b/frontend/README.md index 47c867f9..a8299782 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -55,12 +55,17 @@ The frontend reads Vite environment variables from `.env`. The provided `.env.example` includes deployed contract addresses for supported networks and the WalletConnect project ID placeholder: ```env -VITE_CONTRACT_ADDRESS_11155111=0x54a542dCDC306eE281b5De4613EcEfe6e6ABc562 -VITE_CONTRACT_ADDRESS_61=0xD044A85a5daC307217B9bF313A90E8a60AF7DdCe -VITE_CONTRACT_ADDRESS_137=0xD044A85a5daC307217B9bF313A90E8a60AF7DdCe +VITE_CONTRACT_ADDRESS_11155111=0x7bC4C5abb5b1B8355Aa65307C1cFDbe6254505d2 +VITE_CONTRACT_ADDRESS_61= +VITE_CONTRACT_ADDRESS_137= VITE_WALLETCONNECT_PROJECT_ID= ``` +> ⚠️ Ethereum Classic and Polygon are left blank on purpose. Both still run the +> v1 contract, which does not match the current ABI. The app treats any +> non-empty address as supported, so filling these in would send calls those +> contracts cannot decode. Populate them only after redeploying. + To enable Web3 wallet functionality, create a free WalletConnect Project ID from the Reown dashboard: ```text diff --git a/frontend/src/contractsABI/ChainvoiceABI.js b/frontend/src/contractsABI/ChainvoiceABI.js index 82203610..33cb6176 100644 --- a/frontend/src/contractsABI/ChainvoiceABI.js +++ b/frontend/src/contractsABI/ChainvoiceABI.js @@ -77,14 +77,9 @@ export const ChainvoiceABI = [ "internalType": "address" }, { - "name": "encryptedInvoiceData", - "type": "string", - "internalType": "string" - }, - { - "name": "encryptedHash", - "type": "string", - "internalType": "string" + "name": "invoiceDataHash", + "type": "bytes32", + "internalType": "bytes32" } ], "outputs": [], @@ -110,14 +105,9 @@ export const ChainvoiceABI = [ "internalType": "address" }, { - "name": "encryptedPayloads", - "type": "string[]", - "internalType": "string[]" - }, - { - "name": "encryptedHashes", - "type": "string[]", - "internalType": "string[]" + "name": "invoiceDataHashes", + "type": "bytes32[]", + "internalType": "bytes32[]" } ], "outputs": [], @@ -188,14 +178,9 @@ export const ChainvoiceABI = [ "internalType": "bool" }, { - "name": "encryptedInvoiceData", - "type": "string", - "internalType": "string" - }, - { - "name": "encryptedHash", - "type": "string", - "internalType": "string" + "name": "invoiceDataHash", + "type": "bytes32", + "internalType": "bytes32" } ] } @@ -288,14 +273,9 @@ export const ChainvoiceABI = [ "internalType": "bool" }, { - "name": "encryptedInvoiceData", - "type": "string", - "internalType": "string" - }, - { - "name": "encryptedHash", - "type": "string", - "internalType": "string" + "name": "invoiceDataHash", + "type": "bytes32", + "internalType": "bytes32" } ] } @@ -354,14 +334,9 @@ export const ChainvoiceABI = [ "internalType": "bool" }, { - "name": "encryptedInvoiceData", - "type": "string", - "internalType": "string" - }, - { - "name": "encryptedHash", - "type": "string", - "internalType": "string" + "name": "invoiceDataHash", + "type": "bytes32", + "internalType": "bytes32" } ] } @@ -447,14 +422,9 @@ export const ChainvoiceABI = [ "internalType": "bool" }, { - "name": "encryptedInvoiceData", - "type": "string", - "internalType": "string" - }, - { - "name": "encryptedHash", - "type": "string", - "internalType": "string" + "name": "invoiceDataHash", + "type": "bytes32", + "internalType": "bytes32" } ], "stateMutability": "view" @@ -611,25 +581,6 @@ export const ChainvoiceABI = [ ], "stateMutability": "view" }, - { - "type": "function", - "name": "wakuPublicKeys", - "inputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "bytes", - "internalType": "bytes" - } - ], - "stateMutability": "view" - }, { "type": "function", "name": "withdrawFees",