-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
179 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package rpc | ||
|
||
import "context" | ||
|
||
// SpecVersion returns the version of the Starknet JSON-RPC specification being used | ||
// Parameters: None | ||
// Returns: String of the Starknet JSON-RPC specification | ||
func (provider *Provider) SpecVersion(ctx context.Context) (string, error) { | ||
var result string | ||
err := do(ctx, provider.c, "starknet_specVersion", &result) | ||
return result, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |