{"size": 1480, "ext": "js", "max_stars_repo_path": "scripts/initializeBadges/testMatch.js", "max_stars_repo_name": "UjoTeam/contracts-badges", "max_stars_repo_stars_event_min_datetime": "2018-06-27T21:56:28.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-15T21:35:51.000Z", "max_issues_repo_path": "scripts/initializeBadges/testMatch.js", "max_issues_repo_name": "ujoteam/contracts-badges", "max_issues_repo_issues_event_min_datetime": "2018-06-06T09:05:39.000Z", "max_issues_repo_issues_event_max_datetime": "2018-10-02T19:51:23.000Z", "max_forks_repo_path": "scripts/initializeBadges/testMatch.js", "max_forks_repo_name": "ujoteam/contracts-badges", "max_forks_repo_forks_event_min_datetime": "2019-08-19T06:09:27.000Z", "max_forks_repo_forks_event_max_datetime": "2020-10-25T14:32:37.000Z"}
{"max_stars_count": 7, "max_issues_count": 18, "max_forks_count": 2, "avg_line_length": 32.8888888889, "max_line_length": 96, "alphanum_fraction": 0.7216216216}
/*
This was used to double check that this init script generates the same objects to the front-end.
First, the front-end was deployed and a badge minted.
Then it was pulled from rinkeby and compared to a local MG.
If the hashes match on the objects
*/

const axios = require('axios');

const getDataFromApi = async () => {
  const expectedNftCid = 'zdpuAxqu3oYm4AeRCeNPSy3aYofcoJfwxEZHxYvwkTnLLEez2';
  // const buyer = '0x374Bd185Ee19fD9f8682Eb875E5D0546A8D58CdD';
  const beneficiaryOfBadge = '0x374Bd185Ee19fD9f8682Eb875E5D0546A8D58CdD';
  // const beneficiaryOfBadge = '0x374bd185ee19fd9f8682eb875e5d0546a8d58cdd';

  // 1 == Simon Local
  const { data } = await axios.get('http://localhost:9001/api/musicgroups/1');
  // console.log(data);
  const objectForIPFS = {
    name: `${data.name} Patronage Badge`,
    description: `A collectible patronage badge for ${data.name}`,
    image: `https://wwww.ujomusic.com/image/600x600/${data.image.contentURL}`,
    beneficiaries: [{ address: beneficiaryOfBadge, split: 100 }],
    MusicGroup: data.cid,
    usdCostOfBadge: 5,
  };

  const response = await axios({
    method: 'post',
    url: 'https://api.dev.ujomusic.com/api/dag/put',
    data: JSON.stringify(objectForIPFS),
  });
  console.log('infura response');
  console.log(response);
  console.log(expectedNftCid);
  return objectForIPFS;
};

const initialize = async () => {
  const formattedData = await getDataFromApi();
  console.log(formattedData);
};

initialize();
