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

Implement starknet.go support for call endpoints #12

Open
jelilat opened this issue Feb 15, 2024 · 3 comments
Open

Implement starknet.go support for call endpoints #12

jelilat opened this issue Feb 15, 2024 · 3 comments
Assignees
Labels
good first issue Good for newcomers ODHack Only Dust Hackathon

Comments

@jelilat
Copy link
Contributor

jelilat commented Feb 15, 2024

Implement autogenerated starknet.go code for the following RPC endpoints

  • starknet_call
  • starknet_estimateFee
  • starknet_estimateMessageFee

Additional Context:

@jelilat jelilat added good first issue Good for newcomers ODHack Only Dust Hackathon labels Feb 15, 2024
@AryanGodara
Copy link

I'd like to start with this issue, and make my way up from here :)
Please assign this to me @jelilat 😁

@jelilat
Copy link
Contributor Author

jelilat commented Feb 15, 2024

I'd like to start with this issue, and make my way up from here :) Please assign this to me @jelilat 😁

Done

@AryanGodara
Copy link

I see a common problem where,
image
this is the output (also seen in other PRs)

This is the code

 name: "starknet_call",
    params: {
      context,
      request: functionCall,
      block_id,
    },
    starknetJs: ``,
    starknetGo: `package main
    import (
      "context"
      "fmt"
      "log"
      "github.com/NethermindEth/starknet.go/rpc"
    )
        
    func main() {
      rpcUrl := "https://free-rpc.nethermind.io/mainnet-juno/"
      client, err := rpc.NewClient(rpcUrl)
      if err != nil {
        log.Fatal(err)
      }
      provider := rpc.NewProvider(client)
      feltVar := fp.NewElement(1)
      var one uint64 = 1
      blockId := rpc.BlockID{Number: &one, Hash: felt.NewFelt(&feltVar)}
    
      res, err := provider.Call(
        context.Background(),
        rpc.FunctionCall{
          Calldata:           ,
          ContractAddress:    ${contract_address},
          EntryPointSelector: ${entry_point_selector},
        },
        ${block_id},
      )
      if err != nil {
        log.Fatal(err)
      }
    
      fmt.Println(res)
    }`,

It looks like the UI auto renders after detecting the function, this'll need to be updated, at least for golang, where each function takes in a context.Context; and parameters aren't passed in as a simple ring 🤔 . I'm going to work to figure this out, if a different implementation will be needed for go examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers ODHack Only Dust Hackathon
Projects
None yet
Development

No branches or pull requests

2 participants