@buildonspark/spark-sdk 0.2.12 → 0.2.13
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 +7 -0
- package/dist/bare/index.cjs +59 -38
- package/dist/bare/index.d.cts +23 -8
- package/dist/bare/index.d.ts +23 -8
- package/dist/bare/index.js +59 -38
- package/dist/{chunk-NQMQVXR5.js → chunk-CKHJFQUA.js} +1 -1
- package/dist/{chunk-OEK3R57K.js → chunk-LX45BCZW.js} +59 -38
- package/dist/debug.cjs +59 -38
- package/dist/debug.d.cts +2 -2
- package/dist/debug.d.ts +2 -2
- package/dist/debug.js +1 -1
- package/dist/index.cjs +59 -38
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/index.node.cjs +59 -38
- package/dist/index.node.d.cts +4 -4
- package/dist/index.node.d.ts +4 -4
- package/dist/index.node.js +1 -1
- package/dist/{logging-D3kvES69.d.cts → logging-BfTyKwqb.d.cts} +1 -1
- package/dist/{logging-ClNhGzus.d.ts → logging-CaNpBgiE.d.ts} +1 -1
- package/dist/native/index.cjs +59 -38
- package/dist/native/index.d.cts +23 -8
- package/dist/native/index.d.ts +23 -8
- package/dist/native/index.js +59 -38
- package/dist/{spark-wallet-DiHSU-pz.d.ts → spark-wallet-D0Df_P_x.d.ts} +23 -8
- package/dist/{spark-wallet-Dg5IRQe2.d.cts → spark-wallet-Dvh1BLP6.d.cts} +23 -8
- package/dist/{spark-wallet.node-DSWb18zh.d.cts → spark-wallet.node-B3V8_fgw.d.cts} +1 -1
- package/dist/{spark-wallet.node-BZrxwomN.d.ts → spark-wallet.node-bGmy8-T8.d.ts} +1 -1
- package/dist/tests/test-utils.cjs +1 -1
- package/dist/tests/test-utils.d.cts +2 -2
- package/dist/tests/test-utils.d.ts +2 -2
- package/dist/tests/test-utils.js +2 -2
- package/dist/{token-transactions-B-WqFYpW.d.cts → token-transactions-D1ta-sHH.d.cts} +1 -1
- package/dist/{token-transactions-DovxHIxV.d.ts → token-transactions-DINiKBzd.d.ts} +1 -1
- package/package.json +3 -3
- package/src/services/transfer.ts +0 -26
- package/src/spark-wallet/proto-descriptors.ts +22 -0
- package/src/spark-wallet/proto-hash.ts +743 -0
- package/src/spark-wallet/proto-reflection.ts +193 -0
- package/src/spark-wallet/spark-wallet.ts +70 -24
- package/src/spark_descriptors.pb +0 -0
- package/src/tests/bufbuild-reflection.test.ts +151 -0
- package/src/tests/cross-language-hash.test.ts +79 -0
- package/src/tests/integration/address.test.ts +3 -12
- package/src/tests/integration/ssp/static_deposit.test.ts +15 -9
- package/src/tests/integration/static_deposit.test.ts +26 -0
- package/src/tests/integration/transfer.test.ts +0 -124
package/dist/native/index.d.ts
CHANGED
|
@@ -3330,7 +3330,6 @@ declare class TransferService extends BaseTransferService {
|
|
|
3330
3330
|
private prepareClaimLeafKeyTweaks;
|
|
3331
3331
|
claimTransferSignRefunds(transfer: Transfer$1, leafKeys: LeafKeyTweak[], proofMap?: Map<string, Uint8Array[]>): Promise<NodeSignatures[]>;
|
|
3332
3332
|
private finalizeNodeSignatures;
|
|
3333
|
-
cancelTransfer(transfer: Transfer$1, operatorAddress: string): Promise<Transfer$1 | undefined>;
|
|
3334
3333
|
queryPendingTransfersBySender(operatorAddress: string): Promise<QueryTransfersResponse>;
|
|
3335
3334
|
private refreshTimelockNodesInternal;
|
|
3336
3335
|
refreshTimelockNodes(node: TreeNode, parentNode: TreeNode): Promise<FinalizeNodeSignaturesResponse>;
|
|
@@ -3591,6 +3590,29 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3591
3590
|
/** @deprecated use `satsPerVbyteFee` */ fee?: number;
|
|
3592
3591
|
satsPerVbyteFee?: number;
|
|
3593
3592
|
}): Promise<string>;
|
|
3593
|
+
/**
|
|
3594
|
+
* Refunds a static deposit and broadcasts the transaction to the network.
|
|
3595
|
+
*
|
|
3596
|
+
* @param {Object} params - The refund parameters
|
|
3597
|
+
* @param {string} params.depositTransactionId - The ID of the transaction
|
|
3598
|
+
* @param {number} [params.outputIndex] - The index of the output
|
|
3599
|
+
* @param {string} params.destinationAddress - The destination address
|
|
3600
|
+
* @param {number} [params.satsPerVbyteFee] - The fee per vbyte to refund
|
|
3601
|
+
* @returns {Promise<string>} The transaction ID
|
|
3602
|
+
*/
|
|
3603
|
+
refundAndBroadcastStaticDeposit({ depositTransactionId, outputIndex, destinationAddress, satsPerVbyteFee, }: {
|
|
3604
|
+
depositTransactionId: string;
|
|
3605
|
+
outputIndex?: number;
|
|
3606
|
+
destinationAddress: string;
|
|
3607
|
+
satsPerVbyteFee?: number;
|
|
3608
|
+
}): Promise<string>;
|
|
3609
|
+
/**
|
|
3610
|
+
* Broadcasts a transaction to the network.
|
|
3611
|
+
*
|
|
3612
|
+
* @param {string} txHex - The hex of the transaction
|
|
3613
|
+
* @returns {Promise<string>} The transaction ID
|
|
3614
|
+
*/
|
|
3615
|
+
private broadcastTx;
|
|
3594
3616
|
private getStaticDepositSigningPayload;
|
|
3595
3617
|
private getDepositTransactionVout;
|
|
3596
3618
|
private getDepositTransaction;
|
|
@@ -3676,13 +3698,6 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3676
3698
|
* @private
|
|
3677
3699
|
*/
|
|
3678
3700
|
private claimTransfers;
|
|
3679
|
-
/**
|
|
3680
|
-
* Cancels all sender-initiated transfers.
|
|
3681
|
-
*
|
|
3682
|
-
* @returns {Promise<void>}
|
|
3683
|
-
* @private
|
|
3684
|
-
*/
|
|
3685
|
-
private cancelAllSenderInitiatedTransfers;
|
|
3686
3701
|
/**
|
|
3687
3702
|
* Creates a Lightning invoice for receiving payments.
|
|
3688
3703
|
*
|
package/dist/native/index.js
CHANGED
|
@@ -18393,7 +18393,7 @@ import * as ecies from "eciesjs";
|
|
|
18393
18393
|
import { isNode, isBare } from "@lightsparkdev/core";
|
|
18394
18394
|
var isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
18395
18395
|
var isBun = globalThis.Bun !== void 0;
|
|
18396
|
-
var packageVersion = true ? "0.2.
|
|
18396
|
+
var packageVersion = true ? "0.2.13" : "unknown";
|
|
18397
18397
|
var baseEnvStr = "unknown";
|
|
18398
18398
|
if (isBun) {
|
|
18399
18399
|
const bunVersion = "version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
|
|
@@ -25186,24 +25186,6 @@ var TransferService = class extends BaseTransferService {
|
|
|
25186
25186
|
throw new Error(`Error finalizing node signatures in transfer: ${error}`);
|
|
25187
25187
|
}
|
|
25188
25188
|
}
|
|
25189
|
-
async cancelTransfer(transfer, operatorAddress) {
|
|
25190
|
-
const sparkClient = await this.connectionManager.createSparkClient(operatorAddress);
|
|
25191
|
-
try {
|
|
25192
|
-
const response = await sparkClient.cancel_transfer({
|
|
25193
|
-
transferId: transfer.id,
|
|
25194
|
-
senderIdentityPublicKey: await this.config.signer.getIdentityPublicKey()
|
|
25195
|
-
});
|
|
25196
|
-
return response.transfer;
|
|
25197
|
-
} catch (error) {
|
|
25198
|
-
throw new NetworkError(
|
|
25199
|
-
"Failed to cancel transfer",
|
|
25200
|
-
{
|
|
25201
|
-
method: "POST"
|
|
25202
|
-
},
|
|
25203
|
-
error
|
|
25204
|
-
);
|
|
25205
|
-
}
|
|
25206
|
-
}
|
|
25207
25189
|
async queryPendingTransfersBySender(operatorAddress) {
|
|
25208
25190
|
const sparkClient = await this.connectionManager.createSparkClient(operatorAddress);
|
|
25209
25191
|
try {
|
|
@@ -31642,7 +31624,6 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
31642
31624
|
message: e.message,
|
|
31643
31625
|
stack: e.stack
|
|
31644
31626
|
});
|
|
31645
|
-
await this.cancelAllSenderInitiatedTransfers();
|
|
31646
31627
|
throw new Error(`Failed to request leaves swap: ${e}`);
|
|
31647
31628
|
}
|
|
31648
31629
|
}
|
|
@@ -32105,6 +32086,64 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
32105
32086
|
});
|
|
32106
32087
|
return tx.hex;
|
|
32107
32088
|
}
|
|
32089
|
+
/**
|
|
32090
|
+
* Refunds a static deposit and broadcasts the transaction to the network.
|
|
32091
|
+
*
|
|
32092
|
+
* @param {Object} params - The refund parameters
|
|
32093
|
+
* @param {string} params.depositTransactionId - The ID of the transaction
|
|
32094
|
+
* @param {number} [params.outputIndex] - The index of the output
|
|
32095
|
+
* @param {string} params.destinationAddress - The destination address
|
|
32096
|
+
* @param {number} [params.satsPerVbyteFee] - The fee per vbyte to refund
|
|
32097
|
+
* @returns {Promise<string>} The transaction ID
|
|
32098
|
+
*/
|
|
32099
|
+
async refundAndBroadcastStaticDeposit({
|
|
32100
|
+
depositTransactionId,
|
|
32101
|
+
outputIndex,
|
|
32102
|
+
destinationAddress,
|
|
32103
|
+
satsPerVbyteFee
|
|
32104
|
+
}) {
|
|
32105
|
+
const txHex = await this.refundStaticDeposit({
|
|
32106
|
+
depositTransactionId,
|
|
32107
|
+
outputIndex,
|
|
32108
|
+
destinationAddress,
|
|
32109
|
+
satsPerVbyteFee
|
|
32110
|
+
});
|
|
32111
|
+
return await this.broadcastTx(txHex);
|
|
32112
|
+
}
|
|
32113
|
+
/**
|
|
32114
|
+
* Broadcasts a transaction to the network.
|
|
32115
|
+
*
|
|
32116
|
+
* @param {string} txHex - The hex of the transaction
|
|
32117
|
+
* @returns {Promise<string>} The transaction ID
|
|
32118
|
+
*/
|
|
32119
|
+
async broadcastTx(txHex) {
|
|
32120
|
+
if (!txHex) {
|
|
32121
|
+
throw new ValidationError("Transaction hex cannot be empty", {
|
|
32122
|
+
field: "txHex"
|
|
32123
|
+
});
|
|
32124
|
+
}
|
|
32125
|
+
const { fetch, Headers: Headers2 } = getFetch();
|
|
32126
|
+
const baseUrl = this.config.getElectrsUrl();
|
|
32127
|
+
const headers = new Headers2();
|
|
32128
|
+
if (this.config.getNetwork() === 4 /* LOCAL */) {
|
|
32129
|
+
const localFaucet = BitcoinFaucet.getInstance();
|
|
32130
|
+
const response = await localFaucet.broadcastTx(txHex);
|
|
32131
|
+
return response;
|
|
32132
|
+
} else {
|
|
32133
|
+
if (this.config.getNetwork() === 3 /* REGTEST */) {
|
|
32134
|
+
const auth = btoa(
|
|
32135
|
+
`${ELECTRS_CREDENTIALS.username}:${ELECTRS_CREDENTIALS.password}`
|
|
32136
|
+
);
|
|
32137
|
+
headers.set("Authorization", `Basic ${auth}`);
|
|
32138
|
+
}
|
|
32139
|
+
const response = await fetch(`${baseUrl}/tx`, {
|
|
32140
|
+
method: "POST",
|
|
32141
|
+
body: txHex,
|
|
32142
|
+
headers
|
|
32143
|
+
});
|
|
32144
|
+
return response.text();
|
|
32145
|
+
}
|
|
32146
|
+
}
|
|
32108
32147
|
async getStaticDepositSigningPayload(transactionID, outputIndex, network, requestType, creditAmountSats, sspSignature) {
|
|
32109
32148
|
const encoder = new TextEncoder();
|
|
32110
32149
|
const parts = [];
|
|
@@ -32843,24 +32882,6 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
|
|
|
32843
32882
|
(result) => result.status === "fulfilled" && result.value !== null
|
|
32844
32883
|
).map((result) => result.value);
|
|
32845
32884
|
}
|
|
32846
|
-
/**
|
|
32847
|
-
* Cancels all sender-initiated transfers.
|
|
32848
|
-
*
|
|
32849
|
-
* @returns {Promise<void>}
|
|
32850
|
-
* @private
|
|
32851
|
-
*/
|
|
32852
|
-
async cancelAllSenderInitiatedTransfers() {
|
|
32853
|
-
for (const operator of Object.values(this.config.getSigningOperators())) {
|
|
32854
|
-
const transfers = await this.transferService.queryPendingTransfersBySender(
|
|
32855
|
-
operator.address
|
|
32856
|
-
);
|
|
32857
|
-
for (const transfer of transfers.transfers) {
|
|
32858
|
-
if (transfer.status === 0 /* TRANSFER_STATUS_SENDER_INITIATED */) {
|
|
32859
|
-
await this.transferService.cancelTransfer(transfer, operator.address);
|
|
32860
|
-
}
|
|
32861
|
-
}
|
|
32862
|
-
}
|
|
32863
|
-
}
|
|
32864
32885
|
// ***** Lightning Flow *****
|
|
32865
32886
|
/**
|
|
32866
32887
|
* Creates a Lightning invoice for receiving payments.
|
|
@@ -292,7 +292,6 @@ declare class TransferService extends BaseTransferService {
|
|
|
292
292
|
private prepareClaimLeafKeyTweaks;
|
|
293
293
|
claimTransferSignRefunds(transfer: Transfer, leafKeys: LeafKeyTweak[], proofMap?: Map<string, Uint8Array[]>): Promise<NodeSignatures[]>;
|
|
294
294
|
private finalizeNodeSignatures;
|
|
295
|
-
cancelTransfer(transfer: Transfer, operatorAddress: string): Promise<Transfer | undefined>;
|
|
296
295
|
queryPendingTransfersBySender(operatorAddress: string): Promise<QueryTransfersResponse>;
|
|
297
296
|
private refreshTimelockNodesInternal;
|
|
298
297
|
refreshTimelockNodes(node: TreeNode, parentNode: TreeNode): Promise<FinalizeNodeSignaturesResponse>;
|
|
@@ -692,6 +691,29 @@ declare class SparkWallet extends EventEmitter {
|
|
|
692
691
|
/** @deprecated use `satsPerVbyteFee` */ fee?: number;
|
|
693
692
|
satsPerVbyteFee?: number;
|
|
694
693
|
}): Promise<string>;
|
|
694
|
+
/**
|
|
695
|
+
* Refunds a static deposit and broadcasts the transaction to the network.
|
|
696
|
+
*
|
|
697
|
+
* @param {Object} params - The refund parameters
|
|
698
|
+
* @param {string} params.depositTransactionId - The ID of the transaction
|
|
699
|
+
* @param {number} [params.outputIndex] - The index of the output
|
|
700
|
+
* @param {string} params.destinationAddress - The destination address
|
|
701
|
+
* @param {number} [params.satsPerVbyteFee] - The fee per vbyte to refund
|
|
702
|
+
* @returns {Promise<string>} The transaction ID
|
|
703
|
+
*/
|
|
704
|
+
refundAndBroadcastStaticDeposit({ depositTransactionId, outputIndex, destinationAddress, satsPerVbyteFee, }: {
|
|
705
|
+
depositTransactionId: string;
|
|
706
|
+
outputIndex?: number;
|
|
707
|
+
destinationAddress: string;
|
|
708
|
+
satsPerVbyteFee?: number;
|
|
709
|
+
}): Promise<string>;
|
|
710
|
+
/**
|
|
711
|
+
* Broadcasts a transaction to the network.
|
|
712
|
+
*
|
|
713
|
+
* @param {string} txHex - The hex of the transaction
|
|
714
|
+
* @returns {Promise<string>} The transaction ID
|
|
715
|
+
*/
|
|
716
|
+
private broadcastTx;
|
|
695
717
|
private getStaticDepositSigningPayload;
|
|
696
718
|
private getDepositTransactionVout;
|
|
697
719
|
private getDepositTransaction;
|
|
@@ -777,13 +799,6 @@ declare class SparkWallet extends EventEmitter {
|
|
|
777
799
|
* @private
|
|
778
800
|
*/
|
|
779
801
|
private claimTransfers;
|
|
780
|
-
/**
|
|
781
|
-
* Cancels all sender-initiated transfers.
|
|
782
|
-
*
|
|
783
|
-
* @returns {Promise<void>}
|
|
784
|
-
* @private
|
|
785
|
-
*/
|
|
786
|
-
private cancelAllSenderInitiatedTransfers;
|
|
787
802
|
/**
|
|
788
803
|
* Creates a Lightning invoice for receiving payments.
|
|
789
804
|
*
|
|
@@ -292,7 +292,6 @@ declare class TransferService extends BaseTransferService {
|
|
|
292
292
|
private prepareClaimLeafKeyTweaks;
|
|
293
293
|
claimTransferSignRefunds(transfer: Transfer, leafKeys: LeafKeyTweak[], proofMap?: Map<string, Uint8Array[]>): Promise<NodeSignatures[]>;
|
|
294
294
|
private finalizeNodeSignatures;
|
|
295
|
-
cancelTransfer(transfer: Transfer, operatorAddress: string): Promise<Transfer | undefined>;
|
|
296
295
|
queryPendingTransfersBySender(operatorAddress: string): Promise<QueryTransfersResponse>;
|
|
297
296
|
private refreshTimelockNodesInternal;
|
|
298
297
|
refreshTimelockNodes(node: TreeNode, parentNode: TreeNode): Promise<FinalizeNodeSignaturesResponse>;
|
|
@@ -692,6 +691,29 @@ declare class SparkWallet extends EventEmitter {
|
|
|
692
691
|
/** @deprecated use `satsPerVbyteFee` */ fee?: number;
|
|
693
692
|
satsPerVbyteFee?: number;
|
|
694
693
|
}): Promise<string>;
|
|
694
|
+
/**
|
|
695
|
+
* Refunds a static deposit and broadcasts the transaction to the network.
|
|
696
|
+
*
|
|
697
|
+
* @param {Object} params - The refund parameters
|
|
698
|
+
* @param {string} params.depositTransactionId - The ID of the transaction
|
|
699
|
+
* @param {number} [params.outputIndex] - The index of the output
|
|
700
|
+
* @param {string} params.destinationAddress - The destination address
|
|
701
|
+
* @param {number} [params.satsPerVbyteFee] - The fee per vbyte to refund
|
|
702
|
+
* @returns {Promise<string>} The transaction ID
|
|
703
|
+
*/
|
|
704
|
+
refundAndBroadcastStaticDeposit({ depositTransactionId, outputIndex, destinationAddress, satsPerVbyteFee, }: {
|
|
705
|
+
depositTransactionId: string;
|
|
706
|
+
outputIndex?: number;
|
|
707
|
+
destinationAddress: string;
|
|
708
|
+
satsPerVbyteFee?: number;
|
|
709
|
+
}): Promise<string>;
|
|
710
|
+
/**
|
|
711
|
+
* Broadcasts a transaction to the network.
|
|
712
|
+
*
|
|
713
|
+
* @param {string} txHex - The hex of the transaction
|
|
714
|
+
* @returns {Promise<string>} The transaction ID
|
|
715
|
+
*/
|
|
716
|
+
private broadcastTx;
|
|
695
717
|
private getStaticDepositSigningPayload;
|
|
696
718
|
private getDepositTransactionVout;
|
|
697
719
|
private getDepositTransaction;
|
|
@@ -777,13 +799,6 @@ declare class SparkWallet extends EventEmitter {
|
|
|
777
799
|
* @private
|
|
778
800
|
*/
|
|
779
801
|
private claimTransfers;
|
|
780
|
-
/**
|
|
781
|
-
* Cancels all sender-initiated transfers.
|
|
782
|
-
*
|
|
783
|
-
* @returns {Promise<void>}
|
|
784
|
-
* @private
|
|
785
|
-
*/
|
|
786
|
-
private cancelAllSenderInitiatedTransfers;
|
|
787
802
|
/**
|
|
788
803
|
* Creates a Lightning invoice for receiving payments.
|
|
789
804
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as SparkWallet, F as SparkWalletProps } from './spark-wallet-
|
|
1
|
+
import { H as SparkWallet, F as SparkWalletProps } from './spark-wallet-Dvh1BLP6.cjs';
|
|
2
2
|
|
|
3
3
|
declare class SparkWalletNodeJS extends SparkWallet {
|
|
4
4
|
static initialize({ mnemonicOrSeed, accountNumber, signer, options, }: SparkWalletProps): Promise<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as SparkWallet, F as SparkWalletProps } from './spark-wallet-
|
|
1
|
+
import { H as SparkWallet, F as SparkWalletProps } from './spark-wallet-D0Df_P_x.js';
|
|
2
2
|
|
|
3
3
|
declare class SparkWalletNodeJS extends SparkWallet {
|
|
4
4
|
static initialize({ mnemonicOrSeed, accountNumber, signer, options, }: SparkWalletProps): Promise<{
|
|
@@ -16897,7 +16897,7 @@ init_buffer();
|
|
|
16897
16897
|
var import_core9 = require("@lightsparkdev/core");
|
|
16898
16898
|
var isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
16899
16899
|
var isBun = globalThis.Bun !== void 0;
|
|
16900
|
-
var packageVersion = true ? "0.2.
|
|
16900
|
+
var packageVersion = true ? "0.2.13" : "unknown";
|
|
16901
16901
|
var baseEnvStr = "unknown";
|
|
16902
16902
|
if (isBun) {
|
|
16903
16903
|
const bunVersion = "version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Q as QueryTransfersResponse, a as Transfer, b as TreeNode } from '../spark-C7OG9mGJ.cjs';
|
|
2
|
-
import { b as ConfigOptions, F as SparkWalletProps } from '../spark-wallet-
|
|
2
|
+
import { b as ConfigOptions, F as SparkWalletProps } from '../spark-wallet-Dvh1BLP6.cjs';
|
|
3
3
|
import { S as SparkSigner, D as DefaultSparkSigner } from '../client-DVuA5-7M.cjs';
|
|
4
|
-
import { S as SparkWalletNodeJS } from '../spark-wallet.node-
|
|
4
|
+
import { S as SparkWalletNodeJS } from '../spark-wallet.node-B3V8_fgw.cjs';
|
|
5
5
|
import { Transaction } from '@scure/btc-signer';
|
|
6
6
|
import { TransactionInput, TransactionOutput } from '@scure/btc-signer/psbt';
|
|
7
7
|
import '@bufbuild/protobuf/wire';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Q as QueryTransfersResponse, a as Transfer, b as TreeNode } from '../spark-C7OG9mGJ.js';
|
|
2
|
-
import { b as ConfigOptions, F as SparkWalletProps } from '../spark-wallet-
|
|
2
|
+
import { b as ConfigOptions, F as SparkWalletProps } from '../spark-wallet-D0Df_P_x.js';
|
|
3
3
|
import { S as SparkSigner, D as DefaultSparkSigner } from '../client-D7KDa4Ih.js';
|
|
4
|
-
import { S as SparkWalletNodeJS } from '../spark-wallet.node-
|
|
4
|
+
import { S as SparkWalletNodeJS } from '../spark-wallet.node-bGmy8-T8.js';
|
|
5
5
|
import { Transaction } from '@scure/btc-signer';
|
|
6
6
|
import { TransactionInput, TransactionOutput } from '@scure/btc-signer/psbt';
|
|
7
7
|
import '@bufbuild/protobuf/wire';
|
package/dist/tests/test-utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-CKHJFQUA.js";
|
|
2
2
|
import "../chunk-BYXBJQAS.js";
|
|
3
3
|
import {
|
|
4
4
|
BitcoinFaucet,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
WalletConfigService,
|
|
12
12
|
getNetwork,
|
|
13
13
|
getP2TRAddressFromPublicKey
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-LX45BCZW.js";
|
|
15
15
|
import "../chunk-NX5KPN5F.js";
|
|
16
16
|
import "../chunk-XXTWWW6L.js";
|
|
17
17
|
import "../chunk-TB7DG5CU.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { O as OutputWithPreviousTransactionData, T as TokenTransaction } from './spark-C7OG9mGJ.cjs';
|
|
2
2
|
import { TokenTransaction as TokenTransaction$1, QueryTokenTransactionsResponse } from './proto/spark_token.cjs';
|
|
3
|
-
import { W as WalletConfigService, C as ConnectionManager, A as TokenOutputsMap, B as Bech32mTokenIdentifier, S as SparkAddressFormat } from './spark-wallet-
|
|
3
|
+
import { W as WalletConfigService, C as ConnectionManager, A as TokenOutputsMap, B as Bech32mTokenIdentifier, S as SparkAddressFormat } from './spark-wallet-Dvh1BLP6.cjs';
|
|
4
4
|
|
|
5
5
|
declare class SparkSDKError extends Error {
|
|
6
6
|
readonly context: Record<string, unknown>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { O as OutputWithPreviousTransactionData, T as TokenTransaction } from './spark-C7OG9mGJ.js';
|
|
2
2
|
import { TokenTransaction as TokenTransaction$1, QueryTokenTransactionsResponse } from './proto/spark_token.js';
|
|
3
|
-
import { W as WalletConfigService, C as ConnectionManager, A as TokenOutputsMap, B as Bech32mTokenIdentifier, S as SparkAddressFormat } from './spark-wallet-
|
|
3
|
+
import { W as WalletConfigService, C as ConnectionManager, A as TokenOutputsMap, B as Bech32mTokenIdentifier, S as SparkAddressFormat } from './spark-wallet-D0Df_P_x.js';
|
|
4
4
|
|
|
5
5
|
declare class SparkSDKError extends Error {
|
|
6
6
|
readonly context: Record<string, unknown>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buildonspark/spark-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"author": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"types:watch": "tsc-absolute --watch",
|
|
111
111
|
"types": "tsc",
|
|
112
112
|
"patch-wasm": "node ./wasm/patch-wasm.mjs",
|
|
113
|
-
"generate:proto": "
|
|
113
|
+
"generate:proto": "./generate-proto.sh"
|
|
114
114
|
},
|
|
115
115
|
"devDependencies": {
|
|
116
116
|
"@arethetypeswrong/cli": "^0.17.4",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"dependencies": {
|
|
134
134
|
"@bitcoinerlab/secp256k1": "^1.1.1",
|
|
135
135
|
"@bufbuild/protobuf": "^2.2.5",
|
|
136
|
-
"@lightsparkdev/core": "^1.4.
|
|
136
|
+
"@lightsparkdev/core": "^1.4.4",
|
|
137
137
|
"@noble/curves": "^1.8.0",
|
|
138
138
|
"@noble/hashes": "^1.7.0",
|
|
139
139
|
"@opentelemetry/api": "^1.9.0",
|
package/src/services/transfer.ts
CHANGED
|
@@ -1452,32 +1452,6 @@ export class TransferService extends BaseTransferService {
|
|
|
1452
1452
|
}
|
|
1453
1453
|
}
|
|
1454
1454
|
|
|
1455
|
-
async cancelTransfer(
|
|
1456
|
-
transfer: Transfer,
|
|
1457
|
-
operatorAddress: string,
|
|
1458
|
-
): Promise<Transfer | undefined> {
|
|
1459
|
-
const sparkClient =
|
|
1460
|
-
await this.connectionManager.createSparkClient(operatorAddress);
|
|
1461
|
-
|
|
1462
|
-
try {
|
|
1463
|
-
const response = await sparkClient.cancel_transfer({
|
|
1464
|
-
transferId: transfer.id,
|
|
1465
|
-
senderIdentityPublicKey:
|
|
1466
|
-
await this.config.signer.getIdentityPublicKey(),
|
|
1467
|
-
});
|
|
1468
|
-
|
|
1469
|
-
return response.transfer;
|
|
1470
|
-
} catch (error) {
|
|
1471
|
-
throw new NetworkError(
|
|
1472
|
-
"Failed to cancel transfer",
|
|
1473
|
-
{
|
|
1474
|
-
method: "POST",
|
|
1475
|
-
},
|
|
1476
|
-
error as Error,
|
|
1477
|
-
);
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
1455
|
async queryPendingTransfersBySender(
|
|
1482
1456
|
operatorAddress: string,
|
|
1483
1457
|
): Promise<QueryTransfersResponse> {
|