@buildonspark/spark-sdk 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/bare/index.cjs +1683 -1901
- package/dist/bare/index.d.cts +242 -292
- package/dist/bare/index.d.ts +242 -292
- package/dist/bare/index.js +1604 -1829
- package/dist/{chunk-7LY7PJQL.js → chunk-23BBEC25.js} +14 -5
- package/dist/{chunk-R5VUHUJR.js → chunk-5Y7YILMA.js} +4153 -3728
- package/dist/{chunk-GIDAHHDB.js → chunk-6CMNEDBK.js} +217 -9
- package/dist/{chunk-J24LM4RO.js → chunk-76SYPHOC.js} +1 -1
- package/dist/{chunk-2HD3USKS.js → chunk-A5M55UR3.js} +0 -24
- package/dist/{client-BmnZ1xDg.d.cts → client-B9CAWKWz.d.cts} +1 -1
- package/dist/{client-DmjOifnt.d.ts → client-Dd3QnxQu.d.ts} +1 -1
- package/dist/debug.cjs +1680 -1957
- package/dist/debug.d.cts +13 -8
- package/dist/debug.d.ts +13 -8
- package/dist/debug.js +6 -8
- package/dist/graphql/objects/index.d.cts +3 -3
- package/dist/graphql/objects/index.d.ts +3 -3
- package/dist/index.cjs +1729 -1948
- package/dist/index.d.cts +18 -6
- package/dist/index.d.ts +18 -6
- package/dist/index.js +17 -8
- package/dist/index.node.cjs +1729 -1948
- package/dist/index.node.d.cts +7 -6
- package/dist/index.node.d.ts +7 -6
- package/dist/index.node.js +22 -6
- package/dist/native/index.cjs +1723 -1949
- package/dist/native/index.d.cts +80 -125
- package/dist/native/index.d.ts +80 -125
- package/dist/native/index.js +1652 -1884
- package/dist/proto/spark.cjs +0 -24
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark.js +1 -1
- package/dist/proto/spark_token.cjs +221 -8
- package/dist/proto/spark_token.d.cts +25 -2
- package/dist/proto/spark_token.d.ts +25 -2
- package/dist/proto/spark_token.js +12 -2
- package/dist/{spark-B305mDNB.d.cts → spark-CtGJPkx4.d.cts} +3 -31
- package/dist/{spark-B305mDNB.d.ts → spark-CtGJPkx4.d.ts} +3 -31
- package/dist/{spark-wallet-BdwARy70.d.cts → spark-wallet-Cp3yv6cK.d.ts} +40 -31
- package/dist/{spark-wallet-enp968Uc.d.ts → spark-wallet-yc2KhsVY.d.cts} +40 -31
- package/dist/{spark-wallet.node-CtpJlYBs.d.cts → spark-wallet.node-D0Qw5Wb4.d.cts} +1 -1
- package/dist/{spark-wallet.node-DqWcsNb6.d.ts → spark-wallet.node-D4IovOHu.d.ts} +1 -1
- package/dist/tests/test-utils.cjs +483 -1120
- package/dist/tests/test-utils.d.cts +9 -5
- package/dist/tests/test-utils.d.ts +9 -5
- package/dist/tests/test-utils.js +5 -6
- package/dist/{token-transactions-3-pVToE0.d.cts → token-transactions-0nmR9mQO.d.ts} +17 -12
- package/dist/{token-transactions-84Hp0hGz.d.ts → token-transactions-CwhlOgIP.d.cts} +17 -12
- package/dist/types/index.cjs +0 -24
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +2 -2
- package/dist/{xchain-address-BtuJEbzG.d.cts → xchain-address-BPwpnmuY.d.ts} +9 -3
- package/dist/{xchain-address-Q1BrcwID.d.ts → xchain-address-CNQEwLjR.d.cts} +9 -3
- package/package.json +1 -1
- package/src/constants.ts +7 -1
- package/src/debug.ts +1 -1
- package/src/proto/spark.ts +2 -48
- package/src/proto/spark_token.ts +255 -7
- package/src/services/token-transactions.ts +92 -44
- package/src/services/transfer.ts +20 -17
- package/src/services/wallet-config.ts +2 -0
- package/src/signer/signer.react-native.ts +0 -2
- package/src/spark-wallet/spark-wallet.browser.ts +9 -8
- package/src/spark-wallet/spark-wallet.node.ts +8 -4
- package/src/spark-wallet/spark-wallet.ts +427 -229
- package/src/tests/address.test.ts +87 -1
- package/src/tests/integration/retry.test.ts +78 -0
- package/src/tests/integration/ssp/static-deposit-validation.test.ts +1 -1
- package/src/tests/integration/transfer.test.ts +285 -1
- package/src/tests/integration/wallet.test.ts +160 -0
- package/src/tests/{tokens.test.ts → token-hashing.test.ts} +150 -162
- package/src/tests/token-outputs.test.ts +194 -0
- package/src/tests/utils/spark-testing-wallet.ts +16 -8
- package/src/utils/address.ts +152 -11
- package/src/utils/invoice-hashing.test.ts +235 -0
- package/src/utils/invoice-hashing.ts +227 -0
- package/src/utils/mempool.ts +6 -0
- package/src/utils/retry.ts +116 -0
- package/src/utils/token-hashing.ts +566 -0
- package/src/utils/token-transactions.ts +9 -5
- package/dist/chunk-7N6R7G3E.js +0 -7
- package/dist/spark-wallet.browser-BYlprQpX.d.ts +0 -12
- package/dist/spark-wallet.browser-CVI2Ss3u.d.cts +0 -12
- package/src/services/tree-creation.ts +0 -893
- package/src/tests/integration/tree-creation.test.ts +0 -46
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { describe, expect, it } from "@jest/globals";
|
|
3
|
-
import { bytesToHex } from "@noble/curves/abstract/utils";
|
|
4
|
-
import { ValidationError } from "../../errors/types.js";
|
|
5
|
-
import { getTxFromRawTxBytes, getTxId } from "../../utils/bitcoin.js";
|
|
6
|
-
import { Network } from "../../utils/network.js";
|
|
7
|
-
import { DEFAULT_FEE_SATS } from "../../utils/transaction.js";
|
|
8
|
-
import { SparkWalletTesting } from "../utils/spark-testing-wallet.js";
|
|
9
|
-
|
|
10
|
-
describe("Tree Creation", () => {
|
|
11
|
-
it.skip("test tree creation address generation", async () => {
|
|
12
|
-
const wallet = new SparkWalletTesting({ network: Network.LOCAL });
|
|
13
|
-
await wallet.initWallet();
|
|
14
|
-
|
|
15
|
-
const pubKey = await wallet.getSigner().generatePublicKey();
|
|
16
|
-
|
|
17
|
-
const depositResp = await wallet.generateDepositAddress();
|
|
18
|
-
|
|
19
|
-
expect(depositResp.depositAddress).toBeDefined();
|
|
20
|
-
|
|
21
|
-
const dummyTx = createDummyTx({
|
|
22
|
-
address: depositResp.depositAddress!.address,
|
|
23
|
-
amountSats: 65536n + DEFAULT_FEE_SATS,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const depositTxHex = bytesToHex(dummyTx.tx);
|
|
27
|
-
const depositTx = getTxFromRawTxBytes(dummyTx.tx);
|
|
28
|
-
|
|
29
|
-
const vout = 0;
|
|
30
|
-
const txid = getTxId(depositTx);
|
|
31
|
-
if (!txid) {
|
|
32
|
-
throw new ValidationError("Transaction ID not found", {
|
|
33
|
-
field: "txid",
|
|
34
|
-
value: depositTx,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const treeResp = await wallet.generateDepositAddressForTree(
|
|
39
|
-
vout,
|
|
40
|
-
pubKey,
|
|
41
|
-
depositTx,
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
const treeNodes = await wallet.createTree(vout, treeResp, true, depositTx);
|
|
45
|
-
}, 30000);
|
|
46
|
-
});
|