@sats-connect/core 0.8.1 → 0.8.2-6e91f8a
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 +341 -1
- package/dist/index.d.ts +341 -1
- package/dist/index.js +467 -179
- package/dist/index.mjs +450 -179
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -37,6 +37,7 @@ __export(index_exports, {
|
|
|
37
37
|
DefaultAdaptersInfo: () => DefaultAdaptersInfo,
|
|
38
38
|
MessageSigningProtocols: () => MessageSigningProtocols,
|
|
39
39
|
PermissionRequestParams: () => PermissionRequestParams,
|
|
40
|
+
ProviderPlatform: () => ProviderPlatform,
|
|
40
41
|
RpcErrorCode: () => RpcErrorCode,
|
|
41
42
|
RpcIdSchema: () => RpcIdSchema,
|
|
42
43
|
SatsConnectAdapter: () => SatsConnectAdapter,
|
|
@@ -172,6 +173,22 @@ __export(index_exports, {
|
|
|
172
173
|
signPsbtRequestMessageSchema: () => signPsbtRequestMessageSchema,
|
|
173
174
|
signPsbtResultSchema: () => signPsbtResultSchema,
|
|
174
175
|
signTransaction: () => signTransaction,
|
|
176
|
+
sparkFlashnetAddLiquidityIntentSchema: () => sparkFlashnetAddLiquidityIntentSchema,
|
|
177
|
+
sparkFlashnetClawbackIntentSchema: () => sparkFlashnetClawbackIntentSchema,
|
|
178
|
+
sparkFlashnetConfirmInitialDepositIntentSchema: () => sparkFlashnetConfirmInitialDepositIntentSchema,
|
|
179
|
+
sparkFlashnetCreateConstantProductPoolIntentSchema: () => sparkFlashnetCreateConstantProductPoolIntentSchema,
|
|
180
|
+
sparkFlashnetCreateSingleSidedPoolIntentSchema: () => sparkFlashnetCreateSingleSidedPoolIntentSchema,
|
|
181
|
+
sparkFlashnetGetJwtMethodName: () => sparkFlashnetGetJwtMethodName,
|
|
182
|
+
sparkFlashnetGetJwtParamsSchema: () => sparkFlashnetGetJwtParamsSchema,
|
|
183
|
+
sparkFlashnetGetJwtRequestMessageSchema: () => sparkFlashnetGetJwtRequestMessageSchema,
|
|
184
|
+
sparkFlashnetGetJwtResultSchema: () => sparkFlashnetGetJwtResultSchema,
|
|
185
|
+
sparkFlashnetRemoveLiquidityIntentSchema: () => sparkFlashnetRemoveLiquidityIntentSchema,
|
|
186
|
+
sparkFlashnetRouteSwapIntentSchema: () => sparkFlashnetRouteSwapIntentSchema,
|
|
187
|
+
sparkFlashnetSignIntentMethodName: () => sparkFlashnetSignIntentMethodName,
|
|
188
|
+
sparkFlashnetSignIntentParamsSchema: () => sparkFlashnetSignIntentParamsSchema,
|
|
189
|
+
sparkFlashnetSignIntentRequestMessageSchema: () => sparkFlashnetSignIntentRequestMessageSchema,
|
|
190
|
+
sparkFlashnetSignIntentResultSchema: () => sparkFlashnetSignIntentResultSchema,
|
|
191
|
+
sparkFlashnetSwapIntentSchema: () => sparkFlashnetSwapIntentSchema,
|
|
175
192
|
sparkGetAddressesMethodName: () => sparkGetAddressesMethodName,
|
|
176
193
|
sparkGetAddressesParamsSchema: () => sparkGetAddressesParamsSchema,
|
|
177
194
|
sparkGetAddressesRequestMessageSchema: () => sparkGetAddressesRequestMessageSchema,
|
|
@@ -232,6 +249,9 @@ __export(index_exports, {
|
|
|
232
249
|
});
|
|
233
250
|
module.exports = __toCommonJS(index_exports);
|
|
234
251
|
|
|
252
|
+
// src/request/index.ts
|
|
253
|
+
var v35 = __toESM(require("valibot"));
|
|
254
|
+
|
|
235
255
|
// src/provider/types.ts
|
|
236
256
|
var v4 = __toESM(require("valibot"));
|
|
237
257
|
|
|
@@ -425,8 +445,53 @@ function getSupportedWallets() {
|
|
|
425
445
|
return wallets;
|
|
426
446
|
}
|
|
427
447
|
|
|
428
|
-
// src/request/
|
|
429
|
-
var
|
|
448
|
+
// src/request/sanitizeRequest.ts
|
|
449
|
+
var sanitizeRequest = (method, params, providerInfo) => {
|
|
450
|
+
try {
|
|
451
|
+
const [major, minor, patch] = providerInfo.version.split(".").map((part) => parseInt(part, 10));
|
|
452
|
+
const platform = providerInfo.platform;
|
|
453
|
+
if (
|
|
454
|
+
// platform is missing for versions < 1.5.0 on web and < 1.55.0 on mobile
|
|
455
|
+
!platform || platform === "web" /* Web */ && major <= 1 && minor <= 4 || platform === "mobile" /* Mobile */ && major <= 1 && minor <= 54
|
|
456
|
+
) {
|
|
457
|
+
const v1Sanitized = sanitizeAddressPurposeRequest(method, params);
|
|
458
|
+
method = v1Sanitized.method;
|
|
459
|
+
params = v1Sanitized.params;
|
|
460
|
+
}
|
|
461
|
+
} catch {
|
|
462
|
+
}
|
|
463
|
+
return { method, params };
|
|
464
|
+
};
|
|
465
|
+
var sanitizeAddressPurposeRequest = (method, params) => {
|
|
466
|
+
const filterPurposes = (purposes) => purposes?.filter(
|
|
467
|
+
(purpose) => purpose !== "spark" /* Spark */ && purpose !== "starknet" /* Starknet */
|
|
468
|
+
);
|
|
469
|
+
if (method === "wallet_connect") {
|
|
470
|
+
const typedParams = params;
|
|
471
|
+
if (!typedParams) {
|
|
472
|
+
return { method, params };
|
|
473
|
+
}
|
|
474
|
+
const { addresses, ...rest } = typedParams;
|
|
475
|
+
const overrideParams = {
|
|
476
|
+
...rest,
|
|
477
|
+
addresses: filterPurposes(addresses)
|
|
478
|
+
};
|
|
479
|
+
return { method, params: overrideParams };
|
|
480
|
+
}
|
|
481
|
+
if (method === "getAccounts") {
|
|
482
|
+
const typedParams = params;
|
|
483
|
+
const { purposes, ...rest } = typedParams;
|
|
484
|
+
const overrideParams = { ...rest, purposes: filterPurposes(purposes) };
|
|
485
|
+
return { method, params: overrideParams };
|
|
486
|
+
}
|
|
487
|
+
if (method === "getAddresses") {
|
|
488
|
+
const typedParams = params;
|
|
489
|
+
const { purposes, ...rest } = typedParams;
|
|
490
|
+
const overrideParams = { ...rest, purposes: filterPurposes(purposes) };
|
|
491
|
+
return { method, params: overrideParams };
|
|
492
|
+
}
|
|
493
|
+
return { method, params };
|
|
494
|
+
};
|
|
430
495
|
|
|
431
496
|
// src/request/types/btcMethods.ts
|
|
432
497
|
var v6 = __toESM(require("valibot"));
|
|
@@ -645,6 +710,11 @@ var addNetworkResultSchema = v5.object({
|
|
|
645
710
|
});
|
|
646
711
|
|
|
647
712
|
// src/request/types/btcMethods.ts
|
|
713
|
+
var ProviderPlatform = /* @__PURE__ */ ((ProviderPlatform2) => {
|
|
714
|
+
ProviderPlatform2["Web"] = "web";
|
|
715
|
+
ProviderPlatform2["Mobile"] = "mobile";
|
|
716
|
+
return ProviderPlatform2;
|
|
717
|
+
})(ProviderPlatform || {});
|
|
648
718
|
var getInfoMethodName = "getInfo";
|
|
649
719
|
var getInfoParamsSchema = v6.nullish(v6.null());
|
|
650
720
|
var getInfoResultSchema = v6.object({
|
|
@@ -652,6 +722,10 @@ var getInfoResultSchema = v6.object({
|
|
|
652
722
|
* Version of the wallet.
|
|
653
723
|
*/
|
|
654
724
|
version: v6.string(),
|
|
725
|
+
/**
|
|
726
|
+
* The platform the wallet is running on (web or mobile).
|
|
727
|
+
*/
|
|
728
|
+
platform: v6.optional(v6.enum(ProviderPlatform)),
|
|
655
729
|
/**
|
|
656
730
|
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
657
731
|
*/
|
|
@@ -1039,146 +1113,319 @@ var runesTransferRequestMessageSchema = v11.object({
|
|
|
1039
1113
|
}).entries
|
|
1040
1114
|
});
|
|
1041
1115
|
|
|
1042
|
-
// src/request/types/sparkMethods/
|
|
1116
|
+
// src/request/types/sparkMethods/flashnetMethods/getJwt.ts
|
|
1043
1117
|
var v12 = __toESM(require("valibot"));
|
|
1118
|
+
var sparkFlashnetGetJwtMethodName = "spark_flashnet_getJwt";
|
|
1119
|
+
var sparkFlashnetGetJwtParamsSchema = v12.null();
|
|
1120
|
+
var sparkFlashnetGetJwtResultSchema = v12.object({
|
|
1121
|
+
/**
|
|
1122
|
+
* The JWT token for authenticated requests to the Flashnet API.
|
|
1123
|
+
*/
|
|
1124
|
+
jwt: v12.string()
|
|
1125
|
+
});
|
|
1126
|
+
var sparkFlashnetGetJwtRequestMessageSchema = v12.object({
|
|
1127
|
+
...rpcRequestMessageSchema.entries,
|
|
1128
|
+
...v12.object({
|
|
1129
|
+
method: v12.literal(sparkFlashnetGetJwtMethodName),
|
|
1130
|
+
params: sparkFlashnetGetJwtParamsSchema,
|
|
1131
|
+
id: v12.string()
|
|
1132
|
+
}).entries
|
|
1133
|
+
});
|
|
1134
|
+
|
|
1135
|
+
// src/request/types/sparkMethods/flashnetMethods/intents/addLiquidity.ts
|
|
1136
|
+
var v13 = __toESM(require("valibot"));
|
|
1137
|
+
var sparkFlashnetAddLiquidityIntentSchema = v13.object({
|
|
1138
|
+
type: v13.literal("addLiquidity"),
|
|
1139
|
+
data: v13.object({
|
|
1140
|
+
userPublicKey: v13.string(),
|
|
1141
|
+
poolId: v13.string(),
|
|
1142
|
+
assetAAmount: v13.string(),
|
|
1143
|
+
assetBAmount: v13.string(),
|
|
1144
|
+
assetAMinAmountIn: v13.string(),
|
|
1145
|
+
assetBMinAmountIn: v13.string(),
|
|
1146
|
+
assetATransferId: v13.string(),
|
|
1147
|
+
assetBTransferId: v13.string(),
|
|
1148
|
+
nonce: v13.string()
|
|
1149
|
+
})
|
|
1150
|
+
});
|
|
1151
|
+
|
|
1152
|
+
// src/request/types/sparkMethods/flashnetMethods/intents/clawback.ts
|
|
1153
|
+
var v14 = __toESM(require("valibot"));
|
|
1154
|
+
var sparkFlashnetClawbackIntentSchema = v14.object({
|
|
1155
|
+
type: v14.literal("clawback"),
|
|
1156
|
+
data: v14.object({
|
|
1157
|
+
senderPublicKey: v14.string(),
|
|
1158
|
+
sparkTransferId: v14.string(),
|
|
1159
|
+
lpIdentityPublicKey: v14.string(),
|
|
1160
|
+
nonce: v14.string()
|
|
1161
|
+
})
|
|
1162
|
+
});
|
|
1163
|
+
|
|
1164
|
+
// src/request/types/sparkMethods/flashnetMethods/intents/confirmInitialDeposit.ts
|
|
1165
|
+
var v15 = __toESM(require("valibot"));
|
|
1166
|
+
var sparkFlashnetConfirmInitialDepositIntentSchema = v15.object({
|
|
1167
|
+
type: v15.literal("confirmInitialDeposit"),
|
|
1168
|
+
data: v15.object({
|
|
1169
|
+
poolId: v15.string(),
|
|
1170
|
+
assetASparkTransferId: v15.string(),
|
|
1171
|
+
poolOwnerPublicKey: v15.string(),
|
|
1172
|
+
nonce: v15.string()
|
|
1173
|
+
})
|
|
1174
|
+
});
|
|
1175
|
+
|
|
1176
|
+
// src/request/types/sparkMethods/flashnetMethods/intents/createConstantProductPool.ts
|
|
1177
|
+
var v16 = __toESM(require("valibot"));
|
|
1178
|
+
var sparkFlashnetCreateConstantProductPoolIntentSchema = v16.object({
|
|
1179
|
+
type: v16.literal("createConstantProductPool"),
|
|
1180
|
+
data: v16.object({
|
|
1181
|
+
poolOwnerPublicKey: v16.string(),
|
|
1182
|
+
assetAAddress: v16.string(),
|
|
1183
|
+
assetBAddress: v16.string(),
|
|
1184
|
+
lpFeeRateBps: v16.number(),
|
|
1185
|
+
totalHostFeeRateBps: v16.number(),
|
|
1186
|
+
nonce: v16.string()
|
|
1187
|
+
})
|
|
1188
|
+
});
|
|
1189
|
+
|
|
1190
|
+
// src/request/types/sparkMethods/flashnetMethods/intents/createSingleSidedPool.ts
|
|
1191
|
+
var v17 = __toESM(require("valibot"));
|
|
1192
|
+
var sparkFlashnetCreateSingleSidedPoolIntentSchema = v17.object({
|
|
1193
|
+
type: v17.literal("createSingleSidedPool"),
|
|
1194
|
+
data: v17.object({
|
|
1195
|
+
assetAAddress: v17.string(),
|
|
1196
|
+
assetBAddress: v17.string(),
|
|
1197
|
+
assetAInitialReserve: v17.string(),
|
|
1198
|
+
virtualReserveA: v17.union([v17.number(), v17.string()]),
|
|
1199
|
+
virtualReserveB: v17.union([v17.number(), v17.string()]),
|
|
1200
|
+
threshold: v17.union([v17.number(), v17.string()]),
|
|
1201
|
+
lpFeeRateBps: v17.number(),
|
|
1202
|
+
totalHostFeeRateBps: v17.number(),
|
|
1203
|
+
poolOwnerPublicKey: v17.string(),
|
|
1204
|
+
nonce: v17.string()
|
|
1205
|
+
})
|
|
1206
|
+
});
|
|
1207
|
+
|
|
1208
|
+
// src/request/types/sparkMethods/flashnetMethods/intents/removeLiquidity.ts
|
|
1209
|
+
var v18 = __toESM(require("valibot"));
|
|
1210
|
+
var sparkFlashnetRemoveLiquidityIntentSchema = v18.object({
|
|
1211
|
+
type: v18.literal("removeLiquidity"),
|
|
1212
|
+
data: v18.object({
|
|
1213
|
+
userPublicKey: v18.string(),
|
|
1214
|
+
poolId: v18.string(),
|
|
1215
|
+
lpTokensToRemove: v18.string(),
|
|
1216
|
+
nonce: v18.string()
|
|
1217
|
+
})
|
|
1218
|
+
});
|
|
1219
|
+
|
|
1220
|
+
// src/request/types/sparkMethods/flashnetMethods/intents/routeSwap.ts
|
|
1221
|
+
var v19 = __toESM(require("valibot"));
|
|
1222
|
+
var sparkFlashnetRouteSwapIntentSchema = v19.object({
|
|
1223
|
+
type: v19.literal("executeRouteSwap"),
|
|
1224
|
+
data: v19.object({
|
|
1225
|
+
userPublicKey: v19.string(),
|
|
1226
|
+
initialSparkTransferId: v19.string(),
|
|
1227
|
+
hops: v19.array(
|
|
1228
|
+
v19.object({
|
|
1229
|
+
poolId: v19.string(),
|
|
1230
|
+
inputAssetAddress: v19.string(),
|
|
1231
|
+
outputAssetAddress: v19.string(),
|
|
1232
|
+
hopIntegratorFeeRateBps: v19.optional(v19.number())
|
|
1233
|
+
})
|
|
1234
|
+
),
|
|
1235
|
+
inputAmount: v19.string(),
|
|
1236
|
+
maxRouteSlippageBps: v19.number(),
|
|
1237
|
+
minAmountOut: v19.string(),
|
|
1238
|
+
defaultIntegratorFeeRateBps: v19.optional(v19.number()),
|
|
1239
|
+
nonce: v19.string()
|
|
1240
|
+
})
|
|
1241
|
+
});
|
|
1242
|
+
|
|
1243
|
+
// src/request/types/sparkMethods/flashnetMethods/intents/swap.ts
|
|
1244
|
+
var v20 = __toESM(require("valibot"));
|
|
1245
|
+
var sparkFlashnetSwapIntentSchema = v20.object({
|
|
1246
|
+
type: v20.literal("executeSwap"),
|
|
1247
|
+
data: v20.object({
|
|
1248
|
+
userPublicKey: v20.string(),
|
|
1249
|
+
poolId: v20.string(),
|
|
1250
|
+
transferId: v20.string(),
|
|
1251
|
+
assetInAddress: v20.string(),
|
|
1252
|
+
assetOutAddress: v20.string(),
|
|
1253
|
+
amountIn: v20.string(),
|
|
1254
|
+
maxSlippageBps: v20.number(),
|
|
1255
|
+
minAmountOut: v20.string(),
|
|
1256
|
+
totalIntegratorFeeRateBps: v20.optional(v20.number()),
|
|
1257
|
+
nonce: v20.string()
|
|
1258
|
+
})
|
|
1259
|
+
});
|
|
1260
|
+
|
|
1261
|
+
// src/request/types/sparkMethods/flashnetMethods/signIntent.ts
|
|
1262
|
+
var v21 = __toESM(require("valibot"));
|
|
1263
|
+
var sparkFlashnetSignIntentMethodName = "spark_flashnet_signIntent";
|
|
1264
|
+
var sparkFlashnetSignIntentParamsSchema = v21.union([
|
|
1265
|
+
sparkFlashnetSwapIntentSchema,
|
|
1266
|
+
sparkFlashnetRouteSwapIntentSchema,
|
|
1267
|
+
sparkFlashnetAddLiquidityIntentSchema,
|
|
1268
|
+
sparkFlashnetClawbackIntentSchema,
|
|
1269
|
+
sparkFlashnetConfirmInitialDepositIntentSchema,
|
|
1270
|
+
sparkFlashnetCreateConstantProductPoolIntentSchema,
|
|
1271
|
+
sparkFlashnetCreateSingleSidedPoolIntentSchema,
|
|
1272
|
+
sparkFlashnetRemoveLiquidityIntentSchema
|
|
1273
|
+
]);
|
|
1274
|
+
var sparkFlashnetSignIntentResultSchema = v21.object({
|
|
1275
|
+
/**
|
|
1276
|
+
* The signed intent as a hex string.
|
|
1277
|
+
*/
|
|
1278
|
+
signature: v21.string()
|
|
1279
|
+
});
|
|
1280
|
+
var sparkFlashnetSignIntentRequestMessageSchema = v21.object({
|
|
1281
|
+
...rpcRequestMessageSchema.entries,
|
|
1282
|
+
...v21.object({
|
|
1283
|
+
method: v21.literal(sparkFlashnetSignIntentMethodName),
|
|
1284
|
+
params: sparkFlashnetSignIntentParamsSchema,
|
|
1285
|
+
id: v21.string()
|
|
1286
|
+
}).entries
|
|
1287
|
+
});
|
|
1288
|
+
|
|
1289
|
+
// src/request/types/sparkMethods/getAddresses.ts
|
|
1290
|
+
var v22 = __toESM(require("valibot"));
|
|
1044
1291
|
var sparkGetAddressesMethodName = "spark_getAddresses";
|
|
1045
|
-
var sparkGetAddressesParamsSchema =
|
|
1046
|
-
|
|
1292
|
+
var sparkGetAddressesParamsSchema = v22.nullish(
|
|
1293
|
+
v22.object({
|
|
1047
1294
|
/**
|
|
1048
1295
|
* A message to be displayed to the user in the request prompt.
|
|
1049
1296
|
*/
|
|
1050
|
-
message:
|
|
1297
|
+
message: v22.optional(v22.string())
|
|
1051
1298
|
})
|
|
1052
1299
|
);
|
|
1053
|
-
var sparkGetAddressesResultSchema =
|
|
1300
|
+
var sparkGetAddressesResultSchema = v22.object({
|
|
1054
1301
|
/**
|
|
1055
1302
|
* The addresses generated for the given purposes.
|
|
1056
1303
|
*/
|
|
1057
|
-
addresses:
|
|
1304
|
+
addresses: v22.array(addressSchema),
|
|
1058
1305
|
network: getNetworkResultSchema
|
|
1059
1306
|
});
|
|
1060
|
-
var sparkGetAddressesRequestMessageSchema =
|
|
1307
|
+
var sparkGetAddressesRequestMessageSchema = v22.object({
|
|
1061
1308
|
...rpcRequestMessageSchema.entries,
|
|
1062
|
-
...
|
|
1063
|
-
method:
|
|
1309
|
+
...v22.object({
|
|
1310
|
+
method: v22.literal(sparkGetAddressesMethodName),
|
|
1064
1311
|
params: sparkGetAddressesParamsSchema,
|
|
1065
|
-
id:
|
|
1312
|
+
id: v22.string()
|
|
1066
1313
|
}).entries
|
|
1067
1314
|
});
|
|
1068
1315
|
|
|
1069
1316
|
// src/request/types/sparkMethods/getBalance.ts
|
|
1070
|
-
var
|
|
1317
|
+
var v23 = __toESM(require("valibot"));
|
|
1071
1318
|
var sparkGetBalanceMethodName = "spark_getBalance";
|
|
1072
|
-
var sparkGetBalanceParamsSchema =
|
|
1073
|
-
var sparkGetBalanceResultSchema =
|
|
1319
|
+
var sparkGetBalanceParamsSchema = v23.nullish(v23.null());
|
|
1320
|
+
var sparkGetBalanceResultSchema = v23.object({
|
|
1074
1321
|
/**
|
|
1075
1322
|
* The Spark Bitcoin address balance in sats in string form.
|
|
1076
1323
|
*/
|
|
1077
|
-
balance:
|
|
1078
|
-
tokenBalances:
|
|
1079
|
-
|
|
1324
|
+
balance: v23.string(),
|
|
1325
|
+
tokenBalances: v23.array(
|
|
1326
|
+
v23.object({
|
|
1080
1327
|
/* The address balance of the token in string form as it can overflow a js number */
|
|
1081
|
-
balance:
|
|
1082
|
-
tokenMetadata:
|
|
1083
|
-
tokenIdentifier:
|
|
1084
|
-
tokenName:
|
|
1085
|
-
tokenTicker:
|
|
1086
|
-
decimals:
|
|
1087
|
-
maxSupply:
|
|
1328
|
+
balance: v23.string(),
|
|
1329
|
+
tokenMetadata: v23.object({
|
|
1330
|
+
tokenIdentifier: v23.string(),
|
|
1331
|
+
tokenName: v23.string(),
|
|
1332
|
+
tokenTicker: v23.string(),
|
|
1333
|
+
decimals: v23.number(),
|
|
1334
|
+
maxSupply: v23.string()
|
|
1088
1335
|
})
|
|
1089
1336
|
})
|
|
1090
1337
|
)
|
|
1091
1338
|
});
|
|
1092
|
-
var sparkGetBalanceRequestMessageSchema =
|
|
1339
|
+
var sparkGetBalanceRequestMessageSchema = v23.object({
|
|
1093
1340
|
...rpcRequestMessageSchema.entries,
|
|
1094
|
-
...
|
|
1095
|
-
method:
|
|
1341
|
+
...v23.object({
|
|
1342
|
+
method: v23.literal(sparkGetBalanceMethodName),
|
|
1096
1343
|
params: sparkGetBalanceParamsSchema,
|
|
1097
|
-
id:
|
|
1344
|
+
id: v23.string()
|
|
1098
1345
|
}).entries
|
|
1099
1346
|
});
|
|
1100
1347
|
|
|
1101
1348
|
// src/request/types/sparkMethods/transfer.ts
|
|
1102
|
-
var
|
|
1349
|
+
var v24 = __toESM(require("valibot"));
|
|
1103
1350
|
var sparkTransferMethodName = "spark_transfer";
|
|
1104
|
-
var sparkTransferParamsSchema =
|
|
1351
|
+
var sparkTransferParamsSchema = v24.object({
|
|
1105
1352
|
/**
|
|
1106
1353
|
* Amount of SATS to transfer as a string or number.
|
|
1107
1354
|
*/
|
|
1108
|
-
amountSats:
|
|
1355
|
+
amountSats: v24.union([v24.number(), v24.string()]),
|
|
1109
1356
|
/**
|
|
1110
1357
|
* The recipient's spark address.
|
|
1111
1358
|
*/
|
|
1112
|
-
receiverSparkAddress:
|
|
1359
|
+
receiverSparkAddress: v24.string()
|
|
1113
1360
|
});
|
|
1114
|
-
var sparkTransferResultSchema =
|
|
1361
|
+
var sparkTransferResultSchema = v24.object({
|
|
1115
1362
|
/**
|
|
1116
1363
|
* The ID of the transaction.
|
|
1117
1364
|
*/
|
|
1118
|
-
id:
|
|
1365
|
+
id: v24.string()
|
|
1119
1366
|
});
|
|
1120
|
-
var sparkTransferRequestMessageSchema =
|
|
1367
|
+
var sparkTransferRequestMessageSchema = v24.object({
|
|
1121
1368
|
...rpcRequestMessageSchema.entries,
|
|
1122
|
-
...
|
|
1123
|
-
method:
|
|
1369
|
+
...v24.object({
|
|
1370
|
+
method: v24.literal(sparkTransferMethodName),
|
|
1124
1371
|
params: sparkTransferParamsSchema,
|
|
1125
|
-
id:
|
|
1372
|
+
id: v24.string()
|
|
1126
1373
|
}).entries
|
|
1127
1374
|
});
|
|
1128
1375
|
|
|
1129
1376
|
// src/request/types/sparkMethods/transferToken.ts
|
|
1130
|
-
var
|
|
1377
|
+
var v25 = __toESM(require("valibot"));
|
|
1131
1378
|
var sparkTransferTokenMethodName = "spark_transferToken";
|
|
1132
|
-
var sparkTransferTokenParamsSchema =
|
|
1379
|
+
var sparkTransferTokenParamsSchema = v25.object({
|
|
1133
1380
|
/**
|
|
1134
1381
|
* Amount of units of the token to transfer as a string or number.
|
|
1135
1382
|
*/
|
|
1136
|
-
tokenAmount:
|
|
1383
|
+
tokenAmount: v25.union([v25.number(), v25.string()]),
|
|
1137
1384
|
/**
|
|
1138
1385
|
* The Bech32m token identifier.
|
|
1139
1386
|
*/
|
|
1140
|
-
tokenIdentifier:
|
|
1387
|
+
tokenIdentifier: v25.string(),
|
|
1141
1388
|
/**
|
|
1142
1389
|
* The recipient's spark address.
|
|
1143
1390
|
*/
|
|
1144
|
-
receiverSparkAddress:
|
|
1391
|
+
receiverSparkAddress: v25.string()
|
|
1145
1392
|
});
|
|
1146
|
-
var sparkTransferTokenResultSchema =
|
|
1393
|
+
var sparkTransferTokenResultSchema = v25.object({
|
|
1147
1394
|
/**
|
|
1148
1395
|
* The ID of the transaction.
|
|
1149
1396
|
*/
|
|
1150
|
-
id:
|
|
1397
|
+
id: v25.string()
|
|
1151
1398
|
});
|
|
1152
|
-
var sparkTransferTokenRequestMessageSchema =
|
|
1399
|
+
var sparkTransferTokenRequestMessageSchema = v25.object({
|
|
1153
1400
|
...rpcRequestMessageSchema.entries,
|
|
1154
|
-
...
|
|
1155
|
-
method:
|
|
1401
|
+
...v25.object({
|
|
1402
|
+
method: v25.literal(sparkTransferTokenMethodName),
|
|
1156
1403
|
params: sparkTransferTokenParamsSchema,
|
|
1157
|
-
id:
|
|
1404
|
+
id: v25.string()
|
|
1158
1405
|
}).entries
|
|
1159
1406
|
});
|
|
1160
1407
|
|
|
1161
1408
|
// src/request/types/stxMethods/callContract.ts
|
|
1162
|
-
var
|
|
1409
|
+
var v26 = __toESM(require("valibot"));
|
|
1163
1410
|
var stxCallContractMethodName = "stx_callContract";
|
|
1164
|
-
var stxCallContractParamsSchema =
|
|
1411
|
+
var stxCallContractParamsSchema = v26.object({
|
|
1165
1412
|
/**
|
|
1166
1413
|
* The contract principal.
|
|
1167
1414
|
*
|
|
1168
1415
|
* E.g. `"SPKE...GD5C.my-contract"`
|
|
1169
1416
|
*/
|
|
1170
|
-
contract:
|
|
1417
|
+
contract: v26.string(),
|
|
1171
1418
|
/**
|
|
1172
1419
|
* The name of the function to call.
|
|
1173
1420
|
*
|
|
1174
1421
|
* Note: spec changes ongoing,
|
|
1175
1422
|
* https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
|
|
1176
1423
|
*/
|
|
1177
|
-
functionName:
|
|
1424
|
+
functionName: v26.string(),
|
|
1178
1425
|
/**
|
|
1179
1426
|
* @deprecated in favor of `functionArgs` for @stacks/connect compatibility
|
|
1180
1427
|
*/
|
|
1181
|
-
arguments:
|
|
1428
|
+
arguments: v26.optional(v26.array(v26.string())),
|
|
1182
1429
|
/**
|
|
1183
1430
|
* The function's arguments. The arguments are expected to be hex-encoded
|
|
1184
1431
|
* strings of Clarity values.
|
|
@@ -1193,274 +1440,274 @@ var stxCallContractParamsSchema = v16.object({
|
|
|
1193
1440
|
* const hexArgs = functionArgs.map(cvToHex);
|
|
1194
1441
|
* ```
|
|
1195
1442
|
*/
|
|
1196
|
-
functionArgs:
|
|
1443
|
+
functionArgs: v26.optional(v26.array(v26.string())),
|
|
1197
1444
|
/**
|
|
1198
1445
|
* The post conditions to apply to the contract call.
|
|
1199
1446
|
*/
|
|
1200
|
-
postConditions:
|
|
1447
|
+
postConditions: v26.optional(v26.array(v26.string())),
|
|
1201
1448
|
/**
|
|
1202
1449
|
* The mode to apply to the post conditions.
|
|
1203
1450
|
*/
|
|
1204
|
-
postConditionMode:
|
|
1451
|
+
postConditionMode: v26.optional(v26.union([v26.literal("allow"), v26.literal("deny")]))
|
|
1205
1452
|
});
|
|
1206
|
-
var stxCallContractResultSchema =
|
|
1453
|
+
var stxCallContractResultSchema = v26.object({
|
|
1207
1454
|
/**
|
|
1208
1455
|
* The ID of the transaction.
|
|
1209
1456
|
*/
|
|
1210
|
-
txid:
|
|
1457
|
+
txid: v26.string(),
|
|
1211
1458
|
/**
|
|
1212
1459
|
* A Stacks transaction as a hex-encoded string.
|
|
1213
1460
|
*/
|
|
1214
|
-
transaction:
|
|
1461
|
+
transaction: v26.string()
|
|
1215
1462
|
});
|
|
1216
|
-
var stxCallContractRequestMessageSchema =
|
|
1463
|
+
var stxCallContractRequestMessageSchema = v26.object({
|
|
1217
1464
|
...rpcRequestMessageSchema.entries,
|
|
1218
|
-
...
|
|
1219
|
-
method:
|
|
1465
|
+
...v26.object({
|
|
1466
|
+
method: v26.literal(stxCallContractMethodName),
|
|
1220
1467
|
params: stxCallContractParamsSchema,
|
|
1221
|
-
id:
|
|
1468
|
+
id: v26.string()
|
|
1222
1469
|
}).entries
|
|
1223
1470
|
});
|
|
1224
1471
|
|
|
1225
1472
|
// src/request/types/stxMethods/deployContract.ts
|
|
1226
|
-
var
|
|
1473
|
+
var v27 = __toESM(require("valibot"));
|
|
1227
1474
|
var stxDeployContractMethodName = "stx_deployContract";
|
|
1228
|
-
var stxDeployContractParamsSchema =
|
|
1475
|
+
var stxDeployContractParamsSchema = v27.object({
|
|
1229
1476
|
/**
|
|
1230
1477
|
* Name of the contract.
|
|
1231
1478
|
*/
|
|
1232
|
-
name:
|
|
1479
|
+
name: v27.string(),
|
|
1233
1480
|
/**
|
|
1234
1481
|
* The source code of the Clarity contract.
|
|
1235
1482
|
*/
|
|
1236
|
-
clarityCode:
|
|
1483
|
+
clarityCode: v27.string(),
|
|
1237
1484
|
/**
|
|
1238
1485
|
* The version of the Clarity contract.
|
|
1239
1486
|
*/
|
|
1240
|
-
clarityVersion:
|
|
1487
|
+
clarityVersion: v27.optional(v27.number()),
|
|
1241
1488
|
/**
|
|
1242
1489
|
* The post conditions to apply to the contract call.
|
|
1243
1490
|
*/
|
|
1244
|
-
postConditions:
|
|
1491
|
+
postConditions: v27.optional(v27.array(v27.string())),
|
|
1245
1492
|
/**
|
|
1246
1493
|
* The mode to apply to the post conditions.
|
|
1247
1494
|
*/
|
|
1248
|
-
postConditionMode:
|
|
1495
|
+
postConditionMode: v27.optional(v27.union([v27.literal("allow"), v27.literal("deny")]))
|
|
1249
1496
|
});
|
|
1250
|
-
var stxDeployContractResultSchema =
|
|
1497
|
+
var stxDeployContractResultSchema = v27.object({
|
|
1251
1498
|
/**
|
|
1252
1499
|
* The ID of the transaction.
|
|
1253
1500
|
*/
|
|
1254
|
-
txid:
|
|
1501
|
+
txid: v27.string(),
|
|
1255
1502
|
/**
|
|
1256
1503
|
* A Stacks transaction as a hex-encoded string.
|
|
1257
1504
|
*/
|
|
1258
|
-
transaction:
|
|
1505
|
+
transaction: v27.string()
|
|
1259
1506
|
});
|
|
1260
|
-
var stxDeployContractRequestMessageSchema =
|
|
1507
|
+
var stxDeployContractRequestMessageSchema = v27.object({
|
|
1261
1508
|
...rpcRequestMessageSchema.entries,
|
|
1262
|
-
...
|
|
1263
|
-
method:
|
|
1509
|
+
...v27.object({
|
|
1510
|
+
method: v27.literal(stxDeployContractMethodName),
|
|
1264
1511
|
params: stxDeployContractParamsSchema,
|
|
1265
|
-
id:
|
|
1512
|
+
id: v27.string()
|
|
1266
1513
|
}).entries
|
|
1267
1514
|
});
|
|
1268
1515
|
|
|
1269
1516
|
// src/request/types/stxMethods/getAccounts.ts
|
|
1270
|
-
var
|
|
1517
|
+
var v28 = __toESM(require("valibot"));
|
|
1271
1518
|
var stxGetAccountsMethodName = "stx_getAccounts";
|
|
1272
|
-
var stxGetAccountsParamsSchema =
|
|
1273
|
-
var stxGetAccountsResultSchema =
|
|
1519
|
+
var stxGetAccountsParamsSchema = v28.nullish(v28.null());
|
|
1520
|
+
var stxGetAccountsResultSchema = v28.object({
|
|
1274
1521
|
/**
|
|
1275
1522
|
* The addresses generated for the given purposes.
|
|
1276
1523
|
*/
|
|
1277
|
-
addresses:
|
|
1278
|
-
|
|
1279
|
-
address:
|
|
1280
|
-
publicKey:
|
|
1281
|
-
gaiaHubUrl:
|
|
1282
|
-
gaiaAppKey:
|
|
1524
|
+
addresses: v28.array(
|
|
1525
|
+
v28.object({
|
|
1526
|
+
address: v28.string(),
|
|
1527
|
+
publicKey: v28.string(),
|
|
1528
|
+
gaiaHubUrl: v28.string(),
|
|
1529
|
+
gaiaAppKey: v28.string()
|
|
1283
1530
|
})
|
|
1284
1531
|
),
|
|
1285
1532
|
network: getNetworkResultSchema
|
|
1286
1533
|
});
|
|
1287
|
-
var stxGetAccountsRequestMessageSchema =
|
|
1534
|
+
var stxGetAccountsRequestMessageSchema = v28.object({
|
|
1288
1535
|
...rpcRequestMessageSchema.entries,
|
|
1289
|
-
...
|
|
1290
|
-
method:
|
|
1536
|
+
...v28.object({
|
|
1537
|
+
method: v28.literal(stxGetAccountsMethodName),
|
|
1291
1538
|
params: stxGetAccountsParamsSchema,
|
|
1292
|
-
id:
|
|
1539
|
+
id: v28.string()
|
|
1293
1540
|
}).entries
|
|
1294
1541
|
});
|
|
1295
1542
|
|
|
1296
1543
|
// src/request/types/stxMethods/getAddresses.ts
|
|
1297
|
-
var
|
|
1544
|
+
var v29 = __toESM(require("valibot"));
|
|
1298
1545
|
var stxGetAddressesMethodName = "stx_getAddresses";
|
|
1299
|
-
var stxGetAddressesParamsSchema =
|
|
1300
|
-
|
|
1546
|
+
var stxGetAddressesParamsSchema = v29.nullish(
|
|
1547
|
+
v29.object({
|
|
1301
1548
|
/**
|
|
1302
1549
|
* A message to be displayed to the user in the request prompt.
|
|
1303
1550
|
*/
|
|
1304
|
-
message:
|
|
1551
|
+
message: v29.optional(v29.string())
|
|
1305
1552
|
})
|
|
1306
1553
|
);
|
|
1307
|
-
var stxGetAddressesResultSchema =
|
|
1554
|
+
var stxGetAddressesResultSchema = v29.object({
|
|
1308
1555
|
/**
|
|
1309
1556
|
* The addresses generated for the given purposes.
|
|
1310
1557
|
*/
|
|
1311
|
-
addresses:
|
|
1558
|
+
addresses: v29.array(addressSchema),
|
|
1312
1559
|
network: getNetworkResultSchema
|
|
1313
1560
|
});
|
|
1314
|
-
var stxGetAddressesRequestMessageSchema =
|
|
1561
|
+
var stxGetAddressesRequestMessageSchema = v29.object({
|
|
1315
1562
|
...rpcRequestMessageSchema.entries,
|
|
1316
|
-
...
|
|
1317
|
-
method:
|
|
1563
|
+
...v29.object({
|
|
1564
|
+
method: v29.literal(stxGetAddressesMethodName),
|
|
1318
1565
|
params: stxGetAddressesParamsSchema,
|
|
1319
|
-
id:
|
|
1566
|
+
id: v29.string()
|
|
1320
1567
|
}).entries
|
|
1321
1568
|
});
|
|
1322
1569
|
|
|
1323
1570
|
// src/request/types/stxMethods/signMessage.ts
|
|
1324
|
-
var
|
|
1571
|
+
var v30 = __toESM(require("valibot"));
|
|
1325
1572
|
var stxSignMessageMethodName = "stx_signMessage";
|
|
1326
|
-
var stxSignMessageParamsSchema =
|
|
1573
|
+
var stxSignMessageParamsSchema = v30.object({
|
|
1327
1574
|
/**
|
|
1328
1575
|
* The message to sign.
|
|
1329
1576
|
*/
|
|
1330
|
-
message:
|
|
1577
|
+
message: v30.string()
|
|
1331
1578
|
});
|
|
1332
|
-
var stxSignMessageResultSchema =
|
|
1579
|
+
var stxSignMessageResultSchema = v30.object({
|
|
1333
1580
|
/**
|
|
1334
1581
|
* The signature of the message.
|
|
1335
1582
|
*/
|
|
1336
|
-
signature:
|
|
1583
|
+
signature: v30.string(),
|
|
1337
1584
|
/**
|
|
1338
1585
|
* The public key used to sign the message.
|
|
1339
1586
|
*/
|
|
1340
|
-
publicKey:
|
|
1587
|
+
publicKey: v30.string()
|
|
1341
1588
|
});
|
|
1342
|
-
var stxSignMessageRequestMessageSchema =
|
|
1589
|
+
var stxSignMessageRequestMessageSchema = v30.object({
|
|
1343
1590
|
...rpcRequestMessageSchema.entries,
|
|
1344
|
-
...
|
|
1345
|
-
method:
|
|
1591
|
+
...v30.object({
|
|
1592
|
+
method: v30.literal(stxSignMessageMethodName),
|
|
1346
1593
|
params: stxSignMessageParamsSchema,
|
|
1347
|
-
id:
|
|
1594
|
+
id: v30.string()
|
|
1348
1595
|
}).entries
|
|
1349
1596
|
});
|
|
1350
1597
|
|
|
1351
1598
|
// src/request/types/stxMethods/signStructuredMessage.ts
|
|
1352
|
-
var
|
|
1599
|
+
var v31 = __toESM(require("valibot"));
|
|
1353
1600
|
var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
|
|
1354
|
-
var stxSignStructuredMessageParamsSchema =
|
|
1601
|
+
var stxSignStructuredMessageParamsSchema = v31.object({
|
|
1355
1602
|
/**
|
|
1356
1603
|
* The domain to be signed.
|
|
1357
1604
|
*/
|
|
1358
|
-
domain:
|
|
1605
|
+
domain: v31.string(),
|
|
1359
1606
|
/**
|
|
1360
1607
|
* Message payload to be signed.
|
|
1361
1608
|
*/
|
|
1362
|
-
message:
|
|
1609
|
+
message: v31.string(),
|
|
1363
1610
|
/**
|
|
1364
1611
|
* The public key to sign the message with.
|
|
1365
1612
|
*/
|
|
1366
|
-
publicKey:
|
|
1613
|
+
publicKey: v31.optional(v31.string())
|
|
1367
1614
|
});
|
|
1368
|
-
var stxSignStructuredMessageResultSchema =
|
|
1615
|
+
var stxSignStructuredMessageResultSchema = v31.object({
|
|
1369
1616
|
/**
|
|
1370
1617
|
* Signature of the message.
|
|
1371
1618
|
*/
|
|
1372
|
-
signature:
|
|
1619
|
+
signature: v31.string(),
|
|
1373
1620
|
/**
|
|
1374
1621
|
* Public key as hex-encoded string.
|
|
1375
1622
|
*/
|
|
1376
|
-
publicKey:
|
|
1623
|
+
publicKey: v31.string()
|
|
1377
1624
|
});
|
|
1378
|
-
var stxSignStructuredMessageRequestMessageSchema =
|
|
1625
|
+
var stxSignStructuredMessageRequestMessageSchema = v31.object({
|
|
1379
1626
|
...rpcRequestMessageSchema.entries,
|
|
1380
|
-
...
|
|
1381
|
-
method:
|
|
1627
|
+
...v31.object({
|
|
1628
|
+
method: v31.literal(stxSignStructuredMessageMethodName),
|
|
1382
1629
|
params: stxSignStructuredMessageParamsSchema,
|
|
1383
|
-
id:
|
|
1630
|
+
id: v31.string()
|
|
1384
1631
|
}).entries
|
|
1385
1632
|
});
|
|
1386
1633
|
|
|
1387
1634
|
// src/request/types/stxMethods/signTransaction.ts
|
|
1388
|
-
var
|
|
1635
|
+
var v32 = __toESM(require("valibot"));
|
|
1389
1636
|
var stxSignTransactionMethodName = "stx_signTransaction";
|
|
1390
|
-
var stxSignTransactionParamsSchema =
|
|
1637
|
+
var stxSignTransactionParamsSchema = v32.object({
|
|
1391
1638
|
/**
|
|
1392
1639
|
* The transaction to sign as a hex-encoded string.
|
|
1393
1640
|
*/
|
|
1394
|
-
transaction:
|
|
1641
|
+
transaction: v32.string(),
|
|
1395
1642
|
/**
|
|
1396
1643
|
* The public key to sign the transaction with. The wallet may use any key
|
|
1397
1644
|
* when not provided.
|
|
1398
1645
|
*/
|
|
1399
|
-
pubkey:
|
|
1646
|
+
pubkey: v32.optional(v32.string()),
|
|
1400
1647
|
/**
|
|
1401
1648
|
* Whether to broadcast the transaction after signing. Defaults to `true`.
|
|
1402
1649
|
*/
|
|
1403
|
-
broadcast:
|
|
1650
|
+
broadcast: v32.optional(v32.boolean())
|
|
1404
1651
|
});
|
|
1405
|
-
var stxSignTransactionResultSchema =
|
|
1652
|
+
var stxSignTransactionResultSchema = v32.object({
|
|
1406
1653
|
/**
|
|
1407
1654
|
* The signed transaction as a hex-encoded string.
|
|
1408
1655
|
*/
|
|
1409
|
-
transaction:
|
|
1656
|
+
transaction: v32.string()
|
|
1410
1657
|
});
|
|
1411
|
-
var stxSignTransactionRequestMessageSchema =
|
|
1658
|
+
var stxSignTransactionRequestMessageSchema = v32.object({
|
|
1412
1659
|
...rpcRequestMessageSchema.entries,
|
|
1413
|
-
...
|
|
1414
|
-
method:
|
|
1660
|
+
...v32.object({
|
|
1661
|
+
method: v32.literal(stxSignTransactionMethodName),
|
|
1415
1662
|
params: stxSignTransactionParamsSchema,
|
|
1416
|
-
id:
|
|
1663
|
+
id: v32.string()
|
|
1417
1664
|
}).entries
|
|
1418
1665
|
});
|
|
1419
1666
|
|
|
1420
1667
|
// src/request/types/stxMethods/signTransactions.ts
|
|
1421
|
-
var
|
|
1668
|
+
var v33 = __toESM(require("valibot"));
|
|
1422
1669
|
var stxSignTransactionsMethodName = "stx_signTransactions";
|
|
1423
|
-
var stxSignTransactionsParamsSchema =
|
|
1670
|
+
var stxSignTransactionsParamsSchema = v33.object({
|
|
1424
1671
|
/**
|
|
1425
1672
|
* The transactions to sign as hex-encoded strings.
|
|
1426
1673
|
*/
|
|
1427
|
-
transactions:
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1674
|
+
transactions: v33.pipe(
|
|
1675
|
+
v33.array(
|
|
1676
|
+
v33.pipe(
|
|
1677
|
+
v33.string(),
|
|
1678
|
+
v33.check((hex) => {
|
|
1432
1679
|
return true;
|
|
1433
1680
|
}, "Invalid hex-encoded Stacks transaction.")
|
|
1434
1681
|
)
|
|
1435
1682
|
),
|
|
1436
|
-
|
|
1683
|
+
v33.minLength(1)
|
|
1437
1684
|
),
|
|
1438
1685
|
/**
|
|
1439
1686
|
* Whether the signed transactions should be broadcast after signing. Defaults
|
|
1440
1687
|
* to `true`.
|
|
1441
1688
|
*/
|
|
1442
|
-
broadcast:
|
|
1689
|
+
broadcast: v33.optional(v33.boolean())
|
|
1443
1690
|
});
|
|
1444
|
-
var stxSignTransactionsResultSchema =
|
|
1691
|
+
var stxSignTransactionsResultSchema = v33.object({
|
|
1445
1692
|
/**
|
|
1446
1693
|
* The signed transactions as hex-encoded strings, in the same order as in the
|
|
1447
1694
|
* sign request.
|
|
1448
1695
|
*/
|
|
1449
|
-
transactions:
|
|
1696
|
+
transactions: v33.array(v33.string())
|
|
1450
1697
|
});
|
|
1451
|
-
var stxSignTransactionsRequestMessageSchema =
|
|
1698
|
+
var stxSignTransactionsRequestMessageSchema = v33.object({
|
|
1452
1699
|
...rpcRequestMessageSchema.entries,
|
|
1453
|
-
...
|
|
1454
|
-
method:
|
|
1700
|
+
...v33.object({
|
|
1701
|
+
method: v33.literal(stxSignTransactionsMethodName),
|
|
1455
1702
|
params: stxSignTransactionsParamsSchema,
|
|
1456
|
-
id:
|
|
1703
|
+
id: v33.string()
|
|
1457
1704
|
}).entries
|
|
1458
1705
|
});
|
|
1459
1706
|
|
|
1460
1707
|
// src/request/types/stxMethods/transferStx.ts
|
|
1461
|
-
var
|
|
1708
|
+
var v34 = __toESM(require("valibot"));
|
|
1462
1709
|
var stxTransferStxMethodName = "stx_transferStx";
|
|
1463
|
-
var stxTransferStxParamsSchema =
|
|
1710
|
+
var stxTransferStxParamsSchema = v34.object({
|
|
1464
1711
|
/**
|
|
1465
1712
|
* Amount of STX tokens to transfer in microstacks as a string. Anything
|
|
1466
1713
|
* parseable by `BigInt` is acceptable.
|
|
@@ -1473,23 +1720,23 @@ var stxTransferStxParamsSchema = v24.object({
|
|
|
1473
1720
|
* const amount3 = '1234';
|
|
1474
1721
|
* ```
|
|
1475
1722
|
*/
|
|
1476
|
-
amount:
|
|
1723
|
+
amount: v34.union([v34.number(), v34.string()]),
|
|
1477
1724
|
/**
|
|
1478
1725
|
* The recipient's principal.
|
|
1479
1726
|
*/
|
|
1480
|
-
recipient:
|
|
1727
|
+
recipient: v34.string(),
|
|
1481
1728
|
/**
|
|
1482
1729
|
* A string representing the memo.
|
|
1483
1730
|
*/
|
|
1484
|
-
memo:
|
|
1731
|
+
memo: v34.optional(v34.string()),
|
|
1485
1732
|
/**
|
|
1486
1733
|
* Version of parameter format.
|
|
1487
1734
|
*/
|
|
1488
|
-
version:
|
|
1735
|
+
version: v34.optional(v34.string()),
|
|
1489
1736
|
/**
|
|
1490
1737
|
* The mode of the post conditions.
|
|
1491
1738
|
*/
|
|
1492
|
-
postConditionMode:
|
|
1739
|
+
postConditionMode: v34.optional(v34.number()),
|
|
1493
1740
|
/**
|
|
1494
1741
|
* A hex-encoded string representing the post conditions.
|
|
1495
1742
|
*
|
|
@@ -1502,52 +1749,43 @@ var stxTransferStxParamsSchema = v24.object({
|
|
|
1502
1749
|
* const hexPostCondition = serializePostCondition(postCondition).toString('hex');
|
|
1503
1750
|
* ```
|
|
1504
1751
|
*/
|
|
1505
|
-
postConditions:
|
|
1752
|
+
postConditions: v34.optional(v34.array(v34.string())),
|
|
1506
1753
|
/**
|
|
1507
1754
|
* The public key to sign the transaction with. The wallet may use any key
|
|
1508
1755
|
* when not provided.
|
|
1509
1756
|
*/
|
|
1510
|
-
pubkey:
|
|
1757
|
+
pubkey: v34.optional(v34.string())
|
|
1511
1758
|
});
|
|
1512
|
-
var stxTransferStxResultSchema =
|
|
1759
|
+
var stxTransferStxResultSchema = v34.object({
|
|
1513
1760
|
/**
|
|
1514
1761
|
* The ID of the transaction.
|
|
1515
1762
|
*/
|
|
1516
|
-
txid:
|
|
1763
|
+
txid: v34.string(),
|
|
1517
1764
|
/**
|
|
1518
1765
|
* A Stacks transaction as a hex-encoded string.
|
|
1519
1766
|
*/
|
|
1520
|
-
transaction:
|
|
1767
|
+
transaction: v34.string()
|
|
1521
1768
|
});
|
|
1522
|
-
var stxTransferStxRequestMessageSchema =
|
|
1769
|
+
var stxTransferStxRequestMessageSchema = v34.object({
|
|
1523
1770
|
...rpcRequestMessageSchema.entries,
|
|
1524
|
-
...
|
|
1525
|
-
method:
|
|
1771
|
+
...v34.object({
|
|
1772
|
+
method: v34.literal(stxTransferStxMethodName),
|
|
1526
1773
|
params: stxTransferStxParamsSchema,
|
|
1527
|
-
id:
|
|
1774
|
+
id: v34.string()
|
|
1528
1775
|
}).entries
|
|
1529
1776
|
});
|
|
1530
1777
|
|
|
1531
1778
|
// src/request/index.ts
|
|
1532
|
-
var
|
|
1533
|
-
|
|
1534
|
-
if (providerId) {
|
|
1535
|
-
provider = await getProviderById(providerId);
|
|
1536
|
-
}
|
|
1537
|
-
if (!provider) {
|
|
1538
|
-
throw new Error("no wallet provider was found");
|
|
1539
|
-
}
|
|
1540
|
-
if (!method) {
|
|
1541
|
-
throw new Error("A wallet method is required");
|
|
1542
|
-
}
|
|
1779
|
+
var cache = {};
|
|
1780
|
+
var requestInternal = async (provider, method, params) => {
|
|
1543
1781
|
const response = await provider.request(method, params);
|
|
1544
|
-
if (
|
|
1782
|
+
if (v35.is(rpcErrorResponseMessageSchema, response)) {
|
|
1545
1783
|
return {
|
|
1546
1784
|
status: "error",
|
|
1547
1785
|
error: response.error
|
|
1548
1786
|
};
|
|
1549
1787
|
}
|
|
1550
|
-
if (
|
|
1788
|
+
if (v35.is(rpcSuccessResponseMessageSchema, response)) {
|
|
1551
1789
|
return {
|
|
1552
1790
|
status: "success",
|
|
1553
1791
|
result: response.result
|
|
@@ -1562,6 +1800,39 @@ var request = async (method, params, providerId) => {
|
|
|
1562
1800
|
}
|
|
1563
1801
|
};
|
|
1564
1802
|
};
|
|
1803
|
+
var request = async (method, params, providerId) => {
|
|
1804
|
+
let provider = window.XverseProviders?.BitcoinProvider || window.BitcoinProvider;
|
|
1805
|
+
if (providerId) {
|
|
1806
|
+
provider = await getProviderById(providerId);
|
|
1807
|
+
}
|
|
1808
|
+
if (!provider) {
|
|
1809
|
+
throw new Error("no wallet provider was found");
|
|
1810
|
+
}
|
|
1811
|
+
if (!method) {
|
|
1812
|
+
throw new Error("A wallet method is required");
|
|
1813
|
+
}
|
|
1814
|
+
if (!cache.providerInfo) {
|
|
1815
|
+
const infoResult = await requestInternal(provider, "getInfo", null);
|
|
1816
|
+
if (infoResult.status === "success") {
|
|
1817
|
+
cache.providerInfo = infoResult.result;
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
if (cache.providerInfo) {
|
|
1821
|
+
if (method === "getInfo") {
|
|
1822
|
+
return {
|
|
1823
|
+
status: "success",
|
|
1824
|
+
result: cache.providerInfo
|
|
1825
|
+
};
|
|
1826
|
+
}
|
|
1827
|
+
const sanitized = sanitizeRequest(method, params, cache.providerInfo);
|
|
1828
|
+
if (sanitized.overrideResponse) {
|
|
1829
|
+
return sanitized.overrideResponse;
|
|
1830
|
+
}
|
|
1831
|
+
method = sanitized.method;
|
|
1832
|
+
params = sanitized.params;
|
|
1833
|
+
}
|
|
1834
|
+
return requestInternal(provider, method, params);
|
|
1835
|
+
};
|
|
1565
1836
|
var addListener = (...rawArgs) => {
|
|
1566
1837
|
const [listenerInfo, providerId] = (() => {
|
|
1567
1838
|
if (rawArgs.length === 1) {
|
|
@@ -2567,6 +2838,7 @@ var signMultipleTransactions = async (options) => {
|
|
|
2567
2838
|
DefaultAdaptersInfo,
|
|
2568
2839
|
MessageSigningProtocols,
|
|
2569
2840
|
PermissionRequestParams,
|
|
2841
|
+
ProviderPlatform,
|
|
2570
2842
|
RpcErrorCode,
|
|
2571
2843
|
RpcIdSchema,
|
|
2572
2844
|
SatsConnectAdapter,
|
|
@@ -2702,6 +2974,22 @@ var signMultipleTransactions = async (options) => {
|
|
|
2702
2974
|
signPsbtRequestMessageSchema,
|
|
2703
2975
|
signPsbtResultSchema,
|
|
2704
2976
|
signTransaction,
|
|
2977
|
+
sparkFlashnetAddLiquidityIntentSchema,
|
|
2978
|
+
sparkFlashnetClawbackIntentSchema,
|
|
2979
|
+
sparkFlashnetConfirmInitialDepositIntentSchema,
|
|
2980
|
+
sparkFlashnetCreateConstantProductPoolIntentSchema,
|
|
2981
|
+
sparkFlashnetCreateSingleSidedPoolIntentSchema,
|
|
2982
|
+
sparkFlashnetGetJwtMethodName,
|
|
2983
|
+
sparkFlashnetGetJwtParamsSchema,
|
|
2984
|
+
sparkFlashnetGetJwtRequestMessageSchema,
|
|
2985
|
+
sparkFlashnetGetJwtResultSchema,
|
|
2986
|
+
sparkFlashnetRemoveLiquidityIntentSchema,
|
|
2987
|
+
sparkFlashnetRouteSwapIntentSchema,
|
|
2988
|
+
sparkFlashnetSignIntentMethodName,
|
|
2989
|
+
sparkFlashnetSignIntentParamsSchema,
|
|
2990
|
+
sparkFlashnetSignIntentRequestMessageSchema,
|
|
2991
|
+
sparkFlashnetSignIntentResultSchema,
|
|
2992
|
+
sparkFlashnetSwapIntentSchema,
|
|
2705
2993
|
sparkGetAddressesMethodName,
|
|
2706
2994
|
sparkGetAddressesParamsSchema,
|
|
2707
2995
|
sparkGetAddressesRequestMessageSchema,
|