@buildonspark/spark-sdk 0.1.44 → 0.1.46

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 (143) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/{RequestLightningSendInput-BxbCtwpV.d.cts → RequestLightningSendInput-2cSh_In4.d.cts} +1 -1
  3. package/dist/{RequestLightningSendInput-RGel43ks.d.ts → RequestLightningSendInput-CN6BNg_g.d.ts} +1 -1
  4. package/dist/address/index.cjs +2 -2
  5. package/dist/address/index.d.cts +2 -2
  6. package/dist/address/index.d.ts +2 -2
  7. package/dist/address/index.js +2 -2
  8. package/dist/{chunk-EKFD62HN.js → chunk-4EMV7HHW.js} +2 -1
  9. package/dist/{chunk-4Q2ZDYYU.js → chunk-BGGEVUJK.js} +1157 -208
  10. package/dist/{chunk-CIZNCBKE.js → chunk-C2S227QR.js} +648 -45
  11. package/dist/{chunk-WPTRVD2V.js → chunk-DXR2PXJU.js} +15 -15
  12. package/dist/{chunk-NBCNYDWJ.js → chunk-HHNQ3ZHC.js} +2 -2
  13. package/dist/{chunk-DAXGVPVM.js → chunk-HSCLBJEL.js} +2 -2
  14. package/dist/{chunk-6AFUC5M2.js → chunk-HWJWKEIU.js} +8 -2
  15. package/dist/{chunk-A2ZLMH6I.js → chunk-JB64OQES.js} +259 -327
  16. package/dist/{chunk-KEKGSH7B.js → chunk-KMUMFYFX.js} +3 -3
  17. package/dist/chunk-LHRD2WT6.js +2374 -0
  18. package/dist/{chunk-HTMXTJRK.js → chunk-N5VZVCGJ.js} +4 -4
  19. package/dist/{chunk-SQKXGAIR.js → chunk-NTFKFRQ2.js} +1 -1
  20. package/dist/{chunk-K4BJARWM.js → chunk-OBFKIEMP.js} +1 -1
  21. package/dist/{chunk-UBT6EDVJ.js → chunk-OFCJFZ4I.js} +1 -1
  22. package/dist/{chunk-XX4RRWOX.js → chunk-UXDODSDT.js} +8 -10
  23. package/dist/graphql/objects/index.d.cts +5 -4
  24. package/dist/graphql/objects/index.d.ts +5 -4
  25. package/dist/index-CKL5DodV.d.cts +214 -0
  26. package/dist/index-COm59SPw.d.ts +214 -0
  27. package/dist/index.cjs +4026 -1315
  28. package/dist/index.d.cts +764 -19
  29. package/dist/index.d.ts +764 -19
  30. package/dist/index.js +23 -27
  31. package/dist/index.node.cjs +4026 -1319
  32. package/dist/index.node.d.cts +10 -8
  33. package/dist/index.node.d.ts +10 -8
  34. package/dist/index.node.js +23 -31
  35. package/dist/native/index.cjs +4027 -1316
  36. package/dist/native/index.d.cts +281 -85
  37. package/dist/native/index.d.ts +281 -85
  38. package/dist/native/index.js +4018 -1307
  39. package/dist/{network-CfxLnaot.d.cts → network-Css46DAz.d.cts} +1 -1
  40. package/dist/{network-CroCOQ0B.d.ts → network-hynb7iTZ.d.ts} +1 -1
  41. package/dist/proto/lrc20.cjs +222 -19
  42. package/dist/proto/lrc20.d.cts +1 -1
  43. package/dist/proto/lrc20.d.ts +1 -1
  44. package/dist/proto/lrc20.js +2 -2
  45. package/dist/proto/spark.cjs +1154 -205
  46. package/dist/proto/spark.d.cts +1 -1
  47. package/dist/proto/spark.d.ts +1 -1
  48. package/dist/proto/spark.js +3 -1
  49. package/dist/proto/spark_token.cjs +1377 -58
  50. package/dist/proto/spark_token.d.cts +153 -15
  51. package/dist/proto/spark_token.d.ts +153 -15
  52. package/dist/proto/spark_token.js +40 -4
  53. package/dist/{sdk-types-CTbTdDbE.d.ts → sdk-types-CKBsylfW.d.ts} +1 -1
  54. package/dist/{sdk-types-BeCBoozO.d.cts → sdk-types-Ct8xmN7l.d.cts} +1 -1
  55. package/dist/services/config.cjs +2 -2
  56. package/dist/services/config.d.cts +5 -4
  57. package/dist/services/config.d.ts +5 -4
  58. package/dist/services/config.js +6 -6
  59. package/dist/services/connection.cjs +2438 -262
  60. package/dist/services/connection.d.cts +5 -4
  61. package/dist/services/connection.d.ts +5 -4
  62. package/dist/services/connection.js +4 -4
  63. package/dist/services/index.cjs +5937 -3154
  64. package/dist/services/index.d.cts +7 -6
  65. package/dist/services/index.d.ts +7 -6
  66. package/dist/services/index.js +17 -15
  67. package/dist/services/lrc-connection.cjs +223 -20
  68. package/dist/services/lrc-connection.d.cts +5 -4
  69. package/dist/services/lrc-connection.d.ts +5 -4
  70. package/dist/services/lrc-connection.js +4 -4
  71. package/dist/services/token-transactions.cjs +840 -236
  72. package/dist/services/token-transactions.d.cts +25 -7
  73. package/dist/services/token-transactions.d.ts +25 -7
  74. package/dist/services/token-transactions.js +5 -4
  75. package/dist/services/wallet-config.cjs +3 -1
  76. package/dist/services/wallet-config.d.cts +7 -5
  77. package/dist/services/wallet-config.d.ts +7 -5
  78. package/dist/services/wallet-config.js +3 -1
  79. package/dist/signer/signer.cjs +1 -1
  80. package/dist/signer/signer.d.cts +3 -2
  81. package/dist/signer/signer.d.ts +3 -2
  82. package/dist/signer/signer.js +2 -2
  83. package/dist/{signer-D7vfYik9.d.ts → signer-BP6F__oR.d.cts} +2 -6
  84. package/dist/{signer-DaY8c60s.d.cts → signer-BVZJXcq7.d.ts} +2 -6
  85. package/dist/{spark-C4ZrsgjC.d.cts → spark-DbzGfse6.d.cts} +93 -15
  86. package/dist/{spark-C4ZrsgjC.d.ts → spark-DbzGfse6.d.ts} +93 -15
  87. package/dist/spark_bindings/native/index.cjs +183 -0
  88. package/dist/spark_bindings/native/index.d.cts +14 -0
  89. package/dist/spark_bindings/native/index.d.ts +14 -0
  90. package/dist/spark_bindings/native/index.js +141 -0
  91. package/dist/spark_bindings/wasm/index.cjs +1093 -0
  92. package/dist/spark_bindings/wasm/index.d.cts +47 -0
  93. package/dist/spark_bindings/wasm/index.d.ts +47 -0
  94. package/dist/{chunk-K4C4W5FC.js → spark_bindings/wasm/index.js} +7 -6
  95. package/dist/types/index.cjs +1156 -208
  96. package/dist/types/index.d.cts +5 -4
  97. package/dist/types/index.d.ts +5 -4
  98. package/dist/types/index.js +2 -2
  99. package/dist/types-C-Rp0Oo7.d.cts +46 -0
  100. package/dist/types-C-Rp0Oo7.d.ts +46 -0
  101. package/dist/utils/index.cjs +65 -13
  102. package/dist/utils/index.d.cts +14 -134
  103. package/dist/utils/index.d.ts +14 -134
  104. package/dist/utils/index.js +13 -13
  105. package/package.json +22 -2
  106. package/src/index.node.ts +0 -1
  107. package/src/index.ts +0 -1
  108. package/src/native/index.ts +1 -2
  109. package/src/proto/common.ts +5 -5
  110. package/src/proto/google/protobuf/descriptor.ts +34 -34
  111. package/src/proto/google/protobuf/duration.ts +2 -2
  112. package/src/proto/google/protobuf/empty.ts +2 -2
  113. package/src/proto/google/protobuf/timestamp.ts +2 -2
  114. package/src/proto/mock.ts +4 -4
  115. package/src/proto/spark.ts +1452 -185
  116. package/src/proto/spark_authn.ts +7 -7
  117. package/src/proto/spark_token.ts +1668 -105
  118. package/src/proto/validate/validate.ts +24 -24
  119. package/src/services/bolt11-spark.ts +62 -187
  120. package/src/services/coop-exit.ts +3 -0
  121. package/src/services/lrc20.ts +1 -1
  122. package/src/services/token-transactions.ts +197 -9
  123. package/src/services/transfer.ts +22 -0
  124. package/src/services/tree-creation.ts +13 -0
  125. package/src/services/wallet-config.ts +2 -2
  126. package/src/spark-wallet/spark-wallet.node.ts +0 -4
  127. package/src/spark-wallet/spark-wallet.ts +76 -108
  128. package/src/spark-wallet/types.ts +39 -3
  129. package/src/tests/bolt11-spark.test.ts +7 -15
  130. package/src/tests/integration/ssp/coop-exit.test.ts +7 -7
  131. package/src/tests/integration/swap.test.ts +453 -433
  132. package/src/tests/integration/transfer.test.ts +261 -248
  133. package/src/tests/token-identifier.test.ts +54 -0
  134. package/src/tests/tokens.test.ts +218 -23
  135. package/src/utils/token-hashing.ts +320 -44
  136. package/src/utils/token-identifier.ts +88 -0
  137. package/src/utils/token-transaction-validation.ts +350 -5
  138. package/src/utils/token-transactions.ts +12 -8
  139. package/src/utils/transaction.ts +0 -6
  140. package/dist/chunk-B3AMIGJG.js +0 -1073
  141. package/dist/index-CZmDdSts.d.cts +0 -829
  142. package/dist/index-ClIRO_3y.d.ts +0 -829
  143. package/dist/wasm-7OWFHDMS.js +0 -21
@@ -23,16 +23,34 @@ __export(spark_token_exports, {
23
23
  CommitTransactionRequest: () => CommitTransactionRequest,
24
24
  CommitTransactionResponse: () => CommitTransactionResponse,
25
25
  InputTtxoSignaturesPerOperator: () => InputTtxoSignaturesPerOperator,
26
+ OutputWithPreviousTransactionData: () => OutputWithPreviousTransactionData,
27
+ QueryTokenMetadataRequest: () => QueryTokenMetadataRequest,
28
+ QueryTokenMetadataResponse: () => QueryTokenMetadataResponse,
29
+ QueryTokenOutputsRequest: () => QueryTokenOutputsRequest,
30
+ QueryTokenOutputsResponse: () => QueryTokenOutputsResponse,
31
+ QueryTokenTransactionsRequest: () => QueryTokenTransactionsRequest,
32
+ QueryTokenTransactionsResponse: () => QueryTokenTransactionsResponse,
26
33
  SignatureWithIndex: () => SignatureWithIndex,
27
34
  SparkTokenServiceDefinition: () => SparkTokenServiceDefinition,
35
+ SpentTokenOutputMetadata: () => SpentTokenOutputMetadata,
28
36
  StartTransactionRequest: () => StartTransactionRequest,
29
37
  StartTransactionResponse: () => StartTransactionResponse,
38
+ TokenCreateInput: () => TokenCreateInput,
39
+ TokenMetadata: () => TokenMetadata,
30
40
  TokenMintInput: () => TokenMintInput,
31
41
  TokenOutput: () => TokenOutput,
32
42
  TokenOutputToSpend: () => TokenOutputToSpend,
33
43
  TokenTransaction: () => TokenTransaction,
44
+ TokenTransactionConfirmationMetadata: () => TokenTransactionConfirmationMetadata,
45
+ TokenTransactionStatus: () => TokenTransactionStatus,
46
+ TokenTransactionType: () => TokenTransactionType,
47
+ TokenTransactionWithStatus: () => TokenTransactionWithStatus,
34
48
  TokenTransferInput: () => TokenTransferInput,
35
- protobufPackage: () => protobufPackage
49
+ protobufPackage: () => protobufPackage,
50
+ tokenTransactionStatusFromJSON: () => tokenTransactionStatusFromJSON,
51
+ tokenTransactionStatusToJSON: () => tokenTransactionStatusToJSON,
52
+ tokenTransactionTypeFromJSON: () => tokenTransactionTypeFromJSON,
53
+ tokenTransactionTypeToJSON: () => tokenTransactionTypeToJSON
36
54
  });
