Skip to content

Migration to 9.0.0

This guide describes all breaking changes introduced with v9.0.0.

drop waitMined static method

If you used it like

const sdk = await Universal({ ... })
sdk.waitMined(false)

then you have to rewrite it using Stamp composition

const sdk = await Universal.compose({
  deepProps: { Ae: { defaults: { waitMined: false } } }
})({ ... })

or pass it to specific methods, like

sdk.spend(amount, receiver, { waitMined: false });

or even

const sdk = await Universal({ ... })
sdk.deepProps({ Ae: { defaults: { waitMined: false } } })

drop assertedType, use decode instead

If you used it like

const payload = Crypto.decodeBase64Check(Crypto.assertedType('tx_...', 'tx'));

then you have to rewrite it using decode method

const payload = TxBuilderHelper.decode('tx_...', 'tx');

validator: recursive validator, simplify schema

Instead of TransactionValidator stamp use verifyTransaction function. The function accepts a transaction, and a Node instance for validation (instead of network id), it doesn't return an unpacked transaction anymore, just an array of errors. Each error contains a verbose message (msg before), unique key (for easy comparison), checkedKeys array (txKey before). Using node instead of networkId allows to ensure transaction validation, so warnings are errors now (type field removed).

SCHEMA doesn't contain validation schema anymore. This wasn't supposed to be used by external developers.

simplify buildTxHash helper

If you used buildHash like

const hash = TxBuilderHelper.buildHash('xx', Buffer.from([1, 2, 3]), { raw: true });

then use

const hash = Crypto.hash(Buffer.from([1, 2, 3]));

If you used it with a falsy raw then

const hash = TxBuilderHelper.encode(Crypto.hash(Buffer.from([1, 2, 3])), 'xx');

buildTxHash don't have raw switch anymore, it returns th_-encoded string in all cases, but it still accepts transactions as a string and as a buffer.

enable verification in deep props instead of extra variable

If you were passing verifyTx: false to sdk factory then use verify: false instead.