@sats-connect/core 0.0.10 → 0.0.11-760c033
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/dist/index.d.mts +2 -1
- package/dist/index.mjs +34 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -141,7 +141,8 @@ declare function getSupportedWallets(): SupportedWallet[];
|
|
|
141
141
|
|
|
142
142
|
declare enum BitcoinNetworkType {
|
|
143
143
|
Mainnet = "Mainnet",
|
|
144
|
-
Testnet = "Testnet"
|
|
144
|
+
Testnet = "Testnet",
|
|
145
|
+
Signet = "Signet"
|
|
145
146
|
}
|
|
146
147
|
interface BitcoinNetwork {
|
|
147
148
|
type: BitcoinNetworkType;
|
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType2) => {
|
|
3
3
|
BitcoinNetworkType2["Mainnet"] = "Mainnet";
|
|
4
4
|
BitcoinNetworkType2["Testnet"] = "Testnet";
|
|
5
|
+
BitcoinNetworkType2["Signet"] = "Signet";
|
|
5
6
|
return BitcoinNetworkType2;
|
|
6
7
|
})(BitcoinNetworkType || {});
|
|
7
8
|
var RpcErrorCode = /* @__PURE__ */ ((RpcErrorCode2) => {
|
|
@@ -17,7 +18,12 @@ var RpcErrorCode = /* @__PURE__ */ ((RpcErrorCode2) => {
|
|
|
17
18
|
|
|
18
19
|
// src/runes/api.ts
|
|
19
20
|
import axios from "axios";
|
|
20
|
-
var
|
|
21
|
+
var urlNetworkSuffix = {
|
|
22
|
+
["Mainnet" /* Mainnet */]: "",
|
|
23
|
+
["Testnet" /* Testnet */]: "-testnet",
|
|
24
|
+
["Signet" /* Signet */]: "-signet"
|
|
25
|
+
};
|
|
26
|
+
var ORDINALS_API_BASE_URL = (network = "Mainnet" /* Mainnet */) => `https://ordinals${urlNetworkSuffix[network]}.xverse.app/v1`;
|
|
21
27
|
var RunesApi = class {
|
|
22
28
|
client;
|
|
23
29
|
constructor(network) {
|
|
@@ -151,14 +157,28 @@ var RunesApi = class {
|
|
|
151
157
|
}
|
|
152
158
|
};
|
|
153
159
|
};
|
|
154
|
-
var
|
|
155
|
-
var
|
|
156
|
-
|
|
160
|
+
var clients = {};
|
|
161
|
+
var getRunesApiClient = (network = "Mainnet" /* Mainnet */) => {
|
|
162
|
+
if (!clients[network]) {
|
|
163
|
+
clients[network] = new RunesApi(network);
|
|
164
|
+
}
|
|
165
|
+
return clients[network];
|
|
166
|
+
};
|
|
157
167
|
|
|
158
168
|
// src/adapters/satsConnectAdapter.ts
|
|
159
169
|
var SatsConnectAdapter = class {
|
|
160
170
|
async mintRunes(params) {
|
|
161
171
|
try {
|
|
172
|
+
const walletInfo = await this.requestInternal("getInfo", null).catch(() => null);
|
|
173
|
+
if (walletInfo && walletInfo.status === "success") {
|
|
174
|
+
const isMintSupported = walletInfo.result.methods?.includes("runes_mint");
|
|
175
|
+
if (isMintSupported) {
|
|
176
|
+
const response = await this.requestInternal("runes_mint", params);
|
|
177
|
+
if (response) {
|
|
178
|
+
return response;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
162
182
|
const mintRequest = {
|
|
163
183
|
destinationAddress: params.destinationAddress,
|
|
164
184
|
feeRate: params.feeRate,
|
|
@@ -228,6 +248,16 @@ var SatsConnectAdapter = class {
|
|
|
228
248
|
appServiceFeeAddress: params.appServiceFeeAddress
|
|
229
249
|
};
|
|
230
250
|
try {
|
|
251
|
+
const walletInfo = await this.requestInternal("getInfo", null).catch(() => null);
|
|
252
|
+
if (walletInfo && walletInfo.status === "success") {
|
|
253
|
+
const isEtchSupported = walletInfo.result.methods?.includes("runes_etch");
|
|
254
|
+
if (isEtchSupported) {
|
|
255
|
+
const response = await this.requestInternal("runes_etch", params);
|
|
256
|
+
if (response) {
|
|
257
|
+
return response;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
231
261
|
const orderResponse = await new RunesApi(params.network).createEtchOrder(etchRequest);
|
|
232
262
|
if (!orderResponse.data) {
|
|
233
263
|
return {
|