@sats-connect/core 0.4.0-7a3cb13 → 0.4.0-80a221a

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.mjs CHANGED
@@ -27,8 +27,7 @@ async function getProviderOrThrow(getProvider) {
27
27
  return provider;
28
28
  }
29
29
  function getProviders() {
30
- if (!window.btc_providers)
31
- window.btc_providers = [];
30
+ if (!window.btc_providers) window.btc_providers = [];
32
31
  return window.btc_providers;
33
32
  }
34
33
  function getProviderById(providerId) {
@@ -110,7 +109,7 @@ var rpcResponseMessageSchema = v2.union([
110
109
  ]);
111
110
 
112
111
  // src/request/index.ts
113
- import * as v20 from "valibot";
112
+ import * as v25 from "valibot";
114
113
 
115
114
  // src/request/types/stxMethods/callContract.ts
116
115
  import * as v3 from "valibot";
@@ -619,7 +618,6 @@ var signPsbtParamsSchema = v13.object({
619
618
  * The key is the address and the value is an array of indexes of the inputs to sign.
620
619
  */
621
620
  signInputs: v13.record(v13.string(), v13.array(v13.number())),
622
- allowedSignHash: v13.optional(v13.number()),
623
621
  /**
624
622
  * Whether to broadcast the transaction after signing.
625
623
  **/
@@ -703,275 +701,774 @@ var getBalanceRequestMessageSchema = v13.object({
703
701
  });
704
702
 
705
703
  // src/request/types/walletMethods.ts
704
+ import * as v19 from "valibot";
705
+
706
+ // node_modules/@noble/hashes/esm/_assert.js
707
+ function isBytes(a) {
708
+ return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
709
+ }
710
+ function bytes(b, ...lengths) {
711
+ if (!isBytes(b))
712
+ throw new Error("Uint8Array expected");
713
+ if (lengths.length > 0 && !lengths.includes(b.length))
714
+ throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);
715
+ }
716
+ function exists(instance, checkFinished = true) {
717
+ if (instance.destroyed)
718
+ throw new Error("Hash instance has been destroyed");
719
+ if (checkFinished && instance.finished)
720
+ throw new Error("Hash#digest() has already been called");
721
+ }
722
+ function output(out, instance) {
723
+ bytes(out);
724
+ const min = instance.outputLen;
725
+ if (out.length < min) {
726
+ throw new Error(`digestInto() expects output buffer of length at least ${min}`);
727
+ }
728
+ }
729
+
730
+ // node_modules/@noble/hashes/esm/utils.js
731
+ var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
732
+ var rotr = (word, shift) => word << 32 - shift | word >>> shift;
733
+ var isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
734
+ var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
735
+ function bytesToHex(bytes2) {
736
+ bytes(bytes2);
737
+ let hex = "";
738
+ for (let i = 0; i < bytes2.length; i++) {
739
+ hex += hexes[bytes2[i]];
740
+ }
741
+ return hex;
742
+ }
743
+ function utf8ToBytes(str) {
744
+ if (typeof str !== "string")
745
+ throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
746
+ return new Uint8Array(new TextEncoder().encode(str));
747
+ }
748
+ function toBytes(data) {
749
+ if (typeof data === "string")
750
+ data = utf8ToBytes(data);
751
+ bytes(data);
752
+ return data;
753
+ }
754
+ var Hash = class {
755
+ // Safe version that clones internal state
756
+ clone() {
757
+ return this._cloneInto();
758
+ }
759
+ };
760
+ var toStr = {}.toString;
761
+ function wrapConstructor(hashCons) {
762
+ const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
763
+ const tmp = hashCons();
764
+ hashC.outputLen = tmp.outputLen;
765
+ hashC.blockLen = tmp.blockLen;
766
+ hashC.create = () => hashCons();
767
+ return hashC;
768
+ }
769
+
770
+ // node_modules/@noble/hashes/esm/_md.js
771
+ function setBigUint64(view, byteOffset, value, isLE2) {
772
+ if (typeof view.setBigUint64 === "function")
773
+ return view.setBigUint64(byteOffset, value, isLE2);
774
+ const _32n = BigInt(32);
775
+ const _u32_max = BigInt(4294967295);
776
+ const wh = Number(value >> _32n & _u32_max);
777
+ const wl = Number(value & _u32_max);
778
+ const h = isLE2 ? 4 : 0;
779
+ const l = isLE2 ? 0 : 4;
780
+ view.setUint32(byteOffset + h, wh, isLE2);
781
+ view.setUint32(byteOffset + l, wl, isLE2);
782
+ }
783
+ var Chi = (a, b, c) => a & b ^ ~a & c;
784
+ var Maj = (a, b, c) => a & b ^ a & c ^ b & c;
785
+ var HashMD = class extends Hash {
786
+ constructor(blockLen, outputLen, padOffset, isLE2) {
787
+ super();
788
+ this.blockLen = blockLen;
789
+ this.outputLen = outputLen;
790
+ this.padOffset = padOffset;
791
+ this.isLE = isLE2;
792
+ this.finished = false;
793
+ this.length = 0;
794
+ this.pos = 0;
795
+ this.destroyed = false;
796
+ this.buffer = new Uint8Array(blockLen);
797
+ this.view = createView(this.buffer);
798
+ }
799
+ update(data) {
800
+ exists(this);
801
+ const { view, buffer, blockLen } = this;
802
+ data = toBytes(data);
803
+ const len = data.length;
804
+ for (let pos = 0; pos < len; ) {
805
+ const take = Math.min(blockLen - this.pos, len - pos);
806
+ if (take === blockLen) {
807
+ const dataView = createView(data);
808
+ for (; blockLen <= len - pos; pos += blockLen)
809
+ this.process(dataView, pos);
810
+ continue;
811
+ }
812
+ buffer.set(data.subarray(pos, pos + take), this.pos);
813
+ this.pos += take;
814
+ pos += take;
815
+ if (this.pos === blockLen) {
816
+ this.process(view, 0);
817
+ this.pos = 0;
818
+ }
819
+ }
820
+ this.length += data.length;
821
+ this.roundClean();
822
+ return this;
823
+ }
824
+ digestInto(out) {
825
+ exists(this);
826
+ output(out, this);
827
+ this.finished = true;
828
+ const { buffer, view, blockLen, isLE: isLE2 } = this;
829
+ let { pos } = this;
830
+ buffer[pos++] = 128;
831
+ this.buffer.subarray(pos).fill(0);
832
+ if (this.padOffset > blockLen - pos) {
833
+ this.process(view, 0);
834
+ pos = 0;
835
+ }
836
+ for (let i = pos; i < blockLen; i++)
837
+ buffer[i] = 0;
838
+ setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2);
839
+ this.process(view, 0);
840
+ const oview = createView(out);
841
+ const len = this.outputLen;
842
+ if (len % 4)
843
+ throw new Error("_sha2: outputLen should be aligned to 32bit");
844
+ const outLen = len / 4;
845
+ const state = this.get();
846
+ if (outLen > state.length)
847
+ throw new Error("_sha2: outputLen bigger than state");
848
+ for (let i = 0; i < outLen; i++)
849
+ oview.setUint32(4 * i, state[i], isLE2);
850
+ }
851
+ digest() {
852
+ const { buffer, outputLen } = this;
853
+ this.digestInto(buffer);
854
+ const res = buffer.slice(0, outputLen);
855
+ this.destroy();
856
+ return res;
857
+ }
858
+ _cloneInto(to) {
859
+ to || (to = new this.constructor());
860
+ to.set(...this.get());
861
+ const { blockLen, buffer, length, finished, destroyed, pos } = this;
862
+ to.length = length;
863
+ to.pos = pos;
864
+ to.finished = finished;
865
+ to.destroyed = destroyed;
866
+ if (length % blockLen)
867
+ to.buffer.set(buffer);
868
+ return to;
869
+ }
870
+ };
871
+
872
+ // node_modules/@noble/hashes/esm/sha256.js
873
+ var SHA256_K = /* @__PURE__ */ new Uint32Array([
874
+ 1116352408,
875
+ 1899447441,
876
+ 3049323471,
877
+ 3921009573,
878
+ 961987163,
879
+ 1508970993,
880
+ 2453635748,
881
+ 2870763221,
882
+ 3624381080,
883
+ 310598401,
884
+ 607225278,
885
+ 1426881987,
886
+ 1925078388,
887
+ 2162078206,
888
+ 2614888103,
889
+ 3248222580,
890
+ 3835390401,
891
+ 4022224774,
892
+ 264347078,
893
+ 604807628,
894
+ 770255983,
895
+ 1249150122,
896
+ 1555081692,
897
+ 1996064986,
898
+ 2554220882,
899
+ 2821834349,
900
+ 2952996808,
901
+ 3210313671,
902
+ 3336571891,
903
+ 3584528711,
904
+ 113926993,
905
+ 338241895,
906
+ 666307205,
907
+ 773529912,
908
+ 1294757372,
909
+ 1396182291,
910
+ 1695183700,
911
+ 1986661051,
912
+ 2177026350,
913
+ 2456956037,
914
+ 2730485921,
915
+ 2820302411,
916
+ 3259730800,
917
+ 3345764771,
918
+ 3516065817,
919
+ 3600352804,
920
+ 4094571909,
921
+ 275423344,
922
+ 430227734,
923
+ 506948616,
924
+ 659060556,
925
+ 883997877,
926
+ 958139571,
927
+ 1322822218,
928
+ 1537002063,
929
+ 1747873779,
930
+ 1955562222,
931
+ 2024104815,
932
+ 2227730452,
933
+ 2361852424,
934
+ 2428436474,
935
+ 2756734187,
936
+ 3204031479,
937
+ 3329325298
938
+ ]);
939
+ var SHA256_IV = /* @__PURE__ */ new Uint32Array([
940
+ 1779033703,
941
+ 3144134277,
942
+ 1013904242,
943
+ 2773480762,
944
+ 1359893119,
945
+ 2600822924,
946
+ 528734635,
947
+ 1541459225
948
+ ]);
949
+ var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
950
+ var SHA256 = class extends HashMD {
951
+ constructor() {
952
+ super(64, 32, 8, false);
953
+ this.A = SHA256_IV[0] | 0;
954
+ this.B = SHA256_IV[1] | 0;
955
+ this.C = SHA256_IV[2] | 0;
956
+ this.D = SHA256_IV[3] | 0;
957
+ this.E = SHA256_IV[4] | 0;
958
+ this.F = SHA256_IV[5] | 0;
959
+ this.G = SHA256_IV[6] | 0;
960
+ this.H = SHA256_IV[7] | 0;
961
+ }
962
+ get() {
963
+ const { A, B, C, D, E, F, G, H } = this;
964
+ return [A, B, C, D, E, F, G, H];
965
+ }
966
+ // prettier-ignore
967
+ set(A, B, C, D, E, F, G, H) {
968
+ this.A = A | 0;
969
+ this.B = B | 0;
970
+ this.C = C | 0;
971
+ this.D = D | 0;
972
+ this.E = E | 0;
973
+ this.F = F | 0;
974
+ this.G = G | 0;
975
+ this.H = H | 0;
976
+ }
977
+ process(view, offset) {
978
+ for (let i = 0; i < 16; i++, offset += 4)
979
+ SHA256_W[i] = view.getUint32(offset, false);
980
+ for (let i = 16; i < 64; i++) {
981
+ const W15 = SHA256_W[i - 15];
982
+ const W2 = SHA256_W[i - 2];
983
+ const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
984
+ const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
985
+ SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
986
+ }
987
+ let { A, B, C, D, E, F, G, H } = this;
988
+ for (let i = 0; i < 64; i++) {
989
+ const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
990
+ const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
991
+ const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
992
+ const T2 = sigma0 + Maj(A, B, C) | 0;
993
+ H = G;
994
+ G = F;
995
+ F = E;
996
+ E = D + T1 | 0;
997
+ D = C;
998
+ C = B;
999
+ B = A;
1000
+ A = T1 + T2 | 0;
1001
+ }
1002
+ A = A + this.A | 0;
1003
+ B = B + this.B | 0;
1004
+ C = C + this.C | 0;
1005
+ D = D + this.D | 0;
1006
+ E = E + this.E | 0;
1007
+ F = F + this.F | 0;
1008
+ G = G + this.G | 0;
1009
+ H = H + this.H | 0;
1010
+ this.set(A, B, C, D, E, F, G, H);
1011
+ }
1012
+ roundClean() {
1013
+ SHA256_W.fill(0);
1014
+ }
1015
+ destroy() {
1016
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
1017
+ this.buffer.fill(0);
1018
+ }
1019
+ };
1020
+ var sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());
1021
+
1022
+ // src/request/types/permissions/resources/account.ts
1023
+ import * as v16 from "valibot";
1024
+
1025
+ // src/request/types/permissions/resources/common.ts
706
1026
  import * as v14 from "valibot";
