ui

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EXIT = "EXIT"
	BACK = "BACK"
)

Variables

View Source
var AbisItem = &Item{Label: "ABIs", Details: "Manage ABIs"}
View Source
var AddAbiItem = &Item{Label: "Add ABI", Details: "Add a new ABI"}
View Source
var AddAddressItem = &Item{Label: "Add a new Address"}
View Source
var AddPaymasterItem = &Item{Label: "Add Paymaster", Details: "Add a new paymaster address"}
View Source
var AddSignerItem = &Item{Label: "Add Signer", Details: "Add a new signer"}
View Source
var AppendItem = &Item{Label: "Append", Details: "Append a new value"}
View Source
var Back = &Item{Label: BACK, Details: "Go back to previous menu"}
View Source
var CallDataItem = &Item{Label: "Call Data", Details: "Set Call Data"}
View Source
var CallGasLimitItem = &Item{Label: "Call Gas Limit", Details: "Set Call Gas Limit", Value: userop.DefaultCallGasLimit}
View Source
var ChainIDItem = &Item{Label: "Chain ID", Details: "Set Chain ID"}
View Source
var CloneUserOpItem = &Item{Label: "Clone User Operation", Details: "Clone a user operation"}
View Source
var CreateUserOpItem = &Item{Label: "Create User Operation", Details: "Create a new user operation"}
View Source
var DeleteAbiItem = &Item{Label: "Delete ABI", Details: "Delete this ABI"}
View Source
var EditAbiItem = &Item{Label: "Edit ABI", Details: "Edit this ABI"}
View Source
var EncodeAbiItem = &Item{Label: "Encode ABI", Details: "Encode this ABI"}
View Source
var EncodedBytesItem = &Item{Label: "Encoded Bytes", Details: "Encoded bytes of the user operation"}
View Source
var EntryPointItem = &Item{Label: "Entry Point", Details: "Set entry point"}
View Source
var EntryPointV6Item = &Item{Label: "V6", Details: fmt.Sprintf("Use the V6 entrypoint at: %s", entrypoint.EntryPointAddressV6)}
View Source
var EntryPointV7Item = &Item{Label: "V7", Details: fmt.Sprintf("Use the V7 entrypoint at: %s", entrypoint.EntryPointAddressV7)}
View Source
var Exit = &Item{Label: EXIT, Details: "Exit the program"}
View Source
var ExportAsCurlToEntryItem = &Item{Label: "Export as Curl to Entrypoint", Details: "Export as Curl to Endpoint"}
View Source
var ExportAsRemixTupleV6Item = &Item{Label: "Export as Remix Tuple (V6)", Details: "Export as Remix Tuple"}
View Source
var ExportAsRemixTupleV7Item = &Item{Label: "Export as Remix Tuple (V7)", Details: "Export as Remix Tuple"}
View Source
var ExportAsUOPJSONItem = &Item{Label: "Export as JSON", Details: "Export as JSON"}
View Source
var ExportUserOpItem = &Item{Label: "Export User Operation", Details: "Select the export format"}
View Source
var FactoryDataItem = &Item{Label: "Factory Data", Details: "Set Factory Data"}
View Source
var FactoryItem = &Item{Label: "Factory", Details: "Set Factory"}
View Source
var GetHashItem = &Item{Label: "Hashes and signatures", Details: "Get the hash of the user operation with entrypoint and chainid"}
View Source
var HashItem = &Item{Label: "Hash", Details: "Get the hash of the user operation with entrypoint and chainid"}
View Source
var HashV6Item = &Item{Label: "Hash_v6", Details: "Get the V6 hash of the user operation with entrypoint and chainid"}
View Source
var InputAbiItem = &Item{Label: "Input ABI", Details: "Input ABI manually"}
View Source
var ItemTemplate = &promptui.SelectTemplates{
	Label:    "{{ . | bold | cyan}}",
	Inactive: `{{if eq .Label "BACK"}}{{.Label | yellow}}{{else if eq .Label "EXIT"}}{{.Label | red}}{{else if eq .Label "Set"}}{{.Label | green}}{{else}}{{ .Label }}{{with .DisplayValue}}: {{.}}{{end}}{{end}}`,
	Active:   `{{if eq .Label "BACK"}}{{.Label | yellow | bold | underline}}{{else if eq .Label "EXIT"}}{{.Label | red | bold | underline}}{{else if eq .Label "Set"}}{{.Label | green | bold | underline}}{{else}}{{ .Label | bold | underline }}{{with .DisplayValue}}: {{. | bold}}{{end}}{{end}}`,
	Selected: "{{ .Label | red }}",
	Details:  "{{ .Details | faint }}",
}
View Source
var MaxFeePerGasItem = &Item{Label: "Max Fee Per Gas", Details: "Set Max Fee Per Gas", Value: userop.DefaultMaxFeePerGas}
View Source
var MaxPriorityFeePerGasItem = &Item{Label: "Max Priority Fee Per Gas", Details: "Set Max Priority Fee Per Gas", Value: userop.DefaultMaxPriorityFeePerGas}
View Source
var MethodItem = &Item{Label: "Method", Details: "Manage method"}
View Source
var NonceItem = &Item{Label: "Nonce", Details: "Set nonce", Value: uint64(0)}
View Source
var OK = &Item{Label: "OK", Details: "Confirm and proceed"}

