@buildonspark/spark-sdk 0.2.3 → 0.2.5
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 -0
- package/dist/{chunk-3SEOTO43.js → chunk-3SPMJMUX.js} +3 -2
- package/dist/{chunk-CDLETEDT.js → chunk-CQY5ML2A.js} +16 -3
- package/dist/{chunk-PTRXJS7Q.js → chunk-LQZL2D3Y.js} +1 -1
- package/dist/{chunk-PLLJIZC3.js → chunk-U7LRIWTF.js} +2471 -822
- package/dist/{client-CcYzmpmj.d.cts → client-C88GCTPB.d.cts} +211 -104
- package/dist/{client-CGTRS23n.d.ts → client-Dg6vS_2I.d.ts} +211 -104
- package/dist/debug.cjs +2511 -831
- package/dist/debug.d.cts +19 -6
- package/dist/debug.d.ts +19 -6
- package/dist/debug.js +3 -3
- package/dist/graphql/objects/index.cjs +13 -1
- package/dist/graphql/objects/index.d.cts +6 -51
- package/dist/graphql/objects/index.d.ts +6 -51
- package/dist/graphql/objects/index.js +1 -1
- package/dist/index.cjs +2491 -797
- package/dist/index.d.cts +189 -9
- package/dist/index.d.ts +189 -9
- package/dist/index.js +32 -4
- package/dist/index.node.cjs +2596 -799
- package/dist/index.node.d.cts +9 -190
- package/dist/index.node.d.ts +9 -190
- package/dist/index.node.js +134 -4
- package/dist/native/index.cjs +2491 -797
- package/dist/native/index.d.cts +309 -174
- package/dist/native/index.d.ts +309 -174
- package/dist/native/index.js +2495 -814
- package/dist/proto/lrc20.d.cts +1 -1
- package/dist/proto/lrc20.d.ts +1 -1
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark_token.d.cts +1 -1
- package/dist/proto/spark_token.d.ts +1 -1
- package/dist/{spark-B_7nZx6T.d.cts → spark-ESAfZARg.d.cts} +1 -1
- package/dist/{spark-B_7nZx6T.d.ts → spark-ESAfZARg.d.ts} +1 -1
- package/dist/{spark-wallet-CxcGPXRB.d.ts → spark-wallet-B2WwKN8W.d.ts} +57 -35
- package/dist/{spark-wallet-DJJm19BP.d.cts → spark-wallet-Di65w0Us.d.cts} +57 -35
- package/dist/spark-wallet.node-7R0Rxyj9.d.cts +13 -0
- package/dist/spark-wallet.node-CSPWOWRu.d.ts +13 -0
- package/dist/tests/test-utils.cjs +578 -77
- package/dist/tests/test-utils.d.cts +12 -13
- package/dist/tests/test-utils.d.ts +12 -13
- package/dist/tests/test-utils.js +54 -17
- package/dist/types/index.cjs +16 -3
- package/dist/types/index.d.cts +3 -4
- package/dist/types/index.d.ts +3 -4
- package/dist/types/index.js +2 -2
- package/dist/{xchain-address-Bh9w1SeC.d.ts → xchain-address-BsveIy5l.d.ts} +56 -8
- package/dist/{xchain-address-SZ7dkVUE.d.cts → xchain-address-CqRu3F21.d.cts} +56 -8
- package/package.json +1 -1
- package/src/graphql/client.ts +57 -8
- package/src/graphql/mutations/CompleteLeavesSwap.ts +9 -1
- package/src/graphql/mutations/RequestSwapLeaves.ts +4 -0
- package/src/graphql/objects/CompleteLeavesSwapInput.ts +34 -34
- package/src/graphql/objects/LeavesSwapRequest.ts +4 -0
- package/src/graphql/objects/RequestLeavesSwapInput.ts +48 -47
- package/src/graphql/objects/SparkWalletUser.ts +1 -1
- package/src/graphql/objects/SwapLeaf.ts +40 -32
- package/src/graphql/objects/UserLeafInput.ts +24 -0
- package/src/graphql/objects/UserRequest.ts +4 -0
- package/src/graphql/queries/Transfers.ts +15 -0
- package/src/index.node.ts +1 -1
- package/src/native/index.ts +4 -5
- package/src/services/coop-exit.ts +171 -36
- package/src/services/deposit.ts +471 -74
- package/src/services/lightning.ts +18 -5
- package/src/services/signing.ts +162 -50
- package/src/services/transfer.ts +950 -384
- package/src/services/tree-creation.ts +342 -121
- package/src/spark-wallet/spark-wallet.node.ts +71 -66
- package/src/spark-wallet/spark-wallet.ts +561 -192
- package/src/tests/integration/coop-exit.test.ts +3 -8
- package/src/tests/integration/deposit.test.ts +3 -3
- package/src/tests/integration/lightning.test.ts +521 -466
- package/src/tests/integration/ssp/static_deposit.test.ts +83 -1
- package/src/tests/integration/ssp/transfers.test.ts +97 -0
- package/src/tests/integration/swap.test.ts +559 -307
- package/src/tests/integration/transfer.test.ts +625 -623
- package/src/tests/integration/wallet.test.ts +2 -2
- package/src/tests/integration/watchtower.test.ts +211 -0
- package/src/tests/test-utils.ts +63 -14
- package/src/tests/utils/test-faucet.ts +4 -2
- package/src/types/sdk-types.ts +15 -0
- package/src/utils/adaptor-signature.ts +15 -5
- package/src/utils/bitcoin.ts +13 -0
- package/src/utils/fetch.ts +75 -0
- package/src/utils/mempool.ts +9 -4
- package/src/utils/transaction.ts +388 -26
- package/dist/sdk-types-CB9HrW5O.d.cts +0 -44
- package/dist/sdk-types-CkRNraXT.d.ts +0 -44
- package/src/graphql/queries/Transfer.ts +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @buildonspark/spark-sdk
|
|
2
2
|
|
|
3
|
+
## 0.2.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Attach the SSP request object to spark transfer if it exists
|
|
8
|
+
- Update static deposit refund flow to take sats per vbyte
|
|
9
|
+
- Allow the creation of multiple refunds in static deposit refund flow
|
|
10
|
+
- Add new function to claim a static deposit while specifying a max fee
|
|
11
|
+
|
|
12
|
+
## 0.2.4
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Add watchtower supported transactions on leaves
|
|
17
|
+
- Improvements to otel wrapping
|
|
18
|
+
- Fix resoluation of SparkWallet for Node.js
|
|
19
|
+
|
|
3
20
|
## 0.2.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -35,7 +35,7 @@ function mapTransferLeafToWalletTransferLeaf(proto) {
|
|
|
35
35
|
intermediateRefundTx: bytesToHex(proto.intermediateRefundTx)
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function mapTransferToWalletTransfer(proto, identityPublicKey) {
|
|
38
|
+
function mapTransferToWalletTransfer(proto, identityPublicKey, userRequest) {
|
|
39
39
|
const receiverIdentityPublicKey = bytesToHex(proto.receiverIdentityPublicKey);
|
|
40
40
|
const senderIdentityPublicKey = bytesToHex(proto.senderIdentityPublicKey);
|
|
41
41
|
return {
|
|
@@ -49,7 +49,8 @@ function mapTransferToWalletTransfer(proto, identityPublicKey) {
|
|
|
49
49
|
createdTime: proto.createdTime ? new Date(proto.createdTime) : void 0,
|
|
50
50
|
updatedTime: proto.updatedTime ? new Date(proto.updatedTime) : void 0,
|
|
51
51
|
type: TransferType[proto.type],
|
|
52
|
-
transferDirection: receiverIdentityPublicKey === identityPublicKey ? "INCOMING" /* INCOMING */ : "OUTGOING" /* OUTGOING
|
|
52
|
+
transferDirection: receiverIdentityPublicKey === identityPublicKey ? "INCOMING" /* INCOMING */ : "OUTGOING" /* OUTGOING */,
|
|
53
|
+
userRequest
|
|
53
54
|
};
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -289,7 +289,11 @@ var SwapLeafFromJson = (obj) => {
|
|
|
289
289
|
return {
|
|
290
290
|
leafId: obj["swap_leaf_leaf_id"],
|
|
291
291
|
rawUnsignedRefundTransaction: obj["swap_leaf_raw_unsigned_refund_transaction"],
|
|
292
|
-
adaptorSignedSignature: obj["swap_leaf_adaptor_signed_signature"]
|
|
292
|
+
adaptorSignedSignature: obj["swap_leaf_adaptor_signed_signature"],
|
|
293
|
+
directRawUnsignedRefundTransaction: obj["swap_leaf_direct_raw_unsigned_refund_transaction"],
|
|
294
|
+
directAdaptorSignedSignature: obj["swap_leaf_direct_adaptor_signed_signature"],
|
|
295
|
+
directFromCpfpRawUnsignedRefundTransaction: obj["swap_leaf_direct_from_cpfp_raw_unsigned_refund_transaction"],
|
|
296
|
+
directFromCpfpAdaptorSignedSignature: obj["swap_leaf_direct_from_cpfp_adaptor_signed_signature"]
|
|
293
297
|
};
|
|
294
298
|
};
|
|
295
299
|
|
|
@@ -536,6 +540,10 @@ fragment LeavesSwapRequestFragment on LeavesSwapRequest {
|
|
|
536
540
|
swap_leaf_leaf_id: leaf_id
|
|
537
541
|
swap_leaf_raw_unsigned_refund_transaction: raw_unsigned_refund_transaction
|
|
538
542
|
swap_leaf_adaptor_signed_signature: adaptor_signed_signature
|
|
543
|
+
swap_leaf_direct_raw_unsigned_refund_transaction: direct_raw_unsigned_refund_transaction
|
|
544
|
+
swap_leaf_direct_adaptor_signed_signature: direct_adaptor_signed_signature
|
|
545
|
+
swap_leaf_direct_from_cpfp_raw_unsigned_refund_transaction: direct_from_cpfp_raw_unsigned_refund_transaction
|
|
546
|
+
swap_leaf_direct_from_cpfp_adaptor_signed_signature: direct_from_cpfp_adaptor_signed_signature
|
|
539
547
|
}
|
|
540
548
|
}`;
|
|
541
549
|
var getLeavesSwapRequestQuery = (id) => {
|
|
@@ -1040,6 +1048,10 @@ fragment UserRequestFragment on UserRequest {
|
|
|
1040
1048
|
swap_leaf_leaf_id: leaf_id
|
|
1041
1049
|
swap_leaf_raw_unsigned_refund_transaction: raw_unsigned_refund_transaction
|
|
1042
1050
|
swap_leaf_adaptor_signed_signature: adaptor_signed_signature
|
|
1051
|
+
swap_leaf_direct_raw_unsigned_refund_transaction: direct_raw_unsigned_refund_transaction
|
|
1052
|
+
swap_leaf_direct_adaptor_signed_signature: direct_adaptor_signed_signature
|
|
1053
|
+
swap_leaf_direct_from_cpfp_raw_unsigned_refund_transaction: direct_from_cpfp_raw_unsigned_refund_transaction
|
|
1054
|
+
swap_leaf_direct_from_cpfp_adaptor_signed_signature: direct_from_cpfp_adaptor_signed_signature
|
|
1043
1055
|
}
|
|
1044
1056
|
}
|
|
1045
1057
|
... on LightningReceiveRequest {
|
|
@@ -1486,14 +1498,15 @@ export {
|
|
|
1486
1498
|
LightningSendRequestFromJson,
|
|
1487
1499
|
FRAGMENT6 as FRAGMENT4,
|
|
1488
1500
|
getLightningSendRequestQuery,
|
|
1501
|
+
ClaimStaticDepositStatus_default,
|
|
1502
|
+
ClaimStaticDepositFromJson,
|
|
1503
|
+
getClaimStaticDepositQuery,
|
|
1489
1504
|
ClaimStaticDepositRequestType_default,
|
|
1490
1505
|
CoopExitFeeQuoteFromJson,
|
|
1491
1506
|
FRAGMENT2 as FRAGMENT5,
|
|
1492
1507
|
getCoopExitFeeQuoteQuery,
|
|
1493
|
-
ClaimStaticDepositStatus_default,
|
|
1494
1508
|
FRAGMENT7 as FRAGMENT6,
|
|
1495
1509
|
getUserRequestQuery,
|
|
1496
|
-
getClaimStaticDepositQuery,
|
|
1497
1510
|
SparkUserRequestStatus_default,
|
|
1498
1511
|
SparkUserRequestType_default,
|
|
1499
1512
|
SparkWalletUser_default
|