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