@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.
Files changed (88) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/bare/index.cjs +1683 -1901
  3. package/dist/bare/index.d.cts +242 -292
  4. package/dist/bare/index.d.ts +242 -292
  5. package/dist/bare/index.js +1604 -1829
  6. package/dist/{chunk-7LY7PJQL.js → chunk-23BBEC25.js} +14 -5
  7. package/dist/{chunk-R5VUHUJR.js → chunk-5Y7YILMA.js} +4153 -3728
  8. package/dist/{chunk-GIDAHHDB.js → chunk-6CMNEDBK.js} +217 -9
  9. package/dist/{chunk-J24LM4RO.js → chunk-76SYPHOC.js} +1 -1
  10. package/dist/{chunk-2HD3USKS.js → chunk-A5M55UR3.js} +0 -24
  11. package/dist/{client-BmnZ1xDg.d.cts → client-B9CAWKWz.d.cts} +1 -1
  12. package/dist/{client-DmjOifnt.d.ts → client-Dd3QnxQu.d.ts} +1 -1
  13. package/dist/debug.cjs +1680 -1957
  14. package/dist/debug.d.cts +13 -8
  15. package/dist/debug.d.ts +13 -8
  16. package/dist/debug.js +6 -8
  17. package/dist/graphql/objects/index.d.cts +3 -3
  18. package/dist/graphql/objects/index.d.ts +3 -3
  19. package/dist/index.cjs +1729 -1948
  20. package/dist/index.d.cts +18 -6
  21. package/dist/index.d.ts +18 -6
  22. package/dist/index.js +17 -8
  23. package/dist/index.node.cjs +1729 -1948
  24. package/dist/index.node.d.cts +7 -6
  25. package/dist/index.node.d.ts +7 -6
  26. package/dist/index.node.js +22 -6
  27. package/dist/native/index.cjs +1723 -1949
  28. package/dist/native/index.d.cts +80 -125
  29. package/dist/native/index.d.ts +80 -125
  30. package/dist/native/index.js +1652 -1884
  31. package/dist/proto/spark.cjs +0 -24
  32. package/dist/proto/spark.d.cts +1 -1
  33. package/dist/proto/spark.d.ts +1 -1
  34. package/dist/proto/spark.js +1 -1
  35. package/dist/proto/spark_token.cjs +221 -8
  36. package/dist/proto/spark_token.d.cts +25 -2
  37. package/dist/proto/spark_token.d.ts +25 -2
  38. package/dist/proto/spark_token.js +12 -2
  39. package/dist/{spark-B305mDNB.d.cts → spark-CtGJPkx4.d.cts} +3 -31
  40. package/dist/{spark-B305mDNB.d.ts → spark-CtGJPkx4.d.ts} +3 -31
  41. package/dist/{spark-wallet-BdwARy70.d.cts → spark-wallet-Cp3yv6cK.d.ts} +40 -31
  42. package/dist/{spark-wallet-enp968Uc.d.ts → spark-wallet-yc2KhsVY.d.cts} +40 -31
  43. package/dist/{spark-wallet.node-CtpJlYBs.d.cts → spark-wallet.node-D0Qw5Wb4.d.cts} +1 -1
  44. package/dist/{spark-wallet.node-DqWcsNb6.d.ts → spark-wallet.node-D4IovOHu.d.ts} +1 -1
  45. package/dist/tests/test-utils.cjs +483 -1120
  46. package/dist/tests/test-utils.d.cts +9 -5
  47. package/dist/tests/test-utils.d.ts +9 -5
  48. package/dist/tests/test-utils.js +5 -6
  49. package/dist/{token-transactions-3-pVToE0.d.cts → token-transactions-0nmR9mQO.d.ts} +17 -12
  50. package/dist/{token-transactions-84Hp0hGz.d.ts → token-transactions-CwhlOgIP.d.cts} +17 -12
  51. package/dist/types/index.cjs +0 -24
  52. package/dist/types/index.d.cts +2 -2
  53. package/dist/types/index.d.ts +2 -2
  54. package/dist/types/index.js +2 -2
  55. package/dist/{xchain-address-BtuJEbzG.d.cts → xchain-address-BPwpnmuY.d.ts} +9 -3
  56. package/dist/{xchain-address-Q1BrcwID.d.ts → xchain-address-CNQEwLjR.d.cts} +9 -3
  57. package/package.json +1 -1
  58. package/src/constants.ts +7 -1
  59. package/src/debug.ts +1 -1
  60. package/src/proto/spark.ts +2 -48
  61. package/src/proto/spark_token.ts +255 -7
  62. package/src/services/token-transactions.ts +92 -44
  63. package/src/services/transfer.ts +20 -17
  64. package/src/services/wallet-config.ts +2 -0
  65. package/src/signer/signer.react-native.ts +0 -2
  66. package/src/spark-wallet/spark-wallet.browser.ts +9 -8
  67. package/src/spark-wallet/spark-wallet.node.ts +8 -4
  68. package/src/spark-wallet/spark-wallet.ts +427 -229
  69. package/src/tests/address.test.ts +87 -1
  70. package/src/tests/integration/retry.test.ts +78 -0
  71. package/src/tests/integration/ssp/static-deposit-validation.test.ts +1 -1
  72. package/src/tests/integration/transfer.test.ts +285 -1
  73. package/src/tests/integration/wallet.test.ts +160 -0
  74. package/src/tests/{tokens.test.ts → token-hashing.test.ts} +150 -162
  75. package/src/tests/token-outputs.test.ts +194 -0
  76. package/src/tests/utils/spark-testing-wallet.ts +16 -8
  77. package/src/utils/address.ts +152 -11
  78. package/src/utils/invoice-hashing.test.ts +235 -0
  79. package/src/utils/invoice-hashing.ts +227 -0
  80. package/src/utils/mempool.ts +6 -0
  81. package/src/utils/retry.ts +116 -0
  82. package/src/utils/token-hashing.ts +566 -0
  83. package/src/utils/token-transactions.ts +9 -5
  84. package/dist/chunk-7N6R7G3E.js +0 -7
  85. package/dist/spark-wallet.browser-BYlprQpX.d.ts +0 -12
  86. package/dist/spark-wallet.browser-CVI2Ss3u.d.cts +0 -12
  87. package/src/services/tree-creation.ts +0 -893
  88. package/src/tests/integration/tree-creation.test.ts +0 -46
