@stacks/auth
Advanced tools
Comparing version 7.0.0-next.70 to 7.0.0-next.89
@@ -1,10 +0,9 @@ | ||
import { ClientOpts, ClientParam } from '@stacks/common'; | ||
import { NetworkClientParam } from '@stacks/network'; | ||
export interface ProfileLookupOptions { | ||
username: string; | ||
zoneFileLookupURL?: string; | ||
client?: ClientOpts; | ||
} | ||
export declare function lookupProfile(options: ProfileLookupOptions): Promise<Record<string, any>>; | ||
export declare function lookupProfile(options: ProfileLookupOptions & NetworkClientParam): Promise<Record<string, any>>; | ||
export declare function getNameInfo(opts: { | ||
name: string; | ||
} & ClientParam): Promise<any>; | ||
} & NetworkClientParam): Promise<any>; |
@@ -1,2 +0,2 @@ | ||
import { defaultClientOpts } from '@stacks/common'; | ||
import { clientFromNetwork, networkFrom } from '@stacks/network'; | ||
import { resolveZoneFileToProfile } from '@stacks/profile'; | ||
@@ -7,3 +7,4 @@ export function lookupProfile(options) { | ||
} | ||
const client = defaultClientOpts(options.client); | ||
const network = networkFrom(options.network ?? 'mainnet'); | ||
const client = Object.assign({}, clientFromNetwork(network), options.client); | ||
let lookupPromise; | ||
@@ -15,3 +16,3 @@ if (options.zoneFileLookupURL) { | ||
else { | ||
lookupPromise = getNameInfo({ name: options.username, client: client }); | ||
lookupPromise = getNameInfo({ name: options.username }); | ||
} | ||
@@ -32,5 +33,6 @@ return lookupPromise.then((responseJSON) => { | ||
export function getNameInfo(opts) { | ||
const api = defaultClientOpts(opts.client); | ||
const nameLookupURL = `${api.baseUrl}/v1/names/${opts.name}`; | ||
return api | ||
const network = networkFrom(opts.network ?? 'mainnet'); | ||
const client = Object.assign({}, clientFromNetwork(network), opts.client); | ||
const nameLookupURL = `${client.baseUrl}/v1/names/${opts.name}`; | ||
return client | ||
.fetch(nameLookupURL) | ||
@@ -37,0 +39,0 @@ .then((resp) => { |
@@ -1,10 +0,9 @@ | ||
import { ClientOpts, ClientParam } from '@stacks/common'; | ||
import { NetworkClientParam } from '@stacks/network'; | ||
export interface ProfileLookupOptions { | ||
username: string; | ||
zoneFileLookupURL?: string; | ||
client?: ClientOpts; | ||
} | ||
export declare function lookupProfile(options: ProfileLookupOptions): Promise<Record<string, any>>; | ||
export declare function lookupProfile(options: ProfileLookupOptions & NetworkClientParam): Promise<Record<string, any>>; | ||
export declare function getNameInfo(opts: { | ||
name: string; | ||
} & ClientParam): Promise<any>; | ||
} & NetworkClientParam): Promise<any>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getNameInfo = exports.lookupProfile = void 0; | ||
const common_1 = require("@stacks/common"); | ||
const network_1 = require("@stacks/network"); | ||
const profile_1 = require("@stacks/profile"); | ||
@@ -10,3 +10,4 @@ function lookupProfile(options) { | ||
} | ||
const client = (0, common_1.defaultClientOpts)(options.client); | ||
const network = (0, network_1.networkFrom)(options.network ?? 'mainnet'); | ||
const client = Object.assign({}, (0, network_1.clientFromNetwork)(network), options.client); | ||
let lookupPromise; | ||
@@ -18,3 +19,3 @@ if (options.zoneFileLookupURL) { | ||
else { | ||
lookupPromise = getNameInfo({ name: options.username, client: client }); | ||
lookupPromise = getNameInfo({ name: options.username }); | ||
} | ||
@@ -36,5 +37,6 @@ return lookupPromise.then((responseJSON) => { | ||
function getNameInfo(opts) { | ||
const api = (0, common_1.defaultClientOpts)(opts.client); | ||
const nameLookupURL = `${api.baseUrl}/v1/names/${opts.name}`; | ||
return api | ||
const network = (0, network_1.networkFrom)(opts.network ?? 'mainnet'); | ||
const client = Object.assign({}, (0, network_1.clientFromNetwork)(network), opts.client); | ||
const nameLookupURL = `${client.baseUrl}/v1/names/${opts.name}`; | ||
return client | ||
.fetch(nameLookupURL) | ||
@@ -41,0 +43,0 @@ .then((resp) => { |
{ | ||
"name": "@stacks/auth", | ||
"version": "7.0.0-next.70+0adf46c4", | ||
"version": "7.0.0-next.89+3d4052b2", | ||
"description": "Authentication for Stacks apps.", | ||
@@ -24,6 +24,6 @@ "license": "MIT", | ||
"@noble/secp256k1": "1.7.1", | ||
"@stacks/common": "^7.0.0-next.70+0adf46c4", | ||
"@stacks/encryption": "^7.0.0-next.70+0adf46c4", | ||
"@stacks/network": "^7.0.0-next.70+0adf46c4", | ||
"@stacks/profile": "^7.0.0-next.70+0adf46c4", | ||
"@stacks/common": "^7.0.0-next.89+3d4052b2", | ||
"@stacks/encryption": "^7.0.0-next.89+3d4052b2", | ||
"@stacks/network": "^7.0.0-next.89+3d4052b2", | ||
"@stacks/profile": "^7.0.0-next.89+3d4052b2", | ||
"cross-fetch": "^3.1.5", | ||
@@ -64,3 +64,3 @@ "jsontokens": "^4.0.1" | ||
}, | ||
"gitHead": "0adf46c4eadac85f234140dc2df0e5d06b0ca775" | ||
"gitHead": "3d4052b21c76cd8f28ae64a266d61b650386a726" | ||
} |
@@ -1,2 +0,2 @@ | ||
import { ClientOpts, ClientParam, defaultClientOpts } from '@stacks/common'; | ||
import { NetworkClientParam, clientFromNetwork, networkFrom } from '@stacks/network'; | ||
import { resolveZoneFileToProfile } from '@stacks/profile'; | ||
@@ -7,3 +7,2 @@ | ||
zoneFileLookupURL?: string; | ||
client?: ClientOpts; | ||
} | ||
@@ -20,3 +19,5 @@ | ||
*/ | ||
export function lookupProfile(options: ProfileLookupOptions): Promise<Record<string, any>> { | ||
export function lookupProfile( | ||
options: ProfileLookupOptions & NetworkClientParam | ||
): Promise<Record<string, any>> { | ||
if (!options.username) { | ||
@@ -26,3 +27,4 @@ return Promise.reject(new Error('No username provided')); | ||
const client = defaultClientOpts(options.client); | ||
const network = networkFrom(options.network ?? 'mainnet'); | ||
const client = Object.assign({}, clientFromNetwork(network), options.client); | ||
@@ -34,3 +36,3 @@ let lookupPromise; | ||
} else { | ||
lookupPromise = getNameInfo({ name: options.username, client: client }); | ||
lookupPromise = getNameInfo({ name: options.username }); | ||
} | ||
@@ -56,8 +58,9 @@ return lookupPromise.then((responseJSON: any) => { | ||
name: string; | ||
} & ClientParam | ||
} & NetworkClientParam | ||
) { | ||
const api = defaultClientOpts(opts.client); | ||
const network = networkFrom(opts.network ?? 'mainnet'); | ||
const client = Object.assign({}, clientFromNetwork(network), opts.client); | ||
const nameLookupURL = `${api.baseUrl}/v1/names/${opts.name}`; | ||
return api | ||
const nameLookupURL = `${client.baseUrl}/v1/names/${opts.name}`; | ||
return client | ||
.fetch(nameLookupURL) | ||
@@ -64,0 +67,0 @@ .then((resp: any) => { |
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 too big to display
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
1318792
4138