@sats-connect/core 0.8.1-db15ee7 → 0.8.1-e76eede

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.mjs CHANGED
@@ -1,3 +1,6 @@
1
+ // src/request/index.ts
2
+ import * as v25 from "valibot";
3
+
1
4
  // src/provider/types.ts
2
5
  import * as v4 from "valibot";
3
6
 
@@ -191,8 +194,22 @@ function getSupportedWallets() {
191
194
  return wallets;
192
195
  }
193
196
 
194
- // src/request/index.ts
195
- import * as v26 from "valibot";
197
+ // src/request/sanitizeRequest.ts
198
+ var sanitizeRequest = (method, params, providerVersion) => {
199
+ if (method === "wallet_connect" && providerVersion < 1) {
200
+ const typedParams = params;
201
+ if (!typedParams) {
202
+ return { method, params };
203
+ }
204
+ const { addresses, ...rest } = typedParams;
205
+ const sanitizedAddresses = addresses?.filter(
206
+ (addr) => addr !== "spark" /* Spark */ && addr !== "starknet" /* Starknet */
207
+ );
208
+ const overrideParams = { ...rest, addresses: sanitizedAddresses };
209
+ return { method, params: overrideParams };
210
+ }
211
+ return { method, params };
212
+ };
196
213
 
197
214
  // src/request/types/btcMethods.ts
198
215
  import * as v6 from "valibot";
@@ -864,108 +881,87 @@ var sparkGetBalanceRequestMessageSchema = v13.object({
864
881
  }).entries
865
882
  });
866
883
 
867
- // src/request/types/sparkMethods/signMessage.ts
868
- import * as v14 from "valibot";
869
- var sparkSignMessageMethodName = "spark_signMessage";
870
- var sparkSignMessageParamsSchema = v14.object({
871
- message: v14.string()
872
- });
873
- var sparkSignMessageResultSchema = v14.object({
874
- /**
875
- * The signature for the message in hex format
876
- */
877
- signature: v14.string()
878
- });
879
- var sparkSignMessageRequestMessageSchema = v14.object({
880
- ...rpcRequestMessageSchema.entries,
881
- ...v14.object({
882
- method: v14.literal(sparkSignMessageMethodName),
883
- params: sparkSignMessageParamsSchema,
884
- id: v14.string()
885
- }).entries
886
- });
887
-
888
884
  // src/request/types/sparkMethods/transfer.ts
889
- import * as v15 from "valibot";
885
+ import * as v14 from "valibot";
890
886
  var sparkTransferMethodName = "spark_transfer";
