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
{ | |
"contractName": "Wallet", | |
"abi": [ | |
{ | |
"inputs": [ | |
{ | |
"name": "_master", | |
"type": "address" | |
} | |
], |
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
'use strict' | |
const TestHarness = require('../src/index') | |
let th = new TestHarness() | |
th.run({ | |
name: 'testnet', // specify unique config name here | |
discordUserId: null, // id of Discord user to send alert from Prometheus to (use `Copy ID` on profile to get) | |
// should be string |
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
// listCmd represents the read command | |
var listCmd = &cobra.Command{ | |
Use: "list", | |
Short: "List all blog posts", | |
RunE: func(cmd *cobra.Command, args []string) error { | |
// Create the request (this can be inline below too) | |
req := &blogpb.ListBlogsReq{} | |
// Call ListBlogs that returns a stream | |
stream, err := client.ListBlogs(context.Background(), req) | |
// Check for errors |
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
var deleteCmd = &cobra.Command{ | |
Use: "delete", | |
Short: "Delete a Blog post by its ID", | |
Long: `Delete a blog post by it's mongoDB Unique identifier. | |
If no blog post is found for the ID it will return a 'Not Found' error`, | |
RunE: func(cmd *cobra.Command, args []string) error { | |
id, err := cmd.Flags().GetString("id") | |
if err != nil { | |
return 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
var updateCmd = &cobra.Command{ | |
Use: "update", | |
Short: "Find a Blog post by its ID", | |
Long: `Find a blog post by it's mongoDB Unique identifier. | |
If no blog post is found for the ID it will return a 'Not Found' error`, | |
RunE: func(cmd *cobra.Command, args []string) error { | |
// Get the flags from CLI | |
id, err := cmd.Flags().GetString("id") | |
author, err := cmd.Flags().GetString("author") |
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
var readCmd = &cobra.Command{ | |
Use: "read", | |
Short: "Find a Blog post by its ID", | |
Long: `Find a blog post by it's mongoDB Unique identifier. | |
If no blog post is found for the ID it will return a 'Not Found' error`, | |
RunE: func(cmd *cobra.Command, args []string) error { | |
id, err := cmd.Flags().GetString("id") | |
if err != nil { | |
return 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
func init() { | |
readCmd.Flags().StringP("id", "i", "", "The id of the blog") | |
readCmd.MarkFlagRequired("id") | |
rootCmd.AddCommand(readCmd) | |
} |
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
// createCmd represents the create command | |
var createCmd = &cobra.Command{ | |
Use: "create", | |
Short: "Create a new blog post", | |
Long: `Create a new blogpost on the server through gRPC. | |
A blog post requires an AuthorId, Title and Content.`, | |
RunE: func(cmd *cobra.Command, args []string) error { | |
// Get the data from our flags | |
author, err := cmd.Flags().GetString("author") |
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
func init() { | |
createCmd.Flags().StringP("author", "a", "", "Add an author") | |
createCmd.Flags().StringP("title", "t", "", "A title for the blog") | |
createCmd.Flags().StringP("content", "c", "", "The content for the blog") | |
createCmd.MarkFlagRequired("author") | |
createCmd.MarkFlagRequired("title") | |
createCmd.MarkFlagRequired("content") | |
rootCmd.AddCommand(createCmd) | |
} |
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
var cfgFile string | |
// Client and context global vars for the cmd package | |
// So they can be used by our subcommands | |
var client blogpb.BlogServiceClient | |
var requestCtx context.Context | |
var requestOpts grpc.DialOption | |
func init() { | |
// initConfig reads in config file and ENV variables |