@sats-connect/core 0.8.2 → 0.9.0
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 +355 -1
- package/dist/index.d.ts +355 -1
- package/dist/index.js +399 -167
- package/dist/index.mjs +379 -167
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/request/index.ts
|
|
2
|
-
import * as
|
|
2
|
+
import * as v36 from "valibot";
|
|
3
3
|
|
|
4
4
|
// src/provider/types.ts
|
|
5
5
|
import * as v4 from "valibot";
|
|
@@ -862,146 +862,338 @@ var runesTransferRequestMessageSchema = v11.object({
|
|
|
862
862
|
}).entries
|
|
863
863
|
});
|
|
864
864
|
|
|
865
|
-
// src/request/types/sparkMethods/
|
|
865
|
+
// src/request/types/sparkMethods/flashnetMethods/getJwt.ts
|
|
866
866
|
import * as v12 from "valibot";
|
|
867
|
+
var sparkFlashnetGetJwtMethodName = "spark_flashnet_getJwt";
|
|
868
|
+
var sparkFlashnetGetJwtParamsSchema = v12.null();
|
|
869
|
+
var sparkFlashnetGetJwtResultSchema = v12.object({
|
|
870
|
+
/**
|
|
871
|
+
* The JWT token for authenticated requests to the Flashnet API.
|
|
872
|
+
*/
|
|
873
|
+
jwt: v12.string()
|
|
874
|
+
});
|
|
875
|
+
var sparkFlashnetGetJwtRequestMessageSchema = v12.object({
|
|
876
|
+
...rpcRequestMessageSchema.entries,
|
|
877
|
+
...v12.object({
|
|
878
|
+
method: v12.literal(sparkFlashnetGetJwtMethodName),
|
|
879
|
+
params: sparkFlashnetGetJwtParamsSchema,
|
|
880
|
+
id: v12.string()
|
|
881
|
+
}).entries
|
|
882
|
+
});
|
|
883
|
+
|
|
884
|
+
// src/request/types/sparkMethods/flashnetMethods/intents/addLiquidity.ts
|
|
885
|
+
import * as v13 from "valibot";
|
|
886
|
+
var sparkFlashnetAddLiquidityIntentSchema = v13.object({
|
|
887
|
+
type: v13.literal("addLiquidity"),
|
|
888
|
+
data: v13.object({
|
|
889
|
+
userPublicKey: v13.string(),
|
|
890
|
+
poolId: v13.string(),
|
|
891
|
+
assetAAmount: v13.string(),
|
|
892
|
+
assetBAmount: v13.string(),
|
|
893
|
+
assetAMinAmountIn: v13.string(),
|
|
894
|
+
assetBMinAmountIn: v13.string(),
|
|
895
|
+
assetATransferId: v13.string(),
|
|
896
|
+
assetBTransferId: v13.string(),
|
|
897
|
+
nonce: v13.string()
|
|
898
|
+
})
|
|
899
|
+
});
|
|
900
|
+
|
|
901
|
+
// src/request/types/sparkMethods/flashnetMethods/intents/clawback.ts
|
|
902
|
+
import * as v14 from "valibot";
|
|
903
|
+
var sparkFlashnetClawbackIntentSchema = v14.object({
|
|
904
|
+
type: v14.literal("clawback"),
|
|
905
|
+
data: v14.object({
|
|
906
|
+
senderPublicKey: v14.string(),
|
|
907
|
+
sparkTransferId: v14.string(),
|
|
908
|
+
lpIdentityPublicKey: v14.string(),
|
|
909
|
+
nonce: v14.string()
|
|
910
|
+
})
|
|
911
|
+
});
|
|
912
|
+
|
|
913
|
+
// src/request/types/sparkMethods/flashnetMethods/intents/confirmInitialDeposit.ts
|
|
914
|
+
import * as v15 from "valibot";
|
|
915
|
+
var sparkFlashnetConfirmInitialDepositIntentSchema = v15.object({
|
|
916
|
+
type: v15.literal("confirmInitialDeposit"),
|
|
917
|
+
data: v15.object({
|
|
918
|
+
poolId: v15.string(),
|
|
919
|
+
assetASparkTransferId: v15.string(),
|
|
920
|
+
poolOwnerPublicKey: v15.string(),
|
|
921
|
+
nonce: v15.string()
|
|
922
|
+
})
|
|
923
|
+
});
|
|
924
|
+
|
|
925
|
+
// src/request/types/sparkMethods/flashnetMethods/intents/createConstantProductPool.ts
|
|
926
|
+
import * as v16 from "valibot";
|
|
927
|
+
var sparkFlashnetCreateConstantProductPoolIntentSchema = v16.object({
|
|
928
|
+
type: v16.literal("createConstantProductPool"),
|
|
929
|
+
data: v16.object({
|
|
930
|
+
poolOwnerPublicKey: v16.string(),
|
|
931
|
+
assetAAddress: v16.string(),
|
|
932
|
+
assetBAddress: v16.string(),
|
|
933
|
+
lpFeeRateBps: v16.union([v16.number(), v16.string()]),
|
|
934
|
+
totalHostFeeRateBps: v16.union([v16.number(), v16.string()]),
|
|
935
|
+
nonce: v16.string()
|
|
936
|
+
})
|
|
937
|
+
});
|
|
938
|
+
|
|
939
|
+
// src/request/types/sparkMethods/flashnetMethods/intents/createSingleSidedPool.ts
|
|
940
|
+
import * as v17 from "valibot";
|
|
941
|
+
var sparkFlashnetCreateSingleSidedPoolIntentSchema = v17.object({
|
|
942
|
+
type: v17.literal("createSingleSidedPool"),
|
|
943
|
+
data: v17.object({
|
|
944
|
+
assetAAddress: v17.string(),
|
|
945
|
+
assetBAddress: v17.string(),
|
|
946
|
+
assetAInitialReserve: v17.string(),
|
|
947
|
+
virtualReserveA: v17.union([v17.number(), v17.string()]),
|
|
948
|
+
virtualReserveB: v17.union([v17.number(), v17.string()]),
|
|
949
|
+
threshold: v17.union([v17.number(), v17.string()]),
|
|
950
|
+
lpFeeRateBps: v17.union([v17.number(), v17.string()]),
|
|
951
|
+
totalHostFeeRateBps: v17.union([v17.number(), v17.string()]),
|
|
952
|
+
poolOwnerPublicKey: v17.string(),
|
|
953
|
+
nonce: v17.string()
|
|
954
|
+
})
|
|
955
|
+
});
|
|
956
|
+
|
|
957
|
+
// src/request/types/sparkMethods/flashnetMethods/intents/removeLiquidity.ts
|
|
958
|
+
import * as v18 from "valibot";
|
|
959
|
+
var sparkFlashnetRemoveLiquidityIntentSchema = v18.object({
|
|
960
|
+
type: v18.literal("removeLiquidity"),
|
|
961
|
+
data: v18.object({
|
|
962
|
+
userPublicKey: v18.string(),
|
|
963
|
+
poolId: v18.string(),
|
|
964
|
+
lpTokensToRemove: v18.string(),
|
|
965
|
+
nonce: v18.string()
|
|
966
|
+
})
|
|
967
|
+
});
|
|
968
|
+
|
|
969
|
+
// src/request/types/sparkMethods/flashnetMethods/intents/routeSwap.ts
|
|
970
|
+
import * as v19 from "valibot";
|
|
971
|
+
var sparkFlashnetRouteSwapIntentSchema = v19.object({
|
|
972
|
+
type: v19.literal("executeRouteSwap"),
|
|
973
|
+
data: v19.object({
|
|
974
|
+
userPublicKey: v19.string(),
|
|
975
|
+
initialSparkTransferId: v19.string(),
|
|
976
|
+
hops: v19.array(
|
|
977
|
+
v19.object({
|
|
978
|
+
poolId: v19.string(),
|
|
979
|
+
inputAssetAddress: v19.string(),
|
|
980
|
+
outputAssetAddress: v19.string(),
|
|
981
|
+
hopIntegratorFeeRateBps: v19.optional(v19.union([v19.number(), v19.string()]))
|
|
982
|
+
})
|
|
983
|
+
),
|
|
984
|
+
inputAmount: v19.string(),
|
|
985
|
+
maxRouteSlippageBps: v19.union([v19.number(), v19.string()]),
|
|
986
|
+
minAmountOut: v19.string(),
|
|
987
|
+
defaultIntegratorFeeRateBps: v19.optional(v19.union([v19.number(), v19.string()])),
|
|
988
|
+
nonce: v19.string()
|
|
989
|
+
})
|
|
990
|
+
});
|
|
991
|
+
|
|
992
|
+
// src/request/types/sparkMethods/flashnetMethods/intents/swap.ts
|
|
993
|
+
import * as v20 from "valibot";
|
|
994
|
+
var sparkFlashnetSwapIntentSchema = v20.object({
|
|
995
|
+
type: v20.literal("executeSwap"),
|
|
996
|
+
data: v20.object({
|
|
997
|
+
userPublicKey: v20.string(),
|
|
998
|
+
poolId: v20.string(),
|
|
999
|
+
transferId: v20.string(),
|
|
1000
|
+
assetInAddress: v20.string(),
|
|
1001
|
+
assetOutAddress: v20.string(),
|
|
1002
|
+
amountIn: v20.string(),
|
|
1003
|
+
maxSlippageBps: v20.union([v20.number(), v20.string()]),
|
|
1004
|
+
minAmountOut: v20.string(),
|
|
1005
|
+
totalIntegratorFeeRateBps: v20.optional(v20.union([v20.number(), v20.string()])),
|
|
1006
|
+
nonce: v20.string()
|
|
1007
|
+
})
|
|
1008
|
+
});
|
|
1009
|
+
|
|
1010
|
+
// src/request/types/sparkMethods/flashnetMethods/signIntent.ts
|
|
1011
|
+
import * as v21 from "valibot";
|
|
1012
|
+
var sparkFlashnetSignIntentMethodName = "spark_flashnet_signIntent";
|
|
1013
|
+
var sparkFlashnetSignIntentParamsSchema = v21.union([
|
|
1014
|
+
sparkFlashnetSwapIntentSchema,
|
|
1015
|
+
sparkFlashnetRouteSwapIntentSchema,
|
|
1016
|
+
sparkFlashnetAddLiquidityIntentSchema,
|
|
1017
|
+
sparkFlashnetClawbackIntentSchema,
|
|
1018
|
+
sparkFlashnetConfirmInitialDepositIntentSchema,
|
|
1019
|
+
sparkFlashnetCreateConstantProductPoolIntentSchema,
|
|
1020
|
+
sparkFlashnetCreateSingleSidedPoolIntentSchema,
|
|
1021
|
+
sparkFlashnetRemoveLiquidityIntentSchema
|
|
1022
|
+
]);
|
|
1023
|
+
var sparkFlashnetSignIntentResultSchema = v21.object({
|
|
1024
|
+
/**
|
|
1025
|
+
* The signed intent as a hex string.
|
|
1026
|
+
*/
|
|
1027
|
+
signature: v21.string()
|
|
1028
|
+
});
|
|
1029
|
+
var sparkFlashnetSignIntentRequestMessageSchema = v21.object({
|
|
1030
|
+
...rpcRequestMessageSchema.entries,
|
|
1031
|
+
...v21.object({
|
|
1032
|
+
method: v21.literal(sparkFlashnetSignIntentMethodName),
|
|
1033
|
+
params: sparkFlashnetSignIntentParamsSchema,
|
|
1034
|
+
id: v21.string()
|
|
1035
|
+
}).entries
|
|
1036
|
+
});
|
|
1037
|
+
|
|
1038
|
+
// src/request/types/sparkMethods/flashnetMethods/signStructuredMessage.ts
|
|
1039
|
+
import * as v22 from "valibot";
|
|
1040
|
+
var sparkFlashnetSignStructuredMessageMethodName = "spark_flashnet_signStructuredMessage";
|
|
1041
|
+
var sparkFlashnetSignStructuredMessageParamsSchema = v22.object({
|
|
1042
|
+
message: v22.string()
|
|
1043
|
+
});
|
|
1044
|
+
var sparkFlashnetSignStructuredMessageResultSchema = v22.object({
|
|
1045
|
+
message: v22.string(),
|
|
1046
|
+
signature: v22.string()
|
|
1047
|
+
});
|
|
1048
|
+
var sparkFlashnetSignStructuredMessageRequestMessageSchema = v22.object({
|
|
1049
|
+
...rpcRequestMessageSchema.entries,
|
|
1050
|
+
...v22.object({
|
|
1051
|
+
method: v22.literal(sparkFlashnetSignStructuredMessageMethodName),
|
|
1052
|
+
params: sparkFlashnetSignStructuredMessageParamsSchema,
|
|
1053
|
+
id: v22.string()
|
|
1054
|
+
}).entries
|
|
1055
|
+
});
|
|
1056
|
+
|
|
1057
|
+
// src/request/types/sparkMethods/getAddresses.ts
|
|
1058
|
+
import * as v23 from "valibot";
|
|
867
1059
|
var sparkGetAddressesMethodName = "spark_getAddresses";
|
|
868
|
-
var sparkGetAddressesParamsSchema =
|
|
869
|
-
|
|
1060
|
+
var sparkGetAddressesParamsSchema = v23.nullish(
|
|
1061
|
+
v23.object({
|
|
870
1062
|
/**
|
|
871
1063
|
* A message to be displayed to the user in the request prompt.
|
|
872
1064
|
*/
|
|
873
|
-
message:
|
|
1065
|
+
message: v23.optional(v23.string())
|
|
874
1066
|
})
|
|
875
1067
|
);
|
|
876
|
-
var sparkGetAddressesResultSchema =
|
|
1068
|
+
var sparkGetAddressesResultSchema = v23.object({
|
|
877
1069
|
/**
|
|
878
1070
|
* The addresses generated for the given purposes.
|
|
879
1071
|
*/
|
|
880
|
-
addresses:
|
|
1072
|
+
addresses: v23.array(addressSchema),
|
|
881
1073
|
network: getNetworkResultSchema
|
|
882
1074
|
});
|
|
883
|
-
var sparkGetAddressesRequestMessageSchema =
|
|
1075
|
+
var sparkGetAddressesRequestMessageSchema = v23.object({
|
|
884
1076
|
...rpcRequestMessageSchema.entries,
|
|
885
|
-
...
|
|
886
|
-
method:
|
|
1077
|
+
...v23.object({
|
|
1078
|
+
method: v23.literal(sparkGetAddressesMethodName),
|
|
887
1079
|
params: sparkGetAddressesParamsSchema,
|
|
888
|
-
id:
|
|
1080
|
+
id: v23.string()
|
|
889
1081
|
}).entries
|
|
890
1082
|
});
|
|
891
1083
|
|
|
892
1084
|
// src/request/types/sparkMethods/getBalance.ts
|
|
893
|
-
import * as
|
|
1085
|
+
import * as v24 from "valibot";
|
|
894
1086
|
var sparkGetBalanceMethodName = "spark_getBalance";
|
|
895
|
-
var sparkGetBalanceParamsSchema =
|
|
896
|
-
var sparkGetBalanceResultSchema =
|
|
1087
|
+
var sparkGetBalanceParamsSchema = v24.nullish(v24.null());
|
|
1088
|
+
var sparkGetBalanceResultSchema = v24.object({
|
|
897
1089
|
/**
|
|
898
1090
|
* The Spark Bitcoin address balance in sats in string form.
|
|
899
1091
|
*/
|
|
900
|
-
balance:
|
|
901
|
-
tokenBalances:
|
|
902
|
-
|
|
1092
|
+
balance: v24.string(),
|
|
1093
|
+
tokenBalances: v24.array(
|
|
1094
|
+
v24.object({
|
|
903
1095
|
/* The address balance of the token in string form as it can overflow a js number */
|
|
904
|
-
balance:
|
|
905
|
-
tokenMetadata:
|
|
906
|
-
tokenIdentifier:
|
|
907
|
-
tokenName:
|
|
908
|
-
tokenTicker:
|
|
909
|
-
decimals:
|
|
910
|
-
maxSupply:
|
|
1096
|
+
balance: v24.string(),
|
|
1097
|
+
tokenMetadata: v24.object({
|
|
1098
|
+
tokenIdentifier: v24.string(),
|
|
1099
|
+
tokenName: v24.string(),
|
|
1100
|
+
tokenTicker: v24.string(),
|
|
1101
|
+
decimals: v24.number(),
|
|
1102
|
+
maxSupply: v24.string()
|
|
911
1103
|
})
|
|
912
1104
|
})
|
|
913
1105
|
)
|
|
914
1106
|
});
|
|
915
|
-
var sparkGetBalanceRequestMessageSchema =
|
|
1107
|
+
var sparkGetBalanceRequestMessageSchema = v24.object({
|
|
916
1108
|
...rpcRequestMessageSchema.entries,
|
|
917
|
-
...
|
|
918
|
-
method:
|
|
1109
|
+
...v24.object({
|
|
1110
|
+
method: v24.literal(sparkGetBalanceMethodName),
|
|
919
1111
|
params: sparkGetBalanceParamsSchema,
|
|
920
|
-
id:
|
|
1112
|
+
id: v24.string()
|
|
921
1113
|
}).entries
|
|
922
1114
|
});
|
|
923
1115
|
|
|
924
1116
|
// src/request/types/sparkMethods/transfer.ts
|
|
925
|
-
import * as
|
|
1117
|
+
import * as v25 from "valibot";
|
|
926
1118
|
var sparkTransferMethodName = "spark_transfer";
|
|
927
|
-
var sparkTransferParamsSchema =
|
|
1119
|
+
var sparkTransferParamsSchema = v25.object({
|
|
928
1120
|
/**
|
|
929
1121
|
* Amount of SATS to transfer as a string or number.
|
|
930
1122
|
*/
|
|
931
|
-
amountSats:
|
|
1123
|
+
amountSats: v25.union([v25.number(), v25.string()]),
|
|
932
1124
|
/**
|
|
933
1125
|
* The recipient's spark address.
|
|
934
1126
|
*/
|
|
935
|
-
receiverSparkAddress:
|
|
1127
|
+
receiverSparkAddress: v25.string()
|
|
936
1128
|
});
|
|
937
|
-
var sparkTransferResultSchema =
|
|
1129
|
+
var sparkTransferResultSchema = v25.object({
|
|
938
1130
|
/**
|
|
939
1131
|
* The ID of the transaction.
|
|
940
1132
|
*/
|
|
941
|
-
id:
|
|
1133
|
+
id: v25.string()
|
|
942
1134
|
});
|
|
943
|
-
var sparkTransferRequestMessageSchema =
|
|
1135
|
+
var sparkTransferRequestMessageSchema = v25.object({
|
|
944
1136
|
...rpcRequestMessageSchema.entries,
|
|
945
|
-
...
|
|
946
|
-
method:
|
|
1137
|
+
...v25.object({
|
|
1138
|
+
method: v25.literal(sparkTransferMethodName),
|
|
947
1139
|
params: sparkTransferParamsSchema,
|
|
948
|
-
id:
|
|
1140
|
+
id: v25.string()
|
|
949
1141
|
}).entries
|
|
950
1142
|
});
|
|
951
1143
|
|
|
952
1144
|
// src/request/types/sparkMethods/transferToken.ts
|
|
953
|
-
import * as
|
|
1145
|
+
import * as v26 from "valibot";
|
|
954
1146
|
var sparkTransferTokenMethodName = "spark_transferToken";
|
|
955
|
-
var sparkTransferTokenParamsSchema =
|
|
1147
|
+
var sparkTransferTokenParamsSchema = v26.object({
|
|
956
1148
|
/**
|
|
957
1149
|
* Amount of units of the token to transfer as a string or number.
|
|
958
1150
|
*/
|
|
959
|
-
tokenAmount:
|
|
1151
|
+
tokenAmount: v26.union([v26.number(), v26.string()]),
|
|
960
1152
|
/**
|
|
961
1153
|
* The Bech32m token identifier.
|
|
962
1154
|
*/
|
|
963
|
-
tokenIdentifier:
|
|
1155
|
+
tokenIdentifier: v26.string(),
|
|
964
1156
|
/**
|
|
965
1157
|
* The recipient's spark address.
|
|
966
1158
|
*/
|
|
967
|
-
receiverSparkAddress:
|
|
1159
|
+
receiverSparkAddress: v26.string()
|
|
968
1160
|
});
|
|
969
|
-
var sparkTransferTokenResultSchema =
|
|
1161
|
+
var sparkTransferTokenResultSchema = v26.object({
|
|
970
1162
|
/**
|
|
971
1163
|
* The ID of the transaction.
|
|
972
1164
|
*/
|
|
973
|
-
id:
|
|
1165
|
+
id: v26.string()
|
|
974
1166
|
});
|
|
975
|
-
var sparkTransferTokenRequestMessageSchema =
|
|
1167
|
+
var sparkTransferTokenRequestMessageSchema = v26.object({
|
|
976
1168
|
...rpcRequestMessageSchema.entries,
|
|
977
|
-
...
|
|
978
|
-
method:
|
|
1169
|
+
...v26.object({
|
|
1170
|
+
method: v26.literal(sparkTransferTokenMethodName),
|
|
979
1171
|
params: sparkTransferTokenParamsSchema,
|
|
980
|
-
id:
|
|
1172
|
+
id: v26.string()
|
|
981
1173
|
}).entries
|
|
982
1174
|
});
|
|
983
1175
|
|
|
984
1176
|
// src/request/types/stxMethods/callContract.ts
|
|
985
|
-
import * as
|
|
1177
|
+
import * as v27 from "valibot";
|
|
986
1178
|
var stxCallContractMethodName = "stx_callContract";
|
|
987
|
-
var stxCallContractParamsSchema =
|
|
1179
|
+
var stxCallContractParamsSchema = v27.object({
|
|
988
1180
|
/**
|
|
989
1181
|
* The contract principal.
|
|
990
1182
|
*
|
|
991
1183
|
* E.g. `"SPKE...GD5C.my-contract"`
|
|
992
1184
|
*/
|
|
993
|
-
contract:
|
|
1185
|
+
contract: v27.string(),
|
|
994
1186
|
/**
|
|
995
1187
|
* The name of the function to call.
|
|
996
1188
|
*
|
|
997
1189
|
* Note: spec changes ongoing,
|
|
998
1190
|
* https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
|
|
999
1191
|
*/
|
|
1000
|
-
functionName:
|
|
1192
|
+
functionName: v27.string(),
|
|
1001
1193
|
/**
|
|
1002
1194
|
* @deprecated in favor of `functionArgs` for @stacks/connect compatibility
|
|
1003
1195
|
*/
|
|
1004
|
-
arguments:
|
|
1196
|
+
arguments: v27.optional(v27.array(v27.string())),
|
|
1005
1197
|
/**
|
|
1006
1198
|
* The function's arguments. The arguments are expected to be hex-encoded
|
|
1007
1199
|
* strings of Clarity values.
|
|
@@ -1016,274 +1208,274 @@ var stxCallContractParamsSchema = v16.object({
|
|
|
1016
1208
|
* const hexArgs = functionArgs.map(cvToHex);
|
|
1017
1209
|
* ```
|
|
1018
1210
|
*/
|
|
1019
|
-
functionArgs:
|
|
1211
|
+
functionArgs: v27.optional(v27.array(v27.string())),
|
|
1020
1212
|
/**
|
|
1021
1213
|
* The post conditions to apply to the contract call.
|
|
1022
1214
|
*/
|
|
1023
|
-
postConditions:
|
|
1215
|
+
postConditions: v27.optional(v27.array(v27.string())),
|
|
1024
1216
|
/**
|
|
1025
1217
|
* The mode to apply to the post conditions.
|
|
1026
1218
|
*/
|
|
1027
|
-
postConditionMode:
|
|
1219
|
+
postConditionMode: v27.optional(v27.union([v27.literal("allow"), v27.literal("deny")]))
|
|
1028
1220
|
});
|
|
1029
|
-
var stxCallContractResultSchema =
|
|
1221
|
+
var stxCallContractResultSchema = v27.object({
|
|
1030
1222
|
/**
|
|
1031
1223
|
* The ID of the transaction.
|
|
1032
1224
|
*/
|
|
1033
|
-
txid:
|
|
1225
|
+
txid: v27.string(),
|
|
1034
1226
|
/**
|
|
1035
1227
|
* A Stacks transaction as a hex-encoded string.
|
|
1036
1228
|
*/
|
|
1037
|
-
transaction:
|
|
1229
|
+
transaction: v27.string()
|
|
1038
1230
|
});
|
|
1039
|
-
var stxCallContractRequestMessageSchema =
|
|
1231
|
+
var stxCallContractRequestMessageSchema = v27.object({
|
|
1040
1232
|
...rpcRequestMessageSchema.entries,
|
|
1041
|
-
...
|
|
1042
|
-
method:
|
|
1233
|
+
...v27.object({
|
|
1234
|
+
method: v27.literal(stxCallContractMethodName),
|
|
1043
1235
|
params: stxCallContractParamsSchema,
|
|
1044
|
-
id:
|
|
1236
|
+
id: v27.string()
|
|
1045
1237
|
}).entries
|
|
1046
1238
|
});
|
|
1047
1239
|
|
|
1048
1240
|
// src/request/types/stxMethods/deployContract.ts
|
|
1049
|
-
import * as
|
|
1241
|
+
import * as v28 from "valibot";
|
|
1050
1242
|
var stxDeployContractMethodName = "stx_deployContract";
|
|
1051
|
-
var stxDeployContractParamsSchema =
|
|
1243
|
+
var stxDeployContractParamsSchema = v28.object({
|
|
1052
1244
|
/**
|
|
1053
1245
|
* Name of the contract.
|
|
1054
1246
|
*/
|
|
1055
|
-
name:
|
|
1247
|
+
name: v28.string(),
|
|
1056
1248
|
/**
|
|
1057
1249
|
* The source code of the Clarity contract.
|
|
1058
1250
|
*/
|
|
1059
|
-
clarityCode:
|
|
1251
|
+
clarityCode: v28.string(),
|
|
1060
1252
|
/**
|
|
1061
1253
|
* The version of the Clarity contract.
|
|
1062
1254
|
*/
|
|
1063
|
-
clarityVersion:
|
|
1255
|
+
clarityVersion: v28.optional(v28.number()),
|
|
1064
1256
|
/**
|
|
1065
1257
|
* The post conditions to apply to the contract call.
|
|
1066
1258
|
*/
|
|
1067
|
-
postConditions:
|
|
1259
|
+
postConditions: v28.optional(v28.array(v28.string())),
|
|
1068
1260
|
/**
|
|
1069
1261
|
* The mode to apply to the post conditions.
|
|
1070
1262
|
*/
|
|
1071
|
-
postConditionMode:
|
|
1263
|
+
postConditionMode: v28.optional(v28.union([v28.literal("allow"), v28.literal("deny")]))
|
|
1072
1264
|
});
|
|
1073
|
-
var stxDeployContractResultSchema =
|
|
1265
|
+
var stxDeployContractResultSchema = v28.object({
|
|
1074
1266
|
/**
|
|
1075
1267
|
* The ID of the transaction.
|
|
1076
1268
|
*/
|
|
1077
|
-
txid:
|
|
1269
|
+
txid: v28.string(),
|
|
1078
1270
|
/**
|
|
1079
1271
|
* A Stacks transaction as a hex-encoded string.
|
|
1080
1272
|
*/
|
|
1081
|
-
transaction:
|
|
1273
|
+
transaction: v28.string()
|
|
1082
1274
|
});
|
|
1083
|
-
var stxDeployContractRequestMessageSchema =
|
|
1275
|
+
var stxDeployContractRequestMessageSchema = v28.object({
|
|
1084
1276
|
...rpcRequestMessageSchema.entries,
|
|
1085
|
-
...
|
|
1086
|
-
method:
|
|
1277
|
+
...v28.object({
|
|
1278
|
+
method: v28.literal(stxDeployContractMethodName),
|
|
1087
1279
|
params: stxDeployContractParamsSchema,
|
|
1088
|
-
id:
|
|
1280
|
+
id: v28.string()
|
|
1089
1281
|
}).entries
|
|
1090
1282
|
});
|
|
1091
1283
|
|
|
1092
1284
|
// src/request/types/stxMethods/getAccounts.ts
|
|
1093
|
-
import * as
|
|
1285
|
+
import * as v29 from "valibot";
|
|
1094
1286
|
var stxGetAccountsMethodName = "stx_getAccounts";
|
|
1095
|
-
var stxGetAccountsParamsSchema =
|
|
1096
|
-
var stxGetAccountsResultSchema =
|
|
1287
|
+
var stxGetAccountsParamsSchema = v29.nullish(v29.null());
|
|
1288
|
+
var stxGetAccountsResultSchema = v29.object({
|
|
1097
1289
|
/**
|
|
1098
1290
|
* The addresses generated for the given purposes.
|
|
1099
1291
|
*/
|
|
1100
|
-
addresses:
|
|
1101
|
-
|
|
1102
|
-
address:
|
|
1103
|
-
publicKey:
|
|
1104
|
-
gaiaHubUrl:
|
|
1105
|
-
gaiaAppKey:
|
|
1292
|
+
addresses: v29.array(
|
|
1293
|
+
v29.object({
|
|
1294
|
+
address: v29.string(),
|
|
1295
|
+
publicKey: v29.string(),
|
|
1296
|
+
gaiaHubUrl: v29.string(),
|
|
1297
|
+
gaiaAppKey: v29.string()
|
|
1106
1298
|
})
|
|
1107
1299
|
),
|
|
1108
1300
|
network: getNetworkResultSchema
|
|
1109
1301
|
});
|
|
1110
|
-
var stxGetAccountsRequestMessageSchema =
|
|
1302
|
+
var stxGetAccountsRequestMessageSchema = v29.object({
|
|
1111
1303
|
...rpcRequestMessageSchema.entries,
|
|
1112
|
-
...
|
|
1113
|
-
method:
|
|
1304
|
+
...v29.object({
|
|
1305
|
+
method: v29.literal(stxGetAccountsMethodName),
|
|
1114
1306
|
params: stxGetAccountsParamsSchema,
|
|
1115
|
-
id:
|
|
1307
|
+
id: v29.string()
|
|
1116
1308
|
}).entries
|
|
1117
1309
|
});
|
|
1118
1310
|
|
|
1119
1311
|
// src/request/types/stxMethods/getAddresses.ts
|
|
1120
|
-
import * as
|
|
1312
|
+
import * as v30 from "valibot";
|
|
1121
1313
|
var stxGetAddressesMethodName = "stx_getAddresses";
|
|
1122
|
-
var stxGetAddressesParamsSchema =
|
|
1123
|
-
|
|
1314
|
+
var stxGetAddressesParamsSchema = v30.nullish(
|
|
1315
|
+
v30.object({
|
|
1124
1316
|
/**
|
|
1125
1317
|
* A message to be displayed to the user in the request prompt.
|
|
1126
1318
|
*/
|
|
1127
|
-
message:
|
|
1319
|
+
message: v30.optional(v30.string())
|
|
1128
1320
|
})
|
|
1129
1321
|
);
|
|
1130
|
-
var stxGetAddressesResultSchema =
|
|
1322
|
+
var stxGetAddressesResultSchema = v30.object({
|
|
1131
1323
|
/**
|
|
1132
1324
|
* The addresses generated for the given purposes.
|
|
1133
1325
|
*/
|
|
1134
|
-
addresses:
|
|
1326
|
+
addresses: v30.array(addressSchema),
|
|
1135
1327
|
network: getNetworkResultSchema
|
|
1136
1328
|
});
|
|
1137
|
-
var stxGetAddressesRequestMessageSchema =
|
|
1329
|
+
var stxGetAddressesRequestMessageSchema = v30.object({
|
|
1138
1330
|
...rpcRequestMessageSchema.entries,
|
|
1139
|
-
...
|
|
1140
|
-
method:
|
|
1331
|
+
...v30.object({
|
|
1332
|
+
method: v30.literal(stxGetAddressesMethodName),
|
|
1141
1333
|
params: stxGetAddressesParamsSchema,
|
|
1142
|
-
id:
|
|
1334
|
+
id: v30.string()
|
|
1143
1335
|
}).entries
|
|
1144
1336
|
});
|
|
1145
1337
|
|
|
1146
1338
|
// src/request/types/stxMethods/signMessage.ts
|
|
1147
|
-
import * as
|
|
1339
|
+
import * as v31 from "valibot";
|
|
1148
1340
|
var stxSignMessageMethodName = "stx_signMessage";
|
|
1149
|
-
var stxSignMessageParamsSchema =
|
|
1341
|
+
var stxSignMessageParamsSchema = v31.object({
|
|
1150
1342
|
/**
|
|
1151
1343
|
* The message to sign.
|
|
1152
1344
|
*/
|
|
1153
|
-
message:
|
|
1345
|
+
message: v31.string()
|
|
1154
1346
|
});
|
|
1155
|
-
var stxSignMessageResultSchema =
|
|
1347
|
+
var stxSignMessageResultSchema = v31.object({
|
|
1156
1348
|
/**
|
|
1157
1349
|
* The signature of the message.
|
|
1158
1350
|
*/
|
|
1159
|
-
signature:
|
|
1351
|
+
signature: v31.string(),
|
|
1160
1352
|
/**
|
|
1161
1353
|
* The public key used to sign the message.
|
|
1162
1354
|
*/
|
|
1163
|
-
publicKey:
|
|
1355
|
+
publicKey: v31.string()
|
|
1164
1356
|
});
|
|
1165
|
-
var stxSignMessageRequestMessageSchema =
|
|
1357
|
+
var stxSignMessageRequestMessageSchema = v31.object({
|
|
1166
1358
|
...rpcRequestMessageSchema.entries,
|
|
1167
|
-
...
|
|
1168
|
-
method:
|
|
1359
|
+
...v31.object({
|
|
1360
|
+
method: v31.literal(stxSignMessageMethodName),
|
|
1169
1361
|
params: stxSignMessageParamsSchema,
|
|
1170
|
-
id:
|
|
1362
|
+
id: v31.string()
|
|
1171
1363
|
}).entries
|
|
1172
1364
|
});
|
|
1173
1365
|
|
|
1174
1366
|
// src/request/types/stxMethods/signStructuredMessage.ts
|
|
1175
|
-
import * as
|
|
1367
|
+
import * as v32 from "valibot";
|
|
1176
1368
|
var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
|
|
1177
|
-
var stxSignStructuredMessageParamsSchema =
|
|
1369
|
+
var stxSignStructuredMessageParamsSchema = v32.object({
|
|
1178
1370
|
/**
|
|
1179
1371
|
* The domain to be signed.
|
|
1180
1372
|
*/
|
|
1181
|
-
domain:
|
|
1373
|
+
domain: v32.string(),
|
|
1182
1374
|
/**
|
|
1183
1375
|
* Message payload to be signed.
|
|
1184
1376
|
*/
|
|
1185
|
-
message:
|
|
1377
|
+
message: v32.string(),
|
|
1186
1378
|
/**
|
|
1187
1379
|
* The public key to sign the message with.
|
|
1188
1380
|
*/
|
|
1189
|
-
publicKey:
|
|
1381
|
+
publicKey: v32.optional(v32.string())
|
|
1190
1382
|
});
|
|
1191
|
-
var stxSignStructuredMessageResultSchema =
|
|
1383
|
+
var stxSignStructuredMessageResultSchema = v32.object({
|
|
1192
1384
|
/**
|
|
1193
1385
|
* Signature of the message.
|
|
1194
1386
|
*/
|
|
1195
|
-
signature:
|
|
1387
|
+
signature: v32.string(),
|
|
1196
1388
|
/**
|
|
1197
1389
|
* Public key as hex-encoded string.
|
|
1198
1390
|
*/
|
|
1199
|
-
publicKey:
|
|
1391
|
+
publicKey: v32.string()
|
|
1200
1392
|
});
|
|
1201
|
-
var stxSignStructuredMessageRequestMessageSchema =
|
|
1393
|
+
var stxSignStructuredMessageRequestMessageSchema = v32.object({
|
|
1202
1394
|
...rpcRequestMessageSchema.entries,
|
|
1203
|
-
...
|
|
1204
|
-
method:
|
|
1395
|
+
...v32.object({
|
|
1396
|
+
method: v32.literal(stxSignStructuredMessageMethodName),
|
|
1205
1397
|
params: stxSignStructuredMessageParamsSchema,
|
|
1206
|
-
id:
|
|
1398
|
+
id: v32.string()
|
|
1207
1399
|
}).entries
|
|
1208
1400
|
});
|
|
1209
1401
|
|
|
1210
1402
|
// src/request/types/stxMethods/signTransaction.ts
|
|
1211
|
-
import * as
|
|
1403
|
+
import * as v33 from "valibot";
|
|
1212
1404
|
var stxSignTransactionMethodName = "stx_signTransaction";
|
|
1213
|
-
var stxSignTransactionParamsSchema =
|
|
1405
|
+
var stxSignTransactionParamsSchema = v33.object({
|
|
1214
1406
|
/**
|
|
1215
1407
|
* The transaction to sign as a hex-encoded string.
|
|
1216
1408
|
*/
|
|
1217
|
-
transaction:
|
|
1409
|
+
transaction: v33.string(),
|
|
1218
1410
|
/**
|
|
1219
1411
|
* The public key to sign the transaction with. The wallet may use any key
|
|
1220
1412
|
* when not provided.
|
|
1221
1413
|
*/
|
|
1222
|
-
pubkey:
|
|
1414
|
+
pubkey: v33.optional(v33.string()),
|
|
1223
1415
|
/**
|
|
1224
1416
|
* Whether to broadcast the transaction after signing. Defaults to `true`.
|
|
1225
1417
|
*/
|
|
1226
|
-
broadcast:
|
|
1418
|
+
broadcast: v33.optional(v33.boolean())
|
|
1227
1419
|
});
|
|
1228
|
-
var stxSignTransactionResultSchema =
|
|
1420
|
+
var stxSignTransactionResultSchema = v33.object({
|
|
1229
1421
|
/**
|
|
1230
1422
|
* The signed transaction as a hex-encoded string.
|
|
1231
1423
|
*/
|
|
1232
|
-
transaction:
|
|
1424
|
+
transaction: v33.string()
|
|
1233
1425
|
});
|
|
1234
|
-
var stxSignTransactionRequestMessageSchema =
|
|
1426
|
+
var stxSignTransactionRequestMessageSchema = v33.object({
|
|
1235
1427
|
...rpcRequestMessageSchema.entries,
|
|
1236
|
-
...
|
|
1237
|
-
method:
|
|
1428
|
+
...v33.object({
|
|
1429
|
+
method: v33.literal(stxSignTransactionMethodName),
|
|
1238
1430
|
params: stxSignTransactionParamsSchema,
|
|
1239
|
-
id:
|
|
1431
|
+
id: v33.string()
|
|
1240
1432
|
}).entries
|
|
1241
1433
|
});
|
|
1242
1434
|
|
|
1243
1435
|
// src/request/types/stxMethods/signTransactions.ts
|
|
1244
|
-
import * as
|
|
1436
|
+
import * as v34 from "valibot";
|
|
1245
1437
|
var stxSignTransactionsMethodName = "stx_signTransactions";
|
|
1246
|
-
var stxSignTransactionsParamsSchema =
|
|
1438
|
+
var stxSignTransactionsParamsSchema = v34.object({
|
|
1247
1439
|
/**
|
|
1248
1440
|
* The transactions to sign as hex-encoded strings.
|
|
1249
1441
|
*/
|
|
1250
|
-
transactions:
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1442
|
+
transactions: v34.pipe(
|
|
1443
|
+
v34.array(
|
|
1444
|
+
v34.pipe(
|
|
1445
|
+
v34.string(),
|
|
1446
|
+
v34.check((hex) => {
|
|
1255
1447
|
return true;
|
|
1256
1448
|
}, "Invalid hex-encoded Stacks transaction.")
|
|
1257
1449
|
)
|
|
1258
1450
|
),
|
|
1259
|
-
|
|
1451
|
+
v34.minLength(1)
|
|
1260
1452
|
),
|
|
1261
1453
|
/**
|
|
1262
1454
|
* Whether the signed transactions should be broadcast after signing. Defaults
|
|
1263
1455
|
* to `true`.
|
|
1264
1456
|
*/
|
|
1265
|
-
broadcast:
|
|
1457
|
+
broadcast: v34.optional(v34.boolean())
|
|
1266
1458
|
});
|
|
1267
|
-
var stxSignTransactionsResultSchema =
|
|
1459
|
+
var stxSignTransactionsResultSchema = v34.object({
|
|
1268
1460
|
/**
|
|
1269
1461
|
* The signed transactions as hex-encoded strings, in the same order as in the
|
|
1270
1462
|
* sign request.
|
|
1271
1463
|
*/
|
|
1272
|
-
transactions:
|
|
1464
|
+
transactions: v34.array(v34.string())
|
|
1273
1465
|
});
|
|
1274
|
-
var stxSignTransactionsRequestMessageSchema =
|
|
1466
|
+
var stxSignTransactionsRequestMessageSchema = v34.object({
|
|
1275
1467
|
...rpcRequestMessageSchema.entries,
|
|
1276
|
-
...
|
|
1277
|
-
method:
|
|
1468
|
+
...v34.object({
|
|
1469
|
+
method: v34.literal(stxSignTransactionsMethodName),
|
|
1278
1470
|
params: stxSignTransactionsParamsSchema,
|
|
1279
|
-
id:
|
|
1471
|
+
id: v34.string()
|
|
1280
1472
|
}).entries
|
|
1281
1473
|
});
|
|
1282
1474
|
|
|
1283
1475
|
// src/request/types/stxMethods/transferStx.ts
|
|
1284
|
-
import * as
|
|
1476
|
+
import * as v35 from "valibot";
|
|
1285
1477
|
var stxTransferStxMethodName = "stx_transferStx";
|
|
1286
|
-
var stxTransferStxParamsSchema =
|
|
1478
|
+
var stxTransferStxParamsSchema = v35.object({
|
|
1287
1479
|
/**
|
|
1288
1480
|
* Amount of STX tokens to transfer in microstacks as a string. Anything
|
|
1289
1481
|
* parseable by `BigInt` is acceptable.
|
|
@@ -1296,23 +1488,23 @@ var stxTransferStxParamsSchema = v24.object({
|
|
|
1296
1488
|
* const amount3 = '1234';
|
|
1297
1489
|
* ```
|
|
1298
1490
|
*/
|
|
1299
|
-
amount:
|
|
1491
|
+
amount: v35.union([v35.number(), v35.string()]),
|
|
1300
1492
|
/**
|
|
1301
1493
|
* The recipient's principal.
|
|
1302
1494
|
*/
|
|
1303
|
-
recipient:
|
|
1495
|
+
recipient: v35.string(),
|
|
1304
1496
|
/**
|
|
1305
1497
|
* A string representing the memo.
|
|
1306
1498
|
*/
|
|
1307
|
-
memo:
|
|
1499
|
+
memo: v35.optional(v35.string()),
|
|
1308
1500
|
/**
|
|
1309
1501
|
* Version of parameter format.
|
|
1310
1502
|
*/
|
|
1311
|
-
version:
|
|
1503
|
+
version: v35.optional(v35.string()),
|
|
1312
1504
|
/**
|
|
1313
1505
|
* The mode of the post conditions.
|
|
1314
1506
|
*/
|
|
1315
|
-
postConditionMode:
|
|
1507
|
+
postConditionMode: v35.optional(v35.number()),
|
|
1316
1508
|
/**
|
|
1317
1509
|
* A hex-encoded string representing the post conditions.
|
|
1318
1510
|
*
|
|
@@ -1325,29 +1517,29 @@ var stxTransferStxParamsSchema = v24.object({
|
|
|
1325
1517
|
* const hexPostCondition = serializePostCondition(postCondition).toString('hex');
|
|
1326
1518
|
* ```
|
|
1327
1519
|
*/
|
|
1328
|
-
postConditions:
|
|
1520
|
+
postConditions: v35.optional(v35.array(v35.string())),
|
|
1329
1521
|
/**
|
|
1330
1522
|
* The public key to sign the transaction with. The wallet may use any key
|
|
1331
1523
|
* when not provided.
|
|
1332
1524
|
*/
|
|
1333
|
-
pubkey:
|
|
1525
|
+
pubkey: v35.optional(v35.string())
|
|
1334
1526
|
});
|
|
1335
|
-
var stxTransferStxResultSchema =
|
|
1527
|
+
var stxTransferStxResultSchema = v35.object({
|
|
1336
1528
|
/**
|
|
1337
1529
|
* The ID of the transaction.
|
|
1338
1530
|
*/
|
|
1339
|
-
txid:
|
|
1531
|
+
txid: v35.string(),
|
|
1340
1532
|
/**
|
|
1341
1533
|
* A Stacks transaction as a hex-encoded string.
|
|
1342
1534
|
*/
|
|
1343
|
-
transaction:
|
|
1535
|
+
transaction: v35.string()
|
|
1344
1536
|
});
|
|
1345
|
-
var stxTransferStxRequestMessageSchema =
|
|
1537
|
+
var stxTransferStxRequestMessageSchema = v35.object({
|
|
1346
1538
|
...rpcRequestMessageSchema.entries,
|
|
1347
|
-
...
|
|
1348
|
-
method:
|
|
1539
|
+
...v35.object({
|
|
1540
|
+
method: v35.literal(stxTransferStxMethodName),
|
|
1349
1541
|
params: stxTransferStxParamsSchema,
|
|
1350
|
-
id:
|
|
1542
|
+
id: v35.string()
|
|
1351
1543
|
}).entries
|
|
1352
1544
|
});
|
|
1353
1545
|
|
|
@@ -1355,13 +1547,13 @@ var stxTransferStxRequestMessageSchema = v24.object({
|
|
|
1355
1547
|
var cache = {};
|
|
1356
1548
|
var requestInternal = async (provider, method, params) => {
|
|
1357
1549
|
const response = await provider.request(method, params);
|
|
1358
|
-
if (
|
|
1550
|
+
if (v36.is(rpcErrorResponseMessageSchema, response)) {
|
|
1359
1551
|
return {
|
|
1360
1552
|
status: "error",
|
|
1361
1553
|
error: response.error
|
|
1362
1554
|
};
|
|
1363
1555
|
}
|
|
1364
|
-
if (
|
|
1556
|
+
if (v36.is(rpcSuccessResponseMessageSchema, response)) {
|
|
1365
1557
|
return {
|
|
1366
1558
|
status: "success",
|
|
1367
1559
|
result: response.result
|
|
@@ -2549,6 +2741,26 @@ export {
|
|
|
2549
2741
|
signPsbtRequestMessageSchema,
|
|
2550
2742
|
signPsbtResultSchema,
|
|
2551
2743
|
signTransaction,
|
|
2744
|
+
sparkFlashnetAddLiquidityIntentSchema,
|
|
2745
|
+
sparkFlashnetClawbackIntentSchema,
|
|
2746
|
+
sparkFlashnetConfirmInitialDepositIntentSchema,
|
|
2747
|
+
sparkFlashnetCreateConstantProductPoolIntentSchema,
|
|
2748
|
+
sparkFlashnetCreateSingleSidedPoolIntentSchema,
|
|
2749
|
+
sparkFlashnetGetJwtMethodName,
|
|
2750
|
+
sparkFlashnetGetJwtParamsSchema,
|
|
2751
|
+
sparkFlashnetGetJwtRequestMessageSchema,
|
|
2752
|
+
sparkFlashnetGetJwtResultSchema,
|
|
2753
|
+
sparkFlashnetRemoveLiquidityIntentSchema,
|
|
2754
|
+
sparkFlashnetRouteSwapIntentSchema,
|
|
2755
|
+
sparkFlashnetSignIntentMethodName,
|
|
2756
|
+
sparkFlashnetSignIntentParamsSchema,
|
|
2757
|
+
sparkFlashnetSignIntentRequestMessageSchema,
|
|
2758
|
+
sparkFlashnetSignIntentResultSchema,
|
|
2759
|
+
sparkFlashnetSignStructuredMessageMethodName,
|
|
2760
|
+
sparkFlashnetSignStructuredMessageParamsSchema,
|
|
2761
|
+
sparkFlashnetSignStructuredMessageRequestMessageSchema,
|
|
2762
|
+
sparkFlashnetSignStructuredMessageResultSchema,
|
|
2763
|
+
sparkFlashnetSwapIntentSchema,
|
|
2552
2764
|
sparkGetAddressesMethodName,
|
|
2553
2765
|
sparkGetAddressesParamsSchema,
|
|
2554
2766
|
sparkGetAddressesRequestMessageSchema,
|