37
55
  module.exports = __toCommonJS(spark_token_exports);
38
56
 
@@ -70,7 +88,7 @@ var Timestamp = {
70
88
  },
71
89
  decode(input, length) {
72
90
  const reader = input instanceof import_wire.BinaryReader ? input : new import_wire.BinaryReader(input);
73
- let end = length === void 0 ? reader.len : reader.pos + length;
91
+ const end = length === void 0 ? reader.len : reader.pos + length;
74
92
  const message = createBaseTimestamp();
75
93
  while (reader.pos < end) {
76
94
  const tag = reader.uint32();
@@ -211,7 +229,7 @@ var SigningKeyshare = {
211
229
  },
212
230
  decode(input, length) {
213
231
  const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
214
- let end = length === void 0 ? reader.len : reader.pos + length;
232
+ const end = length === void 0 ? reader.len : reader.pos + length;
215
233
  const message = createBaseSigningKeyshare();
216
234
  while (reader.pos < end) {
217
235
  const tag = reader.uint32();
@@ -335,7 +353,7 @@ var SigningKeyshare_PublicSharesEntry = {
335
353
  },
336
354
  decode(input, length) {
337
355
  const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
338
- let end = length === void 0 ? reader.len : reader.pos + length;
356
+ const end = length === void 0 ? reader.len : reader.pos + length;
339
357
  const message = createBaseSigningKeyshare_PublicSharesEntry();
340
358
  while (reader.pos < end) {
341
359
  const tag = reader.uint32();
@@ -439,6 +457,110 @@ function isSet2(value) {
439
457
 
440
458
  // src/proto/spark_token.ts
441
459
  var protobufPackage = "spark_token";
460
+ var TokenTransactionType = /* @__PURE__ */ ((TokenTransactionType2) => {
461
+ TokenTransactionType2[TokenTransactionType2["TOKEN_TRANSACTION_TYPE_UNSPECIFIED"] = 0] = "TOKEN_TRANSACTION_TYPE_UNSPECIFIED";
462
+ TokenTransactionType2[TokenTransactionType2["TOKEN_TRANSACTION_TYPE_CREATE"] = 1] = "TOKEN_TRANSACTION_TYPE_CREATE";
463
+ TokenTransactionType2[TokenTransactionType2["TOKEN_TRANSACTION_TYPE_MINT"] = 2] = "TOKEN_TRANSACTION_TYPE_MINT";
464
+ TokenTransactionType2[TokenTransactionType2["TOKEN_TRANSACTION_TYPE_TRANSFER"] = 3] = "TOKEN_TRANSACTION_TYPE_TRANSFER";
465
+ TokenTransactionType2[TokenTransactionType2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
466
+ return TokenTransactionType2;
467
+ })(TokenTransactionType || {});
468
+ function tokenTransactionTypeFromJSON(object) {
469
+ switch (object) {
470
+ case 0:
471
+ case "TOKEN_TRANSACTION_TYPE_UNSPECIFIED":
472
+ return 0 /* TOKEN_TRANSACTION_TYPE_UNSPECIFIED */;
473
+ case 1:
474
+ case "TOKEN_TRANSACTION_TYPE_CREATE":
475
+ return 1 /* TOKEN_TRANSACTION_TYPE_CREATE */;
476
+ case 2:
477
+ case "TOKEN_TRANSACTION_TYPE_MINT":
478
+ return 2 /* TOKEN_TRANSACTION_TYPE_MINT */;
479
+ case 3:
480
+ case "TOKEN_TRANSACTION_TYPE_TRANSFER":
481
+ return 3 /* TOKEN_TRANSACTION_TYPE_TRANSFER */;
482
+ case -1:
483
+ case "UNRECOGNIZED":
484
+ default:
485
+ return -1 /* UNRECOGNIZED */;
486
+ }
487
+ }
488
+ function tokenTransactionTypeToJSON(object) {
489
+ switch (object) {
490
+ case 0 /* TOKEN_TRANSACTION_TYPE_UNSPECIFIED */:
491
+ return "TOKEN_TRANSACTION_TYPE_UNSPECIFIED";
492
+ case 1 /* TOKEN_TRANSACTION_TYPE_CREATE */:
493
+ return "TOKEN_TRANSACTION_TYPE_CREATE";
494
+ case 2 /* TOKEN_TRANSACTION_TYPE_MINT */:
495
+ return "TOKEN_TRANSACTION_TYPE_MINT";
496
+ case 3 /* TOKEN_TRANSACTION_TYPE_TRANSFER */:
497
+ return "TOKEN_TRANSACTION_TYPE_TRANSFER";
498
+ case -1 /* UNRECOGNIZED */:
499
+ default:
500
+ return "UNRECOGNIZED";
501
+ }
502
+ }
503
+ var TokenTransactionStatus = /* @__PURE__ */ ((TokenTransactionStatus2) => {
504
+ TokenTransactionStatus2[TokenTransactionStatus2["TOKEN_TRANSACTION_STARTED"] = 0] = "TOKEN_TRANSACTION_STARTED";
505
+ TokenTransactionStatus2[TokenTransactionStatus2["TOKEN_TRANSACTION_SIGNED"] = 1] = "TOKEN_TRANSACTION_SIGNED";
506
+ TokenTransactionStatus2[TokenTransactionStatus2["TOKEN_TRANSACTION_REVEALED"] = 5] = "TOKEN_TRANSACTION_REVEALED";
507
+ TokenTransactionStatus2[TokenTransactionStatus2["TOKEN_TRANSACTION_FINALIZED"] = 2] = "TOKEN_TRANSACTION_FINALIZED";
508
+ TokenTransactionStatus2[TokenTransactionStatus2["TOKEN_TRANSACTION_STARTED_CANCELLED"] = 3] = "TOKEN_TRANSACTION_STARTED_CANCELLED";
509
+ TokenTransactionStatus2[TokenTransactionStatus2["TOKEN_TRANSACTION_SIGNED_CANCELLED"] = 4] = "TOKEN_TRANSACTION_SIGNED_CANCELLED";
510
+ TokenTransactionStatus2[TokenTransactionStatus2["TOKEN_TRANSACTION_UNKNOWN"] = 10] = "TOKEN_TRANSACTION_UNKNOWN";
511
+ TokenTransactionStatus2[TokenTransactionStatus2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
512
+ return TokenTransactionStatus2;
513
+ })(TokenTransactionStatus || {});
514
+ function tokenTransactionStatusFromJSON(object) {
515
+ switch (object) {
516
+ case 0:
517
+ case "TOKEN_TRANSACTION_STARTED":
518
+ return 0 /* TOKEN_TRANSACTION_STARTED */;
519
+ case 1:
520
+ case "TOKEN_TRANSACTION_SIGNED":
521
+ return 1 /* TOKEN_TRANSACTION_SIGNED */;
522
+ case 5:
523
+ case "TOKEN_TRANSACTION_REVEALED":
524
+ return 5 /* TOKEN_TRANSACTION_REVEALED */;
525
+ case 2:
526
+ case "TOKEN_TRANSACTION_FINALIZED":
527
+ return 2 /* TOKEN_TRANSACTION_FINALIZED */;
528
+ case 3:
529
+ case "TOKEN_TRANSACTION_STARTED_CANCELLED":
530
+ return 3 /* TOKEN_TRANSACTION_STARTED_CANCELLED */;
531
+ case 4:
532
+ case "TOKEN_TRANSACTION_SIGNED_CANCELLED":
533
+ return 4 /* TOKEN_TRANSACTION_SIGNED_CANCELLED */;
534
+ case 10:
535
+ case "TOKEN_TRANSACTION_UNKNOWN":
536
+ return 10 /* TOKEN_TRANSACTION_UNKNOWN */;
537
+ case -1:
538
+ case "UNRECOGNIZED":
539
+ default:
540
+ return -1 /* UNRECOGNIZED */;
541
+ }
542
+ }
543
+ function tokenTransactionStatusToJSON(object) {
544
+ switch (object) {
545
+ case 0 /* TOKEN_TRANSACTION_STARTED */:
546
+ return "TOKEN_TRANSACTION_STARTED";
547
+ case 1 /* TOKEN_TRANSACTION_SIGNED */:
548
+ return "TOKEN_TRANSACTION_SIGNED";
549
+ case 5 /* TOKEN_TRANSACTION_REVEALED */:
550
+ return "TOKEN_TRANSACTION_REVEALED";
551
+ case 2 /* TOKEN_TRANSACTION_FINALIZED */:
552
+ return "TOKEN_TRANSACTION_FINALIZED";
553
+ case 3 /* TOKEN_TRANSACTION_STARTED_CANCELLED */:
554
+ return "TOKEN_TRANSACTION_STARTED_CANCELLED";
555
+ case 4 /* TOKEN_TRANSACTION_SIGNED_CANCELLED */:
556
+ return "TOKEN_TRANSACTION_SIGNED_CANCELLED";
557
+ case 10 /* TOKEN_TRANSACTION_UNKNOWN */:
558
+ return "TOKEN_TRANSACTION_UNKNOWN";
559
+ case -1 /* UNRECOGNIZED */:
560
+ default:
561
+ return "UNRECOGNIZED";
562
+ }
563
+ }
442
564
  function createBaseTokenOutputToSpend() {
443
565
  return { prevTokenTransactionHash: new Uint8Array(0), prevTokenTransactionVout: 0 };
444
566
  }
@@ -454,7 +576,7 @@ var TokenOutputToSpend = {
454
576
  },
455
577
  decode(input, length) {
456
578
  const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
457
- let end = length === void 0 ? reader.len : reader.pos + length;
579
+ const end = length === void 0 ? reader.len : reader.pos + length;
458
580
  const message = createBaseTokenOutputToSpend();
459
581
  while (reader.pos < end) {
460
582
  const tag = reader.uint32();
@@ -519,7 +641,7 @@ var TokenTransferInput = {
519
641
  },
520
642
  decode(input, length) {
521
643
  const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
522
- let end = length === void 0 ? reader.len : reader.pos + length;
644
+ const end = length === void 0 ? reader.len : reader.pos + length;
523
645
  const message = createBaseTokenTransferInput();
524
646
  while (reader.pos < end) {
525
647
  const tag = reader.uint32();
@@ -561,21 +683,21 @@ var TokenTransferInput = {
561
683
  }
562
684
  };
563
685
  function createBaseTokenMintInput() {
564
- return { issuerPublicKey: new Uint8Array(0), issuerProvidedTimestamp: 0 };
686
+ return { issuerPublicKey: new Uint8Array(0), tokenIdentifier: void 0 };
565
687
  }
566
688
  var TokenMintInput = {
567
689
  encode(message, writer = new import_wire5.BinaryWriter()) {
568
690
  if (message.issuerPublicKey.length !== 0) {
569
691
  writer.uint32(10).bytes(message.issuerPublicKey);
570
692
  }
571
- if (message.issuerProvidedTimestamp !== 0) {
572
- writer.uint32(16).uint64(message.issuerProvidedTimestamp);
693
+ if (message.tokenIdentifier !== void 0) {
694
+ writer.uint32(18).bytes(message.tokenIdentifier);
573
695
  }
574
696
  return writer;
575
697
  },
576
698
  decode(input, length) {
577
699
  const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
578
- let end = length === void 0 ? reader.len : reader.pos + length;
700
+ const end = length === void 0 ? reader.len : reader.pos + length;
579
701
  const message = createBaseTokenMintInput();
580
702
  while (reader.pos < end) {
581
703
  const tag = reader.uint32();
@@ -588,10 +710,10 @@ var TokenMintInput = {
588
710
  continue;
589
711
  }
590
712
  case 2: {
591
- if (tag !== 16) {
713
+ if (tag !== 18) {
592
714
  break;
593
715
  }
594
- message.issuerProvidedTimestamp = longToNumber2(reader.uint64());
716
+ message.tokenIdentifier = reader.bytes();
595
717
  continue;
596
718
  }
597
719
  }
@@ -605,7 +727,7 @@ var TokenMintInput = {
605
727
  fromJSON(object) {
606
728
  return {
607
729
  issuerPublicKey: isSet3(object.issuerPublicKey) ? bytesFromBase642(object.issuerPublicKey) : new Uint8Array(0),
608
- issuerProvidedTimestamp: isSet3(object.issuerProvidedTimestamp) ? globalThis.Number(object.issuerProvidedTimestamp) : 0
730
+ tokenIdentifier: isSet3(object.tokenIdentifier) ? bytesFromBase642(object.tokenIdentifier) : void 0
609
731
  };
610
732
  },
611
733
  toJSON(message) {
@@ -613,8 +735,8 @@ var TokenMintInput = {
613
735
  if (message.issuerPublicKey.length !== 0) {
614
736
  obj.issuerPublicKey = base64FromBytes2(message.issuerPublicKey);
615
737
  }
616
- if (message.issuerProvidedTimestamp !== 0) {
617
- obj.issuerProvidedTimestamp = Math.round(message.issuerProvidedTimestamp);
738
+ if (message.tokenIdentifier !== void 0) {
739
+ obj.tokenIdentifier = base64FromBytes2(message.tokenIdentifier);
618
740
  }
619
741
  return obj;
620
742
  },
@@ -624,7 +746,158 @@ var TokenMintInput = {
624
746
  fromPartial(object) {
625
747
  const message = createBaseTokenMintInput();
626
748
  message.issuerPublicKey = object.issuerPublicKey ?? new Uint8Array(0);
627
- message.issuerProvidedTimestamp = object.issuerProvidedTimestamp ?? 0;
749
+ message.tokenIdentifier = object.tokenIdentifier ?? void 0;
750
+ return message;
751
+ }
752
+ };
753
+ function createBaseTokenCreateInput() {
754
+ return {
755
+ issuerPublicKey: new Uint8Array(0),
756
+ tokenName: "",
757
+ tokenTicker: "",
758
+ decimals: 0,
759
+ maxSupply: new Uint8Array(0),
760
+ isFreezable: false,
761
+ creationEntityPublicKey: void 0
762
+ };
763
+ }
764
+ var TokenCreateInput = {
765
+ encode(message, writer = new import_wire5.BinaryWriter()) {
766
+ if (message.issuerPublicKey.length !== 0) {
767
+ writer.uint32(10).bytes(message.issuerPublicKey);
768
+ }
769
+ if (message.tokenName !== "") {
770
+ writer.uint32(18).string(message.tokenName);
771
+ }
772
+ if (message.tokenTicker !== "") {
773
+ writer.uint32(26).string(message.tokenTicker);
774
+ }
775
+ if (message.decimals !== 0) {
776
+ writer.uint32(32).uint32(message.decimals);
777
+ }
778
+ if (message.maxSupply.length !== 0) {
779
+ writer.uint32(42).bytes(message.maxSupply);
780
+ }
781
+ if (message.isFreezable !== false) {
782
+ writer.uint32(48).bool(message.isFreezable);
783
+ }
784
+ if (message.creationEntityPublicKey !== void 0) {
785
+ writer.uint32(58).bytes(message.creationEntityPublicKey);
786
+ }
787
+ return writer;
788
+ },
789
+ decode(input, length) {
790
+ const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
791
+ const end = length === void 0 ? reader.len : reader.pos + length;
792
+ const message = createBaseTokenCreateInput();
793
+ while (reader.pos < end) {
794
+ const tag = reader.uint32();
795
+ switch (tag >>> 3) {
796
+ case 1: {
797
+ if (tag !== 10) {
798
+ break;
799
+ }
800
+ message.issuerPublicKey = reader.bytes();
801
+ continue;
802
+ }
803
+ case 2: {
804
+ if (tag !== 18) {
805
+ break;
806
+ }
807
+ message.tokenName = reader.string();
808
+ continue;
809
+ }
810
+ case 3: {
811
+ if (tag !== 26) {
812
+ break;
813
+ }
814
+ message.tokenTicker = reader.string();
815
+ continue;
816
+ }
817
+ case 4: {
818
+ if (tag !== 32) {
819
+ break;
820
+ }
821
+ message.decimals = reader.uint32();
822
+ continue;
823
+ }
824
+ case 5: {
825
+ if (tag !== 42) {
826
+ break;
827
+ }
828
+ message.maxSupply = reader.bytes();
829
+ continue;
830
+ }
831
+ case 6: {
832
+ if (tag !== 48) {
833
+ break;
834
+ }
835
+ message.isFreezable = reader.bool();
836
+ continue;
837
+ }
838
+ case 7: {
839
+ if (tag !== 58) {
840
+ break;
841
+ }
842
+ message.creationEntityPublicKey = reader.bytes();
843
+ continue;
844
+ }
845
+ }
846
+ if ((tag & 7) === 4 || tag === 0) {
847
+ break;
848
+ }
849
+ reader.skip(tag & 7);
850
+ }
851
+ return message;
852
+ },
853
+ fromJSON(object) {
854
+ return {
855
+ issuerPublicKey: isSet3(object.issuerPublicKey) ? bytesFromBase642(object.issuerPublicKey) : new Uint8Array(0),
856
+ tokenName: isSet3(object.tokenName) ? globalThis.String(object.tokenName) : "",
857
+ tokenTicker: isSet3(object.tokenTicker) ? globalThis.String(object.tokenTicker) : "",
858
+ decimals: isSet3(object.decimals) ? globalThis.Number(object.decimals) : 0,
859
+ maxSupply: isSet3(object.maxSupply) ? bytesFromBase642(object.maxSupply) : new Uint8Array(0),
860
+ isFreezable: isSet3(object.isFreezable) ? globalThis.Boolean(object.isFreezable) : false,
861
+ creationEntityPublicKey: isSet3(object.creationEntityPublicKey) ? bytesFromBase642(object.creationEntityPublicKey) : void 0
862
+ };
863
+ },
864
+ toJSON(message) {
865
+ const obj = {};
866
+ if (message.issuerPublicKey.length !== 0) {
867
+ obj.issuerPublicKey = base64FromBytes2(message.issuerPublicKey);
868
+ }
869
+ if (message.tokenName !== "") {
870
+ obj.tokenName = message.tokenName;
871
+ }
872
+ if (message.tokenTicker !== "") {
873
+ obj.tokenTicker = message.tokenTicker;
874
+ }
875
+ if (message.decimals !== 0) {
876
+ obj.decimals = Math.round(message.decimals);
877
+ }
878
+ if (message.maxSupply.length !== 0) {
879
+ obj.maxSupply = base64FromBytes2(message.maxSupply);
880
+ }
881
+ if (message.isFreezable !== false) {
882
+ obj.isFreezable = message.isFreezable;
883
+ }
884
+ if (message.creationEntityPublicKey !== void 0) {
885
+ obj.creationEntityPublicKey = base64FromBytes2(message.creationEntityPublicKey);
886
+ }
887
+ return obj;
888
+ },
889
+ create(base) {
890
+ return TokenCreateInput.fromPartial(base ?? {});
891
+ },
892
+ fromPartial(object) {
893
+ const message = createBaseTokenCreateInput();
894
+ message.issuerPublicKey = object.issuerPublicKey ?? new Uint8Array(0);
895
+ message.tokenName = object.tokenName ?? "";
896
+ message.tokenTicker = object.tokenTicker ?? "";
897
+ message.decimals = object.decimals ?? 0;
898
+ message.maxSupply = object.maxSupply ?? new Uint8Array(0);
899
+ message.isFreezable = object.isFreezable ?? false;
900
+ message.creationEntityPublicKey = object.creationEntityPublicKey ?? void 0;
628
901
  return message;
629
902
  }
630
903
  };
@@ -635,7 +908,8 @@ function createBaseTokenOutput() {
635
908
  revocationCommitment: void 0,
636
909
  withdrawBondSats: void 0,
637
910
  withdrawRelativeBlockLocktime: void 0,
638
- tokenPublicKey: new Uint8Array(0),
911
+ tokenPublicKey: void 0,
912
+ tokenIdentifier: void 0,
639
913
  tokenAmount: new Uint8Array(0)
640
914
  };
641
915
  }
@@ -656,9 +930,12 @@ var TokenOutput = {
656
930
  if (message.withdrawRelativeBlockLocktime !== void 0) {
657
931
  writer.uint32(40).uint64(message.withdrawRelativeBlockLocktime);
658
932
  }
659
- if (message.tokenPublicKey.length !== 0) {
933
+ if (message.tokenPublicKey !== void 0) {
660
934
  writer.uint32(50).bytes(message.tokenPublicKey);
661
935
  }
936
+ if (message.tokenIdentifier !== void 0) {
937
+ writer.uint32(66).bytes(message.tokenIdentifier);
938
+ }
662
939
  if (message.tokenAmount.length !== 0) {
663
940
  writer.uint32(58).bytes(message.tokenAmount);
664
941
  }
@@ -666,7 +943,7 @@ var TokenOutput = {
666
943
  },
667
944
  decode(input, length) {
668
945
  const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
669
- let end = length === void 0 ? reader.len : reader.pos + length;
946
+ const end = length === void 0 ? reader.len : reader.pos + length;
670
947
  const message = createBaseTokenOutput();
671
948
  while (reader.pos < end) {
672
949
  const tag = reader.uint32();
@@ -713,6 +990,13 @@ var TokenOutput = {
713
990
  message.tokenPublicKey = reader.bytes();
714
991
  continue;
715
992
  }
993
+ case 8: {
994
+ if (tag !== 66) {
995
+ break;
996
+ }
997
+ message.tokenIdentifier = reader.bytes();
998
+ continue;
999
+ }
716
1000
  case 7: {
717
1001
  if (tag !== 58) {
718
1002
  break;
@@ -735,7 +1019,8 @@ var TokenOutput = {
735
1019
  revocationCommitment: isSet3(object.revocationCommitment) ? bytesFromBase642(object.revocationCommitment) : void 0,
736
1020
  withdrawBondSats: isSet3(object.withdrawBondSats) ? globalThis.Number(object.withdrawBondSats) : void 0,
737
1021
  withdrawRelativeBlockLocktime: isSet3(object.withdrawRelativeBlockLocktime) ? globalThis.Number(object.withdrawRelativeBlockLocktime) : void 0,
738
- tokenPublicKey: isSet3(object.tokenPublicKey) ? bytesFromBase642(object.tokenPublicKey) : new Uint8Array(0),
1022
+ tokenPublicKey: isSet3(object.tokenPublicKey) ? bytesFromBase642(object.tokenPublicKey) : void 0,
1023
+ tokenIdentifier: isSet3(object.tokenIdentifier) ? bytesFromBase642(object.tokenIdentifier) : void 0,
739
1024
  tokenAmount: isSet3(object.tokenAmount) ? bytesFromBase642(object.tokenAmount) : new Uint8Array(0)
740
1025
  };
741
1026
  },
@@ -756,9 +1041,12 @@ var TokenOutput = {
756
1041
  if (message.withdrawRelativeBlockLocktime !== void 0) {
757
1042
  obj.withdrawRelativeBlockLocktime = Math.round(message.withdrawRelativeBlockLocktime);
758
1043
  }
759
- if (message.tokenPublicKey.length !== 0) {
1044
+ if (message.tokenPublicKey !== void 0) {
760
1045
  obj.tokenPublicKey = base64FromBytes2(message.tokenPublicKey);
761
1046
  }
1047
+ if (message.tokenIdentifier !== void 0) {
1048
+ obj.tokenIdentifier = base64FromBytes2(message.tokenIdentifier);
1049
+ }
762
1050
  if (message.tokenAmount.length !== 0) {
763
1051
  obj.tokenAmount = base64FromBytes2(message.tokenAmount);
764
1052
  }
@@ -774,7 +1062,8 @@ var TokenOutput = {
774
1062
  message.revocationCommitment = object.revocationCommitment ?? void 0;
775
1063
  message.withdrawBondSats = object.withdrawBondSats ?? void 0;
776
1064
  message.withdrawRelativeBlockLocktime = object.withdrawRelativeBlockLocktime ?? void 0;
777
- message.tokenPublicKey = object.tokenPublicKey ?? new Uint8Array(0);
1065
+ message.tokenPublicKey = object.tokenPublicKey ?? void 0;
1066
+ message.tokenIdentifier = object.tokenIdentifier ?? void 0;
778
1067
  message.tokenAmount = object.tokenAmount ?? new Uint8Array(0);
779
1068
  return message;
780
1069
  }
@@ -786,7 +1075,8 @@ function createBaseTokenTransaction() {
786
1075
  tokenOutputs: [],
787
1076
  sparkOperatorIdentityPublicKeys: [],
788
1077
  expiryTime: void 0,
789
- network: 0
1078
+ network: 0,
1079
+ clientCreatedTimestamp: void 0
790
1080
  };
791
1081
  }
792
1082
  var TokenTransaction = {
@@ -801,6 +1091,9 @@ var TokenTransaction = {
801
1091
  case "transferInput":
802
1092
  TokenTransferInput.encode(message.tokenInputs.transferInput, writer.uint32(26).fork()).join();
803
1093
  break;
1094
+ case "createInput":
1095
+ TokenCreateInput.encode(message.tokenInputs.createInput, writer.uint32(66).fork()).join();
1096
+ break;
804
1097
  }
805
1098
  for (const v of message.tokenOutputs) {
806
1099
  TokenOutput.encode(v, writer.uint32(34).fork()).join();
@@ -814,11 +1107,14 @@ var TokenTransaction = {
814
1107
  if (message.network !== 0) {
815
1108
  writer.uint32(56).int32(message.network);
816
1109
  }
1110
+ if (message.clientCreatedTimestamp !== void 0) {
1111
+ Timestamp.encode(toTimestamp2(message.clientCreatedTimestamp), writer.uint32(74).fork()).join();
1112
+ }
817
1113
  return writer;
818
1114
  },
819
1115
  decode(input, length) {
820
1116
  const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
821
- let end = length === void 0 ? reader.len : reader.pos + length;
1117
+ const end = length === void 0 ? reader.len : reader.pos + length;
822
1118
  const message = createBaseTokenTransaction();
823
1119
  while (reader.pos < end) {
824
1120
  const tag = reader.uint32();
@@ -847,6 +1143,13 @@ var TokenTransaction = {
847
1143
  };
848
1144
  continue;
849
1145
  }
1146
+ case 8: {
1147
+ if (tag !== 66) {
1148
+ break;
1149
+ }
1150
+ message.tokenInputs = { $case: "createInput", createInput: TokenCreateInput.decode(reader, reader.uint32()) };
1151
+ continue;
1152
+ }
850
1153
  case 4: {
851
1154
  if (tag !== 34) {
852
1155
  break;
@@ -875,6 +1178,13 @@ var TokenTransaction = {
875
1178
  message.network = reader.int32();
876
1179
  continue;
877
1180
  }
1181
+ case 9: {
1182
+ if (tag !== 74) {
1183
+ break;
1184
+ }
1185
+ message.clientCreatedTimestamp = fromTimestamp2(Timestamp.decode(reader, reader.uint32()));
1186
+ continue;
1187
+ }
878
1188
  }
879
1189
  if ((tag & 7) === 4 || tag === 0) {
880
1190
  break;
@@ -886,11 +1196,12 @@ var TokenTransaction = {
886
1196
  fromJSON(object) {
887
1197
  return {
888
1198
  version: isSet3(object.version) ? globalThis.Number(object.version) : 0,
889
- tokenInputs: isSet3(object.mintInput) ? { $case: "mintInput", mintInput: TokenMintInput.fromJSON(object.mintInput) } : isSet3(object.transferInput) ? { $case: "transferInput", transferInput: TokenTransferInput.fromJSON(object.transferInput) } : void 0,
1199
+ tokenInputs: isSet3(object.mintInput) ? { $case: "mintInput", mintInput: TokenMintInput.fromJSON(object.mintInput) } : isSet3(object.transferInput) ? { $case: "transferInput", transferInput: TokenTransferInput.fromJSON(object.transferInput) } : isSet3(object.createInput) ? { $case: "createInput", createInput: TokenCreateInput.fromJSON(object.createInput) } : void 0,
890
1200
  tokenOutputs: globalThis.Array.isArray(object?.tokenOutputs) ? object.tokenOutputs.map((e) => TokenOutput.fromJSON(e)) : [],
891
1201
  sparkOperatorIdentityPublicKeys: globalThis.Array.isArray(object?.sparkOperatorIdentityPublicKeys) ? object.sparkOperatorIdentityPublicKeys.map((e) => bytesFromBase642(e)) : [],
892
1202
  expiryTime: isSet3(object.expiryTime) ? fromJsonTimestamp2(object.expiryTime) : void 0,
893
- network: isSet3(object.network) ? networkFromJSON(object.network) : 0
1203
+ network: isSet3(object.network) ? networkFromJSON(object.network) : 0,
1204
+ clientCreatedTimestamp: isSet3(object.clientCreatedTimestamp) ? fromJsonTimestamp2(object.clientCreatedTimestamp) : void 0
894
1205
  };
895
1206
  },
896
1207
  toJSON(message) {
@@ -902,6 +1213,8 @@ var TokenTransaction = {
902
1213
  obj.mintInput = TokenMintInput.toJSON(message.tokenInputs.mintInput);
903
1214
  } else if (message.tokenInputs?.$case === "transferInput") {
904
1215
  obj.transferInput = TokenTransferInput.toJSON(message.tokenInputs.transferInput);
1216
+ } else if (message.tokenInputs?.$case === "createInput") {
1217
+ obj.createInput = TokenCreateInput.toJSON(message.tokenInputs.createInput);
905
1218
  }
906
1219
  if (message.tokenOutputs?.length) {
907
1220
  obj.tokenOutputs = message.tokenOutputs.map((e) => TokenOutput.toJSON(e));
@@ -915,6 +1228,9 @@ var TokenTransaction = {
915
1228
  if (message.network !== 0) {
916
1229
  obj.network = networkToJSON(message.network);
917
1230
  }
1231
+ if (message.clientCreatedTimestamp !== void 0) {
1232
+ obj.clientCreatedTimestamp = message.clientCreatedTimestamp.toISOString();
1233
+ }
918
1234
  return obj;
919
1235
  },
920
1236
  create(base) {
@@ -942,11 +1258,21 @@ var TokenTransaction = {
942
1258
  }
943
1259
  break;
944
1260
  }
1261
+ case "createInput": {
1262
+ if (object.tokenInputs?.createInput !== void 0 && object.tokenInputs?.createInput !== null) {
1263
+ message.tokenInputs = {
1264
+ $case: "createInput",
1265
+ createInput: TokenCreateInput.fromPartial(object.tokenInputs.createInput)
1266
+ };
1267
+ }
1268
+ break;
1269
+ }
945
1270
  }
946
1271
  message.tokenOutputs = object.tokenOutputs?.map((e) => TokenOutput.fromPartial(e)) || [];
947
1272
  message.sparkOperatorIdentityPublicKeys = object.sparkOperatorIdentityPublicKeys?.map((e) => e) || [];
948
1273
  message.expiryTime = object.expiryTime ?? void 0;
949
1274
  message.network = object.network ?? 0;
1275
+ message.clientCreatedTimestamp = object.clientCreatedTimestamp ?? void 0;
950
1276
  return message;
951
1277
  }
952
1278
  };
@@ -965,7 +1291,7 @@ var SignatureWithIndex = {
965
1291
  },
966
1292
  decode(input, length) {
967
1293
  const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
968
- let end = length === void 0 ? reader.len : reader.pos + length;
1294
+ const end = length === void 0 ? reader.len : reader.pos + length;
969
1295
  const message = createBaseSignatureWithIndex();
970
1296
  while (reader.pos < end) {
971
1297
  const tag = reader.uint32();
@@ -1033,7 +1359,7 @@ var InputTtxoSignaturesPerOperator = {
1033
1359
  },
1034
1360
  decode(input, length) {
1035
1361
  const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
1036
- let end = length === void 0 ? reader.len : reader.pos + length;
1362
+ const end = length === void 0 ? reader.len : reader.pos + length;
1037
1363
  const message = createBaseInputTtxoSignaturesPerOperator();
1038
1364
  while (reader.pos < end) {
1039
1365
  const tag = reader.uint32();
@@ -1112,7 +1438,7 @@ var StartTransactionRequest = {
1112
1438
  },
1113
1439
  decode(input, length) {
1114
1440
  const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
1115
- let end = length === void 0 ? reader.len : reader.pos + length;
1441
+ const end = length === void 0 ? reader.len : reader.pos + length;
1116
1442
  const message = createBaseStartTransactionRequest();
1117
1443
  while (reader.pos < end) {
1118
1444
  const tag = reader.uint32();
@@ -1206,7 +1532,7 @@ var StartTransactionResponse = {
1206
1532
  },
1207
1533
  decode(input, length) {
1208
1534
  const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
1209
- let end = length === void 0 ? reader.len : reader.pos + length;
1535
+ const end = length === void 0 ? reader.len : reader.pos + length;
1210
1536
  const message = createBaseStartTransactionResponse();
1211
1537
  while (reader.pos < end) {
1212
1538
  const tag = reader.uint32();
@@ -1285,7 +1611,7 @@ var CommitTransactionRequest = {
1285
1611
  },
1286
1612
  decode(input, length) {
1287
1613
  const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
1288
- let end = length === void 0 ? reader.len : reader.pos + length;
1614
+ const end = length === void 0 ? reader.len : reader.pos + length;
1289
1615
  const message = createBaseCommitTransactionRequest();
1290
1616
  while (reader.pos < end) {
1291
1617
  const tag = reader.uint32();
@@ -1373,7 +1699,7 @@ var CommitTransactionResponse = {
1373
1699
  },
1374
1700
  decode(input, length) {
1375
1701
  const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
1376
- let end = length === void 0 ? reader.len : reader.pos + length;
1702
+ const end = length === void 0 ? reader.len : reader.pos + length;
1377
1703
  const message = createBaseCommitTransactionResponse();
1378
1704
  while (reader.pos < end) {
1379
1705
  const tag = reader.uint32();
@@ -1401,31 +1727,1006 @@ var CommitTransactionResponse = {
1401
1727
  return message;
1402
1728
  }
1403
1729
  };
1404
- var SparkTokenServiceDefinition = {
1405
- name: "SparkTokenService",
1406
- fullName: "spark_token.SparkTokenService",
1407
- methods: {
1408
- /**
1409
- * Start process to create final token transaction with all inputs required
1410
- * from user and SOs (including revocation secret commitment)
1411
- */
1412
- start_transaction: {
1413
- name: "start_transaction",
1414
- requestType: StartTransactionRequest,
1415
- requestStream: false,
1416
- responseType: StartTransactionResponse,
1417
- responseStream: false,
1418
- options: {}
1419
- },
1420
- /**
1421
- * Complete the transaction and commit it with all SOs. This will be
1422
- * coordinated by one SO.
1423
- */
1424
- commit_transaction: {
1425
- name: "commit_transaction",
1426
- requestType: CommitTransactionRequest,
1427
- requestStream: false,
1428
- responseType: CommitTransactionResponse,
1730
+ function createBaseQueryTokenMetadataRequest() {
1731
+ return { tokenIdentifiers: [], issuerPublicKeys: [] };
1732
+ }
1733
+ var QueryTokenMetadataRequest = {
1734
+ encode(message, writer = new import_wire5.BinaryWriter()) {
1735
+ for (const v of message.tokenIdentifiers) {
1736
+ writer.uint32(10).bytes(v);
1737
+ }
1738
+ for (const v of message.issuerPublicKeys) {
1739
+ writer.uint32(18).bytes(v);
1740
+ }
1741
+ return writer;
1742
+ },
1743
+ decode(input, length) {
1744
+ const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
1745
+ const end = length === void 0 ? reader.len : reader.pos + length;
1746
+ const message = createBaseQueryTokenMetadataRequest();
1747
+ while (reader.pos < end) {
1748
+ const tag = reader.uint32();
1749
+ switch (tag >>> 3) {
1750
+ case 1: {
1751
+ if (tag !== 10) {
1752
+ break;
1753
+ }
1754
+ message.tokenIdentifiers.push(reader.bytes());
1755
+ continue;
1756
+ }
1757
+ case 2: {
1758
+ if (tag !== 18) {
1759
+ break;
1760
+ }
1761
+ message.issuerPublicKeys.push(reader.bytes());
1762
+ continue;
1763
+ }
1764
+ }
1765
+ if ((tag & 7) === 4 || tag === 0) {
1766
+ break;
1767
+ }
1768
+ reader.skip(tag & 7);
1769
+ }
1770
+ return message;
1771
+ },
1772
+ fromJSON(object) {
1773
+ return {
1774
+ tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) => bytesFromBase642(e)) : [],
1775
+ issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys) ? object.issuerPublicKeys.map((e) => bytesFromBase642(e)) : []
1776
+ };
1777
+ },
1778
+ toJSON(message) {
1779
+ const obj = {};
1780
+ if (message.tokenIdentifiers?.length) {
1781
+ obj.tokenIdentifiers = message.tokenIdentifiers.map((e) => base64FromBytes2(e));
1782
+ }
1783
+ if (message.issuerPublicKeys?.length) {
1784
+ obj.issuerPublicKeys = message.issuerPublicKeys.map((e) => base64FromBytes2(e));
1785
+ }
1786
+ return obj;
1787
+ },
1788
+ create(base) {
1789
+ return QueryTokenMetadataRequest.fromPartial(base ?? {});
1790
+ },
1791
+ fromPartial(object) {
1792
+ const message = createBaseQueryTokenMetadataRequest();
1793
+ message.tokenIdentifiers = object.tokenIdentifiers?.map((e) => e) || [];
1794
+ message.issuerPublicKeys = object.issuerPublicKeys?.map((e) => e) || [];
1795
+ return message;
1796
+ }
1797
+ };
1798
+ function createBaseTokenMetadata() {
1799
+ return {
1800
+ issuerPublicKey: new Uint8Array(0),
1801
+ tokenName: "",
1802
+ tokenTicker: "",
1803
+ decimals: 0,
1804
+ maxSupply: new Uint8Array(0),
1805
+ isFreezable: false,
1806
+ creationEntityPublicKey: void 0,
1807
+ tokenIdentifier: new Uint8Array(0)
1808
+ };
1809
+ }
1810
+ var TokenMetadata = {
1811
+ encode(message, writer = new import_wire5.BinaryWriter()) {
1812
+ if (message.issuerPublicKey.length !== 0) {
1813
+ writer.uint32(10).bytes(message.issuerPublicKey);
1814
+ }
1815
+ if (message.tokenName !== "") {
1816
+ writer.uint32(18).string(message.tokenName);
1817
+ }
1818
+ if (message.tokenTicker !== "") {
1819
+ writer.uint32(26).string(message.tokenTicker);
1820
+ }
1821
+ if (message.decimals !== 0) {
1822
+ writer.uint32(32).uint32(message.decimals);
1823
+ }
1824
+ if (message.maxSupply.length !== 0) {
1825
+ writer.uint32(42).bytes(message.maxSupply);
1826
+ }
1827
+ if (message.isFreezable !== false) {
1828
+ writer.uint32(48).bool(message.isFreezable);
1829
+ }
1830
+ if (message.creationEntityPublicKey !== void 0) {
1831
+ writer.uint32(58).bytes(message.creationEntityPublicKey);
1832
+ }
1833
+ if (message.tokenIdentifier.length !== 0) {
1834
+ writer.uint32(66).bytes(message.tokenIdentifier);
1835
+ }
1836
+ return writer;
1837
+ },
1838
+ decode(input, length) {
1839
+ const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
1840
+ const end = length === void 0 ? reader.len : reader.pos + length;
1841
+ const message = createBaseTokenMetadata();
1842
+ while (reader.pos < end) {
1843
+ const tag = reader.uint32();
1844
+ switch (tag >>> 3) {
1845
+ case 1: {
1846
+ if (tag !== 10) {
1847
+ break;
1848
+ }
1849
+ message.issuerPublicKey = reader.bytes();
1850
+ continue;
1851
+ }
1852
+ case 2: {
1853
+ if (tag !== 18) {
1854
+ break;
1855
+ }
1856
+ message.tokenName = reader.string();
1857
+ continue;
1858
+ }
1859
+ case 3: {
1860
+ if (tag !== 26) {
1861
+ break;
1862
+ }
1863
+ message.tokenTicker = reader.string();
1864
+ continue;
1865
+ }
1866
+ case 4: {
1867
+ if (tag !== 32) {
1868
+ break;
1869
+ }
1870
+ message.decimals = reader.uint32();
1871
+ continue;
1872
+ }
1873
+ case 5: {
1874
+ if (tag !== 42) {
1875
+ break;
1876
+ }
1877
+ message.maxSupply = reader.bytes();
1878
+ continue;
1879
+ }
1880
+ case 6: {
1881
+ if (tag !== 48) {
1882
+ break;
1883
+ }
1884
+ message.isFreezable = reader.bool();
1885
+ continue;
1886
+ }
1887
+ case 7: {
1888
+ if (tag !== 58) {
1889
+ break;
1890
+ }
1891
+ message.creationEntityPublicKey = reader.bytes();
1892
+ continue;
1893
+ }
1894
+ case 8: {
1895
+ if (tag !== 66) {
1896
+ break;
1897
+ }
1898
+ message.tokenIdentifier = reader.bytes();
1899
+ continue;
1900
+ }
1901
+ }
1902
+ if ((tag & 7) === 4 || tag === 0) {
1903
+ break;
1904
+ }
1905
+ reader.skip(tag & 7);
1906
+ }
1907
+ return message;
1908
+ },
1909
+ fromJSON(object) {
1910
+ return {
1911
+ issuerPublicKey: isSet3(object.issuerPublicKey) ? bytesFromBase642(object.issuerPublicKey) : new Uint8Array(0),
1912
+ tokenName: isSet3(object.tokenName) ? globalThis.String(object.tokenName) : "",
1913
+ tokenTicker: isSet3(object.tokenTicker) ? globalThis.String(object.tokenTicker) : "",
1914
+ decimals: isSet3(object.decimals) ? globalThis.Number(object.decimals) : 0,
1915
+ maxSupply: isSet3(object.maxSupply) ? bytesFromBase642(object.maxSupply) : new Uint8Array(0),
1916
+ isFreezable: isSet3(object.isFreezable) ? globalThis.Boolean(object.isFreezable) : false,
1917
+ creationEntityPublicKey: isSet3(object.creationEntityPublicKey) ? bytesFromBase642(object.creationEntityPublicKey) : void 0,
1918
+ tokenIdentifier: isSet3(object.tokenIdentifier) ? bytesFromBase642(object.tokenIdentifier) : new Uint8Array(0)
1919
+ };
1920
+ },
1921
+ toJSON(message) {
1922
+ const obj = {};
1923
+ if (message.issuerPublicKey.length !== 0) {
1924
+ obj.issuerPublicKey = base64FromBytes2(message.issuerPublicKey);
1925
+ }
1926
+ if (message.tokenName !== "") {
1927
+ obj.tokenName = message.tokenName;
1928
+ }
1929
+ if (message.tokenTicker !== "") {
1930
+ obj.tokenTicker = message.tokenTicker;
1931
+ }
1932
+ if (message.decimals !== 0) {
1933
+ obj.decimals = Math.round(message.decimals);
1934
+ }
1935
+ if (message.maxSupply.length !== 0) {
1936
+ obj.maxSupply = base64FromBytes2(message.maxSupply);
1937
+ }
1938
+ if (message.isFreezable !== false) {
1939
+ obj.isFreezable = message.isFreezable;
1940
+ }
1941
+ if (message.creationEntityPublicKey !== void 0) {
1942
+ obj.creationEntityPublicKey = base64FromBytes2(message.creationEntityPublicKey);
1943
+ }
1944
+ if (message.tokenIdentifier.length !== 0) {
1945
+ obj.tokenIdentifier = base64FromBytes2(message.tokenIdentifier);
1946
+ }
1947
+ return obj;
1948
+ },
1949
+ create(base) {
1950
+ return TokenMetadata.fromPartial(base ?? {});
1951
+ },
1952
+ fromPartial(object) {
1953
+ const message = createBaseTokenMetadata();
1954
+ message.issuerPublicKey = object.issuerPublicKey ?? new Uint8Array(0);
1955
+ message.tokenName = object.tokenName ?? "";
1956
+ message.tokenTicker = object.tokenTicker ?? "";
1957
+ message.decimals = object.decimals ?? 0;
1958
+ message.maxSupply = object.maxSupply ?? new Uint8Array(0);
1959
+ message.isFreezable = object.isFreezable ?? false;
1960
+ message.creationEntityPublicKey = object.creationEntityPublicKey ?? void 0;
1961
+ message.tokenIdentifier = object.tokenIdentifier ?? new Uint8Array(0);
1962
+ return message;
1963
+ }
1964
+ };
1965
+ function createBaseQueryTokenMetadataResponse() {
1966
+ return { tokenMetadata: [] };
1967
+ }
1968
+ var QueryTokenMetadataResponse = {
1969
+ encode(message, writer = new import_wire5.BinaryWriter()) {
1970
+ for (const v of message.tokenMetadata) {
1971
+ TokenMetadata.encode(v, writer.uint32(10).fork()).join();
1972
+ }
1973
+ return writer;
1974
+ },
1975
+ decode(input, length) {
1976
+ const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
1977
+ const end = length === void 0 ? reader.len : reader.pos + length;
1978
+ const message = createBaseQueryTokenMetadataResponse();
1979
+ while (reader.pos < end) {
1980
+ const tag = reader.uint32();
1981
+ switch (tag >>> 3) {
1982
+ case 1: {
1983
+ if (tag !== 10) {
1984
+ break;
1985
+ }
1986
+ message.tokenMetadata.push(TokenMetadata.decode(reader, reader.uint32()));
1987
+ continue;
1988
+ }
1989
+ }
1990
+ if ((tag & 7) === 4 || tag === 0) {
1991
+ break;
1992
+ }
1993
+ reader.skip(tag & 7);
1994
+ }
1995
+ return message;
1996
+ },
1997
+ fromJSON(object) {
1998
+ return {
1999
+ tokenMetadata: globalThis.Array.isArray(object?.tokenMetadata) ? object.tokenMetadata.map((e) => TokenMetadata.fromJSON(e)) : []
2000
+ };
2001
+ },
2002
+ toJSON(message) {
2003
+ const obj = {};
2004
+ if (message.tokenMetadata?.length) {
2005
+ obj.tokenMetadata = message.tokenMetadata.map((e) => TokenMetadata.toJSON(e));
2006
+ }
2007
+ return obj;
2008
+ },
2009
+ create(base) {
2010
+ return QueryTokenMetadataResponse.fromPartial(base ?? {});
2011
+ },
2012
+ fromPartial(object) {
2013
+ const message = createBaseQueryTokenMetadataResponse();
2014
+ message.tokenMetadata = object.tokenMetadata?.map((e) => TokenMetadata.fromPartial(e)) || [];
2015
+ return message;
2016
+ }
2017
+ };
2018
+ function createBaseQueryTokenOutputsRequest() {
2019
+ return { ownerPublicKeys: [], issuerPublicKeys: [], tokenIdentifiers: [], network: 0 };
2020
+ }
2021
+ var QueryTokenOutputsRequest = {
2022
+ encode(message, writer = new import_wire5.BinaryWriter()) {
2023
+ for (const v of message.ownerPublicKeys) {
2024
+ writer.uint32(10).bytes(v);
2025
+ }
2026
+ for (const v of message.issuerPublicKeys) {
2027
+ writer.uint32(18).bytes(v);
2028
+ }
2029
+ for (const v of message.tokenIdentifiers) {
2030
+ writer.uint32(34).bytes(v);
2031
+ }
2032
+ if (message.network !== 0) {
2033
+ writer.uint32(24).int32(message.network);
2034
+ }
2035
+ return writer;
2036
+ },
2037
+ decode(input, length) {
2038
+ const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
2039
+ const end = length === void 0 ? reader.len : reader.pos + length;
2040
+ const message = createBaseQueryTokenOutputsRequest();
2041
+ while (reader.pos < end) {
2042
+ const tag = reader.uint32();
2043
+ switch (tag >>> 3) {
2044
+ case 1: {
2045
+ if (tag !== 10) {
2046
+ break;
2047
+ }
2048
+ message.ownerPublicKeys.push(reader.bytes());
2049
+ continue;
2050
+ }
2051
+ case 2: {
2052
+ if (tag !== 18) {
2053
+ break;
2054
+ }
2055
+ message.issuerPublicKeys.push(reader.bytes());
2056
+ continue;
2057
+ }
2058
+ case 4: {
2059
+ if (tag !== 34) {
2060
+ break;
2061
+ }
2062
+ message.tokenIdentifiers.push(reader.bytes());
2063
+ continue;
2064
+ }
2065
+ case 3: {
2066
+ if (tag !== 24) {
2067
+ break;
2068
+ }
2069
+ message.network = reader.int32();
2070
+ continue;
2071
+ }
2072
+ }
2073
+ if ((tag & 7) === 4 || tag === 0) {
2074
+ break;
2075
+ }
2076
+ reader.skip(tag & 7);
2077
+ }
2078
+ return message;
2079
+ },
2080
+ fromJSON(object) {
2081
+ return {
2082
+ ownerPublicKeys: globalThis.Array.isArray(object?.ownerPublicKeys) ? object.ownerPublicKeys.map((e) => bytesFromBase642(e)) : [],
2083
+ issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys) ? object.issuerPublicKeys.map((e) => bytesFromBase642(e)) : [],
2084
+ tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) => bytesFromBase642(e)) : [],
2085
+ network: isSet3(object.network) ? networkFromJSON(object.network) : 0
2086
+ };
2087
+ },
2088
+ toJSON(message) {
2089
+ const obj = {};
2090
+ if (message.ownerPublicKeys?.length) {
2091
+ obj.ownerPublicKeys = message.ownerPublicKeys.map((e) => base64FromBytes2(e));
2092
+ }
2093
+ if (message.issuerPublicKeys?.length) {
2094
+ obj.issuerPublicKeys = message.issuerPublicKeys.map((e) => base64FromBytes2(e));
2095
+ }
2096
+ if (message.tokenIdentifiers?.length) {
2097
+ obj.tokenIdentifiers = message.tokenIdentifiers.map((e) => base64FromBytes2(e));
2098
+ }
2099
+ if (message.network !== 0) {
2100
+ obj.network = networkToJSON(message.network);
2101
+ }
2102
+ return obj;
2103
+ },
2104
+ create(base) {
2105
+ return QueryTokenOutputsRequest.fromPartial(base ?? {});
2106
+ },
2107
+ fromPartial(object) {
2108
+ const message = createBaseQueryTokenOutputsRequest();
2109
+ message.ownerPublicKeys = object.ownerPublicKeys?.map((e) => e) || [];
2110
+ message.issuerPublicKeys = object.issuerPublicKeys?.map((e) => e) || [];
2111
+ message.tokenIdentifiers = object.tokenIdentifiers?.map((e) => e) || [];
2112
+ message.network = object.network ?? 0;
2113
+ return message;
2114
+ }
2115
+ };
2116
+ function createBaseQueryTokenTransactionsRequest() {
2117
+ return {
2118
+ outputIds: [],
2119
+ ownerPublicKeys: [],
2120
+ issuerPublicKeys: [],
2121
+ tokenIdentifiers: [],
2122
+ tokenTransactionHashes: [],
2123
+ limit: 0,
2124
+ offset: 0
2125
+ };
2126
+ }
2127
+ var QueryTokenTransactionsRequest = {
2128
+ encode(message, writer = new import_wire5.BinaryWriter()) {
2129
+ for (const v of message.outputIds) {
2130
+ writer.uint32(10).string(v);
2131
+ }
2132
+ for (const v of message.ownerPublicKeys) {
2133
+ writer.uint32(18).bytes(v);
2134
+ }
2135
+ for (const v of message.issuerPublicKeys) {
2136
+ writer.uint32(26).bytes(v);
2137
+ }
2138
+ for (const v of message.tokenIdentifiers) {
2139
+ writer.uint32(58).bytes(v);
2140
+ }
2141
+ for (const v of message.tokenTransactionHashes) {
2142
+ writer.uint32(34).bytes(v);
2143
+ }
2144
+ if (message.limit !== 0) {
2145
+ writer.uint32(40).int64(message.limit);
2146
+ }
2147
+ if (message.offset !== 0) {
2148
+ writer.uint32(48).int64(message.offset);
2149
+ }
2150
+ return writer;
2151
+ },
2152
+ decode(input, length) {
2153
+ const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
2154
+ const end = length === void 0 ? reader.len : reader.pos + length;
2155
+ const message = createBaseQueryTokenTransactionsRequest();
2156
+ while (reader.pos < end) {
2157
+ const tag = reader.uint32();
2158
+ switch (tag >>> 3) {
2159
+ case 1: {
2160
+ if (tag !== 10) {
2161
+ break;
2162
+ }
2163
+ message.outputIds.push(reader.string());
2164
+ continue;
2165
+ }
2166
+ case 2: {
2167
+ if (tag !== 18) {
2168
+ break;
2169
+ }
2170
+ message.ownerPublicKeys.push(reader.bytes());
2171
+ continue;
2172
+ }
2173
+ case 3: {
2174
+ if (tag !== 26) {
2175
+ break;
2176
+ }
2177
+ message.issuerPublicKeys.push(reader.bytes());
2178
+ continue;
2179
+ }
2180
+ case 7: {
2181
+ if (tag !== 58) {
2182
+ break;
2183
+ }
2184
+ message.tokenIdentifiers.push(reader.bytes());
2185
+ continue;
2186
+ }
2187
+ case 4: {
2188
+ if (tag !== 34) {
2189
+ break;
2190
+ }
2191
+ message.tokenTransactionHashes.push(reader.bytes());
2192
+ continue;
2193
+ }
2194
+ case 5: {
2195
+ if (tag !== 40) {
2196
+ break;
2197
+ }
2198
+ message.limit = longToNumber2(reader.int64());
2199
+ continue;
2200
+ }
2201
+ case 6: {
2202
+ if (tag !== 48) {
2203
+ break;
2204
+ }
2205
+ message.offset = longToNumber2(reader.int64());
2206
+ continue;
2207
+ }
2208
+ }
2209
+ if ((tag & 7) === 4 || tag === 0) {
2210
+ break;
2211
+ }
2212
+ reader.skip(tag & 7);
2213
+ }
2214
+ return message;
2215
+ },
2216
+ fromJSON(object) {
2217
+ return {
2218
+ outputIds: globalThis.Array.isArray(object?.outputIds) ? object.outputIds.map((e) => globalThis.String(e)) : [],
2219
+ ownerPublicKeys: globalThis.Array.isArray(object?.ownerPublicKeys) ? object.ownerPublicKeys.map((e) => bytesFromBase642(e)) : [],
2220
+ issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys) ? object.issuerPublicKeys.map((e) => bytesFromBase642(e)) : [],
2221
+ tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) => bytesFromBase642(e)) : [],
2222
+ tokenTransactionHashes: globalThis.Array.isArray(object?.tokenTransactionHashes) ? object.tokenTransactionHashes.map((e) => bytesFromBase642(e)) : [],
2223
+ limit: isSet3(object.limit) ? globalThis.Number(object.limit) : 0,
2224
+ offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0
2225
+ };
2226
+ },
2227
+ toJSON(message) {
2228
+ const obj = {};
2229
+ if (message.outputIds?.length) {
2230
+ obj.outputIds = message.outputIds;
2231
+ }
2232
+ if (message.ownerPublicKeys?.length) {
2233
+ obj.ownerPublicKeys = message.ownerPublicKeys.map((e) => base64FromBytes2(e));
2234
+ }
2235
+ if (message.issuerPublicKeys?.length) {
2236
+ obj.issuerPublicKeys = message.issuerPublicKeys.map((e) => base64FromBytes2(e));
2237
+ }
2238
+ if (message.tokenIdentifiers?.length) {
2239
+ obj.tokenIdentifiers = message.tokenIdentifiers.map((e) => base64FromBytes2(e));
2240
+ }
2241
+ if (message.tokenTransactionHashes?.length) {
2242
+ obj.tokenTransactionHashes = message.tokenTransactionHashes.map((e) => base64FromBytes2(e));
2243
+ }
2244
+ if (message.limit !== 0) {
2245
+ obj.limit = Math.round(message.limit);
2246
+ }
2247
+ if (message.offset !== 0) {
2248
+ obj.offset = Math.round(message.offset);
2249
+ }
2250
+ return obj;
2251
+ },
2252
+ create(base) {
2253
+ return QueryTokenTransactionsRequest.fromPartial(base ?? {});
2254
+ },
2255
+ fromPartial(object) {
2256
+ const message = createBaseQueryTokenTransactionsRequest();
2257
+ message.outputIds = object.outputIds?.map((e) => e) || [];
2258
+ message.ownerPublicKeys = object.ownerPublicKeys?.map((e) => e) || [];
2259
+ message.issuerPublicKeys = object.issuerPublicKeys?.map((e) => e) || [];
2260
+ message.tokenIdentifiers = object.tokenIdentifiers?.map((e) => e) || [];
2261
+ message.tokenTransactionHashes = object.tokenTransactionHashes?.map((e) => e) || [];
2262
+ message.limit = object.limit ?? 0;
2263
+ message.offset = object.offset ?? 0;
2264
+ return message;
2265
+ }
2266
+ };
2267
+ function createBaseQueryTokenTransactionsResponse() {
2268
+ return { tokenTransactionsWithStatus: [], offset: 0 };
2269
+ }
2270
+ var QueryTokenTransactionsResponse = {
2271
+ encode(message, writer = new import_wire5.BinaryWriter()) {
2272
+ for (const v of message.tokenTransactionsWithStatus) {
2273
+ TokenTransactionWithStatus.encode(v, writer.uint32(10).fork()).join();
2274
+ }
2275
+ if (message.offset !== 0) {
2276
+ writer.uint32(16).int64(message.offset);
2277
+ }
2278
+ return writer;
2279
+ },
2280
+ decode(input, length) {
2281
+ const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
2282
+ const end = length === void 0 ? reader.len : reader.pos + length;
2283
+ const message = createBaseQueryTokenTransactionsResponse();
2284
+ while (reader.pos < end) {
2285
+ const tag = reader.uint32();
2286
+ switch (tag >>> 3) {
2287
+ case 1: {
2288
+ if (tag !== 10) {
2289
+ break;
2290
+ }
2291
+ message.tokenTransactionsWithStatus.push(TokenTransactionWithStatus.decode(reader, reader.uint32()));
2292
+ continue;
2293
+ }
2294
+ case 2: {
2295
+ if (tag !== 16) {
2296
+ break;
2297
+ }
2298
+ message.offset = longToNumber2(reader.int64());
2299
+ continue;
2300
+ }
2301
+ }
2302
+ if ((tag & 7) === 4 || tag === 0) {
2303
+ break;
2304
+ }
2305
+ reader.skip(tag & 7);
2306
+ }
2307
+ return message;
2308
+ },
2309
+ fromJSON(object) {
2310
+ return {
2311
+ tokenTransactionsWithStatus: globalThis.Array.isArray(object?.tokenTransactionsWithStatus) ? object.tokenTransactionsWithStatus.map((e) => TokenTransactionWithStatus.fromJSON(e)) : [],
2312
+ offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0
2313
+ };
2314
+ },
2315
+ toJSON(message) {
2316
+ const obj = {};
2317
+ if (message.tokenTransactionsWithStatus?.length) {
2318
+ obj.tokenTransactionsWithStatus = message.tokenTransactionsWithStatus.map(
2319
+ (e) => TokenTransactionWithStatus.toJSON(e)
2320
+ );
2321
+ }
2322
+ if (message.offset !== 0) {
2323
+ obj.offset = Math.round(message.offset);
2324
+ }
2325
+ return obj;
2326
+ },
2327
+ create(base) {
2328
+ return QueryTokenTransactionsResponse.fromPartial(base ?? {});
2329
+ },
2330
+ fromPartial(object) {
2331
+ const message = createBaseQueryTokenTransactionsResponse();
2332
+ message.tokenTransactionsWithStatus = object.tokenTransactionsWithStatus?.map((e) => TokenTransactionWithStatus.fromPartial(e)) || [];
2333
+ message.offset = object.offset ?? 0;
2334
+ return message;
2335
+ }
2336
+ };
2337
+ function createBaseOutputWithPreviousTransactionData() {
2338
+ return { output: void 0, previousTransactionHash: new Uint8Array(0), previousTransactionVout: 0 };
2339
+ }
2340
+ var OutputWithPreviousTransactionData = {
2341
+ encode(message, writer = new import_wire5.BinaryWriter()) {
2342
+ if (message.output !== void 0) {
2343
+ TokenOutput.encode(message.output, writer.uint32(10).fork()).join();
2344
+ }
2345
+ if (message.previousTransactionHash.length !== 0) {
2346
+ writer.uint32(18).bytes(message.previousTransactionHash);
2347
+ }
2348
+ if (message.previousTransactionVout !== 0) {
2349
+ writer.uint32(24).uint32(message.previousTransactionVout);
2350
+ }
2351
+ return writer;
2352
+ },
2353
+ decode(input, length) {
2354
+ const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
2355
+ const end = length === void 0 ? reader.len : reader.pos + length;
2356
+ const message = createBaseOutputWithPreviousTransactionData();
2357
+ while (reader.pos < end) {
2358
+ const tag = reader.uint32();
2359
+ switch (tag >>> 3) {
2360
+ case 1: {
2361
+ if (tag !== 10) {
2362
+ break;
2363
+ }
2364
+ message.output = TokenOutput.decode(reader, reader.uint32());
2365
+ continue;
2366
+ }
2367
+ case 2: {
2368
+ if (tag !== 18) {
2369
+ break;
2370
+ }
2371
+ message.previousTransactionHash = reader.bytes();
2372
+ continue;
2373
+ }
2374
+ case 3: {
2375
+ if (tag !== 24) {
2376
+ break;
2377
+ }
2378
+ message.previousTransactionVout = reader.uint32();
2379
+ continue;
2380
+ }
2381
+ }
2382
+ if ((tag & 7) === 4 || tag === 0) {
2383
+ break;
2384
+ }
2385
+ reader.skip(tag & 7);
2386
+ }
2387
+ return message;
2388
+ },
2389
+ fromJSON(object) {
2390
+ return {
2391
+ output: isSet3(object.output) ? TokenOutput.fromJSON(object.output) : void 0,
2392
+ previousTransactionHash: isSet3(object.previousTransactionHash) ? bytesFromBase642(object.previousTransactionHash) : new Uint8Array(0),
2393
+ previousTransactionVout: isSet3(object.previousTransactionVout) ? globalThis.Number(object.previousTransactionVout) : 0
2394
+ };
2395
+ },
2396
+ toJSON(message) {
2397
+ const obj = {};
2398
+ if (message.output !== void 0) {
2399
+ obj.output = TokenOutput.toJSON(message.output);
2400
+ }
2401
+ if (message.previousTransactionHash.length !== 0) {
2402
+ obj.previousTransactionHash = base64FromBytes2(message.previousTransactionHash);
2403
+ }
2404
+ if (message.previousTransactionVout !== 0) {
2405
+ obj.previousTransactionVout = Math.round(message.previousTransactionVout);
2406
+ }
2407
+ return obj;
2408
+ },
2409
+ create(base) {
2410
+ return OutputWithPreviousTransactionData.fromPartial(base ?? {});
2411
+ },
2412
+ fromPartial(object) {
2413
+ const message = createBaseOutputWithPreviousTransactionData();
2414
+ message.output = object.output !== void 0 && object.output !== null ? TokenOutput.fromPartial(object.output) : void 0;
2415
+ message.previousTransactionHash = object.previousTransactionHash ?? new Uint8Array(0);
2416
+ message.previousTransactionVout = object.previousTransactionVout ?? 0;
2417
+ return message;
2418
+ }
2419
+ };
2420
+ function createBaseQueryTokenOutputsResponse() {
2421
+ return { outputsWithPreviousTransactionData: [] };
2422
+ }
2423
+ var QueryTokenOutputsResponse = {
2424
+ encode(message, writer = new import_wire5.BinaryWriter()) {
2425
+ for (const v of message.outputsWithPreviousTransactionData) {
2426
+ OutputWithPreviousTransactionData.encode(v, writer.uint32(10).fork()).join();
2427
+ }
2428
+ return writer;
2429
+ },
2430
+ decode(input, length) {
2431
+ const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
2432
+ const end = length === void 0 ? reader.len : reader.pos + length;
2433
+ const message = createBaseQueryTokenOutputsResponse();
2434
+ while (reader.pos < end) {
2435
+ const tag = reader.uint32();
2436
+ switch (tag >>> 3) {
2437
+ case 1: {
2438
+ if (tag !== 10) {
2439
+ break;
2440
+ }
2441
+ message.outputsWithPreviousTransactionData.push(
2442
+ OutputWithPreviousTransactionData.decode(reader, reader.uint32())
2443
+ );
2444
+ continue;
2445
+ }
2446
+ }
2447
+ if ((tag & 7) === 4 || tag === 0) {
2448
+ break;
2449
+ }
2450
+ reader.skip(tag & 7);
2451
+ }
2452
+ return message;
2453
+ },
2454
+ fromJSON(object) {
2455
+ return {
2456
+ outputsWithPreviousTransactionData: globalThis.Array.isArray(object?.outputsWithPreviousTransactionData) ? object.outputsWithPreviousTransactionData.map((e) => OutputWithPreviousTransactionData.fromJSON(e)) : []
2457
+ };
2458
+ },
2459
+ toJSON(message) {
2460
+ const obj = {};
2461
+ if (message.outputsWithPreviousTransactionData?.length) {
2462
+ obj.outputsWithPreviousTransactionData = message.outputsWithPreviousTransactionData.map(
2463
+ (e) => OutputWithPreviousTransactionData.toJSON(e)
2464
+ );
2465
+ }
2466
+ return obj;
2467
+ },
2468
+ create(base) {
2469
+ return QueryTokenOutputsResponse.fromPartial(base ?? {});
2470
+ },
2471
+ fromPartial(object) {
2472
+ const message = createBaseQueryTokenOutputsResponse();
2473
+ message.outputsWithPreviousTransactionData = object.outputsWithPreviousTransactionData?.map((e) => OutputWithPreviousTransactionData.fromPartial(e)) || [];
2474
+ return message;
2475
+ }
2476
+ };
2477
+ function createBaseSpentTokenOutputMetadata() {
2478
+ return { outputId: "", revocationSecret: new Uint8Array(0) };
2479
+ }
2480
+ var SpentTokenOutputMetadata = {
2481
+ encode(message, writer = new import_wire5.BinaryWriter()) {
2482
+ if (message.outputId !== "") {
2483
+ writer.uint32(10).string(message.outputId);
2484
+ }
2485
+ if (message.revocationSecret.length !== 0) {
2486
+ writer.uint32(18).bytes(message.revocationSecret);
2487
+ }
2488
+ return writer;
2489
+ },
2490
+ decode(input, length) {
2491
+ const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
2492
+ const end = length === void 0 ? reader.len : reader.pos + length;
2493
+ const message = createBaseSpentTokenOutputMetadata();
2494
+ while (reader.pos < end) {
2495
+ const tag = reader.uint32();
2496
+ switch (tag >>> 3) {
2497
+ case 1: {
2498
+ if (tag !== 10) {
2499
+ break;
2500
+ }
2501
+ message.outputId = reader.string();
2502
+ continue;
2503
+ }
2504
+ case 2: {
2505
+ if (tag !== 18) {
2506
+ break;
2507
+ }
2508
+ message.revocationSecret = reader.bytes();
2509
+ continue;
2510
+ }
2511
+ }
2512
+ if ((tag & 7) === 4 || tag === 0) {
2513
+ break;
2514
+ }
2515
+ reader.skip(tag & 7);
2516
+ }
2517
+ return message;
2518
+ },
2519
+ fromJSON(object) {
2520
+ return {
2521
+ outputId: isSet3(object.outputId) ? globalThis.String(object.outputId) : "",
2522
+ revocationSecret: isSet3(object.revocationSecret) ? bytesFromBase642(object.revocationSecret) : new Uint8Array(0)
2523
+ };
2524
+ },
2525
+ toJSON(message) {
2526
+ const obj = {};
2527
+ if (message.outputId !== "") {
2528
+ obj.outputId = message.outputId;
2529
+ }
2530
+ if (message.revocationSecret.length !== 0) {
2531
+ obj.revocationSecret = base64FromBytes2(message.revocationSecret);
2532
+ }
2533
+ return obj;
2534
+ },
2535
+ create(base) {
2536
+ return SpentTokenOutputMetadata.fromPartial(base ?? {});
2537
+ },
2538
+ fromPartial(object) {
2539
+ const message = createBaseSpentTokenOutputMetadata();
2540
+ message.outputId = object.outputId ?? "";
2541
+ message.revocationSecret = object.revocationSecret ?? new Uint8Array(0);
2542
+ return message;
2543
+ }
2544
+ };
2545
+ function createBaseTokenTransactionConfirmationMetadata() {
2546
+ return { spentTokenOutputsMetadata: [] };
2547
+ }
2548
+ var TokenTransactionConfirmationMetadata = {
2549
+ encode(message, writer = new import_wire5.BinaryWriter()) {
2550
+ for (const v of message.spentTokenOutputsMetadata) {
2551
+ SpentTokenOutputMetadata.encode(v, writer.uint32(10).fork()).join();
2552
+ }
2553
+ return writer;
2554
+ },
2555
+ decode(input, length) {
2556
+ const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
2557
+ const end = length === void 0 ? reader.len : reader.pos + length;
2558
+ const message = createBaseTokenTransactionConfirmationMetadata();
2559
+ while (reader.pos < end) {
2560
+ const tag = reader.uint32();
2561
+ switch (tag >>> 3) {
2562
+ case 1: {
2563
+ if (tag !== 10) {
2564
+ break;
2565
+ }
2566
+ message.spentTokenOutputsMetadata.push(SpentTokenOutputMetadata.decode(reader, reader.uint32()));
2567
+ continue;
2568
+ }
2569
+ }
2570
+ if ((tag & 7) === 4 || tag === 0) {
2571
+ break;
2572
+ }
2573
+ reader.skip(tag & 7);
2574
+ }
2575
+ return message;
2576
+ },
2577
+ fromJSON(object) {
2578
+ return {
2579
+ spentTokenOutputsMetadata: globalThis.Array.isArray(object?.spentTokenOutputsMetadata) ? object.spentTokenOutputsMetadata.map((e) => SpentTokenOutputMetadata.fromJSON(e)) : []
2580
+ };
2581
+ },
2582
+ toJSON(message) {
2583
+ const obj = {};
2584
+ if (message.spentTokenOutputsMetadata?.length) {
2585
+ obj.spentTokenOutputsMetadata = message.spentTokenOutputsMetadata.map((e) => SpentTokenOutputMetadata.toJSON(e));
2586
+ }
2587
+ return obj;
2588
+ },
2589
+ create(base) {
2590
+ return TokenTransactionConfirmationMetadata.fromPartial(base ?? {});
2591
+ },
2592
+ fromPartial(object) {
2593
+ const message = createBaseTokenTransactionConfirmationMetadata();
2594
+ message.spentTokenOutputsMetadata = object.spentTokenOutputsMetadata?.map((e) => SpentTokenOutputMetadata.fromPartial(e)) || [];
2595
+ return message;
2596
+ }
2597
+ };
2598
+ function createBaseTokenTransactionWithStatus() {
2599
+ return { tokenTransaction: void 0, status: 0, confirmationMetadata: void 0 };
2600
+ }
2601
+ var TokenTransactionWithStatus = {
2602
+ encode(message, writer = new import_wire5.BinaryWriter()) {
2603
+ if (message.tokenTransaction !== void 0) {
2604
+ TokenTransaction.encode(message.tokenTransaction, writer.uint32(10).fork()).join();
2605
+ }
2606
+ if (message.status !== 0) {
2607
+ writer.uint32(16).int32(message.status);
2608
+ }
2609
+ if (message.confirmationMetadata !== void 0) {
2610
+ TokenTransactionConfirmationMetadata.encode(message.confirmationMetadata, writer.uint32(26).fork()).join();
2611
+ }
2612
+ return writer;
2613
+ },
2614
+ decode(input, length) {
2615
+ const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
2616
+ const end = length === void 0 ? reader.len : reader.pos + length;
2617
+ const message = createBaseTokenTransactionWithStatus();
2618
+ while (reader.pos < end) {
2619
+ const tag = reader.uint32();
2620
+ switch (tag >>> 3) {
2621
+ case 1: {
2622
+ if (tag !== 10) {
2623
+ break;
2624
+ }
2625
+ message.tokenTransaction = TokenTransaction.decode(reader, reader.uint32());
2626
+ continue;
2627
+ }
2628
+ case 2: {
2629
+ if (tag !== 16) {
2630
+ break;
2631
+ }
2632
+ message.status = reader.int32();
2633
+ continue;
2634
+ }
2635
+ case 3: {
2636
+ if (tag !== 26) {
2637
+ break;
2638
+ }
2639
+ message.confirmationMetadata = TokenTransactionConfirmationMetadata.decode(reader, reader.uint32());
2640
+ continue;
2641
+ }
2642
+ }
2643
+ if ((tag & 7) === 4 || tag === 0) {
2644
+ break;
2645
+ }
2646
+ reader.skip(tag & 7);
2647
+ }
2648
+ return message;
2649
+ },
2650
+ fromJSON(object) {
2651
+ return {
2652
+ tokenTransaction: isSet3(object.tokenTransaction) ? TokenTransaction.fromJSON(object.tokenTransaction) : void 0,
2653
+ status: isSet3(object.status) ? tokenTransactionStatusFromJSON(object.status) : 0,
2654
+ confirmationMetadata: isSet3(object.confirmationMetadata) ? TokenTransactionConfirmationMetadata.fromJSON(object.confirmationMetadata) : void 0
2655
+ };
2656
+ },
2657
+ toJSON(message) {
2658
+ const obj = {};
2659
+ if (message.tokenTransaction !== void 0) {
2660
+ obj.tokenTransaction = TokenTransaction.toJSON(message.tokenTransaction);
2661
+ }
2662
+ if (message.status !== 0) {
2663
+ obj.status = tokenTransactionStatusToJSON(message.status);
2664
+ }
2665
+ if (message.confirmationMetadata !== void 0) {
2666
+ obj.confirmationMetadata = TokenTransactionConfirmationMetadata.toJSON(message.confirmationMetadata);
2667
+ }
2668
+ return obj;
2669
+ },
2670
+ create(base) {
2671
+ return TokenTransactionWithStatus.fromPartial(base ?? {});
2672
+ },
2673
+ fromPartial(object) {
2674
+ const message = createBaseTokenTransactionWithStatus();
2675
+ message.tokenTransaction = object.tokenTransaction !== void 0 && object.tokenTransaction !== null ? TokenTransaction.fromPartial(object.tokenTransaction) : void 0;
2676
+ message.status = object.status ?? 0;
2677
+ message.confirmationMetadata = object.confirmationMetadata !== void 0 && object.confirmationMetadata !== null ? TokenTransactionConfirmationMetadata.fromPartial(object.confirmationMetadata) : void 0;
2678
+ return message;
2679
+ }
2680
+ };
2681
+ var SparkTokenServiceDefinition = {
2682
+ name: "SparkTokenService",
2683
+ fullName: "spark_token.SparkTokenService",
2684
+ methods: {
2685
+ /**
2686
+ * Start process to create final token transaction with all inputs required
2687
+ * from user and SOs (including revocation secret commitment)
2688
+ */
2689
+ start_transaction: {
2690
+ name: "start_transaction",
2691
+ requestType: StartTransactionRequest,
2692
+ requestStream: false,
2693
+ responseType: StartTransactionResponse,
2694
+ responseStream: false,
2695
+ options: {}
2696
+ },
2697
+ /**
2698
+ * Complete the transaction and commit it with all SOs. This will be
2699
+ * coordinated by one SO.
2700
+ */
2701
+ commit_transaction: {
2702
+ name: "commit_transaction",
2703
+ requestType: CommitTransactionRequest,
2704
+ requestStream: false,
2705
+ responseType: CommitTransactionResponse,
2706
+ responseStream: false,
2707
+ options: {}
2708
+ },
2709
+ query_token_metadata: {
2710
+ name: "query_token_metadata",
2711
+ requestType: QueryTokenMetadataRequest,
2712
+ requestStream: false,
2713
+ responseType: QueryTokenMetadataResponse,
2714
+ responseStream: false,
2715
+ options: {}
2716
+ },
2717
+ query_token_transactions: {
2718
+ name: "query_token_transactions",
2719
+ requestType: QueryTokenTransactionsRequest,
2720
+ requestStream: false,
2721
+ responseType: QueryTokenTransactionsResponse,
2722
+ responseStream: false,
2723
+ options: {}
2724
+ },
2725
+ query_token_outputs: {
2726
+ name: "query_token_outputs",
2727
+ requestType: QueryTokenOutputsRequest,
2728
+ requestStream: false,
2729
+ responseType: QueryTokenOutputsResponse,
1429
2730
  responseStream: false,
1430
2731
  options: {}
1431
2732
  }
@@ -1491,14 +2792,32 @@ function isSet3(value) {
1491
2792
  CommitTransactionRequest,
1492
2793
  CommitTransactionResponse,
1493
2794
  InputTtxoSignaturesPerOperator,
2795
+ OutputWithPreviousTransactionData,
2796
+ QueryTokenMetadataRequest,
2797
+ QueryTokenMetadataResponse,
2798
+ QueryTokenOutputsRequest,
2799
+ QueryTokenOutputsResponse,
2800
+ QueryTokenTransactionsRequest,
2801
+ QueryTokenTransactionsResponse,
1494
2802
  SignatureWithIndex,
1495
2803
  SparkTokenServiceDefinition,
2804
+ SpentTokenOutputMetadata,
1496
2805
  StartTransactionRequest,
1497
2806
  StartTransactionResponse,
2807
+ TokenCreateInput,
2808
+ TokenMetadata,
1498
2809
  TokenMintInput,
1499
2810
  TokenOutput,
1500
2811
  TokenOutputToSpend,
1501
2812
  TokenTransaction,
2813
+ TokenTransactionConfirmationMetadata,
2814
+ TokenTransactionStatus,
2815
+ TokenTransactionType,
2816
+ TokenTransactionWithStatus,
1502
2817
  TokenTransferInput,
1503
- protobufPackage
2818
+ protobufPackage,
2819
+ tokenTransactionStatusFromJSON,
2820
+ tokenTransactionStatusToJSON,
2821
+ tokenTransactionTypeFromJSON,
2822
+ tokenTransactionTypeToJSON
1504
2823
  });