stacks-archive / stacks-transactions-js

The JavaScript library for generating Stacks 2.0 transactions
19 stars 17 forks source link

feat: Tx Broadcast Returns Response #91

Closed reedrosenbluth closed 4 years ago

reedrosenbluth commented 4 years ago

Description

This PR augments transaction broadcasting such that it returns a response instead of a string. If the response fails it will contain a TxBroadcastError.

The possible reasons for failure are listed here: https://github.com/blockstack/stacks-blockchain/pull/1510/files#diff-98a3f84802c72cc9abbd3ecc208654e0R23

More details in issue #54

This PR also introduces a few custom Error classes.

Review by commit.

Type of Change

Does this introduce a breaking change?

This introduces a breaking change since it changes the transaction broadcast API return type.

Checklist

codecov[bot] commented 4 years ago

Codecov Report

Merging #91 into master will decrease coverage by 0.07%. The diff coverage is 40.69%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #91      +/-   ##
==========================================
- Coverage   84.25%   84.17%   -0.08%     
==========================================
  Files          27       28       +1     
  Lines        1778     1820      +42     
  Branches      387      390       +3     
==========================================
+ Hits         1498     1532      +34     
- Misses        278      286       +8     
  Partials        2        2              
Impacted Files Coverage Δ
src/authorization.ts 77.09% <5.26%> (+0.12%) :arrow_up:
src/errors.ts 14.28% <14.28%> (ø)
src/transaction.ts 79.31% <16.66%> (+0.24%) :arrow_up:
src/postcondition.ts 88.88% <20.00%> (+0.17%) :arrow_up:
src/clarity/deserialize.ts 92.30% <25.00%> (+0.15%) :arrow_up:
src/types.ts 83.03% <33.33%> (+0.07%) :arrow_up:
src/clarity/serialize.ts 97.36% <50.00%> (+0.03%) :arrow_up:
src/builders.ts 76.14% <100.00%> (+1.83%) :arrow_up:
src/constants.ts 100.00% <100.00%> (ø)
src/contract-abi.ts 75.00% <100.00%> (+2.23%) :arrow_up:
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3394706...7fb3fed. Read the comment docs.