txm

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const FeeMargin uint32 = 115
View Source
const (
	MaxQueueLen = 1000
)
View Source
const RPCNonceErrMsg = "Invalid transaction nonce"

Variables

View Source
var ErrBadAdapterEncoding = errors.New("failed to decode raw signature as adapter signature")
View Source
var (
	// seed = 0 keys for starknet-devnet
	PrivateKeys0Seed = []string{
		"0xe3e70682c2094cac629f6fbed82c07cd",
		"0xf728b4fa42485e3a0a5d2f346baa9455",
		"0xeb1167b367a9c3787c65c1e582e2e662",
		"0xf7c1bd874da5e709d4713d60c8a70639",
		"0xe443df789558867f5ba91faf7a024204",
		"0x23a7711a8133287637ebdcd9e87a1613",
		"0x1846d424c17c627923c6612f48268673",
		"0xfcbd04c340212ef7cca5a5a19e4d6e3c",
		"0xb4862b21fb97d43588561712e8e5216a",
		"0x259f4329e6f4590b9a164106cf6a659e",
	}
)

Functions

func SetupLocalStarknetNode

func SetupLocalStarknetNode(t *testing.T) string

SetupLocalStarknetNode sets up a local starknet node via cli, and returns the url

func TestKeys

func TestKeys(t *testing.T, count int) (rawkeys [][]byte)

Types

type AccountStore

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

func NewAccountStore

func NewAccountStore() *AccountStore

func (*AccountStore) CreateTxStore

func (c *AccountStore) CreateTxStore(accountAddress *felt.Felt, initialNonce *felt.Felt) (*TxStore, error)

func (*AccountStore) GetAllUnconfirmed

func (c *AccountStore) GetAllUnconfirmed() map[string][]*UnconfirmedTx

func (*AccountStore) GetTotalInflightCount

func (c *AccountStore) GetTotalInflightCount() int

func (*AccountStore) GetTxStore

func (c *AccountStore) GetTxStore(accountAddress *felt.Felt) *TxStore

GetTxStore returns the TxStore for the provided account.

type Config

type Config interface {
	ConfirmationPoll() time.Duration
	TxTimeout() time.Duration
}

txm config

type KeystoreAdapter

type KeystoreAdapter interface {
	starknetaccount.Keystore
	Loopp() loop.Keystore
}

KeystoreAdapter is a starknet-specific adaption layer to translate between the generic Loop Keystore (bytes) and the type specific caigo Keystore (big.Int)

func NewKeystoreAdapter

func NewKeystoreAdapter(lk loop.Keystore) KeystoreAdapter

NewKeystoreAdapter instantiates the KeystoreAdapter interface The implementation requires that the given [looppKs] produces a signature loop.Keystore.Sign that is []byte representation of adapters.Signature Callers are responsible for ensuring that the given LOOPp Keystore encodes signatures correctly.

type StarkTXM

type StarkTXM interface {
	services.Service
	TxManager
}

func New

func New(lggr logger.Logger, keystore loop.Keystore, cfg Config, getClient func() (*starknet.Client, error),
	getFeederClient func() (*starknet.FeederClient, error)) (StarkTXM, error)

type Tx

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

type TxManager

type TxManager interface {
	Enqueue(ctx context.Context, accountAddress *felt.Felt, publicKey *felt.Felt, txFn starknetrpc.FunctionCall) error
	InflightCount() (int, int)
}

type TxStore

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

TxStore tracks broadcast & unconfirmed txs per account address per chain id

func NewTxStore

func NewTxStore(initialNonce *felt.Felt) *TxStore

func (*TxStore) AddUnconfirmed

func (s *TxStore) AddUnconfirmed(nonce *felt.Felt, hash string, call starknetrpc.FunctionCall, publicKey *felt.Felt) error

func (*TxStore) Confirm

func (s *TxStore) Confirm(nonce *felt.Felt, hash string) error

func (*TxStore) GetNextNonce

func (s *TxStore) GetNextNonce() *felt.Felt

func (*TxStore) GetUnconfirmed

func (s *TxStore) GetUnconfirmed() []*UnconfirmedTx

func (*TxStore) InflightCount

func (s *TxStore) InflightCount() int

func (*TxStore) SetNextNonce

func (s *TxStore) SetNextNonce(newNextNonce *felt.Felt) []*UnconfirmedTx

type UnconfirmedTx

type UnconfirmedTx struct {
	Hash      string
	PublicKey *felt.Felt
	Nonce     *felt.Felt
	Call      starknetrpc.FunctionCall
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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