1.0.9 • Published 3 years ago
@motifdev/asset v1.0.9
Motif - Asset
- Install and build repo yarn DO THIS TO AVOID ERRORS THAT MAKE YOU LOSE HOURS!!!!!!!!!!!! mkdir dist yarn build
- Deploy contracts to blockchain remove the contract addresses from addresses/7018.json update .env.prod with private key and rpc yarn deploy --chainId 7018 check if addresses/7018.json filled with addresses
- Deploy library to npm update package.json with the next version and username npm login (if not logged in) npm pack //make sure you did yarn build the blue text has to be long! npm publish --access=public
- Access to contracts
./motif attach '/root/motif/motif-blockchain/build/validatordata/motif.ipc'
var account = "0x7DCB42b41e9CBD56186f69B8dD8C4c89bEe189F3"; personal.unlockAccount(account, "canersbu9000", 3000000); web3.ftm.defaultAccount = account; var itemAbi = [{"inputs":{"internalType":"address","name":"itemExchangeContractAddr","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},"name":"Approval","type":"event"},{"anonymous":false,"inputs":{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"},"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"},"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"string","name":"_uri","type":"string"},"name":"TokenMetadataURIUpdated","type":"event"},{"anonymous":false,"inputs":{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"string","name":"_uri","type":"string"},"name":"TokenURIUpdated","type":"event"},{"anonymous":false,"inputs":{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},"name":"Transfer","type":"event"},{"inputs":[],"name":"MINT_WITH_SIG_TYPEHASH","outputs":{"internalType":"bytes32","name":"","type":"bytes32"},"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMIT_TYPEHASH","outputs":{"internalType":"bytes32","name":"","type":"bytes32"},"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"address","name":"bidder","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"components":{"internalType":"uint256","name":"value","type":"uint256"},"internalType":"struct Decimal.D256","name":"sellOnShare","type":"tuple"}],"internalType":"struct IItemExchange.Bid","name":"bid","type":"tuple"}],"name":"acceptBid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":{"internalType":"address","name":"owner","type":"address"},"name":"balanceOf","outputs":{"internalType":"uint256","name":"","type":"uint256"},"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":{"internalType":"string","name":"","type":"string"},"stateMutability":"view","type":"function"},{"inputs":{"internalType":"uint256","name":"tokenId","type":"uint256"},"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":{"internalType":"uint256","name":"tokenId","type":"uint256"},"name":"getApproved","outputs":{"internalType":"address","name":"","type":"address"},"stateMutability":"view","type":"function"},{"inputs":{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"},"name":"isApprovedForAll","outputs":{"internalType":"bool","name":"","type":"bool"},"stateMutability":"view","type":"function"},{"inputs":[],"name":"itemExchangeContract","outputs":{"internalType":"address","name":"","type":"address"},"stateMutability":"view","type":"function"},{"inputs":{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},"name":"listTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":{"internalType":"string","name":"tokenURI","type":"string"},{"internalType":"string","name":"metadataURI","type":"string"},{"internalType":"bytes32","name":"contentHash","type":"bytes32"},{"internalType":"bytes32","name":"metadataHash","type":"bytes32"},"internalType":"struct IItem.ItemData","name":"data","type":"tuple"},{"components":[{"components":{"internalType":"uint256","name":"value","type":"uint256"},"internalType":"struct Decimal.D256","name":"prevOwner","type":"tuple"},{"components":{"internalType":"uint256","name":"value","type":"uint256"},"internalType":"struct Decimal.D256","name":"creator","type":"tuple"},{"components":{"internalType":"uint256","name":"value","type":"uint256"},"internalType":"struct Decimal.D256","name":"owner","type":"tuple"}],"internalType":"struct IItemExchange.BidShares","name":"bidShares","type":"tuple"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creator","type":"address"},{"components":{"internalType":"string","name":"tokenURI","type":"string"},{"internalType":"string","name":"metadataURI","type":"string"},{"internalType":"bytes32","name":"contentHash","type":"bytes32"},{"internalType":"bytes32","name":"metadataHash","type":"bytes32"},"internalType":"struct IItem.ItemData","name":"data","type":"tuple"},{"components":[{"components":{"internalType":"uint256","name":"value","type":"uint256"},"internalType":"struct Decimal.D256","name":"prevOwner","type":"tuple"},{"components":{"internalType":"uint256","name":"value","type":"uint256"},"internalType":"struct Decimal.D256","name":"creator","type":"tuple"},{"components":{"internalType":"uint256","name":"value","type":"uint256"},"internalType":"struct Decimal.D256","name":"owner","type":"tuple"}],"internalType":"struct IItemExchange.BidShares","name":"bidShares","type":"tuple"},{"components":{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},"internalType":"struct IItem.EIP712Signature","name":"sig","type":"tuple"}],"name":"mintForCreatorWithSig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creator","type":"address"},{"components":{"internalType":"string","name":"tokenURI","type":"string"},{"internalType":"string","name":"metadataURI","type":"string"},{"internalType":"bytes32","name":"contentHash","type":"bytes32"},{"internalType":"bytes32","name":"metadataHash","type":"bytes32"},"internalType":"struct IItem.ItemData","name":"data","type":"tuple"},{"components":[{"components":{"internalType":"uint256","name":"value","type":"uint256"},"internalType":"struct Decimal.D256","name":"prevOwner","type":"tuple"},{"components":{"internalType":"uint256","name":"value","type":"uint256"},"internalType":"struct Decimal.D256","name":"creator","type":"tuple"},{"components":{"internalType":"uint256","name":"value","type":"uint256"},"internalType":"struct Decimal.D256","name":"owner","type":"tuple"}],"internalType":"struct IItemExchange.BidShares","name":"bidShares","type":"tuple"}],"name":"mintForCreatorWithoutSig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":{"internalType":"address","name":"","type":"address"},"name":"mintWithSigNonces","outputs":{"internalType":"uint256","name":"","type":"uint256"},"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":{"internalType":"string","name":"","type":"string"},"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":{"internalType":"address","name":"","type":"address"},"stateMutability":"view","type":"function"},{"inputs":{"internalType":"uint256","name":"tokenId","type":"uint256"},"name":"ownerOf","outputs":{"internalType":"address","name":"","type":"address"},"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},"internalType":"struct IItem.EIP712Signature","name":"sig","type":"tuple"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},"name":"permitNonces","outputs":{"internalType":"uint256","name":"","type":"uint256"},"stateMutability":"view","type":"function"},{"inputs":{"internalType":"uint256","name":"","type":"uint256"},"name":"previousTokenOwners","outputs":{"internalType":"address","name":"","type":"address"},"stateMutability":"view","type":"function"},{"inputs":{"internalType":"uint256","name":"tokenId","type":"uint256"},"name":"removeAsk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":{"internalType":"uint256","name":"tokenId","type":"uint256"},"name":"removeBid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":{"internalType":"uint256","name":"tokenId","type":"uint256"},"name":"revokeApproval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"},"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"},"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},"internalType":"struct IItemExchange.Ask","name":"ask","type":"tuple"}],"name":"setAsk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"address","name":"bidder","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"components":{"internalType":"uint256","name":"value","type":"uint256"},"internalType":"struct Decimal.D256","name":"sellOnShare","type":"tuple"}],"internalType":"struct IItemExchange.Bid","name":"bid","type":"tuple"}],"name":"setBid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":{"internalType":"bytes4","name":"interfaceId","type":"bytes4"},"name":"supportsInterface","outputs":{"internalType":"bool","name":"","type":"bool"},"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":{"internalType":"string","name":"","type":"string"},"stateMutability":"view","type":"function"},{"inputs":{"internalType":"uint256","name":"index","type":"uint256"},"name":"tokenByIndex","outputs":{"internalType":"uint256","name":"","type":"uint256"},"stateMutability":"view","type":"function"},{"inputs":{"internalType":"uint256","name":"","type":"uint256"},"name":"tokenContentHashes","outputs":{"internalType":"bytes32","name":"","type":"bytes32"},"stateMutability":"view","type":"function"},{"inputs":{"internalType":"uint256","name":"","type":"uint256"},"name":"tokenCreators","outputs":{"internalType":"address","name":"","type":"address"},"stateMutability":"view","type":"function"},{"inputs":{"internalType":"uint256","name":"","type":"uint256"},"name":"tokenMetadataHashes","outputs":{"internalType":"bytes32","name":"","type":"bytes32"},"stateMutability":"view","type":"function"},{"inputs":{"internalType":"uint256","name":"tokenId","type":"uint256"},"name":"tokenMetadataURI","outputs":{"internalType":"string","name":"","type":"string"},"stateMutability":"view","type":"function"},{"inputs":{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"},"name":"tokenOfOwnerByIndex","outputs":{"internalType":"uint256","name":"","type":"uint256"},"stateMutability":"view","type":"function"},{"inputs":{"internalType":"uint256","name":"tokenId","type":"uint256"},"name":"tokenURI","outputs":{"internalType":"string","name":"","type":"string"},"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":{"internalType":"uint256","name":"","type":"uint256"},"stateMutability":"view","type":"function"},{"inputs":{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},"name":"transfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":{"internalType":"address","name":"newOwner","type":"address"},"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"metadataURI","type":"string"},"name":"updateTokenMetadataURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"tokenURI","type":"string"},"name":"updateTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"}] var item = web3.ftm.contract(itemAbi).at("0x6B651631Ce8aD5d83D2cF3118F79e3CF27013CE2");
0. yarn
1. yarn compile
2. yarn deploy
3. yarn typechain
4. mkdir dist
5. cd dist
6. mkdir typechain
7. mkdir artifacts
8. yarn build:package
9. npm pack
10. NPM_TOKEN=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 npm publish --access=public