@sats-connect/core 0.8.0 → 0.8.1-29f926e
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 +29 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +173 -140
- package/dist/index.mjs +169 -140
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -192,7 +192,7 @@ function getSupportedWallets() {
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
// src/request/index.ts
|
|
195
|
-
import * as
|
|
195
|
+
import * as v26 from "valibot";
|
|
196
196
|
|
|
197
197
|
// src/request/types/btcMethods.ts
|
|
198
198
|
import * as v6 from "valibot";
|
|
@@ -864,87 +864,112 @@ var sparkGetBalanceRequestMessageSchema = v13.object({
|
|
|
864
864
|
}).entries
|
|
865
865
|
});
|
|
866
866
|
|
|
867
|
-
// src/request/types/sparkMethods/
|
|
867
|
+
// src/request/types/sparkMethods/signMessage.ts
|
|
868
868
|
import * as v14 from "valibot";
|
|
869
|
+
var sparkSignMessageMethodName = "spark_signMessage";
|
|
870
|
+
var sparkSignMessageParamsSchema = v14.object({
|
|
871
|
+
message: v14.string()
|
|
872
|
+
});
|
|
873
|
+
var sparkSignMessageResultSchema = v14.object({
|
|
874
|
+
/**
|
|
875
|
+
* The signature for the message in hex format
|
|
876
|
+
*/
|
|
877
|
+
signature: v14.string(),
|
|
878
|
+
/**
|
|
879
|
+
* The address that signed the message
|
|
880
|
+
*/
|
|
881
|
+
address: v14.string()
|
|
882
|
+
});
|
|
883
|
+
var sparkSignMessageRequestMessageSchema = v14.object({
|
|
884
|
+
...rpcRequestMessageSchema.entries,
|
|
885
|
+
...v14.object({
|
|
886
|
+
method: v14.literal(sparkSignMessageMethodName),
|
|
887
|
+
params: sparkSignMessageParamsSchema,
|
|
888
|
+
id: v14.string()
|
|
889
|
+
}).entries
|
|
890
|
+
});
|
|
891
|
+
|
|
892
|
+
// src/request/types/sparkMethods/transfer.ts
|
|
893
|
+
import * as v15 from "valibot";
|
|
869
894
|
var sparkTransferMethodName = "spark_transfer";
|
|
870
|
-
var sparkTransferParamsSchema =
|
|
895
|
+
var sparkTransferParamsSchema = v15.object({
|
|
871
896
|
/**
|
|
872
897
|
* Amount of SATS to transfer as a string or number.
|
|
873
898
|
*/
|
|
874
|
-
amountSats:
|
|
899
|
+
amountSats: v15.union([v15.number(), v15.string()]),
|
|
875
900
|
/**
|
|
876
901
|
* The recipient's spark address.
|
|
877
902
|
*/
|
|
878
|
-
receiverSparkAddress:
|
|
903
|
+
receiverSparkAddress: v15.string()
|
|
879
904
|
});
|
|
880
|
-
var sparkTransferResultSchema =
|
|
905
|
+
var sparkTransferResultSchema = v15.object({
|
|
881
906
|
/**
|
|
882
907
|
* The ID of the transaction.
|
|
883
908
|
*/
|
|
884
|
-
id:
|
|
909
|
+
id: v15.string()
|
|
885
910
|
});
|
|
886
|
-
var sparkTransferRequestMessageSchema =
|
|
911
|
+
var sparkTransferRequestMessageSchema = v15.object({
|
|
887
912
|
...rpcRequestMessageSchema.entries,
|
|
888
|
-
...
|
|
889
|
-
method:
|
|
913
|
+
...v15.object({
|
|
914
|
+
method: v15.literal(sparkTransferMethodName),
|
|
890
915
|
params: sparkTransferParamsSchema,
|
|
891
|
-
id:
|
|
916
|
+
id: v15.string()
|
|
892
917
|
}).entries
|
|
893
918
|
});
|
|
894
919
|
|
|
895
920
|
// src/request/types/sparkMethods/transferToken.ts
|
|
896
|
-
import * as
|
|
921
|
+
import * as v16 from "valibot";
|
|
897
922
|
var sparkTransferTokenMethodName = "spark_transferToken";
|
|
898
|
-
var sparkTransferTokenParamsSchema =
|
|
923
|
+
var sparkTransferTokenParamsSchema = v16.object({
|
|
899
924
|
/**
|
|
900
925
|
* Amount of units of the token to transfer as a string or number.
|
|
901
926
|
*/
|
|
902
|
-
tokenAmount:
|
|
927
|
+
tokenAmount: v16.union([v16.number(), v16.string()]),
|
|
903
928
|
/**
|
|
904
929
|
* The Bech32m token identifier.
|
|
905
930
|
*/
|
|
906
|
-
tokenIdentifier:
|
|
931
|
+
tokenIdentifier: v16.string(),
|
|
907
932
|
/**
|
|
908
933
|
* The recipient's spark address.
|
|
909
934
|
*/
|
|
910
|
-
receiverSparkAddress:
|
|
935
|
+
receiverSparkAddress: v16.string()
|
|
911
936
|
});
|
|
912
|
-
var sparkTransferTokenResultSchema =
|
|
937
|
+
var sparkTransferTokenResultSchema = v16.object({
|
|
913
938
|
/**
|
|
914
939
|
* The ID of the transaction.
|
|
915
940
|
*/
|
|
916
|
-
id:
|
|
941
|
+
id: v16.string()
|
|
917
942
|
});
|
|
918
|
-
var sparkTransferTokenRequestMessageSchema =
|
|
943
|
+
var sparkTransferTokenRequestMessageSchema = v16.object({
|
|
919
944
|
...rpcRequestMessageSchema.entries,
|
|
920
|
-
...
|
|
921
|
-
method:
|
|
945
|
+
...v16.object({
|
|
946
|
+
method: v16.literal(sparkTransferTokenMethodName),
|
|
922
947
|
params: sparkTransferTokenParamsSchema,
|
|
923
|
-
id:
|
|
948
|
+
id: v16.string()
|
|
924
949
|
}).entries
|
|
925
950
|
});
|
|
926
951
|
|
|
927
952
|
// src/request/types/stxMethods/callContract.ts
|
|
928
|
-
import * as
|
|
953
|
+
import * as v17 from "valibot";
|
|
929
954
|
var stxCallContractMethodName = "stx_callContract";
|
|
930
|
-
var stxCallContractParamsSchema =
|
|
955
|
+
var stxCallContractParamsSchema = v17.object({
|
|
931
956
|
/**
|
|
932
957
|
* The contract principal.
|
|
933
958
|
*
|
|
934
959
|
* E.g. `"SPKE...GD5C.my-contract"`
|
|
935
960
|
*/
|
|
936
|
-
contract:
|
|
961
|
+
contract: v17.string(),
|
|
937
962
|
/**
|
|
938
963
|
* The name of the function to call.
|
|
939
964
|
*
|
|
940
965
|
* Note: spec changes ongoing,
|
|
941
966
|
* https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
|
|
942
967
|
*/
|
|
943
|
-
functionName:
|
|
968
|
+
functionName: v17.string(),
|
|
944
969
|
/**
|
|
945
970
|
* @deprecated in favor of `functionArgs` for @stacks/connect compatibility
|
|
946
971
|
*/
|
|
947
|
-
arguments:
|
|
972
|
+
arguments: v17.optional(v17.array(v17.string())),
|
|
948
973
|
/**
|
|
949
974
|
* The function's arguments. The arguments are expected to be hex-encoded
|
|
950
975
|
* strings of Clarity values.
|
|
@@ -959,274 +984,274 @@ var stxCallContractParamsSchema = v16.object({
|
|
|
959
984
|
* const hexArgs = functionArgs.map(cvToHex);
|
|
960
985
|
* ```
|
|
961
986
|
*/
|
|
962
|
-
functionArgs:
|
|
987
|
+
functionArgs: v17.optional(v17.array(v17.string())),
|
|
963
988
|
/**
|
|
964
989
|
* The post conditions to apply to the contract call.
|
|
965
990
|
*/
|
|
966
|
-
postConditions:
|
|
991
|
+
postConditions: v17.optional(v17.array(v17.string())),
|
|
967
992
|
/**
|
|
968
993
|
* The mode to apply to the post conditions.
|
|
969
994
|
*/
|
|
970
|
-
postConditionMode:
|
|
995
|
+
postConditionMode: v17.optional(v17.union([v17.literal("allow"), v17.literal("deny")]))
|
|
971
996
|
});
|
|
972
|
-
var stxCallContractResultSchema =
|
|
997
|
+
var stxCallContractResultSchema = v17.object({
|
|
973
998
|
/**
|
|
974
999
|
* The ID of the transaction.
|
|
975
1000
|
*/
|
|
976
|
-
txid:
|
|
1001
|
+
txid: v17.string(),
|
|
977
1002
|
/**
|
|
978
1003
|
* A Stacks transaction as a hex-encoded string.
|
|
979
1004
|
*/
|
|
980
|
-
transaction:
|
|
1005
|
+
transaction: v17.string()
|
|
981
1006
|
});
|
|
982
|
-
var stxCallContractRequestMessageSchema =
|
|
1007
|
+
var stxCallContractRequestMessageSchema = v17.object({
|
|
983
1008
|
...rpcRequestMessageSchema.entries,
|
|
984
|
-
...
|
|
985
|
-
method:
|
|
1009
|
+
...v17.object({
|
|
1010
|
+
method: v17.literal(stxCallContractMethodName),
|
|
986
1011
|
params: stxCallContractParamsSchema,
|
|
987
|
-
id:
|
|
1012
|
+
id: v17.string()
|
|
988
1013
|
}).entries
|
|
989
1014
|
});
|
|
990
1015
|
|
|
991
1016
|
// src/request/types/stxMethods/deployContract.ts
|
|
992
|
-
import * as
|
|
1017
|
+
import * as v18 from "valibot";
|
|
993
1018
|
var stxDeployContractMethodName = "stx_deployContract";
|
|
994
|
-
var stxDeployContractParamsSchema =
|
|
1019
|
+
var stxDeployContractParamsSchema = v18.object({
|
|
995
1020
|
/**
|
|
996
1021
|
* Name of the contract.
|
|
997
1022
|
*/
|
|
998
|
-
name:
|
|
1023
|
+
name: v18.string(),
|
|
999
1024
|
/**
|
|
1000
1025
|
* The source code of the Clarity contract.
|
|
1001
1026
|
*/
|
|
1002
|
-
clarityCode:
|
|
1027
|
+
clarityCode: v18.string(),
|
|
1003
1028
|
/**
|
|
1004
1029
|
* The version of the Clarity contract.
|
|
1005
1030
|
*/
|
|
1006
|
-
clarityVersion:
|
|
1031
|
+
clarityVersion: v18.optional(v18.number()),
|
|
1007
1032
|
/**
|
|
1008
1033
|
* The post conditions to apply to the contract call.
|
|
1009
1034
|
*/
|
|
1010
|
-
postConditions:
|
|
1035
|
+
postConditions: v18.optional(v18.array(v18.string())),
|
|
1011
1036
|
/**
|
|
1012
1037
|
* The mode to apply to the post conditions.
|
|
1013
1038
|
*/
|
|
1014
|
-
postConditionMode:
|
|
1039
|
+
postConditionMode: v18.optional(v18.union([v18.literal("allow"), v18.literal("deny")]))
|
|
1015
1040
|
});
|
|
1016
|
-
var stxDeployContractResultSchema =
|
|
1041
|
+
var stxDeployContractResultSchema = v18.object({
|
|
1017
1042
|
/**
|
|
1018
1043
|
* The ID of the transaction.
|
|
1019
1044
|
*/
|
|
1020
|
-
txid:
|
|
1045
|
+
txid: v18.string(),
|
|
1021
1046
|
/**
|
|
1022
1047
|
* A Stacks transaction as a hex-encoded string.
|
|
1023
1048
|
*/
|
|
1024
|
-
transaction:
|
|
1049
|
+
transaction: v18.string()
|
|
1025
1050
|
});
|
|
1026
|
-
var stxDeployContractRequestMessageSchema =
|
|
1051
|
+
var stxDeployContractRequestMessageSchema = v18.object({
|
|
1027
1052
|
...rpcRequestMessageSchema.entries,
|
|
1028
|
-
...
|
|
1029
|
-
method:
|
|
1053
|
+
...v18.object({
|
|
1054
|
+
method: v18.literal(stxDeployContractMethodName),
|
|
1030
1055
|
params: stxDeployContractParamsSchema,
|
|
1031
|
-
id:
|
|
1056
|
+
id: v18.string()
|
|
1032
1057
|
}).entries
|
|
1033
1058
|
});
|
|
1034
1059
|
|
|
1035
1060
|
// src/request/types/stxMethods/getAccounts.ts
|
|
1036
|
-
import * as
|
|
1061
|
+
import * as v19 from "valibot";
|
|
1037
1062
|
var stxGetAccountsMethodName = "stx_getAccounts";
|
|
1038
|
-
var stxGetAccountsParamsSchema =
|
|
1039
|
-
var stxGetAccountsResultSchema =
|
|
1063
|
+
var stxGetAccountsParamsSchema = v19.nullish(v19.null());
|
|
1064
|
+
var stxGetAccountsResultSchema = v19.object({
|
|
1040
1065
|
/**
|
|
1041
1066
|
* The addresses generated for the given purposes.
|
|
1042
1067
|
*/
|
|
1043
|
-
addresses:
|
|
1044
|
-
|
|
1045
|
-
address:
|
|
1046
|
-
publicKey:
|
|
1047
|
-
gaiaHubUrl:
|
|
1048
|
-
gaiaAppKey:
|
|
1068
|
+
addresses: v19.array(
|
|
1069
|
+
v19.object({
|
|
1070
|
+
address: v19.string(),
|
|
1071
|
+
publicKey: v19.string(),
|
|
1072
|
+
gaiaHubUrl: v19.string(),
|
|
1073
|
+
gaiaAppKey: v19.string()
|
|
1049
1074
|
})
|
|
1050
1075
|
),
|
|
1051
1076
|
network: getNetworkResultSchema
|
|
1052
1077
|
});
|
|
1053
|
-
var stxGetAccountsRequestMessageSchema =
|
|
1078
|
+
var stxGetAccountsRequestMessageSchema = v19.object({
|
|
1054
1079
|
...rpcRequestMessageSchema.entries,
|
|
1055
|
-
...
|
|
1056
|
-
method:
|
|
1080
|
+
...v19.object({
|
|
1081
|
+
method: v19.literal(stxGetAccountsMethodName),
|
|
1057
1082
|
params: stxGetAccountsParamsSchema,
|
|
1058
|
-
id:
|
|
1083
|
+
id: v19.string()
|
|
1059
1084
|
}).entries
|
|
1060
1085
|
});
|
|
1061
1086
|
|
|
1062
1087
|
// src/request/types/stxMethods/getAddresses.ts
|
|
1063
|
-
import * as
|
|
1088
|
+
import * as v20 from "valibot";
|
|
1064
1089
|
var stxGetAddressesMethodName = "stx_getAddresses";
|
|
1065
|
-
var stxGetAddressesParamsSchema =
|
|
1066
|
-
|
|
1090
|
+
var stxGetAddressesParamsSchema = v20.nullish(
|
|
1091
|
+
v20.object({
|
|
1067
1092
|
/**
|
|
1068
1093
|
* A message to be displayed to the user in the request prompt.
|
|
1069
1094
|
*/
|
|
1070
|
-
message:
|
|
1095
|
+
message: v20.optional(v20.string())
|
|
1071
1096
|
})
|
|
1072
1097
|
);
|
|
1073
|
-
var stxGetAddressesResultSchema =
|
|
1098
|
+
var stxGetAddressesResultSchema = v20.object({
|
|
1074
1099
|
/**
|
|
1075
1100
|
* The addresses generated for the given purposes.
|
|
1076
1101
|
*/
|
|
1077
|
-
addresses:
|
|
1102
|
+
addresses: v20.array(addressSchema),
|
|
1078
1103
|
network: getNetworkResultSchema
|
|
1079
1104
|
});
|
|
1080
|
-
var stxGetAddressesRequestMessageSchema =
|
|
1105
|
+
var stxGetAddressesRequestMessageSchema = v20.object({
|
|
1081
1106
|
...rpcRequestMessageSchema.entries,
|
|
1082
|
-
...
|
|
1083
|
-
method:
|
|
1107
|
+
...v20.object({
|
|
1108
|
+
method: v20.literal(stxGetAddressesMethodName),
|
|
1084
1109
|
params: stxGetAddressesParamsSchema,
|
|
1085
|
-
id:
|
|
1110
|
+
id: v20.string()
|
|
1086
1111
|
}).entries
|
|
1087
1112
|
});
|
|
1088
1113
|
|
|
1089
1114
|
// src/request/types/stxMethods/signMessage.ts
|
|
1090
|
-
import * as
|
|
1115
|
+
import * as v21 from "valibot";
|
|
1091
1116
|
var stxSignMessageMethodName = "stx_signMessage";
|
|
1092
|
-
var stxSignMessageParamsSchema =
|
|
1117
|
+
var stxSignMessageParamsSchema = v21.object({
|
|
1093
1118
|
/**
|
|
1094
1119
|
* The message to sign.
|
|
1095
1120
|
*/
|
|
1096
|
-
message:
|
|
1121
|
+
message: v21.string()
|
|
1097
1122
|
});
|
|
1098
|
-
var stxSignMessageResultSchema =
|
|
1123
|
+
var stxSignMessageResultSchema = v21.object({
|
|
1099
1124
|
/**
|
|
1100
1125
|
* The signature of the message.
|
|
1101
1126
|
*/
|
|
1102
|
-
signature:
|
|
1127
|
+
signature: v21.string(),
|
|
1103
1128
|
/**
|
|
1104
1129
|
* The public key used to sign the message.
|
|
1105
1130
|
*/
|
|
1106
|
-
publicKey:
|
|
1131
|
+
publicKey: v21.string()
|
|
1107
1132
|
});
|
|
1108
|
-
var stxSignMessageRequestMessageSchema =
|
|
1133
|
+
var stxSignMessageRequestMessageSchema = v21.object({
|
|
1109
1134
|
...rpcRequestMessageSchema.entries,
|
|
1110
|
-
...
|
|
1111
|
-
method:
|
|
1135
|
+
...v21.object({
|
|
1136
|
+
method: v21.literal(stxSignMessageMethodName),
|
|
1112
1137
|
params: stxSignMessageParamsSchema,
|
|
1113
|
-
id:
|
|
1138
|
+
id: v21.string()
|
|
1114
1139
|
}).entries
|
|
1115
1140
|
});
|
|
1116
1141
|
|
|
1117
1142
|
// src/request/types/stxMethods/signStructuredMessage.ts
|
|
1118
|
-
import * as
|
|
1143
|
+
import * as v22 from "valibot";
|
|
1119
1144
|
var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
|
|
1120
|
-
var stxSignStructuredMessageParamsSchema =
|
|
1145
|
+
var stxSignStructuredMessageParamsSchema = v22.object({
|
|
1121
1146
|
/**
|
|
1122
1147
|
* The domain to be signed.
|
|
1123
1148
|
*/
|
|
1124
|
-
domain:
|
|
1149
|
+
domain: v22.string(),
|
|
1125
1150
|
/**
|
|
1126
1151
|
* Message payload to be signed.
|
|
1127
1152
|
*/
|
|
1128
|
-
message:
|
|
1153
|
+
message: v22.string(),
|
|
1129
1154
|
/**
|
|
1130
1155
|
* The public key to sign the message with.
|
|
1131
1156
|
*/
|
|
1132
|
-
publicKey:
|
|
1157
|
+
publicKey: v22.optional(v22.string())
|
|
1133
1158
|
});
|
|
1134
|
-
var stxSignStructuredMessageResultSchema =
|
|
1159
|
+
var stxSignStructuredMessageResultSchema = v22.object({
|
|
1135
1160
|
/**
|
|
1136
1161
|
* Signature of the message.
|
|
1137
1162
|
*/
|
|
1138
|
-
signature:
|
|
1163
|
+
signature: v22.string(),
|
|
1139
1164
|
/**
|
|
1140
1165
|
* Public key as hex-encoded string.
|
|
1141
1166
|
*/
|
|
1142
|
-
publicKey:
|
|
1167
|
+
publicKey: v22.string()
|
|
1143
1168
|
});
|
|
1144
|
-
var stxSignStructuredMessageRequestMessageSchema =
|
|
1169
|
+
var stxSignStructuredMessageRequestMessageSchema = v22.object({
|
|
1145
1170
|
...rpcRequestMessageSchema.entries,
|
|
1146
|
-
...
|
|
1147
|
-
method:
|
|
1171
|
+
...v22.object({
|
|
1172
|
+
method: v22.literal(stxSignStructuredMessageMethodName),
|
|
1148
1173
|
params: stxSignStructuredMessageParamsSchema,
|
|
1149
|
-
id:
|
|
1174
|
+
id: v22.string()
|
|
1150
1175
|
}).entries
|
|
1151
1176
|
});
|
|
1152
1177
|
|
|
1153
1178
|
// src/request/types/stxMethods/signTransaction.ts
|
|
1154
|
-
import * as
|
|
1179
|
+
import * as v23 from "valibot";
|
|
1155
1180
|
var stxSignTransactionMethodName = "stx_signTransaction";
|
|
1156
|
-
var stxSignTransactionParamsSchema =
|
|
1181
|
+
var stxSignTransactionParamsSchema = v23.object({
|
|
1157
1182
|
/**
|
|
1158
1183
|
* The transaction to sign as a hex-encoded string.
|
|
1159
1184
|
*/
|
|
1160
|
-
transaction:
|
|
1185
|
+
transaction: v23.string(),
|
|
1161
1186
|
/**
|
|
1162
1187
|
* The public key to sign the transaction with. The wallet may use any key
|
|
1163
1188
|
* when not provided.
|
|
1164
1189
|
*/
|
|
1165
|
-
pubkey:
|
|
1190
|
+
pubkey: v23.optional(v23.string()),
|
|
1166
1191
|
/**
|
|
1167
1192
|
* Whether to broadcast the transaction after signing. Defaults to `true`.
|
|
1168
1193
|
*/
|
|
1169
|
-
broadcast:
|
|
1194
|
+
broadcast: v23.optional(v23.boolean())
|
|
1170
1195
|
});
|
|
1171
|
-
var stxSignTransactionResultSchema =
|
|
1196
|
+
var stxSignTransactionResultSchema = v23.object({
|
|
1172
1197
|
/**
|
|
1173
1198
|
* The signed transaction as a hex-encoded string.
|
|
1174
1199
|
*/
|
|
1175
|
-
transaction:
|
|
1200
|
+
transaction: v23.string()
|
|
1176
1201
|
});
|
|
1177
|
-
var stxSignTransactionRequestMessageSchema =
|
|
1202
|
+
var stxSignTransactionRequestMessageSchema = v23.object({
|
|
1178
1203
|
...rpcRequestMessageSchema.entries,
|
|
1179
|
-
...
|
|
1180
|
-
method:
|
|
1204
|
+
...v23.object({
|
|
1205
|
+
method: v23.literal(stxSignTransactionMethodName),
|
|
1181
1206
|
params: stxSignTransactionParamsSchema,
|
|
1182
|
-
id:
|
|
1207
|
+
id: v23.string()
|
|
1183
1208
|
}).entries
|
|
1184
1209
|
});
|
|
1185
1210
|
|
|
1186
1211
|
// src/request/types/stxMethods/signTransactions.ts
|
|
1187
|
-
import * as
|
|
1212
|
+
import * as v24 from "valibot";
|
|
1188
1213
|
var stxSignTransactionsMethodName = "stx_signTransactions";
|
|
1189
|
-
var stxSignTransactionsParamsSchema =
|
|
1214
|
+
var stxSignTransactionsParamsSchema = v24.object({
|
|
1190
1215
|
/**
|
|
1191
1216
|
* The transactions to sign as hex-encoded strings.
|
|
1192
1217
|
*/
|
|
1193
|
-
transactions:
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1218
|
+
transactions: v24.pipe(
|
|
1219
|
+
v24.array(
|
|
1220
|
+
v24.pipe(
|
|
1221
|
+
v24.string(),
|
|
1222
|
+
v24.check((hex) => {
|
|
1198
1223
|
return true;
|
|
1199
1224
|
}, "Invalid hex-encoded Stacks transaction.")
|
|
1200
1225
|
)
|
|
1201
1226
|
),
|
|
1202
|
-
|
|
1227
|
+
v24.minLength(1)
|
|
1203
1228
|
),
|
|
1204
1229
|
/**
|
|
1205
1230
|
* Whether the signed transactions should be broadcast after signing. Defaults
|
|
1206
1231
|
* to `true`.
|
|
1207
1232
|
*/
|
|
1208
|
-
broadcast:
|
|
1233
|
+
broadcast: v24.optional(v24.boolean())
|
|
1209
1234
|
});
|
|
1210
|
-
var stxSignTransactionsResultSchema =
|
|
1235
|
+
var stxSignTransactionsResultSchema = v24.object({
|
|
1211
1236
|
/**
|
|
1212
1237
|
* The signed transactions as hex-encoded strings, in the same order as in the
|
|
1213
1238
|
* sign request.
|
|
1214
1239
|
*/
|
|
1215
|
-
transactions:
|
|
1240
|
+
transactions: v24.array(v24.string())
|
|
1216
1241
|
});
|
|
1217
|
-
var stxSignTransactionsRequestMessageSchema =
|
|
1242
|
+
var stxSignTransactionsRequestMessageSchema = v24.object({
|
|
1218
1243
|
...rpcRequestMessageSchema.entries,
|
|
1219
|
-
...
|
|
1220
|
-
method:
|
|
1244
|
+
...v24.object({
|
|
1245
|
+
method: v24.literal(stxSignTransactionsMethodName),
|
|
1221
1246
|
params: stxSignTransactionsParamsSchema,
|
|
1222
|
-
id:
|
|
1247
|
+
id: v24.string()
|
|
1223
1248
|
}).entries
|
|
1224
1249
|
});
|
|
1225
1250
|
|
|
1226
1251
|
// src/request/types/stxMethods/transferStx.ts
|
|
1227
|
-
import * as
|
|
1252
|
+
import * as v25 from "valibot";
|
|
1228
1253
|
var stxTransferStxMethodName = "stx_transferStx";
|
|
1229
|
-
var stxTransferStxParamsSchema =
|
|
1254
|
+
var stxTransferStxParamsSchema = v25.object({
|
|
1230
1255
|
/**
|
|
1231
1256
|
* Amount of STX tokens to transfer in microstacks as a string. Anything
|
|
1232
1257
|
* parseable by `BigInt` is acceptable.
|
|
@@ -1239,23 +1264,23 @@ var stxTransferStxParamsSchema = v24.object({
|
|
|
1239
1264
|
* const amount3 = '1234';
|
|
1240
1265
|
* ```
|
|
1241
1266
|
*/
|
|
1242
|
-
amount:
|
|
1267
|
+
amount: v25.union([v25.number(), v25.string()]),
|
|
1243
1268
|
/**
|
|
1244
1269
|
* The recipient's principal.
|
|
1245
1270
|
*/
|
|
1246
|
-
recipient:
|
|
1271
|
+
recipient: v25.string(),
|
|
1247
1272
|
/**
|
|
1248
1273
|
* A string representing the memo.
|
|
1249
1274
|
*/
|
|
1250
|
-
memo:
|
|
1275
|
+
memo: v25.optional(v25.string()),
|
|
1251
1276
|
/**
|
|
1252
1277
|
* Version of parameter format.
|
|
1253
1278
|
*/
|
|
1254
|
-
version:
|
|
1279
|
+
version: v25.optional(v25.string()),
|
|
1255
1280
|
/**
|
|
1256
1281
|
* The mode of the post conditions.
|
|
1257
1282
|
*/
|
|
1258
|
-
postConditionMode:
|
|
1283
|
+
postConditionMode: v25.optional(v25.number()),
|
|
1259
1284
|
/**
|
|
1260
1285
|
* A hex-encoded string representing the post conditions.
|
|
1261
1286
|
*
|
|
@@ -1268,29 +1293,29 @@ var stxTransferStxParamsSchema = v24.object({
|
|
|
1268
1293
|
* const hexPostCondition = serializePostCondition(postCondition).toString('hex');
|
|
1269
1294
|
* ```
|
|
1270
1295
|
*/
|
|
1271
|
-
postConditions:
|
|
1296
|
+
postConditions: v25.optional(v25.array(v25.string())),
|
|
1272
1297
|
/**
|
|
1273
1298
|
* The public key to sign the transaction with. The wallet may use any key
|
|
1274
1299
|
* when not provided.
|
|
1275
1300
|
*/
|
|
1276
|
-
pubkey:
|
|
1301
|
+
pubkey: v25.optional(v25.string())
|
|
1277
1302
|
});
|
|
1278
|
-
var stxTransferStxResultSchema =
|
|
1303
|
+
var stxTransferStxResultSchema = v25.object({
|
|
1279
1304
|
/**
|
|
1280
1305
|
* The ID of the transaction.
|
|
1281
1306
|
*/
|
|
1282
|
-
txid:
|
|
1307
|
+
txid: v25.string(),
|
|
1283
1308
|
/**
|
|
1284
1309
|
* A Stacks transaction as a hex-encoded string.
|
|
1285
1310
|
*/
|
|
1286
|
-
transaction:
|
|
1311
|
+
transaction: v25.string()
|
|
1287
1312
|
});
|
|
1288
|
-
var stxTransferStxRequestMessageSchema =
|
|
1313
|
+
var stxTransferStxRequestMessageSchema = v25.object({
|
|
1289
1314
|
...rpcRequestMessageSchema.entries,
|
|
1290
|
-
...
|
|
1291
|
-
method:
|
|
1315
|
+
...v25.object({
|
|
1316
|
+
method: v25.literal(stxTransferStxMethodName),
|
|
1292
1317
|
params: stxTransferStxParamsSchema,
|
|
1293
|
-
id:
|
|
1318
|
+
id: v25.string()
|
|
1294
1319
|
}).entries
|
|
1295
1320
|
});
|
|
1296
1321
|
|
|
@@ -1307,13 +1332,13 @@ var request = async (method, params, providerId) => {
|
|
|
1307
1332
|
throw new Error("A wallet method is required");
|
|
1308
1333
|
}
|
|
1309
1334
|
const response = await provider.request(method, params);
|
|
1310
|
-
if (
|
|
1335
|
+
if (v26.is(rpcErrorResponseMessageSchema, response)) {
|
|
1311
1336
|
return {
|
|
1312
1337
|
status: "error",
|
|
1313
1338
|
error: response.error
|
|
1314
1339
|
};
|
|
1315
1340
|
}
|
|
1316
|
-
if (
|
|
1341
|
+
if (v26.is(rpcSuccessResponseMessageSchema, response)) {
|
|
1317
1342
|
return {
|
|
1318
1343
|
status: "success",
|
|
1319
1344
|
result: response.result
|
|
@@ -2475,6 +2500,10 @@ export {
|
|
|
2475
2500
|
sparkGetBalanceParamsSchema,
|
|
2476
2501
|
sparkGetBalanceRequestMessageSchema,
|
|
2477
2502
|
sparkGetBalanceResultSchema,
|
|
2503
|
+
sparkSignMessageMethodName,
|
|
2504
|
+
sparkSignMessageParamsSchema,
|
|
2505
|
+
sparkSignMessageRequestMessageSchema,
|
|
2506
|
+
sparkSignMessageResultSchema,
|
|
2478
2507
|
sparkTransferMethodName,
|
|
2479
2508
|
sparkTransferParamsSchema,
|
|
2480
2509
|
sparkTransferRequestMessageSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sats-connect/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1-29f926e",
|
|
4
4
|
"main": "dist/index.mjs",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.mts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"check-format": "prettier --check .",
|
|
15
15
|
"format": "prettier --write .",
|
|
16
16
|
"ci": "npm run check-types && npm run check-format && npm run build",
|
|
17
|
-
"prepare": "husky
|
|
17
|
+
"prepare": "husky"
|
|
18
18
|
},
|
|
19
19
|
"lint-staged": {
|
|
20
20
|
"*.{ts,tsx}": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
]
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"axios": "1.
|
|
28
|
+
"axios": "1.12.0",
|
|
29
29
|
"bitcoin-address-validation": "3.0.0",
|
|
30
30
|
"buffer": "6.0.3",
|
|
31
31
|
"jsontokens": "4.0.1"
|