@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.js CHANGED
@@ -217,8 +217,7 @@ async function getProviderOrThrow(getProvider) {
217
217
  return provider;
218
218
  }
219
219
  function getProviders() {
220
- if (!window.btc_providers)
221
- window.btc_providers = [];
220
+ if (!window.btc_providers) window.btc_providers = [];
222
221
  return window.btc_providers;
223
222
  }
224
223
  function getProviderById(providerId) {
@@ -300,7 +299,7 @@ var rpcResponseMessageSchema = v2.union([
300
299
  ]);
301
300
 
302
301
  // src/request/index.ts
303
- var v20 = __toESM(require("valibot"));
302
+ var v25 = __toESM(require("valibot"));
304
303
 
305
304
  // src/request/types/stxMethods/callContract.ts
306
305
  var v3 = __toESM(require("valibot"));
@@ -809,7 +808,6 @@ var signPsbtParamsSchema = v13.object({
809
808
  * The key is the address and the value is an array of indexes of the inputs to sign.
810
809
  */
811
810
  signInputs: v13.record(v13.string(), v13.array(v13.number())),
812
- allowedSignHash: v13.optional(v13.number()),
813
811
  /**
814
812
  * Whether to broadcast the transaction after signing.
815
813
  **/
@@ -893,275 +891,774 @@ var getBalanceRequestMessageSchema = v13.object({
893
891
  });
894
892
 
895
893
  // src/request/types/walletMethods.ts
894
+ var v19 = __toESM(require("valibot"));
895
+
896
+ // node_modules/@noble/hashes/esm/_assert.js
897
+ function isBytes(a) {
898
+ return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
899
+ }
900
+ function bytes(b, ...lengths) {
901
+ if (!isBytes(b))
902
+ throw new Error("Uint8Array expected");
903
+ if (lengths.length > 0 && !lengths.includes(b.length))
904
+ throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);
905
+ }
906
+ function exists(instance, checkFinished = true) {
907
+ if (instance.destroyed)
908
+ throw new Error("Hash instance has been destroyed");
909
+ if (checkFinished && instance.finished)
910
+ throw new Error("Hash#digest() has already been called");
911
+ }
912
+ function output(out, instance) {
913
+ bytes(out);
914
+ const min = instance.outputLen;
915
+ if (out.length < min) {
916
+ throw new Error(`digestInto() expects output buffer of length at least ${min}`);
917
+ }
918
+ }
919
+
920
+ // node_modules/@noble/hashes/esm/utils.js
921
+ var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
922
+ var rotr = (word, shift) => word << 32 - shift | word >>> shift;
923
+ var isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
924
+ var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
925
+ function bytesToHex(bytes2) {
926
+ bytes(bytes2);
927
+ let hex = "";
928
+ for (let i = 0; i < bytes2.length; i++) {
929
+ hex += hexes[bytes2[i]];
930
+ }
931
+ return hex;
932
+ }
933
+ function utf8ToBytes(str) {
934
+ if (typeof str !== "string")
935
+ throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
936
+ return new Uint8Array(new TextEncoder().encode(str));
937
+ }
938
+ function toBytes(data) {
939
+ if (typeof data === "string")
940
+ data = utf8ToBytes(data);
941
+ bytes(data);
942
+ return data;
943
+ }
944
+ var Hash = class {
945
+ // Safe version that clones internal state
946
+ clone() {
947
+ return this._cloneInto();
948
+ }
949
+ };
950
+ var toStr = {}.toString;
951
+ function wrapConstructor(hashCons) {
952
+ const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
953
+ const tmp = hashCons();
954
+ hashC.outputLen = tmp.outputLen;
955
+ hashC.blockLen = tmp.blockLen;
956
+ hashC.create = () => hashCons();
957
+ return hashC;
958
+ }
959
+
960
+ // node_modules/@noble/hashes/esm/_md.js
961
+ function setBigUint64(view, byteOffset, value, isLE2) {
962
+ if (typeof view.setBigUint64 === "function")
963
+ return view.setBigUint64(byteOffset, value, isLE2);
964
+ const _32n = BigInt(32);
965
+ const _u32_max = BigInt(4294967295);
966
+ const wh = Number(value >> _32n & _u32_max);
967
+ const wl = Number(value & _u32_max);
968
+ const h = isLE2 ? 4 : 0;
969
+ const l = isLE2 ? 0 : 4;
970
+ view.setUint32(byteOffset + h, wh, isLE2);
971
+ view.setUint32(byteOffset + l, wl, isLE2);
972
+ }
973
+ var Chi = (a, b, c) => a & b ^ ~a & c;
974
+ var Maj = (a, b, c) => a & b ^ a & c ^ b & c;
975
+ var HashMD = class extends Hash {
976
+ constructor(blockLen, outputLen, padOffset, isLE2) {
977
+ super();
978
+ this.blockLen = blockLen;
979
+ this.outputLen = outputLen;
980
+ this.padOffset = padOffset;
981
+ this.isLE = isLE2;
982
+ this.finished = false;
983
+ this.length = 0;
984
+ this.pos = 0;
985
+ this.destroyed = false;
986
+ this.buffer = new Uint8Array(blockLen);
987
+ this.view = createView(this.buffer);
988
+ }
989
+ update(data) {
990
+ exists(this);
991
+ const { view, buffer, blockLen } = this;
992
+ data = toBytes(data);
993
+ const len = data.length;
994
+ for (let pos = 0; pos < len; ) {
995
+ const take = Math.min(blockLen - this.pos, len - pos);
996
+ if (take === blockLen) {
997
+ const dataView = createView(data);
998
+ for (; blockLen <= len - pos; pos += blockLen)
999
+ this.process(dataView, pos);
1000
+ continue;
1001
+ }
1002
+ buffer.set(data.subarray(pos, pos + take), this.pos);
1003
+ this.pos += take;
1004
+ pos += take;
1005
+ if (this.pos === blockLen) {
1006
+ this.process(view, 0);
1007
+ this.pos = 0;
1008
+ }
1009
+ }
1010
+ this.length += data.length;
1011
+ this.roundClean();
1012
+ return this;
1013
+ }
1014
+ digestInto(out) {
1015
+ exists(this);
1016
+ output(out, this);
1017
+ this.finished = true;
1018
+ const { buffer, view, blockLen, isLE: isLE2 } = this;
1019
+ let { pos } = this;
1020
+ buffer[pos++] = 128;
1021
+ this.buffer.subarray(pos).fill(0);
1022
+ if (this.padOffset > blockLen - pos) {
1023
+ this.process(view, 0);
1024
+ pos = 0;
1025
+ }
1026
+ for (let i = pos; i < blockLen; i++)
1027
+ buffer[i] = 0;
1028
+ setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2);
1029
+ this.process(view, 0);
1030
+ const oview = createView(out);
1031
+ const len = this.outputLen;
1032
+ if (len % 4)
1033
+ throw new Error("_sha2: outputLen should be aligned to 32bit");
1034
+ const outLen = len / 4;
1035
+ const state = this.get();
1036
+ if (outLen > state.length)
1037
+ throw new Error("_sha2: outputLen bigger than state");
1038
+ for (let i = 0; i < outLen; i++)
1039
+ oview.setUint32(4 * i, state[i], isLE2);
1040
+ }
1041
+ digest() {
1042
+ const { buffer, outputLen } = this;
1043
+ this.digestInto(buffer);
1044
+ const res = buffer.slice(0, outputLen);
1045
+ this.destroy();
1046
+ return res;
1047
+ }
1048
+ _cloneInto(to) {
1049
+ to || (to = new this.constructor());
1050
+ to.set(...this.get());
1051
+ const { blockLen, buffer, length, finished, destroyed, pos } = this;
1052
+ to.length = length;
1053
+ to.pos = pos;
1054
+ to.finished = finished;
1055
+ to.destroyed = destroyed;
1056
+ if (length % blockLen)
1057
+ to.buffer.set(buffer);
1058
+ return to;
1059
+ }
1060
+ };
1061
+
1062
+ // node_modules/@noble/hashes/esm/sha256.js
1063
+ var SHA256_K = /* @__PURE__ */ new Uint32Array([
1064
+ 1116352408,
1065
+ 1899447441,
1066
+ 3049323471,
1067
+ 3921009573,
1068
+ 961987163,
1069
+ 1508970993,
1070
+ 2453635748,
1071
+ 2870763221,
1072
+ 3624381080,
1073
+ 310598401,
1074
+ 607225278,
1075
+ 1426881987,
1076
+ 1925078388,
1077
+ 2162078206,
1078
+ 2614888103,
1079
+ 3248222580,
1080
+ 3835390401,
1081
+ 4022224774,
1082
+ 264347078,
1083
+ 604807628,
1084
+ 770255983,
1085
+ 1249150122,
1086
+ 1555081692,
1087
+ 1996064986,
1088
+ 2554220882,
1089
+ 2821834349,
1090
+ 2952996808,
1091
+ 3210313671,
1092
+ 3336571891,
1093
+ 3584528711,
1094
+ 113926993,
1095
+ 338241895,
1096
+ 666307205,
1097
+ 773529912,
1098
+ 1294757372,
1099
+ 1396182291,
1100
+ 1695183700,
1101
+ 1986661051,
1102
+ 2177026350,
1103
+ 2456956037,
1104
+ 2730485921,
1105
+ 2820302411,
1106
+ 3259730800,
1107
+ 3345764771,
1108
+ 3516065817,
1109
+ 3600352804,
1110
+ 4094571909,
1111
+ 275423344,
1112
+ 430227734,
1113
+ 506948616,
1114
+ 659060556,
1115
+ 883997877,
1116
+ 958139571,
1117
+ 1322822218,
1118
+ 1537002063,
1119
+ 1747873779,
1120
+ 1955562222,
1121
+ 2024104815,
1122
+ 2227730452,
1123
+ 2361852424,
1124
+ 2428436474,
1125
+ 2756734187,
1126
+ 3204031479,
1127
+ 3329325298
1128
+ ]);
1129
+ var SHA256_IV = /* @__PURE__ */ new Uint32Array([
1130
+ 1779033703,
1131
+ 3144134277,
1132
+ 1013904242,
1133
+ 2773480762,
1134
+ 1359893119,
1135
+ 2600822924,
1136
+ 528734635,
1137
+ 1541459225
1138
+ ]);
1139
+ var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
1140
+ var SHA256 = class extends HashMD {
1141
+ constructor() {
1142
+ super(64, 32, 8, false);
1143
+ this.A = SHA256_IV[0] | 0;
1144
+ this.B = SHA256_IV[1] | 0;
1145
+ this.C = SHA256_IV[2] | 0;
1146
+ this.D = SHA256_IV[3] | 0;
1147
+ this.E = SHA256_IV[4] | 0;
1148
+ this.F = SHA256_IV[5] | 0;
1149
+ this.G = SHA256_IV[6] | 0;
1150
+ this.H = SHA256_IV[7] | 0;
1151
+ }
1152
+ get() {
1153
+ const { A, B, C, D, E, F, G, H } = this;
1154
+ return [A, B, C, D, E, F, G, H];
1155
+ }
1156
+ // prettier-ignore
1157
+ set(A, B, C, D, E, F, G, H) {
1158
+ this.A = A | 0;
1159
+ this.B = B | 0;
1160
+ this.C = C | 0;
1161
+ this.D = D | 0;
1162
+ this.E = E | 0;
1163
+ this.F = F | 0;
1164
+ this.G = G | 0;
1165
+ this.H = H | 0;
1166
+ }
1167
+ process(view, offset) {
1168
+ for (let i = 0; i < 16; i++, offset += 4)
1169
+ SHA256_W[i] = view.getUint32(offset, false);
1170
+ for (let i = 16; i < 64; i++) {
1171
+ const W15 = SHA256_W[i - 15];
1172
+ const W2 = SHA256_W[i - 2];
1173
+ const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
1174
+ const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
1175
+ SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
1176
+ }
1177
+ let { A, B, C, D, E, F, G, H } = this;
1178
+ for (let i = 0; i < 64; i++) {
1179
+ const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
1180
+ const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
1181
+ const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
1182
+ const T2 = sigma0 + Maj(A, B, C) | 0;
1183
+ H = G;
1184
+ G = F;
1185
+ F = E;
1186
+ E = D + T1 | 0;
1187
+ D = C;
1188
+ C = B;
1189
+ B = A;
1190
+ A = T1 + T2 | 0;
1191
+ }
1192
+ A = A + this.A | 0;
1193
+ B = B + this.B | 0;
1194
+ C = C + this.C | 0;
1195
+ D = D + this.D | 0;
1196
+ E = E + this.E | 0;
1197
+ F = F + this.F | 0;
1198
+ G = G + this.G | 0;
1199
+ H = H + this.H | 0;
1200
+ this.set(A, B, C, D, E, F, G, H);
1201
+ }
1202
+ roundClean() {
1203
+ SHA256_W.fill(0);
1204
+ }
1205
+ destroy() {
1206
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
1207
+ this.buffer.fill(0);
1208
+ }
1209
+ };
1210
+ var sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());
1211
+
1212
+ // src/request/types/permissions/resources/account.ts
1213
+ var v16 = __toESM(require("valibot"));
1214
+
1215
+ // src/request/types/permissions/resources/common.ts
896
1216
  var v14 = __toESM(require("valibot"));