707
- import { permissions } from "@secretkeylabs/xverse-core";
708
- var permissionTemplate = v14.variant("type", [
709
- v14.object({
710
- ...v14.omit(permissions.resources.account.accountPermissionSchema, ["clientId"]).entries
1027
+ var actionDescriptionSchema = v14.object({
1028
+ name: v14.string(),
1029
+ description: v14.variant("type", [
1030
+ v14.object({ type: v14.literal("single"), value: v14.string() }),
1031
+ v14.object({ type: v14.literal("multiple"), values: v14.array(v14.string()) })
1032
+ ])
1033
+ });
1034
+
1035
+ // src/request/types/permissions/utils/account-id.ts
1036
+ import * as v15 from "valibot";
1037
+ var accountIdBrandName = "AccountId";
1038
+ var accountIdSchema = v15.pipe(v15.string(), v15.brand(accountIdBrandName));
1039
+ function makeAccountId(options) {
1040
+ return v15.parse(
1041
+ accountIdSchema,
1042
+ bytesToHex(
1043
+ sha256(
1044
+ `account-${options.masterPubKey}-${// NOTE: This "account ID" is actually the ~account~ address index from BIP-44.
1045
+ options.accountId}-${options.networkType}`
1046
+ )
1047
+ )
1048
+ );
1049
+ }
1050
+
1051
+ // src/request/types/permissions/resources/account.ts
1052
+ var accountResourceIdBrandName = "AccountResourceId";
1053
+ var sha256HexStringRegex = /^[\da-f]{64}$/;
1054
+ var accountResourceIdSchema = v16.pipe(
1055
+ v16.string(),
1056
+ v16.check((input) => sha256HexStringRegex.test(input)),
1057
+ v16.brand("AccountResourceId")
1058
+ );
1059
+ function makeAccountResourceId(accountId) {
1060
+ return v16.parse(accountResourceIdSchema, bytesToHex(sha256(`account-resource-${accountId}`)));
1061
+ }
1062
+ var accountResourceSchema = v16.object({
1063
+ type: v16.literal("account"),
1064
+ id: accountResourceIdSchema,
1065
+ accountId: accountIdSchema,
1066
+ name: v16.string()
1067
+ });
1068
+ function makeAccountResource(args) {
1069
+ return {
1070
+ type: "account",
1071
+ id: makeAccountResourceId(args.accountId),
1072
+ accountId: args.accountId,
1073
+ name: `Account ${args.accountId}, ${args.masterPubKey.slice(0, 6)}...(${args.networkType})`
1074
+ };
1075
+ }
1076
+ var accountActionsSchema = v16.object({
1077
+ read: v16.optional(v16.boolean()),
1078
+ autoSign: v16.optional(v16.boolean()),
1079
+ rename: v16.optional(v16.boolean())
1080
+ });
1081
+ var accountActionsDescriptionSchema = v16.record(
1082
+ v16.keyof(accountActionsSchema),
1083
+ actionDescriptionSchema
1084
+ );
1085
+ var accountPermissionSchema = v16.object({
1086
+ type: v16.literal("account"),
1087
+ resourceId: accountResourceIdSchema,
1088
+ clientId: v16.string(),
1089
+ actions: accountActionsSchema
1090
+ });
1091
+
1092
+ // src/request/types/permissions/resources/wallet.ts
1093
+ import * as v17 from "valibot";
1094
+ var walletResourceSchema = v17.object({
1095
+ type: v17.literal("wallet"),
1096
+ id: v17.literal("wallet"),
1097
+ name: v17.literal("Wallet")
1098
+ });
1099
+ var walletActionsSchema = v17.object({
1100
+ addPrivateKey: v17.optional(v17.boolean()),
1101
+ openPopup: v17.optional(v17.boolean()),
1102
+ openFullPage: v17.optional(v17.boolean()),
1103
+ readAllAccounts: v17.optional(v17.boolean())
1104
+ });
1105
+ var walletActionsDescriptionSchema = v17.record(
1106
+ v17.keyof(walletActionsSchema),
1107
+ actionDescriptionSchema
1108
+ );
1109
+ var walletIdSchema = v17.literal("wallet");
1110
+ var walletPermissionSchema = v17.object({
1111
+ type: v17.literal("wallet"),
1112
+ resourceId: walletIdSchema,
1113
+ clientId: v17.string(),
1114
+ actions: walletActionsSchema
1115
+ });
1116
+
1117
+ // src/request/types/permissions/resources/index.ts
1118
+ var account = {
1119
+ accountResourceIdBrandName,
1120
+ accountResourceIdSchema,
1121
+ accountResourceSchema,
1122
+ accountActionsSchema,
1123
+ accountActionsDescriptionSchema,
1124
+ accountPermissionSchema,
1125
+ makeAccountResourceId,
1126
+ makeAccountResource
1127
+ };
1128
+ var common = {
1129
+ actionDescriptionSchema
1130
+ };
1131
+ var wallet = {
1132
+ walletResourceSchema,
1133
+ walletActionsSchema,
1134
+ walletIdSchema,
1135
+ walletPermissionSchema,
1136
+ walletActionsDescriptionSchema
1137
+ };
1138
+
1139
+ // src/request/types/permissions/utils/index.ts
1140
+ var account2 = {
1141
+ makeAccountId,
1142
+ accountIdBrandName,
1143
+ accountIdSchema
1144
+ };
1145
+
1146
+ // src/request/types/permissions/store.ts
1147
+ import * as v18 from "valibot";
1148
+ var clientId = v18.pipe(v18.string(), v18.url(), v18.brand("ClientId"));
1149
+ var client = v18.object({
1150
+ id: clientId,
1151
+ origin: v18.string(),
1152
+ name: v18.optional(v18.string()),
1153
+ description: v18.optional(v18.string())
1154
+ });
1155
+ var clientsTable = v18.array(client);
1156
+ var clientMetadata = v18.object({
1157
+ clientId: client.entries.id,
1158
+ lastUsed: v18.optional(v18.number())
1159
+ });
1160
+ var clientMetadataTable = v18.array(clientMetadata);
1161
+ var resource = v18.variant("type", [accountResourceSchema, walletResourceSchema]);
1162
+ var resourcesTable = v18.array(resource);
1163
+ var permission = v18.variant("type", [accountPermissionSchema, walletPermissionSchema]);
1164
+ var permissionsTable = v18.array(permission);
1165
+ var permissionsStore = v18.object({
1166
+ version: v18.literal(4),
1167
+ clients: clientsTable,
1168
+ clientMetadata: clientMetadataTable,
1169
+ resources: resourcesTable,
1170
+ permissions: permissionsTable
1171
+ });
1172
+
1173
+ // src/request/types/permissions/index.ts
1174
+ var resources = {
1175
+ account,
1176
+ common,
1177
+ wallet
1178
+ };
1179
+ var utils = {
1180
+ account: account2
1181
+ };
1182
+ var store = {
1183
+ clientId,
1184
+ client,
1185
+ clientMetadata,
1186
+ clientMetadataTable,
1187
+ clientsTable,
1188
+ resource,
1189
+ resourcesTable,
1190
+ permission,
1191
+ permissionsTable,
1192
+ permissionsStore
1193
+ };
1194
+ var permissions = {
1195
+ resources,
1196
+ utils,
1197
+ store
1198
+ };
1199
+
1200
+ // src/request/types/walletMethods.ts
1201
+ var permissionTemplate = v19.variant("type", [
1202
+ v19.object({
1203
+ ...v19.omit(permissions.resources.account.accountPermissionSchema, ["clientId"]).entries
711
1204
  }),
712
- v14.object({
713
- ...v14.omit(permissions.resources.wallet.walletPermissionSchema, ["clientId"]).entries
1205
+ v19.object({
1206
+ ...v19.omit(permissions.resources.wallet.walletPermissionSchema, ["clientId"]).entries
714
1207
  })
715
1208
  ]);
716
1209
  var requestPermissionsMethodName = "wallet_requestPermissions";
717
- var requestPermissionsParamsSchema = v14.nullish(v14.array(permissionTemplate));
718
- var requestPermissionsResultSchema = v14.literal(true);
719
- var requestPermissionsRequestMessageSchema = v14.object({
1210
+ var requestPermissionsParamsSchema = v19.nullish(v19.array(permissionTemplate));
1211
+ var requestPermissionsResultSchema = v19.literal(true);
1212
+ var requestPermissionsRequestMessageSchema = v19.object({
720
1213
  ...rpcRequestMessageSchema.entries,
721
- ...v14.object({
722
- method: v14.literal(requestPermissionsMethodName),
1214
+ ...v19.object({
1215
+ method: v19.literal(requestPermissionsMethodName),
723
1216
  params: requestPermissionsParamsSchema,
724
- id: v14.string()
1217
+ id: v19.string()
725
1218
  }).entries
726
1219
  });
727
1220
  var renouncePermissionsMethodName = "wallet_renouncePermissions";
728
- var renouncePermissionsParamsSchema = v14.nullish(v14.null());
729
- var renouncePermissionsResultSchema = v14.nullish(v14.null());
730
- var renouncePermissionsRequestMessageSchema = v14.object({
1221
+ var renouncePermissionsParamsSchema = v19.nullish(v19.null());
1222
+ var renouncePermissionsResultSchema = v19.nullish(v19.null());
1223
+ var renouncePermissionsRequestMessageSchema = v19.object({
731
1224
  ...rpcRequestMessageSchema.entries,
732
- ...v14.object({
733
- method: v14.literal(renouncePermissionsMethodName),
1225
+ ...v19.object({
1226
+ method: v19.literal(renouncePermissionsMethodName),
734
1227
  params: renouncePermissionsParamsSchema,
735
- id: v14.string()
1228
+ id: v19.string()
736
1229
  }).entries
737
1230
  });
738
1231
  var disconnectMethodName = "wallet_disconnect";
739
- var disconnectParamsSchema = v14.nullish(v14.null());
740
- var disconnectResultSchema = v14.nullish(v14.null());
741
- var disconnectRequestMessageSchema = v14.object({
1232
+ var disconnectParamsSchema = v19.nullish(v19.null());
1233
+ var disconnectResultSchema = v19.nullish(v19.null());
1234
+ var disconnectRequestMessageSchema = v19.object({
742
1235
  ...rpcRequestMessageSchema.entries,
743
- ...v14.object({
744
- method: v14.literal(disconnectMethodName),
1236
+ ...v19.object({
1237
+ method: v19.literal(disconnectMethodName),
745
1238
  params: disconnectParamsSchema,
746
- id: v14.string()
1239
+ id: v19.string()
747
1240
  }).entries
748
1241
  });
749
1242
  var getWalletTypeMethodName = "wallet_getWalletType";
750
- var getWalletTypeParamsSchema = v14.nullish(v14.null());
1243
+ var getWalletTypeParamsSchema = v19.nullish(v19.null());
751
1244
  var getWalletTypeResultSchema = walletTypeSchema;
752
- var getWalletTypeRequestMessageSchema = v14.object({
1245
+ var getWalletTypeRequestMessageSchema = v19.object({
753
1246
  ...rpcRequestMessageSchema.entries,
754
- ...v14.object({
755
- method: v14.literal(getWalletTypeMethodName),
1247
+ ...v19.object({
1248
+ method: v19.literal(getWalletTypeMethodName),
756
1249
  params: getWalletTypeParamsSchema,
757
- id: v14.string()
1250
+ id: v19.string()
758
1251
  }).entries
759
1252
  });
760
1253
  var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
761
- var getCurrentPermissionsParamsSchema = v14.nullish(v14.null());
762
- var getCurrentPermissionsResultSchema = v14.array(permissions.store.permission);
763
- var getCurrentPermissionsRequestMessageSchema = v14.object({
1254
+ var getCurrentPermissionsParamsSchema = v19.nullish(v19.null());
1255
+ var getCurrentPermissionsResultSchema = v19.array(permissions.store.permission);
1256
+ var getCurrentPermissionsRequestMessageSchema = v19.object({
764
1257
  ...rpcRequestMessageSchema.entries,
765
- ...v14.object({
766
- method: v14.literal(getCurrentPermissionsMethodName),
1258
+ ...v19.object({
1259
+ method: v19.literal(getCurrentPermissionsMethodName),
767
1260
  params: getCurrentPermissionsParamsSchema,
768
- id: v14.string()
1261
+ id: v19.string()
769
1262
  }).entries
770
1263
  });
771
1264
  var getAccountMethodName = "wallet_getAccount";
772
- var getAccountParamsSchema = v14.nullish(v14.null());
773
- var getAccountResultSchema = v14.object({
1265
+ var getAccountParamsSchema = v19.nullish(v19.null());
1266
+ var getAccountResultSchema = v19.object({
774
1267
  id: permissions.utils.account.accountIdSchema,
775
- addresses: v14.array(addressSchema),
1268
+ addresses: v19.array(addressSchema),
776
1269
  walletType: walletTypeSchema
777
1270
  });
778
- var getAccountRequestMessageSchema = v14.object({
1271
+ var getAccountRequestMessageSchema = v19.object({
779
1272
  ...rpcRequestMessageSchema.entries,
780
- ...v14.object({
781
- method: v14.literal(getAccountMethodName),
1273
+ ...v19.object({
1274
+ method: v19.literal(getAccountMethodName),
782
1275
  params: getAccountParamsSchema,
783
- id: v14.string()
1276
+ id: v19.string()
784
1277
  }).entries
785
1278
  });
786
1279
  var connectMethodName = "wallet_connect";
787
- var connectParamsSchema = v14.nullish(
788
- v14.object({
789
- permissions: v14.optional(v14.array(permissionTemplate))
1280
+ var connectParamsSchema = v19.nullish(
1281
+ v19.object({
1282
+ permissions: v19.optional(v19.array(permissionTemplate)),
1283
+ addresses: v19.optional(v19.array(v19.enum(AddressPurpose))),
1284
+ message: v19.optional(
1285
+ v19.pipe(v19.string(), v19.maxLength(80, "The message must not exceed 80 characters."))
1286
+ )
790
1287
  })
791
1288
  );
792
1289
  var connectResultSchema = getAccountResultSchema;
793
- var connectRequestMessageSchema = v14.object({
1290
+ var connectRequestMessageSchema = v19.object({
794
1291
  ...rpcRequestMessageSchema.entries,
795
- ...v14.object({
796
- method: v14.literal(connectMethodName),
1292
+ ...v19.object({
1293
+ method: v19.literal(connectMethodName),
797
1294
  params: connectParamsSchema,
798
- id: v14.string()
1295
+ id: v19.string()
799
1296
  }).entries
800
1297
  });
801
1298
 
802
1299
  // src/request/types/runesMethods/etch.ts
803
- import * as v15 from "valibot";
1300
+ import * as v20 from "valibot";
804
1301
  var runesEtchMethodName = "runes_etch";
805
- var etchTermsSchema = v15.object({
806
- amount: v15.string(),
807
- cap: v15.string(),
808
- heightStart: v15.optional(v15.string()),
809
- heightEnd: v15.optional(v15.string()),
810
- offsetStart: v15.optional(v15.string()),
811
- offsetEnd: v15.optional(v15.string())
812
- });
813
- var inscriptionDetailsSchema = v15.object({
814
- contentType: v15.string(),
815
- contentBase64: v15.string()
816
- });
817
- var runesEtchParamsSchema = v15.object({
818
- runeName: v15.string(),
819
- divisibility: v15.optional(v15.number()),
820
- symbol: v15.optional(v15.string()),
821
- premine: v15.optional(v15.string()),
822
- isMintable: v15.boolean(),
823
- delegateInscriptionId: v15.optional(v15.string()),
824
- destinationAddress: v15.string(),
825
- refundAddress: v15.string(),
826
- feeRate: v15.number(),
827
- appServiceFee: v15.optional(v15.number()),
828
- appServiceFeeAddress: v15.optional(v15.string()),
829
- terms: v15.optional(etchTermsSchema),
830
- inscriptionDetails: v15.optional(inscriptionDetailsSchema),
831
- network: v15.optional(v15.enum(BitcoinNetworkType))
832
- });
833
- var runesEtchResultSchema = v15.object({
834
- orderId: v15.string(),
835
- fundTransactionId: v15.string(),
836
- fundingAddress: v15.string()
837
- });
838
- var runesEtchRequestMessageSchema = v15.object({
1302
+ var etchTermsSchema = v20.object({
1303
+ amount: v20.string(),
1304
+ cap: v20.string(),
1305
+ heightStart: v20.optional(v20.string()),
1306
+ heightEnd: v20.optional(v20.string()),
1307
+ offsetStart: v20.optional(v20.string()),
1308
+ offsetEnd: v20.optional(v20.string())
1309
+ });
1310
+ var inscriptionDetailsSchema = v20.object({
1311
+ contentType: v20.string(),
1312
+ contentBase64: v20.string()
1313
+ });
1314
+ var runesEtchParamsSchema = v20.object({
1315
+ runeName: v20.string(),
1316
+ divisibility: v20.optional(v20.number()),
1317
+ symbol: v20.optional(v20.string()),
1318
+ premine: v20.optional(v20.string()),
1319
+ isMintable: v20.boolean(),
1320
+ delegateInscriptionId: v20.optional(v20.string()),
1321
+ destinationAddress: v20.string(),
1322
+ refundAddress: v20.string(),
1323
+ feeRate: v20.number(),
1324
+ appServiceFee: v20.optional(v20.number()),
1325
+ appServiceFeeAddress: v20.optional(v20.string()),
1326
+ terms: v20.optional(etchTermsSchema),
1327
+ inscriptionDetails: v20.optional(inscriptionDetailsSchema),
1328
+ network: v20.optional(v20.enum(BitcoinNetworkType))
1329
+ });
1330
+ var runesEtchResultSchema = v20.object({
1331
+ orderId: v20.string(),
1332
+ fundTransactionId: v20.string(),
1333
+ fundingAddress: v20.string()
1334
+ });
1335
+ var runesEtchRequestMessageSchema = v20.object({
839
1336
  ...rpcRequestMessageSchema.entries,
840
- ...v15.object({
841
- method: v15.literal(runesEtchMethodName),
1337
+ ...v20.object({
1338
+ method: v20.literal(runesEtchMethodName),
842
1339
  params: runesEtchParamsSchema,
843
- id: v15.string()
1340
+ id: v20.string()
844
1341
  }).entries
845
1342
  });
846
1343
 
847
1344
  // src/request/types/runesMethods/getBalance.ts
848
- import * as v16 from "valibot";
1345
+ import * as v21 from "valibot";
849
1346
  var runesGetBalanceMethodName = "runes_getBalance";
850
- var runesGetBalanceParamsSchema = v16.nullish(v16.null());
851
- var runesGetBalanceResultSchema = v16.object({
852
- balances: v16.array(
853
- v16.object({
854
- runeName: v16.string(),
855
- amount: v16.string(),
856
- divisibility: v16.number(),
857
- symbol: v16.string(),
858
- inscriptionId: v16.nullish(v16.string())
1347
+ var runesGetBalanceParamsSchema = v21.nullish(v21.null());
1348
+ var runesGetBalanceResultSchema = v21.object({
1349
+ balances: v21.array(
1350
+ v21.object({
1351
+ runeName: v21.string(),
1352
+ amount: v21.string(),
1353
+ divisibility: v21.number(),
1354
+ symbol: v21.string(),
1355
+ inscriptionId: v21.nullish(v21.string())
859
1356
  })
860
1357
  )
861
1358
  });
862
- var runesGetBalanceRequestMessageSchema = v16.object({
1359
+ var runesGetBalanceRequestMessageSchema = v21.object({
863
1360
  ...rpcRequestMessageSchema.entries,
864
- ...v16.object({
865
- method: v16.literal(runesGetBalanceMethodName),
1361
+ ...v21.object({
1362
+ method: v21.literal(runesGetBalanceMethodName),
866
1363
  params: runesGetBalanceParamsSchema,
867
- id: v16.string()
1364
+ id: v21.string()
868
1365
  }).entries
869
1366
  });
870
1367
 
871
1368
  // src/request/types/runesMethods/mint.ts
872
- import * as v17 from "valibot";
1369
+ import * as v22 from "valibot";
873
1370
  var runesMintMethodName = "runes_mint";
874
- var runesMintParamsSchema = v17.object({
875
- appServiceFee: v17.optional(v17.number()),
876
- appServiceFeeAddress: v17.optional(v17.string()),
877
- destinationAddress: v17.string(),
878
- feeRate: v17.number(),
879
- refundAddress: v17.string(),
880
- repeats: v17.number(),
881
- runeName: v17.string(),
882
- network: v17.optional(v17.enum(BitcoinNetworkType))
883
- });
884
- var runesMintResultSchema = v17.object({
885
- orderId: v17.string(),
886
- fundTransactionId: v17.string(),
887
- fundingAddress: v17.string()
888
- });
889
- var runesMintRequestMessageSchema = v17.object({
1371
+ var runesMintParamsSchema = v22.object({
1372
+ appServiceFee: v22.optional(v22.number()),
1373
+ appServiceFeeAddress: v22.optional(v22.string()),
1374
+ destinationAddress: v22.string(),
1375
+ feeRate: v22.number(),
1376
+ refundAddress: v22.string(),
1377
+ repeats: v22.number(),
1378
+ runeName: v22.string(),
1379
+ network: v22.optional(v22.enum(BitcoinNetworkType))
1380
+ });
1381
+ var runesMintResultSchema = v22.object({
1382
+ orderId: v22.string(),
1383
+ fundTransactionId: v22.string(),
1384
+ fundingAddress: v22.string()
1385
+ });
1386
+ var runesMintRequestMessageSchema = v22.object({
890
1387
  ...rpcRequestMessageSchema.entries,
891
- ...v17.object({
892
- method: v17.literal(runesMintMethodName),
1388
+ ...v22.object({
1389
+ method: v22.literal(runesMintMethodName),
893
1390
  params: runesMintParamsSchema,
894
- id: v17.string()
1391
+ id: v22.string()
895
1392
  }).entries
896
1393
  });
897
1394
 
898
1395
  // src/request/types/runesMethods/transfer.ts
899
- import * as v18 from "valibot";
1396
+ import * as v23 from "valibot";
900
1397
  var runesTransferMethodName = "runes_transfer";
901
- var runesTransferParamsSchema = v18.object({
902
- recipients: v18.array(
903
- v18.object({
904
- runeName: v18.string(),
905
- amount: v18.string(),
906
- address: v18.string()
1398
+ var runesTransferParamsSchema = v23.object({
1399
+ recipients: v23.array(
1400
+ v23.object({
1401
+ runeName: v23.string(),
1402
+ amount: v23.string(),
1403
+ address: v23.string()
907
1404
  })
908
1405
  )
909
1406
  });
910
- var runesTransferResultSchema = v18.object({
911
- txid: v18.string()
1407
+ var runesTransferResultSchema = v23.object({
1408
+ txid: v23.string()
912
1409
  });
913
- var runesTransferRequestMessageSchema = v18.object({
1410
+ var runesTransferRequestMessageSchema = v23.object({
914
1411
  ...rpcRequestMessageSchema.entries,
915
- ...v18.object({
916
- method: v18.literal(runesTransferMethodName),
1412
+ ...v23.object({
1413
+ method: v23.literal(runesTransferMethodName),
917
1414
  params: runesTransferParamsSchema,
918
- id: v18.string()
1415
+ id: v23.string()
919
1416
  }).entries
920
1417
  });
921
1418
 
922
1419
  // src/request/types/ordinalsMethods.ts
923
- import * as v19 from "valibot";
1420
+ import * as v24 from "valibot";
924
1421
  var getInscriptionsMethodName = "ord_getInscriptions";
925
- var getInscriptionsParamsSchema = v19.object({
926
- offset: v19.number(),
927
- limit: v19.number()
928
- });
929
- var getInscriptionsResultSchema = v19.object({
930
- total: v19.number(),
931
- limit: v19.number(),
932
- offset: v19.number(),
933
- inscriptions: v19.array(
934
- v19.object({
935
- inscriptionId: v19.string(),
936
- inscriptionNumber: v19.string(),
937
- address: v19.string(),
938
- collectionName: v19.optional(v19.string()),
939
- postage: v19.string(),
940
- contentLength: v19.string(),
941
- contentType: v19.string(),
942
- timestamp: v19.number(),
943
- offset: v19.number(),
944
- genesisTransaction: v19.string(),
945
- output: v19.string()
1422
+ var getInscriptionsParamsSchema = v24.object({
1423
+ offset: v24.number(),
1424
+ limit: v24.number()
1425
+ });
1426
+ var getInscriptionsResultSchema = v24.object({
1427
+ total: v24.number(),
1428
+ limit: v24.number(),
1429
+ offset: v24.number(),
1430
+ inscriptions: v24.array(
1431
+ v24.object({
1432
+ inscriptionId: v24.string(),
1433
+ inscriptionNumber: v24.string(),
1434
+ address: v24.string(),
1435
+ collectionName: v24.optional(v24.string()),
1436
+ postage: v24.string(),
1437
+ contentLength: v24.string(),
1438
+ contentType: v24.string(),
1439
+ timestamp: v24.number(),
1440
+ offset: v24.number(),
1441
+ genesisTransaction: v24.string(),
1442
+ output: v24.string()
946
1443
  })
947
1444
  )
948
1445
  });
949
- var getInscriptionsRequestMessageSchema = v19.object({
1446
+ var getInscriptionsRequestMessageSchema = v24.object({
950
1447
  ...rpcRequestMessageSchema.entries,
951
- ...v19.object({
952
- method: v19.literal(getInscriptionsMethodName),
1448
+ ...v24.object({
1449
+ method: v24.literal(getInscriptionsMethodName),
953
1450
  params: getInscriptionsParamsSchema,
954
- id: v19.string()
1451
+ id: v24.string()
955
1452
  }).entries
956
1453
  });
957
1454
  var sendInscriptionsMethodName = "ord_sendInscriptions";
958
- var sendInscriptionsParamsSchema = v19.object({
959
- transfers: v19.array(
960
- v19.object({
961
- address: v19.string(),
962
- inscriptionId: v19.string()
1455
+ var sendInscriptionsParamsSchema = v24.object({
1456
+ transfers: v24.array(
1457
+ v24.object({
1458
+ address: v24.string(),
1459
+ inscriptionId: v24.string()
963
1460
  })
964
1461
  )
965
1462
  });
966
- var sendInscriptionsResultSchema = v19.object({
967
- txid: v19.string()
1463
+ var sendInscriptionsResultSchema = v24.object({
1464
+ txid: v24.string()
968
1465
  });
969
- var sendInscriptionsRequestMessageSchema = v19.object({
1466
+ var sendInscriptionsRequestMessageSchema = v24.object({
970
1467
  ...rpcRequestMessageSchema.entries,
971
- ...v19.object({
972
- method: v19.literal(sendInscriptionsMethodName),
1468
+ ...v24.object({
1469
+ method: v24.literal(sendInscriptionsMethodName),
973
1470
  params: sendInscriptionsParamsSchema,
974
- id: v19.string()
1471
+ id: v24.string()
975
1472
  }).entries
976
1473
  });
977
1474
 
@@ -988,13 +1485,13 @@ var request = async (method, params, providerId) => {
988
1485
  throw new Error("A wallet method is required");
989
1486
  }
990
1487
  const response = await provider.request(method, params);
991
- if (v20.is(rpcErrorResponseMessageSchema, response)) {
1488
+ if (v25.is(rpcErrorResponseMessageSchema, response)) {
992
1489
  return {
993
1490
  status: "error",
994
1491
  error: response.error
995
1492
  };
996
1493
  }
997
- if (v20.is(rpcSuccessResponseMessageSchema, response)) {
1494
+ if (v25.is(rpcSuccessResponseMessageSchema, response)) {
998
1495
  return {
999
1496
  status: "success",
1000
1497
  result: response.result
@@ -1750,8 +2247,7 @@ var extractOrValidateCapabilities = (provider, reportedCapabilities) => {
1750
2247
  addListener: validateCapability("addListener")
1751
2248
  };
1752
2249
  return Object.entries(capabilityMap).reduce((acc, [capability, value]) => {
1753
- if (value)
1754
- return [...acc, capability];
2250
+ if (value) return [...acc, capability];
1755
2251
  return acc;
1756
2252
  }, []);
1757
2253
  };
@@ -2092,3 +2588,8 @@ export {
2092
2588
  walletTypeSchema,
2093
2589
  walletTypes
2094
2590
  };
2591
+ /*! Bundled license information:
2592
+
2593
+ @noble/hashes/esm/utils.js:
2594
+ (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
2595
+ */