Skip to content

Commit

Permalink
Renamed RootContractAddrV2 to GetRootContractAddr & fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xssnick committed Jun 13, 2024
1 parent a12798e commit 1f4cff6
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion adnl/dht/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion adnl/rldp/http/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion example/dns/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion example/site-request/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions ton/dns/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions ton/dns/resolve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1f4cff6

Please sign in to comment.