@sats-connect/core 0.8.1-91ac91b → 0.8.1-a6a42ae

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.js CHANGED
@@ -35,7 +35,6 @@ __export(index_exports, {
35
35
  BaseAdapter: () => BaseAdapter,
36
36
  BitcoinNetworkType: () => BitcoinNetworkType,
37
37
  DefaultAdaptersInfo: () => DefaultAdaptersInfo,
38
- FlashnetIntentType: () => FlashnetIntentType,
39
38
  MessageSigningProtocols: () => MessageSigningProtocols,
40
39
  PermissionRequestParams: () => PermissionRequestParams,
41
40
  RpcErrorCode: () => RpcErrorCode,
@@ -173,16 +172,6 @@ __export(index_exports, {
173
172
  signPsbtRequestMessageSchema: () => signPsbtRequestMessageSchema,
174
173
  signPsbtResultSchema: () => signPsbtResultSchema,
175
174
  signTransaction: () => signTransaction,
176
- sparkFlashnetGetJwtMethodName: () => sparkFlashnetGetJwtMethodName,
177
- sparkFlashnetGetJwtParamsSchema: () => sparkFlashnetGetJwtParamsSchema,
178
- sparkFlashnetGetJwtRequestMessageSchema: () => sparkFlashnetGetJwtRequestMessageSchema,
179
- sparkFlashnetGetJwtResultSchema: () => sparkFlashnetGetJwtResultSchema,
180
- sparkFlashnetRouteSwapIntentSchema: () => sparkFlashnetRouteSwapIntentSchema,
181
- sparkFlashnetSignIntentMethodName: () => sparkFlashnetSignIntentMethodName,
182
- sparkFlashnetSignIntentParamsSchema: () => sparkFlashnetSignIntentParamsSchema,
183
- sparkFlashnetSignIntentRequestMessageSchema: () => sparkFlashnetSignIntentRequestMessageSchema,
184
- sparkFlashnetSignIntentResultSchema: () => sparkFlashnetSignIntentResultSchema,
185
- sparkFlashnetSwapIntentSchema: () => sparkFlashnetSwapIntentSchema,
186
175
  sparkGetAddressesMethodName: () => sparkGetAddressesMethodName,
187
176
  sparkGetAddressesParamsSchema: () => sparkGetAddressesParamsSchema,
188
177
  sparkGetAddressesRequestMessageSchema: () => sparkGetAddressesRequestMessageSchema,
@@ -243,6 +232,9 @@ __export(index_exports, {
243
232
  });
244
233
  module.exports = __toCommonJS(index_exports);
245
234
 
235
+ // src/request/index.ts
236
+ var v25 = __toESM(require("valibot"));
237
+
246
238
  // src/provider/types.ts
247
239
  var v4 = __toESM(require("valibot"));
248
240
 
@@ -436,8 +428,45 @@ function getSupportedWallets() {
436
428
  return wallets;
437
429
  }
438
430
 
439
- // src/request/index.ts
440
- var v29 = __toESM(require("valibot"));
431
+ // src/request/sanitizeRequest.ts
432
+ var sanitizeRequest = (method, params, providerVersion) => {
433
+ if (providerVersion < 1) {
434
+ const v1Sanitized = sanitizeV1Request(method, params);
435
+ method = v1Sanitized.method;
436
+ params = v1Sanitized.params;
437
+ }
438
+ return { method, params };
439
+ };
440
+ var sanitizeV1Request = (method, params) => {
441
+ const filterPurposes = (purposes) => purposes?.filter(
442
+ (purpose) => purpose !== "spark" /* Spark */ && purpose !== "starknet" /* Starknet */
443
+ );
444
+ if (method === "wallet_connect") {
445
+ const typedParams = params;
446
+ if (!typedParams) {
447
+ return { method, params };
448
+ }
449
+ const { addresses, ...rest } = typedParams;
450
+ const overrideParams = {
451
+ ...rest,
452
+ addresses: filterPurposes(addresses)
453
+ };
454
+ return { method, params: overrideParams };
455
+ }
456
+ if (method === "getAccounts") {
457
+ const typedParams = params;
458
+ const { purposes, ...rest } = typedParams;
459
+ const overrideParams = { ...rest, purposes: filterPurposes(purposes) };
460
+ return { method, params: overrideParams };
461
+ }
462
+ if (method === "getAddresses") {
463
+ const typedParams = params;
464
+ const { purposes, ...rest } = typedParams;
465
+ const overrideParams = { ...rest, purposes: filterPurposes(purposes) };
466
+ return { method, params: overrideParams };
467
+ }
468
+ return { method, params };
469
+ };
441
470
 
442
471
  // src/request/types/btcMethods.ts
443
472
  var v6 = __toESM(require("valibot"));
@@ -1050,10 +1079,10 @@ var runesTransferRequestMessageSchema = v11.object({
1050
1079
  }).entries
1051
1080
  });
1052
1081
 
1053
- // src/request/types/sparkMethods/flashnetMethods/getJwt.ts
1082
+ // src/request/types/sparkMethods/getAddresses.ts
1054
1083
  var v12 = __toESM(require("valibot"));
1055
- var sparkFlashnetGetJwtMethodName = "spark_flashnet_getJwt";
1056
- var sparkFlashnetGetJwtParamsSchema = v12.nullish(
1084
+ var sparkGetAddressesMethodName = "spark_getAddresses";
1085
+ var sparkGetAddressesParamsSchema = v12.nullish(
1057
1086
  v12.object({
1058
1087
  /**
1059
1088
  * A message to be displayed to the user in the request prompt.
@@ -1061,227 +1090,135 @@ var sparkFlashnetGetJwtParamsSchema = v12.nullish(
1061
1090
  message: v12.optional(v12.string())
1062
1091
  })
1063
1092
  );
1064
- var sparkFlashnetGetJwtResultSchema = v12.object({
1065
- /**
1066
- * The JWT token for authenticated requests to the Flashnet API.
1067
- */
1068
- jwt: v12.string()
1069
- });
1070
- var sparkFlashnetGetJwtRequestMessageSchema = v12.object({
1071
- ...rpcRequestMessageSchema.entries,
1072
- ...v12.object({
1073
- method: v12.literal(sparkFlashnetGetJwtMethodName),
1074
- params: sparkFlashnetGetJwtParamsSchema,
1075
- id: v12.string()
1076
- }).entries
1077
- });
1078
-
1079
- // src/request/types/sparkMethods/flashnetMethods/intents/common.ts
1080
- var FlashnetIntentType = /* @__PURE__ */ ((FlashnetIntentType2) => {
1081
- FlashnetIntentType2["Swap"] = "swap";
1082
- FlashnetIntentType2["RouteSwap"] = "route-swap";
1083
- return FlashnetIntentType2;
1084
- })(FlashnetIntentType || {});
1085
-
1086
- // src/request/types/sparkMethods/flashnetMethods/intents/routeSwap.ts
1087
- var v13 = __toESM(require("valibot"));
1088
- var sparkFlashnetRouteSwapIntentSchema = v13.object({
1089
- intentType: v13.literal("route-swap" /* RouteSwap */),
1090
- userPublicKey: v13.string(),
1091
- initialSparkTransferId: v13.string(),
1092
- hops: v13.array(
1093
- v13.object({
1094
- poolId: v13.string(),
1095
- assetInAddress: v13.string(),
1096
- assetOutAddress: v13.string(),
1097
- hopIntegratorFeeRateBps: v13.optional(v13.number())
1098
- })
1099
- ),
1100
- inputAmount: v13.string(),
1101
- maxRouteSlippageBps: v13.number(),
1102
- minAmountOut: v13.string(),
1103
- defaultIntegratorFeeRateBps: v13.optional(v13.number()),
1104
- nonce: v13.string()
1105
- });
1106
-
1107
- // src/request/types/sparkMethods/flashnetMethods/intents/swap.ts
1108
- var v14 = __toESM(require("valibot"));
1109
- var sparkFlashnetSwapIntentSchema = v14.object({
1110
- intentType: v14.literal("swap" /* Swap */),
1111
- userPublicKey: v14.string(),
1112
- poolId: v14.string(),
1113
- transferId: v14.string(),
1114
- assetInAddress: v14.string(),
1115
- assetOutAddress: v14.string(),
1116
- amountIn: v14.string(),
1117
- maxSlippageBps: v14.number(),
1118
- minAmountOut: v14.string(),
1119
- totalIntegratorFeeRateBps: v14.optional(v14.number()),
1120
- nonce: v14.string()
1121
- });
1122
-
1123
- // src/request/types/sparkMethods/flashnetMethods/signIntent.ts
1124
- var v15 = __toESM(require("valibot"));
1125
- var sparkFlashnetSignIntentMethodName = "spark_flashnet_signIntent";
1126
- var sparkFlashnetSignIntentParamsSchema = v15.union([
1127
- sparkFlashnetSwapIntentSchema,
1128
- sparkFlashnetRouteSwapIntentSchema
1129
- ]);
1130
- var sparkFlashnetSignIntentResultSchema = v15.object({
1131
- /**
1132
- * The signed intent as a hex string.
1133
- */
1134
- signature: v15.string()
1135
- });
1136
- var sparkFlashnetSignIntentRequestMessageSchema = v15.object({
1137
- ...rpcRequestMessageSchema.entries,
1138
- ...v15.object({
1139
- method: v15.literal(sparkFlashnetSignIntentMethodName),
1140
- params: sparkFlashnetSignIntentParamsSchema,
1141
- id: v15.string()
1142
- }).entries
1143
- });
1144
-
1145
- // src/request/types/sparkMethods/getAddresses.ts
1146
- var v16 = __toESM(require("valibot"));
1147
- var sparkGetAddressesMethodName = "spark_getAddresses";
1148
- var sparkGetAddressesParamsSchema = v16.nullish(
1149
- v16.object({
1150
- /**
1151
- * A message to be displayed to the user in the request prompt.
1152
- */
1153
- message: v16.optional(v16.string())
1154
- })
1155
- );
1156
- var sparkGetAddressesResultSchema = v16.object({
1093
+ var sparkGetAddressesResultSchema = v12.object({
1157
1094
  /**
1158
1095
  * The addresses generated for the given purposes.
1159
1096
  */
1160
- addresses: v16.array(addressSchema),
1097
+ addresses: v12.array(addressSchema),
1161
1098
  network: getNetworkResultSchema
1162
1099
  });
1163
- var sparkGetAddressesRequestMessageSchema = v16.object({
1100
+ var sparkGetAddressesRequestMessageSchema = v12.object({
1164
1101
  ...rpcRequestMessageSchema.entries,
1165
- ...v16.object({
1166
- method: v16.literal(sparkGetAddressesMethodName),
1102
+ ...v12.object({
1103
+ method: v12.literal(sparkGetAddressesMethodName),
1167
1104
  params: sparkGetAddressesParamsSchema,
1168
- id: v16.string()
1105
+ id: v12.string()
1169
1106
  }).entries
1170
1107
  });
1171
1108
 
1172
1109
  // src/request/types/sparkMethods/getBalance.ts
1173
- var v17 = __toESM(require("valibot"));
1110
+ var v13 = __toESM(require("valibot"));
1174
1111
  var sparkGetBalanceMethodName = "spark_getBalance";
1175
- var sparkGetBalanceParamsSchema = v17.nullish(v17.null());
1176
- var sparkGetBalanceResultSchema = v17.object({
1112
+ var sparkGetBalanceParamsSchema = v13.nullish(v13.null());
1113
+ var sparkGetBalanceResultSchema = v13.object({
1177
1114
  /**
1178
1115
  * The Spark Bitcoin address balance in sats in string form.
1179
1116
  */
1180
- balance: v17.string(),
1181
- tokenBalances: v17.array(
1182
- v17.object({
1117
+ balance: v13.string(),
1118
+ tokenBalances: v13.array(
1119
+ v13.object({
1183
1120
  /* The address balance of the token in string form as it can overflow a js number */
1184
- balance: v17.string(),
1185
- tokenMetadata: v17.object({
1186
- tokenIdentifier: v17.string(),
1187
- tokenName: v17.string(),
1188
- tokenTicker: v17.string(),
1189
- decimals: v17.number(),
1190
- maxSupply: v17.string()
1121
+ balance: v13.string(),
1122
+ tokenMetadata: v13.object({
1123
+ tokenIdentifier: v13.string(),
1124
+ tokenName: v13.string(),
1125
+ tokenTicker: v13.string(),
1126
+ decimals: v13.number(),
1127
+ maxSupply: v13.string()
1191
1128
  })
1192
1129
  })
1193
1130
  )
1194
1131
  });
1195
- var sparkGetBalanceRequestMessageSchema = v17.object({
1132
+ var sparkGetBalanceRequestMessageSchema = v13.object({
1196
1133
  ...rpcRequestMessageSchema.entries,
1197
- ...v17.object({
1198
- method: v17.literal(sparkGetBalanceMethodName),
1134
+ ...v13.object({
1135
+ method: v13.literal(sparkGetBalanceMethodName),
1199
1136
  params: sparkGetBalanceParamsSchema,
1200
- id: v17.string()
1137
+ id: v13.string()
1201
1138
  }).entries
1202
1139
  });
1203
1140
 
1204
1141
  // src/request/types/sparkMethods/transfer.ts
1205
- var v18 = __toESM(require("valibot"));
1142
+ var v14 = __toESM(require("valibot"));
1206
1143
  var sparkTransferMethodName = "spark_transfer";
1207
- var sparkTransferParamsSchema = v18.object({
1144
+ var sparkTransferParamsSchema = v14.object({
1208
1145
  /**
1209
1146
  * Amount of SATS to transfer as a string or number.
1210
1147
  */
1211
- amountSats: v18.union([v18.number(), v18.string()]),
1148
+ amountSats: v14.union([v14.number(), v14.string()]),
1212
1149
  /**
1213
1150
  * The recipient's spark address.
1214
1151
  */
1215
- receiverSparkAddress: v18.string()
1152
+ receiverSparkAddress: v14.string()
1216
1153
  });
1217
- var sparkTransferResultSchema = v18.object({
1154
+ var sparkTransferResultSchema = v14.object({
1218
1155
  /**
1219
1156
  * The ID of the transaction.
1220
1157
  */
1221
- id: v18.string()
1158
+ id: v14.string()
1222
1159
  });
1223
- var sparkTransferRequestMessageSchema = v18.object({
1160
+ var sparkTransferRequestMessageSchema = v14.object({
1224
1161
  ...rpcRequestMessageSchema.entries,
1225
- ...v18.object({
1226
- method: v18.literal(sparkTransferMethodName),
1162
+ ...v14.object({
1163
+ method: v14.literal(sparkTransferMethodName),
1227
1164
  params: sparkTransferParamsSchema,
1228
- id: v18.string()
1165
+ id: v14.string()
1229
1166
  }).entries
1230
1167
  });
1231
1168
 
1232
1169
  // src/request/types/sparkMethods/transferToken.ts
1233
- var v19 = __toESM(require("valibot"));
1170
+ var v15 = __toESM(require("valibot"));
1234
1171
  var sparkTransferTokenMethodName = "spark_transferToken";
1235
- var sparkTransferTokenParamsSchema = v19.object({
1172
+ var sparkTransferTokenParamsSchema = v15.object({
1236
1173
  /**
1237
1174
  * Amount of units of the token to transfer as a string or number.
1238
1175
  */
1239
- tokenAmount: v19.union([v19.number(), v19.string()]),
1176
+ tokenAmount: v15.union([v15.number(), v15.string()]),
1240
1177
  /**
1241
1178
  * The Bech32m token identifier.
1242
1179
  */
1243
- tokenIdentifier: v19.string(),
1180
+ tokenIdentifier: v15.string(),
1244
1181
  /**
1245
1182
  * The recipient's spark address.
1246
1183
  */
1247
- receiverSparkAddress: v19.string()
1184
+ receiverSparkAddress: v15.string()
1248
1185
  });
1249
- var sparkTransferTokenResultSchema = v19.object({
1186
+ var sparkTransferTokenResultSchema = v15.object({
1250
1187
  /**
1251
1188
  * The ID of the transaction.
1252
1189
  */
1253
- id: v19.string()
1190
+ id: v15.string()
1254
1191
  });
1255
- var sparkTransferTokenRequestMessageSchema = v19.object({
1192
+ var sparkTransferTokenRequestMessageSchema = v15.object({
1256
1193
  ...rpcRequestMessageSchema.entries,
1257
- ...v19.object({
1258
- method: v19.literal(sparkTransferTokenMethodName),
1194
+ ...v15.object({
1195
+ method: v15.literal(sparkTransferTokenMethodName),
1259
1196
  params: sparkTransferTokenParamsSchema,
1260
- id: v19.string()
1197
+ id: v15.string()
1261
1198
  }).entries
1262
1199
  });
1263
1200
 
1264
1201
  // src/request/types/stxMethods/callContract.ts
1265
- var v20 = __toESM(require("valibot"));
1202
+ var v16 = __toESM(require("valibot"));
1266
1203
  var stxCallContractMethodName = "stx_callContract";
1267
- var stxCallContractParamsSchema = v20.object({
1204
+ var stxCallContractParamsSchema = v16.object({
1268
1205
  /**
1269
1206
  * The contract principal.
1270
1207
  *
1271
1208
  * E.g. `"SPKE...GD5C.my-contract"`
1272
1209
  */
1273
- contract: v20.string(),
1210
+ contract: v16.string(),
1274
1211
  /**
1275
1212
  * The name of the function to call.
1276
1213
  *
1277
1214
  * Note: spec changes ongoing,
1278
1215
  * https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
1279
1216
  */
1280
- functionName: v20.string(),
1217
+ functionName: v16.string(),
1281
1218
  /**
1282
1219
  * @deprecated in favor of `functionArgs` for @stacks/connect compatibility
1283
1220
  */
1284
- arguments: v20.optional(v20.array(v20.string())),
1221
+ arguments: v16.optional(v16.array(v16.string())),
1285
1222
  /**
1286
1223
  * The function's arguments. The arguments are expected to be hex-encoded
1287
1224
  * strings of Clarity values.
@@ -1296,274 +1233,274 @@ var stxCallContractParamsSchema = v20.object({
1296
1233
  * const hexArgs = functionArgs.map(cvToHex);
1297
1234
  * ```
1298
1235
  */
1299
- functionArgs: v20.optional(v20.array(v20.string())),
1236
+ functionArgs: v16.optional(v16.array(v16.string())),
1300
1237
  /**
1301
1238
  * The post conditions to apply to the contract call.
1302
1239
  */
1303
- postConditions: v20.optional(v20.array(v20.string())),
1240
+ postConditions: v16.optional(v16.array(v16.string())),
1304
1241
  /**
1305
1242
  * The mode to apply to the post conditions.
1306
1243
  */
1307
- postConditionMode: v20.optional(v20.union([v20.literal("allow"), v20.literal("deny")]))
1244
+ postConditionMode: v16.optional(v16.union([v16.literal("allow"), v16.literal("deny")]))
1308
1245
  });
1309
- var stxCallContractResultSchema = v20.object({
1246
+ var stxCallContractResultSchema = v16.object({
1310
1247
  /**
1311
1248
  * The ID of the transaction.
1312
1249
  */
1313
- txid: v20.string(),
1250
+ txid: v16.string(),
1314
1251
  /**
1315
1252
  * A Stacks transaction as a hex-encoded string.
1316
1253
  */
1317
- transaction: v20.string()
1254
+ transaction: v16.string()
1318
1255
  });
1319
- var stxCallContractRequestMessageSchema = v20.object({
1256
+ var stxCallContractRequestMessageSchema = v16.object({
1320
1257
  ...rpcRequestMessageSchema.entries,
1321
- ...v20.object({
1322
- method: v20.literal(stxCallContractMethodName),
1258
+ ...v16.object({
1259
+ method: v16.literal(stxCallContractMethodName),
1323
1260
  params: stxCallContractParamsSchema,
1324
- id: v20.string()
1261
+ id: v16.string()
1325
1262
  }).entries
1326
1263
  });
1327
1264
 
1328
1265
  // src/request/types/stxMethods/deployContract.ts
1329
- var v21 = __toESM(require("valibot"));
1266
+ var v17 = __toESM(require("valibot"));
1330
1267
  var stxDeployContractMethodName = "stx_deployContract";
1331
- var stxDeployContractParamsSchema = v21.object({
1268
+ var stxDeployContractParamsSchema = v17.object({
1332
1269
  /**
1333
1270
  * Name of the contract.
1334
1271
  */
1335
- name: v21.string(),
1272
+ name: v17.string(),
1336
1273
  /**
1337
1274
  * The source code of the Clarity contract.
1338
1275
  */
1339
- clarityCode: v21.string(),
1276
+ clarityCode: v17.string(),
1340
1277
  /**
1341
1278
  * The version of the Clarity contract.
1342
1279
  */
1343
- clarityVersion: v21.optional(v21.number()),
1280
+ clarityVersion: v17.optional(v17.number()),
1344
1281
  /**
1345
1282
  * The post conditions to apply to the contract call.
1346
1283
  */
1347
- postConditions: v21.optional(v21.array(v21.string())),
1284
+ postConditions: v17.optional(v17.array(v17.string())),
1348
1285
  /**
1349
1286
  * The mode to apply to the post conditions.
1350
1287
  */
1351
- postConditionMode: v21.optional(v21.union([v21.literal("allow"), v21.literal("deny")]))
1288
+ postConditionMode: v17.optional(v17.union([v17.literal("allow"), v17.literal("deny")]))
1352
1289
  });
1353
- var stxDeployContractResultSchema = v21.object({
1290
+ var stxDeployContractResultSchema = v17.object({
1354
1291
  /**
1355
1292
  * The ID of the transaction.
1356
1293
  */
1357
- txid: v21.string(),
1294
+ txid: v17.string(),
1358
1295
  /**
1359
1296
  * A Stacks transaction as a hex-encoded string.
1360
1297
  */
1361
- transaction: v21.string()
1298
+ transaction: v17.string()
1362
1299
  });
1363
- var stxDeployContractRequestMessageSchema = v21.object({
1300
+ var stxDeployContractRequestMessageSchema = v17.object({
1364
1301
  ...rpcRequestMessageSchema.entries,
1365
- ...v21.object({
1366
- method: v21.literal(stxDeployContractMethodName),
1302
+ ...v17.object({
1303
+ method: v17.literal(stxDeployContractMethodName),
1367
1304
  params: stxDeployContractParamsSchema,
1368
- id: v21.string()
1305
+ id: v17.string()
1369
1306
  }).entries
1370
1307
  });
1371
1308
 
1372
1309
  // src/request/types/stxMethods/getAccounts.ts
1373
- var v22 = __toESM(require("valibot"));
1310
+ var v18 = __toESM(require("valibot"));
1374
1311
  var stxGetAccountsMethodName = "stx_getAccounts";
1375
- var stxGetAccountsParamsSchema = v22.nullish(v22.null());
1376
- var stxGetAccountsResultSchema = v22.object({
1312
+ var stxGetAccountsParamsSchema = v18.nullish(v18.null());
1313
+ var stxGetAccountsResultSchema = v18.object({
1377
1314
  /**
1378
1315
  * The addresses generated for the given purposes.
1379
1316
  */
1380
- addresses: v22.array(
1381
- v22.object({
1382
- address: v22.string(),
1383
- publicKey: v22.string(),
1384
- gaiaHubUrl: v22.string(),
1385
- gaiaAppKey: v22.string()
1317
+ addresses: v18.array(
1318
+ v18.object({
1319
+ address: v18.string(),
1320
+ publicKey: v18.string(),
1321
+ gaiaHubUrl: v18.string(),
1322
+ gaiaAppKey: v18.string()
1386
1323
  })
1387
1324
  ),
1388
1325
  network: getNetworkResultSchema
1389
1326
  });
1390
- var stxGetAccountsRequestMessageSchema = v22.object({
1327
+ var stxGetAccountsRequestMessageSchema = v18.object({
1391
1328
  ...rpcRequestMessageSchema.entries,
1392
- ...v22.object({
1393
- method: v22.literal(stxGetAccountsMethodName),
1329
+ ...v18.object({
1330
+ method: v18.literal(stxGetAccountsMethodName),
1394
1331
  params: stxGetAccountsParamsSchema,
1395
- id: v22.string()
1332
+ id: v18.string()
1396
1333
  }).entries
1397
1334
  });
1398
1335
 
1399
1336
  // src/request/types/stxMethods/getAddresses.ts
1400
- var v23 = __toESM(require("valibot"));
1337
+ var v19 = __toESM(require("valibot"));
1401
1338
  var stxGetAddressesMethodName = "stx_getAddresses";
1402
- var stxGetAddressesParamsSchema = v23.nullish(
1403
- v23.object({
1339
+ var stxGetAddressesParamsSchema = v19.nullish(
1340
+ v19.object({
1404
1341
  /**
1405
1342
  * A message to be displayed to the user in the request prompt.
1406
1343
  */
1407
- message: v23.optional(v23.string())
1344
+ message: v19.optional(v19.string())
1408
1345
  })
1409
1346
  );
1410
- var stxGetAddressesResultSchema = v23.object({
1347
+ var stxGetAddressesResultSchema = v19.object({
1411
1348
  /**
1412
1349
  * The addresses generated for the given purposes.
1413
1350
  */
1414
- addresses: v23.array(addressSchema),
1351
+ addresses: v19.array(addressSchema),
1415
1352
  network: getNetworkResultSchema
1416
1353
  });
1417
- var stxGetAddressesRequestMessageSchema = v23.object({
1354
+ var stxGetAddressesRequestMessageSchema = v19.object({
1418
1355
  ...rpcRequestMessageSchema.entries,
1419
- ...v23.object({
1420
- method: v23.literal(stxGetAddressesMethodName),
1356
+ ...v19.object({
1357
+ method: v19.literal(stxGetAddressesMethodName),
1421
1358
  params: stxGetAddressesParamsSchema,
1422
- id: v23.string()
1359
+ id: v19.string()
1423
1360
  }).entries
1424
1361
  });
1425
1362
 
1426
1363
  // src/request/types/stxMethods/signMessage.ts
1427
- var v24 = __toESM(require("valibot"));
1364
+ var v20 = __toESM(require("valibot"));
1428
1365
  var stxSignMessageMethodName = "stx_signMessage";
1429
- var stxSignMessageParamsSchema = v24.object({
1366
+ var stxSignMessageParamsSchema = v20.object({
1430
1367
  /**
1431
1368
  * The message to sign.
1432
1369
  */
1433
- message: v24.string()
1370
+ message: v20.string()
1434
1371
  });
1435
- var stxSignMessageResultSchema = v24.object({
1372
+ var stxSignMessageResultSchema = v20.object({
1436
1373
  /**
1437
1374
  * The signature of the message.
1438
1375
  */
1439
- signature: v24.string(),
1376
+ signature: v20.string(),
1440
1377
  /**
1441
1378
  * The public key used to sign the message.
1442
1379
  */
1443
- publicKey: v24.string()
1380
+ publicKey: v20.string()
1444
1381
  });
1445
- var stxSignMessageRequestMessageSchema = v24.object({
1382
+ var stxSignMessageRequestMessageSchema = v20.object({
1446
1383
  ...rpcRequestMessageSchema.entries,
1447
- ...v24.object({
1448
- method: v24.literal(stxSignMessageMethodName),
1384
+ ...v20.object({
1385
+ method: v20.literal(stxSignMessageMethodName),
1449
1386
  params: stxSignMessageParamsSchema,
1450
- id: v24.string()
1387
+ id: v20.string()
1451
1388
  }).entries
1452
1389
  });
1453
1390
 
1454
1391
  // src/request/types/stxMethods/signStructuredMessage.ts
1455
- var v25 = __toESM(require("valibot"));
1392
+ var v21 = __toESM(require("valibot"));
1456
1393
  var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
1457
- var stxSignStructuredMessageParamsSchema = v25.object({
1394
+ var stxSignStructuredMessageParamsSchema = v21.object({
1458
1395
  /**
1459
1396
  * The domain to be signed.
1460
1397
  */
1461
- domain: v25.string(),
1398
+ domain: v21.string(),
1462
1399
  /**
1463
1400
  * Message payload to be signed.
1464
1401
  */
1465
- message: v25.string(),
1402
+ message: v21.string(),
1466
1403
  /**
1467
1404
  * The public key to sign the message with.
1468
1405
  */
1469
- publicKey: v25.optional(v25.string())
1406
+ publicKey: v21.optional(v21.string())
1470
1407
  });
1471
- var stxSignStructuredMessageResultSchema = v25.object({
1408
+ var stxSignStructuredMessageResultSchema = v21.object({
1472
1409
  /**
1473
1410
  * Signature of the message.
1474
1411
  */
1475
- signature: v25.string(),
1412
+ signature: v21.string(),
1476
1413
  /**
1477
1414
  * Public key as hex-encoded string.
1478
1415
  */
1479
- publicKey: v25.string()
1416
+ publicKey: v21.string()
1480
1417
  });
1481
- var stxSignStructuredMessageRequestMessageSchema = v25.object({
1418
+ var stxSignStructuredMessageRequestMessageSchema = v21.object({
1482
1419
  ...rpcRequestMessageSchema.entries,
1483
- ...v25.object({
1484
- method: v25.literal(stxSignStructuredMessageMethodName),
1420
+ ...v21.object({
1421
+ method: v21.literal(stxSignStructuredMessageMethodName),
1485
1422
  params: stxSignStructuredMessageParamsSchema,
1486
- id: v25.string()
1423
+ id: v21.string()
1487
1424
  }).entries
1488
1425
  });
1489
1426
 
1490
1427
  // src/request/types/stxMethods/signTransaction.ts
1491
- var v26 = __toESM(require("valibot"));
1428
+ var v22 = __toESM(require("valibot"));
1492
1429
  var stxSignTransactionMethodName = "stx_signTransaction";
1493
- var stxSignTransactionParamsSchema = v26.object({
1430
+ var stxSignTransactionParamsSchema = v22.object({
1494
1431
  /**
1495
1432
  * The transaction to sign as a hex-encoded string.
1496
1433
  */
1497
- transaction: v26.string(),
1434
+ transaction: v22.string(),
1498
1435
  /**
1499
1436
  * The public key to sign the transaction with. The wallet may use any key
1500
1437
  * when not provided.
1501
1438
  */
1502
- pubkey: v26.optional(v26.string()),
1439
+ pubkey: v22.optional(v22.string()),
1503
1440
  /**
1504
1441
  * Whether to broadcast the transaction after signing. Defaults to `true`.
1505
1442
  */
1506
- broadcast: v26.optional(v26.boolean())
1443
+ broadcast: v22.optional(v22.boolean())
1507
1444
  });
1508
- var stxSignTransactionResultSchema = v26.object({
1445
+ var stxSignTransactionResultSchema = v22.object({
1509
1446
  /**
1510
1447
  * The signed transaction as a hex-encoded string.
1511
1448
  */
1512
- transaction: v26.string()
1449
+ transaction: v22.string()
1513
1450
  });
1514
- var stxSignTransactionRequestMessageSchema = v26.object({
1451
+ var stxSignTransactionRequestMessageSchema = v22.object({
1515
1452
  ...rpcRequestMessageSchema.entries,
1516
- ...v26.object({
1517
- method: v26.literal(stxSignTransactionMethodName),
1453
+ ...v22.object({
1454
+ method: v22.literal(stxSignTransactionMethodName),
1518
1455
  params: stxSignTransactionParamsSchema,
1519
- id: v26.string()
1456
+ id: v22.string()
1520
1457
  }).entries
1521
1458
  });
1522
1459
 
1523
1460
  // src/request/types/stxMethods/signTransactions.ts
1524
- var v27 = __toESM(require("valibot"));
1461
+ var v23 = __toESM(require("valibot"));
1525
1462
  var stxSignTransactionsMethodName = "stx_signTransactions";
1526
- var stxSignTransactionsParamsSchema = v27.object({
1463
+ var stxSignTransactionsParamsSchema = v23.object({
1527
1464
  /**
1528
1465
  * The transactions to sign as hex-encoded strings.
1529
1466
  */
1530
- transactions: v27.pipe(
1531
- v27.array(
1532
- v27.pipe(
1533
- v27.string(),
1534
- v27.check((hex) => {
1467
+ transactions: v23.pipe(
1468
+ v23.array(
1469
+ v23.pipe(
1470
+ v23.string(),
1471
+ v23.check((hex) => {
1535
1472
  return true;
1536
1473
  }, "Invalid hex-encoded Stacks transaction.")
1537
1474
  )
1538
1475
  ),
1539
- v27.minLength(1)
1476
+ v23.minLength(1)
1540
1477
  ),
1541
1478
  /**
1542
1479
  * Whether the signed transactions should be broadcast after signing. Defaults
1543
1480
  * to `true`.
1544
1481
  */
1545
- broadcast: v27.optional(v27.boolean())
1482
+ broadcast: v23.optional(v23.boolean())
1546
1483
  });
1547
- var stxSignTransactionsResultSchema = v27.object({
1484
+ var stxSignTransactionsResultSchema = v23.object({
1548
1485
  /**
1549
1486
  * The signed transactions as hex-encoded strings, in the same order as in the
1550
1487
  * sign request.
1551
1488
  */
1552
- transactions: v27.array(v27.string())
1489
+ transactions: v23.array(v23.string())
1553
1490
  });
1554
- var stxSignTransactionsRequestMessageSchema = v27.object({
1491
+ var stxSignTransactionsRequestMessageSchema = v23.object({
1555
1492
  ...rpcRequestMessageSchema.entries,
1556
- ...v27.object({
1557
- method: v27.literal(stxSignTransactionsMethodName),
1493
+ ...v23.object({
1494
+ method: v23.literal(stxSignTransactionsMethodName),
1558
1495
  params: stxSignTransactionsParamsSchema,
1559
- id: v27.string()
1496
+ id: v23.string()
1560
1497
  }).entries
1561
1498
  });
1562
1499
 
1563
1500
  // src/request/types/stxMethods/transferStx.ts
1564
- var v28 = __toESM(require("valibot"));
1501
+ var v24 = __toESM(require("valibot"));
1565
1502
  var stxTransferStxMethodName = "stx_transferStx";
1566
- var stxTransferStxParamsSchema = v28.object({
1503
+ var stxTransferStxParamsSchema = v24.object({
1567
1504
  /**
1568
1505
  * Amount of STX tokens to transfer in microstacks as a string. Anything
1569
1506
  * parseable by `BigInt` is acceptable.
@@ -1576,23 +1513,23 @@ var stxTransferStxParamsSchema = v28.object({
1576
1513
  * const amount3 = '1234';
1577
1514
  * ```
1578
1515
  */
1579
- amount: v28.union([v28.number(), v28.string()]),
1516
+ amount: v24.union([v24.number(), v24.string()]),
1580
1517
  /**
1581
1518
  * The recipient's principal.
1582
1519
  */
1583
- recipient: v28.string(),
1520
+ recipient: v24.string(),
1584
1521
  /**
1585
1522
  * A string representing the memo.
1586
1523
  */
1587
- memo: v28.optional(v28.string()),
1524
+ memo: v24.optional(v24.string()),
1588
1525
  /**
1589
1526
  * Version of parameter format.
1590
1527
  */
1591
- version: v28.optional(v28.string()),
1528
+ version: v24.optional(v24.string()),
1592
1529
  /**
1593
1530
  * The mode of the post conditions.
1594
1531
  */
1595
- postConditionMode: v28.optional(v28.number()),
1532
+ postConditionMode: v24.optional(v24.number()),
1596
1533
  /**
1597
1534
  * A hex-encoded string representing the post conditions.
1598
1535
  *
@@ -1605,29 +1542,29 @@ var stxTransferStxParamsSchema = v28.object({
1605
1542
  * const hexPostCondition = serializePostCondition(postCondition).toString('hex');
1606
1543
  * ```
1607
1544
  */
1608
- postConditions: v28.optional(v28.array(v28.string())),
1545
+ postConditions: v24.optional(v24.array(v24.string())),
1609
1546
  /**
1610
1547
  * The public key to sign the transaction with. The wallet may use any key
1611
1548
  * when not provided.
1612
1549
  */
1613
- pubkey: v28.optional(v28.string())
1550
+ pubkey: v24.optional(v24.string())
1614
1551
  });
1615
- var stxTransferStxResultSchema = v28.object({
1552
+ var stxTransferStxResultSchema = v24.object({
1616
1553
  /**
1617
1554
  * The ID of the transaction.
1618
1555
  */
1619
- txid: v28.string(),
1556
+ txid: v24.string(),
1620
1557
  /**
1621
1558
  * A Stacks transaction as a hex-encoded string.
1622
1559
  */
1623
- transaction: v28.string()
1560
+ transaction: v24.string()
1624
1561
  });
1625
- var stxTransferStxRequestMessageSchema = v28.object({
1562
+ var stxTransferStxRequestMessageSchema = v24.object({
1626
1563
  ...rpcRequestMessageSchema.entries,
1627
- ...v28.object({
1628
- method: v28.literal(stxTransferStxMethodName),
1564
+ ...v24.object({
1565
+ method: v24.literal(stxTransferStxMethodName),
1629
1566
  params: stxTransferStxParamsSchema,
1630
- id: v28.string()
1567
+ id: v24.string()
1631
1568
  }).entries
1632
1569
  });
1633
1570
 
@@ -1643,14 +1580,23 @@ var request = async (method, params, providerId) => {
1643
1580
  if (!method) {
1644
1581
  throw new Error("A wallet method is required");
1645
1582
  }
1646
- const response = await provider.request(method, params);
1647
- if (v29.is(rpcErrorResponseMessageSchema, response)) {
1583
+ const providerVersion = provider.version ?? 0;
1584
+ const {
1585
+ method: sanitizedMethod,
1586
+ params: sanitizedParams,
1587
+ overrideResponse
1588
+ } = sanitizeRequest(method, params, providerVersion);
1589
+ if (overrideResponse) {
1590
+ return overrideResponse;
1591
+ }
1592
+ const response = await provider.request(sanitizedMethod, sanitizedParams);
1593
+ if (v25.is(rpcErrorResponseMessageSchema, response)) {
1648
1594
  return {
1649
1595
  status: "error",
1650
1596
  error: response.error
1651
1597
  };
1652
1598
  }
1653
- if (v29.is(rpcSuccessResponseMessageSchema, response)) {
1599
+ if (v25.is(rpcSuccessResponseMessageSchema, response)) {
1654
1600
  return {
1655
1601
  status: "success",
1656
1602
  result: response.result
@@ -2466,6 +2412,7 @@ var extractOrValidateCapabilities = (provider, reportedCapabilities) => {
2466
2412
  return true;
2467
2413
  };
2468
2414
  const capabilityMap = {
2415
+ version: validateCapability("version"),
2469
2416
  request: validateCapability("request"),
2470
2417
  connect: validateCapability("connect"),
2471
2418
  signMessage: validateCapability("signMessage"),
@@ -2668,7 +2615,6 @@ var signMultipleTransactions = async (options) => {
2668
2615
  BaseAdapter,
2669
2616
  BitcoinNetworkType,
2670
2617
  DefaultAdaptersInfo,
2671
- FlashnetIntentType,
2672
2618
  MessageSigningProtocols,
2673
2619
  PermissionRequestParams,
2674
2620
  RpcErrorCode,
@@ -2806,16 +2752,6 @@ var signMultipleTransactions = async (options) => {
2806
2752
  signPsbtRequestMessageSchema,
2807
2753
  signPsbtResultSchema,
2808
2754
  signTransaction,
2809
- sparkFlashnetGetJwtMethodName,
2810
- sparkFlashnetGetJwtParamsSchema,
2811
- sparkFlashnetGetJwtRequestMessageSchema,
2812
- sparkFlashnetGetJwtResultSchema,
2813
- sparkFlashnetRouteSwapIntentSchema,
2814
- sparkFlashnetSignIntentMethodName,
2815
- sparkFlashnetSignIntentParamsSchema,
2816
- sparkFlashnetSignIntentRequestMessageSchema,
2817
- sparkFlashnetSignIntentResultSchema,
2818
- sparkFlashnetSwapIntentSchema,
2819
2755
  sparkGetAddressesMethodName,
2820
2756
  sparkGetAddressesParamsSchema,
2821
2757
  sparkGetAddressesRequestMessageSchema,