Giter VIP home page Giter VIP logo

ethereum-qr-code's People

Contributors

iviol avatar mezrin avatar shershen08 avatar yazan24 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ethereum-qr-code's Issues

Missing data parameter ?

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.

URL invalid when having 2 parameters

selection_180

The URL ethereum:0x7cB57B5A97eAbe94205C07890BE4c1aD31E486A8?value=10?gas=20 is wrong - should be ethereum:0x7cB57B5A97eAbe94205C07890BE4c1aD31E486A8?value=10&gas=20

[documentation] undef `codeContainer`

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
});

Feature Request : a qr-code which can call a smart contract function

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

Create good demo

We need to create good demo for the library
Place demo on the github pages

Remove excess vallidations

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:

  • functionName !== null && typeof functionName !== 'undefined'
  • 'payable' shoould be true of false

[Request] List with compatible wallet apps

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.

[Usage] Docs differ from Demo

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?

Encode/decode big numbers correctly

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

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.