@@ -15,6 +15,7 @@ import (
15
15
"time"
16
16
17
17
"go.uber.org/zap"
18
+ "golang.org/x/exp/maps"
18
19
19
20
"github.com/tonkeeper/opentonapi/pkg/addressbook"
20
21
"golang.org/x/exp/slices"
@@ -27,7 +28,6 @@ import (
27
28
"github.com/tonkeeper/tongo"
28
29
"github.com/tonkeeper/tongo/abi"
29
30
"github.com/tonkeeper/tongo/boc"
30
- "github.com/tonkeeper/tongo/code"
31
31
"github.com/tonkeeper/tongo/tlb"
32
32
"github.com/tonkeeper/tongo/ton"
33
33
"github.com/tonkeeper/tongo/utils"
@@ -504,7 +504,7 @@ func (h *Handler) BlockchainAccountInspect(ctx context.Context, params oas.Block
504
504
if err != nil {
505
505
return nil , toError (http .StatusInternalServerError , err )
506
506
}
507
- methods , err := code . ParseContractMethods ( rawAccount .Code )
507
+ info , err := abi . GetCodeInfo ( ctx , rawAccount .Code , h . storage )
508
508
if err != nil {
509
509
return nil , toError (http .StatusInternalServerError , err )
510
510
}
@@ -534,11 +534,15 @@ func (h *Handler) BlockchainAccountInspect(ctx context.Context, params oas.Block
534
534
if len (sourceFiles ) > 0 {
535
535
resp .Source = oas .NewOptSource (oas.Source {Files : sourceFiles })
536
536
}
537
- for _ , methodID := range methods {
538
- if method , ok := code .Methods [methodID ]; ok {
537
+ knownMethods := make (map [int64 ]string )
538
+ for _ , name := range maps .Keys (abi .KnownGetMethodsDecoder ) {
539
+ knownMethods [int64 (utils .MethodIdFromName (name ))] = name
540
+ }
541
+ for _ , methodID := range maps .Keys (info .Methods ) {
542
+ if method , ok := knownMethods [methodID ]; ok {
539
543
resp .Methods = append (resp .Methods , oas.Method {
540
544
ID : methodID ,
541
- Method : string ( method ) ,
545
+ Method : method ,
542
546
})
543
547
}
544
548
}
0 commit comments