Skip to content

Commit

Permalink
comet rebase followup, allow to build and test most things
Browse files Browse the repository at this point in the history
  • Loading branch information
chappjc committed Aug 9, 2023
1 parent fe1c007 commit 53ebe25
Show file tree
Hide file tree
Showing 35 changed files with 339 additions and 284 deletions.
3 changes: 1 addition & 2 deletions cmd/kwil-cli/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package app
import (
"github.com/kwilteam/kwil-db/cmd/kwil-cli/cmds/configure"
"github.com/kwilteam/kwil-db/cmd/kwil-cli/cmds/database"
"github.com/kwilteam/kwil-db/cmd/kwil-cli/cmds/fund"
"github.com/kwilteam/kwil-db/cmd/kwil-cli/cmds/system"
"github.com/kwilteam/kwil-db/cmd/kwil-cli/cmds/utils"
"github.com/kwilteam/kwil-db/cmd/kwil-cli/config"
Expand All @@ -21,7 +20,7 @@ var rootCmd = &cobra.Command{

func Execute() error {
rootCmd.AddCommand(
fund.NewCmdFund(),
// fund.NewCmdFund(),
configure.NewCmdConfigure(),
database.NewCmdDatabase(),
utils.NewCmdUtils(),
Expand Down
4 changes: 2 additions & 2 deletions cmd/kwil-cli/app/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"strings"
"time"

schema "github.com/kwilteam/kwil-db/internal/entity"
"github.com/kwilteam/kwil-db/pkg/serialize"

grpc "github.com/kwilteam/kwil-db/pkg/grpc/client/v1"
"github.com/kwilteam/kwil-db/pkg/log"
Expand Down Expand Up @@ -152,7 +152,7 @@ func (d *KwilCliDriver) GetAllowance(ctx context.Context) (*big.Int, error) {
return nil, nil
}

func (d *KwilCliDriver) DeployDatabase(ctx context.Context, db *schema.Schema) error {
func (d *KwilCliDriver) DeployDatabase(ctx context.Context, db *serialize.Schema) error {
schemaFile := path.Join(os.TempDir(), fmt.Sprintf("schema-%s.json", time.Now().Format("20060102150405")))

dbByte, err := json.Marshal(db)
Expand Down
14 changes: 7 additions & 7 deletions cmd/kwil-cli/cmds/common/roundtripper.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ func DialClient(ctx context.Context, flags uint8, fn RoundTripper) error {

options := []client.ClientOpt{}

if flags&WithoutProvider != 0 {
options = append(options, client.WithoutProvider())
}
if flags&WithoutServiceConfig != 0 {
options = append(options, client.WithoutServiceConfig())
}
// if flags&WithoutProvider != 0 {
// options = append(options, client.WithoutProvider())
// }
// if flags&WithoutServiceConfig != 0 {
// options = append(options, client.WithoutServiceConfig())
// }
if flags&WithChainClient != 0 {
if conf.ClientChainRPCURL == "" {
return fmt.Errorf("chain rpc url is required")
}
options = append(options, client.WithChainRpcUrl(conf.ClientChainRPCURL))
options = append(options, client.WithCometBftUrl(conf.ClientChainRPCURL))
}
if flags&WithoutPrivateKey == 0 {
// this means it needs to use the private key
Expand Down
15 changes: 8 additions & 7 deletions cmd/kwil-cli/cmds/database/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/kwilteam/kuneiform/kfparser"
"io"
"os"
"strings"

"github.com/kwilteam/kuneiform/kfparser"

"github.com/kwilteam/kwil-db/cmd/kwil-cli/cmds/common"
"github.com/kwilteam/kwil-db/cmd/kwil-cli/cmds/common/display"
"github.com/kwilteam/kwil-db/cmd/kwil-cli/config"
"github.com/kwilteam/kwil-db/internal/entity"
"github.com/kwilteam/kwil-db/pkg/client"
"github.com/kwilteam/kwil-db/pkg/crypto"
"github.com/kwilteam/kwil-db/pkg/serialize"
"github.com/spf13/cobra"
)

Expand All @@ -36,7 +37,7 @@ func deployCmd() *cobra.Command {
}
defer file.Close()

var db *entity.Schema
var db *serialize.Schema
if fileType == "kf" {
db, err = UnmarshalKf(file)
} else if fileType == "json" {
Expand Down Expand Up @@ -67,7 +68,7 @@ func deployCmd() *cobra.Command {
return cmd
}

func UnmarshalKf(file *os.File) (*entity.Schema, error) {
func UnmarshalKf(file *os.File) (*serialize.Schema, error) {
source, err := io.ReadAll(file)
if err != nil {
return nil, fmt.Errorf("failed to read Kuneiform source file: %w", err)
Expand All @@ -83,7 +84,7 @@ func UnmarshalKf(file *os.File) (*entity.Schema, error) {
return nil, fmt.Errorf("failed to marshal schema: %w", err)
}

var db entity.Schema
var db serialize.Schema
err = json.Unmarshal(schemaJson, &db)
if err != nil {
return nil, fmt.Errorf("failed to unmarshal schema json: %w", err)
Expand All @@ -92,13 +93,13 @@ func UnmarshalKf(file *os.File) (*entity.Schema, error) {
return &db, nil
}

func UnmarshalJson(file *os.File) (*entity.Schema, error) {
func UnmarshalJson(file *os.File) (*serialize.Schema, error) {
bts, err := io.ReadAll(file)
if err != nil {
return nil, fmt.Errorf("failed to read file: %w", err)
}

var db entity.Schema
var db serialize.Schema
err = json.Unmarshal(bts, &db)
if err != nil {
return nil, fmt.Errorf("failed to unmarshal file: %w", err)
Expand Down
2 changes: 2 additions & 0 deletions cmd/kwil-cli/cmds/fund/approve.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fund

/*
import (
"context"
"errors"
Expand Down Expand Up @@ -67,3 +68,4 @@ func approveCmd() *cobra.Command {
cmd.Flags().BoolVarP(&assumeYes, "yes", "y", false, "Automatic yes to prompts.")
return cmd
}
*/
2 changes: 2 additions & 0 deletions cmd/kwil-cli/cmds/fund/balances.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fund

/*
import (
"context"
"fmt"
Expand Down Expand Up @@ -60,3 +61,4 @@ func balancesCmd() *cobra.Command {
return cmd
}
*/
2 changes: 2 additions & 0 deletions cmd/kwil-cli/cmds/fund/cmd.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fund

/*
import (
"github.com/spf13/cobra"
)
Expand All @@ -19,3 +20,4 @@ func NewCmdFund() *cobra.Command {
)
return cmd
}
*/
2 changes: 2 additions & 0 deletions cmd/kwil-cli/cmds/fund/deposit.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fund

/*
import (
"context"
"errors"
Expand Down Expand Up @@ -67,3 +68,4 @@ func depositCmd() *cobra.Command {
return cmd
}
*/
6 changes: 6 additions & 0 deletions deployments/compose/eth_chain.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package main

/*xxx
import (
"context"
"fmt"
Expand Down Expand Up @@ -61,3 +63,7 @@ func main() {
initContract(chainDeployer)
keepMiningBlocks(chainDeployer)
}
*/

func main() {}
Loading

0 comments on commit 53ebe25

Please sign in to comment.