From ee2595985f0d023ab2c1fcb558830942a9e44df4 Mon Sep 17 00:00:00 2001 From: emilcondrea Date: Tue, 10 Dec 2024 13:12:11 +0200 Subject: [PATCH] Add regtest network (#52) * Add regtest network --- package-lock.json | 4 ++-- package.json | 2 +- src/runes/api.ts | 8 ++++++-- src/types.ts | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index b7da315..5a30463 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@sats-connect/core", - "version": "0.4.1", + "version": "0.4.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@sats-connect/core", - "version": "0.4.1", + "version": "0.4.3", "license": "ISC", "dependencies": { "axios": "1.7.7", diff --git a/package.json b/package.json index 1c6bfff..a6c9741 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sats-connect/core", - "version": "0.4.2", + "version": "0.4.3", "main": "dist/index.mjs", "module": "dist/index.mjs", "types": "dist/index.d.mts", diff --git a/src/runes/api.ts b/src/runes/api.ts index 66120a0..f0948f4 100644 --- a/src/runes/api.ts +++ b/src/runes/api.ts @@ -18,8 +18,12 @@ const urlNetworkSuffix = { [BitcoinNetworkType.Testnet]: '-testnet', [BitcoinNetworkType.Signet]: '-signet', }; -export const ORDINALS_API_BASE_URL = (network: BitcoinNetworkType = BitcoinNetworkType.Mainnet) => - `https://ordinals${urlNetworkSuffix[network]}.xverse.app/v1`; +export const ORDINALS_API_BASE_URL = (network: BitcoinNetworkType = BitcoinNetworkType.Mainnet) => { + if (network === BitcoinNetworkType.Regtest) { + throw new Error('Ordinals API does not support regtest network'); + } + return `https://ordinals${urlNetworkSuffix[network]}.xverse.app/v1`; +}; export class RunesApi { client: AxiosInstance; diff --git a/src/types.ts b/src/types.ts index 4db3bd9..6fd8dea 100644 --- a/src/types.ts +++ b/src/types.ts @@ -6,6 +6,7 @@ export enum BitcoinNetworkType { Mainnet = 'Mainnet', Testnet = 'Testnet', Signet = 'Signet', + Regtest = 'Regtest', } export interface BitcoinNetwork {