Skip to content

Commit

Permalink
Add GraphQL transport for SuiClient (MystenLabs#14646)
Browse files Browse the repository at this point in the history
## Description 

Describe the changes or additions included in this PR.

## Test Plan 

How did you test the new or updated feature?

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes

---------

Co-authored-by: William Robertson <[email protected]>
  • Loading branch information
hayes-mysten and williamrobertson13 authored Feb 8, 2024
1 parent 7e2f857 commit d67d8c2
Show file tree
Hide file tree
Showing 72 changed files with 27,918 additions and 4,241 deletions.
5 changes: 2 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ crates/sui-core/tests/staged/sui.yaml text eol=lf
crates/sui-open-rpc/spec/openrpc.json text eol=lf
sui_core/tests/staged/sui.yaml text eol=lf

# These files is auto generated
sdk/typescript/src/index.guard.ts linguist-generated=true
sdk/typescript/src/rpc/client.guard.ts linguist-generated=true
# These files are auto generated
sdk/graphql-transport/src/queries/generated.ts linguist-generated=true
2 changes: 1 addition & 1 deletion .github/actions/ts-e2e/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ runs:
shell: bash

- name: Run TS SDK e2e tests
run: pnpm dlx concurrently --kill-others --success command-1 "$E2E_RUN_LOCAL_NET_CMD" 'pnpm --filter @mysten/sui.js test:e2e'
run: pnpm dlx concurrently --kill-others --success command-1 "$E2E_RUN_LOCAL_NET_CMD" 'pnpm --filter @mysten/sui.js --filter @mysten/graphql-transport test:e2e'
shell: bash

- name: Run Explorer e2e tests
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
isWallet: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), 'sui-wallet')) }}
isExplorer: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), 'sui-explorer')) }}
isTypescriptSDK: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), '@mysten/sui.js')) }}
isGraphQlTransport: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), '@mysten/graphql-transport')) }}
isRust: ${{ steps.diff.outputs.isRust }}
steps:
- uses: actions/checkout@7dd9e2a3dc350cf687eb1b2a4fadfee8c8e49675 # pin@v3
Expand Down Expand Up @@ -66,7 +67,11 @@ jobs:
- name: Run TS SDK e2e tests
if: ${{ needs.diff.outputs.isTypescriptSDK == 'true' || needs.diff.outputs.isRust == 'true'}}
run: pnpm dlx concurrently --kill-others --success command-1 "$E2E_RUN_LOCAL_NET_CMD" 'pnpm --filter @mysten/sui.js test:e2e'
run: pnpm dlx concurrently --kill-others --success command-1 "$E2E_RUN_LOCAL_NET_CMD" 'pnpm --filter @mysten/sui.js'

- name: Run RPC/GrpahQL comaptability e2e tests
if: ${{ needs.diff.outputs.isGraphQlTransport == 'true' || needs.diff.outputs.isRust == 'true'}}
run: pnpm dlx concurrently --kill-others --success command-1 "$E2E_RUN_LOCAL_NET_CMD" 'pnpm --filter @mysten/graphql-transport test:e2e'

- name: Build explorer
if: ${{ needs.diff.outputs.isTypescriptSDK == 'true' || needs.diff.outputs.isExplorer == 'true' || needs.diff.outputs.isRust == 'true'}}
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ build/
coverage/
dist/
out/
generated/
playwright-report/
storybook-static/
CHANGELOG.md
Expand Down
19 changes: 19 additions & 0 deletions graphql.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import type { IGraphQLConfig } from 'graphql-config';

const config: IGraphQLConfig = {
projects: {
tsSDK: {
schema: './crates/sui-graphql-rpc/schema/current_progress_schema.graphql',
documents: [
'./sdk/graphql-transport/src/**/*.ts',
'./sdk/graphql-transport/src/**/*.graphql',
],
include: ['./sdk/graphql-transport/src/**/*.ts', './sdk/graphql-transport/src/**/*.graphql'],
},
},
};

export default config;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"eslint-plugin-require-extensions": "^0.1.3",
"eslint-plugin-tsdoc": "^0.2.17",
"eslint-plugin-unused-imports": "^3.0.0",
"graphql-config": "^5.0.3",
"prettier": "^3.0.0",
"prettier-plugin-tailwindcss": "^0.4.1",
"tsx": "^3.12.7",
Expand Down
Loading

0 comments on commit d67d8c2

Please sign in to comment.