Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in BN package when building with my own deployed smart contract #22

Open
Shane-Neeley opened this issue May 18, 2022 · 2 comments

Comments

@Shane-Neeley
Copy link

Shane-Neeley commented May 18, 2022

Wasn't getting this at first. Trying to go to http://localhost:8000/en/?hero=7 .. Any idea what this is about?

Screen Shot 2022-05-18 at 12 01 33 PM

UPDATE: this was happening after I built using my own deployed contract, not the v2.tenk.testnet. Which contract should I deploy, the one in the frontend code?

@Shane-Neeley Shane-Neeley reopened this May 19, 2022
@Shane-Neeley Shane-Neeley changed the title Error in BN package Error in BN package when building with my own deployed smart contract May 19, 2022
@Shane-Neeley
Copy link
Author

Shane-Neeley commented May 19, 2022

I guess my main question is, what do I deploy to testnet to test this out? There's src/near/contracts/tenk.ts in the frontend code, but you also have contracts in https://github.com/TENK-DAO/tenk/tree/main/contracts/tenk ... both Rust and TypeScript.

@adamk72
Copy link

adamk72 commented May 26, 2022

Regarding the error: This error will come up with “price” is missing from the JSON when initing the contract. It lets you do that because the init function takes an Option type for the sale key:

    pub fn new_default_meta(
        owner_id: AccountId,
        metadata: InitialMetadata,
        size: u32,
        sale: Option<Sale>,
    ) -> Self {
        Self::new(owner_id, metadata.into(), size, sale.unwrap_or_default())
    }

But the Sale itself has one mandatory key that’s easy to miss, price :

pub struct Sale {
    pub royalties: Option<Royalties>,
    pub initial_royalties: Option<Royalties>,
    pub presale_start: Option<TimestampMs>,
    pub public_sale_start: Option<TimestampMs>,
    pub allowance: Option<u16>,
    pub presale_price: Option<U128>,
    pub price: U128,
    pub mint_rate_limit: Option<u16>,
}

(which, on top of all that requires a String, not a U128, because U128 isn’t a primitive, it’s a macro.)

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

No branches or pull requests

2 participants