Skip to content

Releases: solana-labs/solana-web3.js

v1.92.3

06 Jun 17:23
abbdc5b
Compare
Choose a tag to compare

1.92.3 (2024-06-06)

Bug Fixes

  • Rewrite the message printer as a parser to avoid problems with regexes in old browsers (#2785) (4f19842)

v1.92.2

05 Jun 17:36
327dc9d
Compare
Choose a tag to compare

1.92.2 (2024-06-05)

Bug Fixes

  • Add getter for logs to sendTransactionError (#2771) (327dc9d)

v1.92.1

04 Jun 16:01
Compare
Choose a tag to compare

1.92.1 (2024-06-04)

Bug Fixes

v1.92.0

04 Jun 00:52
21f241b
Compare
Choose a tag to compare

1.92.0 (2024-06-04)

Features

  • added transaction logs to send transaction functions (#2736) (9369269)

v1.91.9

03 Jun 17:56
5527b0e
Compare
Choose a tag to compare

1.91.9 (2024-06-03)

Bug Fixes

  • library-legacy/deps: rpc-websockets@^7.11.0->^7.11.1 (#2758) (5527b0e)

v1.91.8

03 May 18:58
Compare
Choose a tag to compare

1.91.8 (2024-05-03)

Bug Fixes

  • @solana/web3.js should now be compatible with Vercel Edge runtime (4ea9bc9)

The New web3.js – Technology Preview 3

26 Apr 15:31
c95ff26
Compare
Choose a tag to compare

tp3 (2024-04-25)

The next version of the @solana/web3.js Technology Preview brings a major change to how signed transactions are represented, in response to user feedback.

To install the third Technology Preview:

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

Most notably, all *Transaction*() helpers have been renamed to *TransactionMessage*() to reflect what is actually being built when you build a transaction: the transaction message.

Before

const tx = pipe(
    createTransaction({ version: 0 }),
    tx => addTransactionFeePayer(payerAddress, tx),
    /* ... */
);

After

const txMessage = pipe(
    createTransactionMessage({ version: 0 }),
    m => addTransactionMessageFeePayer(payerAddress, m),
    /* ... */
);

We've introduced a new type to represent signed and partially signed messages. This type encapsulates the bytes of a transaction message – however they were serialized – and the ordered map of signer addresses to signatures. Reducing a transaction message to just those two things after the first signature is applied will make it harder for a subsequent signer to invalidate the existing signatures by _re_serializing the transaction message in such a way that the bytes or the order of signer addresses changes.

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

Changelog since Technology Preview 2

  • #2434 31916ae Thanks @lorisleiva! - Renamed mapCodec to transformCodec

  • #2411 2e5af9f Thanks @lorisleiva! - Renamed fixCodec to fixCodecSize

  • #2352 125fc15 Thanks @steveluscher! - SubtleCrypto assertion methods that can make their assertions synchronously are now synchronous, for performance.

  • #2329 478443f Thanks @luu-alex! - createKeyPairFromBytes() now validates that the public key imported is the one that would be derived from the private key imported

  • #2383 ce1be3f Thanks @lorisleiva! - getScalarEnumCodec is now called getEnumCodec

  • #2382 7e86583 Thanks @lorisleiva! - getDataEnumCodec is now called getDiscriminatedUnionCodec

  • #2397 a548de2 Thanks @lorisleiva! - Added a new addCodecSizePrefix primitive

    const codec = addCodecSizePrefix(getBase58Codec(), getU32Codec());
    
    codec.encode("hello world");
    // 0x0b00000068656c6c6f20776f726c64
    //   |       └-- Our encoded base-58 string.
    //   └-- Our encoded u32 size prefix.
  • #2419 89f399d Thanks @lorisleiva! - Added new addCodecSentinel primitive

    The addCodecSentinel function provides a new way of delimiting the size of a codec. It allows us to add a sentinel to the end of the encoded data and to read until that sentinel is found when decoding. It accepts any codec and a Uint8Array sentinel responsible for delimiting the encoded data.

    const codec = addCodecSentinel(getUtf8Codec(), new Uint8Array([255, 255]));
    codec.encode("hello");
    // 0x68656c6c6fffff
    //   |        └-- Our sentinel.
    //   └-- Our encoded string.
  • #2400 ebb03cd Thanks @lorisleiva! - Added new containsBytes and getConstantCodec helpers

    The containsBytes helper checks if a Uint8Array contains another Uint8Array at a given offset.

    containsBytes(new Uint8Array([1, 2, 3, 4]), new Uint8Array([2, 3]), 1); // true
    containsBytes(new Uint8Array([1, 2, 3, 4]), new Uint8Array([2, 3]), 2); // false

    The getConstantCodec function accepts any Uint8Array and returns a Codec<void>. When encoding, it will set the provided Uint8Array as-is. When decoding, it will assert that the next bytes contain the provided Uint8Array and move the offset forward.

    const codec = getConstantCodec(new Uint8Array([1, 2, 3]));
    
    codec.encode(undefined); // 0x010203
    codec.decode(new Uint8Array([1, 2, 3])); // undefined
    codec.decode(new Uint8Array([1, 2, 4])); // Throws an error.
  • #2344 deb7b80 Thanks @lorisleiva! - Improve getTupleCodec type inferences and performance

    The tuple codec now infers its encoded/decoded type from the provided codec array and uses the new DrainOuterGeneric helper to reduce the number of TypeScript instantiations.

  • #2322 6dcf548 Thanks @lorisleiva! - Use DrainOuterGeneric helper on codec type mappings

    This significantly reduces the number of TypeScript instantiations on object mappings,
    which increases TypeScript performance and prevents "Type instantiation is excessively deep and possibly infinite" errors.

  • #2381 49a764c Thanks [@lorisleiva](ht...

Read more

v1.91.7

19 Apr 00:34
da22d0b
Compare
Choose a tag to compare

1.91.7 (2024-04-19)

Bug Fixes

  • update @solana/spl-token to 0.4.5 in tests (#2529) (da22d0b)

v1.91.6

17 Apr 11:05
7d3adbb
Compare
Choose a tag to compare

1.91.6 (2024-04-17)

Bug Fixes

  • revert use of internal fast-stable-stringify in legacy library (#2509) (7d3adbb)

v1.91.5

17 Apr 07:46
18d6b56
Compare
Choose a tag to compare

1.91.5 (2024-04-17)

Bug Fixes

  • use our version of fast-stable-stringify everywhere (#2504) (18d6b56)