@sats-connect/core 0.0.2 → 0.0.3-31f526d
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 +89 -5
- package/dist/index.mjs +256 -22
- package/package.json +3 -2
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,21 +655,31 @@ interface BtcRequests {
|
|
|
581
655
|
signPsbt: SignPsbt;
|
|
582
656
|
}
|
|
583
657
|
type BtcRequestMethod = keyof BtcRequests;
|
|
584
|
-
|
|
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
|
-
|
|
673
|
+
private mintRunes;
|
|
674
|
+
private etchRunes;
|
|
675
|
+
request<Method extends keyof Requests>(method: Method, params: Params<Method>): Promise<RpcResult<Method> | undefined>;
|
|
676
|
+
protected abstract requestInternal<Method extends keyof Requests>(method: Method, params: Params<Method>): Promise<RpcResult<Method> | undefined>;
|
|
593
677
|
}
|
|
594
678
|
|
|
595
679
|
declare class BaseAdapter extends SatsConnectAdapter {
|
|
596
680
|
id: string;
|
|
597
681
|
constructor(providerId: string);
|
|
598
|
-
|
|
682
|
+
requestInternal: <Method extends keyof BtcRequests | keyof StxRequests | keyof RunesRequests>(method: Method, params: Params<Method>) => Promise<RpcResult<Method> | undefined>;
|
|
599
683
|
}
|
|
600
684
|
|
|
601
685
|
declare const DefaultAdaptersInfo: Record<string, Provider>;
|
|
@@ -606,4 +690,4 @@ interface Config {
|
|
|
606
690
|
}
|
|
607
691
|
declare function createDefaultConfig(providers: SupportedWallet[]): Config;
|
|
608
692
|
|
|
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 };
|
|
693
|
+
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, 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, createDefaultConfig, 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,258 @@
|
|
|
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__ */ ((RpcErrorCode2) => {
|
|
8
|
+
RpcErrorCode2[RpcErrorCode2["PARSE_ERROR"] = -32700] = "PARSE_ERROR";
|
|
9
|
+
RpcErrorCode2[RpcErrorCode2["INVALID_REQUEST"] = -32600] = "INVALID_REQUEST";
|
|
10
|
+
RpcErrorCode2[RpcErrorCode2["METHOD_NOT_FOUND"] = -32601] = "METHOD_NOT_FOUND";
|
|
11
|
+
RpcErrorCode2[RpcErrorCode2["INVALID_PARAMS"] = -32602] = "INVALID_PARAMS";
|
|
12
|
+
RpcErrorCode2[RpcErrorCode2["INTERNAL_ERROR"] = -32603] = "INTERNAL_ERROR";
|
|
13
|
+
RpcErrorCode2[RpcErrorCode2["USER_REJECTION"] = -32e3] = "USER_REJECTION";
|
|
14
|
+
RpcErrorCode2[RpcErrorCode2["METHOD_NOT_SUPPORTED"] = -32001] = "METHOD_NOT_SUPPORTED";
|
|
15
|
+
return RpcErrorCode2;
|
|
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
|
+
estimateMintCost = async (mintParams) => {
|
|
29
|
+
try {
|
|
30
|
+
const response = await this.client.post("/mint/estimate", {
|
|
31
|
+
...mintParams
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
status: "success",
|
|
35
|
+
result: {
|
|
36
|
+
costBreakdown: response.data.costBreakdown,
|
|
37
|
+
totalCost: response.data.totalCost,
|
|
38
|
+
totalSize: response.data.totalSize
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
} catch (error) {
|
|
42
|
+
return {
|
|
43
|
+
status: "error",
|
|
44
|
+
error: {
|
|
45
|
+
code: -32603 /* INTERNAL_ERROR */,
|
|
46
|
+
message: error.message
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
estimateEtchCost = async (etchParams) => {
|
|
52
|
+
try {
|
|
53
|
+
const response = await this.client.post("/etch/estimate", {
|
|
54
|
+
...etchParams
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
status: "success",
|
|
58
|
+
result: {
|
|
59
|
+
costBreakdown: response.data.costBreakdown,
|
|
60
|
+
totalCost: response.data.totalCost,
|
|
61
|
+
totalSize: response.data.totalSize
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
} catch (error) {
|
|
65
|
+
return {
|
|
66
|
+
status: "error",
|
|
67
|
+
error: {
|
|
68
|
+
code: -32603 /* INTERNAL_ERROR */,
|
|
69
|
+
message: error.data.message
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
createMintOrder = async (mintOrderParams) => {
|
|
75
|
+
try {
|
|
76
|
+
const response = await this.client.post("/mint/orders", {
|
|
77
|
+
...mintOrderParams
|
|
78
|
+
});
|
|
79
|
+
return {
|
|
80
|
+
data: response.data
|
|
81
|
+
};
|
|
82
|
+
} catch (error) {
|
|
83
|
+
return {
|
|
84
|
+
error: error.data.message
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
createEtchOrder = async (etchOrderParams) => {
|
|
89
|
+
try {
|
|
90
|
+
const response = await this.client.post("/etch/orders", {
|
|
91
|
+
...etchOrderParams
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
data: response.data
|
|
95
|
+
};
|
|
96
|
+
} catch (error) {
|
|
97
|
+
return {
|
|
98
|
+
error: error.data.message
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
executeMint = async (orderId, fundTransactionId) => {
|
|
103
|
+
try {
|
|
104
|
+
const response = await this.client.post(`/mint/orders/${orderId}/execute`, {
|
|
105
|
+
fundTransactionId
|
|
106
|
+
});
|
|
107
|
+
return {
|
|
108
|
+
data: response.data
|
|
109
|
+
};
|
|
110
|
+
} catch (error) {
|
|
111
|
+
return {
|
|
112
|
+
error: error.data.message
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
executeEtch = async (orderId, fundTransactionId) => {
|
|
117
|
+
try {
|
|
118
|
+
const response = await this.client.post(`/etch/orders/${orderId}/execute`, {
|
|
119
|
+
fundTransactionId
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
data: response.data
|
|
123
|
+
};
|
|
124
|
+
} catch (error) {
|
|
125
|
+
return {
|
|
126
|
+
error: error.data.message
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
|
|
1
132
|
// src/adapters/satsConnectAdapter.ts
|
|
2
133
|
var SatsConnectAdapter = class {
|
|
134
|
+
async mintRunes(params) {
|
|
135
|
+
try {
|
|
136
|
+
const orderResponse = await new RunesApi(params.network).createMintOrder(params);
|
|
137
|
+
if (orderResponse.data) {
|
|
138
|
+
const paymentResponse = await this.requestInternal("sendTransfer", {
|
|
139
|
+
recipients: [
|
|
140
|
+
{
|
|
141
|
+
address: orderResponse.data.fundAddress,
|
|
142
|
+
amount: orderResponse.data.fundAmount
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
});
|
|
146
|
+
if (paymentResponse?.status === "success") {
|
|
147
|
+
await new RunesApi(params.network).executeMint(
|
|
148
|
+
orderResponse.data.orderId,
|
|
149
|
+
paymentResponse.result.txid
|
|
150
|
+
);
|
|
151
|
+
return {
|
|
152
|
+
status: "success",
|
|
153
|
+
result: {
|
|
154
|
+
orderId: orderResponse.data.orderId,
|
|
155
|
+
fundTransactionId: paymentResponse.result.txid
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
} else {
|
|
159
|
+
return {
|
|
160
|
+
status: "error",
|
|
161
|
+
error: {
|
|
162
|
+
code: -32e3 /* USER_REJECTION */,
|
|
163
|
+
message: "User rejected the payment request"
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
} else {
|
|
168
|
+
return {
|
|
169
|
+
status: "error",
|
|
170
|
+
error: {
|
|
171
|
+
code: -32603 /* INTERNAL_ERROR */,
|
|
172
|
+
message: orderResponse.error
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
} catch (error) {
|
|
177
|
+
return {
|
|
178
|
+
status: "error",
|
|
179
|
+
error: {
|
|
180
|
+
code: -32603 /* INTERNAL_ERROR */,
|
|
181
|
+
message: error.message
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
async etchRunes(params) {
|
|
187
|
+
try {
|
|
188
|
+
const orderResponse = await new RunesApi(params.network).createEtchOrder(params);
|
|
189
|
+
if (orderResponse.data) {
|
|
190
|
+
const paymentResponse = await this.requestInternal("sendTransfer", {
|
|
191
|
+
recipients: [
|
|
192
|
+
{
|
|
193
|
+
address: orderResponse.data.fundAddress,
|
|
194
|
+
amount: orderResponse.data.fundAmount
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
});
|
|
198
|
+
if (paymentResponse?.status === "success") {
|
|
199
|
+
await new RunesApi(params.network).executeEtch(
|
|
200
|
+
orderResponse.data.orderId,
|
|
201
|
+
paymentResponse.result.txid
|
|
202
|
+
);
|
|
203
|
+
return {
|
|
204
|
+
status: "success",
|
|
205
|
+
result: {
|
|
206
|
+
orderId: orderResponse.data.orderId,
|
|
207
|
+
fundTransactionId: paymentResponse.result.txid
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
} else {
|
|
211
|
+
return {
|
|
212
|
+
status: "error",
|
|
213
|
+
error: {
|
|
214
|
+
code: -32e3 /* USER_REJECTION */,
|
|
215
|
+
message: "User rejected the payment request"
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
} else {
|
|
220
|
+
return {
|
|
221
|
+
status: "error",
|
|
222
|
+
error: {
|
|
223
|
+
code: -32603 /* INTERNAL_ERROR */,
|
|
224
|
+
message: orderResponse.error
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
} catch (error) {
|
|
229
|
+
return {
|
|
230
|
+
status: "error",
|
|
231
|
+
error: {
|
|
232
|
+
code: -32603 /* INTERNAL_ERROR */,
|
|
233
|
+
message: error.message
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
async request(method, params) {
|
|
239
|
+
switch (method) {
|
|
240
|
+
case "runes_mint":
|
|
241
|
+
return this.mintRunes(params);
|
|
242
|
+
case "runes_etch":
|
|
243
|
+
return this.etchRunes(params);
|
|
244
|
+
case "runes_estimateMint":
|
|
245
|
+
return new RunesApi(params.network).estimateMintCost(
|
|
246
|
+
params
|
|
247
|
+
);
|
|
248
|
+
case "runes_estimateEtch":
|
|
249
|
+
return new RunesApi(params.network).estimateEtchCost(
|
|
250
|
+
params
|
|
251
|
+
);
|
|
252
|
+
default:
|
|
253
|
+
return this.requestInternal(method, params);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
3
256
|
};
|
|
4
257
|
|
|
5
258
|
// src/provider/index.ts
|
|
@@ -78,32 +331,13 @@ var isRpcSuccessResponse = (response) => {
|
|
|
78
331
|
// src/adapters/xverse.ts
|
|
79
332
|
var XverseAdapter = class extends SatsConnectAdapter {
|
|
80
333
|
id = DefaultAdaptersInfo.xverse.id;
|
|
81
|
-
|
|
334
|
+
requestInternal = async (method, params) => {
|
|
82
335
|
return request(method, params, this.id);
|
|
83
336
|
};
|
|
84
337
|
};
|
|
85
338
|
|
|
86
339
|
// src/adapters/unisat.ts
|
|
87
340
|
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
341
|
import { AddressType as AddressType2, getAddressInfo } from "bitcoin-address-validation";
|
|
108
342
|
|
|
109
343
|
// src/addresses/index.ts
|
|
@@ -240,7 +474,7 @@ var UnisatAdapter = class extends SatsConnectAdapter {
|
|
|
240
474
|
psbt: psbtHex
|
|
241
475
|
};
|
|
242
476
|
}
|
|
243
|
-
|
|
477
|
+
requestInternal = async (method, params) => {
|
|
244
478
|
try {
|
|
245
479
|
switch (method) {
|
|
246
480
|
case "getAccounts": {
|
|
@@ -306,7 +540,7 @@ var BaseAdapter = class extends SatsConnectAdapter {
|
|
|
306
540
|
super();
|
|
307
541
|
this.id = providerId;
|
|
308
542
|
}
|
|
309
|
-
|
|
543
|
+
requestInternal = async (method, params) => {
|
|
310
544
|
return request(method, params, this.id);
|
|
311
545
|
};
|
|
312
546
|
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sats-connect/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3-31f526d",
|
|
4
4
|
"main": "dist/index.mjs",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
|
-
"types": "dist/index.d.
|
|
6
|
+
"types": "dist/index.d.mts",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
@@ -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",
|