@buildonspark/spark-sdk 0.1.45 → 0.1.47
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 +22 -0
- package/dist/{chunk-I54FARY2.js → chunk-EAP3U3CW.js} +14 -14
- package/dist/chunk-GWFQ7EBA.js +3773 -0
- package/dist/{chunk-J2IE4Z7Y.js → chunk-NNX4OK44.js} +3487 -934
- package/dist/{RequestLightningSendInput-Du0z7Om7.d.cts → client-CvpTRpcw.d.cts} +422 -212
- package/dist/{RequestLightningSendInput-DEPd_fPO.d.ts → client-D7KgLN44.d.ts} +422 -212
- package/dist/graphql/objects/index.d.cts +5 -9
- package/dist/graphql/objects/index.d.ts +5 -9
- package/dist/graphql/objects/index.js +1 -1
- package/dist/index.cjs +20461 -23377
- package/dist/index.d.cts +15 -769
- package/dist/index.d.ts +15 -769
- package/dist/index.js +81 -71
- package/dist/index.node.cjs +21994 -25018
- package/dist/index.node.d.cts +312 -34
- package/dist/index.node.d.ts +312 -34
- package/dist/index.node.js +82 -176
- package/dist/native/index.cjs +22847 -25841
- package/dist/native/index.d.cts +974 -1138
- package/dist/native/index.d.ts +974 -1138
- package/dist/native/index.js +10604 -13592
- package/dist/proto/lrc20.d.cts +2 -2
- package/dist/proto/lrc20.d.ts +2 -2
- package/dist/proto/lrc20.js +3098 -46
- 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/{sdk-types-Cc4l4kb1.d.ts → sdk-types-BGCeea0G.d.ts} +1 -1
- package/dist/{sdk-types-B0SwjolI.d.cts → sdk-types-XUeQMLFP.d.cts} +1 -1
- package/dist/{spark-dM7EYXYQ.d.cts → spark-BbUrbvZz.d.cts} +1 -1
- package/dist/{spark-dM7EYXYQ.d.ts → spark-BbUrbvZz.d.ts} +1 -1
- package/dist/spark-wallet-BAFPpPtY.d.cts +923 -0
- package/dist/spark-wallet-CJkQW8pK.d.ts +923 -0
- package/dist/spark_bindings/native/index.d.cts +1 -1
- package/dist/spark_bindings/native/index.d.ts +1 -1
- package/dist/spark_bindings/wasm/index.d.cts +1 -1
- package/dist/spark_bindings/wasm/index.d.ts +1 -1
- package/dist/{services/index.cjs → tests/test-utils.cjs} +2512 -4380
- package/dist/tests/test-utils.d.cts +79 -0
- package/dist/tests/test-utils.d.ts +79 -0
- package/dist/tests/test-utils.js +85 -0
- package/dist/types/index.d.cts +5 -9
- package/dist/types/index.d.ts +5 -9
- package/dist/types/index.js +5 -5
- package/dist/{types-C-Rp0Oo7.d.cts → types-BADxR3bm.d.cts} +1 -1
- package/dist/{types-C-Rp0Oo7.d.ts → types-BADxR3bm.d.ts} +1 -1
- package/package.json +7 -35
- package/src/graphql/client.ts +59 -20
- package/src/index.node.ts +28 -2
- package/src/index.ts +31 -1
- package/src/native/index.ts +16 -2
- package/src/services/config.ts +4 -6
- package/src/services/connection.ts +131 -64
- package/src/services/lightning.ts +1 -2
- package/src/services/token-transactions.ts +7 -7
- package/src/services/transfer.ts +1 -1
- package/src/services/tree-creation.ts +1 -1
- package/src/services/wallet-config.ts +18 -10
- package/src/signer/signer.react-native.ts +2 -5
- package/src/signer/signer.ts +138 -64
- package/src/signer/types.ts +52 -0
- package/src/spark-wallet/spark-wallet.ts +79 -36
- package/src/spark-wallet/types.ts +4 -4
- package/src/tests/integration/coop-exit.test.ts +2 -1
- package/src/tests/integration/lightning.test.ts +2 -2
- package/src/tests/integration/swap.test.ts +1 -1
- package/src/tests/integration/transfer.test.ts +5 -5
- package/src/tests/integration/tree-creation.test.ts +1 -1
- package/src/tests/integration/wallet.test.ts +1 -0
- package/src/tests/isHermeticTest.ts +3 -24
- package/src/tests/{test-util.ts → test-utils.ts} +3 -7
- package/src/tests/wrapWithOtelSpan.test.ts +1 -1
- package/src/{address → utils}/address.ts +1 -1
- package/src/utils/crypto.ts +19 -9
- package/src/utils/index.ts +2 -0
- package/src/utils/network.ts +17 -0
- package/src/utils/secret-sharing.ts +1 -2
- package/src/utils/signing.ts +1 -1
- package/src/utils/token-transactions.ts +3 -3
- package/src/utils/unilateral-exit.ts +32 -0
- package/src/utils/xchain-address.ts +1 -1
- package/dist/BitcoinNetwork-TnABML0T.d.cts +0 -18
- package/dist/BitcoinNetwork-TnABML0T.d.ts +0 -18
- package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.cts +0 -10
- package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.ts +0 -10
- package/dist/address/index.cjs +0 -458
- package/dist/address/index.d.cts +0 -32
- package/dist/address/index.d.ts +0 -32
- package/dist/address/index.js +0 -17
- package/dist/chunk-5FUB65LX.js +0 -838
- package/dist/chunk-6264CGDM.js +0 -113
- package/dist/chunk-7V6N75CC.js +0 -24
- package/dist/chunk-C2S227QR.js +0 -2336
- package/dist/chunk-GSI4OLXZ.js +0 -117
- package/dist/chunk-GZ5IPPJ2.js +0 -170
- package/dist/chunk-HWJWKEIU.js +0 -75
- package/dist/chunk-KMUMFYFX.js +0 -137
- package/dist/chunk-L3EHBOUX.js +0 -0
- package/dist/chunk-NSJF5F5O.js +0 -325
- package/dist/chunk-NTFKFRQ2.js +0 -3146
- package/dist/chunk-PQN3C2MF.js +0 -1122
- package/dist/chunk-QNNSEJ4P.js +0 -232
- package/dist/chunk-R5PXJZQS.js +0 -277
- package/dist/chunk-VTUGIIWI.js +0 -0
- package/dist/chunk-YUPMXTCJ.js +0 -622
- package/dist/chunk-Z5HIAYFT.js +0 -84
- package/dist/index-B2AwKW5J.d.cts +0 -214
- package/dist/index-CJDi1HWc.d.ts +0 -214
- package/dist/network-BTJl-Sul.d.ts +0 -46
- package/dist/network-CqgsdUF2.d.cts +0 -46
- package/dist/services/config.cjs +0 -2354
- package/dist/services/config.d.cts +0 -42
- package/dist/services/config.d.ts +0 -42
- package/dist/services/config.js +0 -17
- package/dist/services/connection.cjs +0 -17691
- package/dist/services/connection.d.cts +0 -95
- package/dist/services/connection.d.ts +0 -95
- package/dist/services/connection.js +0 -11
- package/dist/services/index.d.cts +0 -21
- package/dist/services/index.d.ts +0 -21
- package/dist/services/index.js +0 -58
- package/dist/services/lrc-connection.cjs +0 -4713
- package/dist/services/lrc-connection.d.cts +0 -34
- package/dist/services/lrc-connection.d.ts +0 -34
- package/dist/services/lrc-connection.js +0 -11
- package/dist/services/token-transactions.cjs +0 -2877
- package/dist/services/token-transactions.d.cts +0 -75
- package/dist/services/token-transactions.d.ts +0 -75
- package/dist/services/token-transactions.js +0 -15
- package/dist/services/wallet-config.cjs +0 -340
- package/dist/services/wallet-config.d.cts +0 -56
- package/dist/services/wallet-config.d.ts +0 -56
- package/dist/services/wallet-config.js +0 -33
- package/dist/signer/signer.cjs +0 -2004
- package/dist/signer/signer.d.cts +0 -10
- package/dist/signer/signer.d.ts +0 -10
- package/dist/signer/signer.js +0 -24
- package/dist/signer-BocS_J6B.d.ts +0 -187
- package/dist/signer-DKS0AJkw.d.cts +0 -187
- package/dist/utils/index.cjs +0 -2947
- package/dist/utils/index.d.cts +0 -18
- package/dist/utils/index.d.ts +0 -18
- package/dist/utils/index.js +0 -157
- package/src/address/index.ts +0 -1
- package/src/services/lrc-connection.ts +0 -215
package/dist/index.js
CHANGED
|
@@ -1,118 +1,117 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
DEFAULT_FEE_SATS,
|
|
8
|
-
checkIfValidSequence,
|
|
9
|
-
computeTaprootKeyNoScript,
|
|
2
|
+
MultisigReceiptInput,
|
|
3
|
+
SparkWallet,
|
|
4
|
+
TokenTransactionService,
|
|
5
|
+
checkIfSelectedOutputsAreAvailable,
|
|
6
|
+
collectResponses,
|
|
10
7
|
constructFeeBumpTx,
|
|
11
8
|
constructUnilateralExitFeeBumpPackages,
|
|
12
9
|
constructUnilateralExitTxs,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
decodeHumanReadableTokenIdentifier,
|
|
11
|
+
decodeSparkAddress,
|
|
12
|
+
encodeHumanReadableTokenIdentifier,
|
|
13
|
+
encodeSparkAddress,
|
|
14
|
+
filterTokenBalanceForTokenPublicKey,
|
|
16
15
|
getLatestDepositTxId,
|
|
17
|
-
getNextTransactionSequence,
|
|
18
|
-
getP2TRAddressFromPkScript,
|
|
19
|
-
getP2TRAddressFromPublicKey,
|
|
20
|
-
getP2TRScriptFromPublicKey,
|
|
21
|
-
getP2WPKHAddressFromPublicKey,
|
|
22
|
-
getSigHashFromTx,
|
|
23
16
|
getSparkAddressFromTaproot,
|
|
24
|
-
getTransactionSequence,
|
|
25
17
|
getTransferPackageSigningPayload,
|
|
26
|
-
getTxFromRawTxBytes,
|
|
27
|
-
getTxFromRawTxHex,
|
|
28
|
-
getTxId,
|
|
29
|
-
getTxIdNoReverse,
|
|
30
18
|
isEphemeralAnchorOutput,
|
|
31
19
|
isTxBroadcast,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
calculateAvailableTokenAmount,
|
|
37
|
-
checkIfSelectedOutputsAreAvailable,
|
|
38
|
-
collectResponses,
|
|
39
|
-
filterTokenBalanceForTokenPublicKey
|
|
40
|
-
} from "./chunk-HWJWKEIU.js";
|
|
20
|
+
isValidPublicKey,
|
|
21
|
+
isValidSparkAddress,
|
|
22
|
+
sumAvailableTokens
|
|
23
|
+
} from "./chunk-NNX4OK44.js";
|
|
41
24
|
import "./chunk-OBFKIEMP.js";
|
|
42
|
-
import "./chunk-I54FARY2.js";
|
|
43
|
-
import "./chunk-L3EHBOUX.js";
|
|
44
|
-
import "./chunk-KMUMFYFX.js";
|
|
45
|
-
import "./chunk-NTFKFRQ2.js";
|
|
46
|
-
import "./chunk-6264CGDM.js";
|
|
47
|
-
import "./chunk-YUPMXTCJ.js";
|
|
48
25
|
import {
|
|
26
|
+
AuthenticationError,
|
|
27
|
+
ConfigurationError,
|
|
28
|
+
DEFAULT_FEE_SATS,
|
|
29
|
+
DefaultSparkSigner,
|
|
30
|
+
InternalValidationError,
|
|
49
31
|
LRC_WALLET_NETWORK,
|
|
50
32
|
LRC_WALLET_NETWORK_TYPE,
|
|
51
33
|
Network,
|
|
34
|
+
NetworkError,
|
|
52
35
|
NetworkToProto,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
36
|
+
NotImplementedError,
|
|
37
|
+
RPCError,
|
|
38
|
+
SparkSDKError,
|
|
39
|
+
TaprootOutputKeysGenerator,
|
|
40
|
+
TaprootSparkSigner,
|
|
41
|
+
ValidationError,
|
|
42
|
+
WalletConfig,
|
|
59
43
|
addPrivateKeys,
|
|
60
44
|
addPublicKeys,
|
|
61
45
|
applyAdaptorToSignature,
|
|
62
46
|
applyAdditiveTweakToPublicKey,
|
|
47
|
+
bigIntToPrivateKey,
|
|
48
|
+
checkIfValidSequence,
|
|
49
|
+
computeTaprootKeyNoScript,
|
|
50
|
+
computerLagrangeCoefficients,
|
|
51
|
+
createRefundTx,
|
|
63
52
|
createSigningCommitment,
|
|
64
53
|
createSigningNonce,
|
|
65
54
|
decodeBytesToSigningCommitment,
|
|
66
55
|
decodeBytesToSigningNonce,
|
|
67
56
|
encodeSigningCommitmentToBytes,
|
|
68
57
|
encodeSigningNonceToBytes,
|
|
58
|
+
evaluatePolynomial,
|
|
59
|
+
fieldDiv,
|
|
69
60
|
generateAdaptorFromSignature,
|
|
61
|
+
generatePolynomialForSecretSharing,
|
|
70
62
|
generateSignatureFromExistingAdaptor,
|
|
63
|
+
getCurrentTimelock,
|
|
64
|
+
getEphemeralAnchorOutput,
|
|
65
|
+
getNetwork,
|
|
66
|
+
getNetworkFromAddress,
|
|
67
|
+
getNetworkFromString,
|
|
68
|
+
getNextTransactionSequence,
|
|
69
|
+
getP2TRAddressFromPkScript,
|
|
70
|
+
getP2TRAddressFromPublicKey,
|
|
71
|
+
getP2TRScriptFromPublicKey,
|
|
72
|
+
getP2WPKHAddressFromPublicKey,
|
|
73
|
+
getRandomBigInt,
|
|
71
74
|
getRandomSigningNonce,
|
|
75
|
+
getSigHashFromTx,
|
|
72
76
|
getSigningCommitmentFromNonce,
|
|
77
|
+
getTransactionSequence,
|
|
78
|
+
getTxFromRawTxBytes,
|
|
79
|
+
getTxFromRawTxHex,
|
|
80
|
+
getTxId,
|
|
81
|
+
getTxIdNoReverse,
|
|
73
82
|
lastKeyWithTarget,
|
|
74
|
-
|
|
75
|
-
subtractPublicKeys,
|
|
76
|
-
sumOfPrivateKeys,
|
|
77
|
-
validateOutboundAdaptorSignature
|
|
78
|
-
} from "./chunk-NSJF5F5O.js";
|
|
79
|
-
import {
|
|
80
|
-
bigIntToPrivateKey,
|
|
81
|
-
computerLagrangeCoefficients,
|
|
82
|
-
evaluatePolynomial,
|
|
83
|
-
fieldDiv,
|
|
84
|
-
generatePolynomialForSecretSharing,
|
|
85
|
-
getRandomBigInt,
|
|
83
|
+
maybeApplyFee,
|
|
86
84
|
modInverse,
|
|
85
|
+
proofOfPossessionMessageHashForDepositAddress,
|
|
86
|
+
protoToNetwork,
|
|
87
87
|
recoverSecret,
|
|
88
|
+
setCrypto,
|
|
88
89
|
splitSecret,
|
|
89
90
|
splitSecretWithProofs,
|
|
91
|
+
subtractPrivateKeys,
|
|
92
|
+
subtractPublicKeys,
|
|
93
|
+
sumOfPrivateKeys,
|
|
94
|
+
validateOutboundAdaptorSignature,
|
|
90
95
|
validateShare
|
|
91
|
-
} from "./chunk-
|
|
92
|
-
import "./chunk-HMLOC6TE.js";
|
|
93
|
-
import "./chunk-VTUGIIWI.js";
|
|
94
|
-
import "./chunk-PQN3C2MF.js";
|
|
96
|
+
} from "./chunk-GWFQ7EBA.js";
|
|
95
97
|
import "./chunk-LHRD2WT6.js";
|
|
96
|
-
import "./chunk-7V6N75CC.js";
|
|
97
|
-
import {
|
|
98
|
-
AuthenticationError,
|
|
99
|
-
ConfigurationError,
|
|
100
|
-
InternalValidationError,
|
|
101
|
-
NetworkError,
|
|
102
|
-
NotImplementedError,
|
|
103
|
-
RPCError,
|
|
104
|
-
SparkSDKError,
|
|
105
|
-
ValidationError
|
|
106
|
-
} from "./chunk-GSI4OLXZ.js";
|
|
107
98
|
import "./chunk-BGGEVUJK.js";
|
|
99
|
+
import "./chunk-EAP3U3CW.js";
|
|
100
|
+
import "./chunk-HMLOC6TE.js";
|
|
108
101
|
import "./chunk-MVRQ5US7.js";
|
|
102
|
+
|
|
103
|
+
// src/index.ts
|
|
104
|
+
var cryptoImpl = typeof window !== "undefined" && window.crypto ? window.crypto : typeof global !== "undefined" && global.crypto ? global.crypto : null;
|
|
105
|
+
setCrypto(cryptoImpl);
|
|
109
106
|
export {
|
|
110
107
|
AuthenticationError,
|
|
111
108
|
ConfigurationError,
|
|
112
109
|
DEFAULT_FEE_SATS,
|
|
110
|
+
DefaultSparkSigner,
|
|
113
111
|
InternalValidationError,
|
|
114
112
|
LRC_WALLET_NETWORK,
|
|
115
113
|
LRC_WALLET_NETWORK_TYPE,
|
|
114
|
+
MultisigReceiptInput,
|
|
116
115
|
Network,
|
|
117
116
|
NetworkError,
|
|
118
117
|
NetworkToProto,
|
|
@@ -120,13 +119,16 @@ export {
|
|
|
120
119
|
RPCError,
|
|
121
120
|
SparkSDKError,
|
|
122
121
|
SparkWallet,
|
|
122
|
+
TaprootOutputKeysGenerator,
|
|
123
|
+
TaprootSparkSigner,
|
|
124
|
+
TokenTransactionService,
|
|
123
125
|
ValidationError,
|
|
126
|
+
WalletConfig,
|
|
124
127
|
addPrivateKeys,
|
|
125
128
|
addPublicKeys,
|
|
126
129
|
applyAdaptorToSignature,
|
|
127
130
|
applyAdditiveTweakToPublicKey,
|
|
128
131
|
bigIntToPrivateKey,
|
|
129
|
-
calculateAvailableTokenAmount,
|
|
130
132
|
checkIfSelectedOutputsAreAvailable,
|
|
131
133
|
checkIfValidSequence,
|
|
132
134
|
collectResponses,
|
|
@@ -140,8 +142,12 @@ export {
|
|
|
140
142
|
createSigningNonce,
|
|
141
143
|
decodeBytesToSigningCommitment,
|
|
142
144
|
decodeBytesToSigningNonce,
|
|
145
|
+
decodeHumanReadableTokenIdentifier,
|
|
146
|
+
decodeSparkAddress,
|
|
147
|
+
encodeHumanReadableTokenIdentifier,
|
|
143
148
|
encodeSigningCommitmentToBytes,
|
|
144
149
|
encodeSigningNonceToBytes,
|
|
150
|
+
encodeSparkAddress,
|
|
145
151
|
evaluatePolynomial,
|
|
146
152
|
fieldDiv,
|
|
147
153
|
filterTokenBalanceForTokenPublicKey,
|
|
@@ -172,15 +178,19 @@ export {
|
|
|
172
178
|
getTxIdNoReverse,
|
|
173
179
|
isEphemeralAnchorOutput,
|
|
174
180
|
isTxBroadcast,
|
|
181
|
+
isValidPublicKey,
|
|
182
|
+
isValidSparkAddress,
|
|
175
183
|
lastKeyWithTarget,
|
|
176
184
|
maybeApplyFee,
|
|
177
185
|
modInverse,
|
|
178
186
|
proofOfPossessionMessageHashForDepositAddress,
|
|
187
|
+
protoToNetwork,
|
|
179
188
|
recoverSecret,
|
|
180
189
|
splitSecret,
|
|
181
190
|
splitSecretWithProofs,
|
|
182
191
|
subtractPrivateKeys,
|
|
183
192
|
subtractPublicKeys,
|
|
193
|
+
sumAvailableTokens,
|
|
184
194
|
sumOfPrivateKeys,
|
|
185
195
|
validateOutboundAdaptorSignature,
|
|
186
196
|
validateShare
|