@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
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.7.2
3
+ // protoc-gen-ts_proto v2.7.5
4
4
  // protoc v5.29.3
5
5
  // source: spark_token.proto
6
6
 
@@ -12,6 +12,114 @@ import { Network, networkFromJSON, networkToJSON, SigningKeyshare } from "./spar
12
12
 
13
13
  export const protobufPackage = "spark_token";
14
14
 
15
+ export enum TokenTransactionType {
16
+ TOKEN_TRANSACTION_TYPE_UNSPECIFIED = 0,
17
+ TOKEN_TRANSACTION_TYPE_CREATE = 1,
18
+ TOKEN_TRANSACTION_TYPE_MINT = 2,
19
+ TOKEN_TRANSACTION_TYPE_TRANSFER = 3,
20
+ UNRECOGNIZED = -1,
21
+ }
22
+
23
+ export function tokenTransactionTypeFromJSON(object: any): TokenTransactionType {
24
+ switch (object) {
25
+ case 0:
26
+ case "TOKEN_TRANSACTION_TYPE_UNSPECIFIED":
27
+ return TokenTransactionType.TOKEN_TRANSACTION_TYPE_UNSPECIFIED;
28
+ case 1:
29
+ case "TOKEN_TRANSACTION_TYPE_CREATE":
30
+ return TokenTransactionType.TOKEN_TRANSACTION_TYPE_CREATE;
31
+ case 2:
32
+ case "TOKEN_TRANSACTION_TYPE_MINT":
33
+ return TokenTransactionType.TOKEN_TRANSACTION_TYPE_MINT;
34
+ case 3:
35
+ case "TOKEN_TRANSACTION_TYPE_TRANSFER":
36
+ return TokenTransactionType.TOKEN_TRANSACTION_TYPE_TRANSFER;
37
+ case -1:
38
+ case "UNRECOGNIZED":
39
+ default:
40
+ return TokenTransactionType.UNRECOGNIZED;
41
+ }
42
+ }
43
+
44
+ export function tokenTransactionTypeToJSON(object: TokenTransactionType): string {
45
+ switch (object) {
46
+ case TokenTransactionType.TOKEN_TRANSACTION_TYPE_UNSPECIFIED:
47
+ return "TOKEN_TRANSACTION_TYPE_UNSPECIFIED";
48
+ case TokenTransactionType.TOKEN_TRANSACTION_TYPE_CREATE:
49
+ return "TOKEN_TRANSACTION_TYPE_CREATE";
50
+ case TokenTransactionType.TOKEN_TRANSACTION_TYPE_MINT:
51
+ return "TOKEN_TRANSACTION_TYPE_MINT";
52
+ case TokenTransactionType.TOKEN_TRANSACTION_TYPE_TRANSFER:
53
+ return "TOKEN_TRANSACTION_TYPE_TRANSFER";
54
+ case TokenTransactionType.UNRECOGNIZED:
55
+ default:
56
+ return "UNRECOGNIZED";
57
+ }
58
+ }
59
+
60
+ export enum TokenTransactionStatus {
61
+ TOKEN_TRANSACTION_STARTED = 0,
62
+ TOKEN_TRANSACTION_SIGNED = 1,
63
+ TOKEN_TRANSACTION_REVEALED = 5,
64
+ TOKEN_TRANSACTION_FINALIZED = 2,
65
+ TOKEN_TRANSACTION_STARTED_CANCELLED = 3,
66
+ TOKEN_TRANSACTION_SIGNED_CANCELLED = 4,
67
+ TOKEN_TRANSACTION_UNKNOWN = 10,
68
+ UNRECOGNIZED = -1,
69
+ }
70
+
71
+ export function tokenTransactionStatusFromJSON(object: any): TokenTransactionStatus {
72
+ switch (object) {
73
+ case 0:
74
+ case "TOKEN_TRANSACTION_STARTED":
75
+ return TokenTransactionStatus.TOKEN_TRANSACTION_STARTED;
76
+ case 1:
77
+ case "TOKEN_TRANSACTION_SIGNED":
78
+ return TokenTransactionStatus.TOKEN_TRANSACTION_SIGNED;
79
+ case 5:
80
+ case "TOKEN_TRANSACTION_REVEALED":
81
+ return TokenTransactionStatus.TOKEN_TRANSACTION_REVEALED;
82
+ case 2:
83
+ case "TOKEN_TRANSACTION_FINALIZED":
84
+ return TokenTransactionStatus.TOKEN_TRANSACTION_FINALIZED;
85
+ case 3:
86
+ case "TOKEN_TRANSACTION_STARTED_CANCELLED":
87
+ return TokenTransactionStatus.TOKEN_TRANSACTION_STARTED_CANCELLED;
88
+ case 4:
89
+ case "TOKEN_TRANSACTION_SIGNED_CANCELLED":
90
+ return TokenTransactionStatus.TOKEN_TRANSACTION_SIGNED_CANCELLED;
91
+ case 10:
92
+ case "TOKEN_TRANSACTION_UNKNOWN":
93
+ return TokenTransactionStatus.TOKEN_TRANSACTION_UNKNOWN;
94
+ case -1:
95
+ case "UNRECOGNIZED":
96
+ default:
97
+ return TokenTransactionStatus.UNRECOGNIZED;
98
+ }
99
+ }
100
+
101
+ export function tokenTransactionStatusToJSON(object: TokenTransactionStatus): string {
102
+ switch (object) {
103
+ case TokenTransactionStatus.TOKEN_TRANSACTION_STARTED:
104
+ return "TOKEN_TRANSACTION_STARTED";
105
+ case TokenTransactionStatus.TOKEN_TRANSACTION_SIGNED:
106
+ return "TOKEN_TRANSACTION_SIGNED";
107
+ case TokenTransactionStatus.TOKEN_TRANSACTION_REVEALED:
108
+ return "TOKEN_TRANSACTION_REVEALED";
109
+ case TokenTransactionStatus.TOKEN_TRANSACTION_FINALIZED:
110
+ return "TOKEN_TRANSACTION_FINALIZED";
111
+ case TokenTransactionStatus.TOKEN_TRANSACTION_STARTED_CANCELLED:
112
+ return "TOKEN_TRANSACTION_STARTED_CANCELLED";
113
+ case TokenTransactionStatus.TOKEN_TRANSACTION_SIGNED_CANCELLED:
114
+ return "TOKEN_TRANSACTION_SIGNED_CANCELLED";
115
+ case TokenTransactionStatus.TOKEN_TRANSACTION_UNKNOWN:
116
+ return "TOKEN_TRANSACTION_UNKNOWN";
117
+ case TokenTransactionStatus.UNRECOGNIZED:
118
+ default:
119
+ return "UNRECOGNIZED";
120
+ }
121
+ }
122
+
15
123
  /**
16
124
  * This proto is constructed by the wallet to specify leaves it wants to spend
17
125
  * as part of the token transaction.
@@ -27,17 +135,18 @@ export interface TokenTransferInput {
27
135
 
28
136
  export interface TokenMintInput {
29
137
  issuerPublicKey: Uint8Array;
30
- /**
31
- * Issuer provided timestamp of when the transaction was signed/constructed.
32
- * Helps provide idempotency and ensures that each mint input signature is
33
- * unique as long as multiple mint signatures are not happening at the same
34
- * time. Also gives a potentially useful data point for when the issuer
35
- * authorized from their perspective. Note that we have no way of proving
36
- * this is accurate.
37
- * TODO: Consider whether implementing generic idempotency controls and/or a
38
- * random nonce would be favorable to populating this field.
39
- */
40
- issuerProvidedTimestamp: number;
138
+ tokenIdentifier?: Uint8Array | undefined;
139
+ }
140
+
141
+ export interface TokenCreateInput {
142
+ issuerPublicKey: Uint8Array;
143
+ tokenName: string;
144
+ tokenTicker: string;
145
+ decimals: number;
146
+ /** Decoded uint128 */
147
+ maxSupply: Uint8Array;
148
+ isFreezable: boolean;
149
+ creationEntityPublicKey?: Uint8Array | undefined;
41
150
  }
42
151
 
43
152
  /**
@@ -52,7 +161,10 @@ export interface TokenOutput {
52
161
  revocationCommitment?: Uint8Array | undefined;
53
162
  withdrawBondSats?: number | undefined;
54
163
  withdrawRelativeBlockLocktime?: number | undefined;
55
- tokenPublicKey: Uint8Array;
164
+ tokenPublicKey?: Uint8Array | undefined;
165
+ tokenIdentifier?:
166
+ | Uint8Array
167
+ | undefined;
56
168
  /** Decoded uint128 */
57
169
  tokenAmount: Uint8Array;
58
170
  }
@@ -70,10 +182,11 @@ export interface TokenTransaction {
70
182
  * leaves must match the token amount in the output leaves.
71
183
  */
72
184
  version: number;
73
- tokenInputs?: { $case: "mintInput"; mintInput: TokenMintInput } | {
74
- $case: "transferInput";
75
- transferInput: TokenTransferInput;
76
- } | undefined;
185
+ tokenInputs?:
186
+ | { $case: "mintInput"; mintInput: TokenMintInput }
187
+ | { $case: "transferInput"; transferInput: TokenTransferInput }
188
+ | { $case: "createInput"; createInput: TokenCreateInput }
189
+ | undefined;
77
190
  tokenOutputs: TokenOutput[];
78
191
  sparkOperatorIdentityPublicKeys: Uint8Array[];
79
192
  /**
@@ -83,6 +196,12 @@ export interface TokenTransaction {
83
196
  */
84
197
  expiryTime: Date | undefined;
85
198
  network: Network;
199
+ /**
200
+ * The timestamp of when the client created the transaction. This is used to
201
+ * determine which transaction should win in a race condition. Earlier
202
+ * timestamps win over later ones.
203
+ */
204
+ clientCreatedTimestamp: Date | undefined;
86
205
  }
87
206
 
