Skip to content

Commit

Permalink
fix: Export our own types through the SDK (#402)
Browse files Browse the repository at this point in the history
Co-authored-by: Satyajeet Kolhapure <[email protected]>
  • Loading branch information
satyajeetkolhapure and kolhapuresatyajeet authored Nov 22, 2023
1 parent d570b00 commit 7d3ee9b
Show file tree
Hide file tree
Showing 27 changed files with 35 additions and 28 deletions.
2 changes: 1 addition & 1 deletion explorer/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useState } from "react";
import veraxLogo from "./assets/verax-logo-circle.svg";
import "./App.css";
import { ConnectKitButton } from "connectkit";
import VeraxSdk from "@verax-attestation-registry/verax-sdk";
import { VeraxSdk } from "@verax-attestation-registry/verax-sdk";

function App() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
2 changes: 1 addition & 1 deletion sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var VeraxSdk = require("@verax-attestation-registry/verax-sdk");

```typescript
// TypeScript
import VeraxSdk from "@verax-attestation-registry/verax-sdk";
import { VeraxSdk } from "@verax-attestation-registry/verax-sdk";
```

### 2. Instantiate VeraxSdk
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/attestation/attestationExamples.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address } from "viem";
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";

export default class AttestationExamples {
private veraxSdk: VeraxSdk;
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/attestation/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";
import AttestationExamples from "./attestationExamples";

let argv: string | null | undefined = process.argv[3] as string;
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/module/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";
import ModuleExamples from "./moduleExamples";

let argv: string | null | undefined = process.argv[3] as string;
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/module/moduleExamples.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address } from "viem";
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";

export default class ModuleExamples {
private veraxSdk: VeraxSdk;
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/portal/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";
import PortalExamples from "./portalExamples";

let argv: string | null | undefined = process.argv[3] as string;
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/portal/portalExamples.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address } from "viem";
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";

export default class PortalExamples {
private veraxSdk: VeraxSdk;
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/schema/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";
import PortalExamples from "./schemaExamples";

let argv: string | null | undefined = process.argv[3] as string;
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/schema/schemaExamples.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address } from "viem";
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";

export default class SchemaExamples {
private veraxSdk: VeraxSdk;
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/utils/decode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";

const veraxSdk = new VeraxSdk(VeraxSdk.DEFAULT_LINEA_TESTNET);

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/utils/encode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";

const veraxSdk = new VeraxSdk(VeraxSdk.DEFAULT_LINEA_TESTNET);

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/utils/getAttestationIdCounter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";

const veraxSdk = new VeraxSdk(VeraxSdk.DEFAULT_LINEA_TESTNET);

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/utils/getModulesNumber.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";

const veraxSdk = new VeraxSdk(VeraxSdk.DEFAULT_LINEA_TESTNET);

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/utils/getPortalsCount.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";

const veraxSdk = new VeraxSdk(VeraxSdk.DEFAULT_LINEA_TESTNET);

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/utils/getRelatedAttestation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";

const veraxSdk = new VeraxSdk(VeraxSdk.DEFAULT_LINEA_TESTNET);

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/utils/getSchemasNumber.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";

const veraxSdk = new VeraxSdk(VeraxSdk.DEFAULT_LINEA_TESTNET);

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/utils/getVersionNumber.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";

const veraxSdk = new VeraxSdk(VeraxSdk.DEFAULT_LINEA_TESTNET);

Expand Down
4 changes: 2 additions & 2 deletions sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@verax-attestation-registry/verax-sdk",
"version": "0.0.13",
"version": "0.0.14",
"description": "Verax Attestation Registry SDK to interact with the subgraph and the contracts",
"keywords": [
"linea-attestation-registry",
Expand All @@ -23,7 +23,7 @@
"scripts": {
"attestation": "ts-node examples/attestation/index.ts",
"clean": "rm -rf ./lib",
"build": "pnpm run clean && tsc",
"build": "pnpm run clean && tsc --p ./tsconfig.build.json",
"prepack": "npm run build",
"publish:public": "pnpm publish --access public --no-git-checks",
"module": "ts-node examples/module/index.ts",
Expand Down
4 changes: 3 additions & 1 deletion sdk/src/VeraxSdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { PrivateKeyAccount, privateKeyToAccount } from "viem/accounts";
import { Conf } from "./types";
import { SDKMode } from "./utils/constants";

export * from "./types";

let account: PrivateKeyAccount | Address;

if (typeof window === "undefined") {
Expand All @@ -23,7 +25,7 @@ if (typeof window === "undefined") {
});
}

export default class VeraxSdk {
export class VeraxSdk {
static DEFAULT_LINEA_MAINNET: Conf = {
chain: linea,
mode: SDKMode.BACKEND,
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/dataMapper/BaseDataMapper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PublicClient, WalletClient } from "viem";
import { Conf } from "../types";
import { OrderDirection } from "../../.graphclient";
import VeraxSdk from "../VeraxSdk";
import { VeraxSdk } from "../VeraxSdk";
import { stringifyWhereClause } from "../utils/graphClientHelper";
import axios from "axios";

Expand Down
5 changes: 3 additions & 2 deletions sdk/src/types/index.d.ts → sdk/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Address, Chain, EthereumProvider } from "viem";
import { Address, Chain, EIP1193Provider } from "viem";
import { SDKMode } from "../utils/constants";

export interface Conf {
chain: Chain;
Expand Down Expand Up @@ -71,6 +72,6 @@ export type OnChainModule = {

declare global {
interface Window {
ethereum: EthereumProvider;
ethereum: EIP1193Provider;
}
}
2 changes: 1 addition & 1 deletion sdk/test/integration/Attestation.integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";

describe("AttestationDataMapper", () => {
let veraxSdk: VeraxSdk;
Expand Down
2 changes: 1 addition & 1 deletion sdk/test/integration/Module.integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";

describe("ModuleDataMapper", () => {
let veraxSdk: VeraxSdk;
Expand Down
2 changes: 1 addition & 1 deletion sdk/test/integration/Portal.integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";

describe("PortalDataMapper", () => {
let veraxSdk: VeraxSdk;
Expand Down
2 changes: 1 addition & 1 deletion sdk/test/integration/Schema.integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import VeraxSdk from "../../src/VeraxSdk";
import { VeraxSdk } from "../../src/VeraxSdk";

describe("SchemaDataMapper", () => {
let veraxSdk: VeraxSdk;
Expand Down
4 changes: 4 additions & 0 deletions sdk/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["test"]
}

0 comments on commit 7d3ee9b

Please sign in to comment.