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