Commit Graph

122 Commits

Author SHA1 Message Date
TJDawson10 c0e6065ac9
feat: add getInflationRate RPC call to web3.js (#29377)
* Add getInflationRate RPC call

* Fix code formatting

Co-authored-by: steveluscher <me+github@steveluscher.com>
2022-12-23 22:08:23 -08:00
Eric Su 710ac01ef7
docs: make the comments on using the new confirmTransaction clearer (#29251)
* docs: make the comments on using the new connection.confirmTransaction clearer

* docs: add TransactionConfirmataionStrategy type

* refactor: change param type in sendAndConfirmRawTransaction

* docs: fix typo
2022-12-19 12:23:38 -08:00
Steven Luscher 456a81982e
fix: reduce Connection keep-alive timeout to 1 second fewer than the Solana RPC's keep-alive timeout (#29130)
* Delete `AgentManager`

* Replace custom `http.Agent` implementation with `agentkeepalive` package

* Set the default free socket timeout to 1s less than the Solana RPC's default timeout

* Add link to particular issue comment

* Create the correct flavor of default agent for http/https
2022-12-19 10:22:25 -08:00
Steven Luscher f1427dd90c
feat: you can now supply your own HTTP agent to a web3.js Connection (#29125)
* You can now supply your own `https?.Agent` when creating a `Connection` object

* Don't use HTTP agents in test mode

* Tests that assert the behaviour of the `agentOverride` config of `Connection`

* s/agentOverride/httpAgent/ is less confusing when the value is `false`
2022-12-06 14:57:13 -08:00
Steven Luscher 35f3c18aa8
feat: you can now abort transaction confirmations in web3.js (#29057)
* Upgrade Typescript, `@types/node`, and `typedoc` to versions that play well together

In this instance it means they:

* understand `AbortSignal`
* don't cause build errors

* You can now abort transaction confirmation using an `AbortSignal`

* Pipe an `AbortSignal` down through `sendAndConfirmTransaction()`

* Add `AbortController` polyfill to test so that test works in Node 14
2022-12-02 16:36:09 -08:00
Steven Luscher 9725a4552e
fix: prevent the first-ever signature subscription from leaking (#29056) 2022-12-02 15:09:42 -08:00
Steven Luscher b112d01a5d
feat: the web3.js getBlock APIs now accept `rewards` and `transactionDetails` config (#29000)
* Add `transactionDetails` and `rewards` params to `getBlock` API of web3.js

* Add the same content to the legacy call

…because it's such a PITA to share config between two methods and not have Typedoc throw a fit.

* Add tests to exercise block deserialization in the case that `transactionDetails` is `none` or `accounts`

* Extract the annotated account key parser into a separate struct

* Parse the `getBlock()` responses differently depending on the mode
2022-12-01 22:04:47 -08:00
Jon Cinque 337621d031
fix: support `VersionedMessage` in `getFeeForMessage` (#28996) 2022-11-30 10:06:43 -08:00
Steven Luscher 7646521a6e
feat: a nonce-based transaction confirmation strategy for web3.js (#25839)
* feat: you can now construct a `Transaction` with durable nonce information

* chore: refactor confirmation logic so that each strategy gets its own method

* feat: `geNonce` now accepts a `minContextSlot` param

* feat: a nonce-based transaction confirmation strategy

* feat: add nonce confirmation strategy to send-and-confirm helpers

* fix: nits from July 8 review

* Use Typescript narrowing to determine which strategy to use

* Double check the signature confirmation against the slot in which the nonce was discovered to have advanced
2022-11-28 22:46:27 -08:00
Steven Luscher 04789cab81
fix: verify commitment level when confirming transactions with one-shot fetch (#28969)
* Rename `subscriptionCommitment` to `confirmationCommitment`

* Reorganize status checking code to return early if `value` is `null`

* Bail if the one-shot signature result does not meet the target commitment
2022-11-28 18:50:16 -08:00
amilz 3922f3d685
fix: add confirmation status to ConfirmedSignatureInfo web3.js response (#28555)
* Add confirmation status to ConfirmedSignatureInfo web3 response

* Update web3.js/src/connection.ts

Co-authored-by: Austin Milt <austin.w.milt@gmail.com>

Co-authored-by: Austin Milt <austin.w.milt@gmail.com>
2022-11-28 12:00:40 -08:00
Adrian Brzeziński d16810ec84
fix: web3.js transaction confirmation now double-checks for already-confirmed txs (#28290)
* chore: create internal method for subscribing to subscription state changes

* add status pool

* fix tests

* more tests

* syntax fix

* variable rename

* fix test

* comment fix

* remove getSignatureStatuses pooling

* rename variable

* IIFE

* wait for subscription

* fix interval clear

* test: you can now pause the establishment of subscriptions in tests

* feat: implementation of signature status check after setting up signature subscription

Co-authored-by: steveluscher <me+github@steveluscher.com>
2022-11-28 11:55:56 -08:00
Justin Starry 49daa596c0
fix: incorrect error message for getFeeForMessage (#28529) 2022-10-21 01:50:10 +00:00
Steven Luscher 5d172151a2
fix: wrap _rpcWebSocketGeneration around when about to overflow (#28428) 2022-10-16 23:33:28 -07:00
Justin Starry 831ed96730
feat: add getMultipleParsedAccounts method (#28414) 2022-10-16 07:26:08 +00:00
Justin Starry 36e5f33e67
feat: add dataSlice param to account fetching config (#28389) 2022-10-14 03:28:00 +00:00
Justin Starry 33a328e589
feat: add getParsedBlock method to Connection (#28345)
* feat: add getParsedBlock method to Connection

* Update web3.js/src/connection.ts

Co-authored-by: Yihau Chen <a122092487@gmail.com>

Co-authored-by: Yihau Chen <a122092487@gmail.com>
2022-10-11 16:13:10 +08:00
Justin Starry d9b1ebece7
feat: add version getter to VersionedTransaction class (#27734) 2022-09-13 00:22:12 +00:00
Justin Starry e42a39024d
feat: add source field to parsed account key responses (#27702) 2022-09-09 21:06:54 +00:00
Justin Starry 204f272412
feat: support versioned txs in `sendTransaction` and `simulateTransaction` (#27528)
* feat: support versioned txs in sendTransaction and simulateTransaction

* chore: add docs for simulation config parameters
2022-09-06 23:53:42 -04:00
Justin Starry da7e88fc41
fix: add compute units to jsonrpc parser (#27554) 2022-09-01 18:18:43 +00:00
Justin Starry 31087b8aba
Revert "fix: add compute units to jsonrpc parser" (#27553)
Revert "fix: add compute units to jsonrpc parser (#27466)"

This reverts commit b34cab46d6.
2022-09-01 13:30:22 -04:00
Maximilian Schneider b34cab46d6
fix: add compute units to jsonrpc parser (#27466)
add compute units to jsonrpc parser
2022-09-01 09:34:10 -07:00
Justin Starry 292b2a1bfe
feat: update `Connection` to support versioned transactions (#27068)
feat: update Connection to support versioned transactions
2022-08-31 08:46:24 -04:00
Steven Luscher 5975176af7
[web3.js] Eliminate dependency on `URL` class (#27349)
* fix: `makeWebsocketUrl` no longer depends on the `URL` class
* fix: `Connection` no longer relies on the `URL` class
* fix: remove dependency on `react-native-url-polyfill`
2022-08-24 11:02:40 -07:00
Justin Starry dcef8ec100
feat: add getAddressLookupTable method to Connection (#27127) 2022-08-14 10:11:49 +00:00
Justin Starry 8e30dbbbf2 chore: restructure utils code 2022-08-12 17:11:51 +01:00
Justin Starry 7e7785fc19
feat: support minContextSlot in getParsedAccountInfo method (#27084) 2022-08-11 14:28:54 +00:00
Justin Starry 9ab52e4260
chore: annotate more types as deprecated (#27067) 2022-08-10 20:35:30 +00:00
Justin Starry 369b6b1828
feat: handle `loadedAddresses` field in tx meta responses (#27065)
feat: handle loadedAddresses field in tx meta responses
2022-08-10 20:08:24 +00:00
Steven Luscher f4100f621f
fix: (web3.js) clear the idle timer whenever the websocket closes (#26734)
fix: clear the idle timer whenever the websocket closes
2022-07-24 21:56:03 -07:00
Athar Mohammad ce337e009d
feat(web3.js): add support for get stake minimum delegation (#26682) 2022-07-22 01:02:49 -07:00
steveluscher b9001a947a fix: add `maxSupportedTransactionVersion` config to remaining `getTransaction` calls 2022-07-22 08:02:28 +00:00
Steven Luscher c971c61dfb
feat: add `maxSupportedTransactionVersion` option to `getBlock` and `getTransaction` (#26726) 2022-07-21 21:02:05 -07:00
Steven Luscher 817402123f
fix: fork `URL` and `fetch` for React Native in web3.js (#26604) 2022-07-12 21:41:33 -07:00
Athar Mohammad d0d3ad7166
Support for returnData in simulate transaction (#26499)
feat(web3.js): add Support for returnData in simulate transaction
2022-07-12 14:07:17 +02:00
steveluscher 627d91fb20 chore: move `checkBlockHeight` into block where it's used 2022-07-02 13:15:50 -07:00
steveluscher 6b82235fab fix: a much simpler way to prevent getRecentPerformanceSamples from sending a commitment 2022-07-01 22:34:30 -07:00
steveluscher e24b64dd71 fix: `getPerformanceSamples` no longer breaks when the connection has a default commitment 2022-07-02 05:29:41 +00:00
Mark Daniel 3fcdc45092
fix: web3.js; maxRetries no longer stripped when zero (#26345)
Co-authored-by: Mark D <83738282+markusmark1@users.noreply.github.com>
2022-06-30 23:20:22 -07:00
Steven Luscher e17ed6b2b9
feat: web3.js RPC errors now hold the error `code` and `data` on the error object (#26318)
feat: web3.js RPC errors now hold the error code on the error object
2022-06-30 13:08:10 -07:00
Steven Luscher f57f228126
feat: add `minContextSlot` configuration to (almost) all web3.js methods (#26296)
* feat: add `minContextSlot` config to `getAccountInfo`

* feat: add `minContextSlot` config to `getBalance`

* feat: add `minContextSlot` config to `getBlockHeight``

* feat: add `minContextSlot` config to `getEpochInfo`

* feat: add `minContextSlot` config to `getInflationReward`

* feat: add `minContextSlot` config to `getLatestBlockhash`

* feat: add `minContextSlot` config to `getMultipleAccounts`

* feat: add `minContextSlot` config to `getProgramAccounts`

* feat: add `minContextSlot` config to `getSignaturesForAddress`

* feat: add `minContextSlot` config to `getSlot`

* feat: add `minContextSlot` config to `getSlotLeader`

* feat: add `minContextSlot` config to `getStakeActivation`

* feat: add `minContextSlot` config to `getTokenAccountsByOwner`

* feat: add `minContextSlot` config to `getTransactionCount`

* feat: add `minContextSlot` config to `sendTransaction`
2022-06-29 09:22:34 -07:00
steveluscher eb12983785 feat: add custom version HTTP header string to RPC requests 2022-06-29 06:59:44 +00:00
Steven Luscher 19eea3a741
chore: fix types of `RpcRequest` and `RpcBatchRequest` (#26102) 2022-06-21 14:48:44 -07:00
Kunal Desai aea84e699c
fix: `getTransactions()` now returns the expected datatype (#26099) 2022-06-21 10:31:42 -07:00
steveluscher da28badcaa fix: web3.js fork fetch for browsers 2022-05-26 14:40:18 -07:00
steveluscher 9f1b876c74 fix: correct the types of the fetch infra in web3.js 2022-05-26 14:40:18 -07:00
Phil Chen 456e6711f0
chore: typo in BlockheightBasedTransactionConfirmationStrategy (#25279)
* fix typo: Confimation => Confirmation

* chore: run prettier

Co-authored-by: steveluscher <me+github@steveluscher.com>
2022-05-17 16:59:04 -07:00
Steven Luscher 4ea39c1cd3
feat: thread new blockheight expiry strategy through `sendAndConfirmTransaction` (#25227)
* chore: extract expirable blockhash record into its own type

* fix: the local latest blockhash cache now fetches and stores lastValidBlockHeight

* fix: allow people to supply a confirmation strategy to sendAndConfirmRawTransaction

* test: upgrade RPC helpers to use blockheight confirmation method

* test: patch up tests to use blockheight based confirmation strategy

* fix: eliminate deprecated construction of Transaction inside simulateTransaction

* test: eliminate deprecated constructions of Transaction in tests
2022-05-14 21:54:12 -07:00
Marc Jaramillo 375968da3b fix: transaction confirmation strategy: wait until the last valid blockheight passes (closes #24211)
Co-authored-by: Marc Jaramillo <mnj.webdeveloper@gmail.com>
Co-authored-by: Stella Wang <stella01wang@gmail.com>
2022-05-13 20:21:24 -07:00