Skip to content

Conversation

Myestery
Copy link
Contributor

@Myestery Myestery commented Jul 15, 2024

Mint Ingestor: Transient

Functionality Supported

  • Ingesting from URL: Yes
  • Ingesting from Contract address: Yes
  • Supported Networks: Base

Before you submit

  • Ensure your generated MintTemplate works 😄
  • Ensure that your code is restricted to a single folder in src/ingestors
  • Ensure that all required assets are included (e.g. ABIs)
  • Ensure ABIs are trimmed to include only methods (1) used in the ingestor or (2) required to mint
  • Ensure that all exported methods are prefixed with the name of your ingestor e.g. myMintingPlatformGetContractDetails
  • Ensure that a test exists for generating a MintTemplate that will always succeed
  • Ensure that your code accesses no external resources except those passed in the resources object

fix #8

@Myestery
Copy link
Contributor Author

Hello @christinehall
I was able to add an ingestor for the transient network.

I noticed the mint contract was different from the nft contract too

@chrismaddern
Copy link
Contributor

Thank you for this submission!! 🥳 🙏

We've gotten a little behind on reviewing these, but will be spending some time over the next 48 hours, so look out for some feedback soon! Thank you! 🙏

contractAddress,
mintAddress,
contractMethod: 'purchase',
contractParams: '["address", 1, 1, address]',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the ABI above, is this right?

https://github.com/floornfts/mobile-minting/pull/27/files#diff-7b9dec2faf20a75b53006dc8f4835e4f6d5e131c7287e038cb46cccd657bb7daR11

Are the last properties optional? And are nftAddress and recipient supposed to both be the recipient's address?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 // nftAddress	address	0x8F7F96eEc76c882C327a1b927D04C87031ED5481
// 1	tokenId	uint256	1
// 2	recipient	address	0xcA4700293Bd3b48E7051116635C82546F17a61e3
// 3	numberToMint	uint256	1
// 4	presaleNumberCanMint	uint256	0
// 5	proof	bytes32[]

The above is a sample contract interaction pulled from the explorer for a successful purchase on transient

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nftAddress should be the address of the nft
and yes recipient address should be address of recipient. ABI says this allows for buying for others

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit unsure of what contractParams: '["address", 1, 1, address]', should be atm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set it to
["${contract.contractAddress}", 1, address, 1],

I believe it represents the structure better now

@Myestery Myestery requested a review from chrismaddern July 17, 2024 11:54
@Myestery
Copy link
Contributor Author

@chrismaddern I have made the necessary corrections, should be good now

@chrismaddern
Copy link
Contributor

Hi @Myestery

Are you able to run the tests locally?

If you:

  1. Add an ALCHEMY_API_KEY var in your local .env
  2. Run yarn test

I've also just added support for simulating transactions to the tests basicIngestorTests

Can you merge the floornfts/mobile-minting branch into yours? There are several failing manual tests already, but this also indicates that the constructed payload does not execute successfully onchain:

CleanShot 2024-07-19 at 08 30 38@2x

Let me know if you have any questions, otherwise, making the tests pass is the right next step 😊

@Myestery
Copy link
Contributor Author

Thanks for fixing the tests,
I'll run them now

@Myestery
Copy link
Contributor Author

I actually have some trouble running the test
I still get ts errors after merging main branch
Screenshot 2024-07-19 at 13 50 07

@chrismaddern
Copy link
Contributor

chrismaddern commented Jul 19, 2024

All local machines and CI seem to be building it okay which is odd - I'm not 100% sure what the problem is:

Setup

  • MacOS Sonoma
  • Node 20.9.0 (we could probably use a node version lock file in the repo actually)
  • The rest of the deps should be pinned in yarn.lock (I assume you used yarn install?)

Do you have any global TS config that could be applying?

Ah, if you're having a hard time running yarn install, you may want to try removing the .npmrc file locally -- that's designed for building and distribution, but can interact with yarn install too.

git update-index --assume-unchanged .npmrc
rm .npmrc

This will remove it locally, while preventing that change from being pushed to git

@Myestery
Copy link
Contributor Author

All local machines and CI seem to be building it okay which is odd - I'm not 100% sure what the problem is:

Setup

  • MacOS Sonoma
  • Node 20.9.0 (we could probably use a node version lock file in the repo actually)
  • The rest of the deps should be pinned in yarn.lock (I assume you used yarn install?)

Do you have any global TS config that could be applying?

Ah, if you're having a hard time running yarn install, you may want to try removing the .npmrc file locally -- that's designed for building and distribution, but can interact with yarn install too.

git update-index --assume-unchanged .npmrc
rm .npmrc

This will remove it locally, while preventing that change from being pushed to git

I finally got it to work using node 20

@Myestery
Copy link
Contributor Author

@chrismaddern The tests are passing now
I noticed switching the simulate env made my tests pass but some of fxhash to fail

Screenshot 2024-07-19 at 17 27 38

chainId,
contractAddress: mintAddress,
contractMethod: 'purchase',
contractParams: `[address, ${token_id}, address, 1, 0, []]`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you merge the latest from mobile-minting main, it will now run a simulation for you in running the tests.

This reveals that these params are incorrect.

Consulting the ABI:

