CRYPTO NEWS

Parsing cryptocurrency URL Address format in Android (Java/Kotlin)

I need to scan qr code with address and amount to transfer for any crypto wallet.
Usually the wallet address and the transfer amount are sent in the uri format, but just a string with the wallet address can also be sent, without the amount and without the name of the wallet

For example, the result of scanning a qr code can give the following data:

  1. bitcoin:tb1q3z4lty9xfyxwwdhmmztdynhfx5expkalg0s7pm?amount=10.2&message=message1453
  2. bitcoincash:bchtest:qq9c03nyhhlh5jmfrkwz6r2zjn4j87ejtqeytnre78?amount=0.1111&message=message message message
  3. litecoin:tltc1q9zrfgnrvsnaxuymuzvkpagd7c37ncdvueyts2a?amount=0.1&message=mes
  4. CustomWallet:tltc1q9zrfgnrvsnaxuymuzvkpagd7c37ncdvueyts2a?amount=0.1111&message=
  5. tltc1q9zrfgnrvsnaxuymuzvkpagd7c37ncdvueyts2a

Can I get wallet address and amount (if specified) without wallet label ("bitcoin:", "bitcoincash:", but "bchtest:" – it important part of wallet address)?

Compare different parts of two bytes[] arrays

Assume I have two bytes variables: t1 and t2, where t1<t2. I also have a bytes variable x. I want to divide t2 into two parts. Compare the first part to see if it is equal to t1, and the second part to see if it is equal to x. function dummy(bytes memory t1, bytes::Listen

Assume I have two bytes variables: t1 and t2, where t1<t2. I also have a bytes variable x. I want to divide t2 into two parts.

Compare the first part to see if it is equal to t1, and the second part to see if it is equal to x.

function dummy(bytes memory t1, bytes memory t2, bytes memory x) returns(bool,bool){    bytes _equal;    //first part of t2   assembly {   calldatacopy(0x0, 0, t1.length)   _equal := mload(0x0)   }    //compare first part and t1   bool equal = (keccak256(abi.encodePacked(t1)) == keccak256(abi.encodePacked(_equal));    //second part of t2   assembly {   calldatacopy(0x0, t1.length, t2.length)   _x := mload(0x0)   }    //compare second part and x   bool element = (keccak256(abi.encodePacked(x)) == keccak256(abi.encodePacked(_x));    return(equal, element); } 

The separating the part code I got from here

And the idea that I can use bytes.length I got from here, but the compiler doesnt seem to agree, as I get:

ParserError: Expected ‘)’ but got ‘.’ calldatacopy(0x0, 0,t1.length)

and

ParserError: Expected primary expression. calldatacopy(0x0, 0,t1.length)

Can anyone point out what I am doing wrong or offer an alternative way to go about it? Thanks in advance.

Parsing cryptocurrency URL Address format in Android (Java/Kotlin)

Shopping cart
There are no products in the cart!
Continue shopping
0