Skip to content

Commit

Permalink
add chain to contract calls
Browse files Browse the repository at this point in the history
  • Loading branch information
rdonmez committed Feb 3, 2024
1 parent bcf1646 commit 0f4be37
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
20 changes: 12 additions & 8 deletions src/components/Register.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { GET_DOMAIN } from "../graphql/Domain";
import { CountdownCircleTimer } from 'react-countdown-circle-timer'
import { getDateSimple, getExpires, getOneYearDuration, getTimeAgo, getTokenId, obscureLabel, obscureName } from "../helpers/String";
import { getBalance } from '@wagmi/core'
import { goerli, zkFair } from 'wagmi/chains'

class Register extends Component {

Expand Down Expand Up @@ -71,7 +72,8 @@ class Register extends Component {
address: process.env.REACT_APP_ZKFREGISTERCONTROLLER,
functionName: "makeCommitment",
args: [ this.props.name, this.props.owner, this.getDuration(), secret, this.resolver, this.data, this.reverseRecord ],
account: this.props.owner
account: this.props.owner,
chainId: process.env.REACT_APP_NODE_ENV === "production" ? zkFair.id: goerli.id
});

console.log("make: "+ _commitment)
Expand All @@ -88,7 +90,8 @@ class Register extends Component {
address: process.env.REACT_APP_ZKFREGISTERCONTROLLER,
functionName: "commitments",
args: [ _commitment ],
account: this.props.owner
account: this.props.owner,
chainId: process.env.REACT_APP_NODE_ENV === "production" ? zkFair.id: goerli.id
});

console.log("Result: "+ result );
Expand Down Expand Up @@ -138,9 +141,7 @@ class Register extends Component {
functionName: "commit",
args: [ this.state.commitment ],
account: this.props.owner,
onError: (e)=> {
toast.error(e.message);
}
chainId: process.env.REACT_APP_NODE_ENV === "production" ? zkFair.id: goerli.id
});


Expand Down Expand Up @@ -182,7 +183,8 @@ class Register extends Component {
functionName: "register",
args: [ this.props.name, this.props.owner, this.getDuration(), this.state.secret, this.resolver, this.data, this.reverseRecord ],
account: this.props.owner,
value: this.state.price
value: this.state.price,
chainId: process.env.REACT_APP_NODE_ENV === "production" ? zkFair.id: goerli.id
});

toast.success("Your transaction has been sent.");
Expand Down Expand Up @@ -215,7 +217,8 @@ class Register extends Component {
address: process.env.REACT_APP_ZKFREGISTERCONTROLLER,
functionName: 'available',
args: [this.props.name],
account: this.props.owner
account: this.props.owner,
chainId: process.env.REACT_APP_NODE_ENV === "production" ? zkFair.id: goerli.id
});

this.setState({ isAvailablePending: false });
Expand Down Expand Up @@ -273,7 +276,8 @@ class Register extends Component {
address: process.env.REACT_APP_ZKFREGISTERCONTROLLER,
functionName: 'rentPrice',
args: [this.props.name, this.getDuration()],
account: this.props.owner
account: this.props.owner,
chainId: process.env.REACT_APP_NODE_ENV === "production" ? zkFair.id: goerli.id
});

console.log(_price)
Expand Down
10 changes: 7 additions & 3 deletions src/components/RenewModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Modal } from "react-bootstrap";
import { } from "@apollo/client";
import { getExpires, getTimeAgo, obscureName } from "../helpers/String";
import { getBalance } from '@wagmi/core'
import { goerli, zkFair } from 'wagmi/chains'

class RenewModal extends Component {

Expand Down Expand Up @@ -55,7 +56,8 @@ class RenewModal extends Component {
functionName: "renew",
args: [ this.props.domain.labelName, this.getDuration() ],
account: this.props.owner,
value: this.state.price
value: this.state.price,
chainId: process.env.REACT_APP_NODE_ENV === "production" ? zkFair.id: goerli.id
});

toast.success("Your transaction has been sent.");
Expand Down Expand Up @@ -91,7 +93,7 @@ class RenewModal extends Component {
}

async handlePrice() {
console.log("handlePrice")
console.log("handlePrice Renew")
let _price = false;

try {
Expand All @@ -103,7 +105,8 @@ class RenewModal extends Component {
address: process.env.REACT_APP_ZKFREGISTERCONTROLLER,
functionName: 'rentPrice',
args: [this.props.domain.labelName, this.getDuration()],
account: this.props.owner
account: this.props.owner,
chainId: process.env.REACT_APP_NODE_ENV === "production" ? zkFair.id: goerli.id
});

console.log(_price)
Expand All @@ -124,6 +127,7 @@ class RenewModal extends Component {

const balance = await getBalance(wagmiConfig, {
address: this.props.owner,
chainId: process.env.REACT_APP_NODE_ENV === "production" ? zkFair.id: goerli.id
});

this.setState({ isGettingBalance : false, balance: balance.value });
Expand Down

0 comments on commit 0f4be37

Please sign in to comment.