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

JSON Unmarshelling typed.TypedData #609

Open
saguillo2000 opened this issue Aug 5, 2024 · 0 comments
Open

JSON Unmarshelling typed.TypedData #609

saguillo2000 opened this issue Aug 5, 2024 · 0 comments

Comments

@saguillo2000
Copy link

I am currently working with AVNU API and there is a method that provides a TypedData JSON, as follows:

{"types":{"StarknetDomain":[{"name":"name","type":"shortstring"},{"name":"version","type":"shortstring"},{"name":"chainId","type":"shortstring"},{"name":"revision","type":"shortstring"}],"OutsideExecution":[{"name":"Caller","type":"ContractAddress"},{"name":"Nonce","type":"felt"},{"name":"Execute After","type":"u128"},{"name":"Execute Before","type":"u128"},{"name":"Calls","type":"Call*"}],"Call":[{"name":"To","type":"ContractAddress"},{"name":"Selector","type":"selector"},{"name":"Calldata","type":"felt*"}]},"primaryType":"OutsideExecution","domain":{"name":"Account.execute......

And I perform the classic method for umarshelling in Go as follows:

var buildResponse typed.TypedData
err = json.Unmarshal(body, &buildResponse)
if err != nil {
log.Fatalf("Failed to unmarshal the response body: %v", err)
return typed.TypedData{}, err
}

Seems like there is no JSON like this for unmarshelling:

type GasTokenPrice struct {
TokenAddress string json:"tokenAddress"
GasFeesInGasToken string json:"gasFeesInGasToken"
GasFeesInUsd float64 json:"gasFeesInUsd"
}

Is there another way to perform this unmarshal?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant