craft-nft

A standalone NFT implementation for real-world arts and crafts assets
Log | Files | Refs | README

commit 65b9bea9297baf3fd05619afd2ec7d2b9e6880bd
parent 08f2de4ef465bcdf7ed9d8f388d2cf8197cdbc13
Author: lash <dev@holbrook.no>
Date:   Sat, 17 Dec 2022 09:17:12 +0000

Bootstrap browserified metamask and web3js environment

Diffstat:
Ajs/manual_test_browser.js | 7+++++++
Ajs/package.json | 15+++++++++++++++
Ajs/src/engine.js | 11+++++++++++
Mpython/tests/test_basic.py | 1+
Msolidity/CraftNFT.sol | 3---
5 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/js/manual_test_browser.js b/js/manual_test_browser.js @@ -0,0 +1,7 @@ +window.addEventListener('load', () => { + alive(); +}); + +async function alive() { + console.debug('g', await window.craftnft.web3.eth.getGasPrice()); +}; diff --git a/js/package.json b/js/package.json @@ -0,0 +1,15 @@ +{ + "name": "craft_nft", + "version": "0.0.1", + "dependencies": { + "web3": "~1.8.1", + "@metamask/sdk": "~0.1.0" + }, + "scripts": { + "build": "browserify src/engine.js -s craftnft -p esmify -o dist/craft_nft.js" + }, + "devDependencies": { + "browserify": "~17.0.0", + "esmify": "~2.1.1" + } +} diff --git a/js/src/engine.js b/js/src/engine.js @@ -0,0 +1,11 @@ +const Web3 = require('web3'); +import MetaMaskSDK from '@metamask/sdk'; + +const mm = new MetaMaskSDK({injectProvider: false}); +const w3_provider = mm.getProvider(); +w3_provider.request({method: 'eth_requestAccounts'}); +const w3 = new Web3(w3_provider); + +module.exports = { + web3: w3, +}; diff --git a/python/tests/test_basic.py b/python/tests/test_basic.py @@ -42,6 +42,7 @@ testdir = os.path.dirname(__file__) hash_of_foo = '2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae' hash_of_bar = 'fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9' + class Test(EthTesterCase): def setUp(self): diff --git a/solidity/CraftNFT.sol b/solidity/CraftNFT.sol @@ -96,9 +96,6 @@ contract CraftNFT { require(token[_content][0].count == 0); require(mintedToken[_content] == bytes32(0x00)); - //first &= 0xffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000; - //require(mintedToken[bytes32(first)] == bytes32(0x00)); - right = uint160(_recipient); right |= (3 << 254); mintedToken[_content] = bytes32(right);