@buildonspark/spark-sdk 0.2.7 → 0.2.8

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 (87) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/bare/index.cjs +1657 -1879
  3. package/dist/bare/index.d.cts +65 -115
  4. package/dist/bare/index.d.ts +65 -115
  5. package/dist/bare/index.js +1578 -1807
  6. package/dist/{chunk-GIDAHHDB.js → chunk-6CMNEDBK.js} +217 -9
  7. package/dist/{chunk-J24LM4RO.js → chunk-76SYPHOC.js} +1 -1
  8. package/dist/{chunk-2HD3USKS.js → chunk-A5M55UR3.js} +0 -24
  9. package/dist/{chunk-7LY7PJQL.js → chunk-G2RIVSSI.js} +14 -5
  10. package/dist/{chunk-R5VUHUJR.js → chunk-HMJO7LPI.js} +4160 -3739
  11. package/dist/{client-DmjOifnt.d.ts → client-B5vlztPA.d.ts} +1 -1
  12. package/dist/{client-BmnZ1xDg.d.cts → client-TLqKGhj8.d.cts} +1 -1
  13. package/dist/debug.cjs +1664 -1945
  14. package/dist/debug.d.cts +12 -7
  15. package/dist/debug.d.ts +12 -7
  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 +1703 -1926
  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 +1703 -1926
  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 +1697 -1927
  28. package/dist/native/index.d.cts +78 -123
  29. package/dist/native/index.d.ts +78 -123
  30. package/dist/native/index.js +1626 -1862
  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-CBBjw5AY.d.cts} +2 -30
  40. package/dist/{spark-B305mDNB.d.ts → spark-CBBjw5AY.d.ts} +2 -30
  41. package/dist/{spark-wallet-BdwARy70.d.cts → spark-wallet-CIuHgbSR.d.cts} +38 -29
  42. package/dist/{spark-wallet-enp968Uc.d.ts → spark-wallet-CrNWPa9p.d.ts} +38 -29
  43. package/dist/{spark-wallet.node-CtpJlYBs.d.cts → spark-wallet.node-BvfiSwh_.d.cts} +1 -1
  44. package/dist/{spark-wallet.node-DqWcsNb6.d.ts → spark-wallet.node-pnKSb-aa.d.ts} +1 -1
  45. package/dist/tests/test-utils.cjs +483 -1120
  46. package/dist/tests/test-utils.d.cts +8 -4
  47. package/dist/tests/test-utils.d.ts +8 -4
  48. package/dist/tests/test-utils.js +5 -6
  49. package/dist/{token-transactions-3-pVToE0.d.cts → token-transactions-ChvD_wLe.d.cts} +15 -10
  50. package/dist/{token-transactions-84Hp0hGz.d.ts → token-transactions-e8UUOjFk.d.ts} +15 -10
  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-CDnNobbB.d.ts} +9 -3
  56. package/dist/{xchain-address-Q1BrcwID.d.ts → xchain-address-CtqVOuWz.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 +57 -14
  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 +424 -227
  69. package/src/tests/address.test.ts +87 -1
  70. package/src/tests/integration/retry.test.ts +78 -0
  71. package/src/tests/integration/transfer.test.ts +285 -1
  72. package/src/tests/integration/wallet.test.ts +160 -0
  73. package/src/tests/{tokens.test.ts → token-hashing.test.ts} +150 -162
  74. package/src/tests/token-outputs.test.ts +194 -0
  75. package/src/tests/utils/spark-testing-wallet.ts +16 -8
  76. package/src/utils/address.ts +152 -11
  77. package/src/utils/invoice-hashing.test.ts +235 -0
  78. package/src/utils/invoice-hashing.ts +227 -0
  79. package/src/utils/mempool.ts +6 -0
  80. package/src/utils/retry.ts +116 -0
  81. package/src/utils/token-hashing.ts +566 -0
  82. package/src/utils/token-transactions.ts +9 -5
  83. package/dist/chunk-7N6R7G3E.js +0 -7
  84. package/dist/spark-wallet.browser-BYlprQpX.d.ts +0 -12
  85. package/dist/spark-wallet.browser-CVI2Ss3u.d.cts +0 -12
  86. package/src/services/tree-creation.ts +0 -893
  87. package/src/tests/integration/tree-creation.test.ts +0 -46
@@ -3,7 +3,7 @@ import {
3
3
  Timestamp,
4
4
  networkFromJSON,
5
5
  networkToJSON
6
- } from "./chunk-2HD3USKS.js";
6
+ } from "./chunk-A5M55UR3.js";
7
7
 
