fix: `NetworkName` usage in `DelegateContractId`
@@ -32,8 +32,8 @@ func DelegatableContractIDFromString(data string) (DelegatableContractID, error)
}
func (id *DelegatableContractID) ValidateChecksum(client *Client) error {
- if !id._IsZero() && client != nil && client.network.networkName != nil {
- tempChecksum, err := _ChecksumParseAddress(client.network.networkName._LedgerID(), fmt.Sprintf("%d.%d.%d", id.Shard, id.Realm, id.Contract))
+ if !id._IsZero() && client != nil && client.network._GetLedgerID() != nil {
+ tempChecksum, err := _ChecksumParseAddress(client.network._GetLedgerID()._ForChecksum(), fmt.Sprintf("%d.%d.%d", id.Shard, id.Realm, id.Contract))
if err != nil {
return err
}
@@ -48,7 +48,7 @@ func (id *DelegatableContractID) ValidateChecksum(client *Client) error {
return errors.New(fmt.Sprintf("network mismatch or wrong checksum given, given checksum: %s, correct checksum %s, network: %s",
*id.checksum,
tempChecksum.correctChecksum,
- *client.network.networkName))
+ *client.network._GetLedgerID()))
}
}
@@ -57,8 +57,8 @@ func (id *DelegatableContractID) ValidateChecksum(client *Client) error {
// Deprecated
func (id *DelegatableContractID) Validate(client *Client) error {
- if !id._IsZero() && client != nil && client.network.networkName != nil {
- tempChecksum, err := _ChecksumParseAddress(client.network.networkName._LedgerID(), fmt.Sprintf("%d.%d.%d", id.Shard, id.Realm, id.Contract))
+ if !id._IsZero() && client != nil && client.network._GetLedgerID() != nil {
+ tempChecksum, err := _ChecksumParseAddress(client.network._GetLedgerID()._ForChecksum(), fmt.Sprintf("%d.%d.%d", id.Shard, id.Realm, id.Contract))
if err != nil {
return err
}
@@ -73,7 +73,7 @@ func (id *DelegatableContractID) Validate(client *Client) error {
return errors.New(fmt.Sprintf("network mismatch or wrong checksum given, given checksum: %s, correct checksum %s, network: %s",
*id.checksum,
tempChecksum.correctChecksum,
- *client.network.networkName))
+ *client.network._GetLedgerID()))
}
}
@@ -100,10 +100,10 @@ func (id DelegatableContractID) String() string {
}
func (id DelegatableContractID) ToStringWithChecksum(client Client) (string, error) {
- if client.GetNetworkName() == nil {
+ if client.GetLedgerID() == nil {
return "", errNetworkNameMissing
}
- checksum, err := _ChecksumParseAddress(client.GetNetworkName()._LedgerID(), fmt.Sprintf("%d.%d.%d", id.Shard, id.Realm, id.Contract))
+ checksum, err := _ChecksumParseAddress(client.GetLedgerID()._ForChecksum(), fmt.Sprintf("%d.%d.%d", id.Shard, id.Realm, id.Contract))
if err != nil {
return "", err
}
