Skip to content

Commit

Permalink
fix(clients): propagate Cause enum new entry
Browse files Browse the repository at this point in the history
  • Loading branch information
renauter authored Jan 18, 2024
1 parent c4ae928 commit 25d5f9d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 7 additions & 2 deletions clients/tfchain-client-go/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import (
)

type DeletedState struct {
IsCanceledByUser bool `json:"is_canceled_by_user"`
IsOutOfFunds bool `json:"is_out_of_funds"`
IsCanceledByUser bool `json:"is_canceled_by_user"`
IsOutOfFunds bool `json:"is_out_of_funds"`
IsCanceledByCollective bool `json:"is_canceled_by_collective"`
}

// Decode implementation for the enum type
Expand All @@ -25,6 +26,8 @@ func (r *DeletedState) Decode(decoder scale.Decoder) error {
r.IsCanceledByUser = true
case 1:
r.IsOutOfFunds = true
case 2:
r.IsCanceledByCollective = true
default:
return fmt.Errorf("unknown deleted state value")
}
Expand All @@ -38,6 +41,8 @@ func (r DeletedState) Encode(encoder scale.Encoder) (err error) {
err = encoder.PushByte(0)
} else if r.IsOutOfFunds {
err = encoder.PushByte(1)
} else if r.IsCanceledByCollective {
err = encoder.PushByte(2)
}
return
}
Expand Down
5 changes: 3 additions & 2 deletions clients/tfchain-client-js/types.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@
"Cause": {
"_enum": [
"CanceledByUser",
"OutOfFunds"
"OutOfFunds",
"CanceledByCollective"
]
},
"NruConsumption": {
Expand Down Expand Up @@ -334,4 +335,4 @@
"farm_id": "u32",
"weight": "u64"
}
}
}

0 comments on commit 25d5f9d

Please sign in to comment.