gitcoinco / gitcoinco/web

Infinite Cart Fetch / tokenDetails.decimals not found

Open
#8,647 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.8k
Forks
776
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

Infinite "Fetching Cart Data" screen.
Console:
`TypeError: Cannot read property 'decimals' of undefined`

**To Reproduce**
Add a grant to my cart, attempt to checkout

**Expected behavior**

**Screenshots**

**Desktop (please complete the following information):**

- OS: Windows
- Browser: Chrome
- Browser Version: 89.0.4389.82

**Additional context**

Looks like its something with tokenDetails being undefined when calculating amount.

```
// Generate array of objects containing donation info from cart
let gitcoinFactor = String(100 - (100 * this.gitcoinFactor));
const donations = this.grantsByTenant.map((grant, index) => {
const tokenDetails = this.getTokenByName(grant.grant_donation_currency);
const amount = parseUnits(String(grant.grant_donation_amount || 0), tokenDetails.decimals)
.mul(gitcoinFactor)
.div(100);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.