#marketplaces #helper #swap #cw721 #cw721-marketplace #cw721-marketplace-permissioned #cw721-marketplace-single-collection

cw721-marketplace-utils

Utility types and helpers for cw721-marketplace, cw721-marketplace-permissioned and cw721-marketplace-single-collection

1 unstable release

0.1.5 May 17, 2024

#13 in #cw721

Download history 126/week @ 2024-05-13 30/week @ 2024-05-20 4/week @ 2024-05-27 9/week @ 2024-06-03 20/week @ 2024-06-10

74 downloads per month
Used in 3 crates

Apache-2.0

8KB
104 lines

Cw721-marketplace-utils

Utility functions, types and helpers intended for use in the following packages:

  • cw721-marketplace
  • cw721-marketplace-permissioned
  • cw721-marketplace-single-collection

This package was created to reduce the amount of redundant code inside the above 3 very similar packages.

Query

PageResult{swaps, page, total} - A formatter struct for paginated swaps data

ListResponse{swaps} - Response type for entry point List

DetailsResponse{creator, contract, payment_token, token_id, expires, price, swap_type} - Response type for entry point Details

Swap

SwapType{Offer, Sale} - Enum type for CW721Swap that distinguishes whether the cw721 token is for sale by owner, or being bid on buy a potential buyer.

CW721Swap{id, creator, nft_contract, payment_token, token_id, expires, price, swap_type} - Struct for creating or finishing a cw721 marketplace swap using entry point Create or entry point Finish

Fees

FeeSplit{marketplace, seller} - A formatter struct for split ratios for marketplaces that collect a fee share of swaps when the Finish entry point is executed.

fee_percentage(amount, share_percent) - Utility function that bifurcates a price value into a FeeSplit when given a swap price and a percentage amount.


XXX Note: This package is a work in progress and part of an unfinished journey of deduplicating redundant code in the cw721 marketplace repostories.

Dependencies

~3.5–5MB
~111K SLoC