-
Notifications
You must be signed in to change notification settings - Fork 919
Add fromJson
and toJson
options to HTTP transport
#3192
Conversation
🦋 Changeset detectedLatest commit: ea59901 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @lorisleiva and the rest of your teammates on Graphite |
2e132bb
to
6d224dd
Compare
8027ee8
to
eec29ad
Compare
6d224dd
to
56c4dbc
Compare
eec29ad
to
4272a4f
Compare
56c4dbc
to
4430dda
Compare
4272a4f
to
d9ab449
Compare
4430dda
to
dd8d6b7
Compare
d9ab449
to
915b51e
Compare
dd8d6b7
to
70bfa6f
Compare
915b51e
to
961ef97
Compare
70bfa6f
to
3a681f1
Compare
961ef97
to
0690002
Compare
statusCode: response.status, | ||
}); | ||
} | ||
if (fromJson) { | ||
return fromJson(await response.text(), { methodName, params }) as TResponse; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented [here](https://app.graphite.dev/github/pr/solana-labs/solana-web3.js/3186/Make-RPC-transports-responsible-for-preparing-payloads#review-PRR_kwDOCLAddc6IhmFq). I think the base-level transport shouldn't know anything about JavaScript or JSON; it should just accept and return text.
See this comment inline on Graphite.
23f22d1
to
f62ca3a
Compare
21ecd67
to
44d491d
Compare
44d491d
to
ea59901
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge activity
|
Because there has been no activity on this PR for 14 days since it was merged, it has been automatically locked. Please open a new issue if it requires a follow up. |
This PR adds two new optional functions to the
createHttpTransport
configs.fromJson
: When provided, replaces the logic that transforms the response from a JSON string into a JSON value.toJson
: When provided, replaces the logic that transforms the request payload from a JSON value into a JSON string.This will enable us to wrap this transport and create a new Solana-RPC-specific HTTP transport that do not loose range/precision when
bigint
values are transmitted over the wire.