{ internalType: 'address', name: 'nftAddress', type: 'address' },
      { internalType: 'uint256', name: 'tokenId', type: 'uint256' },
      { internalType: 'address', name: 'recipient', type: 'address' },
      { internalType: 'uint256', name: 'numberToMint', type: 'uint256' },
      { internalType: 'uint256', name: 'presaleNumberCanMint', type: 'uint256' },
      { internalType: 'bytes32[]', name: 'proof', type: 'bytes32[]' },

The important one is...

Param 1: This is the Address of the NFT collection, not the user

Replacing this with:

contractParams: `["${contractAddress}", "${token_id}", address, 1, 0, []]`,

fixes one part of the problem

The next is that the price wei for the test is being set to 20000000000000000, but minting on metamask reveals it's actualy 0.00209.

CleanShot 2024-07-20 at 15 20 15@2x

The priceWei is missing the mint fee it seems.

Hopefully this helps get it across the line!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @chrismaddern !
I figured the fee some hours ago

However, I noticed there are about 4 contract types on Base Network that Transient supports today

  • ERC721TL
  • ERC1155TL
  • ER7160TL (The contract for Kansas smile)
  • Trace

I'll be adding support for them before the next review

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All tests are passing now tho
Pls let me know if I should proceed with adding support for the remaining 3 contract types

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing, yes — support for all Base supported types would be extremely helpful. Particularly the 721TL is important (and I think most of their mints?)

@chrismaddern
Copy link
Contributor

Amazing! Seeing the same thing on my end!!!

CleanShot 2024-07-20 at 17 53 48@2x

Nice work... I'll wait for the final types (they're just different minter addresses, hopefully?) and then we can get this in and unlock the bounty!! 🥳 🚀

@Myestery
Copy link
Contributor Author

All done @chrismaddern
Screenshot 2024-07-21 at 21 03 30

I added more tests to ensure the other contract types are working and fixed some minor flaws with the ingestor.
I think its completed !

@chrismaddern
Copy link
Contributor

Amazing!

Could you add example URLs for each to the successUrls for the basicIngestorTests?

Currently only the one URL is being simulated in tests:
CleanShot 2024-07-22 at 09 10 19@2x

Also, you can run simulations during testing locally by adding the following to your .env:

SIMULATE_DURING_TESTS=true

When I do this locally:

basicIngestorTests(new TransientIngestor(), resources, {
    successUrls: [
      'https://www.transient.xyz/stacks/kansas-smile',
      'https://www.transient.xyz/stacks/volumina-8',
      'https://www.transient.xyz/stacks/16384',
    ],

CleanShot 2024-07-22 at 09 13 48@2x

If you need to fix the blockHash at which the tests run the simulation you can do so here:
https://github.com/floornfts/mobile-minting/blob/main/test/ingestors/prohibition-daily.test.ts#L27

Note that all test cases currently need to be able to simulate successfully at the same blockhash (i.e. have been live & available at the same time)

@Myestery
Copy link
Contributor Author

Amazing!

Could you add example URLs for each to the successUrls for the basicIngestorTests?

Currently only the one URL is being simulated in tests: CleanShot 2024-07-22 at 09 10 19@2x

Also, you can run simulations during testing locally by adding the following to your .env:

SIMULATE_DURING_TESTS=true

When I do this locally:

basicIngestorTests(new TransientIngestor(), resources, {
    successUrls: [
      'https://www.transient.xyz/stacks/kansas-smile',
      'https://www.transient.xyz/stacks/volumina-8',
      'https://www.transient.xyz/stacks/16384',
    ],

CleanShot 2024-07-22 at 09 13 48@2x

If you need to fix the blockHash at which the tests run the simulation you can do so here: https://github.com/floornfts/mobile-minting/blob/main/test/ingestors/prohibition-daily.test.ts#L27

Note that all test cases currently need to be able to simulate successfully at the same blockhash (i.e. have been live & available at the same time)

I fixed the tests, I noticed a slight change with the ABI for ERC721TL and ERC7160TL contracts

@Myestery
Copy link
Contributor Author

All done 💯
Screenshot 2024-07-22 at 15 16 47

@chrismaddern
Copy link
Contributor

Huzzah! Will review for merge.

Meanwhile, I'll DM you on the Twitter profile on your Github page with follow up for the bounty 🙂

@chrismaddern
Copy link
Contributor

@Myestery did you get the DM? 👀

@Myestery
Copy link
Contributor Author

@Myestery did you get the DM? 👀

yes, seen now

@Myestery
Copy link
Contributor Author

@Myestery did you get the DM? 👀

yes, seen now

Filled.
Thanks

@Myestery
Copy link
Contributor Author

Screenshot 2024-07-25 at 00 20 33

Hey @chrismaddern
I noticed the test failed recently and I did some investigation
I found out that they could close the nft sale before the public sale date ended
that was the issue for kansas-smile

@Myestery
Copy link
Contributor Author

Myestery commented Jul 24, 2024

Screenshot 2024-07-25 at 00 20 33 Hey @chrismaddern I noticed the test failed recently and I did some investigation I found out that they could close the nft sale before the public sale date ended that was the issue for kansas-smile

It got closed some minutes ago
https://api.transient.xyz/v1/catalog/stacks/kansas-smile

@chrismaddern
Copy link
Contributor

@Myestery will observed!

I added a blockhash to the basicIngestor tests in this PR here → #31

@chrismaddern
Copy link
Contributor

You should be able to merge main now! 😊

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

Successfully merging this pull request may close these issues.

Onchain Summer Bounty → Transient Base Mint Ingestor
2 participants