@sats-connect/core 0.4.0-e8e6a66 → 0.4.0-f42fc9a
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 +525 -216
- package/dist/index.d.ts +525 -216
- package/dist/index.js +653 -254
- package/dist/index.mjs +611 -244
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -47,10 +47,7 @@ function removeDefaultProvider() {
|
|
|
47
47
|
localStorage.removeItem("sats-connect_defaultProvider");
|
|
48
48
|
}
|
|
49
49
|
function getSupportedWallets() {
|
|
50
|
-
const
|
|
51
|
-
const { xverse, ...defaultProviders } = DefaultAdaptersInfo;
|
|
52
|
-
const allProviders = [...ambientProviders, ...Object.values(defaultProviders)];
|
|
53
|
-
const wallets = allProviders.map((provider) => {
|
|
50
|
+
const wallets = Object.values(DefaultAdaptersInfo).map((provider) => {
|
|
54
51
|
{
|
|
55
52
|
return {
|
|
56
53
|
...provider,
|
|
@@ -63,11 +60,11 @@ function getSupportedWallets() {
|
|
|
63
60
|
|
|
64
61
|
// src/types.ts
|
|
65
62
|
import * as v2 from "valibot";
|
|
66
|
-
var BitcoinNetworkType = /* @__PURE__ */ ((
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return
|
|
63
|
+
var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType2) => {
|
|
64
|
+
BitcoinNetworkType2["Mainnet"] = "Mainnet";
|
|
65
|
+
BitcoinNetworkType2["Testnet"] = "Testnet";
|
|
66
|
+
BitcoinNetworkType2["Signet"] = "Signet";
|
|
67
|
+
return BitcoinNetworkType2;
|
|
71
68
|
})(BitcoinNetworkType || {});
|
|
72
69
|
var RpcIdSchema = v2.optional(v2.union([v2.string(), v2.number(), v2.null()]));
|
|
73
70
|
var rpcRequestMessageSchema = v2.object({
|
|
@@ -113,16 +110,127 @@ var rpcResponseMessageSchema = v2.union([
|
|
|
113
110
|
]);
|
|
114
111
|
|
|
115
112
|
// src/request/index.ts
|
|
116
|
-
import * as
|
|
113
|
+
import * as v20 from "valibot";
|
|
117
114
|
|
|
118
|
-
// src/request/types/stxMethods.ts
|
|
115
|
+
// src/request/types/stxMethods/callContract.ts
|
|
116
|
+
import * as v3 from "valibot";
|
|
117
|
+
var stxCallContractMethodName = "stx_callContract";
|
|
118
|
+
var stxCallContractParamsSchema = v3.object({
|
|
119
|
+
/**
|
|
120
|
+
* The contract principal.
|
|
121
|
+
*
|
|
122
|
+
* E.g. `"SPKE...GD5C.my-contract"`
|
|
123
|
+
*/
|
|
124
|
+
contract: v3.string(),
|
|
125
|
+
/**
|
|
126
|
+
* The name of the function to call.
|
|
127
|
+
*
|
|
128
|
+
* Note: spec changes ongoing,
|
|
129
|
+
* https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
|
|
130
|
+
*/
|
|
131
|
+
functionName: v3.string(),
|
|
132
|
+
/**
|
|
133
|
+
* The function's arguments. The arguments are expected to be hex-encoded
|
|
134
|
+
* strings of Clarity values.
|
|
135
|
+
*
|
|
136
|
+
* To convert Clarity values to their hex representation, the `cvToString`
|
|
137
|
+
* helper from the `@stacks/transactions` package may be helpful.
|
|
138
|
+
*
|
|
139
|
+
* ```js
|
|
140
|
+
* import { cvToString } from '@stacks/transactions';
|
|
141
|
+
*
|
|
142
|
+
* const functionArgs = [someClarityValue1, someClarityValue2];
|
|
143
|
+
* const hexArgs = functionArgs.map(cvToString);
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
arguments: v3.optional(v3.array(v3.string()))
|
|
147
|
+
});
|
|
148
|
+
var stxCallContractResultSchema = v3.object({
|
|
149
|
+
/**
|
|
150
|
+
* The ID of the transaction.
|
|
151
|
+
*/
|
|
152
|
+
txid: v3.string(),
|
|
153
|
+
/**
|
|
154
|
+
* A Stacks transaction as a hex-encoded string.
|
|
155
|
+
*/
|
|
156
|
+
transaction: v3.string()
|
|
157
|
+
});
|
|
158
|
+
var stxCallContractRequestMessageSchema = v3.object({
|
|
159
|
+
...rpcRequestMessageSchema.entries,
|
|
160
|
+
...v3.object({
|
|
161
|
+
method: v3.literal(stxCallContractMethodName),
|
|
162
|
+
params: stxCallContractParamsSchema,
|
|
163
|
+
id: v3.string()
|
|
164
|
+
}).entries
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// src/request/types/stxMethods/deployContract.ts
|
|
119
168
|
import * as v4 from "valibot";
|
|
169
|
+
var stxDeployContractMethodName = "stx_deployContract";
|
|
170
|
+
var stxDeployContractParamsSchema = v4.object({
|
|
171
|
+
/**
|
|
172
|
+
* Name of the contract.
|
|
173
|
+
*/
|
|
174
|
+
name: v4.string(),
|
|
175
|
+
/**
|
|
176
|
+
* The source code of the Clarity contract.
|
|
177
|
+
*/
|
|
178
|
+
clarityCode: v4.string(),
|
|
179
|
+
/**
|
|
180
|
+
* The version of the Clarity contract.
|
|
181
|
+
*/
|
|
182
|
+
clarityVersion: v4.optional(v4.string())
|
|
183
|
+
});
|
|
184
|
+
var stxDeployContractResultSchema = v4.object({
|
|
185
|
+
/**
|
|
186
|
+
* The ID of the transaction.
|
|
187
|
+
*/
|
|
188
|
+
txid: v4.string(),
|
|
189
|
+
/**
|
|
190
|
+
* A Stacks transaction as a hex-encoded string.
|
|
191
|
+
*/
|
|
192
|
+
transaction: v4.string()
|
|
193
|
+
});
|
|
194
|
+
var stxDeployContractRequestMessageSchema = v4.object({
|
|
195
|
+
...rpcRequestMessageSchema.entries,
|
|
196
|
+
...v4.object({
|
|
197
|
+
method: v4.literal(stxDeployContractMethodName),
|
|
198
|
+
params: stxDeployContractParamsSchema,
|
|
199
|
+
id: v4.string()
|
|
200
|
+
}).entries
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
// src/request/types/stxMethods/getAccounts.ts
|
|
204
|
+
import * as v5 from "valibot";
|
|
205
|
+
var stxGetAccountsMethodName = "stx_getAccounts";
|
|
206
|
+
var stxGetAccountsParamsSchema = v5.nullish(v5.null());
|
|
207
|
+
var stxGetAccountsResultSchema = v5.object({
|
|
208
|
+
/**
|
|
209
|
+
* The addresses generated for the given purposes.
|
|
210
|
+
*/
|
|
211
|
+
addresses: v5.array(
|
|
212
|
+
v5.object({
|
|
213
|
+
address: v5.string(),
|
|
214
|
+
publicKey: v5.string(),
|
|
215
|
+
gaiaHubUrl: v5.string(),
|
|
216
|
+
gaiaAppKey: v5.string()
|
|
217
|
+
})
|
|
218
|
+
)
|
|
219
|
+
});
|
|
220
|
+
var stxGetAccountsRequestMessageSchema = v5.object({
|
|
221
|
+
...rpcRequestMessageSchema.entries,
|
|
222
|
+
...v5.object({
|
|
223
|
+
method: v5.literal(stxGetAccountsMethodName),
|
|
224
|
+
params: stxGetAccountsParamsSchema,
|
|
225
|
+
id: v5.string()
|
|
226
|
+
}).entries
|
|
227
|
+
});
|
|
120
228
|
|
|
121
229
|
// src/addresses/index.ts
|
|
122
230
|
import { createUnsecuredToken } from "jsontokens";
|
|
123
231
|
|
|
124
232
|
// src/addresses/types.ts
|
|
125
|
-
import * as
|
|
233
|
+
import * as v6 from "valibot";
|
|
126
234
|
var AddressPurpose = /* @__PURE__ */ ((AddressPurpose2) => {
|
|
127
235
|
AddressPurpose2["Ordinals"] = "ordinals";
|
|
128
236
|
AddressPurpose2["Payment"] = "payment";
|
|
@@ -138,11 +246,11 @@ var AddressType = /* @__PURE__ */ ((AddressType3) => {
|
|
|
138
246
|
AddressType3["stacks"] = "stacks";
|
|
139
247
|
return AddressType3;
|
|
140
248
|
})(AddressType || {});
|
|
141
|
-
var addressSchema =
|
|
142
|
-
address:
|
|
143
|
-
publicKey:
|
|
144
|
-
purpose:
|
|
145
|
-
addressType:
|
|
249
|
+
var addressSchema = v6.object({
|
|
250
|
+
address: v6.string(),
|
|
251
|
+
publicKey: v6.string(),
|
|
252
|
+
purpose: v6.enum(AddressPurpose),
|
|
253
|
+
addressType: v6.enum(AddressType)
|
|
146
254
|
});
|
|
147
255
|
|
|
148
256
|
// src/addresses/index.ts
|
|
@@ -162,118 +270,269 @@ var getAddress = async (options) => {
|
|
|
162
270
|
}
|
|
163
271
|
};
|
|
164
272
|
|
|
165
|
-
// src/request/types/stxMethods.ts
|
|
273
|
+
// src/request/types/stxMethods/getAddresses.ts
|
|
274
|
+
import * as v7 from "valibot";
|
|
166
275
|
var stxGetAddressesMethodName = "stx_getAddresses";
|
|
167
|
-
var stxGetAddressesParamsSchema =
|
|
168
|
-
|
|
276
|
+
var stxGetAddressesParamsSchema = v7.nullish(
|
|
277
|
+
v7.object({
|
|
169
278
|
/**
|
|
170
279
|
* A message to be displayed to the user in the request prompt.
|
|
171
280
|
*/
|
|
172
|
-
message:
|
|
281
|
+
message: v7.optional(v7.string())
|
|
173
282
|
})
|
|
174
283
|
);
|
|
175
|
-
var stxGetAddressesResultSchema =
|
|
284
|
+
var stxGetAddressesResultSchema = v7.object({
|
|
176
285
|
/**
|
|
177
286
|
* The addresses generated for the given purposes.
|
|
178
287
|
*/
|
|
179
|
-
addresses:
|
|
288
|
+
addresses: v7.array(addressSchema)
|
|
180
289
|
});
|
|
181
|
-
var stxGetAddressesRequestMessageSchema =
|
|
290
|
+
var stxGetAddressesRequestMessageSchema = v7.object({
|
|
182
291
|
...rpcRequestMessageSchema.entries,
|
|
183
|
-
...
|
|
184
|
-
method:
|
|
292
|
+
...v7.object({
|
|
293
|
+
method: v7.literal(stxGetAddressesMethodName),
|
|
185
294
|
params: stxGetAddressesParamsSchema,
|
|
186
|
-
id:
|
|
295
|
+
id: v7.string()
|
|
187
296
|
}).entries
|
|
188
297
|
});
|
|
298
|
+
|
|
299
|
+
// src/request/types/stxMethods/signMessage.ts
|
|
300
|
+
import * as v8 from "valibot";
|
|
301
|
+
var stxSignMessageMethodName = "stx_signMessage";
|
|
302
|
+
var stxSignMessageParamsSchema = v8.object({
|
|
303
|
+
/**
|
|
304
|
+
* The message to sign.
|
|
305
|
+
*/
|
|
306
|
+
message: v8.string(),
|
|
307
|
+
/**
|
|
308
|
+
* The public key to sign the message with.
|
|
309
|
+
*/
|
|
310
|
+
publicKey: v8.string(),
|
|
311
|
+
/**
|
|
312
|
+
* The format version of the parameter.
|
|
313
|
+
*/
|
|
314
|
+
parameterFormatVersion: v8.optional(v8.number())
|
|
315
|
+
});
|
|
316
|
+
var stxSignMessageResultSchema = v8.object({
|
|
317
|
+
/**
|
|
318
|
+
* The signature of the message.
|
|
319
|
+
*/
|
|
320
|
+
signature: v8.string(),
|
|
321
|
+
/**
|
|
322
|
+
* The public key used to sign the message.
|
|
323
|
+
*/
|
|
324
|
+
publicKey: v8.string()
|
|
325
|
+
});
|
|
326
|
+
var stxSignMessageRequestMessageSchema = v8.object({
|
|
327
|
+
...rpcRequestMessageSchema.entries,
|
|
328
|
+
...v8.object({
|
|
329
|
+
method: v8.literal(stxSignMessageMethodName),
|
|
330
|
+
params: stxSignMessageParamsSchema,
|
|
331
|
+
id: v8.string()
|
|
332
|
+
}).entries
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
// src/request/types/stxMethods/signStructuredMessage.ts
|
|
336
|
+
import * as v9 from "valibot";
|
|
337
|
+
var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
|
|
338
|
+
var stxSignStructuredMessageParamsSchema = v9.object({
|
|
339
|
+
/**
|
|
340
|
+
* The domain to be signed.
|
|
341
|
+
*/
|
|
342
|
+
domain: v9.string(),
|
|
343
|
+
/**
|
|
344
|
+
* Message payload to be signed.
|
|
345
|
+
*/
|
|
346
|
+
message: v9.string(),
|
|
347
|
+
/**
|
|
348
|
+
* The format version of the parameter.
|
|
349
|
+
*/
|
|
350
|
+
parameterFormatVersion: v9.optional(v9.number()),
|
|
351
|
+
/**
|
|
352
|
+
* The public key to sign the message with.
|
|
353
|
+
*/
|
|
354
|
+
publicKey: v9.optional(v9.string())
|
|
355
|
+
});
|
|
356
|
+
var stxSignStructuredMessageResultSchema = v9.object({
|
|
357
|
+
/**
|
|
358
|
+
* Signature of the message.
|
|
359
|
+
*/
|
|
360
|
+
signature: v9.string(),
|
|
361
|
+
/**
|
|
362
|
+
* Public key as hex-encoded string.
|
|
363
|
+
*/
|
|
364
|
+
publicKey: v9.string()
|
|
365
|
+
});
|
|
366
|
+
var stxSignStructuredMessageRequestMessageSchema = v9.object({
|
|
367
|
+
...rpcRequestMessageSchema.entries,
|
|
368
|
+
...v9.object({
|
|
369
|
+
method: v9.literal(stxSignStructuredMessageMethodName),
|
|
370
|
+
params: stxSignStructuredMessageParamsSchema,
|
|
371
|
+
id: v9.string()
|
|
372
|
+
}).entries
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
// src/request/types/stxMethods/signTransaction.ts
|
|
376
|
+
import * as v10 from "valibot";
|
|
189
377
|
var stxSignTransactionMethodName = "stx_signTransaction";
|
|
190
|
-
var stxSignTransactionParamsSchema =
|
|
378
|
+
var stxSignTransactionParamsSchema = v10.object({
|
|
191
379
|
/**
|
|
192
380
|
* The transaction to sign as a hex-encoded string.
|
|
193
381
|
*/
|
|
194
|
-
transaction:
|
|
382
|
+
transaction: v10.string(),
|
|
195
383
|
/**
|
|
196
384
|
* The public key to sign the transaction with. The wallet may use any key
|
|
197
385
|
* when not provided.
|
|
198
386
|
*/
|
|
199
|
-
pubkey:
|
|
387
|
+
pubkey: v10.optional(v10.string()),
|
|
200
388
|
/**
|
|
201
389
|
* Whether to broadcast the transaction after signing. Defaults to `true`.
|
|
202
390
|
*/
|
|
203
|
-
broadcast:
|
|
391
|
+
broadcast: v10.optional(v10.boolean())
|
|
204
392
|
});
|
|
205
|
-
var stxSignTransactionResultSchema =
|
|
393
|
+
var stxSignTransactionResultSchema = v10.object({
|
|
206
394
|
/**
|
|
207
395
|
* The signed transaction as a hex-encoded string.
|
|
208
396
|
*/
|
|
209
|
-
transaction:
|
|
397
|
+
transaction: v10.string()
|
|
210
398
|
});
|
|
211
|
-
var stxSignTransactionRequestMessageSchema =
|
|
399
|
+
var stxSignTransactionRequestMessageSchema = v10.object({
|
|
212
400
|
...rpcRequestMessageSchema.entries,
|
|
213
|
-
...
|
|
214
|
-
method:
|
|
401
|
+
...v10.object({
|
|
402
|
+
method: v10.literal(stxSignTransactionMethodName),
|
|
215
403
|
params: stxSignTransactionParamsSchema,
|
|
216
|
-
id:
|
|
404
|
+
id: v10.string()
|
|
405
|
+
}).entries
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
// src/request/types/stxMethods/transferStx.ts
|
|
409
|
+
import * as v11 from "valibot";
|
|
410
|
+
var stxTransferStxMethodName = "stx_transferStx";
|
|
411
|
+
var stxTransferStxParamsSchema = v11.object({
|
|
412
|
+
/**
|
|
413
|
+
* Amount of STX tokens to transfer in microstacks as a string. Anything
|
|
414
|
+
* parseable by `BigInt` is acceptable.
|
|
415
|
+
*
|
|
416
|
+
* Example,
|
|
417
|
+
*
|
|
418
|
+
* ```js
|
|
419
|
+
* const amount1 = 1234;
|
|
420
|
+
* const amount2 = 1234n;
|
|
421
|
+
* const amount3 = '1234';
|
|
422
|
+
* ```
|
|
423
|
+
*/
|
|
424
|
+
amount: v11.union([v11.number(), v11.string()]),
|
|
425
|
+
/**
|
|
426
|
+
* The recipeint's principal.
|
|
427
|
+
*/
|
|
428
|
+
recipient: v11.string(),
|
|
429
|
+
/**
|
|
430
|
+
* A string representing the memo.
|
|
431
|
+
*/
|
|
432
|
+
memo: v11.optional(v11.string()),
|
|
433
|
+
/**
|
|
434
|
+
* Version of parameter format.
|
|
435
|
+
*/
|
|
436
|
+
version: v11.optional(v11.string()),
|
|
437
|
+
/**
|
|
438
|
+
* The mode of the post conditions.
|
|
439
|
+
*/
|
|
440
|
+
postConditionMode: v11.optional(v11.number()),
|
|
441
|
+
/**
|
|
442
|
+
* A hex-encoded string representing the post conditions.
|
|
443
|
+
*
|
|
444
|
+
* A post condition may be converted to it's hex representation using the `serializePostCondition` helper from the `@stacks/transactions` package,
|
|
445
|
+
*
|
|
446
|
+
* ```js
|
|
447
|
+
* import { serializePostCondition } from '@stacks/transactions';
|
|
448
|
+
*
|
|
449
|
+
* const postCondition = somePostCondition;
|
|
450
|
+
* const hexPostCondition = serializePostCondition(postCondition).toString('hex');
|
|
451
|
+
* ```
|
|
452
|
+
*/
|
|
453
|
+
postConditions: v11.optional(v11.array(v11.string())),
|
|
454
|
+
/**
|
|
455
|
+
* The public key to sign the transaction with. The wallet may use any key
|
|
456
|
+
* when not provided.
|
|
457
|
+
*/
|
|
458
|
+
pubkey: v11.optional(v11.string())
|
|
459
|
+
});
|
|
460
|
+
var stxTransferStxResultSchema = v11.object({
|
|
461
|
+
/**
|
|
462
|
+
* The ID of the transaction.
|
|
463
|
+
*/
|
|
464
|
+
txid: v11.string(),
|
|
465
|
+
/**
|
|
466
|
+
* A Stacks transaction as a hex-encoded string.
|
|
467
|
+
*/
|
|
468
|
+
transaction: v11.string()
|
|
469
|
+
});
|
|
470
|
+
var stxTransferStxRequestMessageSchema = v11.object({
|
|
471
|
+
...rpcRequestMessageSchema.entries,
|
|
472
|
+
...v11.object({
|
|
473
|
+
method: v11.literal(stxTransferStxMethodName),
|
|
474
|
+
params: stxTransferStxParamsSchema,
|
|
475
|
+
id: v11.string()
|
|
217
476
|
}).entries
|
|
218
477
|
});
|
|
219
478
|
|
|
220
479
|
// src/request/types/btcMethods.ts
|
|
221
|
-
import * as
|
|
480
|
+
import * as v13 from "valibot";
|
|
222
481
|
|
|
223
482
|
// src/request/types/common.ts
|
|
224
|
-
import * as
|
|
483
|
+
import * as v12 from "valibot";
|
|
225
484
|
var walletTypes = ["software", "ledger"];
|
|
226
|
-
var walletTypeSchema =
|
|
485
|
+
var walletTypeSchema = v12.picklist(walletTypes);
|
|
227
486
|
|
|
228
487
|
// src/request/types/btcMethods.ts
|
|
229
488
|
var getInfoMethodName = "getInfo";
|
|
230
|
-
var getInfoParamsSchema =
|
|
231
|
-
var getInfoResultSchema =
|
|
489
|
+
var getInfoParamsSchema = v13.nullish(v13.null());
|
|
490
|
+
var getInfoResultSchema = v13.object({
|
|
232
491
|
/**
|
|
233
492
|
* Version of the wallet.
|
|
234
493
|
*/
|
|
235
|
-
version:
|
|
494
|
+
version: v13.string(),
|
|
236
495
|
/**
|
|
237
496
|
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
238
497
|
*/
|
|
239
|
-
methods:
|
|
498
|
+
methods: v13.optional(v13.array(v13.string())),
|
|
240
499
|
/**
|
|
241
500
|
* List of WBIP standards supported by the wallet. Not currently used.
|
|
242
501
|
*/
|
|
243
|
-
supports:
|
|
502
|
+
supports: v13.array(v13.string())
|
|
244
503
|
});
|
|
245
|
-
var getInfoRequestMessageSchema =
|
|
504
|
+
var getInfoRequestMessageSchema = v13.object({
|
|
246
505
|
...rpcRequestMessageSchema.entries,
|
|
247
|
-
...
|
|
248
|
-
method:
|
|
506
|
+
...v13.object({
|
|
507
|
+
method: v13.literal(getInfoMethodName),
|
|
249
508
|
params: getInfoParamsSchema,
|
|
250
|
-
id:
|
|
509
|
+
id: v13.string()
|
|
251
510
|
}).entries
|
|
252
511
|
});
|
|
253
512
|
var getAddressesMethodName = "getAddresses";
|
|
254
|
-
var getAddressesParamsSchema =
|
|
513
|
+
var getAddressesParamsSchema = v13.object({
|
|
255
514
|
/**
|
|
256
515
|
* The purposes for which to generate addresses. See
|
|
257
516
|
* {@linkcode AddressPurpose} for available purposes.
|
|
258
517
|
*/
|
|
259
|
-
purposes:
|
|
518
|
+
purposes: v13.array(v13.enum(AddressPurpose)),
|
|
260
519
|
/**
|
|
261
520
|
* A message to be displayed to the user in the request prompt.
|
|
262
521
|
*/
|
|
263
|
-
message:
|
|
522
|
+
message: v13.optional(v13.string())
|
|
264
523
|
});
|
|
265
|
-
var getAddressesResultSchema =
|
|
524
|
+
var getAddressesResultSchema = v13.object({
|
|
266
525
|
/**
|
|
267
526
|
* The addresses generated for the given purposes.
|
|
268
527
|
*/
|
|
269
|
-
addresses:
|
|
528
|
+
addresses: v13.array(addressSchema)
|
|
270
529
|
});
|
|
271
|
-
var getAddressesRequestMessageSchema =
|
|
530
|
+
var getAddressesRequestMessageSchema = v13.object({
|
|
272
531
|
...rpcRequestMessageSchema.entries,
|
|
273
|
-
...
|
|
274
|
-
method:
|
|
532
|
+
...v13.object({
|
|
533
|
+
method: v13.literal(getAddressesMethodName),
|
|
275
534
|
params: getAddressesParamsSchema,
|
|
276
|
-
id:
|
|
535
|
+
id: v13.string()
|
|
277
536
|
}).entries
|
|
278
537
|
});
|
|
279
538
|
var signMessageMethodName = "signMessage";
|
|
@@ -282,363 +541,439 @@ var MessageSigningProtocols = /* @__PURE__ */ ((MessageSigningProtocols2) => {
|
|
|
282
541
|
MessageSigningProtocols2["BIP322"] = "BIP322";
|
|
283
542
|
return MessageSigningProtocols2;
|
|
284
543
|
})(MessageSigningProtocols || {});
|
|
285
|
-
var signMessageParamsSchema =
|
|
544
|
+
var signMessageParamsSchema = v13.object({
|
|
286
545
|
/**
|
|
287
546
|
* The address used for signing.
|
|
288
547
|
**/
|
|
289
|
-
address:
|
|
548
|
+
address: v13.string(),
|
|
290
549
|
/**
|
|
291
550
|
* The message to sign.
|
|
292
551
|
**/
|
|
293
|
-
message:
|
|
552
|
+
message: v13.string(),
|
|
294
553
|
/**
|
|
295
554
|
* The protocol to use for signing the message.
|
|
296
555
|
*/
|
|
297
|
-
protocol:
|
|
556
|
+
protocol: v13.optional(v13.enum(MessageSigningProtocols))
|
|
298
557
|
});
|
|
299
|
-
var signMessageResultSchema =
|
|
558
|
+
var signMessageResultSchema = v13.object({
|
|
300
559
|
/**
|
|
301
560
|
* The signature of the message.
|
|
302
561
|
*/
|
|
303
|
-
signature:
|
|
562
|
+
signature: v13.string(),
|
|
304
563
|
/**
|
|
305
564
|
* hash of the message.
|
|
306
565
|
*/
|
|
307
|
-
messageHash:
|
|
566
|
+
messageHash: v13.string(),
|
|
308
567
|
/**
|
|
309
568
|
* The address used for signing.
|
|
310
569
|
*/
|
|
311
|
-
address:
|
|
570
|
+
address: v13.string(),
|
|
312
571
|
/**
|
|
313
572
|
* The protocol to use for signing the message.
|
|
314
573
|
*/
|
|
315
|
-
protocol:
|
|
574
|
+
protocol: v13.enum(MessageSigningProtocols)
|
|
316
575
|
});
|
|
317
|
-
var signMessageRequestMessageSchema =
|
|
576
|
+
var signMessageRequestMessageSchema = v13.object({
|
|
318
577
|
...rpcRequestMessageSchema.entries,
|
|
319
|
-
...
|
|
320
|
-
method:
|
|
578
|
+
...v13.object({
|
|
579
|
+
method: v13.literal(signMessageMethodName),
|
|
321
580
|
params: signMessageParamsSchema,
|
|
322
|
-
id:
|
|
581
|
+
id: v13.string()
|
|
323
582
|
}).entries
|
|
324
583
|
});
|
|
325
584
|
var sendTransferMethodName = "sendTransfer";
|
|
326
|
-
var sendTransferParamsSchema =
|
|
585
|
+
var sendTransferParamsSchema = v13.object({
|
|
327
586
|
/**
|
|
328
587
|
* Array of recipients to send to.
|
|
329
588
|
* The amount to send to each recipient is in satoshis.
|
|
330
589
|
*/
|
|
331
|
-
recipients:
|
|
332
|
-
|
|
333
|
-
address:
|
|
334
|
-
amount:
|
|
590
|
+
recipients: v13.array(
|
|
591
|
+
v13.object({
|
|
592
|
+
address: v13.string(),
|
|
593
|
+
amount: v13.number()
|
|
335
594
|
})
|
|
336
595
|
)
|
|
337
596
|
});
|
|
338
|
-
var sendTransferResultSchema =
|
|
597
|
+
var sendTransferResultSchema = v13.object({
|
|
339
598
|
/**
|
|
340
599
|
* The transaction id as a hex-encoded string.
|
|
341
600
|
*/
|
|
342
|
-
txid:
|
|
601
|
+
txid: v13.string()
|
|
343
602
|
});
|
|
344
|
-
var sendTransferRequestMessageSchema =
|
|
603
|
+
var sendTransferRequestMessageSchema = v13.object({
|
|
345
604
|
...rpcRequestMessageSchema.entries,
|
|
346
|
-
...
|
|
347
|
-
method:
|
|
605
|
+
...v13.object({
|
|
606
|
+
method: v13.literal(sendTransferMethodName),
|
|
348
607
|
params: sendTransferParamsSchema,
|
|
349
|
-
id:
|
|
608
|
+
id: v13.string()
|
|
350
609
|
}).entries
|
|
351
610
|
});
|
|
352
611
|
var signPsbtMethodName = "signPsbt";
|
|
353
|
-
var signPsbtParamsSchema =
|
|
612
|
+
var signPsbtParamsSchema = v13.object({
|
|
354
613
|
/**
|
|
355
614
|
* The base64 encoded PSBT to sign.
|
|
356
615
|
*/
|
|
357
|
-
psbt:
|
|
616
|
+
psbt: v13.string(),
|
|
358
617
|
/**
|
|
359
618
|
* The inputs to sign.
|
|
360
619
|
* The key is the address and the value is an array of indexes of the inputs to sign.
|
|
361
620
|
*/
|
|
362
|
-
signInputs:
|
|
621
|
+
signInputs: v13.record(v13.string(), v13.array(v13.number())),
|
|
622
|
+
allowedSignHash: v13.optional(v13.number()),
|
|
363
623
|
/**
|
|
364
624
|
* Whether to broadcast the transaction after signing.
|
|
365
625
|
**/
|
|
366
|
-
broadcast:
|
|
626
|
+
broadcast: v13.optional(v13.boolean())
|
|
367
627
|
});
|
|
368
|
-
var signPsbtResultSchema =
|
|
628
|
+
var signPsbtResultSchema = v13.object({
|
|
369
629
|
/**
|
|
370
630
|
* The base64 encoded PSBT after signing.
|
|
371
631
|
*/
|
|
372
|
-
psbt:
|
|
632
|
+
psbt: v13.string(),
|
|
373
633
|
/**
|
|
374
634
|
* The transaction id as a hex-encoded string.
|
|
375
635
|
* This is only returned if the transaction was broadcast.
|
|
376
636
|
**/
|
|
377
|
-
txid:
|
|
637
|
+
txid: v13.optional(v13.string())
|
|
378
638
|
});
|
|
379
|
-
var signPsbtRequestMessageSchema =
|
|
639
|
+
var signPsbtRequestMessageSchema = v13.object({
|
|
380
640
|
...rpcRequestMessageSchema.entries,
|
|
381
|
-
...
|
|
382
|
-
method:
|
|
641
|
+
...v13.object({
|
|
642
|
+
method: v13.literal(signPsbtMethodName),
|
|
383
643
|
params: signPsbtParamsSchema,
|
|
384
|
-
id:
|
|
644
|
+
id: v13.string()
|
|
385
645
|
}).entries
|
|
386
646
|
});
|
|
387
647
|
var getAccountsMethodName = "getAccounts";
|
|
388
|
-
var getAccountsParamsSchema =
|
|
648
|
+
var getAccountsParamsSchema = v13.object({
|
|
389
649
|
/**
|
|
390
650
|
* The purposes for which to generate addresses. See
|
|
391
651
|
* {@linkcode AddressPurpose} for available purposes.
|
|
392
652
|
*/
|
|
393
|
-
purposes:
|
|
653
|
+
purposes: v13.array(v13.enum(AddressPurpose)),
|
|
394
654
|
/**
|
|
395
655
|
* A message to be displayed to the user in the request prompt.
|
|
396
656
|
*/
|
|
397
|
-
message:
|
|
657
|
+
message: v13.optional(v13.string())
|
|
398
658
|
});
|
|
399
|
-
var getAccountsResultSchema =
|
|
400
|
-
|
|
659
|
+
var getAccountsResultSchema = v13.array(
|
|
660
|
+
v13.object({
|
|
401
661
|
...addressSchema.entries,
|
|
402
|
-
...
|
|
662
|
+
...v13.object({
|
|
403
663
|
walletType: walletTypeSchema
|
|
404
664
|
}).entries
|
|
405
665
|
})
|
|
406
666
|
);
|
|
407
|
-
var getAccountsRequestMessageSchema =
|
|
667
|
+
var getAccountsRequestMessageSchema = v13.object({
|
|
408
668
|
...rpcRequestMessageSchema.entries,
|
|
409
|
-
...
|
|
410
|
-
method:
|
|
669
|
+
...v13.object({
|
|
670
|
+
method: v13.literal(getAccountsMethodName),
|
|
411
671
|
params: getAccountsParamsSchema,
|
|
412
|
-
id:
|
|
672
|
+
id: v13.string()
|
|
413
673
|
}).entries
|
|
414
674
|
});
|
|
415
675
|
var getBalanceMethodName = "getBalance";
|
|
416
|
-
var getBalanceParamsSchema =
|
|
417
|
-
var getBalanceResultSchema =
|
|
676
|
+
var getBalanceParamsSchema = v13.nullish(v13.null());
|
|
677
|
+
var getBalanceResultSchema = v13.object({
|
|
418
678
|
/**
|
|
419
679
|
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
420
680
|
* messages not supporting bigint
|
|
421
681
|
* (https://issues.chromium.org/issues/40116184).
|
|
422
682
|
*/
|
|
423
|
-
confirmed:
|
|
683
|
+
confirmed: v13.string(),
|
|
424
684
|
/**
|
|
425
685
|
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
426
686
|
* messages not supporting bigint
|
|
427
687
|
* (https://issues.chromium.org/issues/40116184).
|
|
428
688
|
*/
|
|
429
|
-
unconfirmed:
|
|
689
|
+
unconfirmed: v13.string(),
|
|
430
690
|
/**
|
|
431
691
|
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
432
692
|
* sats. Using a string due to chrome messages not supporting bigint
|
|
433
693
|
* (https://issues.chromium.org/issues/40116184).
|
|
434
694
|
*/
|
|
435
|
-
total:
|
|
695
|
+
total: v13.string()
|
|
436
696
|
});
|
|
437
|
-
var getBalanceRequestMessageSchema =
|
|
697
|
+
var getBalanceRequestMessageSchema = v13.object({
|
|
438
698
|
...rpcRequestMessageSchema.entries,
|
|
439
|
-
...
|
|
440
|
-
method:
|
|
441
|
-
id:
|
|
699
|
+
...v13.object({
|
|
700
|
+
method: v13.literal(getBalanceMethodName),
|
|
701
|
+
id: v13.string()
|
|
442
702
|
}).entries
|
|
443
703
|
});
|
|
444
704
|
|
|
445
705
|
// src/request/types/walletMethods.ts
|
|
446
|
-
import * as
|
|
706
|
+
import * as v14 from "valibot";
|
|
447
707
|
import { permissions } from "@secretkeylabs/xverse-core";
|
|
448
|
-
var permissionTemplate =
|
|
449
|
-
|
|
450
|
-
...
|
|
451
|
-
actions:
|
|
708
|
+
var permissionTemplate = v14.variant("type", [
|
|
709
|
+
v14.object({
|
|
710
|
+
...v14.omit(permissions.resources.account.accountPermissionSchema, ["clientId", "actions"]).entries,
|
|
711
|
+
actions: v14.partial(permissions.resources.account.accountActionsSchema)
|
|
452
712
|
}),
|
|
453
|
-
|
|
454
|
-
...
|
|
455
|
-
actions:
|
|
713
|
+
v14.object({
|
|
714
|
+
...v14.omit(permissions.resources.wallet.walletPermissionSchema, ["clientId"]).entries,
|
|
715
|
+
actions: v14.partial(permissions.resources.wallet.walletActionsSchema)
|
|
456
716
|
})
|
|
457
717
|
]);
|
|
458
718
|
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
459
|
-
var requestPermissionsParamsSchema =
|
|
460
|
-
var requestPermissionsResultSchema =
|
|
461
|
-
var requestPermissionsRequestMessageSchema =
|
|
719
|
+
var requestPermissionsParamsSchema = v14.nullish(v14.array(permissionTemplate));
|
|
720
|
+
var requestPermissionsResultSchema = v14.literal(true);
|
|
721
|
+
var requestPermissionsRequestMessageSchema = v14.object({
|
|
462
722
|
...rpcRequestMessageSchema.entries,
|
|
463
|
-
...
|
|
464
|
-
method:
|
|
723
|
+
...v14.object({
|
|
724
|
+
method: v14.literal(requestPermissionsMethodName),
|
|
465
725
|
params: requestPermissionsParamsSchema,
|
|
466
|
-
id:
|
|
726
|
+
id: v14.string()
|
|
467
727
|
}).entries
|
|
468
728
|
});
|
|
469
729
|
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
470
|
-
var renouncePermissionsParamsSchema =
|
|
471
|
-
var renouncePermissionsResultSchema =
|
|
472
|
-
var renouncePermissionsRequestMessageSchema =
|
|
730
|
+
var renouncePermissionsParamsSchema = v14.nullish(v14.null());
|
|
731
|
+
var renouncePermissionsResultSchema = v14.nullish(v14.null());
|
|
732
|
+
var renouncePermissionsRequestMessageSchema = v14.object({
|
|
473
733
|
...rpcRequestMessageSchema.entries,
|
|
474
|
-
...
|
|
475
|
-
method:
|
|
734
|
+
...v14.object({
|
|
735
|
+
method: v14.literal(renouncePermissionsMethodName),
|
|
476
736
|
params: renouncePermissionsParamsSchema,
|
|
477
|
-
id:
|
|
737
|
+
id: v14.string()
|
|
478
738
|
}).entries
|
|
479
739
|
});
|
|
480
740
|
var disconnectMethodName = "wallet_disconnect";
|
|
481
|
-
var disconnectParamsSchema =
|
|
482
|
-
var disconnectResultSchema =
|
|
483
|
-
var disconnectRequestMessageSchema =
|
|
741
|
+
var disconnectParamsSchema = v14.nullish(v14.null());
|
|
742
|
+
var disconnectResultSchema = v14.nullish(v14.null());
|
|
743
|
+
var disconnectRequestMessageSchema = v14.object({
|
|
484
744
|
...rpcRequestMessageSchema.entries,
|
|
485
|
-
...
|
|
486
|
-
method:
|
|
745
|
+
...v14.object({
|
|
746
|
+
method: v14.literal(disconnectMethodName),
|
|
487
747
|
params: disconnectParamsSchema,
|
|
488
|
-
id:
|
|
748
|
+
id: v14.string()
|
|
489
749
|
}).entries
|
|
490
750
|
});
|
|
491
751
|
var getWalletTypeMethodName = "wallet_getWalletType";
|
|
492
|
-
var getWalletTypeParamsSchema =
|
|
752
|
+
var getWalletTypeParamsSchema = v14.nullish(v14.null());
|
|
493
753
|
var getWalletTypeResultSchema = walletTypeSchema;
|
|
494
|
-
var getWalletTypeRequestMessageSchema =
|
|
754
|
+
var getWalletTypeRequestMessageSchema = v14.object({
|
|
495
755
|
...rpcRequestMessageSchema.entries,
|
|
496
|
-
...
|
|
497
|
-
method:
|
|
756
|
+
...v14.object({
|
|
757
|
+
method: v14.literal(getWalletTypeMethodName),
|
|
498
758
|
params: getWalletTypeParamsSchema,
|
|
499
|
-
id:
|
|
759
|
+
id: v14.string()
|
|
500
760
|
}).entries
|
|
501
761
|
});
|
|
502
762
|
var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
|
|
503
|
-
var getCurrentPermissionsParamsSchema =
|
|
504
|
-
var getCurrentPermissionsResultSchema =
|
|
505
|
-
var getCurrentPermissionsRequestMessageSchema =
|
|
763
|
+
var getCurrentPermissionsParamsSchema = v14.nullish(v14.null());
|
|
764
|
+
var getCurrentPermissionsResultSchema = v14.array(permissions.store.permission);
|
|
765
|
+
var getCurrentPermissionsRequestMessageSchema = v14.object({
|
|
506
766
|
...rpcRequestMessageSchema.entries,
|
|
507
|
-
...
|
|
508
|
-
method:
|
|
767
|
+
...v14.object({
|
|
768
|
+
method: v14.literal(getCurrentPermissionsMethodName),
|
|
509
769
|
params: getCurrentPermissionsParamsSchema,
|
|
510
|
-
id:
|
|
770
|
+
id: v14.string()
|
|
511
771
|
}).entries
|
|
512
772
|
});
|
|
513
773
|
var getAccountMethodName = "wallet_getAccount";
|
|
514
|
-
var getAccountParamsSchema =
|
|
515
|
-
var getAccountResultSchema =
|
|
774
|
+
var getAccountParamsSchema = v14.nullish(v14.null());
|
|
775
|
+
var getAccountResultSchema = v14.object({
|
|
516
776
|
id: permissions.utils.account.accountIdSchema,
|
|
517
|
-
addresses:
|
|
777
|
+
addresses: v14.array(addressSchema),
|
|
518
778
|
walletType: walletTypeSchema
|
|
519
779
|
});
|
|
520
|
-
var getAccountRequestMessageSchema =
|
|
780
|
+
var getAccountRequestMessageSchema = v14.object({
|
|
521
781
|
...rpcRequestMessageSchema.entries,
|
|
522
|
-
...
|
|
523
|
-
method:
|
|
782
|
+
...v14.object({
|
|
783
|
+
method: v14.literal(getAccountMethodName),
|
|
524
784
|
params: getAccountParamsSchema,
|
|
525
|
-
id:
|
|
785
|
+
id: v14.string()
|
|
526
786
|
}).entries
|
|
527
787
|
});
|
|
528
788
|
var connectMethodName = "wallet_connect";
|
|
529
|
-
var connectParamsSchema =
|
|
530
|
-
|
|
531
|
-
permissions:
|
|
789
|
+
var connectParamsSchema = v14.nullish(
|
|
790
|
+
v14.object({
|
|
791
|
+
permissions: v14.optional(v14.array(permissionTemplate))
|
|
532
792
|
})
|
|
533
793
|
);
|
|
534
794
|
var connectResultSchema = getAccountResultSchema;
|
|
535
|
-
var connectRequestMessageSchema =
|
|
795
|
+
var connectRequestMessageSchema = v14.object({
|
|
536
796
|
...rpcRequestMessageSchema.entries,
|
|
537
|
-
...
|
|
538
|
-
method:
|
|
797
|
+
...v14.object({
|
|
798
|
+
method: v14.literal(connectMethodName),
|
|
539
799
|
params: connectParamsSchema,
|
|
540
|
-
id:
|
|
800
|
+
id: v14.string()
|
|
541
801
|
}).entries
|
|
542
802
|
});
|
|
543
803
|
|
|
544
|
-
// src/request/types/runesMethods.ts
|
|
545
|
-
import * as
|
|
546
|
-
var
|
|
547
|
-
var
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
804
|
+
// src/request/types/runesMethods/etch.ts
|
|
805
|
+
import * as v15 from "valibot";
|
|
806
|
+
var runesEtchMethodName = "runes_etch";
|
|
807
|
+
var etchTermsSchema = v15.object({
|
|
808
|
+
amount: v15.string(),
|
|
809
|
+
cap: v15.string(),
|
|
810
|
+
heightStart: v15.optional(v15.string()),
|
|
811
|
+
heightEnd: v15.optional(v15.string()),
|
|
812
|
+
offsetStart: v15.optional(v15.string()),
|
|
813
|
+
offsetEnd: v15.optional(v15.string())
|
|
814
|
+
});
|
|
815
|
+
var inscriptionDetailsSchema = v15.object({
|
|
816
|
+
contentType: v15.string(),
|
|
817
|
+
contentBase64: v15.string()
|
|
818
|
+
});
|
|
819
|
+
var runesEtchParamsSchema = v15.object({
|
|
820
|
+
runeName: v15.string(),
|
|
821
|
+
divisibility: v15.optional(v15.number()),
|
|
822
|
+
symbol: v15.optional(v15.string()),
|
|
823
|
+
premine: v15.optional(v15.string()),
|
|
824
|
+
isMintable: v15.boolean(),
|
|
825
|
+
delegateInscriptionId: v15.optional(v15.string()),
|
|
826
|
+
destinationAddress: v15.string(),
|
|
827
|
+
refundAddress: v15.string(),
|
|
828
|
+
feeRate: v15.number(),
|
|
829
|
+
appServiceFee: v15.optional(v15.number()),
|
|
830
|
+
appServiceFeeAddress: v15.optional(v15.string()),
|
|
831
|
+
terms: v15.optional(etchTermsSchema),
|
|
832
|
+
inscriptionDetails: v15.optional(inscriptionDetailsSchema),
|
|
833
|
+
network: v15.optional(v15.enum(BitcoinNetworkType))
|
|
834
|
+
});
|
|
835
|
+
var runesEtchResultSchema = v15.object({
|
|
836
|
+
orderId: v15.string(),
|
|
837
|
+
fundTransactionId: v15.string(),
|
|
838
|
+
fundingAddress: v15.string()
|
|
839
|
+
});
|
|
840
|
+
var runesEtchRequestMessageSchema = v15.object({
|
|
841
|
+
...rpcRequestMessageSchema.entries,
|
|
842
|
+
...v15.object({
|
|
843
|
+
method: v15.literal(runesEtchMethodName),
|
|
844
|
+
params: runesEtchParamsSchema,
|
|
845
|
+
id: v15.string()
|
|
846
|
+
}).entries
|
|
847
|
+
});
|
|
848
|
+
|
|
849
|
+
// src/request/types/runesMethods/getBalance.ts
|
|
850
|
+
import * as v16 from "valibot";
|
|
851
|
+
var runesGetBalanceMethodName = "runes_getBalance";
|
|
852
|
+
var runesGetBalanceParamsSchema = v16.nullish(v16.null());
|
|
853
|
+
var runesGetBalanceResultSchema = v16.object({
|
|
854
|
+
balances: v16.array(
|
|
855
|
+
v16.object({
|
|
856
|
+
runeName: v16.string(),
|
|
857
|
+
amount: v16.string(),
|
|
858
|
+
divisibility: v16.number(),
|
|
859
|
+
symbol: v16.string(),
|
|
860
|
+
inscriptionId: v16.nullish(v16.string())
|
|
556
861
|
})
|
|
557
862
|
)
|
|
558
863
|
});
|
|
559
|
-
var
|
|
864
|
+
var runesGetBalanceRequestMessageSchema = v16.object({
|
|
560
865
|
...rpcRequestMessageSchema.entries,
|
|
561
|
-
...
|
|
562
|
-
method:
|
|
563
|
-
params:
|
|
564
|
-
id:
|
|
866
|
+
...v16.object({
|
|
867
|
+
method: v16.literal(runesGetBalanceMethodName),
|
|
868
|
+
params: runesGetBalanceParamsSchema,
|
|
869
|
+
id: v16.string()
|
|
870
|
+
}).entries
|
|
871
|
+
});
|
|
872
|
+
|
|
873
|
+
// src/request/types/runesMethods/mint.ts
|
|
874
|
+
import * as v17 from "valibot";
|
|
875
|
+
var runesMintMethodName = "runes_mint";
|
|
876
|
+
var runesMintParamsSchema = v17.object({
|
|
877
|
+
appServiceFee: v17.optional(v17.number()),
|
|
878
|
+
appServiceFeeAddress: v17.optional(v17.string()),
|
|
879
|
+
destinationAddress: v17.string(),
|
|
880
|
+
feeRate: v17.number(),
|
|
881
|
+
refundAddress: v17.string(),
|
|
882
|
+
repeats: v17.number(),
|
|
883
|
+
runeName: v17.string(),
|
|
884
|
+
network: v17.optional(v17.enum(BitcoinNetworkType))
|
|
885
|
+
});
|
|
886
|
+
var runesMintResultSchema = v17.object({
|
|
887
|
+
orderId: v17.string(),
|
|
888
|
+
fundTransactionId: v17.string(),
|
|
889
|
+
fundingAddress: v17.string()
|
|
890
|
+
});
|
|
891
|
+
var runesMintRequestMessageSchema = v17.object({
|
|
892
|
+
...rpcRequestMessageSchema.entries,
|
|
893
|
+
...v17.object({
|
|
894
|
+
method: v17.literal(runesMintMethodName),
|
|
895
|
+
params: runesMintParamsSchema,
|
|
896
|
+
id: v17.string()
|
|
565
897
|
}).entries
|
|
566
898
|
});
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
899
|
+
|
|
900
|
+
// src/request/types/runesMethods/transfer.ts
|
|
901
|
+
import * as v18 from "valibot";
|
|
902
|
+
var runesTransferMethodName = "runes_transfer";
|
|
903
|
+
var runesTransferParamsSchema = v18.object({
|
|
904
|
+
recipients: v18.array(
|
|
905
|
+
v18.object({
|
|
906
|
+
runeName: v18.string(),
|
|
907
|
+
amount: v18.string(),
|
|
908
|
+
address: v18.string()
|
|
574
909
|
})
|
|
575
910
|
)
|
|
576
911
|
});
|
|
577
|
-
var
|
|
912
|
+
var runesTransferResultSchema = v18.object({
|
|
913
|
+
txid: v18.string()
|
|
914
|
+
});
|
|
915
|
+
var runesTransferRequestMessageSchema = v18.object({
|
|
578
916
|
...rpcRequestMessageSchema.entries,
|
|
579
|
-
...
|
|
580
|
-
method:
|
|
581
|
-
params:
|
|
582
|
-
id:
|
|
917
|
+
...v18.object({
|
|
918
|
+
method: v18.literal(runesTransferMethodName),
|
|
919
|
+
params: runesTransferParamsSchema,
|
|
920
|
+
id: v18.string()
|
|
583
921
|
}).entries
|
|
584
922
|
});
|
|
585
|
-
var TransferRunesResultSchema = v8.object({
|
|
586
|
-
txid: v8.string()
|
|
587
|
-
});
|
|
588
923
|
|
|
589
924
|
// src/request/types/ordinalsMethods.ts
|
|
590
|
-
import * as
|
|
925
|
+
import * as v19 from "valibot";
|
|
591
926
|
var getInscriptionsMethodName = "ord_getInscriptions";
|
|
592
|
-
var getInscriptionsParamsSchema =
|
|
593
|
-
offset:
|
|
594
|
-
limit:
|
|
595
|
-
});
|
|
596
|
-
var getInscriptionsResultSchema =
|
|
597
|
-
total:
|
|
598
|
-
limit:
|
|
599
|
-
offset:
|
|
600
|
-
inscriptions:
|
|
601
|
-
|
|
602
|
-
inscriptionId:
|
|
603
|
-
inscriptionNumber:
|
|
604
|
-
address:
|
|
605
|
-
collectionName:
|
|
606
|
-
postage:
|
|
607
|
-
contentLength:
|
|
608
|
-
contentType:
|
|
609
|
-
timestamp:
|
|
610
|
-
offset:
|
|
611
|
-
genesisTransaction:
|
|
612
|
-
output:
|
|
927
|
+
var getInscriptionsParamsSchema = v19.object({
|
|
928
|
+
offset: v19.number(),
|
|
929
|
+
limit: v19.number()
|
|
930
|
+
});
|
|
931
|
+
var getInscriptionsResultSchema = v19.object({
|
|
932
|
+
total: v19.number(),
|
|
933
|
+
limit: v19.number(),
|
|
934
|
+
offset: v19.number(),
|
|
935
|
+
inscriptions: v19.array(
|
|
936
|
+
v19.object({
|
|
937
|
+
inscriptionId: v19.string(),
|
|
938
|
+
inscriptionNumber: v19.string(),
|
|
939
|
+
address: v19.string(),
|
|
940
|
+
collectionName: v19.optional(v19.string()),
|
|
941
|
+
postage: v19.string(),
|
|
942
|
+
contentLength: v19.string(),
|
|
943
|
+
contentType: v19.string(),
|
|
944
|
+
timestamp: v19.number(),
|
|
945
|
+
offset: v19.number(),
|
|
946
|
+
genesisTransaction: v19.string(),
|
|
947
|
+
output: v19.string()
|
|
613
948
|
})
|
|
614
949
|
)
|
|
615
950
|
});
|
|
616
|
-
var
|
|
951
|
+
var getInscriptionsRequestMessageSchema = v19.object({
|
|
617
952
|
...rpcRequestMessageSchema.entries,
|
|
618
|
-
...
|
|
619
|
-
method:
|
|
953
|
+
...v19.object({
|
|
954
|
+
method: v19.literal(getInscriptionsMethodName),
|
|
620
955
|
params: getInscriptionsParamsSchema,
|
|
621
|
-
id:
|
|
956
|
+
id: v19.string()
|
|
622
957
|
}).entries
|
|
623
958
|
});
|
|
624
959
|
var sendInscriptionsMethodName = "ord_sendInscriptions";
|
|
625
|
-
var sendInscriptionsParamsSchema =
|
|
626
|
-
transfers:
|
|
627
|
-
|
|
628
|
-
address:
|
|
629
|
-
inscriptionId:
|
|
960
|
+
var sendInscriptionsParamsSchema = v19.object({
|
|
961
|
+
transfers: v19.array(
|
|
962
|
+
v19.object({
|
|
963
|
+
address: v19.string(),
|
|
964
|
+
inscriptionId: v19.string()
|
|
630
965
|
})
|
|
631
966
|
)
|
|
632
967
|
});
|
|
633
|
-
var sendInscriptionsResultSchema =
|
|
634
|
-
txid:
|
|
968
|
+
var sendInscriptionsResultSchema = v19.object({
|
|
969
|
+
txid: v19.string()
|
|
635
970
|
});
|
|
636
|
-
var
|
|
971
|
+
var sendInscriptionsRequestMessageSchema = v19.object({
|
|
637
972
|
...rpcRequestMessageSchema.entries,
|
|
638
|
-
...
|
|
639
|
-
method:
|
|
973
|
+
...v19.object({
|
|
974
|
+
method: v19.literal(sendInscriptionsMethodName),
|
|
640
975
|
params: sendInscriptionsParamsSchema,
|
|
641
|
-
id:
|
|
976
|
+
id: v19.string()
|
|
642
977
|
}).entries
|
|
643
978
|
});
|
|
644
979
|
|
|
@@ -655,13 +990,13 @@ var request = async (method, params, providerId) => {
|
|
|
655
990
|
throw new Error("A wallet method is required");
|
|
656
991
|
}
|
|
657
992
|
const response = await provider.request(method, params);
|
|
658
|
-
if (
|
|
993
|
+
if (v20.is(rpcErrorResponseMessageSchema, response)) {
|
|
659
994
|
return {
|
|
660
995
|
status: "error",
|
|
661
996
|
error: response.error
|
|
662
997
|
};
|
|
663
998
|
}
|
|
664
|
-
if (
|
|
999
|
+
if (v20.is(rpcSuccessResponseMessageSchema, response)) {
|
|
665
1000
|
return {
|
|
666
1001
|
status: "success",
|
|
667
1002
|
result: response.result
|
|
@@ -1612,7 +1947,6 @@ export {
|
|
|
1612
1947
|
RpcErrorCode,
|
|
1613
1948
|
RpcIdSchema,
|
|
1614
1949
|
SatsConnectAdapter,
|
|
1615
|
-
TransferRunesResultSchema,
|
|
1616
1950
|
accountChangeEventName,
|
|
1617
1951
|
accountChangeSchema,
|
|
1618
1952
|
addListener,
|
|
@@ -1659,15 +1993,11 @@ export {
|
|
|
1659
1993
|
getInfoResultSchema,
|
|
1660
1994
|
getInscriptionsMethodName,
|
|
1661
1995
|
getInscriptionsParamsSchema,
|
|
1996
|
+
getInscriptionsRequestMessageSchema,
|
|
1662
1997
|
getInscriptionsResultSchema,
|
|
1663
|
-
getInscriptionsSchema,
|
|
1664
1998
|
getProviderById,
|
|
1665
1999
|
getProviderOrThrow,
|
|
1666
2000
|
getProviders,
|
|
1667
|
-
getRunesBalanceMethodName,
|
|
1668
|
-
getRunesBalanceParamsSchema,
|
|
1669
|
-
getRunesBalanceRequestMessageSchema,
|
|
1670
|
-
getRunesBalanceResultSchema,
|
|
1671
2001
|
getSupportedWallets,
|
|
1672
2002
|
getWalletTypeMethodName,
|
|
1673
2003
|
getWalletTypeParamsSchema,
|
|
@@ -1691,11 +2021,27 @@ export {
|
|
|
1691
2021
|
rpcRequestMessageSchema,
|
|
1692
2022
|
rpcResponseMessageSchema,
|
|
1693
2023
|
rpcSuccessResponseMessageSchema,
|
|
2024
|
+
runesEtchMethodName,
|
|
2025
|
+
runesEtchParamsSchema,
|
|
2026
|
+
runesEtchRequestMessageSchema,
|
|
2027
|
+
runesEtchResultSchema,
|
|
2028
|
+
runesGetBalanceMethodName,
|
|
2029
|
+
runesGetBalanceParamsSchema,
|
|
2030
|
+
runesGetBalanceRequestMessageSchema,
|
|
2031
|
+
runesGetBalanceResultSchema,
|
|
2032
|
+
runesMintMethodName,
|
|
2033
|
+
runesMintParamsSchema,
|
|
2034
|
+
runesMintRequestMessageSchema,
|
|
2035
|
+
runesMintResultSchema,
|
|
2036
|
+
runesTransferMethodName,
|
|
2037
|
+
runesTransferParamsSchema,
|
|
2038
|
+
runesTransferRequestMessageSchema,
|
|
2039
|
+
runesTransferResultSchema,
|
|
1694
2040
|
sendBtcTransaction,
|
|
1695
2041
|
sendInscriptionsMethodName,
|
|
1696
2042
|
sendInscriptionsParamsSchema,
|
|
2043
|
+
sendInscriptionsRequestMessageSchema,
|
|
1697
2044
|
sendInscriptionsResultSchema,
|
|
1698
|
-
sendInscriptionsSchema,
|
|
1699
2045
|
sendTransferMethodName,
|
|
1700
2046
|
sendTransferParamsSchema,
|
|
1701
2047
|
sendTransferRequestMessageSchema,
|
|
@@ -1712,17 +2058,38 @@ export {
|
|
|
1712
2058
|
signPsbtRequestMessageSchema,
|
|
1713
2059
|
signPsbtResultSchema,
|
|
1714
2060
|
signTransaction,
|
|
2061
|
+
stxCallContractMethodName,
|
|
2062
|
+
stxCallContractParamsSchema,
|
|
2063
|
+
stxCallContractRequestMessageSchema,
|
|
2064
|
+
stxCallContractResultSchema,
|
|
2065
|
+
stxDeployContractMethodName,
|
|
2066
|
+
stxDeployContractParamsSchema,
|
|
2067
|
+
stxDeployContractRequestMessageSchema,
|
|
2068
|
+
stxDeployContractResultSchema,
|
|
2069
|
+
stxGetAccountsMethodName,
|
|
2070
|
+
stxGetAccountsParamsSchema,
|
|
2071
|
+
stxGetAccountsRequestMessageSchema,
|
|
2072
|
+
stxGetAccountsResultSchema,
|
|
1715
2073
|
stxGetAddressesMethodName,
|
|
1716
2074
|
stxGetAddressesParamsSchema,
|
|
1717
2075
|
stxGetAddressesRequestMessageSchema,
|
|
1718
2076
|
stxGetAddressesResultSchema,
|
|
2077
|
+
stxSignMessageMethodName,
|
|
2078
|
+
stxSignMessageParamsSchema,
|
|
2079
|
+
stxSignMessageRequestMessageSchema,
|
|
2080
|
+
stxSignMessageResultSchema,
|
|
2081
|
+
stxSignStructuredMessageMethodName,
|
|
2082
|
+
stxSignStructuredMessageParamsSchema,
|
|
2083
|
+
stxSignStructuredMessageRequestMessageSchema,
|
|
2084
|
+
stxSignStructuredMessageResultSchema,
|
|
1719
2085
|
stxSignTransactionMethodName,
|
|
1720
2086
|
stxSignTransactionParamsSchema,
|
|
1721
2087
|
stxSignTransactionRequestMessageSchema,
|
|
1722
2088
|
stxSignTransactionResultSchema,
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
2089
|
+
stxTransferStxMethodName,
|
|
2090
|
+
stxTransferStxParamsSchema,
|
|
2091
|
+
stxTransferStxRequestMessageSchema,
|
|
2092
|
+
stxTransferStxResultSchema,
|
|
1726
2093
|
walletEventSchema,
|
|
1727
2094
|
walletTypeSchema,
|
|
1728
2095
|
walletTypes
|