This PR adds the network options object to transaction builder functions. Networks are constants that will determine the transaction version, chain ID and API URLs. This simplifies the builder options and provides defaults. This PR also moves the broadcast() function out of the StacksTransaction class and into a separate function in the tx builders. This is so that users can use a network object to specify broadcast API URLs. This PR is based off of the fee estimate PR: #45
The StacksTransaction class no longer has a broadcast() method. It has been moved to a separate function broadcastTransaction(). And it now takes a transaction and network as arguments.
Are documentation updates required?
The readme examples have been updated with this PR.
Testing information
Provide context on how tests should be performed.
Transactions should continue to be generated and broadcasted correctly when using the new options objects for transaction builders.
Checklist
[x] Code is commented where needed
[x] Unit test coverage for new or modified code paths
[x] npm run test passes
[ ] Changelog is updated
[x] Tag 1 of @yknl, @zone117x, @reedrosenbluth for review
This PR adds the network options object to transaction builder functions. Networks are constants that will determine the transaction version, chain ID and API URLs. This simplifies the builder options and provides defaults. This PR also moves the
broadcast()
function out of theStacksTransaction
class and into a separate function in the tx builders. This is so that users can use a network object to specify broadcast API URLs. This PR is based off of the fee estimate PR: #45Usage:
Creating a custom network
Resolves #64
Type of Change
Does this introduce a breaking change?
Yes, the options object for transaction builder functions have been changed.
TokenTransferOptions
ContractDeployOptions
ContractCallOptions
The
StacksTransaction
class no longer has abroadcast()
method. It has been moved to a separate functionbroadcastTransaction()
. And it now takes a transaction and network as arguments.Are documentation updates required?
The readme examples have been updated with this PR.
Testing information
Provide context on how tests should be performed. Transactions should continue to be generated and broadcasted correctly when using the new options objects for transaction builders.
Checklist
npm run test
passes