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 rpc05 specVersion #416

Merged
merged 3 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions rpc/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package rpc

import "context"

func (provider *Provider) SpecVersion(ctx context.Context) (string, error) {
rianhughes marked this conversation as resolved.
Show resolved Hide resolved
var result string
err := do(ctx, provider.c, "starknet_specVersion", &result)
return result, err
}
32 changes: 32 additions & 0 deletions rpc/version_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package rpc

import (
"context"
"testing"

"github.com/test-go/testify/require"
)

// TestSpecVersion tests starknet_specVersion
func TestSpecVersion(t *testing.T) {

testConfig := beforeEach(t)

type testSetType struct {
ExpectedResp string
}
testSet := map[string][]testSetType{
"devnet": {},
"mainnet": {},
"mock": {},
"testnet": {{
ExpectedResp: "0.5.0",
}},
}[testEnv]

for _, test := range testSet {
resp, err := testConfig.provider.SpecVersion(context.Background())
require.NoError(t, err)
require.Equal(t, test.ExpectedResp, resp)
}
}