@sats-connect/core 0.18.0-0b90d6e → 0.18.0-7d98e49
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 +23 -0
- package/dist/index.mjs +20 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -946,6 +946,7 @@ declare const bitcoinSendTransferParamsSchema: v.ObjectSchema<{
|
|
|
946
946
|
readonly address: v.StringSchema<undefined>;
|
|
947
947
|
readonly amount: v.NumberSchema<undefined>;
|
|
948
948
|
}, undefined>, undefined>;
|
|
949
|
+
readonly broadcast: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
949
950
|
}, undefined>;
|
|
950
951
|
type BitcoinSendTransferParams = v.InferOutput<typeof bitcoinSendTransferParamsSchema>;
|
|
951
952
|
declare const bitcoinSendTransferRequestSchema: v.ObjectSchema<{
|
|
@@ -956,6 +957,7 @@ declare const bitcoinSendTransferRequestSchema: v.ObjectSchema<{
|
|
|
956
957
|
readonly address: v.StringSchema<undefined>;
|
|
957
958
|
readonly amount: v.NumberSchema<undefined>;
|
|
958
959
|
}, undefined>, undefined>;
|
|
960
|
+
readonly broadcast: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
959
961
|
}, undefined>;
|
|
960
962
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
961
963
|
}, undefined>;
|
|
@@ -964,12 +966,14 @@ type BitcoinSendTransferRequest = v.InferOutput<typeof bitcoinSendTransferReques
|
|
|
964
966
|
//#region src/request/rpc/objects/namespaces/bitcoin/methods/sendTransfer/response.d.ts
|
|
965
967
|
declare const bitcoinSendTransferResultSchema: v.ObjectSchema<{
|
|
966
968
|
readonly txid: v.StringSchema<undefined>;
|
|
969
|
+
readonly transaction: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
967
970
|
}, undefined>;
|
|
968
971
|
type BitcoinSendTransferResult = v.InferOutput<typeof bitcoinSendTransferResultSchema>;
|
|
969
972
|
declare const bitcoinSendTransferSuccessResponseSchema: v.ObjectSchema<{
|
|
970
973
|
readonly id: v.StringSchema<undefined>;
|
|
971
974
|
readonly result: v.ObjectSchema<{
|
|
972
975
|
readonly txid: v.StringSchema<undefined>;
|
|
976
|
+
readonly transaction: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
973
977
|
}, undefined>;
|
|
974
978
|
readonly '~sats-connect-method': v.LiteralSchema<"sendTransfer", undefined>;
|
|
975
979
|
readonly extensions: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -989,6 +993,7 @@ declare const bitcoinSendTransferV2ParamsSchema: v.ObjectSchema<{
|
|
|
989
993
|
readonly address: v.StringSchema<undefined>;
|
|
990
994
|
readonly amount: v.NumberSchema<undefined>;
|
|
991
995
|
}, undefined>, undefined>;
|
|
996
|
+
readonly broadcast: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
992
997
|
}, undefined>;
|
|
993
998
|
type BitcoinSendTransferV2Params = v.InferOutput<typeof bitcoinSendTransferV2ParamsSchema>;
|
|
994
999
|
declare const bitcoinSendTransferV2RequestSchema: v.ObjectSchema<{
|
|
@@ -999,6 +1004,7 @@ declare const bitcoinSendTransferV2RequestSchema: v.ObjectSchema<{
|
|
|
999
1004
|
readonly address: v.StringSchema<undefined>;
|
|
1000
1005
|
readonly amount: v.NumberSchema<undefined>;
|
|
1001
1006
|
}, undefined>, undefined>;
|
|
1007
|
+
readonly broadcast: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
1002
1008
|
}, undefined>;
|
|
1003
1009
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
1004
1010
|
}, undefined>;
|
|
@@ -1007,12 +1013,14 @@ type BitcoinSendTransferV2Request = v.InferOutput<typeof bitcoinSendTransferV2Re
|
|
|
1007
1013
|
//#region src/request/rpc/objects/namespaces/bitcoin/methods/sendTransferV2/response.d.ts
|
|
1008
1014
|
declare const bitcoinSendTransferV2ResultSchema: v.ObjectSchema<{
|
|
1009
1015
|
readonly txid: v.StringSchema<undefined>;
|
|
1016
|
+
readonly transaction: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
1010
1017
|
}, undefined>;
|
|
1011
1018
|
type BitcoinSendTransferV2Result = v.InferOutput<typeof bitcoinSendTransferV2ResultSchema>;
|
|
1012
1019
|
declare const bitcoinSendTransferV2SuccessResponseSchema: v.ObjectSchema<{
|
|
1013
1020
|
readonly id: v.StringSchema<undefined>;
|
|
1014
1021
|
readonly result: v.ObjectSchema<{
|
|
1015
1022
|
readonly txid: v.StringSchema<undefined>;
|
|
1023
|
+
readonly transaction: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
1016
1024
|
}, undefined>;
|
|
1017
1025
|
readonly '~sats-connect-method': v.LiteralSchema<"bitcoin_sendTransferV2", undefined>;
|
|
1018
1026
|
readonly extensions: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -1368,6 +1376,7 @@ declare const bitcoinRequestSchema: v.VariantSchema<"method", [v.ObjectSchema<{
|
|
|
1368
1376
|
readonly address: v.StringSchema<undefined>;
|
|
1369
1377
|
readonly amount: v.NumberSchema<undefined>;
|
|
1370
1378
|
}, undefined>, undefined>;
|
|
1379
|
+
readonly broadcast: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
1371
1380
|
}, undefined>;
|
|
1372
1381
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
1373
1382
|
}, undefined>, v.ObjectSchema<{
|
|
@@ -1378,6 +1387,7 @@ declare const bitcoinRequestSchema: v.VariantSchema<"method", [v.ObjectSchema<{
|
|
|
1378
1387
|
readonly address: v.StringSchema<undefined>;
|
|
1379
1388
|
readonly amount: v.NumberSchema<undefined>;
|
|
1380
1389
|
}, undefined>, undefined>;
|
|
1390
|
+
readonly broadcast: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
1381
1391
|
}, undefined>;
|
|
1382
1392
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
1383
1393
|
}, undefined>, v.ObjectSchema<{
|
|
@@ -1710,6 +1720,7 @@ declare const bitcoinSuccessResponseSchema: v.VariantSchema<"~sats-connect-metho
|
|
|
1710
1720
|
readonly id: v.StringSchema<undefined>;
|
|
1711
1721
|
readonly result: v.ObjectSchema<{
|
|
1712
1722
|
readonly txid: v.StringSchema<undefined>;
|
|
1723
|
+
readonly transaction: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
1713
1724
|
}, undefined>;
|
|
1714
1725
|
readonly '~sats-connect-method': v.LiteralSchema<"sendTransfer", undefined>;
|
|
1715
1726
|
readonly extensions: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -1724,6 +1735,7 @@ declare const bitcoinSuccessResponseSchema: v.VariantSchema<"~sats-connect-metho
|
|
|
1724
1735
|
readonly id: v.StringSchema<undefined>;
|
|
1725
1736
|
readonly result: v.ObjectSchema<{
|
|
1726
1737
|
readonly txid: v.StringSchema<undefined>;
|
|
1738
|
+
readonly transaction: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
1727
1739
|
}, undefined>;
|
|
1728
1740
|
readonly '~sats-connect-method': v.LiteralSchema<"bitcoin_sendTransferV2", undefined>;
|
|
1729
1741
|
readonly extensions: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -7818,6 +7830,13 @@ declare const walletRenouncePermissionsSuccessResponseSchema: v.ObjectSchema<{
|
|
|
7818
7830
|
type WalletRenouncePermissionsSuccessResponse = v.InferOutput<typeof walletRenouncePermissionsSuccessResponseSchema>;
|
|
7819
7831
|
//#endregion
|
|
7820
7832
|
//#region src/request/rpc/objects/namespaces/wallet/methods/requestPermissions/request.d.ts
|
|
7833
|
+
/**
|
|
7834
|
+
* This method was previously used to connect to the wallet similarly to how
|
|
7835
|
+
* `wallet_connect` is used now: when no permissions are explicitly requested,
|
|
7836
|
+
* account read permissions are implied. The `nullish` schema allows maintaining
|
|
7837
|
+
* backwards compatibility with this behavior while still allowing for explicit
|
|
7838
|
+
* permission requests.
|
|
7839
|
+
*/
|
|
7821
7840
|
declare const walletRequestPermissionsParamsSchema: v.NullishSchema<v.ArraySchema<v.VariantSchema<"type", [v.ObjectSchema<{
|
|
7822
7841
|
readonly type: v.LiteralSchema<"account", undefined>;
|
|
7823
7842
|
readonly resourceId: v.StringSchema<undefined>;
|
|
@@ -10619,6 +10638,7 @@ declare const rpcRequestSchema: v.VariantSchema<"method", [v.VariantSchema<"meth
|
|
|
10619
10638
|
readonly address: v.StringSchema<undefined>;
|
|
10620
10639
|
readonly amount: v.NumberSchema<undefined>;
|
|
10621
10640
|
}, undefined>, undefined>;
|
|
10641
|
+
readonly broadcast: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
10622
10642
|
}, undefined>;
|
|
10623
10643
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
10624
10644
|
}, undefined>, v.ObjectSchema<{
|
|
@@ -10629,6 +10649,7 @@ declare const rpcRequestSchema: v.VariantSchema<"method", [v.VariantSchema<"meth
|
|
|
10629
10649
|
readonly address: v.StringSchema<undefined>;
|
|
10630
10650
|
readonly amount: v.NumberSchema<undefined>;
|
|
10631
10651
|
}, undefined>, undefined>;
|
|
10652
|
+
readonly broadcast: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
10632
10653
|
}, undefined>;
|
|
10633
10654
|
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
10634
10655
|
}, undefined>, v.ObjectSchema<{
|
|
@@ -11915,6 +11936,7 @@ declare const rpcSuccessResponseSchema: v.VariantSchema<"~sats-connect-method",
|
|
|
11915
11936
|
readonly id: v.StringSchema<undefined>;
|
|
11916
11937
|
readonly result: v.ObjectSchema<{
|
|
11917
11938
|
readonly txid: v.StringSchema<undefined>;
|
|
11939
|
+
readonly transaction: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
11918
11940
|
}, undefined>;
|
|
11919
11941
|
readonly '~sats-connect-method': v.LiteralSchema<"sendTransfer", undefined>;
|
|
11920
11942
|
readonly extensions: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -11929,6 +11951,7 @@ declare const rpcSuccessResponseSchema: v.VariantSchema<"~sats-connect-method",
|
|
|
11929
11951
|
readonly id: v.StringSchema<undefined>;
|
|
11930
11952
|
readonly result: v.ObjectSchema<{
|
|
11931
11953
|
readonly txid: v.StringSchema<undefined>;
|
|
11954
|
+
readonly transaction: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
11932
11955
|
}, undefined>;
|
|
11933
11956
|
readonly '~sats-connect-method': v.LiteralSchema<"bitcoin_sendTransferV2", undefined>;
|
|
11934
11957
|
readonly extensions: v.OptionalSchema<v.ObjectSchema<{
|
package/dist/index.mjs
CHANGED
|
@@ -741,8 +741,9 @@ var UnisatAdapter = class extends SatsConnectAdapter {
|
|
|
741
741
|
};
|
|
742
742
|
}
|
|
743
743
|
async sendTransfer(params) {
|
|
744
|
-
const { recipients } = params;
|
|
744
|
+
const { recipients, broadcast } = params;
|
|
745
745
|
if (recipients.length > 1) throw new Error("Only one recipient is supported by this wallet provider");
|
|
746
|
+
if (broadcast === false) throw new Error("Signing without broadcasting is not supported by this wallet provider");
|
|
746
747
|
return { txid: await window.unisat.sendBitcoin(recipients[0].address, recipients[0].amount) };
|
|
747
748
|
}
|
|
748
749
|
async signPsbt(params) {
|
|
@@ -1513,6 +1514,13 @@ const walletRenouncePermissionsSuccessResponseSchema = createSuccessResponseSche
|
|
|
1513
1514
|
|
|
1514
1515
|
//#endregion
|
|
1515
1516
|
//#region src/request/rpc/objects/namespaces/wallet/methods/requestPermissions/request.ts
|
|
1517
|
+
/**
|
|
1518
|
+
* This method was previously used to connect to the wallet similarly to how
|
|
1519
|
+
* `wallet_connect` is used now: when no permissions are explicitly requested,
|
|
1520
|
+
* account read permissions are implied. The `nullish` schema allows maintaining
|
|
1521
|
+
* backwards compatibility with this behavior while still allowing for explicit
|
|
1522
|
+
* permission requests.
|
|
1523
|
+
*/
|
|
1516
1524
|
const walletRequestPermissionsParamsSchema = v.nullish(v.array(permissionRequestParamsSchema));
|
|
1517
1525
|
const walletRequestPermissionsRequestSchema = createRequestSchema({
|
|
1518
1526
|
paramsSchema: walletRequestPermissionsParamsSchema,
|
|
@@ -1665,11 +1673,17 @@ const bitcoinGetInfoSuccessResponseSchema = createSuccessResponseSchema({
|
|
|
1665
1673
|
|
|
1666
1674
|
//#endregion
|
|
1667
1675
|
//#region src/request/rpc/objects/namespaces/bitcoin/shared/sendTransfer.ts
|
|
1668
|
-
const sendTransferParamsSchema = v.object({
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1676
|
+
const sendTransferParamsSchema = v.object({
|
|
1677
|
+
recipients: v.array(v.object({
|
|
1678
|
+
address: v.string(),
|
|
1679
|
+
amount: v.number()
|
|
1680
|
+
})),
|
|
1681
|
+
broadcast: v.optional(v.boolean())
|
|
1682
|
+
});
|
|
1683
|
+
const sendTransferResultSchema = v.object({
|
|
1684
|
+
txid: v.string(),
|
|
1685
|
+
transaction: v.optional(v.string())
|
|
1686
|
+
});
|
|
1673
1687
|
|
|
1674
1688
|
//#endregion
|
|
1675
1689
|
//#region src/request/rpc/objects/namespaces/bitcoin/methods/sendTransfer/request.ts
|