txm

package
v0.0.1-beta-test Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const FEE_MARGIN uint64 = 115
View Source
const (
	MaxQueueLen = 1000
)

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 NewNonceManager

func NewNonceManager(lggr logger.Logger) *nonceManager

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 ChainTxStore

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

func NewChainTxStore

func NewChainTxStore() *ChainTxStore

func (*ChainTxStore) Confirm

func (c *ChainTxStore) Confirm(from caigotypes.Hash, hash string) error

func (*ChainTxStore) GetAllInflightCount

func (c *ChainTxStore) GetAllInflightCount() map[caigotypes.Hash]int

func (*ChainTxStore) GetAllUnconfirmed

func (c *ChainTxStore) GetAllUnconfirmed() map[caigotypes.Hash][]string

func (*ChainTxStore) Save

func (c *ChainTxStore) Save(from caigotypes.Hash, nonce *big.Int, hash string) error

type Config

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

txm config

type KeystoreAdapter

type KeystoreAdapter interface {
	caigo.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 NonceManager

type NonceManager interface {
	types.Service

	Register(ctx context.Context, address caigotypes.Hash, chainId string, client NonceManagerClient) error

	NextSequence(address caigotypes.Hash, chainID string) (*big.Int, error)
	IncrementNextSequence(address caigotypes.Hash, chainID string, currentNonce *big.Int) error
}

type NonceManagerClient

type NonceManagerClient interface {
	AccountNonce(context.Context, caigotypes.Hash) (*big.Int, error)
}

type StarkTXM

type StarkTXM interface {
	relaytypes.Service
	TxManager
}

func New

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

type Tx

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

type TxManager

type TxManager interface {
	Enqueue(senderAddress caigotypes.Hash, accountAddress caigotypes.Hash, txFn caigotypes.FunctionCall) error
	InflightCount() (int, int)
}

type TxStore

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

TxStore tracks broadcast & unconfirmed txs

func NewTxStore

func NewTxStore(current *big.Int) *TxStore

func (*TxStore) Confirm

func (s *TxStore) Confirm(hash string) error

func (*TxStore) GetUnconfirmed

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

func (*TxStore) InflightCount

func (s *TxStore) InflightCount() int

func (*TxStore) Save

func (s *TxStore) Save(nonce *big.Int, hash string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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