From 7b62e516d167a3e40703f0ad762149f4e173431e Mon Sep 17 00:00:00 2001 From: Guillermo Alejandro Gallardo Diez Date: Mon, 6 Jan 2025 23:18:24 +0100 Subject: [PATCH] fix: contract --- contract-rs/Cargo.toml | 6 +++--- frontend/src/components/DonationForm.jsx | 4 +++- frontend/src/pages/_app.js | 6 ------ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/contract-rs/Cargo.toml b/contract-rs/Cargo.toml index 98be752..eaba807 100644 --- a/contract-rs/Cargo.toml +++ b/contract-rs/Cargo.toml @@ -13,11 +13,11 @@ crate-type = ["cdylib", "rlib"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -near-sdk = { version = "5.1.0", features = ["legacy"] } +near-sdk = { version = "5.7.0", features = ["legacy"] } [dev-dependencies] -near-sdk = { version = "5.0.0", features = ["unit-testing"] } -near-workspaces = { version = "0.10.0", features = ["unstable"] } +near-sdk = { version = "5.7.0", features = ["unit-testing"] } +near-workspaces = { version = "0.16.0", features = ["unstable"] } tokio = { version = "1.12.0", features = ["full"] } serde_json = "1" diff --git a/frontend/src/components/DonationForm.jsx b/frontend/src/components/DonationForm.jsx index 0f3aab9..c972e18 100644 --- a/frontend/src/components/DonationForm.jsx +++ b/frontend/src/components/DonationForm.jsx @@ -22,7 +22,7 @@ const DonationForm = ({ setMyDonation }) => { event.preventDefault(); let deposit = utils.format.parseNearAmount(amount.toString()); - setMyDonation(amount); + wallet .callMethod({ contractId: DonationNearContract, @@ -32,6 +32,8 @@ const DonationForm = ({ setMyDonation }) => { .catch(() => { setMyDonation(-Number(amount)); }); + + setMyDonation(amount); }; return ( diff --git a/frontend/src/pages/_app.js b/frontend/src/pages/_app.js index 78bd9eb..93b6d18 100644 --- a/frontend/src/pages/_app.js +++ b/frontend/src/pages/_app.js @@ -10,12 +10,6 @@ import { DonationNearContract, NetworkId } from "@/config"; // Wallet instance const wallet = new Wallet({ networkId: NetworkId }); -// Optional: Create an access key so the user does not need to sign transactions. Read more about access keys here: https://docs.near.org/concepts/protocol/access-keys -// const wallet = new Wallet({ -// createAccessKeyFor: DonationNearContract, -// networkId: NetworkId, -// }); - export default function MyApp({ Component, pageProps }) { const [signedAccountId, setSignedAccountId] = useState("");