@buildonspark/spark-sdk 0.1.12 → 0.1.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/dist/address/index.js +2 -2
- package/dist/{chunk-4FH2OPHD.js → chunk-67MM2MTI.js} +4 -4
- package/dist/{chunk-E7J7YO3V.js → chunk-A44BAL3X.js} +4 -1
- package/dist/chunk-A44BAL3X.js.map +1 -0
- package/dist/{chunk-PT2ZPNWY.js → chunk-CSNQ7B5H.js} +4 -4
- package/dist/{chunk-FGAO7DG6.js → chunk-ICII4F54.js} +5 -5
- package/dist/{chunk-NHI66Q4E.js → chunk-JSUPQJRO.js} +5 -5
- package/dist/{chunk-E4GXS2ZO.js → chunk-PANM2TKC.js} +3 -3
- package/dist/index.cjs +4 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +31 -38
- package/dist/index.js.map +1 -1
- package/dist/services/config.js +5 -5
- package/dist/services/connection.js +2 -2
- package/dist/services/index.cjs +3 -0
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.js +10 -10
- package/dist/services/token-transactions.cjs +3 -0
- package/dist/services/token-transactions.cjs.map +1 -1
- package/dist/services/token-transactions.js +1 -1
- package/dist/services/wallet-config.js +5 -5
- package/dist/signer/signer.js +3 -3
- package/dist/{spark-wallet-BDjhN_kg.d.cts → spark-wallet-B_wVWfyl.d.cts} +1 -1
- package/dist/{spark-wallet-Bf9AnErJ.d.ts → spark-wallet-fJvvrOXF.d.ts} +1 -1
- package/dist/tests/test-util.d.cts +1 -1
- package/dist/tests/test-util.d.ts +1 -1
- package/dist/tests/test-util.js +5 -5
- package/dist/utils/index.js +13 -13
- package/package.json +2 -2
- package/src/services/token-transactions.ts +3 -0
- package/src/spark-wallet.ts +1 -9
- package/dist/chunk-E7J7YO3V.js.map +0 -1
- /package/dist/{chunk-4FH2OPHD.js.map → chunk-67MM2MTI.js.map} +0 -0
- /package/dist/{chunk-PT2ZPNWY.js.map → chunk-CSNQ7B5H.js.map} +0 -0
- /package/dist/{chunk-FGAO7DG6.js.map → chunk-ICII4F54.js.map} +0 -0
- /package/dist/{chunk-NHI66Q4E.js.map → chunk-JSUPQJRO.js.map} +0 -0
- /package/dist/{chunk-E4GXS2ZO.js.map → chunk-PANM2TKC.js.map} +0 -0
package/dist/address/index.js
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
decodeSparkAddress,
|
|
3
3
|
encodeSparkAddress,
|
|
4
4
|
isValidSparkAddress
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-CSNQ7B5H.js";
|
|
6
|
+
import "../chunk-GPC7GYUG.js";
|
|
6
7
|
import "../chunk-4GQZLBIR.js";
|
|
7
8
|
import "../chunk-7Z7Y2PCW.js";
|
|
8
|
-
import "../chunk-GPC7GYUG.js";
|
|
9
9
|
import "../chunk-TNZ6QAWE.js";
|
|
10
10
|
export {
|
|
11
11
|
decodeSparkAddress,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
splitSecretWithProofs
|
|
3
|
-
} from "./chunk-E7KLXM76.js";
|
|
4
1
|
import {
|
|
5
2
|
BitcoinNetwork_default
|
|
6
3
|
} from "./chunk-KMLWFG2H.js";
|
|
4
|
+
import {
|
|
5
|
+
splitSecretWithProofs
|
|
6
|
+
} from "./chunk-E7KLXM76.js";
|
|
7
7
|
import {
|
|
8
8
|
ConfigurationError,
|
|
9
9
|
ValidationError
|
|
@@ -1824,4 +1824,4 @@ export {
|
|
|
1824
1824
|
decryptEcies,
|
|
1825
1825
|
DefaultSparkSigner
|
|
1826
1826
|
};
|
|
1827
|
-
//# sourceMappingURL=chunk-
|
|
1827
|
+
//# sourceMappingURL=chunk-67MM2MTI.js.map
|
|
@@ -817,6 +817,7 @@ var TokenTransactionService = class {
|
|
|
817
817
|
},
|
|
818
818
|
{
|
|
819
819
|
retry: true,
|
|
820
|
+
retryableStatuses: ["UNKNOWN", "UNAVAILABLE", "CANCELLED"],
|
|
820
821
|
retryMaxAttempts: 3
|
|
821
822
|
}
|
|
822
823
|
);
|
|
@@ -910,6 +911,7 @@ var TokenTransactionService = class {
|
|
|
910
911
|
},
|
|
911
912
|
{
|
|
912
913
|
retry: true,
|
|
914
|
+
retryableStatuses: ["UNKNOWN", "UNAVAILABLE", "CANCELLED"],
|
|
913
915
|
retryMaxAttempts: 3
|
|
914
916
|
}
|
|
915
917
|
);
|
|
@@ -952,6 +954,7 @@ var TokenTransactionService = class {
|
|
|
952
954
|
},
|
|
953
955
|
{
|
|
954
956
|
retry: true,
|
|
957
|
+
retryableStatuses: ["UNKNOWN", "UNAVAILABLE", "CANCELLED"],
|
|
955
958
|
retryMaxAttempts: 3
|
|
956
959
|
}
|
|
957
960
|
);
|
|
@@ -1071,4 +1074,4 @@ var TokenTransactionService = class {
|
|
|
1071
1074
|
export {
|
|
1072
1075
|
TokenTransactionService
|
|
1073
1076
|
};
|
|
1074
|
-
//# sourceMappingURL=chunk-
|
|
1077
|
+
//# sourceMappingURL=chunk-A44BAL3X.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/services/token-transactions.ts","../src/utils/token-hashing.ts","../src/utils/token-keyshares.ts","../src/utils/token-transaction-validation.ts"],"sourcesContent":["import {\n bytesToHex,\n bytesToNumberBE,\n numberToBytesBE,\n} from \"@noble/curves/abstract/utils\";\nimport { secp256k1 } from \"@noble/curves/secp256k1\";\nimport {\n OutputWithPreviousTransactionData,\n OperatorSpecificTokenTransactionSignablePayload,\n OperatorSpecificOwnerSignature,\n TokenTransaction,\n StartTokenTransactionResponse,\n SignTokenTransactionResponse,\n SignatureWithIndex,\n RevocationSecretWithIndex,\n} from \"../proto/spark.js\";\nimport { SparkCallOptions } from \"../types/grpc.js\";\nimport { collectResponses } from \"../utils/response-validation.js\";\nimport {\n hashOperatorSpecificTokenTransactionSignablePayload,\n hashTokenTransaction,\n} from \"../utils/token-hashing.js\";\nimport {\n KeyshareWithOperatorIndex,\n recoverRevocationSecretFromKeyshares,\n} from \"../utils/token-keyshares.js\";\nimport { calculateAvailableTokenAmount } from \"../utils/token-transactions.js\";\nimport { validateTokenTransaction } from \"../utils/token-transaction-validation.js\";\nimport { WalletConfigService } from \"./config.js\";\nimport { ConnectionManager } from \"./connection.js\";\nimport {\n ValidationError,\n NetworkError,\n InternalValidationError,\n} from \"../errors/types.js\";\nimport { SigningOperator } from \"./wallet-config.js\";\nimport { hexToBytes } from \"@noble/hashes/utils\";\n\nexport class TokenTransactionService {\n protected readonly config: WalletConfigService;\n protected readonly connectionManager: ConnectionManager;\n\n constructor(\n config: WalletConfigService,\n connectionManager: ConnectionManager,\n ) {\n this.config = config;\n this.connectionManager = connectionManager;\n }\n\n public async constructTransferTokenTransaction(\n selectedOutputs: OutputWithPreviousTransactionData[],\n receiverSparkAddress: Uint8Array,\n tokenPublicKey: Uint8Array,\n tokenAmount: bigint,\n ): Promise<TokenTransaction> {\n let availableTokenAmount = calculateAvailableTokenAmount(selectedOutputs);\n\n if (availableTokenAmount === tokenAmount) {\n return {\n network: this.config.getNetworkProto(),\n tokenInputs: {\n $case: \"transferInput\",\n transferInput: {\n outputsToSpend: selectedOutputs.map((output) => ({\n prevTokenTransactionHash: output.previousTransactionHash,\n prevTokenTransactionVout: output.previousTransactionVout,\n })),\n },\n },\n tokenOutputs: [\n {\n ownerPublicKey: receiverSparkAddress,\n tokenPublicKey: tokenPublicKey,\n tokenAmount: numberToBytesBE(tokenAmount, 16),\n },\n ],\n sparkOperatorIdentityPublicKeys:\n this.collectOperatorIdentityPublicKeys(),\n };\n } else {\n const tokenAmountDifference = availableTokenAmount - tokenAmount;\n\n return {\n network: this.config.getNetworkProto(),\n tokenInputs: {\n $case: \"transferInput\",\n transferInput: {\n outputsToSpend: selectedOutputs.map((output) => ({\n prevTokenTransactionHash: output.previousTransactionHash,\n prevTokenTransactionVout: output.previousTransactionVout,\n })),\n },\n },\n tokenOutputs: [\n {\n ownerPublicKey: receiverSparkAddress,\n tokenPublicKey: tokenPublicKey,\n tokenAmount: numberToBytesBE(tokenAmount, 16),\n },\n {\n ownerPublicKey: await this.config.signer.getIdentityPublicKey(),\n tokenPublicKey: tokenPublicKey,\n tokenAmount: numberToBytesBE(tokenAmountDifference, 16),\n },\n ],\n sparkOperatorIdentityPublicKeys:\n this.collectOperatorIdentityPublicKeys(),\n };\n }\n }\n\n public collectOperatorIdentityPublicKeys(): Uint8Array[] {\n const operatorKeys: Uint8Array[] = [];\n for (const [_, operator] of Object.entries(\n this.config.getSigningOperators(),\n )) {\n operatorKeys.push(hexToBytes(operator.identityPublicKey));\n }\n\n return operatorKeys;\n }\n\n public async broadcastTokenTransaction(\n tokenTransaction: TokenTransaction,\n outputsToSpendSigningPublicKeys?: Uint8Array[],\n outputsToSpendCommitments?: Uint8Array[],\n ): Promise<string> {\n const signingOperators = this.config.getSigningOperators();\n\n const { finalTokenTransaction, finalTokenTransactionHash, threshold } =\n await this.startTokenTransaction(\n tokenTransaction,\n signingOperators,\n outputsToSpendSigningPublicKeys,\n outputsToSpendCommitments,\n );\n\n const { successfulSignatures } = await this.signTokenTransaction(\n finalTokenTransaction,\n finalTokenTransactionHash,\n signingOperators,\n );\n\n if (finalTokenTransaction.tokenInputs!.$case === \"transferInput\") {\n const outputsToSpend =\n finalTokenTransaction.tokenInputs!.transferInput.outputsToSpend;\n\n const errors: ValidationError[] = [];\n const revocationSecrets: RevocationSecretWithIndex[] = [];\n\n for (\n let outputIndex = 0;\n outputIndex < outputsToSpend.length;\n outputIndex++\n ) {\n // For each output, collect keyshares from all SOs that responded successfully\n const outputKeyshares: KeyshareWithOperatorIndex[] =\n successfulSignatures.map(({ identifier, response }) => ({\n operatorIndex: parseInt(identifier, 16),\n keyshare: response.revocationKeyshares[outputIndex]!,\n }));\n\n if (outputKeyshares.length < threshold) {\n errors.push(\n new ValidationError(\"Insufficient keyshares\", {\n field: \"outputKeyshares\",\n value: outputKeyshares.length,\n expected: threshold,\n index: outputIndex,\n }),\n );\n }\n\n // Check for duplicate operator indices\n const seenIndices = new Set<number>();\n for (const { operatorIndex } of outputKeyshares) {\n if (seenIndices.has(operatorIndex)) {\n errors.push(\n new ValidationError(\"Duplicate operator index\", {\n field: \"outputKeyshares\",\n value: operatorIndex,\n expected: \"Unique operator index\",\n index: outputIndex,\n }),\n );\n }\n seenIndices.add(operatorIndex);\n }\n\n const revocationSecret = recoverRevocationSecretFromKeyshares(\n outputKeyshares as KeyshareWithOperatorIndex[],\n threshold,\n );\n const derivedRevocationCommitment = secp256k1.getPublicKey(\n revocationSecret,\n true,\n );\n\n if (\n !outputsToSpendCommitments ||\n !outputsToSpendCommitments[outputIndex] ||\n !derivedRevocationCommitment.every(\n (byte, i) => byte === outputsToSpendCommitments[outputIndex]![i],\n )\n ) {\n errors.push(\n new InternalValidationError(\n \"Revocation commitment verification failed\",\n {\n field: \"revocationCommitment\",\n value: derivedRevocationCommitment,\n expected: bytesToHex(outputsToSpendCommitments![outputIndex]!),\n outputIndex: outputIndex,\n },\n ),\n );\n }\n\n revocationSecrets.push({\n inputIndex: outputIndex,\n revocationSecret,\n });\n }\n\n if (errors.length > 0) {\n throw new ValidationError(\n \"Multiple validation errors occurred across outputs\",\n {\n field: \"outputValidation\",\n value: errors,\n },\n );\n }\n\n // Finalize the token transaction with the keyshares\n await this.finalizeTokenTransaction(\n finalTokenTransaction,\n revocationSecrets,\n threshold,\n );\n }\n\n return bytesToHex(finalTokenTransactionHash);\n }\n\n private async startTokenTransaction(\n tokenTransaction: TokenTransaction,\n signingOperators: Record<string, SigningOperator>,\n outputsToSpendSigningPublicKeys?: Uint8Array[],\n outputsToSpendCommitments?: Uint8Array[],\n ): Promise<{\n finalTokenTransaction: TokenTransaction;\n finalTokenTransactionHash: Uint8Array;\n threshold: number;\n }> {\n const sparkClient = await this.connectionManager.createSparkClient(\n this.config.getCoordinatorAddress(),\n );\n\n const partialTokenTransactionHash = hashTokenTransaction(\n tokenTransaction,\n true,\n );\n\n const ownerSignaturesWithIndex: SignatureWithIndex[] = [];\n if (tokenTransaction.tokenInputs!.$case === \"mintInput\") {\n const issuerPublicKey =\n tokenTransaction.tokenInputs!.mintInput.issuerPublicKey;\n if (!issuerPublicKey) {\n throw new ValidationError(\"Invalid mint input\", {\n field: \"issuerPublicKey\",\n value: null,\n expected: \"Non-null issuer public key\",\n });\n }\n\n const ownerSignature = await this.signMessageWithKey(\n partialTokenTransactionHash,\n issuerPublicKey,\n );\n\n ownerSignaturesWithIndex.push({\n signature: ownerSignature,\n inputIndex: 0,\n });\n } else if (tokenTransaction.tokenInputs!.$case === \"transferInput\") {\n if (!outputsToSpendSigningPublicKeys || !outputsToSpendCommitments) {\n throw new ValidationError(\"Invalid transfer input\", {\n field: \"outputsToSpend\",\n value: {\n signingPublicKeys: outputsToSpendSigningPublicKeys,\n revocationPublicKeys: outputsToSpendCommitments,\n },\n expected: \"Non-null signing and revocation public keys\",\n });\n }\n\n outputsToSpendSigningPublicKeys.forEach(async (key, i) => {\n if (!key) {\n throw new ValidationError(\"Invalid signing key\", {\n field: \"outputsToSpendSigningPublicKeys\",\n value: i,\n expected: \"Non-null signing key\",\n });\n }\n const ownerSignature = await this.signMessageWithKey(\n partialTokenTransactionHash,\n key,\n );\n\n ownerSignaturesWithIndex.push({\n signature: ownerSignature,\n inputIndex: i,\n });\n });\n }\n\n // Start the token transaction\n const startResponse = await sparkClient.start_token_transaction(\n {\n identityPublicKey: await this.config.signer.getIdentityPublicKey(),\n partialTokenTransaction: tokenTransaction,\n tokenTransactionSignatures: {\n ownerSignatures: ownerSignaturesWithIndex,\n },\n },\n {\n retry: true,\n retryableStatuses: [\"UNKNOWN\", \"UNAVAILABLE\", \"CANCELLED\"],\n retryMaxAttempts: 3,\n } as SparkCallOptions,\n );\n\n if (!startResponse.finalTokenTransaction) {\n throw new Error(\"Final token transaction missing in start response\");\n }\n if (!startResponse.keyshareInfo) {\n throw new Error(\"Keyshare info missing in start response\");\n }\n\n validateTokenTransaction(\n startResponse.finalTokenTransaction,\n tokenTransaction,\n signingOperators,\n startResponse.keyshareInfo,\n this.config.getExpectedWithdrawBondSats(),\n this.config.getExpectedWithdrawRelativeBlockLocktime(),\n this.config.getThreshold(),\n );\n\n const finalTokenTransaction = startResponse.finalTokenTransaction;\n const finalTokenTransactionHash = hashTokenTransaction(\n finalTokenTransaction,\n false,\n );\n\n return {\n finalTokenTransaction,\n finalTokenTransactionHash,\n threshold: startResponse.keyshareInfo!.threshold,\n };\n }\n\n private async signTokenTransaction(\n finalTokenTransaction: TokenTransaction,\n finalTokenTransactionHash: Uint8Array,\n signingOperators: Record<string, SigningOperator>,\n ): Promise<{\n successfulSignatures: {\n index: number;\n identifier: string;\n response: SignTokenTransactionResponse;\n }[];\n }> {\n // Submit sign_token_transaction to all SOs in parallel and track their indices\n const soSignatures = await Promise.allSettled(\n Object.entries(signingOperators).map(\n async ([identifier, operator], index) => {\n const internalSparkClient =\n await this.connectionManager.createSparkClient(operator.address);\n const identityPublicKey =\n await this.config.signer.getIdentityPublicKey();\n\n // Create operator-specific payload with operator's identity public key\n const payload: OperatorSpecificTokenTransactionSignablePayload = {\n finalTokenTransactionHash: finalTokenTransactionHash,\n operatorIdentityPublicKey: hexToBytes(operator.identityPublicKey),\n };\n\n const payloadHash =\n await hashOperatorSpecificTokenTransactionSignablePayload(payload);\n\n let operatorSpecificSignatures: OperatorSpecificOwnerSignature[] = [];\n if (finalTokenTransaction.tokenInputs!.$case === \"mintInput\") {\n const issuerPublicKey =\n finalTokenTransaction.tokenInputs!.mintInput.issuerPublicKey;\n if (!issuerPublicKey) {\n throw new ValidationError(\"Invalid mint input\", {\n field: \"issuerPublicKey\",\n value: null,\n expected: \"Non-null issuer public key\",\n });\n }\n\n const ownerSignature = await this.signMessageWithKey(\n payloadHash,\n issuerPublicKey,\n );\n\n operatorSpecificSignatures.push({\n ownerSignature: {\n signature: ownerSignature,\n inputIndex: 0,\n },\n payload: payload,\n });\n }\n\n if (finalTokenTransaction.tokenInputs!.$case === \"transferInput\") {\n const transferInput =\n finalTokenTransaction.tokenInputs!.transferInput;\n for (let i = 0; i < transferInput.outputsToSpend.length; i++) {\n let ownerSignature: Uint8Array;\n if (this.config.shouldSignTokenTransactionsWithSchnorr()) {\n ownerSignature =\n await this.config.signer.signSchnorrWithIdentityKey(\n payloadHash,\n );\n } else {\n ownerSignature =\n await this.config.signer.signMessageWithIdentityKey(\n payloadHash,\n );\n }\n\n operatorSpecificSignatures.push({\n ownerSignature: {\n signature: ownerSignature,\n inputIndex: i,\n },\n payload,\n });\n }\n }\n\n try {\n const response = await internalSparkClient.sign_token_transaction(\n {\n finalTokenTransaction,\n operatorSpecificSignatures,\n identityPublicKey,\n },\n {\n retry: true,\n retryableStatuses: [\"UNKNOWN\", \"UNAVAILABLE\", \"CANCELLED\"],\n retryMaxAttempts: 3,\n } as SparkCallOptions,\n );\n\n return {\n index,\n identifier,\n response,\n };\n } catch (error) {\n throw new NetworkError(\n \"Failed to sign token transaction\",\n {\n operation: \"sign_token_transaction\",\n errorCount: 1,\n errors: error instanceof Error ? error.message : String(error),\n },\n error as Error,\n );\n }\n },\n ),\n );\n\n const successfulSignatures = collectResponses(soSignatures);\n\n return {\n successfulSignatures,\n };\n }\n\n public async finalizeTokenTransaction(\n finalTokenTransaction: TokenTransaction,\n revocationSecrets: RevocationSecretWithIndex[],\n threshold: number,\n ): Promise<TokenTransaction> {\n const signingOperators = this.config.getSigningOperators();\n // Submit finalize_token_transaction to all SOs in parallel\n const soResponses = await Promise.allSettled(\n Object.entries(signingOperators).map(async ([identifier, operator]) => {\n const internalSparkClient =\n await this.connectionManager.createSparkClient(operator.address);\n const identityPublicKey =\n await this.config.signer.getIdentityPublicKey();\n\n try {\n const response = await internalSparkClient.finalize_token_transaction(\n {\n finalTokenTransaction,\n revocationSecrets,\n identityPublicKey,\n },\n {\n retry: true,\n retryableStatuses: [\"UNKNOWN\", \"UNAVAILABLE\", \"CANCELLED\"],\n retryMaxAttempts: 3,\n } as SparkCallOptions,\n );\n\n return {\n identifier,\n response,\n };\n } catch (error) {\n throw new NetworkError(\n \"Failed to finalize token transaction\",\n {\n operation: \"finalize_token_transaction\",\n errorCount: 1,\n errors: error instanceof Error ? error.message : String(error),\n },\n error as Error,\n );\n }\n }),\n );\n\n collectResponses(soResponses);\n\n return finalTokenTransaction;\n }\n\n public async fetchOwnedTokenOutputs(\n ownerPublicKeys: Uint8Array[],\n tokenPublicKeys: Uint8Array[],\n ): Promise<OutputWithPreviousTransactionData[]> {\n const sparkClient = await this.connectionManager.createSparkClient(\n this.config.getCoordinatorAddress(),\n );\n\n try {\n const result = await sparkClient.query_token_outputs({\n ownerPublicKeys,\n tokenPublicKeys,\n });\n\n return result.outputsWithPreviousTransactionData;\n } catch (error) {\n throw new NetworkError(\n \"Failed to fetch owned token outputs\",\n {\n operation: \"query_token_outputs\",\n errorCount: 1,\n errors: error instanceof Error ? error.message : String(error),\n },\n error as Error,\n );\n }\n }\n\n public async syncTokenOutputs(\n tokenOutputs: Map<string, OutputWithPreviousTransactionData[]>,\n ) {\n const unsortedTokenOutputs = await this.fetchOwnedTokenOutputs(\n await this.config.signer.getTrackedPublicKeys(),\n [],\n );\n\n unsortedTokenOutputs.forEach((output) => {\n const tokenKey = bytesToHex(output.output!.tokenPublicKey!);\n const index = output.previousTransactionVout!;\n\n tokenOutputs.set(tokenKey, [\n { ...output, previousTransactionVout: index },\n ]);\n });\n }\n\n public selectTokenOutputs(\n tokenOutputs: OutputWithPreviousTransactionData[],\n tokenAmount: bigint,\n ): OutputWithPreviousTransactionData[] {\n if (calculateAvailableTokenAmount(tokenOutputs) < tokenAmount) {\n throw new ValidationError(\"Insufficient token amount\", {\n field: \"tokenAmount\",\n value: calculateAvailableTokenAmount(tokenOutputs),\n expected: tokenAmount,\n });\n }\n\n // First try to find an exact match\n const exactMatch: OutputWithPreviousTransactionData | undefined =\n tokenOutputs.find(\n (item) => bytesToNumberBE(item.output!.tokenAmount!) === tokenAmount,\n );\n\n if (exactMatch) {\n return [exactMatch];\n }\n\n // Sort by amount ascending for optimal selection.\n // It's in user's interest to hold as little token outputs as possible,\n // so that in the event of a unilateral exit the fees are as low as possible\n tokenOutputs.sort((a, b) =>\n Number(\n bytesToNumberBE(a.output!.tokenAmount!) -\n bytesToNumberBE(b.output!.tokenAmount!),\n ),\n );\n\n let remainingAmount = tokenAmount;\n const selectedOutputs: typeof tokenOutputs = [];\n\n // Select outputs using a greedy approach\n for (const outputWithPreviousTransactionData of tokenOutputs) {\n if (remainingAmount <= 0n) break;\n\n selectedOutputs.push(outputWithPreviousTransactionData);\n remainingAmount -= bytesToNumberBE(\n outputWithPreviousTransactionData.output!.tokenAmount!,\n );\n }\n\n if (remainingAmount > 0n) {\n throw new ValidationError(\"Insufficient funds\", {\n field: \"remainingAmount\",\n value: remainingAmount,\n });\n }\n\n return selectedOutputs;\n }\n\n // Helper function for deciding if the signer public key is the identity public key\n private async signMessageWithKey(\n message: Uint8Array,\n publicKey: Uint8Array,\n ): Promise<Uint8Array> {\n const signWithSchnorr =\n this.config.shouldSignTokenTransactionsWithSchnorr();\n if (\n bytesToHex(publicKey) ===\n bytesToHex(await this.config.signer.getIdentityPublicKey())\n ) {\n if (signWithSchnorr) {\n return await this.config.signer.signSchnorrWithIdentityKey(message);\n } else {\n return await this.config.signer.signMessageWithIdentityKey(message);\n }\n } else {\n if (signWithSchnorr) {\n return await this.config.signer.signSchnorr(message, publicKey);\n } else {\n return await this.config.signer.signMessageWithPublicKey(\n message,\n publicKey,\n );\n }\n }\n }\n}\n","import { sha256 } from \"@scure/btc-signer/utils\";\nimport {\n OperatorSpecificTokenTransactionSignablePayload,\n TokenTransaction,\n} from \"../proto/spark.js\";\nimport { ValidationError } from \"../errors/types.js\";\n\nexport function hashTokenTransaction(\n tokenTransaction: TokenTransaction,\n partialHash: boolean = false,\n): Uint8Array {\n if (!tokenTransaction) {\n throw new ValidationError(\"token transaction cannot be nil\", {\n field: \"tokenTransaction\",\n });\n }\n\n let allHashes: Uint8Array[] = [];\n\n // Hash token inputs if a transfer\n if (tokenTransaction.tokenInputs?.$case === \"transferInput\") {\n if (!tokenTransaction.tokenInputs.transferInput.outputsToSpend) {\n throw new ValidationError(\"outputs to spend cannot be null\", {\n field: \"tokenInputs.transferInput.outputsToSpend\",\n });\n }\n\n if (\n tokenTransaction.tokenInputs.transferInput.outputsToSpend.length === 0\n ) {\n throw new ValidationError(\"outputs to spend cannot be empty\", {\n field: \"tokenInputs.transferInput.outputsToSpend\",\n });\n }\n\n // Hash outputs to spend\n for (const [\n i,\n output,\n ] of tokenTransaction.tokenInputs!.transferInput!.outputsToSpend.entries()) {\n if (!output) {\n throw new ValidationError(`output cannot be null at index ${i}`, {\n field: `tokenInputs.transferInput.outputsToSpend[${i}]`,\n index: i,\n });\n }\n\n const hashObj = sha256.create();\n\n if (output.prevTokenTransactionHash) {\n const prevHash = output.prevTokenTransactionHash;\n if (output.prevTokenTransactionHash.length !== 32) {\n throw new ValidationError(\n `invalid previous transaction hash length at index ${i}`,\n {\n field: `tokenInputs.transferInput.outputsToSpend[${i}].prevTokenTransactionHash`,\n value: prevHash,\n expectedLength: 32,\n actualLength: prevHash.length,\n index: i,\n },\n );\n }\n hashObj.update(output.prevTokenTransactionHash);\n }\n\n const voutBytes = new Uint8Array(4);\n new DataView(voutBytes.buffer).setUint32(\n 0,\n output.prevTokenTransactionVout,\n false,\n ); // false for big-endian\n hashObj.update(voutBytes);\n\n allHashes.push(hashObj.digest());\n }\n }\n\n // Hash input issuance if a mint\n if (tokenTransaction.tokenInputs?.$case === \"mintInput\") {\n const hashObj = sha256.create();\n\n if (tokenTransaction.tokenInputs.mintInput!.issuerPublicKey) {\n const issuerPubKey: Uint8Array =\n tokenTransaction.tokenInputs.mintInput.issuerPublicKey;\n if (issuerPubKey.length === 0) {\n throw new ValidationError(\"issuer public key cannot be empty\", {\n field: \"tokenInputs.mintInput.issuerPublicKey\",\n value: issuerPubKey,\n expectedLength: 1,\n actualLength: 0,\n });\n }\n hashObj.update(issuerPubKey);\n\n if (\n tokenTransaction.tokenInputs.mintInput!.issuerProvidedTimestamp != 0\n ) {\n const timestampBytes = new Uint8Array(8);\n new DataView(timestampBytes.buffer).setBigUint64(\n 0,\n BigInt(\n tokenTransaction.tokenInputs.mintInput!.issuerProvidedTimestamp,\n ),\n true, // true for little-endian to match Go implementation\n );\n hashObj.update(timestampBytes);\n }\n allHashes.push(hashObj.digest());\n }\n }\n\n // Hash token outputs\n if (!tokenTransaction.tokenOutputs) {\n throw new ValidationError(\"token outputs cannot be null\", {\n field: \"tokenOutputs\",\n });\n }\n\n if (tokenTransaction.tokenOutputs.length === 0) {\n throw new ValidationError(\"token outputs cannot be empty\", {\n field: \"tokenOutputs\",\n });\n }\n\n for (const [i, output] of tokenTransaction.tokenOutputs.entries()) {\n if (!output) {\n throw new ValidationError(`output cannot be null at index ${i}`, {\n field: `tokenOutputs[${i}]`,\n index: i,\n });\n }\n\n const hashObj = sha256.create();\n\n // Only hash ID if it's not empty and not in partial hash mode\n if (output.id && !partialHash) {\n if (output.id.length === 0) {\n throw new ValidationError(`output ID at index ${i} cannot be empty`, {\n field: `tokenOutputs[${i}].id`,\n index: i,\n });\n }\n hashObj.update(new TextEncoder().encode(output.id));\n }\n if (output.ownerPublicKey) {\n if (output.ownerPublicKey.length === 0) {\n throw new ValidationError(\n `owner public key at index ${i} cannot be empty`,\n {\n field: `tokenOutputs[${i}].ownerPublicKey`,\n index: i,\n },\n );\n }\n hashObj.update(output.ownerPublicKey);\n }\n\n if (!partialHash) {\n const revPubKey = output.revocationCommitment!!;\n if (revPubKey) {\n if (revPubKey.length === 0) {\n throw new ValidationError(\n `revocation commitment at index ${i} cannot be empty`,\n {\n field: `tokenOutputs[${i}].revocationCommitment`,\n index: i,\n },\n );\n }\n hashObj.update(revPubKey);\n }\n\n const bondBytes = new Uint8Array(8);\n new DataView(bondBytes.buffer).setBigUint64(\n 0,\n BigInt(output.withdrawBondSats!),\n false,\n );\n hashObj.update(bondBytes);\n\n const locktimeBytes = new Uint8Array(8);\n new DataView(locktimeBytes.buffer).setBigUint64(\n 0,\n BigInt(output.withdrawRelativeBlockLocktime!),\n false,\n );\n hashObj.update(locktimeBytes);\n }\n\n if (output.tokenPublicKey) {\n if (output.tokenPublicKey.length === 0) {\n throw new ValidationError(\n `token public key at index ${i} cannot be empty`,\n {\n field: `tokenOutputs[${i}].tokenPublicKey`,\n index: i,\n },\n );\n }\n hashObj.update(output.tokenPublicKey);\n }\n if (output.tokenAmount) {\n if (output.tokenAmount.length === 0) {\n throw new ValidationError(\n `token amount at index ${i} cannot be empty`,\n {\n field: `tokenOutputs[${i}].tokenAmount`,\n index: i,\n },\n );\n }\n if (output.tokenAmount.length > 16) {\n throw new ValidationError(\n `token amount at index ${i} exceeds maximum length`,\n {\n field: `tokenOutputs[${i}].tokenAmount`,\n value: output.tokenAmount,\n expectedLength: 16,\n actualLength: output.tokenAmount.length,\n index: i,\n },\n );\n }\n hashObj.update(output.tokenAmount);\n }\n\n allHashes.push(hashObj.digest());\n }\n\n if (!tokenTransaction.sparkOperatorIdentityPublicKeys) {\n throw new ValidationError(\n \"spark operator identity public keys cannot be null\",\n {},\n );\n }\n\n // Sort operator public keys before hashing\n const sortedPubKeys = [\n ...(tokenTransaction.sparkOperatorIdentityPublicKeys || []),\n ].sort((a, b) => {\n for (let i = 0; i < a.length && i < b.length; i++) {\n // @ts-ignore - i < a and b length\n if (a[i] !== b[i]) return a[i] - b[i];\n }\n return a.length - b.length;\n });\n\n // Hash spark operator identity public keys\n for (const [i, pubKey] of sortedPubKeys.entries()) {\n if (!pubKey) {\n throw new ValidationError(\n `operator public key at index ${i} cannot be null`,\n {\n field: `sparkOperatorIdentityPublicKeys[${i}]`,\n index: i,\n },\n );\n }\n if (pubKey.length === 0) {\n throw new ValidationError(\n `operator public key at index ${i} cannot be empty`,\n {\n field: `sparkOperatorIdentityPublicKeys[${i}]`,\n index: i,\n },\n );\n }\n const hashObj = sha256.create();\n hashObj.update(pubKey);\n allHashes.push(hashObj.digest());\n }\n\n // Hash the network field\n const hashObj = sha256.create();\n let networkBytes = new Uint8Array(4);\n new DataView(networkBytes.buffer).setUint32(\n 0,\n tokenTransaction.network.valueOf(),\n false, // false for big-endian\n );\n hashObj.update(networkBytes);\n allHashes.push(hashObj.digest());\n\n // Final hash of all concatenated hashes\n const finalHashObj = sha256.create();\n const concatenatedHashes = new Uint8Array(\n allHashes.reduce((sum, hash) => sum + hash.length, 0),\n );\n let offset = 0;\n for (const hash of allHashes) {\n concatenatedHashes.set(hash, offset);\n offset += hash.length;\n }\n finalHashObj.update(concatenatedHashes);\n return finalHashObj.digest();\n}\n\nexport function hashOperatorSpecificTokenTransactionSignablePayload(\n payload: OperatorSpecificTokenTransactionSignablePayload,\n): Uint8Array {\n if (!payload) {\n throw new ValidationError(\n \"operator specific token transaction signable payload cannot be null\",\n {\n field: \"payload\",\n },\n );\n }\n\n let allHashes: Uint8Array[] = [];\n\n // Hash final token transaction hash if present\n if (payload.finalTokenTransactionHash) {\n const hashObj = sha256.create();\n if (payload.finalTokenTransactionHash.length !== 32) {\n throw new ValidationError(`invalid final token transaction hash length`, {\n field: \"finalTokenTransactionHash\",\n value: payload.finalTokenTransactionHash,\n expectedLength: 32,\n actualLength: payload.finalTokenTransactionHash.length,\n });\n }\n hashObj.update(payload.finalTokenTransactionHash);\n allHashes.push(hashObj.digest());\n }\n\n // Hash operator identity public key\n if (!payload.operatorIdentityPublicKey) {\n throw new ValidationError(\"operator identity public key cannot be null\", {\n field: \"operatorIdentityPublicKey\",\n });\n }\n\n if (payload.operatorIdentityPublicKey.length === 0) {\n throw new ValidationError(\"operator identity public key cannot be empty\", {\n field: \"operatorIdentityPublicKey\",\n });\n }\n\n const hashObj = sha256.create();\n hashObj.update(payload.operatorIdentityPublicKey);\n allHashes.push(hashObj.digest());\n\n // Final hash of all concatenated hashes\n const finalHashObj = sha256.create();\n const concatenatedHashes = new Uint8Array(\n allHashes.reduce((sum, hash) => sum + hash.length, 0),\n );\n let offset = 0;\n for (const hash of allHashes) {\n concatenatedHashes.set(hash, offset);\n offset += hash.length;\n }\n finalHashObj.update(concatenatedHashes);\n return finalHashObj.digest();\n}\n","import { secp256k1 } from \"@noble/curves/secp256k1\";\nimport {\n bigIntToPrivateKey,\n recoverSecret,\n VerifiableSecretShare,\n} from \"./secret-sharing.js\";\nimport { KeyshareWithIndex } from \"../proto/spark.js\";\n\nexport interface KeyshareWithOperatorIndex {\n operatorIndex: number;\n keyshare: KeyshareWithIndex;\n}\n\nexport function recoverRevocationSecretFromKeyshares(\n keyshares: KeyshareWithOperatorIndex[],\n threshold: number,\n): Uint8Array {\n // Convert keyshares to secret shares format\n const shares: VerifiableSecretShare[] = keyshares.map((keyshare) => ({\n fieldModulus: BigInt(\"0x\" + secp256k1.CURVE.n.toString(16)), // secp256k1 curve order\n threshold,\n index: BigInt(keyshare.operatorIndex),\n share: BigInt(\n \"0x\" + Buffer.from(keyshare.keyshare.keyshare).toString(\"hex\"),\n ),\n proofs: [],\n }));\n\n const recoveredSecret = recoverSecret(shares);\n return bigIntToPrivateKey(recoveredSecret);\n}\n","import { InternalValidationError } from \"../errors/types.js\";\nimport { TokenTransaction, TokenOutputToSpend } from \"../proto/spark.js\";\n\nfunction areByteArraysEqual(a: Uint8Array, b: Uint8Array): boolean {\n if (a.length !== b.length) {\n return false;\n }\n return a.every((byte, index) => byte === b[index]);\n}\n\nfunction hasDuplicates<T>(array: T[]): boolean {\n return new Set(array).size !== array.length;\n}\n\nexport function validateTokenTransaction(\n finalTokenTransaction: TokenTransaction,\n partialTokenTransaction: TokenTransaction,\n signingOperators: Record<string, any>,\n keyshareInfo: { ownerIdentifiers: string[]; threshold: number },\n expectedWithdrawBondSats: number,\n expectedWithdrawRelativeBlockLocktime: number,\n expectedThreshold: number,\n) {\n if (finalTokenTransaction.network !== partialTokenTransaction.network) {\n throw new InternalValidationError(\n \"Network mismatch in response token transaction\",\n {\n value: finalTokenTransaction.network,\n expected: partialTokenTransaction.network,\n },\n );\n }\n\n if (!finalTokenTransaction.tokenInputs) {\n throw new InternalValidationError(\n \"Token inputs missing in final transaction\",\n {\n value: finalTokenTransaction,\n },\n );\n }\n\n if (!partialTokenTransaction.tokenInputs) {\n throw new InternalValidationError(\n \"Token inputs missing in partial transaction\",\n {\n value: partialTokenTransaction,\n },\n );\n }\n\n if (\n finalTokenTransaction.tokenInputs.$case !==\n partialTokenTransaction.tokenInputs.$case\n ) {\n throw new InternalValidationError(\n `Transaction type mismatch: final transaction has ${finalTokenTransaction.tokenInputs.$case}, partial transaction has ${partialTokenTransaction.tokenInputs.$case}`,\n {\n value: finalTokenTransaction.tokenInputs.$case,\n expected: partialTokenTransaction.tokenInputs.$case,\n },\n );\n }\n\n if (\n finalTokenTransaction.sparkOperatorIdentityPublicKeys.length !==\n partialTokenTransaction.sparkOperatorIdentityPublicKeys.length\n ) {\n throw new InternalValidationError(\n \"Spark operator identity public keys count mismatch\",\n {\n value: finalTokenTransaction.sparkOperatorIdentityPublicKeys.length,\n expected:\n partialTokenTransaction.sparkOperatorIdentityPublicKeys.length,\n },\n );\n }\n\n if (\n partialTokenTransaction.tokenInputs.$case === \"mintInput\" &&\n finalTokenTransaction.tokenInputs.$case === \"mintInput\"\n ) {\n const finalMintInput = finalTokenTransaction.tokenInputs.mintInput;\n const partialMintInput = partialTokenTransaction.tokenInputs.mintInput;\n\n if (\n !areByteArraysEqual(\n finalMintInput.issuerPublicKey,\n partialMintInput.issuerPublicKey,\n )\n ) {\n throw new InternalValidationError(\n \"Issuer public key mismatch in mint input\",\n {\n value: finalMintInput.issuerPublicKey.toString(),\n expected: partialMintInput.issuerPublicKey.toString(),\n },\n );\n }\n } else if (\n partialTokenTransaction.tokenInputs.$case === \"transferInput\" &&\n finalTokenTransaction.tokenInputs.$case === \"transferInput\"\n ) {\n const finalTransferInput = finalTokenTransaction.tokenInputs.transferInput;\n const partialTransferInput =\n partialTokenTransaction.tokenInputs.transferInput;\n\n if (\n finalTransferInput.outputsToSpend.length !==\n partialTransferInput.outputsToSpend.length\n ) {\n throw new InternalValidationError(\n \"Outputs to spend count mismatch in transfer input\",\n {\n value: finalTransferInput.outputsToSpend.length,\n expected: partialTransferInput.outputsToSpend.length,\n },\n );\n }\n\n for (let i = 0; i < finalTransferInput.outputsToSpend.length; i++) {\n const finalOutput = finalTransferInput.outputsToSpend[\n i\n ] as TokenOutputToSpend;\n const partialOutput = partialTransferInput.outputsToSpend[\n i\n ] as TokenOutputToSpend;\n\n if (!finalOutput) {\n throw new InternalValidationError(\n \"Token output to spend missing in final transaction\",\n {\n outputIndex: i,\n value: finalOutput,\n },\n );\n }\n\n if (!partialOutput) {\n throw new InternalValidationError(\n \"Token output to spend missing in partial transaction\",\n {\n outputIndex: i,\n value: partialOutput,\n },\n );\n }\n\n if (\n !areByteArraysEqual(\n finalOutput.prevTokenTransactionHash,\n partialOutput.prevTokenTransactionHash,\n )\n ) {\n throw new InternalValidationError(\n \"Previous token transaction hash mismatch in transfer input\",\n {\n outputIndex: i,\n value: finalOutput.prevTokenTransactionHash.toString(),\n expected: partialOutput.prevTokenTransactionHash.toString(),\n },\n );\n }\n\n if (\n finalOutput.prevTokenTransactionVout !==\n partialOutput.prevTokenTransactionVout\n ) {\n throw new InternalValidationError(\n \"Previous token transaction vout mismatch in transfer input\",\n {\n outputIndex: i,\n value: finalOutput.prevTokenTransactionVout,\n expected: partialOutput.prevTokenTransactionVout,\n },\n );\n }\n }\n }\n\n if (\n finalTokenTransaction.tokenOutputs.length !==\n partialTokenTransaction.tokenOutputs.length\n ) {\n throw new InternalValidationError(\"Token outputs count mismatch\", {\n value: finalTokenTransaction.tokenOutputs.length,\n expected: partialTokenTransaction.tokenOutputs.length,\n });\n }\n\n for (let i = 0; i < finalTokenTransaction.tokenOutputs.length; i++) {\n const finalOutput = finalTokenTransaction.tokenOutputs[i];\n const partialOutput = partialTokenTransaction.tokenOutputs[i];\n\n if (!finalOutput) {\n throw new InternalValidationError(\n \"Token output missing in final transaction\",\n {\n outputIndex: i,\n value: finalOutput,\n },\n );\n }\n\n if (!partialOutput) {\n throw new InternalValidationError(\n \"Token output missing in partial transaction\",\n {\n outputIndex: i,\n value: partialOutput,\n },\n );\n }\n\n if (\n !areByteArraysEqual(\n finalOutput.ownerPublicKey,\n partialOutput.ownerPublicKey,\n )\n ) {\n throw new InternalValidationError(\n \"Owner public key mismatch in token output\",\n {\n outputIndex: i,\n value: finalOutput.ownerPublicKey.toString(),\n expected: partialOutput.ownerPublicKey.toString(),\n },\n );\n }\n\n if (\n !areByteArraysEqual(\n finalOutput.tokenPublicKey,\n partialOutput.tokenPublicKey,\n )\n ) {\n throw new InternalValidationError(\n \"Token public key mismatch in token output\",\n {\n outputIndex: i,\n value: finalOutput.tokenPublicKey.toString(),\n expected: partialOutput.tokenPublicKey.toString(),\n },\n );\n }\n\n if (\n !areByteArraysEqual(finalOutput.tokenAmount, partialOutput.tokenAmount)\n ) {\n throw new InternalValidationError(\n \"Token amount mismatch in token output\",\n {\n outputIndex: i,\n value: finalOutput.tokenAmount.toString(),\n expected: partialOutput.tokenAmount.toString(),\n },\n );\n }\n\n if (finalOutput.withdrawBondSats !== undefined) {\n if (finalOutput.withdrawBondSats !== expectedWithdrawBondSats) {\n throw new InternalValidationError(\n \"Withdraw bond sats mismatch in token output\",\n {\n outputIndex: i,\n value: finalOutput.withdrawBondSats,\n expected: expectedWithdrawBondSats,\n },\n );\n }\n }\n\n if (finalOutput.withdrawRelativeBlockLocktime !== undefined) {\n if (\n finalOutput.withdrawRelativeBlockLocktime !==\n expectedWithdrawRelativeBlockLocktime\n ) {\n throw new InternalValidationError(\n \"Withdraw relative block locktime mismatch in token output\",\n {\n outputIndex: i,\n value: finalOutput.withdrawRelativeBlockLocktime,\n expected: expectedWithdrawRelativeBlockLocktime,\n },\n );\n }\n }\n\n if (keyshareInfo.threshold !== expectedThreshold) {\n throw new InternalValidationError(\"Threshold mismatch\", {\n field: \"threshold\",\n value: keyshareInfo.threshold,\n expected: expectedThreshold,\n });\n }\n }\n\n if (\n keyshareInfo.ownerIdentifiers.length !==\n Object.keys(signingOperators).length\n ) {\n throw new InternalValidationError(\n `Keyshare operator count (${keyshareInfo.ownerIdentifiers.length}) does not match signing operator count (${Object.keys(signingOperators).length})`,\n {\n keyshareInfo: keyshareInfo.ownerIdentifiers.length,\n signingOperators: Object.keys(signingOperators).length,\n },\n );\n }\n\n if (hasDuplicates(keyshareInfo.ownerIdentifiers)) {\n throw new InternalValidationError(\n \"Duplicate ownerIdentifiers found in keyshareInfo\",\n {\n keyshareInfo: keyshareInfo.ownerIdentifiers,\n },\n );\n }\n\n for (const identifier of keyshareInfo.ownerIdentifiers) {\n if (!signingOperators[identifier]) {\n throw new InternalValidationError(\n `Keyshare operator ${identifier} not found in signing operator list`,\n {\n keyshareInfo: identifier,\n signingOperators: Object.keys(signingOperators),\n },\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAAA,kBAAiB;;;ACL1B,SAAS,cAAc;AAOhB,SAAS,qBACd,kBACA,cAAuB,OACX;AACZ,MAAI,CAAC,kBAAkB;AACrB,UAAM,IAAI,gBAAgB,mCAAmC;AAAA,MAC3D,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AAEA,MAAI,YAA0B,CAAC;AAG/B,MAAI,iBAAiB,aAAa,UAAU,iBAAiB;AAC3D,QAAI,CAAC,iBAAiB,YAAY,cAAc,gBAAgB;AAC9D,YAAM,IAAI,gBAAgB,mCAAmC;AAAA,QAC3D,OAAO;AAAA,MACT,CAAC;AAAA,IACH;AAEA,QACE,iBAAiB,YAAY,cAAc,eAAe,WAAW,GACrE;AACA,YAAM,IAAI,gBAAgB,oCAAoC;AAAA,QAC5D,OAAO;AAAA,MACT,CAAC;AAAA,IACH;AAGA,eAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF,KAAK,iBAAiB,YAAa,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;AACL,UAAI,iBAAiB;AACnB,eAAO,MAAM,KAAK,OAAO,OAAO,YAAY,SAAS,SAAS;AAAA,MAChE,OAAO;AACL,eAAO,MAAM,KAAK,OAAO,OAAO;AAAA,UAC9B;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":["secp256k1","hashObj","secp256k1"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ValidationError
|
|
3
|
-
} from "./chunk-7Z7Y2PCW.js";
|
|
4
1
|
import {
|
|
5
2
|
SparkAddress
|
|
6
3
|
} from "./chunk-GPC7GYUG.js";
|
|
4
|
+
import {
|
|
5
|
+
ValidationError
|
|
6
|
+
} from "./chunk-7Z7Y2PCW.js";
|
|
7
7
|
|
|
8
8
|
// src/address/address.ts
|
|
9
9
|
import { secp256k1 } from "@noble/curves/secp256k1";
|
|
@@ -117,4 +117,4 @@ export {
|
|
|
117
117
|
decodeSparkAddress,
|
|
118
118
|
isValidSparkAddress
|
|
119
119
|
};
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
120
|
+
//# sourceMappingURL=chunk-CSNQ7B5H.js.map
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
createWasmSigningCommitment,
|
|
6
6
|
getNetwork,
|
|
7
7
|
subtractPublicKeys
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-67MM2MTI.js";
|
|
9
|
+
import {
|
|
10
|
+
ConnectionManager
|
|
11
|
+
} from "./chunk-JSUPQJRO.js";
|
|
9
12
|
import {
|
|
10
13
|
getCrypto
|
|
11
14
|
} from "./chunk-E7KLXM76.js";
|
|
12
|
-
import {
|
|
13
|
-
ConnectionManager
|
|
14
|
-
} from "./chunk-NHI66Q4E.js";
|
|
15
15
|
import {
|
|
16
16
|
ConfigurationError,
|
|
17
17
|
NetworkError,
|
|
@@ -921,4 +921,4 @@ export {
|
|
|
921
921
|
getLocalSigningOperators,
|
|
922
922
|
WalletConfigService
|
|
923
923
|
};
|
|
924
|
-
//# sourceMappingURL=chunk-
|
|
924
|
+
//# sourceMappingURL=chunk-ICII4F54.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AuthenticationError,
|
|
3
|
-
NetworkError
|
|
4
|
-
} from "./chunk-7Z7Y2PCW.js";
|
|
5
1
|
import {
|
|
6
2
|
Empty,
|
|
7
3
|
SparkServiceDefinition
|
|
8
4
|
} from "./chunk-GPC7GYUG.js";
|
|
5
|
+
import {
|
|
6
|
+
AuthenticationError,
|
|
7
|
+
NetworkError
|
|
8
|
+
} from "./chunk-7Z7Y2PCW.js";
|
|
9
9
|
|
|
10
10
|
// src/services/connection.ts
|
|
11
11
|
import { sha256 } from "@scure/btc-signer/utils";
|
|
@@ -825,4 +825,4 @@ var ConnectionManager = class {
|
|
|
825
825
|
export {
|
|
826
826
|
ConnectionManager
|
|
827
827
|
};
|
|
828
|
-
//# sourceMappingURL=chunk-
|
|
828
|
+
//# sourceMappingURL=chunk-JSUPQJRO.js.map
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
ELECTRS_CREDENTIALS,
|
|
3
3
|
getElectrsUrl,
|
|
4
4
|
getP2TRScriptFromPublicKey
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ICII4F54.js";
|
|
6
6
|
import {
|
|
7
7
|
getNetworkFromAddress
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-67MM2MTI.js";
|
|
9
9
|
import {
|
|
10
10
|
BitcoinNetwork_default
|
|
11
11
|
} from "./chunk-KMLWFG2H.js";
|
|
@@ -96,4 +96,4 @@ export {
|
|
|
96
96
|
getEphemeralAnchorOutput,
|
|
97
97
|
getLatestDepositTxId
|
|
98
98
|
};
|
|
99
|
-
//# sourceMappingURL=chunk-
|
|
99
|
+
//# sourceMappingURL=chunk-PANM2TKC.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -19013,6 +19013,7 @@ var TokenTransactionService = class {
|
|
|
19013
19013
|
},
|
|
19014
19014
|
{
|
|
19015
19015
|
retry: true,
|
|
19016
|
+
retryableStatuses: ["UNKNOWN", "UNAVAILABLE", "CANCELLED"],
|
|
19016
19017
|
retryMaxAttempts: 3
|
|
19017
19018
|
}
|
|
19018
19019
|
);
|
|
@@ -19106,6 +19107,7 @@ var TokenTransactionService = class {
|
|
|
19106
19107
|
},
|
|
19107
19108
|
{
|
|
19108
19109
|
retry: true,
|
|
19110
|
+
retryableStatuses: ["UNKNOWN", "UNAVAILABLE", "CANCELLED"],
|
|
19109
19111
|
retryMaxAttempts: 3
|
|
19110
19112
|
}
|
|
19111
19113
|
);
|
|
@@ -19148,6 +19150,7 @@ var TokenTransactionService = class {
|
|
|
19148
19150
|
},
|
|
19149
19151
|
{
|
|
19150
19152
|
retry: true,
|
|
19153
|
+
retryableStatuses: ["UNKNOWN", "UNAVAILABLE", "CANCELLED"],
|
|
19151
19154
|
retryMaxAttempts: 3
|
|
19152
19155
|
}
|
|
19153
19156
|
);
|
|
@@ -21482,13 +21485,6 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
21482
21485
|
const feeEstimate = await this.getLightningSendFeeEstimate({
|
|
21483
21486
|
encodedInvoice: invoice
|
|
21484
21487
|
});
|
|
21485
|
-
if (!feeEstimate) {
|
|
21486
|
-
throw new ValidationError("Failed to get lightning send fee estimate", {
|
|
21487
|
-
field: "feeEstimate",
|
|
21488
|
-
value: feeEstimate,
|
|
21489
|
-
expected: "non-null"
|
|
21490
|
-
});
|
|
21491
|
-
}
|
|
21492
21488
|
if (maxFeeSats < feeEstimate) {
|
|
21493
21489
|
throw new ValidationError("maxFeeSats does not cover fee estimate", {
|
|
21494
21490
|
field: "maxFeeSats",
|
|
@@ -21551,7 +21547,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
21551
21547
|
* Gets fee estimate for sending Lightning payments.
|
|
21552
21548
|
*
|
|
21553
21549
|
* @param {LightningSendFeeEstimateInput} params - Input parameters for fee estimation
|
|
21554
|
-
* @returns {Promise<
|
|
21550
|
+
* @returns {Promise<number>} Fee estimate for sending Lightning payments
|
|
21555
21551
|
*/
|
|
21556
21552
|
async getLightningSendFeeEstimate({
|
|
21557
21553
|
encodedInvoice
|