import { Address, Instruction, Rpc, GetAccountInfoApi, GetMinimumBalanceForRentExemptionApi } from '@solana/kit'; /** * Parameters for burning an SNS domain. * * @example * ```ts * const params: BurnDomainParams = { * domain: "example.sns", * owner, * refundAddress, * }; * ``` */ interface BurnDomainParams { /** Full `.sns` domain name. */ domain: string; /** Current domain owner. */ owner: Address; /** Account receiving reclaimed rent. */ refundAddress: Address; } /** * Builds an instruction to burn a top-level `.sns` domain. * * @param params Burn parameters * @param params.domain Full `.sns` domain name * @param params.owner Current owner of the domain * @param params.refundAddress Account receiving reclaimed rent * @returns Transaction instruction. * * @example * ```ts * const instruction = await burnDomain({ domain: "example.sns", owner, refundAddress }); * ``` */ declare const burnDomain: ({ domain, owner, refundAddress, }: BurnDomainParams) => Promise; /** * Parameters for creating a name registry. * * @example * ```ts * const params: CreateNameRegistryParams = { rpc, name: "example", space: 32, payer, owner }; * ``` */ interface CreateNameRegistryParams { /** RPC client. */ rpc: Rpc; /** Raw registry name. */ name: string; /** Account data size in bytes. */ space: number; /** Account paying for creation. */ payer: Address; /** Owner of the new registry. */ owner: Address; /** Account funding amount. Defaults to the rent-exempt minimum. */ lamports?: bigint; /** Registry class address. */ classAddress?: Address; /** Parent registry address. */ parentAddress?: Address; } /** * Creates a raw SPL Name Registry account with the given rent budget, * allocated space, owner, and class. * * This low-level helper accepts a raw registry seed/name and does not parse * `.sns` or `.sol` suffixes. * * @param params Creation parameters * @param params.rpc RPC client implementing account and rent-exemption APIs * @param params.name Raw registry seed/name for the new account * @param params.space Space in bytes allocated to the account * @param params.payer Account paying for allocation * @param params.owner Owner of the new name account * @param params.lamports Optional lamports to fund the account. Defaults to the rent-exempt minimum * @param params.classAddress Optional class address for the registry * @param params.parentAddress Optional parent registry address * @returns Transaction instruction. * * @example * ```ts * const instruction = await createNameRegistry({ rpc, name: "example", space: 32, payer, owner }); * ``` */ declare const createNameRegistry: ({ rpc, name, space, payer, owner, lamports, classAddress, parentAddress, }: CreateNameRegistryParams) => Promise; /** * Supported SNS record identifiers. */ declare enum Record { IPFS = "IPFS", ARWV = "ARWV", SOL = "SOL", ETH = "ETH", BTC = "BTC", LTC = "LTC", DOGE = "DOGE", Email = "email", Url = "url", Discord = "discord", Github = "github", Reddit = "reddit", Twitter = "twitter", Telegram = "telegram", Pic = "pic", SHDW = "SHDW", POINT = "POINT", BSC = "BSC", Injective = "INJ", Backpack = "backpack", A = "A", AAAA = "AAAA", CNAME = "CNAME", TXT = "TXT", Background = "background", BASE = "BASE", IPNS = "IPNS", Bio = "bio" } /** * Parameters for creating a domain record. * * @example * ```ts * const params: CreateRecordParams = { * domain: "example.sns", * record: Record.Url, * content: "https://example.com", * owner, * payer, * }; * ``` */ interface CreateRecordParams { /** Full `.sns` domain name. */ domain: string; /** Record type. */ record: Record; /** Record content. */ content: string; /** Current domain owner. */ owner: Address; /** Instruction fee payer. */ payer: Address; } /** * Builds an instruction to create a V2 record for a `.sns` domain or subdomain. * * Record content is serialized according to SNS-IP 1. * * @param params Record creation parameters * @param params.domain Full `.sns` domain or subdomain name * @param params.record Record type * @param params.content Record content * @param params.owner Current owner of the domain * @param params.payer Fee payer for the instruction * @returns Transaction instruction. * * @example * ```ts * const instruction = await createRecord({ * domain: "example.sns", * record: Record.Url, * content: "https://example.com", * owner, * payer, * }); * ``` */ declare const createRecord: ({ domain, record, content, owner, payer, }: CreateRecordParams) => Promise; /** * Parameters for creating a reverse lookup record. * * @example * ```ts * const params: CreateReverseParams = { domainAddress, domain: "example", payer }; * ``` */ interface CreateReverseParams { /** Domain account address. */ domainAddress: Address; /** Raw reverse lookup payload. */ domain: string; /** Account funding creation. */ payer: Address; /** Parent domain address for a subdomain. */ parentAddress?: Address; /** Parent domain owner for a subdomain. */ parentOwner?: Address; } /** * Creates a raw reverse lookup record for the specified domain account. * * This low-level helper accepts the stored reverse payload as `domain` and * does not parse `.sns` or `.sol` suffixes. * * @param params Reverse lookup creation parameters * @param params.domainAddress Domain account the reverse lookup points to * @param params.domain Raw reverse payload to store * @param params.payer Account funding reverse lookup creation * @param params.parentAddress Optional parent domain address for subdomain reverse lookups * @param params.parentOwner Optional parent domain owner for subdomain reverse lookups * @returns Transaction instruction. * * @example * ```ts * const instruction = await createReverse({ domainAddress, domain: "example", payer }); * ``` */ declare const createReverse: ({ domainAddress, domain, payer, parentAddress, parentOwner, }: CreateReverseParams) => Promise; /** * Parameters for creating an SNS subdomain. * * @example * ```ts * const params: CreateSubdomainParams = { * rpc, * subdomain: "sub.example.sns", * owner, * }; * ``` */ interface CreateSubdomainParams { /** RPC client. */ rpc: Rpc; /** Full `.sns` subdomain name. */ subdomain: string; /** New subdomain owner. */ owner: Address; /** Account data size in bytes. Defaults to 2,000. */ space?: number; /** Account funding creation. Defaults to `owner`. */ feePayer?: Address; } /** * Builds the instructions to create a `.sns` subdomain. * * The subdomain registry instruction is always included. The reverse lookup * instruction is included only when the reverse lookup account does not exist. * * @param params Subdomain creation parameters * @param params.rpc RPC client implementing account and rent-exemption APIs * @param params.subdomain Full `.sns` subdomain name * @param params.owner New subdomain owner and parent owner for reverse lookup creation * @param params.space Optional space in bytes allocated to the subdomain account. Defaults to 2,000 * @param params.feePayer Optional account funding subdomain creation. Defaults to `owner` * @returns Transaction instructions. * * @example * ```ts * const instructions = await createSubdomain({ rpc, subdomain: "sub.example.sns", owner }); * ``` */ declare const createSubdomain: ({ rpc, subdomain, owner, space, feePayer, }: CreateSubdomainParams) => Promise; /** * Parameters for deleting a name registry. * * @example * ```ts * const params: DeleteNameRegistryParams = { rpc, name: "example", refundAddress }; * ``` */ interface DeleteNameRegistryParams { /** RPC client. */ rpc: Rpc; /** Raw registry name. */ name: string; /** Account receiving refunded rent. */ refundAddress: Address; /** Registry class address. */ classAddress?: Address; /** Parent registry address. */ parentAddress?: Address; } /** * Deletes a raw SPL Name Registry account and refunds the associated rent * balance to the specified target. * * This low-level helper accepts a raw registry seed/name and does not parse * `.sns` or `.sol` suffixes. * * @param params Deletion parameters * @param params.rpc RPC client implementing account lookup * @param params.name Raw registry seed/name whose account will be deleted * @param params.refundAddress Address receiving the refunded rent balance * @param params.classAddress Optional class address for the registry * @param params.parentAddress Optional parent registry address * @returns Transaction instruction. * * @example * ```ts * const instruction = await deleteNameRegistry({ rpc, name: "example", refundAddress }); * ``` */ declare const deleteNameRegistry: ({ rpc, name, refundAddress, classAddress, parentAddress, }: DeleteNameRegistryParams) => Promise; /** * Parameters for deleting a domain record. * * @example * ```ts * const params: DeleteRecordParams = { * domain: "example.sns", * record: Record.Url, * owner, * payer, * }; * ``` */ interface DeleteRecordParams { /** Full `.sns` domain name. */ domain: string; /** Record type. */ record: Record; /** Current domain owner. */ owner: Address; /** Instruction fee payer. */ payer: Address; } /** * Builds an instruction to delete a V2 record for a `.sns` domain or subdomain. * * @param params Record deletion parameters * @param params.domain Full `.sns` domain or subdomain name * @param params.record Record type * @param params.owner Current owner of the domain * @param params.payer Fee payer for the instruction * @returns Transaction instruction. * * @example * ```ts * const instruction = await deleteRecord({ * domain: "example.sns", * record: Record.Url, * owner, * payer, * }); * ``` */ declare const deleteRecord: ({ domain, record, owner, payer, }: DeleteRecordParams) => Promise; /** * Parameters for registering an SNS domain. * * @example * ```ts * const params: RegisterDomainParams = { * domain: "example.sns", * space: 1_000, * buyer, * buyerTokenAccount, * }; * ``` */ interface RegisterDomainParams { /** Full `.sns` domain name. */ domain: string; /** Domain registry size in bytes. */ space: number; /** Account paying for registration. */ buyer: Address; /** Buyer's payment token account. */ buyerTokenAccount: Address; /** Payment token mint. Defaults to USDC. */ mint?: Address; /** Supported referrer address. */ referrer?: Address; } /** * Builds the instructions to register a top-level `.sns` domain. * * If a supported referrer is provided, the returned instructions include an * idempotent associated token account creation instruction before the * registration instruction. * * @param params Registration parameters * @param params.domain Full `.sns` domain name * @param params.space Number of bytes to allocate for the domain registry * @param params.buyer Buyer paying for the registration * @param params.buyerTokenAccount Buyer's token account used to pay for registration * @param params.mint Token mint used for payment. Defaults to USDC * @param params.referrer Optional referrer address * @returns Transaction instructions. * * @example * ```ts * const instructions = await registerDomain({ * domain: "example.sns", * space: 1_000, * buyer, * buyerTokenAccount, * }); * ``` */ declare const registerDomain: ({ domain, space, buyer, buyerTokenAccount, mint, referrer, }: RegisterDomainParams) => Promise; /** * Parameters for registering an SNS domain with an NFT. * * @example * ```ts * const params: RegisterDomainWithNftParams = { * domain: "example.sns", * space: 1_000, * buyer, * nftSource, * nftMint, * }; * ``` */ interface RegisterDomainWithNftParams { /** Full `.sns` domain name. */ domain: string; /** Domain registry size in bytes. */ space: number; /** Account registering the domain. */ buyer: Address; /** Source token account for the NFT. */ nftSource: Address; /** Bonfida Wolves NFT mint. */ nftMint: Address; } /** * Builds an instruction to register a top-level `.sns` domain using a Bonfida Wolves NFT. * * @param params Registration parameters * @param params.domain Full `.sns` domain name * @param params.space Number of bytes to allocate for the domain registry * @param params.buyer Buyer paying for the registration * @param params.nftSource NFT source account * @param params.nftMint NFT mint used for registration * @returns Transaction instruction. * * @example * ```ts * const instruction = await registerDomainWithNft({ * domain: "example.sns", * space: 1_000, * buyer, * nftSource, * nftMint, * }); * ``` */ declare const registerDomainWithNft: ({ domain, space, buyer, nftSource, nftMint, }: RegisterDomainWithNftParams) => Promise; /** * Input for setting an owner's already-derived SNS primary domain. * * @example * ```ts * const params: SetPrimaryDomainParams = { rpc, domainAddress, owner }; * ``` */ interface SetPrimaryDomainParams { /** RPC client used to retrieve the domain registry. */ rpc: Rpc; /** Already-derived SNS domain account address. */ domainAddress: Address; /** Owner of the domain account. */ owner: Address; } /** * Sets the primary domain for the specified owner. * * This is an address-only API: `domainAddress` must be an already-derived SNS * domain account. * * @param params Primary-domain registration parameters * @param params.rpc RPC client implementing account lookup * @param params.domainAddress SNS domain account address to set as primary * @param params.owner Owner of the domain account * @returns Transaction instruction. * * @example * ```ts * const instruction = await setPrimaryDomain({ rpc, domainAddress, owner }); * ``` */ declare const setPrimaryDomain: ({ rpc, domainAddress, owner, }: SetPrimaryDomainParams) => Promise; /** * Accounts and record identity required to build a record-validation instruction. * * @example * ```ts * const params: RecordVerificationParams = { * domain: "example.sns", * record: Record.Url, * owner, * payer, * verifier, * }; * ``` */ interface RecordVerificationParams { /** Full `.sns` domain or subdomain name. */ domain: string; /** V2 record type to validate. */ record: Record; /** Current owner of the domain. */ owner: Address; /** Fee payer for the validation instruction. */ payer: Address; /** Account whose signature or identity verifies the record. */ verifier: Address; } /** * Builds an instruction to store the expected Right of Association verifier for a V2 record. * * @param params V2 record validation parameters * @param params.domain Full `.sns` domain or subdomain name * @param params.record V2 record type * @param params.owner Current owner of the domain * @param params.payer Fee payer for the instruction * @param params.verifier Verifier account used by the record validation instruction * @returns Transaction instruction. * * @example * ```ts * const instruction = await setRecordRoaVerifier({ * domain: "example.sns", * record: Record.Url, * owner, * payer, * verifier, * }); * ``` */ declare const setRecordRoaVerifier: ({ domain, record, owner, payer, verifier, }: RecordVerificationParams) => Promise; /** * Builds an instruction to write or refresh staleness verifier metadata for a V2 record. * * @param params V2 record validation parameters * @param params.domain Full `.sns` domain or subdomain name * @param params.record V2 record type * @param params.owner Current owner of the domain * @param params.payer Fee payer for the instruction * @param params.verifier Verifier account used by the record validation instruction * @returns Transaction instruction. * * @example * ```ts * const instruction = await setRecordStalenessVerifier({ * domain: "example.sns", * record: Record.Url, * owner, * payer, * verifier, * }); * ``` */ declare const setRecordStalenessVerifier: (params: RecordVerificationParams) => Promise; /** * Parameters for transferring an SNS domain. * * @example * ```ts * const params: TransferDomainParams = { rpc, domain: "example.sns", newOwner }; * ``` */ interface TransferDomainParams { /** RPC client. */ rpc: Rpc; /** Full `.sns` domain name. */ domain: string; /** New domain owner. */ newOwner: Address; } /** * Builds an instruction to transfer a top-level `.sns` domain. * * @param params Transfer parameters * @param params.rpc RPC client implementing account lookup * @param params.domain Full `.sns` domain name * @param params.newOwner New owner of the domain * @returns Transaction instruction. * * @example * ```ts * const instruction = await transferDomain({ rpc, domain: "example.sns", newOwner }); * ``` */ declare const transferDomain: ({ rpc, domain, newOwner, }: TransferDomainParams) => Promise; /** * Parameters for transferring an SNS subdomain. * * @example * ```ts * const params: TransferSubdomainParams = { * rpc, * subdomain: "sub.example.sns", * newOwner, * }; * ``` */ interface TransferSubdomainParams { /** RPC client. */ rpc: Rpc; /** Full `.sns` subdomain name. */ subdomain: string; /** New subdomain owner. */ newOwner: Address; /** Whether the parent domain owner signs. */ isParentOwnerSigner?: boolean; /** Current subdomain owner. Resolved when omitted. */ currentOwner?: Address; } /** * Builds an instruction to transfer a `.sns` subdomain. * * @param params Transfer parameters * @param params.rpc RPC client implementing account lookup * @param params.subdomain Full `.sns` subdomain name * @param params.newOwner New owner of the subdomain * @param params.isParentOwnerSigner Whether the parent domain owner signs the transfer * @param params.currentOwner Optional current owner of the subdomain. Resolved automatically when omitted * @returns Transaction instruction. * * @example * ```ts * const instruction = await transferSubdomain({ rpc, subdomain: "sub.example.sns", newOwner }); * ``` */ declare const transferSubdomain: ({ rpc, subdomain, newOwner, isParentOwnerSigner, currentOwner, }: TransferSubdomainParams) => Promise; /** * Input for updating bytes in a raw SNS name-registry account. * * @example * ```ts * const params: UpdateNameRegistryParams = { * rpc, * domain: "example", * offset: 0, * data: new TextEncoder().encode("data"), * }; * ``` */ interface UpdateNameRegistryParams { /** RPC client used to retrieve the registry owner. */ rpc: Rpc; /** Raw registry seed/name to update. */ domain: string; /** Byte offset where the update begins. */ offset: number; /** Bytes to write to the registry. */ data: Uint8Array; /** Optional class address for the registry. */ classAddress?: Address; /** * Optional parent name-account address. */ parentAddress?: Address; } /** * Updates the data of a raw SPL Name Registry account. * * This low-level helper accepts a raw registry seed/name as `domain` and does * not parse `.sns` or `.sol` suffixes. * * @param params Update parameters * @param params.rpc RPC client implementing account lookup * @param params.domain Raw registry seed/name whose account will be updated * @param params.offset Offset in bytes where the update should begin * @param params.data Data to write to the registry * @param params.classAddress Optional class address for the registry * @param params.parentAddress Optional parent registry address * @returns Transaction instruction. * * @example * ```ts * const instruction = await updateNameRegistry({ * rpc, * domain: "example", * offset: 0, * data: new TextEncoder().encode("data"), * }); * ``` */ declare function updateNameRegistry({ rpc, domain, offset, data, classAddress, parentAddress, }: UpdateNameRegistryParams): Promise; /** * Parameters for updating a domain record. * * @example * ```ts * const params: UpdateRecordParams = { * domain: "example.sns", * record: Record.Url, * content: "https://example.com", * owner, * payer, * }; * ``` */ interface UpdateRecordParams { /** Full `.sns` domain name. */ domain: string; /** Record type. */ record: Record; /** Record content. */ content: string; /** Current domain owner. */ owner: Address; /** Instruction fee payer. */ payer: Address; } /** * Builds an instruction to update a V2 record for a `.sns` domain or subdomain. * * Record content is serialized according to SNS-IP 1. * * @param params Record update parameters * @param params.domain Full `.sns` domain or subdomain name * @param params.record Record type * @param params.content Record content * @param params.owner Current owner of the domain * @param params.payer Fee payer for the instruction * @returns Transaction instruction. * * @example * ```ts * const instruction = await updateRecord({ * domain: "example.sns", * record: Record.Url, * content: "https://example.com", * owner, * payer, * }); * ``` */ declare const updateRecord: ({ domain, record, content, owner, payer, }: UpdateRecordParams) => Promise; /** * Builds an instruction to validate a V2 record's Right of Association with a Solana verifier. * * @param params Record validation parameters * @param params.domain Full `.sns` domain or subdomain name * @param params.record Record type * @param params.owner Current owner of the domain * @param params.payer Fee payer for the instruction * @param params.verifier Verifier account used by the record validation instruction * @returns Transaction instruction. * * @example * ```ts * const instruction = await validateRecordRoa({ * domain: "example.sns", * record: Record.Url, * owner, * payer, * verifier, * }); * ``` */ declare const validateRecordRoa: (params: RecordVerificationParams) => Promise; /** * Parameters for validating a record with an Ethereum signature. * * @example * ```ts * const params: ValidateRecordRoaEthereumParams = { * domain: "example.sns", record: Record.ETH, owner, payer, signature, expectedPubkey, * }; * ``` */ interface ValidateRecordRoaEthereumParams { /** Full `.sns` domain name. */ domain: string; /** Record type. */ record: Record; /** Current domain owner. */ owner: Address; /** Instruction fee payer. */ payer: Address; /** Ethereum signature. */ signature: Uint8Array; /** Expected Ethereum public key. */ expectedPubkey: Uint8Array; } /** * Builds an instruction to validate a V2 record's Right of Association with an Ethereum signature. * * @param params Record validation parameters * @param params.domain Full `.sns` domain or subdomain name * @param params.record Record type * @param params.owner Current owner of the domain * @param params.payer Fee payer for the instruction * @param params.signature Ethereum signature used for validation * @param params.expectedPubkey Expected Ethereum public key for validation * @returns Transaction instruction. * * @example * ```ts * const instruction = await validateRecordRoaEthereum({ * domain: "example.sns", * record: Record.ETH, * owner, * payer, * signature, * expectedPubkey, * }); * ``` */ declare const validateRecordRoaEthereum: ({ domain, record, owner, payer, signature, expectedPubkey, }: ValidateRecordRoaEthereumParams) => Promise; export { burnDomain, createNameRegistry, createRecord, createReverse, createSubdomain, deleteNameRegistry, deleteRecord, registerDomain, registerDomainWithNft, setPrimaryDomain, setRecordRoaVerifier, setRecordStalenessVerifier, transferDomain, transferSubdomain, updateNameRegistry, updateRecord, validateRecordRoa, validateRecordRoaEthereum }; export type { BurnDomainParams, CreateNameRegistryParams, CreateRecordParams, CreateReverseParams, CreateSubdomainParams, DeleteNameRegistryParams, DeleteRecordParams, RecordVerificationParams, RegisterDomainParams, RegisterDomainWithNftParams, SetPrimaryDomainParams, TransferDomainParams, TransferSubdomainParams, UpdateNameRegistryParams, UpdateRecordParams, ValidateRecordRoaEthereumParams };