Commit Graph

2241 Commits

Author SHA1 Message Date
Nico Schapeler 7be57d661f
docs: add endianess for pubkey byte/buffer functions (#29079) 2022-12-10 20:36:57 -08:00
Steven Luscher ffcebbbd9b
fix: pretty print PublicKey objects in node and in the browser (#29062) 2022-12-09 11:27:14 -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 fcde8c8366
chore: remove last references to Flow types in web3.js (#29061) 2022-12-02 16:56:34 -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 491d4f3331
fix: TransactionMessage.decompile() now counts the correct number of unsigned, writable accounts (#28990)
* Test that `TransactionMessage.decompile()` can decompile a legacy `Message`

* `TransactionMessage.decompile()` now correctly accounts for the number of writable unsigned accounts
2022-11-30 09:57:54 -08:00
steveluscher 45291a5001 chore: remove @babel/register dependency from web3.js 2022-11-29 08:04:19 +00:00
steveluscher 85e6b80347 chore: remove unused http-server dependency from web3.js 2022-11-29 08:00:06 +00:00
dependabot[bot] cc296839da
chore: bump http-server from 14.1.0 to 14.1.1 in /web3.js (#27333)
Bumps [http-server](https://github.com/http-party/http-server) from 14.1.0 to 14.1.1.
- [Release notes](https://github.com/http-party/http-server/releases)
- [Commits](https://github.com/http-party/http-server/compare/v14.1.0...v14.1.1)

---
updated-dependencies:
- dependency-name: http-server
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-28 23:48:26 -08:00
Ian Macalinao f53aa5f12b
chore: remove redundant 'Buffer' from 'Account' class (#27865) 2022-11-28 23:42:58 -08:00
Ian Macalinao 0e70275b07
chore: use constant for PUBLIC_KEY_LENGTH for checking length of input (#27876) 2022-11-28 23:29:40 -08:00
Ian Macalinao 61803b914f
chore: add deprecation notice for createProgramAddress (#27879) 2022-11-28 23:29:06 -08:00
Ian Macalinao ac8ddc841c
chore: deprecate PublicKey.findProgramAddress (#27882) 2022-11-28 23:28:35 -08:00
Ian Macalinao 19ec2dc0b1
chore: replace casts with not-null assertions (#27883) 2022-11-28 23:26:08 -08:00
Ian Macalinao 8c8e113879
chore: fix typo in PublicKey.unique (#27884) 2022-11-28 23:15:58 -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
Ian Macalinao 3b2014ddc1
fix: remove Buffer from transaction signature verification (#27868) 2022-11-28 16:32: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 <[email protected]>

Co-authored-by: Austin Milt <[email protected]>
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 <[email protected]>
2022-11-28 11:55:56 -08:00
Yihau Chen 9d5f019344
ci: fix wrong path (#28700) 2022-11-01 19:22:59 +08:00
Yihau Chen 2a417de916
chore: web3js get rid of Travis (#28695)
* ci: remove travis related file

* docs: remove travis badge from README.md

* chore: npm uninstall @commitlint/travis-cli

* ci: add test.sh script

* ci: rebuild web3 pipeline when yml changed
2022-11-01 19:06:21 +08:00
Yihau Chen f352934fca
chore: bump node version to 16 (#28693) 2022-11-01 11:19:31 +08:00
Dmitri Makarov 34865d032c chore: update Solana docs and code comments that specify "BPF" to "SBF" 2022-10-31 14:14:25 -04:00
Justin Starry 49daa596c0
fix: incorrect error message for getFeeForMessage (#28529) 2022-10-21 01:50:10 +00:00
steveluscher 25a3df3e40 chore: upgrade eslint in @solana/web3.js 2022-10-20 21:01:32 +00:00
steveluscher 9207f9a1b8 chore: upgrade Mocha to 10.1.0 2022-10-20 20:44:42 +00:00
Steven Luscher 65f1614a42
test: repair tests, `space` having been added to the account response (#28518) 2022-10-20 13:37:55 -07:00
dependabot[bot] 0c6883e9b5
chore: bump vm2 from 3.9.9 to 3.9.11 in /web3.js (#28118)
Bumps [vm2](https://github.com/patriksimek/vm2) from 3.9.9 to 3.9.11.
- [Release notes](https://github.com/patriksimek/vm2/releases)
- [Changelog](https://github.com/patriksimek/vm2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/patriksimek/vm2/compare/3.9.9...3.9.11)

---
updated-dependencies:
- dependency-name: vm2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-20 10:39:35 -07: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
Dmitri Makarov d6813b98d2 chore: move programs/bpf to programs/sbf 2022-10-13 11:40:40 -04:00
Peter Piekarczyk 759dc80fb6
chore: improve default PublicKey docs (#28372)
* docs: replace zeros comments with ones

* Update comment around docs
2022-10-12 20:04:22 -06: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 <[email protected]>

Co-authored-by: Yihau Chen <[email protected]>
2022-10-11 16:13:10 +08:00
Justin Starry 7810387b00
fix: improve `MessageV0.getAccountKeys` API ergonomics (#28042)
fix: improve MessageV0.getAccountKeys API flexibility
2022-09-24 05:37:58 +00:00
Varga-Somogyi Ákos e15a5c010e
feat: implement addSignature in VersionedTransaction (#27945)
* Implement addSignature in VersionedTransaction

* Update asserts

* VersionedTransaction.addSignature test

* Update VersionedTransaction tests
2022-09-21 17:22:40 -07:00
Steven Luscher d466799871
fix: replace bigint literals with `BigInt` constructors (#27930)
This makes web3.js compatible with runtimes that don't understand bigint literals but _do_ understand `BigInt` constructors.
For whatever that's worth.
2022-09-19 18:31:16 -07:00
Ian Macalinao 98dfc2b7d1
chore: remove Buffer from PublicKeyInitData (#27888) 2022-09-17 17:16:45 -07:00
Justin Starry 07a83e0fbb
feat: add isAccountWritable and isAccountSigner to MessageV0 (#27808) 2022-09-15 18:31:43 +00:00
Justin Starry e6687b89e6
chore: fix flakey partialSign test (#27770) 2022-09-13 20:16:30 +00:00
Justin Starry afe1cfe94a
fix: replace computed max u64 constant with literal (#27765) 2022-09-13 19:37:40 +00:00
Justin Starry d9b1ebece7
feat: add version getter to VersionedTransaction class (#27734) 2022-09-13 00:22:12 +00:00
Justin Starry 8bb0acc4c6
chore: remove failing request units test (#27735) 2022-09-12 23:18:29 +00:00
Steven Luscher a98f58f0dc
chore: update the README for web3.js with compatibility notes (#27706) 2022-09-09 14:42:36 -07:00
Justin Starry e42a39024d
feat: add source field to parsed account key responses (#27702) 2022-09-09 21:06:54 +00:00
Justin Starry 080f085cb8
fix: ensure that Keypair.secretKey is a Uint8Array (#27700) 2022-09-09 16:31:18 -04:00