Rewrite the above as variable instantiation witt OK=&Item{Label: "OK"} pattern

View Source
var PaymasterDataItem = &Item{Label: "Paymaster Data", Details: "Set Paymaster Data"}

PaymasterItem is defined in paymasterui.go

View Source
var PaymasterItem = &Item{Label: "Paymaster", Details: "Manage paymaster settings"}
View Source
var PaymasterPostOpGasLimitItem = &Item{Label: "Paymaster Post Op Gas Limit", Details: "Set Paymaster Post Op Gas Limit", Value: userop.DefaultPaymasterPostOpGasLimit}
View Source
var PaymasterVerificationGasLimitItem = &Item{Label: "Paymaster Verification Gas Limit", Details: "Set Paymaster Verification Gas Limit", Value: userop.DefaultPaymasterVerificationGasLimit}
View Source
var PreHashItem = &Item{Label: "Pre Hash", Details: "Hash of an encoded user operation"}
View Source
var PreHashV6Item = &Item{Label: "Pre Hash_v6", Details: "Hash of an encoded user operation"}
View Source
var PreVerificationGasItem = &Item{Label: "Pre Verification Gas", Details: "Set Pre Verification Gas", Value: userop.DefaultPreVerificationGas}
View Source
var ReadAbiFileItem = &Item{Label: "Read ABI from file", Details: "Read ABI from a file"}
View Source
var RemoveAddressItem = &Item{Label: "Remove an Address"}
View Source
var SelectMethodItem = &Item{Label: "Select a Method"}
View Source
var SelectUserOpItem = &Item{Label: "Select User Operation", Details: "Select a user operation"}
View Source
var SenderItem = &Item{Label: state.Sender, Details: "Set sender"}
View Source
var Set = &Item{Label: "Set", Details: "Set the value"}
View Source
var SettingsItem = &Item{Label: "Settings", Details: "Paymasters, Signers, ChainID, ..."}
View Source
var SignItem = &Item{Label: "Sign", Details: "Sign the user operation"}
View Source
var SignatureItem = &Item{Label: "Signature", Details: "Set Signature"}
View Source
var SignerItem = &Item{Label: "Signer", Details: "Manage signer settings"}
View Source
var UserOpContentItem = &Item{Label: "User Operation Content", Details: "Manage user operation content"}
View Source
var UserOpItem = &Item{Label: "User Operations", Details: "Manage user operations"}
View Source
var VerificationGasLimitItem = &Item{Label: "Verification Gas Limit", Details: "Set Verification Gas Limit", Value: userop.DefaultVerificationGasLimit}

Functions

func AbiUI

func AbiUI(contract string, callbackItem *Item) (ret bool)

func AbisUI

func AbisUI(callbackItem *Item) (contract string, err error)

If callback is not nil, it will be set and the function will return

func AddAbiManuallyUI added in v0.1.0

