# Ethers.js tutorial

### 🚀  Want a shortcut? 🚀&#x20;

[**Start with our example code on GitHub**](https://github.com/EveripediaNetwork/oraqle/blob/master/packages/smart-contracts/scripts/get-winner.js).&#x20;

### Walkthrough&#x20;

1. `npm install oraqle-contracts ethers`
2. Use the following JavaScript code to request results from either oraqle.

```
const ethers = require("ethers");
const addresses = {
  kovan: "0x0792724900B551d200D954a5Ed709d9514d73A9F",
  mainnet: "0x3E961f9A77146F6230709D767d60025f1Ed3Bfef",
};
const positions = ["U.S. Senate Class II", "U.S. Senate Class III"];
const abi = require("oraqle-contracts/artifacts/contracts/associated-press/Jan2021SenateRunoffs.sol/Jan2021SenateRunoffs.json")
  .abi;
  
const checker = async (network: "kovan" | "mainnet") => {
  let provider = ethers.getDefaultProvider(network);
  const contractAddress = addresses[network];

  const contract = new ethers.Contract(contractAddress, abi, provider);

  const lastNames = await Promise.all(
    positions.map((position) => contract.winners(position))
  );

  return lastNames;
};

  
```

3\. Still having issues?&#x20;

1. [Refer to our example repo](https://github.com/EveripediaNetwork/oraqle)
2. Tweet to [@dawsonbotsford](https://twitter.com/dawsonbotsford) and [@everipedia](https://twitter.com/Everipedia) any engineering questions (or send a DM on Twitter to [@dawsonbotsford](https://twitter.com/dawsonbotsford))


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.everipedia.org/current-oraqles-projects/jan-5-2021/ethers.js-tutorial.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
