@sats-connect/core 0.8.0 → 0.8.1-29f926e
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 +29 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +173 -140
- package/dist/index.mjs +169 -140
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -180,6 +180,10 @@ __export(index_exports, {
|
|
|
180
180
|
sparkGetBalanceParamsSchema: () => sparkGetBalanceParamsSchema,
|
|
181
181
|
sparkGetBalanceRequestMessageSchema: () => sparkGetBalanceRequestMessageSchema,
|
|
182
182
|
sparkGetBalanceResultSchema: () => sparkGetBalanceResultSchema,
|
|
183
|
+
sparkSignMessageMethodName: () => sparkSignMessageMethodName,
|
|
184
|
+
sparkSignMessageParamsSchema: () => sparkSignMessageParamsSchema,
|
|
185
|
+
sparkSignMessageRequestMessageSchema: () => sparkSignMessageRequestMessageSchema,
|
|
186
|
+
sparkSignMessageResultSchema: () => sparkSignMessageResultSchema,
|
|
183
187
|
sparkTransferMethodName: () => sparkTransferMethodName,
|
|
184
188
|
sparkTransferParamsSchema: () => sparkTransferParamsSchema,
|
|
185
189
|
sparkTransferRequestMessageSchema: () => sparkTransferRequestMessageSchema,
|
|
@@ -426,7 +430,7 @@ function getSupportedWallets() {
|
|
|
426
430
|
}
|
|
427
431
|
|
|
428
432
|
// src/request/index.ts
|
|
429
|
-
var
|
|
433
|
+
var v26 = __toESM(require("valibot"));
|
|
430
434
|
|
|
431
435
|
// src/request/types/btcMethods.ts
|
|
432
436
|
var v6 = __toESM(require("valibot"));
|
|
@@ -1098,87 +1102,112 @@ var sparkGetBalanceRequestMessageSchema = v13.object({
|
|
|
1098
1102
|
}).entries
|
|
1099
1103
|
});
|
|
1100
1104
|
|
|
1101
|
-
// src/request/types/sparkMethods/
|
|
1105
|
+
// src/request/types/sparkMethods/signMessage.ts
|
|
1102
1106
|
var v14 = __toESM(require("valibot"));
|
|
1107
|
+
var sparkSignMessageMethodName = "spark_signMessage";
|
|
1108
|
+
var sparkSignMessageParamsSchema = v14.object({
|
|
1109
|
+
message: v14.string()
|
|
1110
|
+
});
|
|
1111
|
+
var sparkSignMessageResultSchema = v14.object({
|
|
1112
|
+
/**
|
|
1113
|
+
* The signature for the message in hex format
|
|
1114
|
+
*/
|
|
1115
|
+
signature: v14.string(),
|
|
1116
|
+
/**
|
|
1117
|
+
* The address that signed the message
|
|
1118
|
+
*/
|
|
1119
|
+
address: v14.string()
|
|
1120
|
+
});
|
|
1121
|
+
var sparkSignMessageRequestMessageSchema = v14.object({
|
|
1122
|
+
...rpcRequestMessageSchema.entries,
|
|
1123
|
+
...v14.object({
|
|
1124
|
+
method: v14.literal(sparkSignMessageMethodName),
|
|
1125
|
+
params: sparkSignMessageParamsSchema,
|
|
1126
|
+
id: v14.string()
|
|
1127
|
+
}).entries
|
|
1128
|
+
});
|
|
1129
|
+
|
|
1130
|
+
// src/request/types/sparkMethods/transfer.ts
|
|
1131
|
+
var v15 = __toESM(require("valibot"));
|
|
1103
1132
|
var sparkTransferMethodName = "spark_transfer";
|
|
1104
|
-
var sparkTransferParamsSchema =
|
|
1133
|
+
var sparkTransferParamsSchema = v15.object({
|
|
1105
1134
|
/**
|
|
1106
1135
|
* Amount of SATS to transfer as a string or number.
|
|
1107
1136
|
*/
|
|
1108
|
-
amountSats:
|
|
1137
|
+
amountSats: v15.union([v15.number(), v15.string()]),
|
|
1109
1138
|
/**
|
|
1110
1139
|
* The recipient's spark address.
|
|
1111
1140
|
*/
|
|
1112
|
-
receiverSparkAddress:
|
|
1141
|
+
receiverSparkAddress: v15.string()
|
|
1113
1142
|
});
|
|
1114
|
-
var sparkTransferResultSchema =
|
|
1143
|
+
var sparkTransferResultSchema = v15.object({
|
|
1115
1144
|
/**
|
|
1116
1145
|
* The ID of the transaction.
|
|
1117
1146
|
*/
|
|
1118
|
-
id:
|
|
1147
|
+
id: v15.string()
|
|
1119
1148
|
});
|
|
1120
|
-
var sparkTransferRequestMessageSchema =
|
|
1149
|
+
var sparkTransferRequestMessageSchema = v15.object({
|
|
1121
1150
|
...rpcRequestMessageSchema.entries,
|
|
1122
|
-
...
|
|
1123
|
-
method:
|
|
1151
|
+
...v15.object({
|
|
1152
|
+
method: v15.literal(sparkTransferMethodName),
|
|
1124
1153
|
params: sparkTransferParamsSchema,
|
|
1125
|
-
id:
|
|
1154
|
+
id: v15.string()
|
|
1126
1155
|
}).entries
|
|
1127
1156
|
});
|
|
1128
1157
|
|
|
1129
1158
|
// src/request/types/sparkMethods/transferToken.ts
|
|
1130
|
-
var
|
|
1159
|
+
var v16 = __toESM(require("valibot"));
|
|
1131
1160
|
var sparkTransferTokenMethodName = "spark_transferToken";
|
|
1132
|
-
var sparkTransferTokenParamsSchema =
|
|
1161
|
+
var sparkTransferTokenParamsSchema = v16.object({
|
|
1133
1162
|
/**
|
|
1134
1163
|
* Amount of units of the token to transfer as a string or number.
|
|
1135
1164
|
*/
|
|
1136
|
-
tokenAmount:
|
|
1165
|
+
tokenAmount: v16.union([v16.number(), v16.string()]),
|
|
1137
1166
|
/**
|
|
1138
1167
|
* The Bech32m token identifier.
|
|
1139
1168
|
*/
|
|
1140
|
-
tokenIdentifier:
|
|
1169
|
+
tokenIdentifier: v16.string(),
|
|
1141
1170
|
/**
|
|
1142
1171
|
* The recipient's spark address.
|
|
1143
1172
|
*/
|
|
1144
|
-
receiverSparkAddress:
|
|
1173
|
+
receiverSparkAddress: v16.string()
|
|
1145
1174
|
});
|
|
1146
|
-
var sparkTransferTokenResultSchema =
|
|
1175
|
+
var sparkTransferTokenResultSchema = v16.object({
|
|
1147
1176
|
/**
|
|
1148
1177
|
* The ID of the transaction.
|
|
1149
1178
|
*/
|
|
1150
|
-
id:
|
|
1179
|
+
id: v16.string()
|
|
1151
1180
|
});
|
|
1152
|
-
var sparkTransferTokenRequestMessageSchema =
|
|
1181
|
+
var sparkTransferTokenRequestMessageSchema = v16.object({
|
|
1153
1182
|
...rpcRequestMessageSchema.entries,
|
|
1154
|
-
...
|
|
1155
|
-
method:
|
|
1183
|
+
...v16.object({
|
|
1184
|
+
method: v16.literal(sparkTransferTokenMethodName),
|
|
1156
1185
|
params: sparkTransferTokenParamsSchema,
|
|
1157
|
-
id:
|
|
1186
|
+
id: v16.string()
|
|
1158
1187
|
}).entries
|
|
1159
1188
|
});
|
|
1160
1189
|
|
|
1161
1190
|
// src/request/types/stxMethods/callContract.ts
|
|
1162
|
-
var
|
|
1191
|
+
var v17 = __toESM(require("valibot"));
|
|
1163
1192
|
var stxCallContractMethodName = "stx_callContract";
|
|
1164
|
-
var stxCallContractParamsSchema =
|
|
1193
|
+
var stxCallContractParamsSchema = v17.object({
|
|
1165
1194
|
/**
|
|
1166
1195
|
* The contract principal.
|
|
1167
1196
|
*
|
|
1168
1197
|
* E.g. `"SPKE...GD5C.my-contract"`
|
|
1169
1198
|
*/
|
|
1170
|
-
contract:
|
|
1199
|
+
contract: v17.string(),
|
|
1171
1200
|
/**
|
|
1172
1201
|
* The name of the function to call.
|
|
1173
1202
|
*
|
|
1174
1203
|
* Note: spec changes ongoing,
|
|
1175
1204
|
* https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
|
|
1176
1205
|
*/
|
|
1177
|
-
functionName:
|
|
1206
|
+
functionName: v17.string(),
|
|
1178
1207
|
/**
|
|
1179
1208
|
* @deprecated in favor of `functionArgs` for @stacks/connect compatibility
|
|
1180
1209
|
*/
|
|
1181
|
-
arguments:
|
|
1210
|
+
arguments: v17.optional(v17.array(v17.string())),
|
|
1182
1211
|
/**
|
|
1183
1212
|
* The function's arguments. The arguments are expected to be hex-encoded
|
|
1184
1213
|
* strings of Clarity values.
|
|
@@ -1193,274 +1222,274 @@ var stxCallContractParamsSchema = v16.object({
|
|
|
1193
1222
|
* const hexArgs = functionArgs.map(cvToHex);
|
|
1194
1223
|
* ```
|
|
1195
1224
|
*/
|
|
1196
|
-
functionArgs:
|
|
1225
|
+
functionArgs: v17.optional(v17.array(v17.string())),
|
|
1197
1226
|
/**
|
|
1198
1227
|
* The post conditions to apply to the contract call.
|
|
1199
1228
|
*/
|
|
1200
|
-
postConditions:
|
|
1229
|
+
postConditions: v17.optional(v17.array(v17.string())),
|
|
1201
1230
|
/**
|
|
1202
1231
|
* The mode to apply to the post conditions.
|
|
1203
1232
|
*/
|
|
1204
|
-
postConditionMode:
|
|
1233
|
+
postConditionMode: v17.optional(v17.union([v17.literal("allow"), v17.literal("deny")]))
|
|
1205
1234
|
});
|
|
1206
|
-
var stxCallContractResultSchema =
|
|
1235
|
+
var stxCallContractResultSchema = v17.object({
|
|
1207
1236
|
/**
|
|
1208
1237
|
* The ID of the transaction.
|
|
1209
1238
|
*/
|
|
1210
|
-
txid:
|
|
1239
|
+
txid: v17.string(),
|
|
1211
1240
|
/**
|
|
1212
1241
|
* A Stacks transaction as a hex-encoded string.
|
|
1213
1242
|
*/
|
|
1214
|
-
transaction:
|
|
1243
|
+
transaction: v17.string()
|
|
1215
1244
|
});
|
|
1216
|
-
var stxCallContractRequestMessageSchema =
|
|
1245
|
+
var stxCallContractRequestMessageSchema = v17.object({
|
|
1217
1246
|
...rpcRequestMessageSchema.entries,
|
|
1218
|
-
...
|
|
1219
|
-
method:
|
|
1247
|
+
...v17.object({
|
|
1248
|
+
method: v17.literal(stxCallContractMethodName),
|
|
1220
1249
|
params: stxCallContractParamsSchema,
|
|
1221
|
-
id:
|
|
1250
|
+
id: v17.string()
|
|
1222
1251
|
}).entries
|
|
1223
1252
|
});
|
|
1224
1253
|
|
|
1225
1254
|
// src/request/types/stxMethods/deployContract.ts
|
|
1226
|
-
var
|
|
1255
|
+
var v18 = __toESM(require("valibot"));
|
|
1227
1256
|
var stxDeployContractMethodName = "stx_deployContract";
|
|
1228
|
-
var stxDeployContractParamsSchema =
|
|
1257
|
+
var stxDeployContractParamsSchema = v18.object({
|
|
1229
1258
|
/**
|
|
1230
1259
|
* Name of the contract.
|
|
1231
1260
|
*/
|
|
1232
|
-
name:
|
|
1261
|
+
name: v18.string(),
|
|
1233
1262
|
/**
|
|
1234
1263
|
* The source code of the Clarity contract.
|
|
1235
1264
|
*/
|
|
1236
|
-
clarityCode:
|
|
1265
|
+
clarityCode: v18.string(),
|
|
1237
1266
|
/**
|
|
1238
1267
|
* The version of the Clarity contract.
|
|
1239
1268
|
*/
|
|
1240
|
-
clarityVersion:
|
|
1269
|
+
clarityVersion: v18.optional(v18.number()),
|
|
1241
1270
|
/**
|
|
1242
1271
|
* The post conditions to apply to the contract call.
|
|
1243
1272
|
*/
|
|
1244
|
-
postConditions:
|
|
1273
|
+
postConditions: v18.optional(v18.array(v18.string())),
|
|
1245
1274
|
/**
|
|
1246
1275
|
* The mode to apply to the post conditions.
|
|
1247
1276
|
*/
|
|
1248
|
-
postConditionMode:
|
|
1277
|
+
postConditionMode: v18.optional(v18.union([v18.literal("allow"), v18.literal("deny")]))
|
|
1249
1278
|
});
|
|
1250
|
-
var stxDeployContractResultSchema =
|
|
1279
|
+
var stxDeployContractResultSchema = v18.object({
|
|
1251
1280
|
/**
|
|
1252
1281
|
* The ID of the transaction.
|
|
1253
1282
|
*/
|
|
1254
|
-
txid:
|
|
1283
|
+
txid: v18.string(),
|
|
1255
1284
|
/**
|
|
1256
1285
|
* A Stacks transaction as a hex-encoded string.
|
|
1257
1286
|
*/
|
|
1258
|
-
transaction:
|
|
1287
|
+
transaction: v18.string()
|
|
1259
1288
|
});
|
|
1260
|
-
var stxDeployContractRequestMessageSchema =
|
|
1289
|
+
var stxDeployContractRequestMessageSchema = v18.object({
|
|
1261
1290
|
...rpcRequestMessageSchema.entries,
|
|
1262
|
-
...
|
|
1263
|
-
method:
|
|
1291
|
+
...v18.object({
|
|
1292
|
+
method: v18.literal(stxDeployContractMethodName),
|
|
1264
1293
|
params: stxDeployContractParamsSchema,
|
|
1265
|
-
id:
|
|
1294
|
+
id: v18.string()
|
|
1266
1295
|
}).entries
|
|
1267
1296
|
});
|
|
1268
1297
|
|
|
1269
1298
|
// src/request/types/stxMethods/getAccounts.ts
|
|
1270
|
-
var
|
|
1299
|
+
var v19 = __toESM(require("valibot"));
|
|
1271
1300
|
var stxGetAccountsMethodName = "stx_getAccounts";
|
|
1272
|
-
var stxGetAccountsParamsSchema =
|
|
1273
|
-
var stxGetAccountsResultSchema =
|
|
1301
|
+
var stxGetAccountsParamsSchema = v19.nullish(v19.null());
|
|
1302
|
+
var stxGetAccountsResultSchema = v19.object({
|
|
1274
1303
|
/**
|
|
1275
1304
|
* The addresses generated for the given purposes.
|
|
1276
1305
|
*/
|
|
1277
|
-
addresses:
|
|
1278
|
-
|
|
1279
|
-
address:
|
|
1280
|
-
publicKey:
|
|
1281
|
-
gaiaHubUrl:
|
|
1282
|
-
gaiaAppKey:
|
|
1306
|
+
addresses: v19.array(
|
|
1307
|
+
v19.object({
|
|
1308
|
+
address: v19.string(),
|
|
1309
|
+
publicKey: v19.string(),
|
|
1310
|
+
gaiaHubUrl: v19.string(),
|
|
1311
|
+
gaiaAppKey: v19.string()
|
|
1283
1312
|
})
|
|
1284
1313
|
),
|
|
1285
1314
|
network: getNetworkResultSchema
|
|
1286
1315
|
});
|
|
1287
|
-
var stxGetAccountsRequestMessageSchema =
|
|
1316
|
+
var stxGetAccountsRequestMessageSchema = v19.object({
|
|
1288
1317
|
...rpcRequestMessageSchema.entries,
|
|
1289
|
-
...
|
|
1290
|
-
method:
|
|
1318
|
+
...v19.object({
|
|
1319
|
+
method: v19.literal(stxGetAccountsMethodName),
|
|
1291
1320
|
params: stxGetAccountsParamsSchema,
|
|
1292
|
-
id:
|
|
1321
|
+
id: v19.string()
|
|
1293
1322
|
}).entries
|
|
1294
1323
|
});
|
|
1295
1324
|
|
|
1296
1325
|
// src/request/types/stxMethods/getAddresses.ts
|
|
1297
|
-
var
|
|
1326
|
+
var v20 = __toESM(require("valibot"));
|
|
1298
1327
|
var stxGetAddressesMethodName = "stx_getAddresses";
|
|
1299
|
-
var stxGetAddressesParamsSchema =
|
|
1300
|
-
|
|
1328
|
+
var stxGetAddressesParamsSchema = v20.nullish(
|
|
1329
|
+
v20.object({
|
|
1301
1330
|
/**
|
|
1302
1331
|
* A message to be displayed to the user in the request prompt.
|
|
1303
1332
|
*/
|
|
1304
|
-
message:
|
|
1333
|
+
message: v20.optional(v20.string())
|
|
1305
1334
|
})
|
|
1306
1335
|
);
|
|
1307
|
-
var stxGetAddressesResultSchema =
|
|
1336
|
+
var stxGetAddressesResultSchema = v20.object({
|
|
1308
1337
|
/**
|
|
1309
1338
|
* The addresses generated for the given purposes.
|
|
1310
1339
|
*/
|
|
1311
|
-
addresses:
|
|
1340
|
+
addresses: v20.array(addressSchema),
|
|
1312
1341
|
network: getNetworkResultSchema
|
|
1313
1342
|
});
|
|
1314
|
-
var stxGetAddressesRequestMessageSchema =
|
|
1343
|
+
var stxGetAddressesRequestMessageSchema = v20.object({
|
|
1315
1344
|
...rpcRequestMessageSchema.entries,
|
|
1316
|
-
...
|
|
1317
|
-
method:
|
|
1345
|
+
...v20.object({
|
|
1346
|
+
method: v20.literal(stxGetAddressesMethodName),
|
|
1318
1347
|
params: stxGetAddressesParamsSchema,
|
|
1319
|
-
id:
|
|
1348
|
+
id: v20.string()
|
|
1320
1349
|
}).entries
|
|
1321
1350
|
});
|
|
1322
1351
|
|
|
1323
1352
|
// src/request/types/stxMethods/signMessage.ts
|
|
1324
|
-
var
|
|
1353
|
+
var v21 = __toESM(require("valibot"));
|
|
1325
1354
|
var stxSignMessageMethodName = "stx_signMessage";
|
|
1326
|
-
var stxSignMessageParamsSchema =
|
|
1355
|
+
var stxSignMessageParamsSchema = v21.object({
|
|
1327
1356
|
/**
|
|
1328
1357
|
* The message to sign.
|
|
1329
1358
|
*/
|
|
1330
|
-
message:
|
|
1359
|
+
message: v21.string()
|
|
1331
1360
|
});
|
|
1332
|
-
var stxSignMessageResultSchema =
|
|
1361
|
+
var stxSignMessageResultSchema = v21.object({
|
|
1333
1362
|
/**
|
|
1334
1363
|
* The signature of the message.
|
|
1335
1364
|
*/
|
|
1336
|
-
signature:
|
|
1365
|
+
signature: v21.string(),
|
|
1337
1366
|
/**
|
|
1338
1367
|
* The public key used to sign the message.
|
|
1339
1368
|
*/
|
|
1340
|
-
publicKey:
|
|
1369
|
+
publicKey: v21.string()
|
|
1341
1370
|
});
|
|
1342
|
-
var stxSignMessageRequestMessageSchema =
|
|
1371
|
+
var stxSignMessageRequestMessageSchema = v21.object({
|
|
1343
1372
|
...rpcRequestMessageSchema.entries,
|
|
1344
|
-
...
|
|
1345
|
-
method:
|
|
1373
|
+
...v21.object({
|
|
1374
|
+
method: v21.literal(stxSignMessageMethodName),
|
|
1346
1375
|
params: stxSignMessageParamsSchema,
|
|
1347
|
-
id:
|
|
1376
|
+
id: v21.string()
|
|
1348
1377
|
}).entries
|
|
1349
1378
|
});
|
|
1350
1379
|
|
|
1351
1380
|
// src/request/types/stxMethods/signStructuredMessage.ts
|
|
1352
|
-
var
|
|
1381
|
+
var v22 = __toESM(require("valibot"));
|
|
1353
1382
|
var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
|
|
1354
|
-
var stxSignStructuredMessageParamsSchema =
|
|
1383
|
+
var stxSignStructuredMessageParamsSchema = v22.object({
|
|
1355
1384
|
/**
|
|
1356
1385
|
* The domain to be signed.
|
|
1357
1386
|
*/
|
|
1358
|
-
domain:
|
|
1387
|
+
domain: v22.string(),
|
|
1359
1388
|
/**
|
|
1360
1389
|
* Message payload to be signed.
|
|
1361
1390
|
*/
|
|
1362
|
-
message:
|
|
1391
|
+
message: v22.string(),
|
|
1363
1392
|
/**
|
|
1364
1393
|
* The public key to sign the message with.
|
|
1365
1394
|
*/
|
|
1366
|
-
publicKey:
|
|
1395
|
+
publicKey: v22.optional(v22.string())
|
|
1367
1396
|
});
|
|
1368
|
-
var stxSignStructuredMessageResultSchema =
|
|
1397
|
+
var stxSignStructuredMessageResultSchema = v22.object({
|
|
1369
1398
|
/**
|
|
1370
1399
|
* Signature of the message.
|
|
1371
1400
|
*/
|
|
1372
|
-
signature:
|
|
1401
|
+
signature: v22.string(),
|
|
1373
1402
|
/**
|
|
1374
1403
|
* Public key as hex-encoded string.
|
|
1375
1404
|
*/
|
|
1376
|
-
publicKey:
|
|
1405
|
+
publicKey: v22.string()
|
|
1377
1406
|
});
|
|
1378
|
-
var stxSignStructuredMessageRequestMessageSchema =
|
|
1407
|
+
var stxSignStructuredMessageRequestMessageSchema = v22.object({
|
|
1379
1408
|
...rpcRequestMessageSchema.entries,
|
|
1380
|
-
...
|
|
1381
|
-
method:
|
|
1409
|
+
...v22.object({
|
|
1410
|
+
method: v22.literal(stxSignStructuredMessageMethodName),
|
|
1382
1411
|
params: stxSignStructuredMessageParamsSchema,
|
|
1383
|
-
id:
|
|
1412
|
+
id: v22.string()
|
|
1384
1413
|
}).entries
|
|
1385
1414
|
});
|
|
1386
1415
|
|
|
1387
1416
|
// src/request/types/stxMethods/signTransaction.ts
|
|
1388
|
-
var
|
|
1417
|
+
var v23 = __toESM(require("valibot"));
|
|
1389
1418
|
var stxSignTransactionMethodName = "stx_signTransaction";
|
|
1390
|
-
var stxSignTransactionParamsSchema =
|
|
1419
|
+
var stxSignTransactionParamsSchema = v23.object({
|
|
1391
1420
|
/**
|
|
1392
1421
|
* The transaction to sign as a hex-encoded string.
|
|
1393
1422
|
*/
|
|
1394
|
-
transaction:
|
|
1423
|
+
transaction: v23.string(),
|
|
1395
1424
|
/**
|
|
1396
1425
|
* The public key to sign the transaction with. The wallet may use any key
|
|
1397
1426
|
* when not provided.
|
|
1398
1427
|
*/
|
|
1399
|
-
pubkey:
|
|
1428
|
+
pubkey: v23.optional(v23.string()),
|
|
1400
1429
|
/**
|
|
1401
1430
|
* Whether to broadcast the transaction after signing. Defaults to `true`.
|
|
1402
1431
|
*/
|
|
1403
|
-
broadcast:
|
|
1432
|
+
broadcast: v23.optional(v23.boolean())
|
|
1404
1433
|
});
|
|
1405
|
-
var stxSignTransactionResultSchema =
|
|
1434
|
+
var stxSignTransactionResultSchema = v23.object({
|
|
1406
1435
|
/**
|
|
1407
1436
|
* The signed transaction as a hex-encoded string.
|
|
1408
1437
|
*/
|
|
1409
|
-
transaction:
|
|
1438
|
+
transaction: v23.string()
|
|
1410
1439
|
});
|
|
1411
|
-
var stxSignTransactionRequestMessageSchema =
|
|
1440
|
+
var stxSignTransactionRequestMessageSchema = v23.object({
|
|
1412
1441
|
...rpcRequestMessageSchema.entries,
|
|
1413
|
-
...
|
|
1414
|
-
method:
|
|
1442
|
+
...v23.object({
|
|
1443
|
+
method: v23.literal(stxSignTransactionMethodName),
|
|
1415
1444
|
params: stxSignTransactionParamsSchema,
|
|
1416
|
-
id:
|
|
1445
|
+
id: v23.string()
|
|
1417
1446
|
}).entries
|
|
1418
1447
|
});
|
|
1419
1448
|
|
|
1420
1449
|
// src/request/types/stxMethods/signTransactions.ts
|
|
1421
|
-
var
|
|
1450
|
+
var v24 = __toESM(require("valibot"));
|
|
1422
1451
|
var stxSignTransactionsMethodName = "stx_signTransactions";
|
|
1423
|
-
var stxSignTransactionsParamsSchema =
|
|
1452
|
+
var stxSignTransactionsParamsSchema = v24.object({
|
|
1424
1453
|
/**
|
|
1425
1454
|
* The transactions to sign as hex-encoded strings.
|
|
1426
1455
|
*/
|
|
1427
|
-
transactions:
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1456
|
+
transactions: v24.pipe(
|
|
1457
|
+
v24.array(
|
|
1458
|
+
v24.pipe(
|
|
1459
|
+
v24.string(),
|
|
1460
|
+
v24.check((hex) => {
|
|
1432
1461
|
return true;
|
|
1433
1462
|
}, "Invalid hex-encoded Stacks transaction.")
|
|
1434
1463
|
)
|
|
1435
1464
|
),
|
|
1436
|
-
|
|
1465
|
+
v24.minLength(1)
|
|
1437
1466
|
),
|
|
1438
1467
|
/**
|
|
1439
1468
|
* Whether the signed transactions should be broadcast after signing. Defaults
|
|
1440
1469
|
* to `true`.
|
|
1441
1470
|
*/
|
|
1442
|
-
broadcast:
|
|
1471
|
+
broadcast: v24.optional(v24.boolean())
|
|
1443
1472
|
});
|
|
1444
|
-
var stxSignTransactionsResultSchema =
|
|
1473
|
+
var stxSignTransactionsResultSchema = v24.object({
|
|
1445
1474
|
/**
|
|
1446
1475
|
* The signed transactions as hex-encoded strings, in the same order as in the
|
|
1447
1476
|
* sign request.
|
|
1448
1477
|
*/
|
|
1449
|
-
transactions:
|
|
1478
|
+
transactions: v24.array(v24.string())
|
|
1450
1479
|
});
|
|
1451
|
-
var stxSignTransactionsRequestMessageSchema =
|
|
1480
|
+
var stxSignTransactionsRequestMessageSchema = v24.object({
|
|
1452
1481
|
...rpcRequestMessageSchema.entries,
|
|
1453
|
-
...
|
|
1454
|
-
method:
|
|
1482
|
+
...v24.object({
|
|
1483
|
+
method: v24.literal(stxSignTransactionsMethodName),
|
|
1455
1484
|
params: stxSignTransactionsParamsSchema,
|
|
1456
|
-
id:
|
|
1485
|
+
id: v24.string()
|
|
1457
1486
|
}).entries
|
|
1458
1487
|
});
|
|
1459
1488
|
|
|
1460
1489
|
// src/request/types/stxMethods/transferStx.ts
|
|
1461
|
-
var
|
|
1490
|
+
var v25 = __toESM(require("valibot"));
|
|
1462
1491
|
var stxTransferStxMethodName = "stx_transferStx";
|
|
1463
|
-
var stxTransferStxParamsSchema =
|
|
1492
|
+
var stxTransferStxParamsSchema = v25.object({
|
|
1464
1493
|
/**
|
|
1465
1494
|
* Amount of STX tokens to transfer in microstacks as a string. Anything
|
|
1466
1495
|
* parseable by `BigInt` is acceptable.
|
|
@@ -1473,23 +1502,23 @@ var stxTransferStxParamsSchema = v24.object({
|
|
|
1473
1502
|
* const amount3 = '1234';
|
|
1474
1503
|
* ```
|
|
1475
1504
|
*/
|
|
1476
|
-
amount:
|
|
1505
|
+
amount: v25.union([v25.number(), v25.string()]),
|
|
1477
1506
|
/**
|
|
1478
1507
|
* The recipient's principal.
|
|
1479
1508
|
*/
|
|
1480
|
-
recipient:
|
|
1509
|
+
recipient: v25.string(),
|
|
1481
1510
|
/**
|
|
1482
1511
|
* A string representing the memo.
|
|
1483
1512
|
*/
|
|
1484
|
-
memo:
|
|
1513
|
+
memo: v25.optional(v25.string()),
|
|
1485
1514
|
/**
|
|
1486
1515
|
* Version of parameter format.
|
|
1487
1516
|
*/
|
|
1488
|
-
version:
|
|
1517
|
+
version: v25.optional(v25.string()),
|
|
1489
1518
|
/**
|
|
1490
1519
|
* The mode of the post conditions.
|
|
1491
1520
|
*/
|
|
1492
|
-
postConditionMode:
|
|
1521
|
+
postConditionMode: v25.optional(v25.number()),
|
|
1493
1522
|
/**
|
|
1494
1523
|
* A hex-encoded string representing the post conditions.
|
|
1495
1524
|
*
|
|
@@ -1502,29 +1531,29 @@ var stxTransferStxParamsSchema = v24.object({
|
|
|
1502
1531
|
* const hexPostCondition = serializePostCondition(postCondition).toString('hex');
|
|
1503
1532
|
* ```
|
|
1504
1533
|
*/
|
|
1505
|
-
postConditions:
|
|
1534
|
+
postConditions: v25.optional(v25.array(v25.string())),
|
|
1506
1535
|
/**
|
|
1507
1536
|
* The public key to sign the transaction with. The wallet may use any key
|
|
1508
1537
|
* when not provided.
|
|
1509
1538
|
*/
|
|
1510
|
-
pubkey:
|
|
1539
|
+
pubkey: v25.optional(v25.string())
|
|
1511
1540
|
});
|
|
1512
|
-
var stxTransferStxResultSchema =
|
|
1541
|
+
var stxTransferStxResultSchema = v25.object({
|
|
1513
1542
|
/**
|
|
1514
1543
|
* The ID of the transaction.
|
|
1515
1544
|
*/
|
|
1516
|
-
txid:
|
|
1545
|
+
txid: v25.string(),
|
|
1517
1546
|
/**
|
|
1518
1547
|
* A Stacks transaction as a hex-encoded string.
|
|
1519
1548
|
*/
|
|
1520
|
-
transaction:
|
|
1549
|
+
transaction: v25.string()
|
|
1521
1550
|
});
|
|
1522
|
-
var stxTransferStxRequestMessageSchema =
|
|
1551
|
+
var stxTransferStxRequestMessageSchema = v25.object({
|
|
1523
1552
|
...rpcRequestMessageSchema.entries,
|
|
1524
|
-
...
|
|
1525
|
-
method:
|
|
1553
|
+
...v25.object({
|
|
1554
|
+
method: v25.literal(stxTransferStxMethodName),
|
|
1526
1555
|
params: stxTransferStxParamsSchema,
|
|
1527
|
-
id:
|
|
1556
|
+
id: v25.string()
|
|
1528
1557
|
}).entries
|
|
1529
1558
|
});
|
|
1530
1559
|
|
|
@@ -1541,13 +1570,13 @@ var request = async (method, params, providerId) => {
|
|
|
1541
1570
|
throw new Error("A wallet method is required");
|
|
1542
1571
|
}
|
|
1543
1572
|
const response = await provider.request(method, params);
|
|
1544
|
-
if (
|
|
1573
|
+
if (v26.is(rpcErrorResponseMessageSchema, response)) {
|
|
1545
1574
|
return {
|
|
1546
1575
|
status: "error",
|
|
1547
1576
|
error: response.error
|
|
1548
1577
|
};
|
|
1549
1578
|
}
|
|
1550
|
-
if (
|
|
1579
|
+
if (v26.is(rpcSuccessResponseMessageSchema, response)) {
|
|
1551
1580
|
return {
|
|
1552
1581
|
status: "success",
|
|
1553
1582
|
result: response.result
|
|
@@ -2710,6 +2739,10 @@ var signMultipleTransactions = async (options) => {
|
|
|
2710
2739
|
sparkGetBalanceParamsSchema,
|
|
2711
2740
|
sparkGetBalanceRequestMessageSchema,
|
|
2712
2741
|
sparkGetBalanceResultSchema,
|
|
2742
|
+
sparkSignMessageMethodName,
|
|
2743
|
+
sparkSignMessageParamsSchema,
|
|
2744
|
+
sparkSignMessageRequestMessageSchema,
|
|
2745
|
+
sparkSignMessageResultSchema,
|
|
2713
2746
|
sparkTransferMethodName,
|
|
2714
2747
|
sparkTransferParamsSchema,
|
|
2715
2748
|
sparkTransferRequestMessageSchema,
|