jibrelnetwork / ethereum-qr-code Goto Github PK
View Code? Open in Web Editor NEWAdvanced QR code generator for Ethereum payments including token transfers
Home Page: https://jibrelnetwork.github.io/ethereum-qr-code/
License: MIT License
Advanced QR code generator for Ethereum payments including token transfers
Home Page: https://jibrelnetwork.github.io/ethereum-qr-code/
License: MIT License
How can I use it in react-native?
There is no dom in react-native.
Hi,
In your encodeEthSend() function, I think you forgot to set data parameter in default mode.
ethereum:<address>[?value=<value>][?gas=<suggestedGas>][?data=<bytecode>]
const encodeEthSend = (data) => {
const fromBlock = isValueDefined(data.from) ? `?from=${data.from}` : '';
let valueBlock;
if (isValueDefined(data.value)) {
const weiValue = new BigNumber(data.value).toString(10);
valueBlock = isValueDefined(data.value) ? `?value=${weiValue}` : '';
}
const gasBlock = isValueDefined(data.gas) ? `?gas=${data.gas}` : '';
return `ethereum:${data.to}${fromBlock}${valueBlock}${gasBlock}`;
};
If you wish I can try to propose a pull request for that.
like:
When scanning the QR in the Trust wallet & Cipher wallet apps, the price field is not filled in.
Add parameter data
to the ethereum:...
This parameter will contain compiled TX data
We will need it here: https://github.com/jibrelnetwork/jwallet-web/projects/3#card-5650293
Create code to recognize and parse parameters of encoded ERC20 transactions (if it is possible)
Move it to the separate lib
Replace etherium with ethereum across files / demo
When scanning the QR code in the Toshi app, the app freezes.
I'm trying to implement your plugin, but right from the start of the docs you write:
new EthereumQRPlugin(codeContainer);
However, this codeContainer
is undefined, so I'm very confused what to feed in there...
import EthereumQRPlugin from 'ethereum-qr-code';
// later in code
const qr = new EthereumQRPlugin(codeContainer);
const qrCode = qr.toCanvas({
selector: '#my-qr-code',
to,
gas
});
Hello there !
the heading of this issue says it all, but i will elaborate further. I am using web3.py and remix browser IDE to test smart contracts in solidity.
so basically my web3.py front-end is implementing this code;
contract = web3.eth.contract(address=address, abi=abi)
where address is contract address and abi is contract abi
i intend on calling a function called show_information in my contract;
contract.functions.show_information(key_value).call()
to make my request a bit more clear, let me show you what the show_information function looks like in Solidity;
function show_information(string a) public view returns (string)
{
return mapping_name[a] // where mapping_name is a mapping and a is the key
}
so like if we scan a qr-code, on the backend, we can retrieve the key_value from the qr-code and then we can call the show_information()
function , from the web3.py front-end by doing something like;
contract.functions.show_information(key_value_obtained_from_qr_code).call()
if this capability already exists in this qr-code module, please let me know
otherwise, consider this a feature request
add required boolean parameter 'payable' to the mode 'function'
We need to create good demo for the library
Place demo on the github pages
https://github.com/jibrelnetwork/ethereum-qr-code/blob/master/src/utils.js#L69
Solidity has 64 int types, the name of the function can be empty string (fallback function), unit
contains a typo (should be uint
) and so on.
It is not the business of QR code generator to check the validity of function signature. Moreover, we can not test this validator. Also, Solidity developed quite fast, we have no chance to maintain our validator in time.
Anyway, the validity of function signature will be performed by client app (via call
request to the node). So we are safe.
Max list of possible checks:
There is no support for this functionality. Why? Anyone know of a wallet that does support it.
so that https://jibrelnetwork.github.io/ethereum-qr-code/index.html or https://jibrelnetwork.github.io/ethereum-qr-code/docs/index.html
is visible as a demo
That one - https://github.com/edi9999/jsqrcode seem as a good choice. May plan to create a demo with encoding / decoding data with it
I'd love a list in the Readme with all the compatible wallet apps where the QR scan works best with your app. Eg. as in the price gets filled in automatically, etc.
Because not all wallet apps have the same scanning specifications I think.
in the demo you initialise with 2 objects in toCanvas:
//run the plugin
qr.toCanvas(sendDetails, configDetails)
but in the main docs you put the selector in the same object as the sendDetails
in the demo:
const qrCode = qr.toCanvas({
selector: '#my-qr-code',
to,
gas
})
Which one is correct?
Line 15 in c1d80e7
Ethereum and tokens use big numbers (multiplier 10**18
) to provide fractional parts of ETH/tokens - because smart contracts are not able to operate with floating point numbers
When we try to encode very big value - like 1000000000000000000000 (i.e. 1000ETH) - we have string like this ethereum:0x7cB57B5A97eAbe94205C07890BE4c1aD31E486A8?value=1e+21
We need a special lib to work with big numbers. For example, web3
uses BigNumber
I think it is even better to prohibit usage of simple JS numbers and require to use BigNumber
for value
and gas
- this will help us avoid numerous wrong-formatted QR codes
Your .toCanvas do parentEl.appendChild(canvas);
on every call.
https://github.com/jibrelnetwork/ethereum-qr-code/blob/master/src/ethereumQrPlugin.js#L44
I think it is not cool idea.
Because some UI can allows users call this method many times.
For example:
There is EIP155 that contains IDs of different blockchains (main, Ropsten, Kovan etc.)
We need to add optional parameter chainId
- this will allow restricting blockchain for the signed transaction.
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.