mirror of
https://github.com/alexgo-io/stacks-blockchain-api.git
synced 2026-04-28 21:05:36 +08:00
fix: propagate chain id correctly to bns router (#1180)
This commit is contained in:
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@@ -90,8 +90,8 @@
|
||||
"env": {
|
||||
"STACKS_BLOCKCHAIN_API_PORT": "3998",
|
||||
"STACKS_API_MODE": "readonly",
|
||||
"STACKS_CHAIN_ID": "0x80000000",
|
||||
"NODE_ENV": "development",
|
||||
"STACKS_CHAIN_ID": "0x00000001",
|
||||
"NODE_ENV": "production",
|
||||
"TS_NODE_SKIP_IGNORE": "true"
|
||||
},
|
||||
"killBehavior": "polite",
|
||||
|
||||
@@ -17,7 +17,7 @@ export function createBnsNamesRouter(db: DataStore, chainId: ChainID): express.R
|
||||
const { name, zoneFileHash } = req.params;
|
||||
const includeUnanchored = isUnanchoredRequest(req, res, next);
|
||||
let nameFound = false;
|
||||
const nameQuery = await db.getName({ name: name, includeUnanchored });
|
||||
const nameQuery = await db.getName({ name: name, includeUnanchored, chainId: chainId });
|
||||
nameFound = nameQuery.found;
|
||||
if (!nameFound) {
|
||||
const subdomainQuery = await db.getSubdomain({ subdomain: name, includeUnanchored });
|
||||
@@ -54,7 +54,7 @@ export function createBnsNamesRouter(db: DataStore, chainId: ChainID): express.R
|
||||
const { name } = req.params;
|
||||
const includeUnanchored = isUnanchoredRequest(req, res, next);
|
||||
let nameFound = false;
|
||||
const nameQuery = await db.getName({ name: name, includeUnanchored });
|
||||
const nameQuery = await db.getName({ name: name, includeUnanchored, chainId: chainId });
|
||||
nameFound = nameQuery.found;
|
||||
if (!nameFound) {
|
||||
const subdomainQuery = await db.getSubdomain({ subdomain: name, includeUnanchored });
|
||||
@@ -123,7 +123,11 @@ export function createBnsNamesRouter(db: DataStore, chainId: ChainID): express.R
|
||||
zonefile_hash: result.zonefile_hash,
|
||||
};
|
||||
} else {
|
||||
const nameQuery = await db.getName({ name, includeUnanchored: includeUnanchored });
|
||||
const nameQuery = await db.getName({
|
||||
name,
|
||||
includeUnanchored: includeUnanchored,
|
||||
chainId: chainId,
|
||||
});
|
||||
if (!nameQuery.found) {
|
||||
res.status(404).json({ error: `cannot find name ${name}` });
|
||||
return;
|
||||
|
||||
@@ -936,7 +936,11 @@ export interface DataStore extends DataStoreEventEmitter {
|
||||
namespace: string;
|
||||
includeUnanchored: boolean;
|
||||
}): Promise<FoundOrNot<DbBnsNamespace>>;
|
||||
getName(args: { name: string; includeUnanchored: boolean }): Promise<FoundOrNot<DbBnsName>>;
|
||||
getName(args: {
|
||||
name: string;
|
||||
includeUnanchored: boolean;
|
||||
chainId: ChainID;
|
||||
}): Promise<FoundOrNot<DbBnsName>>;
|
||||
getHistoricalZoneFile(args: {
|
||||
name: string;
|
||||
zoneFileHash: string;
|
||||
|
||||
Reference in New Issue
Block a user