func AddAbiManuallyUI()

func AddAbiUI

func AddAbiUI()

func AddSignerUI

func AddSignerUI()

func AddressFromBookUI

func AddressFromBookUI(label string) (*common.Address, bool)

func Capitalize added in v0.1.0

func Capitalize(s string) string

func CloneUserOpUI added in v0.1.0

func CloneUserOpUI(topIt *Item)

func CreateUserOpUI added in v0.1.0

func CreateUserOpUI(topIt *Item)

func DisplayInputsTypes added in v0.1.0

func DisplayInputsTypes(inputs abi.Arguments) string

func EntryPointUI

func EntryPointUI()

func ExportAsCurl

func ExportAsCurl(uop *userop.UserOp)

func ExportAsJSON

func ExportAsJSON(uop *userop.UserOp)

func ExportUserOpUI

func ExportUserOpUI(uop *userop.UserOp)

func GetHashUI

func GetHashUI(usop *userop.UserOp) (sig []byte, err error)

func GetValue

func GetValue(label string, items []*Item) (interface{}, bool)

func InputBigInt

func InputBigInt(item *Item) error

func InputBool added in v0.1.0

func InputBool(item *Item) error

func InputBytes

func InputBytes(item *Item, bytecount int) error

func InputNewAddressUI

func InputNewAddressUI(label string) (*common.Address, error)

func InputNewStringUI

func InputNewStringUI(item *Item) error

func InputString added in v0.1.0

func InputString(item *Item) error

func InputUint

func InputUint(item *Item, size int) error

func MethodUI

func MethodUI(callbackItem *Item) (ret bool)

func MultiLineInput

func MultiLineInput(label string) (string, error)

func PaymasterUI

func PaymasterUI() (*common.Address, bool)

func PotentiallyRecursiveCallDataUI

func PotentiallyRecursiveCallDataUI() (calldata []byte, err error)

func RootUI

func RootUI()

func SelectFileFromFS added in v0.1.0

func SelectFileFromFS(suffix string) (filebytes []byte, err error)

func SelectMethodUI

func SelectMethodUI(contractName string)

func SelectUserOpUI added in v0.1.0

func SelectUserOpUI(topit *Item)

func SetCallDataValue

func SetCallDataValue(data []byte, item *Item)

func SetParamUI

func SetParamUI(item *Item, input *abi.Argument) error

Returning the new value as Item.Value. This allows to handle the DisplayValue in a flexible way

func SetSignatureUI

func SetSignatureUI(userop *userop.UserOp) (calldata []byte, err error)

func SetSliceUI added in v0.1.0

func SetSliceUI(topItem *Item, slice *abi.Argument) error

func SetTupleUI added in v0.1.0

func SetTupleUI(item *Item, tuple *abi.Argument) error

func SettingsUI added in v0.1.0

func SettingsUI()

func ShortHex

func ShortHex(data []byte, l int) string

func ShortString added in v0.1.0

func ShortString(data string, l int) string

func SignerUI

func SignerUI()

func TopUserOpUI added in v0.1.0

func TopUserOpUI()

func UserOpContentUI

func UserOpContentUI(topIt *Item)

func UserOpUI

func UserOpUI(usop *userop.UserOp)

Types

type ExtraItem added in v0.1.0

type ExtraItem struct {
	// contains filtered or unexported fields
}

Define ExtraItem with Name and Size

func (*ExtraItem) IsDir added in v0.1.0

func (ei *ExtraItem) IsDir() bool

func (*ExtraItem) Name added in v0.1.0

func (ei *ExtraItem) Name() string

func (ExtraItem) String added in v0.1.0

func (ei ExtraItem) String() string

type FileItem added in v0.1.0

type FileItem interface {
	Name() string
	IsDir() bool
}

Define an interface Item with Name and Size

type Item

type Item struct {
	Label              string
	Value              interface{}
	Details            string
	DisplayValueString string //could be a function, but I am lazy
}

func GetItem

func GetItem(label string, items []*Item) (*Item, bool)

func (*Item) DisplayValue

func (i *Item) DisplayValue() string

func (*Item) String

func (i *Item) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL