Skip to content

Commit

Permalink
Updated seer starknet generate to understand new bit sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
zomglings committed Jan 15, 2024
1 parent 5672d6a commit 47982e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions starknet/generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package starknet
import (
"bytes"
"fmt"
"strconv"
"strings"
"text/template"

Expand Down Expand Up @@ -53,13 +54,18 @@ type HeaderParameters struct {
// Qualified names for Starknet ABI items are of the form:
// `core::starknet::contract_address::ContractAddress`
func GenerateGoNameForType(qualifiedName string) string {
if qualifiedName == "core::integer::u8" || qualifiedName == "core::integer::u16" || qualifiedName == "core::integer::u32" || qualifiedName == "core::integer::u64" {
if strings.HasPrefix(qualifiedName, "core::integer::u") {
bitsRaw := strings.TrimPrefix(qualifiedName, "core::integer::u")
bits, bitsErr := strconv.Atoi(bitsRaw)
if bitsErr != nil || bits > 64 {
return `*big.Int`
}
return "uint64"
} else if strings.HasPrefix(qualifiedName, "core::integer::") {
return `*big.Int`
} else if qualifiedName == "core::starknet::contract_address::ContractAddress" {
return "string"
} else if qualifiedName == "core::felt252" {
} else if strings.HasPrefix(qualifiedName, "core::felt25") {
return "string"
} else if strings.HasPrefix(qualifiedName, "core::array::Array::<") {
s1, _ := strings.CutPrefix(qualifiedName, "core::array::Array::<")
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package version

var SeerVersion string = "0.0.1"
var SeerVersion string = "0.0.2"

0 comments on commit 47982e7

Please sign in to comment.