Documentation
¶
Index ¶
- Constants
- Variables
- func AddressFromImageHash(imageHash string, context WalletContext) (common.Address, error)
- func AddressFromWalletConfig(walletConfig WalletConfig, context WalletContext) (common.Address, error)
- func BuildProxy(addr common.Address) string
- func ComputeGuestExecDigest(txns Transactions) (common.Hash, error)
- func ComputeSelfExecDigest(txns Transactions) (common.Hash, error)
- func ComputeWalletExecDigest(nonce *big.Int, txns Transactions) (common.Hash, error)
- func DecodeNonce(raw *big.Int) (*big.Int, *big.Int)
- func DecodeNonceChangeEvent(log *types.Log) (*big.Int, *big.Int, error)
- func DecodeRevertReason(logs []*types.Log) []string
- func DecodeTxFailedEvent(log *types.Log) (common.Hash, string, error)
- func DeploySequenceWallet(sender *ethwallet.Wallet, walletConfig WalletConfig, ...) (common.Address, *types.Transaction, ethtxn.WaitReceipt, error)
- func EncodeNonce(space *big.Int, nonce *big.Int) (*big.Int, error)
- func EncodeTransactionsForRelaying(relayer Relayer, walletConfig WalletConfig, walletContext WalletContext, ...) (common.Address, []byte, error)
- func EncodeWalletDeployment(walletConfig WalletConfig, walletContext WalletContext) (common.Address, common.Address, []byte, error)
- func GenerateRandomNonce() (*big.Int, error)
- func GetWalletNonce(provider *ethrpc.Provider, walletConfig WalletConfig, ...) (*big.Int, error)
- func ImageHashOfWalletConfig(walletConfig WalletConfig) (string, error)
- func ImageHashOfWalletConfigBytes(walletConfig WalletConfig) ([]byte, error)
- func IsTxExecutedEvent(log *types.Log, hash common.Hash) bool
- func IsValidSignature(walletAddress common.Address, digest common.Hash, seqSig []byte, ...) (bool, error)
- func IsWalletConfigEqual(walletConfigA, walletConfigB WalletConfig) bool
- func IsWalletConfigUsable(walletConfig WalletConfig) (bool, error)
- func IsWalletDeployed(provider *ethrpc.Provider, walletAddress common.Address) (bool, error)
- func MessageDigest(message []byte) common.Hash
- func MustEncodeSig(str string) common.Hash
- func PackMessageData(chainID *big.Int, address common.Address, digest common.Hash) ([]byte, error)
- func SortWalletConfig(walletConfig WalletConfig) error
- func SubDigest(chainID *big.Int, address common.Address, digest common.Hash) ([]byte, error)
- func ValidateSequenceAccountProof() ethauth.ValidatorFunc
- func ValidateSequenceAccountProofWith(factory, mainModule common.Address) ethauth.ValidatorFunc
- type BlockOfReceipts
- type CallOverride
- type EstimateTransaction
- type Estimator
- func (e *Estimator) AreEOAs(ctx context.Context, provider *ethrpc.Provider, walletConfig WalletConfig) ([]bool, error)
- func (e *Estimator) BuildStubSignature(walletConfig WalletConfig, willSign []bool, isEoa []bool) []byte
- func (e *Estimator) CalldataCost(data []byte) uint64
- func (e *Estimator) Estimate(ctx context.Context, provider *ethrpc.Provider, address common.Address, ...) (uint64, error)
- func (e *Estimator) EstimateCall(ctx context.Context, provider *ethrpc.Provider, call *EstimateTransaction, ...) (*big.Int, error)
- func (e *Estimator) PickSigners(ctx context.Context, walletConfig WalletConfig, isEoa []bool) ([]bool, error)
- func (e *Estimator) SetCache(cache cachestore.Store) *Estimator
- type MetaTxnExecType
- type MetaTxnID
- type MetaTxnStatus
- type NetworkConfig
- type Networks
- type Receipt
- type ReceiptListener
- type ReceiptResult
- type Relayer
- type Signature
- type SignaturePart
- type SignatureParts
- type SignedTransactions
- type StateOverride
- type Transaction
- func (t *Transaction) AddToBundle(txns Transactions)
- func (t *Transaction) Bundle() Transactions
- func (t *Transaction) Clone() *Transaction
- func (t *Transaction) Digest() (common.Hash, error)
- func (t *Transaction) Execdata() ([]byte, error)
- func (t *Transaction) GuestDigest() (common.Hash, error)
- func (t *Transaction) IsBundle() bool
- func (t *Transaction) IsEncoded() bool
- func (t *Transaction) IsValid() error
- type Transactions
- func (t *Transactions) Append(txns Transactions)
- func (t Transactions) AppendBundle(txns Transactions)
- func (t Transactions) AsValues() []Transaction
- func (t Transactions) Clone() Transactions
- func (t Transactions) EncodeRaw() ([]byte, error)
- func (t Transactions) EncodedTransactions() ([]Transaction, error)
- func (t *Transactions) Prepend(txns Transactions)
- func (t Transactions) PrependBundle(txns Transactions)
- type Wallet
- func (w *Wallet) Address() common.Address
- func (w *Wallet) Connect(provider *ethrpc.Provider, relayer Relayer) error
- func (w *Wallet) GetChainID() *big.Int
- func (w *Wallet) GetNonce(optBlockNum ...*big.Int) (*big.Int, error)
- func (w *Wallet) GetProvider() *ethrpc.Provider
- func (w *Wallet) GetRelayer() Relayer
- func (w *Wallet) GetSigner(address common.Address) (*ethwallet.Wallet, bool)
- func (w *Wallet) GetSignerAddresses() []common.Address
- func (w *Wallet) GetSignerWeight() *big.Int
- func (w *Wallet) GetTransactionCount(optBlockNum ...*big.Int) (*big.Int, error)
- func (w *Wallet) GetWalletConfig() WalletConfig
- func (w *Wallet) GetWalletContext() WalletContext
- func (w *Wallet) ImageHash() (common.Hash, error)
- func (w *Wallet) IsDeployed() (bool, error)
- func (w *Wallet) IsSignerAvailable(address common.Address) bool
- func (w *Wallet) IsValidSignature(digest common.Hash, signature []byte) (bool, error)
- func (w *Wallet) SendTransaction(ctx context.Context, signedTxns *SignedTransactions) (MetaTxnID, *types.Transaction, ethtxn.WaitReceipt, error)
- func (w *Wallet) SendTransactions(ctx context.Context, signedTxns *SignedTransactions) (MetaTxnID, *types.Transaction, ethtxn.WaitReceipt, error)
- func (w *Wallet) SetChainID(chainID *big.Int)
- func (w *Wallet) SetProvider(provider *ethrpc.Provider) error
- func (w *Wallet) SetRelayer(relayer Relayer) error
- func (w *Wallet) SignDigest(digest common.Hash) ([]byte, *Signature, error)
- func (w *Wallet) SignMessage(msg []byte) ([]byte, *Signature, error)
- func (w *Wallet) SignTransaction(ctx context.Context, txn *Transaction) (*SignedTransactions, error)
- func (w *Wallet) SignTransactions(ctx context.Context, txns Transactions) (*SignedTransactions, error)
- func (w *Wallet) UseConfig(config WalletConfig) (*Wallet, error)
- func (w *Wallet) UseSigners(signers ...*ethwallet.Wallet) (*Wallet, error)
- type WalletConfig
- type WalletConfigSigner
- type WalletConfigSigners
- type WalletContext
- type WalletOptions
Constants ¶
const WalletContractBytecode = "0x603a600e3d39601a805130553df3363d3d373d3d3d363d30545af43d82803e903d91601857fd5bf3"
https://github.com/0xsequence/wallet-contracts/blob/master/src/contracts/Wallet.sol#L57-L59
Variables ¶
var ( // NonceChangeEventSig is the signature event emitted as the first event on the batch execution // 0x1f180c27086c7a39ea2a7b25239d1ab92348f07ca7bb59d1438fcf527568f881 NonceChangeEventSig = MustEncodeSig("NonceChange(uint256,uint256)") // TxFailedEventSig is the signature event emitted in a failed smart-wallet meta-transaction batch // 0x3dbd1590ea96dd3253a91f24e64e3a502e1225d602a5731357bc12643070ccd7 TxFailedEventSig = MustEncodeSig("TxFailed(bytes32,bytes)") // TxExecutedEventSig is the signature of the event emitted in a successful transaction // ........ TxExecutedEventSig = MustEncodeSig("TxExecuted(bytes32)") )
Transaction events as defined in wallet-contracts IModuleCalls.sol
var ( ErrUnknownChainID = fmt.Errorf("chainID is unknown") ErrProviderNotSet = fmt.Errorf("provider is not set") ErrRelayerNotSet = fmt.Errorf("relayer is not set") )
var ( // ImageHashUpdatedEventSig is emitted anytime wallet config is updated. ImageHashUpdatedEventSig = MustEncodeSig("ImageHashUpdated(bytes32)") // ImplementationUpdatedEventSig is emitted anytime a wallet's mainModule is changed, // this is a rare occurence. ImplementationUpdatedEventSig = MustEncodeSig("ImplementationUpdated(address)") )
Functions ¶
func AddressFromImageHash ¶
func AddressFromImageHash(imageHash string, context WalletContext) (common.Address, error)
func AddressFromWalletConfig ¶
func AddressFromWalletConfig(walletConfig WalletConfig, context WalletContext) (common.Address, error)
func BuildProxy ¶ added in v0.4.4
BuildProxy for address based on https://eips.ethereum.org/EIPS/eip-1167 the bytecode contains an aditional SLOAD to mimic the Sequence proxies bytecode:
| 0x00000000 36 calldatasize cds | 0x00000001 3d returndatasize 0 cds | 0x00000002 3d returndatasize 0 0 cds | 0x00000003 37 calldatacopy | 0x00000004 30 address addr | 0x00000005 54 sload stub | 0x00000006 50 pop | 0x00000007 3d returndatasize 0 | 0x00000008 3d returndatasize 0 0 | 0x00000009 3d returndatasize 0 0 0 | 0x0000000a 36 calldatasize cds 0 0 0 | 0x0000000b 3d returndatasize 0 cds 0 0 0 | 0x0000000c 73bebebebebe. push20 0xbebebebe 0xbebe 0 cds 0 0 0 | 0x00000020 5a gas gas 0xbebe 0 cds 0 0 0 | 0x00000021 f4 delegatecall suc 0 | 0x00000022 3d returndatasize rds suc 0 | 0x00000023 82 dup3 0 rds suc 0 | 0x00000024 80 dup1 0 0 rds suc 0 | 0x00000025 3e returndatacopy suc 0 | 0x00000026 90 swap1 0 suc | 0x00000027 3d returndatasize rds 0 suc | 0x00000028 91 swap2 suc 0 rds | 0x00000029 602d push1 0x2e 0x2e suc 0 rds | ,=< 0x0000002b 57 jumpi 0 rds | | 0x0000002c fd revert | `-> 0x0000002d 5b jumpdest 0 rds \ 0x0000002e f3 return
func ComputeGuestExecDigest ¶ added in v0.3.3
func ComputeGuestExecDigest(txns Transactions) (common.Hash, error)
func ComputeSelfExecDigest ¶ added in v0.3.3
func ComputeSelfExecDigest(txns Transactions) (common.Hash, error)
func ComputeWalletExecDigest ¶ added in v0.3.3
func DecodeNonce ¶
DecodeNonce raw nonce, returns (space, nonce)
func DecodeNonceChangeEvent ¶ added in v0.3.1
func DecodeRevertReason ¶ added in v0.3.3
func DecodeTxFailedEvent ¶ added in v0.3.1
func DeploySequenceWallet ¶
func DeploySequenceWallet(sender *ethwallet.Wallet, walletConfig WalletConfig, walletContext WalletContext) (common.Address, *types.Transaction, ethtxn.WaitReceipt, error)
func EncodeNonce ¶
EncodeNonce with space
func EncodeTransactionsForRelaying ¶
func EncodeTransactionsForRelaying(relayer Relayer, walletConfig WalletConfig, walletContext WalletContext, txns Transactions, nonce *big.Int, seqSig []byte) (common.Address, []byte, error)
returns `to` address (either guest or wallet) and `data` of signed-metatx-calldata, aka execdata
func EncodeWalletDeployment ¶ added in v0.3.3
func EncodeWalletDeployment(walletConfig WalletConfig, walletContext WalletContext) (common.Address, common.Address, []byte, error)
func GenerateRandomNonce ¶
GenerateRandomNonce returns a random space for a nonce to ensure transactions can be executed in parallel.
func GetWalletNonce ¶
func ImageHashOfWalletConfig ¶
func ImageHashOfWalletConfig(walletConfig WalletConfig) (string, error)
func ImageHashOfWalletConfigBytes ¶
func ImageHashOfWalletConfigBytes(walletConfig WalletConfig) ([]byte, error)
func IsTxExecutedEvent ¶ added in v0.3.1
func IsValidSignature ¶
func IsWalletConfigEqual ¶
func IsWalletConfigEqual(walletConfigA, walletConfigB WalletConfig) bool
func IsWalletConfigUsable ¶
func IsWalletConfigUsable(walletConfig WalletConfig) (bool, error)
func IsWalletDeployed ¶
func MessageDigest ¶
func MustEncodeSig ¶
func PackMessageData ¶
PackMessageData encodes a Sequence contract "message"
func SortWalletConfig ¶
func SortWalletConfig(walletConfig WalletConfig) error
func ValidateSequenceAccountProof ¶
func ValidateSequenceAccountProof() ethauth.ValidatorFunc
func ValidateSequenceAccountProofWith ¶
func ValidateSequenceAccountProofWith(factory, mainModule common.Address) ethauth.ValidatorFunc
Types ¶
type BlockOfReceipts ¶ added in v0.4.17
type BlockOfReceipts []*ReceiptResult
type CallOverride ¶ added in v0.4.0
type CallOverride struct {
Code string
Balance *big.Int
Nonce *big.Int
StateDiff []*StateOverride
State []*StateOverride
}
type EstimateTransaction ¶ added in v0.4.0
type Estimator ¶ added in v0.4.0
type Estimator struct {
BaseCost uint64
DataOneCost uint64
DataZeroCost uint64
// contains filtered or unexported fields
}
func NewEstimator ¶ added in v0.4.0
func NewEstimator() *Estimator
func (*Estimator) BuildStubSignature ¶ added in v0.4.0
func (e *Estimator) BuildStubSignature(walletConfig WalletConfig, willSign []bool, isEoa []bool) []byte