stacks-archive / stacks-transactions-js

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

Update network config to be more usable #81

Closed yknl closed 4 years ago

yknl commented 4 years ago

This PR adds the following methods to the StacksNetwork interface:

getBroadcastApiUrl: () => string;
getTransferFeeEstimateApiUrl: () => string;
getAccountApiUrl: (address: string) => string;
getAbiApiUrl: (address: string, contract: string) => string;

And renames the API endpoints:

broadcastEndpoint: string;
transferFeeEstimateEndpoint: string;
accountEndpoint: string;
contractAbiEndpoint: string;

This update makes it possible to create custom network configs by overriding the coreApiUrl property of the existing StacksMainnet or StacksTestnet configs.

Type of Change

Does this introduce a breaking change?

No

Are documentation updates required?

No

Testing information

Checklist

codecov[bot] commented 4 years ago

Codecov Report

Merging #81 into abi will increase coverage by 0.03%. The diff coverage is 77.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##              abi      #81      +/-   ##
==========================================
+ Coverage   83.83%   83.87%   +0.03%     
==========================================
  Files          27       27              
  Lines        1652     1656       +4     
  Branches      348      349       +1     
==========================================
+ Hits         1385     1389       +4     
  Misses        265      265              
  Partials        2        2              
Impacted Files Coverage Δ
src/builders.ts 72.86% <58.33%> (+0.04%) :arrow_up:
src/network.ts 100.00% <100.00%> (+5.26%) :arrow_up:

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 4cc2378...9e40742. Read the comment docs.