forked from stackup-wallet/stackup-bundler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
722 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ | |
# misc | ||
.DS_Store | ||
tmp | ||
.env |
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 |
---|---|---|
@@ -1,6 +1,12 @@ | ||
setup-dev: | ||
install-dev: | ||
go install github.com/cosmtrek/air@latest | ||
go mod tidy | ||
|
||
dev-rpc: | ||
air -c .air-rpc.toml | ||
generate-environment: | ||
go run ./cmd/genenv | ||
|
||
fetch-wallet: | ||
go run ./cmd/fetchwallet | ||
|
||
dev: | ||
air |
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,21 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/viper" | ||
"github.com/stackup-wallet/stackup-bundler/internal/wallet" | ||
) | ||
|
||
func main() { | ||
viper.SetConfigName(".env") | ||
viper.SetConfigType("env") | ||
viper.AddConfigPath(".") | ||
if err := viper.ReadInConfig(); err != nil { | ||
panic(fmt.Errorf("fatal error config file: %w", err)) | ||
} | ||
|
||
w := wallet.New(viper.GetString("erc4337_bundler_private_key")) | ||
fmt.Printf("Public key: %s\n", w.PublicKey) | ||
fmt.Printf("Address: %s\n", w.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Use this for generating a new private key saved to .privatekey | ||
// Implementation from https://goethereumbook.org/en/wallet-generate/ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
"github.com/ethereum/go-ethereum/common/hexutil" | ||
"github.com/ethereum/go-ethereum/crypto" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
func genPrivateKey() string { | ||
privateKey, err := crypto.GenerateKey() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
privateKeyBytes := crypto.FromECDSA(privateKey) | ||
|
||
return hexutil.Encode(privateKeyBytes)[2:] | ||
} | ||
|
||
func main() { | ||
viper.SetConfigName(".env") | ||
viper.SetConfigType("env") | ||
viper.Set("ERC4337_BUNDLER_RPC_URL", "") | ||
viper.Set("ERC4337_BUNDLER_PRIVATE_KEY", genPrivateKey()) | ||
|
||
if err := viper.WriteConfigAs(".env"); err != nil { | ||
panic(fmt.Errorf("fatal error config file: %w", err)) | ||
} | ||
} |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,44 @@ | ||
module github.com/stackup-wallet/standalone-bundler | ||
module github.com/stackup-wallet/stackup-bundler | ||
|
||
go 1.19 | ||
|
||
require ( | ||
github.com/ethereum/go-ethereum v1.10.25 | ||
github.com/gin-gonic/gin v1.8.1 | ||
github.com/iancoleman/strcase v0.2.0 | ||
github.com/spf13/viper v1.13.0 | ||
golang.org/x/text v0.3.7 | ||
) | ||
|
||
require ( | ||
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect | ||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect | ||
github.com/fsnotify/fsnotify v1.5.4 // indirect | ||
github.com/gin-contrib/sse v0.1.0 // indirect | ||
github.com/go-playground/locales v0.14.0 // indirect | ||
github.com/go-playground/universal-translator v0.18.0 // indirect | ||
github.com/go-playground/validator/v10 v10.11.1 // indirect | ||
github.com/goccy/go-json v0.9.11 // indirect | ||
github.com/hashicorp/hcl v1.0.0 // indirect | ||
github.com/json-iterator/go v1.1.12 // indirect | ||
github.com/leodido/go-urn v1.2.1 // indirect | ||
github.com/magiconair/properties v1.8.6 // indirect | ||
github.com/mattn/go-isatty v0.0.16 // indirect | ||
github.com/mitchellh/mapstructure v1.5.0 // indirect | ||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||
github.com/modern-go/reflect2 v1.0.2 // indirect | ||
github.com/pelletier/go-toml v1.9.5 // indirect | ||
github.com/pelletier/go-toml/v2 v2.0.5 // indirect | ||
github.com/spf13/afero v1.8.2 // indirect | ||
github.com/spf13/cast v1.5.0 // indirect | ||
github.com/spf13/jwalterweatherman v1.1.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/subosito/gotenv v1.4.1 // indirect | ||
github.com/ugorji/go/codec v1.2.7 // indirect | ||
golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b // indirect | ||
golang.org/x/net v0.0.0-20221004154528-8021a29435af // indirect | ||
golang.org/x/sys v0.0.0-20221006211917-84dc82d7e875 // indirect | ||
golang.org/x/text v0.3.7 // indirect | ||
google.golang.org/protobuf v1.28.1 // indirect | ||
gopkg.in/ini.v1 v1.67.0 // indirect | ||
gopkg.in/yaml.v2 v2.4.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
Oops, something went wrong.