Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Move sample listing creation out of truffle migration scripts #478

Open
franckc opened this issue Sep 18, 2018 · 2 comments
Open

Move sample listing creation out of truffle migration scripts #478

franckc opened this issue Sep 18, 2018 · 2 comments

Comments

@franckc
Copy link

franckc commented Sep 18, 2018

Currently we create the sample listing via a script that runs as part of the truffle migration steps. The script calls directly the marketplace contract method createListing as opposed to using origin-js. This causes issue since some logic in origin-js runs as part of listing creation to properly set the deposit amount for example before calling the marketplace contract.

It would be better to move sample listing creation to a separate script that would get executed as part of the scripts/build.js build script.

@franckc franckc changed the title Move sample listing creation our of truffle migration scripts Move sample listing creation out of truffle migration scripts Sep 18, 2018
@franckc franckc self-assigned this Sep 18, 2018
@franckc
Copy link
Author

franckc commented Sep 20, 2018

I have been trying to implement the following approach:

  • new method createSampleListing under scripts/helpers/create-sample-listing.js gets called by build.js
  • createSampleListing instantiates an Origin object then call Origin.marketplace.createListing

Code is on branch franck/create_sample_listings

But I'm hitting a couple of problematic issues:

  1. In order to instantiate an Origin object, I need to point to either the origin-js npm or at a locally compiled version of it. But none of those exist yet when build.js runs. I also tried to point to dist/index.js but similarily that fails since webpack compiles that file as part of build.js running...
  2. The upload to IPFS of b64 encoded image data fails unless I make changes to the IpfsService. saveDataURIAsFile method (see Optimize method saveDataURIAsFile #511). I have tested it on Node.js and Chrome browser installed on my envionment but this might be a risky change to put in without more validation on different type of browsers...

Overall I'm inclined to do the following:

  • For our Testnet release, disable sample listing creation on Rinkeby. We can create those manually if needed.
  • Continue looking at options for automatically creating sample listings when origin-js container gets started...

@DanielVF
Copy link
Collaborator

DanielVF commented Sep 20, 2018

Though we would loose all the logic in origin.js, we can always just make simple json POST calls to IPFS and Ganache....

It's probably a terrible idea, but it's always possible...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants