@buildonspark/spark-sdk 0.2.4 → 0.2.6

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 (82) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/{chunk-3SEOTO43.js → chunk-3SPMJMUX.js} +3 -2
  3. package/dist/chunk-AVI5E5VT.js +66 -0
  4. package/dist/{chunk-WAQKYSDI.js → chunk-CQY5ML2A.js} +3 -2
  5. package/dist/{chunk-W4ZRBSWM.js → chunk-GUZ3WCB4.js} +466 -167
  6. package/dist/{client-KhNkrXz4.d.cts → client-CusuvuCe.d.cts} +199 -104
  7. package/dist/{client-BF4cn8F4.d.ts → client-Dn4Ld8pD.d.ts} +199 -104
  8. package/dist/debug.cjs +662 -336
  9. package/dist/debug.d.cts +9 -7
  10. package/dist/debug.d.ts +9 -7
  11. package/dist/debug.js +3 -3
  12. package/dist/graphql/objects/index.d.cts +6 -51
  13. package/dist/graphql/objects/index.d.ts +6 -51
  14. package/dist/graphql/objects/index.js +1 -1
  15. package/dist/index.cjs +713 -327
  16. package/dist/index.d.cts +19 -188
  17. package/dist/index.d.ts +19 -188
  18. package/dist/index.js +15 -8
  19. package/dist/index.node.cjs +638 -352
  20. package/dist/index.node.d.cts +7 -7
  21. package/dist/index.node.d.ts +7 -7
  22. package/dist/index.node.js +59 -100
  23. package/dist/native/index.cjs +655 -325
  24. package/dist/native/index.d.cts +253 -164
  25. package/dist/native/index.d.ts +253 -164
  26. package/dist/native/index.js +505 -172
  27. package/dist/proto/lrc20.d.cts +1 -1
  28. package/dist/proto/lrc20.d.ts +1 -1
  29. package/dist/proto/spark.d.cts +1 -1
  30. package/dist/proto/spark.d.ts +1 -1
  31. package/dist/proto/spark_token.d.cts +1 -1
  32. package/dist/proto/spark_token.d.ts +1 -1
  33. package/dist/{spark-B_7nZx6T.d.cts → spark-Cj4brrP5.d.cts} +1 -1
  34. package/dist/{spark-B_7nZx6T.d.ts → spark-Cj4brrP5.d.ts} +1 -1
  35. package/dist/{spark-wallet-C1Tr_VKI.d.ts → spark-wallet-B6YthxDI.d.ts} +61 -26
  36. package/dist/{spark-wallet-DG3x2obf.d.cts → spark-wallet-BbOf2P2l.d.cts} +61 -26
  37. package/dist/spark-wallet.node-BBk1sGS2.d.cts +12 -0
  38. package/dist/spark-wallet.node-Bffethig.d.ts +12 -0
  39. package/dist/tests/test-utils.cjs +86 -54
  40. package/dist/tests/test-utils.d.cts +24 -24
  41. package/dist/tests/test-utils.d.ts +24 -24
  42. package/dist/tests/test-utils.js +4 -4
  43. package/dist/token-transactions-0_5XMWjs.d.ts +184 -0
  44. package/dist/token-transactions-CD-Adb5y.d.cts +184 -0
  45. package/dist/types/index.cjs +3 -2
  46. package/dist/types/index.d.cts +3 -4
  47. package/dist/types/index.d.ts +3 -4
  48. package/dist/types/index.js +2 -2
  49. package/dist/{xchain-address-HBr6isnc.d.cts → xchain-address-BnKZ0-dY.d.cts} +6 -5
  50. package/dist/{xchain-address-BHu6CpZC.d.ts → xchain-address-Di3lu4Wy.d.ts} +6 -5
  51. package/package.json +7 -2
  52. package/src/graphql/client.ts +49 -8
  53. package/src/graphql/objects/SparkWalletUser.ts +1 -1
  54. package/src/graphql/queries/Transfers.ts +15 -0
  55. package/src/index.node.ts +5 -1
  56. package/src/index.ts +4 -1
  57. package/src/services/config.ts +13 -2
  58. package/src/services/token-transactions.ts +22 -8
  59. package/src/services/wallet-config.ts +22 -13
  60. package/src/spark-wallet/spark-wallet.browser.ts +72 -0
  61. package/src/spark-wallet/spark-wallet.node.ts +60 -118
  62. package/src/spark-wallet/spark-wallet.ts +400 -156
  63. package/src/tests/integration/ssp/coop-exit-validation.test.ts +233 -0
  64. package/src/tests/integration/ssp/coop-exit.test.ts +112 -93
  65. package/src/tests/integration/ssp/static-deposit-validation.test.ts +145 -0
  66. package/src/tests/integration/ssp/static_deposit.test.ts +453 -64
  67. package/src/tests/integration/ssp/transfers.test.ts +102 -0
  68. package/src/tests/integration/static_deposit.test.ts +92 -0
  69. package/src/tests/integration/transfer.test.ts +1 -1
  70. package/src/tests/utils/regtest-test-faucet.ts +8 -0
  71. package/src/tests/utils/spark-testing-wallet.ts +42 -0
  72. package/src/tests/utils/test-faucet.ts +6 -2
  73. package/src/types/sdk-types.ts +15 -0
  74. package/src/utils/bitcoin.ts +13 -0
  75. package/src/utils/token-identifier.ts +47 -4
  76. package/src/utils/token-transactions.ts +13 -9
  77. package/dist/chunk-TVUMSHWA.js +0 -7
  78. package/dist/sdk-types-CB9HrW5O.d.cts +0 -44
  79. package/dist/sdk-types-CkRNraXT.d.ts +0 -44
  80. package/dist/spark-wallet.node-CGxoeCpH.d.ts +0 -13
  81. package/dist/spark-wallet.node-CN9LoB_O.d.cts +0 -13
  82. package/src/graphql/queries/Transfer.ts +0 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @buildonspark/spark-sdk
