Giter Club home page Giter Club logo

snip721-reference-impl's People

Contributors

assafmo avatar baedrik avatar itshaseebsaeed avatar luca992 avatar reuvenpo avatar srdtrk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

snip721-reference-impl's Issues

When I run `cosm wasm` I get tons of `use of undeclared crate or module` errors and a failed build

I am following this tutorial https://www.youtube.com/watch?v=jRuSOos9ig4.

In the above tutorial, in the contracts directory of https://github.com/floAr/FigmentLearn-FromZeroToYourFirstSecretNFT.git, I run cargo generate --git https://github.com/baedrik/snip721-reference-impl.git --name my-snip721 which worked after installing cargo-generate with the command cargo install cargo-generate.

The next step is to run cargo wasm which fails immediately a bunch of use of undeclared crate or module for packages like slice and io. I also get a lot of not found in this scope errors.

Are these problems happening because I'm on an m1 mac? How do I fix this and get cargo wasm to run?

Update
This does not appear to be an m1 mac problem. It fails on my Windows 10 build as well.

Just to reiterate, I did the following commands once in the contracts directory of https://github.com/floAr/FigmentLearn-FromZeroToYourFirstSecretNFT.git:
cargo generate --git https://github.com/baedrik/snip721-reference-impl.git --name my-snip721
cd my-snip721
cargo wasm

When a ran cargo wasm on my m1 mac AND my Windows 10 build, I got an endless string of similar errors. They mostly all follow this format:

error[E0433]: failed to resolve: use of undeclared crate or module `slice`
    --> /Users/<myusername>/.cargo/registry/src/github.com-1ecc6299db9ec823/byteorder-1.4.3/src/lib.rs:1594:13
     |
1594 |             slice::from_raw_parts(src.as_ptr() as *const u64, src.len())
     |             ^^^^^ use of undeclared crate or module `slice`

I also got a bunch of errors that followed this format.

error[E0425]: cannot find function `copy_nonoverlapping` in this scope
    --> /Users/<myusername>/.cargo/registry/src/github.com-1ecc6299db9ec823/byteorder-1.4.3/src/lib.rs:1950:13
     |
