The Solidity Contract-Oriented Programming Language - By chatting here you agree to the https://github.com/ethereum/solidity/blob/develop/CODE_OF_CONDUCT.md
const DOMAIN_TYPE = [
{
type: 'string',
name: 'name'
},
{
type: 'string',
name: 'version'
},
{
type: 'uint256',
name: 'chainId'
},
{
type: 'address',
name: 'verifyingContract'
}
];
const domainData = {
name: 'Market721',
version: '1',
chainId: '1337',
verifyingContract: '0x296564F6260b95f99F93fB347d456b7FC825771b'
};
const OrderTypes = {
AssetType: [
{ name: 'assetClass', type: 'bytes4' },
{ name: 'data', type: 'bytes' }
],
Asset: [
{ name: 'assetType', type: 'AssetType' },
{ name: 'value', type: 'uint256' }
],
Order: [
{ name: 'maker', type: 'address' },
{ name: 'makeAsset', type: 'Asset' },
{ name: 'taker', type: 'address' },
{ name: 'takeAsset', type: 'Asset' }
]
};
const createTypeData = (domain, primaryType, message, types) => {
return {
types: { EIP712Domain: DOMAIN_TYPE, ...types },
domain,
primaryType,
message
};
};
const leftUH = {
maker: "0xfa6954192c3087f9143f5401f7804b405ac84ca5",
makeAsset: {
assetType: {
assetClass: id('ERC20'),
data: web3.eth.abi.encodeParameter('address', '0xfa6954192c3087f9143f5401f7804b405ac84ca5')
},
value: BigNumber("100000000")
},
taker: "0x3bed4334ce380cfe41363c7e875a9fc1769578b1",
takeAsset: {
assetType: {
assetClass: id('ERC721'),
data: web3.eth.abi.encodeParameter({ root: { contract: "address", tokenId: "uint256" }}, { contract: '0xfa6954192c3087f9143f5401f7804b405ac84ca5', tokenId: 1 })
},
value: "1"
}
};
const leftMsgParams = createTypeData(domainData, 'Order', leftUH, OrderTypes)
const leftSig = sigUtil.signTypedData_v4(Buffer.from(leftAcc, 'hex'), { data: leftMsgParams });
const resault = await market.matchOrders(leftUH, leftSig, rightUH, rightSig);
Hi I'm actually doing an online course and I'm developping on nextjs but I have this poblem on my web3.js code :Server Error
ReferenceError: window is not defined
This error happened while generating the page. Any console logs will be displayed in the terminal window.
Source
eth/web3.js (3:0) @ eval
1 | import Web3 from "web3";
2 |
3 | window.ethereum.request({ method: "eth_requestAccounts" });
4 |
5 | const web3 = new Web3(window.ethereum);
6 |
Hi @cameel:matrix.org I read in the docs:
block.basefee (uint): current block’s base fee (EIP-3198 and EIP-1559)
https://docs.soliditylang.org/en/v0.8.9/cheatsheet.html?highlight=block.basefee
It's a bit ambiguous as to whether this is the base fee of the previous block or the current block that this transaction will be included in.
Is it the basefee of the block that the transaction is included in?
Also I wondered what's the best way to get the value for the transactions priorityFee?
Is it: tx.gasprice - block.basefee
?
web3.js
within a browser or server context?
Hello everybody, I am very new in Solidity and also in JavaScript. I finished the CryptoZombies tutorial (maybe you know that) and now I am just playing around a bit to display some things via Javascript.
I have the following problem: I have an array where some parameters as "name" "age" etc are stored and a mapping where it is stored which array entry belongs to which user. So there are more than one entry per address possible.
My problem now is, if I want to display it and I use a "while"-pattern, the while pattern is finished before the results from the smart contract querys are there. And also the results from the smart contract array are not always available in the order requested. so an example:
according to the mapping array entry 0, 3 and 4 belong to some specific address.
so i implemented a while pattern and requested entrys 0, 3 and 4 of the array in the contract but results got in order 3, 0, 4. From MySQL and PHP what I learned several years ago the results are always presented in the order you wanted them. Any suggestions?
"Unreachable code."
warning with solc 0.8.9 even though the code is definitely reachable. I saw : ethereum/solidity#11522