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