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