8
8
  // src/proto/spark_token.ts
9
9
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
@@ -51,6 +51,43 @@ function tokenTransactionTypeToJSON(object) {
51
51
  return "UNRECOGNIZED";
52
52
  }
53
53
  }
54
+ var CommitStatus = /* @__PURE__ */ ((CommitStatus2) => {
55
+ CommitStatus2[CommitStatus2["COMMIT_UNSPECIFIED"] = 0] = "COMMIT_UNSPECIFIED";
56
+ CommitStatus2[CommitStatus2["COMMIT_PROCESSING"] = 1] = "COMMIT_PROCESSING";
57
+ CommitStatus2[CommitStatus2["COMMIT_FINALIZED"] = 2] = "COMMIT_FINALIZED";
58
+ CommitStatus2[CommitStatus2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
59
+ return CommitStatus2;
60
+ })(CommitStatus || {});
61
+ function commitStatusFromJSON(object) {
62
+ switch (object) {
63
+ case 0:
64
+ case "COMMIT_UNSPECIFIED":
65
+ return 0 /* COMMIT_UNSPECIFIED */;
66
+ case 1:
67
+ case "COMMIT_PROCESSING":
68
+ return 1 /* COMMIT_PROCESSING */;
69
+ case 2:
70
+ case "COMMIT_FINALIZED":
71
+ return 2 /* COMMIT_FINALIZED */;
72
+ case -1:
73
+ case "UNRECOGNIZED":
74
+ default:
75
+ return -1 /* UNRECOGNIZED */;
76
+ }
77
+ }
78
+ function commitStatusToJSON(object) {
79
+ switch (object) {
80
+ case 0 /* COMMIT_UNSPECIFIED */:
81
+ return "COMMIT_UNSPECIFIED";
82
+ case 1 /* COMMIT_PROCESSING */:
83
+ return "COMMIT_PROCESSING";
84
+ case 2 /* COMMIT_FINALIZED */:
85
+ return "COMMIT_FINALIZED";
86
+ case -1 /* UNRECOGNIZED */:
87
+ default:
88
+ return "UNRECOGNIZED";
89
+ }
90
+ }
54
91
  var TokenTransactionStatus = /* @__PURE__ */ ((TokenTransactionStatus2) => {
55
92
  TokenTransactionStatus2[TokenTransactionStatus2["TOKEN_TRANSACTION_STARTED"] = 0] = "TOKEN_TRANSACTION_STARTED";
56
93
  TokenTransactionStatus2[TokenTransactionStatus2["TOKEN_TRANSACTION_SIGNED"] = 1] = "TOKEN_TRANSACTION_SIGNED";
@@ -627,7 +664,8 @@ function createBaseTokenTransaction() {
627
664
  sparkOperatorIdentityPublicKeys: [],
628
665
  expiryTime: void 0,
629
666
  network: 0,
630
- clientCreatedTimestamp: void 0
667
+ clientCreatedTimestamp: void 0,
668
+ invoiceAttachments: []
631
669
  };
632
670
  }
633
671
  var TokenTransaction = {
@@ -661,6 +699,9 @@ var TokenTransaction = {
661
699
  if (message.clientCreatedTimestamp !== void 0) {
662
700
  Timestamp.encode(toTimestamp(message.clientCreatedTimestamp), writer.uint32(74).fork()).join();
663
701
  }
702
+ for (const v of message.invoiceAttachments) {
703
+ InvoiceAttachment.encode(v, writer.uint32(82).fork()).join();
704
+ }
664
705
  return writer;
665
706
  },
666
707
  decode(input, length) {
@@ -736,6 +777,13 @@ var TokenTransaction = {
736
777
  message.clientCreatedTimestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
737
778
  continue;
738
779
  }
780
+ case 10: {
781
+ if (tag !== 82) {
782
+ break;
783
+ }
784
+ message.invoiceAttachments.push(InvoiceAttachment.decode(reader, reader.uint32()));
785
+ continue;
786
+ }
739
787
  }
740
788
  if ((tag & 7) === 4 || tag === 0) {
741
789
  break;
@@ -752,7 +800,8 @@ var TokenTransaction = {
752
800
  sparkOperatorIdentityPublicKeys: globalThis.Array.isArray(object?.sparkOperatorIdentityPublicKeys) ? object.sparkOperatorIdentityPublicKeys.map((e) => bytesFromBase64(e)) : [],
753
801
  expiryTime: isSet(object.expiryTime) ? fromJsonTimestamp(object.expiryTime) : void 0,
754
802
  network: isSet(object.network) ? networkFromJSON(object.network) : 0,
755
- clientCreatedTimestamp: isSet(object.clientCreatedTimestamp) ? fromJsonTimestamp(object.clientCreatedTimestamp) : void 0
803
+ clientCreatedTimestamp: isSet(object.clientCreatedTimestamp) ? fromJsonTimestamp(object.clientCreatedTimestamp) : void 0,
804
+ invoiceAttachments: globalThis.Array.isArray(object?.invoiceAttachments) ? object.invoiceAttachments.map((e) => InvoiceAttachment.fromJSON(e)) : []
756
805
  };
757
806
  },
758
807
  toJSON(message) {
@@ -782,6 +831,9 @@ var TokenTransaction = {
782
831
  if (message.clientCreatedTimestamp !== void 0) {
783
832
  obj.clientCreatedTimestamp = message.clientCreatedTimestamp.toISOString();
784
833
  }
834
+ if (message.invoiceAttachments?.length) {
835
+ obj.invoiceAttachments = message.invoiceAttachments.map((e) => InvoiceAttachment.toJSON(e));
836
+ }
785
837
  return obj;
786
838
  },
787
839
  create(base) {
@@ -824,6 +876,58 @@ var TokenTransaction = {
824
876
  message.expiryTime = object.expiryTime ?? void 0;
825
877
  message.network = object.network ?? 0;
826
878
  message.clientCreatedTimestamp = object.clientCreatedTimestamp ?? void 0;
879
+ message.invoiceAttachments = object.invoiceAttachments?.map((e) => InvoiceAttachment.fromPartial(e)) || [];
880
+ return message;
881
+ }
882
+ };
883
+ function createBaseInvoiceAttachment() {
884
+ return { sparkInvoice: "" };
885
+ }
886
+ var InvoiceAttachment = {
887
+ encode(message, writer = new BinaryWriter()) {
888
+ if (message.sparkInvoice !== "") {
889
+ writer.uint32(10).string(message.sparkInvoice);
890
+ }
891
+ return writer;
892
+ },
893
+ decode(input, length) {
894
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
895
+ const end = length === void 0 ? reader.len : reader.pos + length;
896
+ const message = createBaseInvoiceAttachment();
897
+ while (reader.pos < end) {
898
+ const tag = reader.uint32();
899
+ switch (tag >>> 3) {
900
+ case 1: {
901
+ if (tag !== 10) {
902
+ break;
903
+ }
904
+ message.sparkInvoice = reader.string();
905
+ continue;
906
+ }
907
+ }
908
+ if ((tag & 7) === 4 || tag === 0) {
909
+ break;
910
+ }
911
+ reader.skip(tag & 7);
912
+ }
913
+ return message;
914
+ },
915
+ fromJSON(object) {
916
+ return { sparkInvoice: isSet(object.sparkInvoice) ? globalThis.String(object.sparkInvoice) : "" };
917
+ },
918
+ toJSON(message) {
919
+ const obj = {};
920
+ if (message.sparkInvoice !== "") {
921
+ obj.sparkInvoice = message.sparkInvoice;
922
+ }
923
+ return obj;
924
+ },
925
+ create(base) {
926
+ return InvoiceAttachment.fromPartial(base ?? {});
927
+ },
928
+ fromPartial(object) {
929
+ const message = createBaseInvoiceAttachment();
930
+ message.sparkInvoice = object.sparkInvoice ?? "";
827
931
  return message;
828
932
  }
829
933
  };
@@ -1241,11 +1345,85 @@ var CommitTransactionRequest = {
1241
1345
  return message;
1242
1346
  }
1243
1347
  };
1348
+ function createBaseCommitProgress() {
1349
+ return { committedOperatorPublicKeys: [], uncommittedOperatorPublicKeys: [] };
1350
+ }
1351
+ var CommitProgress = {
1352
+ encode(message, writer = new BinaryWriter()) {
1353
+ for (const v of message.committedOperatorPublicKeys) {
1354
+ writer.uint32(10).bytes(v);
1355
+ }
1356
+ for (const v of message.uncommittedOperatorPublicKeys) {
1357
+ writer.uint32(18).bytes(v);
1358
+ }
1359
+ return writer;
1360
+ },
1361
+ decode(input, length) {
1362
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1363
+ const end = length === void 0 ? reader.len : reader.pos + length;
1364
+ const message = createBaseCommitProgress();
1365
+ while (reader.pos < end) {
1366
+ const tag = reader.uint32();
1367
+ switch (tag >>> 3) {
1368
+ case 1: {
1369
+ if (tag !== 10) {
1370
+ break;
1371
+ }
1372
+ message.committedOperatorPublicKeys.push(reader.bytes());
1373
+ continue;
1374
+ }
1375
+ case 2: {
1376
+ if (tag !== 18) {
1377
+ break;
1378
+ }
1379
+ message.uncommittedOperatorPublicKeys.push(reader.bytes());
1380
+ continue;
1381
+ }
1382
+ }
1383
+ if ((tag & 7) === 4 || tag === 0) {
1384
+ break;
1385
+ }
1386
+ reader.skip(tag & 7);
1387
+ }
1388
+ return message;
1389
+ },
1390
+ fromJSON(object) {
1391
+ return {
1392
+ committedOperatorPublicKeys: globalThis.Array.isArray(object?.committedOperatorPublicKeys) ? object.committedOperatorPublicKeys.map((e) => bytesFromBase64(e)) : [],
1393
+ uncommittedOperatorPublicKeys: globalThis.Array.isArray(object?.uncommittedOperatorPublicKeys) ? object.uncommittedOperatorPublicKeys.map((e) => bytesFromBase64(e)) : []
1394
+ };
1395
+ },
1396
+ toJSON(message) {
1397
+ const obj = {};
1398
+ if (message.committedOperatorPublicKeys?.length) {
1399
+ obj.committedOperatorPublicKeys = message.committedOperatorPublicKeys.map((e) => base64FromBytes(e));
1400
+ }
1401
+ if (message.uncommittedOperatorPublicKeys?.length) {
1402
+ obj.uncommittedOperatorPublicKeys = message.uncommittedOperatorPublicKeys.map((e) => base64FromBytes(e));
1403
+ }
1404
+ return obj;
1405
+ },
1406
+ create(base) {
1407
+ return CommitProgress.fromPartial(base ?? {});
1408
+ },
1409
+ fromPartial(object) {
1410
+ const message = createBaseCommitProgress();
1411
+ message.committedOperatorPublicKeys = object.committedOperatorPublicKeys?.map((e) => e) || [];
1412
+ message.uncommittedOperatorPublicKeys = object.uncommittedOperatorPublicKeys?.map((e) => e) || [];
1413
+ return message;
1414
+ }
1415
+ };
1244
1416
  function createBaseCommitTransactionResponse() {
1245
- return {};
1417
+ return { commitStatus: 0, commitProgress: void 0 };
1246
1418
  }
1247
1419
  var CommitTransactionResponse = {
1248
- encode(_, writer = new BinaryWriter()) {
1420
+ encode(message, writer = new BinaryWriter()) {
1421
+ if (message.commitStatus !== 0) {
1422
+ writer.uint32(8).int32(message.commitStatus);
1423
+ }
1424
+ if (message.commitProgress !== void 0) {
1425
+ CommitProgress.encode(message.commitProgress, writer.uint32(18).fork()).join();
1426
+ }
1249
1427
  return writer;
1250
1428
  },
1251
1429
  decode(input, length) {
@@ -1255,6 +1433,20 @@ var CommitTransactionResponse = {
1255
1433
  while (reader.pos < end) {
1256
1434
  const tag = reader.uint32();
1257
1435
  switch (tag >>> 3) {
1436
+ case 1: {
1437
+ if (tag !== 8) {
1438
+ break;
1439
+ }
1440
+ message.commitStatus = reader.int32();
1441
+ continue;
1442
+ }
1443
+ case 2: {
1444
+ if (tag !== 18) {
1445
+ break;
1446
+ }
1447
+ message.commitProgress = CommitProgress.decode(reader, reader.uint32());
1448
+ continue;
1449
+ }
1258
1450
  }
1259
1451
  if ((tag & 7) === 4 || tag === 0) {
1260
1452
  break;
@@ -1263,18 +1455,29 @@ var CommitTransactionResponse = {
1263
1455
  }
1264
1456
  return message;
1265
1457
  },
1266
- fromJSON(_) {
1267
- return {};
1458
+ fromJSON(object) {
1459
+ return {
1460
+ commitStatus: isSet(object.commitStatus) ? commitStatusFromJSON(object.commitStatus) : 0,
1461
+ commitProgress: isSet(object.commitProgress) ? CommitProgress.fromJSON(object.commitProgress) : void 0
1462
+ };
1268
1463
  },
1269
- toJSON(_) {
1464
+ toJSON(message) {
1270
1465
  const obj = {};
1466
+ if (message.commitStatus !== 0) {
1467
+ obj.commitStatus = commitStatusToJSON(message.commitStatus);
1468
+ }
1469
+ if (message.commitProgress !== void 0) {
1470
+ obj.commitProgress = CommitProgress.toJSON(message.commitProgress);
1471
+ }
1271
1472
  return obj;
1272
1473
  },
1273
1474
  create(base) {
1274
1475
  return CommitTransactionResponse.fromPartial(base ?? {});
1275
1476
  },
1276
- fromPartial(_) {
1477
+ fromPartial(object) {
1277
1478
  const message = createBaseCommitTransactionResponse();
1479
+ message.commitStatus = object.commitStatus ?? 0;
1480
+ message.commitProgress = object.commitProgress !== void 0 && object.commitProgress !== null ? CommitProgress.fromPartial(object.commitProgress) : void 0;
1278
1481
  return message;
1279
1482
  }
1280
1483
  };
@@ -2659,6 +2862,9 @@ export {
2659
2862
  TokenTransactionType,
2660
2863
  tokenTransactionTypeFromJSON,
2661
2864
  tokenTransactionTypeToJSON,
2865
+ CommitStatus,
2866
+ commitStatusFromJSON,
2867
+ commitStatusToJSON,
2662
2868
  TokenTransactionStatus,
2663
2869
  tokenTransactionStatusFromJSON,
2664
2870
  tokenTransactionStatusToJSON,
@@ -2668,11 +2874,13 @@ export {
2668
2874
  TokenCreateInput,
2669
2875
  TokenOutput,
2670
2876
  TokenTransaction,
2877
+ InvoiceAttachment,
2671
2878
  SignatureWithIndex,
2672
2879
  InputTtxoSignaturesPerOperator,
2673
2880
  StartTransactionRequest,
2674
2881
  StartTransactionResponse,
2675
2882
  CommitTransactionRequest,
2883
+ CommitProgress,
2676
2884
  CommitTransactionResponse,
2677
2885
  QueryTokenMetadataRequest,
2678
2886
  TokenMetadata,
@@ -2,7 +2,7 @@ import {
2
2
  Network,
3
3
  TransferStatus,
4
4
  TransferType
5
- } from "./chunk-2HD3USKS.js";
5
+ } from "./chunk-A5M55UR3.js";
6
6
 
7
7
  // src/types/sdk-types.ts
8
8
  import { bytesToHex } from "@noble/curves/abstract/utils";
@@ -15250,22 +15250,6 @@ var SparkServiceDefinition = {
15250
15250
  responseStream: false,
15251
15251
  options: {}
15252
15252
  },
15253
- prepare_tree_address: {
15254
- name: "prepare_tree_address",
15255
- requestType: PrepareTreeAddressRequest,
15256
- requestStream: false,
15257
- responseType: PrepareTreeAddressResponse,
15258
- responseStream: false,
15259
- options: {}
15260
- },
15261
- create_tree: {
15262
- name: "create_tree",
15263
- requestType: CreateTreeRequest,
15264
- requestStream: false,
15265
- responseType: CreateTreeResponse,
15266
- responseStream: false,
15267
- options: {}
15268
- },
15269
15253
  get_signing_operator_list: {
15270
15254
  name: "get_signing_operator_list",
15271
15255
  requestType: Empty,
@@ -15437,14 +15421,6 @@ var SparkServiceDefinition = {
15437
15421
  * The following endpoints enforce inclusion of Direct Transactions used
15438
15422
  * for unilateral exits
15439
15423
  */
15440
- create_tree_v2: {
15441
- name: "create_tree_v2",
15442
- requestType: CreateTreeRequest,
15443
- requestStream: false,
15444
- responseType: CreateTreeResponse,
15445
- responseStream: false,
15446
- options: {}
15447
- },
15448
15424
  cooperative_exit_v2: {
15449
15425
  name: "cooperative_exit_v2",
15450
15426
  requestType: CooperativeExitRequest,
@@ -1,11 +1,10 @@
1
1
  import {
2
- SparkWallet
3
- } from "./chunk-R5VUHUJR.js";
2
+ SparkWallet,
3
+ setCrypto
4
+ } from "./chunk-HMJO7LPI.js";
4
5
 
5
6
  // src/spark-wallet/spark-wallet.browser.ts
6
- import {
7
- WebTracerProvider
8
- } from "@opentelemetry/sdk-trace-web";
7
+ import { WebTracerProvider } from "@opentelemetry/sdk-trace-web";
9
8
  import { registerInstrumentations } from "@opentelemetry/instrumentation";
10
9
  import { FetchInstrumentation } from "@opentelemetry/instrumentation-fetch";
11
10
  import { W3CTraceContextPropagator } from "@opentelemetry/core";
@@ -19,6 +18,12 @@ var SparkWalletBrowser = class _SparkWalletBrowser extends SparkWallet {
19
18
  }) {
20
19
  const wallet = new _SparkWalletBrowser(options, signer);
21
20
  wallet.initializeTracer(wallet);
21
+ if (options && options.signerWithPreExistingKeys) {
22
+ await wallet.initWalletWithoutSeed();
23
+ return {
24
+ wallet
25
+ };
26
+ }
22
27
  const initResponse = await wallet.initWallet(mnemonicOrSeed, accountNumber);
23
28
  return {
24
29
  wallet,
@@ -55,6 +60,10 @@ function initializeTracerEnvBrowser({
55
60
  });
56
61
  }
57
62
 
63
+ // src/index.ts
64
+ var cryptoImpl = typeof window !== "undefined" && window.crypto ? window.crypto : typeof global !== "undefined" && global.crypto ? global.crypto : null;
65
+ setCrypto(cryptoImpl);
66
+
58
67
  export {
59
68
  SparkWalletBrowser,
60
69
  initializeTracerEnvBrowser