Skip to content

Releases: solana-labs/solana-web3.js

v1.95.3

21 Aug 00:30
16f145d
Compare
Choose a tag to compare

1.95.3 (2024-08-21)

Bug Fixes

The New web3.js - Release Candidate `rc.1`

09 Aug 18:26
b7aa3f6
Compare
Choose a tag to compare

v2.0.0-rc.1 (2024-08-09)

Since we published the first Release Candidate of @solana/web3.js@2.0.0 your feedback has helped us to catch bugs that we missed during development. A special thank you today to @WilfredAlmeida the reports that led to the fixes in this, updated Release Candidate rc.1.

Also new in this release are handy tools that help you load key pairs and to derive public CryptoKey instances from private CryptoKey instances.

To install the Release Candidate:

npm install --save @solana/web3.js@rc
  • Try the runnable examples in the examples/ directory to get a feel for the API.
  • Use the example dApp at https://solana-labs.github.io/solana-web3.js/example/ – source available here – for an example of how to build transactions with the new web3.js for use with wallets.
  • Install TypeScript clients for on-chain programs like System and Token, then build a useful application or backend service.

Before the general release of web3.js, shortly before Breakpoint 2024 in September, we want to collect as much feedback as possible from you. If you find a bug, are missing a feature, or would like an API modified, file a GitHub Issue.

Changelog since Release Candidate rc.0

  • #3050 7d310f6 Thanks @lorisleiva! - Add a createKeyPairFromPrivateKeyBytes helper that creates a keypair from the 32-byte private key bytes.

    import { createKeyPairFromPrivateKeyBytes } from '@solana/keys';
    
    const { privateKey, publicKey } = await createKeyPairFromPrivateKeyBytes(new Uint8Array([...]));
  • #3049 f9a8446 Thanks @lorisleiva! - Add a getPublicKeyFromPrivateKey helper that, given an extractable CryptoKey private key, gets the corresponding public key as a CryptoKey.

    import { createPrivateKeyFromBytes, getPublicKeyFromPrivateKey } from '@solana/keys';
    
    const privateKey = await createPrivateKeyFromBytes(new Uint8Array([...]), true);
    
    const publicKey = await getPublicKeyFromPrivateKey(privateKey);
    const extractablePublicKey = await getPublicKeyFromPrivateKey(privateKey, true);
  • #3051 1ad523d Thanks @lorisleiva! - Add a createKeyPairSignerFromPrivateKeyBytes helper that compose createKeyPairFromPrivateKeyBytes and createSignerFromKeyPair.

  • #3071 b4bf318 Thanks @steveluscher! - Created a helper that you can use to race two or more promises without having to worry about them leaking memory

  • #3070 f2bb4e8 Thanks @steveluscher! - Created a package for dealing with JavaScript Promises, and copied the implementation of getAbortablePromise into it

  • #3072 c122c75 Thanks @steveluscher! - Fixed a memory leak with transaction confirmation and subscriptions

The New web3.js - Release Candidate

31 Jul 23:15
5a20ed0
Compare
Choose a tag to compare
Pre-release

v2.0.0-rc.0 (2024-07-31)

This is an open invitation to test out what we intend to release as v2.0. Your feedback in these final moments before release will help us catch any bugs and rough edges that we missed during development.

To install the Release Candidate:

npm install --save @solana/web3.js@rc
  • Try the runnable examples in the examples/ directory to get a feel for the API.
  • Use the example dApp at https://solana-labs.github.io/solana-web3.js/example/ – source available here – for an example of how to build transactions with the new web3.js for use with wallets.
  • Install TypeScript clients for on-chain programs like System and Token, then build a useful application or backend service.

Before the general release of web3.js, shortly before Breakpoint 2024 in September, we want to collect as much feedback as possible from you. If you find a bug, are missing a feature, or would like an API modified, file a GitHub Issue.

Changelog since Technology Preview 4

  • #2907 677a9c4 Thanks @steveluscher! - __DEV__ mode will now be the default if you don't set process.env.NODE_ENV at all. This means fewer people ‘accidentally’ finding themselves in production mode with minified error messages.
  • #2905 56fde06 Thanks @steveluscher! - Fixed the type of config on getComputeUnitEstimateForTransactionMessage. It is now optional and does not include transactionMessage.
  • #2968 9239e6e Thanks @lorisleiva! - Tighten return type of isProgramError
  • #2928 bac3747 Thanks @steveluscher! - Added a useSignIn hook that, given a UiWallet or UiWalletAccount, returns a function that you can call to trigger a wallet's ‘Sign In With Solana’ feature.
  • #2950 29821df Thanks @mcintyre94! - Refactor rpc-spec to remove requirement for transports to implement parts of JSON RPC spec
  • #2910 42a70f4 Thanks @Jac0xb! - Fixed a bug where the RPC would fail to throw errors in the event that you configured it with an AbortSignal
  • #2969 419c12e Thanks @mcintyre94! - Add a function to replace accounts in a transaction message using lookup tables
  • #2905 56fde06 Thanks @steveluscher! - Fixed the type of config on getComputeUnitEstimateForTransactionMessage. It is now optional and does not include transactionMessage.

v1.95.2

26 Jul 13:49
a61a732
Compare
Choose a tag to compare

1.95.2 (2024-07-26)

