Quantcast
Channel: Recent Questions - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 6975

SNS - Retrieve all Domains+Subdomains of an User

$
0
0

The following code is used to retrieve all Sub-Domains of a Public-Key.

const getAllSNSProgramAccounts = async () => {    const accounts = await connection.getProgramAccounts(new PublicKey('namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX'), {        commitment: 'confirmed',        encoding: 'base64',        filters: [            {                memcmp: {                    offset: 32,                    bytes: wallet.publicKey.toBase58(),                }            },        ],    });    console.log('All SNS Program Accounts (Domains+Subdomains): ', accounts);}

Note: ATM I think one needs to manually resolve the the returned PKs to distinguish between domains and subdomains.

example result

Ref: https://sns.guide/domain-name/subdomains/index.html


Viewing all articles
Browse latest Browse all 6975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>