ui

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 22 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 AfterItem = &Item{Label: "Valid After", Details: "After this block time", Value: 0}

ValidatingPaymaster specific menu

View Source
var ApiKeyItem = &Item{Label: "Alchemy API Key", Details: "Set Alchemy API Key"}
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 BeneficiaryItem = &Item{Label: "Beneficiary"}
View Source
var BundleSignerItem = &Item{Label: "Signer for the bundle"}
View Source
var CallDataItem = &Item{Label: "Call Data", Details: "Set Call Data"}
View Source
var CallDataTxItem = &Item{Label: "CallData for Tx call", Details: "Enter the call data"}
View Source
var CallDataViewItem = &Item{Label: "CallData for View call", Details: "Enter the call data"}
View Source
var CallForNonceItem = &Item{Label: "Call for Nonce", Details: "Call for the nonce of the selected address"}
View Source
var CallGasLimitItem = &Item{Label: "Call Gas Limit", Details: "Set Call Gas Limit"}
View Source
var CallSignerItem = &Item{Label: "Signer/Sender", Details: "Select the signer"}
View Source
var CallValueItem = &Item{Label: "Value", Details: "Enter the value to send", Value: big.NewInt(0)}
View Source
var ChainCallItem = &Item{Label: "Chain Call", Details: "Call a function on-chain"}
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 ConstructorItem = &Item{Label: "Constructor", Details: "Encode constructor parameters"}
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 DeployBytecodeItem = &Item{Label: "Deploy Bytecode", Details: "Deploy Bytecode"}
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: "Entrypoint", Details: "Set Entrypoint"}
View Source
var EthInfVPMV7Item = &Item{Label: "EthInfinitism ValidatingPaymaster (V7)"}
View Source
var ExecuteBytecodeItem = &Item{Label: "Execute Bytecode", Details: "Execute Bytecode"}
View Source
var Exit = &Item{Label: EXIT, Details: "Exit the program"}
View Source
var ExportAsCurlToAlchemyItem = &Item{Label: "Export as Curl to Alchemy's Bundler", Details: "Export as Curl to Alchemy's Bundler"}
View Source
var ExportAsCurlToEntryItem = &Item{Label: "Export as Curl to Entrypoint", Details: "Export as Curl to Entrypoint"}
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 FromAnotherBookItem = &Item{Label: "From another Address Book"}
View Source
var GasLimitItem = &Item{Label: "Gas Limit", Details: "Enter the gas limit", Value: uint64(200000)}
View Source
var GasLimitOffsetItem = &Item{Label: "Gas Limit Offset", Details: "Set Gas Limit Offset to top the bundle gas limit", Value: state.GetGasLimitOffset()}
View Source
var GetHashItem = &Item{Label: "Hashes and signatures", 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 HashV7Item = &Item{Label: "Hash_v7", Details: "Get the hash of the user operation with entrypoint and chainid"}
View Source
var InputAbiItem = &Item{Label: "Input ABI", Details: "Input ABI manually"}
View Source
var InputAsHexItem = &Item{Label: "Input as HEX", Details: "Input directly as HEX"}

top selection menu

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: "{{. | faint}}",
	Details:  "{{ .Details | faint }}",
}
View Source
var MakeTheCallItem = &Item{Label: "Make call", Details: "Call with the selected values"}
View Source
var MaxFeePerGasItem = &Item{Label: "Max Fee Per Gas", Details: "Set Max Fee Per Gas"}
View Source
var MaxPriorityFeePerGasItem = &Item{Label: "Max Priority Fee Per Gas", Details: "Set Max Priority Fee Per Gas"}
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 PaymasterSignatureItem = &Item{Label: "Paymaster Signature", Details: "Paymaster Signature", Value: []byte{}}
View Source
var PaymasterSignerItem = &Item{Label: "Paymaster Signer", Details: "Signer for Paymaster"}
View Source
var PaymasterV7HashItem = &Item{Label: "Paymaster V7 Hash", Details: "Get the hash as cheked in VerifyingPaymasterV7"}
View Source
var PaymasterVerificationGasLimitItem = &Item{Label: "Paymaster Verification Gas Limit", Details: "Set Paymaster Verification Gas Limit", Value: userop.DefaultPaymasterVerificationGasLimit}
View Source
var PreHashV6Item = &Item{Label: "Pre Hash_v6", Details: "Hash of an encoded user operation"}
View Source
var PreHashV7Item = &Item{Label: "Pre Hash_v7", Details: "Hash of an encoded user operation"}
View Source
var PreVerificationGasItem = &Item{Label: "Pre Verification Gas", Details: "Set Pre Verification Gas"}
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 RemoveSignerItem = &Item{Label: "Remove Signer", Details: "Remove a signer"}
View Source
var RequiredPrefundItem = &Item{Label: "Required Prefund", Details: "Get the required prefund for the user operation"}
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 SendAsBundleItem = &Item{Label: "Send as Bundle", Details: "Send the user operation as a bundle"}
View Source
var SendBundleItem = &Item{Label: "Send as bundle"}
View Source
var SendEndpointItem = &Item{Label: "Endpoint to connect to"}
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 TargetContractItem = &Item{Label: "Target Address ('to')", Details: "Select the target address"}
View Source
var TxCallItem = &Item{Label: "Tx Call", Details: "Send a transaction"}
View Source
var UntilItem = &Item{Label: "Valid Until", Details: "Until this block time", Value: 0}
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 UtilCallItem = &Item{Label: "Web3Api Call", Details: "Call a Web3 API function"}
View Source
var UtilsV6Item = &Item{Label: "Utils V6", Details: "Various V6 utility functions"}
View Source
var UtilsV7Item = &Item{Label: "Utils V7", Details: "Various V7 utility functions"}
View Source
var VerificationGasLimitItem = &Item{Label: "Verification Gas Limit", Details: "Set Verification Gas Limit"}
View Source
var ViewCallItem = &Item{Label: "View Call", Details: "Call a view/pure function"}

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 AddRPCEnpointUI added in v0.2.1

