metaplex-foundation / amman

A modern mandatory toolbelt to help test solana SDK libraries and apps on a locally running validator.
https://metaplex-foundation.github.io/amman/docs/
Apache License 2.0
72 stars 17 forks source link

feat: improved asserts and misc fixes #31

Closed thlorenz closed 2 years ago

thlorenz commented 2 years ago

Summary

The main purpose of this PR is to improve the assertion methods and to make them more discoverable by exposing them directly on the Promise returned by sendAndConfirmTransaction.

Transaction Handler Asserts

The following methods are exposed:

Either of the above have to be synchronously called on the returned Promise or an error is raised. This allowed us to default skipPreflight: true since now errors don't fall through the cracks like as they potentially did before when that setting was used and we did not check that asserts were performed on the results.

assertNone allows to bypass this behavior.

Transaction Checker Asserts

For cases where the amman transaction handler cannot be used a TransactionChecker is provided in order to allow performing the same asserts via the transaction signature.

Misc

Browser Support

First attempt at making amman usable in the browser, not sufficient at this point.

Relay

Fixed emitter leak by tracking account subs

Fetched Accounts

Only creating accounts folder if we have some accounts to fetch.

Config

Fixed extending config which had broken account resolvers.