@buildonspark/spark-sdk 0.1.45 → 0.1.47

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 (146) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/{chunk-I54FARY2.js → chunk-EAP3U3CW.js} +14 -14
  3. package/dist/chunk-GWFQ7EBA.js +3773 -0
  4. package/dist/{chunk-J2IE4Z7Y.js → chunk-NNX4OK44.js} +3487 -934
  5. package/dist/{RequestLightningSendInput-Du0z7Om7.d.cts → client-CvpTRpcw.d.cts} +422 -212
  6. package/dist/{RequestLightningSendInput-DEPd_fPO.d.ts → client-D7KgLN44.d.ts} +422 -212
  7. package/dist/graphql/objects/index.d.cts +5 -9
  8. package/dist/graphql/objects/index.d.ts +5 -9
  9. package/dist/graphql/objects/index.js +1 -1
  10. package/dist/index.cjs +20461 -23377
  11. package/dist/index.d.cts +15 -769
  12. package/dist/index.d.ts +15 -769
  13. package/dist/index.js +81 -71
  14. package/dist/index.node.cjs +21994 -25018
  15. package/dist/index.node.d.cts +312 -34
  16. package/dist/index.node.d.ts +312 -34
  17. package/dist/index.node.js +82 -176
  18. package/dist/native/index.cjs +22847 -25841
  19. package/dist/native/index.d.cts +974 -1138
  20. package/dist/native/index.d.ts +974 -1138
  21. package/dist/native/index.js +10604 -13592
  22. package/dist/proto/lrc20.d.cts +2 -2
  23. package/dist/proto/lrc20.d.ts +2 -2
  24. package/dist/proto/lrc20.js +3098 -46
  25. package/dist/proto/spark.d.cts +1 -1
  26. package/dist/proto/spark.d.ts +1 -1
  27. package/dist/proto/spark_token.d.cts +1 -1
  28. package/dist/proto/spark_token.d.ts +1 -1
  29. package/dist/{sdk-types-Cc4l4kb1.d.ts → sdk-types-BGCeea0G.d.ts} +1 -1
  30. package/dist/{sdk-types-B0SwjolI.d.cts → sdk-types-XUeQMLFP.d.cts} +1 -1
  31. package/dist/{spark-dM7EYXYQ.d.cts → spark-BbUrbvZz.d.cts} +1 -1
  32. package/dist/{spark-dM7EYXYQ.d.ts → spark-BbUrbvZz.d.ts} +1 -1
  33. package/dist/spark-wallet-BAFPpPtY.d.cts +923 -0
  34. package/dist/spark-wallet-CJkQW8pK.d.ts +923 -0
  35. package/dist/spark_bindings/native/index.d.cts +1 -1
  36. package/dist/spark_bindings/native/index.d.ts +1 -1
  37. package/dist/spark_bindings/wasm/index.d.cts +1 -1
  38. package/dist/spark_bindings/wasm/index.d.ts +1 -1
  39. package/dist/{services/index.cjs → tests/test-utils.cjs} +2512 -4380
  40. package/dist/tests/test-utils.d.cts +79 -0
  41. package/dist/tests/test-utils.d.ts +79 -0
  42. package/dist/tests/test-utils.js +85 -0
  43. package/dist/types/index.d.cts +5 -9
  44. package/dist/types/index.d.ts +5 -9
  45. package/dist/types/index.js +5 -5
  46. package/dist/{types-C-Rp0Oo7.d.cts → types-BADxR3bm.d.cts} +1 -1
  47. package/dist/{types-C-Rp0Oo7.d.ts → types-BADxR3bm.d.ts} +1 -1
  48. package/package.json +7 -35
  49. package/src/graphql/client.ts +59 -20
  50. package/src/index.node.ts +28 -2
  51. package/src/index.ts +31 -1
  52. package/src/native/index.ts +16 -2
  53. package/src/services/config.ts +4 -6
  54. package/src/services/connection.ts +131 -64
  55. package/src/services/lightning.ts +1 -2
  56. package/src/services/token-transactions.ts +7 -7
  57. package/src/services/transfer.ts +1 -1
  58. package/src/services/tree-creation.ts +1 -1
  59. package/src/services/wallet-config.ts +18 -10
  60. package/src/signer/signer.react-native.ts +2 -5
  61. package/src/signer/signer.ts +138 -64
  62. package/src/signer/types.ts +52 -0
  63. package/src/spark-wallet/spark-wallet.ts +79 -36
  64. package/src/spark-wallet/types.ts +4 -4
  65. package/src/tests/integration/coop-exit.test.ts +2 -1
  66. package/src/tests/integration/lightning.test.ts +2 -2
  67. package/src/tests/integration/swap.test.ts +1 -1
  68. package/src/tests/integration/transfer.test.ts +5 -5
  69. package/src/tests/integration/tree-creation.test.ts +1 -1
  70. package/src/tests/integration/wallet.test.ts +1 -0
  71. package/src/tests/isHermeticTest.ts +3 -24
  72. package/src/tests/{test-util.ts → test-utils.ts} +3 -7
  73. package/src/tests/wrapWithOtelSpan.test.ts +1 -1
  74. package/src/{address → utils}/address.ts +1 -1
  75. package/src/utils/crypto.ts +19 -9
  76. package/src/utils/index.ts +2 -0
  77. package/src/utils/network.ts +17 -0
  78. package/src/utils/secret-sharing.ts +1 -2
  79. package/src/utils/signing.ts +1 -1
  80. package/src/utils/token-transactions.ts +3 -3
  81. package/src/utils/unilateral-exit.ts +32 -0
  82. package/src/utils/xchain-address.ts +1 -1
  83. package/dist/BitcoinNetwork-TnABML0T.d.cts +0 -18
  84. package/dist/BitcoinNetwork-TnABML0T.d.ts +0 -18
  85. package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.cts +0 -10
  86. package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.ts +0 -10
  87. package/dist/address/index.cjs +0 -458
  88. package/dist/address/index.d.cts +0 -32
  89. package/dist/address/index.d.ts +0 -32
  90. package/dist/address/index.js +0 -17
  91. package/dist/chunk-5FUB65LX.js +0 -838
  92. package/dist/chunk-6264CGDM.js +0 -113
  93. package/dist/chunk-7V6N75CC.js +0 -24
  94. package/dist/chunk-C2S227QR.js +0 -2336
  95. package/dist/chunk-GSI4OLXZ.js +0 -117
  96. package/dist/chunk-GZ5IPPJ2.js +0 -170
  97. package/dist/chunk-HWJWKEIU.js +0 -75
  98. package/dist/chunk-KMUMFYFX.js +0 -137
  99. package/dist/chunk-L3EHBOUX.js +0 -0
  100. package/dist/chunk-NSJF5F5O.js +0 -325
  101. package/dist/chunk-NTFKFRQ2.js +0 -3146
  102. package/dist/chunk-PQN3C2MF.js +0 -1122
  103. package/dist/chunk-QNNSEJ4P.js +0 -232
  104. package/dist/chunk-R5PXJZQS.js +0 -277
  105. package/dist/chunk-VTUGIIWI.js +0 -0
  106. package/dist/chunk-YUPMXTCJ.js +0 -622
  107. package/dist/chunk-Z5HIAYFT.js +0 -84
  108. package/dist/index-B2AwKW5J.d.cts +0 -214
  109. package/dist/index-CJDi1HWc.d.ts +0 -214
  110. package/dist/network-BTJl-Sul.d.ts +0 -46
  111. package/dist/network-CqgsdUF2.d.cts +0 -46
  112. package/dist/services/config.cjs +0 -2354
  113. package/dist/services/config.d.cts +0 -42
  114. package/dist/services/config.d.ts +0 -42
  115. package/dist/services/config.js +0 -17
  116. package/dist/services/connection.cjs +0 -17691
  117. package/dist/services/connection.d.cts +0 -95
  118. package/dist/services/connection.d.ts +0 -95
  119. package/dist/services/connection.js +0 -11
  120. package/dist/services/index.d.cts +0 -21
  121. package/dist/services/index.d.ts +0 -21
  122. package/dist/services/index.js +0 -58
  123. package/dist/services/lrc-connection.cjs +0 -4713
  124. package/dist/services/lrc-connection.d.cts +0 -34
  125. package/dist/services/lrc-connection.d.ts +0 -34
  126. package/dist/services/lrc-connection.js +0 -11
  127. package/dist/services/token-transactions.cjs +0 -2877
  128. package/dist/services/token-transactions.d.cts +0 -75
  129. package/dist/services/token-transactions.d.ts +0 -75
  130. package/dist/services/token-transactions.js +0 -15
  131. package/dist/services/wallet-config.cjs +0 -340
  132. package/dist/services/wallet-config.d.cts +0 -56
  133. package/dist/services/wallet-config.d.ts +0 -56
  134. package/dist/services/wallet-config.js +0 -33
  135. package/dist/signer/signer.cjs +0 -2004
  136. package/dist/signer/signer.d.cts +0 -10
  137. package/dist/signer/signer.d.ts +0 -10
  138. package/dist/signer/signer.js +0 -24
  139. package/dist/signer-BocS_J6B.d.ts +0 -187
  140. package/dist/signer-DKS0AJkw.d.cts +0 -187
  141. package/dist/utils/index.cjs +0 -2947
  142. package/dist/utils/index.d.cts +0 -18
  143. package/dist/utils/index.d.ts +0 -18
  144. package/dist/utils/index.js +0 -157
  145. package/src/address/index.ts +0 -1
  146. package/src/services/lrc-connection.ts +0 -215
