Skip to content

Commit

Permalink
add a new constructor to build new claim
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-korotya committed Nov 14, 2023
1 parent 7ea12c5 commit 075cf88
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,22 @@ func NewClaim(sh SchemaHash, options ...Option) (*Claim, error) {
return c, nil
}

// NewClaimFromBigInts creates new Claim from bigInts.
func NewClaimFromBigInts(raw [8]big.Int) (*Claim, error) {
var c Claim
for i := 0; i < 4; i++ {
err := c.index[i].SetInt(&raw[i])
if err != nil {
return nil, err
}
err = c.value[i].SetInt(&raw[i+4])
if err != nil {
return nil, err
}
}
return &c, nil
}

// WithMerklizedRoot sets root to value v_2 or index i_2
// Returns ErrSlotOverflow if root value are too big.
func WithMerklizedRoot(r *big.Int, pos MerklizedRootPosition) Option {
Expand Down

0 comments on commit 075cf88

Please sign in to comment.