Open KumarUjjwal2022 opened 1 year ago
For the accounts that fail do they always fail. If so can you share some of those accounts?
@ckniffen Yes, Actually as per my analyzation I observe that When the wallet have issued currency/token and some of the issued currency/token whole trust line is not correct seems to give this issue. So I thing do we need to do something with trust line while fetching balance?
The scenario is When i sign in with Wallet on NFT Exchange and then mint 5 to 10 NFT and then it gets sign out giving above error which i mentioned above and this error was occurring from many day but increased from last Friday. I'm mentioning few of the wallet address below with faces this issue:- rnu33wGHC1xPZsLSiDfwnz49CmQiJp7UCh rHVj545USGniF3hvGRKNZHipxVUE25a2gz rUoAF3hZwincR29qrVZXE28Tw6cqdf5S rhWgHYpM8AoxiwjwupqvBZMfCz5kxXKFCX
Have you opened support issues with those NFT marketplaces? Also what wallet are you using with those marketplaces?
Actually It's not marketplace I'm trying to make one for me on XRPL. So after I get the signers wallet address I use to fetch wallet balance as i mentioned but this issue comes random like within minutes and sometimes within hours. I have mention the wallet address above i.e. rnu33wGHC1xPZsLSiDfwnz49CmQiJp7UCh rHVj545USGniF3hvGRKNZHipxVUE25a2gz rUoAF3hZwincR29qrVZXE28Tw6cqdf5S rhWgHYpM8AoxiwjwupqvBZMfCz5kxXKFCX
Also I want too know what is the proper way to detect whether the wallet address with which I'm signing is mainnet/devnet/testnet wallet address.?
Also I want too know what is the proper way to detect whether the wallet address with which I'm signing is mainnet/devnet/testnet wallet address.?
There sort of is. There is support for t
addresses for testnet but those never really caught on. Any address that starts with r
is cryptographically valid on any network.
I tried those 4 accounts and was able to get them to work using this code. https://replit.com/@ckniffen/FrightenedRequiredConsultant#index.js
const xrpl = require("xrpl");
const ac = 'rHVj545USGniF3hvGRKNZHipxVUE25a2gz'
const client = new xrpl.Client('wss://xrplcluster.com');
client.connect().then(async () => {
let currency = await client.getBalances(ac);
console.log("value", currency)
})
Also I want too know what is the proper way to detect whether the wallet address with which I'm signing is mainnet/devnet/testnet wallet address.?
There sort of is. There is support for
t
addresses for testnet but those never really caught on. Any address that starts withr
is cryptographically valid on any network.
I understand your point but all address starting with r
is always of mainnet and correct?
As when i check account_info of rUoAF3hZwincR29qrVZXE28Tw6cqdf5S , Ledger gives this response so what does this mean
"Account malformed."
{ "error": "actMalformed", "error_code": 35, "error_message": "Account malformed.", "id": 2, "request": { "account": "rUoAF3hZwincR29qrVZXE28Tw6cqdf5S", "command": "account_info", "id": { "fake_valuenodepref": "nonfh", "fake_values": true, "original_value": 2 }, "ledger_index": "current", "queue": true, "strict": true }, "status": "error", "type": "response" }
Actually @ckniffen i want to know the method or process by which i can decide that the wallet address who signed is mainnet wallet.
@KumarUjjwal2022 Testnet attempts to be a mirror of mainnet in terms of amendments & how it processes transactions, so it currently doesn't have a way to distinguish account addresses from one network or the other just by looking at them because both networks have the same rules for what makes an address a valid address.
One thing you could try is having a client connection to both testnet and mainnet, and then looking up the account on the other if one of them failed.
If you just want to know if an address is well-formatted, you can use isValidAddress
in xrpl.js (which is ultimately from the ripple-address-codec
package)
I tried those 4 accounts and was able to get them to work using this code. https://replit.com/@ckniffen/FrightenedRequiredConsultant#index.js
const xrpl = require("xrpl"); const ac = 'rHVj545USGniF3hvGRKNZHipxVUE25a2gz' const client = new xrpl.Client('wss://xrplcluster.com'); client.connect().then(async () => { let currency = await client.getBalances(ac); console.log("value", currency) })
Okay @ckniffen , I'm also doing same it gives balance but after few hours or minutes it gets logout giving INVALID PARAMETERS error,
I will explain you my signin method if you want as I am checking this getBalance() method inside sigin also and inside that I get errors and then got logout.
@ckniffen Actually I want to identify only mainnet address i.e. I want to allow those address which is of mainnet XRPL to perform different operation on NFT Exchange otherwise those address which is not of Mainnet ( might be of testnet or of NFT devnet ) don't allow that. So what should i do in this case.?
Also the main wallet address doesn't get the issue but the Vanity address which is derived from main wallet get this INVALID PARAMETER issue.
Also the main wallet address doesn't get the issue but the Vanity address which is derived from main wallet get this INVALID PARAMETER issue.
Can you share an example of the main wallet address vs the vanity address?
I'm not sure what you mean by vanity address, as there is only one valid address per account.
@JST5000 Vanity address is just the custom wallet address whose address you can choose yourself and that is derived from your main wallet address secret key. For more details you can visit https://github.com/WietseWind/xrp-vanity-generator.
Actually the problem I was facing was due to XRPL server ( I'm not sure about it but got balance.) When i connect with wss://xrplcluster.com and try to getBalance then it gives error but after debugging a lot when i changed server to wss://s2.ripple.com , I got all currencies/tokens balance.
So I'm confused little bit as the wallet address i was checking balance is rDPMFNFTsZtZxH86J3TozTXQUYiHGX52RS. Can someone clear my confusion why there is two different result with two different server. It will be very grateful.
Specifically, what error do you get from xrplcluster?
You can copy and paste the error here.
When i try to get xrpl account balance, It gives me below error:-
RippledError: Invalid parameters. data: { error: 'invalidParams', error_code: 31, error_message: 'Invalid parameters.', id: 307, request: { account: 'XYZ', command: 'account_lines', id: [Object], ledger_index: 'validated', limit: 200, marker: 'XYZ' }, status: 'error', type: 'response' } }
Below is the code I am using to fing balance using nodejs version-14.17.1, xrpl npm version-2.6.0 and XRPL mainnet url : wss://xrplcluster.com/ in windows system :-
try { const { ac } = req.decoded; await client.connect(); let currency = await client.getBalances(ac); console.log("value", currency ) } catch (error) { console.log("error get balance", error) }
For some account it gives all currencies balance but for few wallets it gives above error. like for example xrpl airdrop wallets get above mentioned error.
Thanks in advance for any suggestion/help or correct me if I'm doing wrong.
@intelliot This was the error.
@ckniffen Do we have some solution for INVALID PARAMS as I'm getting same error again while fetching wallet balance as it gives balance for some wallet address and in some address it gives same error? Someone please help. Do i need to pass any thing extra along with wallet address inside xrpl.getBalance() method?
@intelliot @ckniffen @JST5000 Do we have solution for "RippledError: Invalid parameters." As I have changed all three full history ripple server after using for 2 to 3 days it through error. Do we need to pass some more parameter in xrpl.getBalance() as right now i'm passing only wallet address. Someone please help.
@KumarUjjwal2022 the id you pass into the rpc call is id: [Object]
. Thats likely where your issue is.
@KumarUjjwal2022
Also, when you reference xrpl.getBalance()
thats a function in the js sdk. Please try to refrain from opening issues on rippled github if you're asking about issues with functionality related to the js sdk. You will get you much more success in your journey if you open issues on the correct github repository.
@dangell7 So is this not the rippled github ? If not Do you know where and how to open this this. As I am fed-up with this issue.
@dangell7 Please correct me where i'm wrong. This is my code :- try { const { ac } = req.decoded; await client.connect(); let currency = await client.getBalances(ac); console.log("value", currency ) } catch (error) { console.log("error get balance", error) }
@dangell7 So is this not the rippled github ? If not Do you know where and how to open this this. As I am fed-up with this issue.
You're using this repo to make that call right? You installed the xrpl
package from that repository right? So I would say no, this isn't the correct repository to make an issue in if you installed and are using a package from another repo.
Its not a big deal its just getting overlooked because all the guys here are C experts not experts in the js sdk.
@dangell7 Please correct me where i'm wrong. This is my code :- try { const { ac } = req.decoded; await client.connect(); let currency = await client.getBalances(ac); console.log("value", currency ) } catch (error) { console.log("error get balance", error) }
This code works perfectly for me. Is this not giving you a response?
import { Client } from "xrpl";
const demo = async () => {
const client = new Client("wss://s.altnet.rippletest.net:51233/");
await client.connect();
let currency = await client.getBalances("rUA1chq23vzzbz6LTtAvddCfxtnc5Dscyk");
console.log(currency);
};
demo();
@dangell7 It works for some wallet address and not for few. This is the wallet address which gets above error which i mentioned (rDPMFNFTsZtZxH86J3TozTXQUYiHGX52RS) . Earlier i was using wss://xrplcluster.com/ and when on this server it gave error i switched to wss://s2.ripple.com and it worked for a week then again on this server also i faced same issue for the above wallet address.
@dangell7 Can you check balance of the wallet address which i gave above you will get the error with both server i mentioned.
@dangell7 It works for some wallet address and not for few. This is the wallet address which gets above error which i mentioned (rDPMFNFTsZtZxH86J3TozTXQUYiHGX52RS) . Earlier i was using wss://xrplcluster.com/ and when on this server it gave error i switched to wss://s2.ripple.com and it worked for a week then again on this server also i faced same issue for the above wallet address.
Its definitely something wrong with the js repo. When I use that address here I get no such error. Also I notice that the js repo is filling the id field with an object. That would be my first lead.
try something like this in the mean time
const request: AccountLinesRequest = {
command: "account_lines",
account: "rDPMFNFTsZtZxH86J3TozTXQUYiHGX52RS",
};
const response = await client.request(request);
Thanks but I think this will give me only xrp balance not of all issued currencies/token a wallet have. Will it? @dangell7 Also what you mentioned above about account_lines, So i need to find balance after getting account_lines or only i need to get account_lines?
Thanks but I think this will give me only xrp balance not of all issued currencies/token a wallet have. Will it? @dangell7
Nope I thought you wanted balance. My apologies. For the currencies you need to use the 'account_lines' endpoint. But when you have more than the limit, you need to loop through the response. This is what the getBalances
function does.
At the moment that isnt working for this wallet. I would create or see if there is an issue in the JS repo linked above. In the mean time because you only have a few lines, the account_lines
endpoint should get you back on track for now.
Thanks but I think this will give me only xrp balance not of all issued currencies/token a wallet have. Will it? @dangell7 Also what you mentioned above about account_lines, So i need to find balance after getting account_lines or only i need to get account_lines?
It depends what balance you want. AccountInfo returns the xrp balance. AccountLines will return the token balances.
Okay No need to apologize @dangell7 , So you mean i need to do both the things account_lines as well as account_info to get all balances of an address i.e. xrp balance as well as all token balance.?
Okay No need to apologize @dangell7 , So you mean i need to do both the things account_lines as well as account_info to get all balances of an address i.e. xrp balance as well as all token balance.?
Yes, to replace the getBalances
function you would need to implement both requests.
Okay No need to apologize @dangell7 , So you mean i need to do both the things account_lines as well as account_info to get all balances of an address i.e. xrp balance as well as all token balance.?
I created an issue here for you.
Okay thanks a lot @dangell7 for your support. Should i raise ticket on xrpl js repo about this issue i.e. client.getBalance() not working properly?
The PR in xrpl.js (https://github.com/XRPLF/xrpl.js/issues/2311) was closed, so I think this one can be closed as well.
When i try to get xrpl account balance, It gives me below error:-
RippledError: Invalid parameters. data: { error: 'invalidParams', error_code: 31, error_message: 'Invalid parameters.', id: 307, request: { account: 'XYZ', command: 'account_lines', id: [Object], ledger_index: 'validated', limit: 200, marker: 'XYZ' }, status: 'error', type: 'response' } }
Below is the code I am using to fing balance using nodejs version-14.17.1, xrpl npm version-2.6.0 and XRPL mainnet url : wss://xrplcluster.com/ in windows system :-
try { const { ac } = req.decoded; await client.connect(); let currency = await client.getBalances(ac); console.log("value", currency ) } catch (error) { console.log("error get balance", error) }
For some account it gives all currencies balance but for few wallets it gives above error. like for example xrpl airdrop wallets get above mentioned error.
Thanks in advance for any suggestion/help or correct me if I'm doing wrong.