@sats-connect/core 0.0.3 → 0.0.4-caef0cb

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 CHANGED
@@ -381,6 +381,80 @@ type GetAccountsParams = {
381
381
  type GetAccountResult = Address$1[];
382
382
  type GetAccounts = MethodParamsAndResult<GetAccountsParams, GetAccountResult>;
383
383
 
384
+ type CreateMintOrderRequest = {
385
+ runeName: string;
386
+ repeats: number;
387
+ refundAddress: string;
388
+ destinationAddress: string;
389
+ feeRate: number;
390
+ appServiceFee?: number;
391
+ appServiceFeeAddress?: string;
392
+ };
393
+ type EstimateMintOrderRequest = Omit<CreateMintOrderRequest, 'refundAddress'>;
394
+ type EstimateOrderResponse = {
395
+ totalSize: number;
396
+ totalCost: number;
397
+ costBreakdown: {
398
+ postage: number;
399
+ networkFee: number;
400
+ serviceFee: number;
401
+ appServiceFee: number;
402
+ };
403
+ };
404
+ type CreateEtchOrderRequest = {
405
+ runeName: string;
406
+ divisibility?: number;
407
+ symbol?: string;
408
+ premine?: string;
409
+ isMintable: boolean;
410
+ terms?: {
411
+ amount?: string;
412
+ cap?: string;
413
+ heightStart?: string;
414
+ heightEnd?: string;
415
+ offsetStart?: string;
416
+ offsetEnd?: string;
417
+ };
418
+ inscriptionDetails?: {
419
+ contentType: string;
420
+ contentBase64: string;
421
+ };
422
+ delegateInscriptionId?: string;
423
+ destinationAddress: string;
424
+ refundAddress: string;
425
+ feeRate: number;
426
+ appServiceFee?: number;
427
+ appServiceFeeAddress?: string;
428
+ };
429
+ type EstimateEtchOrderRequest = Omit<CreateEtchOrderRequest, 'refundAddress'>;
430
+
431
+ interface EstimateRunesMintParams extends EstimateMintOrderRequest {
432
+ network?: BitcoinNetworkType;
433
+ }
434
+ type EstimateRunesMintResult = EstimateOrderResponse;
435
+ type EstimateRunesMint = MethodParamsAndResult<EstimateRunesMintParams, EstimateRunesMintResult>;
436
+ interface MintRunesParams extends CreateMintOrderRequest {
437
+ network?: BitcoinNetworkType;
438
+ }
439
+ type MintRunesResult = {
440
+ orderId: string;
441
+ fundTransactionId: string;
442
+ };
443
+ type MintRunes = MethodParamsAndResult<MintRunesParams, MintRunesResult>;
444
+ interface EstimateRunesEtchParams extends EstimateEtchOrderRequest {
445
+ network?: BitcoinNetworkType;
446
+ }
447
+ type EstimateRunesEtchResult = EstimateOrderResponse;
448
+ type EstimateRunesEtch = MethodParamsAndResult<EstimateRunesEtchParams, EstimateRunesEtchResult>;
449
+ interface EtchRunesParams extends CreateEtchOrderRequest {
450
+ network?: BitcoinNetworkType;
451
+ }
452
+ type EtchRunesResult = {
453
+ orderId: string;
454
+ fundTransactionId: string;
455
+ };
456
+ type EtchRunes = MethodParamsAndResult<EtchRunesParams, EtchRunesResult>;
457
+
384
458
  interface Pubkey {
385
459
  /**
386
460
  * When sending a transfer STX request to a wallet, users can generally
@@ -581,29 +655,36 @@ interface BtcRequests {
581
655
  signPsbt: SignPsbt;
582
656
  }
583
657
  type BtcRequestMethod = keyof BtcRequests;
584
- type Requests = BtcRequests & StxRequests;
658
+ interface RunesRequests {
659
+ runes_estimateMint: EstimateRunesMint;
660
+ runes_mint: MintRunes;
661
+ runes_estimateEtch: EstimateRunesEtch;
662
+ runes_etch: EtchRunes;
663
+ }
664
+ type RunesRequestMethod = keyof RunesRequests;
665
+ type Requests = BtcRequests & StxRequests & RunesRequests;
585
666
  type Return<Method> = Method extends keyof Requests ? Requests[Method]['result'] : never;
586
667
  type Params<Method> = Method extends keyof Requests ? Requests[Method]['params'] : never;
587
668
 
588
- declare const request: <Method extends keyof BtcRequests | keyof StxRequests>(method: Method, params: Params<Method>, providerId?: string) => Promise<RpcResult<Method>>;
669
+ declare const request: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests>(method: Method, params: Params<Method>, providerId?: string) => Promise<RpcResult<Method>>;
589
670
 
590
671
  declare abstract class SatsConnectAdapter {
591
672
  abstract readonly id: string;
592
- abstract request<Method extends keyof Requests>(method: Method, params: Params<Method>): Promise<RpcResult<Method> | undefined>;
673
+ private mintRunes;
674
+ private etchRunes;
675
+ private estimateMint;
676
+ private estimateEtch;
677
+ request<Method extends keyof Requests>(method: Method, params: Params<Method>): Promise<RpcResult<Method> | undefined>;
678
+ protected abstract requestInternal<Method extends keyof Requests>(method: Method, params: Params<Method>): Promise<RpcResult<Method> | undefined>;
593
679
  }
594
680
 
595
681
  declare class BaseAdapter extends SatsConnectAdapter {
596
682
  id: string;
597
683
  constructor(providerId: string);
598
- request: <Method extends keyof BtcRequests | keyof StxRequests>(method: Method, params: Params<Method>) => Promise<RpcResult<Method> | undefined>;
684
+ requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests>(method: Method, params: Params<Method>) => Promise<RpcResult<Method> | undefined>;
599
685
  }
600
686
 
601
687
  declare const DefaultAdaptersInfo: Record<string, Provider>;
602
688
  declare const defaultAdapters: Record<string, new () => SatsConnectAdapter>;
603
689
 
604
- interface Config {
605
- providers: SupportedWallet[];
606
- }
607
- declare function createDefaultConfig(providers: SupportedWallet[]): Config;
608
-
609
- export { type Address$1 as Address, AddressPurpose, AddressType, BaseAdapter, type BitcoinNetwork, BitcoinNetworkType, type BitcoinProvider, type BtcRequestMethod, type BtcRequests, type CallContractParams, type CallContractResult, type Capability, type Config, type CreateInscriptionOptions, type CreateInscriptionPayload, type CreateInscriptionResponse, type CreateRepeatInscriptionsOptions, type CreateRepeatInscriptionsPayload, type CreateRepeatInscriptionsResponse, DefaultAdaptersInfo, type DeployContractParams, type DeployContractResult, type GetAccountResult, type GetAccounts, type GetAccountsParams, type GetAccountsResult, type GetAddressOptions, type GetAddressPayload, type GetAddressResponse, type GetAddresses, type GetAddressesParams, type GetAddressesResult, type GetCapabilitiesOptions, type GetCapabilitiesPayload, type GetCapabilitiesResponse, type GetInfo, type InputToSign, type MethodParamsAndResult, type Params, type Provider, type PsbtPayload, type Recipient$2 as Recipient, type RequestOptions, type RequestPayload, type Requests, type Return, type RpcBase, type RpcError, RpcErrorCode, type RpcErrorResponse, type RpcId, type RpcRequest, type RpcResponse, type RpcResult, type RpcSuccessResponse, SatsConnectAdapter, type SendBtcTransactionOptions, type SendBtcTransactionPayload, type SendBtcTransactionResponse, type SendTransfer, type SendTransferParams, type SerializedRecipient, type SerializedSendBtcTransactionPayload, type SignMessage, type SignMessageOptions, type SignMessageParams, type SignMessagePayload, type SignMessageResponse, type SignMultiplePsbtPayload, type SignMultipleTransactionOptions, type SignMultipleTransactionsPayload, type SignMultipleTransactionsResponse, type SignPsbt, type SignPsbtParams, type SignPsbtResult, type SignStructuredMessageResult, type SignStxMessageParams, type SignStxMessageResult, type SignTransactionOptions, type SignTransactionParams, type SignTransactionPayload, type SignTransactionResponse, type SignTransactionResult, type StxCallContract, type StxDeployContract, type StxGetAccounts, type StxGetAddresses, type StxRequestMethod, type StxRequests, type StxSignStructuredMessage, type StxSignStxMessage, type StxSignTransaction, type StxTransferStx, type SupportedWallet, type TransferStxParams, type TransferStxResult, createDefaultConfig, createInscription, createRepeatInscriptions, defaultAdapters, getAddress, getCapabilities, getDefaultProvider, getProviderById, getProviderOrThrow, getProviders, getSupportedWallets, isProviderInstalled, removeDefaultProvider, request, sendBtcTransaction, setDefaultProvider, signMessage, signMultipleTransactions, signTransaction };
690
+ export { type Address$1 as Address, AddressPurpose, AddressType, BaseAdapter, type BitcoinNetwork, BitcoinNetworkType, type BitcoinProvider, type BtcRequestMethod, type BtcRequests, type CallContractParams, type CallContractResult, type Capability, type CreateInscriptionOptions, type CreateInscriptionPayload, type CreateInscriptionResponse, type CreateRepeatInscriptionsOptions, type CreateRepeatInscriptionsPayload, type CreateRepeatInscriptionsResponse, DefaultAdaptersInfo, type DeployContractParams, type DeployContractResult, type GetAccountResult, type GetAccounts, type GetAccountsParams, type GetAccountsResult, type GetAddressOptions, type GetAddressPayload, type GetAddressResponse, type GetAddresses, type GetAddressesParams, type GetAddressesResult, type GetCapabilitiesOptions, type GetCapabilitiesPayload, type GetCapabilitiesResponse, type GetInfo, type InputToSign, type MethodParamsAndResult, type Params, type Provider, type PsbtPayload, type Recipient$2 as Recipient, type RequestOptions, type RequestPayload, type Requests, type Return, type RpcBase, type RpcError, RpcErrorCode, type RpcErrorResponse, type RpcId, type RpcRequest, type RpcResponse, type RpcResult, type RpcSuccessResponse, type RunesRequestMethod, type RunesRequests, SatsConnectAdapter, type SendBtcTransactionOptions, type SendBtcTransactionPayload, type SendBtcTransactionResponse, type SendTransfer, type SendTransferParams, type SerializedRecipient, type SerializedSendBtcTransactionPayload, type SignMessage, type SignMessageOptions, type SignMessageParams, type SignMessagePayload, type SignMessageResponse, type SignMultiplePsbtPayload, type SignMultipleTransactionOptions, type SignMultipleTransactionsPayload, type SignMultipleTransactionsResponse, type SignPsbt, type SignPsbtParams, type SignPsbtResult, type SignStructuredMessageResult, type SignStxMessageParams, type SignStxMessageResult, type SignTransactionOptions, type SignTransactionParams, type SignTransactionPayload, type SignTransactionResponse, type SignTransactionResult, type StxCallContract, type StxDeployContract, type StxGetAccounts, type StxGetAddresses, type StxRequestMethod, type StxRequests, type StxSignStructuredMessage, type StxSignStxMessage, type StxSignTransaction, type StxTransferStx, type SupportedWallet, type TransferStxParams, type TransferStxResult, createInscription, createRepeatInscriptions, defaultAdapters, getAddress, getCapabilities, getDefaultProvider, getProviderById, getProviderOrThrow, getProviders, getSupportedWallets, isProviderInstalled, removeDefaultProvider, request, sendBtcTransaction, setDefaultProvider, signMessage, signMultipleTransactions, signTransaction };
package/dist/index.mjs CHANGED
@@ -1,5 +1,327 @@
1
+ // src/types.ts
2
+ var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType2) => {
3
+ BitcoinNetworkType2["Mainnet"] = "Mainnet";
4
+ BitcoinNetworkType2["Testnet"] = "Testnet";
5
+ return BitcoinNetworkType2;
6
+ })(BitcoinNetworkType || {});
7
+ var RpcErrorCode = /* @__PURE__ */ ((RpcErrorCode3) => {
8
+ RpcErrorCode3[RpcErrorCode3["PARSE_ERROR"] = -32700] = "PARSE_ERROR";
9
+ RpcErrorCode3[RpcErrorCode3["INVALID_REQUEST"] = -32600] = "INVALID_REQUEST";
10
+ RpcErrorCode3[RpcErrorCode3["METHOD_NOT_FOUND"] = -32601] = "METHOD_NOT_FOUND";
11
+ RpcErrorCode3[RpcErrorCode3["INVALID_PARAMS"] = -32602] = "INVALID_PARAMS";
12
+ RpcErrorCode3[RpcErrorCode3["INTERNAL_ERROR"] = -32603] = "INTERNAL_ERROR";
13
+ RpcErrorCode3[RpcErrorCode3["USER_REJECTION"] = -32e3] = "USER_REJECTION";
14
+ RpcErrorCode3[RpcErrorCode3["METHOD_NOT_SUPPORTED"] = -32001] = "METHOD_NOT_SUPPORTED";
15
+ return RpcErrorCode3;
16
+ })(RpcErrorCode || {});
17
+
18
+ // src/runes/index.ts
19
+ import axios from "axios";
20
+ var RUNES_API_BASE_URL = (network = "Mainnet" /* Mainnet */) => `https://ordinals${network === "Testnet" /* Testnet */ ? "-testnet" : ""}.xverse.app/v1/runes`;
21
+ var RunesApi = class {
22
+ client;
23
+ constructor(network) {
24
+ this.client = axios.create({
25
+ baseURL: `${RUNES_API_BASE_URL(network)}`
26
+ });
27
+ }
28
+ parseError = (error) => {
29
+ return {
30
+ code: error.response?.status,
31
+ message: JSON.stringify(error.response?.data)
32
+ };
33
+ };
34
+ estimateMintCost = async (mintParams) => {
35
+ try {
36
+ const response = await this.client.post("/mint/estimate", {
37
+ ...mintParams
38
+ });
39
+ return {
40
+ data: response.data
41
+ };
42
+ } catch (error) {
43
+ const err = error;
44
+ return {
45
+ error: this.parseError(err)
46
+ };
47
+ }
48
+ };
49
+ estimateEtchCost = async (etchParams) => {
50
+ try {
51
+ const response = await this.client.post("/etch/estimate", {
52
+ ...etchParams
53
+ });
54
+ return {
55
+ data: response.data
56
+ };
57
+ } catch (error) {
58
+ const err = error;
59
+ return {
60
+ error: this.parseError(err)
61
+ };
62
+ }
63
+ };
64
+ createMintOrder = async (mintOrderParams) => {
65
+ try {
66
+ const response = await this.client.post("/mint/orders", {
67
+ ...mintOrderParams
68
+ });
69
+ return {
70
+ data: response.data
71
+ };
72
+ } catch (error) {
73
+ const err = error;
74
+ return {
75
+ error: this.parseError(err)
76
+ };
77
+ }
78
+ };
79
+ createEtchOrder = async (etchOrderParams) => {
80
+ try {
81
+ const response = await this.client.post("/etch/orders", {
82
+ ...etchOrderParams
83
+ });
84
+ return {
85
+ data: response.data
86
+ };
87
+ } catch (error) {
88
+ const err = error;
89
+ return {
90
+ error: this.parseError(err)
91
+ };
92
+ }
93
+ };
94
+ executeMint = async (orderId, fundTransactionId) => {
95
+ try {
96
+ const response = await this.client.post(`/mint/orders/${orderId}/execute`, {
97
+ fundTransactionId
98
+ });
99
+ return {
100
+ data: response.data
101
+ };
102
+ } catch (error) {
103
+ const err = error;
104
+ return {
105
+ error: this.parseError(err)
106
+ };
107
+ }
108
+ };
109
+ executeEtch = async (orderId, fundTransactionId) => {
110
+ try {
111
+ const response = await this.client.post(`/etch/orders/${orderId}/execute`, {
112
+ fundTransactionId
113
+ });
114
+ return {
115
+ data: response.data
116
+ };
117
+ } catch (error) {
118
+ const err = error;
119
+ return {
120
+ error: this.parseError(err)
121
+ };
122
+ }
123
+ };
124
+ };
125
+ var testnetClient = new RunesApi("Testnet" /* Testnet */);
126
+ var mainnetClient = new RunesApi("Mainnet" /* Mainnet */);
127
+ var getRunesApiClient = (network = "Mainnet" /* Mainnet */) => network === "Mainnet" /* Mainnet */ ? mainnetClient : testnetClient;
128
+
1
129
  // src/adapters/satsConnectAdapter.ts
2
130
  var SatsConnectAdapter = class {
131
+ async mintRunes(params) {
132
+ try {
133
+ const mintRequest = {
134
+ destinationAddress: params.destinationAddress,
135
+ feeRate: params.feeRate,
136
+ refundAddress: params.refundAddress,
137
+ repeats: params.repeats,
138
+ runeName: params.runeName,
139
+ appServiceFee: params.appServiceFee,
140
+ appServiceFeeAddress: params.appServiceFeeAddress
141
+ };
142
+ const orderResponse = await new RunesApi(params.network).createMintOrder(mintRequest);
143
+ if (!orderResponse.data) {
144
+ return {
145
+ status: "error",
146
+ error: {
147
+ code: orderResponse.error.code === 400 ? -32600 /* INVALID_REQUEST */ : -32603 /* INTERNAL_ERROR */,
148
+ message: orderResponse.error.message
149
+ }
150
+ };
151
+ }
152
+ const paymentResponse = await this.requestInternal("sendTransfer", {
153
+ recipients: [
154
+ {
155
+ address: orderResponse.data.fundAddress,
156
+ amount: orderResponse.data.fundAmount
157
+ }
158
+ ]
159
+ });
160
+ if (paymentResponse?.status !== "success") {
161
+ return {
162
+ status: "error",
163
+ error: {
164
+ code: -32e3 /* USER_REJECTION */,
165
+ message: "User rejected the payment request"
166
+ }
167
+ };
168
+ }
169
+ await new RunesApi(params.network).executeMint(
170
+ orderResponse.data.orderId,
171
+ paymentResponse.result.txid
172
+ );
173
+ return {
174
+ status: "success",
175
+ result: {
176
+ orderId: orderResponse.data.orderId,
177
+ fundTransactionId: paymentResponse.result.txid
178
+ }
179
+ };
180
+ } catch (error) {
181
+ return {
182
+ status: "error",
183
+ error: {
184
+ code: -32603 /* INTERNAL_ERROR */,
185
+ message: error.message
186
+ }
187
+ };
188
+ }
189
+ }
190
+ async etchRunes(params) {
191
+ const etchRequest = {
192
+ destinationAddress: params.destinationAddress,
193
+ refundAddress: params.refundAddress,
194
+ feeRate: params.feeRate,
195
+ runeName: params.runeName,
196
+ divisibility: params.divisibility,
197
+ symbol: params.symbol,
198
+ premine: params.premine,
199
+ isMintable: params.isMintable,
200
+ terms: params.terms,
201
+ inscriptionDetails: params.inscriptionDetails,
202
+ delegateInscriptionId: params.delegateInscriptionId,
203
+ appServiceFee: params.appServiceFee,
204
+ appServiceFeeAddress: params.appServiceFeeAddress
205
+ };
206
+ try {
207
+ const orderResponse = await new RunesApi(params.network).createEtchOrder(etchRequest);
208
+ if (!orderResponse.data) {
209
+ return {
210
+ status: "error",
211
+ error: {
212
+ code: orderResponse.error.code === 400 ? -32600 /* INVALID_REQUEST */ : -32603 /* INTERNAL_ERROR */,
213
+ message: orderResponse.error.message
214
+ }
215
+ };
216
+ }
217
+ const paymentResponse = await this.requestInternal("sendTransfer", {
218
+ recipients: [
219
+ {
220
+ address: orderResponse.data.fundAddress,
221
+ amount: orderResponse.data.fundAmount
222
+ }
223
+ ]
224
+ });
225
+ if (paymentResponse?.status !== "success") {
226
+ return {
227
+ status: "error",
228
+ error: {
229
+ code: -32e3 /* USER_REJECTION */,
230
+ message: "User rejected the payment request"
231
+ }
232
+ };
233
+ }
234
+ await new RunesApi(params.network).executeEtch(
235
+ orderResponse.data.orderId,
236
+ paymentResponse.result.txid
237
+ );
238
+ return {
239
+ status: "success",
240
+ result: {
241
+ orderId: orderResponse.data.orderId,
242
+ fundTransactionId: paymentResponse.result.txid
243
+ }
244
+ };
245
+ } catch (error) {
246
+ return {
247
+ status: "error",
248
+ error: {
249
+ code: -32603 /* INTERNAL_ERROR */,
250
+ message: error.message
251
+ }
252
+ };
253
+ }
254
+ }
255
+ async estimateMint(params) {
256
+ const estimateMintRequest = {
257
+ destinationAddress: params.destinationAddress,
258
+ feeRate: params.feeRate,
259
+ repeats: params.repeats,
260
+ runeName: params.runeName,
261
+ appServiceFee: params.appServiceFee,
262
+ appServiceFeeAddress: params.appServiceFeeAddress
263
+ };
264
+ const response = await getRunesApiClient(
265
+ params.network
266
+ ).estimateMintCost(estimateMintRequest);
267
+ if (response.data) {
268
+ return {
269
+ status: "success",
270
+ result: response.data
271
+ };
272
+ }
273
+ return {
274
+ status: "error",
275
+ error: {
276
+ code: response.error.code === 400 ? -32600 /* INVALID_REQUEST */ : -32603 /* INTERNAL_ERROR */,
277
+ message: response.error.message
278
+ }
279
+ };
280
+ }
281
+ async estimateEtch(params) {
282
+ const estimateEtchRequest = {
283
+ destinationAddress: params.destinationAddress,
284
+ feeRate: params.feeRate,
285
+ runeName: params.runeName,
286
+ divisibility: params.divisibility,
287
+ symbol: params.symbol,
288
+ premine: params.premine,
289
+ isMintable: params.isMintable,
290
+ terms: params.terms,
291
+ inscriptionDetails: params.inscriptionDetails,
292
+ delegateInscriptionId: params.delegateInscriptionId,
293
+ appServiceFee: params.appServiceFee,
294
+ appServiceFeeAddress: params.appServiceFeeAddress
295
+ };
296
+ const response = await getRunesApiClient(params.network).estimateEtchCost(estimateEtchRequest);
297
+ if (response.data) {
298
+ return {
299
+ status: "success",
300
+ result: response.data
301
+ };
302
+ }
303
+ return {
304
+ status: "error",
305
+ error: {
306
+ code: response.error.code === 400 ? -32600 /* INVALID_REQUEST */ : -32603 /* INTERNAL_ERROR */,
307
+ message: response.error.message
308
+ }
309
+ };
310
+ }
311
+ async request(method, params) {
312
+ switch (method) {
313
+ case "runes_mint":
314
+ return this.mintRunes(params);
315
+ case "runes_etch":
316
+ return this.etchRunes(params);
317
+ case "runes_estimateMint":
318
+ return this.estimateMint(params);
319
+ case "runes_estimateEtch":
320
+ return this.estimateEtch(params);
321
+ default:
322
+ return this.requestInternal(method, params);
323
+ }
324
+ }
3
325
  };
4
326
 
5
327
  // src/provider/index.ts
@@ -78,32 +400,13 @@ var isRpcSuccessResponse = (response) => {
78
400
  // src/adapters/xverse.ts
79
401
  var XverseAdapter = class extends SatsConnectAdapter {
80
402
  id = DefaultAdaptersInfo.xverse.id;
81
- request = async (method, params) => {
403
+ requestInternal = async (method, params) => {
82
404
  return request(method, params, this.id);
83
405
  };
84
406
  };
85
407
 
86
408
  // src/adapters/unisat.ts
87
409
  import { Buffer } from "buffer";
88
-
89
- // src/types.ts
90
- var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType2) => {
91
- BitcoinNetworkType2["Mainnet"] = "Mainnet";
92
- BitcoinNetworkType2["Testnet"] = "Testnet";
93
- return BitcoinNetworkType2;
94
- })(BitcoinNetworkType || {});
95
- var RpcErrorCode = /* @__PURE__ */ ((RpcErrorCode2) => {
96
- RpcErrorCode2[RpcErrorCode2["PARSE_ERROR"] = -32700] = "PARSE_ERROR";
97
- RpcErrorCode2[RpcErrorCode2["INVALID_REQUEST"] = -32600] = "INVALID_REQUEST";
98
- RpcErrorCode2[RpcErrorCode2["METHOD_NOT_FOUND"] = -32601] = "METHOD_NOT_FOUND";
99
- RpcErrorCode2[RpcErrorCode2["INVALID_PARAMS"] = -32602] = "INVALID_PARAMS";
100
- RpcErrorCode2[RpcErrorCode2["INTERNAL_ERROR"] = -32603] = "INTERNAL_ERROR";
101
- RpcErrorCode2[RpcErrorCode2["USER_REJECTION"] = -32e3] = "USER_REJECTION";
102
- RpcErrorCode2[RpcErrorCode2["METHOD_NOT_SUPPORTED"] = -32001] = "METHOD_NOT_SUPPORTED";
103
- return RpcErrorCode2;
104
- })(RpcErrorCode || {});
105
-
106
- // src/adapters/unisat.ts
107
410
  import { AddressType as AddressType2, getAddressInfo } from "bitcoin-address-validation";
108
411
 
109
412
  // src/addresses/index.ts
@@ -240,7 +543,7 @@ var UnisatAdapter = class extends SatsConnectAdapter {
240
543
  psbt: psbtHex
241
544
  };
242
545
  }
243
- request = async (method, params) => {
546
+ requestInternal = async (method, params) => {
244
547
  try {
245
548
  switch (method) {
246
549
  case "getAccounts": {
@@ -306,7 +609,7 @@ var BaseAdapter = class extends SatsConnectAdapter {
306
609
  super();
307
610
  this.id = providerId;
308
611
  }
309
- request = async (method, params) => {
612
+ requestInternal = async (method, params) => {
310
613
  return request(method, params, this.id);
311
614
  };
312
615
  };
@@ -542,30 +845,6 @@ var signMultipleTransactions = async (options) => {
542
845
  options.onCancel?.();
543
846
  }
544
847
  };
545
-
546
- // src/ui/index.ts
547
- function createDefaultConfig(providers) {
548
- const config = { providers: [] };
549
- const xverseProvider = providers.find(
550
- (provider) => provider.id === DefaultAdaptersInfo.xverse.id
551
- );
552
- config.providers.push(
553
- xverseProvider ? xverseProvider : {
554
- ...DefaultAdaptersInfo.xverse,
555
- isInstalled: false
556
- }
557
- );
558
- const unisatProvider = providers.find((provider) => provider.id === "unisat");
559
- if (unisatProvider && unisatProvider.isInstalled) {
560
- config.providers.push(unisatProvider);
561
- }
562
- config.providers.concat(
563
- providers.filter((provider) => {
564
- return provider.id !== DefaultAdaptersInfo.xverse.id && provider.id !== "unisat";
565
- })
566
- );
567
- return config;
568
- }
569
848
  export {
570
849
  AddressPurpose,
571
850
  AddressType,
@@ -574,7 +853,6 @@ export {
574
853
  DefaultAdaptersInfo,
575
854
  RpcErrorCode,
576
855
  SatsConnectAdapter,
577
- createDefaultConfig,
578
856
  createInscription,
579
857
  createRepeatInscriptions,
580
858
  defaultAdapters,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sats-connect/core",
3
- "version": "0.0.3",
3
+ "version": "0.0.4-caef0cb",
4
4
  "main": "dist/index.mjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.mts",
@@ -24,6 +24,7 @@
24
24
  ]
25
25
  },
26
26
  "dependencies": {
27
+ "axios": "1.6.8",
27
28
  "bitcoin-address-validation": "2.2.3",
28
29
  "buffer": "6.0.3",
29
30
  "jsontokens": "4.0.1",