2
2
 
3
+ ## 0.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - -- Opentelemetry improvements
8
+ -- Utility function to decode bech32mtokenidentifiers to raw token identifiers
9
+ -- Add userRequest to transfer in getTransfer() if it exists
10
+ -- Fixes to getIssuerTokenIdentifier() types
11
+ -- Migrates some internal filtering logic to key on token identifiers
12
+ -- Testing improvements
13
+ - Updated dependencies
14
+ - @buildonspark/lrc20-sdk@0.0.61
15
+
16
+ ## 0.2.5
17
+
18
+ ### Patch Changes
19
+
20
+ - Attach the SSP request object to spark transfer if it exists
21
+ - Update static deposit refund flow to take sats per vbyte
22
+ - Allow the creation of multiple refunds in static deposit refund flow
23
+ - Add new function to claim a static deposit while specifying a max fee
24
+
3
25
  ## 0.2.4
4
26
 
5
27
  ### Patch Changes
@@ -35,7 +35,7 @@ function mapTransferLeafToWalletTransferLeaf(proto) {
35
35
  intermediateRefundTx: bytesToHex(proto.intermediateRefundTx)
36
36
  };
37
37
  }
38
- function mapTransferToWalletTransfer(proto, identityPublicKey) {
38
+ function mapTransferToWalletTransfer(proto, identityPublicKey, userRequest) {
39
39
  const receiverIdentityPublicKey = bytesToHex(proto.receiverIdentityPublicKey);
40
40
  const senderIdentityPublicKey = bytesToHex(proto.senderIdentityPublicKey);
41
41
  return {
@@ -49,7 +49,8 @@ function mapTransferToWalletTransfer(proto, identityPublicKey) {
49
49
  createdTime: proto.createdTime ? new Date(proto.createdTime) : void 0,
50
50
  updatedTime: proto.updatedTime ? new Date(proto.updatedTime) : void 0,
51
51
  type: TransferType[proto.type],
52
- transferDirection: receiverIdentityPublicKey === identityPublicKey ? "INCOMING" /* INCOMING */ : "OUTGOING" /* OUTGOING */
52
+ transferDirection: receiverIdentityPublicKey === identityPublicKey ? "INCOMING" /* INCOMING */ : "OUTGOING" /* OUTGOING */,
53
+ userRequest
53
54
  };
54
55
  }
55
56
 
@@ -0,0 +1,66 @@
1
+ import {
2
+ SparkWallet,
3
+ setCrypto
4
+ } from "./chunk-GUZ3WCB4.js";
5
+
6
+ // src/spark-wallet/spark-wallet.browser.ts
7
+ import {
8
+ WebTracerProvider
9
+ } from "@opentelemetry/sdk-trace-web";
10
+ import { registerInstrumentations } from "@opentelemetry/instrumentation";
11
+ import { FetchInstrumentation } from "@opentelemetry/instrumentation-fetch";
12
+ import { W3CTraceContextPropagator } from "@opentelemetry/core";
13
+ import { propagation } from "@opentelemetry/api";
14
+ var SparkWalletBrowser = class _SparkWalletBrowser extends SparkWallet {
15
+ static async initialize({
16
+ mnemonicOrSeed,
17
+ accountNumber,
18
+ signer,
19
+ options
20
+ }) {
21
+ const wallet = new _SparkWalletBrowser(options, signer);
22
+ wallet.initializeTracer(wallet);
23
+ const initResponse = await wallet.initWallet(mnemonicOrSeed, accountNumber);
24
+ return {
25
+ wallet,
26
+ ...initResponse
27
+ };
28
+ }
29
+ initializeTracerEnv({
30
+ spanProcessors,
31
+ traceUrls
32
+ }) {
33
+ initializeTracerEnvBrowser({ spanProcessors, traceUrls });
34
+ }
35
+ };
36
+ function initializeTracerEnvBrowser({
37
+ spanProcessors,
38
+ traceUrls
39
+ }) {
40
+ const provider = new WebTracerProvider({ spanProcessors });
41
+ provider.register();
42
+ propagation.setGlobalPropagator(new W3CTraceContextPropagator());
43
+ registerInstrumentations({
44
+ instrumentations: [
45
+ new FetchInstrumentation({
46
+ ignoreUrls: [
47
+ /* Since we're wrapping global fetch we should be careful to avoid
48
+ adding headers for unrelated requests */
49
+ new RegExp(
50
+ `^(?!(${traceUrls.map((p) => p.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")}))`
51
+ )
52
+ ],
53
+ propagateTraceHeaderCorsUrls: /.*/
54
+ })
55
+ ]
56
+ });
57
+ }
58
+
59
+ // src/index.ts
60
+ var cryptoImpl = typeof window !== "undefined" && window.crypto ? window.crypto : typeof global !== "undefined" && global.crypto ? global.crypto : null;
61
+ setCrypto(cryptoImpl);
62
+
63
+ export {
64
+ SparkWalletBrowser,
65
+ initializeTracerEnvBrowser
66
+ };
@@ -1498,14 +1498,15 @@ export {
1498
1498
  LightningSendRequestFromJson,
1499
1499
  FRAGMENT6 as FRAGMENT4,
1500
1500
  getLightningSendRequestQuery,
1501
+ ClaimStaticDepositStatus_default,
1502
+ ClaimStaticDepositFromJson,
1503
+ getClaimStaticDepositQuery,
1501
1504
  ClaimStaticDepositRequestType_default,
1502
1505
  CoopExitFeeQuoteFromJson,
1503
1506
  FRAGMENT2 as FRAGMENT5,
1504
1507
  getCoopExitFeeQuoteQuery,
1505
- ClaimStaticDepositStatus_default,
1506
1508
  FRAGMENT7 as FRAGMENT6,
1507
1509
  getUserRequestQuery,
1508
- getClaimStaticDepositQuery,
1509
1510
  SparkUserRequestStatus_default,
1510
1511
  SparkUserRequestType_default,
1511
1512
  SparkWalletUser_default