Skip to content

Commit

Permalink
Merge pull request #3 from stakewise/vault-actions
Browse files Browse the repository at this point in the history
Vault actions
  • Loading branch information
mike-diamond authored Aug 18, 2023
2 parents bbef140 + f1ebaf1 commit 1b27a9b
Show file tree
Hide file tree
Showing 51 changed files with 1,574 additions and 3,590 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
18.16.1
4 changes: 4 additions & 0 deletions packages/v3-sdk/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ dist
types
cache
coverage

# Types
schema.graphql
*.graphql.ts
4 changes: 2 additions & 2 deletions packages/v3-sdk/.graphqlconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"extensions": {
"endpoints": {
"Subgraph GraphQL": {
"url": "https://graph-goerli.stakewise.io/subgraphs/name/stakewise/stakewise",
"url": "https://graph-testnet.stakewise.io/subgraphs/name/stakewise/stakewise",
"headers": {
"user-agent": "JS GraphQL"
},
"introspect": false
},
"Backend GraphQL": {
"url": "https://api-goerli.stakewise.io/graphql",
"url": "https://api-testnet.stakewise.io/graphql",
"headers": {
"user-agent": "JS GraphQL"
},
Expand Down
17 changes: 6 additions & 11 deletions packages/v3-sdk/codegen.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import type { CodegenConfig } from '@graphql-codegen/cli'
import constants from '../v3-sdk/src/constants'


const urls = {
backend: 'https://api-goerli.stakewise.io/graphql',
// TODO temporary api
subgraph: 'https://graph-pretest.stakewise.io/subgraphs/name/stakewise/stakewise',
}

// https://the-guild.dev/graphql/codegen/plugins/typescript/typescript
const typesConfig = {
maybeValue: 'T',
Expand All @@ -31,26 +26,26 @@ const hooksConfig = {
arrayInputCoercion: false, // strict array types
}

type Source = keyof typeof urls
type Source = keyof typeof constants.url

const getSchemaOutput = (source: Source): CodegenConfig['generates'][string] => {
return {
schema: urls[source],
schema: constants.url[source],
plugins: [ 'schema-ast' ],
}
}

const getTypesOutput = (source: Source): CodegenConfig['generates'][string] => {
return {
schema: urls[source],
schema: constants.url[source],
config: typesConfig,
plugins: [ 'typescript' ],
}
}

const getHooksOutput = (source: Source): CodegenConfig['generates'][string] => {
return {
schema: urls[source],
schema: constants.url[source],
config: hooksConfig,
plugins: [
'typescript-operations',
Expand All @@ -67,7 +62,7 @@ const getHooksOutput = (source: Source): CodegenConfig['generates'][string] => {
const generateConfig = (): CodegenConfig => {
const generates: CodegenConfig['generates'] = {}

Object.keys(urls).forEach((source) => {
Object.keys(constants.url).forEach((source) => {
const outputs = {
schema: {
path: `src/graphql/${source}/schema.graphql`,
Expand Down
Loading

0 comments on commit 1b27a9b

Please sign in to comment.