From 1f4cff6334857848cd7f2a7c40844ae8c83e68cb Mon Sep 17 00:00:00 2001 From: Oleg Baranov Date: Thu, 13 Jun 2024 14:41:25 +0400 Subject: [PATCH] Renamed RootContractAddrV2 to GetRootContractAddr & fixed tests --- adnl/dht/client_test.go | 2 +- adnl/rldp/http/client_test.go | 2 +- example/dns/main.go | 2 +- example/site-request/main.go | 2 +- ton/dns/resolve.go | 6 +++--- ton/dns/resolve_test.go | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/adnl/dht/client_test.go b/adnl/dht/client_test.go index 8763a823..43a433de 100644 --- a/adnl/dht/client_test.go +++ b/adnl/dht/client_test.go @@ -536,7 +536,7 @@ func TestClient_FindAddressesIntegration(t *testing.T) { } // restore after unit tests - testAddr := "516618cf6cbe9004f6883e742c9a2e3ca53ed02e3e36f4cef62a98ee1e449174" // ADNL address of foundation.ton + testAddr := "89bea091caf4273d38b0dc24944d8798e057abcfa6ac08d5e0b26284c5c0609a" // ADNL address of utils.ton ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) defer cancel() diff --git a/adnl/rldp/http/client_test.go b/adnl/rldp/http/client_test.go index a1bb30ff..32f8e402 100644 --- a/adnl/rldp/http/client_test.go +++ b/adnl/rldp/http/client_test.go @@ -420,7 +420,7 @@ func TestTransport_RoundTripIntegration(t *testing.T) { transport := NewTransport(dhtClient, getDNSResolver()) - req, err := http.NewRequest(http.MethodGet, "http://foundation.ton/", nil) + req, err := http.NewRequest(http.MethodGet, "http://utils.ton/", nil) if err != nil { t.Fatal(err) } diff --git a/example/dns/main.go b/example/dns/main.go index 9b57b30e..305a98d1 100644 --- a/example/dns/main.go +++ b/example/dns/main.go @@ -24,7 +24,7 @@ func main() { api := ton.NewAPIClient(client).WithRetry() // get root dns address from network config - root, err := dns.RootContractAddrV2(context.Background(), api) + root, err := dns.GetRootContractAddr(context.Background(), api) if err != nil { panic(err) } diff --git a/example/site-request/main.go b/example/site-request/main.go index 3a80628e..34b47cbd 100644 --- a/example/site-request/main.go +++ b/example/site-request/main.go @@ -63,7 +63,7 @@ func getDNSResolver() *dns.Client { api := ton.NewAPIClient(client) // get root dns address from network config - root, err := dns.RootContractAddrV2(context.Background(), api) + root, err := dns.GetRootContractAddr(context.Background(), api) if err != nil { panic(err) } diff --git a/ton/dns/resolve.go b/ton/dns/resolve.go index 2a17fc30..cae592d2 100644 --- a/ton/dns/resolve.go +++ b/ton/dns/resolve.go @@ -44,12 +44,12 @@ var randomizer = func() uint64 { return binary.LittleEndian.Uint64(buf) } -// Deprecated: use RootContractAddrV2 +// Deprecated: use GetRootContractAddr func RootContractAddr(api TonApi) (*address.Address, error) { - return RootContractAddrV2(context.Background(), api) + return GetRootContractAddr(context.Background(), api) } -func RootContractAddrV2(ctx context.Context, api TonApi) (*address.Address, error) { +func GetRootContractAddr(ctx context.Context, api TonApi) (*address.Address, error) { b, err := api.CurrentMasterchainInfo(ctx) if err != nil { return nil, fmt.Errorf("failed to get masterchain info: %w", err) diff --git a/ton/dns/resolve_test.go b/ton/dns/resolve_test.go index 37de98c3..0c810749 100644 --- a/ton/dns/resolve_test.go +++ b/ton/dns/resolve_test.go @@ -28,10 +28,10 @@ func TestDomain_GetRecords(t *testing.T) { h.Write([]byte("wallet")) addr := address.MustParseAddr("EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N") records.Set(cell.BeginCell().MustStoreSlice(h.Sum(nil), 256).EndCell(), - cell.BeginCell(). + cell.BeginCell().MustStoreRef(cell.BeginCell(). MustStoreUInt(_CategoryContractAddr, 16). MustStoreAddr(addr). - EndCell()) + EndCell()).EndCell()) domain := Domain{ Records: records,