@stacks/network 3.2.1-alpha.0 → 3.2.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/polyfill/index.js +1 -0
- package/dist/umd/index.js +7504 -0
- package/dist/umd/index.js.map +1 -0
- package/package.json +10 -6
- package/dist/index.umd.js +0 -2
- package/dist/index.umd.js.LICENSE.txt +0 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
window.global=window;import{TransactionVersion as t,ChainID as s,fetchPrivate as e}from"@stacks/common/dist/polyfill";const n="https://stacks-node-api.mainnet.stacks.co",i="https://stacks-node-api.testnet.stacks.co",r="http://localhost:3999",o=["mainnet","testnet"];class a{constructor(e){this.version=t.Mainnet,this.chainId=s.Mainnet,this.bnsLookupUrl="https://stacks-node-api.mainnet.stacks.co",this.broadcastEndpoint="/v2/transactions",this.transferFeeEstimateEndpoint="/v2/fees/transfer",this.transactionFeeEstimateEndpoint="/v2/fees/transaction",this.accountEndpoint="/v2/accounts",this.contractAbiEndpoint="/v2/contracts/interface",this.readOnlyFunctionCallEndpoint="/v2/contracts/call-read",this.isMainnet=()=>this.version===t.Mainnet,this.getBroadcastApiUrl=()=>`${this.coreApiUrl}${this.broadcastEndpoint}`,this.getTransferFeeEstimateApiUrl=()=>`${this.coreApiUrl}${this.transferFeeEstimateEndpoint}`,this.getTransactionFeeEstimateApiUrl=()=>`${this.coreApiUrl}${this.transactionFeeEstimateEndpoint}`,this.getAccountApiUrl=t=>`${this.coreApiUrl}${this.accountEndpoint}/${t}?proof=0`,this.getAbiApiUrl=(t,s)=>`${this.coreApiUrl}${this.contractAbiEndpoint}/${t}/${s}`,this.getReadOnlyFunctionCallApiUrl=(t,s,e)=>`${this.coreApiUrl}${this.readOnlyFunctionCallEndpoint}/${t}/${s}/${encodeURIComponent(e)}`,this.getInfoUrl=()=>`${this.coreApiUrl}/v2/info`,this.getBlockTimeInfoUrl=()=>`${this.coreApiUrl}/extended/v1/info/network_block_times`,this.getPoxInfoUrl=()=>`${this.coreApiUrl}/v2/pox`,this.getRewardsUrl=(t,s)=>{let e=`${this.coreApiUrl}/extended/v1/burnchain/rewards/${t}`;return s&&(e=`${e}?limit=${s.limit}&offset=${s.offset}`),e},this.getRewardsTotalUrl=t=>`${this.coreApiUrl}/extended/v1/burnchain/rewards/${t}/total`,this.getRewardHoldersUrl=(t,s)=>{let e=`${this.coreApiUrl}/extended/v1/burnchain/reward_slot_holders/${t}`;return s&&(e=`${e}?limit=${s.limit}&offset=${s.offset}`),e},this.getStackerInfoUrl=(t,s)=>`${this.coreApiUrl}${this.readOnlyFunctionCallEndpoint}\n ${t}/${s}/get-stacker-info`,this.coreApiUrl=e.url}getNameInfo(t){const s=`${this.bnsLookupUrl}/v1/names/${t}`;return e(s).then((t=>{if(404===t.status)throw new Error("Name not found");if(200!==t.status)throw new Error(`Bad response status: ${t.status}`);return t.json()})).then((t=>t.address?Object.assign({},t,{address:t.address}):t))}}a.fromName=t=>{switch(t){case"mainnet":return new c;case"testnet":return new l;default:throw new Error(`Invalid network name provided. Must be one of the following: ${o.join(", ")}`)}},a.fromNameOrNetwork=t=>"string"!=typeof t&&"version"in t?t:a.fromName(t);class c extends a{constructor(e={url:"https://stacks-node-api.mainnet.stacks.co"}){super(e),this.version=t.Mainnet,this.chainId=s.Mainnet}}class l extends a{constructor(e={url:"https://stacks-node-api.testnet.stacks.co"}){super(e),this.version=t.Testnet,this.chainId=s.Testnet}}class h extends a{constructor(e={url:"http://localhost:3999"}){super(e),this.version=t.Testnet,this.chainId=s.Testnet}}export{n as HIRO_MAINNET_DEFAULT,r as HIRO_MOCKNET_DEFAULT,i as HIRO_TESTNET_DEFAULT,c as StacksMainnet,h as StacksMocknet,a as StacksNetwork,o as StacksNetworks,l as StacksTestnet};
|