@buildonspark/spark-sdk 0.1.43 → 0.1.44
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/{RequestLightningSendInput-Na1mHdWg.d.cts → RequestLightningSendInput-BxbCtwpV.d.cts} +43 -4
- package/dist/{RequestLightningSendInput-D7fZdT4A.d.ts → RequestLightningSendInput-RGel43ks.d.ts} +43 -4
- package/dist/address/index.d.cts +2 -2
- package/dist/address/index.d.ts +2 -2
- package/dist/address/index.js +2 -2
- package/dist/{chunk-M6A4KFIG.js → chunk-4Q2ZDYYU.js} +332 -221
- package/dist/{chunk-WWOTVNPP.js → chunk-A2ZLMH6I.js} +323 -142
- package/dist/{chunk-VA7MV4MZ.js → chunk-B3AMIGJG.js} +1 -1
- package/dist/{chunk-DQYKQJRZ.js → chunk-CIZNCBKE.js} +29 -9
- package/dist/{chunk-BUTZWYBW.js → chunk-DAXGVPVM.js} +2 -2
- package/dist/{chunk-DOA6QXYQ.js → chunk-EKFD62HN.js} +2 -1
- package/dist/{chunk-TIUBYNN5.js → chunk-HTMXTJRK.js} +1 -1
- package/dist/{chunk-TOSP3INR.js → chunk-I54FARY2.js} +4 -2
- package/dist/{chunk-MIVX3GHD.js → chunk-K4BJARWM.js} +1 -1
- package/dist/{chunk-O4RYNJNB.js → chunk-KEKGSH7B.js} +1 -1
- package/dist/{chunk-GYQR4B4P.js → chunk-NBCNYDWJ.js} +2 -2
- package/dist/{chunk-ABZA6R5S.js → chunk-SQKXGAIR.js} +1 -1
- package/dist/{chunk-VFJQNBFX.js → chunk-UBT6EDVJ.js} +5 -2
- package/dist/{chunk-HRQRRDSS.js → chunk-WPTRVD2V.js} +3 -3
- package/dist/{chunk-IRW5TWMH.js → chunk-XX4RRWOX.js} +5 -5
- package/dist/graphql/objects/index.d.cts +5 -43
- package/dist/graphql/objects/index.d.ts +5 -43
- package/dist/graphql/objects/index.js +1 -1
- package/dist/{index-BJOc8Ur-.d.cts → index-CZmDdSts.d.cts} +24 -10
- package/dist/{index-7RYRH5wc.d.ts → index-ClIRO_3y.d.ts} +24 -10
- package/dist/index.cjs +827 -414
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +15 -15
- package/dist/index.node.cjs +830 -417
- package/dist/index.node.d.cts +7 -7
- package/dist/index.node.d.ts +7 -7
- package/dist/index.node.js +18 -18
- package/dist/native/index.cjs +827 -414
- package/dist/native/index.d.cts +88 -23
- package/dist/native/index.d.ts +88 -23
- package/dist/native/index.js +819 -407
- package/dist/{network-D5lKssVl.d.cts → network-CfxLnaot.d.cts} +1 -1
- package/dist/{network-xkBSpaTn.d.ts → network-CroCOQ0B.d.ts} +1 -1
- package/dist/proto/lrc20.d.cts +1 -1
- package/dist/proto/lrc20.d.ts +1 -1
- package/dist/proto/lrc20.js +2 -2
- package/dist/proto/spark.cjs +332 -221
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark.js +3 -5
- package/dist/proto/spark_token.cjs +149 -9
- 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/{sdk-types-B-q9py_P.d.cts → sdk-types-BeCBoozO.d.cts} +1 -1
- package/dist/{sdk-types-BPoPgzda.d.ts → sdk-types-CTbTdDbE.d.ts} +1 -1
- package/dist/services/config.cjs +7 -3
- package/dist/services/config.d.cts +4 -4
- package/dist/services/config.d.ts +4 -4
- package/dist/services/config.js +5 -5
- package/dist/services/connection.cjs +334 -218
- package/dist/services/connection.d.cts +4 -4
- package/dist/services/connection.d.ts +4 -4
- package/dist/services/connection.js +4 -4
- package/dist/services/index.cjs +364 -227
- package/dist/services/index.d.cts +4 -4
- package/dist/services/index.d.ts +4 -4
- package/dist/services/index.js +9 -9
- package/dist/services/lrc-connection.cjs +5 -2
- package/dist/services/lrc-connection.d.cts +4 -4
- package/dist/services/lrc-connection.d.ts +4 -4
- package/dist/services/lrc-connection.js +4 -4
- package/dist/services/token-transactions.cjs +28 -8
- package/dist/services/token-transactions.d.cts +4 -4
- package/dist/services/token-transactions.d.ts +4 -4
- package/dist/services/token-transactions.js +3 -3
- package/dist/services/wallet-config.cjs +2 -1
- package/dist/services/wallet-config.d.cts +4 -4
- package/dist/services/wallet-config.d.ts +4 -4
- package/dist/services/wallet-config.js +1 -1
- package/dist/signer/signer.cjs +5 -2
- package/dist/signer/signer.d.cts +2 -2
- package/dist/signer/signer.d.ts +2 -2
- package/dist/signer/signer.js +2 -2
- package/dist/{signer-wqesWifN.d.ts → signer-D7vfYik9.d.ts} +1 -1
- package/dist/{signer-IO3oMRNj.d.cts → signer-DaY8c60s.d.cts} +1 -1
- package/dist/{spark-CDm4gqS6.d.ts → spark-C4ZrsgjC.d.cts} +47 -29
- package/dist/{spark-CDm4gqS6.d.cts → spark-C4ZrsgjC.d.ts} +47 -29
- package/dist/types/index.cjs +331 -219
- package/dist/types/index.d.cts +5 -5
- package/dist/types/index.d.ts +5 -5
- package/dist/types/index.js +3 -3
- package/dist/utils/index.cjs +298 -28
- package/dist/utils/index.d.cts +5 -5
- package/dist/utils/index.d.ts +5 -5
- package/dist/utils/index.js +6 -6
- package/package.json +1 -1
- package/src/constants.ts +5 -1
- package/src/graphql/client.ts +28 -0
- package/src/graphql/mutations/RequestCoopExit.ts +6 -0
- package/src/graphql/mutations/RequestSwapLeaves.ts +2 -0
- package/src/graphql/queries/GetCoopExitFeeQuote.ts +20 -0
- package/src/proto/spark.ts +454 -322
- package/src/services/token-transactions.ts +12 -0
- package/src/services/transfer.ts +0 -3
- package/src/services/wallet-config.ts +1 -0
- package/src/spark-wallet/spark-wallet.node.ts +3 -3
- package/src/spark-wallet/spark-wallet.ts +301 -125
- package/src/tests/integration/deposit.test.ts +16 -0
- package/src/tests/integration/ssp/coop-exit.test.ts +85 -21
- package/src/tests/integration/ssp/swap.test.ts +47 -0
- package/src/tests/tokens.test.ts +3 -2
- package/src/utils/token-hashing.ts +28 -10
- package/src/utils/transaction.ts +2 -2
- package/src/logger.ts +0 -3
|
@@ -176,6 +176,13 @@ export class TokenTransactionService {
|
|
|
176
176
|
tokenAmount: bigint;
|
|
177
177
|
}>,
|
|
178
178
|
): Promise<TokenTransactionV0> {
|
|
179
|
+
// Ensure outputsToSpend are ordered by vout ascending so that the input indices
|
|
180
|
+
// used for owner signatures match the order expected by the SO, which sorts
|
|
181
|
+
// inputs by "prevTokenTransactionVout" before validating signatures.
|
|
182
|
+
selectedOutputs.sort(
|
|
183
|
+
(a, b) => a.previousTransactionVout - b.previousTransactionVout,
|
|
184
|
+
);
|
|
185
|
+
|
|
179
186
|
const availableTokenAmount = calculateAvailableTokenAmount(selectedOutputs);
|
|
180
187
|
const totalRequestedAmount = tokenOutputData.reduce(
|
|
181
188
|
(sum, output) => sum + output.tokenAmount,
|
|
@@ -223,6 +230,10 @@ export class TokenTransactionService {
|
|
|
223
230
|
tokenAmount: bigint;
|
|
224
231
|
}>,
|
|
225
232
|
): Promise<TokenTransaction> {
|
|
233
|
+
selectedOutputs.sort(
|
|
234
|
+
(a, b) => a.previousTransactionVout - b.previousTransactionVout,
|
|
235
|
+
);
|
|
236
|
+
|
|
226
237
|
const availableTokenAmount = calculateAvailableTokenAmount(selectedOutputs);
|
|
227
238
|
const totalRequestedAmount = tokenOutputData.reduce(
|
|
228
239
|
(sum, output) => sum + output.tokenAmount,
|
|
@@ -826,6 +837,7 @@ export class TokenTransactionService {
|
|
|
826
837
|
await coordinatorClient.commit_transaction(
|
|
827
838
|
{
|
|
828
839
|
finalTokenTransaction,
|
|
840
|
+
finalTokenTransactionHash,
|
|
829
841
|
inputTtxoSignaturesPerOperator,
|
|
830
842
|
ownerIdentityPublicKey:
|
|
831
843
|
await this.config.signer.getIdentityPublicKey(),
|
package/src/services/transfer.ts
CHANGED
|
@@ -49,7 +49,6 @@ import {
|
|
|
49
49
|
getEphemeralAnchorOutput,
|
|
50
50
|
getNextTransactionSequence,
|
|
51
51
|
getTransactionSequence,
|
|
52
|
-
maybeApplyFee,
|
|
53
52
|
} from "../utils/transaction.js";
|
|
54
53
|
import { getTransferPackageSigningPayload } from "../utils/transfer_package.js";
|
|
55
54
|
import { WalletConfigService } from "./config.js";
|
|
@@ -429,7 +428,6 @@ export class BaseTransferService {
|
|
|
429
428
|
nodeTxSignature: new Uint8Array(),
|
|
430
429
|
});
|
|
431
430
|
}
|
|
432
|
-
|
|
433
431
|
return nodeSignatures;
|
|
434
432
|
}
|
|
435
433
|
|
|
@@ -607,7 +605,6 @@ export class TransferService extends BaseTransferService {
|
|
|
607
605
|
leaves,
|
|
608
606
|
proofMap,
|
|
609
607
|
);
|
|
610
|
-
|
|
611
608
|
return await this.finalizeNodeSignatures(signatures);
|
|
612
609
|
}
|
|
613
610
|
|
|
@@ -110,9 +110,9 @@ export class SparkWallet extends BaseSparkWallet {
|
|
|
110
110
|
"SparkWallet.withdraw",
|
|
111
111
|
this.withdraw.bind(this),
|
|
112
112
|
);
|
|
113
|
-
this.
|
|
114
|
-
"SparkWallet.
|
|
115
|
-
this.
|
|
113
|
+
this.getWithdrawalFeeQuote = this.wrapWithOtelSpan(
|
|
114
|
+
"SparkWallet.getWithdrawalFeeQuote",
|
|
115
|
+
this.getWithdrawalFeeQuote.bind(this),
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
|