@@ -6,15 +6,19 @@ import {
6
6
  Bech32mTokenIdentifier,
7
7
  decodeBech32mTokenIdentifier,
8
8
  } from "./token-identifier.js";
9
- import { NetworkType } from "./network.js";
10
9
 
11
10
  export function sumAvailableTokens(
12
11
  outputs: OutputWithPreviousTransactionData[],
13
12
  ): bigint {
14
- return outputs.reduce(
15
- (sum, output) => sum + BigInt(bytesToNumberBE(output.output!.tokenAmount!)),
16
- BigInt(0),
17
- );
13
+ try {
14
+ return outputs.reduce(
15
+ (sum, output) =>
16
+ sum + BigInt(bytesToNumberBE(output.output!.tokenAmount!)),
17
+ BigInt(0),
18
+ );
19
+ } catch (error) {
20
+ return 0n;
21
+ }
18
22
  }
19
23
 
20
24
  export function checkIfSelectedOutputsAreAvailable(
@@ -1,7 +0,0 @@
1
- import {
2
- setCrypto
3
- } from "./chunk-R5VUHUJR.js";
4
-
5
- // src/index.ts
6
- var cryptoImpl = typeof window !== "undefined" && window.crypto ? window.crypto : typeof global !== "undefined" && global.crypto ? global.crypto : null;
7
- setCrypto(cryptoImpl);
@@ -1,12 +0,0 @@
1
- import { z as SparkWallet, x as SparkWalletProps } from './spark-wallet-enp968Uc.js';
2
-
3
- declare class SparkWalletBrowser extends SparkWallet {
4
- static initialize({ mnemonicOrSeed, accountNumber, signer, options, }: SparkWalletProps): Promise<{
5
- mnemonic?: string | undefined;
6
- wallet: SparkWalletBrowser;
7
- }>;
8
- protected initializeTracerEnv({ spanProcessors, traceUrls, }: Parameters<SparkWallet["initializeTracerEnv"]>[0]): void;
9
- }
10
- declare function initializeTracerEnvBrowser({ spanProcessors, traceUrls, }: Parameters<SparkWallet["initializeTracerEnv"]>[0]): void;
11
-
12
- export { SparkWalletBrowser as S, initializeTracerEnvBrowser as i };
@@ -1,12 +0,0 @@
1
- import { z as SparkWallet, x as SparkWalletProps } from './spark-wallet-BdwARy70.cjs';
2
-
3
- declare class SparkWalletBrowser extends SparkWallet {
4
- static initialize({ mnemonicOrSeed, accountNumber, signer, options, }: SparkWalletProps): Promise<{
5
- mnemonic?: string | undefined;
6
- wallet: SparkWalletBrowser;
7
- }>;
8
- protected initializeTracerEnv({ spanProcessors, traceUrls, }: Parameters<SparkWallet["initializeTracerEnv"]>[0]): void;
9
- }
10
- declare function initializeTracerEnvBrowser({ spanProcessors, traceUrls, }: Parameters<SparkWallet["initializeTracerEnv"]>[0]): void;
11
-
12
- export { SparkWalletBrowser as S, initializeTracerEnvBrowser as i };