func AddRPCEnpointUI()

func AddSignerUI

func AddSignerUI()

func AddressFromAllBooksUI added in v0.2.2

func AddressFromAllBooksUI() (string, *common.Address, bool)

func AddressFromBookUI

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

func CallForNonceUI added in v0.2.2

func CallForNonceUI(nit, ait *Item)

func Capitalize added in v0.1.0

func Capitalize(s string) string

func ChainCallUI added in v0.2.2

func ChainCallUI()

func CloneUserOpUI added in v0.1.0

func CloneUserOpUI(topIt *Item)

func CreateUserOpUI added in v0.1.0

func CreateUserOpUI(topIt *Item)

func CustomEntryPointUI added in v0.2.0

func CustomEntryPointUI()

func DisplayInputsTypes added in v0.1.0

func DisplayInputsTypes(inputs abi.Arguments) string

func EditRPCEnpointUI added in v0.2.1

func EditRPCEnpointUI(name string) *state.RPCEndpoint

TODO Error handling

func EncodeConstructorParamsUI added in v0.2.1

func EncodeConstructorParamsUI(callBackItem *Item, mabi *abi.ABI) (ret bool)

func EntryPointUI

func EntryPointUI()

func ExportAsAlchemy added in v0.2.1

func ExportAsAlchemy(uop *userop.UserOperation)

func ExportAsCurl

func ExportAsCurl(uop *userop.UserOperation)

func ExportAsJSON

func ExportAsJSON(uop *userop.UserOperation)

func ExportUserOpUI

func ExportUserOpUI(uop *userop.UserOperation)

func GetEOASignerUI added in v0.2.2

func GetEOASignerUI(it *Item)

func GetHashUI

func GetHashUI(usop *userop.UserOperation) (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) (string, *common.Address, error)

func InputNewStringUI

func InputNewStringUI(item *Item) error

func InputNonceUI added in v0.2.2

func InputNonceUI(nit, ait *Item)

func InputString added in v0.1.0

func InputString(item *Item) error

func InputUint

func InputUint(item *Item, size int) (uint64, 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 RPCEndpointsUI added in v0.2.1

func RPCEndpointsUI(it *Item)

Maintain a map ChainID -> RPC Endpoint

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 SendAsBundleUI added in v0.2.1

func SendAsBundleUI(usop *userop.UserOperation) (*common.Hash, error)

func SetEthInfVPMV7DataUI added in v0.2.0

func SetEthInfVPMV7DataUI(it *Item, usop *userop.UserOperation) error

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 SetPaymasterDataUI added in v0.2.0

func SetPaymasterDataUI(it *Item, usop *userop.UserOperation) error

func SetSignatureUI

func SetSignatureUI(userop *userop.UserOperation) (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(signerItem *Item)

func TopUserOpUI added in v0.1.0

func TopUserOpUI(callbackItem *Item)

func TxCallUI added in v0.2.2

func TxCallUI(transactional bool)

func UsOpV6Arg added in v0.2.0

func UsOpV6Arg(it *Item) error

func UserOpContentUI

func UserOpContentUI(topIt *Item)

func UserOpUI

func UserOpUI(usop *userop.UserOperation)

func UtilCallUI added in v0.2.2

func UtilCallUI(endpoint *state.RPCEndpoint, account common.Address)

func UtilsV6UI added in v0.2.0

func UtilsV6UI(usop *userop.UserOperation)

func UtilsV7UI added in v0.2.0

func UtilsV7UI(usop *userop.UserOperation)

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