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