Skip to content

Commit

Permalink
Revert "fix: update ObjectChange owner type"
Browse files Browse the repository at this point in the history
This reverts commit 770b165.
  • Loading branch information
miancan committed May 31, 2024
1 parent 61a8884 commit 6094426
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
2 changes: 1 addition & 1 deletion models/read_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ type SuiTransactionBlockResponse struct {
type ObjectChange struct {
Type string `json:"type"`
Sender string `json:"sender"`
Owner interface{} `json:"owner"`
Owner ObjectOwner `json:"owner"`
ObjectType string `json:"objectType"`
ObjectId string `json:"objectId"`
PackageId string `json:"packageId"`
Expand Down
18 changes: 1 addition & 17 deletions sui/read_transaction_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,10 @@ func (s *suiReadTransactionFromSuiImpl) SuiGetTransactionBlock(ctx context.Conte
if gjson.ParseBytes(respBytes).Get("error").Exists() {
return rsp, errors.New(gjson.ParseBytes(respBytes).Get("error").String())
}
raws := gjson.ParseBytes(respBytes).Get("result")
err = json.Unmarshal([]byte(raws.Raw), &rsp)
err = json.Unmarshal([]byte(gjson.ParseBytes(respBytes).Get("result").Raw), &rsp)
if err != nil {
return rsp, err
}
objectChanges := raws.Get("objectChanges").Array()
if len(objectChanges) != len(rsp.ObjectChanges) {
return rsp, nil
}
for index, item := range objectChanges {
owner := item.Get("owner")
if owner.IsObject() {
var ownerObject models.ObjectOwner
err = json.Unmarshal([]byte(owner.Raw), &ownerObject)
if err != nil {
return rsp, err
}
rsp.ObjectChanges[index].Owner = ownerObject
}
}
return rsp, nil
}

Expand Down

0 comments on commit 6094426

Please sign in to comment.