-
Notifications
You must be signed in to change notification settings - Fork 8
getParsedAllUserDomains(owner) throws error TypeError: Max seed length exceeded #23
Description
So I was trying to use getParsedAllUserDomains(owner) to retrieve the user domains associated with a particular public key , so I wrote some example tests to do this
describe("getOwnedAllDomains", () => {
it("should return array of domains for an owner", async () => {
const owner = new PublicKey(
"2EGGxj2qbNAJNgLCPKca8sxZYetyTjnoRspTPjzN2D67"
);
const domains = await agent.getOwnedAllDomains(owner);
expect(domains).to.be.an("array").that.includes("miester.sol");
domains.forEach((domain) => {
expect(domain).to.be.a("string");
});
});
it("should return array of domains for an owner", async () => {
const owner = new PublicKey(agent.wallet_address);
const domains = await agent.getOwnedAllDomains(owner);
expect(domains).to.be.an("array");
domains.forEach((domain) => {
expect(domain).to.be.a("string");
});
});
it("should handle owner with no domains", async () => {
// Create a new random public key that likely owns no domains
const emptyOwner = PublicKey.unique();
const domains = await agent.getOwnedAllDomains(emptyOwner);
expect(domains).to.be.an("array");
expect(domains).to.have.lengthOf(0);
});
});upon running them I got the same error -
TypeError: Max seed length exceeded
at forEach (/Users/username/solana-agent-kit/node_modules/.pnpm/@solana+web3.js@1.98.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@solana/web3.js/src/publickey.ts:175:15)
at Array.forEach (<anonymous>)
at Function.createProgramAddressSync (/Users/username/solana-agent-kit/node_modules/.pnpm/@solana+web3.js@1.98.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@solana/web3.js/src/publickey.ts:173:11)
at Function.findProgramAddressSync (/Users/username/solana-agent-kit/node_modules/.pnpm/@solana+web3.js@1.98.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@solana/web3.js/src/publickey.ts:221:24)
at findTldHouse (/Users/username/solana-agent-kit/node_modules/.pnpm/@onsol+tldparser@0.6.7_@solana+web3.js@1.98.0_bufferutil@4.0.8_utf-8-validate@5.0.10__bn.js@5_27ko3lcyvhk2gu6uwvnrtcsfey/node_modules/@onsol/tldparser/src/utils.ts:266:22)
at TldParser.<anonymous> (/Users/username/solana-agent-kit/node_modules/.pnpm/@onsol+tldparser@0.6.7_@solana+web3.js@1.98.0_bufferutil@4.0.8_utf-8-validate@5.0.10__bn.js@5_27ko3lcyvhk2gu6uwvnrtcsfey/node_modules/@onsol/tldparser/src/parsers.ts:473:16)
at Generator.next (<anonymous>)
at fulfilled (/Users/username/solana-agent-kit/node_modules/.pnpm/@onsol+tldparser@0.6.7_@solana+web3.js@1.98.0_bufferutil@4.0.8_utf-8-validate@5.0.10__bn.js@5_27ko3lcyvhk2gu6uwvnrtcsfey/node_modules/@onsol/tldparser/dist/cjs/parsers.js:5:58)upon further inspection I figured out the cause of the problem ,
I went to the getParsedAllUserDomains function in the parsers.js file in the compiled javascript code and put some console.logs in the for loop to trace the error , basically it first loops through all the TLDs gotten from the getAllTId method
getParsedAllUserDomains(userAccount) {
return __awaiter(this, void 0, void 0, function* () {
const allTlds = yield (0, utils_1.getAllTld)(this.connection);
let parsedNameAccountsAndDomains = [];
if (typeof userAccount == 'string') {
userAccount = new web3_js_1.PublicKey(userAccount);
}
for (let { parentAccount, tld } of allTlds) {
let tldName = tld.toString();
console.log(`this is the tldName ${tldName}`)
const [tldHouse] = (0, utils_1.findTldHouse)(tldName);
console.log(`this is the tldHouse ${tldHouse}`)and it gave me this output
this is the tldName .kingali
this is the tldHouse DsP68VSd1dELdFgms8mtipzeqrtPRvkRcTmDMNUooq7j
this is the tldName .freedom
this is the tldHouse DKwkU8An3ttJ74vKUkYQc52YbwzQyHdNKcpyFnBhK49u
this is the tldName .xyz
this is the tldHouse 8mqV9iXcrjKZaxK95NGFLtapnZ8SgdNwZBuz4gt9CAy9
this is the tldName .blink
this is the tldHouse CD1viBNn8vu8sPiYuPf2tx9SVrpgqP6vEr2ivD4aJtu9
this is the tldName .idx
this is the tldHouse DiKh3v9gKHSBwncDxpN3Paw3vvr42hD8zQDSiqMDt2P9
this is the tldName .token
this is the tldHouse 4n4SJz4eFPf7oKz9HW4GMGe7HC4H2UAUr1855VsqtuPy
this is the tldName .gn
this is the tldHouse 2p8TQ98TXEL4GqfGt1QUS3cMmETEfKrP88A4nSGqXybo
this is the tldName .whatis
this is the tldHouse CxabKRRq7jZD1NhG5gwfNBuBQHv1B4VpbxQPigCGndAD
this is the tldName .nft
this is the tldHouse GZF3xuRk8KncrY6wXZPqd99PyispfqD3xYWso9ez5Xaa
this is the tldName .id
this is the tldHouse Bx2ASGzaKUXusJWGQDqUzBLfQUgJPB5bfWDkGSdcLMS1
this is the tldName .fanestld
this is the tldHouse A2SRYWYfN6DQfGCKji88TM4eNBkQwgcTZ3LvcxixRB1n
this is the tldName .more
this is the tldHouse 8Gi3Z4VHXgtxboK1p5acUUrGb1nSeL1B8UWuD6GZgcpu
this is the tldName .blabla
this is the tldHouse GfkE3kTBWAoa49qXjaGbfCoE7W3p2PWnDYvFKD3b8xQT
this is the tldName .zkk
this is the tldHouse BEdrfTsQ8L8K4SK4t7esMth1j28RPrTrqpcudrqx6h5h
this is the tldName .new
this is the tldHouse DdZH8wgvSBggbUi8ncDat7Tr9kjBcR9ctGcL6nf27qzK
this is the tldName .whatever
this is the tldHouse BuS29eDmrBkK3CM9QZiWJqo5vDW1E7ZZhdL2yqcsHpjv
this is the tldName H�u��)"������I���B��.N&u��the last value is where it threw the error and failed, the TLD most likely has unsupported unicode characters as we can see the garbled output, so when that was passed to the findTldHouse method thats when it threw the error that the max seed length exceeded
function findTldHouse(tldString) {
tldString = tldString.toLowerCase();
return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from(constants_1.TLD_HOUSE_PREFIX), Buffer.from(tldString)], constants_1.TLD_HOUSE_PROGRAM_ID);
}