Skip to content

Commit a7ef963

Browse files
fix the BlockchainAccountInspect method
1 parent ea8556a commit a7ef963

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ require (
2424
github.com/sourcegraph/conc v0.3.0
2525
github.com/stretchr/testify v1.9.0
2626
github.com/tonkeeper/scam_backoffice_rules v0.0.1
27-
github.com/tonkeeper/tongo v1.14.3
27+
github.com/tonkeeper/tongo v1.14.5
2828
go.opentelemetry.io/otel v1.24.0
2929
go.opentelemetry.io/otel/metric v1.24.0
3030
go.opentelemetry.io/otel/trace v1.24.0

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
270270
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
271271
github.com/tonkeeper/scam_backoffice_rules v0.0.1 h1:q98OLTO2tjaTOCxBl3EmY+PMClkvamR0+c7ytIisH7o=
272272
github.com/tonkeeper/scam_backoffice_rules v0.0.1/go.mod h1:SqZXYO9vbID8ku+xnnaKXeNGmehxigODGrk5V1KqbRA=
273-
github.com/tonkeeper/tongo v1.14.3 h1:euA0eM+vh6AlRY/TovD1aOhZ3D/pE38P96Ao6y5V5B0=
274-
github.com/tonkeeper/tongo v1.14.3/go.mod h1:MjgIgAytFarjCoVjMLjYEtpZNN1f2G/pnZhKjr28cWs=
273+
github.com/tonkeeper/tongo v1.14.5 h1:4Ttj6jDHMd/2fUbzRiw4SJvS7XJ8/Uexs0khHKcgi4c=
274+
github.com/tonkeeper/tongo v1.14.5/go.mod h1:MjgIgAytFarjCoVjMLjYEtpZNN1f2G/pnZhKjr28cWs=
275275
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
276276
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
277277
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=

pkg/api/account_handlers.go

+9-5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"time"
1616

1717
"go.uber.org/zap"
18+
"golang.org/x/exp/maps"
1819

1920
"github.com/tonkeeper/opentonapi/pkg/addressbook"
2021
"golang.org/x/exp/slices"
@@ -27,7 +28,6 @@ import (
2728
"github.com/tonkeeper/tongo"
2829
"github.com/tonkeeper/tongo/abi"
2930
"github.com/tonkeeper/tongo/boc"
30-
"github.com/tonkeeper/tongo/code"
3131
"github.com/tonkeeper/tongo/tlb"
3232
"github.com/tonkeeper/tongo/ton"
3333
"github.com/tonkeeper/tongo/utils"
@@ -504,7 +504,7 @@ func (h *Handler) BlockchainAccountInspect(ctx context.Context, params oas.Block
504504
if err != nil {
505505
return nil, toError(http.StatusInternalServerError, err)
506506
}
507-
methods, err := code.ParseContractMethods(rawAccount.Code)
507+
info, err := abi.GetCodeInfo(ctx, rawAccount.Code, h.storage)
508508
if err != nil {
509509
return nil, toError(http.StatusInternalServerError, err)
510510
}
@@ -534,11 +534,15 @@ func (h *Handler) BlockchainAccountInspect(ctx context.Context, params oas.Block
534534
if len(sourceFiles) > 0 {
535535
resp.Source = oas.NewOptSource(oas.Source{Files: sourceFiles})
536536
}
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 {
539543
resp.Methods = append(resp.Methods, oas.Method{
540544
ID: methodID,
541-
Method: string(method),
545+
Method: method,
542546
})
543547
}
544548
}

pkg/core/converters.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ func ConvertMessage(message tlb.Message, txLT uint64, cd *abi.ContractDescriptio
354354
CreatedLt: txLT,
355355
Destination: dest,
356356
},
357-
Hash: ton.Bits256(message.Hash()),
357+
Hash: ton.Bits256(message.Hash(false)),
358358
MsgType: ExtInMsg,
359359
SourceExtern: externalAddressFromTlb(info.Src),
360360
ImportFee: importFee.Int64(),

0 commit comments

Comments
 (0)