Stacks.js Version 2: What You Should Know

The JavaScript packages under the stacks.js umbrella continue to improve and today we are excited to share details about a major version bump to version 2, which includes breaking changes. Read on for details on breaking change upgrades, how to use new TypeScript magic, and info about the new wallet SDK!

Type
Product update
Topic(s)
Product
Published
August 6, 2021
Author(s)
Author
Engineer
Stacks.js Version 2: What You Should Know
Contents

Breaking Change #1: Broadcasting Transactions

The broadcastTransaction function in @stacks/transactions now returns a more consistent response whether it succeeds or fails:

  • Success: a JSON object with a property txid.
  • Failure: a JSON object with properties txid, error, reason, and reason_data.

For developers with existing integrations who would like to make use of all the updates and fixes of the version 2 release (see changelog below).

Breaking Change #2: No More Default Anchormode

As part of the rollout of end-to-end support for microblocks, the transaction builder in @stacks/transactions no longer sets a default anchormode.

You need to provide the appropriate mode based on your preference. Read more about microblocks.

Typescript Magic: Deserialize Clarity Values Using Concrete Types

You can now specify Clarity value types when deserializing or reading data out of an otherwise opaque ClarityValue object.

Ready to upgrade to the new version of @stacks/transactions? Give it a try:


# npm
npm update @stacks/transactions@^2.0.1
# yarn
yarn upgrade @stacks/transactions@^2.0.1

A New Library to Build Stacks Wallets

This new package allows developers to:

  • Generate a wallet from scratch
  • Encrypt a wallet with a password
  • Restore a wallet and associated accounts
  • Generate new accounts in a wallet
  • Sign transactions for the Stacks blockchain
  • Register usernames on BNS, the naming service built into the Stacks Blockchain

Give it a try and let us know what you think!

And Much More

These were just the highlights. Read the full changelog for v2.0.1 to learn about other fixes. Give your feedback and discuss changes in #dev-general. The Stacks.js GitHub repository is the best place for bug reports of feature requests.

Product updates & dev resources straight to your inbox
Your Email is in an invalid format
Checkbox is required.
Thanks for
subscribing.
Oops! Something went wrong while submitting the form.
Copy link
Mailbox
Hiro news & product updates straight to your inbox
Only relevant communications. We promise we won’t spam.

Related stories