New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@stacks/network

Package Overview
Dependencies
Maintainers
8
Versions
632
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stacks/network - npm Package Compare versions

Comparing version 3.0.0-beta.0 to 3.0.0

41

CHANGELOG.md

@@ -6,9 +6,26 @@ # Change Log

# [3.0.0-beta.0](https://github.com/blockstack/blockstack.js/compare/v2.0.0-beta.1...v3.0.0-beta.0) (2021-07-20)
## [2.0.1](https://github.com/blockstack/blockstack.js/compare/v2.0.1-beta.2...v2.0.1) (2021-08-09)
**Note:** Version bump only for package @stacks/network
## [2.0.1-beta.2](https://github.com/blockstack/blockstack.js/compare/v2.0.1-beta.1...v2.0.1-beta.2) (2021-08-06)
**Note:** Version bump only for package @stacks/network
## [2.0.1-beta.1](https://github.com/blockstack/blockstack.js/compare/v2.0.0-beta.1...v2.0.1-beta.1) (2021-07-26)
### Bug Fixes
* broken types following diverged network config changes ([03e0c1a](https://github.com/blockstack/blockstack.js/commit/03e0c1a3401f3f58f41933563e9eb4cef2df4830))
* removeread only and add private field to prevent run time assignment ([29796ec](https://github.com/blockstack/blockstack.js/commit/29796ece1dd93869500068a2f8d1e5e4d7cfdf5f))
* BREAKING CHANGE: make coreApiUrl readonly for stacks network and initialize in constructor ([5d8cf6d](https://github.com/blockstack/blockstack.js/commit/5d8cf6d366665dace2df8102049d3f7ac1bf437e))
* broken types following diverged network config changes ([1cd9612](https://github.com/blockstack/blockstack.js/commit/1cd96128334465c461665cf079532f66b893b938))
* removeread only and add private field to prevent run time assignment ([62709aa](https://github.com/blockstack/blockstack.js/commit/62709aa5b6483299718063482bc26d6e94cc8c1c))

@@ -19,1 +36,19 @@

* add regtest to list of available networks ([f572477](https://github.com/blockstack/blockstack.js/commit/f572477ca0e5bc5e862c8a4e2fcc276655ee55a3)), closes [#1041](https://github.com/blockstack/blockstack.js/issues/1041)
# [2.0.0-beta.2](https://github.com/blockstack/blockstack.js/compare/v2.0.0-beta.1...v2.0.0-beta.2) (2021-07-26)
### Bug Fixes
* BREAKING CHANGE: make coreApiUrl readonly for stacks network and initialize in constructor ([5d8cf6d](https://github.com/blockstack/blockstack.js/commit/5d8cf6d366665dace2df8102049d3f7ac1bf437e))
* broken types following diverged network config changes ([1cd9612](https://github.com/blockstack/blockstack.js/commit/1cd96128334465c461665cf079532f66b893b938))
* removeread only and add private field to prevent run time assignment ([62709aa](https://github.com/blockstack/blockstack.js/commit/62709aa5b6483299718063482bc26d6e94cc8c1c))
### Features
* add regtest to list of available networks ([f572477](https://github.com/blockstack/blockstack.js/commit/f572477ca0e5bc5e862c8a4e2fcc276655ee55a3)), closes [#1041](https://github.com/blockstack/blockstack.js/issues/1041)

15

dist/esm/index.d.ts
import { TransactionVersion, ChainID } from '@stacks/common';
export declare const HIRO_MAINNET_DEFAULT = "https://stacks-node-api.mainnet.stacks.co";
export declare const HIRO_REGTEST_DEFAULT = "https://stacks-node-api.regtest.stacks.co";
export declare const HIRO_TESTNET_DEFAULT = "https://stacks-node-api.testnet.stacks.co";

@@ -13,4 +12,6 @@ export declare const HIRO_MOCKNET_DEFAULT = "http://localhost:3999";

bnsLookupUrl: string;
readonly coreApiUrl: string;
broadcastEndpoint: string;
transferFeeEstimateEndpoint: string;
transactionFeeEstimateEndpoint: string;
accountEndpoint: string;

@@ -22,2 +23,3 @@ contractAbiEndpoint: string;

getTransferFeeEstimateApiUrl: () => string;
getTransactionFeeEstimateApiUrl: () => string;
getAccountApiUrl: (address: string) => string;

@@ -41,8 +43,7 @@ getAbiApiUrl: (address: string, contract: string) => string;

transferFeeEstimateEndpoint: string;
transactionFeeEstimateEndpoint: string;
accountEndpoint: string;
contractAbiEndpoint: string;
readOnlyFunctionCallEndpoint: string;
private _coreApiUrl;
get coreApiUrl(): string;
set coreApiUrl(_url: string);
readonly coreApiUrl: string;
constructor(networkUrl?: NetworkConfig);

@@ -52,2 +53,3 @@ isMainnet: () => boolean;

getTransferFeeEstimateApiUrl: () => string;
getTransactionFeeEstimateApiUrl: () => string;
getAccountApiUrl: (address: string) => string;

@@ -75,6 +77,1 @@ getAbiApiUrl: (address: string, contract: string) => string;

}
export declare class StacksRegtest extends StacksMainnet implements StacksNetwork {
version: TransactionVersion;
chainId: ChainID;
constructor(networkUrl?: NetworkConfig);
}
import { TransactionVersion, ChainID, fetchPrivate } from '@stacks/common';
export const HIRO_MAINNET_DEFAULT = 'https://stacks-node-api.mainnet.stacks.co';
export const HIRO_REGTEST_DEFAULT = 'https://stacks-node-api.regtest.stacks.co';
export const HIRO_TESTNET_DEFAULT = 'https://stacks-node-api.testnet.stacks.co';

@@ -13,2 +12,3 @@ export const HIRO_MOCKNET_DEFAULT = 'http://localhost:3999';

this.transferFeeEstimateEndpoint = '/v2/fees/transfer';
this.transactionFeeEstimateEndpoint = '/v2/fees/transaction';
this.accountEndpoint = '/v2/accounts';

@@ -20,2 +20,3 @@ this.contractAbiEndpoint = '/v2/contracts/interface';

this.getTransferFeeEstimateApiUrl = () => `${this.coreApiUrl}${this.transferFeeEstimateEndpoint}`;
this.getTransactionFeeEstimateApiUrl = () => `${this.coreApiUrl}${this.transactionFeeEstimateEndpoint}`;
this.getAccountApiUrl = (address) => `${this.coreApiUrl}${this.accountEndpoint}/${address}?proof=0`;

@@ -44,10 +45,4 @@ this.getAbiApiUrl = (address, contract) => `${this.coreApiUrl}${this.contractAbiEndpoint}/${address}/${contract}`;

${contractAddress}/${contractName}/get-stacker-info`;
this._coreApiUrl = networkUrl.url;
this.coreApiUrl = networkUrl.url;
}
get coreApiUrl() {
return this._coreApiUrl;
}
set coreApiUrl(_url) {
throw new Error('Cannot modify property `coreApiUrl` after object initialization');
}
getNameInfo(fullyQualifiedName) {

@@ -91,9 +86,2 @@ const nameLookupURL = `${this.bnsLookupUrl}/v1/names/${fullyQualifiedName}`;

}
export class StacksRegtest extends StacksMainnet {
constructor(networkUrl = { url: HIRO_REGTEST_DEFAULT }) {
super(networkUrl);
this.version = TransactionVersion.Testnet;
this.chainId = ChainID.Testnet;
}
}
//# sourceMappingURL=index.js.map
import { TransactionVersion, ChainID } from '@stacks/common';
export declare const HIRO_MAINNET_DEFAULT = "https://stacks-node-api.mainnet.stacks.co";
export declare const HIRO_REGTEST_DEFAULT = "https://stacks-node-api.regtest.stacks.co";
export declare const HIRO_TESTNET_DEFAULT = "https://stacks-node-api.testnet.stacks.co";

@@ -13,4 +12,6 @@ export declare const HIRO_MOCKNET_DEFAULT = "http://localhost:3999";

bnsLookupUrl: string;
readonly coreApiUrl: string;
broadcastEndpoint: string;
transferFeeEstimateEndpoint: string;
transactionFeeEstimateEndpoint: string;
accountEndpoint: string;

@@ -22,2 +23,3 @@ contractAbiEndpoint: string;

getTransferFeeEstimateApiUrl: () => string;
getTransactionFeeEstimateApiUrl: () => string;
getAccountApiUrl: (address: string) => string;

@@ -41,8 +43,7 @@ getAbiApiUrl: (address: string, contract: string) => string;

transferFeeEstimateEndpoint: string;
transactionFeeEstimateEndpoint: string;
accountEndpoint: string;
contractAbiEndpoint: string;
readOnlyFunctionCallEndpoint: string;
private _coreApiUrl;
get coreApiUrl(): string;
set coreApiUrl(_url: string);
readonly coreApiUrl: string;
constructor(networkUrl?: NetworkConfig);

@@ -52,2 +53,3 @@ isMainnet: () => boolean;

getTransferFeeEstimateApiUrl: () => string;
getTransactionFeeEstimateApiUrl: () => string;
getAccountApiUrl: (address: string) => string;

@@ -75,6 +77,1 @@ getAbiApiUrl: (address: string, contract: string) => string;

}
export declare class StacksRegtest extends StacksMainnet implements StacksNetwork {
version: TransactionVersion;
chainId: ChainID;
constructor(networkUrl?: NetworkConfig);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StacksRegtest = exports.StacksMocknet = exports.StacksTestnet = exports.StacksMainnet = exports.HIRO_MOCKNET_DEFAULT = exports.HIRO_TESTNET_DEFAULT = exports.HIRO_REGTEST_DEFAULT = exports.HIRO_MAINNET_DEFAULT = void 0;
exports.StacksMocknet = exports.StacksTestnet = exports.StacksMainnet = exports.HIRO_MOCKNET_DEFAULT = exports.HIRO_TESTNET_DEFAULT = exports.HIRO_MAINNET_DEFAULT = void 0;
const common_1 = require("@stacks/common");
exports.HIRO_MAINNET_DEFAULT = 'https://stacks-node-api.mainnet.stacks.co';
exports.HIRO_REGTEST_DEFAULT = 'https://stacks-node-api.regtest.stacks.co';
exports.HIRO_TESTNET_DEFAULT = 'https://stacks-node-api.testnet.stacks.co';

@@ -16,2 +15,3 @@ exports.HIRO_MOCKNET_DEFAULT = 'http://localhost:3999';

this.transferFeeEstimateEndpoint = '/v2/fees/transfer';
this.transactionFeeEstimateEndpoint = '/v2/fees/transaction';
this.accountEndpoint = '/v2/accounts';

@@ -23,2 +23,3 @@ this.contractAbiEndpoint = '/v2/contracts/interface';

this.getTransferFeeEstimateApiUrl = () => `${this.coreApiUrl}${this.transferFeeEstimateEndpoint}`;
this.getTransactionFeeEstimateApiUrl = () => `${this.coreApiUrl}${this.transactionFeeEstimateEndpoint}`;
this.getAccountApiUrl = (address) => `${this.coreApiUrl}${this.accountEndpoint}/${address}?proof=0`;

@@ -47,10 +48,4 @@ this.getAbiApiUrl = (address, contract) => `${this.coreApiUrl}${this.contractAbiEndpoint}/${address}/${contract}`;

${contractAddress}/${contractName}/get-stacker-info`;
this._coreApiUrl = networkUrl.url;
this.coreApiUrl = networkUrl.url;
}
get coreApiUrl() {
return this._coreApiUrl;
}
set coreApiUrl(_url) {
throw new Error('Cannot modify property `coreApiUrl` after object initialization');
}
getNameInfo(fullyQualifiedName) {

@@ -97,10 +92,2 @@ const nameLookupURL = `${this.bnsLookupUrl}/v1/names/${fullyQualifiedName}`;

exports.StacksMocknet = StacksMocknet;
class StacksRegtest extends StacksMainnet {
constructor(networkUrl = { url: exports.HIRO_REGTEST_DEFAULT }) {
super(networkUrl);
this.version = common_1.TransactionVersion.Testnet;
this.chainId = common_1.ChainID.Testnet;
}
}
exports.StacksRegtest = StacksRegtest;
//# sourceMappingURL=index.js.map
{
"name": "@stacks/network",
"version": "3.0.0-beta.0",
"version": "3.0.0",
"description": "Library for Stacks network operations",

@@ -41,3 +41,3 @@ "keywords": [

"dependencies": {
"@stacks/common": "^3.0.0-beta.0"
"@stacks/common": "^3.0.0"
},

@@ -62,3 +62,3 @@ "devDependencies": {

"unpkg": "dist/index.umd.js",
"gitHead": "74e07902c986168aa48d34adb47a46de88bc2cdc"
"gitHead": "728b58358f2876d282f511ba1fc6c4fa9a1ac2f3"
}

@@ -13,3 +13,3 @@ # @stacks/network

Creating a Stacks mainnet, testnet, regtest or mocknet network
Creating a Stacks mainnet, testnet or mocknet network

@@ -23,4 +23,2 @@ ```typescript

const regtest = new StacksRegtest();
const mocknet = new StacksMocknet();

@@ -32,3 +30,3 @@ ```

```typescript
network.coreApiUrl = 'https://www.mystacksnode.com/';
const network = new StacksMainnet({ url: 'https://www.mystacksnode.com/' });
```

@@ -60,20 +58,24 @@

```typescript
const txBroadcastUrl = network.getBroadcastApiUrl();
const txBroadcastUrl = network.getBroadcastApiUrl();
const feeEstimateUrl = network.getTransferFeeEstimateApiUrl();
const feeEstimateUrl = network.getTransferFeeEstimateApiUrl();
const address = 'SP2BS6HD7TN34V8Z5BNF8Q2AW3K8K2DPV4264CF26';
const accountInfoUrl = network.getAccountApiUrl(address);
const address = 'SP2BS6HD7TN34V8Z5BNF8Q2AW3K8K2DPV4264CF26';
const accountInfoUrl = network.getAccountApiUrl(address);
const contractName = 'hello_world';
const abiUrl = network.getAbiApiUrl(address, contractName);
const contractName = 'hello_world';
const abiUrl = network.getAbiApiUrl(address, contractName);
const functionName = 'hello';
const readOnlyFunctionCallUrl = network.getReadOnlyFunctionCallApiUrl(address, contractName, functionName);
const functionName = 'hello';
const readOnlyFunctionCallUrl = network.getReadOnlyFunctionCallApiUrl(
address,
contractName,
functionName
);
const nodeInfoUrl = network.getInfoUrl();
const nodeInfoUrl = network.getInfoUrl();
const blockTimeUrl = network.getBlockTimeInfoUrl();
const blockTimeUrl = network.getBlockTimeInfoUrl();
const poxInfoUrl = network.getPoxInfoUrl();
```
const poxInfoUrl = network.getPoxInfoUrl();
```
import { TransactionVersion, ChainID, fetchPrivate } from '@stacks/common';
export const HIRO_MAINNET_DEFAULT = 'https://stacks-node-api.mainnet.stacks.co';
export const HIRO_REGTEST_DEFAULT = 'https://stacks-node-api.regtest.stacks.co';
export const HIRO_TESTNET_DEFAULT = 'https://stacks-node-api.testnet.stacks.co';

@@ -16,4 +15,6 @@ export const HIRO_MOCKNET_DEFAULT = 'http://localhost:3999';

bnsLookupUrl: string;
readonly coreApiUrl: string;
broadcastEndpoint: string;
transferFeeEstimateEndpoint: string;
transactionFeeEstimateEndpoint: string;
accountEndpoint: string;

@@ -25,2 +26,3 @@ contractAbiEndpoint: string;

getTransferFeeEstimateApiUrl: () => string;
getTransactionFeeEstimateApiUrl: () => string;
getAccountApiUrl: (address: string) => string;

@@ -58,20 +60,18 @@ getAbiApiUrl: (address: string, contract: string) => string;

transferFeeEstimateEndpoint = '/v2/fees/transfer';
transactionFeeEstimateEndpoint = '/v2/fees/transaction';
accountEndpoint = '/v2/accounts';
contractAbiEndpoint = '/v2/contracts/interface';
readOnlyFunctionCallEndpoint = '/v2/contracts/call-read';
private _coreApiUrl: string;
get coreApiUrl() {
return this._coreApiUrl;
}
set coreApiUrl(_url: string) {
throw new Error('Cannot modify property `coreApiUrl` after object initialization');
}
readonly coreApiUrl: string;
constructor(networkUrl: NetworkConfig = { url: HIRO_MAINNET_DEFAULT }) {
this._coreApiUrl = networkUrl.url;
this.coreApiUrl = networkUrl.url;
}
isMainnet = () => this.version === TransactionVersion.Mainnet;
getBroadcastApiUrl = () => `${this.coreApiUrl}${this.broadcastEndpoint}`;
getTransferFeeEstimateApiUrl = () => `${this.coreApiUrl}${this.transferFeeEstimateEndpoint}`;
getTransactionFeeEstimateApiUrl = () =>
`${this.coreApiUrl}${this.transactionFeeEstimateEndpoint}`;
getAccountApiUrl = (address: string) =>

@@ -156,10 +156,1 @@ `${this.coreApiUrl}${this.accountEndpoint}/${address}?proof=0`;

}
export class StacksRegtest extends StacksMainnet implements StacksNetwork {
version = TransactionVersion.Testnet;
chainId = ChainID.Testnet;
constructor(networkUrl: NetworkConfig = { url: HIRO_REGTEST_DEFAULT }) {
super(networkUrl);
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc