Skip to content

Commit

Permalink
feat: sepolia migration and node 18 upgrade (#13)
Browse files Browse the repository at this point in the history
feat: sepolia migration
fix: upgrade node 18
  • Loading branch information
rongquan1 committed Feb 20, 2024
1 parent 4c71b2a commit 52a5b42
Show file tree
Hide file tree
Showing 68 changed files with 21,082 additions and 16,077 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x
- run: npm ci --ignore-scripts
- run: npm run lint

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x
- run: npm ci
- run: npm run build
- uses: codfish/semantic-release-action@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x
- run: npm ci
- run: npm run test:ci

Expand All @@ -25,6 +25,6 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x
- run: npm ci
- run: npm run build
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/hydrogen
26 changes: 13 additions & 13 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 "@tradetrust-tt/tt-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 "@tradetr
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 "@tradetrust-tt/tt-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 "@tradetrust-tt/tt-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 Expand Up @@ -561,4 +561,4 @@ npm run generate:v3
## Additional information

- For Verification SDK implementation follow our [Verifier ADR](https://github.com/Open-Attestation/adr/blob/master/verifier.md).
- Found a bug ? Having a question ? Want to share an idea ? Reach us out on the [Github repository](https://github.com/Open-Attestation/oa-verify).`
- Found a bug ? Having a question ? Want to share an idea ? Reach us out on the [Github repository](https://github.com/Open-Attestation/oa-verify).`
5 changes: 4 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ module.exports = {
testEnvironment: "node",
watchPlugins: ["jest-watch-typeahead/filename", "jest-watch-typeahead/testname"],
testTimeout: 30000,
};
moduleNameMapper: {
axios: "axios/dist/node/axios.cjs", // Temporary workaround: Force Jest to import the CommonJS Axios build
},
};

0 comments on commit 52a5b42

Please sign in to comment.