Skip to content

Commit

Permalink
fix: revert graphql subscriptions PR (#1333)
Browse files Browse the repository at this point in the history
  • Loading branch information
nedsalk authored Oct 11, 2023
1 parent f3c3817 commit bec5938
Show file tree
Hide file tree
Showing 13 changed files with 208 additions and 531 deletions.
6 changes: 6 additions & 0 deletions .changeset/chilled-elephants-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@fuel-ts/errors": minor
"@fuel-ts/providers": minor
---

Reverted GraphQL subscriptions, thus removing `Provider.operations.statusChange`.
6 changes: 0 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ module.exports = {
// Disable error on devDependencies importing since this isn't a TS library
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
'no-await-in-loop': 0,
'no-restricted-syntax': [
'off',
{
selector: 'ForOfStatement',
},
],
'prefer-destructuring': 0,
'no-bitwise': 0,
'no-underscore-dangle': 'off',
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/ci-setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "CI setup"
inputs:
node-version:
description: "Node version"
default: 18.18.0
default: 18.14.1
pnpm-version:
description: "PNPM version"
default: 8.6.1
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.18.0
18.14.1
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"author": "Fuel Labs <[email protected]> (https://fuel.network/)",
"private": true,
"engines": {
"node": ">= 18.18.0",
"pnpm": ">= 8.6.1"
"node": ">= 18.14.1",
"pnpm": ">= 8.1.1"
},
"packageManager": "pnpm@8.6.1",
"packageManager": "pnpm@8.1.1",
"scripts": {
"dev": "nodemon --config nodemon.config.json -x 'pnpm build:packages'",
"build": "turbo run build",
Expand Down Expand Up @@ -88,5 +88,10 @@
"tsx": "^3.12.7",
"turbo": "^1.8.8",
"typescript": "~5.1.6"
},
"pnpm": {
"overrides": {
"cross-fetch": "4.0.0"
}
}
}
5 changes: 1 addition & 4 deletions packages/errors/src/error-codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export enum ErrorCode {
TYPE_NOT_FOUND = 'type-not-found',
TYPE_NOT_SUPPORTED = 'type-not-supported',
INVALID_DECODE_VALUE = 'invalid-decode-value',
JSON_ABI_ERROR = 'json-abi-error',
JSON_ABI_ERROR = 'abi-main-method-missing',
TYPE_ID_NOT_FOUND = 'type-id-not-found',
BIN_FILE_NOT_FOUND = 'bin-file-not-found',
CODER_NOT_FOUND = 'coder-not-found',
Expand Down Expand Up @@ -87,9 +87,6 @@ export enum ErrorCode {
SCRIPT_REVERTED = 'script-reverted',
SCRIPT_RETURN_INVALID_TYPE = 'script-return-invalid-type',

// general
FUEL_NODE_ERROR = 'fuel-node-error',

// coder
// ...
}
12 changes: 3 additions & 9 deletions packages/providers/codegen.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
{
"$schema": "https://www.graphql-code-generator.com/config.schema.json",
"schema": "./fuel-core-schema.graphql",
"documents": "./src/operations.graphql",
"generates": {
"./src/__generated__/operations.ts": {
"documents": "./src/operations.graphql",
"plugins": [
{ "typescript": {} },
{
"typescript-operations": {}
},
{
"typescript-generic-sdk": {
"dedupeFragments": true
}
}
{ "typescript-operations": {} },
{ "typescript-graphql-request": {} }
],
"config": {
"scalars": {
Expand Down
5 changes: 2 additions & 3 deletions packages/providers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"graphql": "^16.6.0",
"graphql-request": "^5.0.0",
"graphql-tag": "^2.12.6",
"graphql-sse": "^2.2.1",
"ramda": "^0.29.0",
"tai64": "^1.0.0"
},
Expand All @@ -49,8 +48,8 @@
"@graphql-codegen/typescript": "^2.8.0",
"@graphql-codegen/typescript-graphql-request": "^4.5.7",
"@graphql-codegen/typescript-operations": "^2.5.5",
"@graphql-codegen/typescript-generic-sdk": "^3.1.0",
"@types/ramda": "^0.29.3",
"get-graphql-schema": "^2.1.2"
"get-graphql-schema": "^2.1.2",
"typescript": "^4.8.4"
}
}
59 changes: 21 additions & 38 deletions packages/providers/src/operations.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,6 @@
# generate `operations.ts` from this file.

# Fragments

fragment transactionStatusFragment on TransactionStatus {
type: __typename
... on SubmittedStatus {
time
}
... on SuccessStatus {
block {
id
}
time
programState {
returnType
data
}
}
... on FailureStatus {
block {
id
}
time
reason
}
}

fragment transactionFragment on Transaction {
id
rawPayload
Expand All @@ -37,7 +12,27 @@ fragment transactionFragment on Transaction {
...receiptFragment
}
status {
...transactionStatusFragment
type: __typename
... on SubmittedStatus {
time
}
... on SuccessStatus {
block {
id
}
time
programState {
returnType
data
}
}
... on FailureStatus {
block {
id
}
time
reason
}
}
}

Expand Down Expand Up @@ -473,15 +468,3 @@ mutation produceBlocks(
startTimestamp: $startTimestamp
)
}

subscription submitAndAwait($encodedTransaction: HexString!) {
submitAndAwait(tx: $encodedTransaction) {
...transactionStatusFragment
}
}

subscription statusChange($transactionId: TransactionId!) {
statusChange(id: $transactionId) {
...transactionStatusFragment
}
}
Loading

0 comments on commit bec5938

Please sign in to comment.