diff --git a/README.md b/README.md index 0898027..59eafdd 100644 --- a/README.md +++ b/README.md @@ -115,4 +115,6 @@ curl -X POST \ -d '{"query": "{ depositAddeds { id seller token amount } }"}' \ https://api.studio.thegraph.com/query/113713/p-2-pix/sepolia -https://api.studio.thegraph.com/query/113713/p-2-pix/1 \ No newline at end of file +https://api.studio.thegraph.com/query/113713/p-2-pix/1 + +curl --request POST --url 'https://api.hm.bb.com.br/testes-portal-desenvolvedor/v1/boletos-pix/pagar?gw-app-key=95cad3f03fd9013a9d15005056825665' --header 'content-type: application/json' --data '{"pix":"00020101021226070503***63041654" }' \ No newline at end of file diff --git a/package.json b/package.json index 625ce46..93356b6 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ "@web3-onboard/vue": "^2.9.0", "alchemy-sdk": "^2.3.0", "axios": "^1.2.1", - "crc": "^3.8.0", "marked": "^4.2.12", "qrcode": "^1.5.1", "viem": "^2.31.3", diff --git a/src/blockchain/buyerMethods.ts b/src/blockchain/buyerMethods.ts index c91ae49..6a7b3f8 100644 --- a/src/blockchain/buyerMethods.ts +++ b/src/blockchain/buyerMethods.ts @@ -1,6 +1,15 @@ import { getContract } from "./provider"; import { getTokenAddress } from "./addresses"; -import { parseEther } from "viem"; +import { + bytesToHex, + encodeAbiParameters, + keccak256, + parseAbiParameters, + parseEther, + stringToBytes, + stringToHex, + toBytes, +} from "viem"; import type { TokenEnum } from "@/model/NetworkEnum"; export const addLock = async ( @@ -54,18 +63,26 @@ export const withdrawDeposit = async ( return receipt.status === "success"; }; -export const releaseLock = async (solicitation: any): Promise => { +export const releaseLock = async ( + lockID: string, + pixtarget: string, + signature: string +): Promise => { const { address, abi, wallet, client, account } = await getContract(); + console.log("Releasing lock", { lockID, pixtarget, signature }); if (!wallet) { throw new Error("Wallet not connected"); } + // Convert pixtarget to bytes32 + const pixTimestamp = keccak256(stringToBytes(pixtarget)); + const { request } = await client.simulateContract({ address: address as `0x${string}`, abi, functionName: "release", - args: [solicitation.lockId, solicitation.e2eId], + args: [BigInt(lockID), pixTimestamp, signature], account: account as `0x${string}`, }); diff --git a/src/blockchain/wallet.ts b/src/blockchain/wallet.ts index 1766113..902bfdf 100644 --- a/src/blockchain/wallet.ts +++ b/src/blockchain/wallet.ts @@ -118,7 +118,6 @@ export const listAllTransactionByWalletAddress = async ( }); const data = await response.json(); - console.log("Subgraph data:", data); // Convert all transactions to common WalletTransaction format const transactions: WalletTransaction[] = []; diff --git a/src/components/ListingComponent/ListingComponent.vue b/src/components/ListingComponent/ListingComponent.vue index 77a187e..51fd314 100644 --- a/src/components/ListingComponent/ListingComponent.vue +++ b/src/components/ListingComponent/ListingComponent.vue @@ -160,9 +160,10 @@ showInitialItems();