1950 |             copy_nonoverlapping(
     |             ^^^^^^^^^^^^^^^^^^^ not found in this scope
...
2301 |             unsafe_write_slice_native!(src, dst, u32);
     |             ----------------------------------------- in this macro invocation
     |
     = note: this error originates in the macro `unsafe_write_slice_native` (in Nightly builds, run with -Z macro-backtrace for more info)

So what seems to be the problem? FYI, I'm using the terminal in visual studio code to run the commands. On my Windows build I ran these commands in the vscode bash terminal, powershell terminal, and cmd termial. They all produced the same errors

I can't get this compiled smart contract to upload to Secret Network.

I am trying to upload a build of this contract https://github.com/baedrik/snip721-reference-impl.

I build it with:

cargo generate --git https://github.com/baedrik/snip721-reference-impl --name my-snip721
cd my-snip721
make

It compiled the contract to contract.wasm and contract.wasm.gz

I made this upload script which I reassembled from this code: https://github.com/scrtlabs/SecretJS-Templates/blob/master/5_contracts/main.js and this code https://github.com/floAr/FigmentLearn-FromZeroToYourFirstSecretNFT/blob/main/contract/deploy-nft.js. It looks like this:

const { Wallet, SecretNetworkClient } = require("secretjs");
const fs = require("fs");

// Load environment variables
require("dotenv").config();

const main = async () => {
  const wallet = new Wallet(process.env.VITE_MNEMONIC);

  // Create a connection to Secret Network node
  // Pass in a wallet that can sign transactions
  // Docs: https://github.com/scrtlabs/secret.js#secretnetworkclient
  const secretjs = new SecretNetworkClient({
    url: process.env.__VITE_SECRET_REST_URL,
    wallet: wallet,
    walletAddress: wallet.address,
    chainId: process.env.VITE_SECRET_CHAIN_ID,
  });
  console.log(`Wallet address=${wallet.address}`);

  // 2. Upload the contract wasm
  const wasm = fs.readFileSync('my-snip721/contract.wasm');
  console.log('Uploading contract');

  const tx = await secretjs.tx.compute.storeCode(
    {
      sender: wallet.address,
      wasm_byte_code: wasm,
      source: "https://github.com/baedrik/snip721-reference-impl",
      builder: "baedrik",
    },
    {
      gasLimit: 1_000_000,
    }
  );
  console.log(tx);

  const codeId = Number(
    tx.arrayLog.find((log) => log.type === "message" && log.key === "code_id")
      .value
  );
  console.log("codeId: ", codeId);

  // contract hash, useful for contract composition
  const contractCodeHash = (await secretjs.query.compute.codeHashByCodeId({code_id: codeId})).code_hash;
  console.log(`Contract hash: ${contractCodeHash}`);
};

main();

When I run the script with node <SCRIPT NAME HERE>.js, I get this error:

TypeError: Cannot read properties of undefined (reading 'find')

Notice that I'm logging tx which looks like this after I format it to json:

{
    "height": 0,
    "timestamp": "",
    "transactionHash": "LONG STRING HERE...",
    "code": 18,
    "codespace": "sdk",
    "info": "",
    "tx": {
        "@type": "/cosmos.tx.v1beta1.Tx",
        "body": {
            "messages": ["Array"],
            "memo": "",
            "timeout_height": "0",
            "extension_options": [],
            "non_critical_extension_options": []
        },
        "auth_info": { "signer_infos": ["Array"], "fee": ["Object"] },
        "signatures": [
            "ANOTHER LONG STRING HERE..."
        ]
    },
    "rawLog": "builder invalid: invalid request",
    "jsonLog": "undefined",
    "arrayLog": "undefined",
    "events": [],
    "data": [],
    "gasUsed": 822,
    "gasWanted": 0,
    "ibcResponses": []
}

arrayLog is undefined. So how do I get this snip 721 compiled contract to upload to Secret Network?

wasm compilation failed

Hi @baedrik,

I have clone the repo and switched to use 1.46.0 stable for rust version with the wasm target but have not been able to compile the code to wasm.

Error:

error: failed to run custom build command for `secp256k1-sys v0.4.1`

--- stdout
  TARGET = Some("wasm32-unknown-unknown")
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-apple-darwin")
  CC_wasm32-unknown-unknown = None
  CC_wasm32_unknown_unknown = None
  TARGET_CC = None
  CC = None
  CFLAGS_wasm32-unknown-unknown = None
  CFLAGS_wasm32_unknown_unknown = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CC_wasm32-unknown-unknown = None
  CC_wasm32_unknown_unknown = None
  TARGET_CC = None
  CC = None
  CFLAGS_wasm32-unknown-unknown = None
  CFLAGS_wasm32_unknown_unknown = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  running: "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "depend/secp256k1/" "-I" "depend/secp256k1/include" "-I" "depend/secp256k1/src" "-I" "wasm-sysroot" "-Wall" "-Wextra" "-DSECP256K1_BUILD=1" "-DSECP256K1_API=" "-DENABLE_MODULE_ECDH=1" "-DENABLE_MODULE_SCHNORRSIG=1" "-DENABLE_MODULE_EXTRAKEYS=1" "-DECMULT_GEN_PREC_BITS=4" "-DUSE_NUM_NONE=1" "-DUSE_FIELD_INV_BUILTIN=1" "-DUSE_SCALAR_INV_BUILTIN=1" "-DECMULT_WINDOW_SIZE=15" "-DUSE_EXTERNAL_DEFAULT_CALLBACKS=1" "-o" "/Users/belsy/snip721-reference-impl/target/wasm32-unknown-unknown/release/build/secp256k1-sys-7f53b194f4029c2b/out/depend/secp256k1/contrib/lax_der_parsing.o" "-c" "depend/secp256k1/contrib/lax_der_parsing.c"
  cargo:warning=error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
  cargo:warning=1 error generated.
  exit code: 1

  --- stderr

am I missing something?

Cannot run secret-contract-optimizer

Issue

When attempting to run the secret contract optimizer with this repo as part of this Figment Learn tutorial, it currently fails to build the uint crate with the following error:

error: package `uint v0.9.3` cannot be built because it requires rustc 1.56.1 or newer, 
while the currently active rustc version is 1.56.0
make: *** [compile-optimized-reproducible] Error 101

This was brought to my attention by @MarkH1994 on the Figment Devs discord server. We were able to determine that version 0.9.0 of the uint crate works in this scenario because it doesn't require a higher rustc version than the Docker container has installed.

@baedrik Would it be preferable to try getting the contract optimizer Docker image updated to use a higher version of rustc? I just don't know who maintains it or I'd ask directly.

Thanks for your assistance! ๐Ÿ˜„

GPL-3.0 License Question, Do my NFTs and Dapps Accessing Them Have to Be Open Source?

Hey I just realized that this project is GPL-3 licensed. Does that mean that any NFT I implement with this repo has to have the same license? Like if I made a cool 3D art file that was in any way code generated, would I have to release the source code? Also, I use a svelte frontend for an NFT minting dapp similar to the code in this repo https://github.com/floAr/FigmentLearn-FromZeroToYourFirstSecretNFT. Does that mean I have to make my whole dapp open source because I used https://github.com/baedrik/snip721-reference-impl to make the actual NFTs?

token_info query

should there be a token_info query handler as part of this? After creating an nft and trying to add to the keplr wallet it fails because i believe it hasnt been implemented. is that intended?
Screen Shot 2022-06-04 at 6 01 48 AM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.