@buildonspark/spark-sdk 0.2.10 → 0.2.12
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/CHANGELOG.md +17 -1
- package/dist/bare/chunk-P6AVV7VD.js +34 -0
- package/dist/bare/index.cjs +729 -166
- package/dist/bare/index.d.cts +62 -5
- package/dist/bare/index.d.ts +62 -5
- package/dist/bare/index.js +675 -173
- package/dist/bare/{wasm-OPXXYRN5.js → wasm-F5QFVBNZ.js} +26 -0
- package/dist/bare/{xhr-transport-6GYJAFWU.js → xhr-transport-EEEC7FYA.js} +2 -2
- package/dist/{chunk-A5M55UR3.js → chunk-5VWGOHED.js} +499 -8
- package/dist/{chunk-MWBK6QBF.js → chunk-NQMQVXR5.js} +1 -1
- package/dist/chunk-NX5KPN5F.js +34 -0
- package/dist/{chunk-JXLWOQK5.js → chunk-OEK3R57K.js} +196 -162
- package/dist/{chunk-76SYPHOC.js → chunk-TB7DG5CU.js} +2 -2
- package/dist/{chunk-6CMNEDBK.js → chunk-XXTWWW6L.js} +1 -1
- package/dist/{client-Dd3QnxQu.d.ts → client-D7KDa4Ih.d.ts} +1 -1
- package/dist/{client-B9CAWKWz.d.cts → client-DVuA5-7M.d.cts} +1 -1
- package/dist/debug.cjs +725 -163
- package/dist/debug.d.cts +8 -5
- package/dist/debug.d.ts +8 -5
- package/dist/debug.js +5 -4
- package/dist/graphql/objects/index.d.cts +3 -3
- package/dist/graphql/objects/index.d.ts +3 -3
- package/dist/index.cjs +810 -246
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +11 -5
- package/dist/index.node.cjs +810 -246
- package/dist/index.node.d.cts +6 -6
- package/dist/index.node.d.ts +6 -6
- package/dist/index.node.js +10 -4
- package/dist/{xchain-address-BPwpnmuY.d.ts → logging-ClNhGzus.d.ts} +18 -4
- package/dist/{xchain-address-CNQEwLjR.d.cts → logging-D3kvES69.d.cts} +18 -4
- package/dist/native/chunk-D3SZRO65.js +36 -0
- package/dist/native/index.cjs +808 -244
- package/dist/native/index.d.cts +62 -5
- package/dist/native/index.d.ts +62 -5
- package/dist/native/index.js +769 -268
- package/dist/native/{wasm-2KV6XFEP.js → wasm-3YAXKQ7F.js} +25 -0
- package/dist/native/{xhr-transport-WHMS3FGG.js → xhr-transport-TNCG4HTW.js} +2 -2
- package/dist/proto/spark.cjs +499 -8
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark.js +17 -1
- package/dist/proto/spark_token.d.cts +1 -1
- package/dist/proto/spark_token.d.ts +1 -1
- package/dist/proto/spark_token.js +2 -2
- package/dist/{spark-CtGJPkx4.d.cts → spark-C7OG9mGJ.d.cts} +79 -2
- package/dist/{spark-CtGJPkx4.d.ts → spark-C7OG9mGJ.d.ts} +79 -2
- package/dist/{spark-wallet-yc2KhsVY.d.cts → spark-wallet-Dg5IRQe2.d.cts} +3 -5
- package/dist/{spark-wallet-Cp3yv6cK.d.ts → spark-wallet-DiHSU-pz.d.ts} +3 -5
- package/dist/{spark-wallet.node-D4IovOHu.d.ts → spark-wallet.node-BZrxwomN.d.ts} +1 -1
- package/dist/{spark-wallet.node-D0Qw5Wb4.d.cts → spark-wallet.node-DSWb18zh.d.cts} +1 -1
- package/dist/spark_bindings/wasm/index.cjs +51 -0
- package/dist/spark_bindings/wasm/index.js +25 -0
- package/dist/tests/test-utils.cjs +725 -155
- package/dist/tests/test-utils.d.cts +4 -4
- package/dist/tests/test-utils.d.ts +4 -4
- package/dist/tests/test-utils.js +6 -5
- package/dist/{token-transactions-CwhlOgIP.d.cts → token-transactions-B-WqFYpW.d.cts} +2 -2
- package/dist/{token-transactions-0nmR9mQO.d.ts → token-transactions-DovxHIxV.d.ts} +2 -2
- package/dist/types/index.cjs +492 -9
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +2 -2
- package/dist/{xhr-transport-RH6LDRXS.js → xhr-transport-IWJPYF7F.js} +2 -2
- package/package.json +1 -1
- package/src/proto/common.ts +1 -1
- package/src/proto/google/protobuf/descriptor.ts +4 -10
- package/src/proto/google/protobuf/duration.ts +1 -1
- package/src/proto/google/protobuf/empty.ts +1 -1
- package/src/proto/google/protobuf/timestamp.ts +1 -1
- package/src/proto/mock.ts +1 -1
- package/src/proto/spark.ts +593 -3
- package/src/proto/spark_authn.ts +1 -1
- package/src/proto/spark_token.ts +1 -1
- package/src/proto/validate/validate.ts +27 -79
- package/src/services/deposit.ts +60 -4
- package/src/services/lightning.ts +2 -2
- package/src/services/signing.ts +1 -1
- package/src/services/token-transactions.ts +2 -5
- package/src/services/transfer.ts +2 -2
- package/src/services/xhr-transport.ts +2 -2
- package/src/signer/signer.ts +2 -2
- package/src/spark-wallet/spark-wallet.ts +25 -33
- package/src/spark_bindings/wasm/index.ts +21 -0
- package/src/tests/address.test.ts +10 -10
- package/src/tests/bitcoin.test.ts +2 -2
- package/src/tests/integration/coop-exit.test.ts +1 -1
- package/src/tests/integration/lightning.test.ts +1 -1
- package/src/tests/integration/ssp/coop-exit-validation.test.ts +2 -2
- package/src/tests/integration/ssp/static_deposit.test.ts +122 -33
- package/src/tests/integration/swap.test.ts +1 -1
- package/src/tests/integration/transfer.test.ts +1 -5
- package/src/tests/integration/wallet.test.ts +7 -7
- package/src/tests/integration/watchtower.test.ts +3 -3
- package/src/tests/token-hashing.test.ts +3 -6
- package/src/tests/token-outputs.test.ts +3 -3
- package/src/tests/utils/test-faucet.ts +2 -2
- package/src/types/sdk-types.ts +1 -1
- package/src/utils/adaptor-signature.ts +12 -13
- package/src/utils/address.ts +10 -10
- package/src/utils/bitcoin.ts +7 -11
- package/src/utils/index.ts +1 -0
- package/src/utils/keys.ts +10 -10
- package/src/utils/logging.ts +40 -0
- package/src/utils/secret-sharing.ts +10 -12
- package/src/utils/token-transactions.ts +1 -2
- package/src/utils/transfer_package.ts +1 -1
- package/src/utils/unilateral-exit.ts +1 -1
package/dist/debug.cjs
CHANGED
|
@@ -1043,6 +1043,43 @@ var init_spark_bindings = __esm({
|
|
|
1043
1043
|
}
|
|
1044
1044
|
});
|
|
1045
1045
|
|
|
1046
|
+
// src/utils/logging.ts
|
|
1047
|
+
var import_core11, LOGGER_NAMES, SparkSdkLogger;
|
|
1048
|
+
var init_logging = __esm({
|
|
1049
|
+
"src/utils/logging.ts"() {
|
|
1050
|
+
"use strict";
|
|
1051
|
+
init_buffer();
|
|
1052
|
+
import_core11 = require("@lightsparkdev/core");
|
|
1053
|
+
LOGGER_NAMES = {
|
|
1054
|
+
wasm: "wasm"
|
|
1055
|
+
};
|
|
1056
|
+
SparkSdkLogger = class {
|
|
1057
|
+
static loggers = /* @__PURE__ */ new Map();
|
|
1058
|
+
static get(name) {
|
|
1059
|
+
if (!this.loggers.has(name)) {
|
|
1060
|
+
this.loggers.set(name, new import_core11.Logger(name));
|
|
1061
|
+
}
|
|
1062
|
+
return this.loggers.get(name);
|
|
1063
|
+
}
|
|
1064
|
+
static setLevel(name, level) {
|
|
1065
|
+
this.get(name).setLevel(level);
|
|
1066
|
+
}
|
|
1067
|
+
static setAllLevels(level) {
|
|
1068
|
+
this.loggers.forEach((logger) => logger.setLevel(level));
|
|
1069
|
+
}
|
|
1070
|
+
static setEnabled(name, enabled) {
|
|
1071
|
+
this.get(name).setEnabled(enabled);
|
|
1072
|
+
}
|
|
1073
|
+
static setAllEnabled(enabled) {
|
|
1074
|
+
this.loggers.forEach((logger) => logger.setEnabled(enabled));
|
|
1075
|
+
}
|
|
1076
|
+
static {
|
|
1077
|
+
Object.values(LOGGER_NAMES).forEach((name) => this.get(name));
|
|
1078
|
+
}
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
});
|
|
1082
|
+
|
|
1046
1083
|
// src/spark_bindings/wasm/index.ts
|
|
1047
1084
|
var wasm_exports = {};
|
|
1048
1085
|
__export(wasm_exports, {
|
|
@@ -1073,6 +1110,13 @@ function signFrost({
|
|
|
1073
1110
|
statechainCommitments,
|
|
1074
1111
|
adaptorPubKey
|
|
1075
1112
|
}) {
|
|
1113
|
+
SparkSdkLogger.get(LOGGER_NAMES.wasm).trace("signFrost", {
|
|
1114
|
+
message: (0, import_utils4.bytesToHex)(message),
|
|
1115
|
+
keyPackage,
|
|
1116
|
+
nonce,
|
|
1117
|
+
selfCommitment,
|
|
1118
|
+
statechainCommitments
|
|
1119
|
+
});
|
|
1076
1120
|
return wasm_sign_frost(
|
|
1077
1121
|
message,
|
|
1078
1122
|
createKeyPackage(keyPackage),
|
|
@@ -1093,6 +1137,17 @@ function aggregateFrost({
|
|
|
1093
1137
|
verifyingKey,
|
|
1094
1138
|
adaptorPubKey
|
|
1095
1139
|
}) {
|
|
1140
|
+
SparkSdkLogger.get(LOGGER_NAMES.wasm).trace("aggregateFrost", {
|
|
1141
|
+
message: (0, import_utils4.bytesToHex)(message),
|
|
1142
|
+
statechainCommitments,
|
|
1143
|
+
selfCommitment,
|
|
1144
|
+
statechainSignatures,
|
|
1145
|
+
selfSignature: (0, import_utils4.bytesToHex)(selfSignature),
|
|
1146
|
+
statechainPublicKeys,
|
|
1147
|
+
selfPublicKey: (0, import_utils4.bytesToHex)(selfPublicKey),
|
|
1148
|
+
verifyingKey: (0, import_utils4.bytesToHex)(verifyingKey),
|
|
1149
|
+
adaptorPubKey: adaptorPubKey ? (0, import_utils4.bytesToHex)(adaptorPubKey) : void 0
|
|
1150
|
+
});
|
|
1096
1151
|
return wasm_aggregate_frost(
|
|
1097
1152
|
message,
|
|
1098
1153
|
statechainCommitments,
|
|
@@ -1123,11 +1178,14 @@ function decryptEcies({
|
|
|
1123
1178
|
}) {
|
|
1124
1179
|
return decrypt_ecies(encryptedMsg, privateKey);
|
|
1125
1180
|
}
|
|
1181
|
+
var import_utils4;
|
|
1126
1182
|
var init_wasm = __esm({
|
|
1127
1183
|
"src/spark_bindings/wasm/index.ts"() {
|
|
1128
1184
|
"use strict";
|
|
1129
1185
|
init_buffer();
|
|
1186
|
+
import_utils4 = require("@noble/curves/utils");
|
|
1130
1187
|
init_spark_bindings();
|
|
1188
|
+
init_logging();
|
|
1131
1189
|
}
|
|
1132
1190
|
});
|
|
1133
1191
|
|
|
@@ -1201,7 +1259,7 @@ function XHRTransport(config) {
|
|
|
1201
1259
|
bodyBuffer = chunk;
|
|
1202
1260
|
break;
|
|
1203
1261
|
}
|
|
1204
|
-
requestBody = bodyBuffer;
|
|
1262
|
+
requestBody = bodyBuffer.slice();
|
|
1205
1263
|
} else {
|
|
1206
1264
|
let iterator;
|
|
1207
1265
|
requestBody = new ReadableStream({
|
|
@@ -1215,7 +1273,7 @@ function XHRTransport(config) {
|
|
|
1215
1273
|
if (done) {
|
|
1216
1274
|
controller.close();
|
|
1217
1275
|
} else {
|
|
1218
|
-
controller.enqueue(value);
|
|
1276
|
+
controller.enqueue(value.slice());
|
|
1219
1277
|
}
|
|
1220
1278
|
},
|
|
1221
1279
|
async cancel() {
|
|
@@ -1315,9 +1373,9 @@ init_buffer();
|
|
|
1315
1373
|
|
|
1316
1374
|
// src/spark-wallet/spark-wallet.ts
|
|
1317
1375
|
init_buffer();
|
|
1318
|
-
var
|
|
1319
|
-
var import_utils23 = require("@noble/curves/abstract/utils");
|
|
1376
|
+
var import_core13 = require("@lightsparkdev/core");
|
|
1320
1377
|
var import_secp256k115 = require("@noble/curves/secp256k1");
|
|
1378
|
+
var import_utils23 = require("@noble/curves/utils");
|
|
1321
1379
|
var import_bip392 = require("@scure/bip39");
|
|
1322
1380
|
var import_english2 = require("@scure/bip39/wordlists/english");
|
|
1323
1381
|
var import_btc_signer6 = require("@scure/btc-signer");
|
|
@@ -4116,6 +4174,41 @@ function utxoSwapRequestTypeToJSON(object) {
|
|
|
4116
4174
|
return "UNRECOGNIZED";
|
|
4117
4175
|
}
|
|
4118
4176
|
}
|
|
4177
|
+
function invoiceStatusFromJSON(object) {
|
|
4178
|
+
switch (object) {
|
|
4179
|
+
case 0:
|
|
4180
|
+
case "NOT_FOUND":
|
|
4181
|
+
return 0 /* NOT_FOUND */;
|
|
4182
|
+
case 1:
|
|
4183
|
+
case "PENDING":
|
|
4184
|
+
return 1 /* PENDING */;
|
|
4185
|
+
case 2:
|
|
4186
|
+
case "FINALIZED":
|
|
4187
|
+
return 2 /* FINALIZED */;
|
|
4188
|
+
case 3:
|
|
4189
|
+
case "EXPIRED":
|
|
4190
|
+
return 3 /* EXPIRED */;
|
|
4191
|
+
case -1:
|
|
4192
|
+
case "UNRECOGNIZED":
|
|
4193
|
+
default:
|
|
4194
|
+
return -1 /* UNRECOGNIZED */;
|
|
4195
|
+
}
|
|
4196
|
+
}
|
|
4197
|
+
function invoiceStatusToJSON(object) {
|
|
4198
|
+
switch (object) {
|
|
4199
|
+
case 0 /* NOT_FOUND */:
|
|
4200
|
+
return "NOT_FOUND";
|
|
4201
|
+
case 1 /* PENDING */:
|
|
4202
|
+
return "PENDING";
|
|
4203
|
+
case 2 /* FINALIZED */:
|
|
4204
|
+
return "FINALIZED";
|
|
4205
|
+
case 3 /* EXPIRED */:
|
|
4206
|
+
return "EXPIRED";
|
|
4207
|
+
case -1 /* UNRECOGNIZED */:
|
|
4208
|
+
default:
|
|
4209
|
+
return "UNRECOGNIZED";
|
|
4210
|
+
}
|
|
4211
|
+
}
|
|
4119
4212
|
function initiatePreimageSwapRequest_ReasonFromJSON(object) {
|
|
4120
4213
|
switch (object) {
|
|
4121
4214
|
case 0:
|
|
@@ -4855,6 +4948,140 @@ var GenerateDepositAddressResponse = {
|
|
|
4855
4948
|
return message;
|
|
4856
4949
|
}
|
|
4857
4950
|
};
|
|
4951
|
+
function createBaseGenerateStaticDepositAddressRequest() {
|
|
4952
|
+
return { signingPublicKey: new Uint8Array(0), identityPublicKey: new Uint8Array(0), network: 0 };
|
|
4953
|
+
}
|
|
4954
|
+
var GenerateStaticDepositAddressRequest = {
|
|
4955
|
+
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
4956
|
+
if (message.signingPublicKey.length !== 0) {
|
|
4957
|
+
writer.uint32(10).bytes(message.signingPublicKey);
|
|
4958
|
+
}
|
|
4959
|
+
if (message.identityPublicKey.length !== 0) {
|
|
4960
|
+
writer.uint32(18).bytes(message.identityPublicKey);
|
|
4961
|
+
}
|
|
4962
|
+
if (message.network !== 0) {
|
|
4963
|
+
writer.uint32(24).int32(message.network);
|
|
4964
|
+
}
|
|
4965
|
+
return writer;
|
|
4966
|
+
},
|
|
4967
|
+
decode(input, length) {
|
|
4968
|
+
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
4969
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
4970
|
+
const message = createBaseGenerateStaticDepositAddressRequest();
|
|
4971
|
+
while (reader.pos < end) {
|
|
4972
|
+
const tag = reader.uint32();
|
|
4973
|
+
switch (tag >>> 3) {
|
|
4974
|
+
case 1: {
|
|
4975
|
+
if (tag !== 10) {
|
|
4976
|
+
break;
|
|
4977
|
+
}
|
|
4978
|
+
message.signingPublicKey = reader.bytes();
|
|
4979
|
+
continue;
|
|
4980
|
+
}
|
|
4981
|
+
case 2: {
|
|
4982
|
+
if (tag !== 18) {
|
|
4983
|
+
break;
|
|
4984
|
+
}
|
|
4985
|
+
message.identityPublicKey = reader.bytes();
|
|
4986
|
+
continue;
|
|
4987
|
+
}
|
|
4988
|
+
case 3: {
|
|
4989
|
+
if (tag !== 24) {
|
|
4990
|
+
break;
|
|
4991
|
+
}
|
|
4992
|
+
message.network = reader.int32();
|
|
4993
|
+
continue;
|
|
4994
|
+
}
|
|
4995
|
+
}
|
|
4996
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4997
|
+
break;
|
|
4998
|
+
}
|
|
4999
|
+
reader.skip(tag & 7);
|
|
5000
|
+
}
|
|
5001
|
+
return message;
|
|
5002
|
+
},
|
|
5003
|
+
fromJSON(object) {
|
|
5004
|
+
return {
|
|
5005
|
+
signingPublicKey: isSet3(object.signingPublicKey) ? bytesFromBase642(object.signingPublicKey) : new Uint8Array(0),
|
|
5006
|
+
identityPublicKey: isSet3(object.identityPublicKey) ? bytesFromBase642(object.identityPublicKey) : new Uint8Array(0),
|
|
5007
|
+
network: isSet3(object.network) ? networkFromJSON(object.network) : 0
|
|
5008
|
+
};
|
|
5009
|
+
},
|
|
5010
|
+
toJSON(message) {
|
|
5011
|
+
const obj = {};
|
|
5012
|
+
if (message.signingPublicKey.length !== 0) {
|
|
5013
|
+
obj.signingPublicKey = base64FromBytes2(message.signingPublicKey);
|
|
5014
|
+
}
|
|
5015
|
+
if (message.identityPublicKey.length !== 0) {
|
|
5016
|
+
obj.identityPublicKey = base64FromBytes2(message.identityPublicKey);
|
|
5017
|
+
}
|
|
5018
|
+
if (message.network !== 0) {
|
|
5019
|
+
obj.network = networkToJSON(message.network);
|
|
5020
|
+
}
|
|
5021
|
+
return obj;
|
|
5022
|
+
},
|
|
5023
|
+
create(base) {
|
|
5024
|
+
return GenerateStaticDepositAddressRequest.fromPartial(base ?? {});
|
|
5025
|
+
},
|
|
5026
|
+
fromPartial(object) {
|
|
5027
|
+
const message = createBaseGenerateStaticDepositAddressRequest();
|
|
5028
|
+
message.signingPublicKey = object.signingPublicKey ?? new Uint8Array(0);
|
|
5029
|
+
message.identityPublicKey = object.identityPublicKey ?? new Uint8Array(0);
|
|
5030
|
+
message.network = object.network ?? 0;
|
|
5031
|
+
return message;
|
|
5032
|
+
}
|
|
5033
|
+
};
|
|
5034
|
+
function createBaseGenerateStaticDepositAddressResponse() {
|
|
5035
|
+
return { depositAddress: void 0 };
|
|
5036
|
+
}
|
|
5037
|
+
var GenerateStaticDepositAddressResponse = {
|
|
5038
|
+
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
5039
|
+
if (message.depositAddress !== void 0) {
|
|
5040
|
+
Address.encode(message.depositAddress, writer.uint32(10).fork()).join();
|
|
5041
|
+
}
|
|
5042
|
+
return writer;
|
|
5043
|
+
},
|
|
5044
|
+
decode(input, length) {
|
|
5045
|
+
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
5046
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
5047
|
+
const message = createBaseGenerateStaticDepositAddressResponse();
|
|
5048
|
+
while (reader.pos < end) {
|
|
5049
|
+
const tag = reader.uint32();
|
|
5050
|
+
switch (tag >>> 3) {
|
|
5051
|
+
case 1: {
|
|
5052
|
+
if (tag !== 10) {
|
|
5053
|
+
break;
|
|
5054
|
+
}
|
|
5055
|
+
message.depositAddress = Address.decode(reader, reader.uint32());
|
|
5056
|
+
continue;
|
|
5057
|
+
}
|
|
5058
|
+
}
|
|
5059
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
5060
|
+
break;
|
|
5061
|
+
}
|
|
5062
|
+
reader.skip(tag & 7);
|
|
5063
|
+
}
|
|
5064
|
+
return message;
|
|
5065
|
+
},
|
|
5066
|
+
fromJSON(object) {
|
|
5067
|
+
return { depositAddress: isSet3(object.depositAddress) ? Address.fromJSON(object.depositAddress) : void 0 };
|
|
5068
|
+
},
|
|
5069
|
+
toJSON(message) {
|
|
5070
|
+
const obj = {};
|
|
5071
|
+
if (message.depositAddress !== void 0) {
|
|
5072
|
+
obj.depositAddress = Address.toJSON(message.depositAddress);
|
|
5073
|
+
}
|
|
5074
|
+
return obj;
|
|
5075
|
+
},
|
|
5076
|
+
create(base) {
|
|
5077
|
+
return GenerateStaticDepositAddressResponse.fromPartial(base ?? {});
|
|
5078
|
+
},
|
|
5079
|
+
fromPartial(object) {
|
|
5080
|
+
const message = createBaseGenerateStaticDepositAddressResponse();
|
|
5081
|
+
message.depositAddress = object.depositAddress !== void 0 && object.depositAddress !== null ? Address.fromPartial(object.depositAddress) : void 0;
|
|
5082
|
+
return message;
|
|
5083
|
+
}
|
|
5084
|
+
};
|
|
4858
5085
|
function createBaseUTXO() {
|
|
4859
5086
|
return { rawTx: new Uint8Array(0), vout: 0, network: 0, txid: new Uint8Array(0) };
|
|
4860
5087
|
}
|
|
@@ -10968,7 +11195,8 @@ function createBaseTransferLeaf() {
|
|
|
10968
11195
|
signature: new Uint8Array(0),
|
|
10969
11196
|
intermediateRefundTx: new Uint8Array(0),
|
|
10970
11197
|
intermediateDirectRefundTx: new Uint8Array(0),
|
|
10971
|
-
intermediateDirectFromCpfpRefundTx: new Uint8Array(0)
|
|
11198
|
+
intermediateDirectFromCpfpRefundTx: new Uint8Array(0),
|
|
11199
|
+
pendingKeyTweakPublicKey: new Uint8Array(0)
|
|
10972
11200
|
};
|
|
10973
11201
|
}
|
|
10974
11202
|
var TransferLeaf = {
|
|
@@ -10991,6 +11219,9 @@ var TransferLeaf = {
|
|
|
10991
11219
|
if (message.intermediateDirectFromCpfpRefundTx.length !== 0) {
|
|
10992
11220
|
writer.uint32(50).bytes(message.intermediateDirectFromCpfpRefundTx);
|
|
10993
11221
|
}
|
|
11222
|
+
if (message.pendingKeyTweakPublicKey.length !== 0) {
|
|
11223
|
+
writer.uint32(58).bytes(message.pendingKeyTweakPublicKey);
|
|
11224
|
+
}
|
|
10994
11225
|
return writer;
|
|
10995
11226
|
},
|
|
10996
11227
|
decode(input, length) {
|
|
@@ -11042,6 +11273,13 @@ var TransferLeaf = {
|
|
|
11042
11273
|
message.intermediateDirectFromCpfpRefundTx = reader.bytes();
|
|
11043
11274
|
continue;
|
|
11044
11275
|
}
|
|
11276
|
+
case 7: {
|
|
11277
|
+
if (tag !== 58) {
|
|
11278
|
+
break;
|
|
11279
|
+
}
|
|
11280
|
+
message.pendingKeyTweakPublicKey = reader.bytes();
|
|
11281
|
+
continue;
|
|
11282
|
+
}
|
|
11045
11283
|
}
|
|
11046
11284
|
if ((tag & 7) === 4 || tag === 0) {
|
|
11047
11285
|
break;
|
|
@@ -11057,7 +11295,8 @@ var TransferLeaf = {
|
|
|
11057
11295
|
signature: isSet3(object.signature) ? bytesFromBase642(object.signature) : new Uint8Array(0),
|
|
11058
11296
|
intermediateRefundTx: isSet3(object.intermediateRefundTx) ? bytesFromBase642(object.intermediateRefundTx) : new Uint8Array(0),
|
|
11059
11297
|
intermediateDirectRefundTx: isSet3(object.intermediateDirectRefundTx) ? bytesFromBase642(object.intermediateDirectRefundTx) : new Uint8Array(0),
|
|
11060
|
-
intermediateDirectFromCpfpRefundTx: isSet3(object.intermediateDirectFromCpfpRefundTx) ? bytesFromBase642(object.intermediateDirectFromCpfpRefundTx) : new Uint8Array(0)
|
|
11298
|
+
intermediateDirectFromCpfpRefundTx: isSet3(object.intermediateDirectFromCpfpRefundTx) ? bytesFromBase642(object.intermediateDirectFromCpfpRefundTx) : new Uint8Array(0),
|
|
11299
|
+
pendingKeyTweakPublicKey: isSet3(object.pendingKeyTweakPublicKey) ? bytesFromBase642(object.pendingKeyTweakPublicKey) : new Uint8Array(0)
|
|
11061
11300
|
};
|
|
11062
11301
|
},
|
|
11063
11302
|
toJSON(message) {
|
|
@@ -11080,6 +11319,9 @@ var TransferLeaf = {
|
|
|
11080
11319
|
if (message.intermediateDirectFromCpfpRefundTx.length !== 0) {
|
|
11081
11320
|
obj.intermediateDirectFromCpfpRefundTx = base64FromBytes2(message.intermediateDirectFromCpfpRefundTx);
|
|
11082
11321
|
}
|
|
11322
|
+
if (message.pendingKeyTweakPublicKey.length !== 0) {
|
|
11323
|
+
obj.pendingKeyTweakPublicKey = base64FromBytes2(message.pendingKeyTweakPublicKey);
|
|
11324
|
+
}
|
|
11083
11325
|
return obj;
|
|
11084
11326
|
},
|
|
11085
11327
|
create(base) {
|
|
@@ -11093,6 +11335,7 @@ var TransferLeaf = {
|
|
|
11093
11335
|
message.intermediateRefundTx = object.intermediateRefundTx ?? new Uint8Array(0);
|
|
11094
11336
|
message.intermediateDirectRefundTx = object.intermediateDirectRefundTx ?? new Uint8Array(0);
|
|
11095
11337
|
message.intermediateDirectFromCpfpRefundTx = object.intermediateDirectFromCpfpRefundTx ?? new Uint8Array(0);
|
|
11338
|
+
message.pendingKeyTweakPublicKey = object.pendingKeyTweakPublicKey ?? new Uint8Array(0);
|
|
11096
11339
|
return message;
|
|
11097
11340
|
}
|
|
11098
11341
|
};
|
|
@@ -13990,13 +14233,16 @@ var QueryUserSignedRefundsRequest = {
|
|
|
13990
14233
|
}
|
|
13991
14234
|
};
|
|
13992
14235
|
function createBaseQueryUserSignedRefundsResponse() {
|
|
13993
|
-
return { userSignedRefunds: [] };
|
|
14236
|
+
return { userSignedRefunds: [], transfer: void 0 };
|
|
13994
14237
|
}
|
|
13995
14238
|
var QueryUserSignedRefundsResponse = {
|
|
13996
14239
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
13997
14240
|
for (const v of message.userSignedRefunds) {
|
|
13998
14241
|
UserSignedRefund.encode(v, writer.uint32(10).fork()).join();
|
|
13999
14242
|
}
|
|
14243
|
+
if (message.transfer !== void 0) {
|
|
14244
|
+
Transfer6.encode(message.transfer, writer.uint32(26).fork()).join();
|
|
14245
|
+
}
|
|
14000
14246
|
return writer;
|
|
14001
14247
|
},
|
|
14002
14248
|
decode(input, length) {
|
|
@@ -14013,6 +14259,13 @@ var QueryUserSignedRefundsResponse = {
|
|
|
14013
14259
|
message.userSignedRefunds.push(UserSignedRefund.decode(reader, reader.uint32()));
|
|
14014
14260
|
continue;
|
|
14015
14261
|
}
|
|
14262
|
+
case 3: {
|
|
14263
|
+
if (tag !== 26) {
|
|
14264
|
+
break;
|
|
14265
|
+
}
|
|
14266
|
+
message.transfer = Transfer6.decode(reader, reader.uint32());
|
|
14267
|
+
continue;
|
|
14268
|
+
}
|
|
14016
14269
|
}
|
|
14017
14270
|
if ((tag & 7) === 4 || tag === 0) {
|
|
14018
14271
|
break;
|
|
@@ -14023,7 +14276,8 @@ var QueryUserSignedRefundsResponse = {
|
|
|
14023
14276
|
},
|
|
14024
14277
|
fromJSON(object) {
|
|
14025
14278
|
return {
|
|
14026
|
-
userSignedRefunds: globalThis.Array.isArray(object?.userSignedRefunds) ? object.userSignedRefunds.map((e) => UserSignedRefund.fromJSON(e)) : []
|
|
14279
|
+
userSignedRefunds: globalThis.Array.isArray(object?.userSignedRefunds) ? object.userSignedRefunds.map((e) => UserSignedRefund.fromJSON(e)) : [],
|
|
14280
|
+
transfer: isSet3(object.transfer) ? Transfer6.fromJSON(object.transfer) : void 0
|
|
14027
14281
|
};
|
|
14028
14282
|
},
|
|
14029
14283
|
toJSON(message) {
|
|
@@ -14031,6 +14285,9 @@ var QueryUserSignedRefundsResponse = {
|
|
|
14031
14285
|
if (message.userSignedRefunds?.length) {
|
|
14032
14286
|
obj.userSignedRefunds = message.userSignedRefunds.map((e) => UserSignedRefund.toJSON(e));
|
|
14033
14287
|
}
|
|
14288
|
+
if (message.transfer !== void 0) {
|
|
14289
|
+
obj.transfer = Transfer6.toJSON(message.transfer);
|
|
14290
|
+
}
|
|
14034
14291
|
return obj;
|
|
14035
14292
|
},
|
|
14036
14293
|
create(base) {
|
|
@@ -14039,6 +14296,7 @@ var QueryUserSignedRefundsResponse = {
|
|
|
14039
14296
|
fromPartial(object) {
|
|
14040
14297
|
const message = createBaseQueryUserSignedRefundsResponse();
|
|
14041
14298
|
message.userSignedRefunds = object.userSignedRefunds?.map((e) => UserSignedRefund.fromPartial(e)) || [];
|
|
14299
|
+
message.transfer = object.transfer !== void 0 && object.transfer !== null ? Transfer6.fromPartial(object.transfer) : void 0;
|
|
14042
14300
|
return message;
|
|
14043
14301
|
}
|
|
14044
14302
|
};
|
|
@@ -14925,7 +15183,8 @@ function createBaseDepositAddressQueryResult() {
|
|
|
14925
15183
|
depositAddress: "",
|
|
14926
15184
|
userSigningPublicKey: new Uint8Array(0),
|
|
14927
15185
|
verifyingPublicKey: new Uint8Array(0),
|
|
14928
|
-
leafId: void 0
|
|
15186
|
+
leafId: void 0,
|
|
15187
|
+
proofOfPossession: void 0
|
|
14929
15188
|
};
|
|
14930
15189
|
}
|
|
14931
15190
|
var DepositAddressQueryResult = {
|
|
@@ -14942,6 +15201,9 @@ var DepositAddressQueryResult = {
|
|
|
14942
15201
|
if (message.leafId !== void 0) {
|
|
14943
15202
|
writer.uint32(34).string(message.leafId);
|
|
14944
15203
|
}
|
|
15204
|
+
if (message.proofOfPossession !== void 0) {
|
|
15205
|
+
DepositAddressProof.encode(message.proofOfPossession, writer.uint32(42).fork()).join();
|
|
15206
|
+
}
|
|
14945
15207
|
return writer;
|
|
14946
15208
|
},
|
|
14947
15209
|
decode(input, length) {
|
|
@@ -14979,6 +15241,13 @@ var DepositAddressQueryResult = {
|
|
|
14979
15241
|
message.leafId = reader.string();
|
|
14980
15242
|
continue;
|
|
14981
15243
|
}
|
|
15244
|
+
case 5: {
|
|
15245
|
+
if (tag !== 42) {
|
|
15246
|
+
break;
|
|
15247
|
+
}
|
|
15248
|
+
message.proofOfPossession = DepositAddressProof.decode(reader, reader.uint32());
|
|
15249
|
+
continue;
|
|
15250
|
+
}
|
|
14982
15251
|
}
|
|
14983
15252
|
if ((tag & 7) === 4 || tag === 0) {
|
|
14984
15253
|
break;
|
|
@@ -14992,7 +15261,8 @@ var DepositAddressQueryResult = {
|
|
|
14992
15261
|
depositAddress: isSet3(object.depositAddress) ? globalThis.String(object.depositAddress) : "",
|
|
14993
15262
|
userSigningPublicKey: isSet3(object.userSigningPublicKey) ? bytesFromBase642(object.userSigningPublicKey) : new Uint8Array(0),
|
|
14994
15263
|
verifyingPublicKey: isSet3(object.verifyingPublicKey) ? bytesFromBase642(object.verifyingPublicKey) : new Uint8Array(0),
|
|
14995
|
-
leafId: isSet3(object.leafId) ? globalThis.String(object.leafId) : void 0
|
|
15264
|
+
leafId: isSet3(object.leafId) ? globalThis.String(object.leafId) : void 0,
|
|
15265
|
+
proofOfPossession: isSet3(object.proofOfPossession) ? DepositAddressProof.fromJSON(object.proofOfPossession) : void 0
|
|
14996
15266
|
};
|
|
14997
15267
|
},
|
|
14998
15268
|
toJSON(message) {
|
|
@@ -15009,6 +15279,9 @@ var DepositAddressQueryResult = {
|
|
|
15009
15279
|
if (message.leafId !== void 0) {
|
|
15010
15280
|
obj.leafId = message.leafId;
|
|
15011
15281
|
}
|
|
15282
|
+
if (message.proofOfPossession !== void 0) {
|
|
15283
|
+
obj.proofOfPossession = DepositAddressProof.toJSON(message.proofOfPossession);
|
|
15284
|
+
}
|
|
15012
15285
|
return obj;
|
|
15013
15286
|
},
|
|
15014
15287
|
create(base) {
|
|
@@ -15020,6 +15293,7 @@ var DepositAddressQueryResult = {
|
|
|
15020
15293
|
message.userSigningPublicKey = object.userSigningPublicKey ?? new Uint8Array(0);
|
|
15021
15294
|
message.verifyingPublicKey = object.verifyingPublicKey ?? new Uint8Array(0);
|
|
15022
15295
|
message.leafId = object.leafId ?? void 0;
|
|
15296
|
+
message.proofOfPossession = object.proofOfPossession !== void 0 && object.proofOfPossession !== null ? DepositAddressProof.fromPartial(object.proofOfPossession) : void 0;
|
|
15023
15297
|
return message;
|
|
15024
15298
|
}
|
|
15025
15299
|
};
|
|
@@ -16984,7 +17258,7 @@ var QueryNodesByValueResponse_NodesEntry = {
|
|
|
16984
17258
|
}
|
|
16985
17259
|
};
|
|
16986
17260
|
function createBaseGetUtxosForAddressRequest() {
|
|
16987
|
-
return { address: "", offset: 0, limit: 0, network: 0 };
|
|
17261
|
+
return { address: "", offset: 0, limit: 0, network: 0, excludeClaimed: false };
|
|
16988
17262
|
}
|
|
16989
17263
|
var GetUtxosForAddressRequest = {
|
|
16990
17264
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
@@ -17000,6 +17274,9 @@ var GetUtxosForAddressRequest = {
|
|
|
17000
17274
|
if (message.network !== 0) {
|
|
17001
17275
|
writer.uint32(32).int32(message.network);
|
|
17002
17276
|
}
|
|
17277
|
+
if (message.excludeClaimed !== false) {
|
|
17278
|
+
writer.uint32(40).bool(message.excludeClaimed);
|
|
17279
|
+
}
|
|
17003
17280
|
return writer;
|
|
17004
17281
|
},
|
|
17005
17282
|
decode(input, length) {
|
|
@@ -17037,6 +17314,13 @@ var GetUtxosForAddressRequest = {
|
|
|
17037
17314
|
message.network = reader.int32();
|
|
17038
17315
|
continue;
|
|
17039
17316
|
}
|
|
17317
|
+
case 5: {
|
|
17318
|
+
if (tag !== 40) {
|
|
17319
|
+
break;
|
|
17320
|
+
}
|
|
17321
|
+
message.excludeClaimed = reader.bool();
|
|
17322
|
+
continue;
|
|
17323
|
+
}
|
|
17040
17324
|
}
|
|
17041
17325
|
if ((tag & 7) === 4 || tag === 0) {
|
|
17042
17326
|
break;
|
|
@@ -17050,7 +17334,8 @@ var GetUtxosForAddressRequest = {
|
|
|
17050
17334
|
address: isSet3(object.address) ? globalThis.String(object.address) : "",
|
|
17051
17335
|
offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0,
|
|
17052
17336
|
limit: isSet3(object.limit) ? globalThis.Number(object.limit) : 0,
|
|
17053
|
-
network: isSet3(object.network) ? networkFromJSON(object.network) : 0
|
|
17337
|
+
network: isSet3(object.network) ? networkFromJSON(object.network) : 0,
|
|
17338
|
+
excludeClaimed: isSet3(object.excludeClaimed) ? globalThis.Boolean(object.excludeClaimed) : false
|
|
17054
17339
|
};
|
|
17055
17340
|
},
|
|
17056
17341
|
toJSON(message) {
|
|
@@ -17067,6 +17352,9 @@ var GetUtxosForAddressRequest = {
|
|
|
17067
17352
|
if (message.network !== 0) {
|
|
17068
17353
|
obj.network = networkToJSON(message.network);
|
|
17069
17354
|
}
|
|
17355
|
+
if (message.excludeClaimed !== false) {
|
|
17356
|
+
obj.excludeClaimed = message.excludeClaimed;
|
|
17357
|
+
}
|
|
17070
17358
|
return obj;
|
|
17071
17359
|
},
|
|
17072
17360
|
create(base) {
|
|
@@ -17078,6 +17366,7 @@ var GetUtxosForAddressRequest = {
|
|
|
17078
17366
|
message.offset = object.offset ?? 0;
|
|
17079
17367
|
message.limit = object.limit ?? 0;
|
|
17080
17368
|
message.network = object.network ?? 0;
|
|
17369
|
+
message.excludeClaimed = object.excludeClaimed ?? false;
|
|
17081
17370
|
return message;
|
|
17082
17371
|
}
|
|
17083
17372
|
};
|
|
@@ -17149,6 +17438,225 @@ var GetUtxosForAddressResponse = {
|
|
|
17149
17438
|
return message;
|
|
17150
17439
|
}
|
|
17151
17440
|
};
|
|
17441
|
+
function createBaseQuerySparkInvoicesRequest() {
|
|
17442
|
+
return { limit: 0, offset: 0, invoice: [] };
|
|
17443
|
+
}
|
|
17444
|
+
var QuerySparkInvoicesRequest = {
|
|
17445
|
+
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
17446
|
+
if (message.limit !== 0) {
|
|
17447
|
+
writer.uint32(8).int64(message.limit);
|
|
17448
|
+
}
|
|
17449
|
+
if (message.offset !== 0) {
|
|
17450
|
+
writer.uint32(16).int64(message.offset);
|
|
17451
|
+
}
|
|
17452
|
+
for (const v of message.invoice) {
|
|
17453
|
+
writer.uint32(26).string(v);
|
|
17454
|
+
}
|
|
17455
|
+
return writer;
|
|
17456
|
+
},
|
|
17457
|
+
decode(input, length) {
|
|
17458
|
+
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
17459
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
17460
|
+
const message = createBaseQuerySparkInvoicesRequest();
|
|
17461
|
+
while (reader.pos < end) {
|
|
17462
|
+
const tag = reader.uint32();
|
|
17463
|
+
switch (tag >>> 3) {
|
|
17464
|
+
case 1: {
|
|
17465
|
+
if (tag !== 8) {
|
|
17466
|
+
break;
|
|
17467
|
+
}
|
|
17468
|
+
message.limit = longToNumber2(reader.int64());
|
|
17469
|
+
continue;
|
|
17470
|
+
}
|
|
17471
|
+
case 2: {
|
|
17472
|
+
if (tag !== 16) {
|
|
17473
|
+
break;
|
|
17474
|
+
}
|
|
17475
|
+
message.offset = longToNumber2(reader.int64());
|
|
17476
|
+
continue;
|
|
17477
|
+
}
|
|
17478
|
+
case 3: {
|
|
17479
|
+
if (tag !== 26) {
|
|
17480
|
+
break;
|
|
17481
|
+
}
|
|
17482
|
+
message.invoice.push(reader.string());
|
|
17483
|
+
continue;
|
|
17484
|
+
}
|
|
17485
|
+
}
|
|
17486
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
17487
|
+
break;
|
|
17488
|
+
}
|
|
17489
|
+
reader.skip(tag & 7);
|
|
17490
|
+
}
|
|
17491
|
+
return message;
|
|
17492
|
+
},
|
|
17493
|
+
fromJSON(object) {
|
|
17494
|
+
return {
|
|
17495
|
+
limit: isSet3(object.limit) ? globalThis.Number(object.limit) : 0,
|
|
17496
|
+
offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0,
|
|
17497
|
+
invoice: globalThis.Array.isArray(object?.invoice) ? object.invoice.map((e) => globalThis.String(e)) : []
|
|
17498
|
+
};
|
|
17499
|
+
},
|
|
17500
|
+
toJSON(message) {
|
|
17501
|
+
const obj = {};
|
|
17502
|
+
if (message.limit !== 0) {
|
|
17503
|
+
obj.limit = Math.round(message.limit);
|
|
17504
|
+
}
|
|
17505
|
+
if (message.offset !== 0) {
|
|
17506
|
+
obj.offset = Math.round(message.offset);
|
|
17507
|
+
}
|
|
17508
|
+
if (message.invoice?.length) {
|
|
17509
|
+
obj.invoice = message.invoice;
|
|
17510
|
+
}
|
|
17511
|
+
return obj;
|
|
17512
|
+
},
|
|
17513
|
+
create(base) {
|
|
17514
|
+
return QuerySparkInvoicesRequest.fromPartial(base ?? {});
|
|
17515
|
+
},
|
|
17516
|
+
fromPartial(object) {
|
|
17517
|
+
const message = createBaseQuerySparkInvoicesRequest();
|
|
17518
|
+
message.limit = object.limit ?? 0;
|
|
17519
|
+
message.offset = object.offset ?? 0;
|
|
17520
|
+
message.invoice = object.invoice?.map((e) => e) || [];
|
|
17521
|
+
return message;
|
|
17522
|
+
}
|
|
17523
|
+
};
|
|
17524
|
+
function createBaseQuerySparkInvoicesResponse() {
|
|
17525
|
+
return { offset: 0, invoiceStatuses: [] };
|
|
17526
|
+
}
|
|
17527
|
+
var QuerySparkInvoicesResponse = {
|
|
17528
|
+
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
17529
|
+
if (message.offset !== 0) {
|
|
17530
|
+
writer.uint32(8).int64(message.offset);
|
|
17531
|
+
}
|
|
17532
|
+
for (const v of message.invoiceStatuses) {
|
|
17533
|
+
InvoiceResponse.encode(v, writer.uint32(18).fork()).join();
|
|
17534
|
+
}
|
|
17535
|
+
return writer;
|
|
17536
|
+
},
|
|
17537
|
+
decode(input, length) {
|
|
17538
|
+
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
17539
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
17540
|
+
const message = createBaseQuerySparkInvoicesResponse();
|
|
17541
|
+
while (reader.pos < end) {
|
|
17542
|
+
const tag = reader.uint32();
|
|
17543
|
+
switch (tag >>> 3) {
|
|
17544
|
+
case 1: {
|
|
17545
|
+
if (tag !== 8) {
|
|
17546
|
+
break;
|
|
17547
|
+
}
|
|
17548
|
+
message.offset = longToNumber2(reader.int64());
|
|
17549
|
+
continue;
|
|
17550
|
+
}
|
|
17551
|
+
case 2: {
|
|
17552
|
+
if (tag !== 18) {
|
|
17553
|
+
break;
|
|
17554
|
+
}
|
|
17555
|
+
message.invoiceStatuses.push(InvoiceResponse.decode(reader, reader.uint32()));
|
|
17556
|
+
continue;
|
|
17557
|
+
}
|
|
17558
|
+
}
|
|
17559
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
17560
|
+
break;
|
|
17561
|
+
}
|
|
17562
|
+
reader.skip(tag & 7);
|
|
17563
|
+
}
|
|
17564
|
+
return message;
|
|
17565
|
+
},
|
|
17566
|
+
fromJSON(object) {
|
|
17567
|
+
return {
|
|
17568
|
+
offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0,
|
|
17569
|
+
invoiceStatuses: globalThis.Array.isArray(object?.invoiceStatuses) ? object.invoiceStatuses.map((e) => InvoiceResponse.fromJSON(e)) : []
|
|
17570
|
+
};
|
|
17571
|
+
},
|
|
17572
|
+
toJSON(message) {
|
|
17573
|
+
const obj = {};
|
|
17574
|
+
if (message.offset !== 0) {
|
|
17575
|
+
obj.offset = Math.round(message.offset);
|
|
17576
|
+
}
|
|
17577
|
+
if (message.invoiceStatuses?.length) {
|
|
17578
|
+
obj.invoiceStatuses = message.invoiceStatuses.map((e) => InvoiceResponse.toJSON(e));
|
|
17579
|
+
}
|
|
17580
|
+
return obj;
|
|
17581
|
+
},
|
|
17582
|
+
create(base) {
|
|
17583
|
+
return QuerySparkInvoicesResponse.fromPartial(base ?? {});
|
|
17584
|
+
},
|
|
17585
|
+
fromPartial(object) {
|
|
17586
|
+
const message = createBaseQuerySparkInvoicesResponse();
|
|
17587
|
+
message.offset = object.offset ?? 0;
|
|
17588
|
+
message.invoiceStatuses = object.invoiceStatuses?.map((e) => InvoiceResponse.fromPartial(e)) || [];
|
|
17589
|
+
return message;
|
|
17590
|
+
}
|
|
17591
|
+
};
|
|
17592
|
+
function createBaseInvoiceResponse() {
|
|
17593
|
+
return { invoice: "", status: 0 };
|
|
17594
|
+
}
|
|
17595
|
+
var InvoiceResponse = {
|
|
17596
|
+
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
17597
|
+
if (message.invoice !== "") {
|
|
17598
|
+
writer.uint32(10).string(message.invoice);
|
|
17599
|
+
}
|
|
17600
|
+
if (message.status !== 0) {
|
|
17601
|
+
writer.uint32(16).int32(message.status);
|
|
17602
|
+
}
|
|
17603
|
+
return writer;
|
|
17604
|
+
},
|
|
17605
|
+
decode(input, length) {
|
|
17606
|
+
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
17607
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
17608
|
+
const message = createBaseInvoiceResponse();
|
|
17609
|
+
while (reader.pos < end) {
|
|
17610
|
+
const tag = reader.uint32();
|
|
17611
|
+
switch (tag >>> 3) {
|
|
17612
|
+
case 1: {
|
|
17613
|
+
if (tag !== 10) {
|
|
17614
|
+
break;
|
|
17615
|
+
}
|
|
17616
|
+
message.invoice = reader.string();
|
|
17617
|
+
continue;
|
|
17618
|
+
}
|
|
17619
|
+
case 2: {
|
|
17620
|
+
if (tag !== 16) {
|
|
17621
|
+
break;
|
|
17622
|
+
}
|
|
17623
|
+
message.status = reader.int32();
|
|
17624
|
+
continue;
|
|
17625
|
+
}
|
|
17626
|
+
}
|
|
17627
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
17628
|
+
break;
|
|
17629
|
+
}
|
|
17630
|
+
reader.skip(tag & 7);
|
|
17631
|
+
}
|
|
17632
|
+
return message;
|
|
17633
|
+
},
|
|
17634
|
+
fromJSON(object) {
|
|
17635
|
+
return {
|
|
17636
|
+
invoice: isSet3(object.invoice) ? globalThis.String(object.invoice) : "",
|
|
17637
|
+
status: isSet3(object.status) ? invoiceStatusFromJSON(object.status) : 0
|
|
17638
|
+
};
|
|
17639
|
+
},
|
|
17640
|
+
toJSON(message) {
|
|
17641
|
+
const obj = {};
|
|
17642
|
+
if (message.invoice !== "") {
|
|
17643
|
+
obj.invoice = message.invoice;
|
|
17644
|
+
}
|
|
17645
|
+
if (message.status !== 0) {
|
|
17646
|
+
obj.status = invoiceStatusToJSON(message.status);
|
|
17647
|
+
}
|
|
17648
|
+
return obj;
|
|
17649
|
+
},
|
|
17650
|
+
create(base) {
|
|
17651
|
+
return InvoiceResponse.fromPartial(base ?? {});
|
|
17652
|
+
},
|
|
17653
|
+
fromPartial(object) {
|
|
17654
|
+
const message = createBaseInvoiceResponse();
|
|
17655
|
+
message.invoice = object.invoice ?? "";
|
|
17656
|
+
message.status = object.status ?? 0;
|
|
17657
|
+
return message;
|
|
17658
|
+
}
|
|
17659
|
+
};
|
|
17152
17660
|
var SparkServiceDefinition = {
|
|
17153
17661
|
name: "SparkService",
|
|
17154
17662
|
fullName: "spark.SparkService",
|
|
@@ -17161,6 +17669,15 @@ var SparkServiceDefinition = {
|
|
|
17161
17669
|
responseStream: false,
|
|
17162
17670
|
options: {}
|
|
17163
17671
|
},
|
|
17672
|
+
/** Generates a new static deposit address of the user or returns the existing one for the specified network. */
|
|
17673
|
+
generate_static_deposit_address: {
|
|
17674
|
+
name: "generate_static_deposit_address",
|
|
17675
|
+
requestType: GenerateStaticDepositAddressRequest,
|
|
17676
|
+
requestStream: false,
|
|
17677
|
+
responseType: GenerateStaticDepositAddressResponse,
|
|
17678
|
+
responseStream: false,
|
|
17679
|
+
options: {}
|
|
17680
|
+
},
|
|
17164
17681
|
start_deposit_tree_creation: {
|
|
17165
17682
|
name: "start_deposit_tree_creation",
|
|
17166
17683
|
requestType: StartDepositTreeCreationRequest,
|
|
@@ -17602,6 +18119,14 @@ var SparkServiceDefinition = {
|
|
|
17602
18119
|
responseType: GetUtxosForAddressResponse,
|
|
17603
18120
|
responseStream: false,
|
|
17604
18121
|
options: {}
|
|
18122
|
+
},
|
|
18123
|
+
query_spark_invoices: {
|
|
18124
|
+
name: "query_spark_invoices",
|
|
18125
|
+
requestType: QuerySparkInvoicesRequest,
|
|
18126
|
+
requestStream: false,
|
|
18127
|
+
responseType: QuerySparkInvoicesResponse,
|
|
18128
|
+
responseStream: false,
|
|
18129
|
+
options: {}
|
|
17605
18130
|
}
|
|
17606
18131
|
}
|
|
17607
18132
|
};
|
|
@@ -17670,13 +18195,13 @@ init_buffer();
|
|
|
17670
18195
|
// src/signer/signer.ts
|
|
17671
18196
|
init_buffer();
|
|
17672
18197
|
var import_secp256k14 = require("@bitcoinerlab/secp256k1");
|
|
17673
|
-
var import_utils4 = require("@noble/curves/abstract/utils");
|
|
17674
18198
|
var import_secp256k15 = require("@noble/curves/secp256k1");
|
|
18199
|
+
var import_utils5 = require("@noble/curves/utils");
|
|
17675
18200
|
var import_sha22 = require("@noble/hashes/sha2");
|
|
17676
18201
|
var import_bip32 = require("@scure/bip32");
|
|
17677
18202
|
var import_bip39 = require("@scure/bip39");
|
|
17678
18203
|
var import_english = require("@scure/bip39/wordlists/english");
|
|
17679
|
-
var
|
|
18204
|
+
var import_utils6 = require("@scure/btc-signer/utils");
|
|
17680
18205
|
var ecies = __toESM(require("eciesjs"), 1);
|
|
17681
18206
|
|
|
17682
18207
|
// src/constants.ts
|
|
@@ -17684,7 +18209,7 @@ init_buffer();
|
|
|
17684
18209
|
var import_core10 = require("@lightsparkdev/core");
|
|
17685
18210
|
var isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
17686
18211
|
var isBun = globalThis.Bun !== void 0;
|
|
17687
|
-
var packageVersion = true ? "0.2.
|
|
18212
|
+
var packageVersion = true ? "0.2.12" : "unknown";
|
|
17688
18213
|
var baseEnvStr = "unknown";
|
|
17689
18214
|
if (isBun) {
|
|
17690
18215
|
const bunVersion = "version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
|
|
@@ -17704,8 +18229,8 @@ var clientEnv = `js-spark-sdk/${packageVersion} ${baseEnvStr}`;
|
|
|
17704
18229
|
|
|
17705
18230
|
// src/utils/keys.ts
|
|
17706
18231
|
init_buffer();
|
|
17707
|
-
var import_utils2 = require("@noble/curves/abstract/utils");
|
|
17708
18232
|
var import_secp256k1 = require("@noble/curves/secp256k1");
|
|
18233
|
+
var import_utils2 = require("@noble/curves/utils");
|
|
17709
18234
|
function addPublicKeys(a, b) {
|
|
17710
18235
|
if (a.length !== 33 || b.length !== 33) {
|
|
17711
18236
|
throw new ValidationError("Public keys must be 33 bytes", {
|
|
@@ -17714,9 +18239,9 @@ function addPublicKeys(a, b) {
|
|
|
17714
18239
|
expected: 33
|
|
17715
18240
|
});
|
|
17716
18241
|
}
|
|
17717
|
-
const pubkeyA = import_secp256k1.secp256k1.
|
|
17718
|
-
const pubkeyB = import_secp256k1.secp256k1.
|
|
17719
|
-
return pubkeyA.add(pubkeyB).
|
|
18242
|
+
const pubkeyA = import_secp256k1.secp256k1.Point.fromHex(a);
|
|
18243
|
+
const pubkeyB = import_secp256k1.secp256k1.Point.fromHex(b);
|
|
18244
|
+
return pubkeyA.add(pubkeyB).toBytes(true);
|
|
17720
18245
|
}
|
|
17721
18246
|
function applyAdditiveTweakToPublicKey(pubkey, tweak) {
|
|
17722
18247
|
if (pubkey.length !== 33) {
|
|
@@ -17733,11 +18258,11 @@ function applyAdditiveTweakToPublicKey(pubkey, tweak) {
|
|
|
17733
18258
|
expected: 32
|
|
17734
18259
|
});
|
|
17735
18260
|
}
|
|
17736
|
-
const pubkeyPoint = import_secp256k1.secp256k1.
|
|
18261
|
+
const pubkeyPoint = import_secp256k1.secp256k1.Point.fromHex(pubkey);
|
|
17737
18262
|
const privTweek = import_secp256k1.secp256k1.utils.normPrivateKeyToScalar(tweak);
|
|
17738
18263
|
const pubTweek = import_secp256k1.secp256k1.getPublicKey(privTweek, true);
|
|
17739
|
-
const tweekPoint = import_secp256k1.secp256k1.
|
|
17740
|
-
return pubkeyPoint.add(tweekPoint).
|
|
18264
|
+
const tweekPoint = import_secp256k1.secp256k1.Point.fromHex(pubTweek);
|
|
18265
|
+
return pubkeyPoint.add(tweekPoint).toBytes(true);
|
|
17741
18266
|
}
|
|
17742
18267
|
function subtractPublicKeys(a, b) {
|
|
17743
18268
|
if (a.length !== 33 || b.length !== 33) {
|
|
@@ -17747,9 +18272,9 @@ function subtractPublicKeys(a, b) {
|
|
|
17747
18272
|
expected: 33
|
|
17748
18273
|
});
|
|
17749
18274
|
}
|
|
17750
|
-
const pubkeyA = import_secp256k1.secp256k1.
|
|
17751
|
-
const pubkeyB = import_secp256k1.secp256k1.
|
|
17752
|
-
return pubkeyA.subtract(pubkeyB).
|
|
18275
|
+
const pubkeyA = import_secp256k1.secp256k1.Point.fromHex(a);
|
|
18276
|
+
const pubkeyB = import_secp256k1.secp256k1.Point.fromHex(b);
|
|
18277
|
+
return pubkeyA.subtract(pubkeyB).toBytes(true);
|
|
17753
18278
|
}
|
|
17754
18279
|
function addPrivateKeys(a, b) {
|
|
17755
18280
|
if (a.length !== 32 || b.length !== 32) {
|
|
@@ -17803,8 +18328,8 @@ function lastKeyWithTarget(target, keys) {
|
|
|
17803
18328
|
|
|
17804
18329
|
// src/utils/secret-sharing.ts
|
|
17805
18330
|
init_buffer();
|
|
17806
|
-
var import_utils3 = require("@noble/curves/abstract/utils");
|
|
17807
18331
|
var import_secp256k12 = require("@noble/curves/secp256k1");
|
|
18332
|
+
var import_utils3 = require("@noble/curves/utils");
|
|
17808
18333
|
|
|
17809
18334
|
// src/utils/crypto.ts
|
|
17810
18335
|
init_buffer();
|
|
@@ -17904,11 +18429,11 @@ function generatePolynomialForSecretSharing(fieldModulus, secret, degree) {
|
|
|
17904
18429
|
const coefficients = new Array(degree);
|
|
17905
18430
|
const proofs = new Array(degree);
|
|
17906
18431
|
coefficients[0] = secret;
|
|
17907
|
-
proofs[0] = import_secp256k12.secp256k1.
|
|
18432
|
+
proofs[0] = import_secp256k12.secp256k1.Point.fromPrivateKey(secret).toBytes(true);
|
|
17908
18433
|
for (let i = 1; i < degree; i++) {
|
|
17909
18434
|
const coefficient = getRandomBigInt(fieldModulus);
|
|
17910
18435
|
coefficients[i] = coefficient;
|
|
17911
|
-
proofs[i] = import_secp256k12.secp256k1.
|
|
18436
|
+
proofs[i] = import_secp256k12.secp256k1.Point.fromPrivateKey(coefficient).toBytes(true);
|
|
17912
18437
|
}
|
|
17913
18438
|
return {
|
|
17914
18439
|
fieldModulus,
|
|
@@ -17980,9 +18505,9 @@ function recoverSecret(shares) {
|
|
|
17980
18505
|
return result;
|
|
17981
18506
|
}
|
|
17982
18507
|
function validateShare(share) {
|
|
17983
|
-
const targetPubkey = import_secp256k12.secp256k1.
|
|
17984
|
-
|
|
17985
|
-
)
|
|
18508
|
+
const targetPubkey = import_secp256k12.secp256k1.Point.fromPrivateKey(share.share).toBytes(
|
|
18509
|
+
true
|
|
18510
|
+
);
|
|
17986
18511
|
let resultPubkey = share.proofs[0];
|
|
17987
18512
|
if (!resultPubkey) {
|
|
17988
18513
|
throw new ValidationError("Result pubkey is not valid", {
|
|
@@ -18001,8 +18526,8 @@ function validateShare(share) {
|
|
|
18001
18526
|
});
|
|
18002
18527
|
}
|
|
18003
18528
|
const value = share.index ** BigInt(i) % share.fieldModulus;
|
|
18004
|
-
const scaledPoint = import_secp256k12.secp256k1.
|
|
18005
|
-
resultPubkey = import_secp256k12.secp256k1.
|
|
18529
|
+
const scaledPoint = import_secp256k12.secp256k1.Point.fromHex(pubkey).multiply(value);
|
|
18530
|
+
resultPubkey = import_secp256k12.secp256k1.Point.fromHex(resultPubkey).add(scaledPoint).toBytes(true);
|
|
18006
18531
|
}
|
|
18007
18532
|
if (!(0, import_utils3.equalBytes)(resultPubkey, targetPubkey)) {
|
|
18008
18533
|
throw new ValidationError("Share is not valid", {
|
|
@@ -18196,7 +18721,7 @@ var DefaultSparkSigner = class {
|
|
|
18196
18721
|
});
|
|
18197
18722
|
}
|
|
18198
18723
|
const receiverEciesPrivKey = ecies.PrivateKey.fromHex(
|
|
18199
|
-
(0,
|
|
18724
|
+
(0, import_utils5.bytesToHex)(this.identityKey.privateKey)
|
|
18200
18725
|
);
|
|
18201
18726
|
const privateKey = ecies.decrypt(receiverEciesPrivKey.toHex(), ciphertext);
|
|
18202
18727
|
return privateKey;
|
|
@@ -18330,7 +18855,7 @@ var DefaultSparkSigner = class {
|
|
|
18330
18855
|
threshold,
|
|
18331
18856
|
numShares
|
|
18332
18857
|
}) {
|
|
18333
|
-
const secretAsInt = (0,
|
|
18858
|
+
const secretAsInt = (0, import_utils5.bytesToNumberBE)(secret);
|
|
18334
18859
|
return splitSecretWithProofs(secretAsInt, curveOrder, threshold, numShares);
|
|
18335
18860
|
}
|
|
18336
18861
|
async signFrost({
|
|
@@ -18366,7 +18891,7 @@ var DefaultSparkSigner = class {
|
|
|
18366
18891
|
publicKey,
|
|
18367
18892
|
verifyingKey
|
|
18368
18893
|
};
|
|
18369
|
-
const logMessage = (0,
|
|
18894
|
+
const logMessage = (0, import_utils5.bytesToHex)(message);
|
|
18370
18895
|
const result = await SparkFrost.signFrost({
|
|
18371
18896
|
message,
|
|
18372
18897
|
keyPackage,
|
|
@@ -18408,7 +18933,7 @@ var DefaultSparkSigner = class {
|
|
|
18408
18933
|
}
|
|
18409
18934
|
async createSparkWalletFromSeed(seed, accountNumber) {
|
|
18410
18935
|
if (typeof seed === "string") {
|
|
18411
|
-
seed = (0,
|
|
18936
|
+
seed = (0, import_utils5.hexToBytes)(seed);
|
|
18412
18937
|
}
|
|
18413
18938
|
const {
|
|
18414
18939
|
identityKey,
|
|
@@ -18420,7 +18945,7 @@ var DefaultSparkSigner = class {
|
|
|
18420
18945
|
this.depositKey = depositKey;
|
|
18421
18946
|
this.signingKey = signingKey.hdKey;
|
|
18422
18947
|
this.staticDepositKey = staticDepositKey.hdKey;
|
|
18423
|
-
return (0,
|
|
18948
|
+
return (0, import_utils5.bytesToHex)(identityKey.publicKey);
|
|
18424
18949
|
}
|
|
18425
18950
|
async signMessageWithIdentityKey(message, compact) {
|
|
18426
18951
|
if (!this.identityKey?.privateKey) {
|
|
@@ -18441,7 +18966,7 @@ var DefaultSparkSigner = class {
|
|
|
18441
18966
|
});
|
|
18442
18967
|
}
|
|
18443
18968
|
const receiverEciesPrivKey = ecies.PrivateKey.fromHex(
|
|
18444
|
-
(0,
|
|
18969
|
+
(0, import_utils5.bytesToHex)(this.identityKey.privateKey)
|
|
18445
18970
|
);
|
|
18446
18971
|
const privateKey = ecies.decrypt(receiverEciesPrivKey.toHex(), ciphertext);
|
|
18447
18972
|
const publicKey = import_secp256k15.secp256k1.getPublicKey(privateKey);
|
|
@@ -18465,15 +18990,15 @@ var DefaultSparkSigner = class {
|
|
|
18465
18990
|
}
|
|
18466
18991
|
signTransactionIndex(tx, index, publicKey) {
|
|
18467
18992
|
let privateKey;
|
|
18468
|
-
if ((0,
|
|
18993
|
+
if ((0, import_utils5.equalBytes)(publicKey, this.identityKey?.publicKey ?? new Uint8Array())) {
|
|
18469
18994
|
privateKey = this.identityKey?.privateKey;
|
|
18470
|
-
} else if ((0,
|
|
18995
|
+
} else if ((0, import_utils5.equalBytes)(publicKey, this.depositKey?.publicKey ?? new Uint8Array())) {
|
|
18471
18996
|
privateKey = this.depositKey?.privateKey;
|
|
18472
18997
|
}
|
|
18473
18998
|
if (!privateKey) {
|
|
18474
18999
|
throw new ValidationError("Private key not found for public key", {
|
|
18475
19000
|
field: "privateKey",
|
|
18476
|
-
value: (0,
|
|
19001
|
+
value: (0, import_utils5.bytesToHex)(publicKey)
|
|
18477
19002
|
});
|
|
18478
19003
|
}
|
|
18479
19004
|
tx.signIdx(privateKey, index);
|
|
@@ -18885,7 +19410,7 @@ var WalletConfigService = class {
|
|
|
18885
19410
|
|
|
18886
19411
|
// src/services/connection.ts
|
|
18887
19412
|
init_buffer();
|
|
18888
|
-
var
|
|
19413
|
+
var import_core12 = require("@lightsparkdev/core");
|
|
18889
19414
|
var import_sha23 = require("@noble/hashes/sha2");
|
|
18890
19415
|
var import_nice_grpc_client_middleware_retry = require("nice-grpc-client-middleware-retry");
|
|
18891
19416
|
var import_nice_grpc_common2 = require("nice-grpc-common");
|
|
@@ -22643,7 +23168,7 @@ var ConnectionManager = class {
|
|
|
22643
23168
|
async createMockClient(address2) {
|
|
22644
23169
|
const channel = await this.createChannelWithTLS(address2);
|
|
22645
23170
|
const isNodeChannel = "close" in channel;
|
|
22646
|
-
if (
|
|
23171
|
+
if (import_core12.isNode && isNodeChannel && !isBun) {
|
|
22647
23172
|
const grpcModule = await import("nice-grpc");
|
|
22648
23173
|
const { createClient } = "default" in grpcModule ? grpcModule.default : grpcModule;
|
|
22649
23174
|
const client = createClient(MockServiceDefinition, channel);
|
|
@@ -22660,7 +23185,7 @@ var ConnectionManager = class {
|
|
|
22660
23185
|
}
|
|
22661
23186
|
async createChannelWithTLS(address2, certPath) {
|
|
22662
23187
|
try {
|
|
22663
|
-
if (
|
|
23188
|
+
if (import_core12.isNode && !isBun) {
|
|
22664
23189
|
const grpcModule = await import("nice-grpc");
|
|
22665
23190
|
const { ChannelCredentials, createChannel } = "default" in grpcModule ? grpcModule.default : grpcModule;
|
|
22666
23191
|
if (certPath) {
|
|
@@ -22691,7 +23216,7 @@ var ConnectionManager = class {
|
|
|
22691
23216
|
const { XHRTransport: XHRTransport2 } = await Promise.resolve().then(() => (init_xhr_transport(), xhr_transport_exports));
|
|
22692
23217
|
return createChannel(
|
|
22693
23218
|
address2,
|
|
22694
|
-
|
|
23219
|
+
import_core12.isBare ? (0, import_nice_grpc_web.NodeHttpTransport)() : isReactNative ? XHRTransport2() : FetchTransport()
|
|
22695
23220
|
);
|
|
22696
23221
|
}
|
|
22697
23222
|
} catch (error) {
|
|
@@ -22797,7 +23322,7 @@ var ConnectionManager = class {
|
|
|
22797
23322
|
sparkAuthnClient.close?.();
|
|
22798
23323
|
return verifyResp.sessionToken;
|
|
22799
23324
|
} catch (error) {
|
|
22800
|
-
if ((0,
|
|
23325
|
+
if ((0, import_core12.isError)(error)) {
|
|
22801
23326
|
sparkAuthnClient?.close?.();
|
|
22802
23327
|
if (error.message.includes("challenge expired")) {
|
|
22803
23328
|
console.warn(
|
|
@@ -22848,7 +23373,7 @@ var ConnectionManager = class {
|
|
|
22848
23373
|
);
|
|
22849
23374
|
}
|
|
22850
23375
|
createAuthnMiddleware() {
|
|
22851
|
-
if (
|
|
23376
|
+
if (import_core12.isNode) {
|
|
22852
23377
|
return async function* (call, options) {
|
|
22853
23378
|
const metadata = (0, import_nice_grpc_common2.Metadata)(options.metadata).set(
|
|
22854
23379
|
"X-Client-Env",
|
|
@@ -22870,14 +23395,14 @@ var ConnectionManager = class {
|
|
|
22870
23395
|
}
|
|
22871
23396
|
}
|
|
22872
23397
|
createMiddleware(address2, authToken) {
|
|
22873
|
-
if (
|
|
23398
|
+
if (import_core12.isNode) {
|
|
22874
23399
|
return this.createNodeMiddleware(address2, authToken);
|
|
22875
23400
|
} else {
|
|
22876
23401
|
return this.createBrowserMiddleware(address2, authToken);
|
|
22877
23402
|
}
|
|
22878
23403
|
}
|
|
22879
23404
|
async *handleMiddlewareError(error, address2, call, metadata, options) {
|
|
22880
|
-
if ((0,
|
|
23405
|
+
if ((0, import_core12.isError)(error)) {
|
|
22881
23406
|
if (error.message.includes("token has expired")) {
|
|
22882
23407
|
const newAuthToken = await this.authenticate(address2);
|
|
22883
23408
|
const clientData = this.clients.get(address2);
|
|
@@ -22948,7 +23473,7 @@ var ConnectionManager = class {
|
|
|
22948
23473
|
};
|
|
22949
23474
|
let options = {};
|
|
22950
23475
|
const isNodeChannel = "close" in channel;
|
|
22951
|
-
if (
|
|
23476
|
+
if (import_core12.isNode && isNodeChannel && !isBun) {
|
|
22952
23477
|
const grpcModule = await import("nice-grpc");
|
|
22953
23478
|
const { openTelemetryClientMiddleware } = await import("nice-grpc-opentelemetry");
|
|
22954
23479
|
const { createClientFactory } = "default" in grpcModule ? grpcModule.default : grpcModule;
|
|
@@ -22998,8 +23523,8 @@ var import_uuidv72 = require("uuidv7");
|
|
|
22998
23523
|
|
|
22999
23524
|
// src/utils/bitcoin.ts
|
|
23000
23525
|
init_buffer();
|
|
23001
|
-
var import_utils6 = require("@noble/curves/abstract/utils");
|
|
23002
23526
|
var import_secp256k16 = require("@noble/curves/secp256k1");
|
|
23527
|
+
var import_utils7 = require("@noble/curves/utils");
|
|
23003
23528
|
var import_sha24 = require("@noble/hashes/sha2");
|
|
23004
23529
|
var btc2 = __toESM(require("@scure/btc-signer"), 1);
|
|
23005
23530
|
function computeTaprootKeyNoScript(pubkey) {
|
|
@@ -23011,10 +23536,10 @@ function computeTaprootKeyNoScript(pubkey) {
|
|
|
23011
23536
|
});
|
|
23012
23537
|
}
|
|
23013
23538
|
const taggedHash = import_secp256k16.schnorr.utils.taggedHash("TapTweak", pubkey);
|
|
23014
|
-
const tweak = (0,
|
|
23539
|
+
const tweak = (0, import_utils7.bytesToNumberBE)(taggedHash);
|
|
23015
23540
|
const P = import_secp256k16.schnorr.utils.lift_x(import_secp256k16.schnorr.utils.bytesToNumberBE(pubkey));
|
|
23016
|
-
const Q = P.add(import_secp256k16.secp256k1.
|
|
23017
|
-
return Q.
|
|
23541
|
+
const Q = P.add(import_secp256k16.secp256k1.Point.fromPrivateKey(tweak));
|
|
23542
|
+
return Q.toBytes();
|
|
23018
23543
|
}
|
|
23019
23544
|
function getP2TRScriptFromPublicKey(pubKey, network) {
|
|
23020
23545
|
if (pubKey.length !== 33) {
|
|
@@ -23024,9 +23549,9 @@ function getP2TRScriptFromPublicKey(pubKey, network) {
|
|
|
23024
23549
|
expected: 33
|
|
23025
23550
|
});
|
|
23026
23551
|
}
|
|
23027
|
-
const internalKey = import_secp256k16.secp256k1.
|
|
23552
|
+
const internalKey = import_secp256k16.secp256k1.Point.fromHex(pubKey);
|
|
23028
23553
|
const script = btc2.p2tr(
|
|
23029
|
-
internalKey.
|
|
23554
|
+
internalKey.toBytes().slice(1, 33),
|
|
23030
23555
|
void 0,
|
|
23031
23556
|
getNetwork(network)
|
|
23032
23557
|
).script;
|
|
@@ -23046,9 +23571,9 @@ function getP2TRAddressFromPublicKey(pubKey, network) {
|
|
|
23046
23571
|
expected: 33
|
|
23047
23572
|
});
|
|
23048
23573
|
}
|
|
23049
|
-
const internalKey = import_secp256k16.secp256k1.
|
|
23574
|
+
const internalKey = import_secp256k16.secp256k1.Point.fromHex(pubKey);
|
|
23050
23575
|
const address2 = btc2.p2tr(
|
|
23051
|
-
internalKey.
|
|
23576
|
+
internalKey.toBytes().slice(1, 33),
|
|
23052
23577
|
void 0,
|
|
23053
23578
|
getNetwork(network)
|
|
23054
23579
|
).address;
|
|
@@ -23064,7 +23589,7 @@ function getP2TRAddressFromPkScript(pkScript, network) {
|
|
|
23064
23589
|
if (pkScript.length !== 34 || pkScript[0] !== 81 || pkScript[1] !== 32) {
|
|
23065
23590
|
throw new ValidationError("Invalid pkscript", {
|
|
23066
23591
|
field: "pkScript",
|
|
23067
|
-
value: (0,
|
|
23592
|
+
value: (0, import_utils7.bytesToHex)(pkScript),
|
|
23068
23593
|
expected: "34 bytes starting with 0x51 0x20"
|
|
23069
23594
|
});
|
|
23070
23595
|
}
|
|
@@ -23089,7 +23614,7 @@ function getP2WPKHAddressFromPublicKey(pubKey, network) {
|
|
|
23089
23614
|
return address2;
|
|
23090
23615
|
}
|
|
23091
23616
|
function getTxFromRawTxHex(rawTxHex) {
|
|
23092
|
-
const txBytes = (0,
|
|
23617
|
+
const txBytes = (0, import_utils7.hexToBytes)(rawTxHex);
|
|
23093
23618
|
const tx = btc2.Transaction.fromRaw(txBytes, {
|
|
23094
23619
|
allowUnknownOutputs: true
|
|
23095
23620
|
});
|
|
@@ -23136,10 +23661,10 @@ function getSigHashFromTx(tx, inputIndex, prevOutput) {
|
|
|
23136
23661
|
);
|
|
23137
23662
|
}
|
|
23138
23663
|
function getTxId(tx) {
|
|
23139
|
-
return (0,
|
|
23664
|
+
return (0, import_utils7.bytesToHex)((0, import_sha24.sha256)((0, import_sha24.sha256)(tx.toBytes(true))).reverse());
|
|
23140
23665
|
}
|
|
23141
23666
|
function getTxIdNoReverse(tx) {
|
|
23142
|
-
return (0,
|
|
23667
|
+
return (0, import_utils7.bytesToHex)((0, import_sha24.sha256)((0, import_sha24.sha256)(tx.toBytes(true))));
|
|
23143
23668
|
}
|
|
23144
23669
|
function getTxEstimatedVbytesSizeByNumberOfInputsOutputs(numInputs, numOutputs) {
|
|
23145
23670
|
const TX_OVERHEAD = 10;
|
|
@@ -23487,8 +24012,8 @@ function getEphemeralAnchorOutput() {
|
|
|
23487
24012
|
|
|
23488
24013
|
// src/services/transfer.ts
|
|
23489
24014
|
init_buffer();
|
|
23490
|
-
var import_utils8 = require("@noble/curves/abstract/utils");
|
|
23491
24015
|
var import_secp256k17 = require("@noble/curves/secp256k1");
|
|
24016
|
+
var import_utils9 = require("@noble/curves/utils");
|
|
23492
24017
|
var import_sha26 = require("@noble/hashes/sha2");
|
|
23493
24018
|
var import_btc_signer2 = require("@scure/btc-signer");
|
|
23494
24019
|
var ecies2 = __toESM(require("eciesjs"), 1);
|
|
@@ -23496,7 +24021,7 @@ var import_uuidv7 = require("uuidv7");
|
|
|
23496
24021
|
|
|
23497
24022
|
// src/utils/transfer_package.ts
|
|
23498
24023
|
init_buffer();
|
|
23499
|
-
var
|
|
24024
|
+
var import_utils8 = require("@noble/curves/utils");
|
|
23500
24025
|
var import_sha25 = require("@noble/hashes/sha2");
|
|
23501
24026
|
function getTransferPackageSigningPayload(transferID, transferPackage) {
|
|
23502
24027
|
const encryptedPayload = transferPackage.keyTweakPackage;
|
|
@@ -23505,7 +24030,7 @@ function getTransferPackageSigningPayload(transferID, transferPackage) {
|
|
|
23505
24030
|
).map(([key, value]) => ({ key, value }));
|
|
23506
24031
|
pairs.sort((a, b) => a.key.localeCompare(b.key));
|
|
23507
24032
|
const encoder = new TextEncoder();
|
|
23508
|
-
let message = (0,
|
|
24033
|
+
let message = (0, import_utils8.hexToBytes)(transferID.replaceAll("-", ""));
|
|
23509
24034
|
for (const pair of pairs) {
|
|
23510
24035
|
const keyPart = encoder.encode(pair.key + ":");
|
|
23511
24036
|
const separator = encoder.encode(";");
|
|
@@ -23885,7 +24410,7 @@ var BaseTransferService = class {
|
|
|
23885
24410
|
}
|
|
23886
24411
|
async prepareSendTransferKeyTweaks(transferID, receiverIdentityPubkey, leaves, cpfpRefundSignatureMap, directRefundSignatureMap, directFromCpfpRefundSignatureMap) {
|
|
23887
24412
|
const receiverEciesPubKey = ecies2.PublicKey.fromHex(
|
|
23888
|
-
(0,
|
|
24413
|
+
(0, import_utils9.bytesToHex)(receiverIdentityPubkey)
|
|
23889
24414
|
);
|
|
23890
24415
|
const leavesTweaksMap = /* @__PURE__ */ new Map();
|
|
23891
24416
|
for (const leaf of leaves) {
|
|
@@ -23926,7 +24451,7 @@ var BaseTransferService = class {
|
|
|
23926
24451
|
throw new Error(`Share not found for operator ${operator.id}`);
|
|
23927
24452
|
}
|
|
23928
24453
|
const pubkeyTweak = import_secp256k17.secp256k1.getPublicKey(
|
|
23929
|
-
(0,
|
|
24454
|
+
(0, import_utils9.numberToBytesBE)(share.share, 32),
|
|
23930
24455
|
true
|
|
23931
24456
|
);
|
|
23932
24457
|
pubkeySharesTweak.set(identifier, pubkeyTweak);
|
|
@@ -23951,7 +24476,7 @@ var BaseTransferService = class {
|
|
|
23951
24476
|
leafTweaksMap.set(identifier, {
|
|
23952
24477
|
leafId: leaf.leaf.id,
|
|
23953
24478
|
secretShareTweak: {
|
|
23954
|
-
secretShare: (0,
|
|
24479
|
+
secretShare: (0, import_utils9.numberToBytesBE)(share.share, 32),
|
|
23955
24480
|
proofs: share.proofs
|
|
23956
24481
|
},
|
|
23957
24482
|
pubkeySharesTweak: Object.fromEntries(pubkeySharesTweak),
|
|
@@ -23974,7 +24499,7 @@ var BaseTransferService = class {
|
|
|
23974
24499
|
return void 0;
|
|
23975
24500
|
}
|
|
23976
24501
|
compareTransfers(transfer1, transfer2) {
|
|
23977
|
-
return transfer1.id === transfer2.id && (0,
|
|
24502
|
+
return transfer1.id === transfer2.id && (0, import_utils9.equalBytes)(
|
|
23978
24503
|
transfer1.senderIdentityPublicKey,
|
|
23979
24504
|
transfer2.senderIdentityPublicKey
|
|
23980
24505
|
) && transfer1.status === transfer2.status && transfer1.totalValue === transfer2.totalValue && transfer1.expiryTime?.getTime() === transfer2.expiryTime?.getTime() && transfer1.leaves.length === transfer2.leaves.length;
|
|
@@ -24273,7 +24798,7 @@ var TransferService = class extends BaseTransferService {
|
|
|
24273
24798
|
}
|
|
24274
24799
|
const nodeTx = getTxFromRawTxBytes(leaf.leaf.nodeTx);
|
|
24275
24800
|
const cpfpNodeOutPoint = {
|
|
24276
|
-
txid: (0,
|
|
24801
|
+
txid: (0, import_utils9.hexToBytes)(getTxId(nodeTx)),
|
|
24277
24802
|
index: 0
|
|
24278
24803
|
};
|
|
24279
24804
|
let directNodeTx;
|
|
@@ -24281,7 +24806,7 @@ var TransferService = class extends BaseTransferService {
|
|
|
24281
24806
|
if (leaf.leaf.directTx.length > 0) {
|
|
24282
24807
|
directNodeTx = getTxFromRawTxBytes(leaf.leaf.directTx);
|
|
24283
24808
|
directNodeOutPoint = {
|
|
24284
|
-
txid: (0,
|
|
24809
|
+
txid: (0, import_utils9.hexToBytes)(getTxId(directNodeTx)),
|
|
24285
24810
|
index: 0
|
|
24286
24811
|
};
|
|
24287
24812
|
}
|
|
@@ -24415,7 +24940,7 @@ var TransferService = class extends BaseTransferService {
|
|
|
24415
24940
|
throw new Error(`Share not found for operator ${operator.id}`);
|
|
24416
24941
|
}
|
|
24417
24942
|
const pubkeyTweak = import_secp256k17.secp256k1.getPublicKey(
|
|
24418
|
-
(0,
|
|
24943
|
+
(0, import_utils9.numberToBytesBE)(share.share, 32)
|
|
24419
24944
|
);
|
|
24420
24945
|
pubkeySharesTweak.set(identifier, pubkeyTweak);
|
|
24421
24946
|
}
|
|
@@ -24428,7 +24953,7 @@ var TransferService = class extends BaseTransferService {
|
|
|
24428
24953
|
leafTweaksMap.set(identifier, {
|
|
24429
24954
|
leafId: leaf.leaf.id,
|
|
24430
24955
|
secretShareTweak: {
|
|
24431
|
-
secretShare: (0,
|
|
24956
|
+
secretShare: (0, import_utils9.numberToBytesBE)(share.share, 32),
|
|
24432
24957
|
proofs: share.proofs
|
|
24433
24958
|
},
|
|
24434
24959
|
pubkeySharesTweak: Object.fromEntries(pubkeySharesTweak)
|
|
@@ -24614,13 +25139,13 @@ var TransferService = class extends BaseTransferService {
|
|
|
24614
25139
|
});
|
|
24615
25140
|
}
|
|
24616
25141
|
const newCpfpRefundOutPoint = {
|
|
24617
|
-
txid: (0,
|
|
25142
|
+
txid: (0, import_utils9.hexToBytes)(getTxId(cpfpNodeTx)),
|
|
24618
25143
|
index: 0
|
|
24619
25144
|
};
|
|
24620
25145
|
let newDirectRefundOutPoint;
|
|
24621
25146
|
if (newDirectNodeTx) {
|
|
24622
25147
|
newDirectRefundOutPoint = {
|
|
24623
|
-
txid: (0,
|
|
25148
|
+
txid: (0, import_utils9.hexToBytes)(getTxId(newDirectNodeTx)),
|
|
24624
25149
|
index: 0
|
|
24625
25150
|
};
|
|
24626
25151
|
}
|
|
@@ -24748,7 +25273,7 @@ var TransferService = class extends BaseTransferService {
|
|
|
24748
25273
|
const refundTx = getTxFromRawTxBytes(node.refundTx);
|
|
24749
25274
|
const refundSequence = refundTx.getInput(0).sequence || 0;
|
|
24750
25275
|
const newNodeOutPoint = {
|
|
24751
|
-
txid: (0,
|
|
25276
|
+
txid: (0, import_utils9.hexToBytes)(getTxId(nodeTx)),
|
|
24752
25277
|
index: 0
|
|
24753
25278
|
};
|
|
24754
25279
|
const {
|
|
@@ -24785,13 +25310,13 @@ var TransferService = class extends BaseTransferService {
|
|
|
24785
25310
|
});
|
|
24786
25311
|
}
|
|
24787
25312
|
const newCpfpRefundOutPoint = {
|
|
24788
|
-
txid: (0,
|
|
25313
|
+
txid: (0, import_utils9.hexToBytes)(getTxId(newNodeTx)),
|
|
24789
25314
|
index: 0
|
|
24790
25315
|
};
|
|
24791
25316
|
let newDirectRefundOutPoint;
|
|
24792
25317
|
if (newDirectNodeTx) {
|
|
24793
25318
|
newDirectRefundOutPoint = {
|
|
24794
|
-
txid: (0,
|
|
25319
|
+
txid: (0, import_utils9.hexToBytes)(getTxId(newDirectNodeTx)),
|
|
24795
25320
|
index: 0
|
|
24796
25321
|
};
|
|
24797
25322
|
}
|
|
@@ -25025,13 +25550,13 @@ var TransferService = class extends BaseTransferService {
|
|
|
25025
25550
|
};
|
|
25026
25551
|
const signingPublicKey = await this.config.signer.getPublicKeyFromDerivation(keyDerivation);
|
|
25027
25552
|
const cpfpRefundOutPoint = {
|
|
25028
|
-
txid: (0,
|
|
25553
|
+
txid: (0, import_utils9.hexToBytes)(getTxId(nodeTx)),
|
|
25029
25554
|
index: 0
|
|
25030
25555
|
};
|
|
25031
25556
|
let directRefundOutPoint;
|
|
25032
25557
|
if (directNodeTx) {
|
|
25033
25558
|
directRefundOutPoint = {
|
|
25034
|
-
txid: (0,
|
|
25559
|
+
txid: (0, import_utils9.hexToBytes)(getTxId(directNodeTx)),
|
|
25035
25560
|
index: 0
|
|
25036
25561
|
};
|
|
25037
25562
|
}
|
|
@@ -25407,9 +25932,9 @@ var CoopExitService = class extends BaseTransferService {
|
|
|
25407
25932
|
init_buffer();
|
|
25408
25933
|
var import_secp256k18 = require("@noble/curves/secp256k1");
|
|
25409
25934
|
var import_sha28 = require("@noble/hashes/sha2");
|
|
25410
|
-
var
|
|
25935
|
+
var import_utils10 = require("@noble/hashes/utils");
|
|
25411
25936
|
var import_btc_signer4 = require("@scure/btc-signer");
|
|
25412
|
-
var
|
|
25937
|
+
var import_utils11 = require("@scure/btc-signer/utils");
|
|
25413
25938
|
|
|
25414
25939
|
// src/utils/proof.ts
|
|
25415
25940
|
init_buffer();
|
|
@@ -25435,7 +25960,8 @@ var DepositService = class {
|
|
|
25435
25960
|
}
|
|
25436
25961
|
async validateDepositAddress({
|
|
25437
25962
|
address: address2,
|
|
25438
|
-
userPubkey
|
|
25963
|
+
userPubkey,
|
|
25964
|
+
verifyCoordinatorProof = false
|
|
25439
25965
|
}) {
|
|
25440
25966
|
if (!address2.depositAddressProof || !address2.depositAddressProof.proofOfPossessionSignature || !address2.depositAddressProof.addressSignatures) {
|
|
25441
25967
|
throw new ValidationError(
|
|
@@ -25473,10 +25999,10 @@ var DepositService = class {
|
|
|
25473
25999
|
}
|
|
25474
26000
|
const addrHash = (0, import_sha28.sha256)(address2.address);
|
|
25475
26001
|
for (const operator of Object.values(this.config.getSigningOperators())) {
|
|
25476
|
-
if (operator.identifier === this.config.getCoordinatorIdentifier()) {
|
|
26002
|
+
if (operator.identifier === this.config.getCoordinatorIdentifier() && !verifyCoordinatorProof) {
|
|
25477
26003
|
continue;
|
|
25478
26004
|
}
|
|
25479
|
-
const operatorPubkey2 = (0,
|
|
26005
|
+
const operatorPubkey2 = (0, import_utils10.hexToBytes)(operator.identityPublicKey);
|
|
25480
26006
|
const operatorSig = address2.depositAddressProof.addressSignatures[operator.identifier];
|
|
25481
26007
|
if (!operatorSig) {
|
|
25482
26008
|
throw new ValidationError("Operator signature not found", {
|
|
@@ -25485,7 +26011,11 @@ var DepositService = class {
|
|
|
25485
26011
|
});
|
|
25486
26012
|
}
|
|
25487
26013
|
const sig = import_secp256k18.secp256k1.Signature.fromDER(operatorSig);
|
|
25488
|
-
const isVerified2 = import_secp256k18.secp256k1.verify(
|
|
26014
|
+
const isVerified2 = import_secp256k18.secp256k1.verify(
|
|
26015
|
+
sig.toCompactRawBytes(),
|
|
26016
|
+
addrHash,
|
|
26017
|
+
operatorPubkey2
|
|
26018
|
+
);
|
|
25489
26019
|
if (!isVerified2) {
|
|
25490
26020
|
throw new ValidationError("Operator signature verification failed", {
|
|
25491
26021
|
field: "operatorSignature",
|
|
@@ -25494,6 +26024,46 @@ var DepositService = class {
|
|
|
25494
26024
|
}
|
|
25495
26025
|
}
|
|
25496
26026
|
}
|
|
26027
|
+
async generateStaticDepositAddress({
|
|
26028
|
+
signingPubkey
|
|
26029
|
+
}) {
|
|
26030
|
+
const sparkClient = await this.connectionManager.createSparkClient(
|
|
26031
|
+
this.config.getCoordinatorAddress()
|
|
26032
|
+
);
|
|
26033
|
+
let depositResp;
|
|
26034
|
+
try {
|
|
26035
|
+
depositResp = await sparkClient.generate_static_deposit_address({
|
|
26036
|
+
signingPublicKey: signingPubkey,
|
|
26037
|
+
identityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
26038
|
+
network: this.config.getNetworkProto()
|
|
26039
|
+
});
|
|
26040
|
+
} catch (error) {
|
|
26041
|
+
throw new NetworkError(
|
|
26042
|
+
"Failed to generate static deposit address",
|
|
26043
|
+
{
|
|
26044
|
+
operation: "generate_static_deposit_address",
|
|
26045
|
+
errorCount: 1,
|
|
26046
|
+
errors: error instanceof Error ? error.message : String(error)
|
|
26047
|
+
},
|
|
26048
|
+
error
|
|
26049
|
+
);
|
|
26050
|
+
}
|
|
26051
|
+
if (!depositResp.depositAddress) {
|
|
26052
|
+
throw new ValidationError(
|
|
26053
|
+
"No static deposit address response from coordinator",
|
|
26054
|
+
{
|
|
26055
|
+
field: "depositAddress",
|
|
26056
|
+
value: depositResp
|
|
26057
|
+
}
|
|
26058
|
+
);
|
|
26059
|
+
}
|
|
26060
|
+
await this.validateDepositAddress({
|
|
26061
|
+
address: depositResp.depositAddress,
|
|
26062
|
+
userPubkey: signingPubkey,
|
|
26063
|
+
verifyCoordinatorProof: true
|
|
26064
|
+
});
|
|
26065
|
+
return depositResp;
|
|
26066
|
+
}
|
|
25497
26067
|
async generateDepositAddress({
|
|
25498
26068
|
signingPubkey,
|
|
25499
26069
|
leafId,
|
|
@@ -25561,7 +26131,7 @@ var DepositService = class {
|
|
|
25561
26131
|
});
|
|
25562
26132
|
}
|
|
25563
26133
|
const depositOutPoint = {
|
|
25564
|
-
txid: (0,
|
|
26134
|
+
txid: (0, import_utils10.hexToBytes)(getTxId(depositTx)),
|
|
25565
26135
|
index: vout
|
|
25566
26136
|
};
|
|
25567
26137
|
const depositTxOut = {
|
|
@@ -25580,8 +26150,8 @@ var DepositService = class {
|
|
|
25580
26150
|
const { cpfpRefundTx, directRefundTx, directFromCpfpRefundTx } = createRefundTxs({
|
|
25581
26151
|
sequence: INITIAL_SEQUENCE,
|
|
25582
26152
|
directSequence: INITIAL_DIRECT_SEQUENCE,
|
|
25583
|
-
input: { txid: (0,
|
|
25584
|
-
directInput: { txid: (0,
|
|
26153
|
+
input: { txid: (0, import_utils10.hexToBytes)(getTxId(cpfpRootTx)), index: 0 },
|
|
26154
|
+
directInput: { txid: (0, import_utils10.hexToBytes)(getTxId(directRootTx)), index: 0 },
|
|
25585
26155
|
amountSats: amount,
|
|
25586
26156
|
receivingPubkey: signingPubKey,
|
|
25587
26157
|
network: this.config.getNetwork()
|
|
@@ -25711,7 +26281,7 @@ var DepositService = class {
|
|
|
25711
26281
|
}
|
|
25712
26282
|
);
|
|
25713
26283
|
}
|
|
25714
|
-
if (!(0,
|
|
26284
|
+
if (!(0, import_utils11.equalBytes)(treeResp.rootNodeSignatureShares.verifyingKey, verifyingKey)) {
|
|
25715
26285
|
throw new ValidationError("Verifying key mismatch", {
|
|
25716
26286
|
field: "verifyingKey",
|
|
25717
26287
|
value: treeResp.rootNodeSignatureShares.verifyingKey,
|
|
@@ -25875,7 +26445,7 @@ var DepositService = class {
|
|
|
25875
26445
|
});
|
|
25876
26446
|
}
|
|
25877
26447
|
const depositOutPoint = {
|
|
25878
|
-
txid: (0,
|
|
26448
|
+
txid: (0, import_utils10.hexToBytes)(getTxId(depositTx)),
|
|
25879
26449
|
index: vout
|
|
25880
26450
|
};
|
|
25881
26451
|
const depositTxOut = {
|
|
@@ -25888,7 +26458,7 @@ var DepositService = class {
|
|
|
25888
26458
|
const signingPubKey = await this.config.signer.getPublicKeyFromDerivation(keyDerivation);
|
|
25889
26459
|
const { cpfpRefundTx } = createRefundTxs({
|
|
25890
26460
|
sequence: INITIAL_SEQUENCE,
|
|
25891
|
-
input: { txid: (0,
|
|
26461
|
+
input: { txid: (0, import_utils10.hexToBytes)(getTxId(cpfpRootTx)), index: 0 },
|
|
25892
26462
|
amountSats: amount,
|
|
25893
26463
|
receivingPubkey: signingPubKey,
|
|
25894
26464
|
network: this.config.getNetwork()
|
|
@@ -25958,7 +26528,7 @@ var DepositService = class {
|
|
|
25958
26528
|
}
|
|
25959
26529
|
);
|
|
25960
26530
|
}
|
|
25961
|
-
if (!(0,
|
|
26531
|
+
if (!(0, import_utils11.equalBytes)(treeResp.rootNodeSignatureShares.verifyingKey, verifyingKey)) {
|
|
25962
26532
|
throw new ValidationError("Verifying key mismatch", {
|
|
25963
26533
|
field: "verifyingKey",
|
|
25964
26534
|
value: treeResp.rootNodeSignatureShares.verifyingKey,
|
|
@@ -26034,8 +26604,8 @@ var DepositService = class {
|
|
|
26034
26604
|
|
|
26035
26605
|
// src/services/lightning.ts
|
|
26036
26606
|
init_buffer();
|
|
26037
|
-
var import_utils11 = require("@noble/curves/abstract/utils");
|
|
26038
26607
|
var import_secp256k19 = require("@noble/curves/secp256k1");
|
|
26608
|
+
var import_utils12 = require("@noble/curves/utils");
|
|
26039
26609
|
var import_sha29 = require("@noble/hashes/sha2");
|
|
26040
26610
|
var import_uuidv73 = require("uuidv7");
|
|
26041
26611
|
|
|
@@ -26121,8 +26691,8 @@ var LightningService = class {
|
|
|
26121
26691
|
}) {
|
|
26122
26692
|
const crypto = getCrypto();
|
|
26123
26693
|
const randBytes = crypto.getRandomValues(new Uint8Array(32));
|
|
26124
|
-
const preimage = (0,
|
|
26125
|
-
(0,
|
|
26694
|
+
const preimage = (0, import_utils12.numberToBytesBE)(
|
|
26695
|
+
(0, import_utils12.bytesToNumberBE)(randBytes) % import_secp256k19.secp256k1.CURVE.n,
|
|
26126
26696
|
32
|
|
26127
26697
|
);
|
|
26128
26698
|
return await this.createLightningInvoiceWithPreImage({
|
|
@@ -26177,12 +26747,12 @@ var LightningService = class {
|
|
|
26177
26747
|
const sparkClient = await this.connectionManager.createSparkClient(
|
|
26178
26748
|
operator.address
|
|
26179
26749
|
);
|
|
26180
|
-
const userIdentityPublicKey = receiverIdentityPubkey ? (0,
|
|
26750
|
+
const userIdentityPublicKey = receiverIdentityPubkey ? (0, import_utils12.hexToBytes)(receiverIdentityPubkey) : await this.config.signer.getIdentityPublicKey();
|
|
26181
26751
|
try {
|
|
26182
26752
|
await sparkClient.store_preimage_share({
|
|
26183
26753
|
paymentHash,
|
|
26184
26754
|
preimageShare: {
|
|
26185
|
-
secretShare: (0,
|
|
26755
|
+
secretShare: (0, import_utils12.numberToBytesBE)(share.share, 32),
|
|
26186
26756
|
proofs: share.proofs
|
|
26187
26757
|
},
|
|
26188
26758
|
threshold: this.config.getThreshold(),
|
|
@@ -26383,15 +26953,18 @@ var LightningService = class {
|
|
|
26383
26953
|
|
|
26384
26954
|
// src/services/token-transactions.ts
|
|
26385
26955
|
init_buffer();
|
|
26386
|
-
var import_utils16 = require("@noble/curves/abstract/utils");
|
|
26387
26956
|
var import_secp256k112 = require("@noble/curves/secp256k1");
|
|
26957
|
+
var import_utils16 = require("@noble/curves/utils");
|
|
26388
26958
|
var import_utils17 = require("@noble/hashes/utils");
|
|
26389
26959
|
|
|
26390
26960
|
// src/utils/address.ts
|
|
26391
26961
|
init_buffer();
|
|
26962
|
+
var import_wire8 = require("@bufbuild/protobuf/wire");
|
|
26392
26963
|
var import_secp256k110 = require("@noble/curves/secp256k1");
|
|
26393
|
-
var
|
|
26964
|
+
var import_utils13 = require("@noble/curves/utils");
|
|
26965
|
+
var import_utils14 = require("@noble/hashes/utils");
|
|
26394
26966
|
var import_base2 = require("@scure/base");
|
|
26967
|
+
var import_uuidv74 = require("uuidv7");
|
|
26395
26968
|
|
|
26396
26969
|
// src/utils/invoice-hashing.ts
|
|
26397
26970
|
init_buffer();
|
|
@@ -26561,9 +27134,6 @@ function uint64be(value) {
|
|
|
26561
27134
|
}
|
|
26562
27135
|
|
|
26563
27136
|
// src/utils/address.ts
|
|
26564
|
-
var import_uuidv74 = require("uuidv7");
|
|
26565
|
-
var import_utils13 = require("@noble/curves/abstract/utils");
|
|
26566
|
-
var import_wire8 = require("@bufbuild/protobuf/wire");
|
|
26567
27137
|
var BECH32M_LIMIT = 1024;
|
|
26568
27138
|
var AddressNetwork = {
|
|
26569
27139
|
MAINNET: "sp",
|
|
@@ -26578,7 +27148,7 @@ function encodeSparkAddress(payload) {
|
|
|
26578
27148
|
function encodeSparkAddressWithSignature(payload, signature) {
|
|
26579
27149
|
try {
|
|
26580
27150
|
isValidPublicKey(payload.identityPublicKey);
|
|
26581
|
-
const identityPublicKey = (0,
|
|
27151
|
+
const identityPublicKey = (0, import_utils14.hexToBytes)(payload.identityPublicKey);
|
|
26582
27152
|
let sparkInvoiceFields;
|
|
26583
27153
|
if (payload.sparkInvoiceFields) {
|
|
26584
27154
|
validateSparkInvoiceFields(payload.sparkInvoiceFields);
|
|
@@ -26622,8 +27192,8 @@ function decodeSparkAddress(address2, network) {
|
|
|
26622
27192
|
}
|
|
26623
27193
|
const payload = SparkAddress.decode(import_base2.bech32m.fromWords(decoded.words));
|
|
26624
27194
|
const { identityPublicKey, sparkInvoiceFields, signature } = payload;
|
|
26625
|
-
const identityPubkeyHex = (0,
|
|
26626
|
-
const signatureHex = signature ? (0,
|
|
27195
|
+
const identityPubkeyHex = (0, import_utils14.bytesToHex)(identityPublicKey);
|
|
27196
|
+
const signatureHex = signature ? (0, import_utils14.bytesToHex)(signature) : void 0;
|
|
26627
27197
|
isValidPublicKey(identityPubkeyHex);
|
|
26628
27198
|
return {
|
|
26629
27199
|
identityPublicKey: identityPubkeyHex,
|
|
@@ -26633,7 +27203,7 @@ function decodeSparkAddress(address2, network) {
|
|
|
26633
27203
|
id: import_uuidv74.UUID.ofInner(sparkInvoiceFields.id).toString(),
|
|
26634
27204
|
paymentType: sparkInvoiceFields.paymentType ? sparkInvoiceFields.paymentType.$case === "tokensPayment" ? {
|
|
26635
27205
|
type: "tokens",
|
|
26636
|
-
tokenIdentifier: sparkInvoiceFields.paymentType.tokensPayment.tokenIdentifier ? (0,
|
|
27206
|
+
tokenIdentifier: sparkInvoiceFields.paymentType.tokensPayment.tokenIdentifier ? (0, import_utils14.bytesToHex)(
|
|
26637
27207
|
sparkInvoiceFields.paymentType.tokensPayment.tokenIdentifier
|
|
26638
27208
|
) : void 0,
|
|
26639
27209
|
amount: sparkInvoiceFields.paymentType.tokensPayment.amount ? (0, import_utils13.bytesToNumberBE)(
|
|
@@ -26644,7 +27214,7 @@ function decodeSparkAddress(address2, network) {
|
|
|
26644
27214
|
amount: sparkInvoiceFields.paymentType.satsPayment.amount
|
|
26645
27215
|
} : void 0 : void 0,
|
|
26646
27216
|
memo: sparkInvoiceFields.memo,
|
|
26647
|
-
senderPublicKey: sparkInvoiceFields.senderPublicKey ? (0,
|
|
27217
|
+
senderPublicKey: sparkInvoiceFields.senderPublicKey ? (0, import_utils14.bytesToHex)(sparkInvoiceFields.senderPublicKey) : void 0,
|
|
26648
27218
|
expiryTime: sparkInvoiceFields.expiryTime
|
|
26649
27219
|
},
|
|
26650
27220
|
signature: signatureHex
|
|
@@ -26693,7 +27263,7 @@ function isValidSparkAddress(address2) {
|
|
|
26693
27263
|
}
|
|
26694
27264
|
function isValidPublicKey(publicKey) {
|
|
26695
27265
|
try {
|
|
26696
|
-
const point = import_secp256k110.secp256k1.
|
|
27266
|
+
const point = import_secp256k110.secp256k1.Point.fromHex(publicKey);
|
|
26697
27267
|
point.assertValidity();
|
|
26698
27268
|
} catch (error) {
|
|
26699
27269
|
throw new ValidationError(
|
|
@@ -26728,7 +27298,7 @@ function validateSparkInvoiceFields(sparkInvoiceFields) {
|
|
|
26728
27298
|
}
|
|
26729
27299
|
if (senderPublicKey) {
|
|
26730
27300
|
try {
|
|
26731
|
-
isValidPublicKey((0,
|
|
27301
|
+
isValidPublicKey((0, import_utils14.bytesToHex)(senderPublicKey));
|
|
26732
27302
|
} catch (error) {
|
|
26733
27303
|
throw new ValidationError(
|
|
26734
27304
|
"Invalid sender public key",
|
|
@@ -28883,12 +29453,11 @@ function validateTokenTransaction(finalTokenTransaction, partialTokenTransaction
|
|
|
28883
29453
|
|
|
28884
29454
|
// src/utils/token-transactions.ts
|
|
28885
29455
|
init_buffer();
|
|
28886
|
-
var
|
|
28887
|
-
var import_utils15 = require("@scure/btc-signer/utils");
|
|
29456
|
+
var import_utils15 = require("@noble/curves/utils");
|
|
28888
29457
|
function sumAvailableTokens(outputs) {
|
|
28889
29458
|
try {
|
|
28890
29459
|
return outputs.reduce(
|
|
28891
|
-
(sum, output) => sum + BigInt((0,
|
|
29460
|
+
(sum, output) => sum + BigInt((0, import_utils15.bytesToNumberBE)(output.output.tokenAmount)),
|
|
28892
29461
|
BigInt(0)
|
|
28893
29462
|
);
|
|
28894
29463
|
} catch (error) {
|
|
@@ -30000,8 +30569,8 @@ function isTokenTransaction(tokenTransaction) {
|
|
|
30000
30569
|
// src/utils/adaptor-signature.ts
|
|
30001
30570
|
init_buffer();
|
|
30002
30571
|
var import_modular = require("@noble/curves/abstract/modular");
|
|
30003
|
-
var import_utils18 = require("@noble/curves/abstract/utils");
|
|
30004
30572
|
var import_secp256k113 = require("@noble/curves/secp256k1");
|
|
30573
|
+
var import_utils18 = require("@noble/curves/utils");
|
|
30005
30574
|
function generateSignatureFromExistingAdaptor(signature, adaptorPrivateKeyBytes) {
|
|
30006
30575
|
const { r, s: s2 } = parseSignature(signature);
|
|
30007
30576
|
const sBigInt = (0, import_utils18.bytesToNumberBE)(s2);
|
|
@@ -30068,7 +30637,7 @@ function schnorrVerifyWithAdaptor(signature, hash, pubKeyBytes, adaptorPubkey, i
|
|
|
30068
30637
|
const commitmenet = import_secp256k113.schnorr.utils.taggedHash(
|
|
30069
30638
|
"BIP0340/challenge",
|
|
30070
30639
|
r,
|
|
30071
|
-
pubKey.
|
|
30640
|
+
pubKey.toBytes().slice(1),
|
|
30072
30641
|
hash
|
|
30073
30642
|
);
|
|
30074
30643
|
if (commitmenet.length > 32) {
|
|
@@ -30076,22 +30645,20 @@ function schnorrVerifyWithAdaptor(signature, hash, pubKeyBytes, adaptorPubkey, i
|
|
|
30076
30645
|
}
|
|
30077
30646
|
const e = (0, import_modular.mod)((0, import_utils18.bytesToNumberBE)(commitmenet), import_secp256k113.secp256k1.CURVE.n);
|
|
30078
30647
|
const negE = (0, import_modular.mod)(-e, import_secp256k113.secp256k1.CURVE.n);
|
|
30079
|
-
const
|
|
30080
|
-
|
|
30081
|
-
|
|
30082
|
-
|
|
30083
|
-
|
|
30084
|
-
if (!R) {
|
|
30085
|
-
throw new Error("R is undefined");
|
|
30648
|
+
const sG = import_secp256k113.secp256k1.Point.BASE.multiplyUnsafe((0, import_utils18.bytesToNumberBE)(s2));
|
|
30649
|
+
const eP = pubKey.multiplyUnsafe(negE);
|
|
30650
|
+
const R = sG.add(eP);
|
|
30651
|
+
if (R.is0()) {
|
|
30652
|
+
throw new Error("R is zero");
|
|
30086
30653
|
}
|
|
30087
30654
|
R.assertValidity();
|
|
30088
|
-
const adaptorPoint = import_secp256k113.secp256k1.
|
|
30655
|
+
const adaptorPoint = import_secp256k113.secp256k1.Point.fromHex(adaptorPubkey);
|
|
30089
30656
|
const newR = R.add(adaptorPoint);
|
|
30090
|
-
if (!inbound && newR.equals(import_secp256k113.secp256k1.
|
|
30657
|
+
if (!inbound && newR.equals(import_secp256k113.secp256k1.Point.ZERO)) {
|
|
30091
30658
|
throw new Error("calculated R point is the point at infinity");
|
|
30092
30659
|
}
|
|
30093
30660
|
newR.assertValidity();
|
|
30094
|
-
if (
|
|
30661
|
+
if (newR.y % 2n !== 0n) {
|
|
30095
30662
|
throw new Error("calculated R y-value is odd");
|
|
30096
30663
|
}
|
|
30097
30664
|
const rNum = (0, import_utils18.bytesToNumberBE)(r);
|
|
@@ -30139,7 +30706,7 @@ var import_nice_grpc_common3 = require("nice-grpc-common");
|
|
|
30139
30706
|
|
|
30140
30707
|
// src/services/signing.ts
|
|
30141
30708
|
init_buffer();
|
|
30142
|
-
var import_utils19 = require("@noble/curves/
|
|
30709
|
+
var import_utils19 = require("@noble/curves/utils");
|
|
30143
30710
|
var SigningService = class {
|
|
30144
30711
|
config;
|
|
30145
30712
|
constructor(config) {
|
|
@@ -30305,8 +30872,8 @@ var SigningService = class {
|
|
|
30305
30872
|
|
|
30306
30873
|
// src/tests/utils/test-faucet.ts
|
|
30307
30874
|
init_buffer();
|
|
30308
|
-
var import_utils20 = require("@noble/curves/abstract/utils");
|
|
30309
30875
|
var import_secp256k114 = require("@noble/curves/secp256k1");
|
|
30876
|
+
var import_utils20 = require("@noble/curves/utils");
|
|
30310
30877
|
var btc3 = __toESM(require("@scure/btc-signer"), 1);
|
|
30311
30878
|
var import_btc_signer5 = require("@scure/btc-signer");
|
|
30312
30879
|
var import_utils21 = require("@scure/btc-signer/utils");
|
|
@@ -30610,7 +31177,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
|
|
|
30610
31177
|
|
|
30611
31178
|
// src/types/sdk-types.ts
|
|
30612
31179
|
init_buffer();
|
|
30613
|
-
var import_utils22 = require("@noble/curves/
|
|
31180
|
+
var import_utils22 = require("@noble/curves/utils");
|
|
30614
31181
|
function mapTreeNodeToWalletLeaf(proto) {
|
|
30615
31182
|
return {
|
|
30616
31183
|
id: proto.id,
|
|
@@ -30898,7 +31465,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30898
31465
|
setTimeout(maybeUnref, 100);
|
|
30899
31466
|
}
|
|
30900
31467
|
};
|
|
30901
|
-
if (
|
|
31468
|
+
if (import_core13.isNode) {
|
|
30902
31469
|
maybeUnref();
|
|
30903
31470
|
}
|
|
30904
31471
|
const claimedTransfersIds = await this.claimTransfers();
|
|
@@ -31920,7 +32487,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
31920
32487
|
* @returns {Promise<string>} A Bitcoin address for depositing funds
|
|
31921
32488
|
*/
|
|
31922
32489
|
async getSingleUseDepositAddress() {
|
|
31923
|
-
return await this.generateDepositAddress(
|
|
32490
|
+
return await this.generateDepositAddress();
|
|
31924
32491
|
}
|
|
31925
32492
|
/**
|
|
31926
32493
|
* Generates a new static deposit address for receiving bitcoin funds.
|
|
@@ -31929,43 +32496,32 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
31929
32496
|
* @returns {Promise<string>} A Bitcoin address for depositing funds
|
|
31930
32497
|
*/
|
|
31931
32498
|
async getStaticDepositAddress() {
|
|
31932
|
-
|
|
31933
|
-
|
|
31934
|
-
|
|
31935
|
-
|
|
31936
|
-
|
|
31937
|
-
|
|
31938
|
-
|
|
31939
|
-
|
|
31940
|
-
|
|
31941
|
-
}
|
|
31942
|
-
} else {
|
|
31943
|
-
throw error;
|
|
31944
|
-
}
|
|
32499
|
+
const signingPubkey = await this.config.signer.getStaticDepositSigningKey(0);
|
|
32500
|
+
const address2 = await this.depositService.generateStaticDepositAddress({
|
|
32501
|
+
signingPubkey
|
|
32502
|
+
});
|
|
32503
|
+
if (!address2.depositAddress) {
|
|
32504
|
+
throw new RPCError("Failed to generate static deposit address", {
|
|
32505
|
+
method: "generateStaticDepositAddress",
|
|
32506
|
+
params: { signingPubkey }
|
|
32507
|
+
});
|
|
31945
32508
|
}
|
|
32509
|
+
return address2.depositAddress.address;
|
|
31946
32510
|
}
|
|
31947
32511
|
/**
|
|
31948
32512
|
* Generates a deposit address for receiving funds.
|
|
31949
|
-
*
|
|
31950
|
-
* @param {boolean} static - Whether the address is static or single use
|
|
31951
32513
|
* @returns {Promise<string>} A deposit address
|
|
31952
32514
|
* @private
|
|
31953
32515
|
*/
|
|
31954
|
-
async generateDepositAddress(
|
|
32516
|
+
async generateDepositAddress() {
|
|
31955
32517
|
const leafId = (0, import_uuidv75.uuidv7)();
|
|
31956
|
-
|
|
31957
|
-
|
|
31958
|
-
|
|
31959
|
-
}
|
|
31960
|
-
signingPubkey = await this.config.signer.getPublicKeyFromDerivation({
|
|
31961
|
-
type: "leaf" /* LEAF */,
|
|
31962
|
-
path: leafId
|
|
31963
|
-
});
|
|
31964
|
-
}
|
|
32518
|
+
const signingPubkey = await this.config.signer.getPublicKeyFromDerivation({
|
|
32519
|
+
type: "leaf" /* LEAF */,
|
|
32520
|
+
path: leafId
|
|
32521
|
+
});
|
|
31965
32522
|
const address2 = await this.depositService.generateDepositAddress({
|
|
31966
32523
|
signingPubkey,
|
|
31967
|
-
leafId
|
|
31968
|
-
isStatic
|
|
32524
|
+
leafId
|
|
31969
32525
|
});
|
|
31970
32526
|
if (!address2.depositAddress) {
|
|
31971
32527
|
throw new RPCError("Failed to generate deposit address", {
|
|
@@ -31992,7 +32548,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
31992
32548
|
* @param offset - Pagination offset (default 0).
|
|
31993
32549
|
* @returns {Promise<{ txid: string, vout: number }[]>} List of confirmed UTXOs.
|
|
31994
32550
|
*/
|
|
31995
|
-
async getUtxosForDepositAddress(depositAddress, limit = 100, offset = 0) {
|
|
32551
|
+
async getUtxosForDepositAddress(depositAddress, limit = 100, offset = 0, excludeClaimed = false) {
|
|
31996
32552
|
if (!depositAddress) {
|
|
31997
32553
|
throw new ValidationError("Deposit address cannot be empty", {
|
|
31998
32554
|
field: "depositAddress"
|
|
@@ -32006,7 +32562,8 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32006
32562
|
address: depositAddress,
|
|
32007
32563
|
network: NetworkToProto[this.config.getNetwork()],
|
|
32008
32564
|
limit,
|
|
32009
|
-
offset
|
|
32565
|
+
offset,
|
|
32566
|
+
excludeClaimed
|
|
32010
32567
|
});
|
|
32011
32568
|
return response.utxos.map((utxo) => ({
|
|
32012
32569
|
txid: (0, import_utils23.bytesToHex)(utxo.txid),
|
|
@@ -33438,7 +33995,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
33438
33995
|
if (!feeEstimate) {
|
|
33439
33996
|
throw new Error("Failed to get lightning send fee estimate");
|
|
33440
33997
|
}
|
|
33441
|
-
const satsFeeEstimate = (0,
|
|
33998
|
+
const satsFeeEstimate = (0, import_core13.mapCurrencyAmount)(feeEstimate.feeEstimate);
|
|
33442
33999
|
return Math.ceil(satsFeeEstimate.sats);
|
|
33443
34000
|
}
|
|
33444
34001
|
// ***** Cooperative Exit Flow *****
|
|
@@ -34348,7 +34905,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
34348
34905
|
} catch (error) {
|
|
34349
34906
|
if (error instanceof Error) {
|
|
34350
34907
|
error.message += ` [traceId: ${traceId}]`;
|
|
34351
|
-
} else if ((0,
|
|
34908
|
+
} else if ((0, import_core13.isObject)(error)) {
|
|
34352
34909
|
error["traceId"] = traceId;
|
|
34353
34910
|
}
|
|
34354
34911
|
throw error;
|
|
@@ -34424,9 +34981,11 @@ __export(utils_exports, {
|
|
|
34424
34981
|
DIRECT_TIMELOCK_OFFSET: () => DIRECT_TIMELOCK_OFFSET,
|
|
34425
34982
|
INITIAL_DIRECT_SEQUENCE: () => INITIAL_DIRECT_SEQUENCE,
|
|
34426
34983
|
INITIAL_SEQUENCE: () => INITIAL_SEQUENCE,
|
|
34984
|
+
LOGGER_NAMES: () => LOGGER_NAMES,
|
|
34427
34985
|
LRC_WALLET_NETWORK: () => LRC_WALLET_NETWORK,
|
|
34428
34986
|
Network: () => Network2,
|
|
34429
34987
|
NetworkToProto: () => NetworkToProto,
|
|
34988
|
+
SparkSdkLogger: () => SparkSdkLogger,
|
|
34430
34989
|
TEST_UNILATERAL_DIRECT_SEQUENCE: () => TEST_UNILATERAL_DIRECT_SEQUENCE,
|
|
34431
34990
|
TEST_UNILATERAL_SEQUENCE: () => TEST_UNILATERAL_SEQUENCE,
|
|
34432
34991
|
addPrivateKeys: () => addPrivateKeys,
|
|
@@ -34573,7 +35132,7 @@ async function isTxBroadcast(txid, baseUrl, network) {
|
|
|
34573
35132
|
|
|
34574
35133
|
// src/utils/unilateral-exit.ts
|
|
34575
35134
|
init_buffer();
|
|
34576
|
-
var import_utils24 = require("@noble/curves/
|
|
35135
|
+
var import_utils24 = require("@noble/curves/utils");
|
|
34577
35136
|
var import_legacy = require("@noble/hashes/legacy");
|
|
34578
35137
|
var import_sha213 = require("@noble/hashes/sha2");
|
|
34579
35138
|
var btc4 = __toESM(require("@scure/btc-signer"), 1);
|
|
@@ -35071,6 +35630,9 @@ function getSparkAddressFromTaproot(taprootAddress) {
|
|
|
35071
35630
|
throw new ValidationError("Invalid taproot address");
|
|
35072
35631
|
}
|
|
35073
35632
|
|
|
35633
|
+
// src/utils/index.ts
|
|
35634
|
+
init_logging();
|
|
35635
|
+
|
|
35074
35636
|
// src/debug.ts
|
|
35075
35637
|
var s = {
|
|
35076
35638
|
SparkWallet,
|