Check the Metabonding contract: https://github.com/ElrondNetwork/sc-metabonding-rs/blob/main/metabonding/src/validation.rs#L14
rar493349386 activity
rar493349386 commented on hi guys! Are there any dev contracts for maiar exchage on dev net?
https://devnet.maiar.exchange/ You can check out the contracts this uses
rar493349386 commented on Is there anyway to deploy sc in specific shard?
Create accounts until you have one that in that shard and then deploy your SC from that account. The SC shard is derived from the account shard.
rar493349386 commented on Hello! Does anyone know any example of an app using transactionWatcher?
What example do you need? It's pretty straightforward to use: const transactionWatcher = new TransactionWatcher(this.proxy); const transactionOnNetwork: any = await transactionWatcher.awaitCompleted(transaction);
rar493349386 commented on is there a standard way to authenticate backend routes when using the dapp login?
https://github.com/ElrondNetwork/elrond-sdk-erdjs-examples/tree/main/signing-providers/src Find a basic example on how to do backend login with each provider here
rar493349386 commented on Hey guys. Anybody know why sometimes when I use the Maiar DEX Extension on some sites, it gives an error `This page has been blocked by Chrome ERR_BLOCKED_BY_CLIENT` and I have to reload the actual page from the extension for it to work ok?
Hello, finally found the example. If you go to this Dapp, login with Extension, then click Bet, I get the following in the Extension window: https://gamebly.app/coinflip
rar493349386 commented on hey Rares, can you please pin point a discussion that explains this in more detail?
And these two gits might also help ^ https://gist.github.com/michavie/40d0cc0564e7819a94ee503836a25525 https://gist.github.com/raress96/4135c92049667e9df0d88d4b3b65bb7c
rar493349386 commented on hello! is there any way to verify the identity of a client both on the client and in the backend? Let’s say in the traditional web2 we generate a hash on the client and we verify the integrity of the client on the backend by generating the hash there too and comparing the 2. In web3, if using wa... Read more
Yes, you can get a token from the backend, send it to the signing providers and on login they sign the token with the user's private key. On backed you can then verify this signature with the user's public key. This is how maiar exchange does it.
rar493349386 commented on are there any issues with devnet api as well?
Haven't noticed any and have been developing for the past several hours
rar493349386 commented on So this is basically all behind this situation?
Basically yes. Although I think you can also do the simulate bit, since the random hash depends on the current block hash and the tx hash, so you could just simulate the transaction and see if you like the result and only then send it. Hence this needs to be done in separate transactions like the new docs say, or async cross shard calls need to always be involved. Either way, the solution against this kind of attack is not pretty regarding UX
rar493349386 commented on Can someone explain in more info how the attack on flip coins was done, so we can educate ourselves on how that works? How can you simulate the transaction before you send it?
It's not simulate per say, but when you call a SC from another SC in the same shard, the calls are done sync, so in the same transaction. So in SC 1 you can have it call SC 2 and then check for the result. If the result is not convenient for you, SC 1 transaction throws an error which will automatically revert the SC 2 transaction since it was done synchronously (because on the same shard). This is because the blockchain always reverts everything in a transaction that is synchronous. (not cross shard)
rar493349386 commented on hi guys! I need the number of decimals given a token identifier. The method self.blockchain().get_esdt_token_data(...) is available, but it needs both the token identifier and the address of the creator. How can I get the address of the creator? I can search it at the Elrond Explorer and provide it ... Read more
Not sure about that, since it might not work if the creator is in another shard.
rar493349386 commented on is there a way to clear single value mapper for every key?
No, you would have to store the keys separately in a VecMapper perhaps or use a different type of mapper
rar493349386 commented on Hey, what happenes when an NFT is burned regarding the Elrond API?Will fetching it by it's nonce no longer work after the cache expires?
Note for others, after an NFT is burned, the API will throw 404 when trying to fetch it (at least the Devnet API does this).
rar493349386 commented on hi, how can i convert Denominated amount to amount with erdjs ?
The new TokenPayment class in Erdjs 10 has all the methods you need, eg fungibleFromAmount or `fungibleFromBigInteger`. And the egld/sft/meta esdt equivalents.
rar493349386 commented on anyone know what "new NFT data on sender" error means when transferring an ESDT?
It means that you are trying to send an NFT that doesn't exist on the address that you are sending it from. Check the nonce/collection id/quantity
rar493349386 commented on Hi guys. I can't find the answer neither in the docs nor in examples: Is there a way to do an assertion on local burn of tokens in a mandos test?
Yes, just check that before the call that does the burn, the esdt key contains what you want, and after the contract call, check the esdt key to no longer contain what you want. At least this works for NFTs fine.
rar493349386 commented on Hello, I'm trying to sign a transaction from a dapp frontend, I'm redirected to the web wallet, all transaction details are filled correctly, when I Sign&Submit the transaction is not sent to the API, I'm redirected back to my dapp with all the query params in url, If I decode them and I manually do... Read more
I believe this is the new way it works with Erdjs 10, the wallet just signs the transaction and then redirects back and it's up to the Dapp to implementing the sending of the transaction. TBH I haven't bothered re-integrating web wallet login in my Dapp, too much work to get it done and not used by a lot of people compared to the extension, maiar or ledger.
rar493349386 commented on Hello! I saw that rust HashMap can't be used in smart contracts as std in not allowed. Is there an alternative? I have a use case where for internal computation (not storage) I need to sum some values by keys and at the end retrieve all of the keys and their resulting sum. Is there a way to do this... Read more
Hello, I had the same use case. There is no alternative to HashMap. You should rethink your algorithm to not require a hashmap. For me, I added a logic to send some values in ascending order only to the SC so then I could check when a value (key) changed and add them to a ManagedVec in a struct containing the key and value.
rar493349386 commented on If not, maybe someone has a new wallet extension in work?
It's not going to be open source for security reasons, to prevent 3rd parties from modifying it and impersonating the official extension (same reason why Metamask is not open source, why the web wallet is not etc)