Skip to content

Commit

Permalink
add base module and graphql
Browse files Browse the repository at this point in the history
  • Loading branch information
Envoy-VC committed Dec 29, 2023
1 parent 5639f5c commit 2003c28
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/atomic-toolkit/src/lib/graphql/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import ModuleBase from '..';
import * as Types from '../../types';

import { Client } from '@urql/core';
import { cacheExchange, fetchExchange } from '@urql/core';

class GraphQL extends ModuleBase {
public gql: Client;
constructor(opts: Types.ModuleOpts) {
super(opts);
this.gql = new Client({
url: 'https://arweave.net/graphql',
exchanges: [cacheExchange, fetchExchange],
maskTypename: true,
});
}
}

export default GraphQL;
22 changes: 22 additions & 0 deletions packages/atomic-toolkit/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Arweave from 'arweave';
import { Warp } from 'warp-contracts';
import { JWKInterface } from 'arbundles';
import Irys, { WebIrys } from '@irys/sdk';

import * as Types from '../types';

class ModuleBase {
protected warp: Warp;
protected arweave: Arweave;
protected irys: WebIrys | Irys | null;
protected key: JWKInterface | 'use_wallet' | null;

constructor(opts: Types.ModuleOpts) {
this.warp = opts.warp;
this.arweave = opts.arweave;
this.irys = opts.irys;
this.key = opts.key;
}
}

export default ModuleBase;

0 comments on commit 2003c28

Please sign in to comment.