88
207
  export interface SignatureWithIndex {
@@ -120,7 +239,7 @@ export interface StartTransactionRequest {
120
239
  /**
121
240
  * How long the transaction should be valid for, in seconds.
122
241
  * The server will set the actual expiry_time in the final transaction based
123
- * on this duration. Must be between 1 and 300 seconds.
242
+ * on this duration. Must be within [1, 300] seconds.
124
243
  */
125
244
  validityDurationSeconds: number;
126
245
  }
@@ -140,6 +259,82 @@ export interface CommitTransactionRequest {
140
259
  export interface CommitTransactionResponse {
141
260
  }
142
261
 
262
+ export interface QueryTokenMetadataRequest {
263
+ tokenIdentifiers: Uint8Array[];
264
+ issuerPublicKeys: Uint8Array[];
265
+ }
266
+
267
+ export interface TokenMetadata {
268
+ issuerPublicKey: Uint8Array;
269
+ tokenName: string;
270
+ tokenTicker: string;
271
+ decimals: number;
272
+ /** Decoded uint128 */
273
+ maxSupply: Uint8Array;
274
+ isFreezable: boolean;
275
+ creationEntityPublicKey?: Uint8Array | undefined;
276
+ tokenIdentifier: Uint8Array;
277
+ }
278
+
279
+ export interface QueryTokenMetadataResponse {
280
+ tokenMetadata: TokenMetadata[];
281
+ }
282
+
283
+ export interface QueryTokenOutputsRequest {
284
+ ownerPublicKeys: Uint8Array[];
285
+ /** Optionally provide issuer public keys or token identifiers. If both are not set return outputs for all tokens. */
286
+ issuerPublicKeys: Uint8Array[];
287
+ tokenIdentifiers: Uint8Array[];
288
+ /** defaults to mainnet when no network is provided. */
289
+ network: Network;
290
+ }
291
+
292
+ /** Request constraints are combined using an AND relation. */
293
+ export interface QueryTokenTransactionsRequest {
294
+ /** Returns transactions that have one of these output ids in the input or output. */
295
+ outputIds: string[];
296
+ /** Returns transactions that have this owner public key as the sender or receiver in one or more of the input/output leaves. */
297
+ ownerPublicKeys: Uint8Array[];
298
+ /** Returns transactions that related to this token public key. */
299
+ issuerPublicKeys: Uint8Array[];
300
+ /** Returns transactions that related to this token identifier. */
301
+ tokenIdentifiers: Uint8Array[];
302
+ /** Returns transactions that match the provided transaction hashes. */
303
+ tokenTransactionHashes: Uint8Array[];
304
+ limit: number;
305
+ offset: number;
306
+ }
307
+
308
+ export interface QueryTokenTransactionsResponse {
309
+ tokenTransactionsWithStatus: TokenTransactionWithStatus[];
310
+ offset: number;
311
+ }
312
+
313
+ export interface OutputWithPreviousTransactionData {
314
+ output: TokenOutput | undefined;
315
+ previousTransactionHash: Uint8Array;
316
+ previousTransactionVout: number;
317
+ }
318
+
319
+ export interface QueryTokenOutputsResponse {
320
+ outputsWithPreviousTransactionData: OutputWithPreviousTransactionData[];
321
+ }
322
+
323
+ export interface SpentTokenOutputMetadata {
324
+ outputId: string;
325
+ revocationSecret: Uint8Array;
326
+ }
327
+
328
+ export interface TokenTransactionConfirmationMetadata {
329
+ spentTokenOutputsMetadata: SpentTokenOutputMetadata[];
330
+ }
331
+
332
+ export interface TokenTransactionWithStatus {
333
+ tokenTransaction: TokenTransaction | undefined;
334
+ status: TokenTransactionStatus;
335
+ confirmationMetadata: TokenTransactionConfirmationMetadata | undefined;
336
+ }
337
+
143
338
  function createBaseTokenOutputToSpend(): TokenOutputToSpend {
144
339
  return { prevTokenTransactionHash: new Uint8Array(0), prevTokenTransactionVout: 0 };
145
340
  }
@@ -157,7 +352,7 @@ export const TokenOutputToSpend: MessageFns<TokenOutputToSpend> = {
157
352
 
158
353
  decode(input: BinaryReader | Uint8Array, length?: number): TokenOutputToSpend {
159
354
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
160
- let end = length === undefined ? reader.len : reader.pos + length;
355
+ const end = length === undefined ? reader.len : reader.pos + length;
161
356
  const message = createBaseTokenOutputToSpend();
162
357
  while (reader.pos < end) {
163
358
  const tag = reader.uint32();
@@ -234,7 +429,7 @@ export const TokenTransferInput: MessageFns<TokenTransferInput> = {
234
429
 
235
430
  decode(input: BinaryReader | Uint8Array, length?: number): TokenTransferInput {
236
431
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
237
- let end = length === undefined ? reader.len : reader.pos + length;
432
+ const end = length === undefined ? reader.len : reader.pos + length;
238
433
  const message = createBaseTokenTransferInput();
239
434
  while (reader.pos < end) {
240
435
  const tag = reader.uint32();
@@ -283,7 +478,7 @@ export const TokenTransferInput: MessageFns<TokenTransferInput> = {
283
478
  };
284
479
 
285
480
  function createBaseTokenMintInput(): TokenMintInput {
286
- return { issuerPublicKey: new Uint8Array(0), issuerProvidedTimestamp: 0 };
481
+ return { issuerPublicKey: new Uint8Array(0), tokenIdentifier: undefined };
287
482
  }
288
483
 
289
484
  export const TokenMintInput: MessageFns<TokenMintInput> = {
@@ -291,15 +486,15 @@ export const TokenMintInput: MessageFns<TokenMintInput> = {
291
486
  if (message.issuerPublicKey.length !== 0) {
292
487
  writer.uint32(10).bytes(message.issuerPublicKey);
293
488
  }
294
- if (message.issuerProvidedTimestamp !== 0) {
295
- writer.uint32(16).uint64(message.issuerProvidedTimestamp);
489
+ if (message.tokenIdentifier !== undefined) {
490
+ writer.uint32(18).bytes(message.tokenIdentifier);
296
491
  }
297
492
  return writer;
298
493
  },
299
494
 
300
495
  decode(input: BinaryReader | Uint8Array, length?: number): TokenMintInput {
301
496
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
302
- let end = length === undefined ? reader.len : reader.pos + length;
497
+ const end = length === undefined ? reader.len : reader.pos + length;
303
498
  const message = createBaseTokenMintInput();
304
499
  while (reader.pos < end) {
305
500
  const tag = reader.uint32();
@@ -313,11 +508,11 @@ export const TokenMintInput: MessageFns<TokenMintInput> = {
313
508
  continue;
314
509
  }
315
510
  case 2: {
316
- if (tag !== 16) {
511
+ if (tag !== 18) {
317
512
  break;
318
513
  }
319
514
 
320
- message.issuerProvidedTimestamp = longToNumber(reader.uint64());
515
+ message.tokenIdentifier = reader.bytes();
321
516
  continue;
322
517
  }
323
518
  }
@@ -332,9 +527,7 @@ export const TokenMintInput: MessageFns<TokenMintInput> = {
332
527
  fromJSON(object: any): TokenMintInput {
333
528
  return {
334
529
  issuerPublicKey: isSet(object.issuerPublicKey) ? bytesFromBase64(object.issuerPublicKey) : new Uint8Array(0),
335
- issuerProvidedTimestamp: isSet(object.issuerProvidedTimestamp)
336
- ? globalThis.Number(object.issuerProvidedTimestamp)
337
- : 0,
530
+ tokenIdentifier: isSet(object.tokenIdentifier) ? bytesFromBase64(object.tokenIdentifier) : undefined,
338
531
  };
339
532
  },
340
533
 
@@ -343,8 +536,8 @@ export const TokenMintInput: MessageFns<TokenMintInput> = {
343
536
  if (message.issuerPublicKey.length !== 0) {
344
537
  obj.issuerPublicKey = base64FromBytes(message.issuerPublicKey);
345
538
  }
346
- if (message.issuerProvidedTimestamp !== 0) {
347
- obj.issuerProvidedTimestamp = Math.round(message.issuerProvidedTimestamp);
539
+ if (message.tokenIdentifier !== undefined) {
540
+ obj.tokenIdentifier = base64FromBytes(message.tokenIdentifier);
348
541
  }
349
542
  return obj;
350
543
  },
@@ -355,7 +548,173 @@ export const TokenMintInput: MessageFns<TokenMintInput> = {
355
548
  fromPartial(object: DeepPartial<TokenMintInput>): TokenMintInput {
356
549
  const message = createBaseTokenMintInput();
357
550
  message.issuerPublicKey = object.issuerPublicKey ?? new Uint8Array(0);
358
- message.issuerProvidedTimestamp = object.issuerProvidedTimestamp ?? 0;
551
+ message.tokenIdentifier = object.tokenIdentifier ?? undefined;
552
+ return message;
553
+ },
554
+ };
555
+
556
+ function createBaseTokenCreateInput(): TokenCreateInput {
557
+ return {
558
+ issuerPublicKey: new Uint8Array(0),
559
+ tokenName: "",
560
+ tokenTicker: "",
561
+ decimals: 0,
562
+ maxSupply: new Uint8Array(0),
563
+ isFreezable: false,
564
+ creationEntityPublicKey: undefined,
565
+ };
566
+ }
567
+
568
+ export const TokenCreateInput: MessageFns<TokenCreateInput> = {
569
+ encode(message: TokenCreateInput, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
570
+ if (message.issuerPublicKey.length !== 0) {
571
+ writer.uint32(10).bytes(message.issuerPublicKey);
572
+ }
573
+ if (message.tokenName !== "") {
574
+ writer.uint32(18).string(message.tokenName);
575
+ }
576
+ if (message.tokenTicker !== "") {
577
+ writer.uint32(26).string(message.tokenTicker);
578
+ }
579
+ if (message.decimals !== 0) {
580
+ writer.uint32(32).uint32(message.decimals);
581
+ }
582
+ if (message.maxSupply.length !== 0) {
583
+ writer.uint32(42).bytes(message.maxSupply);
584
+ }
585
+ if (message.isFreezable !== false) {
586
+ writer.uint32(48).bool(message.isFreezable);
587
+ }
588
+ if (message.creationEntityPublicKey !== undefined) {
589
+ writer.uint32(58).bytes(message.creationEntityPublicKey);
590
+ }
591
+ return writer;
592
+ },
593
+
594
+ decode(input: BinaryReader | Uint8Array, length?: number): TokenCreateInput {
595
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
596
+ const end = length === undefined ? reader.len : reader.pos + length;
597
+ const message = createBaseTokenCreateInput();
598
+ while (reader.pos < end) {
599
+ const tag = reader.uint32();
600
+ switch (tag >>> 3) {
601
+ case 1: {
602
+ if (tag !== 10) {
603
+ break;
604
+ }
605
+
606
+ message.issuerPublicKey = reader.bytes();
607
+ continue;
608
+ }
609
+ case 2: {
610
+ if (tag !== 18) {
611
+ break;
612
+ }
613
+
614
+ message.tokenName = reader.string();
615
+ continue;
616
+ }
617
+ case 3: {
618
+ if (tag !== 26) {
619
+ break;
620
+ }
621
+
622
+ message.tokenTicker = reader.string();
623
+ continue;
624
+ }
625
+ case 4: {
626
+ if (tag !== 32) {
627
+ break;
628
+ }
629
+
630
+ message.decimals = reader.uint32();
631
+ continue;
632
+ }
633
+ case 5: {
634
+ if (tag !== 42) {
635
+ break;
636
+ }
637
+
638
+ message.maxSupply = reader.bytes();
639
+ continue;
640
+ }
641
+ case 6: {
642
+ if (tag !== 48) {
643
+ break;
644
+ }
645
+
646
+ message.isFreezable = reader.bool();
647
+ continue;
648
+ }
649
+ case 7: {
650
+ if (tag !== 58) {
651
+ break;
652
+ }
653
+
654
+ message.creationEntityPublicKey = reader.bytes();
655
+ continue;
656
+ }
657
+ }
658
+ if ((tag & 7) === 4 || tag === 0) {
659
+ break;
660
+ }
661
+ reader.skip(tag & 7);
662
+ }
663
+ return message;
664
+ },
665
+
666
+ fromJSON(object: any): TokenCreateInput {
667
+ return {
668
+ issuerPublicKey: isSet(object.issuerPublicKey) ? bytesFromBase64(object.issuerPublicKey) : new Uint8Array(0),
669
+ tokenName: isSet(object.tokenName) ? globalThis.String(object.tokenName) : "",
670
+ tokenTicker: isSet(object.tokenTicker) ? globalThis.String(object.tokenTicker) : "",
671
+ decimals: isSet(object.decimals) ? globalThis.Number(object.decimals) : 0,
672
+ maxSupply: isSet(object.maxSupply) ? bytesFromBase64(object.maxSupply) : new Uint8Array(0),
673
+ isFreezable: isSet(object.isFreezable) ? globalThis.Boolean(object.isFreezable) : false,
674
+ creationEntityPublicKey: isSet(object.creationEntityPublicKey)
675
+ ? bytesFromBase64(object.creationEntityPublicKey)
676
+ : undefined,
677
+ };
678
+ },
679
+
680
+ toJSON(message: TokenCreateInput): unknown {
681
+ const obj: any = {};
682
+ if (message.issuerPublicKey.length !== 0) {
683
+ obj.issuerPublicKey = base64FromBytes(message.issuerPublicKey);
684
+ }
685
+ if (message.tokenName !== "") {
686
+ obj.tokenName = message.tokenName;
687
+ }
688
+ if (message.tokenTicker !== "") {
689
+ obj.tokenTicker = message.tokenTicker;
690
+ }
691
+ if (message.decimals !== 0) {
692
+ obj.decimals = Math.round(message.decimals);
693
+ }
694
+ if (message.maxSupply.length !== 0) {
695
+ obj.maxSupply = base64FromBytes(message.maxSupply);
696
+ }
697
+ if (message.isFreezable !== false) {
698
+ obj.isFreezable = message.isFreezable;
699
+ }
700
+ if (message.creationEntityPublicKey !== undefined) {
701
+ obj.creationEntityPublicKey = base64FromBytes(message.creationEntityPublicKey);
702
+ }
703
+ return obj;
704
+ },
705
+
706
+ create(base?: DeepPartial<TokenCreateInput>): TokenCreateInput {
707
+ return TokenCreateInput.fromPartial(base ?? {});
708
+ },
709
+ fromPartial(object: DeepPartial<TokenCreateInput>): TokenCreateInput {
710
+ const message = createBaseTokenCreateInput();
711
+ message.issuerPublicKey = object.issuerPublicKey ?? new Uint8Array(0);
712
+ message.tokenName = object.tokenName ?? "";
713
+ message.tokenTicker = object.tokenTicker ?? "";
714
+ message.decimals = object.decimals ?? 0;
715
+ message.maxSupply = object.maxSupply ?? new Uint8Array(0);
716
+ message.isFreezable = object.isFreezable ?? false;
717
+ message.creationEntityPublicKey = object.creationEntityPublicKey ?? undefined;
359
718
  return message;
360
719
  },
361
720
  };
@@ -367,7 +726,8 @@ function createBaseTokenOutput(): TokenOutput {
367
726
  revocationCommitment: undefined,
368
727
  withdrawBondSats: undefined,
369
728
  withdrawRelativeBlockLocktime: undefined,
370
- tokenPublicKey: new Uint8Array(0),
729
+ tokenPublicKey: undefined,
730
+ tokenIdentifier: undefined,
371
731
  tokenAmount: new Uint8Array(0),
372
732
  };
373
733
  }
@@ -389,9 +749,12 @@ export const TokenOutput: MessageFns<TokenOutput> = {
389
749
  if (message.withdrawRelativeBlockLocktime !== undefined) {
390
750
  writer.uint32(40).uint64(message.withdrawRelativeBlockLocktime);
391
751
  }
392
- if (message.tokenPublicKey.length !== 0) {
752
+ if (message.tokenPublicKey !== undefined) {
393
753
  writer.uint32(50).bytes(message.tokenPublicKey);
394
754
  }
755
+ if (message.tokenIdentifier !== undefined) {
756
+ writer.uint32(66).bytes(message.tokenIdentifier);
757
+ }
395
758
  if (message.tokenAmount.length !== 0) {
396
759
  writer.uint32(58).bytes(message.tokenAmount);
397
760
  }
@@ -400,7 +763,7 @@ export const TokenOutput: MessageFns<TokenOutput> = {
400
763
 
401
764
  decode(input: BinaryReader | Uint8Array, length?: number): TokenOutput {
402
765
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
403
- let end = length === undefined ? reader.len : reader.pos + length;
766
+ const end = length === undefined ? reader.len : reader.pos + length;
404
767
  const message = createBaseTokenOutput();
405
768
  while (reader.pos < end) {
406
769
  const tag = reader.uint32();
@@ -453,6 +816,14 @@ export const TokenOutput: MessageFns<TokenOutput> = {
453
816
  message.tokenPublicKey = reader.bytes();
454
817
  continue;
455
818
  }
819
+ case 8: {
820
+ if (tag !== 66) {
821
+ break;
822
+ }
823
+
824
+ message.tokenIdentifier = reader.bytes();
825
+ continue;
826
+ }
456
827
  case 7: {
457
828
  if (tag !== 58) {
458
829
  break;
@@ -481,7 +852,8 @@ export const TokenOutput: MessageFns<TokenOutput> = {
481
852
  withdrawRelativeBlockLocktime: isSet(object.withdrawRelativeBlockLocktime)
482
853
  ? globalThis.Number(object.withdrawRelativeBlockLocktime)
483
854
  : undefined,
484
- tokenPublicKey: isSet(object.tokenPublicKey) ? bytesFromBase64(object.tokenPublicKey) : new Uint8Array(0),
855
+ tokenPublicKey: isSet(object.tokenPublicKey) ? bytesFromBase64(object.tokenPublicKey) : undefined,
856
+ tokenIdentifier: isSet(object.tokenIdentifier) ? bytesFromBase64(object.tokenIdentifier) : undefined,
485
857
  tokenAmount: isSet(object.tokenAmount) ? bytesFromBase64(object.tokenAmount) : new Uint8Array(0),
486
858
  };
487
859
  },
@@ -503,9 +875,12 @@ export const TokenOutput: MessageFns<TokenOutput> = {
503
875
  if (message.withdrawRelativeBlockLocktime !== undefined) {
504
876
  obj.withdrawRelativeBlockLocktime = Math.round(message.withdrawRelativeBlockLocktime);
505
877
  }
506
- if (message.tokenPublicKey.length !== 0) {
878
+ if (message.tokenPublicKey !== undefined) {
507
879
  obj.tokenPublicKey = base64FromBytes(message.tokenPublicKey);
508
880
  }
881
+ if (message.tokenIdentifier !== undefined) {
882
+ obj.tokenIdentifier = base64FromBytes(message.tokenIdentifier);
883
+ }
509
884
  if (message.tokenAmount.length !== 0) {
510
885
  obj.tokenAmount = base64FromBytes(message.tokenAmount);
511
886
  }
@@ -522,7 +897,8 @@ export const TokenOutput: MessageFns<TokenOutput> = {
522
897
  message.revocationCommitment = object.revocationCommitment ?? undefined;
523
898
  message.withdrawBondSats = object.withdrawBondSats ?? undefined;
524
899
  message.withdrawRelativeBlockLocktime = object.withdrawRelativeBlockLocktime ?? undefined;
525
- message.tokenPublicKey = object.tokenPublicKey ?? new Uint8Array(0);
900
+ message.tokenPublicKey = object.tokenPublicKey ?? undefined;
901
+ message.tokenIdentifier = object.tokenIdentifier ?? undefined;
526
902
  message.tokenAmount = object.tokenAmount ?? new Uint8Array(0);
527
903
  return message;
528
904
  },
@@ -536,6 +912,7 @@ function createBaseTokenTransaction(): TokenTransaction {
536
912
  sparkOperatorIdentityPublicKeys: [],
537
913
  expiryTime: undefined,
538
914
  network: 0,
915
+ clientCreatedTimestamp: undefined,
539
916
  };
540
917
  }
541
918
 
@@ -551,6 +928,9 @@ export const TokenTransaction: MessageFns<TokenTransaction> = {
551
928
  case "transferInput":
552
929
  TokenTransferInput.encode(message.tokenInputs.transferInput, writer.uint32(26).fork()).join();
553
930
  break;
931
+ case "createInput":
932
+ TokenCreateInput.encode(message.tokenInputs.createInput, writer.uint32(66).fork()).join();
933
+ break;
554
934
  }
555
935
  for (const v of message.tokenOutputs) {
556
936
  TokenOutput.encode(v!, writer.uint32(34).fork()).join();
@@ -564,12 +944,15 @@ export const TokenTransaction: MessageFns<TokenTransaction> = {
564
944
  if (message.network !== 0) {
565
945
  writer.uint32(56).int32(message.network);
566
946
  }
947
+ if (message.clientCreatedTimestamp !== undefined) {
948
+ Timestamp.encode(toTimestamp(message.clientCreatedTimestamp), writer.uint32(74).fork()).join();
949
+ }
567
950
  return writer;
568
951
  },
569
952
 
570
953
  decode(input: BinaryReader | Uint8Array, length?: number): TokenTransaction {
571
954
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
572
- let end = length === undefined ? reader.len : reader.pos + length;
955
+ const end = length === undefined ? reader.len : reader.pos + length;
573
956
  const message = createBaseTokenTransaction();
574
957
  while (reader.pos < end) {
575
958
  const tag = reader.uint32();
@@ -601,6 +984,14 @@ export const TokenTransaction: MessageFns<TokenTransaction> = {
601
984
  };
602
985
  continue;
603
986
  }
987
+ case 8: {
988
+ if (tag !== 66) {
989
+ break;
990
+ }
991
+
992
+ message.tokenInputs = { $case: "createInput", createInput: TokenCreateInput.decode(reader, reader.uint32()) };
993
+ continue;
994
+ }
604
995
  case 4: {
605
996
  if (tag !== 34) {
606
997
  break;
@@ -633,6 +1024,14 @@ export const TokenTransaction: MessageFns<TokenTransaction> = {
633
1024
  message.network = reader.int32() as any;
634
1025
  continue;
635
1026
  }
1027
+ case 9: {
1028
+ if (tag !== 74) {
1029
+ break;
1030
+ }
1031
+
1032
+ message.clientCreatedTimestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1033
+ continue;
1034
+ }
636
1035
  }
637
1036
  if ((tag & 7) === 4 || tag === 0) {
638
1037
  break;
@@ -649,6 +1048,8 @@ export const TokenTransaction: MessageFns<TokenTransaction> = {
649
1048
  ? { $case: "mintInput", mintInput: TokenMintInput.fromJSON(object.mintInput) }
650
1049
  : isSet(object.transferInput)
651
1050
  ? { $case: "transferInput", transferInput: TokenTransferInput.fromJSON(object.transferInput) }
1051
+ : isSet(object.createInput)
1052
+ ? { $case: "createInput", createInput: TokenCreateInput.fromJSON(object.createInput) }
652
1053
  : undefined,
653
1054
  tokenOutputs: globalThis.Array.isArray(object?.tokenOutputs)
654
1055
  ? object.tokenOutputs.map((e: any) => TokenOutput.fromJSON(e))
@@ -658,6 +1059,9 @@ export const TokenTransaction: MessageFns<TokenTransaction> = {
658
1059
  : [],
659
1060
  expiryTime: isSet(object.expiryTime) ? fromJsonTimestamp(object.expiryTime) : undefined,
660
1061
  network: isSet(object.network) ? networkFromJSON(object.network) : 0,
1062
+ clientCreatedTimestamp: isSet(object.clientCreatedTimestamp)
1063
+ ? fromJsonTimestamp(object.clientCreatedTimestamp)
1064
+ : undefined,
661
1065
  };
662
1066
  },
663
1067
 
@@ -670,6 +1074,8 @@ export const TokenTransaction: MessageFns<TokenTransaction> = {
670
1074
  obj.mintInput = TokenMintInput.toJSON(message.tokenInputs.mintInput);
671
1075
  } else if (message.tokenInputs?.$case === "transferInput") {
672
1076
  obj.transferInput = TokenTransferInput.toJSON(message.tokenInputs.transferInput);
1077
+ } else if (message.tokenInputs?.$case === "createInput") {
1078
+ obj.createInput = TokenCreateInput.toJSON(message.tokenInputs.createInput);
673
1079
  }
674
1080
  if (message.tokenOutputs?.length) {
675
1081
  obj.tokenOutputs = message.tokenOutputs.map((e) => TokenOutput.toJSON(e));
@@ -683,6 +1089,9 @@ export const TokenTransaction: MessageFns<TokenTransaction> = {
683
1089
  if (message.network !== 0) {
684
1090
  obj.network = networkToJSON(message.network);
685
1091
  }
1092
+ if (message.clientCreatedTimestamp !== undefined) {
1093
+ obj.clientCreatedTimestamp = message.clientCreatedTimestamp.toISOString();
1094
+ }
686
1095
  return obj;
687
1096
  },
688
1097
 
@@ -711,11 +1120,21 @@ export const TokenTransaction: MessageFns<TokenTransaction> = {
711
1120
  }
712
1121
  break;
713
1122
  }
1123
+ case "createInput": {
1124
+ if (object.tokenInputs?.createInput !== undefined && object.tokenInputs?.createInput !== null) {
1125
+ message.tokenInputs = {
1126
+ $case: "createInput",
1127
+ createInput: TokenCreateInput.fromPartial(object.tokenInputs.createInput),
1128
+ };
1129
+ }
1130
+ break;
1131
+ }
714
1132
  }
715
1133
  message.tokenOutputs = object.tokenOutputs?.map((e) => TokenOutput.fromPartial(e)) || [];
716
1134
  message.sparkOperatorIdentityPublicKeys = object.sparkOperatorIdentityPublicKeys?.map((e) => e) || [];
717
1135
  message.expiryTime = object.expiryTime ?? undefined;
718
1136
  message.network = object.network ?? 0;
1137
+ message.clientCreatedTimestamp = object.clientCreatedTimestamp ?? undefined;
719
1138
  return message;
720
1139
  },
721
1140
  };
@@ -737,7 +1156,7 @@ export const SignatureWithIndex: MessageFns<SignatureWithIndex> = {
737
1156
 
738
1157
  decode(input: BinaryReader | Uint8Array, length?: number): SignatureWithIndex {
739
1158
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
740
- let end = length === undefined ? reader.len : reader.pos + length;
1159
+ const end = length === undefined ? reader.len : reader.pos + length;
741
1160
  const message = createBaseSignatureWithIndex();
742
1161
  while (reader.pos < end) {
743
1162
  const tag = reader.uint32();
@@ -813,7 +1232,7 @@ export const InputTtxoSignaturesPerOperator: MessageFns<InputTtxoSignaturesPerOp
813
1232
 
814
1233
  decode(input: BinaryReader | Uint8Array, length?: number): InputTtxoSignaturesPerOperator {
815
1234
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
816
- let end = length === undefined ? reader.len : reader.pos + length;
1235
+ const end = length === undefined ? reader.len : reader.pos + length;
817
1236
  const message = createBaseInputTtxoSignaturesPerOperator();
818
1237
  while (reader.pos < end) {
819
1238
  const tag = reader.uint32();
@@ -904,7 +1323,7 @@ export const StartTransactionRequest: MessageFns<StartTransactionRequest> = {
904
1323
 
905
1324
  decode(input: BinaryReader | Uint8Array, length?: number): StartTransactionRequest {
906
1325
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
907
- let end = length === undefined ? reader.len : reader.pos + length;
1326
+ const end = length === undefined ? reader.len : reader.pos + length;
908
1327
  const message = createBaseStartTransactionRequest();
909
1328
  while (reader.pos < end) {
910
1329
  const tag = reader.uint32();
@@ -1020,7 +1439,7 @@ export const StartTransactionResponse: MessageFns<StartTransactionResponse> = {
1020
1439
 
1021
1440
  decode(input: BinaryReader | Uint8Array, length?: number): StartTransactionResponse {
1022
1441
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1023
- let end = length === undefined ? reader.len : reader.pos + length;
1442
+ const end = length === undefined ? reader.len : reader.pos + length;
1024
1443
  const message = createBaseStartTransactionResponse();
1025
1444
  while (reader.pos < end) {
1026
1445
  const tag = reader.uint32();
@@ -1114,7 +1533,7 @@ export const CommitTransactionRequest: MessageFns<CommitTransactionRequest> = {
1114
1533
 
1115
1534
  decode(input: BinaryReader | Uint8Array, length?: number): CommitTransactionRequest {
1116
1535
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1117
- let end = length === undefined ? reader.len : reader.pos + length;
1536
+ const end = length === undefined ? reader.len : reader.pos + length;
1118
1537
  const message = createBaseCommitTransactionRequest();
1119
1538
  while (reader.pos < end) {
1120
1539
  const tag = reader.uint32();
@@ -1224,7 +1643,7 @@ export const CommitTransactionResponse: MessageFns<CommitTransactionResponse> =
1224
1643
 
1225
1644
  decode(input: BinaryReader | Uint8Array, length?: number): CommitTransactionResponse {
1226
1645
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1227
- let end = length === undefined ? reader.len : reader.pos + length;
1646
+ const end = length === undefined ? reader.len : reader.pos + length;
1228
1647
  const message = createBaseCommitTransactionResponse();
1229
1648
  while (reader.pos < end) {
1230
1649
  const tag = reader.uint32();
@@ -1256,74 +1675,1218 @@ export const CommitTransactionResponse: MessageFns<CommitTransactionResponse> =
1256
1675
  },
1257
1676
  };
1258
1677
 
1259
- export type SparkTokenServiceDefinition = typeof SparkTokenServiceDefinition;
1260
- export const SparkTokenServiceDefinition = {
1261
- name: "SparkTokenService",
1262
- fullName: "spark_token.SparkTokenService",
1263
- methods: {
1264
- /**
1265
- * Start process to create final token transaction with all inputs required
1266
- * from user and SOs (including revocation secret commitment)
1267
- */
1268
- start_transaction: {
1269
- name: "start_transaction",
1270
- requestType: StartTransactionRequest,
1271
- requestStream: false,
1272
- responseType: StartTransactionResponse,
1273
- responseStream: false,
1274
- options: {},
1275
- },
1276
- /**
1277
- * Complete the transaction and commit it with all SOs. This will be
1278
- * coordinated by one SO.
1279
- */
1280
- commit_transaction: {
1281
- name: "commit_transaction",
1282
- requestType: CommitTransactionRequest,
1283
- requestStream: false,
1284
- responseType: CommitTransactionResponse,
1285
- responseStream: false,
1286
- options: {},
1287
- },
1678
+ function createBaseQueryTokenMetadataRequest(): QueryTokenMetadataRequest {
1679
+ return { tokenIdentifiers: [], issuerPublicKeys: [] };
1680
+ }
1681
+
1682
+ export const QueryTokenMetadataRequest: MessageFns<QueryTokenMetadataRequest> = {
1683
+ encode(message: QueryTokenMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1684
+ for (const v of message.tokenIdentifiers) {
1685
+ writer.uint32(10).bytes(v!);
1686
+ }
1687
+ for (const v of message.issuerPublicKeys) {
1688
+ writer.uint32(18).bytes(v!);
1689
+ }
1690
+ return writer;
1288
1691
  },
1289
- } as const;
1290
1692
 
1291
- export interface SparkTokenServiceImplementation<CallContextExt = {}> {
1292
- /**
1293
- * Start process to create final token transaction with all inputs required
1294
- * from user and SOs (including revocation secret commitment)
1295
- */
1296
- start_transaction(
1297
- request: StartTransactionRequest,
1298
- context: CallContext & CallContextExt,
1299
- ): Promise<DeepPartial<StartTransactionResponse>>;
1300
- /**
1301
- * Complete the transaction and commit it with all SOs. This will be
1302
- * coordinated by one SO.
1303
- */
1304
- commit_transaction(
1305
- request: CommitTransactionRequest,
1306
- context: CallContext & CallContextExt,
1307
- ): Promise<DeepPartial<CommitTransactionResponse>>;
1308
- }
1693
+ decode(input: BinaryReader | Uint8Array, length?: number): QueryTokenMetadataRequest {
1694
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1695
+ const end = length === undefined ? reader.len : reader.pos + length;
1696
+ const message = createBaseQueryTokenMetadataRequest();
1697
+ while (reader.pos < end) {
1698
+ const tag = reader.uint32();
1699
+ switch (tag >>> 3) {
1700
+ case 1: {
1701
+ if (tag !== 10) {
1702
+ break;
1703
+ }
1309
1704
 
1310
- export interface SparkTokenServiceClient<CallOptionsExt = {}> {
1311
- /**
1312
- * Start process to create final token transaction with all inputs required
1313
- * from user and SOs (including revocation secret commitment)
1314
- */
1315
- start_transaction(
1316
- request: DeepPartial<StartTransactionRequest>,
1317
- options?: CallOptions & CallOptionsExt,
1318
- ): Promise<StartTransactionResponse>;
1319
- /**
1320
- * Complete the transaction and commit it with all SOs. This will be
1321
- * coordinated by one SO.
1705
+ message.tokenIdentifiers.push(reader.bytes());
1706
+ continue;
1707
+ }
1708
+ case 2: {
1709
+ if (tag !== 18) {
1710
+ break;
1711
+ }
1712
+
1713
+ message.issuerPublicKeys.push(reader.bytes());
1714
+ continue;
1715
+ }
1716
+ }
1717
+ if ((tag & 7) === 4 || tag === 0) {
1718
+ break;
1719
+ }
1720
+ reader.skip(tag & 7);
1721
+ }
1722
+ return message;
1723
+ },
1724
+
1725
+ fromJSON(object: any): QueryTokenMetadataRequest {
1726
+ return {
1727
+ tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers)
1728
+ ? object.tokenIdentifiers.map((e: any) => bytesFromBase64(e))
1729
+ : [],
1730
+ issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys)
1731
+ ? object.issuerPublicKeys.map((e: any) => bytesFromBase64(e))
1732
+ : [],
1733
+ };
1734
+ },
1735
+
1736
+ toJSON(message: QueryTokenMetadataRequest): unknown {
1737
+ const obj: any = {};
1738
+ if (message.tokenIdentifiers?.length) {
1739
+ obj.tokenIdentifiers = message.tokenIdentifiers.map((e) => base64FromBytes(e));
1740
+ }
1741
+ if (message.issuerPublicKeys?.length) {
1742
+ obj.issuerPublicKeys = message.issuerPublicKeys.map((e) => base64FromBytes(e));
1743
+ }
1744
+ return obj;
1745
+ },
1746
+
1747
+ create(base?: DeepPartial<QueryTokenMetadataRequest>): QueryTokenMetadataRequest {
1748
+ return QueryTokenMetadataRequest.fromPartial(base ?? {});
1749
+ },
1750
+ fromPartial(object: DeepPartial<QueryTokenMetadataRequest>): QueryTokenMetadataRequest {
1751
+ const message = createBaseQueryTokenMetadataRequest();
1752
+ message.tokenIdentifiers = object.tokenIdentifiers?.map((e) => e) || [];
1753
+ message.issuerPublicKeys = object.issuerPublicKeys?.map((e) => e) || [];
1754
+ return message;
1755
+ },
1756
+ };
1757
+
1758
+ function createBaseTokenMetadata(): TokenMetadata {
1759
+ return {
1760
+ issuerPublicKey: new Uint8Array(0),
1761
+ tokenName: "",
1762
+ tokenTicker: "",
1763
+ decimals: 0,
1764
+ maxSupply: new Uint8Array(0),
1765
+ isFreezable: false,
1766
+ creationEntityPublicKey: undefined,
1767
+ tokenIdentifier: new Uint8Array(0),
1768
+ };
1769
+ }
1770
+
1771
+ export const TokenMetadata: MessageFns<TokenMetadata> = {
1772
+ encode(message: TokenMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1773
+ if (message.issuerPublicKey.length !== 0) {
1774
+ writer.uint32(10).bytes(message.issuerPublicKey);
1775
+ }
1776
+ if (message.tokenName !== "") {
1777
+ writer.uint32(18).string(message.tokenName);
1778
+ }
1779
+ if (message.tokenTicker !== "") {
1780
+ writer.uint32(26).string(message.tokenTicker);
1781
+ }
1782
+ if (message.decimals !== 0) {
1783
+ writer.uint32(32).uint32(message.decimals);
1784
+ }
1785
+ if (message.maxSupply.length !== 0) {
1786
+ writer.uint32(42).bytes(message.maxSupply);
1787
+ }
1788
+ if (message.isFreezable !== false) {
1789
+ writer.uint32(48).bool(message.isFreezable);
1790
+ }
1791
+ if (message.creationEntityPublicKey !== undefined) {
1792
+ writer.uint32(58).bytes(message.creationEntityPublicKey);
1793
+ }
1794
+ if (message.tokenIdentifier.length !== 0) {
1795
+ writer.uint32(66).bytes(message.tokenIdentifier);
1796
+ }
1797
+ return writer;
1798
+ },
1799
+
1800
+ decode(input: BinaryReader | Uint8Array, length?: number): TokenMetadata {
1801
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1802
+ const end = length === undefined ? reader.len : reader.pos + length;
1803
+ const message = createBaseTokenMetadata();
1804
+ while (reader.pos < end) {
1805
+ const tag = reader.uint32();
1806
+ switch (tag >>> 3) {
1807
+ case 1: {
1808
+ if (tag !== 10) {
1809
+ break;
1810
+ }
1811
+
1812
+ message.issuerPublicKey = reader.bytes();
1813
+ continue;
1814
+ }
1815
+ case 2: {
1816
+ if (tag !== 18) {
1817
+ break;
1818
+ }
1819
+
1820
+ message.tokenName = reader.string();
1821
+ continue;
1822
+ }
1823
+ case 3: {
1824
+ if (tag !== 26) {
1825
+ break;
1826
+ }
1827
+
1828
+ message.tokenTicker = reader.string();
1829
+ continue;
1830
+ }
1831
+ case 4: {
1832
+ if (tag !== 32) {
1833
+ break;
1834
+ }
1835
+
1836
+ message.decimals = reader.uint32();
1837
+ continue;
1838
+ }
1839
+ case 5: {
1840
+ if (tag !== 42) {
1841
+ break;
1842
+ }
1843
+
1844
+ message.maxSupply = reader.bytes();
1845
+ continue;
1846
+ }
1847
+ case 6: {
1848
+ if (tag !== 48) {
1849
+ break;
1850
+ }
1851
+
1852
+ message.isFreezable = reader.bool();
1853
+ continue;
1854
+ }
1855
+ case 7: {
1856
+ if (tag !== 58) {
1857
+ break;
1858
+ }
1859
+
1860
+ message.creationEntityPublicKey = reader.bytes();
1861
+ continue;
1862
+ }
1863
+ case 8: {
1864
+ if (tag !== 66) {
1865
+ break;
1866
+ }
1867
+
1868
+ message.tokenIdentifier = reader.bytes();
1869
+ continue;
1870
+ }
1871
+ }
1872
+ if ((tag & 7) === 4 || tag === 0) {
1873
+ break;
1874
+ }
1875
+ reader.skip(tag & 7);
1876
+ }
1877
+ return message;
1878
+ },
1879
+
1880
+ fromJSON(object: any): TokenMetadata {
1881
+ return {
1882
+ issuerPublicKey: isSet(object.issuerPublicKey) ? bytesFromBase64(object.issuerPublicKey) : new Uint8Array(0),
1883
+ tokenName: isSet(object.tokenName) ? globalThis.String(object.tokenName) : "",
1884
+ tokenTicker: isSet(object.tokenTicker) ? globalThis.String(object.tokenTicker) : "",
1885
+ decimals: isSet(object.decimals) ? globalThis.Number(object.decimals) : 0,
1886
+ maxSupply: isSet(object.maxSupply) ? bytesFromBase64(object.maxSupply) : new Uint8Array(0),
1887
+ isFreezable: isSet(object.isFreezable) ? globalThis.Boolean(object.isFreezable) : false,
1888
+ creationEntityPublicKey: isSet(object.creationEntityPublicKey)
1889
+ ? bytesFromBase64(object.creationEntityPublicKey)
1890
+ : undefined,
1891
+ tokenIdentifier: isSet(object.tokenIdentifier) ? bytesFromBase64(object.tokenIdentifier) : new Uint8Array(0),
1892
+ };
1893
+ },
1894
+
1895
+ toJSON(message: TokenMetadata): unknown {
1896
+ const obj: any = {};
1897
+ if (message.issuerPublicKey.length !== 0) {
1898
+ obj.issuerPublicKey = base64FromBytes(message.issuerPublicKey);
1899
+ }
1900
+ if (message.tokenName !== "") {
1901
+ obj.tokenName = message.tokenName;
1902
+ }
1903
+ if (message.tokenTicker !== "") {
1904
+ obj.tokenTicker = message.tokenTicker;
1905
+ }
1906
+ if (message.decimals !== 0) {
1907
+ obj.decimals = Math.round(message.decimals);
1908
+ }
1909
+ if (message.maxSupply.length !== 0) {
1910
+ obj.maxSupply = base64FromBytes(message.maxSupply);
1911
+ }
1912
+ if (message.isFreezable !== false) {
1913
+ obj.isFreezable = message.isFreezable;
1914
+ }
1915
+ if (message.creationEntityPublicKey !== undefined) {
1916
+ obj.creationEntityPublicKey = base64FromBytes(message.creationEntityPublicKey);
1917
+ }
1918
+ if (message.tokenIdentifier.length !== 0) {
1919
+ obj.tokenIdentifier = base64FromBytes(message.tokenIdentifier);
1920
+ }
1921
+ return obj;
1922
+ },
1923
+
1924
+ create(base?: DeepPartial<TokenMetadata>): TokenMetadata {
1925
+ return TokenMetadata.fromPartial(base ?? {});
1926
+ },
1927
+ fromPartial(object: DeepPartial<TokenMetadata>): TokenMetadata {
1928
+ const message = createBaseTokenMetadata();
1929
+ message.issuerPublicKey = object.issuerPublicKey ?? new Uint8Array(0);
1930
+ message.tokenName = object.tokenName ?? "";
1931
+ message.tokenTicker = object.tokenTicker ?? "";
1932
+ message.decimals = object.decimals ?? 0;
1933
+ message.maxSupply = object.maxSupply ?? new Uint8Array(0);
1934
+ message.isFreezable = object.isFreezable ?? false;
1935
+ message.creationEntityPublicKey = object.creationEntityPublicKey ?? undefined;
1936
+ message.tokenIdentifier = object.tokenIdentifier ?? new Uint8Array(0);
1937
+ return message;
1938
+ },
1939
+ };
1940
+
1941
+ function createBaseQueryTokenMetadataResponse(): QueryTokenMetadataResponse {
1942
+ return { tokenMetadata: [] };
1943
+ }
1944
+
1945
+ export const QueryTokenMetadataResponse: MessageFns<QueryTokenMetadataResponse> = {
1946
+ encode(message: QueryTokenMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1947
+ for (const v of message.tokenMetadata) {
1948
+ TokenMetadata.encode(v!, writer.uint32(10).fork()).join();
1949
+ }
1950
+ return writer;
1951
+ },
1952
+
1953
+ decode(input: BinaryReader | Uint8Array, length?: number): QueryTokenMetadataResponse {
1954
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1955
+ const end = length === undefined ? reader.len : reader.pos + length;
1956
+ const message = createBaseQueryTokenMetadataResponse();
1957
+ while (reader.pos < end) {
1958
+ const tag = reader.uint32();
1959
+ switch (tag >>> 3) {
1960
+ case 1: {
1961
+ if (tag !== 10) {
1962
+ break;
1963
+ }
1964
+
1965
+ message.tokenMetadata.push(TokenMetadata.decode(reader, reader.uint32()));
1966
+ continue;
1967
+ }
1968
+ }
1969
+ if ((tag & 7) === 4 || tag === 0) {
1970
+ break;
1971
+ }
1972
+ reader.skip(tag & 7);
1973
+ }
1974
+ return message;
1975
+ },
1976
+
1977
+ fromJSON(object: any): QueryTokenMetadataResponse {
1978
+ return {
1979
+ tokenMetadata: globalThis.Array.isArray(object?.tokenMetadata)
1980
+ ? object.tokenMetadata.map((e: any) => TokenMetadata.fromJSON(e))
1981
+ : [],
1982
+ };
1983
+ },
1984
+
1985
+ toJSON(message: QueryTokenMetadataResponse): unknown {
1986
+ const obj: any = {};
1987
+ if (message.tokenMetadata?.length) {
1988
+ obj.tokenMetadata = message.tokenMetadata.map((e) => TokenMetadata.toJSON(e));
1989
+ }
1990
+ return obj;
1991
+ },
1992
+
1993
+ create(base?: DeepPartial<QueryTokenMetadataResponse>): QueryTokenMetadataResponse {
1994
+ return QueryTokenMetadataResponse.fromPartial(base ?? {});
1995
+ },
1996
+ fromPartial(object: DeepPartial<QueryTokenMetadataResponse>): QueryTokenMetadataResponse {
1997
+ const message = createBaseQueryTokenMetadataResponse();
1998
+ message.tokenMetadata = object.tokenMetadata?.map((e) => TokenMetadata.fromPartial(e)) || [];
1999
+ return message;
2000
+ },
2001
+ };
2002
+
2003
+ function createBaseQueryTokenOutputsRequest(): QueryTokenOutputsRequest {
2004
+ return { ownerPublicKeys: [], issuerPublicKeys: [], tokenIdentifiers: [], network: 0 };
2005
+ }
2006
+
2007
+ export const QueryTokenOutputsRequest: MessageFns<QueryTokenOutputsRequest> = {
2008
+ encode(message: QueryTokenOutputsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2009
+ for (const v of message.ownerPublicKeys) {
2010
+ writer.uint32(10).bytes(v!);
2011
+ }
2012
+ for (const v of message.issuerPublicKeys) {
2013
+ writer.uint32(18).bytes(v!);
2014
+ }
2015
+ for (const v of message.tokenIdentifiers) {
2016
+ writer.uint32(34).bytes(v!);
2017
+ }
2018
+ if (message.network !== 0) {
2019
+ writer.uint32(24).int32(message.network);
2020
+ }
2021
+ return writer;
2022
+ },
2023
+
2024
+ decode(input: BinaryReader | Uint8Array, length?: number): QueryTokenOutputsRequest {
2025
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2026
+ const end = length === undefined ? reader.len : reader.pos + length;
2027
+ const message = createBaseQueryTokenOutputsRequest();
2028
+ while (reader.pos < end) {
2029
+ const tag = reader.uint32();
2030
+ switch (tag >>> 3) {
2031
+ case 1: {
2032
+ if (tag !== 10) {
2033
+ break;
2034
+ }
2035
+
2036
+ message.ownerPublicKeys.push(reader.bytes());
2037
+ continue;
2038
+ }
2039
+ case 2: {
2040
+ if (tag !== 18) {
2041
+ break;
2042
+ }
2043
+
2044
+ message.issuerPublicKeys.push(reader.bytes());
2045
+ continue;
2046
+ }
2047
+ case 4: {
2048
+ if (tag !== 34) {
2049
+ break;
2050
+ }
2051
+
2052
+ message.tokenIdentifiers.push(reader.bytes());
2053
+ continue;
2054
+ }
2055
+ case 3: {
2056
+ if (tag !== 24) {
2057
+ break;
2058
+ }
2059
+
2060
+ message.network = reader.int32() as any;
2061
+ continue;
2062
+ }
2063
+ }
2064
+ if ((tag & 7) === 4 || tag === 0) {
2065
+ break;
2066
+ }
2067
+ reader.skip(tag & 7);
2068
+ }
2069
+ return message;
2070
+ },
2071
+
2072
+ fromJSON(object: any): QueryTokenOutputsRequest {
2073
+ return {
2074
+ ownerPublicKeys: globalThis.Array.isArray(object?.ownerPublicKeys)
2075
+ ? object.ownerPublicKeys.map((e: any) => bytesFromBase64(e))
2076
+ : [],
2077
+ issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys)
2078
+ ? object.issuerPublicKeys.map((e: any) => bytesFromBase64(e))
2079
+ : [],
2080
+ tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers)
2081
+ ? object.tokenIdentifiers.map((e: any) => bytesFromBase64(e))
2082
+ : [],
2083
+ network: isSet(object.network) ? networkFromJSON(object.network) : 0,
2084
+ };
2085
+ },
2086
+
2087
+ toJSON(message: QueryTokenOutputsRequest): unknown {
2088
+ const obj: any = {};
2089
+ if (message.ownerPublicKeys?.length) {
2090
+ obj.ownerPublicKeys = message.ownerPublicKeys.map((e) => base64FromBytes(e));
2091
+ }
2092
+ if (message.issuerPublicKeys?.length) {
2093
+ obj.issuerPublicKeys = message.issuerPublicKeys.map((e) => base64FromBytes(e));
2094
+ }
2095
+ if (message.tokenIdentifiers?.length) {
2096
+ obj.tokenIdentifiers = message.tokenIdentifiers.map((e) => base64FromBytes(e));
2097
+ }
2098
+ if (message.network !== 0) {
2099
+ obj.network = networkToJSON(message.network);
2100
+ }
2101
+ return obj;
2102
+ },
2103
+
2104
+ create(base?: DeepPartial<QueryTokenOutputsRequest>): QueryTokenOutputsRequest {
2105
+ return QueryTokenOutputsRequest.fromPartial(base ?? {});
2106
+ },
2107
+ fromPartial(object: DeepPartial<QueryTokenOutputsRequest>): QueryTokenOutputsRequest {
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
+
2117
+ function createBaseQueryTokenTransactionsRequest(): QueryTokenTransactionsRequest {
2118
+ return {
2119
+ outputIds: [],
2120
+ ownerPublicKeys: [],
2121
+ issuerPublicKeys: [],
2122
+ tokenIdentifiers: [],
2123
+ tokenTransactionHashes: [],
2124
+ limit: 0,
2125
+ offset: 0,
2126
+ };
2127
+ }
2128
+
2129
+ export const QueryTokenTransactionsRequest: MessageFns<QueryTokenTransactionsRequest> = {
2130
+ encode(message: QueryTokenTransactionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2131
+ for (const v of message.outputIds) {
2132
+ writer.uint32(10).string(v!);
2133
+ }
2134
+ for (const v of message.ownerPublicKeys) {
2135
+ writer.uint32(18).bytes(v!);
2136
+ }
2137
+ for (const v of message.issuerPublicKeys) {
2138
+ writer.uint32(26).bytes(v!);
2139
+ }
2140
+ for (const v of message.tokenIdentifiers) {
2141
+ writer.uint32(58).bytes(v!);
2142
+ }
2143
+ for (const v of message.tokenTransactionHashes) {
2144
+ writer.uint32(34).bytes(v!);
2145
+ }
2146
+ if (message.limit !== 0) {
2147
+ writer.uint32(40).int64(message.limit);
2148
+ }
2149
+ if (message.offset !== 0) {
2150
+ writer.uint32(48).int64(message.offset);
2151
+ }
2152
+ return writer;
2153
+ },
2154
+
2155
+ decode(input: BinaryReader | Uint8Array, length?: number): QueryTokenTransactionsRequest {
2156
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2157
+ const end = length === undefined ? reader.len : reader.pos + length;
2158
+ const message = createBaseQueryTokenTransactionsRequest();
2159
+ while (reader.pos < end) {
2160
+ const tag = reader.uint32();
2161
+ switch (tag >>> 3) {
2162
+ case 1: {
2163
+ if (tag !== 10) {
2164
+ break;
2165
+ }
2166
+
2167
+ message.outputIds.push(reader.string());
2168
+ continue;
2169
+ }
2170
+ case 2: {
2171
+ if (tag !== 18) {
2172
+ break;
2173
+ }
2174
+
2175
+ message.ownerPublicKeys.push(reader.bytes());
2176
+ continue;
2177
+ }
2178
+ case 3: {
2179
+ if (tag !== 26) {
2180
+ break;
2181
+ }
2182
+
2183
+ message.issuerPublicKeys.push(reader.bytes());
2184
+ continue;
2185
+ }
2186
+ case 7: {
2187
+ if (tag !== 58) {
2188
+ break;
2189
+ }
2190
+
2191
+ message.tokenIdentifiers.push(reader.bytes());
2192
+ continue;
2193
+ }
2194
+ case 4: {
2195
+ if (tag !== 34) {
2196
+ break;
2197
+ }
2198
+
2199
+ message.tokenTransactionHashes.push(reader.bytes());
2200
+ continue;
2201
+ }
2202
+ case 5: {
2203
+ if (tag !== 40) {
2204
+ break;
2205
+ }
2206
+
2207
+ message.limit = longToNumber(reader.int64());
2208
+ continue;
2209
+ }
2210
+ case 6: {
2211
+ if (tag !== 48) {
2212
+ break;
2213
+ }
2214
+
2215
+ message.offset = longToNumber(reader.int64());
2216
+ continue;
2217
+ }
2218
+ }
2219
+ if ((tag & 7) === 4 || tag === 0) {
2220
+ break;
2221
+ }
2222
+ reader.skip(tag & 7);
2223
+ }
2224
+ return message;
2225
+ },
2226
+
2227
+ fromJSON(object: any): QueryTokenTransactionsRequest {
2228
+ return {
2229
+ outputIds: globalThis.Array.isArray(object?.outputIds)
2230
+ ? object.outputIds.map((e: any) => globalThis.String(e))
2231
+ : [],
2232
+ ownerPublicKeys: globalThis.Array.isArray(object?.ownerPublicKeys)
2233
+ ? object.ownerPublicKeys.map((e: any) => bytesFromBase64(e))
2234
+ : [],
2235
+ issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys)
2236
+ ? object.issuerPublicKeys.map((e: any) => bytesFromBase64(e))
2237
+ : [],
2238
+ tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers)
2239
+ ? object.tokenIdentifiers.map((e: any) => bytesFromBase64(e))
2240
+ : [],
2241
+ tokenTransactionHashes: globalThis.Array.isArray(object?.tokenTransactionHashes)
2242
+ ? object.tokenTransactionHashes.map((e: any) => bytesFromBase64(e))
2243
+ : [],
2244
+ limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0,
2245
+ offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0,
2246
+ };
2247
+ },
2248
+
2249
+ toJSON(message: QueryTokenTransactionsRequest): unknown {
2250
+ const obj: any = {};
2251
+ if (message.outputIds?.length) {
2252
+ obj.outputIds = message.outputIds;
2253
+ }
2254
+ if (message.ownerPublicKeys?.length) {
2255
+ obj.ownerPublicKeys = message.ownerPublicKeys.map((e) => base64FromBytes(e));
2256
+ }
2257
+ if (message.issuerPublicKeys?.length) {
2258
+ obj.issuerPublicKeys = message.issuerPublicKeys.map((e) => base64FromBytes(e));
2259
+ }
2260
+ if (message.tokenIdentifiers?.length) {
2261
+ obj.tokenIdentifiers = message.tokenIdentifiers.map((e) => base64FromBytes(e));
2262
+ }
2263
+ if (message.tokenTransactionHashes?.length) {
2264
+ obj.tokenTransactionHashes = message.tokenTransactionHashes.map((e) => base64FromBytes(e));
2265
+ }
2266
+ if (message.limit !== 0) {
2267
+ obj.limit = Math.round(message.limit);
2268
+ }
2269
+ if (message.offset !== 0) {
2270
+ obj.offset = Math.round(message.offset);
2271
+ }
2272
+ return obj;
2273
+ },
2274
+
2275
+ create(base?: DeepPartial<QueryTokenTransactionsRequest>): QueryTokenTransactionsRequest {
2276
+ return QueryTokenTransactionsRequest.fromPartial(base ?? {});
2277
+ },
2278
+ fromPartial(object: DeepPartial<QueryTokenTransactionsRequest>): QueryTokenTransactionsRequest {
2279
+ const message = createBaseQueryTokenTransactionsRequest();
2280
+ message.outputIds = object.outputIds?.map((e) => e) || [];
2281
+ message.ownerPublicKeys = object.ownerPublicKeys?.map((e) => e) || [];
2282
+ message.issuerPublicKeys = object.issuerPublicKeys?.map((e) => e) || [];
2283
+ message.tokenIdentifiers = object.tokenIdentifiers?.map((e) => e) || [];
2284
+ message.tokenTransactionHashes = object.tokenTransactionHashes?.map((e) => e) || [];
2285
+ message.limit = object.limit ?? 0;
2286
+ message.offset = object.offset ?? 0;
2287
+ return message;
2288
+ },
2289
+ };
2290
+
2291
+ function createBaseQueryTokenTransactionsResponse(): QueryTokenTransactionsResponse {
2292
+ return { tokenTransactionsWithStatus: [], offset: 0 };
2293
+ }
2294
+
2295
+ export const QueryTokenTransactionsResponse: MessageFns<QueryTokenTransactionsResponse> = {
2296
+ encode(message: QueryTokenTransactionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2297
+ for (const v of message.tokenTransactionsWithStatus) {
2298
+ TokenTransactionWithStatus.encode(v!, writer.uint32(10).fork()).join();
2299
+ }
2300
+ if (message.offset !== 0) {
2301
+ writer.uint32(16).int64(message.offset);
2302
+ }
2303
+ return writer;
2304
+ },
2305
+
2306
+ decode(input: BinaryReader | Uint8Array, length?: number): QueryTokenTransactionsResponse {
2307
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2308
+ const end = length === undefined ? reader.len : reader.pos + length;
2309
+ const message = createBaseQueryTokenTransactionsResponse();
2310
+ while (reader.pos < end) {
2311
+ const tag = reader.uint32();
2312
+ switch (tag >>> 3) {
2313
+ case 1: {
2314
+ if (tag !== 10) {
2315
+ break;
2316
+ }
2317
+
2318
+ message.tokenTransactionsWithStatus.push(TokenTransactionWithStatus.decode(reader, reader.uint32()));
2319
+ continue;
2320
+ }
2321
+ case 2: {
2322
+ if (tag !== 16) {
2323
+ break;
2324
+ }
2325
+
2326
+ message.offset = longToNumber(reader.int64());
2327
+ continue;
2328
+ }
2329
+ }
2330
+ if ((tag & 7) === 4 || tag === 0) {
2331
+ break;
2332
+ }
2333
+ reader.skip(tag & 7);
2334
+ }
2335
+ return message;
2336
+ },
2337
+
2338
+ fromJSON(object: any): QueryTokenTransactionsResponse {
2339
+ return {
2340
+ tokenTransactionsWithStatus: globalThis.Array.isArray(object?.tokenTransactionsWithStatus)
2341
+ ? object.tokenTransactionsWithStatus.map((e: any) => TokenTransactionWithStatus.fromJSON(e))
2342
+ : [],
2343
+ offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0,
2344
+ };
2345
+ },
2346
+
2347
+ toJSON(message: QueryTokenTransactionsResponse): unknown {
2348
+ const obj: any = {};
2349
+ if (message.tokenTransactionsWithStatus?.length) {
2350
+ obj.tokenTransactionsWithStatus = message.tokenTransactionsWithStatus.map((e) =>
2351
+ TokenTransactionWithStatus.toJSON(e)
2352
+ );
2353
+ }
2354
+ if (message.offset !== 0) {
2355
+ obj.offset = Math.round(message.offset);
2356
+ }
2357
+ return obj;
2358
+ },
2359
+
2360
+ create(base?: DeepPartial<QueryTokenTransactionsResponse>): QueryTokenTransactionsResponse {
2361
+ return QueryTokenTransactionsResponse.fromPartial(base ?? {});
2362
+ },
2363
+ fromPartial(object: DeepPartial<QueryTokenTransactionsResponse>): QueryTokenTransactionsResponse {
2364
+ const message = createBaseQueryTokenTransactionsResponse();
2365
+ message.tokenTransactionsWithStatus =
2366
+ object.tokenTransactionsWithStatus?.map((e) => TokenTransactionWithStatus.fromPartial(e)) || [];
2367
+ message.offset = object.offset ?? 0;
2368
+ return message;
2369
+ },
2370
+ };
2371
+
2372
+ function createBaseOutputWithPreviousTransactionData(): OutputWithPreviousTransactionData {
2373
+ return { output: undefined, previousTransactionHash: new Uint8Array(0), previousTransactionVout: 0 };
2374
+ }
2375
+
2376
+ export const OutputWithPreviousTransactionData: MessageFns<OutputWithPreviousTransactionData> = {
2377
+ encode(message: OutputWithPreviousTransactionData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2378
+ if (message.output !== undefined) {
2379
+ TokenOutput.encode(message.output, writer.uint32(10).fork()).join();
2380
+ }
2381
+ if (message.previousTransactionHash.length !== 0) {
2382
+ writer.uint32(18).bytes(message.previousTransactionHash);
2383
+ }
2384
+ if (message.previousTransactionVout !== 0) {
2385
+ writer.uint32(24).uint32(message.previousTransactionVout);
2386
+ }
2387
+ return writer;
2388
+ },
2389
+
2390
+ decode(input: BinaryReader | Uint8Array, length?: number): OutputWithPreviousTransactionData {
2391
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2392
+ const end = length === undefined ? reader.len : reader.pos + length;
2393
+ const message = createBaseOutputWithPreviousTransactionData();
2394
+ while (reader.pos < end) {
2395
+ const tag = reader.uint32();
2396
+ switch (tag >>> 3) {
2397
+ case 1: {
2398
+ if (tag !== 10) {
2399
+ break;
2400
+ }
2401
+
2402
+ message.output = TokenOutput.decode(reader, reader.uint32());
2403
+ continue;
2404
+ }
2405
+ case 2: {
2406
+ if (tag !== 18) {
2407
+ break;
2408
+ }
2409
+
2410
+ message.previousTransactionHash = reader.bytes();
2411
+ continue;
2412
+ }
2413
+ case 3: {
2414
+ if (tag !== 24) {
2415
+ break;
2416
+ }
2417
+
2418
+ message.previousTransactionVout = reader.uint32();
2419
+ continue;
2420
+ }
2421
+ }
2422
+ if ((tag & 7) === 4 || tag === 0) {
2423
+ break;
2424
+ }
2425
+ reader.skip(tag & 7);
2426
+ }
2427
+ return message;
2428
+ },
2429
+
2430
+ fromJSON(object: any): OutputWithPreviousTransactionData {
2431
+ return {
2432
+ output: isSet(object.output) ? TokenOutput.fromJSON(object.output) : undefined,
2433
+ previousTransactionHash: isSet(object.previousTransactionHash)
2434
+ ? bytesFromBase64(object.previousTransactionHash)
2435
+ : new Uint8Array(0),
2436
+ previousTransactionVout: isSet(object.previousTransactionVout)
2437
+ ? globalThis.Number(object.previousTransactionVout)
2438
+ : 0,
2439
+ };
2440
+ },
2441
+
2442
+ toJSON(message: OutputWithPreviousTransactionData): unknown {
2443
+ const obj: any = {};
2444
+ if (message.output !== undefined) {
2445
+ obj.output = TokenOutput.toJSON(message.output);
2446
+ }
2447
+ if (message.previousTransactionHash.length !== 0) {
2448
+ obj.previousTransactionHash = base64FromBytes(message.previousTransactionHash);
2449
+ }
2450
+ if (message.previousTransactionVout !== 0) {
2451
+ obj.previousTransactionVout = Math.round(message.previousTransactionVout);
2452
+ }
2453
+ return obj;
2454
+ },
2455
+
2456
+ create(base?: DeepPartial<OutputWithPreviousTransactionData>): OutputWithPreviousTransactionData {
2457
+ return OutputWithPreviousTransactionData.fromPartial(base ?? {});
2458
+ },
2459
+ fromPartial(object: DeepPartial<OutputWithPreviousTransactionData>): OutputWithPreviousTransactionData {
2460
+ const message = createBaseOutputWithPreviousTransactionData();
2461
+ message.output = (object.output !== undefined && object.output !== null)
2462
+ ? TokenOutput.fromPartial(object.output)
2463
+ : undefined;
2464
+ message.previousTransactionHash = object.previousTransactionHash ?? new Uint8Array(0);
2465
+ message.previousTransactionVout = object.previousTransactionVout ?? 0;
2466
+ return message;
2467
+ },
2468
+ };
2469
+
2470
+ function createBaseQueryTokenOutputsResponse(): QueryTokenOutputsResponse {
2471
+ return { outputsWithPreviousTransactionData: [] };
2472
+ }
2473
+
2474
+ export const QueryTokenOutputsResponse: MessageFns<QueryTokenOutputsResponse> = {
2475
+ encode(message: QueryTokenOutputsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2476
+ for (const v of message.outputsWithPreviousTransactionData) {
2477
+ OutputWithPreviousTransactionData.encode(v!, writer.uint32(10).fork()).join();
2478
+ }
2479
+ return writer;
2480
+ },
2481
+
2482
+ decode(input: BinaryReader | Uint8Array, length?: number): QueryTokenOutputsResponse {
2483
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2484
+ const end = length === undefined ? reader.len : reader.pos + length;
2485
+ const message = createBaseQueryTokenOutputsResponse();
2486
+ while (reader.pos < end) {
2487
+ const tag = reader.uint32();
2488
+ switch (tag >>> 3) {
2489
+ case 1: {
2490
+ if (tag !== 10) {
2491
+ break;
2492
+ }
2493
+
2494
+ message.outputsWithPreviousTransactionData.push(
2495
+ OutputWithPreviousTransactionData.decode(reader, reader.uint32()),
2496
+ );
2497
+ continue;
2498
+ }
2499
+ }
2500
+ if ((tag & 7) === 4 || tag === 0) {
2501
+ break;
2502
+ }
2503
+ reader.skip(tag & 7);
2504
+ }
2505
+ return message;
2506
+ },
2507
+
2508
+ fromJSON(object: any): QueryTokenOutputsResponse {
2509
+ return {
2510
+ outputsWithPreviousTransactionData: globalThis.Array.isArray(object?.outputsWithPreviousTransactionData)
2511
+ ? object.outputsWithPreviousTransactionData.map((e: any) => OutputWithPreviousTransactionData.fromJSON(e))
2512
+ : [],
2513
+ };
2514
+ },
2515
+
2516
+ toJSON(message: QueryTokenOutputsResponse): unknown {
2517
+ const obj: any = {};
2518
+ if (message.outputsWithPreviousTransactionData?.length) {
2519
+ obj.outputsWithPreviousTransactionData = message.outputsWithPreviousTransactionData.map((e) =>
2520
+ OutputWithPreviousTransactionData.toJSON(e)
2521
+ );
2522
+ }
2523
+ return obj;
2524
+ },
2525
+
2526
+ create(base?: DeepPartial<QueryTokenOutputsResponse>): QueryTokenOutputsResponse {
2527
+ return QueryTokenOutputsResponse.fromPartial(base ?? {});
2528
+ },
2529
+ fromPartial(object: DeepPartial<QueryTokenOutputsResponse>): QueryTokenOutputsResponse {
2530
+ const message = createBaseQueryTokenOutputsResponse();
2531
+ message.outputsWithPreviousTransactionData =
2532
+ object.outputsWithPreviousTransactionData?.map((e) => OutputWithPreviousTransactionData.fromPartial(e)) || [];
2533
+ return message;
2534
+ },
2535
+ };
2536
+
2537
+ function createBaseSpentTokenOutputMetadata(): SpentTokenOutputMetadata {
2538
+ return { outputId: "", revocationSecret: new Uint8Array(0) };
2539
+ }
2540
+
2541
+ export const SpentTokenOutputMetadata: MessageFns<SpentTokenOutputMetadata> = {
2542
+ encode(message: SpentTokenOutputMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2543
+ if (message.outputId !== "") {
2544
+ writer.uint32(10).string(message.outputId);
2545
+ }
2546
+ if (message.revocationSecret.length !== 0) {
2547
+ writer.uint32(18).bytes(message.revocationSecret);
2548
+ }
2549
+ return writer;
2550
+ },
2551
+
2552
+ decode(input: BinaryReader | Uint8Array, length?: number): SpentTokenOutputMetadata {
2553
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2554
+ const end = length === undefined ? reader.len : reader.pos + length;
2555
+ const message = createBaseSpentTokenOutputMetadata();
2556
+ while (reader.pos < end) {
2557
+ const tag = reader.uint32();
2558
+ switch (tag >>> 3) {
2559
+ case 1: {
2560
+ if (tag !== 10) {
2561
+ break;
2562
+ }
2563
+
2564
+ message.outputId = reader.string();
2565
+ continue;
2566
+ }
2567
+ case 2: {
2568
+ if (tag !== 18) {
2569
+ break;
2570
+ }
2571
+
2572
+ message.revocationSecret = reader.bytes();
2573
+ continue;
2574
+ }
2575
+ }
2576
+ if ((tag & 7) === 4 || tag === 0) {
2577
+ break;
2578
+ }
2579
+ reader.skip(tag & 7);
2580
+ }
2581
+ return message;
2582
+ },
2583
+
2584
+ fromJSON(object: any): SpentTokenOutputMetadata {
2585
+ return {
2586
+ outputId: isSet(object.outputId) ? globalThis.String(object.outputId) : "",
2587
+ revocationSecret: isSet(object.revocationSecret) ? bytesFromBase64(object.revocationSecret) : new Uint8Array(0),
2588
+ };
2589
+ },
2590
+
2591
+ toJSON(message: SpentTokenOutputMetadata): unknown {
2592
+ const obj: any = {};
2593
+ if (message.outputId !== "") {
2594
+ obj.outputId = message.outputId;
2595
+ }
2596
+ if (message.revocationSecret.length !== 0) {
2597
+ obj.revocationSecret = base64FromBytes(message.revocationSecret);
2598
+ }
2599
+ return obj;
2600
+ },
2601
+
2602
+ create(base?: DeepPartial<SpentTokenOutputMetadata>): SpentTokenOutputMetadata {
2603
+ return SpentTokenOutputMetadata.fromPartial(base ?? {});
2604
+ },
2605
+ fromPartial(object: DeepPartial<SpentTokenOutputMetadata>): SpentTokenOutputMetadata {
2606
+ const message = createBaseSpentTokenOutputMetadata();
2607
+ message.outputId = object.outputId ?? "";
2608
+ message.revocationSecret = object.revocationSecret ?? new Uint8Array(0);
2609
+ return message;
2610
+ },
2611
+ };
2612
+
2613
+ function createBaseTokenTransactionConfirmationMetadata(): TokenTransactionConfirmationMetadata {
2614
+ return { spentTokenOutputsMetadata: [] };
2615
+ }
2616
+
2617
+ export const TokenTransactionConfirmationMetadata: MessageFns<TokenTransactionConfirmationMetadata> = {
2618
+ encode(message: TokenTransactionConfirmationMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2619
+ for (const v of message.spentTokenOutputsMetadata) {
2620
+ SpentTokenOutputMetadata.encode(v!, writer.uint32(10).fork()).join();
2621
+ }
2622
+ return writer;
2623
+ },
2624
+
2625
+ decode(input: BinaryReader | Uint8Array, length?: number): TokenTransactionConfirmationMetadata {
2626
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2627
+ const end = length === undefined ? reader.len : reader.pos + length;
2628
+ const message = createBaseTokenTransactionConfirmationMetadata();
2629
+ while (reader.pos < end) {
2630
+ const tag = reader.uint32();
2631
+ switch (tag >>> 3) {
2632
+ case 1: {
2633
+ if (tag !== 10) {
2634
+ break;
2635
+ }
2636
+
2637
+ message.spentTokenOutputsMetadata.push(SpentTokenOutputMetadata.decode(reader, reader.uint32()));
2638
+ continue;
2639
+ }
2640
+ }
2641
+ if ((tag & 7) === 4 || tag === 0) {
2642
+ break;
2643
+ }
2644
+ reader.skip(tag & 7);
2645
+ }
2646
+ return message;
2647
+ },
2648
+
2649
+ fromJSON(object: any): TokenTransactionConfirmationMetadata {
2650
+ return {
2651
+ spentTokenOutputsMetadata: globalThis.Array.isArray(object?.spentTokenOutputsMetadata)
2652
+ ? object.spentTokenOutputsMetadata.map((e: any) => SpentTokenOutputMetadata.fromJSON(e))
2653
+ : [],
2654
+ };
2655
+ },
2656
+
2657
+ toJSON(message: TokenTransactionConfirmationMetadata): unknown {
2658
+ const obj: any = {};
2659
+ if (message.spentTokenOutputsMetadata?.length) {
2660
+ obj.spentTokenOutputsMetadata = message.spentTokenOutputsMetadata.map((e) => SpentTokenOutputMetadata.toJSON(e));
2661
+ }
2662
+ return obj;
2663
+ },
2664
+
2665
+ create(base?: DeepPartial<TokenTransactionConfirmationMetadata>): TokenTransactionConfirmationMetadata {
2666
+ return TokenTransactionConfirmationMetadata.fromPartial(base ?? {});
2667
+ },
2668
+ fromPartial(object: DeepPartial<TokenTransactionConfirmationMetadata>): TokenTransactionConfirmationMetadata {
2669
+ const message = createBaseTokenTransactionConfirmationMetadata();
2670
+ message.spentTokenOutputsMetadata =
2671
+ object.spentTokenOutputsMetadata?.map((e) => SpentTokenOutputMetadata.fromPartial(e)) || [];
2672
+ return message;
2673
+ },
2674
+ };
2675
+
2676
+ function createBaseTokenTransactionWithStatus(): TokenTransactionWithStatus {
2677
+ return { tokenTransaction: undefined, status: 0, confirmationMetadata: undefined };
2678
+ }
2679
+
2680
+ export const TokenTransactionWithStatus: MessageFns<TokenTransactionWithStatus> = {
2681
+ encode(message: TokenTransactionWithStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2682
+ if (message.tokenTransaction !== undefined) {
2683
+ TokenTransaction.encode(message.tokenTransaction, writer.uint32(10).fork()).join();
2684
+ }
2685
+ if (message.status !== 0) {
2686
+ writer.uint32(16).int32(message.status);
2687
+ }
2688
+ if (message.confirmationMetadata !== undefined) {
2689
+ TokenTransactionConfirmationMetadata.encode(message.confirmationMetadata, writer.uint32(26).fork()).join();
2690
+ }
2691
+ return writer;
2692
+ },
2693
+
2694
+ decode(input: BinaryReader | Uint8Array, length?: number): TokenTransactionWithStatus {
2695
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2696
+ const end = length === undefined ? reader.len : reader.pos + length;
2697
+ const message = createBaseTokenTransactionWithStatus();
2698
+ while (reader.pos < end) {
2699
+ const tag = reader.uint32();
2700
+ switch (tag >>> 3) {
2701
+ case 1: {
2702
+ if (tag !== 10) {
2703
+ break;
2704
+ }
2705
+
2706
+ message.tokenTransaction = TokenTransaction.decode(reader, reader.uint32());
2707
+ continue;
2708
+ }
2709
+ case 2: {
2710
+ if (tag !== 16) {
2711
+ break;
2712
+ }
2713
+
2714
+ message.status = reader.int32() as any;
2715
+ continue;
2716
+ }
2717
+ case 3: {
2718
+ if (tag !== 26) {
2719
+ break;
2720
+ }
2721
+
2722
+ message.confirmationMetadata = TokenTransactionConfirmationMetadata.decode(reader, reader.uint32());
2723
+ continue;
2724
+ }
2725
+ }
2726
+ if ((tag & 7) === 4 || tag === 0) {
2727
+ break;
2728
+ }
2729
+ reader.skip(tag & 7);
2730
+ }
2731
+ return message;
2732
+ },
2733
+
2734
+ fromJSON(object: any): TokenTransactionWithStatus {
2735
+ return {
2736
+ tokenTransaction: isSet(object.tokenTransaction) ? TokenTransaction.fromJSON(object.tokenTransaction) : undefined,
2737
+ status: isSet(object.status) ? tokenTransactionStatusFromJSON(object.status) : 0,
2738
+ confirmationMetadata: isSet(object.confirmationMetadata)
2739
+ ? TokenTransactionConfirmationMetadata.fromJSON(object.confirmationMetadata)
2740
+ : undefined,
2741
+ };
2742
+ },
2743
+
2744
+ toJSON(message: TokenTransactionWithStatus): unknown {
2745
+ const obj: any = {};
2746
+ if (message.tokenTransaction !== undefined) {
2747
+ obj.tokenTransaction = TokenTransaction.toJSON(message.tokenTransaction);
2748
+ }
2749
+ if (message.status !== 0) {
2750
+ obj.status = tokenTransactionStatusToJSON(message.status);
2751
+ }
2752
+ if (message.confirmationMetadata !== undefined) {
2753
+ obj.confirmationMetadata = TokenTransactionConfirmationMetadata.toJSON(message.confirmationMetadata);
2754
+ }
2755
+ return obj;
2756
+ },
2757
+
2758
+ create(base?: DeepPartial<TokenTransactionWithStatus>): TokenTransactionWithStatus {
2759
+ return TokenTransactionWithStatus.fromPartial(base ?? {});
2760
+ },
2761
+ fromPartial(object: DeepPartial<TokenTransactionWithStatus>): TokenTransactionWithStatus {
2762
+ const message = createBaseTokenTransactionWithStatus();
2763
+ message.tokenTransaction = (object.tokenTransaction !== undefined && object.tokenTransaction !== null)
2764
+ ? TokenTransaction.fromPartial(object.tokenTransaction)
2765
+ : undefined;
2766
+ message.status = object.status ?? 0;
2767
+ message.confirmationMetadata = (object.confirmationMetadata !== undefined && object.confirmationMetadata !== null)
2768
+ ? TokenTransactionConfirmationMetadata.fromPartial(object.confirmationMetadata)
2769
+ : undefined;
2770
+ return message;
2771
+ },
2772
+ };
2773
+
2774
+ export type SparkTokenServiceDefinition = typeof SparkTokenServiceDefinition;
2775
+ export const SparkTokenServiceDefinition = {
2776
+ name: "SparkTokenService",
2777
+ fullName: "spark_token.SparkTokenService",
2778
+ methods: {
2779
+ /**
2780
+ * Start process to create final token transaction with all inputs required
2781
+ * from user and SOs (including revocation secret commitment)
2782
+ */
2783
+ start_transaction: {
2784
+ name: "start_transaction",
2785
+ requestType: StartTransactionRequest,
2786
+ requestStream: false,
2787
+ responseType: StartTransactionResponse,
2788
+ responseStream: false,
2789
+ options: {},
2790
+ },
2791
+ /**
2792
+ * Complete the transaction and commit it with all SOs. This will be
2793
+ * coordinated by one SO.
2794
+ */
2795
+ commit_transaction: {
2796
+ name: "commit_transaction",
2797
+ requestType: CommitTransactionRequest,
2798
+ requestStream: false,
2799
+ responseType: CommitTransactionResponse,
2800
+ responseStream: false,
2801
+ options: {},
2802
+ },
2803
+ query_token_metadata: {
2804
+ name: "query_token_metadata",
2805
+ requestType: QueryTokenMetadataRequest,
2806
+ requestStream: false,
2807
+ responseType: QueryTokenMetadataResponse,
2808
+ responseStream: false,
2809
+ options: {},
2810
+ },
2811
+ query_token_transactions: {
2812
+ name: "query_token_transactions",
2813
+ requestType: QueryTokenTransactionsRequest,
2814
+ requestStream: false,
2815
+ responseType: QueryTokenTransactionsResponse,
2816
+ responseStream: false,
2817
+ options: {},
2818
+ },
2819
+ query_token_outputs: {
2820
+ name: "query_token_outputs",
2821
+ requestType: QueryTokenOutputsRequest,
2822
+ requestStream: false,
2823
+ responseType: QueryTokenOutputsResponse,
2824
+ responseStream: false,
2825
+ options: {},
2826
+ },
2827
+ },
2828
+ } as const;
2829
+
2830
+ export interface SparkTokenServiceImplementation<CallContextExt = {}> {
2831
+ /**
2832
+ * Start process to create final token transaction with all inputs required
2833
+ * from user and SOs (including revocation secret commitment)
2834
+ */
2835
+ start_transaction(
2836
+ request: StartTransactionRequest,
2837
+ context: CallContext & CallContextExt,
2838
+ ): Promise<DeepPartial<StartTransactionResponse>>;
2839
+ /**
2840
+ * Complete the transaction and commit it with all SOs. This will be
2841
+ * coordinated by one SO.
2842
+ */
2843
+ commit_transaction(
2844
+ request: CommitTransactionRequest,
2845
+ context: CallContext & CallContextExt,
2846
+ ): Promise<DeepPartial<CommitTransactionResponse>>;
2847
+ query_token_metadata(
2848
+ request: QueryTokenMetadataRequest,
2849
+ context: CallContext & CallContextExt,
2850
+ ): Promise<DeepPartial<QueryTokenMetadataResponse>>;
2851
+ query_token_transactions(
2852
+ request: QueryTokenTransactionsRequest,
2853
+ context: CallContext & CallContextExt,
2854
+ ): Promise<DeepPartial<QueryTokenTransactionsResponse>>;
2855
+ query_token_outputs(
2856
+ request: QueryTokenOutputsRequest,
2857
+ context: CallContext & CallContextExt,
2858
+ ): Promise<DeepPartial<QueryTokenOutputsResponse>>;
2859
+ }
2860
+
2861
+ export interface SparkTokenServiceClient<CallOptionsExt = {}> {
2862
+ /**
2863
+ * Start process to create final token transaction with all inputs required
2864
+ * from user and SOs (including revocation secret commitment)
2865
+ */
2866
+ start_transaction(
2867
+ request: DeepPartial<StartTransactionRequest>,
2868
+ options?: CallOptions & CallOptionsExt,
2869
+ ): Promise<StartTransactionResponse>;
2870
+ /**
2871
+ * Complete the transaction and commit it with all SOs. This will be
2872
+ * coordinated by one SO.
1322
2873
  */
1323
2874
  commit_transaction(
1324
2875
  request: DeepPartial<CommitTransactionRequest>,
1325
2876
  options?: CallOptions & CallOptionsExt,
1326
2877
  ): Promise<CommitTransactionResponse>;
2878
+ query_token_metadata(
2879
+ request: DeepPartial<QueryTokenMetadataRequest>,
2880
+ options?: CallOptions & CallOptionsExt,
2881
+ ): Promise<QueryTokenMetadataResponse>;
2882
+ query_token_transactions(
2883
+ request: DeepPartial<QueryTokenTransactionsRequest>,
2884
+ options?: CallOptions & CallOptionsExt,
2885
+ ): Promise<QueryTokenTransactionsResponse>;
2886
+ query_token_outputs(
2887
+ request: DeepPartial<QueryTokenOutputsRequest>,
2888
+ options?: CallOptions & CallOptionsExt,
2889
+ ): Promise<QueryTokenOutputsResponse>;
1327
2890
  }
1328
2891
 
1329
2892
  function bytesFromBase64(b64: string): Uint8Array {