@pushchain/core 5.0.0 → 5.1.0

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 (92) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/package.json +1 -1
  3. package/src/lib/constants/abi/cea.evm.d.ts +23 -0
  4. package/src/lib/constants/abi/cea.evm.js +34 -0
  5. package/src/lib/constants/abi/cea.evm.js.map +1 -0
  6. package/src/lib/constants/abi/ceaFactory.evm.d.ts +65 -0
  7. package/src/lib/constants/abi/ceaFactory.evm.js +41 -0
  8. package/src/lib/constants/abi/ceaFactory.evm.js.map +1 -0
  9. package/src/lib/constants/abi/erc20.evm.d.ts +14 -0
  10. package/src/lib/constants/abi/erc20.evm.js +7 -0
  11. package/src/lib/constants/abi/erc20.evm.js.map +1 -1
  12. package/src/lib/constants/abi/index.d.ts +6 -0
  13. package/src/lib/constants/abi/index.js +15 -1
  14. package/src/lib/constants/abi/index.js.map +1 -1
  15. package/src/lib/constants/abi/prc20.evm.d.ts +188 -0
  16. package/src/lib/constants/abi/prc20.evm.js +130 -0
  17. package/src/lib/constants/abi/prc20.evm.js.map +1 -0
  18. package/src/lib/constants/abi/uea-factory.d.ts +30 -0
  19. package/src/lib/constants/abi/uea-factory.js +25 -0
  20. package/src/lib/constants/abi/uea-factory.js.map +1 -0
  21. package/src/lib/constants/abi/universalGateway.evm.d.ts +93 -0
  22. package/src/lib/constants/abi/universalGateway.evm.js +70 -0
  23. package/src/lib/constants/abi/universalGateway.evm.js.map +1 -0
  24. package/src/lib/constants/abi/universalGatewayPC.evm.d.ts +140 -0
  25. package/src/lib/constants/abi/universalGatewayPC.evm.js +70 -0
  26. package/src/lib/constants/abi/universalGatewayPC.evm.js.map +1 -0
  27. package/src/lib/constants/abi/universalGatewayV0.evm.js +57 -0
  28. package/src/lib/constants/abi/universalGatewayV0.evm.js.map +1 -1
  29. package/src/lib/constants/abi/universalGatewayV0.json +1581 -859
  30. package/src/lib/constants/chain.d.ts +54 -1
  31. package/src/lib/constants/chain.js +207 -17
  32. package/src/lib/constants/chain.js.map +1 -1
  33. package/src/lib/constants/index.d.ts +9 -1
  34. package/src/lib/constants/index.js +20 -1
  35. package/src/lib/constants/index.js.map +1 -1
  36. package/src/lib/constants/selectors.d.ts +42 -0
  37. package/src/lib/constants/selectors.js +45 -0
  38. package/src/lib/constants/selectors.js.map +1 -0
  39. package/src/lib/constants/tokens.d.ts +48 -1
  40. package/src/lib/constants/tokens.js +112 -9
  41. package/src/lib/constants/tokens.js.map +1 -1
  42. package/src/lib/generated/uexecutor/v2/index.d.ts +2 -0
  43. package/src/lib/generated/uexecutor/v2/index.js +31 -0
  44. package/src/lib/generated/uexecutor/v2/index.js.map +1 -0
  45. package/src/lib/generated/uexecutor/v2/query.d.ts +23 -0
  46. package/src/lib/generated/uexecutor/v2/query.js +79 -0
  47. package/src/lib/generated/uexecutor/v2/query.js.map +1 -0
  48. package/src/lib/generated/uexecutor/v2/types.d.ts +101 -0
  49. package/src/lib/generated/uexecutor/v2/types.js +660 -0
  50. package/src/lib/generated/uexecutor/v2/types.js.map +1 -0
  51. package/src/lib/generated/v1/tx.d.ts +22 -0
  52. package/src/lib/generated/v1/tx.js +188 -1
  53. package/src/lib/generated/v1/tx.js.map +1 -1
  54. package/src/lib/index.d.ts +5 -0
  55. package/src/lib/index.js +25 -1
  56. package/src/lib/index.js.map +1 -1
  57. package/src/lib/orchestrator/cea-utils.d.ts +85 -0
  58. package/src/lib/orchestrator/cea-utils.js +186 -0
  59. package/src/lib/orchestrator/cea-utils.js.map +1 -0
  60. package/src/lib/orchestrator/orchestrator.d.ts +348 -3
  61. package/src/lib/orchestrator/orchestrator.js +3853 -290
  62. package/src/lib/orchestrator/orchestrator.js.map +1 -1
  63. package/src/lib/orchestrator/orchestrator.types.d.ts +529 -0
  64. package/src/lib/orchestrator/orchestrator.types.js +17 -0
  65. package/src/lib/orchestrator/orchestrator.types.js.map +1 -1
  66. package/src/lib/orchestrator/payload-builders.d.ts +212 -2
  67. package/src/lib/orchestrator/payload-builders.js +536 -16
  68. package/src/lib/orchestrator/payload-builders.js.map +1 -1
  69. package/src/lib/orchestrator/route-detector.d.ts +102 -0
  70. package/src/lib/orchestrator/route-detector.js +355 -0
  71. package/src/lib/orchestrator/route-detector.js.map +1 -0
  72. package/src/lib/price-fetch/price-fetch.js +5 -2
  73. package/src/lib/price-fetch/price-fetch.js.map +1 -1
  74. package/src/lib/progress-hook/progress-hook.js +54 -4
  75. package/src/lib/progress-hook/progress-hook.js.map +1 -1
  76. package/src/lib/progress-hook/progress-hook.types.d.ts +10 -3
  77. package/src/lib/progress-hook/progress-hook.types.js +8 -0
  78. package/src/lib/progress-hook/progress-hook.types.js.map +1 -1
  79. package/src/lib/push-chain/push-chain.d.ts +75 -1
  80. package/src/lib/push-chain/push-chain.js +73 -1
  81. package/src/lib/push-chain/push-chain.js.map +1 -1
  82. package/src/lib/push-client/push-client.d.ts +20 -4
  83. package/src/lib/push-client/push-client.js +133 -67
  84. package/src/lib/push-client/push-client.js.map +1 -1
  85. package/src/lib/universal/signer/signer.js +17 -3
  86. package/src/lib/universal/signer/signer.js.map +1 -1
  87. package/src/lib/utils.d.ts +14 -0
  88. package/src/lib/utils.js +25 -0
  89. package/src/lib/utils.js.map +1 -1
  90. package/src/lib/vm-client/evm-client.d.ts +3 -1
  91. package/src/lib/vm-client/evm-client.js +23 -15
  92. package/src/lib/vm-client/evm-client.js.map +1 -1
