@sats-connect/core 0.8.2-6e91f8a → 0.8.2-b625163
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 +50 -28
- package/dist/index.d.ts +50 -28
- package/dist/index.js +203 -176
- package/dist/index.mjs +199 -176
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/request/index.ts
|
|
2
|
-
import * as
|
|
2
|
+
import * as v36 from "valibot";
|
|
3
3
|
|
|
4
4
|
// src/provider/types.ts
|
|
5
5
|
import * as v4 from "valibot";
|
|
@@ -930,8 +930,8 @@ var sparkFlashnetCreateConstantProductPoolIntentSchema = v16.object({
|
|
|
930
930
|
poolOwnerPublicKey: v16.string(),
|
|
931
931
|
assetAAddress: v16.string(),
|
|
932
932
|
assetBAddress: v16.string(),
|
|
933
|
-
lpFeeRateBps: v16.number(),
|
|
934
|
-
totalHostFeeRateBps: v16.number(),
|
|
933
|
+
lpFeeRateBps: v16.union([v16.number(), v16.string()]),
|
|
934
|
+
totalHostFeeRateBps: v16.union([v16.number(), v16.string()]),
|
|
935
935
|
nonce: v16.string()
|
|
936
936
|
})
|
|
937
937
|
});
|
|
@@ -947,8 +947,8 @@ var sparkFlashnetCreateSingleSidedPoolIntentSchema = v17.object({
|
|
|
947
947
|
virtualReserveA: v17.union([v17.number(), v17.string()]),
|
|
948
948
|
virtualReserveB: v17.union([v17.number(), v17.string()]),
|
|
949
949
|
threshold: v17.union([v17.number(), v17.string()]),
|
|
950
|
-
lpFeeRateBps: v17.number(),
|
|
951
|
-
totalHostFeeRateBps: v17.number(),
|
|
950
|
+
lpFeeRateBps: v17.union([v17.number(), v17.string()]),
|
|
951
|
+
totalHostFeeRateBps: v17.union([v17.number(), v17.string()]),
|
|
952
952
|
poolOwnerPublicKey: v17.string(),
|
|
953
953
|
nonce: v17.string()
|
|
954
954
|
})
|
|
@@ -978,13 +978,13 @@ var sparkFlashnetRouteSwapIntentSchema = v19.object({
|
|
|
978
978
|
poolId: v19.string(),
|
|
979
979
|
inputAssetAddress: v19.string(),
|
|
980
980
|
outputAssetAddress: v19.string(),
|
|
981
|
-
hopIntegratorFeeRateBps: v19.optional(v19.number())
|
|
981
|
+
hopIntegratorFeeRateBps: v19.optional(v19.union([v19.number(), v19.string()]))
|
|
982
982
|
})
|
|
983
983
|
),
|
|
984
984
|
inputAmount: v19.string(),
|
|
985
|
-
maxRouteSlippageBps: v19.number(),
|
|
985
|
+
maxRouteSlippageBps: v19.union([v19.number(), v19.string()]),
|
|
986
986
|
minAmountOut: v19.string(),
|
|
987
|
-
defaultIntegratorFeeRateBps: v19.optional(v19.number()),
|
|
987
|
+
defaultIntegratorFeeRateBps: v19.optional(v19.union([v19.number(), v19.string()])),
|
|
988
988
|
nonce: v19.string()
|
|
989
989
|
})
|
|
990
990
|
});
|
|
@@ -1000,9 +1000,9 @@ var sparkFlashnetSwapIntentSchema = v20.object({
|
|
|
1000
1000
|
assetInAddress: v20.string(),
|
|
1001
1001
|
assetOutAddress: v20.string(),
|
|
1002
1002
|
amountIn: v20.string(),
|
|
1003
|
-
maxSlippageBps: v20.number(),
|
|
1003
|
+
maxSlippageBps: v20.union([v20.number(), v20.string()]),
|
|
1004
1004
|
minAmountOut: v20.string(),
|
|
1005
|
-
totalIntegratorFeeRateBps: v20.optional(v20.number()),
|
|
1005
|
+
totalIntegratorFeeRateBps: v20.optional(v20.union([v20.number(), v20.string()])),
|
|
1006
1006
|
nonce: v20.string()
|
|
1007
1007
|
})
|
|
1008
1008
|
});
|
|
@@ -1035,146 +1035,165 @@ var sparkFlashnetSignIntentRequestMessageSchema = v21.object({
|
|
|
1035
1035
|
}).entries
|
|
1036
1036
|
});
|
|
1037
1037
|
|
|
1038
|
-
// src/request/types/sparkMethods/
|
|
1038
|
+
// src/request/types/sparkMethods/flashnetMethods/signStructuredMessage.ts
|
|
1039
1039
|
import * as v22 from "valibot";
|
|
1040
|
+
var sparkFlashnetSignStructuredMessageMethodName = "spark_flashnet_signStructuredMessage";
|
|
1041
|
+
var sparkFlashnetSignStructuredMessageParamsSchema = v22.object({
|
|
1042
|
+
message: v22.string()
|
|
1043
|
+
});
|
|
1044
|
+
var sparkFlashnetSignStructuredMessageResultSchema = v22.object({
|
|
1045
|
+
message: v22.string(),
|
|
1046
|
+
signature: v22.string()
|
|
1047
|
+
});
|
|
1048
|
+
var sparkFlashnetSignStructuredMessageRequestMessageSchema = v22.object({
|
|
1049
|
+
...rpcRequestMessageSchema.entries,
|
|
1050
|
+
...v22.object({
|
|
1051
|
+
method: v22.literal(sparkFlashnetSignStructuredMessageMethodName),
|
|
1052
|
+
params: sparkFlashnetSignStructuredMessageParamsSchema,
|
|
1053
|
+
id: v22.string()
|
|
1054
|
+
}).entries
|
|
1055
|
+
});
|
|
1056
|
+
|
|
1057
|
+
// src/request/types/sparkMethods/getAddresses.ts
|
|
1058
|
+
import * as v23 from "valibot";
|
|
1040
1059
|
var sparkGetAddressesMethodName = "spark_getAddresses";
|
|
1041
|
-
var sparkGetAddressesParamsSchema =
|
|
1042
|
-
|
|
1060
|
+
var sparkGetAddressesParamsSchema = v23.nullish(
|
|
1061
|
+
v23.object({
|
|
1043
1062
|
/**
|
|
1044
1063
|
* A message to be displayed to the user in the request prompt.
|
|
1045
1064
|
*/
|
|
1046
|
-
message:
|
|
1065
|
+
message: v23.optional(v23.string())
|
|
1047
1066
|
})
|
|
1048
1067
|
);
|
|
1049
|
-
var sparkGetAddressesResultSchema =
|
|
1068
|
+
var sparkGetAddressesResultSchema = v23.object({
|
|
1050
1069
|
/**
|
|
1051
1070
|
* The addresses generated for the given purposes.
|
|
1052
1071
|
*/
|
|
1053
|
-
addresses:
|
|
1072
|
+
addresses: v23.array(addressSchema),
|
|
1054
1073
|
network: getNetworkResultSchema
|
|
1055
1074
|
});
|
|
1056
|
-
var sparkGetAddressesRequestMessageSchema =
|
|
1075
|
+
var sparkGetAddressesRequestMessageSchema = v23.object({
|
|
1057
1076
|
...rpcRequestMessageSchema.entries,
|
|
1058
|
-
...
|
|
1059
|
-
method:
|
|
1077
|
+
...v23.object({
|
|
1078
|
+
method: v23.literal(sparkGetAddressesMethodName),
|
|
1060
1079
|
params: sparkGetAddressesParamsSchema,
|
|
1061
|
-
id:
|
|
1080
|
+
id: v23.string()
|
|
1062
1081
|
}).entries
|
|
1063
1082
|
});
|
|
1064
1083
|
|
|
1065
1084
|
// src/request/types/sparkMethods/getBalance.ts
|
|
1066
|
-
import * as
|
|
1085
|
+
import * as v24 from "valibot";
|
|
1067
1086
|
var sparkGetBalanceMethodName = "spark_getBalance";
|
|
1068
|
-
var sparkGetBalanceParamsSchema =
|
|
1069
|
-
var sparkGetBalanceResultSchema =
|
|
1087
|
+
var sparkGetBalanceParamsSchema = v24.nullish(v24.null());
|
|
1088
|
+
var sparkGetBalanceResultSchema = v24.object({
|
|
1070
1089
|
/**
|
|
1071
1090
|
* The Spark Bitcoin address balance in sats in string form.
|
|
1072
1091
|
*/
|
|
1073
|
-
balance:
|
|
1074
|
-
tokenBalances:
|
|
1075
|
-
|
|
1092
|
+
balance: v24.string(),
|
|
1093
|
+
tokenBalances: v24.array(
|
|
1094
|
+
v24.object({
|
|
1076
1095
|
/* The address balance of the token in string form as it can overflow a js number */
|
|
1077
|
-
balance:
|
|
1078
|
-
tokenMetadata:
|
|
1079
|
-
tokenIdentifier:
|
|
1080
|
-
tokenName:
|
|
1081
|
-
tokenTicker:
|
|
1082
|
-
decimals:
|
|
1083
|
-
maxSupply:
|
|
1096
|
+
balance: v24.string(),
|
|
1097
|
+
tokenMetadata: v24.object({
|
|
1098
|
+
tokenIdentifier: v24.string(),
|
|
1099
|
+
tokenName: v24.string(),
|
|
1100
|
+
tokenTicker: v24.string(),
|
|
1101
|
+
decimals: v24.number(),
|
|
1102
|
+
maxSupply: v24.string()
|
|
1084
1103
|
})
|
|
1085
1104
|
})
|
|
1086
1105
|
)
|
|
1087
1106
|
});
|
|
1088
|
-
var sparkGetBalanceRequestMessageSchema =
|
|
1107
|
+
var sparkGetBalanceRequestMessageSchema = v24.object({
|
|
1089
1108
|
...rpcRequestMessageSchema.entries,
|
|
1090
|
-
...
|
|
1091
|
-
method:
|
|
1109
|
+
...v24.object({
|
|
1110
|
+
method: v24.literal(sparkGetBalanceMethodName),
|
|
1092
1111
|
params: sparkGetBalanceParamsSchema,
|
|
1093
|
-
id:
|
|
1112
|
+
id: v24.string()
|
|
1094
1113
|
}).entries
|
|
1095
1114
|
});
|
|
1096
1115
|
|
|
1097
1116
|
// src/request/types/sparkMethods/transfer.ts
|
|
1098
|
-
import * as
|
|
1117
|
+
import * as v25 from "valibot";
|
|
1099
1118
|
var sparkTransferMethodName = "spark_transfer";
|
|
1100
|
-
var sparkTransferParamsSchema =
|
|
1119
|
+
var sparkTransferParamsSchema = v25.object({
|
|
1101
1120
|
/**
|
|
1102
1121
|
* Amount of SATS to transfer as a string or number.
|
|
1103
1122
|
*/
|
|
1104
|
-
amountSats:
|
|
1123
|
+
amountSats: v25.union([v25.number(), v25.string()]),
|
|
1105
1124
|
/**
|
|
1106
1125
|
* The recipient's spark address.
|
|
1107
1126
|
*/
|
|
1108
|
-
receiverSparkAddress:
|
|
1127
|
+
receiverSparkAddress: v25.string()
|
|
1109
1128
|
});
|
|
1110
|
-
var sparkTransferResultSchema =
|
|
1129
|
+
var sparkTransferResultSchema = v25.object({
|
|
1111
1130
|
/**
|
|
1112
1131
|
* The ID of the transaction.
|
|
1113
1132
|
*/
|
|
1114
|
-
id:
|
|
1133
|
+
id: v25.string()
|
|
1115
1134
|
});
|
|
1116
|
-
var sparkTransferRequestMessageSchema =
|
|
1135
|
+
var sparkTransferRequestMessageSchema = v25.object({
|
|
1117
1136
|
...rpcRequestMessageSchema.entries,
|
|
1118
|
-
...
|
|
1119
|
-
method:
|
|
1137
|
+
...v25.object({
|
|
1138
|
+
method: v25.literal(sparkTransferMethodName),
|
|
1120
1139
|
params: sparkTransferParamsSchema,
|
|
1121
|
-
id:
|
|
1140
|
+
id: v25.string()
|
|
1122
1141
|
}).entries
|
|
1123
1142
|
});
|
|
1124
1143
|
|
|
1125
1144
|
// src/request/types/sparkMethods/transferToken.ts
|
|
1126
|
-
import * as
|
|
1145
|
+
import * as v26 from "valibot";
|
|
1127
1146
|
var sparkTransferTokenMethodName = "spark_transferToken";
|
|
1128
|
-
var sparkTransferTokenParamsSchema =
|
|
1147
|
+
var sparkTransferTokenParamsSchema = v26.object({
|
|
1129
1148
|
/**
|
|
1130
1149
|
* Amount of units of the token to transfer as a string or number.
|
|
1131
1150
|
*/
|
|
1132
|
-
tokenAmount:
|
|
1151
|
+
tokenAmount: v26.union([v26.number(), v26.string()]),
|
|
1133
1152
|
/**
|
|
1134
1153
|
* The Bech32m token identifier.
|
|
1135
1154
|
*/
|
|
1136
|
-
tokenIdentifier:
|
|
1155
|
+
tokenIdentifier: v26.string(),
|
|
1137
1156
|
/**
|
|
1138
1157
|
* The recipient's spark address.
|
|
1139
1158
|
*/
|
|
1140
|
-
receiverSparkAddress:
|
|
1159
|
+
receiverSparkAddress: v26.string()
|
|
1141
1160
|
});
|
|
1142
|
-
var sparkTransferTokenResultSchema =
|
|
1161
|
+
var sparkTransferTokenResultSchema = v26.object({
|
|
1143
1162
|
/**
|
|
1144
1163
|
* The ID of the transaction.
|
|
1145
1164
|
*/
|
|
1146
|
-
id:
|
|
1165
|
+
id: v26.string()
|
|
1147
1166
|
});
|
|
1148
|
-
var sparkTransferTokenRequestMessageSchema =
|
|
1167
|
+
var sparkTransferTokenRequestMessageSchema = v26.object({
|
|
1149
1168
|
...rpcRequestMessageSchema.entries,
|
|
1150
|
-
...
|
|
1151
|
-
method:
|
|
1169
|
+
...v26.object({
|
|
1170
|
+
method: v26.literal(sparkTransferTokenMethodName),
|
|
1152
1171
|
params: sparkTransferTokenParamsSchema,
|
|
1153
|
-
id:
|
|
1172
|
+
id: v26.string()
|
|
1154
1173
|
}).entries
|
|
1155
1174
|
});
|
|
1156
1175
|
|
|
1157
1176
|
// src/request/types/stxMethods/callContract.ts
|
|
1158
|
-
import * as
|
|
1177
|
+
import * as v27 from "valibot";
|
|
1159
1178
|
var stxCallContractMethodName = "stx_callContract";
|
|
1160
|
-
var stxCallContractParamsSchema =
|
|
1179
|
+
var stxCallContractParamsSchema = v27.object({
|
|
1161
1180
|
/**
|
|
1162
1181
|
* The contract principal.
|
|
1163
1182
|
*
|
|
1164
1183
|
* E.g. `"SPKE...GD5C.my-contract"`
|
|
1165
1184
|
*/
|
|
1166
|
-
contract:
|
|
1185
|
+
contract: v27.string(),
|
|
1167
1186
|
/**
|
|
1168
1187
|
* The name of the function to call.
|
|
1169
1188
|
*
|
|
1170
1189
|
* Note: spec changes ongoing,
|
|
1171
1190
|
* https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
|
|
1172
1191
|
*/
|
|
1173
|
-
functionName:
|
|
1192
|
+
functionName: v27.string(),
|
|
1174
1193
|
/**
|
|
1175
1194
|
* @deprecated in favor of `functionArgs` for @stacks/connect compatibility
|
|
1176
1195
|
*/
|
|
1177
|
-
arguments:
|
|
1196
|
+
arguments: v27.optional(v27.array(v27.string())),
|
|
1178
1197
|
/**
|
|
1179
1198
|
* The function's arguments. The arguments are expected to be hex-encoded
|
|
1180
1199
|
* strings of Clarity values.
|
|
@@ -1189,274 +1208,274 @@ var stxCallContractParamsSchema = v26.object({
|
|
|
1189
1208
|
* const hexArgs = functionArgs.map(cvToHex);
|
|
1190
1209
|
* ```
|
|
1191
1210
|
*/
|
|
1192
|
-
functionArgs:
|
|
1211
|
+
functionArgs: v27.optional(v27.array(v27.string())),
|
|
1193
1212
|
/**
|
|
1194
1213
|
* The post conditions to apply to the contract call.
|
|
1195
1214
|
*/
|
|
1196
|
-
postConditions:
|
|
1215
|
+
postConditions: v27.optional(v27.array(v27.string())),
|
|
1197
1216
|
/**
|
|
1198
1217
|
* The mode to apply to the post conditions.
|
|
1199
1218
|
*/
|
|
1200
|
-
postConditionMode:
|
|
1219
|
+
postConditionMode: v27.optional(v27.union([v27.literal("allow"), v27.literal("deny")]))
|
|
1201
1220
|
});
|
|
1202
|
-
var stxCallContractResultSchema =
|
|
1221
|
+
var stxCallContractResultSchema = v27.object({
|
|
1203
1222
|
/**
|
|
1204
1223
|
* The ID of the transaction.
|
|
1205
1224
|
*/
|
|
1206
|
-
txid:
|
|
1225
|
+
txid: v27.string(),
|
|
1207
1226
|
/**
|
|
1208
1227
|
* A Stacks transaction as a hex-encoded string.
|
|
1209
1228
|
*/
|
|
1210
|
-
transaction:
|
|
1229
|
+
transaction: v27.string()
|
|
1211
1230
|
});
|
|
1212
|
-
var stxCallContractRequestMessageSchema =
|
|
1231
|
+
var stxCallContractRequestMessageSchema = v27.object({
|
|
1213
1232
|
...rpcRequestMessageSchema.entries,
|
|
1214
|
-
...
|
|
1215
|
-
method:
|
|
1233
|
+
...v27.object({
|
|
1234
|
+
method: v27.literal(stxCallContractMethodName),
|
|
1216
1235
|
params: stxCallContractParamsSchema,
|
|
1217
|
-
id:
|
|
1236
|
+
id: v27.string()
|
|
1218
1237
|
}).entries
|
|
1219
1238
|
});
|
|
1220
1239
|
|
|
1221
1240
|
// src/request/types/stxMethods/deployContract.ts
|
|
1222
|
-
import * as
|
|
1241
|
+
import * as v28 from "valibot";
|
|
1223
1242
|
var stxDeployContractMethodName = "stx_deployContract";
|
|
1224
|
-
var stxDeployContractParamsSchema =
|
|
1243
|
+
var stxDeployContractParamsSchema = v28.object({
|
|
1225
1244
|
/**
|
|
1226
1245
|
* Name of the contract.
|
|
1227
1246
|
*/
|
|
1228
|
-
name:
|
|
1247
|
+
name: v28.string(),
|
|
1229
1248
|
/**
|
|
1230
1249
|
* The source code of the Clarity contract.
|
|
1231
1250
|
*/
|
|
1232
|
-
clarityCode:
|
|
1251
|
+
clarityCode: v28.string(),
|
|
1233
1252
|
/**
|
|
1234
1253
|
* The version of the Clarity contract.
|
|
1235
1254
|
*/
|
|
1236
|
-
clarityVersion:
|
|
1255
|
+
clarityVersion: v28.optional(v28.number()),
|
|
1237
1256
|
/**
|
|
1238
1257
|
* The post conditions to apply to the contract call.
|
|
1239
1258
|
*/
|
|
1240
|
-
postConditions:
|
|
1259
|
+
postConditions: v28.optional(v28.array(v28.string())),
|
|
1241
1260
|
/**
|
|
1242
1261
|
* The mode to apply to the post conditions.
|
|
1243
1262
|
*/
|
|
1244
|
-
postConditionMode:
|
|
1263
|
+
postConditionMode: v28.optional(v28.union([v28.literal("allow"), v28.literal("deny")]))
|
|
1245
1264
|
});
|
|
1246
|
-
var stxDeployContractResultSchema =
|
|
1265
|
+
var stxDeployContractResultSchema = v28.object({
|
|
1247
1266
|
/**
|
|
1248
1267
|
* The ID of the transaction.
|
|
1249
1268
|
*/
|
|
1250
|
-
txid:
|
|
1269
|
+
txid: v28.string(),
|
|
1251
1270
|
/**
|
|
1252
1271
|
* A Stacks transaction as a hex-encoded string.
|
|
1253
1272
|
*/
|
|
1254
|
-
transaction:
|
|
1273
|
+
transaction: v28.string()
|
|
1255
1274
|
});
|
|
1256
|
-
var stxDeployContractRequestMessageSchema =
|
|
1275
|
+
var stxDeployContractRequestMessageSchema = v28.object({
|
|
1257
1276
|
...rpcRequestMessageSchema.entries,
|
|
1258
|
-
...
|
|
1259
|
-
method:
|
|
1277
|
+
...v28.object({
|
|
1278
|
+
method: v28.literal(stxDeployContractMethodName),
|
|
1260
1279
|
params: stxDeployContractParamsSchema,
|
|
1261
|
-
id:
|
|
1280
|
+
id: v28.string()
|
|
1262
1281
|
}).entries
|
|
1263
1282
|
});
|
|
1264
1283
|
|
|
1265
1284
|
// src/request/types/stxMethods/getAccounts.ts
|
|
1266
|
-
import * as
|
|
1285
|
+
import * as v29 from "valibot";
|
|
1267
1286
|
var stxGetAccountsMethodName = "stx_getAccounts";
|
|
1268
|
-
var stxGetAccountsParamsSchema =
|
|
1269
|
-
var stxGetAccountsResultSchema =
|
|
1287
|
+
var stxGetAccountsParamsSchema = v29.nullish(v29.null());
|
|
1288
|
+
var stxGetAccountsResultSchema = v29.object({
|
|
1270
1289
|
/**
|
|
1271
1290
|
* The addresses generated for the given purposes.
|
|
1272
1291
|
*/
|
|
1273
|
-
addresses:
|
|
1274
|
-
|
|
1275
|
-
address:
|
|
1276
|
-
publicKey:
|
|
1277
|
-
gaiaHubUrl:
|
|
1278
|
-
gaiaAppKey:
|
|
1292
|
+
addresses: v29.array(
|
|
1293
|
+
v29.object({
|
|
1294
|
+
address: v29.string(),
|
|
1295
|
+
publicKey: v29.string(),
|
|
1296
|
+
gaiaHubUrl: v29.string(),
|
|
1297
|
+
gaiaAppKey: v29.string()
|
|
1279
1298
|
})
|
|
1280
1299
|
),
|
|
1281
1300
|
network: getNetworkResultSchema
|
|
1282
1301
|
});
|
|
1283
|
-
var stxGetAccountsRequestMessageSchema =
|
|
1302
|
+
var stxGetAccountsRequestMessageSchema = v29.object({
|
|
1284
1303
|
...rpcRequestMessageSchema.entries,
|
|
1285
|
-
...
|
|
1286
|
-
method:
|
|
1304
|
+
...v29.object({
|
|
1305
|
+
method: v29.literal(stxGetAccountsMethodName),
|
|
1287
1306
|
params: stxGetAccountsParamsSchema,
|
|
1288
|
-
id:
|
|
1307
|
+
id: v29.string()
|
|
1289
1308
|
}).entries
|
|
1290
1309
|
});
|
|
1291
1310
|
|
|
1292
1311
|
// src/request/types/stxMethods/getAddresses.ts
|
|
1293
|
-
import * as
|
|
1312
|
+
import * as v30 from "valibot";
|
|
1294
1313
|
var stxGetAddressesMethodName = "stx_getAddresses";
|
|
1295
|
-
var stxGetAddressesParamsSchema =
|
|
1296
|
-
|
|
1314
|
+
var stxGetAddressesParamsSchema = v30.nullish(
|
|
1315
|
+
v30.object({
|
|
1297
1316
|
/**
|
|
1298
1317
|
* A message to be displayed to the user in the request prompt.
|
|
1299
1318
|
*/
|
|
1300
|
-
message:
|
|
1319
|
+
message: v30.optional(v30.string())
|
|
1301
1320
|
})
|
|
1302
1321
|
);
|
|
1303
|
-
var stxGetAddressesResultSchema =
|
|
1322
|
+
var stxGetAddressesResultSchema = v30.object({
|
|
1304
1323
|
/**
|
|
1305
1324
|
* The addresses generated for the given purposes.
|
|
1306
1325
|
*/
|
|
1307
|
-
addresses:
|
|
1326
|
+
addresses: v30.array(addressSchema),
|
|
1308
1327
|
network: getNetworkResultSchema
|
|
1309
1328
|
});
|
|
1310
|
-
var stxGetAddressesRequestMessageSchema =
|
|
1329
|
+
var stxGetAddressesRequestMessageSchema = v30.object({
|
|
1311
1330
|
...rpcRequestMessageSchema.entries,
|
|
1312
|
-
...
|
|
1313
|
-
method:
|
|
1331
|
+
...v30.object({
|
|
1332
|
+
method: v30.literal(stxGetAddressesMethodName),
|
|
1314
1333
|
params: stxGetAddressesParamsSchema,
|
|
1315
|
-
id:
|
|
1334
|
+
id: v30.string()
|
|
1316
1335
|
}).entries
|
|
1317
1336
|
});
|
|
1318
1337
|
|
|
1319
1338
|
// src/request/types/stxMethods/signMessage.ts
|
|
1320
|
-
import * as
|
|
1339
|
+
import * as v31 from "valibot";
|
|
1321
1340
|
var stxSignMessageMethodName = "stx_signMessage";
|
|
1322
|
-
var stxSignMessageParamsSchema =
|
|
1341
|
+
var stxSignMessageParamsSchema = v31.object({
|
|
1323
1342
|
/**
|
|
1324
1343
|
* The message to sign.
|
|
1325
1344
|
*/
|
|
1326
|
-
message:
|
|
1345
|
+
message: v31.string()
|
|
1327
1346
|
});
|
|
1328
|
-
var stxSignMessageResultSchema =
|
|
1347
|
+
var stxSignMessageResultSchema = v31.object({
|
|
1329
1348
|
/**
|
|
1330
1349
|
* The signature of the message.
|
|
1331
1350
|
*/
|
|
1332
|
-
signature:
|
|
1351
|
+
signature: v31.string(),
|
|
1333
1352
|
/**
|
|
1334
1353
|
* The public key used to sign the message.
|
|
1335
1354
|
*/
|
|
1336
|
-
publicKey:
|
|
1355
|
+
publicKey: v31.string()
|
|
1337
1356
|
});
|
|
1338
|
-
var stxSignMessageRequestMessageSchema =
|
|
1357
|
+
var stxSignMessageRequestMessageSchema = v31.object({
|
|
1339
1358
|
...rpcRequestMessageSchema.entries,
|
|
1340
|
-
...
|
|
1341
|
-
method:
|
|
1359
|
+
...v31.object({
|
|
1360
|
+
method: v31.literal(stxSignMessageMethodName),
|
|
1342
1361
|
params: stxSignMessageParamsSchema,
|
|
1343
|
-
id:
|
|
1362
|
+
id: v31.string()
|
|
1344
1363
|
}).entries
|
|
1345
1364
|
});
|
|
1346
1365
|
|
|
1347
1366
|
// src/request/types/stxMethods/signStructuredMessage.ts
|
|
1348
|
-
import * as
|
|
1367
|
+
import * as v32 from "valibot";
|
|
1349
1368
|
var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
|
|
1350
|
-
var stxSignStructuredMessageParamsSchema =
|
|
1369
|
+
var stxSignStructuredMessageParamsSchema = v32.object({
|
|
1351
1370
|
/**
|
|
1352
1371
|
* The domain to be signed.
|
|
1353
1372
|
*/
|
|
1354
|
-
domain:
|
|
1373
|
+
domain: v32.string(),
|
|
1355
1374
|
/**
|
|
1356
1375
|
* Message payload to be signed.
|
|
1357
1376
|
*/
|
|
1358
|
-
message:
|
|
1377
|
+
message: v32.string(),
|
|
1359
1378
|
/**
|
|
1360
1379
|
* The public key to sign the message with.
|
|
1361
1380
|
*/
|
|
1362
|
-
publicKey:
|
|
1381
|
+
publicKey: v32.optional(v32.string())
|
|
1363
1382
|
});
|
|
1364
|
-
var stxSignStructuredMessageResultSchema =
|
|
1383
|
+
var stxSignStructuredMessageResultSchema = v32.object({
|
|
1365
1384
|
/**
|
|
1366
1385
|
* Signature of the message.
|
|
1367
1386
|
*/
|
|
1368
|
-
signature:
|
|
1387
|
+
signature: v32.string(),
|
|
1369
1388
|
/**
|
|
1370
1389
|
* Public key as hex-encoded string.
|
|
1371
1390
|
*/
|
|
1372
|
-
publicKey:
|
|
1391
|
+
publicKey: v32.string()
|
|
1373
1392
|
});
|
|
1374
|
-
var stxSignStructuredMessageRequestMessageSchema =
|
|
1393
|
+
var stxSignStructuredMessageRequestMessageSchema = v32.object({
|
|
1375
1394
|
...rpcRequestMessageSchema.entries,
|
|
1376
|
-
...
|
|
1377
|
-
method:
|
|
1395
|
+
...v32.object({
|
|
1396
|
+
method: v32.literal(stxSignStructuredMessageMethodName),
|
|
1378
1397
|
params: stxSignStructuredMessageParamsSchema,
|
|
1379
|
-
id:
|
|
1398
|
+
id: v32.string()
|
|
1380
1399
|
}).entries
|
|
1381
1400
|
});
|
|
1382
1401
|
|
|
1383
1402
|
// src/request/types/stxMethods/signTransaction.ts
|
|
1384
|
-
import * as
|
|
1403
|
+
import * as v33 from "valibot";
|
|
1385
1404
|
var stxSignTransactionMethodName = "stx_signTransaction";
|
|
1386
|
-
var stxSignTransactionParamsSchema =
|
|
1405
|
+
var stxSignTransactionParamsSchema = v33.object({
|
|
1387
1406
|
/**
|
|
1388
1407
|
* The transaction to sign as a hex-encoded string.
|
|
1389
1408
|
*/
|
|
1390
|
-
transaction:
|
|
1409
|
+
transaction: v33.string(),
|
|
1391
1410
|
/**
|
|
1392
1411
|
* The public key to sign the transaction with. The wallet may use any key
|
|
1393
1412
|
* when not provided.
|
|
1394
1413
|
*/
|
|
1395
|
-
pubkey:
|
|
1414
|
+
pubkey: v33.optional(v33.string()),
|
|
1396
1415
|
/**
|
|
1397
1416
|
* Whether to broadcast the transaction after signing. Defaults to `true`.
|
|
1398
1417
|
*/
|
|
1399
|
-
broadcast:
|
|
1418
|
+
broadcast: v33.optional(v33.boolean())
|
|
1400
1419
|
});
|
|
1401
|
-
var stxSignTransactionResultSchema =
|
|
1420
|
+
var stxSignTransactionResultSchema = v33.object({
|
|
1402
1421
|
/**
|
|
1403
1422
|
* The signed transaction as a hex-encoded string.
|
|
1404
1423
|
*/
|
|
1405
|
-
transaction:
|
|
1424
|
+
transaction: v33.string()
|
|
1406
1425
|
});
|
|
1407
|
-
var stxSignTransactionRequestMessageSchema =
|
|
1426
|
+
var stxSignTransactionRequestMessageSchema = v33.object({
|
|
1408
1427
|
...rpcRequestMessageSchema.entries,
|
|
1409
|
-
...
|
|
1410
|
-
method:
|
|
1428
|
+
...v33.object({
|
|
1429
|
+
method: v33.literal(stxSignTransactionMethodName),
|
|
1411
1430
|
params: stxSignTransactionParamsSchema,
|
|
1412
|
-
id:
|
|
1431
|
+
id: v33.string()
|
|
1413
1432
|
}).entries
|
|
1414
1433
|
});
|
|
1415
1434
|
|
|
1416
1435
|
// src/request/types/stxMethods/signTransactions.ts
|
|
1417
|
-
import * as
|
|
1436
|
+
import * as v34 from "valibot";
|
|
1418
1437
|
var stxSignTransactionsMethodName = "stx_signTransactions";
|
|
1419
|
-
var stxSignTransactionsParamsSchema =
|
|
1438
|
+
var stxSignTransactionsParamsSchema = v34.object({
|
|
1420
1439
|
/**
|
|
1421
1440
|
* The transactions to sign as hex-encoded strings.
|
|
1422
1441
|
*/
|
|
1423
|
-
transactions:
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1442
|
+
transactions: v34.pipe(
|
|
1443
|
+
v34.array(
|
|
1444
|
+
v34.pipe(
|
|
1445
|
+
v34.string(),
|
|
1446
|
+
v34.check((hex) => {
|
|
1428
1447
|
return true;
|
|
1429
1448
|
}, "Invalid hex-encoded Stacks transaction.")
|
|
1430
1449
|
)
|
|
1431
1450
|
),
|
|
1432
|
-
|
|
1451
|
+
v34.minLength(1)
|
|
1433
1452
|
),
|
|
1434
1453
|
/**
|
|
1435
1454
|
* Whether the signed transactions should be broadcast after signing. Defaults
|
|
1436
1455
|
* to `true`.
|
|
1437
1456
|
*/
|
|
1438
|
-
broadcast:
|
|
1457
|
+
broadcast: v34.optional(v34.boolean())
|
|
1439
1458
|
});
|
|
1440
|
-
var stxSignTransactionsResultSchema =
|
|
1459
|
+
var stxSignTransactionsResultSchema = v34.object({
|
|
1441
1460
|
/**
|
|
1442
1461
|
* The signed transactions as hex-encoded strings, in the same order as in the
|
|
1443
1462
|
* sign request.
|
|
1444
1463
|
*/
|
|
1445
|
-
transactions:
|
|
1464
|
+
transactions: v34.array(v34.string())
|
|
1446
1465
|
});
|
|
1447
|
-
var stxSignTransactionsRequestMessageSchema =
|
|
1466
|
+
var stxSignTransactionsRequestMessageSchema = v34.object({
|
|
1448
1467
|
...rpcRequestMessageSchema.entries,
|
|
1449
|
-
...
|
|
1450
|
-
method:
|
|
1468
|
+
...v34.object({
|
|
1469
|
+
method: v34.literal(stxSignTransactionsMethodName),
|
|
1451
1470
|
params: stxSignTransactionsParamsSchema,
|
|
1452
|
-
id:
|
|
1471
|
+
id: v34.string()
|
|
1453
1472
|
}).entries
|
|
1454
1473
|
});
|
|
1455
1474
|
|
|
1456
1475
|
// src/request/types/stxMethods/transferStx.ts
|
|
1457
|
-
import * as
|
|
1476
|
+
import * as v35 from "valibot";
|
|
1458
1477
|
var stxTransferStxMethodName = "stx_transferStx";
|
|
1459
|
-
var stxTransferStxParamsSchema =
|
|
1478
|
+
var stxTransferStxParamsSchema = v35.object({
|
|
1460
1479
|
/**
|
|
1461
1480
|
* Amount of STX tokens to transfer in microstacks as a string. Anything
|
|
1462
1481
|
* parseable by `BigInt` is acceptable.
|
|
@@ -1469,23 +1488,23 @@ var stxTransferStxParamsSchema = v34.object({
|
|
|
1469
1488
|
* const amount3 = '1234';
|
|
1470
1489
|
* ```
|
|
1471
1490
|
*/
|
|
1472
|
-
amount:
|
|
1491
|
+
amount: v35.union([v35.number(), v35.string()]),
|
|
1473
1492
|
/**
|
|
1474
1493
|
* The recipient's principal.
|
|
1475
1494
|
*/
|
|
1476
|
-
recipient:
|
|
1495
|
+
recipient: v35.string(),
|
|
1477
1496
|
/**
|
|
1478
1497
|
* A string representing the memo.
|
|
1479
1498
|
*/
|
|
1480
|
-
memo:
|
|
1499
|
+
memo: v35.optional(v35.string()),
|
|
1481
1500
|
/**
|
|
1482
1501
|
* Version of parameter format.
|
|
1483
1502
|
*/
|
|
1484
|
-
version:
|
|
1503
|
+
version: v35.optional(v35.string()),
|
|
1485
1504
|
/**
|
|
1486
1505
|
* The mode of the post conditions.
|
|
1487
1506
|
*/
|
|
1488
|
-
postConditionMode:
|
|
1507
|
+
postConditionMode: v35.optional(v35.number()),
|
|
1489
1508
|
/**
|
|
1490
1509
|
* A hex-encoded string representing the post conditions.
|
|
1491
1510
|
*
|
|
@@ -1498,29 +1517,29 @@ var stxTransferStxParamsSchema = v34.object({
|
|
|
1498
1517
|
* const hexPostCondition = serializePostCondition(postCondition).toString('hex');
|
|
1499
1518
|
* ```
|
|
1500
1519
|
*/
|
|
1501
|
-
postConditions:
|
|
1520
|
+
postConditions: v35.optional(v35.array(v35.string())),
|
|
1502
1521
|
/**
|
|
1503
1522
|
* The public key to sign the transaction with. The wallet may use any key
|
|
1504
1523
|
* when not provided.
|
|
1505
1524
|
*/
|
|
1506
|
-
pubkey:
|
|
1525
|
+
pubkey: v35.optional(v35.string())
|
|
1507
1526
|
});
|
|
1508
|
-
var stxTransferStxResultSchema =
|
|
1527
|
+
var stxTransferStxResultSchema = v35.object({
|
|
1509
1528
|
/**
|
|
1510
1529
|
* The ID of the transaction.
|
|
1511
1530
|
*/
|
|
1512
|
-
txid:
|
|
1531
|
+
txid: v35.string(),
|
|
1513
1532
|
/**
|
|
1514
1533
|
* A Stacks transaction as a hex-encoded string.
|
|
1515
1534
|
*/
|
|
1516
|
-
transaction:
|
|
1535
|
+
transaction: v35.string()
|
|
1517
1536
|
});
|
|
1518
|
-
var stxTransferStxRequestMessageSchema =
|
|
1537
|
+
var stxTransferStxRequestMessageSchema = v35.object({
|
|
1519
1538
|
...rpcRequestMessageSchema.entries,
|
|
1520
|
-
...
|
|
1521
|
-
method:
|
|
1539
|
+
...v35.object({
|
|
1540
|
+
method: v35.literal(stxTransferStxMethodName),
|
|
1522
1541
|
params: stxTransferStxParamsSchema,
|
|
1523
|
-
id:
|
|
1542
|
+
id: v35.string()
|
|
1524
1543
|
}).entries
|
|
1525
1544
|
});
|
|
1526
1545
|
|
|
@@ -1528,13 +1547,13 @@ var stxTransferStxRequestMessageSchema = v34.object({
|
|
|
1528
1547
|
var cache = {};
|
|
1529
1548
|
var requestInternal = async (provider, method, params) => {
|
|
1530
1549
|
const response = await provider.request(method, params);
|
|
1531
|
-
if (
|
|
1550
|
+
if (v36.is(rpcErrorResponseMessageSchema, response)) {
|
|
1532
1551
|
return {
|
|
1533
1552
|
status: "error",
|
|
1534
1553
|
error: response.error
|
|
1535
1554
|
};
|
|
1536
1555
|
}
|
|
1537
|
-
if (
|
|
1556
|
+
if (v36.is(rpcSuccessResponseMessageSchema, response)) {
|
|
1538
1557
|
return {
|
|
1539
1558
|
status: "success",
|
|
1540
1559
|
result: response.result
|
|
@@ -2737,6 +2756,10 @@ export {
|
|
|
2737
2756
|
sparkFlashnetSignIntentParamsSchema,
|
|
2738
2757
|
sparkFlashnetSignIntentRequestMessageSchema,
|
|
2739
2758
|
sparkFlashnetSignIntentResultSchema,
|
|
2759
|
+
sparkFlashnetSignStructuredMessageMethodName,
|
|
2760
|
+
sparkFlashnetSignStructuredMessageParamsSchema,
|
|
2761
|
+
sparkFlashnetSignStructuredMessageRequestMessageSchema,
|
|
2762
|
+
sparkFlashnetSignStructuredMessageResultSchema,
|
|
2740
2763
|
sparkFlashnetSwapIntentSchema,
|
|
2741
2764
|
sparkGetAddressesMethodName,
|
|
2742
2765
|
sparkGetAddressesParamsSchema,
|