Commit Graph

77 Commits

Author SHA1 Message Date
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
Steven Luscher e024806aa5
fix: mark the socket as closed when receiving a close/error message (#25180) 2022-05-13 02:07:13 -07:00
wentokay a38ce127ca
fix: include exception identifier in `catch` blocks (#25147) 2022-05-11 20:32:02 -07:00
Steven Luscher 2e617ba4fd
fix: the one where we fix client subscriptions (#24473)
* chore: create a first-class type to distinguish client subscription ids from server subscription ids

* chore: add fast-stable-stringify as a dependency to web3.js

* fix: reimplement the subscription tracker as a state machine

* test: updated tests to recognize that signatureUnsubscribe happens synchronously

* chore: add sinon-chai so that we can make assertions on calling spies

* test: coverage for the full range of subscription state transitions

* fix: special case auto-disposing subscriptions like signatureSubscribe

* fix: document Subscription type (SQUASH THIS)

* fix: strict undefined checks (SQUASH THIS)

* fix: naming (SQUASH THIS)

* fix: move defaulting to source (SQUASH THIS)

* fix: build RPC args first, then produce the subscription topic hash (SQUASH THIS)

* fix: dispose handles no longer track whether they've been called (SQUASH THIS)

* fix: shore up the auto-disposing sub tests now that double-free doesn't fatal (SQUASH THIS)

* fix: write documentation explaining how and why to apply a default commitment (SQUASH THIS)

* fix: skip subscriptions that have been deleted when recursing (SQUASH THIS)

* fix: bail on async responses when the connection has been recycled (SQUASH THIS)

* fix: typo in comment (SQUASH THIS)

* chore: comment on why notification callbacks are ts-ignored

* chore: start all the new stuff out as private members of the Connection class
2022-04-28 16:21:39 -07:00
steveluscher 674c0d7602 fix: downgrade multiple unsubscribes from fatal to warning 2022-04-25 11:50:47 -07:00
Brennan Gebotys 0b93de9bd5
feat: implement getTransactions (#23633)
implement getTransactions which retrieves multiple transaction responses in a single RPC call

Co-authored-by: obiwan <you@example.com>
2022-04-25 21:46:33 +08:00
Jordan Sexton 21dacefbee
fix: transactions populated from RPC requests retain original account key order (#23720)
* fix: transaction populate

* chore: web3: fix tx serialization test

* chore: web3: run prettier

* fix: web3: transaction populate

* fix: web3: handle nonce info

* add hash calc config.use_write_cache (#24005)

* restore existing overlapping overflow (#24010)

* Stringify populated transaction fields

* fix: web3: compare stringified JSON

* chore: web3: remove eslint indent rule that conflicts with prettier

* fix: web3: explicitly call toJSON

* fix: web3: add test for compileMessage

* fix: web3: make JSON internal

* fix: web3: connection simulation from message relies on mutating transaction

Co-authored-by: Jeff Washington (jwash) <wash678@gmail.com>
Co-authored-by: Jack May <jack@solana.com>
Co-authored-by: Justin Starry <justin@solana.com>
2022-04-16 14:28:57 -05:00
Elliott W 6e03e0e987
feat: support overriding fetch function in Connection (#24367)
Co-authored-by: elliott-home-pc <elliott.wagener@mude.com.au>
2022-04-16 14:49:31 +08:00
Justin Starry e13efa0883 fix: do not modify transaction during simulation 2022-04-13 15:22:35 -07:00
David Mohl d8c45a69c3
fix: don't override a transaction's recentBlockhash when calling simulate if it's already set (#24280)
* Update simulate to add blockhash if not exist

Simulate has been overriding the recentBlockhash of the passed
Transaction which can be considered destructive and with side effects.

Since the purpose of this function is to purely simulate, it should not
override recentBlockhash if it has already been set

Refs https://github.com/solana-labs/solana/issues/24279

* Apply prettier
2022-04-13 10:15:50 +08:00
steveluscher 4dd3987451 Reset onLogs subscriptions when websocket disconnects 2022-04-07 15:45:35 -07:00
Bryon M 04158ee455
fix: stop logging to console when send tx fails (#23511)
There is no need to log the error to the console. Developers can simply catch the error and handle it themselves without it cluttering production logs.
2022-04-04 19:11:20 +08:00
stellaw1 c08cfafd6c feat: adds getBlockProduction RPC call 2022-03-26 18:31:40 -07:00
Andrey Frolov 59290c08aa
fix: add type-check script to web3.js package (#23109) 2022-03-23 12:58:42 -07:00
Sammy 26da64184a
feat(web3.js): expose rpcEndpoint in client for web3.js (#23719)
Adds a getter to the commitment class to expose the rpcEndpoint property.
2022-03-23 11:05:37 -07:00
Ashwin Ramaswami accc64ebcf
chore: fix typo retring -> retrying (#23630) 2022-03-13 23:25:27 -06:00
Krešimir Klas 41ab690a61 feat: add getMultipleAccountsInfoAndContext method to Connection
Similar to `getAccountInfoAndContext`.
2022-03-02 20:39:48 +01:00
Pierre ebe3d2d59d
fix: simulateTransaction accounts items can be null (#23229)
* fix: simulated accounts can be null

* Use Missing rather than token program id

Co-authored-by: Arrowana <8245419+Arrowana@users.noreply.github.com>
2022-02-21 14:20:11 +08:00
marty-mcflai f73b470ec0
fix: swallow error if socket has already been closed (#22934)
* Swallow error if socket has already been closed

* fix: log error
2022-02-04 19:21:58 +08:00
Hareesh Nagaraj 28442aa922
fix: enable maxRetries option to SendOptions (#22893)
* Web3.js - enable maxRetries option to SendOptions

* Prettier
2022-02-03 11:54:43 -07:00
Jon Cinque fa51e5b704
chore: update Connection to non-deprecated endpoints (#22800)
* chore: remove usage of `getConfirmedTransaction`

* chore: use `getBlock` instead of `getConfirmedBlock`

* chore: add `getLatestBlockhash` and test
2022-01-28 00:43:01 +01:00
Kirill Fomichev 3c44d405c7
feat: add Connection.getFeeForMessage (#22128)
* web3.js: add Connection.getFeeForMessage

* throw if value is null

* fix null value

* fix types
2022-01-11 17:49:28 +08:00
Victor Pontis 8b6310b179 fix: add owner to token balance type 2022-01-03 20:31:42 -08:00
Victor Pontis 33ad74fbcd chore: add encoding param to getMultipleAccounts 2022-01-03 19:26:03 -08:00
Victor Wu 736f974082
chore: fix typo in AccountInfo docs (#22196) 2021-12-31 06:03:42 +08:00
Steven Luscher d36ff8d978
fix: refine stacktrace attribution of errors thrown from middleware (#21470)
* Refine middleware types to include the method signature and to express the nullability of the middleware.

* Make sure that the stacktrace does not involve middleware unless the error originated from the middleware itself.

Co-authored-by: steveluscher <github@steveluscher.com>
2021-11-28 23:43:33 -06:00
Justin Starry a005773d10
feat: add config option to exclude accounts from supply response (#20887) 2021-10-22 16:12:49 -04:00
Justin Starry c02ef395ed
fix: use stable endpoints for getBlocks (#20310) 2021-09-29 15:27:11 +00:00
Justin Starry 071cfd7484 fix: add type checks for caught errors 2021-09-25 15:38:58 -04:00
Furkan KAMACI ea5fed937f
feat: getBlocks API is added (#19854) 2021-09-20 23:08:12 -04:00
Josh 0404e75e96
feat: make confirm transaction timeout configurable (#19954) 2021-09-17 09:54:25 -07:00
Josh 49d3d79459
web3.js: add accounts support to simulateTransaction (#19590)
* feat: add accounts support to simulateTransaction

* feat: introduce test for simulateTransaction on Message objects

* feat: populate transaction from message defaults to no signatures

* fix: remove unused constant

* fix: small formatting error

* fix: eslint and prettier were fighting over ternary indentation

* fix: make simulated transaction result accounts nullable
2021-09-16 14:10:28 -07:00
Justin Starry 0b64bf5585
feat: add support for getGenesisHash RPC (#19732) 2021-09-09 13:34:43 -04:00
Justin Starry 4c6f9bac32
feat: use cross-fetch instead of node-fetch (#19621)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-07 17:09:13 -05:00
Pierre f59a55be17
fix: handle null case in getMultipleAccountsInfo (#19307)
* fix null case

* make it similar in interface to getProgramAccounts

Co-authored-by: Arrowana <8245419+Arrowana@users.noreply.github.com>
2021-08-19 13:09:36 -07:00
Josh 548cf6a437
docs: deprecate jsonParsed for getProgramAccounts (#18816)
Co-authored-by: 0xab <0xalexbai@gmail.com>
2021-07-21 15:14:25 -07:00
Tommy Johnson c8442fd476
feat: add getMultipleAccountsInfo which uses the getMultipleAccounts RPC method (#18736)
* feat(web3): add getMultipleAccountsInfo which uses the getMultipleAccounts RPC method

* fix: add airdrop to get multiple accounts info

Co-authored-by: Josh Hundley <josh.hundley@gmail.com>
2021-07-20 09:42:14 -07:00
Alexey Elizarov 33066d254e
feat(web3): add send transaction error with logs #18277 (#18606)
* feat(web3): add send transaction error with logs #18277

* fix: logs type

* refactor: prettier
2021-07-13 09:14:20 -05:00
Justin Starry 2ef2b6daa0
fix: remove buggy node polyfill plugin (#18531)
* fix: remove buggy node polyfill plugin

* fix websocket test

* remove assert dependency
2021-07-09 00:33:41 -05:00
Tommy Johnson c2124154a5
feat: add filters support to the connection.onProgramAccountChange method (#18257)
* add filters support to the connection.onProgramAccountChange method

* add jsdoc comment

* chore: lint

Co-authored-by: Justin Starry <justin@solana.com>
2021-06-28 09:21:47 -05:00
Rohit Narurkar db3475bcdf feat: support rpc method getSignaturesByAddres 2021-06-24 09:18:16 -07:00
Pierre 97ef9b2bc3
feat: add convenience methods to EpochSchedule (#17810)
* first try, failing test

* fix implementation and tests

* lint:fix

* move method tests to seperate test

* lint fix

* apply starry's comments and grab the bonus points

* minor fixes after starry's second review

Co-authored-by: Arrowana <8245419+Arrowana@users.noreply.github.com>
2021-06-09 22:47:54 -07:00
Justin Starry 18ec6756e4
docs: add airdrop example (#17770) 2021-06-06 12:20:14 -07:00
Andreas Brekken 847e074943
feat: add disableRetryOnRateLimit connection option (#17709)
Disables auto-retrying when rate limited from HTTP 429 response.
The default behavior, auto-retrying, is unchanged.
2021-06-03 21:17:19 -07:00
Alexey Elizarov 94fffee158
feat(web3): add ability to pass different websocket endpoint #17387 (#17556) 2021-05-27 14:57:32 -07:00
Justin Starry 0dbe926efe
feat: add getBlock and getTransaction apis (#17449) 2021-05-25 10:12:47 -07:00