-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
674 lines (580 loc) · 16.4 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
package parsiq_solana_hclient
type SolanaRpcRequest struct {
Version string `json:"jsonrpc"`
Id uint64 `json:"id"`
Method string `json:"method"`
Params []interface{} `json:"params"`
}
type SolanaBaseRpcResponse struct {
Error struct {
Code int `json:"code"`
Message string `json:"message"`
} `json:"error"`
Id int `json:"id"`
}
type RequestAirdropResp struct {
SolanaBaseRpcResponse
Result string `json:"result"`
}
type GetConfirmedBlocksResp struct {
SolanaBaseRpcResponse
Result []uint64 `json:"result"`
}
type GetSnapshotSlotResp struct {
SolanaBaseRpcResponse
Result uint64 `json:"result"`
}
type GetConfirmedBlockResp struct {
SolanaBaseRpcResponse
Result *SolanaBlock `json:"result"`
}
type GetTokenLargestAccountsResp struct {
SolanaBaseRpcResponse
Result *TokenLargestAccount `json:"result"`
}
type GetTokenSupplyResp struct {
SolanaBaseRpcResponse
Result *TokenAccountBalance `json:"result"`
}
type GetSignatureStatusesResp struct {
SolanaBaseRpcResponse
Result *SignatureStatuses `json:"result"`
}
type GetConfirmedTransactionResp struct {
SolanaBaseRpcResponse
Result *ConfirmedTransaction `json:"result"`
}
type GetLeaderScheduleResp struct {
SolanaBaseRpcResponse
Result interface{} `json:"result"`
}
type GetIdentityResp struct {
SolanaBaseRpcResponse
Result struct {
Identity string `json:"identity"`
} `json:"result"`
}
type GetConfirmedBlocksWithLimitResp struct {
SolanaBaseRpcResponse
Result []uint64 `json:"result"`
}
type GetFirstAvailableBlockResp struct {
SolanaBaseRpcResponse
Result uint64 `json:"result"`
}
type GetEpochInfoResp struct {
SolanaBaseRpcResponse
Result *EpochInfo `json:"result"`
}
type GetAccountInfoResp struct {
SolanaBaseRpcResponse
Result *AccountInfo `json:"result"`
}
type GetEpochScheduleResp struct {
SolanaBaseRpcResponse
Result *EpochSchedule `json:"result"`
}
type GetFeeCalculatorForBlockhashResp struct {
Result interface{} `json:"result"`
}
type MinimumLedgerSlotResp struct {
SolanaBaseRpcResponse
Result uint64 `json:"result"`
}
type GetGenesisHashResp struct {
SolanaBaseRpcResponse
Result string `json:"result"`
}
type GetBalanceResp struct {
SolanaBaseRpcResponse
Result *Balance `json:"result"`
}
type GetVersionResp struct {
SolanaBaseRpcResponse
Result *SolanaVersion `json:"result"`
}
type GetRecentPerformanceSamplesResp struct {
SolanaBaseRpcResponse
Result []RpcPerfSample `json:"result"`
}
type GetMultipleAccountsResp struct {
SolanaBaseRpcResponse
Result *MultipleAccounts `json:"result"`
}
type GetMinimumBalanceForRentExemptionResp struct {
SolanaBaseRpcResponse
Result *uint64 `json:"result"`
}
type GetInflationGovernorResp struct {
SolanaBaseRpcResponse
Result *InflationGovernor `json:"result"`
}
type GetClusterNodesResp struct {
SolanaBaseRpcResponse
Result []*ClusterNodes `json:"result"`
}
type GetInflationRateResp struct {
SolanaBaseRpcResponse
Result *InflationRate `json:"result"`
}
type GetLargestAccountsResp struct {
SolanaBaseRpcResponse
Result *LargestAccounts `json:"result"`
}
type GetFeesResp struct {
SolanaBaseRpcResponse
Result *Fees `json:"result"`
}
type GetMaxRetransmitSlotResp struct {
SolanaBaseRpcResponse
Result uint64 `json:"result"`
}
type GetMaxShredInsertSlotResp struct {
SolanaBaseRpcResponse
Result uint64 `json:"result"`
}
type GetHealhtResp struct {
SolanaBaseRpcResponse
Result interface{} `json:"result"`
}
type SendTransactionResp struct {
SolanaBaseRpcResponse
Result string `json:"result"`
}
type SimulateTransactionResp struct {
SolanaBaseRpcResponse
Result *SimulateTransaction `json:"result"`
}
type GetTokenAccountBalanceResp struct {
SolanaBaseRpcResponse
Result *TokenAccountBalance `json:"result"`
}
type GetTokenAccountsResp struct {
SolanaBaseRpcResponse
Result *TokenAccounts `json:"result"`
}
type GetConfirmedSignaturesForAddressResp struct {
SolanaBaseRpcResponse
Result *[]ConfirmedSignaturesForAddress `json:"result"`
}
type GetBlockTimeResp struct {
SolanaBaseRpcResponse
Result int64 `json:"result"`
}
type GetStakeActivationResp struct {
SolanaBaseRpcResponse
Result *StakeActivation `json:"result"`
}
type GetSlotResp struct {
SolanaBaseRpcResponse
Result uint64 `json:"result"`
}
type GetSlotLeaderResp struct {
SolanaBaseRpcResponse
Result string `json:"result"`
}
type GetVoteAccountsResp struct {
SolanaBaseRpcResponse
Result *VoteAccounts `json:"result"`
}
type GetFeeRateGovernorResp struct {
SolanaBaseRpcResponse
Result *FeeRateGovernor `json:"result"`
}
type GetSupplyResp struct {
SolanaBaseRpcResponse
Result *Supply `json:"result"`
}
type GetProgramAccountsResp struct {
SolanaBaseRpcResponse
Result []*ProgramAccounts `json:"result"`
}
type GetRecentBlockHashResp struct {
SolanaRpcClient
Result *RecentBlockHash `json:"result"`
}
type GetBlockCommitmentResp struct {
SolanaBaseRpcResponse
Result *BlockCommitment `json:"result"`
}
type GetTransactionCountResp struct {
SolanaBaseRpcResponse
Result uint64 `json:"result"`
}
type BlockCommitment struct {
Commitment []uint64 `json:"commitment"`
TotalStake uint64 `json:"totalStake"`
}
type StakeActivation struct {
State string `json:"state"`
Active uint64 `json:"active"`
Inactive uint64 `json:"inactive"`
}
type ConfirmedSignaturesForAddress struct {
Signature string `json:"signature"`
Slot uint64 `json:"slot"`
Err interface{} `json:"err"`
Memo string `json:"memo"`
}
type ConfirmedSignaturesParams struct {
Limit uint16 `json:"limit"` //1-1000, default 1000
Before string `json:"before"`
Until string `json:"until"`
}
type Limit struct {
Limit uint16 `json:"limit"`
}
type Before struct {
Before string `json:"before"`
}
type Until struct {
Until string `json:"until"`
}
type SearchTransactionHistory struct {
SearchTransactionHistory bool `json:"searchTransactionHistory"`
}
type RpcPerfSample struct {
Slot uint64 `json:"slot"`
NumTransactions uint64 `json:"numTransactions"`
NumSlots uint64 `json:"numSlots"`
SamplePeriodSpecs uint16 `json:"samplePeriodSpecs"`
}
type InflationGovernor struct {
Initial float64 `json:"initial"`
Terminal float64 `json:"terminal"`
Taper float64 `json:"taper"`
Foundation float64 `json:"foundation"`
FoundationTerm float64 `json:"foundationTerm"`
}
type InflationRate struct {
Total float64 `json:"total"`
Validator float64 `json:"validator"`
Foundation float64 `json:"foundation"`
Epoch float64 `json:"epoch"`
}
//NOT USING DEPRECATED FIELDS
type SignatureStatuses struct {
Context struct {
Slot uint64 `json:"slot"`
} `json:"context"`
Value []struct {
Slot uint64 `json:"slot"`
Confirmations uint `json:"confirmations"`
Err interface{} `json:"err"`
ConfirmationStatus string `json:"confirmationStatus"`
} `json:"value"`
}
type EpochSchedule struct {
SlotsPerEpoch uint64 `json:"slotsPerEpoch"`
LeaderScheduleSlotOffset uint64 `json:"leaderScheduleSlotOffset"`
Warmup bool `json:"warmup"`
FirstNormalEpoch uint64 `json:"firstNormalEpoch"`
FirstNormalSlot uint64 `json:"firstNormalSlot"`
}
type SolanaVersion struct {
SolanaCore string `json:"solana-core"`
FeatureSet uint64 `json:"feature-set"`
}
type VoteAccounts struct {
Current []VoteAccount `json:"current"`
Delinquent []VoteAccount `json:"delinquent"`
}
type VoteAccount struct {
VotePubkey string `json:"votePubkey"`
NodePubkey string `json:"nodePubkey"`
ActivatedStake uint64 `json:"activatedStake"`
EpochVoteAccount bool `json:"epochVoteAccount"`
Commission uint8 `json:"commission"`
LastVote uint64 `json:"lastVote"`
EpochCredits [][]uint64 `json:"epochCredits"`
}
type ConfirmedTransaction struct {
Slot uint64 `json:"slot"`
Transaction interface{} `json:"transaction"`
BlockTime int64 `json:"blockTime"`
Meta struct {
Err interface{} `json:"err"`
Fee uint64 `json:"fee"`
PreBalances []uint64 `json:"preBalances"`
PostBalances []uint64 `json:"postBalances"`
InnerInstructions interface{} `json:"innerInstructions"`
PreTokenBalances interface{} `json:"preTokenBalances"`
PostTokenBalances interface{} `json:"postTokenBalances"`
LogMessages []string `json:"logMessages"`
} `json:"meta"`
}
type StakeActivationParam struct {
Commitment string `json:"commitment"`
Epoch uint64 `json:"epoch"`
}
type FeeRateGovernor struct {
Context struct {
Slot uint64 `json:"slot"`
} `json:"context"`
Value struct {
FeeRateGovernor struct {
BurnPercent uint8 `json:"burnPercent"`
MaxLamportsPerSignature uint64 `json:"maxLamportsPerSignature"`
MinLamportsPerSignature uint64 `json:"minLamportsPerSignature"`
TargetLamportsPerSignature uint64 `json:"targetLamportsPerSignature"`
TargetSignaturesPerSlot uint64 `json:"targetSignaturesPerSlot"`
} `json:"feeRateGovernor"`
}
}
type Supply struct {
Context struct {
Slot uint64 `json:"slot"`
} `json:"context"`
Value struct {
Total uint64 `json:"total"`
Circulating uint64 `json:"circulating"`
NonCirculating uint64 `json:"nonCirculating"`
NonCirculatingAccounts []string `json:"nonCirculatingAccounts"`
}
}
type SimulateTransaction struct {
Context struct {
Slot uint64 `json:"slot"`
} `json:"context"`
Value struct {
Err interface{} `json:"err"`
Logs []string `json:"logs"`
} `json:"value"`
}
type LeadersSchedule struct {
Slot uint64
Commitment string
}
type TokenAccountBalance struct {
Context struct {
Slot uint64 `json:"slot"`
} `json:"context"`
Value struct {
UiAmount float64 `json:"uiAmount"`
Amount string `json:"amount"`
Decimals uint8 `json:"decimals"`
} `json:"value"`
}
type TokenLargestAccount struct {
Context struct {
Slot uint64 `json:"slot"`
} `json:"context"`
Value []struct {
Address string `json:"address"`
UiAmount float64 `json:"uiAmount"`
Amount string `json:"amount"`
Decimals uint8 `json:"decimals"`
} `json:"value"`
}
type Mint struct {
Mint string `json:"mint"`
}
type ProgramID struct {
ProgramID string `json:"programId"`
}
type TokenAccounts struct {
Context struct {
Slot uint64 `json:"slot"`
} `json:"context"`
Value []struct {
PubKey string `json:"pubKey"`
Account struct {
Lamports uint64 `json:"lamports"`
Owner string `json:"owner"`
Data interface{} `json:"data"`
Executable bool `json:"executable"`
RentEpoch uint64 `json:"rentEpoch"`
} `json:"account"`
} `json:"value"`
}
type Fees struct {
Context struct {
Slot uint64 `json:"slot"`
} `json:"context"`
Value struct {
Blockhash string `json:"blockhash"`
FeeCalculator struct {
LamportsPerSignature uint64 `json:"lamportsPerSignature"`
} `json:"feeCalculator"`
LastValidSlot uint64 `json:"lastValidSlot"`
}
}
type Balance struct {
Context struct {
Slot uint64 `json:"slot"`
} `json:"context"`
Value uint64 `json:"value"`
}
type ProgramAccounts struct {
PubKey string `json:"pubKey"`
Account struct {
Lamports uint64 `json:"lamports"`
Owner string `json:"owner"`
Executable bool `json:"executable"`
RentEpoch uint64 `json:"rentEpoch"`
} `json:"account"`
}
type RecentBlockHash struct {
Context struct {
Slot uint64 `json:"slot"`
} `json:"context"`
Value struct {
RpcResponse interface{} `json:"RpcResponse"`
BlockHash string `json:"blockhash"`
FeeCalculator interface{} `json:"feeCalculator"`
} `json:"value"`
}
type LargestAccounts struct {
Context struct {
Slot uint64 `json:"slot"`
} `json:"context"`
Value []struct {
Lamports uint64 `json:"lamports"`
Address string `json:"address"`
} `json:"value"`
}
type LargestAccountsParams struct {
Commitment string `json:"commitment"`
Filter string `json:"filter"`
}
type AccountInfoParams struct {
Commitment string `json:"commitment"`
Encoding string `json:"encoding"`
DataSlice struct {
Offset uint `json:"offset"`
Length uint `json:"length"`
} `json:"dataSlice"`
}
type ProgramAccountParams struct {
Commitment string `json:"commitment"`
Encoding string `json:"encoding"`
DataSlice struct {
Offset uint `json:"offset"`
Length uint `json:"length"`
} `json:"dataSlice"`
Filters []interface{} `json:"filters"`
}
//We can't pass dataSize within Filter since it MUST have other position within the array in ProgramAccountParams
type DataSize struct {
DataSize uint64 `json:"dataSize"`
}
type Filter struct {
Memcmp struct {
Offset uint64 `json:"offset"`
Bytes string `json:"bytes"`
} `json:"memcmp"`
}
type ClusterNodes struct {
Gossip string `json:"gossip"`
Pubkey string `json:"pubkey"`
Rpc string `json:"rpc"`
Tpu string `json:"tpu"`
Version string `json:"version"`
}
//https://docs.solana.com/developing/clients/jsonrpc-api#configuring-state-commitment
type Commitment struct {
Commitment string `json:"commitment"`
}
type SimulateTransactionParam struct {
SigVerify bool `json:"sigVerify"`
Commitment string `json:"commitment"`
Encoding string `json:"encoding"`
}
type SendTransactionParams struct {
SkipPreflight bool `json:"skipPreflight"`
PreflightCommitment string `json:"preflightCommitment"`
Encoding string `json:"encoding"`
}
type AccountInfo struct {
Context struct {
Slot uint64 `json:"slot"`
} `json:"context"`
Value struct {
Data interface{} `json:"data"`
Executable bool `json:"executable"`
Lamports uint64 `json:"lamports"`
Owner string `json:"owner"`
RentEpoch uint64 `json:"rentEpoch"`
} `json:"value"`
}
type MultipleAccounts struct {
Context struct {
Slot uint64 `json:"slot"`
} `json:"context"`
Value []struct {
Data interface{} `json:"data"`
Executable bool `json:"executable"`
Lamports uint64 `json:"lamports"`
Owner string `json:"owner"`
RentEpoch uint64 `json:"rentEpoch"`
} `json:"value"`
}
type EpochInfo struct {
AbsoluteSlot uint64 `json:"absoluteSlot"`
BlockHeight uint64 `json:"blockHeight"`
Epoch uint64 `json:"epoch"`
SlotIndex uint64 `json:"slotIndex"`
SlotsInEpoch uint64 `json:"slotsInEpoch"`
}
type SolanaBlock struct {
SlotNumber uint64 `json:"slotNumber"`
BlockTime uint64 `json:"blockTime"`
Blockhash string `json:"blockhash"`
ParentSlot uint64 `json:"parentSlot"`
PreviousBlockhash string `json:"previousBlockhash"`
Rewards []struct {
Lamports uint64 `json:"lamports"`
PostBalance uint64 `json:"postBalance"`
Pubkey string `json:"pubkey"`
RewardType string `json:"rewardType"`
} `json:"rewards"`
Transactions []*SolanaTransaction `json:"transactions"`
}
type SolanaTransaction struct {
Meta struct {
Err interface{} `json:"err"`
Fee uint64 `json:"fee"`
InnerInstructions []interface{} `json:"innerInstructions"`
LogMessages []string `json:"logMessages"`
PreBalances []uint64 `json:"preBalances"`
PostBalances []uint64 `json:"postBalances"`
PreTokenBalances []*struct {
AccountIndex uint16 `json:"accountIndex"`
Mint string `json:"mint"`
UiTokenAmount struct {
Amount string `json:"amount"`
Decimals uint8 `json:"decimals"`
UiAmount float64 `json:"uiAmount"`
} `json:"uiTokenAmount"`
} `json:"preTokenBalances"`
PostTokenBalances []*struct {
AccountIndex uint16 `json:"accountIndex"`
Mint string `json:"mint"`
UiTokenAmount struct {
Amount string `json:"amount"`
Decimals uint8 `json:"decimals"`
UiAmount float64 `json:"uiAmount"`
} `json:"uiTokenAmount"`
} `json:"postTokenBalances"`
Status struct {
Ok interface{} `json:"Ok"`
} `json:"status"`
} `json:"meta"`
Transaction struct {
Message struct {
AccountKeys []string `json:"accountKeys"`
Header struct {
NumReadonlySignedAccounts uint16 `json:"numReadonlySignedAccounts"`
NumReadonlyUnsignedAccounts uint16 `json:"numReadonlyUnsignedAccounts"`
NumRequiredSignatures uint16 `json:"numRequiredSignatures"`
} `json:"header"`
Instructions []struct {
Accounts []uint16 `json:"accounts"`
Data string `json:"data"`
ProgramIDIndex uint16 `json:"programIdIndex"`
} `json:"instructions"`
RecentBlockhash string `json:"recentBlockhash"`
} `json:"message"`
Signatures []string `json:"signatures"`
} `json:"transaction"`
}