Skip to content

Commit

Permalink
changed to ethers v5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
vignesha22 committed Nov 13, 2024
1 parent ed1f426 commit 5d74ca9
Show file tree
Hide file tree
Showing 4 changed files with 651 additions and 1,008 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"axios": "^0.27.2",
"bootstrap": "^5.1.3",
"dotenv": "^16.4.5",
"ethers": "^6.13.4",
"ethers": "^5.7.0",
"firebase": "^9.8.3",
"graphql": "^15.9.0",
"jsqr": "^1.4.0",
Expand Down Expand Up @@ -85,5 +85,6 @@
"react-app-rewired": "^2.2.1",
"stream-browserify": "^3.0.0",
"vm-browserify": "^1.1.2"
}
},
"packageManager": "[email protected]+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447"
}
4 changes: 2 additions & 2 deletions src/components/Scan/Scan.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Spinner from "react-bootstrap/Spinner";

import { useSdk } from "../../hooks/etherspotSdk";
import { sleep } from "@etherspot/prime-sdk/dist/sdk/common";
import { Interface } from 'ethers';
import { ethers } from 'ethers';
import { collection, doc, getDocs, getFirestore, updateDoc, where, query } from "firebase/firestore";


Expand Down Expand Up @@ -53,7 +53,7 @@ export default function ScanScreen(props) {
return;
}
const handshakeAbi = ['function handshake(address other)', 'function register()'];
const hc = new Interface(handshakeAbi);
const hc = new ethers.utils.Interface(handshakeAbi);
await sdk.addUserOpsToBatch({to: '0xbF3bB56D80bAA76d67d1FbDeA92377db5B586CF1', data: hc.encodeFunctionData('handshake', [result.data])});
const estimate = await sdk.estimate({paymasterDetails: { url: `https://arka.etherspot.io?apiKey=${process.env.REACT_APP_ARKA_KEY}&chainId=42161`, context: { mode: 'sponsor' } }})
console.log('estimate: ', estimate);
Expand Down
6 changes: 2 additions & 4 deletions src/hooks/etherspotSdk.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PrimeSdk, ArkaPaymaster, EtherspotBundler } from '@etherspot/prime-sdk';
import { Contract, JsonRpcProvider } from 'ethers';
import { Contract, providers } from 'ethers';

let isInitialised = false;
let sdk = null;
Expand Down Expand Up @@ -43,11 +43,9 @@ const getAddress = async () => {
}

const getScore = async (address) => {
const provider = new JsonRpcProvider(`https://rpc.etherspot.io/v1/42161?api-key=eyJvcmciOiI2NTIzZjY5MzUwOTBmNzAwMDFiYjJkZWIiLCJpZCI6Ijk4NjVhZTdiOTUzYTRhY2U4OTllZWY5NjVlZWE1ZDY2IiwiaCI6Im11cm11cjEyOCJ9`);
const provider = new providers.JsonRpcProvider(`https://rpc.etherspot.io/v1/42161?api-key=eyJvcmciOiI2NTIzZjY5MzUwOTBmNzAwMDFiYjJkZWIiLCJpZCI6Ijk4NjVhZTdiOTUzYTRhY2U4OTllZWY5NjVlZWE1ZDY2IiwiaCI6Im11cm11cjEyOCJ9`);
const contract = new Contract('0xbF3bB56D80bAA76d67d1FbDeA92377db5B586CF1', abi, provider);
score = await contract.scores(address);
const handshakes = await contract.getHandshakes(address);
console.log(handshakes);
return score;
}

Expand Down
Loading

0 comments on commit 5d74ca9

Please sign in to comment.