Skip to content

Commit

Permalink
add rpc errors
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyapotti committed Aug 9, 2024
1 parent dee4ed9 commit 4d03476
Show file tree
Hide file tree
Showing 10 changed files with 708 additions and 158 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
env:
SOURCE_DIR: "./examples/vue-example/dist"
AWS_REGION: "us-east-1"
AWS_S3_BUCKET: "demo-openlogin.web3auth.io"
AWS_S3_BUCKET: "demo-openlogin-v8.web3auth.io"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

Expand All @@ -66,7 +66,7 @@ jobs:
uses: chaitanyapotti/cloudfront-update-distribution@v4
if: github.ref == 'refs/heads/master'
with:
cloudfront-distribution-id: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }}
cloudfront-distribution-id: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID_V8 }}
cloudfront-invalidation-required: true
cloudfront-invalidation-path: "/*"
cloudfront-wait-for-service-update: false
153 changes: 0 additions & 153 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/openlogin-jrpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"pre-commit": "lint-staged --cwd ."
},
"dependencies": {
"@metamask/rpc-errors": "^6.2.1",
"end-of-stream": "^1.4.4",
"events": "^3.3.0",
"fast-safe-stringify": "^2.1.1",
Expand Down
89 changes: 89 additions & 0 deletions packages/openlogin-jrpc/src/errors/error-constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
export const errorCodes = {
rpc: {
invalidInput: -32000,
resourceNotFound: -32001,
resourceUnavailable: -32002,
transactionRejected: -32003,
methodNotSupported: -32004,
limitExceeded: -32005,
parse: -32700,
invalidRequest: -32600,
methodNotFound: -32601,
invalidParams: -32602,
internal: -32603,
},
provider: {
userRejectedRequest: 4001,
unauthorized: 4100,
unsupportedMethod: 4200,
disconnected: 4900,
chainDisconnected: 4901,
},
};

export const errorValues = {
"-32700": {
standard: "JSON RPC 2.0",
message: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text.",
},
"-32600": {
standard: "JSON RPC 2.0",
message: "The JSON sent is not a valid Request object.",
},
"-32601": {
standard: "JSON RPC 2.0",
message: "The method does not exist / is not available.",
},
"-32602": {
standard: "JSON RPC 2.0",
message: "Invalid method parameter(s).",
},
"-32603": {
standard: "JSON RPC 2.0",
message: "Internal JSON-RPC error.",
},
"-32000": {
standard: "EIP-1474",
message: "Invalid input.",
},
"-32001": {
standard: "EIP-1474",
message: "Resource not found.",
},
"-32002": {
standard: "EIP-1474",
message: "Resource unavailable.",
},
"-32003": {
standard: "EIP-1474",
message: "Transaction rejected.",
},
"-32004": {
standard: "EIP-1474",
message: "Method not supported.",
},
"-32005": {
standard: "EIP-1474",
message: "Request limit exceeded.",
},
"4001": {
standard: "EIP-1193",
message: "User rejected the request.",
},
"4100": {
standard: "EIP-1193",
message: "The requested account and/or method has not been authorized by the user.",
},
"4200": {
standard: "EIP-1193",
message: "The requested method is not supported by this Ethereum provider.",
},
"4900": {
standard: "EIP-1193",
message: "The provider is disconnected from all chains.",
},
"4901": {
standard: "EIP-1193",
message: "The provider is disconnected from the specified chain.",
},
};
Loading

0 comments on commit 4d03476

Please sign in to comment.