Skip to content

Commit

Permalink
feat: migration to sepolia testnet (#273)
Browse files Browse the repository at this point in the history
* feat: migrate verify v3 integration tests to use sepolia

* feat: migrate verify v2 integration tests to use sepolia

* feat: migrate to sepolia

* chore: update endpoint

* chore: resolve typings

* chore: empty commit

* chore: use custom sepolia config

* chore: bump resolver versions

* chore: fix lint

* chore: use infura provider

* chore: use optional chaining
  • Loading branch information
zixiang2018 committed Jan 12, 2024
1 parent 19bad26 commit 85b6f53
Show file tree
Hide file tree
Showing 41 changed files with 9,500 additions and 13,726 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ A verification happens on a wrapped document, and it consists of answering to so

A wrapped document (shown below) created using [Open Attestation](https://www.openattestation.com/docs/developer-section/libraries/remote-files/open-attestation) would be required.

> **NOTE:** The document shown below is valid and has been issued on the goerli network
> **NOTE:** The document shown below is valid and has been issued on the sepolia network
```json
{
Expand Down Expand Up @@ -107,10 +107,10 @@ You can build your own verify method or your own verifiers:
// creating your own verify using default exported verifiers
import { verificationBuilder, openAttestationVerifiers } from "@govtechsg/oa-verify";

const verify1 = verificationBuilder(openAttestationVerifiers, { network: "goerli" }); // this verify is equivalent to the one exported by the library
const verify1 = verificationBuilder(openAttestationVerifiers, { network: "sepolia" }); // this verify is equivalent to the one exported by the library
// this verify is equivalent to the one exported by the library
const verify2 = verificationBuilder([openAttestationVerifiers[0], openAttestationVerifiers[1]], {
network: "goerli",
network: "sepolia",
}); // this verify only run 2 verifiers
```

Expand All @@ -130,7 +130,7 @@ const customVerifier: Verifier<any> = {
};

// create your own verify function with all verifiers and your custom one
const verify = verificationBuilder([...openAttestationVerifiers, customVerifier], { network: "goerli" });
const verify = verificationBuilder([...openAttestationVerifiers, customVerifier], { network: "sepolia" });
```

Refer to [Extending Custom Verification](#extending-custom-verification) to find out more on how to create your own custom verifier.
Expand Down Expand Up @@ -180,7 +180,7 @@ import { isValid, openAttestationVerifiers, verificationBuilder } from "@govtech
import * as document from "./document.json";

const verify = verificationBuilder(openAttestationVerifiers, {
network: "goerli",
network: "sepolia",
});

const promisesCallback = (verificationMethods: any) => {
Expand Down Expand Up @@ -334,7 +334,7 @@ const customVerifier: Verifier<any> = {
};

// create your own verify function with all verifiers and your custom one
const verify = verificationBuilder([...openAttestationVerifiers, customVerifier], { network: "goerli" });
const verify = verificationBuilder([...openAttestationVerifiers, customVerifier], { network: "sepolia" });

const fragments = await verify(document);

Expand Down Expand Up @@ -374,7 +374,7 @@ The document that we [created](#verifying-a-document) is not valid against our o

- `PROVIDER_API_KEY`: let you provide your own PROVIDER API key.
- `PROVIDER_ENDPOINT_URL`: let you provide your preferred JSON-RPC HTTP API URL.
- `PROVIDER_NETWORK`: let you specify the network to use, i.e. "homestead", "mainnet", "goerli".
- `PROVIDER_NETWORK`: let you specify the network to use, i.e. "homestead", "mainnet", "sepolia".
- `PROVIDER_ENDPOINT_TYPE`: let you specify the provider to use, i.e. "infura", "alchemy", "jsonrpc".

_Provider that is supported: Infura, EtherScan, Alchemy, JSON-RPC_
Expand All @@ -395,7 +395,7 @@ const verify = verificationBuilder(openAttestationVerifiers, { provider: customP
To specify network:

```ts
const verify = verificationBuilder(openAttestationVerifiers, { network: "goerli" });
const verify = verificationBuilder(openAttestationVerifiers, { network: "sepolia" });
```

### Specify resolver
Expand Down Expand Up @@ -425,7 +425,7 @@ You may generate a provider using the provider generator, it supports `INFURA`,

It requires a set of options:

- `network`: The _network_ may be specified as a **string** for a common network name, i.e. "homestead", "mainnet", "goerli".
- `network`: The _network_ may be specified as a **string** for a common network name, i.e. "homestead", "mainnet", "sepolia".
- `provider`: The _provider_ may be specified as a **string**, i.e. "infura", "alchemy" or "jsonrpc".
- `url`: The _url_ may be specified as a **string** in which is being used to connect to a JSON-RPC HTTP API
- `apiKey`: The _apiKey_ may be specified as a **string** for use together with the provider. If no apiKey is provided, a default shared API key will be used, which may result in reduced performance and throttled requests.
Expand All @@ -444,7 +444,7 @@ Alternate way 1 (with environment variables):

```ts
// environment file
PROVIDER_NETWORK = "goerli";
PROVIDER_NETWORK = "sepolia";
PROVIDER_ENDPOINT_TYPE = "infura";
PROVIDER_ENDPOINT_URL = "http://jsonrpc.com";
PROVIDER_API_KEY = "ajdh1j23";
Expand All @@ -460,7 +460,7 @@ Alternate way 2 (passing values in as parameters):
```ts
import { utils } from "@govtechsg/oa-verify";
const providerOptions = {
network: "goerli",
network: "sepolia",
providerType: "infura",
apiKey: "abdfddsfe23232",
};
Expand Down Expand Up @@ -492,7 +492,7 @@ Let's see how to use it

```ts
import { utils } from "@govtechsg/oa-verify";
const fragments = verify(documentValidWithCertificateStore, { network: "goerli" });
const fragments = verify(documentValidWithCertificateStore, { network: "sepolia" });
// return the correct fragment, correctly typed
const fragment = utils.getOpenAttestationEthereumTokenRegistryStatusFragment(fragments);

Expand Down

0 comments on commit 85b6f53

Please sign in to comment.