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