Skip to content

Commit

Permalink
style: formatting fix
Browse files Browse the repository at this point in the history
  • Loading branch information
andrix10 committed Oct 16, 2020
1 parent 33e41ae commit 8e62952
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 37 deletions.
1 change: 1 addition & 0 deletions account_balance_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func NewAccountBalanceQuery() *AccountBalanceQuery {
pb: &pb,
}
}

// SetAccountID sets the AccountID for which you wish to query the balance.
//
// Note: you can only query an Account or Contract but not both -- if a Contract ID or Account ID has already been set,
Expand Down
11 changes: 5 additions & 6 deletions contract_info_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ func (query *ContractInfoQuery) Execute(client *Client) (ContractInfo, error) {
return ContractInfo{}, err
}


resp, err := execute(
client,
request{
Expand Down Expand Up @@ -108,13 +107,13 @@ func (query *ContractInfoQuery) Execute(client *Client) (ContractInfo, error) {
AccountID: accountIDFromProtobuf(resp.query.GetContractGetInfo().ContractInfo.AccountID),
ContractID: contractIDFromProtobuf(resp.query.GetContractGetInfo().ContractInfo.ContractID),
ContractAccountID: resp.query.GetContractGetInfo().ContractInfo.ContractAccountID,
AdminKey: PublicKey{
AdminKey: PublicKey{
keyData: adminKey.toProtoKey().GetEd25519(),
},
ExpirationTime: timeFromProtobuf(resp.query.GetContractGetInfo().ContractInfo.ExpirationTime),
AutoRenewPeriod: durationFromProtobuf(resp.query.GetContractGetInfo().ContractInfo.AutoRenewPeriod),
Storage: uint64(resp.query.GetContractGetInfo().ContractInfo.Storage),
ContractMemo: resp.query.GetContractGetInfo().ContractInfo.Memo,
ExpirationTime: timeFromProtobuf(resp.query.GetContractGetInfo().ContractInfo.ExpirationTime),
AutoRenewPeriod: durationFromProtobuf(resp.query.GetContractGetInfo().ContractInfo.AutoRenewPeriod),
Storage: uint64(resp.query.GetContractGetInfo().ContractInfo.Storage),
ContractMemo: resp.query.GetContractGetInfo().ContractInfo.Memo,
}, nil
}

Expand Down
1 change: 0 additions & 1 deletion contract_records_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func (query *ContractRecordsQuery) Execute(client *Client) ([]TransactionRecord,
return []TransactionRecord{}, err
}


resp, err := execute(
client,
request{
Expand Down
2 changes: 0 additions & 2 deletions file_contents_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func (query *FileContentsQuery) Execute(client *Client) ([]byte, error) {
return []byte{}, err
}


resp, err := execute(
client,
request{
Expand Down Expand Up @@ -104,4 +103,3 @@ func (query *FileContentsQuery) SetNodeAccountID(accountID AccountID) *FileConte
func (query *FileContentsQuery) GetNodeAccountId() AccountID {
return query.Query.GetNodeAccountId()
}

8 changes: 4 additions & 4 deletions file_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ func (fileInfo *FileInfo) toProtobuf() *proto.FileGetInfoResponse_FileInfo {
}

return &proto.FileGetInfoResponse_FileInfo{
FileID: fileInfo.FileID.toProtobuf(),
Size: fileInfo.Size,
FileID: fileInfo.FileID.toProtobuf(),
Size: fileInfo.Size,
ExpirationTime: &proto.Timestamp{
Seconds: int64(fileInfo.ExpirationTime.Second()),
Nanos: int32(fileInfo.ExpirationTime.Nanosecond()),
},
Deleted: fileInfo.IsDeleted,
Keys: &proto.KeyList{
Deleted: fileInfo.IsDeleted,
Keys: &proto.KeyList{
Keys: keys,
},
}
Expand Down
1 change: 0 additions & 1 deletion file_info_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ func (query *FileInfoQuery) Execute(client *Client) (FileInfo, error) {
return FileInfo{}, err
}


resp, err := execute(
client,
request{
Expand Down
14 changes: 7 additions & 7 deletions live_hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (

type LiveHash struct {
AccountID AccountID
Hash []byte
Keys KeyList
Duration time.Time
Hash []byte
Keys KeyList
Duration time.Time
}

func newLiveHash(accountId AccountID, hash []byte,
Expand All @@ -27,7 +27,7 @@ func (liveHash *LiveHash) toProtobuf() *proto.LiveHash {
AccountId: liveHash.AccountID.toProtobuf(),
Hash: liveHash.Hash,
Keys: liveHash.Keys.toProtoKeyList(),
Duration: &proto.Duration{
Duration: &proto.Duration{
Seconds: int64(liveHash.Duration.Second()),
},
}
Expand All @@ -38,9 +38,9 @@ func liveHashFromProtobuf(hash *proto.LiveHash) LiveHash {
AccountID: accountIDFromProtobuf(hash.GetAccountId()),
Hash: hash.Hash,
Keys: keyListFromProtobuf(hash.Keys),
Duration: time.Date(time.Now().Year(), time.Now().Month(),
time.Now().Day(), time.Now().Hour(), time.Now().Minute(),
int(hash.Duration.Seconds), time.Now().Nanosecond(), time.Now().Location()),
Duration: time.Date(time.Now().Year(), time.Now().Month(),
time.Now().Day(), time.Now().Hour(), time.Now().Minute(),
int(hash.Duration.Seconds), time.Now().Nanosecond(), time.Now().Location()),
}

}
1 change: 0 additions & 1 deletion live_hash_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func (query *LiveHashQuery) Execute(client *Client) (LiveHash, error) {
return LiveHash{}, err
}


resp, err := execute(
client,
request{
Expand Down
1 change: 0 additions & 1 deletion network_version_info_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ func (query *NetworkVersionInfoQuery) Execute(client *Client) (NetworkVersionInf
return NetworkVersionInfo{}, err
}


resp, err := execute(
client,
request{
Expand Down
26 changes: 13 additions & 13 deletions topic_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ type TopicInfo struct {

func topicInfoFromProtobuf(topicInfo *proto.ConsensusTopicInfo) TopicInfo {
return TopicInfo{
Memo: topicInfo.Memo,
RunningHash: topicInfo.RunningHash,
SequenceNumber: topicInfo.SequenceNumber,
ExpirationTime: time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(),
time.Now().Hour(), time.Now().Minute(), int(topicInfo.ExpirationTime.Seconds),
int(topicInfo.ExpirationTime.Nanos), time.Now().Location()),
AdminKey: &PublicKey{
Memo: topicInfo.Memo,
RunningHash: topicInfo.RunningHash,
SequenceNumber: topicInfo.SequenceNumber,
ExpirationTime: time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(),
time.Now().Hour(), time.Now().Minute(), int(topicInfo.ExpirationTime.Seconds),
int(topicInfo.ExpirationTime.Nanos), time.Now().Location()),
AdminKey: &PublicKey{
keyData: topicInfo.AdminKey.GetEd25519(),
},
SubmitKey: &PublicKey{
SubmitKey: &PublicKey{
keyData: topicInfo.SubmitKey.GetEd25519(),
},
AutoRenewPeriod: durationFromProtobuf(topicInfo.AutoRenewPeriod),
AutoRenewPeriod: durationFromProtobuf(topicInfo.AutoRenewPeriod),
AutoRenewAccountID: &AccountID{
Shard: uint64(topicInfo.GetAutoRenewAccount().ShardNum),
Realm: uint64(topicInfo.GetAutoRenewAccount().RealmNum),
Expand All @@ -41,10 +41,10 @@ func topicInfoFromProtobuf(topicInfo *proto.ConsensusTopicInfo) TopicInfo {

func (topicInfo *TopicInfo) toProtobuf() *proto.ConsensusTopicInfo {
return &proto.ConsensusTopicInfo{
Memo: topicInfo.Memo,
RunningHash: topicInfo.RunningHash,
SequenceNumber: topicInfo.SequenceNumber,
ExpirationTime: &proto.Timestamp{
Memo: topicInfo.Memo,
RunningHash: topicInfo.RunningHash,
SequenceNumber: topicInfo.SequenceNumber,
ExpirationTime: &proto.Timestamp{
Seconds: int64(topicInfo.ExpirationTime.Second()),
Nanos: int32(topicInfo.ExpirationTime.Nanosecond()),
},
Expand Down
1 change: 0 additions & 1 deletion topic_info_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ func (query *TopicInfoQuery) Execute(client *Client) (TopicInfo, error) {
return TopicInfo{}, err
}


resp, err := execute(
client,
request{
Expand Down

0 comments on commit 8e62952

Please sign in to comment.