Skip to content

Releases: dao-xyz/borsh-ts

5.2.3

19 May 11:34
Compare
Choose a tag to compare
  • fix: export getDependencies method. This method allows you to get all classes with schemas that extend a particular class

5.2.2

09 Apr 09:46
Compare
Choose a tag to compare
  • fix: reset cached deserialisation behaviour on dynamic imports. This will allow dynamically imported classes to also be considered for Enum deserialisation

5.2.1

17 Jan 09:49
Compare
Choose a tag to compare
  • feat: Custom class serializer

Custom class serialization that is useful if you want to override serialization behaviour, like doing caching

Example

import { serializer } from '@dao-xyz/borsh'
class TestStruct {

  @field({type: 'u8'})
  public number: number;

  constructor(number: number) {
    this.number = number;
  }

  cache: Uint8Array | undefined;

  @serializer()
  override(writer: BinaryWriter, serialize: (obj: this) => Uint8Array) {
    if (!this.cache) {
      this.cache = serialize(this)
    }
    writer.set(this.cache)
  }
}

5.1.8

14 Sep 05:41
Compare
Choose a tag to compare
  • fix: improve error message for variant conflict (b35bf99)

5.1.7

07 Sep 05:08
Compare
Choose a tag to compare
  • fix: Throw BorshError instead of Error on failing to decode bool and u8

5.1.6

06 Sep 18:25
Compare
Choose a tag to compare
  • fix: add overflow checks for string decoding to coerce behaviours between protobuf/utf8 and Buffer.toString()

5.1.5

09 Mar 15:42
Compare
Choose a tag to compare
  • Prevent unbound allocation for arrays on deserialization
  • Reduce call stack depth when deserializing many elements

5.1.4

22 Jan 10:37
Compare
Choose a tag to compare
  • Improve performance for large string encoding/decoding. See benchmark.

5.1.3

17 Jan 09:57
Compare
Choose a tag to compare
  • Bug fix: Prevent u256 and u512 deserialization modifying the original serialized byte array when passed as Buffer

5.1.2

15 Jan 16:23
Compare
Choose a tag to compare
  • Faster u64 serialization by handling small numbers differently

Benchmark below. Protobuf does not deserialize into bigint so these benchmarks are not easily comparable.

borsh u64 with bigint x 5,385,093 ops/sec ±0.44% (389 runs sampled)
protobujs u64 with bigint x 7,022,500 ops/sec ±0.53% (393 runs sampled)
borsh u64 with number x 6,124,037 ops/sec ±0.42% (393 runs sampled)
protobujs u64 with number x 4,639,581 ops/sec ±0.35% (394 runs sampled)