@buildonspark/spark-sdk 0.2.11 → 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 +8 -0
- package/dist/bare/index.cjs +703 -206
- package/dist/bare/index.d.cts +47 -3
- package/dist/bare/index.d.ts +47 -3
- package/dist/bare/index.js +626 -133
- package/dist/{chunk-A5M55UR3.js → chunk-5VWGOHED.js} +499 -8
- package/dist/{chunk-3WBPICWC.js → chunk-NQMQVXR5.js} +1 -1
- package/dist/{chunk-QNYJGFPD.js → chunk-OEK3R57K.js} +149 -123
- 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 +703 -206
- package/dist/debug.d.cts +4 -4
- package/dist/debug.d.ts +4 -4
- package/dist/debug.js +4 -4
- package/dist/graphql/objects/index.d.cts +3 -3
- package/dist/graphql/objects/index.d.ts +3 -3
- package/dist/index.cjs +725 -228
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +5 -5
- package/dist/index.node.cjs +725 -228
- package/dist/index.node.d.cts +6 -6
- package/dist/index.node.d.ts +6 -6
- package/dist/index.node.js +4 -4
- package/dist/{logging-Bt_WdZbu.d.ts → logging-ClNhGzus.d.ts} +3 -3
- package/dist/{logging-BOAzMqpM.d.cts → logging-D3kvES69.d.cts} +3 -3
- package/dist/native/index.cjs +724 -227
- package/dist/native/index.d.cts +47 -3
- package/dist/native/index.d.ts +47 -3
- package/dist/native/index.js +628 -135
- 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/tests/test-utils.cjs +573 -66
- package/dist/tests/test-utils.d.cts +4 -4
- package/dist/tests/test-utils.d.ts +4 -4
- package/dist/tests/test-utils.js +5 -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/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 +55 -3
- 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/signer/signer.ts +2 -2
- package/src/spark-wallet/spark-wallet.ts +25 -33
- 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/static_deposit.test.ts +122 -1
- 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 +1 -1
- 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 +1 -1
- package/src/utils/address.ts +1 -1
- package/src/utils/bitcoin.ts +1 -5
- package/src/utils/keys.ts +1 -1
- package/src/utils/secret-sharing.ts +1 -1
- 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/native/index.js
CHANGED
|
@@ -130,8 +130,8 @@ var NotImplementedError = class extends SparkSDKError {
|
|
|
130
130
|
|
|
131
131
|
// src/utils/address.ts
|
|
132
132
|
import { BinaryWriter as BinaryWriter5 } from "@bufbuild/protobuf/wire";
|
|
133
|
-
import { bytesToNumberBE } from "@noble/curves/abstract/utils";
|
|
134
133
|
import { schnorr, secp256k1 } from "@noble/curves/secp256k1";
|
|
134
|
+
import { bytesToNumberBE } from "@noble/curves/utils";
|
|
135
135
|
import { bytesToHex as bytesToHex2, hexToBytes } from "@noble/hashes/utils";
|
|
136
136
|
import { bech32m } from "@scure/base";
|
|
137
137
|
import { UUID } from "uuidv7";
|
|
@@ -695,6 +695,41 @@ function utxoSwapRequestTypeToJSON(object) {
|
|
|
695
695
|
return "UNRECOGNIZED";
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
|
+
function invoiceStatusFromJSON(object) {
|
|
699
|
+
switch (object) {
|
|
700
|
+
case 0:
|
|
701
|
+
case "NOT_FOUND":
|
|
702
|
+
return 0 /* NOT_FOUND */;
|
|
703
|
+
case 1:
|
|
704
|
+
case "PENDING":
|
|
705
|
+
return 1 /* PENDING */;
|
|
706
|
+
case 2:
|
|
707
|
+
case "FINALIZED":
|
|
708
|
+
return 2 /* FINALIZED */;
|
|
709
|
+
case 3:
|
|
710
|
+
case "EXPIRED":
|
|
711
|
+
return 3 /* EXPIRED */;
|
|
712
|
+
case -1:
|
|
713
|
+
case "UNRECOGNIZED":
|
|
714
|
+
default:
|
|
715
|
+
return -1 /* UNRECOGNIZED */;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
function invoiceStatusToJSON(object) {
|
|
719
|
+
switch (object) {
|
|
720
|
+
case 0 /* NOT_FOUND */:
|
|
721
|
+
return "NOT_FOUND";
|
|
722
|
+
case 1 /* PENDING */:
|
|
723
|
+
return "PENDING";
|
|
724
|
+
case 2 /* FINALIZED */:
|
|
725
|
+
return "FINALIZED";
|
|
726
|
+
case 3 /* EXPIRED */:
|
|
727
|
+
return "EXPIRED";
|
|
728
|
+
case -1 /* UNRECOGNIZED */:
|
|
729
|
+
default:
|
|
730
|
+
return "UNRECOGNIZED";
|
|
731
|
+
}
|
|
732
|
+
}
|
|
698
733
|
function initiatePreimageSwapRequest_ReasonFromJSON(object) {
|
|
699
734
|
switch (object) {
|
|
700
735
|
case 0:
|
|
@@ -1434,6 +1469,140 @@ var GenerateDepositAddressResponse = {
|
|
|
1434
1469
|
return message;
|
|
1435
1470
|
}
|
|
1436
1471
|
};
|
|
1472
|
+
function createBaseGenerateStaticDepositAddressRequest() {
|
|
1473
|
+
return { signingPublicKey: new Uint8Array(0), identityPublicKey: new Uint8Array(0), network: 0 };
|
|
1474
|
+
}
|
|
1475
|
+
var GenerateStaticDepositAddressRequest = {
|
|
1476
|
+
encode(message, writer = new BinaryWriter4()) {
|
|
1477
|
+
if (message.signingPublicKey.length !== 0) {
|
|
1478
|
+
writer.uint32(10).bytes(message.signingPublicKey);
|
|
1479
|
+
}
|
|
1480
|
+
if (message.identityPublicKey.length !== 0) {
|
|
1481
|
+
writer.uint32(18).bytes(message.identityPublicKey);
|
|
1482
|
+
}
|
|
1483
|
+
if (message.network !== 0) {
|
|
1484
|
+
writer.uint32(24).int32(message.network);
|
|
1485
|
+
}
|
|
1486
|
+
return writer;
|
|
1487
|
+
},
|
|
1488
|
+
decode(input, length) {
|
|
1489
|
+
const reader = input instanceof BinaryReader4 ? input : new BinaryReader4(input);
|
|
1490
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1491
|
+
const message = createBaseGenerateStaticDepositAddressRequest();
|
|
1492
|
+
while (reader.pos < end) {
|
|
1493
|
+
const tag = reader.uint32();
|
|
1494
|
+
switch (tag >>> 3) {
|
|
1495
|
+
case 1: {
|
|
1496
|
+
if (tag !== 10) {
|
|
1497
|
+
break;
|
|
1498
|
+
}
|
|
1499
|
+
message.signingPublicKey = reader.bytes();
|
|
1500
|
+
continue;
|
|
1501
|
+
}
|
|
1502
|
+
case 2: {
|
|
1503
|
+
if (tag !== 18) {
|
|
1504
|
+
break;
|
|
1505
|
+
}
|
|
1506
|
+
message.identityPublicKey = reader.bytes();
|
|
1507
|
+
continue;
|
|
1508
|
+
}
|
|
1509
|
+
case 3: {
|
|
1510
|
+
if (tag !== 24) {
|
|
1511
|
+
break;
|
|
1512
|
+
}
|
|
1513
|
+
message.network = reader.int32();
|
|
1514
|
+
continue;
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1518
|
+
break;
|
|
1519
|
+
}
|
|
1520
|
+
reader.skip(tag & 7);
|
|
1521
|
+
}
|
|
1522
|
+
return message;
|
|
1523
|
+
},
|
|
1524
|
+
fromJSON(object) {
|
|
1525
|
+
return {
|
|
1526
|
+
signingPublicKey: isSet3(object.signingPublicKey) ? bytesFromBase642(object.signingPublicKey) : new Uint8Array(0),
|
|
1527
|
+
identityPublicKey: isSet3(object.identityPublicKey) ? bytesFromBase642(object.identityPublicKey) : new Uint8Array(0),
|
|
1528
|
+
network: isSet3(object.network) ? networkFromJSON(object.network) : 0
|
|
1529
|
+
};
|
|
1530
|
+
},
|
|
1531
|
+
toJSON(message) {
|
|
1532
|
+
const obj = {};
|
|
1533
|
+
if (message.signingPublicKey.length !== 0) {
|
|
1534
|
+
obj.signingPublicKey = base64FromBytes2(message.signingPublicKey);
|
|
1535
|
+
}
|
|
1536
|
+
if (message.identityPublicKey.length !== 0) {
|
|
1537
|
+
obj.identityPublicKey = base64FromBytes2(message.identityPublicKey);
|
|
1538
|
+
}
|
|
1539
|
+
if (message.network !== 0) {
|
|
1540
|
+
obj.network = networkToJSON(message.network);
|
|
1541
|
+
}
|
|
1542
|
+
return obj;
|
|
1543
|
+
},
|
|
1544
|
+
create(base) {
|
|
1545
|
+
return GenerateStaticDepositAddressRequest.fromPartial(base ?? {});
|
|
1546
|
+
},
|
|
1547
|
+
fromPartial(object) {
|
|
1548
|
+
const message = createBaseGenerateStaticDepositAddressRequest();
|
|
1549
|
+
message.signingPublicKey = object.signingPublicKey ?? new Uint8Array(0);
|
|
1550
|
+
message.identityPublicKey = object.identityPublicKey ?? new Uint8Array(0);
|
|
1551
|
+
message.network = object.network ?? 0;
|
|
1552
|
+
return message;
|
|
1553
|
+
}
|
|
1554
|
+
};
|
|
1555
|
+
function createBaseGenerateStaticDepositAddressResponse() {
|
|
1556
|
+
return { depositAddress: void 0 };
|
|
1557
|
+
}
|
|
1558
|
+
var GenerateStaticDepositAddressResponse = {
|
|
1559
|
+
encode(message, writer = new BinaryWriter4()) {
|
|
1560
|
+
if (message.depositAddress !== void 0) {
|
|
1561
|
+
Address.encode(message.depositAddress, writer.uint32(10).fork()).join();
|
|
1562
|
+
}
|
|
1563
|
+
return writer;
|
|
1564
|
+
},
|
|
1565
|
+
decode(input, length) {
|
|
1566
|
+
const reader = input instanceof BinaryReader4 ? input : new BinaryReader4(input);
|
|
1567
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
1568
|
+
const message = createBaseGenerateStaticDepositAddressResponse();
|
|
1569
|
+
while (reader.pos < end) {
|
|
1570
|
+
const tag = reader.uint32();
|
|
1571
|
+
switch (tag >>> 3) {
|
|
1572
|
+
case 1: {
|
|
1573
|
+
if (tag !== 10) {
|
|
1574
|
+
break;
|
|
1575
|
+
}
|
|
1576
|
+
message.depositAddress = Address.decode(reader, reader.uint32());
|
|
1577
|
+
continue;
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1581
|
+
break;
|
|
1582
|
+
}
|
|
1583
|
+
reader.skip(tag & 7);
|
|
1584
|
+
}
|
|
1585
|
+
return message;
|
|
1586
|
+
},
|
|
1587
|
+
fromJSON(object) {
|
|
1588
|
+
return { depositAddress: isSet3(object.depositAddress) ? Address.fromJSON(object.depositAddress) : void 0 };
|
|
1589
|
+
},
|
|
1590
|
+
toJSON(message) {
|
|
1591
|
+
const obj = {};
|
|
1592
|
+
if (message.depositAddress !== void 0) {
|
|
1593
|
+
obj.depositAddress = Address.toJSON(message.depositAddress);
|
|
1594
|
+
}
|
|
1595
|
+
return obj;
|
|
1596
|
+
},
|
|
1597
|
+
create(base) {
|
|
1598
|
+
return GenerateStaticDepositAddressResponse.fromPartial(base ?? {});
|
|
1599
|
+
},
|
|
1600
|
+
fromPartial(object) {
|
|
1601
|
+
const message = createBaseGenerateStaticDepositAddressResponse();
|
|
1602
|
+
message.depositAddress = object.depositAddress !== void 0 && object.depositAddress !== null ? Address.fromPartial(object.depositAddress) : void 0;
|
|
1603
|
+
return message;
|
|
1604
|
+
}
|
|
1605
|
+
};
|
|
1437
1606
|
function createBaseUTXO() {
|
|
1438
1607
|
return { rawTx: new Uint8Array(0), vout: 0, network: 0, txid: new Uint8Array(0) };
|
|
1439
1608
|
}
|
|
@@ -7547,7 +7716,8 @@ function createBaseTransferLeaf() {
|
|
|
7547
7716
|
signature: new Uint8Array(0),
|
|
7548
7717
|
intermediateRefundTx: new Uint8Array(0),
|
|
7549
7718
|
intermediateDirectRefundTx: new Uint8Array(0),
|
|
7550
|
-
intermediateDirectFromCpfpRefundTx: new Uint8Array(0)
|
|
7719
|
+
intermediateDirectFromCpfpRefundTx: new Uint8Array(0),
|
|
7720
|
+
pendingKeyTweakPublicKey: new Uint8Array(0)
|
|
7551
7721
|
};
|
|
7552
7722
|
}
|
|
7553
7723
|
var TransferLeaf = {
|
|
@@ -7570,6 +7740,9 @@ var TransferLeaf = {
|
|
|
7570
7740
|
if (message.intermediateDirectFromCpfpRefundTx.length !== 0) {
|
|
7571
7741
|
writer.uint32(50).bytes(message.intermediateDirectFromCpfpRefundTx);
|
|
7572
7742
|
}
|
|
7743
|
+
if (message.pendingKeyTweakPublicKey.length !== 0) {
|
|
7744
|
+
writer.uint32(58).bytes(message.pendingKeyTweakPublicKey);
|
|
7745
|
+
}
|
|
7573
7746
|
return writer;
|
|
7574
7747
|
},
|
|
7575
7748
|
decode(input, length) {
|
|
@@ -7621,6 +7794,13 @@ var TransferLeaf = {
|
|
|
7621
7794
|
message.intermediateDirectFromCpfpRefundTx = reader.bytes();
|
|
7622
7795
|
continue;
|
|
7623
7796
|
}
|
|
7797
|
+
case 7: {
|
|
7798
|
+
if (tag !== 58) {
|
|
7799
|
+
break;
|
|
7800
|
+
}
|
|
7801
|
+
message.pendingKeyTweakPublicKey = reader.bytes();
|
|
7802
|
+
continue;
|
|
7803
|
+
}
|
|
7624
7804
|
}
|
|
7625
7805
|
if ((tag & 7) === 4 || tag === 0) {
|
|
7626
7806
|
break;
|
|
@@ -7636,7 +7816,8 @@ var TransferLeaf = {
|
|
|
7636
7816
|
signature: isSet3(object.signature) ? bytesFromBase642(object.signature) : new Uint8Array(0),
|
|
7637
7817
|
intermediateRefundTx: isSet3(object.intermediateRefundTx) ? bytesFromBase642(object.intermediateRefundTx) : new Uint8Array(0),
|
|
7638
7818
|
intermediateDirectRefundTx: isSet3(object.intermediateDirectRefundTx) ? bytesFromBase642(object.intermediateDirectRefundTx) : new Uint8Array(0),
|
|
7639
|
-
intermediateDirectFromCpfpRefundTx: isSet3(object.intermediateDirectFromCpfpRefundTx) ? bytesFromBase642(object.intermediateDirectFromCpfpRefundTx) : new Uint8Array(0)
|
|
7819
|
+
intermediateDirectFromCpfpRefundTx: isSet3(object.intermediateDirectFromCpfpRefundTx) ? bytesFromBase642(object.intermediateDirectFromCpfpRefundTx) : new Uint8Array(0),
|
|
7820
|
+
pendingKeyTweakPublicKey: isSet3(object.pendingKeyTweakPublicKey) ? bytesFromBase642(object.pendingKeyTweakPublicKey) : new Uint8Array(0)
|
|
7640
7821
|
};
|
|
7641
7822
|
},
|
|
7642
7823
|
toJSON(message) {
|
|
@@ -7659,6 +7840,9 @@ var TransferLeaf = {
|
|
|
7659
7840
|
if (message.intermediateDirectFromCpfpRefundTx.length !== 0) {
|
|
7660
7841
|
obj.intermediateDirectFromCpfpRefundTx = base64FromBytes2(message.intermediateDirectFromCpfpRefundTx);
|
|
7661
7842
|
}
|
|
7843
|
+
if (message.pendingKeyTweakPublicKey.length !== 0) {
|
|
7844
|
+
obj.pendingKeyTweakPublicKey = base64FromBytes2(message.pendingKeyTweakPublicKey);
|
|
7845
|
+
}
|
|
7662
7846
|
return obj;
|
|
7663
7847
|
},
|
|
7664
7848
|
create(base) {
|
|
@@ -7672,6 +7856,7 @@ var TransferLeaf = {
|
|
|
7672
7856
|
message.intermediateRefundTx = object.intermediateRefundTx ?? new Uint8Array(0);
|
|
7673
7857
|
message.intermediateDirectRefundTx = object.intermediateDirectRefundTx ?? new Uint8Array(0);
|
|
7674
7858
|
message.intermediateDirectFromCpfpRefundTx = object.intermediateDirectFromCpfpRefundTx ?? new Uint8Array(0);
|
|
7859
|
+
message.pendingKeyTweakPublicKey = object.pendingKeyTweakPublicKey ?? new Uint8Array(0);
|
|
7675
7860
|
return message;
|
|
7676
7861
|
}
|
|
7677
7862
|
};
|
|
@@ -10569,13 +10754,16 @@ var QueryUserSignedRefundsRequest = {
|
|
|
10569
10754
|
}
|
|
10570
10755
|
};
|
|
10571
10756
|
function createBaseQueryUserSignedRefundsResponse() {
|
|
10572
|
-
return { userSignedRefunds: [] };
|
|
10757
|
+
return { userSignedRefunds: [], transfer: void 0 };
|
|
10573
10758
|
}
|
|
10574
10759
|
var QueryUserSignedRefundsResponse = {
|
|
10575
10760
|
encode(message, writer = new BinaryWriter4()) {
|
|
10576
10761
|
for (const v of message.userSignedRefunds) {
|
|
10577
10762
|
UserSignedRefund.encode(v, writer.uint32(10).fork()).join();
|
|
10578
10763
|
}
|
|
10764
|
+
if (message.transfer !== void 0) {
|
|
10765
|
+
Transfer.encode(message.transfer, writer.uint32(26).fork()).join();
|
|
10766
|
+
}
|
|
10579
10767
|
return writer;
|
|
10580
10768
|
},
|
|
10581
10769
|
decode(input, length) {
|
|
@@ -10592,6 +10780,13 @@ var QueryUserSignedRefundsResponse = {
|
|
|
10592
10780
|
message.userSignedRefunds.push(UserSignedRefund.decode(reader, reader.uint32()));
|
|
10593
10781
|
continue;
|
|
10594
10782
|
}
|
|
10783
|
+
case 3: {
|
|
10784
|
+
if (tag !== 26) {
|
|
10785
|
+
break;
|
|
10786
|
+
}
|
|
10787
|
+
message.transfer = Transfer.decode(reader, reader.uint32());
|
|
10788
|
+
continue;
|
|
10789
|
+
}
|
|
10595
10790
|
}
|
|
10596
10791
|
if ((tag & 7) === 4 || tag === 0) {
|
|
10597
10792
|
break;
|
|
@@ -10602,7 +10797,8 @@ var QueryUserSignedRefundsResponse = {
|
|
|
10602
10797
|
},
|
|
10603
10798
|
fromJSON(object) {
|
|
10604
10799
|
return {
|
|
10605
|
-
userSignedRefunds: globalThis.Array.isArray(object?.userSignedRefunds) ? object.userSignedRefunds.map((e) => UserSignedRefund.fromJSON(e)) : []
|
|
10800
|
+
userSignedRefunds: globalThis.Array.isArray(object?.userSignedRefunds) ? object.userSignedRefunds.map((e) => UserSignedRefund.fromJSON(e)) : [],
|
|
10801
|
+
transfer: isSet3(object.transfer) ? Transfer.fromJSON(object.transfer) : void 0
|
|
10606
10802
|
};
|
|
10607
10803
|
},
|
|
10608
10804
|
toJSON(message) {
|
|
@@ -10610,6 +10806,9 @@ var QueryUserSignedRefundsResponse = {
|
|
|
10610
10806
|
if (message.userSignedRefunds?.length) {
|
|
10611
10807
|
obj.userSignedRefunds = message.userSignedRefunds.map((e) => UserSignedRefund.toJSON(e));
|
|
10612
10808
|
}
|
|
10809
|
+
if (message.transfer !== void 0) {
|
|
10810
|
+
obj.transfer = Transfer.toJSON(message.transfer);
|
|
10811
|
+
}
|
|
10613
10812
|
return obj;
|
|
10614
10813
|
},
|
|
10615
10814
|
create(base) {
|
|
@@ -10618,6 +10817,7 @@ var QueryUserSignedRefundsResponse = {
|
|
|
10618
10817
|
fromPartial(object) {
|
|
10619
10818
|
const message = createBaseQueryUserSignedRefundsResponse();
|
|
10620
10819
|
message.userSignedRefunds = object.userSignedRefunds?.map((e) => UserSignedRefund.fromPartial(e)) || [];
|
|
10820
|
+
message.transfer = object.transfer !== void 0 && object.transfer !== null ? Transfer.fromPartial(object.transfer) : void 0;
|
|
10621
10821
|
return message;
|
|
10622
10822
|
}
|
|
10623
10823
|
};
|
|
@@ -11504,7 +11704,8 @@ function createBaseDepositAddressQueryResult() {
|
|
|
11504
11704
|
depositAddress: "",
|
|
11505
11705
|
userSigningPublicKey: new Uint8Array(0),
|
|
11506
11706
|
verifyingPublicKey: new Uint8Array(0),
|
|
11507
|
-
leafId: void 0
|
|
11707
|
+
leafId: void 0,
|
|
11708
|
+
proofOfPossession: void 0
|
|
11508
11709
|
};
|
|
11509
11710
|
}
|
|
11510
11711
|
var DepositAddressQueryResult = {
|
|
@@ -11521,6 +11722,9 @@ var DepositAddressQueryResult = {
|
|
|
11521
11722
|
if (message.leafId !== void 0) {
|
|
11522
11723
|
writer.uint32(34).string(message.leafId);
|
|
11523
11724
|
}
|
|
11725
|
+
if (message.proofOfPossession !== void 0) {
|
|
11726
|
+
DepositAddressProof.encode(message.proofOfPossession, writer.uint32(42).fork()).join();
|
|
11727
|
+
}
|
|
11524
11728
|
return writer;
|
|
11525
11729
|
},
|
|
11526
11730
|
decode(input, length) {
|
|
@@ -11558,6 +11762,13 @@ var DepositAddressQueryResult = {
|
|
|
11558
11762
|
message.leafId = reader.string();
|
|
11559
11763
|
continue;
|
|
11560
11764
|
}
|
|
11765
|
+
case 5: {
|
|
11766
|
+
if (tag !== 42) {
|
|
11767
|
+
break;
|
|
11768
|
+
}
|
|
11769
|
+
message.proofOfPossession = DepositAddressProof.decode(reader, reader.uint32());
|
|
11770
|
+
continue;
|
|
11771
|
+
}
|
|
11561
11772
|
}
|
|
11562
11773
|
if ((tag & 7) === 4 || tag === 0) {
|
|
11563
11774
|
break;
|
|
@@ -11571,7 +11782,8 @@ var DepositAddressQueryResult = {
|
|
|
11571
11782
|
depositAddress: isSet3(object.depositAddress) ? globalThis.String(object.depositAddress) : "",
|
|
11572
11783
|
userSigningPublicKey: isSet3(object.userSigningPublicKey) ? bytesFromBase642(object.userSigningPublicKey) : new Uint8Array(0),
|
|
11573
11784
|
verifyingPublicKey: isSet3(object.verifyingPublicKey) ? bytesFromBase642(object.verifyingPublicKey) : new Uint8Array(0),
|
|
11574
|
-
leafId: isSet3(object.leafId) ? globalThis.String(object.leafId) : void 0
|
|
11785
|
+
leafId: isSet3(object.leafId) ? globalThis.String(object.leafId) : void 0,
|
|
11786
|
+
proofOfPossession: isSet3(object.proofOfPossession) ? DepositAddressProof.fromJSON(object.proofOfPossession) : void 0
|
|
11575
11787
|
};
|
|
11576
11788
|
},
|
|
11577
11789
|
toJSON(message) {
|
|
@@ -11588,6 +11800,9 @@ var DepositAddressQueryResult = {
|
|
|
11588
11800
|
if (message.leafId !== void 0) {
|
|
11589
11801
|
obj.leafId = message.leafId;
|
|
11590
11802
|
}
|
|
11803
|
+
if (message.proofOfPossession !== void 0) {
|
|
11804
|
+
obj.proofOfPossession = DepositAddressProof.toJSON(message.proofOfPossession);
|
|
11805
|
+
}
|
|
11591
11806
|
return obj;
|
|
11592
11807
|
},
|
|
11593
11808
|
create(base) {
|
|
@@ -11599,6 +11814,7 @@ var DepositAddressQueryResult = {
|
|
|
11599
11814
|
message.userSigningPublicKey = object.userSigningPublicKey ?? new Uint8Array(0);
|
|
11600
11815
|
message.verifyingPublicKey = object.verifyingPublicKey ?? new Uint8Array(0);
|
|
11601
11816
|
message.leafId = object.leafId ?? void 0;
|
|
11817
|
+
message.proofOfPossession = object.proofOfPossession !== void 0 && object.proofOfPossession !== null ? DepositAddressProof.fromPartial(object.proofOfPossession) : void 0;
|
|
11602
11818
|
return message;
|
|
11603
11819
|
}
|
|
11604
11820
|
};
|
|
@@ -13563,7 +13779,7 @@ var QueryNodesByValueResponse_NodesEntry = {
|
|
|
13563
13779
|
}
|
|
13564
13780
|
};
|
|
13565
13781
|
function createBaseGetUtxosForAddressRequest() {
|
|
13566
|
-
return { address: "", offset: 0, limit: 0, network: 0 };
|
|
13782
|
+
return { address: "", offset: 0, limit: 0, network: 0, excludeClaimed: false };
|
|
13567
13783
|
}
|
|
13568
13784
|
var GetUtxosForAddressRequest = {
|
|
13569
13785
|
encode(message, writer = new BinaryWriter4()) {
|
|
@@ -13579,6 +13795,9 @@ var GetUtxosForAddressRequest = {
|
|
|
13579
13795
|
if (message.network !== 0) {
|
|
13580
13796
|
writer.uint32(32).int32(message.network);
|
|
13581
13797
|
}
|
|
13798
|
+
if (message.excludeClaimed !== false) {
|
|
13799
|
+
writer.uint32(40).bool(message.excludeClaimed);
|
|
13800
|
+
}
|
|
13582
13801
|
return writer;
|
|
13583
13802
|
},
|
|
13584
13803
|
decode(input, length) {
|
|
@@ -13616,6 +13835,13 @@ var GetUtxosForAddressRequest = {
|
|
|
13616
13835
|
message.network = reader.int32();
|
|
13617
13836
|
continue;
|
|
13618
13837
|
}
|
|
13838
|
+
case 5: {
|
|
13839
|
+
if (tag !== 40) {
|
|
13840
|
+
break;
|
|
13841
|
+
}
|
|
13842
|
+
message.excludeClaimed = reader.bool();
|
|
13843
|
+
continue;
|
|
13844
|
+
}
|
|
13619
13845
|
}
|
|
13620
13846
|
if ((tag & 7) === 4 || tag === 0) {
|
|
13621
13847
|
break;
|
|
@@ -13629,7 +13855,8 @@ var GetUtxosForAddressRequest = {
|
|
|
13629
13855
|
address: isSet3(object.address) ? globalThis.String(object.address) : "",
|
|
13630
13856
|
offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0,
|
|
13631
13857
|
limit: isSet3(object.limit) ? globalThis.Number(object.limit) : 0,
|
|
13632
|
-
network: isSet3(object.network) ? networkFromJSON(object.network) : 0
|
|
13858
|
+
network: isSet3(object.network) ? networkFromJSON(object.network) : 0,
|
|
13859
|
+
excludeClaimed: isSet3(object.excludeClaimed) ? globalThis.Boolean(object.excludeClaimed) : false
|
|
13633
13860
|
};
|
|
13634
13861
|
},
|
|
13635
13862
|
toJSON(message) {
|
|
@@ -13646,6 +13873,9 @@ var GetUtxosForAddressRequest = {
|
|
|
13646
13873
|
if (message.network !== 0) {
|
|
13647
13874
|
obj.network = networkToJSON(message.network);
|
|
13648
13875
|
}
|
|
13876
|
+
if (message.excludeClaimed !== false) {
|
|
13877
|
+
obj.excludeClaimed = message.excludeClaimed;
|
|
13878
|
+
}
|
|
13649
13879
|
return obj;
|
|
13650
13880
|
},
|
|
13651
13881
|
create(base) {
|
|
@@ -13657,6 +13887,7 @@ var GetUtxosForAddressRequest = {
|
|
|
13657
13887
|
message.offset = object.offset ?? 0;
|
|
13658
13888
|
message.limit = object.limit ?? 0;
|
|
13659
13889
|
message.network = object.network ?? 0;
|
|
13890
|
+
message.excludeClaimed = object.excludeClaimed ?? false;
|
|
13660
13891
|
return message;
|
|
13661
13892
|
}
|
|
13662
13893
|
};
|
|
@@ -13728,6 +13959,225 @@ var GetUtxosForAddressResponse = {
|
|
|
13728
13959
|
return message;
|
|
13729
13960
|
}
|
|
13730
13961
|
};
|
|
13962
|
+
function createBaseQuerySparkInvoicesRequest() {
|
|
13963
|
+
return { limit: 0, offset: 0, invoice: [] };
|
|
13964
|
+
}
|
|
13965
|
+
var QuerySparkInvoicesRequest = {
|
|
13966
|
+
encode(message, writer = new BinaryWriter4()) {
|
|
13967
|
+
if (message.limit !== 0) {
|
|
13968
|
+
writer.uint32(8).int64(message.limit);
|
|
13969
|
+
}
|
|
13970
|
+
if (message.offset !== 0) {
|
|
13971
|
+
writer.uint32(16).int64(message.offset);
|
|
13972
|
+
}
|
|
13973
|
+
for (const v of message.invoice) {
|
|
13974
|
+
writer.uint32(26).string(v);
|
|
13975
|
+
}
|
|
13976
|
+
return writer;
|
|
13977
|
+
},
|
|
13978
|
+
decode(input, length) {
|
|
13979
|
+
const reader = input instanceof BinaryReader4 ? input : new BinaryReader4(input);
|
|
13980
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
13981
|
+
const message = createBaseQuerySparkInvoicesRequest();
|
|
13982
|
+
while (reader.pos < end) {
|
|
13983
|
+
const tag = reader.uint32();
|
|
13984
|
+
switch (tag >>> 3) {
|
|
13985
|
+
case 1: {
|
|
13986
|
+
if (tag !== 8) {
|
|
13987
|
+
break;
|
|
13988
|
+
}
|
|
13989
|
+
message.limit = longToNumber2(reader.int64());
|
|
13990
|
+
continue;
|
|
13991
|
+
}
|
|
13992
|
+
case 2: {
|
|
13993
|
+
if (tag !== 16) {
|
|
13994
|
+
break;
|
|
13995
|
+
}
|
|
13996
|
+
message.offset = longToNumber2(reader.int64());
|
|
13997
|
+
continue;
|
|
13998
|
+
}
|
|
13999
|
+
case 3: {
|
|
14000
|
+
if (tag !== 26) {
|
|
14001
|
+
break;
|
|
14002
|
+
}
|
|
14003
|
+
message.invoice.push(reader.string());
|
|
14004
|
+
continue;
|
|
14005
|
+
}
|
|
14006
|
+
}
|
|
14007
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
14008
|
+
break;
|
|
14009
|
+
}
|
|
14010
|
+
reader.skip(tag & 7);
|
|
14011
|
+
}
|
|
14012
|
+
return message;
|
|
14013
|
+
},
|
|
14014
|
+
fromJSON(object) {
|
|
14015
|
+
return {
|
|
14016
|
+
limit: isSet3(object.limit) ? globalThis.Number(object.limit) : 0,
|
|
14017
|
+
offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0,
|
|
14018
|
+
invoice: globalThis.Array.isArray(object?.invoice) ? object.invoice.map((e) => globalThis.String(e)) : []
|
|
14019
|
+
};
|
|
14020
|
+
},
|
|
14021
|
+
toJSON(message) {
|
|
14022
|
+
const obj = {};
|
|
14023
|
+
if (message.limit !== 0) {
|
|
14024
|
+
obj.limit = Math.round(message.limit);
|
|
14025
|
+
}
|
|
14026
|
+
if (message.offset !== 0) {
|
|
14027
|
+
obj.offset = Math.round(message.offset);
|
|
14028
|
+
}
|
|
14029
|
+
if (message.invoice?.length) {
|
|
14030
|
+
obj.invoice = message.invoice;
|
|
14031
|
+
}
|
|
14032
|
+
return obj;
|
|
14033
|
+
},
|
|
14034
|
+
create(base) {
|
|
14035
|
+
return QuerySparkInvoicesRequest.fromPartial(base ?? {});
|
|
14036
|
+
},
|
|
14037
|
+
fromPartial(object) {
|
|
14038
|
+
const message = createBaseQuerySparkInvoicesRequest();
|
|
14039
|
+
message.limit = object.limit ?? 0;
|
|
14040
|
+
message.offset = object.offset ?? 0;
|
|
14041
|
+
message.invoice = object.invoice?.map((e) => e) || [];
|
|
14042
|
+
return message;
|
|
14043
|
+
}
|
|
14044
|
+
};
|
|
14045
|
+
function createBaseQuerySparkInvoicesResponse() {
|
|
14046
|
+
return { offset: 0, invoiceStatuses: [] };
|
|
14047
|
+
}
|
|
14048
|
+
var QuerySparkInvoicesResponse = {
|
|
14049
|
+
encode(message, writer = new BinaryWriter4()) {
|
|
14050
|
+
if (message.offset !== 0) {
|
|
14051
|
+
writer.uint32(8).int64(message.offset);
|
|
14052
|
+
}
|
|
14053
|
+
for (const v of message.invoiceStatuses) {
|
|
14054
|
+
InvoiceResponse.encode(v, writer.uint32(18).fork()).join();
|
|
14055
|
+
}
|
|
14056
|
+
return writer;
|
|
14057
|
+
},
|
|
14058
|
+
decode(input, length) {
|
|
14059
|
+
const reader = input instanceof BinaryReader4 ? input : new BinaryReader4(input);
|
|
14060
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
14061
|
+
const message = createBaseQuerySparkInvoicesResponse();
|
|
14062
|
+
while (reader.pos < end) {
|
|
14063
|
+
const tag = reader.uint32();
|
|
14064
|
+
switch (tag >>> 3) {
|
|
14065
|
+
case 1: {
|
|
14066
|
+
if (tag !== 8) {
|
|
14067
|
+
break;
|
|
14068
|
+
}
|
|
14069
|
+
message.offset = longToNumber2(reader.int64());
|
|
14070
|
+
continue;
|
|
14071
|
+
}
|
|
14072
|
+
case 2: {
|
|
14073
|
+
if (tag !== 18) {
|
|
14074
|
+
break;
|
|
14075
|
+
}
|
|
14076
|
+
message.invoiceStatuses.push(InvoiceResponse.decode(reader, reader.uint32()));
|
|
14077
|
+
continue;
|
|
14078
|
+
}
|
|
14079
|
+
}
|
|
14080
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
14081
|
+
break;
|
|
14082
|
+
}
|
|
14083
|
+
reader.skip(tag & 7);
|
|
14084
|
+
}
|
|
14085
|
+
return message;
|
|
14086
|
+
},
|
|
14087
|
+
fromJSON(object) {
|
|
14088
|
+
return {
|
|
14089
|
+
offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0,
|
|
14090
|
+
invoiceStatuses: globalThis.Array.isArray(object?.invoiceStatuses) ? object.invoiceStatuses.map((e) => InvoiceResponse.fromJSON(e)) : []
|
|
14091
|
+
};
|
|
14092
|
+
},
|
|
14093
|
+
toJSON(message) {
|
|
14094
|
+
const obj = {};
|
|
14095
|
+
if (message.offset !== 0) {
|
|
14096
|
+
obj.offset = Math.round(message.offset);
|
|
14097
|
+
}
|
|
14098
|
+
if (message.invoiceStatuses?.length) {
|
|
14099
|
+
obj.invoiceStatuses = message.invoiceStatuses.map((e) => InvoiceResponse.toJSON(e));
|
|
14100
|
+
}
|
|
14101
|
+
return obj;
|
|
14102
|
+
},
|
|
14103
|
+
create(base) {
|
|
14104
|
+
return QuerySparkInvoicesResponse.fromPartial(base ?? {});
|
|
14105
|
+
},
|
|
14106
|
+
fromPartial(object) {
|
|
14107
|
+
const message = createBaseQuerySparkInvoicesResponse();
|
|
14108
|
+
message.offset = object.offset ?? 0;
|
|
14109
|
+
message.invoiceStatuses = object.invoiceStatuses?.map((e) => InvoiceResponse.fromPartial(e)) || [];
|
|
14110
|
+
return message;
|
|
14111
|
+
}
|
|
14112
|
+
};
|
|
14113
|
+
function createBaseInvoiceResponse() {
|
|
14114
|
+
return { invoice: "", status: 0 };
|
|
14115
|
+
}
|
|
14116
|
+
var InvoiceResponse = {
|
|
14117
|
+
encode(message, writer = new BinaryWriter4()) {
|
|
14118
|
+
if (message.invoice !== "") {
|
|
14119
|
+
writer.uint32(10).string(message.invoice);
|
|
14120
|
+
}
|
|
14121
|
+
if (message.status !== 0) {
|
|
14122
|
+
writer.uint32(16).int32(message.status);
|
|
14123
|
+
}
|
|
14124
|
+
return writer;
|
|
14125
|
+
},
|
|
14126
|
+
decode(input, length) {
|
|
14127
|
+
const reader = input instanceof BinaryReader4 ? input : new BinaryReader4(input);
|
|
14128
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
14129
|
+
const message = createBaseInvoiceResponse();
|
|
14130
|
+
while (reader.pos < end) {
|
|
14131
|
+
const tag = reader.uint32();
|
|
14132
|
+
switch (tag >>> 3) {
|
|
14133
|
+
case 1: {
|
|
14134
|
+
if (tag !== 10) {
|
|
14135
|
+
break;
|
|
14136
|
+
}
|
|
14137
|
+
message.invoice = reader.string();
|
|
14138
|
+
continue;
|
|
14139
|
+
}
|
|
14140
|
+
case 2: {
|
|
14141
|
+
if (tag !== 16) {
|
|
14142
|
+
break;
|
|
14143
|
+
}
|
|
14144
|
+
message.status = reader.int32();
|
|
14145
|
+
continue;
|
|
14146
|
+
}
|
|
14147
|
+
}
|
|
14148
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
14149
|
+
break;
|
|
14150
|
+
}
|
|
14151
|
+
reader.skip(tag & 7);
|
|
14152
|
+
}
|
|
14153
|
+
return message;
|
|
14154
|
+
},
|
|
14155
|
+
fromJSON(object) {
|
|
14156
|
+
return {
|
|
14157
|
+
invoice: isSet3(object.invoice) ? globalThis.String(object.invoice) : "",
|
|
14158
|
+
status: isSet3(object.status) ? invoiceStatusFromJSON(object.status) : 0
|
|
14159
|
+
};
|
|
14160
|
+
},
|
|
14161
|
+
toJSON(message) {
|
|
14162
|
+
const obj = {};
|
|
14163
|
+
if (message.invoice !== "") {
|
|
14164
|
+
obj.invoice = message.invoice;
|
|
14165
|
+
}
|
|
14166
|
+
if (message.status !== 0) {
|
|
14167
|
+
obj.status = invoiceStatusToJSON(message.status);
|
|
14168
|
+
}
|
|
14169
|
+
return obj;
|
|
14170
|
+
},
|
|
14171
|
+
create(base) {
|
|
14172
|
+
return InvoiceResponse.fromPartial(base ?? {});
|
|
14173
|
+
},
|
|
14174
|
+
fromPartial(object) {
|
|
14175
|
+
const message = createBaseInvoiceResponse();
|
|
14176
|
+
message.invoice = object.invoice ?? "";
|
|
14177
|
+
message.status = object.status ?? 0;
|
|
14178
|
+
return message;
|
|
14179
|
+
}
|
|
14180
|
+
};
|
|
13731
14181
|
var SparkServiceDefinition = {
|
|
13732
14182
|
name: "SparkService",
|
|
13733
14183
|
fullName: "spark.SparkService",
|
|
@@ -13740,6 +14190,15 @@ var SparkServiceDefinition = {
|
|
|
13740
14190
|
responseStream: false,
|
|
13741
14191
|
options: {}
|
|
13742
14192
|
},
|
|
14193
|
+
/** Generates a new static deposit address of the user or returns the existing one for the specified network. */
|
|
14194
|
+
generate_static_deposit_address: {
|
|
14195
|
+
name: "generate_static_deposit_address",
|
|
14196
|
+
requestType: GenerateStaticDepositAddressRequest,
|
|
14197
|
+
requestStream: false,
|
|
14198
|
+
responseType: GenerateStaticDepositAddressResponse,
|
|
14199
|
+
responseStream: false,
|
|
14200
|
+
options: {}
|
|
14201
|
+
},
|
|
13743
14202
|
start_deposit_tree_creation: {
|
|
13744
14203
|
name: "start_deposit_tree_creation",
|
|
13745
14204
|
requestType: StartDepositTreeCreationRequest,
|
|
@@ -14181,6 +14640,14 @@ var SparkServiceDefinition = {
|
|
|
14181
14640
|
responseType: GetUtxosForAddressResponse,
|
|
14182
14641
|
responseStream: false,
|
|
14183
14642
|
options: {}
|
|
14643
|
+
},
|
|
14644
|
+
query_spark_invoices: {
|
|
14645
|
+
name: "query_spark_invoices",
|
|
14646
|
+
requestType: QuerySparkInvoicesRequest,
|
|
14647
|
+
requestStream: false,
|
|
14648
|
+
responseType: QuerySparkInvoicesResponse,
|
|
14649
|
+
responseStream: false,
|
|
14650
|
+
options: {}
|
|
14184
14651
|
}
|
|
14185
14652
|
}
|
|
14186
14653
|
};
|
|
@@ -14768,8 +15235,8 @@ function encodeSparkInvoiceFieldsV1Canonical(f) {
|
|
|
14768
15235
|
|
|
14769
15236
|
// src/utils/adaptor-signature.ts
|
|
14770
15237
|
import { mod } from "@noble/curves/abstract/modular";
|
|
14771
|
-
import { bytesToNumberBE as bytesToNumberBE2, numberToBytesBE } from "@noble/curves/abstract/utils";
|
|
14772
15238
|
import { schnorr as schnorr2, secp256k1 as secp256k12 } from "@noble/curves/secp256k1";
|
|
15239
|
+
import { bytesToNumberBE as bytesToNumberBE2, numberToBytesBE } from "@noble/curves/utils";
|
|
14773
15240
|
function generateSignatureFromExistingAdaptor(signature, adaptorPrivateKeyBytes) {
|
|
14774
15241
|
const { r, s } = parseSignature(signature);
|
|
14775
15242
|
const sBigInt = bytesToNumberBE2(s);
|
|
@@ -14897,12 +15364,8 @@ function parseSignature(signature) {
|
|
|
14897
15364
|
}
|
|
14898
15365
|
|
|
14899
15366
|
// src/utils/bitcoin.ts
|
|
14900
|
-
import {
|
|
14901
|
-
bytesToHex as bytesToHex3,
|
|
14902
|
-
bytesToNumberBE as bytesToNumberBE3,
|
|
14903
|
-
hexToBytes as hexToBytes2
|
|
14904
|
-
} from "@noble/curves/abstract/utils";
|
|
14905
15367
|
import { schnorr as schnorr3, secp256k1 as secp256k13 } from "@noble/curves/secp256k1";
|
|
15368
|
+
import { bytesToHex as bytesToHex3, bytesToNumberBE as bytesToNumberBE3, hexToBytes as hexToBytes2 } from "@noble/curves/utils";
|
|
14906
15369
|
import { sha256 as sha2562 } from "@noble/hashes/sha2";
|
|
14907
15370
|
import * as btc2 from "@scure/btc-signer";
|
|
14908
15371
|
|
|
@@ -15144,8 +15607,8 @@ function getTxEstimatedVbytesSizeByNumberOfInputsOutputs(numInputs, numOutputs)
|
|
|
15144
15607
|
}
|
|
15145
15608
|
|
|
15146
15609
|
// src/utils/keys.ts
|
|
15147
|
-
import { numberToBytesBE as numberToBytesBE2 } from "@noble/curves/abstract/utils";
|
|
15148
15610
|
import { secp256k1 as secp256k14 } from "@noble/curves/secp256k1";
|
|
15611
|
+
import { numberToBytesBE as numberToBytesBE2 } from "@noble/curves/utils";
|
|
15149
15612
|
function addPublicKeys(a, b) {
|
|
15150
15613
|
if (a.length !== 33 || b.length !== 33) {
|
|
15151
15614
|
throw new ValidationError("Public keys must be 33 bytes", {
|
|
@@ -16350,7 +16813,7 @@ fragment UserRequestFragment on UserRequest {
|
|
|
16350
16813
|
}`;
|
|
16351
16814
|
|
|
16352
16815
|
// src/types/sdk-types.ts
|
|
16353
|
-
import { bytesToHex as bytesToHex4 } from "@noble/curves/
|
|
16816
|
+
import { bytesToHex as bytesToHex4 } from "@noble/curves/utils";
|
|
16354
16817
|
function mapTreeNodeToWalletLeaf(proto) {
|
|
16355
16818
|
return {
|
|
16356
16819
|
id: proto.id,
|
|
@@ -16497,8 +16960,8 @@ function collectResponses(responses) {
|
|
|
16497
16960
|
}
|
|
16498
16961
|
|
|
16499
16962
|
// src/utils/secret-sharing.ts
|
|
16500
|
-
import { bytesToHex as bytesToHex5, equalBytes } from "@noble/curves/abstract/utils";
|
|
16501
16963
|
import { secp256k1 as secp256k15 } from "@noble/curves/secp256k1";
|
|
16964
|
+
import { bytesToHex as bytesToHex5, equalBytes } from "@noble/curves/utils";
|
|
16502
16965
|
function getRandomBigInt(max) {
|
|
16503
16966
|
const byteLength = max.toString(2).length + 7 >> 3;
|
|
16504
16967
|
const maxBigInt = max;
|
|
@@ -16880,8 +17343,7 @@ function getNetworkFromBech32mTokenIdentifier(bech32mTokenIdentifier) {
|
|
|
16880
17343
|
}
|
|
16881
17344
|
|
|
16882
17345
|
// src/utils/token-transactions.ts
|
|
16883
|
-
import { bytesToNumberBE as bytesToNumberBE4 } from "@noble/curves/
|
|
16884
|
-
import { equalBytes as equalBytes2 } from "@scure/btc-signer/utils";
|
|
17346
|
+
import { bytesToNumberBE as bytesToNumberBE4, equalBytes as equalBytes2 } from "@noble/curves/utils";
|
|
16885
17347
|
function sumAvailableTokens(outputs) {
|
|
16886
17348
|
try {
|
|
16887
17349
|
return outputs.reduce(
|
|
@@ -16929,7 +17391,7 @@ function filterTokenBalanceForTokenIdentifier(tokenBalances, tokenIdentifier) {
|
|
|
16929
17391
|
}
|
|
16930
17392
|
|
|
16931
17393
|
// src/utils/transfer_package.ts
|
|
16932
|
-
import { hexToBytes as hexToBytes3 } from "@noble/curves/
|
|
17394
|
+
import { hexToBytes as hexToBytes3 } from "@noble/curves/utils";
|
|
16933
17395
|
import { sha256 as sha2564 } from "@noble/hashes/sha2";
|
|
16934
17396
|
function getTransferPackageSigningPayload(transferID, transferPackage) {
|
|
16935
17397
|
const encryptedPayload = transferPackage.keyTweakPackage;
|
|
@@ -17289,7 +17751,7 @@ function getEphemeralAnchorOutput() {
|
|
|
17289
17751
|
}
|
|
17290
17752
|
|
|
17291
17753
|
// src/utils/unilateral-exit.ts
|
|
17292
|
-
import { bytesToHex as
|
|
17754
|
+
import { bytesToHex as bytesToHex6, hexToBytes as hexToBytes4 } from "@noble/curves/utils";
|
|
17293
17755
|
import { ripemd160 } from "@noble/hashes/legacy";
|
|
17294
17756
|
import { sha256 as sha2565 } from "@noble/hashes/sha2";
|
|
17295
17757
|
import * as btc3 from "@scure/btc-signer";
|
|
@@ -17360,10 +17822,10 @@ async function constructUnilateralExitTxs(nodeHexStrings, sparkClient, network)
|
|
|
17360
17822
|
}
|
|
17361
17823
|
}
|
|
17362
17824
|
for (const chainNode of chain) {
|
|
17363
|
-
const nodeTx =
|
|
17825
|
+
const nodeTx = bytesToHex6(chainNode.nodeTx);
|
|
17364
17826
|
transactions.push(nodeTx);
|
|
17365
17827
|
if (chainNode.id === node.id) {
|
|
17366
|
-
const refundTx =
|
|
17828
|
+
const refundTx = bytesToHex6(chainNode.refundTx);
|
|
17367
17829
|
transactions.push(refundTx);
|
|
17368
17830
|
}
|
|
17369
17831
|
}
|
|
@@ -17469,7 +17931,7 @@ async function constructUnilateralExitFeeBumpPackages(nodeHexStrings, utxos, fee
|
|
|
17469
17931
|
}
|
|
17470
17932
|
}
|
|
17471
17933
|
for (const chainNode of chain) {
|
|
17472
|
-
let nodeTxHex =
|
|
17934
|
+
let nodeTxHex = bytesToHex6(chainNode.nodeTx);
|
|
17473
17935
|
try {
|
|
17474
17936
|
const txObj = getTxFromRawTxHex(nodeTxHex);
|
|
17475
17937
|
const txid = getTxId(txObj);
|
|
@@ -17486,7 +17948,7 @@ async function constructUnilateralExitFeeBumpPackages(nodeHexStrings, utxos, fee
|
|
|
17486
17948
|
for (let i = txObj.outputsLength - 1; i >= 0; i--) {
|
|
17487
17949
|
const output = txObj.getOutput(i);
|
|
17488
17950
|
if (output?.amount === 0n && output.script) {
|
|
17489
|
-
anchorOutputScriptHex =
|
|
17951
|
+
anchorOutputScriptHex = bytesToHex6(output.script);
|
|
17490
17952
|
break;
|
|
17491
17953
|
}
|
|
17492
17954
|
}
|
|
@@ -17511,7 +17973,7 @@ async function constructUnilateralExitFeeBumpPackages(nodeHexStrings, utxos, fee
|
|
|
17511
17973
|
var feeBumpOut = feeBumpTx.outputsLength === 1 ? feeBumpTx.getOutput(0) : null;
|
|
17512
17974
|
var feeBumpOutPubKey = null;
|
|
17513
17975
|
for (const usedUtxo of usedUtxos) {
|
|
17514
|
-
if (feeBumpOut &&
|
|
17976
|
+
if (feeBumpOut && bytesToHex6(feeBumpOut.script) == usedUtxo.script) {
|
|
17515
17977
|
feeBumpOutPubKey = usedUtxo.publicKey;
|
|
17516
17978
|
}
|
|
17517
17979
|
const index = availableUtxos.findIndex(
|
|
@@ -17526,20 +17988,20 @@ async function constructUnilateralExitFeeBumpPackages(nodeHexStrings, utxos, fee
|
|
|
17526
17988
|
txid: getTxId(feeBumpTx),
|
|
17527
17989
|
vout: 0,
|
|
17528
17990
|
value: feeBumpOut.amount,
|
|
17529
|
-
script:
|
|
17991
|
+
script: bytesToHex6(feeBumpOut.script),
|
|
17530
17992
|
publicKey: feeBumpOutPubKey
|
|
17531
17993
|
});
|
|
17532
17994
|
const finalNodeTx = correctedParentTx || nodeTxHex;
|
|
17533
17995
|
txPackages.push({ tx: finalNodeTx, feeBumpPsbt: nodeFeeBumpPsbt });
|
|
17534
17996
|
if (chainNode.id === node.id) {
|
|
17535
|
-
let refundTxHex =
|
|
17997
|
+
let refundTxHex = bytesToHex6(chainNode.refundTx);
|
|
17536
17998
|
try {
|
|
17537
17999
|
const txObj = getTxFromRawTxHex(refundTxHex);
|
|
17538
18000
|
let anchorOutputScriptHex;
|
|
17539
18001
|
for (let i = txObj.outputsLength - 1; i >= 0; i--) {
|
|
17540
18002
|
const output = txObj.getOutput(i);
|
|
17541
18003
|
if (output?.amount === 0n && output.script) {
|
|
17542
|
-
anchorOutputScriptHex =
|
|
18004
|
+
anchorOutputScriptHex = bytesToHex6(output.script);
|
|
17543
18005
|
break;
|
|
17544
18006
|
}
|
|
17545
18007
|
}
|
|
@@ -17567,7 +18029,7 @@ async function constructUnilateralExitFeeBumpPackages(nodeHexStrings, utxos, fee
|
|
|
17567
18029
|
var feeBumpOut = feeBumpTx2.outputsLength === 1 ? feeBumpTx2.getOutput(0) : null;
|
|
17568
18030
|
var feeBumpOutPubKey = null;
|
|
17569
18031
|
for (const usedUtxo of usedUtxos) {
|
|
17570
|
-
if (feeBumpOut &&
|
|
18032
|
+
if (feeBumpOut && bytesToHex6(feeBumpOut.script) == usedUtxo.script) {
|
|
17571
18033
|
feeBumpOutPubKey = usedUtxo.publicKey;
|
|
17572
18034
|
}
|
|
17573
18035
|
const index = availableUtxos.findIndex(
|
|
@@ -17582,7 +18044,7 @@ async function constructUnilateralExitFeeBumpPackages(nodeHexStrings, utxos, fee
|
|
|
17582
18044
|
txid: getTxId(feeBumpTx2),
|
|
17583
18045
|
vout: 0,
|
|
17584
18046
|
value: feeBumpOut.amount,
|
|
17585
|
-
script:
|
|
18047
|
+
script: bytesToHex6(feeBumpOut.script),
|
|
17586
18048
|
publicKey: feeBumpOutPubKey
|
|
17587
18049
|
});
|
|
17588
18050
|
txPackages.push({
|
|
@@ -17680,7 +18142,7 @@ function constructFeeBumpTx(txHex, utxos, feeRate, previousFeeBumpTx) {
|
|
|
17680
18142
|
const pubKeyHash = hash160(hexToBytes4(fundingUtxo.publicKey));
|
|
17681
18143
|
const scriptToUse = new Uint8Array([0, 20, ...pubKeyHash]);
|
|
17682
18144
|
const providedScript = hexToBytes4(fundingUtxo.script);
|
|
17683
|
-
if (
|
|
18145
|
+
if (bytesToHex6(scriptToUse) !== bytesToHex6(providedScript)) {
|
|
17684
18146
|
throw new Error(
|
|
17685
18147
|
`\u274C Derived script doesn't match provided script for UTXO ${i + 1}.`
|
|
17686
18148
|
);
|
|
@@ -17745,7 +18207,7 @@ function constructFeeBumpTx(txHex, utxos, feeRate, previousFeeBumpTx) {
|
|
|
17745
18207
|
}
|
|
17746
18208
|
let psbtHex;
|
|
17747
18209
|
try {
|
|
17748
|
-
psbtHex =
|
|
18210
|
+
psbtHex = bytesToHex6(builder.toPSBT());
|
|
17749
18211
|
} catch (error) {
|
|
17750
18212
|
throw new Error(`Failed to extract transaction: ${error}`);
|
|
17751
18213
|
}
|
|
@@ -17913,13 +18375,13 @@ var NativeSparkFrost = class {
|
|
|
17913
18375
|
|
|
17914
18376
|
// src/signer/signer.ts
|
|
17915
18377
|
import { privateNegate } from "@bitcoinerlab/secp256k1";
|
|
18378
|
+
import { schnorr as schnorr4, secp256k1 as secp256k17 } from "@noble/curves/secp256k1";
|
|
17916
18379
|
import {
|
|
17917
|
-
bytesToHex as
|
|
18380
|
+
bytesToHex as bytesToHex7,
|
|
17918
18381
|
bytesToNumberBE as bytesToNumberBE5,
|
|
17919
18382
|
equalBytes as equalBytes3,
|
|
17920
18383
|
hexToBytes as hexToBytes5
|
|
17921
|
-
} from "@noble/curves/
|
|
17922
|
-
import { schnorr as schnorr4, secp256k1 as secp256k17 } from "@noble/curves/secp256k1";
|
|
18384
|
+
} from "@noble/curves/utils";
|
|
17923
18385
|
import { sha256 as sha2566 } from "@noble/hashes/sha2";
|
|
17924
18386
|
import { HDKey } from "@scure/bip32";
|
|
17925
18387
|
import { generateMnemonic, mnemonicToSeed } from "@scure/bip39";
|
|
@@ -17931,7 +18393,7 @@ import * as ecies from "eciesjs";
|
|
|
17931
18393
|
import { isNode, isBare } from "@lightsparkdev/core";
|
|
17932
18394
|
var isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
17933
18395
|
var isBun = globalThis.Bun !== void 0;
|
|
17934
|
-
var packageVersion = true ? "0.2.
|
|
18396
|
+
var packageVersion = true ? "0.2.12" : "unknown";
|
|
17935
18397
|
var baseEnvStr = "unknown";
|
|
17936
18398
|
if (isBun) {
|
|
17937
18399
|
const bunVersion = "version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
|
|
@@ -18039,7 +18501,7 @@ var DefaultSparkSigner = class {
|
|
|
18039
18501
|
});
|
|
18040
18502
|
}
|
|
18041
18503
|
const receiverEciesPrivKey = ecies.PrivateKey.fromHex(
|
|
18042
|
-
|
|
18504
|
+
bytesToHex7(this.identityKey.privateKey)
|
|
18043
18505
|
);
|
|
18044
18506
|
const privateKey = ecies.decrypt(receiverEciesPrivKey.toHex(), ciphertext);
|
|
18045
18507
|
return privateKey;
|
|
@@ -18209,7 +18671,7 @@ var DefaultSparkSigner = class {
|
|
|
18209
18671
|
publicKey,
|
|
18210
18672
|
verifyingKey
|
|
18211
18673
|
};
|
|
18212
|
-
const logMessage =
|
|
18674
|
+
const logMessage = bytesToHex7(message);
|
|
18213
18675
|
const result = await SparkFrost.signFrost({
|
|
18214
18676
|
message,
|
|
18215
18677
|
keyPackage,
|
|
@@ -18263,7 +18725,7 @@ var DefaultSparkSigner = class {
|
|
|
18263
18725
|
this.depositKey = depositKey;
|
|
18264
18726
|
this.signingKey = signingKey.hdKey;
|
|
18265
18727
|
this.staticDepositKey = staticDepositKey.hdKey;
|
|
18266
|
-
return
|
|
18728
|
+
return bytesToHex7(identityKey.publicKey);
|
|
18267
18729
|
}
|
|
18268
18730
|
async signMessageWithIdentityKey(message, compact) {
|
|
18269
18731
|
if (!this.identityKey?.privateKey) {
|
|
@@ -18284,7 +18746,7 @@ var DefaultSparkSigner = class {
|
|
|
18284
18746
|
});
|
|
18285
18747
|
}
|
|
18286
18748
|
const receiverEciesPrivKey = ecies.PrivateKey.fromHex(
|
|
18287
|
-
|
|
18749
|
+
bytesToHex7(this.identityKey.privateKey)
|
|
18288
18750
|
);
|
|
18289
18751
|
const privateKey = ecies.decrypt(receiverEciesPrivKey.toHex(), ciphertext);
|
|
18290
18752
|
const publicKey = secp256k17.getPublicKey(privateKey);
|
|
@@ -18316,7 +18778,7 @@ var DefaultSparkSigner = class {
|
|
|
18316
18778
|
if (!privateKey) {
|
|
18317
18779
|
throw new ValidationError("Private key not found for public key", {
|
|
18318
18780
|
field: "privateKey",
|
|
18319
|
-
value:
|
|
18781
|
+
value: bytesToHex7(publicKey)
|
|
18320
18782
|
});
|
|
18321
18783
|
}
|
|
18322
18784
|
tx.signIdx(privateKey, index);
|
|
@@ -18388,14 +18850,14 @@ var ReactNativeSparkSigner = class extends DefaultSparkSigner {
|
|
|
18388
18850
|
|
|
18389
18851
|
// src/spark-wallet/spark-wallet.ts
|
|
18390
18852
|
import { isNode as isNode3, isObject as isObject10, mapCurrencyAmount } from "@lightsparkdev/core";
|
|
18853
|
+
import { secp256k1 as secp256k114 } from "@noble/curves/secp256k1";
|
|
18391
18854
|
import {
|
|
18392
|
-
bytesToHex as
|
|
18855
|
+
bytesToHex as bytesToHex12,
|
|
18393
18856
|
bytesToNumberBE as bytesToNumberBE8,
|
|
18394
18857
|
equalBytes as equalBytes6,
|
|
18395
18858
|
hexToBytes as hexToBytes12,
|
|
18396
18859
|
numberToVarBytesBE
|
|
18397
|
-
} from "@noble/curves/
|
|
18398
|
-
import { secp256k1 as secp256k114 } from "@noble/curves/secp256k1";
|
|
18860
|
+
} from "@noble/curves/utils";
|
|
18399
18861
|
import { validateMnemonic } from "@scure/bip39";
|
|
18400
18862
|
import { wordlist as wordlist2 } from "@scure/bip39/wordlists/english";
|
|
18401
18863
|
import { Address as Address5, OutScript as OutScript3, Transaction as Transaction8 } from "@scure/btc-signer";
|
|
@@ -18404,7 +18866,7 @@ import { uuidv7 as uuidv74, uuidv7obj } from "uuidv7";
|
|
|
18404
18866
|
|
|
18405
18867
|
// src/graphql/client.ts
|
|
18406
18868
|
import {
|
|
18407
|
-
bytesToHex as
|
|
18869
|
+
bytesToHex as bytesToHex8,
|
|
18408
18870
|
DefaultCrypto,
|
|
18409
18871
|
NodeKeyCache,
|
|
18410
18872
|
Requester,
|
|
@@ -19390,7 +19852,7 @@ var SspClient = class {
|
|
|
19390
19852
|
{
|
|
19391
19853
|
queryPayload: GetChallenge,
|
|
19392
19854
|
variables: {
|
|
19393
|
-
public_key:
|
|
19855
|
+
public_key: bytesToHex8(await this.signer.getIdentityPublicKey())
|
|
19394
19856
|
},
|
|
19395
19857
|
constructObject: (response) => {
|
|
19396
19858
|
return GetChallengeOutputFromJson(response.get_challenge);
|
|
@@ -19406,7 +19868,7 @@ var SspClient = class {
|
|
|
19406
19868
|
variables: {
|
|
19407
19869
|
protected_challenge: protectedChallenge,
|
|
19408
19870
|
signature,
|
|
19409
|
-
identity_public_key:
|
|
19871
|
+
identity_public_key: bytesToHex8(
|
|
19410
19872
|
await this.signer.getIdentityPublicKey()
|
|
19411
19873
|
)
|
|
19412
19874
|
},
|
|
@@ -23726,13 +24188,13 @@ import { Transaction as Transaction5 } from "@scure/btc-signer";
|
|
|
23726
24188
|
import { uuidv7 as uuidv72 } from "uuidv7";
|
|
23727
24189
|
|
|
23728
24190
|
// src/services/transfer.ts
|
|
24191
|
+
import { secp256k1 as secp256k18 } from "@noble/curves/secp256k1";
|
|
23729
24192
|
import {
|
|
23730
|
-
bytesToHex as
|
|
24193
|
+
bytesToHex as bytesToHex9,
|
|
23731
24194
|
equalBytes as equalBytes4,
|
|
23732
24195
|
hexToBytes as hexToBytes6,
|
|
23733
24196
|
numberToBytesBE as numberToBytesBE3
|
|
23734
|
-
} from "@noble/curves/
|
|
23735
|
-
import { secp256k1 as secp256k18 } from "@noble/curves/secp256k1";
|
|
24197
|
+
} from "@noble/curves/utils";
|
|
23736
24198
|
import { sha256 as sha2569 } from "@noble/hashes/sha2";
|
|
23737
24199
|
import { Transaction as Transaction4 } from "@scure/btc-signer";
|
|
23738
24200
|
import * as ecies2 from "eciesjs";
|
|
@@ -24102,7 +24564,7 @@ var BaseTransferService = class {
|
|
|
24102
24564
|
}
|
|
24103
24565
|
async prepareSendTransferKeyTweaks(transferID, receiverIdentityPubkey, leaves, cpfpRefundSignatureMap, directRefundSignatureMap, directFromCpfpRefundSignatureMap) {
|
|
24104
24566
|
const receiverEciesPubKey = ecies2.PublicKey.fromHex(
|
|
24105
|
-
|
|
24567
|
+
bytesToHex9(receiverIdentityPubkey)
|
|
24106
24568
|
);
|
|
24107
24569
|
const leavesTweaksMap = /* @__PURE__ */ new Map();
|
|
24108
24570
|
for (const leaf of leaves) {
|
|
@@ -25635,7 +26097,8 @@ var DepositService = class {
|
|
|
25635
26097
|
}
|
|
25636
26098
|
async validateDepositAddress({
|
|
25637
26099
|
address: address2,
|
|
25638
|
-
userPubkey
|
|
26100
|
+
userPubkey,
|
|
26101
|
+
verifyCoordinatorProof = false
|
|
25639
26102
|
}) {
|
|
25640
26103
|
if (!address2.depositAddressProof || !address2.depositAddressProof.proofOfPossessionSignature || !address2.depositAddressProof.addressSignatures) {
|
|
25641
26104
|
throw new ValidationError(
|
|
@@ -25673,7 +26136,7 @@ var DepositService = class {
|
|
|
25673
26136
|
}
|
|
25674
26137
|
const addrHash = sha25610(address2.address);
|
|
25675
26138
|
for (const operator of Object.values(this.config.getSigningOperators())) {
|
|
25676
|
-
if (operator.identifier === this.config.getCoordinatorIdentifier()) {
|
|
26139
|
+
if (operator.identifier === this.config.getCoordinatorIdentifier() && !verifyCoordinatorProof) {
|
|
25677
26140
|
continue;
|
|
25678
26141
|
}
|
|
25679
26142
|
const operatorPubkey2 = hexToBytes7(operator.identityPublicKey);
|
|
@@ -25698,6 +26161,46 @@ var DepositService = class {
|
|
|
25698
26161
|
}
|
|
25699
26162
|
}
|
|
25700
26163
|
}
|
|
26164
|
+
async generateStaticDepositAddress({
|
|
26165
|
+
signingPubkey
|
|
26166
|
+
}) {
|
|
26167
|
+
const sparkClient = await this.connectionManager.createSparkClient(
|
|
26168
|
+
this.config.getCoordinatorAddress()
|
|
26169
|
+
);
|
|
26170
|
+
let depositResp;
|
|
26171
|
+
try {
|
|
26172
|
+
depositResp = await sparkClient.generate_static_deposit_address({
|
|
26173
|
+
signingPublicKey: signingPubkey,
|
|
26174
|
+
identityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
26175
|
+
network: this.config.getNetworkProto()
|
|
26176
|
+
});
|
|
26177
|
+
} catch (error) {
|
|
26178
|
+
throw new NetworkError(
|
|
26179
|
+
"Failed to generate static deposit address",
|
|
26180
|
+
{
|
|
26181
|
+
operation: "generate_static_deposit_address",
|
|
26182
|
+
errorCount: 1,
|
|
26183
|
+
errors: error instanceof Error ? error.message : String(error)
|
|
26184
|
+
},
|
|
26185
|
+
error
|
|
26186
|
+
);
|
|
26187
|
+
}
|
|
26188
|
+
if (!depositResp.depositAddress) {
|
|
26189
|
+
throw new ValidationError(
|
|
26190
|
+
"No static deposit address response from coordinator",
|
|
26191
|
+
{
|
|
26192
|
+
field: "depositAddress",
|
|
26193
|
+
value: depositResp
|
|
26194
|
+
}
|
|
26195
|
+
);
|
|
26196
|
+
}
|
|
26197
|
+
await this.validateDepositAddress({
|
|
26198
|
+
address: depositResp.depositAddress,
|
|
26199
|
+
userPubkey: signingPubkey,
|
|
26200
|
+
verifyCoordinatorProof: true
|
|
26201
|
+
});
|
|
26202
|
+
return depositResp;
|
|
26203
|
+
}
|
|
25701
26204
|
async generateDepositAddress({
|
|
25702
26205
|
signingPubkey,
|
|
25703
26206
|
leafId,
|
|
@@ -26237,12 +26740,12 @@ var DepositService = class {
|
|
|
26237
26740
|
};
|
|
26238
26741
|
|
|
26239
26742
|
// src/services/lightning.ts
|
|
26743
|
+
import { secp256k1 as secp256k110 } from "@noble/curves/secp256k1";
|
|
26240
26744
|
import {
|
|
26241
26745
|
bytesToNumberBE as bytesToNumberBE6,
|
|
26242
26746
|
hexToBytes as hexToBytes8,
|
|
26243
26747
|
numberToBytesBE as numberToBytesBE4
|
|
26244
|
-
} from "@noble/curves/
|
|
26245
|
-
import { secp256k1 as secp256k110 } from "@noble/curves/secp256k1";
|
|
26748
|
+
} from "@noble/curves/utils";
|
|
26246
26749
|
import { sha256 as sha25611 } from "@noble/hashes/sha2";
|
|
26247
26750
|
import { uuidv7 as uuidv73 } from "uuidv7";
|
|
26248
26751
|
|
|
@@ -26588,12 +27091,12 @@ var LightningService = class {
|
|
|
26588
27091
|
};
|
|
26589
27092
|
|
|
26590
27093
|
// src/services/token-transactions.ts
|
|
27094
|
+
import { secp256k1 as secp256k112 } from "@noble/curves/secp256k1";
|
|
26591
27095
|
import {
|
|
26592
|
-
bytesToHex as
|
|
27096
|
+
bytesToHex as bytesToHex10,
|
|
26593
27097
|
bytesToNumberBE as bytesToNumberBE7,
|
|
26594
27098
|
numberToBytesBE as numberToBytesBE5
|
|
26595
|
-
} from "@noble/curves/
|
|
26596
|
-
import { secp256k1 as secp256k112 } from "@noble/curves/secp256k1";
|
|
27099
|
+
} from "@noble/curves/utils";
|
|
26597
27100
|
import { hexToBytes as hexToBytes9 } from "@noble/hashes/utils";
|
|
26598
27101
|
|
|
26599
27102
|
// src/utils/token-hashing.ts
|
|
@@ -28730,7 +29233,7 @@ var TokenTransactionService = class {
|
|
|
28730
29233
|
{
|
|
28731
29234
|
field: "revocationCommitment",
|
|
28732
29235
|
value: derivedRevocationCommitment,
|
|
28733
|
-
expected:
|
|
29236
|
+
expected: bytesToHex10(outputsToSpendCommitments[outputIndex]),
|
|
28734
29237
|
outputIndex
|
|
28735
29238
|
}
|
|
28736
29239
|
)
|
|
@@ -28756,7 +29259,7 @@ var TokenTransactionService = class {
|
|
|
28756
29259
|
threshold
|
|
28757
29260
|
);
|
|
28758
29261
|
}
|
|
28759
|
-
return
|
|
29262
|
+
return bytesToHex10(finalTokenTransactionHash);
|
|
28760
29263
|
}
|
|
28761
29264
|
async broadcastTokenTransactionV1(tokenTransaction, signingOperators, outputsToSpendSigningPublicKeys, outputsToSpendCommitments) {
|
|
28762
29265
|
const { finalTokenTransaction, finalTokenTransactionHash, threshold } = await this.startTokenTransaction(
|
|
@@ -28770,7 +29273,7 @@ var TokenTransactionService = class {
|
|
|
28770
29273
|
finalTokenTransactionHash,
|
|
28771
29274
|
signingOperators
|
|
28772
29275
|
);
|
|
28773
|
-
return
|
|
29276
|
+
return bytesToHex10(finalTokenTransactionHash);
|
|
28774
29277
|
}
|
|
28775
29278
|
async startTokenTransactionV0(tokenTransaction, signingOperators, outputsToSpendSigningPublicKeys, outputsToSpendCommitments) {
|
|
28776
29279
|
const sparkClient = await this.connectionManager.createSparkClient(
|
|
@@ -29362,7 +29865,7 @@ var TokenTransactionService = class {
|
|
|
29362
29865
|
// Helper function for deciding if the signer public key is the identity public key
|
|
29363
29866
|
async signMessageWithKey(message, publicKey) {
|
|
29364
29867
|
const tokenSignatures = this.config.getTokenSignatures();
|
|
29365
|
-
if (
|
|
29868
|
+
if (bytesToHex10(publicKey) === bytesToHex10(await this.config.signer.getIdentityPublicKey())) {
|
|
29366
29869
|
if (tokenSignatures === "SCHNORR") {
|
|
29367
29870
|
return await this.config.signer.signSchnorrWithIdentityKey(message);
|
|
29368
29871
|
} else {
|
|
@@ -29371,8 +29874,8 @@ var TokenTransactionService = class {
|
|
|
29371
29874
|
} else {
|
|
29372
29875
|
throw new ValidationError("Invalid public key", {
|
|
29373
29876
|
field: "publicKey",
|
|
29374
|
-
value:
|
|
29375
|
-
expected:
|
|
29877
|
+
value: bytesToHex10(publicKey),
|
|
29878
|
+
expected: bytesToHex10(await this.config.signer.getIdentityPublicKey())
|
|
29376
29879
|
});
|
|
29377
29880
|
}
|
|
29378
29881
|
}
|
|
@@ -29511,7 +30014,7 @@ import { EventEmitter } from "eventemitter3";
|
|
|
29511
30014
|
import { ClientError, Status } from "nice-grpc-common";
|
|
29512
30015
|
|
|
29513
30016
|
// src/services/signing.ts
|
|
29514
|
-
import { hexToBytes as hexToBytes10 } from "@noble/curves/
|
|
30017
|
+
import { hexToBytes as hexToBytes10 } from "@noble/curves/utils";
|
|
29515
30018
|
var SigningService = class {
|
|
29516
30019
|
config;
|
|
29517
30020
|
constructor(config) {
|
|
@@ -29676,8 +30179,8 @@ var SigningService = class {
|
|
|
29676
30179
|
};
|
|
29677
30180
|
|
|
29678
30181
|
// src/tests/utils/test-faucet.ts
|
|
29679
|
-
import { bytesToHex as bytesToHex12, hexToBytes as hexToBytes11 } from "@noble/curves/abstract/utils";
|
|
29680
30182
|
import { schnorr as schnorr6, secp256k1 as secp256k113 } from "@noble/curves/secp256k1";
|
|
30183
|
+
import { bytesToHex as bytesToHex11, hexToBytes as hexToBytes11 } from "@noble/curves/utils";
|
|
29681
30184
|
import * as btc5 from "@scure/btc-signer";
|
|
29682
30185
|
import { Address as Address4, OutScript as OutScript2, SigHash as SigHash2, Transaction as Transaction7 } from "@scure/btc-signer";
|
|
29683
30186
|
import { taprootTweakPrivKey as taprootTweakPrivKey2 } from "@scure/btc-signer/utils";
|
|
@@ -29809,7 +30312,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
|
|
|
29809
30312
|
},
|
|
29810
30313
|
STATIC_MINING_KEY
|
|
29811
30314
|
);
|
|
29812
|
-
await this.broadcastTx(
|
|
30315
|
+
await this.broadcastTx(bytesToHex11(signedSplitTx.extract()));
|
|
29813
30316
|
const splitTxId = signedSplitTx.id;
|
|
29814
30317
|
for (let i = 0; i < numCoinsToCreate; i++) {
|
|
29815
30318
|
this.coins.push({
|
|
@@ -29843,7 +30346,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
|
|
|
29843
30346
|
coinToSend.txout,
|
|
29844
30347
|
coinToSend.key
|
|
29845
30348
|
);
|
|
29846
|
-
await this.broadcastTx(
|
|
30349
|
+
await this.broadcastTx(bytesToHex11(signedTx.extract()));
|
|
29847
30350
|
}
|
|
29848
30351
|
async signFaucetCoin(unsignedTx, fundingTxOut, key) {
|
|
29849
30352
|
const pubKey = secp256k113.getPublicKey(key);
|
|
@@ -29963,7 +30466,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
|
|
|
29963
30466
|
});
|
|
29964
30467
|
}
|
|
29965
30468
|
const signedTx = await this.signFaucetCoin(tx, coin.txout, coin.key);
|
|
29966
|
-
const txHex =
|
|
30469
|
+
const txHex = bytesToHex11(signedTx.extract());
|
|
29967
30470
|
await this.broadcastTx(txHex);
|
|
29968
30471
|
const randomKey = secp256k113.utils.randomPrivateKey();
|
|
29969
30472
|
const randomPubKey = secp256k113.getPublicKey(randomKey);
|
|
@@ -30529,7 +31032,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
30529
31032
|
* @returns {Promise<string>} The identity public key as a hex string.
|
|
30530
31033
|
*/
|
|
30531
31034
|
async getIdentityPublicKey() {
|
|
30532
|
-
return
|
|
31035
|
+
return bytesToHex12(await this.config.signer.getIdentityPublicKey());
|
|
30533
31036
|
}
|
|
30534
31037
|
/**
|
|
30535
31038
|
* Gets the Spark address of the wallet.
|
|
@@ -30539,7 +31042,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
30539
31042
|
async getSparkAddress() {
|
|
30540
31043
|
if (!this.sparkAddress) {
|
|
30541
31044
|
this.sparkAddress = encodeSparkAddress({
|
|
30542
|
-
identityPublicKey:
|
|
31045
|
+
identityPublicKey: bytesToHex12(
|
|
30543
31046
|
await this.config.signer.getIdentityPublicKey()
|
|
30544
31047
|
),
|
|
30545
31048
|
network: this.config.getNetworkType()
|
|
@@ -30623,7 +31126,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
30623
31126
|
const signature = await this.config.signer.signSchnorrWithIdentityKey(hash);
|
|
30624
31127
|
return encodeSparkAddressWithSignature(
|
|
30625
31128
|
{
|
|
30626
|
-
identityPublicKey:
|
|
31129
|
+
identityPublicKey: bytesToHex12(identityPublicKey),
|
|
30627
31130
|
network: this.config.getNetworkType(),
|
|
30628
31131
|
sparkInvoiceFields: invoiceFields
|
|
30629
31132
|
},
|
|
@@ -30691,7 +31194,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
30691
31194
|
});
|
|
30692
31195
|
}
|
|
30693
31196
|
this.sparkAddress = encodeSparkAddress({
|
|
30694
|
-
identityPublicKey:
|
|
31197
|
+
identityPublicKey: bytesToHex12(identityPublicKey),
|
|
30695
31198
|
network: this.config.getNetworkType()
|
|
30696
31199
|
});
|
|
30697
31200
|
return this.sparkAddress;
|
|
@@ -30871,18 +31374,18 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
30871
31374
|
const userLeaves = [];
|
|
30872
31375
|
userLeaves.push({
|
|
30873
31376
|
leaf_id: transfer.leaves[0].leaf.id,
|
|
30874
|
-
raw_unsigned_refund_transaction:
|
|
31377
|
+
raw_unsigned_refund_transaction: bytesToHex12(
|
|
30875
31378
|
transfer.leaves[0].intermediateRefundTx
|
|
30876
31379
|
),
|
|
30877
|
-
direct_raw_unsigned_refund_transaction:
|
|
31380
|
+
direct_raw_unsigned_refund_transaction: bytesToHex12(
|
|
30878
31381
|
transfer.leaves[0].intermediateDirectRefundTx
|
|
30879
31382
|
),
|
|
30880
|
-
direct_from_cpfp_raw_unsigned_refund_transaction:
|
|
31383
|
+
direct_from_cpfp_raw_unsigned_refund_transaction: bytesToHex12(
|
|
30881
31384
|
transfer.leaves[0].intermediateDirectFromCpfpRefundTx
|
|
30882
31385
|
),
|
|
30883
|
-
adaptor_added_signature:
|
|
30884
|
-
direct_adaptor_added_signature:
|
|
30885
|
-
direct_from_cpfp_adaptor_added_signature:
|
|
31386
|
+
adaptor_added_signature: bytesToHex12(cpfpAdaptorSignature),
|
|
31387
|
+
direct_adaptor_added_signature: bytesToHex12(directAdaptorSignature),
|
|
31388
|
+
direct_from_cpfp_adaptor_added_signature: bytesToHex12(
|
|
30886
31389
|
directFromCpfpAdaptorSignature
|
|
30887
31390
|
)
|
|
30888
31391
|
});
|
|
@@ -30935,24 +31438,24 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
30935
31438
|
}
|
|
30936
31439
|
userLeaves.push({
|
|
30937
31440
|
leaf_id: leaf.leaf.id,
|
|
30938
|
-
raw_unsigned_refund_transaction:
|
|
31441
|
+
raw_unsigned_refund_transaction: bytesToHex12(
|
|
30939
31442
|
leaf.intermediateRefundTx
|
|
30940
31443
|
),
|
|
30941
|
-
direct_raw_unsigned_refund_transaction:
|
|
31444
|
+
direct_raw_unsigned_refund_transaction: bytesToHex12(
|
|
30942
31445
|
leaf.intermediateDirectRefundTx
|
|
30943
31446
|
),
|
|
30944
|
-
direct_from_cpfp_raw_unsigned_refund_transaction:
|
|
31447
|
+
direct_from_cpfp_raw_unsigned_refund_transaction: bytesToHex12(
|
|
30945
31448
|
leaf.intermediateDirectFromCpfpRefundTx
|
|
30946
31449
|
),
|
|
30947
|
-
adaptor_added_signature:
|
|
30948
|
-
direct_adaptor_added_signature:
|
|
30949
|
-
direct_from_cpfp_adaptor_added_signature:
|
|
31450
|
+
adaptor_added_signature: bytesToHex12(cpfpSignature),
|
|
31451
|
+
direct_adaptor_added_signature: bytesToHex12(directSignature),
|
|
31452
|
+
direct_from_cpfp_adaptor_added_signature: bytesToHex12(
|
|
30950
31453
|
directFromCpfpSignature
|
|
30951
31454
|
)
|
|
30952
31455
|
});
|
|
30953
31456
|
}
|
|
30954
31457
|
const sspClient = this.getSspClient();
|
|
30955
|
-
const cpfpAdaptorPubkey =
|
|
31458
|
+
const cpfpAdaptorPubkey = bytesToHex12(
|
|
30956
31459
|
secp256k114.getPublicKey(cpfpAdaptorPrivateKey)
|
|
30957
31460
|
);
|
|
30958
31461
|
if (!cpfpAdaptorPubkey) {
|
|
@@ -30960,13 +31463,13 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
30960
31463
|
}
|
|
30961
31464
|
let directAdaptorPubkey;
|
|
30962
31465
|
if (directAdaptorPrivateKey.length > 0) {
|
|
30963
|
-
directAdaptorPubkey =
|
|
31466
|
+
directAdaptorPubkey = bytesToHex12(
|
|
30964
31467
|
secp256k114.getPublicKey(directAdaptorPrivateKey)
|
|
30965
31468
|
);
|
|
30966
31469
|
}
|
|
30967
31470
|
let directFromCpfpAdaptorPubkey;
|
|
30968
31471
|
if (directFromCpfpAdaptorPrivateKey.length > 0) {
|
|
30969
|
-
directFromCpfpAdaptorPubkey =
|
|
31472
|
+
directFromCpfpAdaptorPubkey = bytesToHex12(
|
|
30970
31473
|
secp256k114.getPublicKey(directFromCpfpAdaptorPrivateKey)
|
|
30971
31474
|
);
|
|
30972
31475
|
}
|
|
@@ -31106,9 +31609,9 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
31106
31609
|
directFromCpfpSignatureMap
|
|
31107
31610
|
);
|
|
31108
31611
|
const completeResponse = await sspClient.completeLeaveSwap({
|
|
31109
|
-
adaptorSecretKey:
|
|
31110
|
-
directAdaptorSecretKey:
|
|
31111
|
-
directFromCpfpAdaptorSecretKey:
|
|
31612
|
+
adaptorSecretKey: bytesToHex12(cpfpAdaptorPrivateKey),
|
|
31613
|
+
directAdaptorSecretKey: bytesToHex12(directAdaptorPrivateKey),
|
|
31614
|
+
directFromCpfpAdaptorSecretKey: bytesToHex12(
|
|
31112
31615
|
directFromCpfpAdaptorPrivateKey
|
|
31113
31616
|
),
|
|
31114
31617
|
userOutboundTransferExternalId: transfer.id,
|
|
@@ -31203,7 +31706,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
31203
31706
|
let tokenMetadataMap = /* @__PURE__ */ new Map();
|
|
31204
31707
|
for (const [tokenIdentifier, metadata] of this.tokenMetadata) {
|
|
31205
31708
|
tokenMetadataMap.set(tokenIdentifier, {
|
|
31206
|
-
tokenPublicKey:
|
|
31709
|
+
tokenPublicKey: bytesToHex12(metadata.issuerPublicKey),
|
|
31207
31710
|
rawTokenIdentifier: metadata.tokenIdentifier,
|
|
31208
31711
|
tokenName: metadata.tokenName,
|
|
31209
31712
|
tokenTicker: metadata.tokenTicker,
|
|
@@ -31243,7 +31746,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
31243
31746
|
* @returns {Promise<string>} A Bitcoin address for depositing funds
|
|
31244
31747
|
*/
|
|
31245
31748
|
async getSingleUseDepositAddress() {
|
|
31246
|
-
return await this.generateDepositAddress(
|
|
31749
|
+
return await this.generateDepositAddress();
|
|
31247
31750
|
}
|
|
31248
31751
|
/**
|
|
31249
31752
|
* Generates a new static deposit address for receiving bitcoin funds.
|
|
@@ -31252,43 +31755,32 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
31252
31755
|
* @returns {Promise<string>} A Bitcoin address for depositing funds
|
|
31253
31756
|
*/
|
|
31254
31757
|
async getStaticDepositAddress() {
|
|
31255
|
-
|
|
31256
|
-
|
|
31257
|
-
|
|
31258
|
-
|
|
31259
|
-
|
|
31260
|
-
|
|
31261
|
-
|
|
31262
|
-
|
|
31263
|
-
|
|
31264
|
-
}
|
|
31265
|
-
} else {
|
|
31266
|
-
throw error;
|
|
31267
|
-
}
|
|
31758
|
+
const signingPubkey = await this.config.signer.getStaticDepositSigningKey(0);
|
|
31759
|
+
const address2 = await this.depositService.generateStaticDepositAddress({
|
|
31760
|
+
signingPubkey
|
|
31761
|
+
});
|
|
31762
|
+
if (!address2.depositAddress) {
|
|
31763
|
+
throw new RPCError("Failed to generate static deposit address", {
|
|
31764
|
+
method: "generateStaticDepositAddress",
|
|
31765
|
+
params: { signingPubkey }
|
|
31766
|
+
});
|
|
31268
31767
|
}
|
|
31768
|
+
return address2.depositAddress.address;
|
|
31269
31769
|
}
|
|
31270
31770
|
/**
|
|
31271
31771
|
* Generates a deposit address for receiving funds.
|
|
31272
|
-
*
|
|
31273
|
-
* @param {boolean} static - Whether the address is static or single use
|
|
31274
31772
|
* @returns {Promise<string>} A deposit address
|
|
31275
31773
|
* @private
|
|
31276
31774
|
*/
|
|
31277
|
-
async generateDepositAddress(
|
|
31775
|
+
async generateDepositAddress() {
|
|
31278
31776
|
const leafId = uuidv74();
|
|
31279
|
-
|
|
31280
|
-
|
|
31281
|
-
|
|
31282
|
-
}
|
|
31283
|
-
signingPubkey = await this.config.signer.getPublicKeyFromDerivation({
|
|
31284
|
-
type: "leaf" /* LEAF */,
|
|
31285
|
-
path: leafId
|
|
31286
|
-
});
|
|
31287
|
-
}
|
|
31777
|
+
const signingPubkey = await this.config.signer.getPublicKeyFromDerivation({
|
|
31778
|
+
type: "leaf" /* LEAF */,
|
|
31779
|
+
path: leafId
|
|
31780
|
+
});
|
|
31288
31781
|
const address2 = await this.depositService.generateDepositAddress({
|
|
31289
31782
|
signingPubkey,
|
|
31290
|
-
leafId
|
|
31291
|
-
isStatic
|
|
31783
|
+
leafId
|
|
31292
31784
|
});
|
|
31293
31785
|
if (!address2.depositAddress) {
|
|
31294
31786
|
throw new RPCError("Failed to generate deposit address", {
|
|
@@ -31315,7 +31807,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
31315
31807
|
* @param offset - Pagination offset (default 0).
|
|
31316
31808
|
* @returns {Promise<{ txid: string, vout: number }[]>} List of confirmed UTXOs.
|
|
31317
31809
|
*/
|
|
31318
|
-
async getUtxosForDepositAddress(depositAddress, limit = 100, offset = 0) {
|
|
31810
|
+
async getUtxosForDepositAddress(depositAddress, limit = 100, offset = 0, excludeClaimed = false) {
|
|
31319
31811
|
if (!depositAddress) {
|
|
31320
31812
|
throw new ValidationError("Deposit address cannot be empty", {
|
|
31321
31813
|
field: "depositAddress"
|
|
@@ -31329,10 +31821,11 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
31329
31821
|
address: depositAddress,
|
|
31330
31822
|
network: NetworkToProto[this.config.getNetwork()],
|
|
31331
31823
|
limit,
|
|
31332
|
-
offset
|
|
31824
|
+
offset,
|
|
31825
|
+
excludeClaimed
|
|
31333
31826
|
});
|
|
31334
31827
|
return response.utxos.map((utxo) => ({
|
|
31335
|
-
txid:
|
|
31828
|
+
txid: bytesToHex12(utxo.txid),
|
|
31336
31829
|
vout: utxo.vout
|
|
31337
31830
|
})) ?? [];
|
|
31338
31831
|
} catch (error) {
|
|
@@ -31402,7 +31895,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
31402
31895
|
if (network === BitcoinNetwork_default.FUTURE_VALUE) {
|
|
31403
31896
|
network = BitcoinNetwork_default.REGTEST;
|
|
31404
31897
|
}
|
|
31405
|
-
const depositSecretKey =
|
|
31898
|
+
const depositSecretKey = bytesToHex12(
|
|
31406
31899
|
await this.config.signer.getStaticDepositSecretKey(0)
|
|
31407
31900
|
);
|
|
31408
31901
|
const message = await this.getStaticDepositSigningPayload(
|
|
@@ -31415,7 +31908,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
31415
31908
|
);
|
|
31416
31909
|
const hashBuffer = sha25613(message);
|
|
31417
31910
|
const signatureBytes = await this.config.signer.signMessageWithIdentityKey(hashBuffer);
|
|
31418
|
-
const signature =
|
|
31911
|
+
const signature = bytesToHex12(signatureBytes);
|
|
31419
31912
|
const response = await this.sspClient.claimStaticDeposit({
|
|
31420
31913
|
transactionId,
|
|
31421
31914
|
outputIndex,
|
|
@@ -31567,7 +32060,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
31567
32060
|
networkJSON.toLowerCase(),
|
|
31568
32061
|
2 /* Refund */,
|
|
31569
32062
|
creditAmountSats,
|
|
31570
|
-
|
|
32063
|
+
bytesToHex12(spendTxSighash)
|
|
31571
32064
|
);
|
|
31572
32065
|
const hashBuffer = sha25613(message);
|
|
31573
32066
|
const swapResponseUserSignature = await this.config.signer.signMessageWithIdentityKey(hashBuffer);
|
|
@@ -32090,7 +32583,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
32090
32583
|
}
|
|
32091
32584
|
return mapTransferToWalletTransfer(
|
|
32092
32585
|
transfer,
|
|
32093
|
-
|
|
32586
|
+
bytesToHex12(await this.config.signer.getIdentityPublicKey())
|
|
32094
32587
|
);
|
|
32095
32588
|
});
|
|
32096
32589
|
}
|
|
@@ -32446,7 +32939,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
32446
32939
|
const invoice2 = await sspClient.requestLightningReceive({
|
|
32447
32940
|
amountSats: amountSats2,
|
|
32448
32941
|
network: bitcoinNetwork,
|
|
32449
|
-
paymentHash:
|
|
32942
|
+
paymentHash: bytesToHex12(paymentHash),
|
|
32450
32943
|
expirySecs: expirySeconds,
|
|
32451
32944
|
memo: memo2,
|
|
32452
32945
|
includeSparkAddress,
|
|
@@ -32976,7 +33469,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
32976
33469
|
return transfers?.[0];
|
|
32977
33470
|
}
|
|
32978
33471
|
async constructTransfersWithUserRequest(transfers) {
|
|
32979
|
-
const identityPublicKey =
|
|
33472
|
+
const identityPublicKey = bytesToHex12(
|
|
32980
33473
|
await this.config.signer.getIdentityPublicKey()
|
|
32981
33474
|
);
|
|
32982
33475
|
const userRequests = await this.sspClient?.getTransfers(
|
|
@@ -33220,7 +33713,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
33220
33713
|
hash,
|
|
33221
33714
|
compact
|
|
33222
33715
|
);
|
|
33223
|
-
return
|
|
33716
|
+
return bytesToHex12(signature);
|
|
33224
33717
|
}
|
|
33225
33718
|
/**
|
|
33226
33719
|
* Validates a message with the identity key.
|
|
@@ -33278,7 +33771,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
33278
33771
|
publicKey,
|
|
33279
33772
|
this.config.getNetwork()
|
|
33280
33773
|
);
|
|
33281
|
-
if (
|
|
33774
|
+
if (bytesToHex12(script) === bytesToHex12(identityScript)) {
|
|
33282
33775
|
try {
|
|
33283
33776
|
this.config.signer.signTransactionIndex(tx, i, publicKey);
|
|
33284
33777
|
inputsSigned++;
|
|
@@ -33322,13 +33815,13 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
33322
33815
|
depositPubKey,
|
|
33323
33816
|
this.config.getNetwork()
|
|
33324
33817
|
);
|
|
33325
|
-
if (
|
|
33818
|
+
if (bytesToHex12(script) === bytesToHex12(identityScript)) {
|
|
33326
33819
|
return {
|
|
33327
33820
|
publicKey: identityPubKey,
|
|
33328
33821
|
keyType: "identity"
|
|
33329
33822
|
};
|
|
33330
33823
|
}
|
|
33331
|
-
if (
|
|
33824
|
+
if (bytesToHex12(script) === bytesToHex12(depositScript)) {
|
|
33332
33825
|
return {
|
|
33333
33826
|
publicKey: depositPubKey,
|
|
33334
33827
|
keyType: "deposit"
|