Documentation ¶
Overview ¶
Package scenario allows creating orders for testing purposes with a variety of options. It also supports setting up the necessary on-chain state for both the taker and maker.
Index ¶
- Variables
- func GetDummyERC1155AssetData(t *testing.T, tokenIDs []*big.Int, amounts []*big.Int) []byte
- func GetDummyERC721AssetData(tokenID *big.Int) []byte
- func GetTestSignerFn(signerAddress common.Address) ...
- func NewSignedTestOrder(t *testing.T, opts ...orderopts.Option) *zeroex.SignedOrder
- func NewSignedTestOrdersBatch(t *testing.T, numOrders int, ...) []*zeroex.SignedOrder
- func NewTestOrder(t *testing.T, opts ...orderopts.Option) *zeroex.Order
- func OptionsForAll(opts ...orderopts.Option) func(_ int) []orderopts.Option
Constants ¶
This section is empty.
Variables ¶
var ( ZRXAssetData = constants.ZRXAssetData WETHAssetData = constants.WETHAssetData )
Functions ¶
func GetDummyERC721AssetData ¶
func GetTestSignerFn ¶
func GetTestSignerFn(signerAddress common.Address) func(signer types.Signer, address common.Address, tx *types.Transaction) (*types.Transaction, error)
GetTestSignerFn returns a test signer function that can be used to sign Ethereum transactions
func NewSignedTestOrder ¶
func NewSignedTestOrdersBatch ¶
func NewSignedTestOrdersBatch(t *testing.T, numOrders int, optionsForIndex func(index int) []orderopts.Option) []*zeroex.SignedOrder
NewSignedTestOrdersBatch efficiently creates numOrders orders with independent options. If the options require setting up maker or taker state, that state will be set up efficiently with one transaction per address.
optionsForIndex is a function which returns the options for creating the order at a specific index (between 0 and numOrders). For example, you can create ERC721 orders which each have a unique token ID. optionsForIndex can be nil to always use the default options. It can return nil to use the default options for an order at a specific index.
func OptionsForAll ¶
OptionsForAll is a convenience function which can be used in combination with NewSignedTestOrdersBatch when you want all orders to be created with the same options. It returns a function which can be used as optionsForIndex which always returns the given options, regardless of the index.
Types ¶
This section is empty.