ordinalsbot
Advanced tools
Comparing version 0.1.4 to 0.1.5
import { AxiosInstance } from "axios"; | ||
import { InscriptionEnv } from "./types"; | ||
import { InscriptionPriceRequest, InscriptionPriceResponse, InscriptionOrderRequest, InscriptionOrder, InscriptionCollectionCreateRequest, InscriptionCollectionCreateResponse, InscriptionCollectionOrderRequest, InscriptionTextOrderRequest, InscriptionInventoryResponse, InscriptionReferralRequest, InscriptionReferralSetResponse, InscriptionReferralStatusResponse } from "./types/v1"; | ||
import { InscriptionPriceRequest, InscriptionPriceResponse, InscriptionOrderRequest, InscriptionOrder, InscriptionCollectionCreateRequest, InscriptionCollectionCreateResponse, InscriptionCollectionOrderRequest, InscriptionTextOrderRequest, InscriptionInventoryResponse, InscriptionReferralRequest, InscriptionReferralSetResponse, InscriptionReferralStatusResponse, CreateSpecialSatsRequest, CreateSpecialSatsResponse, InscriptionCollectionOrderResponse } from "./types/v1"; | ||
export declare class InscriptionClient { | ||
@@ -14,3 +14,3 @@ env: InscriptionEnv; | ||
createCollection(collection: InscriptionCollectionCreateRequest): Promise<InscriptionCollectionCreateResponse>; | ||
createCollectionOrder(collectionOrder: InscriptionCollectionOrderRequest): Promise<InscriptionOrder>; | ||
createCollectionOrder(collectionOrder: InscriptionCollectionOrderRequest): Promise<InscriptionCollectionOrderResponse>; | ||
createTextOrder(order: InscriptionTextOrderRequest): Promise<InscriptionOrder>; | ||
@@ -20,3 +20,4 @@ getInventory(): Promise<InscriptionInventoryResponse[]>; | ||
getReferralStatus(referral: InscriptionReferralRequest): Promise<InscriptionReferralStatusResponse>; | ||
createSpecialSatsPSBT(createSpecialSatsRequest: CreateSpecialSatsRequest): Promise<CreateSpecialSatsResponse>; | ||
} | ||
//# sourceMappingURL=client.d.ts.map |
@@ -8,3 +8,3 @@ "use strict"; | ||
const axios_1 = __importDefault(require("axios")); | ||
const InscriptionError_1 = require("./InscriptionError"); | ||
const error_1 = require("./inscription/error"); | ||
const qs = require("qs"); | ||
@@ -33,3 +33,3 @@ const version = require("../package.json")?.version || "local"; | ||
if (axios_1.default.isAxiosError(err)) { | ||
throw new InscriptionError_1.InscriptionError(err.message, err.response?.statusText, err.response?.status); | ||
throw new error_1.InscriptionError(err.message, err.response?.statusText, err.response?.status); | ||
} | ||
@@ -101,4 +101,9 @@ if (err instanceof Error) | ||
} | ||
async createSpecialSatsPSBT(createSpecialSatsRequest) { | ||
return this.instanceV1.post(`/create-special-sats-psbt`, { | ||
...createSpecialSatsRequest, | ||
}); | ||
} | ||
} | ||
exports.InscriptionClient = InscriptionClient; | ||
//# sourceMappingURL=client.js.map |
@@ -0,9 +1,31 @@ | ||
import { Inscription } from "./inscription/index"; | ||
import { Launchpad } from "./launchpad/index"; | ||
import { MarketPlace } from "./marketplace"; | ||
import { Mempool } from "./mempool/index"; | ||
import { Satextractor } from "./satextractor/index"; | ||
import { Satscanner } from "./satscanner/index"; | ||
import { InscriptionEnv } from "./types"; | ||
export { InscriptionClient } from "./client"; | ||
export { InscriptionError } from "./InscriptionError"; | ||
export { InscriptionError } from "./inscription/error"; | ||
export * from "./types"; | ||
export { MarketPlace } from "./marketplace"; | ||
export { Inscription } from "./inscription"; | ||
export { Satscanner } from "./satscanner"; | ||
export { Satextractor } from "./satextractor"; | ||
export { Mempool } from "./mempool"; | ||
export { Inscription } from "./inscription/index"; | ||
export { Satscanner } from "./satscanner/index"; | ||
export { Satextractor } from "./satextractor/index"; | ||
export { Mempool } from "./mempool/index"; | ||
export declare class Ordinalsbot { | ||
private marketPlaceObj; | ||
private inscriptionObj; | ||
private launchpadObj; | ||
private mempoolObj; | ||
private satextractorObj; | ||
private satscannerObj; | ||
constructor(key?: string, environment?: InscriptionEnv); | ||
MarketPlace(): MarketPlace; | ||
Inscription(): Inscription; | ||
Launchpad(): Launchpad; | ||
Mempool(): Mempool; | ||
Satextractor(): Satextractor; | ||
Satscanner(): Satscanner; | ||
} | ||
//# sourceMappingURL=index.d.ts.map |
@@ -17,18 +17,65 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Mempool = exports.Satextractor = exports.Satscanner = exports.Inscription = exports.MarketPlace = exports.InscriptionError = exports.InscriptionClient = void 0; | ||
exports.Ordinalsbot = exports.Mempool = exports.Satextractor = exports.Satscanner = exports.Inscription = exports.MarketPlace = exports.InscriptionError = exports.InscriptionClient = void 0; | ||
const index_1 = require("./inscription/index"); | ||
const index_2 = require("./launchpad/index"); | ||
const marketplace_1 = require("./marketplace"); | ||
const index_3 = require("./mempool/index"); | ||
const index_4 = require("./satextractor/index"); | ||
const index_5 = require("./satscanner/index"); | ||
var client_1 = require("./client"); | ||
Object.defineProperty(exports, "InscriptionClient", { enumerable: true, get: function () { return client_1.InscriptionClient; } }); | ||
var InscriptionError_1 = require("./InscriptionError"); | ||
Object.defineProperty(exports, "InscriptionError", { enumerable: true, get: function () { return InscriptionError_1.InscriptionError; } }); | ||
var error_1 = require("./inscription/error"); | ||
Object.defineProperty(exports, "InscriptionError", { enumerable: true, get: function () { return error_1.InscriptionError; } }); | ||
__exportStar(require("./types"), exports); | ||
var marketplace_1 = require("./marketplace"); | ||
Object.defineProperty(exports, "MarketPlace", { enumerable: true, get: function () { return marketplace_1.MarketPlace; } }); | ||
var inscription_1 = require("./inscription"); | ||
Object.defineProperty(exports, "Inscription", { enumerable: true, get: function () { return inscription_1.Inscription; } }); | ||
var satscanner_1 = require("./satscanner"); | ||
Object.defineProperty(exports, "Satscanner", { enumerable: true, get: function () { return satscanner_1.Satscanner; } }); | ||
var satextractor_1 = require("./satextractor"); | ||
Object.defineProperty(exports, "Satextractor", { enumerable: true, get: function () { return satextractor_1.Satextractor; } }); | ||
var mempool_1 = require("./mempool"); | ||
Object.defineProperty(exports, "Mempool", { enumerable: true, get: function () { return mempool_1.Mempool; } }); | ||
var marketplace_2 = require("./marketplace"); | ||
Object.defineProperty(exports, "MarketPlace", { enumerable: true, get: function () { return marketplace_2.MarketPlace; } }); | ||
var index_6 = require("./inscription/index"); | ||
Object.defineProperty(exports, "Inscription", { enumerable: true, get: function () { return index_6.Inscription; } }); | ||
var index_7 = require("./satscanner/index"); | ||
Object.defineProperty(exports, "Satscanner", { enumerable: true, get: function () { return index_7.Satscanner; } }); | ||
var index_8 = require("./satextractor/index"); | ||
Object.defineProperty(exports, "Satextractor", { enumerable: true, get: function () { return index_8.Satextractor; } }); | ||
var index_9 = require("./mempool/index"); | ||
Object.defineProperty(exports, "Mempool", { enumerable: true, get: function () { return index_9.Mempool; } }); | ||
class Ordinalsbot { | ||
constructor(key = "", environment = "live") { | ||
if (this.marketPlaceObj === undefined) { | ||
this.marketPlaceObj = new marketplace_1.MarketPlace(key, environment); | ||
} | ||
if (this.inscriptionObj === undefined) { | ||
this.inscriptionObj = new index_1.Inscription(key, environment); | ||
} | ||
if (this.launchpadObj === undefined) { | ||
this.launchpadObj = new index_2.Launchpad(key, environment); | ||
} | ||
if (this.mempoolObj === undefined) { | ||
this.mempoolObj = new index_3.Mempool(key, environment); | ||
} | ||
if (this.satextractorObj === undefined) { | ||
this.satextractorObj = new index_4.Satextractor(key, environment); | ||
} | ||
if (this.satscannerObj === undefined) { | ||
this.satscannerObj = new index_5.Satscanner(key, environment); | ||
} | ||
} | ||
MarketPlace() { | ||
return this.marketPlaceObj; | ||
} | ||
Inscription() { | ||
return this.inscriptionObj; | ||
} | ||
Launchpad() { | ||
return this.launchpadObj; | ||
} | ||
Mempool() { | ||
return this.mempoolObj; | ||
} | ||
Satextractor() { | ||
return this.satextractorObj; | ||
} | ||
Satscanner() { | ||
return this.satscannerObj; | ||
} | ||
} | ||
exports.Ordinalsbot = Ordinalsbot; | ||
//# sourceMappingURL=index.js.map |
@@ -8,3 +8,3 @@ "use strict"; | ||
const axios_1 = __importDefault(require("axios")); | ||
const InscriptionError_1 = require("./InscriptionError"); | ||
const error_1 = require("./inscription/error"); | ||
class MarketPlaceClient { | ||
@@ -30,3 +30,3 @@ constructor(key = "", environment = "live") { | ||
if (axios_1.default.isAxiosError(err)) { | ||
throw new InscriptionError_1.InscriptionError(err.message, err.response?.statusText, err.response?.status); | ||
throw new error_1.InscriptionError(err.message, err.response?.statusText, err.response?.status); | ||
} | ||
@@ -33,0 +33,0 @@ if (err instanceof Error) |
@@ -80,9 +80,38 @@ export declare enum LISTING_STATUS { | ||
export interface MarketplaceGetListingRequest { | ||
query: { | ||
filter: { | ||
status: LISTING_STATUS; | ||
}; | ||
page?: number; | ||
itemsPerPage?: number; | ||
sort?: string; | ||
} | ||
export interface MarketplaceGetListingResponse { | ||
ordinals: Array<SellerOrdinal>; | ||
results: ListingOrdinal[]; | ||
count: number; | ||
currentPage: number; | ||
totalPages: number; | ||
totalItems: number; | ||
} | ||
interface ListingOrdinal { | ||
_id: string; | ||
ordinalId: string; | ||
price: number; | ||
sellerPaymentAddress: string; | ||
sellerOrdinalAddress: string; | ||
sellerOrdinalPublicKey: string; | ||
status: string; | ||
sellerOutputValue: number; | ||
ordinalUtxoTxId: string; | ||
ordinalUtxoVout: number; | ||
indexInSellerPSBT: number; | ||
marketPlaceId: string; | ||
marketPlaceMakerFee: number; | ||
marketPlaceTakerFee: number; | ||
platformMakerFee: number; | ||
platformTakerFee: number; | ||
marketPlaceFeeBtcAddress: string; | ||
createdAt: string; | ||
updatedAt: string; | ||
signedListingPSBT: string; | ||
} | ||
export interface MarketplaceSaveListingRequest { | ||
@@ -155,2 +184,3 @@ ordinalId: String; | ||
} | ||
export {}; | ||
//# sourceMappingURL=marketplace_types.d.ts.map |
@@ -12,2 +12,9 @@ export interface MempoolAddressUtxoResponse { | ||
} | ||
export interface RecommendedFees { | ||
fastestFee: number; | ||
halfHourFee: number; | ||
hourFee: number; | ||
economyFee: number; | ||
minimumFee: number; | ||
} | ||
//# sourceMappingURL=mempool_types.d.ts.map |
@@ -22,5 +22,5 @@ export interface InscriptionTransaction { | ||
files: InscriptionFile[]; | ||
fee: number; | ||
fee?: number; | ||
lowPostage?: boolean; | ||
receiveAddress?: string; | ||
receiveAddress?: string | string[]; | ||
rareSats?: string; | ||
@@ -32,3 +32,10 @@ referral?: string; | ||
compress?: boolean; | ||
parent?: InscriptionOrderParentRequest; | ||
projectTag?: string; | ||
batchMode?: string; | ||
} | ||
export interface InscriptionOrderParentRequest { | ||
inscriptionId: string; | ||
returnAddress: string; | ||
} | ||
export interface InscriptionCharge { | ||
@@ -50,5 +57,9 @@ id: string; | ||
chain_invoice?: InscriptionOnchainInvoice; | ||
lightning_invoice?: InscriptionLightningInvoice; | ||
transactions?: InscriptionChargeTransaction[]; | ||
uri?: string; | ||
callback_url?: string; | ||
} | ||
export interface InscriptionOrder extends InscriptionOrderRequest { | ||
id: string; | ||
status: string; | ||
@@ -58,3 +69,8 @@ charge: InscriptionCharge; | ||
serviceFee: number; | ||
baseFee: number; | ||
rareSatsFee: number; | ||
postage: number; | ||
orderType: string; | ||
zeroConf: string | null; | ||
state: string; | ||
createdAt: number; | ||
@@ -67,2 +83,6 @@ } | ||
} | ||
export interface InscriptionLightningInvoice { | ||
expires_at: number; | ||
payreq: string; | ||
} | ||
export interface InscriptionChargeTransaction { | ||
@@ -85,27 +105,37 @@ address: string; | ||
rareSats: string; | ||
lowPostage?: boolean; | ||
direct?: boolean; | ||
additionalFee?: number; | ||
baseFee?: number; | ||
} | ||
export interface InscriptionPriceResponse { | ||
status: string; | ||
chainFee: number; | ||
baseFee: number; | ||
serviceFee: number; | ||
rareSatsFee: number; | ||
additionalFee: number; | ||
postage: number; | ||
amount: number; | ||
totalFee: number; | ||
} | ||
export interface InscriptionCollectionCreateRequest { | ||
id: string; | ||
files: InscriptionFile[]; | ||
id?: string; | ||
name?: string; | ||
description?: string; | ||
creator: string; | ||
price: number; | ||
totalCount: number; | ||
totalCount?: number; | ||
twitter?: string; | ||
website?: string; | ||
banner?: string; | ||
cover?: string; | ||
fee?: number; | ||
serviceFee?: number; | ||
"creator-address": string; | ||
name: string; | ||
description: string; | ||
creator: string; | ||
twitter?: string; | ||
website?: string; | ||
allowList?: AllocationMap; | ||
discord?: string; | ||
banner?: string; | ||
cover?: string; | ||
allowlist?: AllocationMap; | ||
parent?: InscriptionOrderParentRequest; | ||
deployInscription?: string; | ||
saleSize?: number; | ||
} | ||
@@ -118,3 +148,6 @@ export type AllocationMap = { | ||
export interface InscriptionCollectionCreateResponse extends InscriptionCollectionCreateRequest { | ||
averageSize: number; | ||
inscribedCount: number; | ||
status: string; | ||
active: boolean; | ||
createdAt: number; | ||
@@ -125,16 +158,40 @@ } | ||
count: number; | ||
requestedIds?: number[]; | ||
} | ||
export interface InscriptionCollectionOrderRequest { | ||
collection: InscriptionCollection; | ||
fee?: number; | ||
receiveAddress?: string; | ||
collection?: InscriptionCollection; | ||
referral?: string; | ||
token?: string; | ||
receiveAddress?: string; | ||
rareSats?: string; | ||
timeout?: number; | ||
additionalFee?: number; | ||
} | ||
export interface InscriptionTextOrderRequest { | ||
texts: string[]; | ||
export interface InscriptionCollectionOrderResponse { | ||
charge: InscriptionCharge; | ||
collection: InscriptionCollection; | ||
fee: number; | ||
lowPostage?: boolean; | ||
receiveAddress?: string; | ||
referral?: string; | ||
rareSatsFee: number; | ||
serviceFee: number; | ||
price: number; | ||
fileCount: number; | ||
orderType: string; | ||
postage: number; | ||
lowPostage: number; | ||
chainFee: number; | ||
amount: number; | ||
id: string; | ||
additionalFee: number; | ||
rareSats: string; | ||
receiveAddress: string; | ||
referral: string; | ||
zeroConf: string; | ||
status: string; | ||
state: string; | ||
createdAt: number; | ||
} | ||
export interface InscriptionTextOrderRequest extends InscriptionOrderRequest { | ||
texts: string[]; | ||
} | ||
type InscriptionInventoryData = { | ||
@@ -184,3 +241,14 @@ amount: number; | ||
} | ||
export interface CreateSpecialSatsResponse { | ||
psbt: string; | ||
} | ||
export interface CreateSpecialSatsRequest { | ||
chargeAmount: string; | ||
fundingAddress: string; | ||
specialSatsOutput: string; | ||
userAddress: string; | ||
userPublicKey: string; | ||
feeRate: number; | ||
} | ||
export {}; | ||
//# sourceMappingURL=v1.d.ts.map |
{ | ||
"name": "ordinalsbot", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Node.js library for OrdinalsBot API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -27,10 +27,12 @@ # OrdinalsBot Node.js Library | ||
```js | ||
import { MarketPlace, Inscription, Satscanner, Satextractor, Mempool } from "ordinalsbot"; | ||
import { Ordinalsbot } from "ordinalsbot"; | ||
// if no parameter given, default environment is 'live' | ||
let inscription = new Inscription("API_KEY", "dev"); | ||
let marketplace = new MarketPlace("API_KEY", "dev"); | ||
let satscanner = new Satscanner("API_KEY", "dev"); | ||
let satextractor = new Satextractor("API_KEY", "dev"); | ||
let mempool = new Mempool("API_KEY", "dev"); | ||
const ordinalsbotObj = new Ordinalsbot(API_KEY, "dev"); | ||
const marketPlace = ordinalsbotObj.MarketPlace(); | ||
const inscription = ordinalsbotObj.Inscription(); | ||
const launchpad = ordinalsbotObj.Launchpad(); | ||
const mempool = ordinalsbotObj.Mempool(); | ||
const satextractor = ordinalsbotObj.Satextractor(); | ||
const satscanner = ordinalsbotObj.Satscanner(); | ||
``` | ||
@@ -122,4 +124,7 @@ | ||
```js | ||
import { Ordinalsbot } from "ordinalsbot"; | ||
import { marketplace, WALLET_PROVIDER } from "ordinalsbot"; | ||
// if no parameter given, default environment is 'live' | ||
const ordinalsbotObj = new Ordinalsbot(API_KEY, "dev"); | ||
const marketPlace = ordinalsbotObj.MarketPlace(); | ||
@@ -126,0 +131,0 @@ const listingRequest = { |
import axios, { AxiosInstance } from "axios"; | ||
import { InscriptionError } from "./InscriptionError"; | ||
import { InscriptionError } from "./inscription/error"; | ||
import { InscriptionEnv } from "./types"; | ||
@@ -17,2 +17,5 @@ import { | ||
InscriptionReferralStatusResponse, | ||
CreateSpecialSatsRequest, | ||
CreateSpecialSatsResponse, | ||
InscriptionCollectionOrderResponse, | ||
} from "./types/v1"; | ||
@@ -24,3 +27,9 @@ | ||
/** | ||
* Represents a client for interacting with the Inscription API. | ||
*/ | ||
export class InscriptionClient { | ||
/** | ||
* The environment for the API client. | ||
*/ | ||
public env: InscriptionEnv; | ||
@@ -31,2 +40,7 @@ | ||
/** | ||
* Constructs an instance of InscriptionClient. | ||
* @param {string} key - The API key for authentication. | ||
* @param {InscriptionEnv} environment - The environment for the client, either 'live' or 'dev'. | ||
*/ | ||
constructor(key: string = "", environment: InscriptionEnv = "live") { | ||
@@ -39,6 +53,6 @@ this.api_key = key; | ||
baseURL: | ||
environment === "live" | ||
? `https://api.ordinalsbot.com` | ||
: `https://testnet-api.ordinalsbot.com`, | ||
timeout: 30000, | ||
environment === "live" | ||
? `https://api.ordinalsbot.com` | ||
: `https://testnet-api.ordinalsbot.com`, | ||
timeout: 30000, | ||
headers: { | ||
@@ -78,8 +92,15 @@ "x-api-key": this.api_key, | ||
// exposing the axios instance in case the user wants to use it directly | ||
// This is also useful for testing | ||
get axiosInstance() { | ||
/** | ||
* Exposes the Axios instance for direct usage. | ||
* @returns {AxiosInstance} The Axios instance. | ||
*/ | ||
get axiosInstance(): AxiosInstance { | ||
return this.instanceV1; | ||
} | ||
/** | ||
* Retrieves the price for a given request. | ||
* @param {InscriptionPriceRequest} priceRequest - The request object for price calculation. | ||
* @returns {Promise<InscriptionPriceResponse>} A promise resolving with the price response. | ||
*/ | ||
async getPrice( | ||
@@ -93,2 +114,7 @@ priceRequest: InscriptionPriceRequest | ||
/** | ||
* Creates an inscription order. | ||
* @param {InscriptionOrderRequest} order - The request object for creating the order. | ||
* @returns {Promise<InscriptionOrder>} A promise resolving with the created order. | ||
*/ | ||
async createOrder(order: InscriptionOrderRequest): Promise<InscriptionOrder> { | ||
@@ -98,2 +124,7 @@ return this.instanceV1.post(`/order`, order); | ||
/** | ||
* Retrieves an inscription order by ID. | ||
* @param {string} id - The ID of the order to retrieve. | ||
* @returns {Promise<InscriptionOrder>} A promise resolving with the retrieved order. | ||
*/ | ||
async getOrder(id: string): Promise<InscriptionOrder> { | ||
@@ -105,2 +136,7 @@ return this.instanceV1.get(`/order`, { | ||
/** | ||
* Creates a collection for inscriptions. | ||
* @param {InscriptionCollectionCreateRequest} collection - The request object for creating the collection. | ||
* @returns {Promise<InscriptionCollectionCreateResponse>} A promise resolving with the created collection response. | ||
*/ | ||
async createCollection( | ||
@@ -136,8 +172,18 @@ collection: InscriptionCollectionCreateRequest | ||
/** | ||
* Creates an order for a collection. | ||
* @param {InscriptionCollectionOrderRequest} collectionOrder - The request object for creating the collection order. | ||
* @returns {Promise<InscriptionCollectionOrderResponse>} A promise resolving with the created collection order response. | ||
*/ | ||
async createCollectionOrder( | ||
collectionOrder: InscriptionCollectionOrderRequest | ||
): Promise<InscriptionOrder> { | ||
): Promise<InscriptionCollectionOrderResponse> { | ||
return this.instanceV1.post(`/collectionorder`, collectionOrder); | ||
} | ||
/** | ||
* Creates an order for text inscription. | ||
* @param {InscriptionTextOrderRequest} order - The request object for creating the text order. | ||
* @returns {Promise<InscriptionOrder>} A promise resolving with the created text order. | ||
*/ | ||
async createTextOrder( | ||
@@ -149,2 +195,6 @@ order: InscriptionTextOrderRequest | ||
/** | ||
* Retrieves inventory information. | ||
* @returns {Promise<InscriptionInventoryResponse[]>} A promise resolving with the inventory information. | ||
*/ | ||
async getInventory(): Promise<InscriptionInventoryResponse[]> { | ||
@@ -154,2 +204,7 @@ return this.instanceV1.get(`/inventory`); | ||
/** | ||
* Sets a referral code. | ||
* @param {InscriptionReferralRequest} referral - The request object for setting the referral code. | ||
* @returns {Promise<InscriptionReferralSetResponse>} A promise resolving with the response of setting the referral code. | ||
*/ | ||
async setReferralCode( | ||
@@ -161,2 +216,7 @@ referral: InscriptionReferralRequest | ||
/** | ||
* gets a referral code. | ||
* @param {InscriptionReferralRequest} referral - The request object for setting the referral code. | ||
* @returns {Promise<InscriptionReferralStatusResponse>} A promise resolving with the response of setting the referral code. | ||
*/ | ||
async getReferralStatus( | ||
@@ -169,2 +229,15 @@ referral: InscriptionReferralRequest | ||
} | ||
/** | ||
* Creates a special Sats PSBT. | ||
* @param {CreateSpecialSatsRequest} createSpecialSatsRequest - The request object containing the details for creating the PSBT. | ||
* @returns {Promise<CreateSpecialSatsResponse>} A promise that resolves with the response containing the created PSBT. | ||
*/ | ||
async createSpecialSatsPSBT( | ||
createSpecialSatsRequest: CreateSpecialSatsRequest | ||
): Promise<CreateSpecialSatsResponse> { | ||
return this.instanceV1.post(`/create-special-sats-psbt`, { | ||
...createSpecialSatsRequest, | ||
}); | ||
} | ||
} |
150
src/index.ts
@@ -0,8 +1,148 @@ | ||
import { Inscription } from "./inscription/index"; | ||
import { Launchpad } from "./launchpad/index"; | ||
import { MarketPlace } from "./marketplace"; | ||
import { Mempool } from "./mempool/index"; | ||
import { Satextractor } from "./satextractor/index"; | ||
import { Satscanner } from "./satscanner/index"; | ||
import { InscriptionEnv } from "./types"; | ||
export { InscriptionClient } from "./client"; | ||
export { InscriptionError } from "./InscriptionError"; | ||
export { InscriptionError } from "./inscription/error"; | ||
export * from "./types"; | ||
export { MarketPlace } from "./marketplace"; | ||
export { Inscription } from "./inscription"; | ||
export { Satscanner } from "./satscanner"; | ||
export { Satextractor } from "./satextractor"; | ||
export { Mempool } from "./mempool"; | ||
export { Inscription } from "./inscription/index"; | ||
export { Satscanner } from "./satscanner/index"; | ||
export { Satextractor } from "./satextractor/index"; | ||
export { Mempool } from "./mempool/index"; | ||
/** | ||
* Represents a bot for managing marketplaces and inscriptions. | ||
*/ | ||
export class Ordinalsbot { | ||
/** | ||
* The marketplace instance. | ||
*/ | ||
private marketPlaceObj!: MarketPlace; | ||
/** | ||
* The inscription instance. | ||
*/ | ||
private inscriptionObj!: Inscription; | ||
/** | ||
* The launchpad instance. | ||
*/ | ||
private launchpadObj!: Launchpad; | ||
/** | ||
* The Mempool instance. | ||
*/ | ||
private mempoolObj!: Mempool; | ||
/** | ||
* The Satextractor instance. | ||
*/ | ||
private satextractorObj!: Satextractor; | ||
/** | ||
* The satscanner instance. | ||
*/ | ||
private satscannerObj!: Satscanner; | ||
/** | ||
* Creates an instance of Ordinalsbot. | ||
* @param {string} key - The API key for authentication. | ||
* @param {InscriptionEnv} environment - The environment (e.g., "live" or "dev") for the inscription. | ||
*/ | ||
constructor(key: string = "", environment: InscriptionEnv = "live") { | ||
/** | ||
* initialising the marketplace instance | ||
*/ | ||
if (this.marketPlaceObj === undefined) { | ||
this.marketPlaceObj = new MarketPlace(key, environment); | ||
} | ||
/** | ||
* initialising the inscription instance | ||
*/ | ||
if (this.inscriptionObj === undefined) { | ||
this.inscriptionObj = new Inscription(key, environment); | ||
} | ||
/** | ||
* initialising the launchpad instance | ||
*/ | ||
if (this.launchpadObj === undefined) { | ||
this.launchpadObj = new Launchpad(key, environment); | ||
} | ||
/** | ||
* initialising the mempool instance | ||
*/ | ||
if (this.mempoolObj === undefined) { | ||
this.mempoolObj = new Mempool(key, environment); | ||
} | ||
/** | ||
* initialising the satextractor instance | ||
*/ | ||
if (this.satextractorObj === undefined) { | ||
this.satextractorObj = new Satextractor(key, environment); | ||
} | ||
/** | ||
* initialising the satextractor instance | ||
*/ | ||
if (this.satscannerObj === undefined) { | ||
this.satscannerObj = new Satscanner(key, environment); | ||
} | ||
} | ||
/** | ||
* Returns the marketplace instance. | ||
* @returns {MarketPlace} The marketplace instance. | ||
*/ | ||
MarketPlace(): MarketPlace { | ||
return this.marketPlaceObj; | ||
} | ||
/** | ||
* Returns the inscription instance. | ||
* @returns {Inscription} The inscription instance. | ||
*/ | ||
Inscription(): Inscription { | ||
return this.inscriptionObj; | ||
} | ||
/** | ||
* Returns the launchpad instance. | ||
* @returns {Launchpad} The launchpad instance. | ||
*/ | ||
Launchpad(): Launchpad { | ||
return this.launchpadObj; | ||
} | ||
/** | ||
* Returns the mempool instance. | ||
* @returns {Mempool} The mempool instance. | ||
*/ | ||
Mempool(): Mempool { | ||
return this.mempoolObj; | ||
} | ||
/** | ||
* Returns the satextractor instance. | ||
* @returns {Satextractor} The satextractor instance. | ||
*/ | ||
Satextractor(): Satextractor { | ||
return this.satextractorObj; | ||
} | ||
/** | ||
* Returns the Satscanner instance. | ||
* @returns {Satscanner} The Satscanner instance. | ||
*/ | ||
Satscanner(): Satscanner { | ||
return this.satscannerObj; | ||
} | ||
} |
import axios, { AxiosInstance } from "axios"; | ||
import { InscriptionError } from "./InscriptionError"; | ||
import { InscriptionError } from "./inscription/error"; | ||
import { | ||
@@ -4,0 +4,0 @@ MarketplaceConfirmPaddingOutputsRequest, |
@@ -154,10 +154,72 @@ export enum LISTING_STATUS { | ||
/** | ||
* Request object for the ordinal listing | ||
*/ | ||
export interface MarketplaceGetListingRequest { | ||
query: { status: LISTING_STATUS }; | ||
/** | ||
* Filter based on the status. | ||
*/ | ||
filter: { status: LISTING_STATUS }; | ||
/** | ||
* Starting of the page. | ||
* Default page is 1 | ||
*/ | ||
page?: number; | ||
/** | ||
* Records in a single listing result | ||
* Default page is 1 | ||
*/ | ||
itemsPerPage?: number; | ||
/** | ||
* sorting the result collection | ||
* Default sort value is time. | ||
*/ | ||
sort?: string; | ||
} | ||
/** | ||
* Get market listing response object | ||
*/ | ||
export interface MarketplaceGetListingResponse { | ||
ordinals: Array<SellerOrdinal>; | ||
/** Array of the listing */ | ||
results: ListingOrdinal[]; | ||
/** total number records */ | ||
count: number; | ||
/**current page number */ | ||
currentPage: number; | ||
/** total pages */ | ||
totalPages: number; | ||
/** total number of items in the result array */ | ||
totalItems: number; | ||
} | ||
/** | ||
* Listing ordinal object | ||
*/ | ||
interface ListingOrdinal { | ||
_id: string; | ||
ordinalId: string; | ||
price: number; | ||
sellerPaymentAddress: string; | ||
sellerOrdinalAddress: string; | ||
sellerOrdinalPublicKey: string; | ||
status: string; | ||
sellerOutputValue: number; | ||
ordinalUtxoTxId: string; | ||
ordinalUtxoVout: number; | ||
indexInSellerPSBT: number; | ||
marketPlaceId: string; | ||
marketPlaceMakerFee: number; | ||
marketPlaceTakerFee: number; | ||
platformMakerFee: number; | ||
platformTakerFee: number; | ||
marketPlaceFeeBtcAddress: string; | ||
createdAt: string; | ||
updatedAt: string; | ||
signedListingPSBT: string; | ||
} | ||
export interface MarketplaceSaveListingRequest { | ||
@@ -216,3 +278,3 @@ ordinalId: String; | ||
senderPaymentAddress: string; | ||
/** The sender's payment public key */ | ||
@@ -226,3 +288,3 @@ senderPaymentPublicKey: string; | ||
senderOrdinalAddress: string; | ||
/** Wallet Provider name */ | ||
@@ -265,3 +327,3 @@ walletProvider?: string; | ||
/** updated price for ordinal */ | ||
price:number | ||
price: number; | ||
@@ -313,3 +375,2 @@ /** The address to receive the sale proceeds when the ordinal is sold. This will be part of the sale transaction that the buyer will sign */ | ||
/** | ||
@@ -324,3 +385,3 @@ * Request object for deList ordinal. | ||
senderPaymentAddress: string; | ||
/** The seller's payment public key */ | ||
@@ -331,3 +392,3 @@ senderPaymentPublicKey: string; | ||
senderOrdinalAddress: string; | ||
/** Wallet Provider name */ | ||
@@ -334,0 +395,0 @@ walletProvider?: string; |
@@ -11,2 +11,10 @@ export interface MempoolAddressUtxoResponse { | ||
value: number; | ||
} | ||
} | ||
export interface RecommendedFees { | ||
fastestFee: number; | ||
halfHourFee: number; | ||
hourFee: number; | ||
economyFee: number; | ||
minimumFee: number; | ||
} |
@@ -25,2 +25,2 @@ import { SpecialRange } from "./satscanner_types"; | ||
tx: string; | ||
} | ||
} |
@@ -47,27 +47,56 @@ export interface InscriptionTransaction { | ||
metadataSize?: number; | ||
} | ||
export interface InscriptionOrderRequest { | ||
/* | ||
* An array of objects that includes: | ||
* | ||
* Mandatory | ||
* - name:string; => name of the file including extension. | ||
* - size:number; => size of the file in bytes | ||
* - url:string; => file URL hosted on OrdinalsBot buckets | ||
* | ||
* Optional | ||
* - metadataUrl:string; => metadata json file URL hosted on OrdinalsBot buckets | ||
* - metadataSize:number; => size of the metadata file in bytes | ||
* - metaprotocol:string; => Metaprotocol field to be included in the inscription data | ||
* | ||
* Note: you can send any dataURL text/json/image/video data in a parameter called dataURL instead of url for files | ||
*/ | ||
files: InscriptionFile[]; | ||
fee: number; | ||
/** Inscribe file with minimum postage (padding) 546 sats instead of the standard 10,000 sats. | ||
(default=false) | ||
*/ | ||
/** | ||
* Miner fee that will be paid while inscribing the ordinals in sats/byte. | ||
* (default=2 sats/byte) | ||
*/ | ||
fee?: number; | ||
/** | ||
* Inscribe file with minimum postage (padding) 546 sats instead of the standard 10,000 sats. | ||
* (default=false) | ||
*/ | ||
lowPostage?: boolean; | ||
receiveAddress?: string; | ||
/** Inscribe on a rare, exotic, early sat. | ||
Options: vintage | block78 | pizza | uncommon | random (default=random) | ||
full list can be queried from inventory endpoint | ||
*/ | ||
/** | ||
* A single Bitcoin address to receive the inscriptions for the whole order | ||
* Or one receiver Address per file | ||
*/ | ||
receiveAddress?: string | string[]; | ||
/** | ||
* Inscribe on a rare, exotic, early sat. | ||
* Options: vintage | block78 | pizza | uncommon | random (default=random) | ||
* full list can be queried from inventory endpoint | ||
*/ | ||
rareSats?: string; | ||
/** referral code to earn up to %15 of the order service fee. */ | ||
/** | ||
* Referral code to earn up to %15 of the order service fee. | ||
*/ | ||
referral?: string; | ||
/** Amount of satoshis to charge extra for this order that will be added to "referral" account. | ||
Needs to be used together with "referral" | ||
*/ | ||
/** | ||
* Amount of satoshis to charge extra for this order that will be added to "referral" account. | ||
* Needs to be used together with "referral" parameter. | ||
*/ | ||
additionalFee?: number; | ||
@@ -84,8 +113,29 @@ | ||
/** Use brotli compression to reduce file sizes on chain | ||
/** | ||
* Use brotli compression to reduce file sizes on chain | ||
* default=false | ||
*/ | ||
compress?: boolean; | ||
/** | ||
* | ||
*/ | ||
parent?: InscriptionOrderParentRequest; | ||
/** | ||
* | ||
*/ | ||
projectTag?: string; | ||
batchMode?: string; | ||
} | ||
/** | ||
* Parent Reqeust object for the Inscription order | ||
*/ | ||
export interface InscriptionOrderParentRequest { | ||
inscriptionId: string; | ||
returnAddress: string; | ||
} | ||
export interface InscriptionCharge { | ||
@@ -107,6 +157,10 @@ id: string; | ||
chain_invoice?: InscriptionOnchainInvoice; | ||
lightning_invoice?: InscriptionLightningInvoice; | ||
transactions?: InscriptionChargeTransaction[]; | ||
uri?: string; | ||
callback_url?: string; | ||
} | ||
export interface InscriptionOrder extends InscriptionOrderRequest { | ||
id: string; | ||
status: string; | ||
@@ -117,3 +171,8 @@ // ... input parameters from InscriptionOrderRequest | ||
serviceFee: number; // in satoshis | ||
baseFee: number; | ||
rareSatsFee: number; | ||
postage: number; | ||
orderType: string; | ||
zeroConf: string | null; | ||
state: string; | ||
createdAt: number; // timestamp in ms, | ||
@@ -128,2 +187,6 @@ } | ||
export interface InscriptionLightningInvoice { | ||
expires_at: number, | ||
payreq: string, | ||
} | ||
export interface InscriptionChargeTransaction { | ||
@@ -143,2 +206,5 @@ address: string; | ||
/** | ||
* Represents a request for pricing information for inscribing files. | ||
*/ | ||
export interface InscriptionPriceRequest { | ||
@@ -159,9 +225,38 @@ /** Total size of all files to be inscribed in bytes */ | ||
rareSats: string; | ||
/** Esitmate fees for the files with minimum postage | ||
* (padding) 546 sats instead of the standard 10,000 sats | ||
* (default = false) | ||
*/ | ||
lowPostage?: boolean; | ||
/** | ||
* Estimate fees for a direct inscription order | ||
* `/inscribe` endpoint which will be cheaper | ||
* (default = false) | ||
*/ | ||
direct?: boolean; | ||
/** | ||
* Additional fee(in satoshis) to be added to order total and passed to your referral code. | ||
*/ | ||
additionalFee?: number; | ||
/** | ||
* The custom base fee from apikey | ||
*/ | ||
baseFee?: number; | ||
} | ||
/** | ||
* Represents a response for pricing information for inscribing files. | ||
*/ | ||
export interface InscriptionPriceResponse { | ||
status: string; | ||
chainFee: number; // chain fee that will be paid to miners | ||
baseFee: number; // base service fee taken by inscription.com | ||
serviceFee: number; // total service fee taken by inscription.com | ||
rareSatsFee: number; | ||
additionalFee: number; //the additinal fee per file | ||
postage: number; //postage fee according to provided lowPostage. i.e lowPostage is 546 and normalPostage is 10,000 | ||
amount: number; // amount to be paid by the user | ||
totalFee: number; // total amount to be paid by the user | ||
@@ -171,34 +266,56 @@ } | ||
export interface InscriptionCollectionCreateRequest { | ||
/** URL safe unique collection slug. This will be used as part of mint URL. */ | ||
id: string; | ||
/** | ||
* An array of objects that includes: | ||
* - name:string; => name of the file including extension. | ||
* - size:number; => size of the file in bytes. | ||
* - url:string; => publicly accessible image URL | ||
*/ | ||
files: InscriptionFile[]; | ||
// Inscription price per file (for collection creator) set to 0 for free mints | ||
price: number; | ||
// Max supply of the collection. | ||
totalCount: number; | ||
/** URL safe unique collection slug. Will be used as mint URL. */ | ||
id?: string; | ||
// Miner fee that will be paid while inscribing the ordinals in sats/byte. (default=2 sats/byte) | ||
fee?: number; | ||
/** Collection Display Name */ | ||
name?: string; | ||
// Inscription service fee per file taken by inscription.com, min: 27000 (sats) | ||
serviceFee?: number; | ||
// Bitcoin address to receive payouts from inscriptions | ||
"creator-address": string; | ||
/** Collection description */ | ||
description?: string; | ||
// collection metadata | ||
name: string; | ||
description: string; | ||
/** Collection creator */ | ||
creator: string; | ||
// optional info to be displayed on the mint page | ||
/** Inscription price per file (for collection creator) set to 0 for free mints */ | ||
price: number; | ||
/** Max supply of the collection */ | ||
totalCount?: number; | ||
/** Collection twitter account */ | ||
twitter?: string; | ||
/** Collection website */ | ||
website?: string; | ||
discord?: string; | ||
// images to be used on the mint page | ||
/** Collection banner image URL */ | ||
banner?: string; | ||
/** Collection cover image URL */ | ||
cover?: string; | ||
/** Miner fee that will be paid while inscribing the ordinals in sats/byte. (default=2 sats/byte) */ | ||
fee?: number; | ||
/** Inscription service fee per file taken by ordinalsbot.com, min: 27000 (sats) */ | ||
serviceFee?: number; | ||
/** Bitcoin address to receive payouts from inscriptions */ | ||
"creator-address": string; | ||
// allowlist is optional | ||
allowlist?: AllocationMap; | ||
allowList?: AllocationMap; | ||
discord?: string; | ||
parent?: InscriptionOrderParentRequest; | ||
/** brc20 collection fields */ | ||
deployInscription?: string; | ||
saleSize?: number; | ||
} | ||
@@ -215,3 +332,6 @@ | ||
extends InscriptionCollectionCreateRequest { | ||
averageSize: number; | ||
inscribedCount: number; | ||
status: string; | ||
active: boolean; | ||
// ... input parameters from InscriptionCollectionCreateRequest | ||
@@ -227,31 +347,84 @@ createdAt: number; | ||
count: number; | ||
requestedIds?: number[]; | ||
} | ||
export interface InscriptionCollectionOrderRequest { | ||
collection: InscriptionCollection; | ||
/** Mining fee to be paid for this collection inscription (sats/vB) */ | ||
fee?: number; | ||
// cloudflare turnstile token | ||
/** Bitcoin address to receive the inscriptions for the whole order */ | ||
receiveAddress?: string; | ||
/** | ||
* Object including | ||
* id: Collection slug to be inscribed | ||
* count: number of inscriptions being ordered. | ||
* requestedIds: id to be requested. one from both count or requestedIds is must | ||
*/ | ||
collection?: InscriptionCollection; | ||
referral?: string; | ||
/** Cloudflare turnstile token. Required if no x-api-key header is present. */ | ||
token?: string; | ||
receiveAddress?: string; | ||
/** | ||
* Inscribe on a rare, exotic, early sat. | ||
* Options: vintage | block78 | pizza | uncommon | random (default=random) | ||
* full list can be queried from inventory endpoint | ||
*/ | ||
rareSats?: string; | ||
/** Inscribe on a rare, exotic, early sat. | ||
Options: vintage | block78 | pizza | uncommon | random (default=random) | ||
full list can be queried from inventory endpoint | ||
*/ | ||
rareSats?: string; | ||
/** | ||
* Order timeout in minutes. | ||
* Generated payment invoice will be valid for this duration only. Payments that are sent after this will not be processed. | ||
* (default=4320) | ||
*/ | ||
timeout?: number; | ||
/** | ||
* Amount of satoshis to charge extra for this order that will be added to "referral" account. | ||
* Needs to be used together with "referral" parameter. | ||
*/ | ||
additionalFee?: number; | ||
} | ||
export interface InscriptionTextOrderRequest { | ||
texts: string[]; | ||
/** | ||
* Create collectionorder response Object | ||
*/ | ||
export interface InscriptionCollectionOrderResponse { | ||
charge: InscriptionCharge; | ||
collection: InscriptionCollection; | ||
fee: number; | ||
rareSatsFee: number; | ||
serviceFee: number; // in satoshis | ||
price: number; | ||
fileCount: number; | ||
orderType: string; | ||
postage: number; | ||
lowPostage: number; | ||
chainFee: number; // in satoshis | ||
amount: number; // in satoshis | ||
id: string; | ||
additionalFee: number; | ||
rareSats: string; | ||
receiveAddress: string; | ||
referral: string; | ||
zeroConf: string; | ||
status: string; | ||
state: string; | ||
createdAt: number; // timestamp in ms, | ||
} | ||
/** Inscribe file with minimum postage (padding) 546 sats instead of the standard 10,000 sats. | ||
(default=false) | ||
*/ | ||
lowPostage?: boolean; | ||
receiveAddress?: string; | ||
/** | ||
* Create textorder request object | ||
*/ | ||
export interface InscriptionTextOrderRequest extends InscriptionOrderRequest { | ||
// ... input parameters from InscriptionOrderRequest | ||
/** referral code to earn up to %15 of the order service fee. */ | ||
referral?: string; | ||
/** | ||
* An array of strings to be inscribed | ||
*/ | ||
texts: string[]; | ||
} | ||
@@ -315,1 +488,34 @@ | ||
} | ||
/** | ||
* Response object for create special Sats. | ||
*/ | ||
export interface CreateSpecialSatsResponse { | ||
/** | ||
* base64 transaction to be signed | ||
*/ | ||
psbt: string; | ||
} | ||
/** | ||
* Request object for Create Special Sats. | ||
*/ | ||
export interface CreateSpecialSatsRequest { | ||
/** Charge amount for creating Create Special Sats */ | ||
chargeAmount: string; | ||
/** The funding payment address */ | ||
fundingAddress: string; | ||
/** The Special Sats Output public key */ | ||
specialSatsOutput: string; | ||
/** user's payment address */ | ||
userAddress: string; | ||
/** user's payment public key*/ | ||
userPublicKey: string; | ||
/**feeRate */ | ||
feeRate: number; | ||
} |
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
268517
110
5282
147