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