Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Block Types #114

Merged
merged 4 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module github.com/iotaledger/inx/go
go 1.21

require (
github.com/iotaledger/hive.go/ierrors v0.0.0-20231020115340-13da292c580b
github.com/iotaledger/hive.go/lo v0.0.0-20231020115340-13da292c580b
github.com/iotaledger/hive.go/ierrors v0.0.0-20231027195901-620bd7470e42
github.com/iotaledger/hive.go/lo v0.0.0-20231027195901-620bd7470e42
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231020115340-13da292c580b
github.com/iotaledger/iota.go/v4 v4.0.0-20231026154111-efd63ff4f03d
github.com/iotaledger/iota.go/v4 v4.0.0-20231028103644-b834fd54b02a
google.golang.org/grpc v1.59.0
google.golang.org/protobuf v1.31.0
)
Expand All @@ -21,11 +21,11 @@ require (
github.com/gorilla/websocket v1.5.0 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/iancoleman/orderedmap v0.3.0 // indirect
github.com/iotaledger/hive.go/constraints v0.0.0-20231020115340-13da292c580b // indirect
github.com/iotaledger/hive.go/constraints v0.0.0-20231027195901-620bd7470e42 // indirect
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231020115340-13da292c580b // indirect
github.com/iotaledger/hive.go/crypto v0.0.0-20231020115340-13da292c580b // indirect
github.com/iotaledger/hive.go/runtime v0.0.0-20231020115340-13da292c580b // indirect
github.com/iotaledger/hive.go/stringify v0.0.0-20231020115340-13da292c580b // indirect
github.com/iotaledger/hive.go/crypto v0.0.0-20231027195901-620bd7470e42 // indirect
github.com/iotaledger/hive.go/runtime v0.0.0-20231027195901-620bd7470e42 // indirect
github.com/iotaledger/hive.go/stringify v0.0.0-20231027195901-620bd7470e42 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/pasztorpisti/qs v0.0.0-20171216220353-8d6c33ee906c // indirect
Expand Down
28 changes: 14 additions & 14 deletions go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,24 @@ github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o
github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw=
github.com/iancoleman/orderedmap v0.3.0 h1:5cbR2grmZR/DiVt+VJopEhtVs9YGInGIxAoMJn+Ichc=
github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJDkXXS7VoV7XGE=
github.com/iotaledger/hive.go/constraints v0.0.0-20231020115340-13da292c580b h1:HF4e0wz0JMIT4m3saqdQ//T9nWHV9d5sLMtEwNDuykM=
github.com/iotaledger/hive.go/constraints v0.0.0-20231020115340-13da292c580b/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s=
github.com/iotaledger/hive.go/constraints v0.0.0-20231027195901-620bd7470e42 h1:drmpgLlJy7kZ09Dt1qKSnbILU+27Qu2jp4VdPDNwbFk=
github.com/iotaledger/hive.go/constraints v0.0.0-20231027195901-620bd7470e42/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s=
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231020115340-13da292c580b h1:ZERXxhQBUBV1AqTE6cUI4vTxSx4JrnsMuLZFgj32xLM=
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231020115340-13da292c580b/go.mod h1:Mc+ACqBGPxrPMIPUBOm6/HL0J6m0iVMwjtIEKW3uow8=
github.com/iotaledger/hive.go/crypto v0.0.0-20231020115340-13da292c580b h1:ZUUqRRO6XnQmVcXlXyx07vqySn28+bln6jp9KagYCjY=
github.com/iotaledger/hive.go/crypto v0.0.0-20231020115340-13da292c580b/go.mod h1:h3o6okvMSEK3KOX6pOp3yq1h9ohTkTfo6X8MzEadeb0=
github.com/iotaledger/hive.go/ierrors v0.0.0-20231020115340-13da292c580b h1:JJPnr231djUTgTnE4oGz847WE9VA7Py6E6fgZwT5TQo=
github.com/iotaledger/hive.go/ierrors v0.0.0-20231020115340-13da292c580b/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8=
github.com/iotaledger/hive.go/lo v0.0.0-20231020115340-13da292c580b h1:UvFWI8wQJS/XQOeWHpPsaFVeS2nxJ7nIGFr+IFjrnVw=
github.com/iotaledger/hive.go/lo v0.0.0-20231020115340-13da292c580b/go.mod h1:s4kzx9QY1MVWHJralj+3q5kI0eARtrJhphYD/iBbPfo=
github.com/iotaledger/hive.go/runtime v0.0.0-20231020115340-13da292c580b h1:O68POYIqBLnoHN+HIszc58QwAI2qocYq0WKGfVrXmMg=
github.com/iotaledger/hive.go/runtime v0.0.0-20231020115340-13da292c580b/go.mod h1:jRw8yFipiPaqmTPHh7hTcxAP9u6pjRGpByS3REJKkbY=
github.com/iotaledger/hive.go/crypto v0.0.0-20231027195901-620bd7470e42 h1:r8TkdQJB7/bJd8cF8z5GQ+rX/7JpbPdPoN7wMoV1OCM=
github.com/iotaledger/hive.go/crypto v0.0.0-20231027195901-620bd7470e42/go.mod h1:h3o6okvMSEK3KOX6pOp3yq1h9ohTkTfo6X8MzEadeb0=
github.com/iotaledger/hive.go/ierrors v0.0.0-20231027195901-620bd7470e42 h1:QMxd32Y/veVhTDPCiOFgetjUbG7sr9MryF29/rSPkMA=
github.com/iotaledger/hive.go/ierrors v0.0.0-20231027195901-620bd7470e42/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8=
github.com/iotaledger/hive.go/lo v0.0.0-20231027195901-620bd7470e42 h1:AvNLzONVMspwx7nD/NyYUgb5Hi7/zgzIOegr1uRD/M8=
github.com/iotaledger/hive.go/lo v0.0.0-20231027195901-620bd7470e42/go.mod h1:s4kzx9QY1MVWHJralj+3q5kI0eARtrJhphYD/iBbPfo=
github.com/iotaledger/hive.go/runtime v0.0.0-20231027195901-620bd7470e42 h1:1QMJ39qXIx/IZVzus3+97IV7Pa++e+d340TvbMjhiBU=
github.com/iotaledger/hive.go/runtime v0.0.0-20231027195901-620bd7470e42/go.mod h1:jRw8yFipiPaqmTPHh7hTcxAP9u6pjRGpByS3REJKkbY=
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231020115340-13da292c580b h1:zaXZn9yV/95SRDkgCZQeBbSbmcJTKSZbCB7oBd71Qwg=
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231020115340-13da292c580b/go.mod h1:SdK26z8/VhWtxaqCuQrufm80SELgowQPmu9T/8eUQ8g=
github.com/iotaledger/hive.go/stringify v0.0.0-20231020115340-13da292c580b h1:MDZhTZTVDiydXcW5j4TA7HixVCyAdToIMPhHfJee7cE=
github.com/iotaledger/hive.go/stringify v0.0.0-20231020115340-13da292c580b/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs=
github.com/iotaledger/iota.go/v4 v4.0.0-20231026154111-efd63ff4f03d h1:gcJz0J3xFELIPT7y4xqW+q25oOcK6QMlxNnrfFu8srA=
github.com/iotaledger/iota.go/v4 v4.0.0-20231026154111-efd63ff4f03d/go.mod h1:jqbLYq4a/FwuiPBqFfkAwwxU8vs3+kReRq2/tyX5qRA=
github.com/iotaledger/hive.go/stringify v0.0.0-20231027195901-620bd7470e42 h1:OlDhgvJ48bZxcvTeebJ1b96xtNnJAddejd2Q4rlH1mU=
github.com/iotaledger/hive.go/stringify v0.0.0-20231027195901-620bd7470e42/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs=
github.com/iotaledger/iota.go/v4 v4.0.0-20231028103644-b834fd54b02a h1:WLW4iaJAx4N9Pujv+gzHklnnjCt5MPrtXyVcK3UXdNc=
github.com/iotaledger/iota.go/v4 v4.0.0-20231028103644-b834fd54b02a/go.mod h1:jqbLYq4a/FwuiPBqFfkAwwxU8vs3+kReRq2/tyX5qRA=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
Expand Down
16 changes: 8 additions & 8 deletions go/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func blockIDsFromSlice(slice []*BlockId) iotago.BlockIDs {

// Block

func WrapBlock(block *iotago.ProtocolBlock) (*RawBlock, error) {
func WrapBlock(block *iotago.Block) (*RawBlock, error) {
bytes, err := block.API.Encode(block)
if err != nil {
return nil, err
Expand All @@ -31,8 +31,8 @@ func WrapBlock(block *iotago.ProtocolBlock) (*RawBlock, error) {
}, nil
}

func (x *RawBlock) UnwrapBlock(apiProvider iotago.APIProvider) (*iotago.ProtocolBlock, error) {
return lo.DropCount(iotago.ProtocolBlockFromBytes(apiProvider)(x.GetData()))
func (x *RawBlock) UnwrapBlock(apiProvider iotago.APIProvider) (*iotago.Block, error) {
return lo.DropCount(iotago.BlockFromBytes(apiProvider)(x.GetData()))
}

func (x *BlockId) Unwrap() iotago.BlockID {
Expand All @@ -47,11 +47,11 @@ func (x *Block) UnwrapBlockID() iotago.BlockID {
return x.GetBlockId().Unwrap()
}

func (x *Block) UnwrapBlock(apiProvider iotago.APIProvider) (*iotago.ProtocolBlock, error) {
func (x *Block) UnwrapBlock(apiProvider iotago.APIProvider) (*iotago.Block, error) {
return x.GetBlock().UnwrapBlock(apiProvider)
}

func (x *Block) MustUnwrapBlock(apiProvider iotago.APIProvider) *iotago.ProtocolBlock {
func (x *Block) MustUnwrapBlock(apiProvider iotago.APIProvider) *iotago.Block {
msg, err := x.GetBlock().UnwrapBlock(apiProvider)
if err != nil {
panic(err)
Expand Down Expand Up @@ -231,7 +231,7 @@ func (x *TipsResponse) UnwrapShallowLikeTips() iotago.BlockIDs {

// Payload

func WrapPayload(block iotago.BlockPayload, api iotago.API) (*RawPayload, error) {
func WrapPayload(block iotago.ApplicationPayload, api iotago.API) (*RawPayload, error) {
bytes, err := api.Encode(block)
if err != nil {
return nil, err
Expand All @@ -242,8 +242,8 @@ func WrapPayload(block iotago.BlockPayload, api iotago.API) (*RawPayload, error)
}, nil
}

func (x *RawPayload) Unwrap(api iotago.API, opts ...serix.Option) (iotago.BlockPayload, error) {
var payload iotago.BlockPayload
func (x *RawPayload) Unwrap(api iotago.API, opts ...serix.Option) (iotago.ApplicationPayload, error) {
var payload iotago.ApplicationPayload
if _, err := api.Decode(x.GetData(), &payload, opts...); err != nil {
return nil, err
}
Expand Down