@triton-one/yellowstone-grpc 0.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.
- package/.prettierrc.json +1 -0
- package/README.md +26 -0
- package/dist/grpc/geyser.d.ts +8450 -0
- package/dist/grpc/geyser.js +2868 -0
- package/dist/grpc/solana-storage.d.ts +3773 -0
- package/dist/grpc/solana-storage.js +1856 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +265 -0
- package/package.json +35 -0
- package/src/grpc/geyser.ts +3477 -0
- package/src/grpc/solana-storage.ts +2141 -0
- package/src/index.ts +190 -0
- package/tsconfig.json +7 -0
|
@@ -0,0 +1,2141 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import * as Long from "long";
|
|
3
|
+
import * as _m0 from "protobufjs/minimal";
|
|
4
|
+
|
|
5
|
+
export const protobufPackage = "solana.storage.ConfirmedBlock";
|
|
6
|
+
|
|
7
|
+
export enum RewardType {
|
|
8
|
+
Unspecified = 0,
|
|
9
|
+
Fee = 1,
|
|
10
|
+
Rent = 2,
|
|
11
|
+
Staking = 3,
|
|
12
|
+
Voting = 4,
|
|
13
|
+
UNRECOGNIZED = -1,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function rewardTypeFromJSON(object: any): RewardType {
|
|
17
|
+
switch (object) {
|
|
18
|
+
case 0:
|
|
19
|
+
case "Unspecified":
|
|
20
|
+
return RewardType.Unspecified;
|
|
21
|
+
case 1:
|
|
22
|
+
case "Fee":
|
|
23
|
+
return RewardType.Fee;
|
|
24
|
+
case 2:
|
|
25
|
+
case "Rent":
|
|
26
|
+
return RewardType.Rent;
|
|
27
|
+
case 3:
|
|
28
|
+
case "Staking":
|
|
29
|
+
return RewardType.Staking;
|
|
30
|
+
case 4:
|
|
31
|
+
case "Voting":
|
|
32
|
+
return RewardType.Voting;
|
|
33
|
+
case -1:
|
|
34
|
+
case "UNRECOGNIZED":
|
|
35
|
+
default:
|
|
36
|
+
return RewardType.UNRECOGNIZED;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function rewardTypeToJSON(object: RewardType): string {
|
|
41
|
+
switch (object) {
|
|
42
|
+
case RewardType.Unspecified:
|
|
43
|
+
return "Unspecified";
|
|
44
|
+
case RewardType.Fee:
|
|
45
|
+
return "Fee";
|
|
46
|
+
case RewardType.Rent:
|
|
47
|
+
return "Rent";
|
|
48
|
+
case RewardType.Staking:
|
|
49
|
+
return "Staking";
|
|
50
|
+
case RewardType.Voting:
|
|
51
|
+
return "Voting";
|
|
52
|
+
case RewardType.UNRECOGNIZED:
|
|
53
|
+
default:
|
|
54
|
+
return "UNRECOGNIZED";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface ConfirmedBlock {
|
|
59
|
+
previousBlockhash: string;
|
|
60
|
+
blockhash: string;
|
|
61
|
+
parentSlot: number;
|
|
62
|
+
transactions: ConfirmedTransaction[];
|
|
63
|
+
rewards: Reward[];
|
|
64
|
+
blockTime: UnixTimestamp | undefined;
|
|
65
|
+
blockHeight: BlockHeight | undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface ConfirmedTransaction {
|
|
69
|
+
transaction: Transaction | undefined;
|
|
70
|
+
meta: TransactionStatusMeta | undefined;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface Transaction {
|
|
74
|
+
signatures: Uint8Array[];
|
|
75
|
+
message: Message | undefined;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface Message {
|
|
79
|
+
header: MessageHeader | undefined;
|
|
80
|
+
accountKeys: Uint8Array[];
|
|
81
|
+
recentBlockhash: Uint8Array;
|
|
82
|
+
instructions: CompiledInstruction[];
|
|
83
|
+
versioned: boolean;
|
|
84
|
+
addressTableLookups: MessageAddressTableLookup[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface MessageHeader {
|
|
88
|
+
numRequiredSignatures: number;
|
|
89
|
+
numReadonlySignedAccounts: number;
|
|
90
|
+
numReadonlyUnsignedAccounts: number;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface MessageAddressTableLookup {
|
|
94
|
+
accountKey: Uint8Array;
|
|
95
|
+
writableIndexes: Uint8Array;
|
|
96
|
+
readonlyIndexes: Uint8Array;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface TransactionStatusMeta {
|
|
100
|
+
err: TransactionError | undefined;
|
|
101
|
+
fee: number;
|
|
102
|
+
preBalances: number[];
|
|
103
|
+
postBalances: number[];
|
|
104
|
+
innerInstructions: InnerInstructions[];
|
|
105
|
+
innerInstructionsNone: boolean;
|
|
106
|
+
logMessages: string[];
|
|
107
|
+
logMessagesNone: boolean;
|
|
108
|
+
preTokenBalances: TokenBalance[];
|
|
109
|
+
postTokenBalances: TokenBalance[];
|
|
110
|
+
rewards: Reward[];
|
|
111
|
+
loadedWritableAddresses: Uint8Array[];
|
|
112
|
+
loadedReadonlyAddresses: Uint8Array[];
|
|
113
|
+
returnData: ReturnData | undefined;
|
|
114
|
+
returnDataNone: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Sum of compute units consumed by all instructions.
|
|
117
|
+
* Available since Solana v1.10.35 / v1.11.6.
|
|
118
|
+
* Set to `None` for txs executed on earlier versions.
|
|
119
|
+
*/
|
|
120
|
+
computeUnitsConsumed?: number | undefined;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface TransactionError {
|
|
124
|
+
err: Uint8Array;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface InnerInstructions {
|
|
128
|
+
index: number;
|
|
129
|
+
instructions: InnerInstruction[];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface InnerInstruction {
|
|
133
|
+
programIdIndex: number;
|
|
134
|
+
accounts: Uint8Array;
|
|
135
|
+
data: Uint8Array;
|
|
136
|
+
/**
|
|
137
|
+
* Invocation stack height of an inner instruction.
|
|
138
|
+
* Available since Solana v1.14.6
|
|
139
|
+
* Set to `None` for txs executed on earlier versions.
|
|
140
|
+
*/
|
|
141
|
+
stackHeight?: number | undefined;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface CompiledInstruction {
|
|
145
|
+
programIdIndex: number;
|
|
146
|
+
accounts: Uint8Array;
|
|
147
|
+
data: Uint8Array;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface TokenBalance {
|
|
151
|
+
accountIndex: number;
|
|
152
|
+
mint: string;
|
|
153
|
+
uiTokenAmount: UiTokenAmount | undefined;
|
|
154
|
+
owner: string;
|
|
155
|
+
programId: string;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface UiTokenAmount {
|
|
159
|
+
uiAmount: number;
|
|
160
|
+
decimals: number;
|
|
161
|
+
amount: string;
|
|
162
|
+
uiAmountString: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface ReturnData {
|
|
166
|
+
programId: Uint8Array;
|
|
167
|
+
data: Uint8Array;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface Reward {
|
|
171
|
+
pubkey: string;
|
|
172
|
+
lamports: number;
|
|
173
|
+
postBalance: number;
|
|
174
|
+
rewardType: RewardType;
|
|
175
|
+
commission: string;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface Rewards {
|
|
179
|
+
rewards: Reward[];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface UnixTimestamp {
|
|
183
|
+
timestamp: number;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface BlockHeight {
|
|
187
|
+
blockHeight: number;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function createBaseConfirmedBlock(): ConfirmedBlock {
|
|
191
|
+
return {
|
|
192
|
+
previousBlockhash: "",
|
|
193
|
+
blockhash: "",
|
|
194
|
+
parentSlot: 0,
|
|
195
|
+
transactions: [],
|
|
196
|
+
rewards: [],
|
|
197
|
+
blockTime: undefined,
|
|
198
|
+
blockHeight: undefined,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export const ConfirmedBlock = {
|
|
203
|
+
encode(message: ConfirmedBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
204
|
+
if (message.previousBlockhash !== "") {
|
|
205
|
+
writer.uint32(10).string(message.previousBlockhash);
|
|
206
|
+
}
|
|
207
|
+
if (message.blockhash !== "") {
|
|
208
|
+
writer.uint32(18).string(message.blockhash);
|
|
209
|
+
}
|
|
210
|
+
if (message.parentSlot !== 0) {
|
|
211
|
+
writer.uint32(24).uint64(message.parentSlot);
|
|
212
|
+
}
|
|
213
|
+
for (const v of message.transactions) {
|
|
214
|
+
ConfirmedTransaction.encode(v!, writer.uint32(34).fork()).ldelim();
|
|
215
|
+
}
|
|
216
|
+
for (const v of message.rewards) {
|
|
217
|
+
Reward.encode(v!, writer.uint32(42).fork()).ldelim();
|
|
218
|
+
}
|
|
219
|
+
if (message.blockTime !== undefined) {
|
|
220
|
+
UnixTimestamp.encode(message.blockTime, writer.uint32(50).fork()).ldelim();
|
|
221
|
+
}
|
|
222
|
+
if (message.blockHeight !== undefined) {
|
|
223
|
+
BlockHeight.encode(message.blockHeight, writer.uint32(58).fork()).ldelim();
|
|
224
|
+
}
|
|
225
|
+
return writer;
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): ConfirmedBlock {
|
|
229
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
230
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
231
|
+
const message = createBaseConfirmedBlock();
|
|
232
|
+
while (reader.pos < end) {
|
|
233
|
+
const tag = reader.uint32();
|
|
234
|
+
switch (tag >>> 3) {
|
|
235
|
+
case 1:
|
|
236
|
+
if (tag !== 10) {
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
message.previousBlockhash = reader.string();
|
|
241
|
+
continue;
|
|
242
|
+
case 2:
|
|
243
|
+
if (tag !== 18) {
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
message.blockhash = reader.string();
|
|
248
|
+
continue;
|
|
249
|
+
case 3:
|
|
250
|
+
if (tag !== 24) {
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
message.parentSlot = longToNumber(reader.uint64() as Long);
|
|
255
|
+
continue;
|
|
256
|
+
case 4:
|
|
257
|
+
if (tag !== 34) {
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
message.transactions.push(ConfirmedTransaction.decode(reader, reader.uint32()));
|
|
262
|
+
continue;
|
|
263
|
+
case 5:
|
|
264
|
+
if (tag !== 42) {
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
message.rewards.push(Reward.decode(reader, reader.uint32()));
|
|
269
|
+
continue;
|
|
270
|
+
case 6:
|
|
271
|
+
if (tag !== 50) {
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
message.blockTime = UnixTimestamp.decode(reader, reader.uint32());
|
|
276
|
+
continue;
|
|
277
|
+
case 7:
|
|
278
|
+
if (tag !== 58) {
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
message.blockHeight = BlockHeight.decode(reader, reader.uint32());
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
reader.skipType(tag & 7);
|
|
289
|
+
}
|
|
290
|
+
return message;
|
|
291
|
+
},
|
|
292
|
+
|
|
293
|
+
fromJSON(object: any): ConfirmedBlock {
|
|
294
|
+
return {
|
|
295
|
+
previousBlockhash: isSet(object.previousBlockhash) ? String(object.previousBlockhash) : "",
|
|
296
|
+
blockhash: isSet(object.blockhash) ? String(object.blockhash) : "",
|
|
297
|
+
parentSlot: isSet(object.parentSlot) ? Number(object.parentSlot) : 0,
|
|
298
|
+
transactions: Array.isArray(object?.transactions)
|
|
299
|
+
? object.transactions.map((e: any) => ConfirmedTransaction.fromJSON(e))
|
|
300
|
+
: [],
|
|
301
|
+
rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => Reward.fromJSON(e)) : [],
|
|
302
|
+
blockTime: isSet(object.blockTime) ? UnixTimestamp.fromJSON(object.blockTime) : undefined,
|
|
303
|
+
blockHeight: isSet(object.blockHeight) ? BlockHeight.fromJSON(object.blockHeight) : undefined,
|
|
304
|
+
};
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
toJSON(message: ConfirmedBlock): unknown {
|
|
308
|
+
const obj: any = {};
|
|
309
|
+
message.previousBlockhash !== undefined && (obj.previousBlockhash = message.previousBlockhash);
|
|
310
|
+
message.blockhash !== undefined && (obj.blockhash = message.blockhash);
|
|
311
|
+
message.parentSlot !== undefined && (obj.parentSlot = Math.round(message.parentSlot));
|
|
312
|
+
if (message.transactions) {
|
|
313
|
+
obj.transactions = message.transactions.map((e) => e ? ConfirmedTransaction.toJSON(e) : undefined);
|
|
314
|
+
} else {
|
|
315
|
+
obj.transactions = [];
|
|
316
|
+
}
|
|
317
|
+
if (message.rewards) {
|
|
318
|
+
obj.rewards = message.rewards.map((e) => e ? Reward.toJSON(e) : undefined);
|
|
319
|
+
} else {
|
|
320
|
+
obj.rewards = [];
|
|
321
|
+
}
|
|
322
|
+
message.blockTime !== undefined &&
|
|
323
|
+
(obj.blockTime = message.blockTime ? UnixTimestamp.toJSON(message.blockTime) : undefined);
|
|
324
|
+
message.blockHeight !== undefined &&
|
|
325
|
+
(obj.blockHeight = message.blockHeight ? BlockHeight.toJSON(message.blockHeight) : undefined);
|
|
326
|
+
return obj;
|
|
327
|
+
},
|
|
328
|
+
|
|
329
|
+
create<I extends Exact<DeepPartial<ConfirmedBlock>, I>>(base?: I): ConfirmedBlock {
|
|
330
|
+
return ConfirmedBlock.fromPartial(base ?? {});
|
|
331
|
+
},
|
|
332
|
+
|
|
333
|
+
fromPartial<I extends Exact<DeepPartial<ConfirmedBlock>, I>>(object: I): ConfirmedBlock {
|
|
334
|
+
const message = createBaseConfirmedBlock();
|
|
335
|
+
message.previousBlockhash = object.previousBlockhash ?? "";
|
|
336
|
+
message.blockhash = object.blockhash ?? "";
|
|
337
|
+
message.parentSlot = object.parentSlot ?? 0;
|
|
338
|
+
message.transactions = object.transactions?.map((e) => ConfirmedTransaction.fromPartial(e)) || [];
|
|
339
|
+
message.rewards = object.rewards?.map((e) => Reward.fromPartial(e)) || [];
|
|
340
|
+
message.blockTime = (object.blockTime !== undefined && object.blockTime !== null)
|
|
341
|
+
? UnixTimestamp.fromPartial(object.blockTime)
|
|
342
|
+
: undefined;
|
|
343
|
+
message.blockHeight = (object.blockHeight !== undefined && object.blockHeight !== null)
|
|
344
|
+
? BlockHeight.fromPartial(object.blockHeight)
|
|
345
|
+
: undefined;
|
|
346
|
+
return message;
|
|
347
|
+
},
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
function createBaseConfirmedTransaction(): ConfirmedTransaction {
|
|
351
|
+
return { transaction: undefined, meta: undefined };
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export const ConfirmedTransaction = {
|
|
355
|
+
encode(message: ConfirmedTransaction, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
356
|
+
if (message.transaction !== undefined) {
|
|
357
|
+
Transaction.encode(message.transaction, writer.uint32(10).fork()).ldelim();
|
|
358
|
+
}
|
|
359
|
+
if (message.meta !== undefined) {
|
|
360
|
+
TransactionStatusMeta.encode(message.meta, writer.uint32(18).fork()).ldelim();
|
|
361
|
+
}
|
|
362
|
+
return writer;
|
|
363
|
+
},
|
|
364
|
+
|
|
365
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): ConfirmedTransaction {
|
|
366
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
367
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
368
|
+
const message = createBaseConfirmedTransaction();
|
|
369
|
+
while (reader.pos < end) {
|
|
370
|
+
const tag = reader.uint32();
|
|
371
|
+
switch (tag >>> 3) {
|
|
372
|
+
case 1:
|
|
373
|
+
if (tag !== 10) {
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
message.transaction = Transaction.decode(reader, reader.uint32());
|
|
378
|
+
continue;
|
|
379
|
+
case 2:
|
|
380
|
+
if (tag !== 18) {
|
|
381
|
+
break;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
message.meta = TransactionStatusMeta.decode(reader, reader.uint32());
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
388
|
+
break;
|
|
389
|
+
}
|
|
390
|
+
reader.skipType(tag & 7);
|
|
391
|
+
}
|
|
392
|
+
return message;
|
|
393
|
+
},
|
|
394
|
+
|
|
395
|
+
fromJSON(object: any): ConfirmedTransaction {
|
|
396
|
+
return {
|
|
397
|
+
transaction: isSet(object.transaction) ? Transaction.fromJSON(object.transaction) : undefined,
|
|
398
|
+
meta: isSet(object.meta) ? TransactionStatusMeta.fromJSON(object.meta) : undefined,
|
|
399
|
+
};
|
|
400
|
+
},
|
|
401
|
+
|
|
402
|
+
toJSON(message: ConfirmedTransaction): unknown {
|
|
403
|
+
const obj: any = {};
|
|
404
|
+
message.transaction !== undefined &&
|
|
405
|
+
(obj.transaction = message.transaction ? Transaction.toJSON(message.transaction) : undefined);
|
|
406
|
+
message.meta !== undefined && (obj.meta = message.meta ? TransactionStatusMeta.toJSON(message.meta) : undefined);
|
|
407
|
+
return obj;
|
|
408
|
+
},
|
|
409
|
+
|
|
410
|
+
create<I extends Exact<DeepPartial<ConfirmedTransaction>, I>>(base?: I): ConfirmedTransaction {
|
|
411
|
+
return ConfirmedTransaction.fromPartial(base ?? {});
|
|
412
|
+
},
|
|
413
|
+
|
|
414
|
+
fromPartial<I extends Exact<DeepPartial<ConfirmedTransaction>, I>>(object: I): ConfirmedTransaction {
|
|
415
|
+
const message = createBaseConfirmedTransaction();
|
|
416
|
+
message.transaction = (object.transaction !== undefined && object.transaction !== null)
|
|
417
|
+
? Transaction.fromPartial(object.transaction)
|
|
418
|
+
: undefined;
|
|
419
|
+
message.meta = (object.meta !== undefined && object.meta !== null)
|
|
420
|
+
? TransactionStatusMeta.fromPartial(object.meta)
|
|
421
|
+
: undefined;
|
|
422
|
+
return message;
|
|
423
|
+
},
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
function createBaseTransaction(): Transaction {
|
|
427
|
+
return { signatures: [], message: undefined };
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export const Transaction = {
|
|
431
|
+
encode(message: Transaction, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
432
|
+
for (const v of message.signatures) {
|
|
433
|
+
writer.uint32(10).bytes(v!);
|
|
434
|
+
}
|
|
435
|
+
if (message.message !== undefined) {
|
|
436
|
+
Message.encode(message.message, writer.uint32(18).fork()).ldelim();
|
|
437
|
+
}
|
|
438
|
+
return writer;
|
|
439
|
+
},
|
|
440
|
+
|
|
441
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Transaction {
|
|
442
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
443
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
444
|
+
const message = createBaseTransaction();
|
|
445
|
+
while (reader.pos < end) {
|
|
446
|
+
const tag = reader.uint32();
|
|
447
|
+
switch (tag >>> 3) {
|
|
448
|
+
case 1:
|
|
449
|
+
if (tag !== 10) {
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
message.signatures.push(reader.bytes());
|
|
454
|
+
continue;
|
|
455
|
+
case 2:
|
|
456
|
+
if (tag !== 18) {
|
|
457
|
+
break;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
message.message = Message.decode(reader, reader.uint32());
|
|
461
|
+
continue;
|
|
462
|
+
}
|
|
463
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
reader.skipType(tag & 7);
|
|
467
|
+
}
|
|
468
|
+
return message;
|
|
469
|
+
},
|
|
470
|
+
|
|
471
|
+
fromJSON(object: any): Transaction {
|
|
472
|
+
return {
|
|
473
|
+
signatures: Array.isArray(object?.signatures) ? object.signatures.map((e: any) => bytesFromBase64(e)) : [],
|
|
474
|
+
message: isSet(object.message) ? Message.fromJSON(object.message) : undefined,
|
|
475
|
+
};
|
|
476
|
+
},
|
|
477
|
+
|
|
478
|
+
toJSON(message: Transaction): unknown {
|
|
479
|
+
const obj: any = {};
|
|
480
|
+
if (message.signatures) {
|
|
481
|
+
obj.signatures = message.signatures.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array(0)));
|
|
482
|
+
} else {
|
|
483
|
+
obj.signatures = [];
|
|
484
|
+
}
|
|
485
|
+
message.message !== undefined && (obj.message = message.message ? Message.toJSON(message.message) : undefined);
|
|
486
|
+
return obj;
|
|
487
|
+
},
|
|
488
|
+
|
|
489
|
+
create<I extends Exact<DeepPartial<Transaction>, I>>(base?: I): Transaction {
|
|
490
|
+
return Transaction.fromPartial(base ?? {});
|
|
491
|
+
},
|
|
492
|
+
|
|
493
|
+
fromPartial<I extends Exact<DeepPartial<Transaction>, I>>(object: I): Transaction {
|
|
494
|
+
const message = createBaseTransaction();
|
|
495
|
+
message.signatures = object.signatures?.map((e) => e) || [];
|
|
496
|
+
message.message = (object.message !== undefined && object.message !== null)
|
|
497
|
+
? Message.fromPartial(object.message)
|
|
498
|
+
: undefined;
|
|
499
|
+
return message;
|
|
500
|
+
},
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
function createBaseMessage(): Message {
|
|
504
|
+
return {
|
|
505
|
+
header: undefined,
|
|
506
|
+
accountKeys: [],
|
|
507
|
+
recentBlockhash: new Uint8Array(0),
|
|
508
|
+
instructions: [],
|
|
509
|
+
versioned: false,
|
|
510
|
+
addressTableLookups: [],
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
export const Message = {
|
|
515
|
+
encode(message: Message, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
516
|
+
if (message.header !== undefined) {
|
|
517
|
+
MessageHeader.encode(message.header, writer.uint32(10).fork()).ldelim();
|
|
518
|
+
}
|
|
519
|
+
for (const v of message.accountKeys) {
|
|
520
|
+
writer.uint32(18).bytes(v!);
|
|
521
|
+
}
|
|
522
|
+
if (message.recentBlockhash.length !== 0) {
|
|
523
|
+
writer.uint32(26).bytes(message.recentBlockhash);
|
|
524
|
+
}
|
|
525
|
+
for (const v of message.instructions) {
|
|
526
|
+
CompiledInstruction.encode(v!, writer.uint32(34).fork()).ldelim();
|
|
527
|
+
}
|
|
528
|
+
if (message.versioned === true) {
|
|
529
|
+
writer.uint32(40).bool(message.versioned);
|
|
530
|
+
}
|
|
531
|
+
for (const v of message.addressTableLookups) {
|
|
532
|
+
MessageAddressTableLookup.encode(v!, writer.uint32(50).fork()).ldelim();
|
|
533
|
+
}
|
|
534
|
+
return writer;
|
|
535
|
+
},
|
|
536
|
+
|
|
537
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Message {
|
|
538
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
539
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
540
|
+
const message = createBaseMessage();
|
|
541
|
+
while (reader.pos < end) {
|
|
542
|
+
const tag = reader.uint32();
|
|
543
|
+
switch (tag >>> 3) {
|
|
544
|
+
case 1:
|
|
545
|
+
if (tag !== 10) {
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
message.header = MessageHeader.decode(reader, reader.uint32());
|
|
550
|
+
continue;
|
|
551
|
+
case 2:
|
|
552
|
+
if (tag !== 18) {
|
|
553
|
+
break;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
message.accountKeys.push(reader.bytes());
|
|
557
|
+
continue;
|
|
558
|
+
case 3:
|
|
559
|
+
if (tag !== 26) {
|
|
560
|
+
break;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
message.recentBlockhash = reader.bytes();
|
|
564
|
+
continue;
|
|
565
|
+
case 4:
|
|
566
|
+
if (tag !== 34) {
|
|
567
|
+
break;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
message.instructions.push(CompiledInstruction.decode(reader, reader.uint32()));
|
|
571
|
+
continue;
|
|
572
|
+
case 5:
|
|
573
|
+
if (tag !== 40) {
|
|
574
|
+
break;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
message.versioned = reader.bool();
|
|
578
|
+
continue;
|
|
579
|
+
case 6:
|
|
580
|
+
if (tag !== 50) {
|
|
581
|
+
break;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
message.addressTableLookups.push(MessageAddressTableLookup.decode(reader, reader.uint32()));
|
|
585
|
+
continue;
|
|
586
|
+
}
|
|
587
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
reader.skipType(tag & 7);
|
|
591
|
+
}
|
|
592
|
+
return message;
|
|
593
|
+
},
|
|
594
|
+
|
|
595
|
+
fromJSON(object: any): Message {
|
|
596
|
+
return {
|
|
597
|
+
header: isSet(object.header) ? MessageHeader.fromJSON(object.header) : undefined,
|
|
598
|
+
accountKeys: Array.isArray(object?.accountKeys) ? object.accountKeys.map((e: any) => bytesFromBase64(e)) : [],
|
|
599
|
+
recentBlockhash: isSet(object.recentBlockhash) ? bytesFromBase64(object.recentBlockhash) : new Uint8Array(0),
|
|
600
|
+
instructions: Array.isArray(object?.instructions)
|
|
601
|
+
? object.instructions.map((e: any) => CompiledInstruction.fromJSON(e))
|
|
602
|
+
: [],
|
|
603
|
+
versioned: isSet(object.versioned) ? Boolean(object.versioned) : false,
|
|
604
|
+
addressTableLookups: Array.isArray(object?.addressTableLookups)
|
|
605
|
+
? object.addressTableLookups.map((e: any) => MessageAddressTableLookup.fromJSON(e))
|
|
606
|
+
: [],
|
|
607
|
+
};
|
|
608
|
+
},
|
|
609
|
+
|
|
610
|
+
toJSON(message: Message): unknown {
|
|
611
|
+
const obj: any = {};
|
|
612
|
+
message.header !== undefined && (obj.header = message.header ? MessageHeader.toJSON(message.header) : undefined);
|
|
613
|
+
if (message.accountKeys) {
|
|
614
|
+
obj.accountKeys = message.accountKeys.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array(0)));
|
|
615
|
+
} else {
|
|
616
|
+
obj.accountKeys = [];
|
|
617
|
+
}
|
|
618
|
+
message.recentBlockhash !== undefined &&
|
|
619
|
+
(obj.recentBlockhash = base64FromBytes(
|
|
620
|
+
message.recentBlockhash !== undefined ? message.recentBlockhash : new Uint8Array(0),
|
|
621
|
+
));
|
|
622
|
+
if (message.instructions) {
|
|
623
|
+
obj.instructions = message.instructions.map((e) => e ? CompiledInstruction.toJSON(e) : undefined);
|
|
624
|
+
} else {
|
|
625
|
+
obj.instructions = [];
|
|
626
|
+
}
|
|
627
|
+
message.versioned !== undefined && (obj.versioned = message.versioned);
|
|
628
|
+
if (message.addressTableLookups) {
|
|
629
|
+
obj.addressTableLookups = message.addressTableLookups.map((e) =>
|
|
630
|
+
e ? MessageAddressTableLookup.toJSON(e) : undefined
|
|
631
|
+
);
|
|
632
|
+
} else {
|
|
633
|
+
obj.addressTableLookups = [];
|
|
634
|
+
}
|
|
635
|
+
return obj;
|
|
636
|
+
},
|
|
637
|
+
|
|
638
|
+
create<I extends Exact<DeepPartial<Message>, I>>(base?: I): Message {
|
|
639
|
+
return Message.fromPartial(base ?? {});
|
|
640
|
+
},
|
|
641
|
+
|
|
642
|
+
fromPartial<I extends Exact<DeepPartial<Message>, I>>(object: I): Message {
|
|
643
|
+
const message = createBaseMessage();
|
|
644
|
+
message.header = (object.header !== undefined && object.header !== null)
|
|
645
|
+
? MessageHeader.fromPartial(object.header)
|
|
646
|
+
: undefined;
|
|
647
|
+
message.accountKeys = object.accountKeys?.map((e) => e) || [];
|
|
648
|
+
message.recentBlockhash = object.recentBlockhash ?? new Uint8Array(0);
|
|
649
|
+
message.instructions = object.instructions?.map((e) => CompiledInstruction.fromPartial(e)) || [];
|
|
650
|
+
message.versioned = object.versioned ?? false;
|
|
651
|
+
message.addressTableLookups = object.addressTableLookups?.map((e) => MessageAddressTableLookup.fromPartial(e)) ||
|
|
652
|
+
[];
|
|
653
|
+
return message;
|
|
654
|
+
},
|
|
655
|
+
};
|
|
656
|
+
|
|
657
|
+
function createBaseMessageHeader(): MessageHeader {
|
|
658
|
+
return { numRequiredSignatures: 0, numReadonlySignedAccounts: 0, numReadonlyUnsignedAccounts: 0 };
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
export const MessageHeader = {
|
|
662
|
+
encode(message: MessageHeader, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
663
|
+
if (message.numRequiredSignatures !== 0) {
|
|
664
|
+
writer.uint32(8).uint32(message.numRequiredSignatures);
|
|
665
|
+
}
|
|
666
|
+
if (message.numReadonlySignedAccounts !== 0) {
|
|
667
|
+
writer.uint32(16).uint32(message.numReadonlySignedAccounts);
|
|
668
|
+
}
|
|
669
|
+
if (message.numReadonlyUnsignedAccounts !== 0) {
|
|
670
|
+
writer.uint32(24).uint32(message.numReadonlyUnsignedAccounts);
|
|
671
|
+
}
|
|
672
|
+
return writer;
|
|
673
|
+
},
|
|
674
|
+
|
|
675
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MessageHeader {
|
|
676
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
677
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
678
|
+
const message = createBaseMessageHeader();
|
|
679
|
+
while (reader.pos < end) {
|
|
680
|
+
const tag = reader.uint32();
|
|
681
|
+
switch (tag >>> 3) {
|
|
682
|
+
case 1:
|
|
683
|
+
if (tag !== 8) {
|
|
684
|
+
break;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
message.numRequiredSignatures = reader.uint32();
|
|
688
|
+
continue;
|
|
689
|
+
case 2:
|
|
690
|
+
if (tag !== 16) {
|
|
691
|
+
break;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
message.numReadonlySignedAccounts = reader.uint32();
|
|
695
|
+
continue;
|
|
696
|
+
case 3:
|
|
697
|
+
if (tag !== 24) {
|
|
698
|
+
break;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
message.numReadonlyUnsignedAccounts = reader.uint32();
|
|
702
|
+
continue;
|
|
703
|
+
}
|
|
704
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
705
|
+
break;
|
|
706
|
+
}
|
|
707
|
+
reader.skipType(tag & 7);
|
|
708
|
+
}
|
|
709
|
+
return message;
|
|
710
|
+
},
|
|
711
|
+
|
|
712
|
+
fromJSON(object: any): MessageHeader {
|
|
713
|
+
return {
|
|
714
|
+
numRequiredSignatures: isSet(object.numRequiredSignatures) ? Number(object.numRequiredSignatures) : 0,
|
|
715
|
+
numReadonlySignedAccounts: isSet(object.numReadonlySignedAccounts) ? Number(object.numReadonlySignedAccounts) : 0,
|
|
716
|
+
numReadonlyUnsignedAccounts: isSet(object.numReadonlyUnsignedAccounts)
|
|
717
|
+
? Number(object.numReadonlyUnsignedAccounts)
|
|
718
|
+
: 0,
|
|
719
|
+
};
|
|
720
|
+
},
|
|
721
|
+
|
|
722
|
+
toJSON(message: MessageHeader): unknown {
|
|
723
|
+
const obj: any = {};
|
|
724
|
+
message.numRequiredSignatures !== undefined &&
|
|
725
|
+
(obj.numRequiredSignatures = Math.round(message.numRequiredSignatures));
|
|
726
|
+
message.numReadonlySignedAccounts !== undefined &&
|
|
727
|
+
(obj.numReadonlySignedAccounts = Math.round(message.numReadonlySignedAccounts));
|
|
728
|
+
message.numReadonlyUnsignedAccounts !== undefined &&
|
|
729
|
+
(obj.numReadonlyUnsignedAccounts = Math.round(message.numReadonlyUnsignedAccounts));
|
|
730
|
+
return obj;
|
|
731
|
+
},
|
|
732
|
+
|
|
733
|
+
create<I extends Exact<DeepPartial<MessageHeader>, I>>(base?: I): MessageHeader {
|
|
734
|
+
return MessageHeader.fromPartial(base ?? {});
|
|
735
|
+
},
|
|
736
|
+
|
|
737
|
+
fromPartial<I extends Exact<DeepPartial<MessageHeader>, I>>(object: I): MessageHeader {
|
|
738
|
+
const message = createBaseMessageHeader();
|
|
739
|
+
message.numRequiredSignatures = object.numRequiredSignatures ?? 0;
|
|
740
|
+
message.numReadonlySignedAccounts = object.numReadonlySignedAccounts ?? 0;
|
|
741
|
+
message.numReadonlyUnsignedAccounts = object.numReadonlyUnsignedAccounts ?? 0;
|
|
742
|
+
return message;
|
|
743
|
+
},
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
function createBaseMessageAddressTableLookup(): MessageAddressTableLookup {
|
|
747
|
+
return { accountKey: new Uint8Array(0), writableIndexes: new Uint8Array(0), readonlyIndexes: new Uint8Array(0) };
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
export const MessageAddressTableLookup = {
|
|
751
|
+
encode(message: MessageAddressTableLookup, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
752
|
+
if (message.accountKey.length !== 0) {
|
|
753
|
+
writer.uint32(10).bytes(message.accountKey);
|
|
754
|
+
}
|
|
755
|
+
if (message.writableIndexes.length !== 0) {
|
|
756
|
+
writer.uint32(18).bytes(message.writableIndexes);
|
|
757
|
+
}
|
|
758
|
+
if (message.readonlyIndexes.length !== 0) {
|
|
759
|
+
writer.uint32(26).bytes(message.readonlyIndexes);
|
|
760
|
+
}
|
|
761
|
+
return writer;
|
|
762
|
+
},
|
|
763
|
+
|
|
764
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MessageAddressTableLookup {
|
|
765
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
766
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
767
|
+
const message = createBaseMessageAddressTableLookup();
|
|
768
|
+
while (reader.pos < end) {
|
|
769
|
+
const tag = reader.uint32();
|
|
770
|
+
switch (tag >>> 3) {
|
|
771
|
+
case 1:
|
|
772
|
+
if (tag !== 10) {
|
|
773
|
+
break;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
message.accountKey = reader.bytes();
|
|
777
|
+
continue;
|
|
778
|
+
case 2:
|
|
779
|
+
if (tag !== 18) {
|
|
780
|
+
break;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
message.writableIndexes = reader.bytes();
|
|
784
|
+
continue;
|
|
785
|
+
case 3:
|
|
786
|
+
if (tag !== 26) {
|
|
787
|
+
break;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
message.readonlyIndexes = reader.bytes();
|
|
791
|
+
continue;
|
|
792
|
+
}
|
|
793
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
794
|
+
break;
|
|
795
|
+
}
|
|
796
|
+
reader.skipType(tag & 7);
|
|
797
|
+
}
|
|
798
|
+
return message;
|
|
799
|
+
},
|
|
800
|
+
|
|
801
|
+
fromJSON(object: any): MessageAddressTableLookup {
|
|
802
|
+
return {
|
|
803
|
+
accountKey: isSet(object.accountKey) ? bytesFromBase64(object.accountKey) : new Uint8Array(0),
|
|
804
|
+
writableIndexes: isSet(object.writableIndexes) ? bytesFromBase64(object.writableIndexes) : new Uint8Array(0),
|
|
805
|
+
readonlyIndexes: isSet(object.readonlyIndexes) ? bytesFromBase64(object.readonlyIndexes) : new Uint8Array(0),
|
|
806
|
+
};
|
|
807
|
+
},
|
|
808
|
+
|
|
809
|
+
toJSON(message: MessageAddressTableLookup): unknown {
|
|
810
|
+
const obj: any = {};
|
|
811
|
+
message.accountKey !== undefined &&
|
|
812
|
+
(obj.accountKey = base64FromBytes(message.accountKey !== undefined ? message.accountKey : new Uint8Array(0)));
|
|
813
|
+
message.writableIndexes !== undefined &&
|
|
814
|
+
(obj.writableIndexes = base64FromBytes(
|
|
815
|
+
message.writableIndexes !== undefined ? message.writableIndexes : new Uint8Array(0),
|
|
816
|
+
));
|
|
817
|
+
message.readonlyIndexes !== undefined &&
|
|
818
|
+
(obj.readonlyIndexes = base64FromBytes(
|
|
819
|
+
message.readonlyIndexes !== undefined ? message.readonlyIndexes : new Uint8Array(0),
|
|
820
|
+
));
|
|
821
|
+
return obj;
|
|
822
|
+
},
|
|
823
|
+
|
|
824
|
+
create<I extends Exact<DeepPartial<MessageAddressTableLookup>, I>>(base?: I): MessageAddressTableLookup {
|
|
825
|
+
return MessageAddressTableLookup.fromPartial(base ?? {});
|
|
826
|
+
},
|
|
827
|
+
|
|
828
|
+
fromPartial<I extends Exact<DeepPartial<MessageAddressTableLookup>, I>>(object: I): MessageAddressTableLookup {
|
|
829
|
+
const message = createBaseMessageAddressTableLookup();
|
|
830
|
+
message.accountKey = object.accountKey ?? new Uint8Array(0);
|
|
831
|
+
message.writableIndexes = object.writableIndexes ?? new Uint8Array(0);
|
|
832
|
+
message.readonlyIndexes = object.readonlyIndexes ?? new Uint8Array(0);
|
|
833
|
+
return message;
|
|
834
|
+
},
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
function createBaseTransactionStatusMeta(): TransactionStatusMeta {
|
|
838
|
+
return {
|
|
839
|
+
err: undefined,
|
|
840
|
+
fee: 0,
|
|
841
|
+
preBalances: [],
|
|
842
|
+
postBalances: [],
|
|
843
|
+
innerInstructions: [],
|
|
844
|
+
innerInstructionsNone: false,
|
|
845
|
+
logMessages: [],
|
|
846
|
+
logMessagesNone: false,
|
|
847
|
+
preTokenBalances: [],
|
|
848
|
+
postTokenBalances: [],
|
|
849
|
+
rewards: [],
|
|
850
|
+
loadedWritableAddresses: [],
|
|
851
|
+
loadedReadonlyAddresses: [],
|
|
852
|
+
returnData: undefined,
|
|
853
|
+
returnDataNone: false,
|
|
854
|
+
computeUnitsConsumed: undefined,
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
export const TransactionStatusMeta = {
|
|
859
|
+
encode(message: TransactionStatusMeta, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
860
|
+
if (message.err !== undefined) {
|
|
861
|
+
TransactionError.encode(message.err, writer.uint32(10).fork()).ldelim();
|
|
862
|
+
}
|
|
863
|
+
if (message.fee !== 0) {
|
|
864
|
+
writer.uint32(16).uint64(message.fee);
|
|
865
|
+
}
|
|
866
|
+
writer.uint32(26).fork();
|
|
867
|
+
for (const v of message.preBalances) {
|
|
868
|
+
writer.uint64(v);
|
|
869
|
+
}
|
|
870
|
+
writer.ldelim();
|
|
871
|
+
writer.uint32(34).fork();
|
|
872
|
+
for (const v of message.postBalances) {
|
|
873
|
+
writer.uint64(v);
|
|
874
|
+
}
|
|
875
|
+
writer.ldelim();
|
|
876
|
+
for (const v of message.innerInstructions) {
|
|
877
|
+
InnerInstructions.encode(v!, writer.uint32(42).fork()).ldelim();
|
|
878
|
+
}
|
|
879
|
+
if (message.innerInstructionsNone === true) {
|
|
880
|
+
writer.uint32(80).bool(message.innerInstructionsNone);
|
|
881
|
+
}
|
|
882
|
+
for (const v of message.logMessages) {
|
|
883
|
+
writer.uint32(50).string(v!);
|
|
884
|
+
}
|
|
885
|
+
if (message.logMessagesNone === true) {
|
|
886
|
+
writer.uint32(88).bool(message.logMessagesNone);
|
|
887
|
+
}
|
|
888
|
+
for (const v of message.preTokenBalances) {
|
|
889
|
+
TokenBalance.encode(v!, writer.uint32(58).fork()).ldelim();
|
|
890
|
+
}
|
|
891
|
+
for (const v of message.postTokenBalances) {
|
|
892
|
+
TokenBalance.encode(v!, writer.uint32(66).fork()).ldelim();
|
|
893
|
+
}
|
|
894
|
+
for (const v of message.rewards) {
|
|
895
|
+
Reward.encode(v!, writer.uint32(74).fork()).ldelim();
|
|
896
|
+
}
|
|
897
|
+
for (const v of message.loadedWritableAddresses) {
|
|
898
|
+
writer.uint32(98).bytes(v!);
|
|
899
|
+
}
|
|
900
|
+
for (const v of message.loadedReadonlyAddresses) {
|
|
901
|
+
writer.uint32(106).bytes(v!);
|
|
902
|
+
}
|
|
903
|
+
if (message.returnData !== undefined) {
|
|
904
|
+
ReturnData.encode(message.returnData, writer.uint32(114).fork()).ldelim();
|
|
905
|
+
}
|
|
906
|
+
if (message.returnDataNone === true) {
|
|
907
|
+
writer.uint32(120).bool(message.returnDataNone);
|
|
908
|
+
}
|
|
909
|
+
if (message.computeUnitsConsumed !== undefined) {
|
|
910
|
+
writer.uint32(128).uint64(message.computeUnitsConsumed);
|
|
911
|
+
}
|
|
912
|
+
return writer;
|
|
913
|
+
},
|
|
914
|
+
|
|
915
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): TransactionStatusMeta {
|
|
916
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
917
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
918
|
+
const message = createBaseTransactionStatusMeta();
|
|
919
|
+
while (reader.pos < end) {
|
|
920
|
+
const tag = reader.uint32();
|
|
921
|
+
switch (tag >>> 3) {
|
|
922
|
+
case 1:
|
|
923
|
+
if (tag !== 10) {
|
|
924
|
+
break;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
message.err = TransactionError.decode(reader, reader.uint32());
|
|
928
|
+
continue;
|
|
929
|
+
case 2:
|
|
930
|
+
if (tag !== 16) {
|
|
931
|
+
break;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
message.fee = longToNumber(reader.uint64() as Long);
|
|
935
|
+
continue;
|
|
936
|
+
case 3:
|
|
937
|
+
if (tag === 24) {
|
|
938
|
+
message.preBalances.push(longToNumber(reader.uint64() as Long));
|
|
939
|
+
|
|
940
|
+
continue;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
if (tag === 26) {
|
|
944
|
+
const end2 = reader.uint32() + reader.pos;
|
|
945
|
+
while (reader.pos < end2) {
|
|
946
|
+
message.preBalances.push(longToNumber(reader.uint64() as Long));
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
continue;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
break;
|
|
953
|
+
case 4:
|
|
954
|
+
if (tag === 32) {
|
|
955
|
+
message.postBalances.push(longToNumber(reader.uint64() as Long));
|
|
956
|
+
|
|
957
|
+
continue;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
if (tag === 34) {
|
|
961
|
+
const end2 = reader.uint32() + reader.pos;
|
|
962
|
+
while (reader.pos < end2) {
|
|
963
|
+
message.postBalances.push(longToNumber(reader.uint64() as Long));
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
continue;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
break;
|
|
970
|
+
case 5:
|
|
971
|
+
if (tag !== 42) {
|
|
972
|
+
break;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
message.innerInstructions.push(InnerInstructions.decode(reader, reader.uint32()));
|
|
976
|
+
continue;
|
|
977
|
+
case 10:
|
|
978
|
+
if (tag !== 80) {
|
|
979
|
+
break;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
message.innerInstructionsNone = reader.bool();
|
|
983
|
+
continue;
|
|
984
|
+
case 6:
|
|
985
|
+
if (tag !== 50) {
|
|
986
|
+
break;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
message.logMessages.push(reader.string());
|
|
990
|
+
continue;
|
|
991
|
+
case 11:
|
|
992
|
+
if (tag !== 88) {
|
|
993
|
+
break;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
message.logMessagesNone = reader.bool();
|
|
997
|
+
continue;
|
|
998
|
+
case 7:
|
|
999
|
+
if (tag !== 58) {
|
|
1000
|
+
break;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
message.preTokenBalances.push(TokenBalance.decode(reader, reader.uint32()));
|
|
1004
|
+
continue;
|
|
1005
|
+
case 8:
|
|
1006
|
+
if (tag !== 66) {
|
|
1007
|
+
break;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
message.postTokenBalances.push(TokenBalance.decode(reader, reader.uint32()));
|
|
1011
|
+
continue;
|
|
1012
|
+
case 9:
|
|
1013
|
+
if (tag !== 74) {
|
|
1014
|
+
break;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
message.rewards.push(Reward.decode(reader, reader.uint32()));
|
|
1018
|
+
continue;
|
|
1019
|
+
case 12:
|
|
1020
|
+
if (tag !== 98) {
|
|
1021
|
+
break;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
message.loadedWritableAddresses.push(reader.bytes());
|
|
1025
|
+
continue;
|
|
1026
|
+
case 13:
|
|
1027
|
+
if (tag !== 106) {
|
|
1028
|
+
break;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
message.loadedReadonlyAddresses.push(reader.bytes());
|
|
1032
|
+
continue;
|
|
1033
|
+
case 14:
|
|
1034
|
+
if (tag !== 114) {
|
|
1035
|
+
break;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
message.returnData = ReturnData.decode(reader, reader.uint32());
|
|
1039
|
+
continue;
|
|
1040
|
+
case 15:
|
|
1041
|
+
if (tag !== 120) {
|
|
1042
|
+
break;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
message.returnDataNone = reader.bool();
|
|
1046
|
+
continue;
|
|
1047
|
+
case 16:
|
|
1048
|
+
if (tag !== 128) {
|
|
1049
|
+
break;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
message.computeUnitsConsumed = longToNumber(reader.uint64() as Long);
|
|
1053
|
+
continue;
|
|
1054
|
+
}
|
|
1055
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1056
|
+
break;
|
|
1057
|
+
}
|
|
1058
|
+
reader.skipType(tag & 7);
|
|
1059
|
+
}
|
|
1060
|
+
return message;
|
|
1061
|
+
},
|
|
1062
|
+
|
|
1063
|
+
fromJSON(object: any): TransactionStatusMeta {
|
|
1064
|
+
return {
|
|
1065
|
+
err: isSet(object.err) ? TransactionError.fromJSON(object.err) : undefined,
|
|
1066
|
+
fee: isSet(object.fee) ? Number(object.fee) : 0,
|
|
1067
|
+
preBalances: Array.isArray(object?.preBalances) ? object.preBalances.map((e: any) => Number(e)) : [],
|
|
1068
|
+
postBalances: Array.isArray(object?.postBalances) ? object.postBalances.map((e: any) => Number(e)) : [],
|
|
1069
|
+
innerInstructions: Array.isArray(object?.innerInstructions)
|
|
1070
|
+
? object.innerInstructions.map((e: any) => InnerInstructions.fromJSON(e))
|
|
1071
|
+
: [],
|
|
1072
|
+
innerInstructionsNone: isSet(object.innerInstructionsNone) ? Boolean(object.innerInstructionsNone) : false,
|
|
1073
|
+
logMessages: Array.isArray(object?.logMessages) ? object.logMessages.map((e: any) => String(e)) : [],
|
|
1074
|
+
logMessagesNone: isSet(object.logMessagesNone) ? Boolean(object.logMessagesNone) : false,
|
|
1075
|
+
preTokenBalances: Array.isArray(object?.preTokenBalances)
|
|
1076
|
+
? object.preTokenBalances.map((e: any) => TokenBalance.fromJSON(e))
|
|
1077
|
+
: [],
|
|
1078
|
+
postTokenBalances: Array.isArray(object?.postTokenBalances)
|
|
1079
|
+
? object.postTokenBalances.map((e: any) => TokenBalance.fromJSON(e))
|
|
1080
|
+
: [],
|
|
1081
|
+
rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => Reward.fromJSON(e)) : [],
|
|
1082
|
+
loadedWritableAddresses: Array.isArray(object?.loadedWritableAddresses)
|
|
1083
|
+
? object.loadedWritableAddresses.map((e: any) => bytesFromBase64(e))
|
|
1084
|
+
: [],
|
|
1085
|
+
loadedReadonlyAddresses: Array.isArray(object?.loadedReadonlyAddresses)
|
|
1086
|
+
? object.loadedReadonlyAddresses.map((e: any) => bytesFromBase64(e))
|
|
1087
|
+
: [],
|
|
1088
|
+
returnData: isSet(object.returnData) ? ReturnData.fromJSON(object.returnData) : undefined,
|
|
1089
|
+
returnDataNone: isSet(object.returnDataNone) ? Boolean(object.returnDataNone) : false,
|
|
1090
|
+
computeUnitsConsumed: isSet(object.computeUnitsConsumed) ? Number(object.computeUnitsConsumed) : undefined,
|
|
1091
|
+
};
|
|
1092
|
+
},
|
|
1093
|
+
|
|
1094
|
+
toJSON(message: TransactionStatusMeta): unknown {
|
|
1095
|
+
const obj: any = {};
|
|
1096
|
+
message.err !== undefined && (obj.err = message.err ? TransactionError.toJSON(message.err) : undefined);
|
|
1097
|
+
message.fee !== undefined && (obj.fee = Math.round(message.fee));
|
|
1098
|
+
if (message.preBalances) {
|
|
1099
|
+
obj.preBalances = message.preBalances.map((e) => Math.round(e));
|
|
1100
|
+
} else {
|
|
1101
|
+
obj.preBalances = [];
|
|
1102
|
+
}
|
|
1103
|
+
if (message.postBalances) {
|
|
1104
|
+
obj.postBalances = message.postBalances.map((e) => Math.round(e));
|
|
1105
|
+
} else {
|
|
1106
|
+
obj.postBalances = [];
|
|
1107
|
+
}
|
|
1108
|
+
if (message.innerInstructions) {
|
|
1109
|
+
obj.innerInstructions = message.innerInstructions.map((e) => e ? InnerInstructions.toJSON(e) : undefined);
|
|
1110
|
+
} else {
|
|
1111
|
+
obj.innerInstructions = [];
|
|
1112
|
+
}
|
|
1113
|
+
message.innerInstructionsNone !== undefined && (obj.innerInstructionsNone = message.innerInstructionsNone);
|
|
1114
|
+
if (message.logMessages) {
|
|
1115
|
+
obj.logMessages = message.logMessages.map((e) => e);
|
|
1116
|
+
} else {
|
|
1117
|
+
obj.logMessages = [];
|
|
1118
|
+
}
|
|
1119
|
+
message.logMessagesNone !== undefined && (obj.logMessagesNone = message.logMessagesNone);
|
|
1120
|
+
if (message.preTokenBalances) {
|
|
1121
|
+
obj.preTokenBalances = message.preTokenBalances.map((e) => e ? TokenBalance.toJSON(e) : undefined);
|
|
1122
|
+
} else {
|
|
1123
|
+
obj.preTokenBalances = [];
|
|
1124
|
+
}
|
|
1125
|
+
if (message.postTokenBalances) {
|
|
1126
|
+
obj.postTokenBalances = message.postTokenBalances.map((e) => e ? TokenBalance.toJSON(e) : undefined);
|
|
1127
|
+
} else {
|
|
1128
|
+
obj.postTokenBalances = [];
|
|
1129
|
+
}
|
|
1130
|
+
if (message.rewards) {
|
|
1131
|
+
obj.rewards = message.rewards.map((e) => e ? Reward.toJSON(e) : undefined);
|
|
1132
|
+
} else {
|
|
1133
|
+
obj.rewards = [];
|
|
1134
|
+
}
|
|
1135
|
+
if (message.loadedWritableAddresses) {
|
|
1136
|
+
obj.loadedWritableAddresses = message.loadedWritableAddresses.map((e) =>
|
|
1137
|
+
base64FromBytes(e !== undefined ? e : new Uint8Array(0))
|
|
1138
|
+
);
|
|
1139
|
+
} else {
|
|
1140
|
+
obj.loadedWritableAddresses = [];
|
|
1141
|
+
}
|
|
1142
|
+
if (message.loadedReadonlyAddresses) {
|
|
1143
|
+
obj.loadedReadonlyAddresses = message.loadedReadonlyAddresses.map((e) =>
|
|
1144
|
+
base64FromBytes(e !== undefined ? e : new Uint8Array(0))
|
|
1145
|
+
);
|
|
1146
|
+
} else {
|
|
1147
|
+
obj.loadedReadonlyAddresses = [];
|
|
1148
|
+
}
|
|
1149
|
+
message.returnData !== undefined &&
|
|
1150
|
+
(obj.returnData = message.returnData ? ReturnData.toJSON(message.returnData) : undefined);
|
|
1151
|
+
message.returnDataNone !== undefined && (obj.returnDataNone = message.returnDataNone);
|
|
1152
|
+
message.computeUnitsConsumed !== undefined && (obj.computeUnitsConsumed = Math.round(message.computeUnitsConsumed));
|
|
1153
|
+
return obj;
|
|
1154
|
+
},
|
|
1155
|
+
|
|
1156
|
+
create<I extends Exact<DeepPartial<TransactionStatusMeta>, I>>(base?: I): TransactionStatusMeta {
|
|
1157
|
+
return TransactionStatusMeta.fromPartial(base ?? {});
|
|
1158
|
+
},
|
|
1159
|
+
|
|
1160
|
+
fromPartial<I extends Exact<DeepPartial<TransactionStatusMeta>, I>>(object: I): TransactionStatusMeta {
|
|
1161
|
+
const message = createBaseTransactionStatusMeta();
|
|
1162
|
+
message.err = (object.err !== undefined && object.err !== null)
|
|
1163
|
+
? TransactionError.fromPartial(object.err)
|
|
1164
|
+
: undefined;
|
|
1165
|
+
message.fee = object.fee ?? 0;
|
|
1166
|
+
message.preBalances = object.preBalances?.map((e) => e) || [];
|
|
1167
|
+
message.postBalances = object.postBalances?.map((e) => e) || [];
|
|
1168
|
+
message.innerInstructions = object.innerInstructions?.map((e) => InnerInstructions.fromPartial(e)) || [];
|
|
1169
|
+
message.innerInstructionsNone = object.innerInstructionsNone ?? false;
|
|
1170
|
+
message.logMessages = object.logMessages?.map((e) => e) || [];
|
|
1171
|
+
message.logMessagesNone = object.logMessagesNone ?? false;
|
|
1172
|
+
message.preTokenBalances = object.preTokenBalances?.map((e) => TokenBalance.fromPartial(e)) || [];
|
|
1173
|
+
message.postTokenBalances = object.postTokenBalances?.map((e) => TokenBalance.fromPartial(e)) || [];
|
|
1174
|
+
message.rewards = object.rewards?.map((e) => Reward.fromPartial(e)) || [];
|
|
1175
|
+
message.loadedWritableAddresses = object.loadedWritableAddresses?.map((e) => e) || [];
|
|
1176
|
+
message.loadedReadonlyAddresses = object.loadedReadonlyAddresses?.map((e) => e) || [];
|
|
1177
|
+
message.returnData = (object.returnData !== undefined && object.returnData !== null)
|
|
1178
|
+
? ReturnData.fromPartial(object.returnData)
|
|
1179
|
+
: undefined;
|
|
1180
|
+
message.returnDataNone = object.returnDataNone ?? false;
|
|
1181
|
+
message.computeUnitsConsumed = object.computeUnitsConsumed ?? undefined;
|
|
1182
|
+
return message;
|
|
1183
|
+
},
|
|
1184
|
+
};
|
|
1185
|
+
|
|
1186
|
+
function createBaseTransactionError(): TransactionError {
|
|
1187
|
+
return { err: new Uint8Array(0) };
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
export const TransactionError = {
|
|
1191
|
+
encode(message: TransactionError, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
1192
|
+
if (message.err.length !== 0) {
|
|
1193
|
+
writer.uint32(10).bytes(message.err);
|
|
1194
|
+
}
|
|
1195
|
+
return writer;
|
|
1196
|
+
},
|
|
1197
|
+
|
|
1198
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): TransactionError {
|
|
1199
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1200
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1201
|
+
const message = createBaseTransactionError();
|
|
1202
|
+
while (reader.pos < end) {
|
|
1203
|
+
const tag = reader.uint32();
|
|
1204
|
+
switch (tag >>> 3) {
|
|
1205
|
+
case 1:
|
|
1206
|
+
if (tag !== 10) {
|
|
1207
|
+
break;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
message.err = reader.bytes();
|
|
1211
|
+
continue;
|
|
1212
|
+
}
|
|
1213
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1214
|
+
break;
|
|
1215
|
+
}
|
|
1216
|
+
reader.skipType(tag & 7);
|
|
1217
|
+
}
|
|
1218
|
+
return message;
|
|
1219
|
+
},
|
|
1220
|
+
|
|
1221
|
+
fromJSON(object: any): TransactionError {
|
|
1222
|
+
return { err: isSet(object.err) ? bytesFromBase64(object.err) : new Uint8Array(0) };
|
|
1223
|
+
},
|
|
1224
|
+
|
|
1225
|
+
toJSON(message: TransactionError): unknown {
|
|
1226
|
+
const obj: any = {};
|
|
1227
|
+
message.err !== undefined &&
|
|
1228
|
+
(obj.err = base64FromBytes(message.err !== undefined ? message.err : new Uint8Array(0)));
|
|
1229
|
+
return obj;
|
|
1230
|
+
},
|
|
1231
|
+
|
|
1232
|
+
create<I extends Exact<DeepPartial<TransactionError>, I>>(base?: I): TransactionError {
|
|
1233
|
+
return TransactionError.fromPartial(base ?? {});
|
|
1234
|
+
},
|
|
1235
|
+
|
|
1236
|
+
fromPartial<I extends Exact<DeepPartial<TransactionError>, I>>(object: I): TransactionError {
|
|
1237
|
+
const message = createBaseTransactionError();
|
|
1238
|
+
message.err = object.err ?? new Uint8Array(0);
|
|
1239
|
+
return message;
|
|
1240
|
+
},
|
|
1241
|
+
};
|
|
1242
|
+
|
|
1243
|
+
function createBaseInnerInstructions(): InnerInstructions {
|
|
1244
|
+
return { index: 0, instructions: [] };
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
export const InnerInstructions = {
|
|
1248
|
+
encode(message: InnerInstructions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
1249
|
+
if (message.index !== 0) {
|
|
1250
|
+
writer.uint32(8).uint32(message.index);
|
|
1251
|
+
}
|
|
1252
|
+
for (const v of message.instructions) {
|
|
1253
|
+
InnerInstruction.encode(v!, writer.uint32(18).fork()).ldelim();
|
|
1254
|
+
}
|
|
1255
|
+
return writer;
|
|
1256
|
+
},
|
|
1257
|
+
|
|
1258
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): InnerInstructions {
|
|
1259
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1260
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1261
|
+
const message = createBaseInnerInstructions();
|
|
1262
|
+
while (reader.pos < end) {
|
|
1263
|
+
const tag = reader.uint32();
|
|
1264
|
+
switch (tag >>> 3) {
|
|
1265
|
+
case 1:
|
|
1266
|
+
if (tag !== 8) {
|
|
1267
|
+
break;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
message.index = reader.uint32();
|
|
1271
|
+
continue;
|
|
1272
|
+
case 2:
|
|
1273
|
+
if (tag !== 18) {
|
|
1274
|
+
break;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
message.instructions.push(InnerInstruction.decode(reader, reader.uint32()));
|
|
1278
|
+
continue;
|
|
1279
|
+
}
|
|
1280
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1281
|
+
break;
|
|
1282
|
+
}
|
|
1283
|
+
reader.skipType(tag & 7);
|
|
1284
|
+
}
|
|
1285
|
+
return message;
|
|
1286
|
+
},
|
|
1287
|
+
|
|
1288
|
+
fromJSON(object: any): InnerInstructions {
|
|
1289
|
+
return {
|
|
1290
|
+
index: isSet(object.index) ? Number(object.index) : 0,
|
|
1291
|
+
instructions: Array.isArray(object?.instructions)
|
|
1292
|
+
? object.instructions.map((e: any) => InnerInstruction.fromJSON(e))
|
|
1293
|
+
: [],
|
|
1294
|
+
};
|
|
1295
|
+
},
|
|
1296
|
+
|
|
1297
|
+
toJSON(message: InnerInstructions): unknown {
|
|
1298
|
+
const obj: any = {};
|
|
1299
|
+
message.index !== undefined && (obj.index = Math.round(message.index));
|
|
1300
|
+
if (message.instructions) {
|
|
1301
|
+
obj.instructions = message.instructions.map((e) => e ? InnerInstruction.toJSON(e) : undefined);
|
|
1302
|
+
} else {
|
|
1303
|
+
obj.instructions = [];
|
|
1304
|
+
}
|
|
1305
|
+
return obj;
|
|
1306
|
+
},
|
|
1307
|
+
|
|
1308
|
+
create<I extends Exact<DeepPartial<InnerInstructions>, I>>(base?: I): InnerInstructions {
|
|
1309
|
+
return InnerInstructions.fromPartial(base ?? {});
|
|
1310
|
+
},
|
|
1311
|
+
|
|
1312
|
+
fromPartial<I extends Exact<DeepPartial<InnerInstructions>, I>>(object: I): InnerInstructions {
|
|
1313
|
+
const message = createBaseInnerInstructions();
|
|
1314
|
+
message.index = object.index ?? 0;
|
|
1315
|
+
message.instructions = object.instructions?.map((e) => InnerInstruction.fromPartial(e)) || [];
|
|
1316
|
+
return message;
|
|
1317
|
+
},
|
|
1318
|
+
};
|
|
1319
|
+
|
|
1320
|
+
function createBaseInnerInstruction(): InnerInstruction {
|
|
1321
|
+
return { programIdIndex: 0, accounts: new Uint8Array(0), data: new Uint8Array(0), stackHeight: undefined };
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
export const InnerInstruction = {
|
|
1325
|
+
encode(message: InnerInstruction, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
1326
|
+
if (message.programIdIndex !== 0) {
|
|
1327
|
+
writer.uint32(8).uint32(message.programIdIndex);
|
|
1328
|
+
}
|
|
1329
|
+
if (message.accounts.length !== 0) {
|
|
1330
|
+
writer.uint32(18).bytes(message.accounts);
|
|
1331
|
+
}
|
|
1332
|
+
if (message.data.length !== 0) {
|
|
1333
|
+
writer.uint32(26).bytes(message.data);
|
|
1334
|
+
}
|
|
1335
|
+
if (message.stackHeight !== undefined) {
|
|
1336
|
+
writer.uint32(32).uint32(message.stackHeight);
|
|
1337
|
+
}
|
|
1338
|
+
return writer;
|
|
1339
|
+
},
|
|
1340
|
+
|
|
1341
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): InnerInstruction {
|
|
1342
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1343
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1344
|
+
const message = createBaseInnerInstruction();
|
|
1345
|
+
while (reader.pos < end) {
|
|
1346
|
+
const tag = reader.uint32();
|
|
1347
|
+
switch (tag >>> 3) {
|
|
1348
|
+
case 1:
|
|
1349
|
+
if (tag !== 8) {
|
|
1350
|
+
break;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
message.programIdIndex = reader.uint32();
|
|
1354
|
+
continue;
|
|
1355
|
+
case 2:
|
|
1356
|
+
if (tag !== 18) {
|
|
1357
|
+
break;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
message.accounts = reader.bytes();
|
|
1361
|
+
continue;
|
|
1362
|
+
case 3:
|
|
1363
|
+
if (tag !== 26) {
|
|
1364
|
+
break;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
message.data = reader.bytes();
|
|
1368
|
+
continue;
|
|
1369
|
+
case 4:
|
|
1370
|
+
if (tag !== 32) {
|
|
1371
|
+
break;
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
message.stackHeight = reader.uint32();
|
|
1375
|
+
continue;
|
|
1376
|
+
}
|
|
1377
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1378
|
+
break;
|
|
1379
|
+
}
|
|
1380
|
+
reader.skipType(tag & 7);
|
|
1381
|
+
}
|
|
1382
|
+
return message;
|
|
1383
|
+
},
|
|
1384
|
+
|
|
1385
|
+
fromJSON(object: any): InnerInstruction {
|
|
1386
|
+
return {
|
|
1387
|
+
programIdIndex: isSet(object.programIdIndex) ? Number(object.programIdIndex) : 0,
|
|
1388
|
+
accounts: isSet(object.accounts) ? bytesFromBase64(object.accounts) : new Uint8Array(0),
|
|
1389
|
+
data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0),
|
|
1390
|
+
stackHeight: isSet(object.stackHeight) ? Number(object.stackHeight) : undefined,
|
|
1391
|
+
};
|
|
1392
|
+
},
|
|
1393
|
+
|
|
1394
|
+
toJSON(message: InnerInstruction): unknown {
|
|
1395
|
+
const obj: any = {};
|
|
1396
|
+
message.programIdIndex !== undefined && (obj.programIdIndex = Math.round(message.programIdIndex));
|
|
1397
|
+
message.accounts !== undefined &&
|
|
1398
|
+
(obj.accounts = base64FromBytes(message.accounts !== undefined ? message.accounts : new Uint8Array(0)));
|
|
1399
|
+
message.data !== undefined &&
|
|
1400
|
+
(obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array(0)));
|
|
1401
|
+
message.stackHeight !== undefined && (obj.stackHeight = Math.round(message.stackHeight));
|
|
1402
|
+
return obj;
|
|
1403
|
+
},
|
|
1404
|
+
|
|
1405
|
+
create<I extends Exact<DeepPartial<InnerInstruction>, I>>(base?: I): InnerInstruction {
|
|
1406
|
+
return InnerInstruction.fromPartial(base ?? {});
|
|
1407
|
+
},
|
|
1408
|
+
|
|
1409
|
+
fromPartial<I extends Exact<DeepPartial<InnerInstruction>, I>>(object: I): InnerInstruction {
|
|
1410
|
+
const message = createBaseInnerInstruction();
|
|
1411
|
+
message.programIdIndex = object.programIdIndex ?? 0;
|
|
1412
|
+
message.accounts = object.accounts ?? new Uint8Array(0);
|
|
1413
|
+
message.data = object.data ?? new Uint8Array(0);
|
|
1414
|
+
message.stackHeight = object.stackHeight ?? undefined;
|
|
1415
|
+
return message;
|
|
1416
|
+
},
|
|
1417
|
+
};
|
|
1418
|
+
|
|
1419
|
+
function createBaseCompiledInstruction(): CompiledInstruction {
|
|
1420
|
+
return { programIdIndex: 0, accounts: new Uint8Array(0), data: new Uint8Array(0) };
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
export const CompiledInstruction = {
|
|
1424
|
+
encode(message: CompiledInstruction, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
1425
|
+
if (message.programIdIndex !== 0) {
|
|
1426
|
+
writer.uint32(8).uint32(message.programIdIndex);
|
|
1427
|
+
}
|
|
1428
|
+
if (message.accounts.length !== 0) {
|
|
1429
|
+
writer.uint32(18).bytes(message.accounts);
|
|
1430
|
+
}
|
|
1431
|
+
if (message.data.length !== 0) {
|
|
1432
|
+
writer.uint32(26).bytes(message.data);
|
|
1433
|
+
}
|
|
1434
|
+
return writer;
|
|
1435
|
+
},
|
|
1436
|
+
|
|
1437
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): CompiledInstruction {
|
|
1438
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1439
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1440
|
+
const message = createBaseCompiledInstruction();
|
|
1441
|
+
while (reader.pos < end) {
|
|
1442
|
+
const tag = reader.uint32();
|
|
1443
|
+
switch (tag >>> 3) {
|
|
1444
|
+
case 1:
|
|
1445
|
+
if (tag !== 8) {
|
|
1446
|
+
break;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
message.programIdIndex = reader.uint32();
|
|
1450
|
+
continue;
|
|
1451
|
+
case 2:
|
|
1452
|
+
if (tag !== 18) {
|
|
1453
|
+
break;
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
message.accounts = reader.bytes();
|
|
1457
|
+
continue;
|
|
1458
|
+
case 3:
|
|
1459
|
+
if (tag !== 26) {
|
|
1460
|
+
break;
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
message.data = reader.bytes();
|
|
1464
|
+
continue;
|
|
1465
|
+
}
|
|
1466
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1467
|
+
break;
|
|
1468
|
+
}
|
|
1469
|
+
reader.skipType(tag & 7);
|
|
1470
|
+
}
|
|
1471
|
+
return message;
|
|
1472
|
+
},
|
|
1473
|
+
|
|
1474
|
+
fromJSON(object: any): CompiledInstruction {
|
|
1475
|
+
return {
|
|
1476
|
+
programIdIndex: isSet(object.programIdIndex) ? Number(object.programIdIndex) : 0,
|
|
1477
|
+
accounts: isSet(object.accounts) ? bytesFromBase64(object.accounts) : new Uint8Array(0),
|
|
1478
|
+
data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0),
|
|
1479
|
+
};
|
|
1480
|
+
},
|
|
1481
|
+
|
|
1482
|
+
toJSON(message: CompiledInstruction): unknown {
|
|
1483
|
+
const obj: any = {};
|
|
1484
|
+
message.programIdIndex !== undefined && (obj.programIdIndex = Math.round(message.programIdIndex));
|
|
1485
|
+
message.accounts !== undefined &&
|
|
1486
|
+
(obj.accounts = base64FromBytes(message.accounts !== undefined ? message.accounts : new Uint8Array(0)));
|
|
1487
|
+
message.data !== undefined &&
|
|
1488
|
+
(obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array(0)));
|
|
1489
|
+
return obj;
|
|
1490
|
+
},
|
|
1491
|
+
|
|
1492
|
+
create<I extends Exact<DeepPartial<CompiledInstruction>, I>>(base?: I): CompiledInstruction {
|
|
1493
|
+
return CompiledInstruction.fromPartial(base ?? {});
|
|
1494
|
+
},
|
|
1495
|
+
|
|
1496
|
+
fromPartial<I extends Exact<DeepPartial<CompiledInstruction>, I>>(object: I): CompiledInstruction {
|
|
1497
|
+
const message = createBaseCompiledInstruction();
|
|
1498
|
+
message.programIdIndex = object.programIdIndex ?? 0;
|
|
1499
|
+
message.accounts = object.accounts ?? new Uint8Array(0);
|
|
1500
|
+
message.data = object.data ?? new Uint8Array(0);
|
|
1501
|
+
return message;
|
|
1502
|
+
},
|
|
1503
|
+
};
|
|
1504
|
+
|
|
1505
|
+
function createBaseTokenBalance(): TokenBalance {
|
|
1506
|
+
return { accountIndex: 0, mint: "", uiTokenAmount: undefined, owner: "", programId: "" };
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
export const TokenBalance = {
|
|
1510
|
+
encode(message: TokenBalance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
1511
|
+
if (message.accountIndex !== 0) {
|
|
1512
|
+
writer.uint32(8).uint32(message.accountIndex);
|
|
1513
|
+
}
|
|
1514
|
+
if (message.mint !== "") {
|
|
1515
|
+
writer.uint32(18).string(message.mint);
|
|
1516
|
+
}
|
|
1517
|
+
if (message.uiTokenAmount !== undefined) {
|
|
1518
|
+
UiTokenAmount.encode(message.uiTokenAmount, writer.uint32(26).fork()).ldelim();
|
|
1519
|
+
}
|
|
1520
|
+
if (message.owner !== "") {
|
|
1521
|
+
writer.uint32(34).string(message.owner);
|
|
1522
|
+
}
|
|
1523
|
+
if (message.programId !== "") {
|
|
1524
|
+
writer.uint32(42).string(message.programId);
|
|
1525
|
+
}
|
|
1526
|
+
return writer;
|
|
1527
|
+
},
|
|
1528
|
+
|
|
1529
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): TokenBalance {
|
|
1530
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1531
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1532
|
+
const message = createBaseTokenBalance();
|
|
1533
|
+
while (reader.pos < end) {
|
|
1534
|
+
const tag = reader.uint32();
|
|
1535
|
+
switch (tag >>> 3) {
|
|
1536
|
+
case 1:
|
|
1537
|
+
if (tag !== 8) {
|
|
1538
|
+
break;
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
message.accountIndex = reader.uint32();
|
|
1542
|
+
continue;
|
|
1543
|
+
case 2:
|
|
1544
|
+
if (tag !== 18) {
|
|
1545
|
+
break;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
message.mint = reader.string();
|
|
1549
|
+
continue;
|
|
1550
|
+
case 3:
|
|
1551
|
+
if (tag !== 26) {
|
|
1552
|
+
break;
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
message.uiTokenAmount = UiTokenAmount.decode(reader, reader.uint32());
|
|
1556
|
+
continue;
|
|
1557
|
+
case 4:
|
|
1558
|
+
if (tag !== 34) {
|
|
1559
|
+
break;
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
message.owner = reader.string();
|
|
1563
|
+
continue;
|
|
1564
|
+
case 5:
|
|
1565
|
+
if (tag !== 42) {
|
|
1566
|
+
break;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
message.programId = reader.string();
|
|
1570
|
+
continue;
|
|
1571
|
+
}
|
|
1572
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1573
|
+
break;
|
|
1574
|
+
}
|
|
1575
|
+
reader.skipType(tag & 7);
|
|
1576
|
+
}
|
|
1577
|
+
return message;
|
|
1578
|
+
},
|
|
1579
|
+
|
|
1580
|
+
fromJSON(object: any): TokenBalance {
|
|
1581
|
+
return {
|
|
1582
|
+
accountIndex: isSet(object.accountIndex) ? Number(object.accountIndex) : 0,
|
|
1583
|
+
mint: isSet(object.mint) ? String(object.mint) : "",
|
|
1584
|
+
uiTokenAmount: isSet(object.uiTokenAmount) ? UiTokenAmount.fromJSON(object.uiTokenAmount) : undefined,
|
|
1585
|
+
owner: isSet(object.owner) ? String(object.owner) : "",
|
|
1586
|
+
programId: isSet(object.programId) ? String(object.programId) : "",
|
|
1587
|
+
};
|
|
1588
|
+
},
|
|
1589
|
+
|
|
1590
|
+
toJSON(message: TokenBalance): unknown {
|
|
1591
|
+
const obj: any = {};
|
|
1592
|
+
message.accountIndex !== undefined && (obj.accountIndex = Math.round(message.accountIndex));
|
|
1593
|
+
message.mint !== undefined && (obj.mint = message.mint);
|
|
1594
|
+
message.uiTokenAmount !== undefined &&
|
|
1595
|
+
(obj.uiTokenAmount = message.uiTokenAmount ? UiTokenAmount.toJSON(message.uiTokenAmount) : undefined);
|
|
1596
|
+
message.owner !== undefined && (obj.owner = message.owner);
|
|
1597
|
+
message.programId !== undefined && (obj.programId = message.programId);
|
|
1598
|
+
return obj;
|
|
1599
|
+
},
|
|
1600
|
+
|
|
1601
|
+
create<I extends Exact<DeepPartial<TokenBalance>, I>>(base?: I): TokenBalance {
|
|
1602
|
+
return TokenBalance.fromPartial(base ?? {});
|
|
1603
|
+
},
|
|
1604
|
+
|
|
1605
|
+
fromPartial<I extends Exact<DeepPartial<TokenBalance>, I>>(object: I): TokenBalance {
|
|
1606
|
+
const message = createBaseTokenBalance();
|
|
1607
|
+
message.accountIndex = object.accountIndex ?? 0;
|
|
1608
|
+
message.mint = object.mint ?? "";
|
|
1609
|
+
message.uiTokenAmount = (object.uiTokenAmount !== undefined && object.uiTokenAmount !== null)
|
|
1610
|
+
? UiTokenAmount.fromPartial(object.uiTokenAmount)
|
|
1611
|
+
: undefined;
|
|
1612
|
+
message.owner = object.owner ?? "";
|
|
1613
|
+
message.programId = object.programId ?? "";
|
|
1614
|
+
return message;
|
|
1615
|
+
},
|
|
1616
|
+
};
|
|
1617
|
+
|
|
1618
|
+
function createBaseUiTokenAmount(): UiTokenAmount {
|
|
1619
|
+
return { uiAmount: 0, decimals: 0, amount: "", uiAmountString: "" };
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
export const UiTokenAmount = {
|
|
1623
|
+
encode(message: UiTokenAmount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
1624
|
+
if (message.uiAmount !== 0) {
|
|
1625
|
+
writer.uint32(9).double(message.uiAmount);
|
|
1626
|
+
}
|
|
1627
|
+
if (message.decimals !== 0) {
|
|
1628
|
+
writer.uint32(16).uint32(message.decimals);
|
|
1629
|
+
}
|
|
1630
|
+
if (message.amount !== "") {
|
|
1631
|
+
writer.uint32(26).string(message.amount);
|
|
1632
|
+
}
|
|
1633
|
+
if (message.uiAmountString !== "") {
|
|
1634
|
+
writer.uint32(34).string(message.uiAmountString);
|
|
1635
|
+
}
|
|
1636
|
+
return writer;
|
|
1637
|
+
},
|
|
1638
|
+
|
|
1639
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): UiTokenAmount {
|
|
1640
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1641
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1642
|
+
const message = createBaseUiTokenAmount();
|
|
1643
|
+
while (reader.pos < end) {
|
|
1644
|
+
const tag = reader.uint32();
|
|
1645
|
+
switch (tag >>> 3) {
|
|
1646
|
+
case 1:
|
|
1647
|
+
if (tag !== 9) {
|
|
1648
|
+
break;
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
message.uiAmount = reader.double();
|
|
1652
|
+
continue;
|
|
1653
|
+
case 2:
|
|
1654
|
+
if (tag !== 16) {
|
|
1655
|
+
break;
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
message.decimals = reader.uint32();
|
|
1659
|
+
continue;
|
|
1660
|
+
case 3:
|
|
1661
|
+
if (tag !== 26) {
|
|
1662
|
+
break;
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
message.amount = reader.string();
|
|
1666
|
+
continue;
|
|
1667
|
+
case 4:
|
|
1668
|
+
if (tag !== 34) {
|
|
1669
|
+
break;
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
message.uiAmountString = reader.string();
|
|
1673
|
+
continue;
|
|
1674
|
+
}
|
|
1675
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1676
|
+
break;
|
|
1677
|
+
}
|
|
1678
|
+
reader.skipType(tag & 7);
|
|
1679
|
+
}
|
|
1680
|
+
return message;
|
|
1681
|
+
},
|
|
1682
|
+
|
|
1683
|
+
fromJSON(object: any): UiTokenAmount {
|
|
1684
|
+
return {
|
|
1685
|
+
uiAmount: isSet(object.uiAmount) ? Number(object.uiAmount) : 0,
|
|
1686
|
+
decimals: isSet(object.decimals) ? Number(object.decimals) : 0,
|
|
1687
|
+
amount: isSet(object.amount) ? String(object.amount) : "",
|
|
1688
|
+
uiAmountString: isSet(object.uiAmountString) ? String(object.uiAmountString) : "",
|
|
1689
|
+
};
|
|
1690
|
+
},
|
|
1691
|
+
|
|
1692
|
+
toJSON(message: UiTokenAmount): unknown {
|
|
1693
|
+
const obj: any = {};
|
|
1694
|
+
message.uiAmount !== undefined && (obj.uiAmount = message.uiAmount);
|
|
1695
|
+
message.decimals !== undefined && (obj.decimals = Math.round(message.decimals));
|
|
1696
|
+
message.amount !== undefined && (obj.amount = message.amount);
|
|
1697
|
+
message.uiAmountString !== undefined && (obj.uiAmountString = message.uiAmountString);
|
|
1698
|
+
return obj;
|
|
1699
|
+
},
|
|
1700
|
+
|
|
1701
|
+
create<I extends Exact<DeepPartial<UiTokenAmount>, I>>(base?: I): UiTokenAmount {
|
|
1702
|
+
return UiTokenAmount.fromPartial(base ?? {});
|
|
1703
|
+
},
|
|
1704
|
+
|
|
1705
|
+
fromPartial<I extends Exact<DeepPartial<UiTokenAmount>, I>>(object: I): UiTokenAmount {
|
|
1706
|
+
const message = createBaseUiTokenAmount();
|
|
1707
|
+
message.uiAmount = object.uiAmount ?? 0;
|
|
1708
|
+
message.decimals = object.decimals ?? 0;
|
|
1709
|
+
message.amount = object.amount ?? "";
|
|
1710
|
+
message.uiAmountString = object.uiAmountString ?? "";
|
|
1711
|
+
return message;
|
|
1712
|
+
},
|
|
1713
|
+
};
|
|
1714
|
+
|
|
1715
|
+
function createBaseReturnData(): ReturnData {
|
|
1716
|
+
return { programId: new Uint8Array(0), data: new Uint8Array(0) };
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
export const ReturnData = {
|
|
1720
|
+
encode(message: ReturnData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
1721
|
+
if (message.programId.length !== 0) {
|
|
1722
|
+
writer.uint32(10).bytes(message.programId);
|
|
1723
|
+
}
|
|
1724
|
+
if (message.data.length !== 0) {
|
|
1725
|
+
writer.uint32(18).bytes(message.data);
|
|
1726
|
+
}
|
|
1727
|
+
return writer;
|
|
1728
|
+
},
|
|
1729
|
+
|
|
1730
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): ReturnData {
|
|
1731
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1732
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1733
|
+
const message = createBaseReturnData();
|
|
1734
|
+
while (reader.pos < end) {
|
|
1735
|
+
const tag = reader.uint32();
|
|
1736
|
+
switch (tag >>> 3) {
|
|
1737
|
+
case 1:
|
|
1738
|
+
if (tag !== 10) {
|
|
1739
|
+
break;
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
message.programId = reader.bytes();
|
|
1743
|
+
continue;
|
|
1744
|
+
case 2:
|
|
1745
|
+
if (tag !== 18) {
|
|
1746
|
+
break;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
message.data = reader.bytes();
|
|
1750
|
+
continue;
|
|
1751
|
+
}
|
|
1752
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1753
|
+
break;
|
|
1754
|
+
}
|
|
1755
|
+
reader.skipType(tag & 7);
|
|
1756
|
+
}
|
|
1757
|
+
return message;
|
|
1758
|
+
},
|
|
1759
|
+
|
|
1760
|
+
fromJSON(object: any): ReturnData {
|
|
1761
|
+
return {
|
|
1762
|
+
programId: isSet(object.programId) ? bytesFromBase64(object.programId) : new Uint8Array(0),
|
|
1763
|
+
data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0),
|
|
1764
|
+
};
|
|
1765
|
+
},
|
|
1766
|
+
|
|
1767
|
+
toJSON(message: ReturnData): unknown {
|
|
1768
|
+
const obj: any = {};
|
|
1769
|
+
message.programId !== undefined &&
|
|
1770
|
+
(obj.programId = base64FromBytes(message.programId !== undefined ? message.programId : new Uint8Array(0)));
|
|
1771
|
+
message.data !== undefined &&
|
|
1772
|
+
(obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array(0)));
|
|
1773
|
+
return obj;
|
|
1774
|
+
},
|
|
1775
|
+
|
|
1776
|
+
create<I extends Exact<DeepPartial<ReturnData>, I>>(base?: I): ReturnData {
|
|
1777
|
+
return ReturnData.fromPartial(base ?? {});
|
|
1778
|
+
},
|
|
1779
|
+
|
|
1780
|
+
fromPartial<I extends Exact<DeepPartial<ReturnData>, I>>(object: I): ReturnData {
|
|
1781
|
+
const message = createBaseReturnData();
|
|
1782
|
+
message.programId = object.programId ?? new Uint8Array(0);
|
|
1783
|
+
message.data = object.data ?? new Uint8Array(0);
|
|
1784
|
+
return message;
|
|
1785
|
+
},
|
|
1786
|
+
};
|
|
1787
|
+
|
|
1788
|
+
function createBaseReward(): Reward {
|
|
1789
|
+
return { pubkey: "", lamports: 0, postBalance: 0, rewardType: 0, commission: "" };
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
export const Reward = {
|
|
1793
|
+
encode(message: Reward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
1794
|
+
if (message.pubkey !== "") {
|
|
1795
|
+
writer.uint32(10).string(message.pubkey);
|
|
1796
|
+
}
|
|
1797
|
+
if (message.lamports !== 0) {
|
|
1798
|
+
writer.uint32(16).int64(message.lamports);
|
|
1799
|
+
}
|
|
1800
|
+
if (message.postBalance !== 0) {
|
|
1801
|
+
writer.uint32(24).uint64(message.postBalance);
|
|
1802
|
+
}
|
|
1803
|
+
if (message.rewardType !== 0) {
|
|
1804
|
+
writer.uint32(32).int32(message.rewardType);
|
|
1805
|
+
}
|
|
1806
|
+
if (message.commission !== "") {
|
|
1807
|
+
writer.uint32(42).string(message.commission);
|
|
1808
|
+
}
|
|
1809
|
+
return writer;
|
|
1810
|
+
},
|
|
1811
|
+
|
|
1812
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Reward {
|
|
1813
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1814
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1815
|
+
const message = createBaseReward();
|
|
1816
|
+
while (reader.pos < end) {
|
|
1817
|
+
const tag = reader.uint32();
|
|
1818
|
+
switch (tag >>> 3) {
|
|
1819
|
+
case 1:
|
|
1820
|
+
if (tag !== 10) {
|
|
1821
|
+
break;
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
message.pubkey = reader.string();
|
|
1825
|
+
continue;
|
|
1826
|
+
case 2:
|
|
1827
|
+
if (tag !== 16) {
|
|
1828
|
+
break;
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
message.lamports = longToNumber(reader.int64() as Long);
|
|
1832
|
+
continue;
|
|
1833
|
+
case 3:
|
|
1834
|
+
if (tag !== 24) {
|
|
1835
|
+
break;
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
message.postBalance = longToNumber(reader.uint64() as Long);
|
|
1839
|
+
continue;
|
|
1840
|
+
case 4:
|
|
1841
|
+
if (tag !== 32) {
|
|
1842
|
+
break;
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
message.rewardType = reader.int32() as any;
|
|
1846
|
+
continue;
|
|
1847
|
+
case 5:
|
|
1848
|
+
if (tag !== 42) {
|
|
1849
|
+
break;
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
message.commission = reader.string();
|
|
1853
|
+
continue;
|
|
1854
|
+
}
|
|
1855
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1856
|
+
break;
|
|
1857
|
+
}
|
|
1858
|
+
reader.skipType(tag & 7);
|
|
1859
|
+
}
|
|
1860
|
+
return message;
|
|
1861
|
+
},
|
|
1862
|
+
|
|
1863
|
+
fromJSON(object: any): Reward {
|
|
1864
|
+
return {
|
|
1865
|
+
pubkey: isSet(object.pubkey) ? String(object.pubkey) : "",
|
|
1866
|
+
lamports: isSet(object.lamports) ? Number(object.lamports) : 0,
|
|
1867
|
+
postBalance: isSet(object.postBalance) ? Number(object.postBalance) : 0,
|
|
1868
|
+
rewardType: isSet(object.rewardType) ? rewardTypeFromJSON(object.rewardType) : 0,
|
|
1869
|
+
commission: isSet(object.commission) ? String(object.commission) : "",
|
|
1870
|
+
};
|
|
1871
|
+
},
|
|
1872
|
+
|
|
1873
|
+
toJSON(message: Reward): unknown {
|
|
1874
|
+
const obj: any = {};
|
|
1875
|
+
message.pubkey !== undefined && (obj.pubkey = message.pubkey);
|
|
1876
|
+
message.lamports !== undefined && (obj.lamports = Math.round(message.lamports));
|
|
1877
|
+
message.postBalance !== undefined && (obj.postBalance = Math.round(message.postBalance));
|
|
1878
|
+
message.rewardType !== undefined && (obj.rewardType = rewardTypeToJSON(message.rewardType));
|
|
1879
|
+
message.commission !== undefined && (obj.commission = message.commission);
|
|
1880
|
+
return obj;
|
|
1881
|
+
},
|
|
1882
|
+
|
|
1883
|
+
create<I extends Exact<DeepPartial<Reward>, I>>(base?: I): Reward {
|
|
1884
|
+
return Reward.fromPartial(base ?? {});
|
|
1885
|
+
},
|
|
1886
|
+
|
|
1887
|
+
fromPartial<I extends Exact<DeepPartial<Reward>, I>>(object: I): Reward {
|
|
1888
|
+
const message = createBaseReward();
|
|
1889
|
+
message.pubkey = object.pubkey ?? "";
|
|
1890
|
+
message.lamports = object.lamports ?? 0;
|
|
1891
|
+
message.postBalance = object.postBalance ?? 0;
|
|
1892
|
+
message.rewardType = object.rewardType ?? 0;
|
|
1893
|
+
message.commission = object.commission ?? "";
|
|
1894
|
+
return message;
|
|
1895
|
+
},
|
|
1896
|
+
};
|
|
1897
|
+
|
|
1898
|
+
function createBaseRewards(): Rewards {
|
|
1899
|
+
return { rewards: [] };
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
export const Rewards = {
|
|
1903
|
+
encode(message: Rewards, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
1904
|
+
for (const v of message.rewards) {
|
|
1905
|
+
Reward.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
1906
|
+
}
|
|
1907
|
+
return writer;
|
|
1908
|
+
},
|
|
1909
|
+
|
|
1910
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Rewards {
|
|
1911
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1912
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1913
|
+
const message = createBaseRewards();
|
|
1914
|
+
while (reader.pos < end) {
|
|
1915
|
+
const tag = reader.uint32();
|
|
1916
|
+
switch (tag >>> 3) {
|
|
1917
|
+
case 1:
|
|
1918
|
+
if (tag !== 10) {
|
|
1919
|
+
break;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
message.rewards.push(Reward.decode(reader, reader.uint32()));
|
|
1923
|
+
continue;
|
|
1924
|
+
}
|
|
1925
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1926
|
+
break;
|
|
1927
|
+
}
|
|
1928
|
+
reader.skipType(tag & 7);
|
|
1929
|
+
}
|
|
1930
|
+
return message;
|
|
1931
|
+
},
|
|
1932
|
+
|
|
1933
|
+
fromJSON(object: any): Rewards {
|
|
1934
|
+
return { rewards: Array.isArray(object?.rewards) ? object.rewards.map((e: any) => Reward.fromJSON(e)) : [] };
|
|
1935
|
+
},
|
|
1936
|
+
|
|
1937
|
+
toJSON(message: Rewards): unknown {
|
|
1938
|
+
const obj: any = {};
|
|
1939
|
+
if (message.rewards) {
|
|
1940
|
+
obj.rewards = message.rewards.map((e) => e ? Reward.toJSON(e) : undefined);
|
|
1941
|
+
} else {
|
|
1942
|
+
obj.rewards = [];
|
|
1943
|
+
}
|
|
1944
|
+
return obj;
|
|
1945
|
+
},
|
|
1946
|
+
|
|
1947
|
+
create<I extends Exact<DeepPartial<Rewards>, I>>(base?: I): Rewards {
|
|
1948
|
+
return Rewards.fromPartial(base ?? {});
|
|
1949
|
+
},
|
|
1950
|
+
|
|
1951
|
+
fromPartial<I extends Exact<DeepPartial<Rewards>, I>>(object: I): Rewards {
|
|
1952
|
+
const message = createBaseRewards();
|
|
1953
|
+
message.rewards = object.rewards?.map((e) => Reward.fromPartial(e)) || [];
|
|
1954
|
+
return message;
|
|
1955
|
+
},
|
|
1956
|
+
};
|
|
1957
|
+
|
|
1958
|
+
function createBaseUnixTimestamp(): UnixTimestamp {
|
|
1959
|
+
return { timestamp: 0 };
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
export const UnixTimestamp = {
|
|
1963
|
+
encode(message: UnixTimestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
1964
|
+
if (message.timestamp !== 0) {
|
|
1965
|
+
writer.uint32(8).int64(message.timestamp);
|
|
1966
|
+
}
|
|
1967
|
+
return writer;
|
|
1968
|
+
},
|
|
1969
|
+
|
|
1970
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): UnixTimestamp {
|
|
1971
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1972
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1973
|
+
const message = createBaseUnixTimestamp();
|
|
1974
|
+
while (reader.pos < end) {
|
|
1975
|
+
const tag = reader.uint32();
|
|
1976
|
+
switch (tag >>> 3) {
|
|
1977
|
+
case 1:
|
|
1978
|
+
if (tag !== 8) {
|
|
1979
|
+
break;
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
message.timestamp = longToNumber(reader.int64() as Long);
|
|
1983
|
+
continue;
|
|
1984
|
+
}
|
|
1985
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1986
|
+
break;
|
|
1987
|
+
}
|
|
1988
|
+
reader.skipType(tag & 7);
|
|
1989
|
+
}
|
|
1990
|
+
return message;
|
|
1991
|
+
},
|
|
1992
|
+
|
|
1993
|
+
fromJSON(object: any): UnixTimestamp {
|
|
1994
|
+
return { timestamp: isSet(object.timestamp) ? Number(object.timestamp) : 0 };
|
|
1995
|
+
},
|
|
1996
|
+
|
|
1997
|
+
toJSON(message: UnixTimestamp): unknown {
|
|
1998
|
+
const obj: any = {};
|
|
1999
|
+
message.timestamp !== undefined && (obj.timestamp = Math.round(message.timestamp));
|
|
2000
|
+
return obj;
|
|
2001
|
+
},
|
|
2002
|
+
|
|
2003
|
+
create<I extends Exact<DeepPartial<UnixTimestamp>, I>>(base?: I): UnixTimestamp {
|
|
2004
|
+
return UnixTimestamp.fromPartial(base ?? {});
|
|
2005
|
+
},
|
|
2006
|
+
|
|
2007
|
+
fromPartial<I extends Exact<DeepPartial<UnixTimestamp>, I>>(object: I): UnixTimestamp {
|
|
2008
|
+
const message = createBaseUnixTimestamp();
|
|
2009
|
+
message.timestamp = object.timestamp ?? 0;
|
|
2010
|
+
return message;
|
|
2011
|
+
},
|
|
2012
|
+
};
|
|
2013
|
+
|
|
2014
|
+
function createBaseBlockHeight(): BlockHeight {
|
|
2015
|
+
return { blockHeight: 0 };
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
export const BlockHeight = {
|
|
2019
|
+
encode(message: BlockHeight, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
2020
|
+
if (message.blockHeight !== 0) {
|
|
2021
|
+
writer.uint32(8).uint64(message.blockHeight);
|
|
2022
|
+
}
|
|
2023
|
+
return writer;
|
|
2024
|
+
},
|
|
2025
|
+
|
|
2026
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): BlockHeight {
|
|
2027
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
2028
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2029
|
+
const message = createBaseBlockHeight();
|
|
2030
|
+
while (reader.pos < end) {
|
|
2031
|
+
const tag = reader.uint32();
|
|
2032
|
+
switch (tag >>> 3) {
|
|
2033
|
+
case 1:
|
|
2034
|
+
if (tag !== 8) {
|
|
2035
|
+
break;
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
message.blockHeight = longToNumber(reader.uint64() as Long);
|
|
2039
|
+
continue;
|
|
2040
|
+
}
|
|
2041
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
2042
|
+
break;
|
|
2043
|
+
}
|
|
2044
|
+
reader.skipType(tag & 7);
|
|
2045
|
+
}
|
|
2046
|
+
return message;
|
|
2047
|
+
},
|
|
2048
|
+
|
|
2049
|
+
fromJSON(object: any): BlockHeight {
|
|
2050
|
+
return { blockHeight: isSet(object.blockHeight) ? Number(object.blockHeight) : 0 };
|
|
2051
|
+
},
|
|
2052
|
+
|
|
2053
|
+
toJSON(message: BlockHeight): unknown {
|
|
2054
|
+
const obj: any = {};
|
|
2055
|
+
message.blockHeight !== undefined && (obj.blockHeight = Math.round(message.blockHeight));
|
|
2056
|
+
return obj;
|
|
2057
|
+
},
|
|
2058
|
+
|
|
2059
|
+
create<I extends Exact<DeepPartial<BlockHeight>, I>>(base?: I): BlockHeight {
|
|
2060
|
+
return BlockHeight.fromPartial(base ?? {});
|
|
2061
|
+
},
|
|
2062
|
+
|
|
2063
|
+
fromPartial<I extends Exact<DeepPartial<BlockHeight>, I>>(object: I): BlockHeight {
|
|
2064
|
+
const message = createBaseBlockHeight();
|
|
2065
|
+
message.blockHeight = object.blockHeight ?? 0;
|
|
2066
|
+
return message;
|
|
2067
|
+
},
|
|
2068
|
+
};
|
|
2069
|
+
|
|
2070
|
+
declare var self: any | undefined;
|
|
2071
|
+
declare var window: any | undefined;
|
|
2072
|
+
declare var global: any | undefined;
|
|
2073
|
+
var tsProtoGlobalThis: any = (() => {
|
|
2074
|
+
if (typeof globalThis !== "undefined") {
|
|
2075
|
+
return globalThis;
|
|
2076
|
+
}
|
|
2077
|
+
if (typeof self !== "undefined") {
|
|
2078
|
+
return self;
|
|
2079
|
+
}
|
|
2080
|
+
if (typeof window !== "undefined") {
|
|
2081
|
+
return window;
|
|
2082
|
+
}
|
|
2083
|
+
if (typeof global !== "undefined") {
|
|
2084
|
+
return global;
|
|
2085
|
+
}
|
|
2086
|
+
throw "Unable to locate global object";
|
|
2087
|
+
})();
|
|
2088
|
+
|
|
2089
|
+
function bytesFromBase64(b64: string): Uint8Array {
|
|
2090
|
+
if (tsProtoGlobalThis.Buffer) {
|
|
2091
|
+
return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64"));
|
|
2092
|
+
} else {
|
|
2093
|
+
const bin = tsProtoGlobalThis.atob(b64);
|
|
2094
|
+
const arr = new Uint8Array(bin.length);
|
|
2095
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
2096
|
+
arr[i] = bin.charCodeAt(i);
|
|
2097
|
+
}
|
|
2098
|
+
return arr;
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
function base64FromBytes(arr: Uint8Array): string {
|
|
2103
|
+
if (tsProtoGlobalThis.Buffer) {
|
|
2104
|
+
return tsProtoGlobalThis.Buffer.from(arr).toString("base64");
|
|
2105
|
+
} else {
|
|
2106
|
+
const bin: string[] = [];
|
|
2107
|
+
arr.forEach((byte) => {
|
|
2108
|
+
bin.push(String.fromCharCode(byte));
|
|
2109
|
+
});
|
|
2110
|
+
return tsProtoGlobalThis.btoa(bin.join(""));
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
|
|
2114
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
2115
|
+
|
|
2116
|
+
export type DeepPartial<T> = T extends Builtin ? T
|
|
2117
|
+
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
2118
|
+
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
2119
|
+
: Partial<T>;
|
|
2120
|
+
|
|
2121
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
2122
|
+
export type Exact<P, I extends P> = P extends Builtin ? P
|
|
2123
|
+
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
|
2124
|
+
|
|
2125
|
+
function longToNumber(long: Long): number {
|
|
2126
|
+
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
|
2127
|
+
throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
2128
|
+
}
|
|
2129
|
+
return long.toNumber();
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
// If you get a compile-error about 'Constructor<Long> and ... have no overlap',
|
|
2133
|
+
// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'.
|
|
2134
|
+
if (_m0.util.Long !== Long) {
|
|
2135
|
+
_m0.util.Long = Long as any;
|
|
2136
|
+
_m0.configure();
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
function isSet(value: any): boolean {
|
|
2140
|
+
return value !== null && value !== undefined;
|
|
2141
|
+
}
|