891
- var sparkTransferParamsSchema = v15.object({
887
+ var sparkTransferParamsSchema = v14.object({
892
888
  /**
893
889
  * Amount of SATS to transfer as a string or number.
894
890
  */
895
- amountSats: v15.union([v15.number(), v15.string()]),
891
+ amountSats: v14.union([v14.number(), v14.string()]),
896
892
  /**
897
893
  * The recipient's spark address.
898
894
  */
899
- receiverSparkAddress: v15.string()
895
+ receiverSparkAddress: v14.string()
900
896
  });
901
- var sparkTransferResultSchema = v15.object({
897
+ var sparkTransferResultSchema = v14.object({
902
898
  /**
903
899
  * The ID of the transaction.
904
900
  */
905
- id: v15.string()
901
+ id: v14.string()
906
902
  });
907
- var sparkTransferRequestMessageSchema = v15.object({
903
+ var sparkTransferRequestMessageSchema = v14.object({
908
904
  ...rpcRequestMessageSchema.entries,
909
- ...v15.object({
910
- method: v15.literal(sparkTransferMethodName),
905
+ ...v14.object({
906
+ method: v14.literal(sparkTransferMethodName),
911
907
  params: sparkTransferParamsSchema,
912
- id: v15.string()
908
+ id: v14.string()
913
909
  }).entries
914
910
  });
915
911
 
916
912
  // src/request/types/sparkMethods/transferToken.ts
917
- import * as v16 from "valibot";
913
+ import * as v15 from "valibot";
918
914
  var sparkTransferTokenMethodName = "spark_transferToken";
919
- var sparkTransferTokenParamsSchema = v16.object({
915
+ var sparkTransferTokenParamsSchema = v15.object({
920
916
  /**
921
917
  * Amount of units of the token to transfer as a string or number.
922
918
  */
923
- tokenAmount: v16.union([v16.number(), v16.string()]),
919
+ tokenAmount: v15.union([v15.number(), v15.string()]),
924
920
  /**
925
921
  * The Bech32m token identifier.
926
922
  */
927
- tokenIdentifier: v16.string(),
923
+ tokenIdentifier: v15.string(),
928
924
  /**
929
925
  * The recipient's spark address.
930
926
  */
931
- receiverSparkAddress: v16.string()
927
+ receiverSparkAddress: v15.string()
932
928
  });
933
- var sparkTransferTokenResultSchema = v16.object({
929
+ var sparkTransferTokenResultSchema = v15.object({
934
930
  /**
935
931
  * The ID of the transaction.
936
932
  */
937
- id: v16.string()
933
+ id: v15.string()
938
934
  });
939
- var sparkTransferTokenRequestMessageSchema = v16.object({
935
+ var sparkTransferTokenRequestMessageSchema = v15.object({
940
936
  ...rpcRequestMessageSchema.entries,
941
- ...v16.object({
942
- method: v16.literal(sparkTransferTokenMethodName),
937
+ ...v15.object({
938
+ method: v15.literal(sparkTransferTokenMethodName),
943
939
  params: sparkTransferTokenParamsSchema,
944
- id: v16.string()
940
+ id: v15.string()
945
941
  }).entries
946
942
  });
947
943
 
948
944
  // src/request/types/stxMethods/callContract.ts
949
- import * as v17 from "valibot";
945
+ import * as v16 from "valibot";
950
946
  var stxCallContractMethodName = "stx_callContract";
951
- var stxCallContractParamsSchema = v17.object({
947
+ var stxCallContractParamsSchema = v16.object({
952
948
  /**
953
949
  * The contract principal.
954
950
  *
955
951
  * E.g. `"SPKE...GD5C.my-contract"`
956
952
  */
957
- contract: v17.string(),
953
+ contract: v16.string(),
958
954
  /**
959
955
  * The name of the function to call.
960
956
  *
961
957
  * Note: spec changes ongoing,
962
958
  * https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
963
959
  */
964
- functionName: v17.string(),
960
+ functionName: v16.string(),
965
961
  /**
966
962
  * @deprecated in favor of `functionArgs` for @stacks/connect compatibility
967
963
  */
968
- arguments: v17.optional(v17.array(v17.string())),
964
+ arguments: v16.optional(v16.array(v16.string())),
969
965
  /**
970
966
  * The function's arguments. The arguments are expected to be hex-encoded
971
967
  * strings of Clarity values.
@@ -980,274 +976,274 @@ var stxCallContractParamsSchema = v17.object({
980
976
  * const hexArgs = functionArgs.map(cvToHex);
981
977
  * ```
982
978
  */
983
- functionArgs: v17.optional(v17.array(v17.string())),
979
+ functionArgs: v16.optional(v16.array(v16.string())),
984
980
  /**
985
981
  * The post conditions to apply to the contract call.
986
982
  */
987
- postConditions: v17.optional(v17.array(v17.string())),
983
+ postConditions: v16.optional(v16.array(v16.string())),
988
984
  /**
989
985
  * The mode to apply to the post conditions.
990
986
  */
991
- postConditionMode: v17.optional(v17.union([v17.literal("allow"), v17.literal("deny")]))
987
+ postConditionMode: v16.optional(v16.union([v16.literal("allow"), v16.literal("deny")]))
992
988
  });
993
- var stxCallContractResultSchema = v17.object({
989
+ var stxCallContractResultSchema = v16.object({
994
990
  /**
995
991
  * The ID of the transaction.
996
992
  */
997
- txid: v17.string(),
993
+ txid: v16.string(),
998
994
  /**
999
995
  * A Stacks transaction as a hex-encoded string.
1000
996
  */
1001
- transaction: v17.string()
997
+ transaction: v16.string()
1002
998
  });
1003
- var stxCallContractRequestMessageSchema = v17.object({
999
+ var stxCallContractRequestMessageSchema = v16.object({
1004
1000
  ...rpcRequestMessageSchema.entries,
1005
- ...v17.object({
1006
- method: v17.literal(stxCallContractMethodName),
1001
+ ...v16.object({
1002
+ method: v16.literal(stxCallContractMethodName),
1007
1003
  params: stxCallContractParamsSchema,
1008
- id: v17.string()
1004
+ id: v16.string()
1009
1005
  }).entries
1010
1006
  });
1011
1007
 
1012
1008
  // src/request/types/stxMethods/deployContract.ts
1013
- import * as v18 from "valibot";
1009
+ import * as v17 from "valibot";
1014
1010
  var stxDeployContractMethodName = "stx_deployContract";
1015
- var stxDeployContractParamsSchema = v18.object({
1011
+ var stxDeployContractParamsSchema = v17.object({
1016
1012
  /**
1017
1013
  * Name of the contract.
1018
1014
  */
1019
- name: v18.string(),
1015
+ name: v17.string(),
1020
1016
  /**
1021
1017
  * The source code of the Clarity contract.
1022
1018
  */
1023
- clarityCode: v18.string(),
1019
+ clarityCode: v17.string(),
1024
1020
  /**
1025
1021
  * The version of the Clarity contract.
1026
1022
  */
1027
- clarityVersion: v18.optional(v18.number()),
1023
+ clarityVersion: v17.optional(v17.number()),
1028
1024
  /**
1029
1025
  * The post conditions to apply to the contract call.
1030
1026
  */
1031
- postConditions: v18.optional(v18.array(v18.string())),
1027
+ postConditions: v17.optional(v17.array(v17.string())),
1032
1028
  /**
1033
1029
  * The mode to apply to the post conditions.
1034
1030
  */
1035
- postConditionMode: v18.optional(v18.union([v18.literal("allow"), v18.literal("deny")]))
1031
+ postConditionMode: v17.optional(v17.union([v17.literal("allow"), v17.literal("deny")]))
1036
1032
  });
1037
- var stxDeployContractResultSchema = v18.object({
1033
+ var stxDeployContractResultSchema = v17.object({
1038
1034
  /**
1039
1035
  * The ID of the transaction.
1040
1036
  */
1041
- txid: v18.string(),
1037
+ txid: v17.string(),
1042
1038
  /**
1043
1039
  * A Stacks transaction as a hex-encoded string.
1044
1040
  */
1045
- transaction: v18.string()
1041
+ transaction: v17.string()
1046
1042
  });
1047
- var stxDeployContractRequestMessageSchema = v18.object({
1043
+ var stxDeployContractRequestMessageSchema = v17.object({
1048
1044
  ...rpcRequestMessageSchema.entries,
1049
- ...v18.object({
1050
- method: v18.literal(stxDeployContractMethodName),
1045
+ ...v17.object({
1046
+ method: v17.literal(stxDeployContractMethodName),
1051
1047
  params: stxDeployContractParamsSchema,
1052
- id: v18.string()
1048
+ id: v17.string()
1053
1049
  }).entries
1054
1050
  });
1055
1051
 
1056
1052
  // src/request/types/stxMethods/getAccounts.ts
1057
- import * as v19 from "valibot";
1053
+ import * as v18 from "valibot";
1058
1054
  var stxGetAccountsMethodName = "stx_getAccounts";
1059
- var stxGetAccountsParamsSchema = v19.nullish(v19.null());
1060
- var stxGetAccountsResultSchema = v19.object({
1055
+ var stxGetAccountsParamsSchema = v18.nullish(v18.null());
1056
+ var stxGetAccountsResultSchema = v18.object({
1061
1057
  /**
1062
1058
  * The addresses generated for the given purposes.
1063
1059
  */
1064
- addresses: v19.array(
1065
- v19.object({
1066
- address: v19.string(),
1067
- publicKey: v19.string(),
1068
- gaiaHubUrl: v19.string(),
1069
- gaiaAppKey: v19.string()
1060
+ addresses: v18.array(
1061
+ v18.object({
1062
+ address: v18.string(),
1063
+ publicKey: v18.string(),
1064
+ gaiaHubUrl: v18.string(),
1065
+ gaiaAppKey: v18.string()
1070
1066
  })
1071
1067
  ),
1072
1068
  network: getNetworkResultSchema
1073
1069
  });
1074
- var stxGetAccountsRequestMessageSchema = v19.object({
1070
+ var stxGetAccountsRequestMessageSchema = v18.object({
1075
1071
  ...rpcRequestMessageSchema.entries,
1076
- ...v19.object({
1077
- method: v19.literal(stxGetAccountsMethodName),
1072
+ ...v18.object({
1073
+ method: v18.literal(stxGetAccountsMethodName),
1078
1074
  params: stxGetAccountsParamsSchema,
1079
- id: v19.string()
1075
+ id: v18.string()
1080
1076
  }).entries
1081
1077
  });
1082
1078
 
1083
1079
  // src/request/types/stxMethods/getAddresses.ts
1084
- import * as v20 from "valibot";
1080
+ import * as v19 from "valibot";
1085
1081
  var stxGetAddressesMethodName = "stx_getAddresses";
1086
- var stxGetAddressesParamsSchema = v20.nullish(
1087
- v20.object({
1082
+ var stxGetAddressesParamsSchema = v19.nullish(
1083
+ v19.object({
1088
1084
  /**
1089
1085
  * A message to be displayed to the user in the request prompt.
1090
1086
  */
1091
- message: v20.optional(v20.string())
1087
+ message: v19.optional(v19.string())
1092
1088
  })
1093
1089
  );
1094
- var stxGetAddressesResultSchema = v20.object({
1090
+ var stxGetAddressesResultSchema = v19.object({
1095
1091
  /**
1096
1092
  * The addresses generated for the given purposes.
1097
1093
  */
1098
- addresses: v20.array(addressSchema),
1094
+ addresses: v19.array(addressSchema),
1099
1095
  network: getNetworkResultSchema
1100
1096
  });
1101
- var stxGetAddressesRequestMessageSchema = v20.object({
1097
+ var stxGetAddressesRequestMessageSchema = v19.object({
1102
1098
  ...rpcRequestMessageSchema.entries,
1103
- ...v20.object({
1104
- method: v20.literal(stxGetAddressesMethodName),
1099
+ ...v19.object({
1100
+ method: v19.literal(stxGetAddressesMethodName),
1105
1101
  params: stxGetAddressesParamsSchema,
1106
- id: v20.string()
1102
+ id: v19.string()
1107
1103
  }).entries
1108
1104
  });
1109
1105
 
1110
1106
  // src/request/types/stxMethods/signMessage.ts
1111
- import * as v21 from "valibot";
1107
+ import * as v20 from "valibot";
1112
1108
  var stxSignMessageMethodName = "stx_signMessage";
1113
- var stxSignMessageParamsSchema = v21.object({
1109
+ var stxSignMessageParamsSchema = v20.object({
1114
1110
  /**
1115
1111
  * The message to sign.
1116
1112
  */
1117
- message: v21.string()
1113
+ message: v20.string()
1118
1114
  });
1119
- var stxSignMessageResultSchema = v21.object({
1115
+ var stxSignMessageResultSchema = v20.object({
1120
1116
  /**
1121
1117
  * The signature of the message.
1122
1118
  */
1123
- signature: v21.string(),
1119
+ signature: v20.string(),
1124
1120
  /**
1125
1121
  * The public key used to sign the message.
1126
1122
  */
1127
- publicKey: v21.string()
1123
+ publicKey: v20.string()
1128
1124
  });
1129
- var stxSignMessageRequestMessageSchema = v21.object({
1125
+ var stxSignMessageRequestMessageSchema = v20.object({
1130
1126
  ...rpcRequestMessageSchema.entries,
1131
- ...v21.object({
1132
- method: v21.literal(stxSignMessageMethodName),
1127
+ ...v20.object({
1128
+ method: v20.literal(stxSignMessageMethodName),
1133
1129
  params: stxSignMessageParamsSchema,
1134
- id: v21.string()
1130
+ id: v20.string()
1135
1131
  }).entries
1136
1132
  });
1137
1133
 
1138
1134
  // src/request/types/stxMethods/signStructuredMessage.ts
1139
- import * as v22 from "valibot";
1135
+ import * as v21 from "valibot";
1140
1136
  var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
1141
- var stxSignStructuredMessageParamsSchema = v22.object({
1137
+ var stxSignStructuredMessageParamsSchema = v21.object({
1142
1138
  /**
1143
1139
  * The domain to be signed.
1144
1140
  */
1145
- domain: v22.string(),
1141
+ domain: v21.string(),
1146
1142
  /**
1147
1143
  * Message payload to be signed.
1148
1144
  */
1149
- message: v22.string(),
1145
+ message: v21.string(),
1150
1146
  /**
1151
1147
  * The public key to sign the message with.
1152
1148
  */
1153
- publicKey: v22.optional(v22.string())
1149
+ publicKey: v21.optional(v21.string())
1154
1150
  });
1155
- var stxSignStructuredMessageResultSchema = v22.object({
1151
+ var stxSignStructuredMessageResultSchema = v21.object({
1156
1152
  /**
1157
1153
  * Signature of the message.
1158
1154
  */
1159
- signature: v22.string(),
1155
+ signature: v21.string(),
1160
1156
  /**
1161
1157
  * Public key as hex-encoded string.
1162
1158
  */
1163
- publicKey: v22.string()
1159
+ publicKey: v21.string()
1164
1160
  });
1165
- var stxSignStructuredMessageRequestMessageSchema = v22.object({
1161
+ var stxSignStructuredMessageRequestMessageSchema = v21.object({
1166
1162
  ...rpcRequestMessageSchema.entries,
1167
- ...v22.object({
1168
- method: v22.literal(stxSignStructuredMessageMethodName),
1163
+ ...v21.object({
1164
+ method: v21.literal(stxSignStructuredMessageMethodName),
1169
1165
  params: stxSignStructuredMessageParamsSchema,
1170
- id: v22.string()
1166
+ id: v21.string()
1171
1167
  }).entries
1172
1168
  });
1173
1169
 
1174
1170
  // src/request/types/stxMethods/signTransaction.ts
1175
- import * as v23 from "valibot";
1171
+ import * as v22 from "valibot";
1176
1172
  var stxSignTransactionMethodName = "stx_signTransaction";
1177
- var stxSignTransactionParamsSchema = v23.object({
1173
+ var stxSignTransactionParamsSchema = v22.object({
1178
1174
  /**
1179
1175
  * The transaction to sign as a hex-encoded string.
1180
1176
  */
1181
- transaction: v23.string(),
1177
+ transaction: v22.string(),
1182
1178
  /**
1183
1179
  * The public key to sign the transaction with. The wallet may use any key
1184
1180
  * when not provided.
1185
1181
  */
1186
- pubkey: v23.optional(v23.string()),
1182
+ pubkey: v22.optional(v22.string()),
1187
1183
  /**
1188
1184
  * Whether to broadcast the transaction after signing. Defaults to `true`.
1189
1185
  */
1190
- broadcast: v23.optional(v23.boolean())
1186
+ broadcast: v22.optional(v22.boolean())
1191
1187
  });
1192
- var stxSignTransactionResultSchema = v23.object({
1188
+ var stxSignTransactionResultSchema = v22.object({
1193
1189
  /**
1194
1190
  * The signed transaction as a hex-encoded string.
1195
1191
  */
1196
- transaction: v23.string()
1192
+ transaction: v22.string()
1197
1193
  });
1198
- var stxSignTransactionRequestMessageSchema = v23.object({
1194
+ var stxSignTransactionRequestMessageSchema = v22.object({
1199
1195
  ...rpcRequestMessageSchema.entries,
1200
- ...v23.object({
1201
- method: v23.literal(stxSignTransactionMethodName),
1196
+ ...v22.object({
1197
+ method: v22.literal(stxSignTransactionMethodName),
1202
1198
  params: stxSignTransactionParamsSchema,
1203
- id: v23.string()
1199
+ id: v22.string()
1204
1200
  }).entries
1205
1201
  });
1206
1202
 
1207
1203
  // src/request/types/stxMethods/signTransactions.ts
1208
- import * as v24 from "valibot";
1204
+ import * as v23 from "valibot";
1209
1205
  var stxSignTransactionsMethodName = "stx_signTransactions";
1210
- var stxSignTransactionsParamsSchema = v24.object({
1206
+ var stxSignTransactionsParamsSchema = v23.object({
1211
1207
  /**
1212
1208
  * The transactions to sign as hex-encoded strings.
1213
1209
  */
1214
- transactions: v24.pipe(
1215
- v24.array(
1216
- v24.pipe(
1217
- v24.string(),
1218
- v24.check((hex) => {
1210
+ transactions: v23.pipe(
1211
+ v23.array(
1212
+ v23.pipe(
1213
+ v23.string(),
1214
+ v23.check((hex) => {
1219
1215
  return true;
1220
1216
  }, "Invalid hex-encoded Stacks transaction.")
1221
1217
  )
1222
1218
  ),
1223
- v24.minLength(1)
1219
+ v23.minLength(1)
1224
1220
  ),
1225
1221
  /**
1226
1222
  * Whether the signed transactions should be broadcast after signing. Defaults
1227
1223
  * to `true`.
1228
1224
  */
1229
- broadcast: v24.optional(v24.boolean())
1225
+ broadcast: v23.optional(v23.boolean())
1230
1226
  });
1231
- var stxSignTransactionsResultSchema = v24.object({
1227
+ var stxSignTransactionsResultSchema = v23.object({
1232
1228
  /**
1233
1229
  * The signed transactions as hex-encoded strings, in the same order as in the
1234
1230
  * sign request.
1235
1231
  */
1236
- transactions: v24.array(v24.string())
1232
+ transactions: v23.array(v23.string())
1237
1233
  });
1238
- var stxSignTransactionsRequestMessageSchema = v24.object({
1234
+ var stxSignTransactionsRequestMessageSchema = v23.object({
1239
1235
  ...rpcRequestMessageSchema.entries,
1240
- ...v24.object({
1241
- method: v24.literal(stxSignTransactionsMethodName),
1236
+ ...v23.object({
1237
+ method: v23.literal(stxSignTransactionsMethodName),
1242
1238
  params: stxSignTransactionsParamsSchema,
1243
- id: v24.string()
1239
+ id: v23.string()
1244
1240
  }).entries
1245
1241
  });
1246
1242
 
1247
1243
  // src/request/types/stxMethods/transferStx.ts
1248
- import * as v25 from "valibot";
1244
+ import * as v24 from "valibot";
1249
1245
  var stxTransferStxMethodName = "stx_transferStx";
1250
- var stxTransferStxParamsSchema = v25.object({
1246
+ var stxTransferStxParamsSchema = v24.object({
1251
1247
  /**
1252
1248
  * Amount of STX tokens to transfer in microstacks as a string. Anything
1253
1249
  * parseable by `BigInt` is acceptable.
@@ -1260,23 +1256,23 @@ var stxTransferStxParamsSchema = v25.object({
1260
1256
  * const amount3 = '1234';
1261
1257
  * ```
1262
1258
  */
1263
- amount: v25.union([v25.number(), v25.string()]),
1259
+ amount: v24.union([v24.number(), v24.string()]),
1264
1260
  /**
1265
1261
  * The recipient's principal.
1266
1262
  */
1267
- recipient: v25.string(),
1263
+ recipient: v24.string(),
1268
1264
  /**
1269
1265
  * A string representing the memo.
1270
1266
  */
1271
- memo: v25.optional(v25.string()),
1267
+ memo: v24.optional(v24.string()),
1272
1268
  /**
1273
1269
  * Version of parameter format.
1274
1270
  */
1275
- version: v25.optional(v25.string()),
1271
+ version: v24.optional(v24.string()),
1276
1272
  /**
1277
1273
  * The mode of the post conditions.
1278
1274
  */
1279
- postConditionMode: v25.optional(v25.number()),
1275
+ postConditionMode: v24.optional(v24.number()),
1280
1276
  /**
1281
1277
  * A hex-encoded string representing the post conditions.
1282
1278
  *
@@ -1289,29 +1285,29 @@ var stxTransferStxParamsSchema = v25.object({
1289
1285
  * const hexPostCondition = serializePostCondition(postCondition).toString('hex');
1290
1286
  * ```
1291
1287
  */
1292
- postConditions: v25.optional(v25.array(v25.string())),
1288
+ postConditions: v24.optional(v24.array(v24.string())),
1293
1289
  /**
1294
1290
  * The public key to sign the transaction with. The wallet may use any key
1295
1291
  * when not provided.
1296
1292
  */
1297
- pubkey: v25.optional(v25.string())
1293
+ pubkey: v24.optional(v24.string())
1298
1294
  });
1299
- var stxTransferStxResultSchema = v25.object({
1295
+ var stxTransferStxResultSchema = v24.object({
1300
1296
  /**
1301
1297
  * The ID of the transaction.
1302
1298
  */
1303
- txid: v25.string(),
1299
+ txid: v24.string(),
1304
1300
  /**
1305
1301
  * A Stacks transaction as a hex-encoded string.
1306
1302
  */
1307
- transaction: v25.string()
1303
+ transaction: v24.string()
1308
1304
  });
1309
- var stxTransferStxRequestMessageSchema = v25.object({
1305
+ var stxTransferStxRequestMessageSchema = v24.object({
1310
1306
  ...rpcRequestMessageSchema.entries,
1311
- ...v25.object({
1312
- method: v25.literal(stxTransferStxMethodName),
1307
+ ...v24.object({
1308
+ method: v24.literal(stxTransferStxMethodName),
1313
1309
  params: stxTransferStxParamsSchema,
1314
- id: v25.string()
1310
+ id: v24.string()
1315
1311
  }).entries
1316
1312
  });
1317
1313
 
@@ -1327,14 +1323,23 @@ var request = async (method, params, providerId) => {
1327
1323
  if (!method) {
1328
1324
  throw new Error("A wallet method is required");
1329
1325
  }
1330
- const response = await provider.request(method, params);
1331
- if (v26.is(rpcErrorResponseMessageSchema, response)) {
1326
+ const providerVersion = provider.version ?? 0;
1327
+ const {
1328
+ method: sanitizedMethod,
1329
+ params: sanitizedParams,
1330
+ overrideResponse
1331
+ } = sanitizeRequest(method, params, providerVersion);
1332
+ if (overrideResponse) {
1333
+ return overrideResponse;
1334
+ }
1335
+ const response = await provider.request(sanitizedMethod, sanitizedParams);
1336
+ if (v25.is(rpcErrorResponseMessageSchema, response)) {
1332
1337
  return {
1333
1338
  status: "error",
1334
1339
  error: response.error
1335
1340
  };
1336
1341
  }
1337
- if (v26.is(rpcSuccessResponseMessageSchema, response)) {
1342
+ if (v25.is(rpcSuccessResponseMessageSchema, response)) {
1338
1343
  return {
1339
1344
  status: "success",
1340
1345
  result: response.result
@@ -2496,10 +2501,6 @@ export {
2496
2501
  sparkGetBalanceParamsSchema,
2497
2502
  sparkGetBalanceRequestMessageSchema,
2498
2503
  sparkGetBalanceResultSchema,
2499
- sparkSignMessageMethodName,
2500
- sparkSignMessageParamsSchema,
2501
- sparkSignMessageRequestMessageSchema,
2502
- sparkSignMessageResultSchema,
2503
2504
  sparkTransferMethodName,
2504
2505
  sparkTransferParamsSchema,
2505
2506
  sparkTransferRequestMessageSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sats-connect/core",
3
- "version": "0.8.1-db15ee7",
3
+ "version": "0.8.1-e76eede",
4
4
  "main": "dist/index.mjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.mts",