Closed awmuncy closed 1 year ago
@andrewxhill This issue is caused by the testnet/mainnet validator split. I was able to fix it for now but specifying the host as testnet.tableland.network, but this will eventually break as the network split moves forward. That is to say, this problem is not solved, so I'm not closing the ticket.
Yeh this isn't a "bug" though right? It is a feature. What exactly is "breaking here"?
This is a bug in the NFT renderer app, not the validator or SDK. It's totally expected and reasonable behavior from those entities. I'm just going to have to figure out how to fix it in the renderer app. When the query parameters include a chaid id, it's pretty easy; just connect to the host associated with that chain. However, if someone loads the app without a query parameter, it becomes a problem. This may never happen, since I don't know of a situation where this would be rendered without the query parameter. Right now, it's only loaded in marketplaces. But if that does happen, I would need to parse the user's query, figure out the chain id of the network they're querying from the table name specified, and connect to the right host from there.
wondering... is that a problem that the sdk should help with? feels... helpful. some ideas
.gatewayFor(tablename) => 'testnet' || 'mainnet'
.gatewayUrlFor(tableland) => 'testnet.tableland.xyz'
.networkFor(tablename) => 'testnet' || 'mainnet'
something like that
another idea, maybe the best
.info(tablename) => {network: string, gateway: string, networkId: int, prefix: string, tokenId: int}
The refactored SDK (will have, I mean, it has them, but it isn't published) helper functions for getBaseUrl, getChainId, getContractAddress, and others. We could probably also have some helpers explicitly for whether it is a 'testnet' or 'mainnet'?
With all of that in mind, even with the current parser and sdk, the above information can be extracted. Normalizing a statement can be used to extract the table name, and validateTableName can be used to extract the chainId, etc. Then you simply create a helper function of your own (just for now) that switches on this and returns 'testnet' or 'mainnet' as needed.
But again, if we can hold off a bit, then we can get all this "for free" via the SDK, because the SDK needs to know all this to route queries appropriately anyway.
I believe this is due to Validator/SDK updates, though I could be wrong.