@@ -1,3146 +0,0 @@
1
- import {
2
- Empty,
3
- OperatorSpecificOwnerSignature,
4
- RevocationSecretWithIndex,
5
- Timestamp,
6
- TokenTransaction
7
- } from "./chunk-BGGEVUJK.js";
8
-
9
- // src/proto/lrc20.ts
10
- import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
11
- var protobufPackage = "rpc.v1";
12
- var Layer = /* @__PURE__ */ ((Layer2) => {
13
- Layer2[Layer2["L1"] = 0] = "L1";
14
- Layer2[Layer2["SPARK"] = 1] = "SPARK";
15
- Layer2[Layer2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
16
- return Layer2;
17
- })(Layer || {});
18
- function layerFromJSON(object) {
19
- switch (object) {
20
- case 0:
21
- case "L1":
22
- return 0 /* L1 */;
23
- case 1:
24
- case "SPARK":
25
- return 1 /* SPARK */;
26
- case -1:
27
- case "UNRECOGNIZED":
28
- default:
29
- return -1 /* UNRECOGNIZED */;
30
- }
31
- }
32
- function layerToJSON(object) {
33
- switch (object) {
34
- case 0 /* L1 */:
35
- return "L1";
36
- case 1 /* SPARK */:
37
- return "SPARK";
38
- case -1 /* UNRECOGNIZED */:
39
- default:
40
- return "UNRECOGNIZED";
41
- }
42
- }
43
- var OperationType = /* @__PURE__ */ ((OperationType2) => {
44
- OperationType2[OperationType2["USER_TRANSFER"] = 0] = "USER_TRANSFER";
45
- OperationType2[OperationType2["USER_BURN"] = 1] = "USER_BURN";
46
- OperationType2[OperationType2["ISSUER_ANNOUNCE"] = 2] = "ISSUER_ANNOUNCE";
47
- OperationType2[OperationType2["ISSUER_MINT"] = 3] = "ISSUER_MINT";
48
- OperationType2[OperationType2["ISSUER_TRANSFER"] = 4] = "ISSUER_TRANSFER";
49
- OperationType2[OperationType2["ISSUER_FREEZE"] = 5] = "ISSUER_FREEZE";
50
- OperationType2[OperationType2["ISSUER_UNFREEZE"] = 6] = "ISSUER_UNFREEZE";
51
- OperationType2[OperationType2["ISSUER_BURN"] = 7] = "ISSUER_BURN";
52
- OperationType2[OperationType2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
53
- return OperationType2;
54
- })(OperationType || {});
55
- function operationTypeFromJSON(object) {
56
- switch (object) {
57
- case 0:
58
- case "USER_TRANSFER":
59
- return 0 /* USER_TRANSFER */;
60
- case 1:
61
- case "USER_BURN":
62
- return 1 /* USER_BURN */;
63
- case 2:
64
- case "ISSUER_ANNOUNCE":
65
- return 2 /* ISSUER_ANNOUNCE */;
66
- case 3:
67
- case "ISSUER_MINT":
68
- return 3 /* ISSUER_MINT */;
69
- case 4:
70
- case "ISSUER_TRANSFER":
71
- return 4 /* ISSUER_TRANSFER */;
72
- case 5:
73
- case "ISSUER_FREEZE":
74
- return 5 /* ISSUER_FREEZE */;
75
- case 6:
76
- case "ISSUER_UNFREEZE":
77
- return 6 /* ISSUER_UNFREEZE */;
78
- case 7:
79
- case "ISSUER_BURN":
80
- return 7 /* ISSUER_BURN */;
81
- case -1:
82
- case "UNRECOGNIZED":
83
- default:
84
- return -1 /* UNRECOGNIZED */;
85
- }
86
- }
87
- function operationTypeToJSON(object) {
88
- switch (object) {
89
- case 0 /* USER_TRANSFER */:
90
- return "USER_TRANSFER";
91
- case 1 /* USER_BURN */:
92
- return "USER_BURN";
93
- case 2 /* ISSUER_ANNOUNCE */:
94
- return "ISSUER_ANNOUNCE";
95
- case 3 /* ISSUER_MINT */:
96
- return "ISSUER_MINT";
97
- case 4 /* ISSUER_TRANSFER */:
98
- return "ISSUER_TRANSFER";
99
- case 5 /* ISSUER_FREEZE */:
100
- return "ISSUER_FREEZE";
101
- case 6 /* ISSUER_UNFREEZE */:
102
- return "ISSUER_UNFREEZE";
103
- case 7 /* ISSUER_BURN */:
104
- return "ISSUER_BURN";
105
- case -1 /* UNRECOGNIZED */:
106
- default:
107
- return "UNRECOGNIZED";
108
- }
109
- }
110
- var OnChainTransactionStatus = /* @__PURE__ */ ((OnChainTransactionStatus2) => {
111
- OnChainTransactionStatus2[OnChainTransactionStatus2["PENDING"] = 0] = "PENDING";
112
- OnChainTransactionStatus2[OnChainTransactionStatus2["CONFIRMED"] = 1] = "CONFIRMED";
113
- OnChainTransactionStatus2[OnChainTransactionStatus2["WAITING_MINED"] = 2] = "WAITING_MINED";
114
- OnChainTransactionStatus2[OnChainTransactionStatus2["MINED"] = 3] = "MINED";
115
- OnChainTransactionStatus2[OnChainTransactionStatus2["ATTACHING"] = 4] = "ATTACHING";
116
- OnChainTransactionStatus2[OnChainTransactionStatus2["ATTACHED"] = 5] = "ATTACHED";
117
- OnChainTransactionStatus2[OnChainTransactionStatus2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
118
- return OnChainTransactionStatus2;
119
- })(OnChainTransactionStatus || {});
120
- function onChainTransactionStatusFromJSON(object) {
121
- switch (object) {
122
- case 0:
123
- case "PENDING":
124
- return 0 /* PENDING */;
125
- case 1:
126
- case "CONFIRMED":
127
- return 1 /* CONFIRMED */;
128
- case 2:
129
- case "WAITING_MINED":
130
- return 2 /* WAITING_MINED */;
131
- case 3:
132
- case "MINED":
133
- return 3 /* MINED */;
134
- case 4:
135
- case "ATTACHING":
136
- return 4 /* ATTACHING */;
137
- case 5:
138
- case "ATTACHED":
139
- return 5 /* ATTACHED */;
140
- case -1:
141
- case "UNRECOGNIZED":
142
- default:
143
- return -1 /* UNRECOGNIZED */;
144
- }
145
- }
146
- function onChainTransactionStatusToJSON(object) {
147
- switch (object) {
148
- case 0 /* PENDING */:
149
- return "PENDING";
150
- case 1 /* CONFIRMED */:
151
- return "CONFIRMED";
152
- case 2 /* WAITING_MINED */:
153
- return "WAITING_MINED";
154
- case 3 /* MINED */:
155
- return "MINED";
156
- case 4 /* ATTACHING */:
157
- return "ATTACHING";
158
- case 5 /* ATTACHED */:
159
- return "ATTACHED";
160
- case -1 /* UNRECOGNIZED */:
161
- default:
162
- return "UNRECOGNIZED";
163
- }
164
- }
165
- var SparkTransactionStatus = /* @__PURE__ */ ((SparkTransactionStatus2) => {
166
- SparkTransactionStatus2[SparkTransactionStatus2["STARTED"] = 0] = "STARTED";
167
- SparkTransactionStatus2[SparkTransactionStatus2["SIGNED"] = 1] = "SIGNED";
168
- SparkTransactionStatus2[SparkTransactionStatus2["FINALIZED"] = 2] = "FINALIZED";
169
- SparkTransactionStatus2[SparkTransactionStatus2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
170
- return SparkTransactionStatus2;
171
- })(SparkTransactionStatus || {});
172
- function sparkTransactionStatusFromJSON(object) {
173
- switch (object) {
174
- case 0:
175
- case "STARTED":
176
- return 0 /* STARTED */;
177
- case 1:
178
- case "SIGNED":
179
- return 1 /* SIGNED */;
180
- case 2:
181
- case "FINALIZED":
182
- return 2 /* FINALIZED */;
183
- case -1:
184
- case "UNRECOGNIZED":
185
- default:
186
- return -1 /* UNRECOGNIZED */;
187
- }
188
- }
189
- function sparkTransactionStatusToJSON(object) {
190
- switch (object) {
191
- case 0 /* STARTED */:
192
- return "STARTED";
193
- case 1 /* SIGNED */:
194
- return "SIGNED";
195
- case 2 /* FINALIZED */:
196
- return "FINALIZED";
197
- case -1 /* UNRECOGNIZED */:
198
- default:
199
- return "UNRECOGNIZED";
200
- }
201
- }
202
- function createBaseSendSparkSignatureRequest() {
203
- return {
204
- finalTokenTransaction: void 0,
205
- operatorSpecificSignatures: [],
206
- operatorSignatureData: void 0,
207
- revocationSecrets: []
208
- };
209
- }
210
- var SendSparkSignatureRequest = {
211
- encode(message, writer = new BinaryWriter()) {
212
- if (message.finalTokenTransaction !== void 0) {
213
- TokenTransaction.encode(message.finalTokenTransaction, writer.uint32(10).fork()).join();
214
- }
215
- for (const v of message.operatorSpecificSignatures) {
216
- OperatorSpecificOwnerSignature.encode(v, writer.uint32(18).fork()).join();
217
- }
218
- if (message.operatorSignatureData !== void 0) {
219
- SparkOperatorSignatureData.encode(message.operatorSignatureData, writer.uint32(26).fork()).join();
220
- }
221
- for (const v of message.revocationSecrets) {
222
- RevocationSecretWithIndex.encode(v, writer.uint32(34).fork()).join();
223
- }
224
- return writer;
225
- },
226
- decode(input, length) {
227
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
228
- let end = length === void 0 ? reader.len : reader.pos + length;
229
- const message = createBaseSendSparkSignatureRequest();
230
- while (reader.pos < end) {
231
- const tag = reader.uint32();
232
- switch (tag >>> 3) {
233
- case 1: {
234
- if (tag !== 10) {
235
- break;
236
- }
237
- message.finalTokenTransaction = TokenTransaction.decode(reader, reader.uint32());
238
- continue;
239
- }
240
- case 2: {
241
- if (tag !== 18) {
242
- break;
243
- }
244
- message.operatorSpecificSignatures.push(OperatorSpecificOwnerSignature.decode(reader, reader.uint32()));
245
- continue;
246
- }
247
- case 3: {
248
- if (tag !== 26) {
249
- break;
250
- }
251
- message.operatorSignatureData = SparkOperatorSignatureData.decode(reader, reader.uint32());
252
- continue;
253
- }
254
- case 4: {
255
- if (tag !== 34) {
256
- break;
257
- }
258
- message.revocationSecrets.push(RevocationSecretWithIndex.decode(reader, reader.uint32()));
259
- continue;
260
- }
261
- }
262
- if ((tag & 7) === 4 || tag === 0) {
263
- break;
264
- }
265
- reader.skip(tag & 7);
266
- }
267
- return message;
268
- },
269
- fromJSON(object) {
270
- return {
271
- finalTokenTransaction: isSet(object.finalTokenTransaction) ? TokenTransaction.fromJSON(object.finalTokenTransaction) : void 0,
272
- operatorSpecificSignatures: globalThis.Array.isArray(object?.operatorSpecificSignatures) ? object.operatorSpecificSignatures.map((e) => OperatorSpecificOwnerSignature.fromJSON(e)) : [],
273
- operatorSignatureData: isSet(object.operatorSignatureData) ? SparkOperatorSignatureData.fromJSON(object.operatorSignatureData) : void 0,
274
- revocationSecrets: globalThis.Array.isArray(object?.revocationSecrets) ? object.revocationSecrets.map((e) => RevocationSecretWithIndex.fromJSON(e)) : []
275
- };
276
- },
277
- toJSON(message) {
278
- const obj = {};
279
- if (message.finalTokenTransaction !== void 0) {
280
- obj.finalTokenTransaction = TokenTransaction.toJSON(message.finalTokenTransaction);
281
- }
282
- if (message.operatorSpecificSignatures?.length) {
283
- obj.operatorSpecificSignatures = message.operatorSpecificSignatures.map(
284
- (e) => OperatorSpecificOwnerSignature.toJSON(e)
285
- );
286
- }
287
- if (message.operatorSignatureData !== void 0) {
288
- obj.operatorSignatureData = SparkOperatorSignatureData.toJSON(message.operatorSignatureData);
289
- }
290
- if (message.revocationSecrets?.length) {
291
- obj.revocationSecrets = message.revocationSecrets.map((e) => RevocationSecretWithIndex.toJSON(e));
292
- }
293
- return obj;
294
- },
295
- create(base) {
296
- return SendSparkSignatureRequest.fromPartial(base ?? {});
297
- },
298
- fromPartial(object) {
299
- const message = createBaseSendSparkSignatureRequest();
300
- message.finalTokenTransaction = object.finalTokenTransaction !== void 0 && object.finalTokenTransaction !== null ? TokenTransaction.fromPartial(object.finalTokenTransaction) : void 0;
301
- message.operatorSpecificSignatures = object.operatorSpecificSignatures?.map((e) => OperatorSpecificOwnerSignature.fromPartial(e)) || [];
302
- message.operatorSignatureData = object.operatorSignatureData !== void 0 && object.operatorSignatureData !== null ? SparkOperatorSignatureData.fromPartial(object.operatorSignatureData) : void 0;
303
- message.revocationSecrets = object.revocationSecrets?.map((e) => RevocationSecretWithIndex.fromPartial(e)) || [];
304
- return message;
305
- }
306
- };
307
- function createBaseSparkOperatorSignatureData() {
308
- return { sparkOperatorSignature: new Uint8Array(0), operatorIdentityPublicKey: new Uint8Array(0) };
309
- }
310
- var SparkOperatorSignatureData = {
311
- encode(message, writer = new BinaryWriter()) {
312
- if (message.sparkOperatorSignature.length !== 0) {
313
- writer.uint32(10).bytes(message.sparkOperatorSignature);
314
- }
315
- if (message.operatorIdentityPublicKey.length !== 0) {
316
- writer.uint32(18).bytes(message.operatorIdentityPublicKey);
317
- }
318
- return writer;
319
- },
320
- decode(input, length) {
321
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
322
- let end = length === void 0 ? reader.len : reader.pos + length;
323
- const message = createBaseSparkOperatorSignatureData();
324
- while (reader.pos < end) {
325
- const tag = reader.uint32();
326
- switch (tag >>> 3) {
327
- case 1: {
328
- if (tag !== 10) {
329
- break;
330
- }
331
- message.sparkOperatorSignature = reader.bytes();
332
- continue;
333
- }
334
- case 2: {
335
- if (tag !== 18) {
336
- break;
337
- }
338
- message.operatorIdentityPublicKey = reader.bytes();
339
- continue;
340
- }
341
- }
342
- if ((tag & 7) === 4 || tag === 0) {
343
- break;
344
- }
345
- reader.skip(tag & 7);
346
- }
347
- return message;
348
- },
349
- fromJSON(object) {
350
- return {
351
- sparkOperatorSignature: isSet(object.sparkOperatorSignature) ? bytesFromBase64(object.sparkOperatorSignature) : new Uint8Array(0),
352
- operatorIdentityPublicKey: isSet(object.operatorIdentityPublicKey) ? bytesFromBase64(object.operatorIdentityPublicKey) : new Uint8Array(0)
353
- };
354
- },
355
- toJSON(message) {
356
- const obj = {};
357
- if (message.sparkOperatorSignature.length !== 0) {
358
- obj.sparkOperatorSignature = base64FromBytes(message.sparkOperatorSignature);
359
- }
360
- if (message.operatorIdentityPublicKey.length !== 0) {
361
- obj.operatorIdentityPublicKey = base64FromBytes(message.operatorIdentityPublicKey);
362
- }
363
- return obj;
364
- },
365
- create(base) {
366
- return SparkOperatorSignatureData.fromPartial(base ?? {});
367
- },
368
- fromPartial(object) {
369
- const message = createBaseSparkOperatorSignatureData();
370
- message.sparkOperatorSignature = object.sparkOperatorSignature ?? new Uint8Array(0);
371
- message.operatorIdentityPublicKey = object.operatorIdentityPublicKey ?? new Uint8Array(0);
372
- return message;
373
- }
374
- };
375
- function createBaseGetSparkTxRequest() {
376
- return { finalTokenTransactionHash: new Uint8Array(0) };
377
- }
378
- var GetSparkTxRequest = {
379
- encode(message, writer = new BinaryWriter()) {
380
- if (message.finalTokenTransactionHash.length !== 0) {
381
- writer.uint32(10).bytes(message.finalTokenTransactionHash);
382
- }
383
- return writer;
384
- },
385
- decode(input, length) {
386
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
387
- let end = length === void 0 ? reader.len : reader.pos + length;
388
- const message = createBaseGetSparkTxRequest();
389
- while (reader.pos < end) {
390
- const tag = reader.uint32();
391
- switch (tag >>> 3) {
392
- case 1: {
393
- if (tag !== 10) {
394
- break;
395
- }
396
- message.finalTokenTransactionHash = reader.bytes();
397
- continue;
398
- }
399
- }
400
- if ((tag & 7) === 4 || tag === 0) {
401
- break;
402
- }
403
- reader.skip(tag & 7);
404
- }
405
- return message;
406
- },
407
- fromJSON(object) {
408
- return {
409
- finalTokenTransactionHash: isSet(object.finalTokenTransactionHash) ? bytesFromBase64(object.finalTokenTransactionHash) : new Uint8Array(0)
410
- };
411
- },
412
- toJSON(message) {
413
- const obj = {};
414
- if (message.finalTokenTransactionHash.length !== 0) {
415
- obj.finalTokenTransactionHash = base64FromBytes(message.finalTokenTransactionHash);
416
- }
417
- return obj;
418
- },
419
- create(base) {
420
- return GetSparkTxRequest.fromPartial(base ?? {});
421
- },
422
- fromPartial(object) {
423
- const message = createBaseGetSparkTxRequest();
424
- message.finalTokenTransactionHash = object.finalTokenTransactionHash ?? new Uint8Array(0);
425
- return message;
426
- }
427
- };
428
- function createBaseVerifySparkTxRequest() {
429
- return { finalTokenTransaction: void 0 };
430
- }
431
- var VerifySparkTxRequest = {
432
- encode(message, writer = new BinaryWriter()) {
433
- if (message.finalTokenTransaction !== void 0) {
434
- TokenTransaction.encode(message.finalTokenTransaction, writer.uint32(10).fork()).join();
435
- }
436
- return writer;
437
- },
438
- decode(input, length) {
439
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
440
- let end = length === void 0 ? reader.len : reader.pos + length;
441
- const message = createBaseVerifySparkTxRequest();
442
- while (reader.pos < end) {
443
- const tag = reader.uint32();
444
- switch (tag >>> 3) {
445
- case 1: {
446
- if (tag !== 10) {
447
- break;
448
- }
449
- message.finalTokenTransaction = TokenTransaction.decode(reader, reader.uint32());
450
- continue;
451
- }
452
- }
453
- if ((tag & 7) === 4 || tag === 0) {
454
- break;
455
- }
456
- reader.skip(tag & 7);
457
- }
458
- return message;
459
- },
460
- fromJSON(object) {
461
- return {
462
- finalTokenTransaction: isSet(object.finalTokenTransaction) ? TokenTransaction.fromJSON(object.finalTokenTransaction) : void 0
463
- };
464
- },
465
- toJSON(message) {
466
- const obj = {};
467
- if (message.finalTokenTransaction !== void 0) {
468
- obj.finalTokenTransaction = TokenTransaction.toJSON(message.finalTokenTransaction);
469
- }
470
- return obj;
471
- },
472
- create(base) {
473
- return VerifySparkTxRequest.fromPartial(base ?? {});
474
- },
475
- fromPartial(object) {
476
- const message = createBaseVerifySparkTxRequest();
477
- message.finalTokenTransaction = object.finalTokenTransaction !== void 0 && object.finalTokenTransaction !== null ? TokenTransaction.fromPartial(object.finalTokenTransaction) : void 0;
478
- return message;
479
- }
480
- };
481
- function createBaseListSparkTxsRequest() {
482
- return { pageToken: void 0, pageSize: void 0 };
483
- }
484
- var ListSparkTxsRequest = {
485
- encode(message, writer = new BinaryWriter()) {
486
- if (message.pageToken !== void 0) {
487
- writer.uint32(10).bytes(message.pageToken);
488
- }
489
- if (message.pageSize !== void 0) {
490
- writer.uint32(16).uint32(message.pageSize);
491
- }
492
- return writer;
493
- },
494
- decode(input, length) {
495
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
496
- let end = length === void 0 ? reader.len : reader.pos + length;
497
- const message = createBaseListSparkTxsRequest();
498
- while (reader.pos < end) {
499
- const tag = reader.uint32();
500
- switch (tag >>> 3) {
501
- case 1: {
502
- if (tag !== 10) {
503
- break;
504
- }
505
- message.pageToken = reader.bytes();
506
- continue;
507
- }
508
- case 2: {
509
- if (tag !== 16) {
510
- break;
511
- }
512
- message.pageSize = reader.uint32();
513
- continue;
514
- }
515
- }
516
- if ((tag & 7) === 4 || tag === 0) {
517
- break;
518
- }
519
- reader.skip(tag & 7);
520
- }
521
- return message;
522
- },
523
- fromJSON(object) {
524
- return {
525
- pageToken: isSet(object.pageToken) ? bytesFromBase64(object.pageToken) : void 0,
526
- pageSize: isSet(object.pageSize) ? globalThis.Number(object.pageSize) : void 0
527
- };
528
- },
529
- toJSON(message) {
530
- const obj = {};
531
- if (message.pageToken !== void 0) {
532
- obj.pageToken = base64FromBytes(message.pageToken);
533
- }
534
- if (message.pageSize !== void 0) {
535
- obj.pageSize = Math.round(message.pageSize);
536
- }
537
- return obj;
538
- },
539
- create(base) {
540
- return ListSparkTxsRequest.fromPartial(base ?? {});
541
- },
542
- fromPartial(object) {
543
- const message = createBaseListSparkTxsRequest();
544
- message.pageToken = object.pageToken ?? void 0;
545
- message.pageSize = object.pageSize ?? void 0;
546
- return message;
547
- }
548
- };
549
- function createBaseListWithdrawnOutputsRequest() {
550
- return { blockhash: void 0, pageToken: void 0, pageSize: void 0 };
551
- }
552
- var ListWithdrawnOutputsRequest = {
553
- encode(message, writer = new BinaryWriter()) {
554
- if (message.blockhash !== void 0) {
555
- writer.uint32(10).bytes(message.blockhash);
556
- }
557
- if (message.pageToken !== void 0) {
558
- writer.uint32(18).string(message.pageToken);
559
- }
560
- if (message.pageSize !== void 0) {
561
- writer.uint32(24).uint32(message.pageSize);
562
- }
563
- return writer;
564
- },
565
- decode(input, length) {
566
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
567
- let end = length === void 0 ? reader.len : reader.pos + length;
568
- const message = createBaseListWithdrawnOutputsRequest();
569
- while (reader.pos < end) {
570
- const tag = reader.uint32();
571
- switch (tag >>> 3) {
572
- case 1: {
573
- if (tag !== 10) {
574
- break;
575
- }
576
- message.blockhash = reader.bytes();
577
- continue;
578
- }
579
- case 2: {
580
- if (tag !== 18) {
581
- break;
582
- }
583
- message.pageToken = reader.string();
584
- continue;
585
- }
586
- case 3: {
587
- if (tag !== 24) {
588
- break;
589
- }
590
- message.pageSize = reader.uint32();
591
- continue;
592
- }
593
- }
594
- if ((tag & 7) === 4 || tag === 0) {
595
- break;
596
- }
597
- reader.skip(tag & 7);
598
- }
599
- return message;
600
- },
601
- fromJSON(object) {
602
- return {
603
- blockhash: isSet(object.blockhash) ? bytesFromBase64(object.blockhash) : void 0,
604
- pageToken: isSet(object.pageToken) ? globalThis.String(object.pageToken) : void 0,
605
- pageSize: isSet(object.pageSize) ? globalThis.Number(object.pageSize) : void 0
606
- };
607
- },
608
- toJSON(message) {
609
- const obj = {};
610
- if (message.blockhash !== void 0) {
611
- obj.blockhash = base64FromBytes(message.blockhash);
612
- }
613
- if (message.pageToken !== void 0) {
614
- obj.pageToken = message.pageToken;
615
- }
616
- if (message.pageSize !== void 0) {
617
- obj.pageSize = Math.round(message.pageSize);
618
- }
619
- return obj;
620
- },
621
- create(base) {
622
- return ListWithdrawnOutputsRequest.fromPartial(base ?? {});
623
- },
624
- fromPartial(object) {
625
- const message = createBaseListWithdrawnOutputsRequest();
626
- message.blockhash = object.blockhash ?? void 0;
627
- message.pageToken = object.pageToken ?? void 0;
628
- message.pageSize = object.pageSize ?? void 0;
629
- return message;
630
- }
631
- };
632
- function createBaseListSparkTxsResponse() {
633
- return { tokenTransactions: [], nextPageToken: void 0 };
634
- }
635
- var ListSparkTxsResponse = {
636
- encode(message, writer = new BinaryWriter()) {
637
- for (const v of message.tokenTransactions) {
638
- TokenTransactionResponse.encode(v, writer.uint32(10).fork()).join();
639
- }
640
- if (message.nextPageToken !== void 0) {
641
- writer.uint32(18).bytes(message.nextPageToken);
642
- }
643
- return writer;
644
- },
645
- decode(input, length) {
646
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
647
- let end = length === void 0 ? reader.len : reader.pos + length;
648
- const message = createBaseListSparkTxsResponse();
649
- while (reader.pos < end) {
650
- const tag = reader.uint32();
651
- switch (tag >>> 3) {
652
- case 1: {
653
- if (tag !== 10) {
654
- break;
655
- }
656
- message.tokenTransactions.push(TokenTransactionResponse.decode(reader, reader.uint32()));
657
- continue;
658
- }
659
- case 2: {
660
- if (tag !== 18) {
661
- break;
662
- }
663
- message.nextPageToken = reader.bytes();
664
- continue;
665
- }
666
- }
667
- if ((tag & 7) === 4 || tag === 0) {
668
- break;
669
- }
670
- reader.skip(tag & 7);
671
- }
672
- return message;
673
- },
674
- fromJSON(object) {
675
- return {
676
- tokenTransactions: globalThis.Array.isArray(object?.tokenTransactions) ? object.tokenTransactions.map((e) => TokenTransactionResponse.fromJSON(e)) : [],
677
- nextPageToken: isSet(object.nextPageToken) ? bytesFromBase64(object.nextPageToken) : void 0
678
- };
679
- },
680
- toJSON(message) {
681
- const obj = {};
682
- if (message.tokenTransactions?.length) {
683
- obj.tokenTransactions = message.tokenTransactions.map((e) => TokenTransactionResponse.toJSON(e));
684
- }
685
- if (message.nextPageToken !== void 0) {
686
- obj.nextPageToken = base64FromBytes(message.nextPageToken);
687
- }
688
- return obj;
689
- },
690
- create(base) {
691
- return ListSparkTxsResponse.fromPartial(base ?? {});
692
- },
693
- fromPartial(object) {
694
- const message = createBaseListSparkTxsResponse();
695
- message.tokenTransactions = object.tokenTransactions?.map((e) => TokenTransactionResponse.fromPartial(e)) || [];
696
- message.nextPageToken = object.nextPageToken ?? void 0;
697
- return message;
698
- }
699
- };
700
- function createBaseListWithdrawnOutputsResponse() {
701
- return { outputs: [], nextPageToken: void 0 };
702
- }
703
- var ListWithdrawnOutputsResponse = {
704
- encode(message, writer = new BinaryWriter()) {
705
- for (const v of message.outputs) {
706
- TokenOutput.encode(v, writer.uint32(10).fork()).join();
707
- }
708
- if (message.nextPageToken !== void 0) {
709
- writer.uint32(18).string(message.nextPageToken);
710
- }
711
- return writer;
712
- },
713
- decode(input, length) {
714
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
715
- let end = length === void 0 ? reader.len : reader.pos + length;
716
- const message = createBaseListWithdrawnOutputsResponse();
717
- while (reader.pos < end) {
718
- const tag = reader.uint32();
719
- switch (tag >>> 3) {
720
- case 1: {
721
- if (tag !== 10) {
722
- break;
723
- }
724
- message.outputs.push(TokenOutput.decode(reader, reader.uint32()));
725
- continue;
726
- }
727
- case 2: {
728
- if (tag !== 18) {
729
- break;
730
- }
731
- message.nextPageToken = reader.string();
732
- continue;
733
- }
734
- }
735
- if ((tag & 7) === 4 || tag === 0) {
736
- break;
737
- }
738
- reader.skip(tag & 7);
739
- }
740
- return message;
741
- },
742
- fromJSON(object) {
743
- return {
744
- outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e) => TokenOutput.fromJSON(e)) : [],
745
- nextPageToken: isSet(object.nextPageToken) ? globalThis.String(object.nextPageToken) : void 0
746
- };
747
- },
748
- toJSON(message) {
749
- const obj = {};
750
- if (message.outputs?.length) {
751
- obj.outputs = message.outputs.map((e) => TokenOutput.toJSON(e));
752
- }
753
- if (message.nextPageToken !== void 0) {
754
- obj.nextPageToken = message.nextPageToken;
755
- }
756
- return obj;
757
- },
758
- create(base) {
759
- return ListWithdrawnOutputsResponse.fromPartial(base ?? {});
760
- },
761
- fromPartial(object) {
762
- const message = createBaseListWithdrawnOutputsResponse();
763
- message.outputs = object.outputs?.map((e) => TokenOutput.fromPartial(e)) || [];
764
- message.nextPageToken = object.nextPageToken ?? void 0;
765
- return message;
766
- }
767
- };
768
- function createBaseGetSparkTxResponse() {
769
- return { finalTokenTransaction: void 0 };
770
- }
771
- var GetSparkTxResponse = {
772
- encode(message, writer = new BinaryWriter()) {
773
- if (message.finalTokenTransaction !== void 0) {
774
- TokenTransaction.encode(message.finalTokenTransaction, writer.uint32(10).fork()).join();
775
- }
776
- return writer;
777
- },
778
- decode(input, length) {
779
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
780
- let end = length === void 0 ? reader.len : reader.pos + length;
781
- const message = createBaseGetSparkTxResponse();
782
- while (reader.pos < end) {
783
- const tag = reader.uint32();
784
- switch (tag >>> 3) {
785
- case 1: {
786
- if (tag !== 10) {
787
- break;
788
- }
789
- message.finalTokenTransaction = TokenTransaction.decode(reader, reader.uint32());
790
- continue;
791
- }
792
- }
793
- if ((tag & 7) === 4 || tag === 0) {
794
- break;
795
- }
796
- reader.skip(tag & 7);
797
- }
798
- return message;
799
- },
800
- fromJSON(object) {
801
- return {
802
- finalTokenTransaction: isSet(object.finalTokenTransaction) ? TokenTransaction.fromJSON(object.finalTokenTransaction) : void 0
803
- };
804
- },
805
- toJSON(message) {
806
- const obj = {};
807
- if (message.finalTokenTransaction !== void 0) {
808
- obj.finalTokenTransaction = TokenTransaction.toJSON(message.finalTokenTransaction);
809
- }
810
- return obj;
811
- },
812
- create(base) {
813
- return GetSparkTxResponse.fromPartial(base ?? {});
814
- },
815
- fromPartial(object) {
816
- const message = createBaseGetSparkTxResponse();
817
- message.finalTokenTransaction = object.finalTokenTransaction !== void 0 && object.finalTokenTransaction !== null ? TokenTransaction.fromPartial(object.finalTokenTransaction) : void 0;
818
- return message;
819
- }
820
- };
821
- function createBaseFreezeTokensRequest() {
822
- return { freezeTokensPayload: void 0, issuerSignature: new Uint8Array(0) };
823
- }
824
- var FreezeTokensRequest = {
825
- encode(message, writer = new BinaryWriter()) {
826
- if (message.freezeTokensPayload !== void 0) {
827
- FreezeTokensPayload.encode(message.freezeTokensPayload, writer.uint32(10).fork()).join();
828
- }
829
- if (message.issuerSignature.length !== 0) {
830
- writer.uint32(18).bytes(message.issuerSignature);
831
- }
832
- return writer;
833
- },
834
- decode(input, length) {
835
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
836
- let end = length === void 0 ? reader.len : reader.pos + length;
837
- const message = createBaseFreezeTokensRequest();
838
- while (reader.pos < end) {
839
- const tag = reader.uint32();
840
- switch (tag >>> 3) {
841
- case 1: {
842
- if (tag !== 10) {
843
- break;
844
- }
845
- message.freezeTokensPayload = FreezeTokensPayload.decode(reader, reader.uint32());
846
- continue;
847
- }
848
- case 2: {
849
- if (tag !== 18) {
850
- break;
851
- }
852
- message.issuerSignature = reader.bytes();
853
- continue;
854
- }
855
- }
856
- if ((tag & 7) === 4 || tag === 0) {
857
- break;
858
- }
859
- reader.skip(tag & 7);
860
- }
861
- return message;
862
- },
863
- fromJSON(object) {
864
- return {
865
- freezeTokensPayload: isSet(object.freezeTokensPayload) ? FreezeTokensPayload.fromJSON(object.freezeTokensPayload) : void 0,
866
- issuerSignature: isSet(object.issuerSignature) ? bytesFromBase64(object.issuerSignature) : new Uint8Array(0)
867
- };
868
- },
869
- toJSON(message) {
870
- const obj = {};
871
- if (message.freezeTokensPayload !== void 0) {
872
- obj.freezeTokensPayload = FreezeTokensPayload.toJSON(message.freezeTokensPayload);
873
- }
874
- if (message.issuerSignature.length !== 0) {
875
- obj.issuerSignature = base64FromBytes(message.issuerSignature);
876
- }
877
- return obj;
878
- },
879
- create(base) {
880
- return FreezeTokensRequest.fromPartial(base ?? {});
881
- },
882
- fromPartial(object) {
883
- const message = createBaseFreezeTokensRequest();
884
- message.freezeTokensPayload = object.freezeTokensPayload !== void 0 && object.freezeTokensPayload !== null ? FreezeTokensPayload.fromPartial(object.freezeTokensPayload) : void 0;
885
- message.issuerSignature = object.issuerSignature ?? new Uint8Array(0);
886
- return message;
887
- }
888
- };
889
- function createBaseFreezeTokensResponse() {
890
- return { impactedOutputIds: [], impactedTokenAmount: [] };
891
- }
892
- var FreezeTokensResponse = {
893
- encode(message, writer = new BinaryWriter()) {
894
- for (const v of message.impactedOutputIds) {
895
- writer.uint32(10).string(v);
896
- }
897
- for (const v of message.impactedTokenAmount) {
898
- writer.uint32(18).bytes(v);
899
- }
900
- return writer;
901
- },
902
- decode(input, length) {
903
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
904
- let end = length === void 0 ? reader.len : reader.pos + length;
905
- const message = createBaseFreezeTokensResponse();
906
- while (reader.pos < end) {
907
- const tag = reader.uint32();
908
- switch (tag >>> 3) {
909
- case 1: {
910
- if (tag !== 10) {
911
- break;
912
- }
913
- message.impactedOutputIds.push(reader.string());
914
- continue;
915
- }
916
- case 2: {
917
- if (tag !== 18) {
918
- break;
919
- }
920
- message.impactedTokenAmount.push(reader.bytes());
921
- continue;
922
- }
923
- }
924
- if ((tag & 7) === 4 || tag === 0) {
925
- break;
926
- }
927
- reader.skip(tag & 7);
928
- }
929
- return message;
930
- },
931
- fromJSON(object) {
932
- return {
933
- impactedOutputIds: globalThis.Array.isArray(object?.impactedOutputIds) ? object.impactedOutputIds.map((e) => globalThis.String(e)) : [],
934
- impactedTokenAmount: globalThis.Array.isArray(object?.impactedTokenAmount) ? object.impactedTokenAmount.map((e) => bytesFromBase64(e)) : []
935
- };
936
- },
937
- toJSON(message) {
938
- const obj = {};
939
- if (message.impactedOutputIds?.length) {
940
- obj.impactedOutputIds = message.impactedOutputIds;
941
- }
942
- if (message.impactedTokenAmount?.length) {
943
- obj.impactedTokenAmount = message.impactedTokenAmount.map((e) => base64FromBytes(e));
944
- }
945
- return obj;
946
- },
947
- create(base) {
948
- return FreezeTokensResponse.fromPartial(base ?? {});
949
- },
950
- fromPartial(object) {
951
- const message = createBaseFreezeTokensResponse();
952
- message.impactedOutputIds = object.impactedOutputIds?.map((e) => e) || [];
953
- message.impactedTokenAmount = object.impactedTokenAmount?.map((e) => e) || [];
954
- return message;
955
- }
956
- };
957
- function createBaseListAllTokenTransactionsRequest() {
958
- return {
959
- cursor: void 0,
960
- pageSize: void 0,
961
- ownerPublicKey: void 0,
962
- tokenPublicKey: void 0,
963
- beforeTimestamp: void 0,
964
- afterTimestamp: void 0,
965
- operationTypes: []
966
- };
967
- }
968
- var ListAllTokenTransactionsRequest = {
969
- encode(message, writer = new BinaryWriter()) {
970
- if (message.cursor !== void 0) {
971
- ListAllTokenTransactionsCursor.encode(message.cursor, writer.uint32(10).fork()).join();
972
- }
973
- if (message.pageSize !== void 0) {
974
- writer.uint32(16).uint32(message.pageSize);
975
- }
976
- if (message.ownerPublicKey !== void 0) {
977
- writer.uint32(26).bytes(message.ownerPublicKey);
978
- }
979
- if (message.tokenPublicKey !== void 0) {
980
- writer.uint32(34).bytes(message.tokenPublicKey);
981
- }
982
- if (message.beforeTimestamp !== void 0) {
983
- Timestamp.encode(toTimestamp(message.beforeTimestamp), writer.uint32(42).fork()).join();
984
- }
985
- if (message.afterTimestamp !== void 0) {
986
- Timestamp.encode(toTimestamp(message.afterTimestamp), writer.uint32(50).fork()).join();
987
- }
988
- writer.uint32(58).fork();
989
- for (const v of message.operationTypes) {
990
- writer.int32(v);
991
- }
992
- writer.join();
993
- return writer;
994
- },
995
- decode(input, length) {
996
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
997
- let end = length === void 0 ? reader.len : reader.pos + length;
998
- const message = createBaseListAllTokenTransactionsRequest();
999
- while (reader.pos < end) {
1000
- const tag = reader.uint32();
1001
- switch (tag >>> 3) {
1002
- case 1: {
1003
- if (tag !== 10) {
1004
- break;
1005
- }
1006
- message.cursor = ListAllTokenTransactionsCursor.decode(reader, reader.uint32());
1007
- continue;
1008
- }
1009
- case 2: {
1010
- if (tag !== 16) {
1011
- break;
1012
- }
1013
- message.pageSize = reader.uint32();
1014
- continue;
1015
- }
1016
- case 3: {
1017
- if (tag !== 26) {
1018
- break;
1019
- }
1020
- message.ownerPublicKey = reader.bytes();
1021
- continue;
1022
- }
1023
- case 4: {
1024
- if (tag !== 34) {
1025
- break;
1026
- }
1027
- message.tokenPublicKey = reader.bytes();
1028
- continue;
1029
- }
1030
- case 5: {
1031
- if (tag !== 42) {
1032
- break;
1033
- }
1034
- message.beforeTimestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1035
- continue;
1036
- }
1037
- case 6: {
1038
- if (tag !== 50) {
1039
- break;
1040
- }
1041
- message.afterTimestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1042
- continue;
1043
- }
1044
- case 7: {
1045
- if (tag === 56) {
1046
- message.operationTypes.push(reader.int32());
1047
- continue;
1048
- }
1049
- if (tag === 58) {
1050
- const end2 = reader.uint32() + reader.pos;
1051
- while (reader.pos < end2) {
1052
- message.operationTypes.push(reader.int32());
1053
- }
1054
- continue;
1055
- }
1056
- break;
1057
- }
1058
- }
1059
- if ((tag & 7) === 4 || tag === 0) {
1060
- break;
1061
- }
1062
- reader.skip(tag & 7);
1063
- }
1064
- return message;
1065
- },
1066
- fromJSON(object) {
1067
- return {
1068
- cursor: isSet(object.cursor) ? ListAllTokenTransactionsCursor.fromJSON(object.cursor) : void 0,
1069
- pageSize: isSet(object.pageSize) ? globalThis.Number(object.pageSize) : void 0,
1070
- ownerPublicKey: isSet(object.ownerPublicKey) ? bytesFromBase64(object.ownerPublicKey) : void 0,
1071
- tokenPublicKey: isSet(object.tokenPublicKey) ? bytesFromBase64(object.tokenPublicKey) : void 0,
1072
- beforeTimestamp: isSet(object.beforeTimestamp) ? fromJsonTimestamp(object.beforeTimestamp) : void 0,
1073
- afterTimestamp: isSet(object.afterTimestamp) ? fromJsonTimestamp(object.afterTimestamp) : void 0,
1074
- operationTypes: globalThis.Array.isArray(object?.operationTypes) ? object.operationTypes.map((e) => operationTypeFromJSON(e)) : []
1075
- };
1076
- },
1077
- toJSON(message) {
1078
- const obj = {};
1079
- if (message.cursor !== void 0) {
1080
- obj.cursor = ListAllTokenTransactionsCursor.toJSON(message.cursor);
1081
- }
1082
- if (message.pageSize !== void 0) {
1083
- obj.pageSize = Math.round(message.pageSize);
1084
- }
1085
- if (message.ownerPublicKey !== void 0) {
1086
- obj.ownerPublicKey = base64FromBytes(message.ownerPublicKey);
1087
- }
1088
- if (message.tokenPublicKey !== void 0) {
1089
- obj.tokenPublicKey = base64FromBytes(message.tokenPublicKey);
1090
- }
1091
- if (message.beforeTimestamp !== void 0) {
1092
- obj.beforeTimestamp = message.beforeTimestamp.toISOString();
1093
- }
1094
- if (message.afterTimestamp !== void 0) {
1095
- obj.afterTimestamp = message.afterTimestamp.toISOString();
1096
- }
1097
- if (message.operationTypes?.length) {
1098
- obj.operationTypes = message.operationTypes.map((e) => operationTypeToJSON(e));
1099
- }
1100
- return obj;
1101
- },
1102
- create(base) {
1103
- return ListAllTokenTransactionsRequest.fromPartial(base ?? {});
1104
- },
1105
- fromPartial(object) {
1106
- const message = createBaseListAllTokenTransactionsRequest();
1107
- message.cursor = object.cursor !== void 0 && object.cursor !== null ? ListAllTokenTransactionsCursor.fromPartial(object.cursor) : void 0;
1108
- message.pageSize = object.pageSize ?? void 0;
1109
- message.ownerPublicKey = object.ownerPublicKey ?? void 0;
1110
- message.tokenPublicKey = object.tokenPublicKey ?? void 0;
1111
- message.beforeTimestamp = object.beforeTimestamp ?? void 0;
1112
- message.afterTimestamp = object.afterTimestamp ?? void 0;
1113
- message.operationTypes = object.operationTypes?.map((e) => e) || [];
1114
- return message;
1115
- }
1116
- };
1117
- function createBaseListAllTokenTransactionsResponse() {
1118
- return { transactions: [], nextCursor: void 0 };
1119
- }
1120
- var ListAllTokenTransactionsResponse = {
1121
- encode(message, writer = new BinaryWriter()) {
1122
- for (const v of message.transactions) {
1123
- Transaction.encode(v, writer.uint32(10).fork()).join();
1124
- }
1125
- if (message.nextCursor !== void 0) {
1126
- ListAllTokenTransactionsCursor.encode(message.nextCursor, writer.uint32(18).fork()).join();
1127
- }
1128
- return writer;
1129
- },
1130
- decode(input, length) {
1131
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1132
- let end = length === void 0 ? reader.len : reader.pos + length;
1133
- const message = createBaseListAllTokenTransactionsResponse();
1134
- while (reader.pos < end) {
1135
- const tag = reader.uint32();
1136
- switch (tag >>> 3) {
1137
- case 1: {
1138
- if (tag !== 10) {
1139
- break;
1140
- }
1141
- message.transactions.push(Transaction.decode(reader, reader.uint32()));
1142
- continue;
1143
- }
1144
- case 2: {
1145
- if (tag !== 18) {
1146
- break;
1147
- }
1148
- message.nextCursor = ListAllTokenTransactionsCursor.decode(reader, reader.uint32());
1149
- continue;
1150
- }
1151
- }
1152
- if ((tag & 7) === 4 || tag === 0) {
1153
- break;
1154
- }
1155
- reader.skip(tag & 7);
1156
- }
1157
- return message;
1158
- },
1159
- fromJSON(object) {
1160
- return {
1161
- transactions: globalThis.Array.isArray(object?.transactions) ? object.transactions.map((e) => Transaction.fromJSON(e)) : [],
1162
- nextCursor: isSet(object.nextCursor) ? ListAllTokenTransactionsCursor.fromJSON(object.nextCursor) : void 0
1163
- };
1164
- },
1165
- toJSON(message) {
1166
- const obj = {};
1167
- if (message.transactions?.length) {
1168
- obj.transactions = message.transactions.map((e) => Transaction.toJSON(e));
1169
- }
1170
- if (message.nextCursor !== void 0) {
1171
- obj.nextCursor = ListAllTokenTransactionsCursor.toJSON(message.nextCursor);
1172
- }
1173
- return obj;
1174
- },
1175
- create(base) {
1176
- return ListAllTokenTransactionsResponse.fromPartial(base ?? {});
1177
- },
1178
- fromPartial(object) {
1179
- const message = createBaseListAllTokenTransactionsResponse();
1180
- message.transactions = object.transactions?.map((e) => Transaction.fromPartial(e)) || [];
1181
- message.nextCursor = object.nextCursor !== void 0 && object.nextCursor !== null ? ListAllTokenTransactionsCursor.fromPartial(object.nextCursor) : void 0;
1182
- return message;
1183
- }
1184
- };
1185
- function createBaseBlockInfoResponse() {
1186
- return { blockInfo: void 0 };
1187
- }
1188
- var BlockInfoResponse = {
1189
- encode(message, writer = new BinaryWriter()) {
1190
- if (message.blockInfo !== void 0) {
1191
- BlockInfo.encode(message.blockInfo, writer.uint32(10).fork()).join();
1192
- }
1193
- return writer;
1194
- },
1195
- decode(input, length) {
1196
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1197
- let end = length === void 0 ? reader.len : reader.pos + length;
1198
- const message = createBaseBlockInfoResponse();
1199
- while (reader.pos < end) {
1200
- const tag = reader.uint32();
1201
- switch (tag >>> 3) {
1202
- case 1: {
1203
- if (tag !== 10) {
1204
- break;
1205
- }
1206
- message.blockInfo = BlockInfo.decode(reader, reader.uint32());
1207
- continue;
1208
- }
1209
- }
1210
- if ((tag & 7) === 4 || tag === 0) {
1211
- break;
1212
- }
1213
- reader.skip(tag & 7);
1214
- }
1215
- return message;
1216
- },
1217
- fromJSON(object) {
1218
- return { blockInfo: isSet(object.blockInfo) ? BlockInfo.fromJSON(object.blockInfo) : void 0 };
1219
- },
1220
- toJSON(message) {
1221
- const obj = {};
1222
- if (message.blockInfo !== void 0) {
1223
- obj.blockInfo = BlockInfo.toJSON(message.blockInfo);
1224
- }
1225
- return obj;
1226
- },
1227
- create(base) {
1228
- return BlockInfoResponse.fromPartial(base ?? {});
1229
- },
1230
- fromPartial(object) {
1231
- const message = createBaseBlockInfoResponse();
1232
- message.blockInfo = object.blockInfo !== void 0 && object.blockInfo !== null ? BlockInfo.fromPartial(object.blockInfo) : void 0;
1233
- return message;
1234
- }
1235
- };
1236
- function createBaseSendRawTxRequest() {
1237
- return { tx: "", maxBurnAmount: void 0 };
1238
- }
1239
- var SendRawTxRequest = {
1240
- encode(message, writer = new BinaryWriter()) {
1241
- if (message.tx !== "") {
1242
- writer.uint32(10).string(message.tx);
1243
- }
1244
- if (message.maxBurnAmount !== void 0) {
1245
- writer.uint32(16).uint64(message.maxBurnAmount);
1246
- }
1247
- return writer;
1248
- },
1249
- decode(input, length) {
1250
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1251
- let end = length === void 0 ? reader.len : reader.pos + length;
1252
- const message = createBaseSendRawTxRequest();
1253
- while (reader.pos < end) {
1254
- const tag = reader.uint32();
1255
- switch (tag >>> 3) {
1256
- case 1: {
1257
- if (tag !== 10) {
1258
- break;
1259
- }
1260
- message.tx = reader.string();
1261
- continue;
1262
- }
1263
- case 2: {
1264
- if (tag !== 16) {
1265
- break;
1266
- }
1267
- message.maxBurnAmount = longToNumber(reader.uint64());
1268
- continue;
1269
- }
1270
- }
1271
- if ((tag & 7) === 4 || tag === 0) {
1272
- break;
1273
- }
1274
- reader.skip(tag & 7);
1275
- }
1276
- return message;
1277
- },
1278
- fromJSON(object) {
1279
- return {
1280
- tx: isSet(object.tx) ? globalThis.String(object.tx) : "",
1281
- maxBurnAmount: isSet(object.maxBurnAmount) ? globalThis.Number(object.maxBurnAmount) : void 0
1282
- };
1283
- },
1284
- toJSON(message) {
1285
- const obj = {};
1286
- if (message.tx !== "") {
1287
- obj.tx = message.tx;
1288
- }
1289
- if (message.maxBurnAmount !== void 0) {
1290
- obj.maxBurnAmount = Math.round(message.maxBurnAmount);
1291
- }
1292
- return obj;
1293
- },
1294
- create(base) {
1295
- return SendRawTxRequest.fromPartial(base ?? {});
1296
- },
1297
- fromPartial(object) {
1298
- const message = createBaseSendRawTxRequest();
1299
- message.tx = object.tx ?? "";
1300
- message.maxBurnAmount = object.maxBurnAmount ?? void 0;
1301
- return message;
1302
- }
1303
- };
1304
- function createBaseGetTokenPubkeyInfoRequest() {
1305
- return { publicKeys: [] };
1306
- }
1307
- var GetTokenPubkeyInfoRequest = {
1308
- encode(message, writer = new BinaryWriter()) {
1309
- for (const v of message.publicKeys) {
1310
- writer.uint32(10).bytes(v);
1311
- }
1312
- return writer;
1313
- },
1314
- decode(input, length) {
1315
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1316
- let end = length === void 0 ? reader.len : reader.pos + length;
1317
- const message = createBaseGetTokenPubkeyInfoRequest();
1318
- while (reader.pos < end) {
1319
- const tag = reader.uint32();
1320
- switch (tag >>> 3) {
1321
- case 1: {
1322
- if (tag !== 10) {
1323
- break;
1324
- }
1325
- message.publicKeys.push(reader.bytes());
1326
- continue;
1327
- }
1328
- }
1329
- if ((tag & 7) === 4 || tag === 0) {
1330
- break;
1331
- }
1332
- reader.skip(tag & 7);
1333
- }
1334
- return message;
1335
- },
1336
- fromJSON(object) {
1337
- return {
1338
- publicKeys: globalThis.Array.isArray(object?.publicKeys) ? object.publicKeys.map((e) => bytesFromBase64(e)) : []
1339
- };
1340
- },
1341
- toJSON(message) {
1342
- const obj = {};
1343
- if (message.publicKeys?.length) {
1344
- obj.publicKeys = message.publicKeys.map((e) => base64FromBytes(e));
1345
- }
1346
- return obj;
1347
- },
1348
- create(base) {
1349
- return GetTokenPubkeyInfoRequest.fromPartial(base ?? {});
1350
- },
1351
- fromPartial(object) {
1352
- const message = createBaseGetTokenPubkeyInfoRequest();
1353
- message.publicKeys = object.publicKeys?.map((e) => e) || [];
1354
- return message;
1355
- }
1356
- };
1357
- function createBaseGetTokenPubkeyInfoResponse() {
1358
- return { tokenPubkeyInfos: [] };
1359
- }
1360
- var GetTokenPubkeyInfoResponse = {
1361
- encode(message, writer = new BinaryWriter()) {
1362
- for (const v of message.tokenPubkeyInfos) {
1363
- TokenPubkeyInfo.encode(v, writer.uint32(10).fork()).join();
1364
- }
1365
- return writer;
1366
- },
1367
- decode(input, length) {
1368
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1369
- let end = length === void 0 ? reader.len : reader.pos + length;
1370
- const message = createBaseGetTokenPubkeyInfoResponse();
1371
- while (reader.pos < end) {
1372
- const tag = reader.uint32();
1373
- switch (tag >>> 3) {
1374
- case 1: {
1375
- if (tag !== 10) {
1376
- break;
1377
- }
1378
- message.tokenPubkeyInfos.push(TokenPubkeyInfo.decode(reader, reader.uint32()));
1379
- continue;
1380
- }
1381
- }
1382
- if ((tag & 7) === 4 || tag === 0) {
1383
- break;
1384
- }
1385
- reader.skip(tag & 7);
1386
- }
1387
- return message;
1388
- },
1389
- fromJSON(object) {
1390
- return {
1391
- tokenPubkeyInfos: globalThis.Array.isArray(object?.tokenPubkeyInfos) ? object.tokenPubkeyInfos.map((e) => TokenPubkeyInfo.fromJSON(e)) : []
1392
- };
1393
- },
1394
- toJSON(message) {
1395
- const obj = {};
1396
- if (message.tokenPubkeyInfos?.length) {
1397
- obj.tokenPubkeyInfos = message.tokenPubkeyInfos.map((e) => TokenPubkeyInfo.toJSON(e));
1398
- }
1399
- return obj;
1400
- },
1401
- create(base) {
1402
- return GetTokenPubkeyInfoResponse.fromPartial(base ?? {});
1403
- },
1404
- fromPartial(object) {
1405
- const message = createBaseGetTokenPubkeyInfoResponse();
1406
- message.tokenPubkeyInfos = object.tokenPubkeyInfos?.map((e) => TokenPubkeyInfo.fromPartial(e)) || [];
1407
- return message;
1408
- }
1409
- };
1410
- function createBaseTokenPubkeyInfo() {
1411
- return { announcement: void 0, totalSupply: new Uint8Array(0), owner: void 0, logoUrl: void 0 };
1412
- }
1413
- var TokenPubkeyInfo = {
1414
- encode(message, writer = new BinaryWriter()) {
1415
- if (message.announcement !== void 0) {
1416
- TokenPubkeyAnnouncement.encode(message.announcement, writer.uint32(10).fork()).join();
1417
- }
1418
- if (message.totalSupply.length !== 0) {
1419
- writer.uint32(18).bytes(message.totalSupply);
1420
- }
1421
- if (message.owner !== void 0) {
1422
- writer.uint32(26).bytes(message.owner);
1423
- }
1424
- if (message.logoUrl !== void 0) {
1425
- writer.uint32(34).string(message.logoUrl);
1426
- }
1427
- return writer;
1428
- },
1429
- decode(input, length) {
1430
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1431
- let end = length === void 0 ? reader.len : reader.pos + length;
1432
- const message = createBaseTokenPubkeyInfo();
1433
- while (reader.pos < end) {
1434
- const tag = reader.uint32();
1435
- switch (tag >>> 3) {
1436
- case 1: {
1437
- if (tag !== 10) {
1438
- break;
1439
- }
1440
- message.announcement = TokenPubkeyAnnouncement.decode(reader, reader.uint32());
1441
- continue;
1442
- }
1443
- case 2: {
1444
- if (tag !== 18) {
1445
- break;
1446
- }
1447
- message.totalSupply = reader.bytes();
1448
- continue;
1449
- }
1450
- case 3: {
1451
- if (tag !== 26) {
1452
- break;
1453
- }
1454
- message.owner = reader.bytes();
1455
- continue;
1456
- }
1457
- case 4: {
1458
- if (tag !== 34) {
1459
- break;
1460
- }
1461
- message.logoUrl = reader.string();
1462
- continue;
1463
- }
1464
- }
1465
- if ((tag & 7) === 4 || tag === 0) {
1466
- break;
1467
- }
1468
- reader.skip(tag & 7);
1469
- }
1470
- return message;
1471
- },
1472
- fromJSON(object) {
1473
- return {
1474
- announcement: isSet(object.announcement) ? TokenPubkeyAnnouncement.fromJSON(object.announcement) : void 0,
1475
- totalSupply: isSet(object.totalSupply) ? bytesFromBase64(object.totalSupply) : new Uint8Array(0),
1476
- owner: isSet(object.owner) ? bytesFromBase64(object.owner) : void 0,
1477
- logoUrl: isSet(object.logoUrl) ? globalThis.String(object.logoUrl) : void 0
1478
- };
1479
- },
1480
- toJSON(message) {
1481
- const obj = {};
1482
- if (message.announcement !== void 0) {
1483
- obj.announcement = TokenPubkeyAnnouncement.toJSON(message.announcement);
1484
- }
1485
- if (message.totalSupply.length !== 0) {
1486
- obj.totalSupply = base64FromBytes(message.totalSupply);
1487
- }
1488
- if (message.owner !== void 0) {
1489
- obj.owner = base64FromBytes(message.owner);
1490
- }
1491
- if (message.logoUrl !== void 0) {
1492
- obj.logoUrl = message.logoUrl;
1493
- }
1494
- return obj;
1495
- },
1496
- create(base) {
1497
- return TokenPubkeyInfo.fromPartial(base ?? {});
1498
- },
1499
- fromPartial(object) {
1500
- const message = createBaseTokenPubkeyInfo();
1501
- message.announcement = object.announcement !== void 0 && object.announcement !== null ? TokenPubkeyAnnouncement.fromPartial(object.announcement) : void 0;
1502
- message.totalSupply = object.totalSupply ?? new Uint8Array(0);
1503
- message.owner = object.owner ?? void 0;
1504
- message.logoUrl = object.logoUrl ?? void 0;
1505
- return message;
1506
- }
1507
- };
1508
- function createBaseTokenOutput() {
1509
- return {
1510
- id: "",
1511
- ownerPublicKey: new Uint8Array(0),
1512
- revocationCommitment: new Uint8Array(0),
1513
- withdrawalBondSats: 0,
1514
- withdrawalLocktime: 0,
1515
- tokenPublicKey: new Uint8Array(0),
1516
- tokenAmount: new Uint8Array(0),
1517
- isFrozen: void 0
1518
- };
1519
- }
1520
- var TokenOutput = {
1521
- encode(message, writer = new BinaryWriter()) {
1522
- if (message.id !== "") {
1523
- writer.uint32(10).string(message.id);
1524
- }
1525
- if (message.ownerPublicKey.length !== 0) {
1526
- writer.uint32(18).bytes(message.ownerPublicKey);
1527
- }
1528
- if (message.revocationCommitment.length !== 0) {
1529
- writer.uint32(26).bytes(message.revocationCommitment);
1530
- }
1531
- if (message.withdrawalBondSats !== 0) {
1532
- writer.uint32(32).uint64(message.withdrawalBondSats);
1533
- }
1534
- if (message.withdrawalLocktime !== 0) {
1535
- writer.uint32(40).uint64(message.withdrawalLocktime);
1536
- }
1537
- if (message.tokenPublicKey.length !== 0) {
1538
- writer.uint32(50).bytes(message.tokenPublicKey);
1539
- }
1540
- if (message.tokenAmount.length !== 0) {
1541
- writer.uint32(58).bytes(message.tokenAmount);
1542
- }
1543
- if (message.isFrozen !== void 0) {
1544
- writer.uint32(64).bool(message.isFrozen);
1545
- }
1546
- return writer;
1547
- },
1548
- decode(input, length) {
1549
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1550
- let end = length === void 0 ? reader.len : reader.pos + length;
1551
- const message = createBaseTokenOutput();
1552
- while (reader.pos < end) {
1553
- const tag = reader.uint32();
1554
- switch (tag >>> 3) {
1555
- case 1: {
1556
- if (tag !== 10) {
1557
- break;
1558
- }
1559
- message.id = reader.string();
1560
- continue;
1561
- }
1562
- case 2: {
1563
- if (tag !== 18) {
1564
- break;
1565
- }
1566
- message.ownerPublicKey = reader.bytes();
1567
- continue;
1568
- }
1569
- case 3: {
1570
- if (tag !== 26) {
1571
- break;
1572
- }
1573
- message.revocationCommitment = reader.bytes();
1574
- continue;
1575
- }
1576
- case 4: {
1577
- if (tag !== 32) {
1578
- break;
1579
- }
1580
- message.withdrawalBondSats = longToNumber(reader.uint64());
1581
- continue;
1582
- }
1583
- case 5: {
1584
- if (tag !== 40) {
1585
- break;
1586
- }
1587
- message.withdrawalLocktime = longToNumber(reader.uint64());
1588
- continue;
1589
- }
1590
- case 6: {
1591
- if (tag !== 50) {
1592
- break;
1593
- }
1594
- message.tokenPublicKey = reader.bytes();
1595
- continue;
1596
- }
1597
- case 7: {
1598
- if (tag !== 58) {
1599
- break;
1600
- }
1601
- message.tokenAmount = reader.bytes();
1602
- continue;
1603
- }
1604
- case 8: {
1605
- if (tag !== 64) {
1606
- break;
1607
- }
1608
- message.isFrozen = reader.bool();
1609
- continue;
1610
- }
1611
- }
1612
- if ((tag & 7) === 4 || tag === 0) {
1613
- break;
1614
- }
1615
- reader.skip(tag & 7);
1616
- }
1617
- return message;
1618
- },
1619
- fromJSON(object) {
1620
- return {
1621
- id: isSet(object.id) ? globalThis.String(object.id) : "",
1622
- ownerPublicKey: isSet(object.ownerPublicKey) ? bytesFromBase64(object.ownerPublicKey) : new Uint8Array(0),
1623
- revocationCommitment: isSet(object.revocationCommitment) ? bytesFromBase64(object.revocationCommitment) : new Uint8Array(0),
1624
- withdrawalBondSats: isSet(object.withdrawalBondSats) ? globalThis.Number(object.withdrawalBondSats) : 0,
1625
- withdrawalLocktime: isSet(object.withdrawalLocktime) ? globalThis.Number(object.withdrawalLocktime) : 0,
1626
- tokenPublicKey: isSet(object.tokenPublicKey) ? bytesFromBase64(object.tokenPublicKey) : new Uint8Array(0),
1627
- tokenAmount: isSet(object.tokenAmount) ? bytesFromBase64(object.tokenAmount) : new Uint8Array(0),
1628
- isFrozen: isSet(object.isFrozen) ? globalThis.Boolean(object.isFrozen) : void 0
1629
- };
1630
- },
1631
- toJSON(message) {
1632
- const obj = {};
1633
- if (message.id !== "") {
1634
- obj.id = message.id;
1635
- }
1636
- if (message.ownerPublicKey.length !== 0) {
1637
- obj.ownerPublicKey = base64FromBytes(message.ownerPublicKey);
1638
- }
1639
- if (message.revocationCommitment.length !== 0) {
1640
- obj.revocationCommitment = base64FromBytes(message.revocationCommitment);
1641
- }
1642
- if (message.withdrawalBondSats !== 0) {
1643
- obj.withdrawalBondSats = Math.round(message.withdrawalBondSats);
1644
- }
1645
- if (message.withdrawalLocktime !== 0) {
1646
- obj.withdrawalLocktime = Math.round(message.withdrawalLocktime);
1647
- }
1648
- if (message.tokenPublicKey.length !== 0) {
1649
- obj.tokenPublicKey = base64FromBytes(message.tokenPublicKey);
1650
- }
1651
- if (message.tokenAmount.length !== 0) {
1652
- obj.tokenAmount = base64FromBytes(message.tokenAmount);
1653
- }
1654
- if (message.isFrozen !== void 0) {
1655
- obj.isFrozen = message.isFrozen;
1656
- }
1657
- return obj;
1658
- },
1659
- create(base) {
1660
- return TokenOutput.fromPartial(base ?? {});
1661
- },
1662
- fromPartial(object) {
1663
- const message = createBaseTokenOutput();
1664
- message.id = object.id ?? "";
1665
- message.ownerPublicKey = object.ownerPublicKey ?? new Uint8Array(0);
1666
- message.revocationCommitment = object.revocationCommitment ?? new Uint8Array(0);
1667
- message.withdrawalBondSats = object.withdrawalBondSats ?? 0;
1668
- message.withdrawalLocktime = object.withdrawalLocktime ?? 0;
1669
- message.tokenPublicKey = object.tokenPublicKey ?? new Uint8Array(0);
1670
- message.tokenAmount = object.tokenAmount ?? new Uint8Array(0);
1671
- message.isFrozen = object.isFrozen ?? void 0;
1672
- return message;
1673
- }
1674
- };
1675
- function createBaseFreezeTokensPayload() {
1676
- return {
1677
- ownerPublicKey: new Uint8Array(0),
1678
- tokenPublicKey: new Uint8Array(0),
1679
- timestamp: 0,
1680
- operatorIdentityPublicKey: new Uint8Array(0),
1681
- shouldUnfreeze: false
1682
- };
1683
- }
1684
- var FreezeTokensPayload = {
1685
- encode(message, writer = new BinaryWriter()) {
1686
- if (message.ownerPublicKey.length !== 0) {
1687
- writer.uint32(10).bytes(message.ownerPublicKey);
1688
- }
1689
- if (message.tokenPublicKey.length !== 0) {
1690
- writer.uint32(18).bytes(message.tokenPublicKey);
1691
- }
1692
- if (message.timestamp !== 0) {
1693
- writer.uint32(24).uint64(message.timestamp);
1694
- }
1695
- if (message.operatorIdentityPublicKey.length !== 0) {
1696
- writer.uint32(34).bytes(message.operatorIdentityPublicKey);
1697
- }
1698
- if (message.shouldUnfreeze !== false) {
1699
- writer.uint32(40).bool(message.shouldUnfreeze);
1700
- }
1701
- return writer;
1702
- },
1703
- decode(input, length) {
1704
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1705
- let end = length === void 0 ? reader.len : reader.pos + length;
1706
- const message = createBaseFreezeTokensPayload();
1707
- while (reader.pos < end) {
1708
- const tag = reader.uint32();
1709
- switch (tag >>> 3) {
1710
- case 1: {
1711
- if (tag !== 10) {
1712
- break;
1713
- }
1714
- message.ownerPublicKey = reader.bytes();
1715
- continue;
1716
- }
1717
- case 2: {
1718
- if (tag !== 18) {
1719
- break;
1720
- }
1721
- message.tokenPublicKey = reader.bytes();
1722
- continue;
1723
- }
1724
- case 3: {
1725
- if (tag !== 24) {
1726
- break;
1727
- }
1728
- message.timestamp = longToNumber(reader.uint64());
1729
- continue;
1730
- }
1731
- case 4: {
1732
- if (tag !== 34) {
1733
- break;
1734
- }
1735
- message.operatorIdentityPublicKey = reader.bytes();
1736
- continue;
1737
- }
1738
- case 5: {
1739
- if (tag !== 40) {
1740
- break;
1741
- }
1742
- message.shouldUnfreeze = reader.bool();
1743
- continue;
1744
- }
1745
- }
1746
- if ((tag & 7) === 4 || tag === 0) {
1747
- break;
1748
- }
1749
- reader.skip(tag & 7);
1750
- }
1751
- return message;
1752
- },
1753
- fromJSON(object) {
1754
- return {
1755
- ownerPublicKey: isSet(object.ownerPublicKey) ? bytesFromBase64(object.ownerPublicKey) : new Uint8Array(0),
1756
- tokenPublicKey: isSet(object.tokenPublicKey) ? bytesFromBase64(object.tokenPublicKey) : new Uint8Array(0),
1757
- timestamp: isSet(object.timestamp) ? globalThis.Number(object.timestamp) : 0,
1758
- operatorIdentityPublicKey: isSet(object.operatorIdentityPublicKey) ? bytesFromBase64(object.operatorIdentityPublicKey) : new Uint8Array(0),
1759
- shouldUnfreeze: isSet(object.shouldUnfreeze) ? globalThis.Boolean(object.shouldUnfreeze) : false
1760
- };
1761
- },
1762
- toJSON(message) {
1763
- const obj = {};
1764
- if (message.ownerPublicKey.length !== 0) {
1765
- obj.ownerPublicKey = base64FromBytes(message.ownerPublicKey);
1766
- }
1767
- if (message.tokenPublicKey.length !== 0) {
1768
- obj.tokenPublicKey = base64FromBytes(message.tokenPublicKey);
1769
- }
1770
- if (message.timestamp !== 0) {
1771
- obj.timestamp = Math.round(message.timestamp);
1772
- }
1773
- if (message.operatorIdentityPublicKey.length !== 0) {
1774
- obj.operatorIdentityPublicKey = base64FromBytes(message.operatorIdentityPublicKey);
1775
- }
1776
- if (message.shouldUnfreeze !== false) {
1777
- obj.shouldUnfreeze = message.shouldUnfreeze;
1778
- }
1779
- return obj;
1780
- },
1781
- create(base) {
1782
- return FreezeTokensPayload.fromPartial(base ?? {});
1783
- },
1784
- fromPartial(object) {
1785
- const message = createBaseFreezeTokensPayload();
1786
- message.ownerPublicKey = object.ownerPublicKey ?? new Uint8Array(0);
1787
- message.tokenPublicKey = object.tokenPublicKey ?? new Uint8Array(0);
1788
- message.timestamp = object.timestamp ?? 0;
1789
- message.operatorIdentityPublicKey = object.operatorIdentityPublicKey ?? new Uint8Array(0);
1790
- message.shouldUnfreeze = object.shouldUnfreeze ?? false;
1791
- return message;
1792
- }
1793
- };
1794
- function createBaseTokenTransactionResponse() {
1795
- return { finalized: false, finalTokenTransaction: void 0, finalTokenTransactionHash: new Uint8Array(0) };
1796
- }
1797
- var TokenTransactionResponse = {
1798
- encode(message, writer = new BinaryWriter()) {
1799
- if (message.finalized !== false) {
1800
- writer.uint32(8).bool(message.finalized);
1801
- }
1802
- if (message.finalTokenTransaction !== void 0) {
1803
- TokenTransaction.encode(message.finalTokenTransaction, writer.uint32(18).fork()).join();
1804
- }
1805
- if (message.finalTokenTransactionHash.length !== 0) {
1806
- writer.uint32(26).bytes(message.finalTokenTransactionHash);
1807
- }
1808
- return writer;
1809
- },
1810
- decode(input, length) {
1811
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1812
- let end = length === void 0 ? reader.len : reader.pos + length;
1813
- const message = createBaseTokenTransactionResponse();
1814
- while (reader.pos < end) {
1815
- const tag = reader.uint32();
1816
- switch (tag >>> 3) {
1817
- case 1: {
1818
- if (tag !== 8) {
1819
- break;
1820
- }
1821
- message.finalized = reader.bool();
1822
- continue;
1823
- }
1824
- case 2: {
1825
- if (tag !== 18) {
1826
- break;
1827
- }
1828
- message.finalTokenTransaction = TokenTransaction.decode(reader, reader.uint32());
1829
- continue;
1830
- }
1831
- case 3: {
1832
- if (tag !== 26) {
1833
- break;
1834
- }
1835
- message.finalTokenTransactionHash = reader.bytes();
1836
- continue;
1837
- }
1838
- }
1839
- if ((tag & 7) === 4 || tag === 0) {
1840
- break;
1841
- }
1842
- reader.skip(tag & 7);
1843
- }
1844
- return message;
1845
- },
1846
- fromJSON(object) {
1847
- return {
1848
- finalized: isSet(object.finalized) ? globalThis.Boolean(object.finalized) : false,
1849
- finalTokenTransaction: isSet(object.finalTokenTransaction) ? TokenTransaction.fromJSON(object.finalTokenTransaction) : void 0,
1850
- finalTokenTransactionHash: isSet(object.finalTokenTransactionHash) ? bytesFromBase64(object.finalTokenTransactionHash) : new Uint8Array(0)
1851
- };
1852
- },
1853
- toJSON(message) {
1854
- const obj = {};
1855
- if (message.finalized !== false) {
1856
- obj.finalized = message.finalized;
1857
- }
1858
- if (message.finalTokenTransaction !== void 0) {
1859
- obj.finalTokenTransaction = TokenTransaction.toJSON(message.finalTokenTransaction);
1860
- }
1861
- if (message.finalTokenTransactionHash.length !== 0) {
1862
- obj.finalTokenTransactionHash = base64FromBytes(message.finalTokenTransactionHash);
1863
- }
1864
- return obj;
1865
- },
1866
- create(base) {
1867
- return TokenTransactionResponse.fromPartial(base ?? {});
1868
- },
1869
- fromPartial(object) {
1870
- const message = createBaseTokenTransactionResponse();
1871
- message.finalized = object.finalized ?? false;
1872
- message.finalTokenTransaction = object.finalTokenTransaction !== void 0 && object.finalTokenTransaction !== null ? TokenTransaction.fromPartial(object.finalTokenTransaction) : void 0;
1873
- message.finalTokenTransactionHash = object.finalTokenTransactionHash ?? new Uint8Array(0);
1874
- return message;
1875
- }
1876
- };
1877
- function createBaseTransaction() {
1878
- return { transaction: void 0 };
1879
- }
1880
- var Transaction = {
1881
- encode(message, writer = new BinaryWriter()) {
1882
- switch (message.transaction?.$case) {
1883
- case "onChain":
1884
- OnChainTransaction.encode(message.transaction.onChain, writer.uint32(10).fork()).join();
1885
- break;
1886
- case "spark":
1887
- SparkTransaction.encode(message.transaction.spark, writer.uint32(18).fork()).join();
1888
- break;
1889
- }
1890
- return writer;
1891
- },
1892
- decode(input, length) {
1893
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1894
- let end = length === void 0 ? reader.len : reader.pos + length;
1895
- const message = createBaseTransaction();
1896
- while (reader.pos < end) {
1897
- const tag = reader.uint32();
1898
- switch (tag >>> 3) {
1899
- case 1: {
1900
- if (tag !== 10) {
1901
- break;
1902
- }
1903
- message.transaction = { $case: "onChain", onChain: OnChainTransaction.decode(reader, reader.uint32()) };
1904
- continue;
1905
- }
1906
- case 2: {
1907
- if (tag !== 18) {
1908
- break;
1909
- }
1910
- message.transaction = { $case: "spark", spark: SparkTransaction.decode(reader, reader.uint32()) };
1911
- continue;
1912
- }
1913
- }
1914
- if ((tag & 7) === 4 || tag === 0) {
1915
- break;
1916
- }
1917
- reader.skip(tag & 7);
1918
- }
1919
- return message;
1920
- },
1921
- fromJSON(object) {
1922
- return {
1923
- transaction: isSet(object.onChain) ? { $case: "onChain", onChain: OnChainTransaction.fromJSON(object.onChain) } : isSet(object.spark) ? { $case: "spark", spark: SparkTransaction.fromJSON(object.spark) } : void 0
1924
- };
1925
- },
1926
- toJSON(message) {
1927
- const obj = {};
1928
- if (message.transaction?.$case === "onChain") {
1929
- obj.onChain = OnChainTransaction.toJSON(message.transaction.onChain);
1930
- } else if (message.transaction?.$case === "spark") {
1931
- obj.spark = SparkTransaction.toJSON(message.transaction.spark);
1932
- }
1933
- return obj;
1934
- },
1935
- create(base) {
1936
- return Transaction.fromPartial(base ?? {});
1937
- },
1938
- fromPartial(object) {
1939
- const message = createBaseTransaction();
1940
- switch (object.transaction?.$case) {
1941
- case "onChain": {
1942
- if (object.transaction?.onChain !== void 0 && object.transaction?.onChain !== null) {
1943
- message.transaction = {
1944
- $case: "onChain",
1945
- onChain: OnChainTransaction.fromPartial(object.transaction.onChain)
1946
- };
1947
- }
1948
- break;
1949
- }
1950
- case "spark": {
1951
- if (object.transaction?.spark !== void 0 && object.transaction?.spark !== null) {
1952
- message.transaction = { $case: "spark", spark: SparkTransaction.fromPartial(object.transaction.spark) };
1953
- }
1954
- break;
1955
- }
1956
- }
1957
- return message;
1958
- }
1959
- };
1960
- function createBaseListAllTokenTransactionsCursor() {
1961
- return { lastTransactionHash: new Uint8Array(0), layer: 0 };
1962
- }
1963
- var ListAllTokenTransactionsCursor = {
1964
- encode(message, writer = new BinaryWriter()) {
1965
- if (message.lastTransactionHash.length !== 0) {
1966
- writer.uint32(10).bytes(message.lastTransactionHash);
1967
- }
1968
- if (message.layer !== 0) {
1969
- writer.uint32(16).int32(message.layer);
1970
- }
1971
- return writer;
1972
- },
1973
- decode(input, length) {
1974
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1975
- let end = length === void 0 ? reader.len : reader.pos + length;
1976
- const message = createBaseListAllTokenTransactionsCursor();
1977
- while (reader.pos < end) {
1978
- const tag = reader.uint32();
1979
- switch (tag >>> 3) {
1980
- case 1: {
1981
- if (tag !== 10) {
1982
- break;
1983
- }
1984
- message.lastTransactionHash = reader.bytes();
1985
- continue;
1986
- }
1987
- case 2: {
1988
- if (tag !== 16) {
1989
- break;
1990
- }
1991
- message.layer = reader.int32();
1992
- continue;
1993
- }
1994
- }
1995
- if ((tag & 7) === 4 || tag === 0) {
1996
- break;
1997
- }
1998
- reader.skip(tag & 7);
1999
- }
2000
- return message;
2001
- },
2002
- fromJSON(object) {
2003
- return {
2004
- lastTransactionHash: isSet(object.lastTransactionHash) ? bytesFromBase64(object.lastTransactionHash) : new Uint8Array(0),
2005
- layer: isSet(object.layer) ? layerFromJSON(object.layer) : 0
2006
- };
2007
- },
2008
- toJSON(message) {
2009
- const obj = {};
2010
- if (message.lastTransactionHash.length !== 0) {
2011
- obj.lastTransactionHash = base64FromBytes(message.lastTransactionHash);
2012
- }
2013
- if (message.layer !== 0) {
2014
- obj.layer = layerToJSON(message.layer);
2015
- }
2016
- return obj;
2017
- },
2018
- create(base) {
2019
- return ListAllTokenTransactionsCursor.fromPartial(base ?? {});
2020
- },
2021
- fromPartial(object) {
2022
- const message = createBaseListAllTokenTransactionsCursor();
2023
- message.lastTransactionHash = object.lastTransactionHash ?? new Uint8Array(0);
2024
- message.layer = object.layer ?? 0;
2025
- return message;
2026
- }
2027
- };
2028
- function createBaseOnChainTokenOutput() {
2029
- return { rawTx: new Uint8Array(0), vout: 0, amountSats: 0, tokenPublicKey: void 0, tokenAmount: void 0 };
2030
- }
2031
- var OnChainTokenOutput = {
2032
- encode(message, writer = new BinaryWriter()) {
2033
- if (message.rawTx.length !== 0) {
2034
- writer.uint32(10).bytes(message.rawTx);
2035
- }
2036
- if (message.vout !== 0) {
2037
- writer.uint32(16).uint32(message.vout);
2038
- }
2039
- if (message.amountSats !== 0) {
2040
- writer.uint32(24).uint64(message.amountSats);
2041
- }
2042
- if (message.tokenPublicKey !== void 0) {
2043
- writer.uint32(34).string(message.tokenPublicKey);
2044
- }
2045
- if (message.tokenAmount !== void 0) {
2046
- writer.uint32(42).bytes(message.tokenAmount);
2047
- }
2048
- return writer;
2049
- },
2050
- decode(input, length) {
2051
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2052
- let end = length === void 0 ? reader.len : reader.pos + length;
2053
- const message = createBaseOnChainTokenOutput();
2054
- while (reader.pos < end) {
2055
- const tag = reader.uint32();
2056
- switch (tag >>> 3) {
2057
- case 1: {
2058
- if (tag !== 10) {
2059
- break;
2060
- }
2061
- message.rawTx = reader.bytes();
2062
- continue;
2063
- }
2064
- case 2: {
2065
- if (tag !== 16) {
2066
- break;
2067
- }
2068
- message.vout = reader.uint32();
2069
- continue;
2070
- }
2071
- case 3: {
2072
- if (tag !== 24) {
2073
- break;
2074
- }
2075
- message.amountSats = longToNumber(reader.uint64());
2076
- continue;
2077
- }
2078
- case 4: {
2079
- if (tag !== 34) {
2080
- break;
2081
- }
2082
- message.tokenPublicKey = reader.string();
2083
- continue;
2084
- }
2085
- case 5: {
2086
- if (tag !== 42) {
2087
- break;
2088
- }
2089
- message.tokenAmount = reader.bytes();
2090
- continue;
2091
- }
2092
- }
2093
- if ((tag & 7) === 4 || tag === 0) {
2094
- break;
2095
- }
2096
- reader.skip(tag & 7);
2097
- }
2098
- return message;
2099
- },
2100
- fromJSON(object) {
2101
- return {
2102
- rawTx: isSet(object.rawTx) ? bytesFromBase64(object.rawTx) : new Uint8Array(0),
2103
- vout: isSet(object.vout) ? globalThis.Number(object.vout) : 0,
2104
- amountSats: isSet(object.amountSats) ? globalThis.Number(object.amountSats) : 0,
2105
- tokenPublicKey: isSet(object.tokenPublicKey) ? globalThis.String(object.tokenPublicKey) : void 0,
2106
- tokenAmount: isSet(object.tokenAmount) ? bytesFromBase64(object.tokenAmount) : void 0
2107
- };
2108
- },
2109
- toJSON(message) {
2110
- const obj = {};
2111
- if (message.rawTx.length !== 0) {
2112
- obj.rawTx = base64FromBytes(message.rawTx);
2113
- }
2114
- if (message.vout !== 0) {
2115
- obj.vout = Math.round(message.vout);
2116
- }
2117
- if (message.amountSats !== 0) {
2118
- obj.amountSats = Math.round(message.amountSats);
2119
- }
2120
- if (message.tokenPublicKey !== void 0) {
2121
- obj.tokenPublicKey = message.tokenPublicKey;
2122
- }
2123
- if (message.tokenAmount !== void 0) {
2124
- obj.tokenAmount = base64FromBytes(message.tokenAmount);
2125
- }
2126
- return obj;
2127
- },
2128
- create(base) {
2129
- return OnChainTokenOutput.fromPartial(base ?? {});
2130
- },
2131
- fromPartial(object) {
2132
- const message = createBaseOnChainTokenOutput();
2133
- message.rawTx = object.rawTx ?? new Uint8Array(0);
2134
- message.vout = object.vout ?? 0;
2135
- message.amountSats = object.amountSats ?? 0;
2136
- message.tokenPublicKey = object.tokenPublicKey ?? void 0;
2137
- message.tokenAmount = object.tokenAmount ?? void 0;
2138
- return message;
2139
- }
2140
- };
2141
- function createBaseOnChainTransaction() {
2142
- return {
2143
- operationType: 0,
2144
- transactionHash: new Uint8Array(0),
2145
- rawtx: new Uint8Array(0),
2146
- status: 0,
2147
- inputs: [],
2148
- outputs: [],
2149
- broadcastedAt: void 0,
2150
- confirmedAt: void 0
2151
- };
2152
- }
2153
- var OnChainTransaction = {
2154
- encode(message, writer = new BinaryWriter()) {
2155
- if (message.operationType !== 0) {
2156
- writer.uint32(8).int32(message.operationType);
2157
- }
2158
- if (message.transactionHash.length !== 0) {
2159
- writer.uint32(18).bytes(message.transactionHash);
2160
- }
2161
- if (message.rawtx.length !== 0) {
2162
- writer.uint32(26).bytes(message.rawtx);
2163
- }
2164
- if (message.status !== 0) {
2165
- writer.uint32(32).int32(message.status);
2166
- }
2167
- for (const v of message.inputs) {
2168
- OnChainTokenOutput.encode(v, writer.uint32(42).fork()).join();
2169
- }
2170
- for (const v of message.outputs) {
2171
- OnChainTokenOutput.encode(v, writer.uint32(50).fork()).join();
2172
- }
2173
- if (message.broadcastedAt !== void 0) {
2174
- Timestamp.encode(toTimestamp(message.broadcastedAt), writer.uint32(58).fork()).join();
2175
- }
2176
- if (message.confirmedAt !== void 0) {
2177
- Timestamp.encode(toTimestamp(message.confirmedAt), writer.uint32(66).fork()).join();
2178
- }
2179
- return writer;
2180
- },
2181
- decode(input, length) {
2182
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2183
- let end = length === void 0 ? reader.len : reader.pos + length;
2184
- const message = createBaseOnChainTransaction();
2185
- while (reader.pos < end) {
2186
- const tag = reader.uint32();
2187
- switch (tag >>> 3) {
2188
- case 1: {
2189
- if (tag !== 8) {
2190
- break;
2191
- }
2192
- message.operationType = reader.int32();
2193
- continue;
2194
- }
2195
- case 2: {
2196
- if (tag !== 18) {
2197
- break;
2198
- }
2199
- message.transactionHash = reader.bytes();
2200
- continue;
2201
- }
2202
- case 3: {
2203
- if (tag !== 26) {
2204
- break;
2205
- }
2206
- message.rawtx = reader.bytes();
2207
- continue;
2208
- }
2209
- case 4: {
2210
- if (tag !== 32) {
2211
- break;
2212
- }
2213
- message.status = reader.int32();
2214
- continue;
2215
- }
2216
- case 5: {
2217
- if (tag !== 42) {
2218
- break;
2219
- }
2220
- message.inputs.push(OnChainTokenOutput.decode(reader, reader.uint32()));
2221
- continue;
2222
- }
2223
- case 6: {
2224
- if (tag !== 50) {
2225
- break;
2226
- }
2227
- message.outputs.push(OnChainTokenOutput.decode(reader, reader.uint32()));
2228
- continue;
2229
- }
2230
- case 7: {
2231
- if (tag !== 58) {
2232
- break;
2233
- }
2234
- message.broadcastedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2235
- continue;
2236
- }
2237
- case 8: {
2238
- if (tag !== 66) {
2239
- break;
2240
- }
2241
- message.confirmedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2242
- continue;
2243
- }
2244
- }
2245
- if ((tag & 7) === 4 || tag === 0) {
2246
- break;
2247
- }
2248
- reader.skip(tag & 7);
2249
- }
2250
- return message;
2251
- },
2252
- fromJSON(object) {
2253
- return {
2254
- operationType: isSet(object.operationType) ? operationTypeFromJSON(object.operationType) : 0,
2255
- transactionHash: isSet(object.transactionHash) ? bytesFromBase64(object.transactionHash) : new Uint8Array(0),
2256
- rawtx: isSet(object.rawtx) ? bytesFromBase64(object.rawtx) : new Uint8Array(0),
2257
- status: isSet(object.status) ? onChainTransactionStatusFromJSON(object.status) : 0,
2258
- inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e) => OnChainTokenOutput.fromJSON(e)) : [],
2259
- outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e) => OnChainTokenOutput.fromJSON(e)) : [],
2260
- broadcastedAt: isSet(object.broadcastedAt) ? fromJsonTimestamp(object.broadcastedAt) : void 0,
2261
- confirmedAt: isSet(object.confirmedAt) ? fromJsonTimestamp(object.confirmedAt) : void 0
2262
- };
2263
- },
2264
- toJSON(message) {
2265
- const obj = {};
2266
- if (message.operationType !== 0) {
2267
- obj.operationType = operationTypeToJSON(message.operationType);
2268
- }
2269
- if (message.transactionHash.length !== 0) {
2270
- obj.transactionHash = base64FromBytes(message.transactionHash);
2271
- }
2272
- if (message.rawtx.length !== 0) {
2273
- obj.rawtx = base64FromBytes(message.rawtx);
2274
- }
2275
- if (message.status !== 0) {
2276
- obj.status = onChainTransactionStatusToJSON(message.status);
2277
- }
2278
- if (message.inputs?.length) {
2279
- obj.inputs = message.inputs.map((e) => OnChainTokenOutput.toJSON(e));
2280
- }
2281
- if (message.outputs?.length) {
2282
- obj.outputs = message.outputs.map((e) => OnChainTokenOutput.toJSON(e));
2283
- }
2284
- if (message.broadcastedAt !== void 0) {
2285
- obj.broadcastedAt = message.broadcastedAt.toISOString();
2286
- }
2287
- if (message.confirmedAt !== void 0) {
2288
- obj.confirmedAt = message.confirmedAt.toISOString();
2289
- }
2290
- return obj;
2291
- },
2292
- create(base) {
2293
- return OnChainTransaction.fromPartial(base ?? {});
2294
- },
2295
- fromPartial(object) {
2296
- const message = createBaseOnChainTransaction();
2297
- message.operationType = object.operationType ?? 0;
2298
- message.transactionHash = object.transactionHash ?? new Uint8Array(0);
2299
- message.rawtx = object.rawtx ?? new Uint8Array(0);
2300
- message.status = object.status ?? 0;
2301
- message.inputs = object.inputs?.map((e) => OnChainTokenOutput.fromPartial(e)) || [];
2302
- message.outputs = object.outputs?.map((e) => OnChainTokenOutput.fromPartial(e)) || [];
2303
- message.broadcastedAt = object.broadcastedAt ?? void 0;
2304
- message.confirmedAt = object.confirmedAt ?? void 0;
2305
- return message;
2306
- }
2307
- };
2308
- function createBaseSparkTransaction() {
2309
- return {
2310
- operationType: 0,
2311
- transactionHash: new Uint8Array(0),
2312
- status: 0,
2313
- confirmedAt: void 0,
2314
- leavesToCreate: [],
2315
- leavesToSpend: [],
2316
- sparkOperatorIdentityPublicKeys: []
2317
- };
2318
- }
2319
- var SparkTransaction = {
2320
- encode(message, writer = new BinaryWriter()) {
2321
- if (message.operationType !== 0) {
2322
- writer.uint32(8).int32(message.operationType);
2323
- }
2324
- if (message.transactionHash.length !== 0) {
2325
- writer.uint32(18).bytes(message.transactionHash);
2326
- }
2327
- if (message.status !== 0) {
2328
- writer.uint32(24).int32(message.status);
2329
- }
2330
- if (message.confirmedAt !== void 0) {
2331
- Timestamp.encode(toTimestamp(message.confirmedAt), writer.uint32(34).fork()).join();
2332
- }
2333
- for (const v of message.leavesToCreate) {
2334
- SparkLeaf.encode(v, writer.uint32(42).fork()).join();
2335
- }
2336
- for (const v of message.leavesToSpend) {
2337
- SparkLeaf.encode(v, writer.uint32(50).fork()).join();
2338
- }
2339
- for (const v of message.sparkOperatorIdentityPublicKeys) {
2340
- writer.uint32(58).bytes(v);
2341
- }
2342
- return writer;
2343
- },
2344
- decode(input, length) {
2345
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2346
- let end = length === void 0 ? reader.len : reader.pos + length;
2347
- const message = createBaseSparkTransaction();
2348
- while (reader.pos < end) {
2349
- const tag = reader.uint32();
2350
- switch (tag >>> 3) {
2351
- case 1: {
2352
- if (tag !== 8) {
2353
- break;
2354
- }
2355
- message.operationType = reader.int32();
2356
- continue;
2357
- }
2358
- case 2: {
2359
- if (tag !== 18) {
2360
- break;
2361
- }
2362
- message.transactionHash = reader.bytes();
2363
- continue;
2364
- }
2365
- case 3: {
2366
- if (tag !== 24) {
2367
- break;
2368
- }
2369
- message.status = reader.int32();
2370
- continue;
2371
- }
2372
- case 4: {
2373
- if (tag !== 34) {
2374
- break;
2375
- }
2376
- message.confirmedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2377
- continue;
2378
- }
2379
- case 5: {
2380
- if (tag !== 42) {
2381
- break;
2382
- }
2383
- message.leavesToCreate.push(SparkLeaf.decode(reader, reader.uint32()));
2384
- continue;
2385
- }
2386
- case 6: {
2387
- if (tag !== 50) {
2388
- break;
2389
- }
2390
- message.leavesToSpend.push(SparkLeaf.decode(reader, reader.uint32()));
2391
- continue;
2392
- }
2393
- case 7: {
2394
- if (tag !== 58) {
2395
- break;
2396
- }
2397
- message.sparkOperatorIdentityPublicKeys.push(reader.bytes());
2398
- continue;
2399
- }
2400
- }
2401
- if ((tag & 7) === 4 || tag === 0) {
2402
- break;
2403
- }
2404
- reader.skip(tag & 7);
2405
- }
2406
- return message;
2407
- },
2408
- fromJSON(object) {
2409
- return {
2410
- operationType: isSet(object.operationType) ? operationTypeFromJSON(object.operationType) : 0,
2411
- transactionHash: isSet(object.transactionHash) ? bytesFromBase64(object.transactionHash) : new Uint8Array(0),
2412
- status: isSet(object.status) ? sparkTransactionStatusFromJSON(object.status) : 0,
2413
- confirmedAt: isSet(object.confirmedAt) ? fromJsonTimestamp(object.confirmedAt) : void 0,
2414
- leavesToCreate: globalThis.Array.isArray(object?.leavesToCreate) ? object.leavesToCreate.map((e) => SparkLeaf.fromJSON(e)) : [],
2415
- leavesToSpend: globalThis.Array.isArray(object?.leavesToSpend) ? object.leavesToSpend.map((e) => SparkLeaf.fromJSON(e)) : [],
2416
- sparkOperatorIdentityPublicKeys: globalThis.Array.isArray(object?.sparkOperatorIdentityPublicKeys) ? object.sparkOperatorIdentityPublicKeys.map((e) => bytesFromBase64(e)) : []
2417
- };
2418
- },
2419
- toJSON(message) {
2420
- const obj = {};
2421
- if (message.operationType !== 0) {
2422
- obj.operationType = operationTypeToJSON(message.operationType);
2423
- }
2424
- if (message.transactionHash.length !== 0) {
2425
- obj.transactionHash = base64FromBytes(message.transactionHash);
2426
- }
2427
- if (message.status !== 0) {
2428
- obj.status = sparkTransactionStatusToJSON(message.status);
2429
- }
2430
- if (message.confirmedAt !== void 0) {
2431
- obj.confirmedAt = message.confirmedAt.toISOString();
2432
- }
2433
- if (message.leavesToCreate?.length) {
2434
- obj.leavesToCreate = message.leavesToCreate.map((e) => SparkLeaf.toJSON(e));
2435
- }
2436
- if (message.leavesToSpend?.length) {
2437
- obj.leavesToSpend = message.leavesToSpend.map((e) => SparkLeaf.toJSON(e));
2438
- }
2439
- if (message.sparkOperatorIdentityPublicKeys?.length) {
2440
- obj.sparkOperatorIdentityPublicKeys = message.sparkOperatorIdentityPublicKeys.map((e) => base64FromBytes(e));
2441
- }
2442
- return obj;
2443
- },
2444
- create(base) {
2445
- return SparkTransaction.fromPartial(base ?? {});
2446
- },
2447
- fromPartial(object) {
2448
- const message = createBaseSparkTransaction();
2449
- message.operationType = object.operationType ?? 0;
2450
- message.transactionHash = object.transactionHash ?? new Uint8Array(0);
2451
- message.status = object.status ?? 0;
2452
- message.confirmedAt = object.confirmedAt ?? void 0;
2453
- message.leavesToCreate = object.leavesToCreate?.map((e) => SparkLeaf.fromPartial(e)) || [];
2454
- message.leavesToSpend = object.leavesToSpend?.map((e) => SparkLeaf.fromPartial(e)) || [];
2455
- message.sparkOperatorIdentityPublicKeys = object.sparkOperatorIdentityPublicKeys?.map((e) => e) || [];
2456
- return message;
2457
- }
2458
- };
2459
- function createBaseSparkLeaf() {
2460
- return {
2461
- tokenPublicKey: new Uint8Array(0),
2462
- id: "",
2463
- ownerPublicKey: new Uint8Array(0),
2464
- revocationPublicKey: new Uint8Array(0),
2465
- withdrawalBondSats: 0,
2466
- withdrawalLocktime: 0,
2467
- tokenAmount: new Uint8Array(0),
2468
- createTxHash: new Uint8Array(0),
2469
- createTxVoutIndex: 0,
2470
- spendTxHash: void 0,
2471
- spendTxVoutIndex: void 0,
2472
- isFrozen: void 0
2473
- };
2474
- }
2475
- var SparkLeaf = {
2476
- encode(message, writer = new BinaryWriter()) {
2477
- if (message.tokenPublicKey.length !== 0) {
2478
- writer.uint32(10).bytes(message.tokenPublicKey);
2479
- }
2480
- if (message.id !== "") {
2481
- writer.uint32(18).string(message.id);
2482
- }
2483
- if (message.ownerPublicKey.length !== 0) {
2484
- writer.uint32(26).bytes(message.ownerPublicKey);
2485
- }
2486
- if (message.revocationPublicKey.length !== 0) {
2487
- writer.uint32(34).bytes(message.revocationPublicKey);
2488
- }
2489
- if (message.withdrawalBondSats !== 0) {
2490
- writer.uint32(40).uint64(message.withdrawalBondSats);
2491
- }
2492
- if (message.withdrawalLocktime !== 0) {
2493
- writer.uint32(48).uint64(message.withdrawalLocktime);
2494
- }
2495
- if (message.tokenAmount.length !== 0) {
2496
- writer.uint32(58).bytes(message.tokenAmount);
2497
- }
2498
- if (message.createTxHash.length !== 0) {
2499
- writer.uint32(66).bytes(message.createTxHash);
2500
- }
2501
- if (message.createTxVoutIndex !== 0) {
2502
- writer.uint32(72).uint32(message.createTxVoutIndex);
2503
- }
2504
- if (message.spendTxHash !== void 0) {
2505
- writer.uint32(82).bytes(message.spendTxHash);
2506
- }
2507
- if (message.spendTxVoutIndex !== void 0) {
2508
- writer.uint32(88).uint32(message.spendTxVoutIndex);
2509
- }
2510
- if (message.isFrozen !== void 0) {
2511
- writer.uint32(96).bool(message.isFrozen);
2512
- }
2513
- return writer;
2514
- },
2515
- decode(input, length) {
2516
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2517
- let end = length === void 0 ? reader.len : reader.pos + length;
2518
- const message = createBaseSparkLeaf();
2519
- while (reader.pos < end) {
2520
- const tag = reader.uint32();
2521
- switch (tag >>> 3) {
2522
- case 1: {
2523
- if (tag !== 10) {
2524
- break;
2525
- }
2526
- message.tokenPublicKey = reader.bytes();
2527
- continue;
2528
- }
2529
- case 2: {
2530
- if (tag !== 18) {
2531
- break;
2532
- }
2533
- message.id = reader.string();
2534
- continue;
2535
- }
2536
- case 3: {
2537
- if (tag !== 26) {
2538
- break;
2539
- }
2540
- message.ownerPublicKey = reader.bytes();
2541
- continue;
2542
- }
2543
- case 4: {
2544
- if (tag !== 34) {
2545
- break;
2546
- }
2547
- message.revocationPublicKey = reader.bytes();
2548
- continue;
2549
- }
2550
- case 5: {
2551
- if (tag !== 40) {
2552
- break;
2553
- }
2554
- message.withdrawalBondSats = longToNumber(reader.uint64());
2555
- continue;
2556
- }
2557
- case 6: {
2558
- if (tag !== 48) {
2559
- break;
2560
- }
2561
- message.withdrawalLocktime = longToNumber(reader.uint64());
2562
- continue;
2563
- }
2564
- case 7: {
2565
- if (tag !== 58) {
2566
- break;
2567
- }
2568
- message.tokenAmount = reader.bytes();
2569
- continue;
2570
- }
2571
- case 8: {
2572
- if (tag !== 66) {
2573
- break;
2574
- }
2575
- message.createTxHash = reader.bytes();
2576
- continue;
2577
- }
2578
- case 9: {
2579
- if (tag !== 72) {
2580
- break;
2581
- }
2582
- message.createTxVoutIndex = reader.uint32();
2583
- continue;
2584
- }
2585
- case 10: {
2586
- if (tag !== 82) {
2587
- break;
2588
- }
2589
- message.spendTxHash = reader.bytes();
2590
- continue;
2591
- }
2592
- case 11: {
2593
- if (tag !== 88) {
2594
- break;
2595
- }
2596
- message.spendTxVoutIndex = reader.uint32();
2597
- continue;
2598
- }
2599
- case 12: {
2600
- if (tag !== 96) {
2601
- break;
2602
- }
2603
- message.isFrozen = reader.bool();
2604
- continue;
2605
- }
2606
- }
2607
- if ((tag & 7) === 4 || tag === 0) {
2608
- break;
2609
- }
2610
- reader.skip(tag & 7);
2611
- }
2612
- return message;
2613
- },
2614
- fromJSON(object) {
2615
- return {
2616
- tokenPublicKey: isSet(object.tokenPublicKey) ? bytesFromBase64(object.tokenPublicKey) : new Uint8Array(0),
2617
- id: isSet(object.id) ? globalThis.String(object.id) : "",
2618
- ownerPublicKey: isSet(object.ownerPublicKey) ? bytesFromBase64(object.ownerPublicKey) : new Uint8Array(0),
2619
- revocationPublicKey: isSet(object.revocationPublicKey) ? bytesFromBase64(object.revocationPublicKey) : new Uint8Array(0),
2620
- withdrawalBondSats: isSet(object.withdrawalBondSats) ? globalThis.Number(object.withdrawalBondSats) : 0,
2621
- withdrawalLocktime: isSet(object.withdrawalLocktime) ? globalThis.Number(object.withdrawalLocktime) : 0,
2622
- tokenAmount: isSet(object.tokenAmount) ? bytesFromBase64(object.tokenAmount) : new Uint8Array(0),
2623
- createTxHash: isSet(object.createTxHash) ? bytesFromBase64(object.createTxHash) : new Uint8Array(0),
2624
- createTxVoutIndex: isSet(object.createTxVoutIndex) ? globalThis.Number(object.createTxVoutIndex) : 0,
2625
- spendTxHash: isSet(object.spendTxHash) ? bytesFromBase64(object.spendTxHash) : void 0,
2626
- spendTxVoutIndex: isSet(object.spendTxVoutIndex) ? globalThis.Number(object.spendTxVoutIndex) : void 0,
2627
- isFrozen: isSet(object.isFrozen) ? globalThis.Boolean(object.isFrozen) : void 0
2628
- };
2629
- },
2630
- toJSON(message) {
2631
- const obj = {};
2632
- if (message.tokenPublicKey.length !== 0) {
2633
- obj.tokenPublicKey = base64FromBytes(message.tokenPublicKey);
2634
- }
2635
- if (message.id !== "") {
2636
- obj.id = message.id;
2637
- }
2638
- if (message.ownerPublicKey.length !== 0) {
2639
- obj.ownerPublicKey = base64FromBytes(message.ownerPublicKey);
2640
- }
2641
- if (message.revocationPublicKey.length !== 0) {
2642
- obj.revocationPublicKey = base64FromBytes(message.revocationPublicKey);
2643
- }
2644
- if (message.withdrawalBondSats !== 0) {
2645
- obj.withdrawalBondSats = Math.round(message.withdrawalBondSats);
2646
- }
2647
- if (message.withdrawalLocktime !== 0) {
2648
- obj.withdrawalLocktime = Math.round(message.withdrawalLocktime);
2649
- }
2650
- if (message.tokenAmount.length !== 0) {
2651
- obj.tokenAmount = base64FromBytes(message.tokenAmount);
2652
- }
2653
- if (message.createTxHash.length !== 0) {
2654
- obj.createTxHash = base64FromBytes(message.createTxHash);
2655
- }
2656
- if (message.createTxVoutIndex !== 0) {
2657
- obj.createTxVoutIndex = Math.round(message.createTxVoutIndex);
2658
- }
2659
- if (message.spendTxHash !== void 0) {
2660
- obj.spendTxHash = base64FromBytes(message.spendTxHash);
2661
- }
2662
- if (message.spendTxVoutIndex !== void 0) {
2663
- obj.spendTxVoutIndex = Math.round(message.spendTxVoutIndex);
2664
- }
2665
- if (message.isFrozen !== void 0) {
2666
- obj.isFrozen = message.isFrozen;
2667
- }
2668
- return obj;
2669
- },
2670
- create(base) {
2671
- return SparkLeaf.fromPartial(base ?? {});
2672
- },
2673
- fromPartial(object) {
2674
- const message = createBaseSparkLeaf();
2675
- message.tokenPublicKey = object.tokenPublicKey ?? new Uint8Array(0);
2676
- message.id = object.id ?? "";
2677
- message.ownerPublicKey = object.ownerPublicKey ?? new Uint8Array(0);
2678
- message.revocationPublicKey = object.revocationPublicKey ?? new Uint8Array(0);
2679
- message.withdrawalBondSats = object.withdrawalBondSats ?? 0;
2680
- message.withdrawalLocktime = object.withdrawalLocktime ?? 0;
2681
- message.tokenAmount = object.tokenAmount ?? new Uint8Array(0);
2682
- message.createTxHash = object.createTxHash ?? new Uint8Array(0);
2683
- message.createTxVoutIndex = object.createTxVoutIndex ?? 0;
2684
- message.spendTxHash = object.spendTxHash ?? void 0;
2685
- message.spendTxVoutIndex = object.spendTxVoutIndex ?? void 0;
2686
- message.isFrozen = object.isFrozen ?? void 0;
2687
- return message;
2688
- }
2689
- };
2690
- function createBaseBlockInfo() {
2691
- return { blockHash: new Uint8Array(0), blockHeight: 0, minedAt: void 0 };
2692
- }
2693
- var BlockInfo = {
2694
- encode(message, writer = new BinaryWriter()) {
2695
- if (message.blockHash.length !== 0) {
2696
- writer.uint32(10).bytes(message.blockHash);
2697
- }
2698
- if (message.blockHeight !== 0) {
2699
- writer.uint32(16).uint32(message.blockHeight);
2700
- }
2701
- if (message.minedAt !== void 0) {
2702
- Timestamp.encode(toTimestamp(message.minedAt), writer.uint32(34).fork()).join();
2703
- }
2704
- return writer;
2705
- },
2706
- decode(input, length) {
2707
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2708
- let end = length === void 0 ? reader.len : reader.pos + length;
2709
- const message = createBaseBlockInfo();
2710
- while (reader.pos < end) {
2711
- const tag = reader.uint32();
2712
- switch (tag >>> 3) {
2713
- case 1: {
2714
- if (tag !== 10) {
2715
- break;
2716
- }
2717
- message.blockHash = reader.bytes();
2718
- continue;
2719
- }
2720
- case 2: {
2721
- if (tag !== 16) {
2722
- break;
2723
- }
2724
- message.blockHeight = reader.uint32();
2725
- continue;
2726
- }
2727
- case 4: {
2728
- if (tag !== 34) {
2729
- break;
2730
- }
2731
- message.minedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2732
- continue;
2733
- }
2734
- }
2735
- if ((tag & 7) === 4 || tag === 0) {
2736
- break;
2737
- }
2738
- reader.skip(tag & 7);
2739
- }
2740
- return message;
2741
- },
2742
- fromJSON(object) {
2743
- return {
2744
- blockHash: isSet(object.blockHash) ? bytesFromBase64(object.blockHash) : new Uint8Array(0),
2745
- blockHeight: isSet(object.blockHeight) ? globalThis.Number(object.blockHeight) : 0,
2746
- minedAt: isSet(object.minedAt) ? fromJsonTimestamp(object.minedAt) : void 0
2747
- };
2748
- },
2749
- toJSON(message) {
2750
- const obj = {};
2751
- if (message.blockHash.length !== 0) {
2752
- obj.blockHash = base64FromBytes(message.blockHash);
2753
- }
2754
- if (message.blockHeight !== 0) {
2755
- obj.blockHeight = Math.round(message.blockHeight);
2756
- }
2757
- if (message.minedAt !== void 0) {
2758
- obj.minedAt = message.minedAt.toISOString();
2759
- }
2760
- return obj;
2761
- },
2762
- create(base) {
2763
- return BlockInfo.fromPartial(base ?? {});
2764
- },
2765
- fromPartial(object) {
2766
- const message = createBaseBlockInfo();
2767
- message.blockHash = object.blockHash ?? new Uint8Array(0);
2768
- message.blockHeight = object.blockHeight ?? 0;
2769
- message.minedAt = object.minedAt ?? void 0;
2770
- return message;
2771
- }
2772
- };
2773
- function createBaseTokenPubkey() {
2774
- return { publicKey: new Uint8Array(0) };
2775
- }
2776
- var TokenPubkey = {
2777
- encode(message, writer = new BinaryWriter()) {
2778
- if (message.publicKey.length !== 0) {
2779
- writer.uint32(10).bytes(message.publicKey);
2780
- }
2781
- return writer;
2782
- },
2783
- decode(input, length) {
2784
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2785
- let end = length === void 0 ? reader.len : reader.pos + length;
2786
- const message = createBaseTokenPubkey();
2787
- while (reader.pos < end) {
2788
- const tag = reader.uint32();
2789
- switch (tag >>> 3) {
2790
- case 1: {
2791
- if (tag !== 10) {
2792
- break;
2793
- }
2794
- message.publicKey = reader.bytes();
2795
- continue;
2796
- }
2797
- }
2798
- if ((tag & 7) === 4 || tag === 0) {
2799
- break;
2800
- }
2801
- reader.skip(tag & 7);
2802
- }
2803
- return message;
2804
- },
2805
- fromJSON(object) {
2806
- return { publicKey: isSet(object.publicKey) ? bytesFromBase64(object.publicKey) : new Uint8Array(0) };
2807
- },
2808
- toJSON(message) {
2809
- const obj = {};
2810
- if (message.publicKey.length !== 0) {
2811
- obj.publicKey = base64FromBytes(message.publicKey);
2812
- }
2813
- return obj;
2814
- },
2815
- create(base) {
2816
- return TokenPubkey.fromPartial(base ?? {});
2817
- },
2818
- fromPartial(object) {
2819
- const message = createBaseTokenPubkey();
2820
- message.publicKey = object.publicKey ?? new Uint8Array(0);
2821
- return message;
2822
- }
2823
- };
2824
- function createBaseTokenPubkeyAnnouncement() {
2825
- return {
2826
- publicKey: void 0,
2827
- name: "",
2828
- symbol: "",
2829
- decimal: new Uint8Array(0),
2830
- maxSupply: new Uint8Array(0),
2831
- isFreezable: false
2832
- };
2833
- }
2834
- var TokenPubkeyAnnouncement = {
2835
- encode(message, writer = new BinaryWriter()) {
2836
- if (message.publicKey !== void 0) {
2837
- TokenPubkey.encode(message.publicKey, writer.uint32(10).fork()).join();
2838
- }
2839
- if (message.name !== "") {
2840
- writer.uint32(18).string(message.name);
2841
- }
2842
- if (message.symbol !== "") {
2843
- writer.uint32(26).string(message.symbol);
2844
- }
2845
- if (message.decimal.length !== 0) {
2846
- writer.uint32(34).bytes(message.decimal);
2847
- }
2848
- if (message.maxSupply.length !== 0) {
2849
- writer.uint32(42).bytes(message.maxSupply);
2850
- }
2851
- if (message.isFreezable !== false) {
2852
- writer.uint32(48).bool(message.isFreezable);
2853
- }
2854
- return writer;
2855
- },
2856
- decode(input, length) {
2857
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2858
- let end = length === void 0 ? reader.len : reader.pos + length;
2859
- const message = createBaseTokenPubkeyAnnouncement();
2860
- while (reader.pos < end) {
2861
- const tag = reader.uint32();
2862
- switch (tag >>> 3) {
2863
- case 1: {
2864
- if (tag !== 10) {
2865
- break;
2866
- }
2867
- message.publicKey = TokenPubkey.decode(reader, reader.uint32());
2868
- continue;
2869
- }
2870
- case 2: {
2871
- if (tag !== 18) {
2872
- break;
2873
- }
2874
- message.name = reader.string();
2875
- continue;
2876
- }
2877
- case 3: {
2878
- if (tag !== 26) {
2879
- break;
2880
- }
2881
- message.symbol = reader.string();
2882
- continue;
2883
- }
2884
- case 4: {
2885
- if (tag !== 34) {
2886
- break;
2887
- }
2888
- message.decimal = reader.bytes();
2889
- continue;
2890
- }
2891
- case 5: {
2892
- if (tag !== 42) {
2893
- break;
2894
- }
2895
- message.maxSupply = reader.bytes();
2896
- continue;
2897
- }
2898
- case 6: {
2899
- if (tag !== 48) {
2900
- break;
2901
- }
2902
- message.isFreezable = reader.bool();
2903
- continue;
2904
- }
2905
- }
2906
- if ((tag & 7) === 4 || tag === 0) {
2907
- break;
2908
- }
2909
- reader.skip(tag & 7);
2910
- }
2911
- return message;
2912
- },
2913
- fromJSON(object) {
2914
- return {
2915
- publicKey: isSet(object.publicKey) ? TokenPubkey.fromJSON(object.publicKey) : void 0,
2916
- name: isSet(object.name) ? globalThis.String(object.name) : "",
2917
- symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "",
2918
- decimal: isSet(object.decimal) ? bytesFromBase64(object.decimal) : new Uint8Array(0),
2919
- maxSupply: isSet(object.maxSupply) ? bytesFromBase64(object.maxSupply) : new Uint8Array(0),
2920
- isFreezable: isSet(object.isFreezable) ? globalThis.Boolean(object.isFreezable) : false
2921
- };
2922
- },
2923
- toJSON(message) {
2924
- const obj = {};
2925
- if (message.publicKey !== void 0) {
2926
- obj.publicKey = TokenPubkey.toJSON(message.publicKey);
2927
- }
2928
- if (message.name !== "") {
2929
- obj.name = message.name;
2930
- }
2931
- if (message.symbol !== "") {
2932
- obj.symbol = message.symbol;
2933
- }
2934
- if (message.decimal.length !== 0) {
2935
- obj.decimal = base64FromBytes(message.decimal);
2936
- }
2937
- if (message.maxSupply.length !== 0) {
2938
- obj.maxSupply = base64FromBytes(message.maxSupply);
2939
- }
2940
- if (message.isFreezable !== false) {
2941
- obj.isFreezable = message.isFreezable;
2942
- }
2943
- return obj;
2944
- },
2945
- create(base) {
2946
- return TokenPubkeyAnnouncement.fromPartial(base ?? {});
2947
- },
2948
- fromPartial(object) {
2949
- const message = createBaseTokenPubkeyAnnouncement();
2950
- message.publicKey = object.publicKey !== void 0 && object.publicKey !== null ? TokenPubkey.fromPartial(object.publicKey) : void 0;
2951
- message.name = object.name ?? "";
2952
- message.symbol = object.symbol ?? "";
2953
- message.decimal = object.decimal ?? new Uint8Array(0);
2954
- message.maxSupply = object.maxSupply ?? new Uint8Array(0);
2955
- message.isFreezable = object.isFreezable ?? false;
2956
- return message;
2957
- }
2958
- };
2959
- var SparkServiceDefinition = {
2960
- name: "SparkService",
2961
- fullName: "rpc.v1.SparkService",
2962
- methods: {
2963
- sendSparkSignature: {
2964
- name: "SendSparkSignature",
2965
- requestType: SendSparkSignatureRequest,
2966
- requestStream: false,
2967
- responseType: Empty,
2968
- responseStream: false,
2969
- options: {}
2970
- },
2971
- listSparkTxs: {
2972
- name: "ListSparkTxs",
2973
- requestType: ListSparkTxsRequest,
2974
- requestStream: false,
2975
- responseType: ListSparkTxsResponse,
2976
- responseStream: false,
2977
- options: {}
2978
- },
2979
- listTransactions: {
2980
- name: "ListTransactions",
2981
- requestType: ListAllTokenTransactionsRequest,
2982
- requestStream: false,
2983
- responseType: ListAllTokenTransactionsResponse,
2984
- responseStream: false,
2985
- options: {}
2986
- },
2987
- listWithdrawnOutputs: {
2988
- name: "ListWithdrawnOutputs",
2989
- requestType: ListWithdrawnOutputsRequest,
2990
- requestStream: false,
2991
- responseType: ListWithdrawnOutputsResponse,
2992
- responseStream: false,
2993
- options: {}
2994
- },
2995
- getSparkTx: {
2996
- name: "GetSparkTx",
2997
- requestType: GetSparkTxRequest,
2998
- requestStream: false,
2999
- responseType: GetSparkTxResponse,
3000
- responseStream: false,
3001
- options: {}
3002
- },
3003
- verifySparkTx: {
3004
- name: "VerifySparkTx",
3005
- requestType: VerifySparkTxRequest,
3006
- requestStream: false,
3007
- responseType: Empty,
3008
- responseStream: false,
3009
- options: {}
3010
- },
3011
- freezeTokens: {
3012
- name: "FreezeTokens",
3013
- requestType: FreezeTokensRequest,
3014
- requestStream: false,
3015
- responseType: FreezeTokensResponse,
3016
- responseStream: false,
3017
- options: {}
3018
- },
3019
- getLastIndexedBlockInfo: {
3020
- name: "GetLastIndexedBlockInfo",
3021
- requestType: Empty,
3022
- requestStream: false,
3023
- responseType: BlockInfoResponse,
3024
- responseStream: false,
3025
- options: {}
3026
- },
3027
- sendRawLrcTransaction: {
3028
- name: "SendRawLrcTransaction",
3029
- requestType: SendRawTxRequest,
3030
- requestStream: false,
3031
- responseType: Empty,
3032
- responseStream: false,
3033
- options: {}
3034
- },
3035
- getTokenPubkeyInfo: {
3036
- name: "GetTokenPubkeyInfo",
3037
- requestType: GetTokenPubkeyInfoRequest,
3038
- requestStream: false,
3039
- responseType: GetTokenPubkeyInfoResponse,
3040
- responseStream: false,
3041
- options: {}
3042
- }
3043
- }
3044
- };
3045
- function bytesFromBase64(b64) {
3046
- if (globalThis.Buffer) {
3047
- return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
3048
- } else {
3049
- const bin = globalThis.atob(b64);
3050
- const arr = new Uint8Array(bin.length);
3051
- for (let i = 0; i < bin.length; ++i) {
3052
- arr[i] = bin.charCodeAt(i);
3053
- }
3054
- return arr;
3055
- }
3056
- }
3057
- function base64FromBytes(arr) {
3058
- if (globalThis.Buffer) {
3059
- return globalThis.Buffer.from(arr).toString("base64");
3060
- } else {
3061
- const bin = [];
3062
- arr.forEach((byte) => {
3063
- bin.push(globalThis.String.fromCharCode(byte));
3064
- });
3065
- return globalThis.btoa(bin.join(""));
3066
- }
3067
- }
3068
- function toTimestamp(date) {
3069
- const seconds = Math.trunc(date.getTime() / 1e3);
3070
- const nanos = date.getTime() % 1e3 * 1e6;
3071
- return { seconds, nanos };
3072
- }
3073
- function fromTimestamp(t) {
3074
- let millis = (t.seconds || 0) * 1e3;
3075
- millis += (t.nanos || 0) / 1e6;
3076
- return new globalThis.Date(millis);
3077
- }
3078
- function fromJsonTimestamp(o) {
3079
- if (o instanceof globalThis.Date) {
3080
- return o;
3081
- } else if (typeof o === "string") {
3082
- return new globalThis.Date(o);
3083
- } else {
3084
- return fromTimestamp(Timestamp.fromJSON(o));
3085
- }
3086
- }
3087
- function longToNumber(int64) {
3088
- const num = globalThis.Number(int64.toString());
3089
- if (num > globalThis.Number.MAX_SAFE_INTEGER) {
3090
- throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
3091
- }
3092
- if (num < globalThis.Number.MIN_SAFE_INTEGER) {
3093
- throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
3094
- }
3095
- return num;
3096
- }
3097
- function isSet(value) {
3098
- return value !== null && value !== void 0;
3099
- }
3100
-
3101
- export {
3102
- protobufPackage,
3103
- Layer,
3104
- layerFromJSON,
3105
- layerToJSON,
3106
- OperationType,
3107
- operationTypeFromJSON,
3108
- operationTypeToJSON,
3109
- OnChainTransactionStatus,
3110
- onChainTransactionStatusFromJSON,
3111
- onChainTransactionStatusToJSON,
3112
- SparkTransactionStatus,
3113
- sparkTransactionStatusFromJSON,
3114
- sparkTransactionStatusToJSON,
3115
- SendSparkSignatureRequest,
3116
- SparkOperatorSignatureData,
3117
- GetSparkTxRequest,
3118
- VerifySparkTxRequest,
3119
- ListSparkTxsRequest,
3120
- ListWithdrawnOutputsRequest,
3121
- ListSparkTxsResponse,
3122
- ListWithdrawnOutputsResponse,
3123
- GetSparkTxResponse,
3124
- FreezeTokensRequest,
3125
- FreezeTokensResponse,
3126
- ListAllTokenTransactionsRequest,
3127
- ListAllTokenTransactionsResponse,
3128
- BlockInfoResponse,
3129
- SendRawTxRequest,
3130
- GetTokenPubkeyInfoRequest,
3131
- GetTokenPubkeyInfoResponse,
3132
- TokenPubkeyInfo,
3133
- TokenOutput,
3134
- FreezeTokensPayload,
3135
- TokenTransactionResponse,
3136
- Transaction,
3137
- ListAllTokenTransactionsCursor,
3138
- OnChainTokenOutput,
3139
- OnChainTransaction,
3140
- SparkTransaction,
3141
- SparkLeaf,
3142
- BlockInfo,
3143
- TokenPubkey,
3144
- TokenPubkeyAnnouncement,
3145
- SparkServiceDefinition
3146
- };