forked from tonkeeper/tonapi-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
oas_client_gen.go
10319 lines (9257 loc) · 289 KB
/
oas_client_gen.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
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by ogen, DO NOT EDIT.
package tonapi
import (
"context"
"net/url"
"strings"
"time"
"github.com/go-faster/errors"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/metric"
semconv "go.opentelemetry.io/otel/semconv/v1.19.0"
"go.opentelemetry.io/otel/trace"
"github.com/ogen-go/ogen/conv"
ht "github.com/ogen-go/ogen/http"
"github.com/ogen-go/ogen/otelogen"
"github.com/ogen-go/ogen/uri"
)
// Invoker invokes operations described by OpenAPI v3 specification.
type Invoker interface {
// AccountDnsBackResolve invokes accountDnsBackResolve operation.
//
// Get account's domains.
//
// GET /v2/accounts/{account_id}/dns/backresolve
AccountDnsBackResolve(ctx context.Context, params AccountDnsBackResolveParams) (*DomainNames, error)
// AddressParse invokes addressParse operation.
//
// Parse address and display in all formats.
//
// GET /v2/address/{account_id}/parse
AddressParse(ctx context.Context, params AddressParseParams) (*AddressParseOK, error)
// BlockchainAccountInspect invokes blockchainAccountInspect operation.
//
// Blockchain account inspect.
//
// GET /v2/blockchain/accounts/{account_id}/inspect
BlockchainAccountInspect(ctx context.Context, params BlockchainAccountInspectParams) (*BlockchainAccountInspect, error)
// DecodeMessage invokes decodeMessage operation.
//
// Decode a given message. Only external incoming messages can be decoded currently.
//
// POST /v2/message/decode
DecodeMessage(ctx context.Context, request *DecodeMessageReq) (*DecodedMessage, error)
// DnsResolve invokes dnsResolve operation.
//
// DNS resolve for domain name.
//
// GET /v2/dns/{domain_name}/resolve
DnsResolve(ctx context.Context, params DnsResolveParams) (*DnsRecord, error)
// EmulateMessageToAccountEvent invokes emulateMessageToAccountEvent operation.
//
// Emulate sending message to blockchain.
//
// POST /v2/accounts/{account_id}/events/emulate
EmulateMessageToAccountEvent(ctx context.Context, request *EmulateMessageToAccountEventReq, params EmulateMessageToAccountEventParams) (*AccountEvent, error)
// EmulateMessageToEvent invokes emulateMessageToEvent operation.
//
// Emulate sending message to blockchain.
//
// POST /v2/events/emulate
EmulateMessageToEvent(ctx context.Context, request *EmulateMessageToEventReq, params EmulateMessageToEventParams) (*Event, error)
// EmulateMessageToTrace invokes emulateMessageToTrace operation.
//
// Emulate sending message to blockchain.
//
// POST /v2/traces/emulate
EmulateMessageToTrace(ctx context.Context, request *EmulateMessageToTraceReq, params EmulateMessageToTraceParams) (*Trace, error)
// EmulateMessageToWallet invokes emulateMessageToWallet operation.
//
// Emulate sending message to blockchain.
//
// POST /v2/wallet/emulate
EmulateMessageToWallet(ctx context.Context, request *EmulateMessageToWalletReq, params EmulateMessageToWalletParams) (*MessageConsequences, error)
// ExecGetMethodForBlockchainAccount invokes execGetMethodForBlockchainAccount operation.
//
// Execute get method for account.
//
// GET /v2/blockchain/accounts/{account_id}/methods/{method_name}
ExecGetMethodForBlockchainAccount(ctx context.Context, params ExecGetMethodForBlockchainAccountParams) (*MethodExecutionResult, error)
// GetAccount invokes getAccount operation.
//
// Get human-friendly information about an account without low-level details.
//
// GET /v2/accounts/{account_id}
GetAccount(ctx context.Context, params GetAccountParams) (*Account, error)
// GetAccountDiff invokes getAccountDiff operation.
//
// Get account's balance change.
//
// GET /v2/accounts/{account_id}/diff
GetAccountDiff(ctx context.Context, params GetAccountDiffParams) (*GetAccountDiffOK, error)
// GetAccountDnsExpiring invokes getAccountDnsExpiring operation.
//
// Get expiring account .ton dns.
//
// GET /v2/accounts/{account_id}/dns/expiring
GetAccountDnsExpiring(ctx context.Context, params GetAccountDnsExpiringParams) (*DnsExpiring, error)
// GetAccountEvent invokes getAccountEvent operation.
//
// Get event for an account by event_id.
//
// GET /v2/accounts/{account_id}/events/{event_id}
GetAccountEvent(ctx context.Context, params GetAccountEventParams) (*AccountEvent, error)
// GetAccountEvents invokes getAccountEvents operation.
//
// Get events for an account. Each event is built on top of a trace which is a series of transactions
// caused by one inbound message. TonAPI looks for known patterns inside the trace and splits the
// trace into actions, where a single action represents a meaningful high-level operation like a
// Jetton Transfer or an NFT Purchase. Actions are expected to be shown to users. It is advised not
// to build any logic on top of actions because actions can be changed at any time.
//
// GET /v2/accounts/{account_id}/events
GetAccountEvents(ctx context.Context, params GetAccountEventsParams) (*AccountEvents, error)
// GetAccountInfoByStateInit invokes getAccountInfoByStateInit operation.
//
// Get account info by state init.
//
// POST /v2/tonconnect/stateinit
GetAccountInfoByStateInit(ctx context.Context, request *GetAccountInfoByStateInitReq) (*AccountInfoByStateInit, error)
// GetAccountInscriptions invokes getAccountInscriptions operation.
//
// Get all inscriptions by owner address. It's experimental API and can be dropped in the future.
//
// GET /v2/experimental/accounts/{account_id}/inscriptions
GetAccountInscriptions(ctx context.Context, params GetAccountInscriptionsParams) (*InscriptionBalances, error)
// GetAccountInscriptionsHistory invokes getAccountInscriptionsHistory operation.
//
// Get the transfer inscriptions history for account. It's experimental API and can be dropped in the
// future.
//
// GET /v2/experimental/accounts/{account_id}/inscriptions/history
GetAccountInscriptionsHistory(ctx context.Context, params GetAccountInscriptionsHistoryParams) (*AccountEvents, error)
// GetAccountInscriptionsHistoryByTicker invokes getAccountInscriptionsHistoryByTicker operation.
//
// Get the transfer inscriptions history for account. It's experimental API and can be dropped in the
// future.
//
// GET /v2/experimental/accounts/{account_id}/inscriptions/{ticker}/history
GetAccountInscriptionsHistoryByTicker(ctx context.Context, params GetAccountInscriptionsHistoryByTickerParams) (*AccountEvents, error)
// GetAccountJettonHistoryByID invokes getAccountJettonHistoryByID operation.
//
// Get the transfer jetton history for account and jetton.
//
// GET /v2/accounts/{account_id}/jettons/{jetton_id}/history
GetAccountJettonHistoryByID(ctx context.Context, params GetAccountJettonHistoryByIDParams) (*AccountEvents, error)
// GetAccountJettonsBalances invokes getAccountJettonsBalances operation.
//
// Get all Jettons balances by owner address.
//
// GET /v2/accounts/{account_id}/jettons
GetAccountJettonsBalances(ctx context.Context, params GetAccountJettonsBalancesParams) (*JettonsBalances, error)
// GetAccountJettonsHistory invokes getAccountJettonsHistory operation.
//
// Get the transfer jettons history for account.
//
// GET /v2/accounts/{account_id}/jettons/history
GetAccountJettonsHistory(ctx context.Context, params GetAccountJettonsHistoryParams) (*AccountEvents, error)
// GetAccountNftHistory invokes getAccountNftHistory operation.
//
// Get the transfer nft history.
//
// GET /v2/accounts/{account_id}/nfts/history
GetAccountNftHistory(ctx context.Context, params GetAccountNftHistoryParams) (*AccountEvents, error)
// GetAccountNftItems invokes getAccountNftItems operation.
//
// Get all NFT items by owner address.
//
// GET /v2/accounts/{account_id}/nfts
GetAccountNftItems(ctx context.Context, params GetAccountNftItemsParams) (*NftItems, error)
// GetAccountNominatorsPools invokes getAccountNominatorsPools operation.
//
// All pools where account participates.
//
// GET /v2/staking/nominator/{account_id}/pools
GetAccountNominatorsPools(ctx context.Context, params GetAccountNominatorsPoolsParams) (*AccountStaking, error)
// GetAccountPublicKey invokes getAccountPublicKey operation.
//
// Get public key by account id.
//
// GET /v2/accounts/{account_id}/publickey
GetAccountPublicKey(ctx context.Context, params GetAccountPublicKeyParams) (*GetAccountPublicKeyOK, error)
// GetAccountSeqno invokes getAccountSeqno operation.
//
// Get account seqno.
//
// GET /v2/wallet/{account_id}/seqno
GetAccountSeqno(ctx context.Context, params GetAccountSeqnoParams) (*Seqno, error)
// GetAccountSubscriptions invokes getAccountSubscriptions operation.
//
// Get all subscriptions by wallet address.
//
// GET /v2/accounts/{account_id}/subscriptions
GetAccountSubscriptions(ctx context.Context, params GetAccountSubscriptionsParams) (*Subscriptions, error)
// GetAccountTraces invokes getAccountTraces operation.
//
// Get traces for account.
//
// GET /v2/accounts/{account_id}/traces
GetAccountTraces(ctx context.Context, params GetAccountTracesParams) (*TraceIDs, error)
// GetAccounts invokes getAccounts operation.
//
// Get human-friendly information about several accounts without low-level details.
//
// POST /v2/accounts/_bulk
GetAccounts(ctx context.Context, request OptGetAccountsReq) (*Accounts, error)
// GetAllAuctions invokes getAllAuctions operation.
//
// Get all auctions.
//
// GET /v2/dns/auctions
GetAllAuctions(ctx context.Context, params GetAllAuctionsParams) (*Auctions, error)
// GetAllRawShardsInfo invokes getAllRawShardsInfo operation.
//
// Get all raw shards info.
//
// GET /v2/liteserver/get_all_shards_info/{block_id}
GetAllRawShardsInfo(ctx context.Context, params GetAllRawShardsInfoParams) (*GetAllRawShardsInfoOK, error)
// GetBlockchainAccountTransactions invokes getBlockchainAccountTransactions operation.
//
// Get account transactions.
//
// GET /v2/blockchain/accounts/{account_id}/transactions
GetBlockchainAccountTransactions(ctx context.Context, params GetBlockchainAccountTransactionsParams) (*Transactions, error)
// GetBlockchainBlock invokes getBlockchainBlock operation.
//
// Get blockchain block data.
//
// GET /v2/blockchain/blocks/{block_id}
GetBlockchainBlock(ctx context.Context, params GetBlockchainBlockParams) (*BlockchainBlock, error)
// GetBlockchainBlockTransactions invokes getBlockchainBlockTransactions operation.
//
// Get transactions from block.
//
// GET /v2/blockchain/blocks/{block_id}/transactions
GetBlockchainBlockTransactions(ctx context.Context, params GetBlockchainBlockTransactionsParams) (*Transactions, error)
// GetBlockchainConfig invokes getBlockchainConfig operation.
//
// Get blockchain config.
//
// GET /v2/blockchain/config
GetBlockchainConfig(ctx context.Context) (*BlockchainConfig, error)
// GetBlockchainConfigFromBlock invokes getBlockchainConfigFromBlock operation.
//
// Get blockchain config from a specific block, if present.
//
// GET /v2/blockchain/masterchain/{masterchain_seqno}/config
GetBlockchainConfigFromBlock(ctx context.Context, params GetBlockchainConfigFromBlockParams) (*BlockchainConfig, error)
// GetBlockchainMasterchainBlocks invokes getBlockchainMasterchainBlocks operation.
//
// Get all blocks in all shards and workchains between target and previous masterchain block
// according to shards last blocks snapshot in masterchain. We don't recommend to build your app
// around this method because it has problem with scalability and will work very slow in the future.
//
// GET /v2/blockchain/masterchain/{masterchain_seqno}/blocks
GetBlockchainMasterchainBlocks(ctx context.Context, params GetBlockchainMasterchainBlocksParams) (*BlockchainBlocks, error)
// GetBlockchainMasterchainHead invokes getBlockchainMasterchainHead operation.
//
// Get last known masterchain block.
//
// GET /v2/blockchain/masterchain-head
GetBlockchainMasterchainHead(ctx context.Context) (*BlockchainBlock, error)
// GetBlockchainMasterchainShards invokes getBlockchainMasterchainShards operation.
//
// Get blockchain block shards.
//
// GET /v2/blockchain/masterchain/{masterchain_seqno}/shards
GetBlockchainMasterchainShards(ctx context.Context, params GetBlockchainMasterchainShardsParams) (*BlockchainBlockShards, error)
// GetBlockchainMasterchainTransactions invokes getBlockchainMasterchainTransactions operation.
//
// Get all transactions in all shards and workchains between target and previous masterchain block
// according to shards last blocks snapshot in masterchain. We don't recommend to build your app
// around this method because it has problem with scalability and will work very slow in the future.
//
// GET /v2/blockchain/masterchain/{masterchain_seqno}/transactions
GetBlockchainMasterchainTransactions(ctx context.Context, params GetBlockchainMasterchainTransactionsParams) (*Transactions, error)
// GetBlockchainRawAccount invokes getBlockchainRawAccount operation.
//
// Get low-level information about an account taken directly from the blockchain.
//
// GET /v2/blockchain/accounts/{account_id}
GetBlockchainRawAccount(ctx context.Context, params GetBlockchainRawAccountParams) (*BlockchainRawAccount, error)
// GetBlockchainTransaction invokes getBlockchainTransaction operation.
//
// Get transaction data.
//
// GET /v2/blockchain/transactions/{transaction_id}
GetBlockchainTransaction(ctx context.Context, params GetBlockchainTransactionParams) (*Transaction, error)
// GetBlockchainTransactionByMessageHash invokes getBlockchainTransactionByMessageHash operation.
//
// Get transaction data by message hash.
//
// GET /v2/blockchain/messages/{msg_id}/transaction
GetBlockchainTransactionByMessageHash(ctx context.Context, params GetBlockchainTransactionByMessageHashParams) (*Transaction, error)
// GetBlockchainValidators invokes getBlockchainValidators operation.
//
// Get blockchain validators.
//
// GET /v2/blockchain/validators
GetBlockchainValidators(ctx context.Context) (*Validators, error)
// GetChartRates invokes getChartRates operation.
//
// Get chart by token.
//
// GET /v2/rates/chart
GetChartRates(ctx context.Context, params GetChartRatesParams) (*GetChartRatesOK, error)
// GetDnsInfo invokes getDnsInfo operation.
//
// Get full information about domain name.
//
// GET /v2/dns/{domain_name}
GetDnsInfo(ctx context.Context, params GetDnsInfoParams) (*DomainInfo, error)
// GetDomainBids invokes getDomainBids operation.
//
// Get domain bids.
//
// GET /v2/dns/{domain_name}/bids
GetDomainBids(ctx context.Context, params GetDomainBidsParams) (*DomainBids, error)
// GetEvent invokes getEvent operation.
//
// Get an event either by event ID or a hash of any transaction in a trace. An event is built on top
// of a trace which is a series of transactions caused by one inbound message. TonAPI looks for known
// patterns inside the trace and splits the trace into actions, where a single action represents a
// meaningful high-level operation like a Jetton Transfer or an NFT Purchase. Actions are expected to
// be shown to users. It is advised not to build any logic on top of actions because actions can be
// changed at any time.
//
// GET /v2/events/{event_id}
GetEvent(ctx context.Context, params GetEventParams) (*Event, error)
// GetInscriptionOpTemplate invokes getInscriptionOpTemplate operation.
//
// Return comment for making operation with inscription. please don't use it if you don't know what
// you are doing.
//
// GET /v2/experimental/inscriptions/op-template
GetInscriptionOpTemplate(ctx context.Context, params GetInscriptionOpTemplateParams) (*GetInscriptionOpTemplateOK, error)
// GetItemsFromCollection invokes getItemsFromCollection operation.
//
// Get NFT items from collection by collection address.
//
// GET /v2/nfts/collections/{account_id}/items
GetItemsFromCollection(ctx context.Context, params GetItemsFromCollectionParams) (*NftItems, error)
// GetJettonHolders invokes getJettonHolders operation.
//
// Get jetton's holders.
//
// GET /v2/jettons/{account_id}/holders
GetJettonHolders(ctx context.Context, params GetJettonHoldersParams) (*JettonHolders, error)
// GetJettonInfo invokes getJettonInfo operation.
//
// Get jetton metadata by jetton master address.
//
// GET /v2/jettons/{account_id}
GetJettonInfo(ctx context.Context, params GetJettonInfoParams) (*JettonInfo, error)
// GetJettons invokes getJettons operation.
//
// Get a list of all indexed jetton masters in the blockchain.
//
// GET /v2/jettons
GetJettons(ctx context.Context, params GetJettonsParams) (*Jettons, error)
// GetJettonsEvents invokes getJettonsEvents operation.
//
// Get only jetton transfers in the event.
//
// GET /v2/events/{event_id}/jettons
GetJettonsEvents(ctx context.Context, params GetJettonsEventsParams) (*Event, error)
// GetNftCollection invokes getNftCollection operation.
//
// Get NFT collection by collection address.
//
// GET /v2/nfts/collections/{account_id}
GetNftCollection(ctx context.Context, params GetNftCollectionParams) (*NftCollection, error)
// GetNftCollections invokes getNftCollections operation.
//
// Get NFT collections.
//
// GET /v2/nfts/collections
GetNftCollections(ctx context.Context, params GetNftCollectionsParams) (*NftCollections, error)
// GetNftHistoryByID invokes getNftHistoryByID operation.
//
// Get the transfer nfts history for account.
//
// GET /v2/nfts/{account_id}/history
GetNftHistoryByID(ctx context.Context, params GetNftHistoryByIDParams) (*AccountEvents, error)
// GetNftItemByAddress invokes getNftItemByAddress operation.
//
// Get NFT item by its address.
//
// GET /v2/nfts/{account_id}
GetNftItemByAddress(ctx context.Context, params GetNftItemByAddressParams) (*NftItem, error)
// GetNftItemsByAddresses invokes getNftItemsByAddresses operation.
//
// Get NFT items by their addresses.
//
// POST /v2/nfts/_bulk
GetNftItemsByAddresses(ctx context.Context, request OptGetNftItemsByAddressesReq) (*NftItems, error)
// GetRates invokes getRates operation.
//
// Get the token price to the currency.
//
// GET /v2/rates
GetRates(ctx context.Context, params GetRatesParams) (*GetRatesOK, error)
// GetRawAccountState invokes getRawAccountState operation.
//
// Get raw account state.
//
// GET /v2/liteserver/get_account_state/{account_id}
GetRawAccountState(ctx context.Context, params GetRawAccountStateParams) (*GetRawAccountStateOK, error)
// GetRawBlockProof invokes getRawBlockProof operation.
//
// Get raw block proof.
//
// GET /v2/liteserver/get_block_proof
GetRawBlockProof(ctx context.Context, params GetRawBlockProofParams) (*GetRawBlockProofOK, error)
// GetRawBlockchainBlock invokes getRawBlockchainBlock operation.
//
// Get raw blockchain block.
//
// GET /v2/liteserver/get_block/{block_id}
GetRawBlockchainBlock(ctx context.Context, params GetRawBlockchainBlockParams) (*GetRawBlockchainBlockOK, error)
// GetRawBlockchainBlockHeader invokes getRawBlockchainBlockHeader operation.
//
// Get raw blockchain block header.
//
// GET /v2/liteserver/get_block_header/{block_id}
GetRawBlockchainBlockHeader(ctx context.Context, params GetRawBlockchainBlockHeaderParams) (*GetRawBlockchainBlockHeaderOK, error)
// GetRawBlockchainBlockState invokes getRawBlockchainBlockState operation.
//
// Get raw blockchain block state.
//
// GET /v2/liteserver/get_state/{block_id}
GetRawBlockchainBlockState(ctx context.Context, params GetRawBlockchainBlockStateParams) (*GetRawBlockchainBlockStateOK, error)
// GetRawBlockchainConfig invokes getRawBlockchainConfig operation.
//
// Get raw blockchain config.
//
// GET /v2/blockchain/config/raw
GetRawBlockchainConfig(ctx context.Context) (*RawBlockchainConfig, error)
// GetRawBlockchainConfigFromBlock invokes getRawBlockchainConfigFromBlock operation.
//
// Get raw blockchain config from a specific block, if present.
//
// GET /v2/blockchain/masterchain/{masterchain_seqno}/config/raw
GetRawBlockchainConfigFromBlock(ctx context.Context, params GetRawBlockchainConfigFromBlockParams) (*RawBlockchainConfig, error)
// GetRawConfig invokes getRawConfig operation.
//
// Get raw config.
//
// GET /v2/liteserver/get_config_all/{block_id}
GetRawConfig(ctx context.Context, params GetRawConfigParams) (*GetRawConfigOK, error)
// GetRawListBlockTransactions invokes getRawListBlockTransactions operation.
//
// Get raw list block transactions.
//
// GET /v2/liteserver/list_block_transactions/{block_id}
GetRawListBlockTransactions(ctx context.Context, params GetRawListBlockTransactionsParams) (*GetRawListBlockTransactionsOK, error)
// GetRawMasterchainInfo invokes getRawMasterchainInfo operation.
//
// Get raw masterchain info.
//
// GET /v2/liteserver/get_masterchain_info
GetRawMasterchainInfo(ctx context.Context) (*GetRawMasterchainInfoOK, error)
// GetRawMasterchainInfoExt invokes getRawMasterchainInfoExt operation.
//
// Get raw masterchain info ext.
//
// GET /v2/liteserver/get_masterchain_info_ext
GetRawMasterchainInfoExt(ctx context.Context, params GetRawMasterchainInfoExtParams) (*GetRawMasterchainInfoExtOK, error)
// GetRawShardBlockProof invokes getRawShardBlockProof operation.
//
// Get raw shard block proof.
//
// GET /v2/liteserver/get_shard_block_proof/{block_id}
GetRawShardBlockProof(ctx context.Context, params GetRawShardBlockProofParams) (*GetRawShardBlockProofOK, error)
// GetRawShardInfo invokes getRawShardInfo operation.
//
// Get raw shard info.
//
// GET /v2/liteserver/get_shard_info/{block_id}
GetRawShardInfo(ctx context.Context, params GetRawShardInfoParams) (*GetRawShardInfoOK, error)
// GetRawTime invokes getRawTime operation.
//
// Get raw time.
//
// GET /v2/liteserver/get_time
GetRawTime(ctx context.Context) (*GetRawTimeOK, error)
// GetRawTransactions invokes getRawTransactions operation.
//
// Get raw transactions.
//
// GET /v2/liteserver/get_transactions/{account_id}
GetRawTransactions(ctx context.Context, params GetRawTransactionsParams) (*GetRawTransactionsOK, error)
// GetStakingPoolHistory invokes getStakingPoolHistory operation.
//
// Pool history.
//
// GET /v2/staking/pool/{account_id}/history
GetStakingPoolHistory(ctx context.Context, params GetStakingPoolHistoryParams) (*GetStakingPoolHistoryOK, error)
// GetStakingPoolInfo invokes getStakingPoolInfo operation.
//
// Stacking pool info.
//
// GET /v2/staking/pool/{account_id}
GetStakingPoolInfo(ctx context.Context, params GetStakingPoolInfoParams) (*GetStakingPoolInfoOK, error)
// GetStakingPools invokes getStakingPools operation.
//
// All pools available in network.
//
// GET /v2/staking/pools
GetStakingPools(ctx context.Context, params GetStakingPoolsParams) (*GetStakingPoolsOK, error)
// GetStorageProviders invokes getStorageProviders operation.
//
// Get TON storage providers deployed to the blockchain.
//
// GET /v2/storage/providers
GetStorageProviders(ctx context.Context) (*GetStorageProvidersOK, error)
// GetTonConnectPayload invokes getTonConnectPayload operation.
//
// Get a payload for further token receipt.
//
// GET /v2/tonconnect/payload
GetTonConnectPayload(ctx context.Context) (*GetTonConnectPayloadOK, error)
// GetTrace invokes getTrace operation.
//
// Get the trace by trace ID or hash of any transaction in trace.
//
// GET /v2/traces/{trace_id}
GetTrace(ctx context.Context, params GetTraceParams) (*Trace, error)
// GetWalletBackup invokes getWalletBackup operation.
//
// Get backup info.
//
// GET /v2/wallet/backup
GetWalletBackup(ctx context.Context, params GetWalletBackupParams) (*GetWalletBackupOK, error)
// GetWalletsByPublicKey invokes getWalletsByPublicKey operation.
//
// Get wallets by public key.
//
// GET /v2/pubkeys/{public_key}/wallets
GetWalletsByPublicKey(ctx context.Context, params GetWalletsByPublicKeyParams) (*Accounts, error)
// ReduceIndexingLatency invokes reduceIndexingLatency operation.
//
// Reduce indexing latency.
//
// GET /v2/status
ReduceIndexingLatency(ctx context.Context) (*ServiceStatus, error)
// ReindexAccount invokes reindexAccount operation.
//
// Update internal cache for a particular account.
//
// POST /v2/accounts/{account_id}/reindex
ReindexAccount(ctx context.Context, params ReindexAccountParams) error
// SearchAccounts invokes searchAccounts operation.
//
// Search by account domain name.
//
// GET /v2/accounts/search
SearchAccounts(ctx context.Context, params SearchAccountsParams) (*FoundAccounts, error)
// SendBlockchainMessage invokes sendBlockchainMessage operation.
//
// Send message to blockchain.
//
// POST /v2/blockchain/message
SendBlockchainMessage(ctx context.Context, request *SendBlockchainMessageReq) error
// SendRawMessage invokes sendRawMessage operation.
//
// Send raw message to blockchain.
//
// POST /v2/liteserver/send_message
SendRawMessage(ctx context.Context, request *SendRawMessageReq) (*SendRawMessageOK, error)
// SetWalletBackup invokes setWalletBackup operation.
//
// Set backup info.
//
// PUT /v2/wallet/backup
SetWalletBackup(ctx context.Context, request SetWalletBackupReq, params SetWalletBackupParams) error
// TonConnectProof invokes tonConnectProof operation.
//
// Account verification and token issuance.
//
// POST /v2/wallet/auth/proof
TonConnectProof(ctx context.Context, request *TonConnectProofReq) (*TonConnectProofOK, error)
}
// Client implements OAS client.
type Client struct {
serverURL *url.URL
baseClient
}
func trimTrailingSlashes(u *url.URL) {
u.Path = strings.TrimRight(u.Path, "/")
u.RawPath = strings.TrimRight(u.RawPath, "/")
}
// NewClient initializes new Client defined by OAS.
func NewClient(serverURL string, opts ...ClientOption) (*Client, error) {
u, err := url.Parse(serverURL)
if err != nil {
return nil, err
}
trimTrailingSlashes(u)
c, err := newClientConfig(opts...).baseClient()
if err != nil {
return nil, err
}
return &Client{
serverURL: u,
baseClient: c,
}, nil
}
type serverURLKey struct{}
// WithServerURL sets context key to override server URL.
func WithServerURL(ctx context.Context, u *url.URL) context.Context {
return context.WithValue(ctx, serverURLKey{}, u)
}
func (c *Client) requestURL(ctx context.Context) *url.URL {
u, ok := ctx.Value(serverURLKey{}).(*url.URL)
if !ok {
return c.serverURL
}
return u
}
// AccountDnsBackResolve invokes accountDnsBackResolve operation.
//
// Get account's domains.
//
// GET /v2/accounts/{account_id}/dns/backresolve
func (c *Client) AccountDnsBackResolve(ctx context.Context, params AccountDnsBackResolveParams) (*DomainNames, error) {
res, err := c.sendAccountDnsBackResolve(ctx, params)
return res, err
}
func (c *Client) sendAccountDnsBackResolve(ctx context.Context, params AccountDnsBackResolveParams) (res *DomainNames, err error) {
otelAttrs := []attribute.KeyValue{
otelogen.OperationID("accountDnsBackResolve"),
semconv.HTTPMethodKey.String("GET"),
semconv.HTTPRouteKey.String("/v2/accounts/{account_id}/dns/backresolve"),
}
// Run stopwatch.
startTime := time.Now()
defer func() {
// Use floating point division here for higher precision (instead of Millisecond method).
elapsedDuration := time.Since(startTime)
c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...))
}()
// Increment request counter.
c.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...))
// Start a span for this request.
ctx, span := c.cfg.Tracer.Start(ctx, "AccountDnsBackResolve",
trace.WithAttributes(otelAttrs...),
clientSpanKind,
)
// Track stage for error reporting.
var stage string
defer func() {
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, stage)
c.errors.Add(ctx, 1, metric.WithAttributes(otelAttrs...))
}
span.End()
}()
stage = "BuildURL"
u := uri.Clone(c.requestURL(ctx))
var pathParts [3]string
pathParts[0] = "/v2/accounts/"
{
// Encode "account_id" parameter.
e := uri.NewPathEncoder(uri.PathEncoderConfig{
Param: "account_id",
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
return e.EncodeValue(conv.StringToString(params.AccountID))
}(); err != nil {
return res, errors.Wrap(err, "encode path")
}
encoded, err := e.Result()
if err != nil {
return res, errors.Wrap(err, "encode path")
}
pathParts[1] = encoded
}
pathParts[2] = "/dns/backresolve"
uri.AddPathParts(u, pathParts[:]...)
stage = "EncodeRequest"
r, err := ht.NewRequest(ctx, "GET", u)
if err != nil {
return res, errors.Wrap(err, "create request")
}
stage = "SendRequest"
resp, err := c.cfg.Client.Do(r)
if err != nil {
return res, errors.Wrap(err, "do request")
}
defer resp.Body.Close()
stage = "DecodeResponse"
result, err := decodeAccountDnsBackResolveResponse(resp)
if err != nil {
return res, errors.Wrap(err, "decode response")
}
return result, nil
}
// AddressParse invokes addressParse operation.
//
// Parse address and display in all formats.
//
// GET /v2/address/{account_id}/parse
func (c *Client) AddressParse(ctx context.Context, params AddressParseParams) (*AddressParseOK, error) {
res, err := c.sendAddressParse(ctx, params)
return res, err
}
func (c *Client) sendAddressParse(ctx context.Context, params AddressParseParams) (res *AddressParseOK, err error) {
otelAttrs := []attribute.KeyValue{
otelogen.OperationID("addressParse"),
semconv.HTTPMethodKey.String("GET"),
semconv.HTTPRouteKey.String("/v2/address/{account_id}/parse"),
}
// Run stopwatch.
startTime := time.Now()
defer func() {
// Use floating point division here for higher precision (instead of Millisecond method).
elapsedDuration := time.Since(startTime)
c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...))
}()
// Increment request counter.
c.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...))
// Start a span for this request.
ctx, span := c.cfg.Tracer.Start(ctx, "AddressParse",
trace.WithAttributes(otelAttrs...),
clientSpanKind,
)
// Track stage for error reporting.
var stage string
defer func() {
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, stage)
c.errors.Add(ctx, 1, metric.WithAttributes(otelAttrs...))
}
span.End()
}()
stage = "BuildURL"
u := uri.Clone(c.requestURL(ctx))
var pathParts [3]string
pathParts[0] = "/v2/address/"
{
// Encode "account_id" parameter.
e := uri.NewPathEncoder(uri.PathEncoderConfig{
Param: "account_id",
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
return e.EncodeValue(conv.StringToString(params.AccountID))
}(); err != nil {
return res, errors.Wrap(err, "encode path")
}
encoded, err := e.Result()
if err != nil {
return res, errors.Wrap(err, "encode path")
}
pathParts[1] = encoded
}
pathParts[2] = "/parse"
uri.AddPathParts(u, pathParts[:]...)
stage = "EncodeRequest"
r, err := ht.NewRequest(ctx, "GET", u)
if err != nil {
return res, errors.Wrap(err, "create request")
}
stage = "SendRequest"
resp, err := c.cfg.Client.Do(r)
if err != nil {
return res, errors.Wrap(err, "do request")
}
defer resp.Body.Close()
stage = "DecodeResponse"
result, err := decodeAddressParseResponse(resp)
if err != nil {
return res, errors.Wrap(err, "decode response")
}
return result, nil
}
// BlockchainAccountInspect invokes blockchainAccountInspect operation.
//
// Blockchain account inspect.
//
// GET /v2/blockchain/accounts/{account_id}/inspect
func (c *Client) BlockchainAccountInspect(ctx context.Context, params BlockchainAccountInspectParams) (*BlockchainAccountInspect, error) {
res, err := c.sendBlockchainAccountInspect(ctx, params)
return res, err
}
func (c *Client) sendBlockchainAccountInspect(ctx context.Context, params BlockchainAccountInspectParams) (res *BlockchainAccountInspect, err error) {
otelAttrs := []attribute.KeyValue{
otelogen.OperationID("blockchainAccountInspect"),
semconv.HTTPMethodKey.String("GET"),
semconv.HTTPRouteKey.String("/v2/blockchain/accounts/{account_id}/inspect"),
}
// Run stopwatch.
startTime := time.Now()
defer func() {
// Use floating point division here for higher precision (instead of Millisecond method).
elapsedDuration := time.Since(startTime)
c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...))
}()
// Increment request counter.
c.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...))
// Start a span for this request.
ctx, span := c.cfg.Tracer.Start(ctx, "BlockchainAccountInspect",
trace.WithAttributes(otelAttrs...),
clientSpanKind,
)
// Track stage for error reporting.
var stage string
defer func() {
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, stage)
c.errors.Add(ctx, 1, metric.WithAttributes(otelAttrs...))
}
span.End()
}()
stage = "BuildURL"
u := uri.Clone(c.requestURL(ctx))
var pathParts [3]string
pathParts[0] = "/v2/blockchain/accounts/"
{
// Encode "account_id" parameter.
e := uri.NewPathEncoder(uri.PathEncoderConfig{
Param: "account_id",
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
return e.EncodeValue(conv.StringToString(params.AccountID))
}(); err != nil {
return res, errors.Wrap(err, "encode path")
}
encoded, err := e.Result()
if err != nil {
return res, errors.Wrap(err, "encode path")
}
pathParts[1] = encoded
}
pathParts[2] = "/inspect"
uri.AddPathParts(u, pathParts[:]...)
stage = "EncodeRequest"
r, err := ht.NewRequest(ctx, "GET", u)
if err != nil {
return res, errors.Wrap(err, "create request")
}
stage = "SendRequest"
resp, err := c.cfg.Client.Do(r)
if err != nil {
return res, errors.Wrap(err, "do request")
}
defer resp.Body.Close()
stage = "DecodeResponse"
result, err := decodeBlockchainAccountInspectResponse(resp)
if err != nil {
return res, errors.Wrap(err, "decode response")
}
return result, nil
}
// DecodeMessage invokes decodeMessage operation.
//
// Decode a given message. Only external incoming messages can be decoded currently.
//
// POST /v2/message/decode
func (c *Client) DecodeMessage(ctx context.Context, request *DecodeMessageReq) (*DecodedMessage, error) {
res, err := c.sendDecodeMessage(ctx, request)
return res, err
}
func (c *Client) sendDecodeMessage(ctx context.Context, request *DecodeMessageReq) (res *DecodedMessage, err error) {
otelAttrs := []attribute.KeyValue{
otelogen.OperationID("decodeMessage"),
semconv.HTTPMethodKey.String("POST"),
semconv.HTTPRouteKey.String("/v2/message/decode"),
}
// Run stopwatch.
startTime := time.Now()
defer func() {
// Use floating point division here for higher precision (instead of Millisecond method).
elapsedDuration := time.Since(startTime)
c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...))
}()
// Increment request counter.
c.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...))
// Start a span for this request.
ctx, span := c.cfg.Tracer.Start(ctx, "DecodeMessage",
trace.WithAttributes(otelAttrs...),
clientSpanKind,
)
// Track stage for error reporting.
var stage string
defer func() {
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, stage)
c.errors.Add(ctx, 1, metric.WithAttributes(otelAttrs...))
}
span.End()
}()
stage = "BuildURL"
u := uri.Clone(c.requestURL(ctx))
var pathParts [1]string
pathParts[0] = "/v2/message/decode"
uri.AddPathParts(u, pathParts[:]...)
stage = "EncodeRequest"
r, err := ht.NewRequest(ctx, "POST", u)
if err != nil {
return res, errors.Wrap(err, "create request")
}
if err := encodeDecodeMessageRequest(request, r); err != nil {
return res, errors.Wrap(err, "encode request")
}
stage = "SendRequest"
resp, err := c.cfg.Client.Do(r)
if err != nil {
return res, errors.Wrap(err, "do request")
}
defer resp.Body.Close()
stage = "DecodeResponse"
result, err := decodeDecodeMessageResponse(resp)
if err != nil {
return res, errors.Wrap(err, "decode response")
}
return result, nil
}
// DnsResolve invokes dnsResolve operation.
//
// DNS resolve for domain name.
//
// GET /v2/dns/{domain_name}/resolve
func (c *Client) DnsResolve(ctx context.Context, params DnsResolveParams) (*DnsRecord, error) {
res, err := c.sendDnsResolve(ctx, params)
return res, err
}
func (c *Client) sendDnsResolve(ctx context.Context, params DnsResolveParams) (res *DnsRecord, err error) {
otelAttrs := []attribute.KeyValue{
otelogen.OperationID("dnsResolve"),
semconv.HTTPMethodKey.String("GET"),
semconv.HTTPRouteKey.String("/v2/dns/{domain_name}/resolve"),
}
// Run stopwatch.
startTime := time.Now()