897
- var import_xverse_core = require("@secretkeylabs/xverse-core");
898
- var permissionTemplate = v14.variant("type", [
899
- v14.object({
900
- ...v14.omit(import_xverse_core.permissions.resources.account.accountPermissionSchema, ["clientId"]).entries
1217
+ var actionDescriptionSchema = v14.object({
1218
+ name: v14.string(),
1219
+ description: v14.variant("type", [
1220
+ v14.object({ type: v14.literal("single"), value: v14.string() }),
1221
+ v14.object({ type: v14.literal("multiple"), values: v14.array(v14.string()) })
1222
+ ])
1223
+ });
1224
+
1225
+ // src/request/types/permissions/utils/account-id.ts
1226
+ var v15 = __toESM(require("valibot"));
1227
+ var accountIdBrandName = "AccountId";
1228
+ var accountIdSchema = v15.pipe(v15.string(), v15.brand(accountIdBrandName));
1229
+ function makeAccountId(options) {
1230
+ return v15.parse(
1231
+ accountIdSchema,
1232
+ bytesToHex(
1233
+ sha256(
1234
+ `account-${options.masterPubKey}-${// NOTE: This "account ID" is actually the ~account~ address index from BIP-44.
1235
+ options.accountId}-${options.networkType}`
1236
+ )
1237
+ )
1238
+ );
1239
+ }
1240
+
1241
+ // src/request/types/permissions/resources/account.ts
1242
+ var accountResourceIdBrandName = "AccountResourceId";
1243
+ var sha256HexStringRegex = /^[\da-f]{64}$/;
1244
+ var accountResourceIdSchema = v16.pipe(
1245
+ v16.string(),
1246
+ v16.check((input) => sha256HexStringRegex.test(input)),
1247
+ v16.brand("AccountResourceId")
1248
+ );
1249
+ function makeAccountResourceId(accountId) {
1250
+ return v16.parse(accountResourceIdSchema, bytesToHex(sha256(`account-resource-${accountId}`)));
1251
+ }
1252
+ var accountResourceSchema = v16.object({
1253
+ type: v16.literal("account"),
1254
+ id: accountResourceIdSchema,
1255
+ accountId: accountIdSchema,
1256
+ name: v16.string()
1257
+ });
1258
+ function makeAccountResource(args) {
1259
+ return {
1260
+ type: "account",
1261
+ id: makeAccountResourceId(args.accountId),
1262
+ accountId: args.accountId,
1263
+ name: `Account ${args.accountId}, ${args.masterPubKey.slice(0, 6)}...(${args.networkType})`
1264
+ };
1265
+ }
1266
+ var accountActionsSchema = v16.object({
1267
+ read: v16.optional(v16.boolean()),
1268
+ autoSign: v16.optional(v16.boolean()),
1269
+ rename: v16.optional(v16.boolean())
1270
+ });
1271
+ var accountActionsDescriptionSchema = v16.record(
1272
+ v16.keyof(accountActionsSchema),
1273
+ actionDescriptionSchema
1274
+ );
1275
+ var accountPermissionSchema = v16.object({
1276
+ type: v16.literal("account"),
1277
+ resourceId: accountResourceIdSchema,
1278
+ clientId: v16.string(),
1279
+ actions: accountActionsSchema
1280
+ });
1281
+
1282
+ // src/request/types/permissions/resources/wallet.ts
1283
+ var v17 = __toESM(require("valibot"));
1284
+ var walletResourceSchema = v17.object({
1285
+ type: v17.literal("wallet"),
1286
+ id: v17.literal("wallet"),
1287
+ name: v17.literal("Wallet")
1288
+ });
1289
+ var walletActionsSchema = v17.object({
1290
+ addPrivateKey: v17.optional(v17.boolean()),
1291
+ openPopup: v17.optional(v17.boolean()),
1292
+ openFullPage: v17.optional(v17.boolean()),
1293
+ readAllAccounts: v17.optional(v17.boolean())
1294
+ });
1295
+ var walletActionsDescriptionSchema = v17.record(
1296
+ v17.keyof(walletActionsSchema),
1297
+ actionDescriptionSchema
1298
+ );
1299
+ var walletIdSchema = v17.literal("wallet");
1300
+ var walletPermissionSchema = v17.object({
1301
+ type: v17.literal("wallet"),
1302
+ resourceId: walletIdSchema,
1303
+ clientId: v17.string(),
1304
+ actions: walletActionsSchema
1305
+ });
1306
+
1307
+ // src/request/types/permissions/resources/index.ts
1308
+ var account = {
1309
+ accountResourceIdBrandName,
1310
+ accountResourceIdSchema,
1311
+ accountResourceSchema,
1312
+ accountActionsSchema,
1313
+ accountActionsDescriptionSchema,
1314
+ accountPermissionSchema,
1315
+ makeAccountResourceId,
1316
+ makeAccountResource
1317
+ };
1318
+ var common = {
1319
+ actionDescriptionSchema
1320
+ };
1321
+ var wallet = {
1322
+ walletResourceSchema,
1323
+ walletActionsSchema,
1324
+ walletIdSchema,
1325
+ walletPermissionSchema,
1326
+ walletActionsDescriptionSchema
1327
+ };
1328
+
1329
+ // src/request/types/permissions/utils/index.ts
1330
+ var account2 = {
1331
+ makeAccountId,
1332
+ accountIdBrandName,
1333
+ accountIdSchema
1334
+ };
1335
+
1336
+ // src/request/types/permissions/store.ts
1337
+ var v18 = __toESM(require("valibot"));
1338
+ var clientId = v18.pipe(v18.string(), v18.url(), v18.brand("ClientId"));
1339
+ var client = v18.object({
1340
+ id: clientId,
1341
+ origin: v18.string(),
1342
+ name: v18.optional(v18.string()),
1343
+ description: v18.optional(v18.string())
1344
+ });
1345
+ var clientsTable = v18.array(client);
1346
+ var clientMetadata = v18.object({
1347
+ clientId: client.entries.id,
1348
+ lastUsed: v18.optional(v18.number())
1349
+ });
1350
+ var clientMetadataTable = v18.array(clientMetadata);
1351
+ var resource = v18.variant("type", [accountResourceSchema, walletResourceSchema]);
1352
+ var resourcesTable = v18.array(resource);
1353
+ var permission = v18.variant("type", [accountPermissionSchema, walletPermissionSchema]);
1354
+ var permissionsTable = v18.array(permission);
1355
+ var permissionsStore = v18.object({
1356
+ version: v18.literal(4),
1357
+ clients: clientsTable,
1358
+ clientMetadata: clientMetadataTable,
1359
+ resources: resourcesTable,
1360
+ permissions: permissionsTable
1361
+ });
1362
+
1363
+ // src/request/types/permissions/index.ts
1364
+ var resources = {
1365
+ account,
1366
+ common,
1367
+ wallet
1368
+ };
1369
+ var utils = {
1370
+ account: account2
1371
+ };
1372
+ var store = {
1373
+ clientId,
1374
+ client,
1375
+ clientMetadata,
1376
+ clientMetadataTable,
1377
+ clientsTable,
1378
+ resource,
1379
+ resourcesTable,
1380
+ permission,
1381
+ permissionsTable,
1382
+ permissionsStore
1383
+ };
1384
+ var permissions = {
1385
+ resources,
1386
+ utils,
1387
+ store
1388
+ };
1389
+
1390
+ // src/request/types/walletMethods.ts
1391
+ var permissionTemplate = v19.variant("type", [
1392
+ v19.object({
1393
+ ...v19.omit(permissions.resources.account.accountPermissionSchema, ["clientId"]).entries
901
1394
  }),
902
- v14.object({
903
- ...v14.omit(import_xverse_core.permissions.resources.wallet.walletPermissionSchema, ["clientId"]).entries
1395
+ v19.object({
1396
+ ...v19.omit(permissions.resources.wallet.walletPermissionSchema, ["clientId"]).entries
904
1397
  })
905
1398
  ]);
906
1399
  var requestPermissionsMethodName = "wallet_requestPermissions";
907
- var requestPermissionsParamsSchema = v14.nullish(v14.array(permissionTemplate));
908
- var requestPermissionsResultSchema = v14.literal(true);
909
- var requestPermissionsRequestMessageSchema = v14.object({
1400
+ var requestPermissionsParamsSchema = v19.nullish(v19.array(permissionTemplate));
1401
+ var requestPermissionsResultSchema = v19.literal(true);
1402
+ var requestPermissionsRequestMessageSchema = v19.object({
910
1403
  ...rpcRequestMessageSchema.entries,
911
- ...v14.object({
912
- method: v14.literal(requestPermissionsMethodName),
1404
+ ...v19.object({
1405
+ method: v19.literal(requestPermissionsMethodName),
913
1406
  params: requestPermissionsParamsSchema,
914
- id: v14.string()
1407
+ id: v19.string()
915
1408
  }).entries
916
1409
  });
917
1410
  var renouncePermissionsMethodName = "wallet_renouncePermissions";
918
- var renouncePermissionsParamsSchema = v14.nullish(v14.null());
919
- var renouncePermissionsResultSchema = v14.nullish(v14.null());
920
- var renouncePermissionsRequestMessageSchema = v14.object({
1411
+ var renouncePermissionsParamsSchema = v19.nullish(v19.null());
1412
+ var renouncePermissionsResultSchema = v19.nullish(v19.null());
1413
+ var renouncePermissionsRequestMessageSchema = v19.object({
921
1414
  ...rpcRequestMessageSchema.entries,
922
- ...v14.object({
923
- method: v14.literal(renouncePermissionsMethodName),
1415
+ ...v19.object({
1416
+ method: v19.literal(renouncePermissionsMethodName),
924
1417
  params: renouncePermissionsParamsSchema,
925
- id: v14.string()
1418
+ id: v19.string()
926
1419
  }).entries
927
1420
  });
928
1421
  var disconnectMethodName = "wallet_disconnect";
929
- var disconnectParamsSchema = v14.nullish(v14.null());
930
- var disconnectResultSchema = v14.nullish(v14.null());
931
- var disconnectRequestMessageSchema = v14.object({
1422
+ var disconnectParamsSchema = v19.nullish(v19.null());
1423
+ var disconnectResultSchema = v19.nullish(v19.null());
1424
+ var disconnectRequestMessageSchema = v19.object({
932
1425
  ...rpcRequestMessageSchema.entries,
933
- ...v14.object({
934
- method: v14.literal(disconnectMethodName),
1426
+ ...v19.object({
1427
+ method: v19.literal(disconnectMethodName),
935
1428
  params: disconnectParamsSchema,
936
- id: v14.string()
1429
+ id: v19.string()
937
1430
  }).entries
938
1431
  });
939
1432
  var getWalletTypeMethodName = "wallet_getWalletType";
940
- var getWalletTypeParamsSchema = v14.nullish(v14.null());
1433
+ var getWalletTypeParamsSchema = v19.nullish(v19.null());
941
1434
  var getWalletTypeResultSchema = walletTypeSchema;
942
- var getWalletTypeRequestMessageSchema = v14.object({
1435
+ var getWalletTypeRequestMessageSchema = v19.object({
943
1436
  ...rpcRequestMessageSchema.entries,
944
- ...v14.object({
945
- method: v14.literal(getWalletTypeMethodName),
1437
+ ...v19.object({
1438
+ method: v19.literal(getWalletTypeMethodName),
946
1439
  params: getWalletTypeParamsSchema,
947
- id: v14.string()
1440
+ id: v19.string()
948
1441
  }).entries
949
1442
  });
950
1443
  var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
951
- var getCurrentPermissionsParamsSchema = v14.nullish(v14.null());
952
- var getCurrentPermissionsResultSchema = v14.array(import_xverse_core.permissions.store.permission);
953
- var getCurrentPermissionsRequestMessageSchema = v14.object({
1444
+ var getCurrentPermissionsParamsSchema = v19.nullish(v19.null());
1445
+ var getCurrentPermissionsResultSchema = v19.array(permissions.store.permission);
1446
+ var getCurrentPermissionsRequestMessageSchema = v19.object({
954
1447
  ...rpcRequestMessageSchema.entries,
955
- ...v14.object({
956
- method: v14.literal(getCurrentPermissionsMethodName),
1448
+ ...v19.object({
1449
+ method: v19.literal(getCurrentPermissionsMethodName),
957
1450
  params: getCurrentPermissionsParamsSchema,
958
- id: v14.string()
1451
+ id: v19.string()
959
1452
  }).entries
960
1453
  });
961
1454
  var getAccountMethodName = "wallet_getAccount";
962
- var getAccountParamsSchema = v14.nullish(v14.null());
963
- var getAccountResultSchema = v14.object({
964
- id: import_xverse_core.permissions.utils.account.accountIdSchema,
965
- addresses: v14.array(addressSchema),
1455
+ var getAccountParamsSchema = v19.nullish(v19.null());
1456
+ var getAccountResultSchema = v19.object({
1457
+ id: permissions.utils.account.accountIdSchema,
1458
+ addresses: v19.array(addressSchema),
966
1459
  walletType: walletTypeSchema
967
1460
  });
968
- var getAccountRequestMessageSchema = v14.object({
1461
+ var getAccountRequestMessageSchema = v19.object({
969
1462
  ...rpcRequestMessageSchema.entries,
970
- ...v14.object({
971
- method: v14.literal(getAccountMethodName),
1463
+ ...v19.object({
1464
+ method: v19.literal(getAccountMethodName),
972
1465
  params: getAccountParamsSchema,
973
- id: v14.string()
1466
+ id: v19.string()
974
1467
  }).entries
975
1468
  });
976
1469
  var connectMethodName = "wallet_connect";
977
- var connectParamsSchema = v14.nullish(
978
- v14.object({
979
- permissions: v14.optional(v14.array(permissionTemplate))
1470
+ var connectParamsSchema = v19.nullish(
1471
+ v19.object({
1472
+ permissions: v19.optional(v19.array(permissionTemplate)),
1473
+ addresses: v19.optional(v19.array(v19.enum(AddressPurpose))),
1474
+ message: v19.optional(
1475
+ v19.pipe(v19.string(), v19.maxLength(80, "The message must not exceed 80 characters."))
1476
+ )
980
1477
  })
981
1478
  );
982
1479
  var connectResultSchema = getAccountResultSchema;
983
- var connectRequestMessageSchema = v14.object({
1480
+ var connectRequestMessageSchema = v19.object({
984
1481
  ...rpcRequestMessageSchema.entries,
985
- ...v14.object({
986
- method: v14.literal(connectMethodName),
1482
+ ...v19.object({
1483
+ method: v19.literal(connectMethodName),
987
1484
  params: connectParamsSchema,
988
- id: v14.string()
1485
+ id: v19.string()
989
1486
  }).entries
990
1487
  });
991
1488
 
992
1489
  // src/request/types/runesMethods/etch.ts
993
- var v15 = __toESM(require("valibot"));
1490
+ var v20 = __toESM(require("valibot"));
994
1491
  var runesEtchMethodName = "runes_etch";
995
- var etchTermsSchema = v15.object({
996
- amount: v15.string(),
997
- cap: v15.string(),
998
- heightStart: v15.optional(v15.string()),
999
- heightEnd: v15.optional(v15.string()),
1000
- offsetStart: v15.optional(v15.string()),
1001
- offsetEnd: v15.optional(v15.string())
1002
- });
1003
- var inscriptionDetailsSchema = v15.object({
1004
- contentType: v15.string(),
1005
- contentBase64: v15.string()
1006
- });
1007
- var runesEtchParamsSchema = v15.object({
1008
- runeName: v15.string(),
1009
- divisibility: v15.optional(v15.number()),
1010
- symbol: v15.optional(v15.string()),
1011
- premine: v15.optional(v15.string()),
1012
- isMintable: v15.boolean(),
1013
- delegateInscriptionId: v15.optional(v15.string()),
1014
- destinationAddress: v15.string(),
1015
- refundAddress: v15.string(),
1016
- feeRate: v15.number(),
1017
- appServiceFee: v15.optional(v15.number()),
1018
- appServiceFeeAddress: v15.optional(v15.string()),
1019
- terms: v15.optional(etchTermsSchema),
1020
- inscriptionDetails: v15.optional(inscriptionDetailsSchema),
1021
- network: v15.optional(v15.enum(BitcoinNetworkType))
1022
- });
1023
- var runesEtchResultSchema = v15.object({
1024
- orderId: v15.string(),
1025
- fundTransactionId: v15.string(),
1026
- fundingAddress: v15.string()
1027
- });
1028
- var runesEtchRequestMessageSchema = v15.object({
1492
+ var etchTermsSchema = v20.object({
1493
+ amount: v20.string(),
1494
+ cap: v20.string(),
1495
+ heightStart: v20.optional(v20.string()),
1496
+ heightEnd: v20.optional(v20.string()),
1497
+ offsetStart: v20.optional(v20.string()),
1498
+ offsetEnd: v20.optional(v20.string())
1499
+ });
1500
+ var inscriptionDetailsSchema = v20.object({
1501
+ contentType: v20.string(),
1502
+ contentBase64: v20.string()
1503
+ });
1504
+ var runesEtchParamsSchema = v20.object({
1505
+ runeName: v20.string(),
1506
+ divisibility: v20.optional(v20.number()),
1507
+ symbol: v20.optional(v20.string()),
1508
+ premine: v20.optional(v20.string()),
1509
+ isMintable: v20.boolean(),
1510
+ delegateInscriptionId: v20.optional(v20.string()),
1511
+ destinationAddress: v20.string(),
1512
+ refundAddress: v20.string(),
1513
+ feeRate: v20.number(),
1514
+ appServiceFee: v20.optional(v20.number()),
1515
+ appServiceFeeAddress: v20.optional(v20.string()),
1516
+ terms: v20.optional(etchTermsSchema),
1517
+ inscriptionDetails: v20.optional(inscriptionDetailsSchema),
1518
+ network: v20.optional(v20.enum(BitcoinNetworkType))
1519
+ });
1520
+ var runesEtchResultSchema = v20.object({
1521
+ orderId: v20.string(),
1522
+ fundTransactionId: v20.string(),
1523
+ fundingAddress: v20.string()
1524
+ });
1525
+ var runesEtchRequestMessageSchema = v20.object({
1029
1526
  ...rpcRequestMessageSchema.entries,
1030
- ...v15.object({
1031
- method: v15.literal(runesEtchMethodName),
1527
+ ...v20.object({
1528
+ method: v20.literal(runesEtchMethodName),
1032
1529
  params: runesEtchParamsSchema,
1033
- id: v15.string()
1530
+ id: v20.string()
1034
1531
  }).entries
1035
1532
  });
1036
1533
 
1037
1534
  // src/request/types/runesMethods/getBalance.ts
1038
- var v16 = __toESM(require("valibot"));
1535
+ var v21 = __toESM(require("valibot"));
1039
1536
  var runesGetBalanceMethodName = "runes_getBalance";
1040
- var runesGetBalanceParamsSchema = v16.nullish(v16.null());
1041
- var runesGetBalanceResultSchema = v16.object({
1042
- balances: v16.array(
1043
- v16.object({
1044
- runeName: v16.string(),
1045
- amount: v16.string(),
1046
- divisibility: v16.number(),
1047
- symbol: v16.string(),
1048
- inscriptionId: v16.nullish(v16.string())
1537
+ var runesGetBalanceParamsSchema = v21.nullish(v21.null());
1538
+ var runesGetBalanceResultSchema = v21.object({
1539
+ balances: v21.array(
1540
+ v21.object({
1541
+ runeName: v21.string(),
1542
+ amount: v21.string(),
1543
+ divisibility: v21.number(),
1544
+ symbol: v21.string(),
1545
+ inscriptionId: v21.nullish(v21.string())
1049
1546
  })
1050
1547
  )
1051
1548
  });
1052
- var runesGetBalanceRequestMessageSchema = v16.object({
1549
+ var runesGetBalanceRequestMessageSchema = v21.object({
1053
1550
  ...rpcRequestMessageSchema.entries,
1054
- ...v16.object({
1055
- method: v16.literal(runesGetBalanceMethodName),
1551
+ ...v21.object({
1552
+ method: v21.literal(runesGetBalanceMethodName),
1056
1553
  params: runesGetBalanceParamsSchema,
1057
- id: v16.string()
1554
+ id: v21.string()
1058
1555
  }).entries
1059
1556
  });
1060
1557
 
1061
1558
  // src/request/types/runesMethods/mint.ts
1062
- var v17 = __toESM(require("valibot"));
1559
+ var v22 = __toESM(require("valibot"));
1063
1560
  var runesMintMethodName = "runes_mint";
1064
- var runesMintParamsSchema = v17.object({
1065
- appServiceFee: v17.optional(v17.number()),
1066
- appServiceFeeAddress: v17.optional(v17.string()),
1067
- destinationAddress: v17.string(),
1068
- feeRate: v17.number(),
1069
- refundAddress: v17.string(),
1070
- repeats: v17.number(),
1071
- runeName: v17.string(),
1072
- network: v17.optional(v17.enum(BitcoinNetworkType))
1073
- });
1074
- var runesMintResultSchema = v17.object({
1075
- orderId: v17.string(),
1076
- fundTransactionId: v17.string(),
1077
- fundingAddress: v17.string()
1078
- });
1079
- var runesMintRequestMessageSchema = v17.object({
1561
+ var runesMintParamsSchema = v22.object({
1562
+ appServiceFee: v22.optional(v22.number()),
1563
+ appServiceFeeAddress: v22.optional(v22.string()),
1564
+ destinationAddress: v22.string(),
1565
+ feeRate: v22.number(),
1566
+ refundAddress: v22.string(),
1567
+ repeats: v22.number(),
1568
+ runeName: v22.string(),
1569
+ network: v22.optional(v22.enum(BitcoinNetworkType))
1570
+ });
1571
+ var runesMintResultSchema = v22.object({
1572
+ orderId: v22.string(),
1573
+ fundTransactionId: v22.string(),
1574
+ fundingAddress: v22.string()
1575
+ });
1576
+ var runesMintRequestMessageSchema = v22.object({
1080
1577
  ...rpcRequestMessageSchema.entries,
1081
- ...v17.object({
1082
- method: v17.literal(runesMintMethodName),
1578
+ ...v22.object({
1579
+ method: v22.literal(runesMintMethodName),
1083
1580
  params: runesMintParamsSchema,
1084
- id: v17.string()
1581
+ id: v22.string()
1085
1582
  }).entries
1086
1583
  });
1087
1584
 
1088
1585
  // src/request/types/runesMethods/transfer.ts
1089
- var v18 = __toESM(require("valibot"));
1586
+ var v23 = __toESM(require("valibot"));
1090
1587
  var runesTransferMethodName = "runes_transfer";
1091
- var runesTransferParamsSchema = v18.object({
1092
- recipients: v18.array(
1093
- v18.object({
1094
- runeName: v18.string(),
1095
- amount: v18.string(),
1096
- address: v18.string()
1588
+ var runesTransferParamsSchema = v23.object({
1589
+ recipients: v23.array(
1590
+ v23.object({
1591
+ runeName: v23.string(),
1592
+ amount: v23.string(),
1593
+ address: v23.string()
1097
1594
  })
1098
1595
  )
1099
1596
  });
1100
- var runesTransferResultSchema = v18.object({
1101
- txid: v18.string()
1597
+ var runesTransferResultSchema = v23.object({
1598
+ txid: v23.string()
1102
1599
  });
1103
- var runesTransferRequestMessageSchema = v18.object({
1600
+ var runesTransferRequestMessageSchema = v23.object({
1104
1601
  ...rpcRequestMessageSchema.entries,
1105
- ...v18.object({
1106
- method: v18.literal(runesTransferMethodName),
1602
+ ...v23.object({
1603
+ method: v23.literal(runesTransferMethodName),
1107
1604
  params: runesTransferParamsSchema,
1108
- id: v18.string()
1605
+ id: v23.string()
1109
1606
  }).entries
1110
1607
  });
1111
1608
 
1112
1609
  // src/request/types/ordinalsMethods.ts
1113
- var v19 = __toESM(require("valibot"));
1610
+ var v24 = __toESM(require("valibot"));
1114
1611
  var getInscriptionsMethodName = "ord_getInscriptions";
1115
- var getInscriptionsParamsSchema = v19.object({
1116
- offset: v19.number(),
1117
- limit: v19.number()
1118
- });
1119
- var getInscriptionsResultSchema = v19.object({
1120
- total: v19.number(),
1121
- limit: v19.number(),
1122
- offset: v19.number(),
1123
- inscriptions: v19.array(
1124
- v19.object({
1125
- inscriptionId: v19.string(),
1126
- inscriptionNumber: v19.string(),
1127
- address: v19.string(),
1128
- collectionName: v19.optional(v19.string()),
1129
- postage: v19.string(),
1130
- contentLength: v19.string(),
1131
- contentType: v19.string(),
1132
- timestamp: v19.number(),
1133
- offset: v19.number(),
1134
- genesisTransaction: v19.string(),
1135
- output: v19.string()
1612
+ var getInscriptionsParamsSchema = v24.object({
1613
+ offset: v24.number(),
1614
+ limit: v24.number()
1615
+ });
1616
+ var getInscriptionsResultSchema = v24.object({
1617
+ total: v24.number(),
1618
+ limit: v24.number(),
1619
+ offset: v24.number(),
1620
+ inscriptions: v24.array(
1621
+ v24.object({
1622
+ inscriptionId: v24.string(),
1623
+ inscriptionNumber: v24.string(),
1624
+ address: v24.string(),
1625
+ collectionName: v24.optional(v24.string()),
1626
+ postage: v24.string(),
1627
+ contentLength: v24.string(),
1628
+ contentType: v24.string(),
1629
+ timestamp: v24.number(),
1630
+ offset: v24.number(),
1631
+ genesisTransaction: v24.string(),
1632
+ output: v24.string()
1136
1633
  })
1137
1634
  )
1138
1635
  });
1139
- var getInscriptionsRequestMessageSchema = v19.object({
1636
+ var getInscriptionsRequestMessageSchema = v24.object({
1140
1637
  ...rpcRequestMessageSchema.entries,
1141
- ...v19.object({
1142
- method: v19.literal(getInscriptionsMethodName),
1638
+ ...v24.object({
1639
+ method: v24.literal(getInscriptionsMethodName),
1143
1640
  params: getInscriptionsParamsSchema,
1144
- id: v19.string()
1641
+ id: v24.string()
1145
1642
  }).entries
1146
1643
  });
1147
1644
  var sendInscriptionsMethodName = "ord_sendInscriptions";
1148
- var sendInscriptionsParamsSchema = v19.object({
1149
- transfers: v19.array(
1150
- v19.object({
1151
- address: v19.string(),
1152
- inscriptionId: v19.string()
1645
+ var sendInscriptionsParamsSchema = v24.object({
1646
+ transfers: v24.array(
1647
+ v24.object({
1648
+ address: v24.string(),
1649
+ inscriptionId: v24.string()
1153
1650
  })
1154
1651
  )
1155
1652
  });
1156
- var sendInscriptionsResultSchema = v19.object({
1157
- txid: v19.string()
1653
+ var sendInscriptionsResultSchema = v24.object({
1654
+ txid: v24.string()
1158
1655
  });
1159
- var sendInscriptionsRequestMessageSchema = v19.object({
1656
+ var sendInscriptionsRequestMessageSchema = v24.object({
1160
1657
  ...rpcRequestMessageSchema.entries,
1161
- ...v19.object({
1162
- method: v19.literal(sendInscriptionsMethodName),
1658
+ ...v24.object({
1659
+ method: v24.literal(sendInscriptionsMethodName),
1163
1660
  params: sendInscriptionsParamsSchema,
1164
- id: v19.string()
1661
+ id: v24.string()
1165
1662
  }).entries
1166
1663
  });
1167
1664
 
@@ -1178,13 +1675,13 @@ var request = async (method, params, providerId) => {
1178
1675
  throw new Error("A wallet method is required");
1179
1676
  }
1180
1677
  const response = await provider.request(method, params);
1181
- if (v20.is(rpcErrorResponseMessageSchema, response)) {
1678
+ if (v25.is(rpcErrorResponseMessageSchema, response)) {
1182
1679
  return {
1183
1680
  status: "error",
1184
1681
  error: response.error
1185
1682
  };
1186
1683
  }
1187
- if (v20.is(rpcSuccessResponseMessageSchema, response)) {
1684
+ if (v25.is(rpcSuccessResponseMessageSchema, response)) {
1188
1685
  return {
1189
1686
  status: "success",
1190
1687
  result: response.result
@@ -1940,8 +2437,7 @@ var extractOrValidateCapabilities = (provider, reportedCapabilities) => {
1940
2437
  addListener: validateCapability("addListener")
1941
2438
  };
1942
2439
  return Object.entries(capabilityMap).reduce((acc, [capability, value]) => {
1943
- if (value)
1944
- return [...acc, capability];
2440
+ if (value) return [...acc, capability];
1945
2441
  return acc;
1946
2442
  }, []);
1947
2443
  };
@@ -2283,3 +2779,8 @@ var signMultipleTransactions = async (options) => {
2283
2779
  walletTypeSchema,
2284
2780
  walletTypes
2285
2781
  });
2782
+ /*! Bundled license information:
2783
+
2784
+ @noble/hashes/esm/utils.js:
2785
+ (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
2786
+ */