Bug Fixes

  • correct import for getSetComputeUnitLimitInstruction helper (#2992) (a61a732)

v1.95.1

17 Jul 22:05
8ea5794
Compare
Choose a tag to compare

1.95.1 (2024-07-17)

Bug Fixes

  • apply default memcmp encoding (base58) when not supplied (#2945) (8ea5794)

v1.95.0

08 Jul 17:41
3c67d8a
Compare
Choose a tag to compare

1.95.0 (2024-07-08)

Features

The New web3.js – Technology Preview 4

02 Jul 21:17
798651e
Compare
Choose a tag to compare

tp4 (2024-07-02)

This version of the @solana/web3.js Technology Preview fixes a bug with the default RPC transport, adds a utility that you can use to get an estimate of a transaction message's compute unit cost, and introduces @solana/react hooks for interacting with Wallet Standard wallets.

To install the fourth Technology Preview:

npm install --save @solana/web3.js@tp4

For an example of how to use the new @solana/react package to interact with wallets in a React application, see the example application in examples/react-app. We hope to see similar wallet-connection packages patterned off @solana/react for other application frameworks soon.

Try a demo of Technology Preview 4 in your browser at CodeSandbox.

Changelog since Technology Preview 3

  • #2858 22a34aa Thanks @steveluscher! - Transaction signers' methods now take minContextSlot as an option. This is important for signers that simulate transactions, like wallets. They might be interested in knowing the slot at which the transaction was prepared, lest they run simulation at too early a slot.

  • #2852 cec9048 Thanks @lorisleiva! - The signAndSendTransactionMessageWithSigners function now automatically asserts that the provided transaction message contains a single sending signer and fails otherwise.

  • #2707 cb49bfa Thanks @mcintyre94! - Allow creating keypairs and keys from ReadonlyUint8Array

  • #2715 26dae19 Thanks @lorisleiva! - Consolidated getNullableCodec and getOptionCodec with their Zeroable counterparts and added more configurations

    Namely, the prefix option can now be set to null and the fixed option was replaced with the noneValue option which can be set to "zeroes" for Zeroable codecs or a custom byte array for custom representations of none values. This means the getZeroableNullableCodec and getZeroableOptionCodec functions were removed in favor of the new options.

    // Before.
    getZeroableNullableCodec(getU16Codec());
    
    // After.
    getNullableCodec(getU16Codec(), { noneValue: 'zeroes', prefix: null });

    Additionally, it is now possible to create nullable codecs that have no prefix nor noneValue. In this case, the existence of the nullable item is indicated by the presence of any remaining bytes left to decode.

    const codec = getNullableCodec(getU16Codec(), { prefix: null });
    codec.encode(42); // 0x2a00
    codec.encode(null); // Encodes nothing.
    codec.decode(new Uint8Array([42, 0])); // 42
    codec.decode(new Uint8Array([])); // null

    Also note that it is now possible for custom noneValue byte arrays to be of any length — previously, it had to match the fixed-size of the nullable item.

    Here is a recap of all supported scenarios, using a u16 codec as an example:

    encode(42) / encode(null) No noneValue (default) noneValue: "zeroes" Custom noneValue (0xff)
    u8 prefix (default) 0x012a00 / 0x00 0x012a00 / 0x000000 0x012a00 / 0x00ff
    Custom prefix (u16) 0x01002a00 / 0x0000 0x01002a00 / 0x00000000 0x01002a00 / 0x0000ff
    No prefix 0x2a00 / 0x 0x2a00 / 0x0000 0x2a00 / 0xff

    Reciprocal changes were made with getOptionCodec.

  • #2785 4f19842 Thanks @steveluscher! - The development mode error message printer no longer fatals on Safari < 16.4.

  • #2867 be36bab Thanks @steveluscher! - The innerInstructions property of JSON-RPC errors used snake case rather than camelCase for stackHeight and programId. This has been corrected.

  • #2728 f1e9ac2 Thanks @joncinque! - Simulate with the maximum quantity of compute units (1.4M) instead of u32::MAX

  • #2703 0908628 Thanks @steveluscher! - Created a utility function to estimate the compute unit consumption of a transaction message

  • #2795 ce876d9 Thanks @steveluscher! - Added React hooks to which you can pass a Wallet Standard UiWalletAccount and obtain a MessageModifyingSigner, TransactionModifyingSigner, or TransactionSendingSigner for use in constructing, signing, and sending Solana transactions and messages

  • #2772 8fe4551 Thanks @steveluscher! - Added a series of React hooks to which you can pass a Wallet Standard UiWalletAccount to extract its signMessage, signTransaction, and signAndSendTransaction features

  • #2819 7ee47ae Thanks @steveluscher! - Fixed a bug where coalesced RPC calls could end up aborted even though there were still interested consumers. This would happen if the consumer count fell to zero, then rose above zero again, in the same runloop.

  • #2868 91fb1f3 Thanks @steveluscher! - The simulateTransaction RPC method now accepts an innerInstructions param. When true, the simulation result will include an array of inner instructions, if any.

  • #2866 73bd5a9 Thanks @steveluscher! - The TransactionInstruction RPC type now has stackHeight

  • #2751 6340744 Thanks @mcintyre94! - Allow Rpc Request params to be any type, instead of requiring an array

v1.94.0

29 Jun 04:51
0936673
Compare
Choose a tag to compare

1.94.0 (2024-06-29)

Features

  • simulated_transaction: Add Inner Instructions (#2756) (0936673)

v1.93.4

28 Jun 00:26
1df9acb
Compare
Choose a tag to compare

1.93.4 (2024-06-28)

Bug Fixes

  • add deprecation notice for getConfirmedSignatureForAddress2 and update other deprecation notices' validator versions (#2871) (1df9acb), closes #2859
  • deprecate the getStakeActivation RPC method (#2864) (8bd58de)

v1.93.3

27 Jun 14:35
f9b0d6d
Compare
Choose a tag to compare

1.93.3 (2024-06-27)

Bug Fixes

  • onProgramAccountChange() and onAccountChange() now accept an encoding (#2861) (f9b0d6d), closes #2725