@sats-connect/core 0.0.8 → 0.0.9-00db390
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 +13 -1
- package/dist/index.mjs +21 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -114,7 +114,7 @@ interface Provider {
|
|
|
114
114
|
mozillaAddOnsUrl?: string;
|
|
115
115
|
googlePlayStoreUrl?: string;
|
|
116
116
|
iOSAppStoreUrl?: string;
|
|
117
|
-
methods?: (StxRequestMethod | BtcRequestMethod)[];
|
|
117
|
+
methods?: (StxRequestMethod | BtcRequestMethod | RunesRequestMethod)[];
|
|
118
118
|
}
|
|
119
119
|
interface SupportedWallet extends Provider {
|
|
120
120
|
isInstalled: boolean;
|
|
@@ -492,6 +492,17 @@ interface RbfOrderResult {
|
|
|
492
492
|
fundingAddress: string;
|
|
493
493
|
}
|
|
494
494
|
type RbfOrder = MethodParamsAndResult<RbfOrderParams, RbfOrderResult>;
|
|
495
|
+
type GetRunesBalanceParams = null;
|
|
496
|
+
interface GetRunesBalanceResult {
|
|
497
|
+
balances: {
|
|
498
|
+
runeName: string;
|
|
499
|
+
amount: string;
|
|
500
|
+
divisibility: number;
|
|
501
|
+
symbol: string;
|
|
502
|
+
inscriptionId: string | null;
|
|
503
|
+
}[];
|
|
504
|
+
}
|
|
505
|
+
type GetRunesBalance = MethodParamsAndResult<GetRunesBalanceParams, GetRunesBalanceResult>;
|
|
495
506
|
|
|
496
507
|
interface Pubkey {
|
|
497
508
|
/**
|
|
@@ -701,6 +712,7 @@ interface RunesRequests {
|
|
|
701
712
|
runes_getOrder: GetOrder;
|
|
702
713
|
runes_estimateRbfOrder: EstimateRbfOrder;
|
|
703
714
|
runes_rbfOrder: RbfOrder;
|
|
715
|
+
runes_getBalance: GetRunesBalance;
|
|
704
716
|
}
|
|
705
717
|
type RunesRequestMethod = keyof RunesRequests;
|
|
706
718
|
type Requests = BtcRequests & StxRequests & RunesRequests;
|
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ var RpcErrorCode = /* @__PURE__ */ ((RpcErrorCode2) => {
|
|
|
15
15
|
return RpcErrorCode2;
|
|
16
16
|
})(RpcErrorCode || {});
|
|
17
17
|
|
|
18
|
-
// src/runes/
|
|
18
|
+
// src/runes/api.ts
|
|
19
19
|
import axios from "axios";
|
|
20
20
|
var ORDINALS_API_BASE_URL = (network = "Mainnet" /* Mainnet */) => `https://ordinals${network === "Testnet" /* Testnet */ ? "-testnet" : ""}.xverse.app/v1`;
|
|
21
21
|
var RunesApi = class {
|
|
@@ -159,6 +159,16 @@ var getRunesApiClient = (network = "Mainnet" /* Mainnet */) => network === "Main
|
|
|
159
159
|
var SatsConnectAdapter = class {
|
|
160
160
|
async mintRunes(params) {
|
|
161
161
|
try {
|
|
162
|
+
const walletInfo = await this.requestInternal("getInfo", null).catch(() => null);
|
|
163
|
+
if (walletInfo && walletInfo.status === "success") {
|
|
164
|
+
const isMintSupported = walletInfo.result.methods?.includes("runes_mint");
|
|
165
|
+
if (isMintSupported) {
|
|
166
|
+
const response = await this.requestInternal("runes_mint", params);
|
|
167
|
+
if (response) {
|
|
168
|
+
return response;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
162
172
|
const mintRequest = {
|
|
163
173
|
destinationAddress: params.destinationAddress,
|
|
164
174
|
feeRate: params.feeRate,
|
|
@@ -234,6 +244,16 @@ var SatsConnectAdapter = class {
|
|
|
234
244
|
appServiceFeeAddress: params.appServiceFeeAddress
|
|
235
245
|
};
|
|
236
246
|
try {
|
|
247
|
+
const walletInfo = await this.requestInternal("getInfo", null).catch(() => null);
|
|
248
|
+
if (walletInfo && walletInfo.status === "success") {
|
|
249
|
+
const isEtchSupported = walletInfo.result.methods?.includes("runes_etch");
|
|
250
|
+
if (isEtchSupported) {
|
|
251
|
+
const response = await this.requestInternal("runes_etch", params);
|
|
252
|
+
if (response) {
|
|
253
|
+
return response;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
237
257
|
const orderResponse = await new RunesApi(params.network).createEtchOrder(etchRequest);
|
|
238
258
|
if (!orderResponse.data) {
|
|
239
259
|
return {
|