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