@@ -0,0 +1,660 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UniversalTxV2Codec = exports.OutboundTxV2Codec = exports.RevertInstructions = exports.OutboundObservation = exports.OriginatingPcTx = exports.OutboundStatus = exports.TxType = exports.PCTx = exports.Inbound = exports.UniversalPayload = exports.universalTxStatusToJSON = exports.universalTxStatusFromJSON = exports.UniversalTxStatus = exports.verificationTypeToJSON = exports.verificationTypeFromJSON = exports.VerificationType = exports.protobufPackage = void 0;
4
+ exports.txTypeFromJSON = txTypeFromJSON;
5
+ exports.txTypeToJSON = txTypeToJSON;
6
+ exports.outboundStatusFromJSON = outboundStatusFromJSON;
7
+ exports.outboundStatusToJSON = outboundStatusToJSON;
8
+ // Code generated to match uexecutor/v1/types.proto with expanded OutboundTx
9
+ // This provides v2 types with full OutboundTx fields and repeated outbound_tx array
10
+ /* eslint-disable */
11
+ const wire_1 = require("@bufbuild/protobuf/wire");
12
+ exports.protobufPackage = 'uexecutor.v2';
13
+ // Re-export enums from v1 that are unchanged
14
+ var types_1 = require("../v1/types");
15
+ Object.defineProperty(exports, "VerificationType", { enumerable: true, get: function () { return types_1.VerificationType; } });
16
+ Object.defineProperty(exports, "verificationTypeFromJSON", { enumerable: true, get: function () { return types_1.verificationTypeFromJSON; } });
17
+ Object.defineProperty(exports, "verificationTypeToJSON", { enumerable: true, get: function () { return types_1.verificationTypeToJSON; } });
18
+ Object.defineProperty(exports, "UniversalTxStatus", { enumerable: true, get: function () { return types_1.UniversalTxStatus; } });
19
+ Object.defineProperty(exports, "universalTxStatusFromJSON", { enumerable: true, get: function () { return types_1.universalTxStatusFromJSON; } });
20
+ Object.defineProperty(exports, "universalTxStatusToJSON", { enumerable: true, get: function () { return types_1.universalTxStatusToJSON; } });
21
+ // Import types from v1 that are unchanged
22
+ const types_2 = require("../v1/types");
23
+ Object.defineProperty(exports, "UniversalPayload", { enumerable: true, get: function () { return types_2.UniversalPayload; } });
24
+ Object.defineProperty(exports, "Inbound", { enumerable: true, get: function () { return types_2.Inbound; } });
25
+ Object.defineProperty(exports, "PCTx", { enumerable: true, get: function () { return types_2.PCTx; } });
26
+ /**
27
+ * TxType enum for outbound transaction types
28
+ * Matches chain proto: uexecutor/v1/types.proto TxType
29
+ */
30
+ var TxType;
31
+ (function (TxType) {
32
+ TxType[TxType["UNSPECIFIED_TX"] = 0] = "UNSPECIFIED_TX";
33
+ TxType[TxType["GAS"] = 1] = "GAS";
34
+ TxType[TxType["GAS_AND_PAYLOAD"] = 2] = "GAS_AND_PAYLOAD";
35
+ TxType[TxType["FUNDS"] = 3] = "FUNDS";
36
+ TxType[TxType["FUNDS_AND_PAYLOAD"] = 4] = "FUNDS_AND_PAYLOAD";
37
+ TxType[TxType["PAYLOAD"] = 5] = "PAYLOAD";
38
+ TxType[TxType["INBOUND_REVERT"] = 6] = "INBOUND_REVERT";
39
+ TxType[TxType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
40
+ })(TxType || (exports.TxType = TxType = {}));
41
+ function txTypeFromJSON(object) {
42
+ switch (object) {
43
+ case 0:
44
+ case 'UNSPECIFIED_TX':
45
+ return TxType.UNSPECIFIED_TX;
46
+ case 1:
47
+ case 'GAS':
48
+ return TxType.GAS;
49
+ case 2:
50
+ case 'GAS_AND_PAYLOAD':
51
+ return TxType.GAS_AND_PAYLOAD;
52
+ case 3:
53
+ case 'FUNDS':
54
+ return TxType.FUNDS;
55
+ case 4:
56
+ case 'FUNDS_AND_PAYLOAD':
57
+ return TxType.FUNDS_AND_PAYLOAD;
58
+ case 5:
59
+ case 'PAYLOAD':
60
+ return TxType.PAYLOAD;
61
+ case 6:
62
+ case 'INBOUND_REVERT':
63
+ return TxType.INBOUND_REVERT;
64
+ case -1:
65
+ case 'UNRECOGNIZED':
66
+ default:
67
+ return TxType.UNRECOGNIZED;
68
+ }
69
+ }
70
+ function txTypeToJSON(object) {
71
+ switch (object) {
72
+ case TxType.UNSPECIFIED_TX:
73
+ return 'UNSPECIFIED_TX';
74
+ case TxType.GAS:
75
+ return 'GAS';
76
+ case TxType.GAS_AND_PAYLOAD:
77
+ return 'GAS_AND_PAYLOAD';
78
+ case TxType.FUNDS:
79
+ return 'FUNDS';
80
+ case TxType.FUNDS_AND_PAYLOAD:
81
+ return 'FUNDS_AND_PAYLOAD';
82
+ case TxType.PAYLOAD:
83
+ return 'PAYLOAD';
84
+ case TxType.INBOUND_REVERT:
85
+ return 'INBOUND_REVERT';
86
+ case TxType.UNRECOGNIZED:
87
+ default:
88
+ return 'UNRECOGNIZED';
89
+ }
90
+ }
91
+ /**
92
+ * OutboundStatus enum for outbound transaction status
93
+ */
94
+ var OutboundStatus;
95
+ (function (OutboundStatus) {
96
+ OutboundStatus[OutboundStatus["OUTBOUND_STATUS_UNSPECIFIED"] = 0] = "OUTBOUND_STATUS_UNSPECIFIED";
97
+ OutboundStatus[OutboundStatus["PENDING"] = 1] = "PENDING";
98
+ OutboundStatus[OutboundStatus["OBSERVED"] = 2] = "OBSERVED";
99
+ OutboundStatus[OutboundStatus["REVERTED"] = 3] = "REVERTED";
100
+ OutboundStatus[OutboundStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
101
+ })(OutboundStatus || (exports.OutboundStatus = OutboundStatus = {}));
102
+ function outboundStatusFromJSON(object) {
103
+ switch (object) {
104
+ case 0:
105
+ case 'OUTBOUND_STATUS_UNSPECIFIED':
106
+ return OutboundStatus.OUTBOUND_STATUS_UNSPECIFIED;
107
+ case 1:
108
+ case 'PENDING':
109
+ return OutboundStatus.PENDING;
110
+ case 2:
111
+ case 'OBSERVED':
112
+ return OutboundStatus.OBSERVED;
113
+ case 3:
114
+ case 'REVERTED':
115
+ return OutboundStatus.REVERTED;
116
+ case -1:
117
+ case 'UNRECOGNIZED':
118
+ default:
119
+ return OutboundStatus.UNRECOGNIZED;
120
+ }
121
+ }
122
+ function outboundStatusToJSON(object) {
123
+ switch (object) {
124
+ case OutboundStatus.OUTBOUND_STATUS_UNSPECIFIED:
125
+ return 'OUTBOUND_STATUS_UNSPECIFIED';
126
+ case OutboundStatus.PENDING:
127
+ return 'PENDING';
128
+ case OutboundStatus.OBSERVED:
129
+ return 'OBSERVED';
130
+ case OutboundStatus.REVERTED:
131
+ return 'REVERTED';
132
+ case OutboundStatus.UNRECOGNIZED:
133
+ default:
134
+ return 'UNRECOGNIZED';
135
+ }
136
+ }
137
+ // ============================================================================
138
+ // Encoder/Decoder implementations
139
+ // ============================================================================
140
+ function createBaseOriginatingPcTx() {
141
+ return {
142
+ txHash: '',
143
+ logIndex: '',
144
+ };
145
+ }
146
+ exports.OriginatingPcTx = {
147
+ encode(message, writer = new wire_1.BinaryWriter()) {
148
+ if (message.txHash !== '')
149
+ writer.uint32(10).string(message.txHash);
150
+ if (message.logIndex !== '')
151
+ writer.uint32(18).string(message.logIndex);
152
+ return writer;
153
+ },
154
+ decode(input, length) {
155
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
156
+ const end = length === undefined ? reader.len : reader.pos + length;
157
+ const message = createBaseOriginatingPcTx();
158
+ while (reader.pos < end) {
159
+ const tag = reader.uint32();
160
+ switch (tag >>> 3) {
161
+ case 1:
162
+ message.txHash = reader.string();
163
+ break;
164
+ case 2:
165
+ message.logIndex = reader.string();
166
+ break;
167
+ default:
168
+ if ((tag & 7) === 4 || tag === 0)
169
+ return message;
170
+ reader.skip(tag & 7);
171
+ break;
172
+ }
173
+ }
174
+ return message;
175
+ },
176
+ fromJSON(object) {
177
+ return {
178
+ txHash: isSet(object.txHash) ? globalThis.String(object.txHash) : '',
179
+ logIndex: isSet(object.logIndex)
180
+ ? globalThis.String(object.logIndex)
181
+ : '',
182
+ };
183
+ },
184
+ toJSON(message) {
185
+ const obj = {};
186
+ if (message.txHash !== '')
187
+ obj.txHash = message.txHash;
188
+ if (message.logIndex !== '')
189
+ obj.logIndex = message.logIndex;
190
+ return obj;
191
+ },
192
+ fromPartial(object) {
193
+ var _a, _b;
194
+ const message = createBaseOriginatingPcTx();
195
+ message.txHash = (_a = object.txHash) !== null && _a !== void 0 ? _a : '';
196
+ message.logIndex = (_b = object.logIndex) !== null && _b !== void 0 ? _b : '';
197
+ return message;
198
+ },
199
+ };
200
+ function createBaseOutboundObservation() {
201
+ return { success: false, blockHeight: 0, txHash: '', errorMsg: '' };
202
+ }
203
+ exports.OutboundObservation = {
204
+ encode(message, writer = new wire_1.BinaryWriter()) {
205
+ if (message.success !== false)
206
+ writer.uint32(8).bool(message.success);
207
+ if (message.blockHeight !== 0)
208
+ writer.uint32(16).uint64(message.blockHeight);
209
+ if (message.txHash !== '')
210
+ writer.uint32(26).string(message.txHash);
211
+ if (message.errorMsg !== '')
212
+ writer.uint32(34).string(message.errorMsg);
213
+ return writer;
214
+ },
215
+ decode(input, length) {
216
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
217
+ const end = length === undefined ? reader.len : reader.pos + length;
218
+ const message = createBaseOutboundObservation();
219
+ while (reader.pos < end) {
220
+ const tag = reader.uint32();
221
+ switch (tag >>> 3) {
222
+ case 1:
223
+ message.success = reader.bool();
224
+ break;
225
+ case 2:
226
+ message.blockHeight = Number(reader.uint64());
227
+ break;
228
+ case 3:
229
+ message.txHash = reader.string();
230
+ break;
231
+ case 4:
232
+ message.errorMsg = reader.string();
233
+ break;
234
+ default:
235
+ if ((tag & 7) === 4 || tag === 0)
236
+ return message;
237
+ reader.skip(tag & 7);
238
+ break;
239
+ }
240
+ }
241
+ return message;
242
+ },
243
+ fromJSON(object) {
244
+ return {
245
+ success: isSet(object.success)
246
+ ? globalThis.Boolean(object.success)
247
+ : false,
248
+ blockHeight: isSet(object.blockHeight)
249
+ ? globalThis.Number(object.blockHeight)
250
+ : 0,
251
+ txHash: isSet(object.txHash) ? globalThis.String(object.txHash) : '',
252
+ errorMsg: isSet(object.errorMsg)
253
+ ? globalThis.String(object.errorMsg)
254
+ : '',
255
+ };
256
+ },
257
+ toJSON(message) {
258
+ const obj = {};
259
+ if (message.success !== false)
260
+ obj.success = message.success;
261
+ if (message.blockHeight !== 0)
262
+ obj.blockHeight = message.blockHeight;
263
+ if (message.txHash !== '')
264
+ obj.txHash = message.txHash;
265
+ if (message.errorMsg !== '')
266
+ obj.errorMsg = message.errorMsg;
267
+ return obj;
268
+ },
269
+ fromPartial(object) {
270
+ var _a, _b, _c, _d;
271
+ const message = createBaseOutboundObservation();
272
+ message.success = (_a = object.success) !== null && _a !== void 0 ? _a : false;
273
+ message.blockHeight = (_b = object.blockHeight) !== null && _b !== void 0 ? _b : 0;
274
+ message.txHash = (_c = object.txHash) !== null && _c !== void 0 ? _c : '';
275
+ message.errorMsg = (_d = object.errorMsg) !== null && _d !== void 0 ? _d : '';
276
+ return message;
277
+ },
278
+ };
279
+ function createBaseRevertInstructions() {
280
+ return { fundRecipient: '' };
281
+ }
282
+ exports.RevertInstructions = {
283
+ encode(message, writer = new wire_1.BinaryWriter()) {
284
+ if (message.fundRecipient !== '')
285
+ writer.uint32(10).string(message.fundRecipient);
286
+ return writer;
287
+ },
288
+ decode(input, length) {
289
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
290
+ const end = length === undefined ? reader.len : reader.pos + length;
291
+ const message = createBaseRevertInstructions();
292
+ while (reader.pos < end) {
293
+ const tag = reader.uint32();
294
+ switch (tag >>> 3) {
295
+ case 1:
296
+ message.fundRecipient = reader.string();
297
+ break;
298
+ default:
299
+ if ((tag & 7) === 4 || tag === 0)
300
+ return message;
301
+ reader.skip(tag & 7);
302
+ break;
303
+ }
304
+ }
305
+ return message;
306
+ },
307
+ fromJSON(object) {
308
+ return {
309
+ fundRecipient: isSet(object.fundRecipient)
310
+ ? globalThis.String(object.fundRecipient)
311
+ : '',
312
+ };
313
+ },
314
+ toJSON(message) {
315
+ const obj = {};
316
+ if (message.fundRecipient !== '')
317
+ obj.fundRecipient = message.fundRecipient;
318
+ return obj;
319
+ },
320
+ fromPartial(object) {
321
+ var _a;
322
+ const message = createBaseRevertInstructions();
323
+ message.fundRecipient = (_a = object.fundRecipient) !== null && _a !== void 0 ? _a : '';
324
+ return message;
325
+ },
326
+ };
327
+ function createBaseOutboundTxV2() {
328
+ return {
329
+ destinationChain: '',
330
+ recipient: '',
331
+ amount: '',
332
+ externalAssetAddr: '',
333
+ prc20AssetAddr: '',
334
+ sender: '',
335
+ payload: '',
336
+ gasLimit: '',
337
+ txType: 0,
338
+ pcTx: undefined,
339
+ observedTx: undefined,
340
+ id: '',
341
+ outboundStatus: 0,
342
+ revertInstructions: undefined,
343
+ pcRevertExecution: undefined,
344
+ };
345
+ }
346
+ // Import PCTx encoder from v1
347
+ const types_3 = require("../v1/types");
348
+ exports.OutboundTxV2Codec = {
349
+ encode(message, writer = new wire_1.BinaryWriter()) {
350
+ if (message.destinationChain !== '')
351
+ writer.uint32(10).string(message.destinationChain);
352
+ if (message.recipient !== '')
353
+ writer.uint32(18).string(message.recipient);
354
+ if (message.amount !== '')
355
+ writer.uint32(26).string(message.amount);
356
+ if (message.externalAssetAddr !== '')
357
+ writer.uint32(34).string(message.externalAssetAddr);
358
+ if (message.prc20AssetAddr !== '')
359
+ writer.uint32(42).string(message.prc20AssetAddr);
360
+ if (message.sender !== '')
361
+ writer.uint32(50).string(message.sender);
362
+ if (message.payload !== '')
363
+ writer.uint32(58).string(message.payload);
364
+ if (message.gasLimit !== '')
365
+ writer.uint32(66).string(message.gasLimit);
366
+ if (message.txType !== 0)
367
+ writer.uint32(72).int32(message.txType);
368
+ if (message.pcTx !== undefined)
369
+ exports.OriginatingPcTx.encode(message.pcTx, writer.uint32(82).fork()).join();
370
+ if (message.observedTx !== undefined)
371
+ exports.OutboundObservation.encode(message.observedTx, writer.uint32(90).fork()).join();
372
+ if (message.id !== '')
373
+ writer.uint32(98).string(message.id);
374
+ if (message.outboundStatus !== 0)
375
+ writer.uint32(104).int32(message.outboundStatus);
376
+ if (message.revertInstructions !== undefined)
377
+ exports.RevertInstructions.encode(message.revertInstructions, writer.uint32(114).fork()).join();
378
+ if (message.pcRevertExecution !== undefined)
379
+ types_3.PCTx.encode(message.pcRevertExecution, writer.uint32(122).fork()).join();
380
+ return writer;
381
+ },
382
+ decode(input, length) {
383
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
384
+ const end = length === undefined ? reader.len : reader.pos + length;
385
+ const message = createBaseOutboundTxV2();
386
+ while (reader.pos < end) {
387
+ const tag = reader.uint32();
388
+ switch (tag >>> 3) {
389
+ case 1:
390
+ message.destinationChain = reader.string();
391
+ break;
392
+ case 2:
393
+ message.recipient = reader.string();
394
+ break;
395
+ case 3:
396
+ message.amount = reader.string();
397
+ break;
398
+ case 4:
399
+ message.externalAssetAddr = reader.string();
400
+ break;
401
+ case 5:
402
+ message.prc20AssetAddr = reader.string();
403
+ break;
404
+ case 6:
405
+ message.sender = reader.string();
406
+ break;
407
+ case 7:
408
+ message.payload = reader.string();
409
+ break;
410
+ case 8:
411
+ message.gasLimit = reader.string();
412
+ break;
413
+ case 9:
414
+ message.txType = reader.int32();
415
+ break;
416
+ case 10:
417
+ message.pcTx = exports.OriginatingPcTx.decode(reader, reader.uint32());
418
+ break;
419
+ case 11:
420
+ message.observedTx = exports.OutboundObservation.decode(reader, reader.uint32());
421
+ break;
422
+ case 12:
423
+ message.id = reader.string();
424
+ break;
425
+ case 13:
426
+ message.outboundStatus = reader.int32();
427
+ break;
428
+ case 14:
429
+ message.revertInstructions = exports.RevertInstructions.decode(reader, reader.uint32());
430
+ break;
431
+ case 15:
432
+ message.pcRevertExecution = types_3.PCTx.decode(reader, reader.uint32());
433
+ break;
434
+ default:
435
+ if ((tag & 7) === 4 || tag === 0)
436
+ return message;
437
+ reader.skip(tag & 7);
438
+ break;
439
+ }
440
+ }
441
+ return message;
442
+ },
443
+ fromJSON(object) {
444
+ return {
445
+ destinationChain: isSet(object.destinationChain)
446
+ ? globalThis.String(object.destinationChain)
447
+ : '',
448
+ recipient: isSet(object.recipient)
449
+ ? globalThis.String(object.recipient)
450
+ : '',
451
+ amount: isSet(object.amount) ? globalThis.String(object.amount) : '',
452
+ externalAssetAddr: isSet(object.externalAssetAddr)
453
+ ? globalThis.String(object.externalAssetAddr)
454
+ : '',
455
+ prc20AssetAddr: isSet(object.prc20AssetAddr)
456
+ ? globalThis.String(object.prc20AssetAddr)
457
+ : '',
458
+ sender: isSet(object.sender) ? globalThis.String(object.sender) : '',
459
+ payload: isSet(object.payload) ? globalThis.String(object.payload) : '',
460
+ gasLimit: isSet(object.gasLimit)
461
+ ? globalThis.String(object.gasLimit)
462
+ : '',
463
+ txType: isSet(object.txType) ? txTypeFromJSON(object.txType) : 0,
464
+ pcTx: isSet(object.pcTx)
465
+ ? exports.OriginatingPcTx.fromJSON(object.pcTx)
466
+ : undefined,
467
+ observedTx: isSet(object.observedTx)
468
+ ? exports.OutboundObservation.fromJSON(object.observedTx)
469
+ : undefined,
470
+ id: isSet(object.id) ? globalThis.String(object.id) : '',
471
+ outboundStatus: isSet(object.outboundStatus)
472
+ ? outboundStatusFromJSON(object.outboundStatus)
473
+ : 0,
474
+ revertInstructions: isSet(object.revertInstructions)
475
+ ? exports.RevertInstructions.fromJSON(object.revertInstructions)
476
+ : undefined,
477
+ pcRevertExecution: isSet(object.pcRevertExecution)
478
+ ? types_3.PCTx.fromJSON(object.pcRevertExecution)
479
+ : undefined,
480
+ };
481
+ },
482
+ toJSON(message) {
483
+ const obj = {};
484
+ if (message.destinationChain !== '')
485
+ obj.destinationChain = message.destinationChain;
486
+ if (message.recipient !== '')
487
+ obj.recipient = message.recipient;
488
+ if (message.amount !== '')
489
+ obj.amount = message.amount;
490
+ if (message.externalAssetAddr !== '')
491
+ obj.externalAssetAddr = message.externalAssetAddr;
492
+ if (message.prc20AssetAddr !== '')
493
+ obj.prc20AssetAddr = message.prc20AssetAddr;
494
+ if (message.sender !== '')
495
+ obj.sender = message.sender;
496
+ if (message.payload !== '')
497
+ obj.payload = message.payload;
498
+ if (message.gasLimit !== '')
499
+ obj.gasLimit = message.gasLimit;
500
+ if (message.txType !== 0)
501
+ obj.txType = txTypeToJSON(message.txType);
502
+ if (message.pcTx !== undefined)
503
+ obj.pcTx = exports.OriginatingPcTx.toJSON(message.pcTx);
504
+ if (message.observedTx !== undefined)
505
+ obj.observedTx = exports.OutboundObservation.toJSON(message.observedTx);
506
+ if (message.id !== '')
507
+ obj.id = message.id;
508
+ if (message.outboundStatus !== 0)
509
+ obj.outboundStatus = outboundStatusToJSON(message.outboundStatus);
510
+ if (message.revertInstructions !== undefined)
511
+ obj.revertInstructions = exports.RevertInstructions.toJSON(message.revertInstructions);
512
+ if (message.pcRevertExecution !== undefined)
513
+ obj.pcRevertExecution = types_3.PCTx.toJSON(message.pcRevertExecution);
514
+ return obj;
515
+ },
516
+ fromPartial(object) {
517
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
518
+ const message = createBaseOutboundTxV2();
519
+ message.destinationChain = (_a = object.destinationChain) !== null && _a !== void 0 ? _a : '';
520
+ message.recipient = (_b = object.recipient) !== null && _b !== void 0 ? _b : '';
521
+ message.amount = (_c = object.amount) !== null && _c !== void 0 ? _c : '';
522
+ message.externalAssetAddr = (_d = object.externalAssetAddr) !== null && _d !== void 0 ? _d : '';
523
+ message.prc20AssetAddr = (_e = object.prc20AssetAddr) !== null && _e !== void 0 ? _e : '';
524
+ message.sender = (_f = object.sender) !== null && _f !== void 0 ? _f : '';
525
+ message.payload = (_g = object.payload) !== null && _g !== void 0 ? _g : '';
526
+ message.gasLimit = (_h = object.gasLimit) !== null && _h !== void 0 ? _h : '';
527
+ message.txType = (_j = object.txType) !== null && _j !== void 0 ? _j : 0;
528
+ message.pcTx =
529
+ object.pcTx !== undefined && object.pcTx !== null
530
+ ? exports.OriginatingPcTx.fromPartial(object.pcTx)
531
+ : undefined;
532
+ message.observedTx =
533
+ object.observedTx !== undefined && object.observedTx !== null
534
+ ? exports.OutboundObservation.fromPartial(object.observedTx)
535
+ : undefined;
536
+ message.id = (_k = object.id) !== null && _k !== void 0 ? _k : '';
537
+ message.outboundStatus = (_l = object.outboundStatus) !== null && _l !== void 0 ? _l : 0;
538
+ message.revertInstructions =
539
+ object.revertInstructions !== undefined &&
540
+ object.revertInstructions !== null
541
+ ? exports.RevertInstructions.fromPartial(object.revertInstructions)
542
+ : undefined;
543
+ message.pcRevertExecution =
544
+ object.pcRevertExecution !== undefined &&
545
+ object.pcRevertExecution !== null
546
+ ? types_3.PCTx.fromPartial(object.pcRevertExecution)
547
+ : undefined;
548
+ return message;
549
+ },
550
+ };
551
+ // Import Inbound encoder from v1
552
+ const types_4 = require("../v1/types");
553
+ function createBaseUniversalTxV2() {
554
+ return {
555
+ id: '',
556
+ inboundTx: undefined,
557
+ pcTx: [],
558
+ outboundTx: [],
559
+ universalStatus: 0,
560
+ };
561
+ }
562
+ exports.UniversalTxV2Codec = {
563
+ encode(message, writer = new wire_1.BinaryWriter()) {
564
+ if (message.id !== '')
565
+ writer.uint32(10).string(message.id);
566
+ if (message.inboundTx !== undefined)
567
+ types_4.Inbound.encode(message.inboundTx, writer.uint32(18).fork()).join();
568
+ for (const v of message.pcTx) {
569
+ types_3.PCTx.encode(v, writer.uint32(26).fork()).join();
570
+ }
571
+ for (const v of message.outboundTx) {
572
+ exports.OutboundTxV2Codec.encode(v, writer.uint32(34).fork()).join();
573
+ }
574
+ if (message.universalStatus !== 0)
575
+ writer.uint32(40).int32(message.universalStatus);
576
+ return writer;
577
+ },
578
+ decode(input, length) {
579
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
580
+ const end = length === undefined ? reader.len : reader.pos + length;
581
+ const message = createBaseUniversalTxV2();
582
+ while (reader.pos < end) {
583
+ const tag = reader.uint32();
584
+ switch (tag >>> 3) {
585
+ case 1:
586
+ message.id = reader.string();
587
+ break;
588
+ case 2:
589
+ message.inboundTx = types_4.Inbound.decode(reader, reader.uint32());
590
+ break;
591
+ case 3:
592
+ message.pcTx.push(types_3.PCTx.decode(reader, reader.uint32()));
593
+ break;
594
+ case 4:
595
+ message.outboundTx.push(exports.OutboundTxV2Codec.decode(reader, reader.uint32()));
596
+ break;
597
+ case 5:
598
+ message.universalStatus = reader.int32();
599
+ break;
600
+ default:
601
+ if ((tag & 7) === 4 || tag === 0)
602
+ return message;
603
+ reader.skip(tag & 7);
604
+ break;
605
+ }
606
+ }
607
+ return message;
608
+ },
609
+ fromJSON(object) {
610
+ return {
611
+ id: isSet(object.id) ? globalThis.String(object.id) : '',
612
+ inboundTx: isSet(object.inboundTx)
613
+ ? types_4.Inbound.fromJSON(object.inboundTx)
614
+ : undefined,
615
+ pcTx: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.pcTx)
616
+ ? object.pcTx.map((e) => types_3.PCTx.fromJSON(e))
617
+ : [],
618
+ outboundTx: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.outboundTx)
619
+ ? object.outboundTx.map((e) => exports.OutboundTxV2Codec.fromJSON(e))
620
+ : [],
621
+ universalStatus: isSet(object.universalStatus)
622
+ ? object.universalStatus
623
+ : 0,
624
+ };
625
+ },
626
+ toJSON(message) {
627
+ var _a, _b;
628
+ const obj = {};
629
+ if (message.id !== '')
630
+ obj.id = message.id;
631
+ if (message.inboundTx !== undefined)
632
+ obj.inboundTx = types_4.Inbound.toJSON(message.inboundTx);
633
+ if ((_a = message.pcTx) === null || _a === void 0 ? void 0 : _a.length)
634
+ obj.pcTx = message.pcTx.map((e) => types_3.PCTx.toJSON(e));
635
+ if ((_b = message.outboundTx) === null || _b === void 0 ? void 0 : _b.length)
636
+ obj.outboundTx = message.outboundTx.map((e) => exports.OutboundTxV2Codec.toJSON(e));
637
+ if (message.universalStatus !== 0)
638
+ obj.universalStatus = message.universalStatus;
639
+ return obj;
640
+ },
641
+ fromPartial(object) {
642
+ var _a, _b, _c, _d;
643
+ const message = createBaseUniversalTxV2();
644
+ message.id = (_a = object.id) !== null && _a !== void 0 ? _a : '';
645
+ message.inboundTx =
646
+ object.inboundTx !== undefined && object.inboundTx !== null
647
+ ? types_4.Inbound.fromPartial(object.inboundTx)
648
+ : undefined;
649
+ message.pcTx = ((_b = object.pcTx) === null || _b === void 0 ? void 0 : _b.map((e) => types_3.PCTx.fromPartial(e))) || [];
650
+ message.outboundTx =
651
+ ((_c = object.outboundTx) === null || _c === void 0 ? void 0 : _c.map((e) => exports.OutboundTxV2Codec.fromPartial(e))) || [];
652
+ message.universalStatus = (_d = object.universalStatus) !== null && _d !== void 0 ? _d : 0;
653
+ return message;
654
+ },
655
+ };
656
+ // Helper types
657
+ function isSet(value) {
658
+ return value !== null && value !== undefined;
659
+ }
660
+ //# sourceMappingURL=types.js.map