@stacks/network
Advanced tools
Comparing version 6.14.1-pr.31 to 6.14.1-pr.32
@@ -14,3 +14,9 @@ export declare enum ChainId { | ||
} | ||
export declare enum AddressVersion { | ||
MainnetSingleSig = 22, | ||
MainnetMultiSig = 20, | ||
TestnetSingleSig = 26, | ||
TestnetMultiSig = 21 | ||
} | ||
export declare const DEFAULT_TRANSACTION_VERSION = TransactionVersion.Mainnet; | ||
export declare function whenTransactionVersion(transactionVersion: TransactionVersion): <T>(map: Record<TransactionVersion, T>) => T; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.whenTransactionVersion = exports.DEFAULT_TRANSACTION_VERSION = exports.TransactionVersion = exports.DEFAULT_CHAIN_ID = exports.PeerNetworkId = exports.ChainId = void 0; | ||
exports.whenTransactionVersion = exports.DEFAULT_TRANSACTION_VERSION = exports.AddressVersion = exports.TransactionVersion = exports.DEFAULT_CHAIN_ID = exports.PeerNetworkId = exports.ChainId = void 0; | ||
var ChainId; | ||
@@ -20,2 +20,9 @@ (function (ChainId) { | ||
})(TransactionVersion || (exports.TransactionVersion = TransactionVersion = {})); | ||
var AddressVersion; | ||
(function (AddressVersion) { | ||
AddressVersion[AddressVersion["MainnetSingleSig"] = 22] = "MainnetSingleSig"; | ||
AddressVersion[AddressVersion["MainnetMultiSig"] = 20] = "MainnetMultiSig"; | ||
AddressVersion[AddressVersion["TestnetSingleSig"] = 26] = "TestnetSingleSig"; | ||
AddressVersion[AddressVersion["TestnetMultiSig"] = 21] = "TestnetMultiSig"; | ||
})(AddressVersion || (exports.AddressVersion = AddressVersion = {})); | ||
exports.DEFAULT_TRANSACTION_VERSION = TransactionVersion.Mainnet; | ||
@@ -22,0 +29,0 @@ function whenTransactionVersion(transactionVersion) { |
@@ -14,3 +14,9 @@ export declare enum ChainId { | ||
} | ||
export declare enum AddressVersion { | ||
MainnetSingleSig = 22, | ||
MainnetMultiSig = 20, | ||
TestnetSingleSig = 26, | ||
TestnetMultiSig = 21 | ||
} | ||
export declare const DEFAULT_TRANSACTION_VERSION = TransactionVersion.Mainnet; | ||
export declare function whenTransactionVersion(transactionVersion: TransactionVersion): <T>(map: Record<TransactionVersion, T>) => T; |
@@ -17,2 +17,9 @@ export var ChainId; | ||
})(TransactionVersion || (TransactionVersion = {})); | ||
export var AddressVersion; | ||
(function (AddressVersion) { | ||
AddressVersion[AddressVersion["MainnetSingleSig"] = 22] = "MainnetSingleSig"; | ||
AddressVersion[AddressVersion["MainnetMultiSig"] = 20] = "MainnetMultiSig"; | ||
AddressVersion[AddressVersion["TestnetSingleSig"] = 26] = "TestnetSingleSig"; | ||
AddressVersion[AddressVersion["TestnetMultiSig"] = 21] = "TestnetMultiSig"; | ||
})(AddressVersion || (AddressVersion = {})); | ||
export const DEFAULT_TRANSACTION_VERSION = TransactionVersion.Mainnet; | ||
@@ -19,0 +26,0 @@ export function whenTransactionVersion(transactionVersion) { |
@@ -7,2 +7,6 @@ export interface StacksNetwork { | ||
bootAddress: string; | ||
addressVersion: { | ||
singleSig: number; | ||
multiSig: number; | ||
}; | ||
} | ||
@@ -9,0 +13,0 @@ export declare const STACKS_MAINNET: StacksNetwork; |
import { DEVNET_URL, HIRO_MAINNET_URL, HIRO_TESTNET_URL } from '@stacks/common'; | ||
import { ChainId, PeerNetworkId, TransactionVersion } from './constants'; | ||
import { AddressVersion, ChainId, PeerNetworkId, TransactionVersion } from './constants'; | ||
export const STACKS_MAINNET = { | ||
@@ -9,2 +9,6 @@ chainId: ChainId.Mainnet, | ||
bootAddress: 'SP000000000000000000002Q6VF78', | ||
addressVersion: { | ||
singleSig: AddressVersion.MainnetSingleSig, | ||
multiSig: AddressVersion.MainnetMultiSig, | ||
}, | ||
}; | ||
@@ -17,2 +21,6 @@ export const STACKS_TESTNET = { | ||
bootAddress: 'ST000000000000000000002AMW42H', | ||
addressVersion: { | ||
singleSig: AddressVersion.TestnetSingleSig, | ||
multiSig: AddressVersion.TestnetMultiSig, | ||
}, | ||
}; | ||
@@ -19,0 +27,0 @@ export const STACKS_DEVNET = { |
@@ -7,2 +7,6 @@ export interface StacksNetwork { | ||
bootAddress: string; | ||
addressVersion: { | ||
singleSig: number; | ||
multiSig: number; | ||
}; | ||
} | ||
@@ -9,0 +13,0 @@ export declare const STACKS_MAINNET: StacksNetwork; |
@@ -12,2 +12,6 @@ "use strict"; | ||
bootAddress: 'SP000000000000000000002Q6VF78', | ||
addressVersion: { | ||
singleSig: constants_1.AddressVersion.MainnetSingleSig, | ||
multiSig: constants_1.AddressVersion.MainnetMultiSig, | ||
}, | ||
}; | ||
@@ -20,2 +24,6 @@ exports.STACKS_TESTNET = { | ||
bootAddress: 'ST000000000000000000002AMW42H', | ||
addressVersion: { | ||
singleSig: constants_1.AddressVersion.TestnetSingleSig, | ||
multiSig: constants_1.AddressVersion.TestnetMultiSig, | ||
}, | ||
}; | ||
@@ -22,0 +30,0 @@ exports.STACKS_DEVNET = { |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.StacksNetwork=t():e.StacksNetwork=t()}(this,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ChainId:()=>n,DEFAULT_CHAIN_ID:()=>o,DEFAULT_TRANSACTION_VERSION:()=>i,PeerNetworkId:()=>r,STACKS_DEVNET:()=>N,STACKS_MAINNET:()=>w,STACKS_MOCKNET:()=>h,STACKS_TESTNET:()=>O,StacksNetworks:()=>k,TransactionVersion:()=>a,deriveDefaultUrl:()=>j,networkFrom:()=>g,networkFromName:()=>M,whenTransactionVersion:()=>s});var n=(e=>(e[e.Mainnet=1]="Mainnet",e[e.Testnet=2147483648]="Testnet",e))(n||{}),r=(e=>(e[e.Mainnet=385875968]="Mainnet",e[e.Testnet=4278190080]="Testnet",e))(r||{});const o=1;var a=(e=>(e[e.Mainnet=0]="Mainnet",e[e.Testnet=128]="Testnet",e))(a||{});const i=0;function s(e){return t=>t[e]}const c="https://api.mainnet.hiro.so",p="https://api.testnet.hiro.so",d="http://localhost:3999";var u=Object.defineProperty,f=Object.defineProperties,T=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable,m=(e,t,n)=>t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,S=(e,t)=>{for(var n in t||(t={}))y.call(t,n)&&m(e,n,t[n]);if(l)for(var n of l(t))b.call(t,n)&&m(e,n,t[n]);return e};const w={chainId:n.Mainnet,transactionVersion:a.Mainnet,peerNetworkId:r.Mainnet,magicBytes:"X2",bootAddress:"SP000000000000000000002Q6VF78"},O={chainId:n.Testnet,transactionVersion:a.Testnet,peerNetworkId:r.Testnet,magicBytes:"T2",bootAddress:"ST000000000000000000002AMW42H"},N=f(S({},O),T({magicBytes:"id"}));const h=S({},N),k=["mainnet","testnet","devnet","mocknet"];function M(e){switch(e){case"mainnet":return w;case"testnet":return O;case"devnet":return N;case"mocknet":return h;default:throw new Error(`Unknown network name: ${e}`)}}function g(e){return"string"==typeof e?M(e):e}function j(e){return e&&(e=g(e))&&e.transactionVersion!==a.Mainnet?"id"===e.magicBytes?d:p:c}return t})())); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.StacksNetwork=t():e.StacksNetwork=t()}(this,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{AddressVersion:()=>s,ChainId:()=>n,DEFAULT_CHAIN_ID:()=>i,DEFAULT_TRANSACTION_VERSION:()=>a,PeerNetworkId:()=>r,STACKS_DEVNET:()=>O,STACKS_MAINNET:()=>b,STACKS_MOCKNET:()=>N,STACKS_TESTNET:()=>w,StacksNetworks:()=>h,TransactionVersion:()=>o,deriveDefaultUrl:()=>j,networkFrom:()=>A,networkFromName:()=>k,whenTransactionVersion:()=>c});var n=(e=>(e[e.Mainnet=1]="Mainnet",e[e.Testnet=2147483648]="Testnet",e))(n||{}),r=(e=>(e[e.Mainnet=385875968]="Mainnet",e[e.Testnet=4278190080]="Testnet",e))(r||{});const i=1;var o=(e=>(e[e.Mainnet=0]="Mainnet",e[e.Testnet=128]="Testnet",e))(o||{}),s=(e=>(e[e.MainnetSingleSig=22]="MainnetSingleSig",e[e.MainnetMultiSig=20]="MainnetMultiSig",e[e.TestnetSingleSig=26]="TestnetSingleSig",e[e.TestnetMultiSig=21]="TestnetMultiSig",e))(s||{});const a=0;function c(e){return t=>t[e]}const S="https://api.mainnet.hiro.so",l="https://api.testnet.hiro.so",d="http://localhost:3999";var u=Object.defineProperty,g=Object.defineProperties,p=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,y=(e,t,n)=>t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,m=(e,t)=>{for(var n in t||(t={}))f.call(t,n)&&y(e,n,t[n]);if(T)for(var n of T(t))M.call(t,n)&&y(e,n,t[n]);return e};const b={chainId:n.Mainnet,transactionVersion:o.Mainnet,peerNetworkId:r.Mainnet,magicBytes:"X2",bootAddress:"SP000000000000000000002Q6VF78",addressVersion:{singleSig:s.MainnetSingleSig,multiSig:s.MainnetMultiSig}},w={chainId:n.Testnet,transactionVersion:o.Testnet,peerNetworkId:r.Testnet,magicBytes:"T2",bootAddress:"ST000000000000000000002AMW42H",addressVersion:{singleSig:s.TestnetSingleSig,multiSig:s.TestnetMultiSig}},O=g(m({},w),p({magicBytes:"id"}));const N=m({},O),h=["mainnet","testnet","devnet","mocknet"];function k(e){switch(e){case"mainnet":return b;case"testnet":return w;case"devnet":return O;case"mocknet":return N;default:throw new Error(`Unknown network name: ${e}`)}}function A(e){return"string"==typeof e?k(e):e}function j(e){return e&&(e=A(e))&&e.transactionVersion!==o.Mainnet?"id"===e.magicBytes?d:l:S}return t})())); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@stacks/network", | ||
"version": "6.14.1-pr.31+3d8c3141", | ||
"version": "6.14.1-pr.32+f6fde004", | ||
"description": "Library for Stacks network operations", | ||
@@ -23,3 +23,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@stacks/common": "^6.14.1-pr.31+3d8c3141", | ||
"@stacks/common": "^6.14.1-pr.32+f6fde004", | ||
"cross-fetch": "^3.1.5" | ||
@@ -56,3 +56,3 @@ }, | ||
}, | ||
"gitHead": "3d8c314146849501e3eda86bb8bed63844732688" | ||
"gitHead": "f6fde004d73d5e6aaa4b0d8234c33d592d2cae93" | ||
} |
@@ -37,2 +37,19 @@ /** | ||
/** | ||
* Address versions for identifying address types in an encoded Stacks address. | ||
* The address version is a single byte, indicating the address type. | ||
* Every Stacks address starts with `S` followed by a single character indicating the address version. | ||
* The second character is the c32-encoded AddressVersion byte. | ||
*/ | ||
export enum AddressVersion { | ||
/** `P` — A single-sig address for mainnet (starting with `SP`) */ | ||
MainnetSingleSig = 22, | ||
/** `M` — A multi-sig address for mainnet (starting with `SM`) */ | ||
MainnetMultiSig = 20, | ||
/** `T` — A single-sig address for testnet (starting with `ST`) */ | ||
TestnetSingleSig = 26, | ||
/** `N` — A multi-sig address for testnet (starting with `SN`) */ | ||
TestnetMultiSig = 21, | ||
} | ||
export const DEFAULT_TRANSACTION_VERSION = TransactionVersion.Mainnet; | ||
@@ -39,0 +56,0 @@ |
import { DEVNET_URL, HIRO_MAINNET_URL, HIRO_TESTNET_URL } from '@stacks/common'; | ||
import { ChainId, PeerNetworkId, TransactionVersion } from './constants'; | ||
import { AddressVersion, ChainId, PeerNetworkId, TransactionVersion } from './constants'; | ||
@@ -10,2 +10,6 @@ export interface StacksNetwork { | ||
bootAddress: string; | ||
addressVersion: { | ||
singleSig: number; | ||
multiSig: number; | ||
}; | ||
// todo: add check32 character bytes string | ||
@@ -20,2 +24,6 @@ } | ||
bootAddress: 'SP000000000000000000002Q6VF78', | ||
addressVersion: { | ||
singleSig: AddressVersion.MainnetSingleSig, | ||
multiSig: AddressVersion.MainnetMultiSig, | ||
}, | ||
}; | ||
@@ -29,2 +37,6 @@ | ||
bootAddress: 'ST000000000000000000002AMW42H', | ||
addressVersion: { | ||
singleSig: AddressVersion.TestnetSingleSig, | ||
multiSig: AddressVersion.TestnetMultiSig, | ||
}, | ||
}; | ||
@@ -31,0 +43,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
41300
426