@maxion-platform/ronin-market-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1141 -0
- package/dist/cjs/actions/approve-token/index.js +64 -0
- package/dist/cjs/actions/approve-token/types.js +9 -0
- package/dist/cjs/actions/bulk-buy-token/index.js +116 -0
- package/dist/cjs/actions/buy-token/index.js +160 -0
- package/dist/cjs/actions/gift-token/index.js +49 -0
- package/dist/cjs/actions/offer/acceptOffer.js +40 -0
- package/dist/cjs/actions/offer/cancelOffer.js +27 -0
- package/dist/cjs/actions/offer/makeOffer.js +92 -0
- package/dist/cjs/actions/order/cancelOrder.js +58 -0
- package/dist/cjs/actions/order/createOrder.js +153 -0
- package/dist/cjs/actions/ron-wrapper/index.js +51 -0
- package/dist/cjs/common/constants.js +147 -0
- package/dist/cjs/configs/index.js +83 -0
- package/dist/cjs/contracts/BaseContract.js +23 -0
- package/dist/cjs/contracts/KatanaContract.js +25 -0
- package/dist/cjs/contracts/abis/collection-offer.json.js +2366 -0
- package/dist/cjs/contracts/abis/erc1155.json.js +823 -0
- package/dist/cjs/contracts/abis/erc20.json.js +232 -0
- package/dist/cjs/contracts/abis/erc721.json.js +825 -0
- package/dist/cjs/contracts/abis/katana.json.js +1034 -0
- package/dist/cjs/contracts/abis/market-gateway-multisend.json.js +394 -0
- package/dist/cjs/contracts/abis/market-gateway.json.js +774 -0
- package/dist/cjs/contracts/abis/multicall.json.js +349 -0
- package/dist/cjs/contracts/abis/royalty-registry.json.js +952 -0
- package/dist/cjs/contracts/abis/types/v5/factories/CollectionOffer__factory.js +2352 -0
- package/dist/cjs/contracts/abis/types/v5/factories/Erc1155OrderExchange__factory.js +876 -0
- package/dist/cjs/contracts/abis/types/v5/factories/Erc1155__factory.js +813 -0
- package/dist/cjs/contracts/abis/types/v5/factories/Erc20__factory.js +240 -0
- package/dist/cjs/contracts/abis/types/v5/factories/Erc721__factory.js +814 -0
- package/dist/cjs/contracts/abis/types/v5/factories/Katana__factory.js +1041 -0
- package/dist/cjs/contracts/abis/types/v5/factories/MarketGatewayMultisend__factory.js +398 -0
- package/dist/cjs/contracts/abis/types/v5/factories/MarketGateway__factory.js +773 -0
- package/dist/cjs/contracts/abis/types/v5/factories/MavisExchange__factory.js +842 -0
- package/dist/cjs/contracts/abis/types/v5/factories/Multicall__factory.js +355 -0
- package/dist/cjs/contracts/abis/types/v5/factories/RoyaltyRegistry__factory.js +949 -0
- package/dist/cjs/contracts/abis/types/v5/factories/Wron__factory.js +476 -0
- package/dist/cjs/contracts/abis/types/v5/factories/index.js +31 -0
- package/dist/cjs/contracts/abis/wron.json.js +478 -0
- package/dist/cjs/contracts/index.js +70 -0
- package/dist/cjs/contracts/market-gateway/Erc1155MarketGatewayContract.js +104 -0
- package/dist/cjs/contracts/market-gateway/MarketGatewayContract.js +102 -0
- package/dist/cjs/contracts/market-gateway/MarketGatewayMultisendContract.js +157 -0
- package/dist/cjs/contracts/market-gateway/factory.js +20 -0
- package/dist/cjs/index.js +278 -0
- package/dist/cjs/queries/collection/index.js +44 -0
- package/dist/cjs/queries/collection/types.js +8 -0
- package/dist/cjs/queries/exchange-rate/index.js +11 -0
- package/dist/cjs/queries/graphql/fragments/asset.js +24 -0
- package/dist/cjs/queries/graphql/fragments/collection.js +32 -0
- package/dist/cjs/queries/graphql/fragments/offer.js +61 -0
- package/dist/cjs/queries/graphql/fragments/order.js +77 -0
- package/dist/cjs/queries/graphql/fragments/profile.js +37 -0
- package/dist/cjs/queries/graphql/fragments/token.js +217 -0
- package/dist/cjs/queries/graphql/index.js +37 -0
- package/dist/cjs/queries/graphql/mutations/metadata.js +11 -0
- package/dist/cjs/queries/graphql/mutations/order.js +15 -0
- package/dist/cjs/queries/graphql/queries/collection.js +80 -0
- package/dist/cjs/queries/graphql/queries/exchange-rate.js +27 -0
- package/dist/cjs/queries/graphql/queries/offer.js +102 -0
- package/dist/cjs/queries/graphql/queries/order.js +105 -0
- package/dist/cjs/queries/graphql/queries/token.js +390 -0
- package/dist/cjs/queries/offer/index.js +92 -0
- package/dist/cjs/queries/offer/types.js +11 -0
- package/dist/cjs/queries/order/index.js +90 -0
- package/dist/cjs/queries/order/types.js +43 -0
- package/dist/cjs/queries/token/index.js +226 -0
- package/dist/cjs/queries/token/types.js +24 -0
- package/dist/cjs/services/balance/checkIsInsufficientBalance.js +16 -0
- package/dist/cjs/services/balance/fetchBalances.js +27 -0
- package/dist/cjs/services/order/bulkSettleOrders.js +26 -0
- package/dist/cjs/services/order/checkIsOrderValid.js +72 -0
- package/dist/cjs/services/order/generateOrderData.js +86 -0
- package/dist/cjs/services/order/getNonce.js +13 -0
- package/dist/cjs/services/order/getOrderSignature.js +18 -0
- package/dist/cjs/services/order/getOrderState.js +39 -0
- package/dist/cjs/services/order/getOrdersByCriteria.js +38 -0
- package/dist/cjs/services/order/getOrdersByQuantity.js +23 -0
- package/dist/cjs/services/order/getOrdersTotalPrice.js +46 -0
- package/dist/cjs/services/order/getSwapTokenData.js +41 -0
- package/dist/cjs/services/order/settleOrder.js +141 -0
- package/dist/cjs/services/tokens/checkIsTokenApproved.js +47 -0
- package/dist/cjs/services/tokens/configs.js +163 -0
- package/dist/cjs/services/tokens/data.js +150 -0
- package/dist/cjs/services/tokens/getPaymentTokens.js +14 -0
- package/dist/cjs/services/tokens/getTokensNeedToApprove.js +26 -0
- package/dist/cjs/services/tokens/getTokensNeedToApproveByOrders.js +31 -0
- package/dist/cjs/types/index.js +23 -0
- package/dist/cjs/types/order.js +13 -0
- package/dist/cjs/utils/convertPrice.js +13 -0
- package/dist/cjs/utils/getSpenderContractAddress.js +17 -0
- package/dist/cjs/utils/mapData.js +65 -0
- package/dist/mjs/actions/approve-token/index.js +47 -0
- package/dist/mjs/actions/approve-token/types.js +7 -0
- package/dist/mjs/actions/bulk-buy-token/index.js +86 -0
- package/dist/mjs/actions/buy-token/index.js +126 -0
- package/dist/mjs/actions/gift-token/index.js +27 -0
- package/dist/mjs/actions/offer/acceptOffer.js +15 -0
- package/dist/mjs/actions/offer/cancelOffer.js +3 -0
- package/dist/mjs/actions/offer/makeOffer.js +63 -0
- package/dist/mjs/actions/order/cancelOrder.js +32 -0
- package/dist/mjs/actions/order/createOrder.js +122 -0
- package/dist/mjs/actions/ron-wrapper/index.js +24 -0
- package/dist/mjs/common/constants.js +139 -0
- package/dist/mjs/configs/index.js +72 -0
- package/dist/mjs/contracts/BaseContract.js +15 -0
- package/dist/mjs/contracts/KatanaContract.js +19 -0
- package/dist/mjs/contracts/abis/collection-offer.json.js +2360 -0
- package/dist/mjs/contracts/abis/erc1155.json.js +817 -0
- package/dist/mjs/contracts/abis/erc20.json.js +226 -0
- package/dist/mjs/contracts/abis/erc721.json.js +819 -0
- package/dist/mjs/contracts/abis/katana.json.js +1028 -0
- package/dist/mjs/contracts/abis/market-gateway-multisend.json.js +388 -0
- package/dist/mjs/contracts/abis/market-gateway.json.js +768 -0
- package/dist/mjs/contracts/abis/multicall.json.js +343 -0
- package/dist/mjs/contracts/abis/royalty-registry.json.js +946 -0
- package/dist/mjs/contracts/abis/types/v5/factories/CollectionOffer__factory.js +2346 -0
- package/dist/mjs/contracts/abis/types/v5/factories/Erc1155OrderExchange__factory.js +870 -0
- package/dist/mjs/contracts/abis/types/v5/factories/Erc1155__factory.js +807 -0
- package/dist/mjs/contracts/abis/types/v5/factories/Erc20__factory.js +234 -0
- package/dist/mjs/contracts/abis/types/v5/factories/Erc721__factory.js +808 -0
- package/dist/mjs/contracts/abis/types/v5/factories/Katana__factory.js +1035 -0
- package/dist/mjs/contracts/abis/types/v5/factories/MarketGatewayMultisend__factory.js +392 -0
- package/dist/mjs/contracts/abis/types/v5/factories/MarketGateway__factory.js +767 -0
- package/dist/mjs/contracts/abis/types/v5/factories/MavisExchange__factory.js +836 -0
- package/dist/mjs/contracts/abis/types/v5/factories/Multicall__factory.js +349 -0
- package/dist/mjs/contracts/abis/types/v5/factories/RoyaltyRegistry__factory.js +943 -0
- package/dist/mjs/contracts/abis/types/v5/factories/Wron__factory.js +470 -0
- package/dist/mjs/contracts/abis/types/v5/factories/index.js +3 -0
- package/dist/mjs/contracts/abis/wron.json.js +472 -0
- package/dist/mjs/contracts/index.js +40 -0
- package/dist/mjs/contracts/market-gateway/Erc1155MarketGatewayContract.js +94 -0
- package/dist/mjs/contracts/market-gateway/MarketGatewayContract.js +91 -0
- package/dist/mjs/contracts/market-gateway/MarketGatewayMultisendContract.js +146 -0
- package/dist/mjs/contracts/market-gateway/factory.js +10 -0
- package/dist/mjs/index.js +1 -0
- package/dist/mjs/queries/collection/index.js +29 -0
- package/dist/mjs/queries/collection/types.js +6 -0
- package/dist/mjs/queries/exchange-rate/index.js +4 -0
- package/dist/mjs/queries/graphql/fragments/asset.js +17 -0
- package/dist/mjs/queries/graphql/fragments/collection.js +25 -0
- package/dist/mjs/queries/graphql/fragments/offer.js +53 -0
- package/dist/mjs/queries/graphql/fragments/order.js +68 -0
- package/dist/mjs/queries/graphql/fragments/profile.js +29 -0
- package/dist/mjs/queries/graphql/fragments/token.js +199 -0
- package/dist/mjs/queries/graphql/index.js +27 -0
- package/dist/mjs/queries/graphql/mutations/metadata.js +5 -0
- package/dist/mjs/queries/graphql/mutations/order.js +8 -0
- package/dist/mjs/queries/graphql/queries/collection.js +69 -0
- package/dist/mjs/queries/graphql/queries/exchange-rate.js +21 -0
- package/dist/mjs/queries/graphql/queries/offer.js +90 -0
- package/dist/mjs/queries/graphql/queries/order.js +94 -0
- package/dist/mjs/queries/graphql/queries/token.js +368 -0
- package/dist/mjs/queries/offer/index.js +75 -0
- package/dist/mjs/queries/offer/types.js +9 -0
- package/dist/mjs/queries/order/index.js +59 -0
- package/dist/mjs/queries/order/types.js +41 -0
- package/dist/mjs/queries/token/index.js +189 -0
- package/dist/mjs/queries/token/types.js +22 -0
- package/dist/mjs/services/balance/checkIsInsufficientBalance.js +8 -0
- package/dist/mjs/services/balance/fetchBalances.js +15 -0
- package/dist/mjs/services/order/bulkSettleOrders.js +17 -0
- package/dist/mjs/services/order/checkIsOrderValid.js +47 -0
- package/dist/mjs/services/order/generateOrderData.js +76 -0
- package/dist/mjs/services/order/getNonce.js +6 -0
- package/dist/mjs/services/order/getOrderSignature.js +10 -0
- package/dist/mjs/services/order/getOrderState.js +28 -0
- package/dist/mjs/services/order/getOrdersByCriteria.js +26 -0
- package/dist/mjs/services/order/getOrdersByQuantity.js +19 -0
- package/dist/mjs/services/order/getOrdersTotalPrice.js +36 -0
- package/dist/mjs/services/order/getSwapTokenData.js +25 -0
- package/dist/mjs/services/order/settleOrder.js +122 -0
- package/dist/mjs/services/tokens/checkIsTokenApproved.js +35 -0
- package/dist/mjs/services/tokens/configs.js +153 -0
- package/dist/mjs/services/tokens/data.js +143 -0
- package/dist/mjs/services/tokens/getPaymentTokens.js +7 -0
- package/dist/mjs/services/tokens/getTokensNeedToApprove.js +18 -0
- package/dist/mjs/services/tokens/getTokensNeedToApproveByOrders.js +22 -0
- package/dist/mjs/types/index.js +10 -0
- package/dist/mjs/types/order.js +11 -0
- package/dist/mjs/utils/convertPrice.js +7 -0
- package/dist/mjs/utils/getSpenderContractAddress.js +10 -0
- package/dist/mjs/utils/mapData.js +43 -0
- package/dist/types/actions/approve-token/index.d.ts +8 -0
- package/dist/types/actions/approve-token/index.d.ts.map +1 -0
- package/dist/types/actions/approve-token/types.d.ts +25 -0
- package/dist/types/actions/approve-token/types.d.ts.map +1 -0
- package/dist/types/actions/bulk-buy-token/index.d.ts +4 -0
- package/dist/types/actions/bulk-buy-token/index.d.ts.map +1 -0
- package/dist/types/actions/bulk-buy-token/types.d.ts +25 -0
- package/dist/types/actions/bulk-buy-token/types.d.ts.map +1 -0
- package/dist/types/actions/buy-token/index.d.ts +8 -0
- package/dist/types/actions/buy-token/index.d.ts.map +1 -0
- package/dist/types/actions/buy-token/types.d.ts +28 -0
- package/dist/types/actions/buy-token/types.d.ts.map +1 -0
- package/dist/types/actions/gift-token/index.d.ts +6 -0
- package/dist/types/actions/gift-token/index.d.ts.map +1 -0
- package/dist/types/actions/gift-token/types.d.ts +16 -0
- package/dist/types/actions/gift-token/types.d.ts.map +1 -0
- package/dist/types/actions/index.d.ts +8 -0
- package/dist/types/actions/index.d.ts.map +1 -0
- package/dist/types/actions/offer/acceptOffer.d.ts +3 -0
- package/dist/types/actions/offer/acceptOffer.d.ts.map +1 -0
- package/dist/types/actions/offer/cancelOffer.d.ts +3 -0
- package/dist/types/actions/offer/cancelOffer.d.ts.map +1 -0
- package/dist/types/actions/offer/index.d.ts +5 -0
- package/dist/types/actions/offer/index.d.ts.map +1 -0
- package/dist/types/actions/offer/makeOffer.d.ts +3 -0
- package/dist/types/actions/offer/makeOffer.d.ts.map +1 -0
- package/dist/types/actions/offer/types.d.ts +21 -0
- package/dist/types/actions/offer/types.d.ts.map +1 -0
- package/dist/types/actions/order/cancelOrder.d.ts +5 -0
- package/dist/types/actions/order/cancelOrder.d.ts.map +1 -0
- package/dist/types/actions/order/createOrder.d.ts +5 -0
- package/dist/types/actions/order/createOrder.d.ts.map +1 -0
- package/dist/types/actions/order/index.d.ts +4 -0
- package/dist/types/actions/order/index.d.ts.map +1 -0
- package/dist/types/actions/order/types.d.ts +30 -0
- package/dist/types/actions/order/types.d.ts.map +1 -0
- package/dist/types/actions/ron-wrapper/index.d.ts +5 -0
- package/dist/types/actions/ron-wrapper/index.d.ts.map +1 -0
- package/dist/types/actions/ron-wrapper/types.d.ts +9 -0
- package/dist/types/actions/ron-wrapper/types.d.ts.map +1 -0
- package/dist/types/common/constants.d.ts +24 -0
- package/dist/types/common/constants.d.ts.map +1 -0
- package/dist/types/common/index.d.ts +2 -0
- package/dist/types/common/index.d.ts.map +1 -0
- package/dist/types/configs/index.d.ts +28 -0
- package/dist/types/configs/index.d.ts.map +1 -0
- package/dist/types/contracts/BaseContract.d.ts +6 -0
- package/dist/types/contracts/BaseContract.d.ts.map +1 -0
- package/dist/types/contracts/KatanaContract.d.ts +9 -0
- package/dist/types/contracts/KatanaContract.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/CollectionOffer.d.ts +871 -0
- package/dist/types/contracts/abis/types/v5/CollectionOffer.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/Erc1155.d.ts +535 -0
- package/dist/types/contracts/abis/types/v5/Erc1155.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/Erc1155OrderExchange.d.ts +522 -0
- package/dist/types/contracts/abis/types/v5/Erc1155OrderExchange.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/Erc20.d.ts +169 -0
- package/dist/types/contracts/abis/types/v5/Erc20.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/Erc721.d.ts +547 -0
- package/dist/types/contracts/abis/types/v5/Erc721.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/Katana.d.ts +548 -0
- package/dist/types/contracts/abis/types/v5/Katana.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/MarketGateway.d.ts +543 -0
- package/dist/types/contracts/abis/types/v5/MarketGateway.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/MarketGatewayMultisend.d.ts +267 -0
- package/dist/types/contracts/abis/types/v5/MarketGatewayMultisend.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/MavisExchange.d.ts +508 -0
- package/dist/types/contracts/abis/types/v5/MavisExchange.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/Multicall.d.ts +219 -0
- package/dist/types/contracts/abis/types/v5/Multicall.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/RoyaltyRegistry.d.ts +497 -0
- package/dist/types/contracts/abis/types/v5/RoyaltyRegistry.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/Wron.d.ts +348 -0
- package/dist/types/contracts/abis/types/v5/Wron.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/common.d.ts +23 -0
- package/dist/types/contracts/abis/types/v5/common.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/factories/CollectionOffer__factory.d.ts +1826 -0
- package/dist/types/contracts/abis/types/v5/factories/CollectionOffer__factory.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/factories/Erc1155OrderExchange__factory.d.ts +672 -0
- package/dist/types/contracts/abis/types/v5/factories/Erc1155OrderExchange__factory.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/factories/Erc1155__factory.d.ts +626 -0
- package/dist/types/contracts/abis/types/v5/factories/Erc1155__factory.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/factories/Erc20__factory.d.ts +176 -0
- package/dist/types/contracts/abis/types/v5/factories/Erc20__factory.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/factories/Erc721__factory.d.ts +620 -0
- package/dist/types/contracts/abis/types/v5/factories/Erc721__factory.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/factories/Katana__factory.d.ts +810 -0
- package/dist/types/contracts/abis/types/v5/factories/Katana__factory.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/factories/MarketGatewayMultisend__factory.d.ts +302 -0
- package/dist/types/contracts/abis/types/v5/factories/MarketGatewayMultisend__factory.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/factories/MarketGateway__factory.d.ts +588 -0
- package/dist/types/contracts/abis/types/v5/factories/MarketGateway__factory.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/factories/MavisExchange__factory.d.ts +646 -0
- package/dist/types/contracts/abis/types/v5/factories/MavisExchange__factory.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/factories/Multicall__factory.d.ts +268 -0
- package/dist/types/contracts/abis/types/v5/factories/Multicall__factory.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/factories/RoyaltyRegistry__factory.d.ts +721 -0
- package/dist/types/contracts/abis/types/v5/factories/RoyaltyRegistry__factory.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/factories/Wron__factory.d.ts +369 -0
- package/dist/types/contracts/abis/types/v5/factories/Wron__factory.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/factories/index.d.ts +13 -0
- package/dist/types/contracts/abis/types/v5/factories/index.d.ts.map +1 -0
- package/dist/types/contracts/abis/types/v5/index.d.ts +26 -0
- package/dist/types/contracts/abis/types/v5/index.d.ts.map +1 -0
- package/dist/types/contracts/index.d.ts +19 -0
- package/dist/types/contracts/index.d.ts.map +1 -0
- package/dist/types/contracts/market-gateway/Erc1155MarketGatewayContract.d.ts +46 -0
- package/dist/types/contracts/market-gateway/Erc1155MarketGatewayContract.d.ts.map +1 -0
- package/dist/types/contracts/market-gateway/MarketGatewayContract.d.ts +43 -0
- package/dist/types/contracts/market-gateway/MarketGatewayContract.d.ts.map +1 -0
- package/dist/types/contracts/market-gateway/MarketGatewayMultisendContract.d.ts +60 -0
- package/dist/types/contracts/market-gateway/MarketGatewayMultisendContract.d.ts.map +1 -0
- package/dist/types/contracts/market-gateway/factory.d.ts +6 -0
- package/dist/types/contracts/market-gateway/factory.d.ts.map +1 -0
- package/dist/types/contracts/market-gateway/index.d.ts +5 -0
- package/dist/types/contracts/market-gateway/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/queries/collection/index.d.ts +11 -0
- package/dist/types/queries/collection/index.d.ts.map +1 -0
- package/dist/types/queries/collection/queryTypes.d.ts +40 -0
- package/dist/types/queries/collection/queryTypes.d.ts.map +1 -0
- package/dist/types/queries/collection/types.d.ts +98 -0
- package/dist/types/queries/collection/types.d.ts.map +1 -0
- package/dist/types/queries/exchange-rate/index.d.ts +5 -0
- package/dist/types/queries/exchange-rate/index.d.ts.map +1 -0
- package/dist/types/queries/exchange-rate/queryTypes.d.ts +9 -0
- package/dist/types/queries/exchange-rate/queryTypes.d.ts.map +1 -0
- package/dist/types/queries/exchange-rate/types.d.ts +11 -0
- package/dist/types/queries/exchange-rate/types.d.ts.map +1 -0
- package/dist/types/queries/graphql/fragments/asset.d.ts +3 -0
- package/dist/types/queries/graphql/fragments/asset.d.ts.map +1 -0
- package/dist/types/queries/graphql/fragments/collection.d.ts +3 -0
- package/dist/types/queries/graphql/fragments/collection.d.ts.map +1 -0
- package/dist/types/queries/graphql/fragments/offer.d.ts +3 -0
- package/dist/types/queries/graphql/fragments/offer.d.ts.map +1 -0
- package/dist/types/queries/graphql/fragments/order.d.ts +3 -0
- package/dist/types/queries/graphql/fragments/order.d.ts.map +1 -0
- package/dist/types/queries/graphql/fragments/profile.d.ts +4 -0
- package/dist/types/queries/graphql/fragments/profile.d.ts.map +1 -0
- package/dist/types/queries/graphql/fragments/token.d.ts +12 -0
- package/dist/types/queries/graphql/fragments/token.d.ts.map +1 -0
- package/dist/types/queries/graphql/index.d.ts +14 -0
- package/dist/types/queries/graphql/index.d.ts.map +1 -0
- package/dist/types/queries/graphql/mutations/metadata.d.ts +2 -0
- package/dist/types/queries/graphql/mutations/metadata.d.ts.map +1 -0
- package/dist/types/queries/graphql/mutations/order.d.ts +2 -0
- package/dist/types/queries/graphql/mutations/order.d.ts.map +1 -0
- package/dist/types/queries/graphql/queries/collection.d.ts +5 -0
- package/dist/types/queries/graphql/queries/collection.d.ts.map +1 -0
- package/dist/types/queries/graphql/queries/exchange-rate.d.ts +2 -0
- package/dist/types/queries/graphql/queries/exchange-rate.d.ts.map +1 -0
- package/dist/types/queries/graphql/queries/offer.d.ts +7 -0
- package/dist/types/queries/graphql/queries/offer.d.ts.map +1 -0
- package/dist/types/queries/graphql/queries/order.d.ts +6 -0
- package/dist/types/queries/graphql/queries/order.d.ts.map +1 -0
- package/dist/types/queries/graphql/queries/token.d.ts +14 -0
- package/dist/types/queries/graphql/queries/token.d.ts.map +1 -0
- package/dist/types/queries/index.d.ts +8 -0
- package/dist/types/queries/index.d.ts.map +1 -0
- package/dist/types/queries/offer/index.d.ts +19 -0
- package/dist/types/queries/offer/index.d.ts.map +1 -0
- package/dist/types/queries/offer/queryTypes.d.ts +89 -0
- package/dist/types/queries/offer/queryTypes.d.ts.map +1 -0
- package/dist/types/queries/offer/types.d.ts +33 -0
- package/dist/types/queries/offer/types.d.ts.map +1 -0
- package/dist/types/queries/order/index.d.ts +14 -0
- package/dist/types/queries/order/index.d.ts.map +1 -0
- package/dist/types/queries/order/queryTypes.d.ts +87 -0
- package/dist/types/queries/order/queryTypes.d.ts.map +1 -0
- package/dist/types/queries/order/types.d.ts +96 -0
- package/dist/types/queries/order/types.d.ts.map +1 -0
- package/dist/types/queries/profile/index.d.ts +2 -0
- package/dist/types/queries/profile/index.d.ts.map +1 -0
- package/dist/types/queries/profile/types.d.ts +11 -0
- package/dist/types/queries/profile/types.d.ts.map +1 -0
- package/dist/types/queries/token/index.d.ts +92 -0
- package/dist/types/queries/token/index.d.ts.map +1 -0
- package/dist/types/queries/token/queryTypes.d.ts +304 -0
- package/dist/types/queries/token/queryTypes.d.ts.map +1 -0
- package/dist/types/queries/token/types.d.ts +103 -0
- package/dist/types/queries/token/types.d.ts.map +1 -0
- package/dist/types/services/balance/checkIsInsufficientBalance.d.ts +4 -0
- package/dist/types/services/balance/checkIsInsufficientBalance.d.ts.map +1 -0
- package/dist/types/services/balance/fetchBalances.d.ts +4 -0
- package/dist/types/services/balance/fetchBalances.d.ts.map +1 -0
- package/dist/types/services/balance/index.d.ts +3 -0
- package/dist/types/services/balance/index.d.ts.map +1 -0
- package/dist/types/services/index.d.ts +4 -0
- package/dist/types/services/index.d.ts.map +1 -0
- package/dist/types/services/order/bulkSettleOrders.d.ts +21 -0
- package/dist/types/services/order/bulkSettleOrders.d.ts.map +1 -0
- package/dist/types/services/order/checkIsOrderValid.d.ts +5 -0
- package/dist/types/services/order/checkIsOrderValid.d.ts.map +1 -0
- package/dist/types/services/order/generateOrderData.d.ts +6 -0
- package/dist/types/services/order/generateOrderData.d.ts.map +1 -0
- package/dist/types/services/order/getNonce.d.ts +3 -0
- package/dist/types/services/order/getNonce.d.ts.map +1 -0
- package/dist/types/services/order/getOrderSignature.d.ts +4 -0
- package/dist/types/services/order/getOrderSignature.d.ts.map +1 -0
- package/dist/types/services/order/getOrderState.d.ts +4 -0
- package/dist/types/services/order/getOrderState.d.ts.map +1 -0
- package/dist/types/services/order/getOrdersByCriteria.d.ts +4 -0
- package/dist/types/services/order/getOrdersByCriteria.d.ts.map +1 -0
- package/dist/types/services/order/getOrdersByQuantity.d.ts +4 -0
- package/dist/types/services/order/getOrdersByQuantity.d.ts.map +1 -0
- package/dist/types/services/order/getOrdersTotalPrice.d.ts +15 -0
- package/dist/types/services/order/getOrdersTotalPrice.d.ts.map +1 -0
- package/dist/types/services/order/getSwapTokenData.d.ts +9 -0
- package/dist/types/services/order/getSwapTokenData.d.ts.map +1 -0
- package/dist/types/services/order/index.d.ts +11 -0
- package/dist/types/services/order/index.d.ts.map +1 -0
- package/dist/types/services/order/settleOrder.d.ts +11 -0
- package/dist/types/services/order/settleOrder.d.ts.map +1 -0
- package/dist/types/services/tokens/checkIsTokenApproved.d.ts +6 -0
- package/dist/types/services/tokens/checkIsTokenApproved.d.ts.map +1 -0
- package/dist/types/services/tokens/configs.d.ts +71 -0
- package/dist/types/services/tokens/configs.d.ts.map +1 -0
- package/dist/types/services/tokens/data.d.ts +45 -0
- package/dist/types/services/tokens/data.d.ts.map +1 -0
- package/dist/types/services/tokens/getPaymentTokens.d.ts +11 -0
- package/dist/types/services/tokens/getPaymentTokens.d.ts.map +1 -0
- package/dist/types/services/tokens/getTokensNeedToApprove.d.ts +4 -0
- package/dist/types/services/tokens/getTokensNeedToApprove.d.ts.map +1 -0
- package/dist/types/services/tokens/getTokensNeedToApproveByOrders.d.ts +4 -0
- package/dist/types/services/tokens/getTokensNeedToApproveByOrders.d.ts.map +1 -0
- package/dist/types/services/tokens/index.d.ts +7 -0
- package/dist/types/services/tokens/index.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +11 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/order.d.ts +72 -0
- package/dist/types/types/order.d.ts.map +1 -0
- package/dist/types/types/wallet.d.ts +10 -0
- package/dist/types/types/wallet.d.ts.map +1 -0
- package/dist/types/utils/convertPrice.d.ts +3 -0
- package/dist/types/utils/convertPrice.d.ts.map +1 -0
- package/dist/types/utils/getSpenderContractAddress.d.ts +3 -0
- package/dist/types/utils/getSpenderContractAddress.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/mapData.d.ts +7 -0
- package/dist/types/utils/mapData.d.ts.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.OrderStatus = void 0;
|
|
4
|
+
(function (OrderStatus) {
|
|
5
|
+
OrderStatus["CANCELLED"] = "CANCELLED";
|
|
6
|
+
OrderStatus["EXPIRED"] = "EXPIRED";
|
|
7
|
+
OrderStatus["INVALID_ITEM_AMOUNT"] = "INVALID_ITEM_AMOUNT";
|
|
8
|
+
OrderStatus["INVALID_ITEM_AMOUNT_AND_UNAPPROVED_ITEM"] = "INVALID_ITEM_AMOUNT_AND_UNAPPROVED_ITEM";
|
|
9
|
+
OrderStatus["INVALID_WRON_APPROVE_AMOUNT"] = "INVALID_WRON_APPROVE_AMOUNT";
|
|
10
|
+
OrderStatus["INVALID_WRON_INSUFFICIENT"] = "INVALID_WRON_INSUFFICIENT";
|
|
11
|
+
OrderStatus["INVALID_WRON_INSUFFICIENT_AND_APPROVE_AMOUNT"] = "INVALID_WRON_INSUFFICIENT_AND_APPROVE_AMOUNT";
|
|
12
|
+
OrderStatus["LOCKED_ITEM"] = "LOCKED_ITEM";
|
|
13
|
+
OrderStatus["MATCHED"] = "MATCHED";
|
|
14
|
+
OrderStatus["OFFERER_CANCEL"] = "OFFERER_CANCEL";
|
|
15
|
+
OrderStatus["OPEN"] = "OPEN";
|
|
16
|
+
OrderStatus["OPENED"] = "OPENED";
|
|
17
|
+
OrderStatus["PARTIALLY_CANCELLED"] = "PARTIALLY_CANCELLED";
|
|
18
|
+
OrderStatus["PARTIALLY_EXPIRED"] = "PARTIALLY_EXPIRED";
|
|
19
|
+
OrderStatus["PARTIALLY_MATCHED"] = "PARTIALLY_MATCHED";
|
|
20
|
+
OrderStatus["PASIVELY_CANCELLED"] = "PASIVELY_CANCELLED";
|
|
21
|
+
OrderStatus["REOPEN"] = "REOPEN";
|
|
22
|
+
OrderStatus["REVALID_WRON_SUFFICIENT"] = "REVALID_WRON_SUFFICIENT";
|
|
23
|
+
OrderStatus["TRANSFERRED_ITEM"] = "TRANSFERRED_ITEM";
|
|
24
|
+
OrderStatus["UNAPPROVED_ITEM"] = "UNAPPROVED_ITEM";
|
|
25
|
+
})(exports.OrderStatus || (exports.OrderStatus = {}));
|
|
26
|
+
exports.OrderType = void 0;
|
|
27
|
+
(function (OrderType) {
|
|
28
|
+
OrderType["Offer"] = "Offer";
|
|
29
|
+
OrderType["Sell"] = "Sell";
|
|
30
|
+
})(exports.OrderType || (exports.OrderType = {}));
|
|
31
|
+
exports.AuctionType = void 0;
|
|
32
|
+
(function (AuctionType) {
|
|
33
|
+
AuctionType["All"] = "All";
|
|
34
|
+
AuctionType["NotForSale"] = "NotForSale";
|
|
35
|
+
AuctionType["Sale"] = "Sale";
|
|
36
|
+
})(exports.AuctionType || (exports.AuctionType = {}));
|
|
37
|
+
exports.ListingSortBy = void 0;
|
|
38
|
+
(function (ListingSortBy) {
|
|
39
|
+
ListingSortBy["ExpiredAtAsc"] = "ExpiredAtAsc";
|
|
40
|
+
ListingSortBy["ExpiredAtDesc"] = "ExpiredAtDesc";
|
|
41
|
+
ListingSortBy["PriceAsc"] = "PriceAsc";
|
|
42
|
+
ListingSortBy["PriceDesc"] = "PriceDesc";
|
|
43
|
+
})(exports.ListingSortBy || (exports.ListingSortBy = {}));
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('../graphql/index.js');
|
|
4
|
+
require('../graphql/queries/collection.js');
|
|
5
|
+
var types$2 = require('../collection/types.js');
|
|
6
|
+
var metadata = require('../graphql/mutations/metadata.js');
|
|
7
|
+
var token = require('../graphql/queries/token.js');
|
|
8
|
+
var types$1 = require('../order/types.js');
|
|
9
|
+
var types = require('./types.js');
|
|
10
|
+
|
|
11
|
+
// Erc721
|
|
12
|
+
const getErc721Tokens = (params) => {
|
|
13
|
+
const { chainId, ...otherParams } = params;
|
|
14
|
+
const variables = { showMinPrice: false, ...otherParams };
|
|
15
|
+
return index.graphQLRequest({ query: token.GET_ERC721_TOKENS, variables, chainId }).then(response => {
|
|
16
|
+
const erc721Tokens = response?.erc721Tokens || {};
|
|
17
|
+
const { total, results } = erc721Tokens;
|
|
18
|
+
return {
|
|
19
|
+
total: total || 0,
|
|
20
|
+
results: results || [],
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const getErc721Token = (params) => {
|
|
25
|
+
const { chainId, ...otherParams } = params;
|
|
26
|
+
const variables = { showMinPrice: false, ...otherParams };
|
|
27
|
+
return index.graphQLRequest({ query: token.GET_ERC721_TOKEN, variables, chainId }).then(response => response?.erc721Token);
|
|
28
|
+
};
|
|
29
|
+
const getErc721TokenTransferHistory = (params) => {
|
|
30
|
+
const { chainId, ...otherParams } = params;
|
|
31
|
+
return index.graphQLRequest({
|
|
32
|
+
query: token.GET_ERC721_TRANSFER_HISTORY,
|
|
33
|
+
variables: { ...otherParams },
|
|
34
|
+
chainId,
|
|
35
|
+
}).then(response => {
|
|
36
|
+
const transferHistory = response?.erc721Token?.transferHistory || {};
|
|
37
|
+
const { total, results } = transferHistory;
|
|
38
|
+
return {
|
|
39
|
+
total: total || 0,
|
|
40
|
+
results: results || [],
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
// Erc1155
|
|
45
|
+
const getErc1155Tokens = (params) => {
|
|
46
|
+
const { chainId, ...otherParams } = params;
|
|
47
|
+
const variables = { showMinPrice: false, ...otherParams };
|
|
48
|
+
return index.graphQLRequest({ query: token.GET_ERC1155_TOKENS, variables, chainId }).then(response => {
|
|
49
|
+
const erc1155Tokens = response?.erc1155Tokens || {};
|
|
50
|
+
const { total, results } = erc1155Tokens;
|
|
51
|
+
return {
|
|
52
|
+
total: total || 0,
|
|
53
|
+
results: results || [],
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const getErc1155Token = (params) => {
|
|
58
|
+
const { chainId, ...otherParams } = params;
|
|
59
|
+
const variables = { showMinPrice: false, ...otherParams };
|
|
60
|
+
return index.graphQLRequest({ query: token.GET_ERC1155_TOKEN, variables, chainId }).then(response => response?.erc1155Token);
|
|
61
|
+
};
|
|
62
|
+
const getErc1155TokenTransferHistory = (params) => {
|
|
63
|
+
const { chainId, ...otherParams } = params;
|
|
64
|
+
return index.graphQLRequest({
|
|
65
|
+
query: token.GET_ERC1155_TRANSFER_HISTORY,
|
|
66
|
+
variables: { ...otherParams },
|
|
67
|
+
chainId,
|
|
68
|
+
}).then(response => {
|
|
69
|
+
const transferHistory = response?.erc1155Token?.transferHistory || {};
|
|
70
|
+
const { total, results } = transferHistory;
|
|
71
|
+
return {
|
|
72
|
+
total: total || 0,
|
|
73
|
+
results: results || [],
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
const getErc1155Balance = (params) => {
|
|
78
|
+
const { chainId, ...otherParams } = params;
|
|
79
|
+
return index.graphQLRequest({
|
|
80
|
+
query: token.GET_ERC1155_BALANCE,
|
|
81
|
+
variables: { ...otherParams },
|
|
82
|
+
chainId,
|
|
83
|
+
}).then(response => response?.erc1155Token?.balance);
|
|
84
|
+
};
|
|
85
|
+
const getAllTokens = (params) => {
|
|
86
|
+
const { chainId, ...otherParams } = params;
|
|
87
|
+
const variables = {
|
|
88
|
+
auctionType: types$1.AuctionType.All,
|
|
89
|
+
sort: types$1.ListingSortBy.PriceAsc,
|
|
90
|
+
tokenAddresses: [],
|
|
91
|
+
...otherParams,
|
|
92
|
+
};
|
|
93
|
+
return index.graphQLRequest({
|
|
94
|
+
query: token.GET_ALL_TOKENS,
|
|
95
|
+
variables,
|
|
96
|
+
chainId,
|
|
97
|
+
}).then(response => {
|
|
98
|
+
const results = response?.tokens || {};
|
|
99
|
+
const { total, data } = results;
|
|
100
|
+
const tokens = (data || []).map((tokenInfo) => {
|
|
101
|
+
const { erc721TokenAddress, erc721TokenId, erc721CollectionMetadata, erc721Image, erc721CdnImage, erc721Video, erc721Name, erc721Order, erc721IsLocked, } = tokenInfo;
|
|
102
|
+
const { erc1155TokenAddress, erc1155TokenId, erc1155CollectionMetadata, erc1155Image, erc1155CdnImage, erc1155Video, erc1155Name, erc1155Orders, erc1155Balance, } = tokenInfo;
|
|
103
|
+
const isErc721 = !!erc721TokenId;
|
|
104
|
+
return {
|
|
105
|
+
ercType: isErc721 ? types$2.Erc.Erc721 : types$2.Erc.Erc1155,
|
|
106
|
+
data: {
|
|
107
|
+
tokenAddress: erc721TokenAddress || erc1155TokenAddress,
|
|
108
|
+
tokenId: erc721TokenId || erc1155TokenId,
|
|
109
|
+
owner: params.owner,
|
|
110
|
+
name: erc721Name || erc1155Name,
|
|
111
|
+
image: erc721Image || erc1155Image,
|
|
112
|
+
cdnImage: erc721CdnImage || erc1155CdnImage,
|
|
113
|
+
video: erc721Video || erc1155Video,
|
|
114
|
+
isLocked: isErc721 ? erc721IsLocked : false,
|
|
115
|
+
collectionMetadata: erc721CollectionMetadata || erc1155CollectionMetadata,
|
|
116
|
+
balance: isErc721 ? null : erc1155Balance,
|
|
117
|
+
orders: isErc721 ? erc721Order : erc1155Orders,
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
total: total || 0,
|
|
123
|
+
tokens,
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
const refreshMetadata = (params) => {
|
|
128
|
+
const { chainId, ...otherParams } = params;
|
|
129
|
+
return index.graphQLRequest({
|
|
130
|
+
query: metadata.REFRESH_METADATA,
|
|
131
|
+
variables: { ...otherParams },
|
|
132
|
+
chainId,
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
const getMyErc1155TokensList = (params) => {
|
|
136
|
+
const { chainId, ...otherParams } = params;
|
|
137
|
+
return index.graphQLRequest({
|
|
138
|
+
query: token.GET_MY_ERC1155_TOKENS_LIST,
|
|
139
|
+
variables: { ...otherParams },
|
|
140
|
+
chainId,
|
|
141
|
+
}).then(response => {
|
|
142
|
+
const erc1155Tokens = response?.erc1155Tokens || {};
|
|
143
|
+
const { total, results } = erc1155Tokens;
|
|
144
|
+
return {
|
|
145
|
+
total: total || 0,
|
|
146
|
+
results: results || [],
|
|
147
|
+
};
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
const getTokenData = (params) => {
|
|
151
|
+
const { chainId, ...otherParams } = params;
|
|
152
|
+
return index.graphQLRequest({
|
|
153
|
+
query: token.GET_TOKEN_DATA,
|
|
154
|
+
variables: { ...otherParams },
|
|
155
|
+
chainId,
|
|
156
|
+
}).then(response => {
|
|
157
|
+
return response?.tokenData || null;
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
const getErc1155TokenWithOrders = (params) => {
|
|
161
|
+
const { chainId, ...otherParams } = params;
|
|
162
|
+
return index.graphQLRequest({
|
|
163
|
+
query: token.GET_ERC1155_TOKEN_WITH_ORDERS,
|
|
164
|
+
variables: { ...otherParams },
|
|
165
|
+
chainId,
|
|
166
|
+
}).then(response => {
|
|
167
|
+
return response?.erc1155Token || null;
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
const getErc1155TokensList = (params) => {
|
|
171
|
+
const { chainId, ...otherParams } = params;
|
|
172
|
+
return index.graphQLRequest({
|
|
173
|
+
query: token.GET_ERC1155_TOKENS_LIST,
|
|
174
|
+
variables: { ...otherParams },
|
|
175
|
+
chainId,
|
|
176
|
+
}).then(response => {
|
|
177
|
+
const erc1155Tokens = response?.erc1155Tokens || {};
|
|
178
|
+
const { total, results } = erc1155Tokens;
|
|
179
|
+
return {
|
|
180
|
+
total: total || 0,
|
|
181
|
+
results: results || [],
|
|
182
|
+
};
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
const getErc1155TokensListWithTraits = (params) => {
|
|
186
|
+
const { chainId, ...otherParams } = params;
|
|
187
|
+
return index.graphQLRequest({
|
|
188
|
+
query: token.GET_ERC1155_TOKENS_LIST_WITH_TRAITS,
|
|
189
|
+
variables: { ...otherParams },
|
|
190
|
+
chainId,
|
|
191
|
+
}).then(response => {
|
|
192
|
+
const erc1155Tokens = response?.erc1155Tokens || {};
|
|
193
|
+
const { total, results } = erc1155Tokens;
|
|
194
|
+
return {
|
|
195
|
+
total: total || 0,
|
|
196
|
+
results: results || [],
|
|
197
|
+
};
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
Object.defineProperty(exports, 'AttributeType', {
|
|
202
|
+
enumerable: true,
|
|
203
|
+
get: function () { return types.AttributeType; }
|
|
204
|
+
});
|
|
205
|
+
Object.defineProperty(exports, 'Erc1155SortBy', {
|
|
206
|
+
enumerable: true,
|
|
207
|
+
get: function () { return types.Erc1155SortBy; }
|
|
208
|
+
});
|
|
209
|
+
Object.defineProperty(exports, 'SortBy', {
|
|
210
|
+
enumerable: true,
|
|
211
|
+
get: function () { return types.SortBy; }
|
|
212
|
+
});
|
|
213
|
+
exports.getAllTokens = getAllTokens;
|
|
214
|
+
exports.getErc1155Balance = getErc1155Balance;
|
|
215
|
+
exports.getErc1155Token = getErc1155Token;
|
|
216
|
+
exports.getErc1155TokenTransferHistory = getErc1155TokenTransferHistory;
|
|
217
|
+
exports.getErc1155TokenWithOrders = getErc1155TokenWithOrders;
|
|
218
|
+
exports.getErc1155Tokens = getErc1155Tokens;
|
|
219
|
+
exports.getErc1155TokensList = getErc1155TokensList;
|
|
220
|
+
exports.getErc1155TokensListWithTraits = getErc1155TokensListWithTraits;
|
|
221
|
+
exports.getErc721Token = getErc721Token;
|
|
222
|
+
exports.getErc721TokenTransferHistory = getErc721TokenTransferHistory;
|
|
223
|
+
exports.getErc721Tokens = getErc721Tokens;
|
|
224
|
+
exports.getMyErc1155TokensList = getMyErc1155TokensList;
|
|
225
|
+
exports.getTokenData = getTokenData;
|
|
226
|
+
exports.refreshMetadata = refreshMetadata;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.SortBy = void 0;
|
|
4
|
+
(function (SortBy) {
|
|
5
|
+
SortBy["IdAsc"] = "IdAsc";
|
|
6
|
+
SortBy["IdDesc"] = "IdDesc";
|
|
7
|
+
SortBy["Latest"] = "Latest";
|
|
8
|
+
SortBy["PriceAsc"] = "PriceAsc";
|
|
9
|
+
SortBy["PriceDesc"] = "PriceDesc";
|
|
10
|
+
})(exports.SortBy || (exports.SortBy = {}));
|
|
11
|
+
exports.Erc1155SortBy = void 0;
|
|
12
|
+
(function (Erc1155SortBy) {
|
|
13
|
+
Erc1155SortBy["Latest"] = "Latest";
|
|
14
|
+
Erc1155SortBy["PriceAsc"] = "PriceAsc";
|
|
15
|
+
Erc1155SortBy["PriceDesc"] = "PriceDesc";
|
|
16
|
+
})(exports.Erc1155SortBy || (exports.Erc1155SortBy = {}));
|
|
17
|
+
exports.AttributeType = void 0;
|
|
18
|
+
(function (AttributeType) {
|
|
19
|
+
AttributeType["Date"] = "date";
|
|
20
|
+
AttributeType["NumberRanking"] = "number_ranking";
|
|
21
|
+
AttributeType["String"] = "string";
|
|
22
|
+
AttributeType["Number"] = "number";
|
|
23
|
+
AttributeType["Price"] = "price";
|
|
24
|
+
})(exports.AttributeType || (exports.AttributeType = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ethers = require('ethers');
|
|
4
|
+
var fetchBalances = require('./fetchBalances.js');
|
|
5
|
+
|
|
6
|
+
const checkIsInsufficientBalance = async (chainId, tokenAddress, account, amount) => {
|
|
7
|
+
const currentBalance = await fetchBalances.fetchPaymentTokenBalance(chainId, tokenAddress, account);
|
|
8
|
+
return ethers.BigNumber.from(amount).gt(currentBalance);
|
|
9
|
+
};
|
|
10
|
+
const checkIsInsufficientOfferBalance = async (chainId, account, amount) => {
|
|
11
|
+
const wRonBalance = await fetchBalances.fetchOfferBalance(chainId, account);
|
|
12
|
+
return ethers.BigNumber.from(amount).gt(wRonBalance);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
exports.checkIsInsufficientBalance = checkIsInsufficientBalance;
|
|
16
|
+
exports.checkIsInsufficientOfferBalance = checkIsInsufficientOfferBalance;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('../../contracts/index.js');
|
|
4
|
+
require('../../configs/index.js');
|
|
5
|
+
var data = require('../tokens/data.js');
|
|
6
|
+
var getPaymentTokens = require('../tokens/getPaymentTokens.js');
|
|
7
|
+
require('lodash');
|
|
8
|
+
require('ethers');
|
|
9
|
+
|
|
10
|
+
const fetchOfferBalance = (chainId, account) => {
|
|
11
|
+
const wRonContract = index.createWRonContract(chainId);
|
|
12
|
+
const readProvider = index.createReadOnlyProvider(chainId);
|
|
13
|
+
return wRonContract.connect(readProvider).balanceOf(account);
|
|
14
|
+
};
|
|
15
|
+
const fetchPaymentTokenBalance = (chainId, tokenAddress, account) => {
|
|
16
|
+
const paymentTokens = getPaymentTokens.getPaymentTokens(chainId);
|
|
17
|
+
const erc20Contract = index.createErc20Contract(tokenAddress);
|
|
18
|
+
const readProvider = index.createReadOnlyProvider(chainId);
|
|
19
|
+
const isRon = paymentTokens[data.Token.RON].address.toLowerCase() === tokenAddress.toLowerCase();
|
|
20
|
+
if (isRon) {
|
|
21
|
+
return readProvider.getBalance(account);
|
|
22
|
+
}
|
|
23
|
+
return erc20Contract.connect(readProvider).balanceOf(account);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.fetchOfferBalance = fetchOfferBalance;
|
|
27
|
+
exports.fetchPaymentTokenBalance = fetchPaymentTokenBalance;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('../../contracts/index.js');
|
|
4
|
+
var types = require('../../queries/collection/types.js');
|
|
5
|
+
|
|
6
|
+
const bulkSettleOrders = (params) => {
|
|
7
|
+
const { chainId, wallet, bulkBuyData, paymentToken, totalSettlePrice, tokenType, requiredAllSuccess = false, options, } = params;
|
|
8
|
+
if (tokenType === types.Erc.Erc721) {
|
|
9
|
+
return bulkSettleErc721Orders(chainId, wallet, bulkBuyData, paymentToken, totalSettlePrice, requiredAllSuccess, options);
|
|
10
|
+
}
|
|
11
|
+
return bulkSettleErc1155Orders(chainId, wallet, bulkBuyData, paymentToken, totalSettlePrice, requiredAllSuccess, options);
|
|
12
|
+
};
|
|
13
|
+
const bulkSettleErc721Orders = (chainId, wallet, ordersData, paymentToken, totalSettlePrice, requiredAllSuccess, options) => {
|
|
14
|
+
const { provider } = wallet;
|
|
15
|
+
const marketGatewayMultisendContract = index.createMarketGatewayMultiSendContract(chainId, provider);
|
|
16
|
+
return marketGatewayMultisendContract.bulkSettleErc721Orders(chainId, wallet, ordersData, paymentToken, totalSettlePrice, requiredAllSuccess, options);
|
|
17
|
+
};
|
|
18
|
+
const bulkSettleErc1155Orders = (chainId, wallet, ordersData, paymentToken, totalSettlePrice, requiredAllSuccess, options) => {
|
|
19
|
+
const { provider } = wallet;
|
|
20
|
+
const marketGatewayMultisendContract = index.createMarketGatewayMultiSendContract(chainId, provider);
|
|
21
|
+
return marketGatewayMultisendContract.bulkSettleErc1155Orders(chainId, wallet, ordersData, paymentToken, totalSettlePrice, requiredAllSuccess, options);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.bulkSettleErc1155Orders = bulkSettleErc1155Orders;
|
|
25
|
+
exports.bulkSettleErc721Orders = bulkSettleErc721Orders;
|
|
26
|
+
exports.bulkSettleOrders = bulkSettleOrders;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('../../contracts/index.js');
|
|
4
|
+
require('ethers');
|
|
5
|
+
var Erc1155OrderExchange__factory = require('../../contracts/abis/types/v5/factories/Erc1155OrderExchange__factory.js');
|
|
6
|
+
var MavisExchange__factory = require('../../contracts/abis/types/v5/factories/MavisExchange__factory.js');
|
|
7
|
+
require('graphql-request');
|
|
8
|
+
require('../../types/index.js');
|
|
9
|
+
require('../../queries/graphql/queries/collection.js');
|
|
10
|
+
require('../../queries/collection/types.js');
|
|
11
|
+
require('../../queries/graphql/queries/exchange-rate.js');
|
|
12
|
+
require('../../queries/graphql/queries/offer.js');
|
|
13
|
+
require('../../queries/offer/types.js');
|
|
14
|
+
require('../../queries/graphql/mutations/order.js');
|
|
15
|
+
require('../../queries/graphql/queries/order.js');
|
|
16
|
+
require('../../queries/token/types.js');
|
|
17
|
+
var types = require('../../queries/order/types.js');
|
|
18
|
+
require('../../queries/graphql/mutations/metadata.js');
|
|
19
|
+
require('../../queries/graphql/queries/token.js');
|
|
20
|
+
var generateOrderData = require('./generateOrderData.js');
|
|
21
|
+
var factory = require('../../contracts/market-gateway/factory.js');
|
|
22
|
+
|
|
23
|
+
const checkIsErc721OrderValid = async (chainId, order) => {
|
|
24
|
+
const { hash } = order;
|
|
25
|
+
const formattedHash = hash.includes('0x') ? hash : `0x${hash}`;
|
|
26
|
+
const erc721Order = generateOrderData.generateErc721Order(order);
|
|
27
|
+
const readProvider = index.createReadOnlyProvider(chainId);
|
|
28
|
+
const marketGatewayContract = factory.createMarketGatewayContract(chainId);
|
|
29
|
+
const encodedOrder = marketGatewayContract.encodeOrder(erc721Order);
|
|
30
|
+
const params = MavisExchange__factory.MavisExchange__factory.createInterface().encodeFunctionData('orderValid', [
|
|
31
|
+
formattedHash,
|
|
32
|
+
encodedOrder,
|
|
33
|
+
]);
|
|
34
|
+
const encodedResponse = await readProvider.call({
|
|
35
|
+
to: marketGatewayContract.address,
|
|
36
|
+
data: marketGatewayContract.interface.encodeFunctionData('interactWith', [
|
|
37
|
+
marketGatewayContract._orderExchangeInterface,
|
|
38
|
+
params,
|
|
39
|
+
]),
|
|
40
|
+
});
|
|
41
|
+
const result = MavisExchange__factory.MavisExchange__factory.createInterface().decodeFunctionResult('orderValid', encodedResponse);
|
|
42
|
+
return result?.[0] === true;
|
|
43
|
+
};
|
|
44
|
+
const checkIsErc1155OrderValid = async (chainId, order) => {
|
|
45
|
+
const { hash, orderStatus } = order;
|
|
46
|
+
const formattedHash = hash.includes('0x') ? hash : `0x${hash}`;
|
|
47
|
+
const invalidStatusList = [types.OrderStatus.INVALID_ITEM_AMOUNT];
|
|
48
|
+
const isInvalidOrder = invalidStatusList.includes(orderStatus);
|
|
49
|
+
if (isInvalidOrder) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
const erc1155Order = generateOrderData.generateErc1155Order(order);
|
|
53
|
+
const readProvider = index.createReadOnlyProvider(chainId);
|
|
54
|
+
const erc1155marketGatewayContract = factory.createErc1155MarketGatewayContract(chainId);
|
|
55
|
+
const encodedOrder = erc1155marketGatewayContract.encodeErc1155Order(erc1155Order);
|
|
56
|
+
const params = Erc1155OrderExchange__factory.Erc1155OrderExchange__factory.createInterface().encodeFunctionData('orderValid', [
|
|
57
|
+
formattedHash,
|
|
58
|
+
encodedOrder,
|
|
59
|
+
]);
|
|
60
|
+
const encodedResponse = await readProvider.call({
|
|
61
|
+
to: erc1155marketGatewayContract.address,
|
|
62
|
+
data: erc1155marketGatewayContract.interface.encodeFunctionData('interactWith', [
|
|
63
|
+
erc1155marketGatewayContract._orderExchangeInterface,
|
|
64
|
+
params,
|
|
65
|
+
]),
|
|
66
|
+
});
|
|
67
|
+
const result = Erc1155OrderExchange__factory.Erc1155OrderExchange__factory.createInterface().decodeFunctionResult('orderValid', encodedResponse);
|
|
68
|
+
return result?.[0] === true;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
exports.checkIsErc1155OrderValid = checkIsErc1155OrderValid;
|
|
72
|
+
exports.checkIsErc721OrderValid = checkIsErc721OrderValid;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var mapData = require('../../utils/mapData.js');
|
|
4
|
+
require('lodash');
|
|
5
|
+
require('../../configs/index.js');
|
|
6
|
+
|
|
7
|
+
const generateErc721Order = (order) => {
|
|
8
|
+
const { expiredAt, basePrice, kind, startedAt, assets, paymentToken, maker, expectedState, nonce, marketFeePercentage, } = order;
|
|
9
|
+
const result = {
|
|
10
|
+
maker: maker,
|
|
11
|
+
kind: mapData.getOrderKind(kind),
|
|
12
|
+
assets: assets.map(asset => {
|
|
13
|
+
const { address, erc, quantity, id } = asset;
|
|
14
|
+
return {
|
|
15
|
+
addr: address,
|
|
16
|
+
erc: mapData.getErcAssetItem(erc),
|
|
17
|
+
quantity: Number(quantity),
|
|
18
|
+
id: id,
|
|
19
|
+
};
|
|
20
|
+
}),
|
|
21
|
+
expiredAt: expiredAt,
|
|
22
|
+
basePrice: basePrice,
|
|
23
|
+
paymentToken: paymentToken,
|
|
24
|
+
startedAt: startedAt,
|
|
25
|
+
endedAt: 0,
|
|
26
|
+
endedPrice: '0',
|
|
27
|
+
expectedState: `${expectedState}`,
|
|
28
|
+
nonce: nonce,
|
|
29
|
+
marketFeePercentage: marketFeePercentage,
|
|
30
|
+
};
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
const generateErc1155Order = (order) => {
|
|
34
|
+
const { expiredAt, basePrice, kind, startedAt, assets, paymentToken, maker, expectedState, nonce } = order;
|
|
35
|
+
const parsedAssets = assets.map(asset => {
|
|
36
|
+
return {
|
|
37
|
+
erc: mapData.getErcAssetItem(asset.erc),
|
|
38
|
+
addr: asset.address,
|
|
39
|
+
id: asset.id,
|
|
40
|
+
quantity: asset.quantity,
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
const result = {
|
|
44
|
+
maker: maker,
|
|
45
|
+
kind: mapData.getOrderKind(kind),
|
|
46
|
+
asset: parsedAssets[0],
|
|
47
|
+
expiredAt: expiredAt,
|
|
48
|
+
unitPrice: basePrice,
|
|
49
|
+
paymentToken: paymentToken,
|
|
50
|
+
startedAt: startedAt,
|
|
51
|
+
endedAt: 0,
|
|
52
|
+
endedUnitPrice: '0',
|
|
53
|
+
expectedState: `${expectedState}`,
|
|
54
|
+
nonce: nonce,
|
|
55
|
+
};
|
|
56
|
+
return result;
|
|
57
|
+
};
|
|
58
|
+
const generateInputOrder = (data) => {
|
|
59
|
+
const { price, duration, orderType, expectedState, nonce, assets, paymentToken } = data;
|
|
60
|
+
const now = new Date().getTime();
|
|
61
|
+
const startedAt = Math.ceil(now / 1000);
|
|
62
|
+
const expiredAt = startedAt + duration;
|
|
63
|
+
const inputOrder = {
|
|
64
|
+
nonce,
|
|
65
|
+
assets: assets.map(asset => {
|
|
66
|
+
const { addr, erc, quantity, id } = asset;
|
|
67
|
+
return {
|
|
68
|
+
erc: mapData.getErcType(erc),
|
|
69
|
+
address: addr,
|
|
70
|
+
id: id,
|
|
71
|
+
quantity: quantity.toString(),
|
|
72
|
+
};
|
|
73
|
+
}),
|
|
74
|
+
startedAt,
|
|
75
|
+
expiredAt,
|
|
76
|
+
expectedState,
|
|
77
|
+
paymentToken,
|
|
78
|
+
kind: orderType,
|
|
79
|
+
basePrice: price.toString(),
|
|
80
|
+
};
|
|
81
|
+
return inputOrder;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
exports.generateErc1155Order = generateErc1155Order;
|
|
85
|
+
exports.generateErc721Order = generateErc721Order;
|
|
86
|
+
exports.generateInputOrder = generateInputOrder;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('../../contracts/index.js');
|
|
4
|
+
var factory = require('../../contracts/market-gateway/factory.js');
|
|
5
|
+
|
|
6
|
+
const getNonce = async (chainId, address) => {
|
|
7
|
+
const readProvider = index.createReadOnlyProvider(chainId);
|
|
8
|
+
const marketGatewayContract = factory.createMarketGatewayContract(chainId);
|
|
9
|
+
const nonce = await marketGatewayContract.connect(readProvider).makerNonce(address);
|
|
10
|
+
return Number(nonce);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
exports.getNonce = getNonce;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constants = require('../../common/constants.js');
|
|
4
|
+
var index = require('../../configs/index.js');
|
|
5
|
+
|
|
6
|
+
const getErc721OrderSignature = (chainId, signer, order) => {
|
|
7
|
+
const config = index.getConfig(chainId);
|
|
8
|
+
const { marketGatewayDomain } = config;
|
|
9
|
+
return signer._signTypedData(marketGatewayDomain, constants.OrderAbiTypes, order);
|
|
10
|
+
};
|
|
11
|
+
const getErc1155OrderSignature = (chainId, signer, order) => {
|
|
12
|
+
const config = index.getConfig(chainId);
|
|
13
|
+
const { marketGatewayDomain } = config;
|
|
14
|
+
return signer._signTypedData(marketGatewayDomain, constants.Erc1155OrderAbiTypes, order);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.getErc1155OrderSignature = getErc1155OrderSignature;
|
|
18
|
+
exports.getErc721OrderSignature = getErc721OrderSignature;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('../../contracts/index.js');
|
|
4
|
+
require('ethers');
|
|
5
|
+
var Erc1155OrderExchange__factory = require('../../contracts/abis/types/v5/factories/Erc1155OrderExchange__factory.js');
|
|
6
|
+
var MavisExchange__factory = require('../../contracts/abis/types/v5/factories/MavisExchange__factory.js');
|
|
7
|
+
var factory = require('../../contracts/market-gateway/factory.js');
|
|
8
|
+
|
|
9
|
+
const getErc721OrderState = async (chainId, orderAssetItem) => {
|
|
10
|
+
const marketGatewayContract = factory.createMarketGatewayContract(chainId);
|
|
11
|
+
const readProvider = index.createReadOnlyProvider(chainId);
|
|
12
|
+
const params = MavisExchange__factory.MavisExchange__factory.createInterface().encodeFunctionData('getState', [orderAssetItem]);
|
|
13
|
+
const encodedResponse = await readProvider.call({
|
|
14
|
+
to: marketGatewayContract.address,
|
|
15
|
+
data: marketGatewayContract.interface.encodeFunctionData('interactWith', [
|
|
16
|
+
marketGatewayContract._orderExchangeInterface,
|
|
17
|
+
params,
|
|
18
|
+
]),
|
|
19
|
+
});
|
|
20
|
+
const result = MavisExchange__factory.MavisExchange__factory.createInterface().decodeFunctionResult('getState', encodedResponse);
|
|
21
|
+
return result?.[0]?.toString();
|
|
22
|
+
};
|
|
23
|
+
const getErc1155OrderState = async (chainId, orderAssetItem) => {
|
|
24
|
+
const erc1155MarketGatewayContract = factory.createErc1155MarketGatewayContract(chainId);
|
|
25
|
+
const readProvider = index.createReadOnlyProvider(chainId);
|
|
26
|
+
const params = Erc1155OrderExchange__factory.Erc1155OrderExchange__factory.createInterface().encodeFunctionData('getState', [orderAssetItem]);
|
|
27
|
+
const encodedResponse = await readProvider.call({
|
|
28
|
+
to: erc1155MarketGatewayContract.address,
|
|
29
|
+
data: erc1155MarketGatewayContract.interface.encodeFunctionData('interactWith', [
|
|
30
|
+
erc1155MarketGatewayContract._orderExchangeInterface,
|
|
31
|
+
params,
|
|
32
|
+
]),
|
|
33
|
+
});
|
|
34
|
+
const result = Erc1155OrderExchange__factory.Erc1155OrderExchange__factory.createInterface().decodeFunctionResult('getState', encodedResponse);
|
|
35
|
+
return result?.[0]?.toString();
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
exports.getErc1155OrderState = getErc1155OrderState;
|
|
39
|
+
exports.getErc721OrderState = getErc721OrderState;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('graphql-request');
|
|
4
|
+
require('../../types/index.js');
|
|
5
|
+
require('../../queries/graphql/mutations/order.js');
|
|
6
|
+
require('../../queries/graphql/queries/order.js');
|
|
7
|
+
var types$1 = require('../../queries/token/types.js');
|
|
8
|
+
var types = require('../../queries/order/types.js');
|
|
9
|
+
var index = require('../../queries/token/index.js');
|
|
10
|
+
|
|
11
|
+
const getOrdersByCriteria = async (params) => {
|
|
12
|
+
const { chainId, tokenAddress, maxPrice, criteria, rangeCriteria, from = 0, size = 50 } = params;
|
|
13
|
+
if (!criteria && !rangeCriteria) {
|
|
14
|
+
throw new Error('Criteria or rangeCriteria is required');
|
|
15
|
+
}
|
|
16
|
+
if (size > 50) {
|
|
17
|
+
throw new Error('Size must be less than 50');
|
|
18
|
+
}
|
|
19
|
+
const searchParams = {
|
|
20
|
+
chainId,
|
|
21
|
+
tokenAddress,
|
|
22
|
+
from,
|
|
23
|
+
size,
|
|
24
|
+
auctionType: types.AuctionType.Sale,
|
|
25
|
+
criteria,
|
|
26
|
+
sort: types$1.SortBy.PriceAsc,
|
|
27
|
+
rangeCriteria,
|
|
28
|
+
};
|
|
29
|
+
const { results } = await index.getErc1155TokensList(searchParams);
|
|
30
|
+
const orders = results
|
|
31
|
+
.flatMap(result => result.orders || [])
|
|
32
|
+
.filter(order => {
|
|
33
|
+
return !maxPrice || BigInt(order.currentPrice) <= maxPrice;
|
|
34
|
+
});
|
|
35
|
+
return orders;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
exports.getOrdersByCriteria = getOrdersByCriteria;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const getOrdersByQuantity = (orders, quantity) => {
|
|
4
|
+
let total = 0;
|
|
5
|
+
const ordersByQuantity = [];
|
|
6
|
+
for (const order of orders) {
|
|
7
|
+
const { orderQuantity } = order;
|
|
8
|
+
const availableQuantity = Number(orderQuantity?.availableQuantity || 0);
|
|
9
|
+
if (availableQuantity === 0) {
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
const newTotal = total + availableQuantity;
|
|
13
|
+
const newQuantity = Math.min(availableQuantity, quantity - total);
|
|
14
|
+
total = newTotal;
|
|
15
|
+
ordersByQuantity.push({ quantity: newQuantity, order });
|
|
16
|
+
if (newTotal >= quantity) {
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return ordersByQuantity;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
exports.getOrdersByQuantity = getOrdersByQuantity;
|