@gobob/bob-sdk 5.12.0 → 5.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/gateway/client.js.map +1 -1
- package/dist/gateway/error/gateway-error.js.map +1 -1
- package/dist/gateway/utils/common.d.ts +821 -5884
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/dist/mempool.js +1 -1
- package/dist/mempool.js.map +1 -1
- package/dist/wallet/utxo.d.ts +1 -3
- package/dist/wallet/utxo.js +7 -90
- package/dist/wallet/utxo.js.map +1 -1
- package/package.json +4 -5
- package/dist/helpers.d.ts +0 -3
- package/dist/helpers.js +0 -77
- package/dist/helpers.js.map +0 -1
- package/dist/inscription.d.ts +0 -23
- package/dist/inscription.js +0 -198
- package/dist/inscription.js.map +0 -1
- package/dist/ordinal-api/index.d.ts +0 -113
- package/dist/ordinal-api/index.js +0 -156
- package/dist/ordinal-api/index.js.map +0 -1
- package/dist/ordinals/commit.d.ts +0 -11
- package/dist/ordinals/commit.js +0 -66
- package/dist/ordinals/commit.js.map +0 -1
- package/dist/ordinals/index.d.ts +0 -5
- package/dist/ordinals/index.js +0 -83
- package/dist/ordinals/index.js.map +0 -1
- package/dist/ordinals/reveal.d.ts +0 -13
- package/dist/ordinals/reveal.js +0 -78
- package/dist/ordinals/reveal.js.map +0 -1
- package/dist/ordinals/signer.d.ts +0 -14
- package/dist/ordinals/signer.js +0 -17
- package/dist/ordinals/signer.js.map +0 -1
- package/dist/runes.d.ts +0 -5
- package/dist/runes.js +0 -55
- package/dist/runes.js.map +0 -1
- package/dist/wallet/inscriptions.d.ts +0 -4
- package/dist/wallet/inscriptions.js +0 -43
- package/dist/wallet/inscriptions.js.map +0 -1
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
export declare const REGTEST_ORD_BASE_PATH = "http://0.0.0.0:3003";
|
|
2
|
-
export declare const MAINNET_ORD_BASE_PATH = "https://ordinals-mainnet.gobob.xyz";
|
|
3
|
-
export declare const TESTNET_ORD_BASE_PATH = "https://ordinals-testnet.gobob.xyz";
|
|
4
|
-
export declare const SIGNET_ORD_BASE_PATH = "https://ordinals-signet.gobob.xyz";
|
|
5
|
-
export type InscriptionId = {
|
|
6
|
-
txid: string;
|
|
7
|
-
index: number;
|
|
8
|
-
};
|
|
9
|
-
export declare namespace InscriptionId {
|
|
10
|
-
function toString(id: InscriptionId): string;
|
|
11
|
-
function fromString(id: string): InscriptionId;
|
|
12
|
-
}
|
|
13
|
-
export type OutPoint = {
|
|
14
|
-
txid: string;
|
|
15
|
-
vout: number;
|
|
16
|
-
};
|
|
17
|
-
export declare namespace OutPoint {
|
|
18
|
-
function toString(id: OutPoint): string;
|
|
19
|
-
function fromString(id: string): OutPoint;
|
|
20
|
-
}
|
|
21
|
-
export type SatPoint = {
|
|
22
|
-
outpoint: OutPoint;
|
|
23
|
-
offset: number;
|
|
24
|
-
};
|
|
25
|
-
export declare namespace SatPoint {
|
|
26
|
-
function toString(id: SatPoint): string;
|
|
27
|
-
function fromString(id: string): SatPoint;
|
|
28
|
-
}
|
|
29
|
-
export interface InscriptionsJson<InscriptionId> {
|
|
30
|
-
ids: InscriptionId[];
|
|
31
|
-
more: boolean;
|
|
32
|
-
page_index: number;
|
|
33
|
-
}
|
|
34
|
-
export interface OutputJson {
|
|
35
|
-
address: string | null;
|
|
36
|
-
indexed: boolean;
|
|
37
|
-
inscriptions: string[];
|
|
38
|
-
runes: {
|
|
39
|
-
[key: string]: {
|
|
40
|
-
amount: number;
|
|
41
|
-
divisibility: number;
|
|
42
|
-
symbol: string | null;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
confirmations: number;
|
|
46
|
-
outpoint: string;
|
|
47
|
-
sat_ranges: [number, number][] | null;
|
|
48
|
-
script_pubkey: string;
|
|
49
|
-
spent: boolean;
|
|
50
|
-
transaction: string;
|
|
51
|
-
value: number;
|
|
52
|
-
}
|
|
53
|
-
export interface AddressInfo {
|
|
54
|
-
outputs: string[];
|
|
55
|
-
inscriptions: string[];
|
|
56
|
-
sat_balance: number;
|
|
57
|
-
runes_balances: [string, `${number}`, string][];
|
|
58
|
-
}
|
|
59
|
-
export interface SatJson<InscriptionId> {
|
|
60
|
-
number: number;
|
|
61
|
-
decimal: string;
|
|
62
|
-
degree: string;
|
|
63
|
-
name: string;
|
|
64
|
-
block: number;
|
|
65
|
-
charms: number[];
|
|
66
|
-
cycle: number;
|
|
67
|
-
epoch: number;
|
|
68
|
-
period: number;
|
|
69
|
-
offset: number;
|
|
70
|
-
rarity: string;
|
|
71
|
-
percentile: string;
|
|
72
|
-
satpoint: string | null;
|
|
73
|
-
timestamp: number;
|
|
74
|
-
inscriptions: InscriptionId[];
|
|
75
|
-
}
|
|
76
|
-
export interface InscriptionJson<InscriptionId, SatPoint> {
|
|
77
|
-
address: string | null;
|
|
78
|
-
charms: string[];
|
|
79
|
-
child_count: number;
|
|
80
|
-
children: InscriptionId[];
|
|
81
|
-
content_length: number | null;
|
|
82
|
-
content_type: string | null;
|
|
83
|
-
effective_content_type: string | null;
|
|
84
|
-
fee: number;
|
|
85
|
-
metaprotocol: string | null;
|
|
86
|
-
height: number;
|
|
87
|
-
id: InscriptionId;
|
|
88
|
-
next: InscriptionId | null;
|
|
89
|
-
number: number;
|
|
90
|
-
parents: string[];
|
|
91
|
-
previous: InscriptionId | null;
|
|
92
|
-
rune: string | null;
|
|
93
|
-
sat: number | null;
|
|
94
|
-
satpoint: SatPoint;
|
|
95
|
-
timestamp: number;
|
|
96
|
-
value: number | null;
|
|
97
|
-
}
|
|
98
|
-
export declare class OrdinalsClient {
|
|
99
|
-
private basePath;
|
|
100
|
-
constructor(networkOrUrl?: string);
|
|
101
|
-
getAssetsByAddress(address: string): Promise<AddressInfo>;
|
|
102
|
-
getInscriptionFromId(id: InscriptionId): Promise<InscriptionJson<InscriptionId, SatPoint>>;
|
|
103
|
-
getInscriptions(): Promise<InscriptionsJson<InscriptionId>>;
|
|
104
|
-
getInscriptionsFromBlock(height: number): Promise<InscriptionsJson<InscriptionId>>;
|
|
105
|
-
getInscriptionsFromOutPoint(outPoint: OutPoint): Promise<OutputJson>;
|
|
106
|
-
getOutputsFromAddress(address: string, type?: 'cardinal' | 'inscribed' | 'runic' | 'any'): Promise<OutputJson[]>;
|
|
107
|
-
getOutputsFromOutPoints(outpoints: string[]): Promise<OutputJson[]>;
|
|
108
|
-
getInscriptionsFromSat(sat: number): Promise<SatJson<InscriptionId>>;
|
|
109
|
-
getInscriptionsFromStartBlock(startHeight: number): Promise<InscriptionsJson<InscriptionId>>;
|
|
110
|
-
private getJson;
|
|
111
|
-
private postJson;
|
|
112
|
-
private parseInscriptionsJson;
|
|
113
|
-
}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OrdinalsClient = exports.SatPoint = exports.OutPoint = exports.InscriptionId = exports.SIGNET_ORD_BASE_PATH = exports.TESTNET_ORD_BASE_PATH = exports.MAINNET_ORD_BASE_PATH = exports.REGTEST_ORD_BASE_PATH = void 0;
|
|
4
|
-
exports.REGTEST_ORD_BASE_PATH = 'http://0.0.0.0:3003';
|
|
5
|
-
exports.MAINNET_ORD_BASE_PATH = 'https://ordinals-mainnet.gobob.xyz';
|
|
6
|
-
exports.TESTNET_ORD_BASE_PATH = 'https://ordinals-testnet.gobob.xyz';
|
|
7
|
-
exports.SIGNET_ORD_BASE_PATH = 'https://ordinals-signet.gobob.xyz';
|
|
8
|
-
var InscriptionId;
|
|
9
|
-
(function (InscriptionId) {
|
|
10
|
-
function toString(id) {
|
|
11
|
-
return `${id.txid}i${id.index}`;
|
|
12
|
-
}
|
|
13
|
-
InscriptionId.toString = toString;
|
|
14
|
-
function fromString(id) {
|
|
15
|
-
const [txid, index] = id.split('i');
|
|
16
|
-
return {
|
|
17
|
-
txid,
|
|
18
|
-
index: parseInt(index, 10),
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
InscriptionId.fromString = fromString;
|
|
22
|
-
})(InscriptionId || (exports.InscriptionId = InscriptionId = {}));
|
|
23
|
-
var OutPoint;
|
|
24
|
-
(function (OutPoint) {
|
|
25
|
-
function toString(id) {
|
|
26
|
-
return `${id.txid}:${id.vout}`;
|
|
27
|
-
}
|
|
28
|
-
OutPoint.toString = toString;
|
|
29
|
-
function fromString(id) {
|
|
30
|
-
const [txid, vout] = id.split(':');
|
|
31
|
-
return {
|
|
32
|
-
txid,
|
|
33
|
-
vout: parseInt(vout, 10),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
OutPoint.fromString = fromString;
|
|
37
|
-
})(OutPoint || (exports.OutPoint = OutPoint = {}));
|
|
38
|
-
var SatPoint;
|
|
39
|
-
(function (SatPoint) {
|
|
40
|
-
function toString(id) {
|
|
41
|
-
return `${OutPoint.toString(id.outpoint)}:${id.offset}`;
|
|
42
|
-
}
|
|
43
|
-
SatPoint.toString = toString;
|
|
44
|
-
function fromString(id) {
|
|
45
|
-
const [txid, vout, offset] = id.split(':');
|
|
46
|
-
return {
|
|
47
|
-
outpoint: {
|
|
48
|
-
txid,
|
|
49
|
-
vout: parseInt(vout, 10),
|
|
50
|
-
},
|
|
51
|
-
offset: parseInt(offset, 10),
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
SatPoint.fromString = fromString;
|
|
55
|
-
})(SatPoint || (exports.SatPoint = SatPoint = {}));
|
|
56
|
-
class OrdinalsClient {
|
|
57
|
-
basePath;
|
|
58
|
-
constructor(networkOrUrl = 'mainnet') {
|
|
59
|
-
switch (networkOrUrl) {
|
|
60
|
-
case 'mainnet':
|
|
61
|
-
this.basePath = exports.MAINNET_ORD_BASE_PATH;
|
|
62
|
-
break;
|
|
63
|
-
case 'signet':
|
|
64
|
-
this.basePath = exports.SIGNET_ORD_BASE_PATH;
|
|
65
|
-
break;
|
|
66
|
-
case 'testnet':
|
|
67
|
-
this.basePath = exports.TESTNET_ORD_BASE_PATH;
|
|
68
|
-
break;
|
|
69
|
-
case 'regtest':
|
|
70
|
-
this.basePath = exports.REGTEST_ORD_BASE_PATH;
|
|
71
|
-
break;
|
|
72
|
-
default:
|
|
73
|
-
this.basePath = networkOrUrl;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
getAssetsByAddress(address) {
|
|
77
|
-
return this.getJson(`${this.basePath}/address/${address}`);
|
|
78
|
-
}
|
|
79
|
-
async getInscriptionFromId(id) {
|
|
80
|
-
console.log(`${this.basePath}/inscription/${InscriptionId.toString(id)}`);
|
|
81
|
-
const inscriptionJson = await this.getJson(`${this.basePath}/inscription/${InscriptionId.toString(id)}`);
|
|
82
|
-
return {
|
|
83
|
-
...inscriptionJson,
|
|
84
|
-
children: inscriptionJson.children.map(InscriptionId.fromString),
|
|
85
|
-
id: InscriptionId.fromString(inscriptionJson.id),
|
|
86
|
-
next: inscriptionJson.next != null ? InscriptionId.fromString(inscriptionJson.next) : null,
|
|
87
|
-
previous: inscriptionJson.previous != null ? InscriptionId.fromString(inscriptionJson.previous) : null,
|
|
88
|
-
satpoint: SatPoint.fromString(inscriptionJson.satpoint),
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
async getInscriptions() {
|
|
92
|
-
const inscriptionsJson = await this.getJson(`${this.basePath}/inscriptions`);
|
|
93
|
-
return this.parseInscriptionsJson(inscriptionsJson);
|
|
94
|
-
}
|
|
95
|
-
async getInscriptionsFromBlock(height) {
|
|
96
|
-
const inscriptionsJson = await this.getJson(`${this.basePath}/inscriptions/block/${height}`);
|
|
97
|
-
return this.parseInscriptionsJson(inscriptionsJson);
|
|
98
|
-
}
|
|
99
|
-
getInscriptionsFromOutPoint(outPoint) {
|
|
100
|
-
return this.getJson(`${this.basePath}/output/${OutPoint.toString(outPoint)}`);
|
|
101
|
-
}
|
|
102
|
-
getOutputsFromAddress(address, type) {
|
|
103
|
-
const searchParams = new URLSearchParams();
|
|
104
|
-
if (type)
|
|
105
|
-
searchParams.append('type', type);
|
|
106
|
-
return this.getJson(`${this.basePath}/outputs/${address}?${searchParams}`);
|
|
107
|
-
}
|
|
108
|
-
getOutputsFromOutPoints(outpoints) {
|
|
109
|
-
return this.postJson(`${this.basePath}/outputs`, outpoints);
|
|
110
|
-
}
|
|
111
|
-
async getInscriptionsFromSat(sat) {
|
|
112
|
-
const satJson = await this.getJson(`${this.basePath}/sat/${sat}`);
|
|
113
|
-
return {
|
|
114
|
-
...satJson,
|
|
115
|
-
inscriptions: satJson.inscriptions.map((id) => InscriptionId.fromString(id)),
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
async getInscriptionsFromStartBlock(startHeight) {
|
|
119
|
-
const inscriptionsJson = await this.getJson(`${this.basePath}/inscriptions/${startHeight}`);
|
|
120
|
-
return this.parseInscriptionsJson(inscriptionsJson);
|
|
121
|
-
}
|
|
122
|
-
async getJson(url) {
|
|
123
|
-
const response = await fetch(url, {
|
|
124
|
-
headers: {
|
|
125
|
-
Accept: 'application/json',
|
|
126
|
-
},
|
|
127
|
-
});
|
|
128
|
-
if (!response.ok) {
|
|
129
|
-
throw new Error(response.statusText);
|
|
130
|
-
}
|
|
131
|
-
return response.json();
|
|
132
|
-
}
|
|
133
|
-
async postJson(url, body) {
|
|
134
|
-
const response = await fetch(url, {
|
|
135
|
-
method: 'POST',
|
|
136
|
-
headers: {
|
|
137
|
-
'Content-Type': 'application/json',
|
|
138
|
-
Accept: 'application/json',
|
|
139
|
-
},
|
|
140
|
-
body: JSON.stringify(body),
|
|
141
|
-
});
|
|
142
|
-
if (!response.ok) {
|
|
143
|
-
throw new Error(response.statusText);
|
|
144
|
-
}
|
|
145
|
-
return response.json();
|
|
146
|
-
}
|
|
147
|
-
parseInscriptionsJson(inscriptionsJson) {
|
|
148
|
-
const ids = inscriptionsJson.ids.map((id) => InscriptionId.fromString(id));
|
|
149
|
-
return {
|
|
150
|
-
...inscriptionsJson,
|
|
151
|
-
ids,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
exports.OrdinalsClient = OrdinalsClient;
|
|
156
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ordinal-api/index.ts"],"names":[],"mappings":";;;AAIa,QAAA,qBAAqB,GAAG,qBAAqB,CAAC;AAM9C,QAAA,qBAAqB,GAAG,oCAAoC,CAAC;AAM7D,QAAA,qBAAqB,GAAG,oCAAoC,CAAC;AAM7D,QAAA,oBAAoB,GAAG,mCAAmC,CAAC;AAQxE,IAAc,aAAa,CAa1B;AAbD,WAAc,aAAa;IACvB,SAAgB,QAAQ,CAAC,EAAiB;QACtC,OAAO,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC;IACpC,CAAC;IAFe,sBAAQ,WAEvB,CAAA;IAED,SAAgB,UAAU,CAAC,EAAU;QAEjC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpC,OAAO;YACH,IAAI;YACJ,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC;SAC7B,CAAC;IACN,CAAC;IAPe,wBAAU,aAOzB,CAAA;AACL,CAAC,EAba,aAAa,6BAAb,aAAa,QAa1B;AAQD,IAAc,QAAQ,CAarB;AAbD,WAAc,QAAQ;IAClB,SAAgB,QAAQ,CAAC,EAAY;QACjC,OAAO,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;IACnC,CAAC;IAFe,iBAAQ,WAEvB,CAAA;IAED,SAAgB,UAAU,CAAC,EAAU;QAEjC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO;YACH,IAAI;YACJ,IAAI,EAAE,QAAQ,CAAC,IAA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{
|
|
4
|
-
scriptTaproot: bitcoin.payments.Payment;
|
|
5
|
-
tapLeafScript: {
|
|
6
|
-
leafVersion: number;
|
|
7
|
-
script: Buffer;
|
|
8
|
-
controlBlock: Buffer;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export declare function createCommitTxData(network: bitcoin.Network, publicKey: Buffer, inscription: Inscription): CommitTxData;
|
package/dist/ordinals/commit.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.createCommitTxData = createCommitTxData;
|
|
37
|
-
const bitcoin = __importStar(require("bitcoinjs-lib"));
|
|
38
|
-
function toXOnly(pubkey) {
|
|
39
|
-
return pubkey.subarray(1, 33);
|
|
40
|
-
}
|
|
41
|
-
function createCommitTxData(network, publicKey, inscription) {
|
|
42
|
-
const xOnlyPublicKey = toXOnly(publicKey);
|
|
43
|
-
const script = inscription.toScript(xOnlyPublicKey);
|
|
44
|
-
const outputScript = bitcoin.script.compile(script);
|
|
45
|
-
const scriptTree = {
|
|
46
|
-
output: outputScript,
|
|
47
|
-
redeemVersion: 192,
|
|
48
|
-
};
|
|
49
|
-
const scriptTaproot = bitcoin.payments.p2tr({
|
|
50
|
-
internalPubkey: xOnlyPublicKey,
|
|
51
|
-
scriptTree,
|
|
52
|
-
redeem: scriptTree,
|
|
53
|
-
network,
|
|
54
|
-
});
|
|
55
|
-
const cblock = scriptTaproot.witness?.at(-1);
|
|
56
|
-
const tapLeafScript = {
|
|
57
|
-
leafVersion: scriptTaproot.redeemVersion,
|
|
58
|
-
script: outputScript,
|
|
59
|
-
controlBlock: cblock || Buffer.alloc(0),
|
|
60
|
-
};
|
|
61
|
-
return {
|
|
62
|
-
scriptTaproot,
|
|
63
|
-
tapLeafScript,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=commit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commit.js","sourceRoot":"","sources":["../../src/ordinals/commit.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,gDAkCC;AAtDD,uDAAyC;AAYzC,SAAS,OAAO,CAAC,MAAc;IAC3B,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAClC,CAAC;AAMD,SAAgB,kBAAkB,CAC9B,OAAwB,EACxB,SAAiB,EACjB,WAAwB;IAExB,MAAM,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEpD,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEpD,MAAM,UAAU,GAAG;QACf,MAAM,EAAE,YAAY;QACpB,aAAa,EAAE,GAAG;KACrB,CAAC;IAEF,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;QACxC,cAAc,EAAE,cAAc;QAC9B,UAAU;QACV,MAAM,EAAE,UAAU;QAClB,OAAO;KACV,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAE7C,MAAM,aAAa,GAAG;QAClB,WAAW,EAAE,aAAa,CAAC,aAAc;QACzC,MAAM,EAAE,YAAY;QACpB,YAAY,EAAE,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;KAC1C,CAAC;IAEF,OAAO;QACH,aAAa;QACb,aAAa;KAChB,CAAC;AACN,CAAC"}
|
package/dist/ordinals/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as bitcoin from 'bitcoinjs-lib';
|
|
2
|
-
import { RemoteSigner } from './signer';
|
|
3
|
-
import { Inscription } from '../inscription';
|
|
4
|
-
export { RemoteSigner };
|
|
5
|
-
export declare function inscribeData(signer: RemoteSigner, toAddress: string, feeRate: number, inscription: Inscription, postage?: number): Promise<bitcoin.Transaction>;
|
package/dist/ordinals/index.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.inscribeData = inscribeData;
|
|
37
|
-
const bitcoin = __importStar(require("bitcoinjs-lib"));
|
|
38
|
-
const signer_1 = require("./signer");
|
|
39
|
-
const commit_1 = require("./commit");
|
|
40
|
-
const reveal_1 = require("./reveal");
|
|
41
|
-
function estimateTxSize(network, publicKey, commitTxData, toAddress, amount) {
|
|
42
|
-
const psbt = new bitcoin.Psbt({ network });
|
|
43
|
-
const { scriptTaproot, tapLeafScript } = commitTxData;
|
|
44
|
-
psbt.addInput({
|
|
45
|
-
hash: Buffer.alloc(32, 0),
|
|
46
|
-
index: 0,
|
|
47
|
-
witnessUtxo: {
|
|
48
|
-
value: amount,
|
|
49
|
-
script: scriptTaproot.output,
|
|
50
|
-
},
|
|
51
|
-
tapLeafScript: tapLeafScript ? [tapLeafScript] : undefined,
|
|
52
|
-
});
|
|
53
|
-
psbt.addOutput({
|
|
54
|
-
value: amount,
|
|
55
|
-
address: toAddress,
|
|
56
|
-
});
|
|
57
|
-
psbt.signInput(0, new signer_1.DummySigner(publicKey));
|
|
58
|
-
psbt.finalizeInput(0, (0, reveal_1.customFinalizer)(commitTxData));
|
|
59
|
-
const tx = psbt.extractTransaction();
|
|
60
|
-
return tx.virtualSize();
|
|
61
|
-
}
|
|
62
|
-
async function inscribeData(signer, toAddress, feeRate, inscription, postage = 10000) {
|
|
63
|
-
const bitcoinNetwork = await signer.getNetwork();
|
|
64
|
-
const publicKey = Buffer.from(await signer.getPublicKey(), 'hex');
|
|
65
|
-
const commitTxData = (0, commit_1.createCommitTxData)(bitcoinNetwork, publicKey, inscription);
|
|
66
|
-
const revealTxSize = estimateTxSize(bitcoinNetwork, publicKey, commitTxData, toAddress, postage);
|
|
67
|
-
const revealFee = revealTxSize * feeRate;
|
|
68
|
-
const commitTxAmount = revealFee + postage;
|
|
69
|
-
const commitAddress = commitTxData.scriptTaproot.address;
|
|
70
|
-
const commitTxId = await signer.sendToAddress(commitAddress, commitTxAmount);
|
|
71
|
-
const commitTx = await signer.getTransaction(commitTxId);
|
|
72
|
-
const scriptPubKey = bitcoin.address.toOutputScript(commitAddress, bitcoinNetwork);
|
|
73
|
-
const commitUtxoIndex = commitTx.outs.findIndex((out) => out.script.equals(scriptPubKey));
|
|
74
|
-
const commitTxResult = {
|
|
75
|
-
tx: commitTx,
|
|
76
|
-
outputIndex: commitUtxoIndex,
|
|
77
|
-
outputAmount: commitTxAmount,
|
|
78
|
-
};
|
|
79
|
-
const revealPsbt = (0, reveal_1.createRevealTx)(bitcoinNetwork, commitTxData, commitTxResult, toAddress, postage);
|
|
80
|
-
const revealTx = await (0, reveal_1.signRevealTx)(signer, commitTxData, revealPsbt);
|
|
81
|
-
return revealTx;
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ordinals/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,oCAqCC;AA3FD,uDAAyC;AAEzC,qCAAqD;AACrD,qCAA4D;AAC5D,qCAAyE;AAQzE,SAAS,cAAc,CACnB,OAAwB,EACxB,SAAiB,EACjB,YAA0B,EAC1B,SAAiB,EACjB,MAAc;IAEd,MAAM,IAAI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IAE3C,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,YAAY,CAAC;IACtD,IAAI,CAAC,QAAQ,CAAC;QACV,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;QACzB,KAAK,EAAE,CAAC;QACR,WAAW,EAAE;YACT,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,aAAa,CAAC,MAAO;SAChC;QACD,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS;KAC7D,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,CAAC;QACX,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,SAAS;KACrB,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,CAAC,CAAC,EA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CAAC,YAAY,CAAC,CAAC,CAAC;IAE1F,MAAM,cAAc,GAAG;QACnB,EAAE,EAAE,QAAQ;QACZ,WAAW,EAAE,eAAe;QAC5B,YAAY,EAAE,cAAc;KAC/B,CAAC;IAEF,MAAM,UAAU,GAAG,IAAA,uBAAc,EAAC,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAEpG,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAY,EAAC,MAAM,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;IAEtE,OAAO,QAAQ,CAAC;AACpB,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as bitcoin from 'bitcoinjs-lib';
|
|
2
|
-
import { RemoteSigner } from './signer';
|
|
3
|
-
import { CommitTxData } from './commit';
|
|
4
|
-
export interface CommitTxResult {
|
|
5
|
-
tx: bitcoin.Transaction;
|
|
6
|
-
outputIndex: number;
|
|
7
|
-
outputAmount: number;
|
|
8
|
-
}
|
|
9
|
-
export declare function createRevealTx(network: bitcoin.Network, commitTxData: CommitTxData, commitTxResult: CommitTxResult, toAddress: string, amount: number): bitcoin.Psbt;
|
|
10
|
-
export declare const customFinalizer: (commitTxData: CommitTxData) => (inputIndex: number, input: any) => {
|
|
11
|
-
finalScriptWitness: Buffer<ArrayBufferLike>;
|
|
12
|
-
};
|
|
13
|
-
export declare function signRevealTx(signer: RemoteSigner, commitTxData: CommitTxData, psbt: bitcoin.Psbt): Promise<bitcoin.Transaction>;
|
package/dist/ordinals/reveal.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.customFinalizer = void 0;
|
|
37
|
-
exports.createRevealTx = createRevealTx;
|
|
38
|
-
exports.signRevealTx = signRevealTx;
|
|
39
|
-
const bitcoin = __importStar(require("bitcoinjs-lib"));
|
|
40
|
-
const psbtUtils = __importStar(require("bitcoinjs-lib/src/psbt/psbtutils"));
|
|
41
|
-
const { witnessStackToScriptWitness } = psbtUtils;
|
|
42
|
-
function createRevealTx(network, commitTxData, commitTxResult, toAddress, amount) {
|
|
43
|
-
const { scriptTaproot, tapLeafScript } = commitTxData;
|
|
44
|
-
const psbt = new bitcoin.Psbt({ network });
|
|
45
|
-
psbt.addInput({
|
|
46
|
-
hash: commitTxResult.tx.getId(),
|
|
47
|
-
index: commitTxResult.outputIndex,
|
|
48
|
-
witnessUtxo: {
|
|
49
|
-
value: commitTxResult.outputAmount,
|
|
50
|
-
script: scriptTaproot.output,
|
|
51
|
-
},
|
|
52
|
-
nonWitnessUtxo: commitTxResult.tx.toBuffer(),
|
|
53
|
-
tapLeafScript: [tapLeafScript],
|
|
54
|
-
});
|
|
55
|
-
psbt.addOutput({
|
|
56
|
-
value: amount,
|
|
57
|
-
address: toAddress,
|
|
58
|
-
});
|
|
59
|
-
return psbt;
|
|
60
|
-
}
|
|
61
|
-
const customFinalizer = (commitTxData) => {
|
|
62
|
-
const { tapLeafScript } = commitTxData;
|
|
63
|
-
return (inputIndex, input) => {
|
|
64
|
-
const witness = [input.tapScriptSig[inputIndex].signature]
|
|
65
|
-
.concat(tapLeafScript.script)
|
|
66
|
-
.concat(tapLeafScript.controlBlock);
|
|
67
|
-
return {
|
|
68
|
-
finalScriptWitness: witnessStackToScriptWitness(witness),
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
exports.customFinalizer = customFinalizer;
|
|
73
|
-
async function signRevealTx(signer, commitTxData, psbt) {
|
|
74
|
-
psbt = await signer.signInput(0, psbt);
|
|
75
|
-
psbt.finalizeInput(0, (0, exports.customFinalizer)(commitTxData));
|
|
76
|
-
return psbt.extractTransaction();
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=reveal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reveal.js","sourceRoot":"","sources":["../../src/ordinals/reveal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,wCA4BC;AAiBD,oCAQC;AAtED,uDAAyC;AACzC,4EAA8D;AAK9D,MAAM,EAAE,2BAA2B,EAAE,GAAG,SAAS,CAAC;AAW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,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAGvC,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAA,uBAAe,EAAC,YAAY,CAAC,CAAC,CAAC;IAErD,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Network, Psbt, Signer, Transaction } from 'bitcoinjs-lib';
|
|
2
|
-
export declare class DummySigner implements Signer {
|
|
3
|
-
publicKey: Buffer;
|
|
4
|
-
constructor(publicKey: Buffer);
|
|
5
|
-
sign(_hash: Buffer, _lowR?: boolean | undefined): Buffer;
|
|
6
|
-
signSchnorr(_hash: Buffer): Buffer;
|
|
7
|
-
}
|
|
8
|
-
export interface RemoteSigner {
|
|
9
|
-
getNetwork(): Promise<Network>;
|
|
10
|
-
getPublicKey(): Promise<string>;
|
|
11
|
-
sendToAddress(toAddress: string, amount: number): Promise<string>;
|
|
12
|
-
getTransaction(txId: string): Promise<Transaction>;
|
|
13
|
-
signInput(inputIndex: number, psbt: Psbt): Promise<Psbt>;
|
|
14
|
-
}
|
package/dist/ordinals/signer.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DummySigner = void 0;
|
|
4
|
-
class DummySigner {
|
|
5
|
-
publicKey;
|
|
6
|
-
constructor(publicKey) {
|
|
7
|
-
this.publicKey = publicKey;
|
|
8
|
-
}
|
|
9
|
-
sign(_hash, _lowR) {
|
|
10
|
-
return Buffer.alloc(64, 0);
|
|
11
|
-
}
|
|
12
|
-
signSchnorr(_hash) {
|
|
13
|
-
return Buffer.alloc(64, 0);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.DummySigner = DummySigner;
|
|
17
|
-
//# sourceMappingURL=signer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signer.js","sourceRoot":"","sources":["../../src/ordinals/signer.ts"],"names":[],"mappings":";;;AAKA,MAAa,WAAW;IACpB,SAAS,CAAS;IAClB,YAAY,SAAiB;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;IAED,IAAI,CAAC,KAAa,EAAE,KAA2B;QAE3C,OAAO,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/B,CAAC;IAED,WAAW,CAAC,KAAa;QAErB,OAAO,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/B,CAAC;CACJ;AAfD,kCAeC"}
|
package/dist/runes.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as bitcoin from 'bitcoinjs-lib';
|
|
2
|
-
import { EsploraClient } from './esplora';
|
|
3
|
-
import { Cenotaph, RunestoneSpec } from '@magiceden-oss/runestone-lib';
|
|
4
|
-
export declare function parseRunestone(tx: bitcoin.Transaction): RunestoneSpec | Cenotaph | null;
|
|
5
|
-
export declare function getTxRunestone(esploraClient: EsploraClient, txid: string): Promise<RunestoneSpec | Cenotaph | null>;
|
package/dist/runes.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.parseRunestone = parseRunestone;
|
|
37
|
-
exports.getTxRunestone = getTxRunestone;
|
|
38
|
-
const bitcoin = __importStar(require("bitcoinjs-lib"));
|
|
39
|
-
const runestone_lib_1 = require("@magiceden-oss/runestone-lib");
|
|
40
|
-
function parseRunestone(tx) {
|
|
41
|
-
const rune = (0, runestone_lib_1.tryDecodeRunestone)({
|
|
42
|
-
vout: tx.outs.map((out) => ({
|
|
43
|
-
scriptPubKey: {
|
|
44
|
-
hex: out.script.toString('hex'),
|
|
45
|
-
},
|
|
46
|
-
})),
|
|
47
|
-
});
|
|
48
|
-
return rune;
|
|
49
|
-
}
|
|
50
|
-
async function getTxRunestone(esploraClient, txid) {
|
|
51
|
-
const txHex = await esploraClient.getTransactionHex(txid);
|
|
52
|
-
const tx = bitcoin.Transaction.fromHex(txHex);
|
|
53
|
-
return parseRunestone(tx);
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=runes.js.map
|
package/dist/runes.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runes.js","sourceRoot":"","sources":["../src/runes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,wCAUC;AAED,wCAIC;AApBD,uDAAyC;AAEzC,gEAA2F;AAE3F,SAAgB,cAAc,CAAC,EAAuB;IAClD,MAAM,IAAI,GAAG,IAAA,kCAAkB,EAAC;QAC5B,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACxB,YAAY,EAAE;gBACV,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;aAClC;SACJ,CAAC,CAAC;KACN,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AAChB,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,aAA4B,EAAE,IAAY;IAC3E,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1D,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,cAAc,CAAC,EAAE,CAAC,CAAC;AAC9B,CAAC"}
|