• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

decentraland / marketplace / 6970244998

23 Nov 2023 01:18PM UTC coverage: 43.312% (+2.4%) from 40.865%
6970244998

Pull #2042

github

juanmahidalgo
feat: add missing select token and chain events
Pull Request #2042: feat: use squid to calculate route between two chains and tokens

2626 of 7307 branches covered (0.0%)

Branch coverage included in aggregate %.

277 of 382 new or added lines in 20 files covered. (72.51%)

1 existing line in 1 file now uncovered.

4634 of 9455 relevant lines covered (49.01%)

23.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/webapp/src/components/Modals/BuyWithCryptoModal/BuyWithCryptoModal.container.ts
1
import { connect } from 'react-redux'
2
import { Dispatch } from 'redux'
3
import { Item, Network } from '@dcl/schemas'
4
import { switchNetworkRequest } from 'decentraland-dapps/dist/modules/wallet/actions'
5
import { getLoading as getLoadingAuthorizations } from 'decentraland-dapps/dist/modules/authorization/selectors'
6
import { isLoadingType } from 'decentraland-dapps/dist/modules/loading/selectors'
7
import { openBuyManaWithFiatModalRequest } from 'decentraland-dapps/dist/modules/gateway/actions'
8
import { FETCH_AUTHORIZATIONS_REQUEST } from 'decentraland-dapps/dist/modules/authorization/actions'
9
import { RootState } from '../../../modules/reducer'
10
import {
11
  getWallet,
12
  isSwitchingNetwork
13
} from '../../../modules/wallet/selectors'
14
import { getLoading as getLoadingOrders } from '../../../modules/order/selectors'
15
import {
16
  EXECUTE_ORDER_REQUEST,
17
  executeOrderRequest,
18
  executeOrderWithCardRequest
19
} from '../../../modules/order/actions'
20
import { getIsBuyWithCardPage } from '../../../modules/routing/selectors'
21
import { getLoading as getItemsLoading } from '../../../modules/item/selectors'
22
import { Contract } from '../../../modules/vendor/services'
23
import { getContract } from '../../../modules/contract/selectors'
24
import { Route } from '../../../lib/xchain'
25
import {
26
  BUY_ITEM_CROSS_CHAIN_REQUEST,
27
  BUY_ITEM_REQUEST,
28
  buyItemCrossChainRequest,
29
  buyItemRequest,
30
  buyItemWithCardRequest
31
} from '../../../modules/item/actions'
32
import {
33
  MapDispatchProps,
34
  MapStateProps,
35
  OwnProps
36
} from './BuyWithCryptoModal.types'
37
import {
38
  BuyNFTWithCryptoModal,
39
  MintNFTWithCryptoModal
40
} from './BuyWithCryptoModal'
41

NEW
42
const mapState = (state: RootState): MapStateProps => {
×
NEW
43
  return {
×
44
    wallet: getWallet(state),
45
    isLoading:
46
      isLoadingType(
×
47
        getLoadingAuthorizations(state),
48
        FETCH_AUTHORIZATIONS_REQUEST
49
      ) ||
50
      isLoadingType(getLoadingOrders(state), EXECUTE_ORDER_REQUEST) ||
51
      isLoadingType(getItemsLoading(state), BUY_ITEM_REQUEST),
52
    isLoadingBuyCrossChain: isLoadingType(
53
      getItemsLoading(state),
54
      BUY_ITEM_CROSS_CHAIN_REQUEST
55
    ),
56
    isSwitchingNetwork: isSwitchingNetwork(state),
57
    isBuyWithCardPage: getIsBuyWithCardPage(state),
NEW
58
    getContract: (query: Partial<Contract>) => getContract(state, query)
×
59
  }
60
}
61

NEW
62
const mapDispatch = (
×
63
  dispatch: Dispatch,
64
  ownProps: OwnProps
NEW
65
): MapDispatchProps => ({
×
NEW
66
  onGetMana: () => dispatch(openBuyManaWithFiatModalRequest(Network.MATIC)),
×
67
  onBuyItemThroughProvider: (route: Route) =>
NEW
68
    dispatch(buyItemCrossChainRequest(ownProps.metadata.asset as Item, route)),
×
NEW
69
  onSwitchNetwork: chainId => dispatch(switchNetworkRequest(chainId)),
×
NEW
70
  onBuyItem: item => dispatch(buyItemRequest(item)),
×
71
  onExecuteOrder: (order, nft, fingerprint, silent) =>
NEW
72
    dispatch(executeOrderRequest(order, nft, fingerprint, silent)),
×
NEW
73
  onExecuteOrderWithCard: nft => dispatch(executeOrderWithCardRequest(nft)),
×
NEW
74
  onBuyItemWithCard: item => dispatch(buyItemWithCardRequest(item))
×
75
})
76

NEW
77
export const BuyNFTWithCryptoModalContainer = connect(
×
78
  mapState,
79
  mapDispatch
80
)(BuyNFTWithCryptoModal)
81

NEW
82
export const MintNFTWithCryptoModalConatiner = connect(
×
83
  mapState,
84
  mapDispatch
85
)(MintNFTWithCryptoModal)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc