@solana-name-service/sns-sdk-kit 1.0.0 → 1.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +335 -322
- package/dist/cjs/address/getPrimaryDomain.cjs.map +1 -1
- package/dist/cjs/address/getPrimaryDomainsBatch.cjs.map +1 -1
- package/dist/cjs/address/getSnsDomainsForAddress.cjs.map +1 -1
- package/dist/cjs/address/getSnsNftsForAddress.cjs.map +1 -1
- package/dist/cjs/address/getSolDomainsForAddress.cjs +86 -0
- package/dist/cjs/address/getSolDomainsForAddress.cjs.map +1 -0
- package/dist/cjs/address/getSolNftsForAddress.cjs +144 -0
- package/dist/cjs/address/getSolNftsForAddress.cjs.map +1 -0
- package/dist/cjs/address/index.cjs +4 -0
- package/dist/cjs/address/index.cjs.map +1 -1
- package/dist/cjs/bindings/burnDomain.cjs.map +1 -1
- package/dist/cjs/bindings/createNameRegistry.cjs.map +1 -1
- package/dist/cjs/bindings/createRecord.cjs.map +1 -1
- package/dist/cjs/bindings/createReverse.cjs.map +1 -1
- package/dist/cjs/bindings/createSubdomain.cjs.map +1 -1
- package/dist/cjs/bindings/deleteNameRegistry.cjs.map +1 -1
- package/dist/cjs/bindings/deleteRecord.cjs.map +1 -1
- package/dist/cjs/bindings/recordValidation.cjs.map +1 -1
- package/dist/cjs/bindings/registerDomain.cjs.map +1 -1
- package/dist/cjs/bindings/registerDomainWithNft.cjs.map +1 -1
- package/dist/cjs/bindings/setPrimaryDomain.cjs.map +1 -1
- package/dist/cjs/bindings/setRecordRoaVerifier.cjs.map +1 -1
- package/dist/cjs/bindings/setRecordStalenessVerifier.cjs.map +1 -1
- package/dist/cjs/bindings/transferDomain.cjs.map +1 -1
- package/dist/cjs/bindings/transferSubdomain.cjs.map +1 -1
- package/dist/cjs/bindings/updateNameRegistry.cjs.map +1 -1
- package/dist/cjs/bindings/updateRecord.cjs.map +1 -1
- package/dist/cjs/bindings/validateRecordRoa.cjs.map +1 -1
- package/dist/cjs/bindings/validateRecordRoaEthereum.cjs.map +1 -1
- package/dist/cjs/codecs.cjs.map +1 -1
- package/dist/cjs/constants/addresses.cjs +26 -16
- package/dist/cjs/constants/addresses.cjs.map +1 -1
- package/dist/cjs/constants/index.cjs +18 -0
- package/dist/cjs/constants/index.cjs.map +1 -1
- package/dist/cjs/constants/pythFeeds.cjs.map +1 -1
- package/dist/cjs/constants/records.cjs.map +1 -1
- package/dist/cjs/constants/srs.cjs +48 -0
- package/dist/cjs/constants/srs.cjs.map +1 -0
- package/dist/cjs/domain/getAllSnsDomains.cjs.map +1 -1
- package/dist/cjs/domain/getAllSolDomains.cjs +58 -0
- package/dist/cjs/domain/getAllSolDomains.cjs.map +1 -0
- package/dist/cjs/domain/getDomainOwner.cjs +3 -3
- package/dist/cjs/domain/getDomainOwner.cjs.map +1 -1
- package/dist/cjs/domain/getDomainRecord.cjs +3 -3
- package/dist/cjs/domain/getDomainRecord.cjs.map +1 -1
- package/dist/cjs/domain/getDomainRecords.cjs +3 -3
- package/dist/cjs/domain/getDomainRecords.cjs.map +1 -1
- package/dist/cjs/domain/getSnsDomainAddress.cjs.map +1 -1
- package/dist/cjs/domain/getSnsDomainOwner.cjs +1 -2
- package/dist/cjs/domain/getSnsDomainOwner.cjs.map +1 -1
- package/dist/cjs/domain/getSolDomainAddress.cjs +36 -0
- package/dist/cjs/domain/getSolDomainAddress.cjs.map +1 -0
- package/dist/cjs/domain/getSrsDomainAddress.cjs +4 -17
- package/dist/cjs/domain/getSrsDomainAddress.cjs.map +1 -1
- package/dist/cjs/domain/getSubdomains.cjs +3 -3
- package/dist/cjs/domain/getSubdomains.cjs.map +1 -1
- package/dist/cjs/domain/index.cjs +4 -0
- package/dist/cjs/domain/index.cjs.map +1 -1
- package/dist/cjs/domain/resolve.cjs +19 -12
- package/dist/cjs/domain/resolve.cjs.map +1 -1
- package/dist/cjs/domain/resolveSns.cjs.map +1 -1
- package/dist/cjs/domain/resolveSol.cjs +129 -0
- package/dist/cjs/domain/resolveSol.cjs.map +1 -0
- package/dist/cjs/errors.cjs.map +1 -1
- package/dist/cjs/index.cjs +141 -115
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/instructions/allocateAndPostRecordInstruction.cjs.map +1 -1
- package/dist/cjs/instructions/burnDomainInstruction.cjs.map +1 -1
- package/dist/cjs/instructions/createAtaIdempotentInstruction.cjs.map +1 -1
- package/dist/cjs/instructions/createNameRegistryInstruction.cjs.map +1 -1
- package/dist/cjs/instructions/createReverseInstruction.cjs.map +1 -1
- package/dist/cjs/instructions/createSplitV2Instruction.cjs.map +1 -1
- package/dist/cjs/instructions/createWithNftInstruction.cjs.map +1 -1
- package/dist/cjs/instructions/deleteNameRegistryInstruction.cjs.map +1 -1
- package/dist/cjs/instructions/deleteRecordInstruction.cjs.map +1 -1
- package/dist/cjs/instructions/reallocInstruction.cjs.map +1 -1
- package/dist/cjs/instructions/registerPrimaryInstruction.cjs.map +1 -1
- package/dist/cjs/instructions/setRecordRoaVerifierInstruction.cjs.map +1 -1
- package/dist/cjs/instructions/transferInstruction.cjs.map +1 -1
- package/dist/cjs/instructions/updateNameRegistryInstruction.cjs.map +1 -1
- package/dist/cjs/instructions/updateRecordInstruction.cjs.map +1 -1
- package/dist/cjs/instructions/validateEthereumSignatureInstruction.cjs.map +1 -1
- package/dist/cjs/instructions/validateSolanaSignatureInstruction.cjs.map +1 -1
- package/dist/cjs/nft/getSnsNftMint.cjs.map +1 -1
- package/dist/cjs/nft/getSnsNftOwner.cjs.map +1 -1
- package/dist/cjs/record/getRecordV1Address.cjs.map +1 -1
- package/dist/cjs/record/getRecordV2Address.cjs.map +1 -1
- package/dist/cjs/record/verifyRecordRightOfAssociation.cjs +3 -3
- package/dist/cjs/record/verifyRecordRightOfAssociation.cjs.map +1 -1
- package/dist/cjs/record/verifyRecordStaleness.cjs +3 -3
- package/dist/cjs/record/verifyRecordStaleness.cjs.map +1 -1
- package/dist/cjs/srs/additional-metadata.cjs +20 -0
- package/dist/cjs/srs/additional-metadata.cjs.map +1 -0
- package/dist/cjs/srs/metadata.cjs +27 -0
- package/dist/cjs/srs/metadata.cjs.map +1 -0
- package/dist/cjs/states/nft.cjs.map +1 -1
- package/dist/cjs/states/primaryDomain.cjs.map +1 -1
- package/dist/cjs/states/record.cjs.map +1 -1
- package/dist/cjs/states/registry.cjs.map +1 -1
- package/dist/cjs/types/record.cjs.map +1 -1
- package/dist/cjs/types/validation.cjs.map +1 -1
- package/dist/cjs/utils/check.cjs.map +1 -1
- package/dist/cjs/utils/checkAddressOnCurve/ed25519.cjs.map +1 -1
- package/dist/cjs/utils/checkAddressOnCurve/index.cjs.map +1 -1
- package/dist/cjs/utils/deriveAddress.cjs.map +1 -1
- package/dist/cjs/utils/deserializers/deserializeRecordContent.cjs.map +1 -1
- package/dist/cjs/utils/deserializers/deserializeReverse.cjs.map +1 -1
- package/dist/cjs/utils/fetchEncodedAccountsBatched.cjs +29 -0
- package/dist/cjs/utils/fetchEncodedAccountsBatched.cjs.map +1 -0
- package/dist/cjs/utils/getPythFeedAddress.cjs.map +1 -1
- package/dist/cjs/utils/getReverseAddress.cjs.map +1 -1
- package/dist/cjs/utils/getReverseAddressFromDomainAddress.cjs.map +1 -1
- package/dist/cjs/utils/parseSnsDomain.cjs +1 -2
- package/dist/cjs/utils/parseSnsDomain.cjs.map +1 -1
- package/dist/cjs/utils/reverseLookup.cjs.map +1 -1
- package/dist/cjs/utils/reverseLookupBatch.cjs.map +1 -1
- package/dist/cjs/utils/serializers/serializeRecordContent.cjs.map +1 -1
- package/dist/cjs/utils/tld.cjs +1 -1
- package/dist/cjs/utils/tld.cjs.map +1 -1
- package/dist/cjs/utils/token2022/assertValidAccountData.cjs +37 -0
- package/dist/cjs/utils/token2022/assertValidAccountData.cjs.map +1 -0
- package/dist/cjs/utils/token2022/extensions.cjs +91 -0
- package/dist/cjs/utils/token2022/extensions.cjs.map +1 -0
- package/dist/cjs/utils/token2022/unpackAccount.cjs +29 -0
- package/dist/cjs/utils/token2022/unpackAccount.cjs.map +1 -0
- package/dist/cjs/utils/token2022/unpackMint.cjs +27 -0
- package/dist/cjs/utils/token2022/unpackMint.cjs.map +1 -0
- package/dist/cjs/utils/uint8Array/uint8ArrayFromHex.cjs.map +1 -1
- package/dist/cjs/utils/uint8Array/uint8ArrayToHex.cjs.map +1 -1
- package/dist/cjs/utils/uint8Array/uint8ArraysEqual.cjs.map +1 -1
- package/dist/esm/address/getPrimaryDomain.mjs.map +1 -1
- package/dist/esm/address/getPrimaryDomainsBatch.mjs.map +1 -1
- package/dist/esm/address/getSnsDomainsForAddress.mjs.map +1 -1
- package/dist/esm/address/getSnsNftsForAddress.mjs.map +1 -1
- package/dist/esm/address/getSolDomainsForAddress.mjs +82 -0
- package/dist/esm/address/getSolDomainsForAddress.mjs.map +1 -0
- package/dist/esm/address/getSolNftsForAddress.mjs +140 -0
- package/dist/esm/address/getSolNftsForAddress.mjs.map +1 -0
- package/dist/esm/address/index.mjs +2 -0
- package/dist/esm/address/index.mjs.map +1 -1
- package/dist/esm/bindings/burnDomain.mjs.map +1 -1
- package/dist/esm/bindings/createNameRegistry.mjs.map +1 -1
- package/dist/esm/bindings/createRecord.mjs.map +1 -1
- package/dist/esm/bindings/createReverse.mjs.map +1 -1
- package/dist/esm/bindings/createSubdomain.mjs.map +1 -1
- package/dist/esm/bindings/deleteNameRegistry.mjs.map +1 -1
- package/dist/esm/bindings/deleteRecord.mjs.map +1 -1
- package/dist/esm/bindings/recordValidation.mjs.map +1 -1
- package/dist/esm/bindings/registerDomain.mjs.map +1 -1
- package/dist/esm/bindings/registerDomainWithNft.mjs.map +1 -1
- package/dist/esm/bindings/setPrimaryDomain.mjs.map +1 -1
- package/dist/esm/bindings/setRecordRoaVerifier.mjs.map +1 -1
- package/dist/esm/bindings/setRecordStalenessVerifier.mjs.map +1 -1
- package/dist/esm/bindings/transferDomain.mjs.map +1 -1
- package/dist/esm/bindings/transferSubdomain.mjs.map +1 -1
- package/dist/esm/bindings/updateNameRegistry.mjs.map +1 -1
- package/dist/esm/bindings/updateRecord.mjs.map +1 -1
- package/dist/esm/bindings/validateRecordRoa.mjs.map +1 -1
- package/dist/esm/bindings/validateRecordRoaEthereum.mjs.map +1 -1
- package/dist/esm/codecs.mjs.map +1 -1
- package/dist/esm/constants/addresses.mjs +24 -17
- package/dist/esm/constants/addresses.mjs.map +1 -1
- package/dist/esm/constants/index.mjs +2 -1
- package/dist/esm/constants/index.mjs.map +1 -1
- package/dist/esm/constants/pythFeeds.mjs.map +1 -1
- package/dist/esm/constants/records.mjs.map +1 -1
- package/dist/esm/constants/srs.mjs +31 -0
- package/dist/esm/constants/srs.mjs.map +1 -0
- package/dist/esm/domain/getAllSnsDomains.mjs.map +1 -1
- package/dist/esm/domain/getAllSolDomains.mjs +54 -0
- package/dist/esm/domain/getAllSolDomains.mjs.map +1 -0
- package/dist/esm/domain/getDomainOwner.mjs +3 -3
- package/dist/esm/domain/getDomainOwner.mjs.map +1 -1
- package/dist/esm/domain/getDomainRecord.mjs +3 -3
- package/dist/esm/domain/getDomainRecord.mjs.map +1 -1
- package/dist/esm/domain/getDomainRecords.mjs +3 -3
- package/dist/esm/domain/getDomainRecords.mjs.map +1 -1
- package/dist/esm/domain/getSnsDomainAddress.mjs.map +1 -1
- package/dist/esm/domain/getSnsDomainOwner.mjs +1 -2
- package/dist/esm/domain/getSnsDomainOwner.mjs.map +1 -1
- package/dist/esm/domain/getSolDomainAddress.mjs +32 -0
- package/dist/esm/domain/getSolDomainAddress.mjs.map +1 -0
- package/dist/esm/domain/getSrsDomainAddress.mjs +4 -17
- package/dist/esm/domain/getSrsDomainAddress.mjs.map +1 -1
- package/dist/esm/domain/getSubdomains.mjs +3 -3
- package/dist/esm/domain/getSubdomains.mjs.map +1 -1
- package/dist/esm/domain/index.mjs +2 -0
- package/dist/esm/domain/index.mjs.map +1 -1
- package/dist/esm/domain/resolve.mjs +20 -13
- package/dist/esm/domain/resolve.mjs.map +1 -1
- package/dist/esm/domain/resolveSns.mjs.map +1 -1
- package/dist/esm/domain/resolveSol.mjs +125 -0
- package/dist/esm/domain/resolveSol.mjs.map +1 -0
- package/dist/esm/errors.mjs.map +1 -1
- package/dist/esm/index.mjs +51 -46
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/instructions/allocateAndPostRecordInstruction.mjs.map +1 -1
- package/dist/esm/instructions/burnDomainInstruction.mjs.map +1 -1
- package/dist/esm/instructions/createAtaIdempotentInstruction.mjs.map +1 -1
- package/dist/esm/instructions/createNameRegistryInstruction.mjs.map +1 -1
- package/dist/esm/instructions/createReverseInstruction.mjs.map +1 -1
- package/dist/esm/instructions/createSplitV2Instruction.mjs.map +1 -1
- package/dist/esm/instructions/createWithNftInstruction.mjs.map +1 -1
- package/dist/esm/instructions/deleteNameRegistryInstruction.mjs.map +1 -1
- package/dist/esm/instructions/deleteRecordInstruction.mjs.map +1 -1
- package/dist/esm/instructions/reallocInstruction.mjs.map +1 -1
- package/dist/esm/instructions/registerPrimaryInstruction.mjs.map +1 -1
- package/dist/esm/instructions/setRecordRoaVerifierInstruction.mjs.map +1 -1
- package/dist/esm/instructions/transferInstruction.mjs.map +1 -1
- package/dist/esm/instructions/updateNameRegistryInstruction.mjs.map +1 -1
- package/dist/esm/instructions/updateRecordInstruction.mjs.map +1 -1
- package/dist/esm/instructions/validateEthereumSignatureInstruction.mjs.map +1 -1
- package/dist/esm/instructions/validateSolanaSignatureInstruction.mjs.map +1 -1
- package/dist/esm/nft/getSnsNftMint.mjs +1 -1
- package/dist/esm/nft/getSnsNftMint.mjs.map +1 -1
- package/dist/esm/nft/getSnsNftOwner.mjs.map +1 -1
- package/dist/esm/record/getRecordV1Address.mjs.map +1 -1
- package/dist/esm/record/getRecordV2Address.mjs.map +1 -1
- package/dist/esm/record/verifyRecordRightOfAssociation.mjs +3 -3
- package/dist/esm/record/verifyRecordRightOfAssociation.mjs.map +1 -1
- package/dist/esm/record/verifyRecordStaleness.mjs +3 -3
- package/dist/esm/record/verifyRecordStaleness.mjs.map +1 -1
- package/dist/esm/srs/additional-metadata.mjs +16 -0
- package/dist/esm/srs/additional-metadata.mjs.map +1 -0
- package/dist/esm/srs/metadata.mjs +23 -0
- package/dist/esm/srs/metadata.mjs.map +1 -0
- package/dist/esm/states/nft.mjs.map +1 -1
- package/dist/esm/states/primaryDomain.mjs.map +1 -1
- package/dist/esm/states/record.mjs +1 -1
- package/dist/esm/states/record.mjs.map +1 -1
- package/dist/esm/states/registry.mjs.map +1 -1
- package/dist/esm/types/record.mjs.map +1 -1
- package/dist/esm/types/validation.mjs.map +1 -1
- package/dist/esm/utils/check.mjs.map +1 -1
- package/dist/esm/utils/checkAddressOnCurve/ed25519.mjs.map +1 -1
- package/dist/esm/utils/checkAddressOnCurve/index.mjs.map +1 -1
- package/dist/esm/utils/deriveAddress.mjs.map +1 -1
- package/dist/esm/utils/deserializers/deserializeRecordContent.mjs.map +1 -1
- package/dist/esm/utils/deserializers/deserializeReverse.mjs.map +1 -1
- package/dist/esm/utils/fetchEncodedAccountsBatched.mjs +25 -0
- package/dist/esm/utils/fetchEncodedAccountsBatched.mjs.map +1 -0
- package/dist/esm/utils/getPythFeedAddress.mjs.map +1 -1
- package/dist/esm/utils/getReverseAddress.mjs.map +1 -1
- package/dist/esm/utils/getReverseAddressFromDomainAddress.mjs.map +1 -1
- package/dist/esm/utils/parseSnsDomain.mjs +1 -2
- package/dist/esm/utils/parseSnsDomain.mjs.map +1 -1
- package/dist/esm/utils/reverseLookup.mjs.map +1 -1
- package/dist/esm/utils/reverseLookupBatch.mjs.map +1 -1
- package/dist/esm/utils/serializers/serializeRecordContent.mjs.map +1 -1
- package/dist/esm/utils/tld.mjs +1 -1
- package/dist/esm/utils/tld.mjs.map +1 -1
- package/dist/esm/utils/token2022/assertValidAccountData.mjs +33 -0
- package/dist/esm/utils/token2022/assertValidAccountData.mjs.map +1 -0
- package/dist/esm/utils/token2022/extensions.mjs +85 -0
- package/dist/esm/utils/token2022/extensions.mjs.map +1 -0
- package/dist/esm/utils/token2022/unpackAccount.mjs +25 -0
- package/dist/esm/utils/token2022/unpackAccount.mjs.map +1 -0
- package/dist/esm/utils/token2022/unpackMint.mjs +23 -0
- package/dist/esm/utils/token2022/unpackMint.mjs.map +1 -0
- package/dist/esm/utils/uint8Array/uint8ArrayFromHex.mjs.map +1 -1
- package/dist/esm/utils/uint8Array/uint8ArrayToHex.mjs.map +1 -1
- package/dist/esm/utils/uint8Array/uint8ArraysEqual.mjs.map +1 -1
- package/dist/types/address/index.d.ts +103 -2
- package/dist/types/constants/index.d.ts +53 -17
- package/dist/types/domain/index.d.ts +94 -32
- package/dist/types/index.d.ts +253 -54
- package/dist/types/record/index.d.ts +6 -6
- package/dist/types/utils/index.d.ts +1 -1
- package/package.json +2 -1
- package/dist/cjs/config.cjs +0 -18
- package/dist/cjs/config.cjs.map +0 -1
- package/dist/cjs/utils/assertTldSupported.cjs +0 -28
- package/dist/cjs/utils/assertTldSupported.cjs.map +0 -1
- package/dist/esm/config.mjs +0 -11
- package/dist/esm/config.mjs.map +0 -1
- package/dist/esm/utils/assertTldSupported.mjs +0 -24
- package/dist/esm/utils/assertTldSupported.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createReverseInstruction.mjs","sources":["../../../src/instructions/createReverseInstruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/**\r\n * Input for creating an SNS reverse-lookup account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: CreateReverseInstructionParams = { domain: \"example\" };\r\n * ```\r\n */\r\nexport interface CreateReverseInstructionParams {\r\n /** Raw reverse lookup payload. */\r\n domain: string;\r\n}\r\n\r\n/** Builder for creating an SNS reverse-lookup account. */\r\nexport class CreateReverseInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** Raw reverse lookup payload. */\r\n domain: string;\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n domain: \"string\",\r\n },\r\n };\r\n\r\n constructor(obj: CreateReverseInstructionParams) {\r\n this.tag = 12;\r\n this.domain = obj.domain;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(CreateReverseInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n namingServiceProgram: Address,\r\n rootDomain: Address,\r\n reverseLookup: Address,\r\n systemProgram: Address,\r\n centralState: Address,\r\n payer: Address,\r\n rentSysvar: Address,\r\n parentAddress?: Address,\r\n parentOwner?: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: namingServiceProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: rootDomain,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: reverseLookup,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: centralState,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: payer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: rentSysvar,\r\n role: AccountRole.READONLY,\r\n },\r\n ];\r\n\r\n if (parentAddress) {\r\n accounts.push({\r\n address: parentAddress,\r\n role: AccountRole.WRITABLE,\r\n });\r\n }\r\n\r\n if (parentOwner) {\r\n accounts.push({\r\n address: parentOwner,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n });\r\n }\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAgBA;MACa,wBAAwB,CAAA;;AAEnC,IAAA,GAAG;;AAEH,IAAA,MAAM;IACN,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,MAAM,EAAE,QAAQ;AACjB,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAAmC,EAAA;AAC7C,QAAA,IAAI,CAAC,GAAG,GAAG,EAAE;AACb,QAAA,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM
|
|
1
|
+
{"version":3,"file":"createReverseInstruction.mjs","sources":["../../../src/instructions/createReverseInstruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/**\r\n * Input for creating an SNS reverse-lookup account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: CreateReverseInstructionParams = { domain: \"example\" };\r\n * ```\r\n */\r\nexport interface CreateReverseInstructionParams {\r\n /** Raw reverse lookup payload. */\r\n domain: string;\r\n}\r\n\r\n/** Builder for creating an SNS reverse-lookup account. */\r\nexport class CreateReverseInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** Raw reverse lookup payload. */\r\n domain: string;\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n domain: \"string\",\r\n },\r\n };\r\n\r\n constructor(obj: CreateReverseInstructionParams) {\r\n this.tag = 12;\r\n this.domain = obj.domain;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(CreateReverseInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n namingServiceProgram: Address,\r\n rootDomain: Address,\r\n reverseLookup: Address,\r\n systemProgram: Address,\r\n centralState: Address,\r\n payer: Address,\r\n rentSysvar: Address,\r\n parentAddress?: Address,\r\n parentOwner?: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: namingServiceProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: rootDomain,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: reverseLookup,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: centralState,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: payer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: rentSysvar,\r\n role: AccountRole.READONLY,\r\n },\r\n ];\r\n\r\n if (parentAddress) {\r\n accounts.push({\r\n address: parentAddress,\r\n role: AccountRole.WRITABLE,\r\n });\r\n }\r\n\r\n if (parentOwner) {\r\n accounts.push({\r\n address: parentOwner,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n });\r\n }\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAgBA;MACa,wBAAwB,CAAA;;AAEnC,IAAA,GAAG;;AAEH,IAAA,MAAM;IACN,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,MAAM,EAAE,QAAQ;AACjB,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAAmC,EAAA;AAC7C,QAAA,IAAI,CAAC,GAAG,GAAG,EAAE;AACb,QAAA,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM;IAC1B;IAEA,SAAS,GAAA;QACP,OAAO,SAAS,CAAC,wBAAwB,CAAC,MAAM,EAAE,IAAI,CAAC;IACzD;AAEA,IAAA,cAAc,CACZ,cAAuB,EACvB,oBAA6B,EAC7B,UAAmB,EACnB,aAAsB,EACtB,aAAsB,EACtB,YAAqB,EACrB,KAAc,EACd,UAAmB,EACnB,aAAuB,EACvB,WAAqB,EAAA;AAErB,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE;AAE7B,QAAA,MAAM,QAAQ,GAAkB;AAC9B,YAAA;AACE,gBAAA,OAAO,EAAE,oBAAoB;gBAC7B,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,UAAU;gBACnB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,aAAa;gBACtB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,aAAa;gBACtB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,YAAY;gBACrB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,WAAW,CAAC,eAAe;AAClC,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,UAAU;gBACnB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;SACF;QAED,IAAI,aAAa,EAAE;YACjB,QAAQ,CAAC,IAAI,CAAC;AACZ,gBAAA,OAAO,EAAE,aAAa;gBACtB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA,CAAC;QACJ;QAEA,IAAI,WAAW,EAAE;YACf,QAAQ,CAAC,IAAI,CAAC;AACZ,gBAAA,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAE,WAAW,CAAC,eAAe;AAClC,aAAA,CAAC;QACJ;QAEA,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSplitV2Instruction.mjs","sources":["../../../src/instructions/createSplitV2Instruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/**\r\n * Input for creating a split SNS V2 domain account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: CreateSplitV2InstructionParams = { name: \"example\", space: 1_000, referrerIdxOpt: null };\r\n * ```\r\n */\r\nexport interface CreateSplitV2InstructionParams {\r\n /** TLD-less domain name. */\r\n name: string;\r\n /** Account data size in bytes. */\r\n space: number;\r\n /** Approved referrer index, if any. */\r\n referrerIdxOpt: number | null;\r\n}\r\n\r\n/** Builder for creating a split SNS V2 domain account. */\r\nexport class CreateSplitV2Instruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** TLD-less domain name. */\r\n name: string;\r\n /** Account data size in bytes. */\r\n space: number;\r\n /** Approved referrer index, if any. */\r\n referrerIdxOpt: number | null;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n name: \"string\",\r\n space: \"u32\",\r\n referrerIdxOpt: { option: \"u16\" },\r\n },\r\n };\r\n\r\n constructor(obj: CreateSplitV2InstructionParams) {\r\n this.tag = 20;\r\n this.name = obj.name;\r\n this.space = obj.space;\r\n this.referrerIdxOpt = obj.referrerIdxOpt;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(CreateSplitV2Instruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n namingServiceProgram: Address,\r\n rootDomain: Address,\r\n name: Address,\r\n reverseLookup: Address,\r\n systemProgram: Address,\r\n centralState: Address,\r\n buyer: Address,\r\n domainOwner: Address,\r\n feePayer: Address,\r\n buyerTokenSource: Address,\r\n pythFeedAccount: Address,\r\n vault: Address,\r\n splTokenProgram: Address,\r\n rentSysvar: Address,\r\n state: Address,\r\n referrerAccountOpt?: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: namingServiceProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: rootDomain,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: name,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: reverseLookup,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: centralState,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: buyer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: domainOwner,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: feePayer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: buyerTokenSource,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: pythFeedAccount,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: vault,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: splTokenProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: rentSysvar,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: state,\r\n role: AccountRole.READONLY,\r\n },\r\n ];\r\n\r\n if (referrerAccountOpt) {\r\n accounts.push({\r\n address: referrerAccountOpt,\r\n role: AccountRole.WRITABLE,\r\n });\r\n }\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAoBA;MACa,wBAAwB,CAAA;;AAEnC,IAAA,GAAG;;AAEH,IAAA,IAAI;;AAEJ,IAAA,KAAK;;AAEL,IAAA,cAAc;IAEd,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,KAAK,EAAE,KAAK;AACZ,YAAA,cAAc,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;AAClC,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAAmC,EAAA;AAC7C,QAAA,IAAI,CAAC,GAAG,GAAG,EAAE;AACb,QAAA,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI;AACpB,QAAA,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK;AACtB,QAAA,IAAI,CAAC,cAAc,GAAG,GAAG,CAAC,cAAc
|
|
1
|
+
{"version":3,"file":"createSplitV2Instruction.mjs","sources":["../../../src/instructions/createSplitV2Instruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/**\r\n * Input for creating a split SNS V2 domain account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: CreateSplitV2InstructionParams = { name: \"example\", space: 1_000, referrerIdxOpt: null };\r\n * ```\r\n */\r\nexport interface CreateSplitV2InstructionParams {\r\n /** TLD-less domain name. */\r\n name: string;\r\n /** Account data size in bytes. */\r\n space: number;\r\n /** Approved referrer index, if any. */\r\n referrerIdxOpt: number | null;\r\n}\r\n\r\n/** Builder for creating a split SNS V2 domain account. */\r\nexport class CreateSplitV2Instruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** TLD-less domain name. */\r\n name: string;\r\n /** Account data size in bytes. */\r\n space: number;\r\n /** Approved referrer index, if any. */\r\n referrerIdxOpt: number | null;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n name: \"string\",\r\n space: \"u32\",\r\n referrerIdxOpt: { option: \"u16\" },\r\n },\r\n };\r\n\r\n constructor(obj: CreateSplitV2InstructionParams) {\r\n this.tag = 20;\r\n this.name = obj.name;\r\n this.space = obj.space;\r\n this.referrerIdxOpt = obj.referrerIdxOpt;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(CreateSplitV2Instruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n namingServiceProgram: Address,\r\n rootDomain: Address,\r\n name: Address,\r\n reverseLookup: Address,\r\n systemProgram: Address,\r\n centralState: Address,\r\n buyer: Address,\r\n domainOwner: Address,\r\n feePayer: Address,\r\n buyerTokenSource: Address,\r\n pythFeedAccount: Address,\r\n vault: Address,\r\n splTokenProgram: Address,\r\n rentSysvar: Address,\r\n state: Address,\r\n referrerAccountOpt?: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: namingServiceProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: rootDomain,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: name,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: reverseLookup,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: centralState,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: buyer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: domainOwner,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: feePayer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: buyerTokenSource,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: pythFeedAccount,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: vault,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: splTokenProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: rentSysvar,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: state,\r\n role: AccountRole.READONLY,\r\n },\r\n ];\r\n\r\n if (referrerAccountOpt) {\r\n accounts.push({\r\n address: referrerAccountOpt,\r\n role: AccountRole.WRITABLE,\r\n });\r\n }\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAoBA;MACa,wBAAwB,CAAA;;AAEnC,IAAA,GAAG;;AAEH,IAAA,IAAI;;AAEJ,IAAA,KAAK;;AAEL,IAAA,cAAc;IAEd,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,KAAK,EAAE,KAAK;AACZ,YAAA,cAAc,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;AAClC,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAAmC,EAAA;AAC7C,QAAA,IAAI,CAAC,GAAG,GAAG,EAAE;AACb,QAAA,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI;AACpB,QAAA,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK;AACtB,QAAA,IAAI,C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EAAE,QAAQ;gBACjB,IAAI,EAAE,WAAW,CAAC,eAAe;AAClC,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,gBAAgB;gBACzB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,eAAe;gBACxB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,eAAe;gBACxB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,UAAU;gBACnB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;SACF;QAED,IAAI,kBAAkB,EAAE;YACtB,QAAQ,CAAC,IAAI,CAAC;AACZ,gBAAA,OAAO,EAAE,kBAAkB;gBAC3B,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA,CAAC;QACJ;QAEA,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWithNftInstruction.mjs","sources":["../../../src/instructions/createWithNftInstruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/**\r\n * Input for registering an SNS domain backed by an NFT.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: CreateWithNftInstructionParams = { name: \"example\", space: 1_000 };\r\n * ```\r\n */\r\nexport interface CreateWithNftInstructionParams {\r\n /** TLD-less domain name. */\r\n name: string;\r\n /** Account data size in bytes. */\r\n space: number;\r\n}\r\n\r\n/** Builder for registering an SNS domain backed by an NFT. */\r\nexport class CreateWithNftInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** TLD-less domain name. */\r\n name: string;\r\n /** Account data size in bytes. */\r\n space: number;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n name: \"string\",\r\n space: \"u32\",\r\n },\r\n };\r\n\r\n constructor(obj: CreateWithNftInstructionParams) {\r\n this.tag = 17;\r\n this.name = obj.name;\r\n this.space = obj.space;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(CreateWithNftInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n namingServiceProgram: Address,\r\n rootDomain: Address,\r\n name: Address,\r\n reverseLookup: Address,\r\n systemProgram: Address,\r\n centralState: Address,\r\n buyer: Address,\r\n nftSource: Address,\r\n nftMetadata: Address,\r\n nftMint: Address,\r\n masterEdition: Address,\r\n collection: Address,\r\n splTokenProgram: Address,\r\n rentSysvar: Address,\r\n state: Address,\r\n mplTokenMetadata: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: namingServiceProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: rootDomain,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: name,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: reverseLookup,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: centralState,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: buyer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: nftSource,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: nftMetadata,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: nftMint,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: masterEdition,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: collection,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: splTokenProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: rentSysvar,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: state,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: mplTokenMetadata,\r\n role: AccountRole.READONLY,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAkBA;MACa,wBAAwB,CAAA;;AAEnC,IAAA,GAAG;;AAEH,IAAA,IAAI;;AAEJ,IAAA,KAAK;IAEL,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,KAAK,EAAE,KAAK;AACb,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAAmC,EAAA;AAC7C,QAAA,IAAI,CAAC,GAAG,GAAG,EAAE;AACb,QAAA,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI;AACpB,QAAA,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK
|
|
1
|
+
{"version":3,"file":"createWithNftInstruction.mjs","sources":["../../../src/instructions/createWithNftInstruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/**\r\n * Input for registering an SNS domain backed by an NFT.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: CreateWithNftInstructionParams = { name: \"example\", space: 1_000 };\r\n * ```\r\n */\r\nexport interface CreateWithNftInstructionParams {\r\n /** TLD-less domain name. */\r\n name: string;\r\n /** Account data size in bytes. */\r\n space: number;\r\n}\r\n\r\n/** Builder for registering an SNS domain backed by an NFT. */\r\nexport class CreateWithNftInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** TLD-less domain name. */\r\n name: string;\r\n /** Account data size in bytes. */\r\n space: number;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n name: \"string\",\r\n space: \"u32\",\r\n },\r\n };\r\n\r\n constructor(obj: CreateWithNftInstructionParams) {\r\n this.tag = 17;\r\n this.name = obj.name;\r\n this.space = obj.space;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(CreateWithNftInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n namingServiceProgram: Address,\r\n rootDomain: Address,\r\n name: Address,\r\n reverseLookup: Address,\r\n systemProgram: Address,\r\n centralState: Address,\r\n buyer: Address,\r\n nftSource: Address,\r\n nftMetadata: Address,\r\n nftMint: Address,\r\n masterEdition: Address,\r\n collection: Address,\r\n splTokenProgram: Address,\r\n rentSysvar: Address,\r\n state: Address,\r\n mplTokenMetadata: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: namingServiceProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: rootDomain,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: name,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: reverseLookup,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: centralState,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: buyer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: nftSource,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: nftMetadata,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: nftMint,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: masterEdition,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: collection,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: splTokenProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: rentSysvar,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: state,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: mplTokenMetadata,\r\n role: AccountRole.READONLY,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAkBA;MACa,wBAAwB,CAAA;;AAEnC,IAAA,GAAG;;AAEH,IAAA,IAAI;;AAEJ,IAAA,KAAK;IAEL,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,KAAK,EAAE,KAAK;AACb,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAAmC,EAAA;AAC7C,QAAA,IAAI,CAAC,GAAG,GAAG,EAAE;AACb,QAAA,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI;AACpB,QAAA,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK;IACxB;IAEA,SAAS,GAAA;QACP,OAAO,SAAS,CAAC,wBAAwB,CAAC,MAAM,EAAE,IAAI,CAAC;IACzD;AAEA,IAAA,cAAc,CACZ,cAAuB,EACvB,oBAA6B,EAC7B,UAAmB,EACnB,IAAa,EACb,aAAsB,EACtB,aAAsB,EACtB,YAAqB,EACrB,KAAc,EACd,SAAkB,EAClB,WAAoB,EACpB,OAAgB,EAChB,aAAsB,EACtB,UAAmB,EACnB,eAAwB,EACxB,UAAmB,EACnB,KAAc,EACd,gBAAyB,EAAA;AAEzB,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE;AAE7B,QAAA,MAAM,QAAQ,GAAkB;AAC9B,YAAA;AACE,gBAAA,OAAO,EAAE,oBAAoB;gBAC7B,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,UAAU;gBACnB,IAAI,EAAE,WA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,YAAA;AACE,gBAAA,OAAO,EAAE,gBAAgB;gBACzB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;SACF;QAED,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteNameRegistryInstruction.mjs","sources":["../../../src/instructions/deleteNameRegistryInstruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/** Builder for deleting an SNS name-registry account. */\r\nexport class DeleteNameRegistryInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n },\r\n };\r\n\r\n constructor() {\r\n this.tag = 3;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(DeleteNameRegistryInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n domainAddress: Address,\r\n refundTarget: Address,\r\n owner: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: domainAddress,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: owner,\r\n role: AccountRole.READONLY_SIGNER,\r\n },\r\n {\r\n address: refundTarget,\r\n role: AccountRole.WRITABLE,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAGA;MACa,6BAA6B,CAAA;;AAExC,IAAA,GAAG;IAEH,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACV,SAAA;KACF;AAED,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC
|
|
1
|
+
{"version":3,"file":"deleteNameRegistryInstruction.mjs","sources":["../../../src/instructions/deleteNameRegistryInstruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/** Builder for deleting an SNS name-registry account. */\r\nexport class DeleteNameRegistryInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n },\r\n };\r\n\r\n constructor() {\r\n this.tag = 3;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(DeleteNameRegistryInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n domainAddress: Address,\r\n refundTarget: Address,\r\n owner: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: domainAddress,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: owner,\r\n role: AccountRole.READONLY_SIGNER,\r\n },\r\n {\r\n address: refundTarget,\r\n role: AccountRole.WRITABLE,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAGA;MACa,6BAA6B,CAAA;;AAExC,IAAA,GAAG;IAEH,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACV,SAAA;KACF;AAED,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC;IACd;IAEA,SAAS,GAAA;QACP,OAAO,SAAS,CAAC,6BAA6B,CAAC,MAAM,EAAE,IAAI,CAAC;IAC9D;AAEA,IAAA,cAAc,CACZ,cAAuB,EACvB,aAAsB,EACtB,YAAqB,EACrB,KAAc,EAAA;AAEd,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE;AAE7B,QAAA,MAAM,QAAQ,GAAkB;AAC9B,YAAA;AACE,gBAAA,OAAO,EAAE,aAAa;gBACtB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,WAAW,CAAC,eAAe;AAClC,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,YAAY;gBACrB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;SACF;QAED,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteRecordInstruction.mjs","sources":["../../../src/instructions/deleteRecordInstruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/** Builder for deleting an SNS V2 record account. */\r\nexport class DeleteRecordInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n },\r\n };\r\n\r\n constructor() {\r\n this.tag = 5;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(DeleteRecordInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n systemProgram: Address,\r\n splNameServiceProgram: Address,\r\n payer: Address,\r\n record: Address,\r\n domainAddress: Address,\r\n domainOwner: Address,\r\n centralState: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: splNameServiceProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: payer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: record,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domainAddress,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domainOwner,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: centralState,\r\n role: AccountRole.READONLY,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAGA;MACa,uBAAuB,CAAA;;AAElC,IAAA,GAAG;IAEH,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACV,SAAA;KACF;AAED,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC
|
|
1
|
+
{"version":3,"file":"deleteRecordInstruction.mjs","sources":["../../../src/instructions/deleteRecordInstruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/** Builder for deleting an SNS V2 record account. */\r\nexport class DeleteRecordInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n },\r\n };\r\n\r\n constructor() {\r\n this.tag = 5;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(DeleteRecordInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n systemProgram: Address,\r\n splNameServiceProgram: Address,\r\n payer: Address,\r\n record: Address,\r\n domainAddress: Address,\r\n domainOwner: Address,\r\n centralState: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: splNameServiceProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: payer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: record,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domainAddress,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domainOwner,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: centralState,\r\n role: AccountRole.READONLY,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }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ACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reallocInstruction.mjs","sources":["../../../src/instructions/reallocInstruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/**\r\n * Input for reallocating an SNS name-registry account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: ReallocInstructionParams = { space: 1_000 };\r\n * ```\r\n */\r\nexport interface ReallocInstructionParams {\r\n /** New account data size in bytes. */\r\n space: number;\r\n}\r\n\r\n/** Builder for reallocating an SNS name-registry account. */\r\nexport class ReallocInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** New account data size in bytes. */\r\n space: number;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n space: \"u32\",\r\n },\r\n };\r\n\r\n constructor(obj: ReallocInstructionParams) {\r\n this.tag = 4;\r\n this.space = obj.space;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(ReallocInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n systemProgramId: Address,\r\n payerKey: Address,\r\n nameAccountKey: Address,\r\n nameOwnerKey: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: systemProgramId,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: payerKey,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: nameAccountKey,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: nameOwnerKey,\r\n role: AccountRole.READONLY_SIGNER,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAgBA;MACa,kBAAkB,CAAA;;AAE7B,IAAA,GAAG;;AAEH,IAAA,KAAK;IAEL,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,KAAK,EAAE,KAAK;AACb,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAA6B,EAAA;AACvC,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,QAAA,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK
|
|
1
|
+
{"version":3,"file":"reallocInstruction.mjs","sources":["../../../src/instructions/reallocInstruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/**\r\n * Input for reallocating an SNS name-registry account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: ReallocInstructionParams = { space: 1_000 };\r\n * ```\r\n */\r\nexport interface ReallocInstructionParams {\r\n /** New account data size in bytes. */\r\n space: number;\r\n}\r\n\r\n/** Builder for reallocating an SNS name-registry account. */\r\nexport class ReallocInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** New account data size in bytes. */\r\n space: number;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n space: \"u32\",\r\n },\r\n };\r\n\r\n constructor(obj: ReallocInstructionParams) {\r\n this.tag = 4;\r\n this.space = obj.space;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(ReallocInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n systemProgramId: Address,\r\n payerKey: Address,\r\n nameAccountKey: Address,\r\n nameOwnerKey: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: systemProgramId,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: payerKey,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: nameAccountKey,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: nameOwnerKey,\r\n role: AccountRole.READONLY_SIGNER,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAgBA;MACa,kBAAkB,CAAA;;AAE7B,IAAA,GAAG;;AAEH,IAAA,KAAK;IAEL,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,KAAK,EAAE,KAAK;AACb,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAA6B,EAAA;AACvC,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,QAAA,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK;IACxB;IAEA,SAAS,GAAA;QACP,OAAO,SAAS,CAAC,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC;IACnD;IAEA,cAAc,CACZ,cAAuB,EACvB,eAAwB,EACxB,QAAiB,EACjB,cAAuB,EACvB,YAAqB,EAAA;AAErB,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE;AAE7B,QAAA,MAAM,QAAQ,GAAkB;AAC9B,YAAA;AACE,gBAAA,OAAO,EAAE,eAAe;gBACxB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,QAAQ;gBACjB,IAAI,EAAE,WAAW,CAAC,eAAe;AAClC,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,cAAc;gBACvB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,YAAY;gBACrB,IAAI,EAAE,WAAW,CAAC,eAAe;AAClC,aAAA;SACF;QAED,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerPrimaryInstruction.mjs","sources":["../../../src/instructions/registerPrimaryInstruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/** Builder for registering an address's SNS primary domain. */\r\nexport class RegisterPrimaryInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n },\r\n };\r\n\r\n constructor() {\r\n this.tag = 6;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(RegisterPrimaryInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n nameAccount: Address,\r\n primaryAccount: Address,\r\n owner: Address,\r\n systemProgram: Address,\r\n optParent?: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: nameAccount,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: primaryAccount,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: owner,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n ];\r\n\r\n if (optParent) {\r\n accounts.push({\r\n address: optParent,\r\n role: AccountRole.READONLY,\r\n });\r\n }\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAGA;MACa,0BAA0B,CAAA;;AAErC,IAAA,GAAG;IACH,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACV,SAAA;KACF;AAED,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC
|
|
1
|
+
{"version":3,"file":"registerPrimaryInstruction.mjs","sources":["../../../src/instructions/registerPrimaryInstruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/** Builder for registering an address's SNS primary domain. */\r\nexport class RegisterPrimaryInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n },\r\n };\r\n\r\n constructor() {\r\n this.tag = 6;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(RegisterPrimaryInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n nameAccount: Address,\r\n primaryAccount: Address,\r\n owner: Address,\r\n systemProgram: Address,\r\n optParent?: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: nameAccount,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: primaryAccount,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: owner,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n ];\r\n\r\n if (optParent) {\r\n accounts.push({\r\n address: optParent,\r\n role: AccountRole.READONLY,\r\n });\r\n }\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAGA;MACa,0BAA0B,CAAA;;AAErC,IAAA,GAAG;IACH,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACV,SAAA;KACF;AAED,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC;IACd;IAEA,SAAS,GAAA;QACP,OAAO,SAAS,CAAC,0BAA0B,CAAC,MAAM,EAAE,IAAI,CAAC;IAC3D;IAEA,cAAc,CACZ,cAAuB,EACvB,WAAoB,EACpB,cAAuB,EACvB,KAAc,EACd,aAAsB,EACtB,SAAmB,EAAA;AAEnB,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE;AAC7B,QAAA,MAAM,QAAQ,GAAkB;AAC9B,YAAA;AACE,gBAAA,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,cAAc;gBACvB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,WAAW,CAAC,eAAe;AAClC,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,aAAa;gBACtB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;SACF;QAED,IAAI,SAAS,EAAE;YACb,QAAQ,CAAC,IAAI,CAAC;AACZ,gBAAA,OAAO,EAAE,SAAS;gBAClB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA,CAAC;QACJ;QAEA,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setRecordRoaVerifierInstruction.mjs","sources":["../../../src/instructions/setRecordRoaVerifierInstruction.ts"],"sourcesContent":["import {\r\n AccountMeta,\r\n AccountRole,\r\n Address,\r\n Instruction,\r\n ReadonlyUint8Array,\r\n} from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\nimport { addressCodec } from \"../codecs\";\r\n\r\n/**\r\n * Input for setting an SNS record's Right of Association verifier.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: SetRecordRoaVerifierInstructionParams = { verifier };\r\n * ```\r\n */\r\nexport interface SetRecordRoaVerifierInstructionParams {\r\n /** Verifier account address. */\r\n verifier: Address;\r\n}\r\n\r\n/** Builder for setting an SNS record's Right of Association verifier. */\r\nexport class SetRecordRoaVerifierInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** Encoded verifier address. */\r\n roaId: ReadonlyUint8Array;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n roaId: { array: { type: \"u8\" } },\r\n },\r\n };\r\n\r\n constructor(obj: SetRecordRoaVerifierInstructionParams) {\r\n this.tag = 6;\r\n this.roaId = addressCodec.encode(obj.verifier);\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(SetRecordRoaVerifierInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n systemProgram: Address,\r\n splNameServiceProgram: Address,\r\n feePayer: Address,\r\n record: Address,\r\n domain: Address,\r\n domainOwner: Address,\r\n centralState: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: splNameServiceProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: feePayer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: record,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domain,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domainOwner,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: centralState,\r\n role: AccountRole.READONLY,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;AAwBA;MACa,+BAA+B,CAAA;;AAE1C,IAAA,GAAG;;AAEH,IAAA,KAAK;IAEL,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;YACT,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;AACjC,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAA0C,EAAA;AACpD,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC;QACZ,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC
|
|
1
|
+
{"version":3,"file":"setRecordRoaVerifierInstruction.mjs","sources":["../../../src/instructions/setRecordRoaVerifierInstruction.ts"],"sourcesContent":["import {\r\n AccountMeta,\r\n AccountRole,\r\n Address,\r\n Instruction,\r\n ReadonlyUint8Array,\r\n} from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\nimport { addressCodec } from \"../codecs\";\r\n\r\n/**\r\n * Input for setting an SNS record's Right of Association verifier.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: SetRecordRoaVerifierInstructionParams = { verifier };\r\n * ```\r\n */\r\nexport interface SetRecordRoaVerifierInstructionParams {\r\n /** Verifier account address. */\r\n verifier: Address;\r\n}\r\n\r\n/** Builder for setting an SNS record's Right of Association verifier. */\r\nexport class SetRecordRoaVerifierInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** Encoded verifier address. */\r\n roaId: ReadonlyUint8Array;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n roaId: { array: { type: \"u8\" } },\r\n },\r\n };\r\n\r\n constructor(obj: SetRecordRoaVerifierInstructionParams) {\r\n this.tag = 6;\r\n this.roaId = addressCodec.encode(obj.verifier);\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(SetRecordRoaVerifierInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n systemProgram: Address,\r\n splNameServiceProgram: Address,\r\n feePayer: Address,\r\n record: Address,\r\n domain: Address,\r\n domainOwner: Address,\r\n centralState: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: splNameServiceProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: feePayer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: record,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domain,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domainOwner,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: centralState,\r\n role: AccountRole.READONLY,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\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ACpB,IAAI,EAAE,WAAW,CAAC,eAAe;AAClC,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,YAAY;gBACrB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;SACF;QAED,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transferInstruction.mjs","sources":["../../../src/instructions/transferInstruction.ts"],"sourcesContent":["import {\r\n AccountMeta,\r\n AccountRole,\r\n Address,\r\n Instruction,\r\n ReadonlyUint8Array,\r\n} from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\nimport { addressCodec } from \"../codecs\";\r\nimport { DEFAULT_ADDRESS } from \"../constants/addresses\";\r\n\r\n/**\r\n * Input for transferring an SNS name-registry account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: TransferInstructionParams = { newOwner };\r\n * ```\r\n */\r\nexport interface TransferInstructionParams {\r\n /** New registry owner. */\r\n newOwner: Address;\r\n}\r\n\r\n/** Builder for the SNS name-registry transfer instruction. */\r\nexport class TransferInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** Encoded new owner address. */\r\n encodedNewOwnerAddress: ReadonlyUint8Array;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n encodedNewOwnerAddress: { array: { type: \"u8\", len: 32 } },\r\n },\r\n };\r\n\r\n constructor(obj: TransferInstructionParams) {\r\n this.tag = 2;\r\n this.encodedNewOwnerAddress = addressCodec.encode(obj.newOwner);\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(TransferInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n domainAddress: Address,\r\n currentOwner: Address,\r\n classAddress?: Address,\r\n parentAddress?: Address,\r\n parentOwner?: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: domainAddress,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: parentOwner ? parentOwner : currentOwner,\r\n role: AccountRole.READONLY_SIGNER,\r\n },\r\n ];\r\n\r\n if (classAddress) {\r\n accounts.push({\r\n address: classAddress,\r\n role: AccountRole.READONLY_SIGNER,\r\n });\r\n }\r\n\r\n if (parentOwner && parentAddress) {\r\n if (!classAddress) {\r\n accounts.push({\r\n address: DEFAULT_ADDRESS,\r\n role: AccountRole.READONLY,\r\n });\r\n }\r\n\r\n accounts.push({\r\n address: parentAddress,\r\n role: AccountRole.READONLY,\r\n });\r\n }\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;AAyBA;MACa,mBAAmB,CAAA;;AAE9B,IAAA,GAAG;;AAEH,IAAA,sBAAsB;IAEtB,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,sBAAsB,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE;AAC3D,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAA8B,EAAA;AACxC,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC;QACZ,IAAI,CAAC,sBAAsB,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC
|
|
1
|
+
{"version":3,"file":"transferInstruction.mjs","sources":["../../../src/instructions/transferInstruction.ts"],"sourcesContent":["import {\r\n AccountMeta,\r\n AccountRole,\r\n Address,\r\n Instruction,\r\n ReadonlyUint8Array,\r\n} from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\nimport { addressCodec } from \"../codecs\";\r\nimport { DEFAULT_ADDRESS } from \"../constants/addresses\";\r\n\r\n/**\r\n * Input for transferring an SNS name-registry account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: TransferInstructionParams = { newOwner };\r\n * ```\r\n */\r\nexport interface TransferInstructionParams {\r\n /** New registry owner. */\r\n newOwner: Address;\r\n}\r\n\r\n/** Builder for the SNS name-registry transfer instruction. */\r\nexport class TransferInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** Encoded new owner address. */\r\n encodedNewOwnerAddress: ReadonlyUint8Array;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n encodedNewOwnerAddress: { array: { type: \"u8\", len: 32 } },\r\n },\r\n };\r\n\r\n constructor(obj: TransferInstructionParams) {\r\n this.tag = 2;\r\n this.encodedNewOwnerAddress = addressCodec.encode(obj.newOwner);\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(TransferInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n domainAddress: Address,\r\n currentOwner: Address,\r\n classAddress?: Address,\r\n parentAddress?: Address,\r\n parentOwner?: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: domainAddress,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: parentOwner ? parentOwner : currentOwner,\r\n role: AccountRole.READONLY_SIGNER,\r\n },\r\n ];\r\n\r\n if (classAddress) {\r\n accounts.push({\r\n address: classAddress,\r\n role: AccountRole.READONLY_SIGNER,\r\n });\r\n }\r\n\r\n if (parentOwner && parentAddress) {\r\n if (!classAddress) {\r\n accounts.push({\r\n address: DEFAULT_ADDRESS,\r\n role: AccountRole.READONLY,\r\n });\r\n }\r\n\r\n accounts.push({\r\n address: parentAddress,\r\n role: AccountRole.READONLY,\r\n });\r\n }\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;AAyBA;MACa,mBAAmB,CAAA;;AAE9B,IAAA,GAAG;;AAEH,IAAA,sBAAsB;IAEtB,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,s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A,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateNameRegistryInstruction.mjs","sources":["../../../src/instructions/updateNameRegistryInstruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/**\r\n * Input for updating an SNS name-registry account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: UpdateNameRegistryInstructionParams = { offset: 0, inputData };\r\n * ```\r\n */\r\nexport interface UpdateNameRegistryInstructionParams {\r\n /** Byte offset where the update begins. */\r\n offset: number;\r\n /** Bytes to write. */\r\n inputData: Uint8Array;\r\n}\r\n\r\n/** Builder for updating the data of an SNS name-registry account. */\r\nexport class UpdateNameRegistryInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** Byte offset where the update begins. */\r\n offset: number;\r\n /** Bytes to write. */\r\n inputData: Uint8Array;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n offset: \"u32\",\r\n inputData: { array: { type: \"u8\" } },\r\n },\r\n };\r\n\r\n constructor(obj: UpdateNameRegistryInstructionParams) {\r\n this.tag = 1;\r\n this.offset = obj.offset;\r\n this.inputData = obj.inputData;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(UpdateNameRegistryInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n domainAddress: Address,\r\n signer: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: domainAddress,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: signer,\r\n role: AccountRole.READONLY_SIGNER,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAkBA;MACa,6BAA6B,CAAA;;AAExC,IAAA,GAAG;;AAEH,IAAA,MAAM;;AAEN,IAAA,SAAS;IAET,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,MAAM,EAAE,KAAK;YACb,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;AACrC,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAAwC,EAAA;AAClD,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,QAAA,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM;AACxB,QAAA,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS
|
|
1
|
+
{"version":3,"file":"updateNameRegistryInstruction.mjs","sources":["../../../src/instructions/updateNameRegistryInstruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/**\r\n * Input for updating an SNS name-registry account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: UpdateNameRegistryInstructionParams = { offset: 0, inputData };\r\n * ```\r\n */\r\nexport interface UpdateNameRegistryInstructionParams {\r\n /** Byte offset where the update begins. */\r\n offset: number;\r\n /** Bytes to write. */\r\n inputData: Uint8Array;\r\n}\r\n\r\n/** Builder for updating the data of an SNS name-registry account. */\r\nexport class UpdateNameRegistryInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** Byte offset where the update begins. */\r\n offset: number;\r\n /** Bytes to write. */\r\n inputData: Uint8Array;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n offset: \"u32\",\r\n inputData: { array: { type: \"u8\" } },\r\n },\r\n };\r\n\r\n constructor(obj: UpdateNameRegistryInstructionParams) {\r\n this.tag = 1;\r\n this.offset = obj.offset;\r\n this.inputData = obj.inputData;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(UpdateNameRegistryInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n domainAddress: Address,\r\n signer: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: domainAddress,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: signer,\r\n role: AccountRole.READONLY_SIGNER,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAkBA;MACa,6BAA6B,CAAA;;AAExC,IAAA,GAAG;;AAEH,IAAA,MAAM;;AAEN,IAAA,SAAS;IAET,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,MAAM,EAAE,KAAK;YACb,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;AACrC,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAAwC,EAAA;AAClD,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,QAAA,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM;AACxB,QAAA,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS;IAChC;IAEA,SAAS,GAAA;QACP,OAAO,SAAS,CAAC,6BAA6B,CAAC,MAAM,EAAE,IAAI,CAAC;IAC9D;AAEA,IAAA,cAAc,CACZ,cAAuB,EACvB,aAAsB,EACtB,MAAe,EAAA;AAEf,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE;AAE7B,QAAA,MAAM,QAAQ,GAAkB;AAC9B,YAAA;AACE,gBAAA,OAAO,EAAE,aAAa;gBACtB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,WAAW,CAAC,eAAe;AAClC,aAAA;SACF;QAED,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateRecordInstruction.mjs","sources":["../../../src/instructions/updateRecordInstruction.ts"],"sourcesContent":["import {\r\n AccountMeta,\r\n AccountRole,\r\n Address,\r\n Instruction,\r\n ReadonlyUint8Array,\r\n} from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/**\r\n * Input for updating an SNS V2 record account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: UpdateRecordInstructionParams = { record, content };\r\n * ```\r\n */\r\nexport interface UpdateRecordInstructionParams {\r\n /** Encoded V2 record label. */\r\n record: string;\r\n /** Serialized record content. */\r\n content: ReadonlyUint8Array;\r\n}\r\n\r\n/** Builder for updating content in an SNS V2 record account. */\r\nexport class UpdateRecordInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** Encoded V2 record label. */\r\n record: string;\r\n /** Serialized record content. */\r\n content: ReadonlyUint8Array;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n record: \"string\",\r\n content: { array: { type: \"u8\" } },\r\n },\r\n };\r\n\r\n constructor(obj: UpdateRecordInstructionParams) {\r\n this.tag = 2;\r\n this.record = obj.record;\r\n this.content = obj.content;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(UpdateRecordInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n systemProgram: Address,\r\n splNameServiceProgram: Address,\r\n feePayer: Address,\r\n record: Address,\r\n domain: Address,\r\n domainOwner: Address,\r\n centralState: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: splNameServiceProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: feePayer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: record,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domain,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domainOwner,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: centralState,\r\n role: AccountRole.READONLY,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAwBA;MACa,uBAAuB,CAAA;;AAElC,IAAA,GAAG;;AAEH,IAAA,MAAM;;AAEN,IAAA,OAAO;IAEP,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;AACnC,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAAkC,EAAA;AAC5C,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,QAAA,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM;AACxB,QAAA,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO
|
|
1
|
+
{"version":3,"file":"updateRecordInstruction.mjs","sources":["../../../src/instructions/updateRecordInstruction.ts"],"sourcesContent":["import {\r\n AccountMeta,\r\n AccountRole,\r\n Address,\r\n Instruction,\r\n ReadonlyUint8Array,\r\n} from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/**\r\n * Input for updating an SNS V2 record account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: UpdateRecordInstructionParams = { record, content };\r\n * ```\r\n */\r\nexport interface UpdateRecordInstructionParams {\r\n /** Encoded V2 record label. */\r\n record: string;\r\n /** Serialized record content. */\r\n content: ReadonlyUint8Array;\r\n}\r\n\r\n/** Builder for updating content in an SNS V2 record account. */\r\nexport class UpdateRecordInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** Encoded V2 record label. */\r\n record: string;\r\n /** Serialized record content. */\r\n content: ReadonlyUint8Array;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n record: \"string\",\r\n content: { array: { type: \"u8\" } },\r\n },\r\n };\r\n\r\n constructor(obj: UpdateRecordInstructionParams) {\r\n this.tag = 2;\r\n this.record = obj.record;\r\n this.content = obj.content;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(UpdateRecordInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n systemProgram: Address,\r\n splNameServiceProgram: Address,\r\n feePayer: Address,\r\n record: Address,\r\n domain: Address,\r\n domainOwner: Address,\r\n centralState: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: splNameServiceProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: feePayer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: record,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domain,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domainOwner,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: centralState,\r\n role: AccountRole.READONLY,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAwBA;MACa,uBAAuB,CAAA;;AAElC,IAAA,GAAG;;AAEH,IAAA,MAAM;;AAEN,IAAA,OAAO;IAEP,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;AACnC,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAAkC,EAAA;AAC5C,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,QAAA,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM;AACxB,QAAA,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO;IAC5B;IAEA,SAAS,GAAA;QACP,OAAO,SAAS,CAAC,uBAAuB,CAAC,MAAM,EAAE,IAAI,CAAC;IACxD;AAEA,IAAA,cAAc,CACZ,cAAuB,EACvB,aAAsB,EACtB,qBAA8B,EAC9B,QAAiB,EACjB,MAAe,EACf,MAAe,EACf,WAAoB,EACpB,YAAqB,EAAA;AAErB,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE;AAE7B,QAAA,MAAM,QAAQ,GAAkB;AAC9B,YAAA;AACE,gBAAA,OAAO,EAAE,aAAa;gBACtB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,qBAAqB;gBAC9B,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,QAAQ;gBACjB,IAAI,EAAE,WAAW,CAAC,eAAe;AAClC,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAE,WAAW,CAAC,eAAe;AAClC,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,YAAY;gBACrB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;SACF;QAED,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateEthereumSignatureInstruction.mjs","sources":["../../../src/instructions/validateEthereumSignatureInstruction.ts"],"sourcesContent":["import {\r\n AccountMeta,\r\n AccountRole,\r\n Address,\r\n Instruction,\r\n ReadonlyUint8Array,\r\n} from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/**\r\n * Input for validating an Ethereum signature for an SNS record.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: ValidateEthereumSignatureInstructionParams = { validation, signature, expectedPubkey };\r\n * ```\r\n */\r\nexport interface ValidateEthereumSignatureInstructionParams {\r\n /** Validation mode discriminator. */\r\n validation: number;\r\n /** Ethereum signature. */\r\n signature: ReadonlyUint8Array;\r\n /** Expected Ethereum public key. */\r\n expectedPubkey: ReadonlyUint8Array;\r\n}\r\n\r\n/** Builder for validating an Ethereum signature for an SNS record. */\r\nexport class ValidateEthereumSignatureInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** Validation mode discriminator. */\r\n validation: number;\r\n /** Ethereum signature. */\r\n signature: ReadonlyUint8Array;\r\n /** Expected Ethereum public key. */\r\n expectedPubkey: ReadonlyUint8Array;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n validation: \"u8\",\r\n signature: { array: { type: \"u8\" } },\r\n expectedPubkey: { array: { type: \"u8\" } },\r\n },\r\n };\r\n\r\n constructor(obj: ValidateEthereumSignatureInstructionParams) {\r\n this.tag = 4;\r\n this.validation = obj.validation;\r\n this.signature = obj.signature;\r\n this.expectedPubkey = obj.expectedPubkey;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(ValidateEthereumSignatureInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n systemProgram: Address,\r\n splNameServiceProgram: Address,\r\n feePayer: Address,\r\n record: Address,\r\n domain: Address,\r\n domainOwner: Address,\r\n centralState: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: splNameServiceProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: feePayer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: record,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domain,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domainOwner,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: centralState,\r\n role: AccountRole.READONLY,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AA0BA;MACa,oCAAoC,CAAA;;AAE/C,IAAA,GAAG;;AAEH,IAAA,UAAU;;AAEV,IAAA,SAAS;;AAET,IAAA,cAAc;IAEd,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,UAAU,EAAE,IAAI;YAChB,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;YACpC,cAAc,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;AAC1C,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAA+C,EAAA;AACzD,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,QAAA,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU;AAChC,QAAA,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS;AAC9B,QAAA,IAAI,CAAC,cAAc,GAAG,GAAG,CAAC,cAAc
|
|
1
|
+
{"version":3,"file":"validateEthereumSignatureInstruction.mjs","sources":["../../../src/instructions/validateEthereumSignatureInstruction.ts"],"sourcesContent":["import {\r\n AccountMeta,\r\n AccountRole,\r\n Address,\r\n Instruction,\r\n ReadonlyUint8Array,\r\n} from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/**\r\n * Input for validating an Ethereum signature for an SNS record.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: ValidateEthereumSignatureInstructionParams = { validation, signature, expectedPubkey };\r\n * ```\r\n */\r\nexport interface ValidateEthereumSignatureInstructionParams {\r\n /** Validation mode discriminator. */\r\n validation: number;\r\n /** Ethereum signature. */\r\n signature: ReadonlyUint8Array;\r\n /** Expected Ethereum public key. */\r\n expectedPubkey: ReadonlyUint8Array;\r\n}\r\n\r\n/** Builder for validating an Ethereum signature for an SNS record. */\r\nexport class ValidateEthereumSignatureInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** Validation mode discriminator. */\r\n validation: number;\r\n /** Ethereum signature. */\r\n signature: ReadonlyUint8Array;\r\n /** Expected Ethereum public key. */\r\n expectedPubkey: ReadonlyUint8Array;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n validation: \"u8\",\r\n signature: { array: { type: \"u8\" } },\r\n expectedPubkey: { array: { type: \"u8\" } },\r\n },\r\n };\r\n\r\n constructor(obj: ValidateEthereumSignatureInstructionParams) {\r\n this.tag = 4;\r\n this.validation = obj.validation;\r\n this.signature = obj.signature;\r\n this.expectedPubkey = obj.expectedPubkey;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(ValidateEthereumSignatureInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n systemProgram: Address,\r\n splNameServiceProgram: Address,\r\n feePayer: Address,\r\n record: Address,\r\n domain: Address,\r\n domainOwner: Address,\r\n centralState: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: splNameServiceProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: feePayer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: record,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domain,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domainOwner,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: centralState,\r\n role: AccountRole.READONLY,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AA0BA;MACa,oCAAoC,CAAA;;AAE/C,IAAA,GAAG;;AAEH,IAAA,UAAU;;AAEV,IAAA,SAAS;;AAET,IAAA,cAAc;IAEd,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,UAAU,EAAE,IAAI;YAChB,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;YACpC,cAAc,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;AAC1C,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAA+C,EAAA;AACzD,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,QAAA,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU;AAChC,QAAA,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS;AAC9B,QAAA,IAAI,CAAC,cAAc,GAAG,GAAG,CAAC,cAAc;IAC1C;IAEA,SAAS,GAAA;QACP,OAAO,SAAS,CAAC,oCAAoC,CAAC,MAAM,EAAE,IAAI,CAAC;IACrE;AAEA,IAAA,cAAc,CACZ,cAAuB,EACvB,aAAsB,EACtB,qBAA8B,EAC9B,QAAiB,EACjB,MAAe,EACf,MAAe,EACf,WAAoB,EACpB,YAAqB,EAAA;AAErB,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE;AAE7B,QAAA,MAAM,QAAQ,GAAkB;AAC9B,YAAA;AACE,gBAAA,OAAO,EAAE,aAAa;gBACtB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,qBAAqB;gBAC9B,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,QAAQ;gBACjB,IAAI,EAAE,WAAW,CAAC,eAAe;AAClC,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAE,WAAW,CAAC,eAAe;AAClC,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,YAAY;gBACrB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;SACF;QAED,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateSolanaSignatureInstruction.mjs","sources":["../../../src/instructions/validateSolanaSignatureInstruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/**\r\n * Input for validating a Solana signature for an SNS record.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: ValidateSolanaSignatureInstructionParams = { staleness: false };\r\n * ```\r\n */\r\nexport interface ValidateSolanaSignatureInstructionParams {\r\n /** Whether to validate staleness. */\r\n staleness: boolean;\r\n}\r\n\r\n/** Builder for validating a Solana signature for an SNS record. */\r\nexport class ValidateSolanaSignatureInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** Whether to validate staleness. */\r\n staleness: boolean;\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n staleness: \"bool\",\r\n },\r\n };\r\n\r\n constructor(obj: ValidateSolanaSignatureInstructionParams) {\r\n this.tag = 3;\r\n this.staleness = obj.staleness;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(ValidateSolanaSignatureInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n systemProgram: Address,\r\n splNameServiceProgram: Address,\r\n feePayer: Address,\r\n record: Address,\r\n domain: Address,\r\n domainOwner: Address,\r\n centralState: Address,\r\n verifier: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: splNameServiceProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: feePayer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: record,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domain,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domainOwner,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: centralState,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: verifier,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAgBA;MACa,kCAAkC,CAAA;;AAE7C,IAAA,GAAG;;AAEH,IAAA,SAAS;IACT,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,SAAS,EAAE,MAAM;AAClB,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAA6C,EAAA;AACvD,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,QAAA,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS
|
|
1
|
+
{"version":3,"file":"validateSolanaSignatureInstruction.mjs","sources":["../../../src/instructions/validateSolanaSignatureInstruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/**\r\n * Input for validating a Solana signature for an SNS record.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: ValidateSolanaSignatureInstructionParams = { staleness: false };\r\n * ```\r\n */\r\nexport interface ValidateSolanaSignatureInstructionParams {\r\n /** Whether to validate staleness. */\r\n staleness: boolean;\r\n}\r\n\r\n/** Builder for validating a Solana signature for an SNS record. */\r\nexport class ValidateSolanaSignatureInstruction {\r\n /** Instruction discriminator. */\r\n tag: number;\r\n /** Whether to validate staleness. */\r\n staleness: boolean;\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n staleness: \"bool\",\r\n },\r\n };\r\n\r\n constructor(obj: ValidateSolanaSignatureInstructionParams) {\r\n this.tag = 3;\r\n this.staleness = obj.staleness;\r\n }\r\n\r\n serialize(): Uint8Array {\r\n return serialize(ValidateSolanaSignatureInstruction.schema, this);\r\n }\r\n\r\n getInstruction(\r\n programAddress: Address,\r\n systemProgram: Address,\r\n splNameServiceProgram: Address,\r\n feePayer: Address,\r\n record: Address,\r\n domain: Address,\r\n domainOwner: Address,\r\n centralState: Address,\r\n verifier: Address\r\n ): Instruction {\r\n const data = this.serialize();\r\n\r\n const accounts: AccountMeta[] = [\r\n {\r\n address: systemProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: splNameServiceProgram,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: feePayer,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n {\r\n address: record,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domain,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: domainOwner,\r\n role: AccountRole.WRITABLE,\r\n },\r\n {\r\n address: centralState,\r\n role: AccountRole.READONLY,\r\n },\r\n {\r\n address: verifier,\r\n role: AccountRole.WRITABLE_SIGNER,\r\n },\r\n ];\r\n\r\n return {\r\n programAddress,\r\n accounts,\r\n data,\r\n };\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAgBA;MACa,kCAAkC,CAAA;;AAE7C,IAAA,GAAG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AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,QAAQ;gBACjB,IAAI,EAAE,WAAW,CAAC,eAAe;AAClC,aAAA;SACF;QAED,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getProgramDerivedAddress } from '@solana/kit';
|
|
2
|
-
import {
|
|
2
|
+
import { addressCodec, utf8Codec } from '../codecs.mjs';
|
|
3
3
|
import { NAME_TOKENIZER_ADDRESS } from '../constants/addresses.mjs';
|
|
4
4
|
|
|
5
5
|
const MINT_PREFIX = utf8Codec.encode("tokenized_name");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSnsNftMint.mjs","sources":["../../../src/nft/getSnsNftMint.ts"],"sourcesContent":["import { Address, getProgramDerivedAddress } from \"@solana/kit\";\r\n\r\nimport { addressCodec, utf8Codec } from \"../codecs\";\r\nimport { NAME_TOKENIZER_ADDRESS } from \"../constants/addresses\";\r\n\r\n/**\r\n * Parameters for deriving an SNS NFT mint.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: GetSnsNftMintParams = { domainAddress };\r\n * ```\r\n */\r\nexport interface GetSnsNftMintParams {\r\n /** Tokenized domain account address. */\r\n domainAddress: Address;\r\n}\r\n\r\nconst MINT_PREFIX = utf8Codec.encode(\"tokenized_name\");\r\n\r\n/**\r\n * Derives the mint address of a tokenized SNS domain.\r\n *\r\n * @param params NFT mint derivation parameters\r\n * @param params.domainAddress Domain account address used to derive the NFT mint\r\n * @returns The derived SNS domain NFT mint address.\r\n *\r\n * @example\r\n * ```ts\r\n * const mint = await getSnsNftMint({ domainAddress });\r\n * ```\r\n */\r\nexport const getSnsNftMint = async ({ domainAddress }: GetSnsNftMintParams) => {\r\n const [mint] = await getProgramDerivedAddress({\r\n programAddress: NAME_TOKENIZER_ADDRESS,\r\n seeds: [MINT_PREFIX, addressCodec.encode(domainAddress)],\r\n });\r\n return mint;\r\n};\r\n"],"names":[],"mappings":";;;;AAkBA,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC;AAEtD;;;;;;;;;;;AAWG;
|
|
1
|
+
{"version":3,"file":"getSnsNftMint.mjs","sources":["../../../src/nft/getSnsNftMint.ts"],"sourcesContent":["import { Address, getProgramDerivedAddress } from \"@solana/kit\";\r\n\r\nimport { addressCodec, utf8Codec } from \"../codecs\";\r\nimport { NAME_TOKENIZER_ADDRESS } from \"../constants/addresses\";\r\n\r\n/**\r\n * Parameters for deriving an SNS NFT mint.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: GetSnsNftMintParams = { domainAddress };\r\n * ```\r\n */\r\nexport interface GetSnsNftMintParams {\r\n /** Tokenized domain account address. */\r\n domainAddress: Address;\r\n}\r\n\r\nconst MINT_PREFIX = utf8Codec.encode(\"tokenized_name\");\r\n\r\n/**\r\n * Derives the mint address of a tokenized SNS domain.\r\n *\r\n * @param params NFT mint derivation parameters\r\n * @param params.domainAddress Domain account address used to derive the NFT mint\r\n * @returns The derived SNS domain NFT mint address.\r\n *\r\n * @example\r\n * ```ts\r\n * const mint = await getSnsNftMint({ domainAddress });\r\n * ```\r\n */\r\nexport const getSnsNftMint = async ({ domainAddress }: GetSnsNftMintParams) => {\r\n const [mint] = await getProgramDerivedAddress({\r\n programAddress: NAME_TOKENIZER_ADDRESS,\r\n seeds: [MINT_PREFIX, addressCodec.encode(domainAddress)],\r\n });\r\n return mint;\r\n};\r\n"],"names":[],"mappings":";;;;AAkBA,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC;AAEtD;;;;;;;;;;;AAWG;AACI,MAAM,aAAa,GAAG,OAAO,EAAE,aAAa,EAAuB,KAAI;AAC5E,IAAA,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,wBAAwB,CAAC;AAC5C,QAAA,cAAc,EAAE,sBAAsB;QACtC,KAAK,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;AACzD,KAAA,CAAC;AACF,IAAA,OAAO,IAAI;AACb;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSnsNftOwner.mjs","sources":["../../../src/nft/getSnsNftOwner.ts"],"sourcesContent":["import {\r\n Address,\r\n GetAccountInfoApi,\r\n GetTokenLargestAccountsApi,\r\n Rpc,\r\n SOLANA_ERROR__JSON_RPC__INVALID_PARAMS,\r\n fetchEncodedAccount,\r\n isSolanaError,\r\n} from \"@solana/kit\";\r\n\r\nimport { tokenCodec } from \"../codecs\";\r\nimport { getSnsNftMint } from \"./getSnsNftMint\";\r\n\r\n/**\r\n * Parameters for retrieving an SNS NFT owner.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: GetSnsNftOwnerParams = { rpc, domainAddress };\r\n * ```\r\n */\r\nexport interface GetSnsNftOwnerParams {\r\n /** RPC client. */\r\n rpc: Rpc<GetAccountInfoApi & GetTokenLargestAccountsApi>;\r\n /** Tokenized domain account address. */\r\n domainAddress: Address;\r\n}\r\n\r\n/**\r\n * Retrieves the owner of a tokenized SNS domain.\r\n *\r\n * @param params NFT owner retrieval parameters\r\n * @param params.rpc RPC client implementing account and token-largest-account APIs\r\n * @param params.domainAddress Domain account address whose tokenized owner is retrieved\r\n * @returns The SNS domain NFT owner address, or `null` when no valid tokenized owner is found.\r\n *\r\n * @example\r\n * ```ts\r\n * const owner = await getSnsNftOwner({ rpc, domainAddress });\r\n * ```\r\n */\r\nexport const getSnsNftOwner = async ({\r\n rpc,\r\n domainAddress,\r\n}: GetSnsNftOwnerParams): Promise<Address | null> => {\r\n try {\r\n const mint = await getSnsNftMint({ domainAddress });\r\n const largestAccounts = await rpc.getTokenLargestAccounts(mint).send();\r\n\r\n if (largestAccounts.value.length === 0) {\r\n return null;\r\n }\r\n\r\n const largestAccountInfo = await fetchEncodedAccount(\r\n rpc,\r\n largestAccounts.value[0].address\r\n );\r\n\r\n if (!largestAccountInfo.exists) {\r\n return null;\r\n }\r\n\r\n const decoded = tokenCodec.decode(largestAccountInfo.data);\r\n if (decoded.amount.toString() === \"1\") {\r\n return decoded.owner;\r\n }\r\n\r\n return null;\r\n } catch (err) {\r\n if (isSolanaError(err, SOLANA_ERROR__JSON_RPC__INVALID_PARAMS)) {\r\n return null;\r\n }\r\n throw err;\r\n }\r\n};\r\n"],"names":[],"mappings":";;;;AA4BA;;;;;;;;;;;;AAYG;AACI,MAAM,cAAc,GAAG,OAAO,EACnC,GAAG,EACH,aAAa,GACQ,KAA6B;AAClD,IAAA,IAAI;QACF,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,EAAE,aAAa,EAAE,CAAC;AACnD,QAAA,MAAM,eAAe,GAAG,MAAM,GAAG,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE;QAEtE,IAAI,eAAe,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;AACtC,YAAA,OAAO,IAAI
|
|
1
|
+
{"version":3,"file":"getSnsNftOwner.mjs","sources":["../../../src/nft/getSnsNftOwner.ts"],"sourcesContent":["import {\r\n Address,\r\n GetAccountInfoApi,\r\n GetTokenLargestAccountsApi,\r\n Rpc,\r\n SOLANA_ERROR__JSON_RPC__INVALID_PARAMS,\r\n fetchEncodedAccount,\r\n isSolanaError,\r\n} from \"@solana/kit\";\r\n\r\nimport { tokenCodec } from \"../codecs\";\r\nimport { getSnsNftMint } from \"./getSnsNftMint\";\r\n\r\n/**\r\n * Parameters for retrieving an SNS NFT owner.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: GetSnsNftOwnerParams = { rpc, domainAddress };\r\n * ```\r\n */\r\nexport interface GetSnsNftOwnerParams {\r\n /** RPC client. */\r\n rpc: Rpc<GetAccountInfoApi & GetTokenLargestAccountsApi>;\r\n /** Tokenized domain account address. */\r\n domainAddress: Address;\r\n}\r\n\r\n/**\r\n * Retrieves the owner of a tokenized SNS domain.\r\n *\r\n * @param params NFT owner retrieval parameters\r\n * @param params.rpc RPC client implementing account and token-largest-account APIs\r\n * @param params.domainAddress Domain account address whose tokenized owner is retrieved\r\n * @returns The SNS domain NFT owner address, or `null` when no valid tokenized owner is found.\r\n *\r\n * @example\r\n * ```ts\r\n * const owner = await getSnsNftOwner({ rpc, domainAddress });\r\n * ```\r\n */\r\nexport const getSnsNftOwner = async ({\r\n rpc,\r\n domainAddress,\r\n}: GetSnsNftOwnerParams): Promise<Address | null> => {\r\n try {\r\n const mint = await getSnsNftMint({ domainAddress });\r\n const largestAccounts = await rpc.getTokenLargestAccounts(mint).send();\r\n\r\n if (largestAccounts.value.length === 0) {\r\n return null;\r\n }\r\n\r\n const largestAccountInfo = await fetchEncodedAccount(\r\n rpc,\r\n largestAccounts.value[0].address\r\n );\r\n\r\n if (!largestAccountInfo.exists) {\r\n return null;\r\n }\r\n\r\n const decoded = tokenCodec.decode(largestAccountInfo.data);\r\n if (decoded.amount.toString() === \"1\") {\r\n return decoded.owner;\r\n }\r\n\r\n return null;\r\n } catch (err) {\r\n if (isSolanaError(err, SOLANA_ERROR__JSON_RPC__INVALID_PARAMS)) {\r\n return null;\r\n }\r\n throw err;\r\n }\r\n};\r\n"],"names":[],"mappings":";;;;AA4BA;;;;;;;;;;;;AAYG;AACI,MAAM,cAAc,GAAG,OAAO,EACnC,GAAG,EACH,aAAa,GACQ,KAA6B;AAClD,IAAA,IAAI;QACF,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,EAAE,aAAa,EAAE,CAAC;AACnD,QAAA,MAAM,eAAe,GAAG,MAAM,GAAG,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE;QAEtE,IAAI,eAAe,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;AACtC,YAAA,OAAO,IAAI;QACb;AAEA,QAAA,MAAM,kBAAkB,GAAG,MAAM,mBAAmB,CAClD,GAAG,EACH,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CACjC;AAED,QAAA,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE;AAC9B,YAAA,OAAO,IAAI;QACb;QAEA,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC;QAC1D,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,GAAG,EAAE;YACrC,OAAO,OAAO,CAAC,KAAK;QACtB;AAEA,QAAA,OAAO,IAAI;IACb;IAAE,OAAO,GAAG,EAAE;AACZ,QAAA,IAAI,aAAa,CAAC,GAAG,EAAE,sCAAsC,CAAC,EAAE;AAC9D,YAAA,OAAO,IAAI;QACb;AACA,QAAA,MAAM,GAAG;IACX;AACF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRecordV1Address.mjs","sources":["../../../src/record/getRecordV1Address.ts"],"sourcesContent":["import { getSnsDomainAddress } from \"../domain/getSnsDomainAddress\";\r\nimport { Record, RecordVersion } from \"../types/record\";\r\n\r\n/**\r\n * Parameters for deriving a V1 record address.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: GetRecordV1AddressParams = { domain: \"example\", record: Record.Url };\r\n * ```\r\n */\r\nexport interface GetRecordV1AddressParams {\r\n /** TLD-less domain name. */\r\n domain: string;\r\n /** Record type. */\r\n record: Record;\r\n}\r\n\r\n/**\r\n * Derives the address of a V1 record account.\r\n *\r\n * The V1 account is derived by prefixing the record label to the domain name.\r\n *\r\n * @param params Record address derivation parameters\r\n * @param params.domain TLD-trimmed SNS domain name\r\n * @param params.record Record type\r\n * @returns The derived V1 record account address.\r\n *\r\n * @example\r\n * ```ts\r\n * const address = await getRecordV1Address({ domain: \"example\", record: Record.Url });\r\n * ```\r\n */\r\nexport const getRecordV1Address = async ({\r\n domain,\r\n record,\r\n}: GetRecordV1AddressParams) => {\r\n const { domainAddress } = await getSnsDomainAddress({\r\n domain: record + \".\" + domain,\r\n record: RecordVersion.V1,\r\n });\r\n\r\n return domainAddress;\r\n};\r\n"],"names":[],"mappings":";;;AAkBA;;;;;;;;;;;;;;AAcG;AACI,MAAM,kBAAkB,GAAG,OAAO,EACvC,MAAM,EACN,MAAM,GACmB,KAAI;AAC7B,IAAA,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,mBAAmB,CAAC;AAClD,QAAA,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM;QAC7B,MAAM,EAAE,aAAa,CAAC,EAAE;AACzB,KAAA,CAAC;AAEF,IAAA,OAAO,aAAa;AACtB
|
|
1
|
+
{"version":3,"file":"getRecordV1Address.mjs","sources":["../../../src/record/getRecordV1Address.ts"],"sourcesContent":["import { getSnsDomainAddress } from \"../domain/getSnsDomainAddress\";\r\nimport { Record, RecordVersion } from \"../types/record\";\r\n\r\n/**\r\n * Parameters for deriving a V1 record address.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: GetRecordV1AddressParams = { domain: \"example\", record: Record.Url };\r\n * ```\r\n */\r\nexport interface GetRecordV1AddressParams {\r\n /** TLD-less domain name. */\r\n domain: string;\r\n /** Record type. */\r\n record: Record;\r\n}\r\n\r\n/**\r\n * Derives the address of a V1 record account.\r\n *\r\n * The V1 account is derived by prefixing the record label to the domain name.\r\n *\r\n * @param params Record address derivation parameters\r\n * @param params.domain TLD-trimmed SNS domain name\r\n * @param params.record Record type\r\n * @returns The derived V1 record account address.\r\n *\r\n * @example\r\n * ```ts\r\n * const address = await getRecordV1Address({ domain: \"example\", record: Record.Url });\r\n * ```\r\n */\r\nexport const getRecordV1Address = async ({\r\n domain,\r\n record,\r\n}: GetRecordV1AddressParams) => {\r\n const { domainAddress } = await getSnsDomainAddress({\r\n domain: record + \".\" + domain,\r\n record: RecordVersion.V1,\r\n });\r\n\r\n return domainAddress;\r\n};\r\n"],"names":[],"mappings":";;;AAkBA;;;;;;;;;;;;;;AAcG;AACI,MAAM,kBAAkB,GAAG,OAAO,EACvC,MAAM,EACN,MAAM,GACmB,KAAI;AAC7B,IAAA,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,mBAAmB,CAAC;AAClD,QAAA,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM;QAC7B,MAAM,EAAE,aAAa,CAAC,EAAE;AACzB,KAAA,CAAC;AAEF,IAAA,OAAO,aAAa;AACtB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRecordV2Address.mjs","sources":["../../../src/record/getRecordV2Address.ts"],"sourcesContent":["import { Address } from \"@solana/kit\";\r\n\r\nimport { CENTRAL_STATE_DOMAIN_RECORDS } from \"../constants/addresses\";\r\nimport { getSnsDomainAddress } from \"../domain/getSnsDomainAddress\";\r\nimport { Record } from \"../types/record\";\r\nimport { _deriveAddress } from \"../utils/deriveAddress\";\r\n\r\n/**\r\n * Parameters for deriving a V2 record address.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: GetRecordV2AddressParams = { domain: \"example\", record: Record.Url };\r\n * ```\r\n */\r\nexport interface GetRecordV2AddressParams {\r\n /** TLD-less domain name. */\r\n domain: string;\r\n /** Record type. */\r\n record: Record;\r\n}\r\n\r\n/**\r\n * Derives the address of a V2 record account.\r\n *\r\n * @param params Record address derivation parameters\r\n * @param params.domain TLD-trimmed SNS domain name\r\n * @param params.record Record type\r\n * @returns The derived V2 record account address.\r\n *\r\n * @example\r\n * ```ts\r\n * const address = await getRecordV2Address({ domain: \"example\", record: Record.Url });\r\n * ```\r\n */\r\nexport const getRecordV2Address = async ({\r\n domain,\r\n record,\r\n}: GetRecordV2AddressParams): Promise<Address> => {\r\n const { domainAddress } = await getSnsDomainAddress({ domain });\r\n\r\n return await _deriveAddress(\r\n `\\x02${record}`,\r\n domainAddress,\r\n CENTRAL_STATE_DOMAIN_RECORDS\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;AAsBA;;;;;;;;;;;;AAYG;AACI,MAAM,kBAAkB,GAAG,OAAO,EACvC,MAAM,EACN,MAAM,GACmB,KAAsB;IAC/C,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE/D,OAAO,MAAM,cAAc,CACzB,
|
|
1
|
+
{"version":3,"file":"getRecordV2Address.mjs","sources":["../../../src/record/getRecordV2Address.ts"],"sourcesContent":["import { Address } from \"@solana/kit\";\r\n\r\nimport { CENTRAL_STATE_DOMAIN_RECORDS } from \"../constants/addresses\";\r\nimport { getSnsDomainAddress } from \"../domain/getSnsDomainAddress\";\r\nimport { Record } from \"../types/record\";\r\nimport { _deriveAddress } from \"../utils/deriveAddress\";\r\n\r\n/**\r\n * Parameters for deriving a V2 record address.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: GetRecordV2AddressParams = { domain: \"example\", record: Record.Url };\r\n * ```\r\n */\r\nexport interface GetRecordV2AddressParams {\r\n /** TLD-less domain name. */\r\n domain: string;\r\n /** Record type. */\r\n record: Record;\r\n}\r\n\r\n/**\r\n * Derives the address of a V2 record account.\r\n *\r\n * @param params Record address derivation parameters\r\n * @param params.domain TLD-trimmed SNS domain name\r\n * @param params.record Record type\r\n * @returns The derived V2 record account address.\r\n *\r\n * @example\r\n * ```ts\r\n * const address = await getRecordV2Address({ domain: \"example\", record: Record.Url });\r\n * ```\r\n */\r\nexport const getRecordV2Address = async ({\r\n domain,\r\n record,\r\n}: GetRecordV2AddressParams): Promise<Address> => {\r\n const { domainAddress } = await getSnsDomainAddress({ domain });\r\n\r\n return await _deriveAddress(\r\n `\\x02${record}`,\r\n domainAddress,\r\n CENTRAL_STATE_DOMAIN_RECORDS\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;AAsBA;;;;;;;;;;;;AAYG;AACI,MAAM,kBAAkB,GAAG,OAAO,EACvC,MAAM,EACN,MAAM,GACmB,KAAsB;IAC/C,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE/D,OAAO,MAAM,cAAc,CACzB,CAAA,IAAA,EAAO,MAAM,CAAA,CAAE,EACf,aAAa,EACb,4BAA4B,CAC7B;AACH;;"}
|
|
@@ -4,7 +4,7 @@ import { MissingVerifierError } from '../errors.mjs';
|
|
|
4
4
|
import { getRecordV2Address } from './getRecordV2Address.mjs';
|
|
5
5
|
import { RecordState } from '../states/record.mjs';
|
|
6
6
|
import { Validation } from '../types/validation.mjs';
|
|
7
|
-
import {
|
|
7
|
+
import { _parseSnsDomain } from '../utils/parseSnsDomain.mjs';
|
|
8
8
|
import { uint8ArraysEqual } from '../utils/uint8Array/uint8ArraysEqual.mjs';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -61,7 +61,7 @@ const _verifyRoaSync = ({ record, state, verifier, }) => {
|
|
|
61
61
|
* Verifies a record's Right of Association validation.
|
|
62
62
|
*
|
|
63
63
|
* @param rpc RPC client implementing account and token-largest-account APIs
|
|
64
|
-
* @param domain Full
|
|
64
|
+
* @param domain Full `.sns` domain name
|
|
65
65
|
* @param record Record type to verify
|
|
66
66
|
* @param verifier Optional verifier for the record. If omitted, a default verifier is derived
|
|
67
67
|
* @returns True if the association is valid, false otherwise.
|
|
@@ -73,7 +73,7 @@ const _verifyRoaSync = ({ record, state, verifier, }) => {
|
|
|
73
73
|
* ```
|
|
74
74
|
*/
|
|
75
75
|
const verifyRecordRightOfAssociation = async (rpc, domain, record, verifier) => {
|
|
76
|
-
const
|
|
76
|
+
const trimmedDomain = _parseSnsDomain(domain);
|
|
77
77
|
const address = await getRecordV2Address({
|
|
78
78
|
domain: trimmedDomain,
|
|
79
79
|
record,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyRecordRightOfAssociation.mjs","sources":["../../../src/record/verifyRecordRightOfAssociation.ts"],"sourcesContent":["import {\r\n GetAccountInfoApi,\r\n
|
|
1
|
+
{"version":3,"file":"verifyRecordRightOfAssociation.mjs","sources":["../../../src/record/verifyRecordRightOfAssociation.ts"],"sourcesContent":["import {\r\n GetAccountInfoApi,\r\n GetTokenLargestAccountsApi,\r\n ReadonlyUint8Array,\r\n Rpc,\r\n} from \"@solana/kit\";\r\n\r\nimport { addressCodec } from \"../codecs\";\r\nimport {\r\n ETH_ROA_RECORDS,\r\n GUARDIANS,\r\n SELF_SIGNED_RECORDS,\r\n} from \"../constants/records\";\r\nimport { MissingVerifierError } from \"../errors\";\r\nimport { getRecordV2Address } from \"../record/getRecordV2Address\";\r\nimport { RecordState } from \"../states/record\";\r\nimport { Record } from \"../types/record\";\r\nimport { Validation } from \"../types/validation\";\r\nimport { _parseSnsDomain } from \"../utils/parseSnsDomain\";\r\nimport { uint8ArraysEqual } from \"../utils/uint8Array/uint8ArraysEqual\";\r\n\r\n/**\r\n * Internal helper that derives the default verifier for a record state.\r\n *\r\n * @param params Default verifier parameters\r\n * @param params.record Record type\r\n * @param params.state Record state\r\n * @returns The default verifier, or `undefined` when no verifier is found.\r\n *\r\n * @example\r\n * ```ts\r\n * const verifier = _getDefaultVerifier({ record: Record.Url, state });\r\n * ```\r\n */\r\nexport const _getDefaultVerifier = ({\r\n record,\r\n state,\r\n}: {\r\n record: Record;\r\n state: RecordState;\r\n}) => {\r\n if (SELF_SIGNED_RECORDS.has(record)) {\r\n return state.getContent();\r\n } else {\r\n const guardian = GUARDIANS.get(record);\r\n if (guardian) {\r\n return addressCodec.encode(guardian);\r\n }\r\n }\r\n return undefined;\r\n};\r\n\r\n/**\r\n * Internal helper that verifies a record's Right of Association validation.\r\n *\r\n * Ethereum/secp256k1 validation is used for EVM RoA records; Solana validation\r\n * is used otherwise.\r\n *\r\n * @param params Right of Association verification parameters\r\n * @param params.record Record type to verify\r\n * @param params.state Record state\r\n * @param params.verifier Verifier for the record\r\n * @returns True if the association is valid, false otherwise.\r\n *\r\n * @example\r\n * ```ts\r\n * const valid = _verifyRoaSync({ record: Record.Url, state, verifier });\r\n * ```\r\n */\r\nexport const _verifyRoaSync = ({\r\n record,\r\n state,\r\n verifier,\r\n}: {\r\n record: Record;\r\n state: RecordState;\r\n verifier: ReadonlyUint8Array;\r\n}) => {\r\n const roaId = state.getRoAId();\r\n\r\n const validation = ETH_ROA_RECORDS.has(record)\r\n ? Validation.Ethereum\r\n : Validation.Solana;\r\n\r\n return (\r\n uint8ArraysEqual(roaId, verifier) &&\r\n state.header.rightOfAssociationValidation === validation\r\n );\r\n};\r\n\r\n/**\r\n * Verifies a record's Right of Association validation.\r\n *\r\n * @param rpc RPC client implementing account and token-largest-account APIs\r\n * @param domain Full `.sns` domain name\r\n * @param record Record type to verify\r\n * @param verifier Optional verifier for the record. If omitted, a default verifier is derived\r\n * @returns True if the association is valid, false otherwise.\r\n * @throws MissingVerifierError If no verifier is specified and no default verifier is found.\r\n *\r\n * @example\r\n * ```ts\r\n * const valid = await verifyRecordRightOfAssociation(rpc, \"example.sns\", Record.Url);\r\n * ```\r\n */\r\nexport const verifyRecordRightOfAssociation = async (\r\n rpc: Rpc<GetAccountInfoApi & GetTokenLargestAccountsApi>,\r\n domain: string,\r\n record: Record,\r\n verifier?: ReadonlyUint8Array\r\n) => {\r\n const trimmedDomain = _parseSnsDomain(domain);\r\n const address = await getRecordV2Address({\r\n domain: trimmedDomain,\r\n record,\r\n });\r\n const state = await RecordState.retrieve(rpc, address);\r\n\r\n verifier = verifier || _getDefaultVerifier({ record, state });\r\n if (!verifier) {\r\n throw new MissingVerifierError(\"You must specify the verifier\");\r\n }\r\n\r\n return _verifyRoaSync({ record, state, verifier });\r\n};\r\n"],"names":[],"mappings":";;;;;;;;;AAqBA;;;;;;;;;;;;AAYG;AACI,MAAM,mBAAmB,GAAG,CAAC,EAClC,MAAM,EACN,KAAK,GAIN,KAAI;AACH,IAAA,IAAI,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;AACnC,QAAA,OAAO,KAAK,CAAC,UAAU,EAAE;IAC3B;SAAO;QACL,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC;QACtC,IAAI,QAAQ,EAAE;AACZ,YAAA,OAAO,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC;QACtC;IACF;AACA,IAAA,OAAO,SAAS;AAClB;AAEA;;;;;;;;;;;;;;;;AAgBG;AACI,MAAM,cAAc,GAAG,CAAC,EAC7B,MAAM,EACN,KAAK,EACL,QAAQ,GAKT,KAAI;AACH,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE;AAE9B,IAAA,MAAM,UAAU,GAAG,eAAe,CAAC,GAAG,CAAC,MAAM;UACzC,UAAU,CAAC;AACb,UAAE,UAAU,CAAC,MAAM;AAErB,IAAA,QACE,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC;AACjC,QAAA,KAAK,CAAC,MAAM,CAAC,4BAA4B,KAAK,UAAU;AAE5D;AAEA;;;;;;;;;;;;;;AAcG;AACI,MAAM,8BAA8B,GAAG,OAC5C,GAAwD,EACxD,MAAc,EACd,MAAc,EACd,QAA6B,KAC3B;AACF,IAAA,MAAM,aAAa,GAAG,eAAe,CAAC,MAAM,CAAC;AAC7C,IAAA,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC;AACvC,QAAA,MAAM,EAAE,aAAa;QACrB,MAAM;AACP,KAAA,CAAC;IACF,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IAEtD,QAAQ,GAAG,QAAQ,IAAI,mBAAmB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC7D,IAAI,CAAC,QAAQ,EAAE;AACb,QAAA,MAAM,IAAI,oBAAoB,CAAC,+BAA+B,CAAC;IACjE;IAEA,OAAO,cAAc,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACpD;;"}
|
|
@@ -3,7 +3,7 @@ import { _getSnsDomainOwner } from '../domain/getSnsDomainOwner.mjs';
|
|
|
3
3
|
import { getRecordV2Address } from './getRecordV2Address.mjs';
|
|
4
4
|
import { RecordState } from '../states/record.mjs';
|
|
5
5
|
import { Validation } from '../types/validation.mjs';
|
|
6
|
-
import {
|
|
6
|
+
import { _parseSnsDomain } from '../utils/parseSnsDomain.mjs';
|
|
7
7
|
import { uint8ArraysEqual } from '../utils/uint8Array/uint8ArraysEqual.mjs';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -29,7 +29,7 @@ const _verifyStalenessSync = ({ domainOwner, state, }) => {
|
|
|
29
29
|
*
|
|
30
30
|
* @param params Staleness verification parameters
|
|
31
31
|
* @param params.rpc RPC client implementing account and token-largest-account APIs
|
|
32
|
-
* @param params.domain Full
|
|
32
|
+
* @param params.domain Full `.sns` domain name
|
|
33
33
|
* @param params.record Record type to verify
|
|
34
34
|
* @returns True if the record's staleness validation passes, false otherwise.
|
|
35
35
|
*
|
|
@@ -39,7 +39,7 @@ const _verifyStalenessSync = ({ domainOwner, state, }) => {
|
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
41
|
const verifyRecordStaleness = async ({ rpc, domain, record, }) => {
|
|
42
|
-
const
|
|
42
|
+
const trimmedDomain = _parseSnsDomain(domain);
|
|
43
43
|
const [domainOwner, state] = await Promise.all([
|
|
44
44
|
_getSnsDomainOwner({ rpc, domain: trimmedDomain }),
|
|
45
45
|
getRecordV2Address({ domain: trimmedDomain, record }).then((address) => RecordState.retrieve(rpc, address)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyRecordStaleness.mjs","sources":["../../../src/record/verifyRecordStaleness.ts"],"sourcesContent":["import {\r\n Address,\r\n GetAccountInfoApi,\r\n
|
|
1
|
+
{"version":3,"file":"verifyRecordStaleness.mjs","sources":["../../../src/record/verifyRecordStaleness.ts"],"sourcesContent":["import {\r\n Address,\r\n GetAccountInfoApi,\r\n GetTokenLargestAccountsApi,\r\n Rpc,\r\n} from \"@solana/kit\";\r\n\r\nimport { addressCodec } from \"../codecs\";\r\nimport { _getSnsDomainOwner } from \"../domain/getSnsDomainOwner\";\r\nimport { getRecordV2Address } from \"../record/getRecordV2Address\";\r\nimport { RecordState } from \"../states/record\";\r\nimport { Record } from \"../types/record\";\r\nimport { Validation } from \"../types/validation\";\r\nimport { _parseSnsDomain } from \"../utils/parseSnsDomain\";\r\nimport { uint8ArraysEqual } from \"../utils/uint8Array/uint8ArraysEqual\";\r\n\r\n/**\r\n * Internal helper that verifies a record's staleness validation.\r\n *\r\n * @param params Staleness verification parameters\r\n * @param params.domainOwner Current owner of the domain\r\n * @param params.state Record state to verify\r\n * @returns True if the record's staleness validation passes, false otherwise.\r\n *\r\n * @example\r\n * ```ts\r\n * const valid = _verifyStalenessSync({ domainOwner, state });\r\n * ```\r\n */\r\nexport const _verifyStalenessSync = ({\r\n domainOwner,\r\n state,\r\n}: {\r\n domainOwner: Address;\r\n state: RecordState;\r\n}) => {\r\n const stalenessId = state.getStalenessId();\r\n\r\n return (\r\n uint8ArraysEqual(addressCodec.encode(domainOwner), stalenessId) &&\r\n state.header.stalenessValidation === Validation.Solana\r\n );\r\n};\r\n\r\n/**\r\n * Parameters for verifying record staleness.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: VerifyRecordStalenessParams = {\r\n * rpc,\r\n * domain: \"example.sns\",\r\n * record: Record.Url,\r\n * };\r\n * ```\r\n */\r\nexport interface VerifyRecordStalenessParams {\r\n /** RPC client. */\r\n rpc: Rpc<GetAccountInfoApi & GetTokenLargestAccountsApi>;\r\n /** Full `.sns` domain name. */\r\n domain: string;\r\n /** Record type. */\r\n record: Record;\r\n}\r\n\r\n/**\r\n * Verifies a record's staleness validation.\r\n *\r\n * @param params Staleness verification parameters\r\n * @param params.rpc RPC client implementing account and token-largest-account APIs\r\n * @param params.domain Full `.sns` domain name\r\n * @param params.record Record type to verify\r\n * @returns True if the record's staleness validation passes, false otherwise.\r\n *\r\n * @example\r\n * ```ts\r\n * const valid = await verifyRecordStaleness({ rpc, domain: \"example.sns\", record: Record.Url });\r\n * ```\r\n */\r\nexport const verifyRecordStaleness = async ({\r\n rpc,\r\n domain,\r\n record,\r\n}: VerifyRecordStalenessParams): Promise<boolean> => {\r\n const trimmedDomain = _parseSnsDomain(domain);\r\n const [domainOwner, state] = await Promise.all([\r\n _getSnsDomainOwner({ rpc, domain: trimmedDomain }),\r\n getRecordV2Address({ domain: trimmedDomain, record }).then((address) =>\r\n RecordState.retrieve(rpc, address)\r\n ),\r\n ]);\r\n\r\n return _verifyStalenessSync({ domainOwner, state });\r\n};\r\n"],"names":[],"mappings":";;;;;;;;AAgBA;;;;;;;;;;;;AAYG;AACI,MAAM,oBAAoB,GAAG,CAAC,EACnC,WAAW,EACX,KAAK,GAIN,KAAI;AACH,IAAA,MAAM,WAAW,GAAG,KAAK,CAAC,cAAc,EAAE;IAE1C,QACE,gBAAgB,CAAC,YAAY,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;QAC/D,KAAK,CAAC,MAAM,CAAC,mBAAmB,KAAK,UAAU,CAAC,MAAM;AAE1D;AAuBA;;;;;;;;;;;;;AAaG;AACI,MAAM,qBAAqB,GAAG,OAAO,EAC1C,GAAG,EACH,MAAM,EACN,MAAM,GACsB,KAAsB;AAClD,IAAA,MAAM,aAAa,GAAG,eAAe,CAAC,MAAM,CAAC;IAC7C,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC7C,kBAAkB,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;QAClD,kBAAkB,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,KACjE,WAAW,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CACnC;AACF,KAAA,CAAC;IAEF,OAAO,oBAAoB,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AACrD;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { struct, string } from '@metaplex-foundation/umi/serializers';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates the serializer for one Token-2022 additional metadata entry.
|
|
5
|
+
*
|
|
6
|
+
* @returns A serializer for encoding and decoding additional metadata entries.
|
|
7
|
+
*/
|
|
8
|
+
function getAdditionalMetadataSerializer() {
|
|
9
|
+
return struct([
|
|
10
|
+
["label", string()],
|
|
11
|
+
["value", string()],
|
|
12
|
+
], { description: "AdditionalMetadata" });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { getAdditionalMetadataSerializer };
|
|
16
|
+
//# sourceMappingURL=additional-metadata.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"additional-metadata.mjs","sources":["../../../src/srs/additional-metadata.ts"],"sourcesContent":["import {\r\n Serializer,\r\n string,\r\n struct,\r\n} from \"@metaplex-foundation/umi/serializers\";\r\n\r\n/** Additional metadata for the Token-2022 Metadata Extension format. */\r\nexport type AdditionalMetadata = { label: string; value: string };\r\n\r\n/** Input fields accepted by the additional metadata serializer. */\r\nexport type AdditionalMetadataArgs = AdditionalMetadata;\r\n\r\n/**\r\n * Creates the serializer for one Token-2022 additional metadata entry.\r\n *\r\n * @returns A serializer for encoding and decoding additional metadata entries.\r\n */\r\nexport function getAdditionalMetadataSerializer(): Serializer<\r\n AdditionalMetadataArgs,\r\n AdditionalMetadata\r\n> {\r\n return struct<AdditionalMetadata>(\r\n [\r\n [\"label\", string()],\r\n [\"value\", string()],\r\n ],\r\n { description: \"AdditionalMetadata\" }\r\n ) as Serializer<AdditionalMetadataArgs, AdditionalMetadata>;\r\n}\r\n"],"names":[],"mappings":";;AAYA;;;;AAIG;SACa,+BAA+B,GAAA;AAI7C,IAAA,OAAO,MAAM,CACX;AACE,QAAA,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;AACnB,QAAA,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,KAAA,EACD,EAAE,WAAW,EAAE,oBAAoB,EAAE,CACoB;AAC7D;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { mapSerializer, struct, string, array } from '@metaplex-foundation/umi/serializers';
|
|
2
|
+
import { getAdditionalMetadataSerializer } from './additional-metadata.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Creates the serializer for the Token-2022 Metadata extension format used by
|
|
6
|
+
* SRS records.
|
|
7
|
+
*
|
|
8
|
+
* The serializer uses the same wire format as the JS SDK and defaults an
|
|
9
|
+
* omitted symbol to `"SRS"` when encoding metadata.
|
|
10
|
+
*
|
|
11
|
+
* @returns A serializer for encoding and decoding SRS metadata.
|
|
12
|
+
*/
|
|
13
|
+
function getMetadataSerializer() {
|
|
14
|
+
return mapSerializer(struct([
|
|
15
|
+
["name", string()],
|
|
16
|
+
["symbol", string()],
|
|
17
|
+
["uri", string()],
|
|
18
|
+
["additionalMetadata", array(getAdditionalMetadataSerializer())],
|
|
19
|
+
], { description: "Metadata" }), (value) => ({ ...value, symbol: value.symbol ?? "SRS" }));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { getMetadataSerializer };
|
|
23
|
+
//# sourceMappingURL=metadata.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.mjs","sources":["../../../src/srs/metadata.ts"],"sourcesContent":["import {\r\n Serializer,\r\n array,\r\n mapSerializer,\r\n string,\r\n struct,\r\n} from \"@metaplex-foundation/umi/serializers\";\r\n\r\nimport {\r\n AdditionalMetadata,\r\n AdditionalMetadataArgs,\r\n getAdditionalMetadataSerializer,\r\n} from \"./additional-metadata\";\r\n\r\n/** Token-2022 Metadata Extension-compatible metadata format. */\r\nexport type Metadata = {\r\n name: string;\r\n symbol: string;\r\n uri: string;\r\n additionalMetadata: Array<AdditionalMetadata>;\r\n};\r\n\r\n/** Input fields accepted by the Token-2022 metadata serializer. */\r\nexport type MetadataArgs = {\r\n name: string;\r\n symbol?: string;\r\n uri: string;\r\n additionalMetadata: Array<AdditionalMetadataArgs>;\r\n};\r\n\r\n/**\r\n * Creates the serializer for the Token-2022 Metadata extension format used by\r\n * SRS records.\r\n *\r\n * The serializer uses the same wire format as the JS SDK and defaults an\r\n * omitted symbol to `\"SRS\"` when encoding metadata.\r\n *\r\n * @returns A serializer for encoding and decoding SRS metadata.\r\n */\r\nexport function getMetadataSerializer(): Serializer<MetadataArgs, Metadata> {\r\n return mapSerializer<MetadataArgs, any, Metadata>(\r\n struct<Metadata>(\r\n [\r\n [\"name\", string()],\r\n [\"symbol\", string()],\r\n [\"uri\", string()],\r\n [\"additionalMetadata\", array(getAdditionalMetadataSerializer())],\r\n ],\r\n { description: \"Metadata\" }\r\n ),\r\n (value) => ({ ...value, symbol: value.symbol ?? \"SRS\" })\r\n ) as Serializer<MetadataArgs, Metadata>;\r\n}\r\n"],"names":[],"mappings":";;;AA8BA;;;;;;;;AAQG;SACa,qBAAqB,GAAA;IACnC,OAAO,aAAa,CAClB,MAAM,CACJ;AACE,QAAA,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;AAClB,QAAA,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;AACpB,QAAA,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;AACjB,QAAA,CAAC,oBAAoB,EAAE,KAAK,CAAC,+BAA+B,EAAE,CAAC,CAAC;KACjE,EACD,EAAE,WAAW,EAAE,UAAU,EAAE,CAC5B,EACD,CAAC,KAAK,MAAM,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,KAAK,EAAE,CAAC,CACnB;AACzC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nft.mjs","sources":["../../../src/states/nft.ts"],"sourcesContent":["import {\r\n Address,\r\n Base58EncodedBytes,\r\n GetAccountInfoApi,\r\n GetProgramAccountsApi,\r\n Rpc,\r\n fetchEncodedAccount,\r\n getProgramDerivedAddress,\r\n} from \"@solana/kit\";\r\nimport { deserialize } from \"borsh\";\r\n\r\nimport { addressCodec, base64Codec, utf8Codec } from \"../codecs\";\r\nimport { NAME_TOKENIZER_ADDRESS } from \"../constants/addresses\";\r\nimport { InvalidSerializedDataError, NftAccountNotFoundError } from \"../errors\";\r\n\r\n/** Tags identifying the SNS NFT state variant. */\r\nexport enum NftTag {\r\n Uninitialized = 0,\r\n CentralState = 1,\r\n ActiveRecord = 2,\r\n InactiveRecord = 3,\r\n}\r\n\r\n/**\r\n * Input for decoding an SNS NFT account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: NftStateParams = { tag: 2, nonce: 0, nameAccount, owner, nftMint };\r\n * ```\r\n */\r\nexport interface NftStateParams {\r\n /** NFT state tag. */\r\n tag: number;\r\n /** NFT record nonce. */\r\n nonce: number;\r\n /** Encoded SNS domain account address. */\r\n nameAccount: Uint8Array;\r\n /** Encoded NFT owner address. */\r\n owner: Uint8Array;\r\n /** Encoded NFT mint address. */\r\n nftMint: Uint8Array;\r\n}\r\n\r\n/** Decoded state of an SNS NFT account. */\r\nexport class NftState {\r\n /** NFT state tag. */\r\n tag: NftTag;\r\n /** NFT record nonce. */\r\n nonce: number;\r\n /** SNS domain account address. */\r\n nameAccount: Address;\r\n /** NFT owner address. */\r\n owner: Address;\r\n /** NFT mint address. */\r\n nftMint: Address;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n nonce: \"u8\",\r\n nameAccount: { array: { type: \"u8\", len: 32 } },\r\n owner: { array: { type: \"u8\", len: 32 } },\r\n nftMint: { array: { type: \"u8\", len: 32 } },\r\n },\r\n };\r\n\r\n // The total length of the struct is calculated as the sum of:\r\n // - `tag`: 1 byte (`u8`)\r\n // - `nonce`: 1 byte (`u8`)\r\n // - `nameAccount`: 32 bytes (array of `u8` with length 32)\r\n // - `owner`: 32 bytes (array of `u8` with length 32)\r\n // - `nftMint`: 32 bytes (array of `u8` with length 32)\r\n static LEN = 1 + 1 + 32 + 32 + 32;\r\n\r\n constructor(obj: NftStateParams) {\r\n this.tag = obj.tag as NftTag;\r\n this.nonce = obj.nonce;\r\n this.nameAccount = addressCodec.decode(obj.nameAccount);\r\n this.owner = addressCodec.decode(obj.owner);\r\n this.nftMint = addressCodec.decode(obj.nftMint);\r\n }\r\n\r\n static deserialize(data: Uint8Array): NftState {\r\n try {\r\n return new NftState(deserialize(this.schema, data) as any);\r\n } catch {\r\n throw new InvalidSerializedDataError(\r\n \"Failed to deserialize NftState data\"\r\n );\r\n }\r\n }\r\n\r\n static async retrieve(\r\n rpc: Rpc<GetAccountInfoApi>,\r\n address: Address\r\n ): Promise<NftState> {\r\n const nftAccount = await fetchEncodedAccount(rpc, address);\r\n if (!nftAccount.exists) {\r\n throw new NftAccountNotFoundError(`NFT not found: ${address}`);\r\n }\r\n return this.deserialize(nftAccount.data);\r\n }\r\n\r\n static async retrieveFromMint(\r\n rpc: Rpc<GetProgramAccountsApi>,\r\n mint: Address\r\n ): Promise<NftState> {\r\n const data = await rpc\r\n .getProgramAccounts(NAME_TOKENIZER_ADDRESS, {\r\n encoding: \"base64\",\r\n filters: [\r\n { dataSize: BigInt(NftState.LEN) },\r\n {\r\n memcmp: {\r\n offset: BigInt(0),\r\n bytes: \"3\" as Base58EncodedBytes,\r\n encoding: \"base58\",\r\n },\r\n },\r\n {\r\n memcmp: {\r\n offset: BigInt(1 + 1 + 32 + 32),\r\n bytes: mint as string as Base58EncodedBytes,\r\n encoding: \"base58\",\r\n },\r\n },\r\n ],\r\n })\r\n .send();\r\n\r\n if (data.length !== 1) {\r\n throw new NftAccountNotFoundError(`NFT not found: ${mint}`);\r\n }\r\n\r\n return this.deserialize(\r\n base64Codec.encode(data[0].account.data[0]) as Uint8Array\r\n );\r\n }\r\n\r\n static async getAddress(domainAddress: Address): Promise<Address> {\r\n const [address] = await getProgramDerivedAddress({\r\n programAddress: NAME_TOKENIZER_ADDRESS,\r\n seeds: [\r\n utf8Codec.encode(\"nft_record\"),\r\n addressCodec.encode(domainAddress),\r\n ],\r\n });\r\n\r\n return address;\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;AAeA;IACY;AAAZ,CAAA,UAAY,MAAM,EAAA;AAChB,IAAA,MAAA,CAAA,MAAA,CAAA,eAAA,CAAA,GAAA,CAAA,CAAA,GAAA,eAAiB;AACjB,IAAA,MAAA,CAAA,MAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAgB;AAChB,IAAA,MAAA,CAAA,MAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAgB;AAChB,IAAA,MAAA,CAAA,MAAA,CAAA,gBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,gBAAkB;AACpB,CAAC,EALW,MAAM,KAAN,MAAM,
|
|
1
|
+
{"version":3,"file":"nft.mjs","sources":["../../../src/states/nft.ts"],"sourcesContent":["import {\r\n Address,\r\n Base58EncodedBytes,\r\n GetAccountInfoApi,\r\n GetProgramAccountsApi,\r\n Rpc,\r\n fetchEncodedAccount,\r\n getProgramDerivedAddress,\r\n} from \"@solana/kit\";\r\nimport { deserialize } from \"borsh\";\r\n\r\nimport { addressCodec, base64Codec, utf8Codec } from \"../codecs\";\r\nimport { NAME_TOKENIZER_ADDRESS } from \"../constants/addresses\";\r\nimport { InvalidSerializedDataError, NftAccountNotFoundError } from \"../errors\";\r\n\r\n/** Tags identifying the SNS NFT state variant. */\r\nexport enum NftTag {\r\n Uninitialized = 0,\r\n CentralState = 1,\r\n ActiveRecord = 2,\r\n InactiveRecord = 3,\r\n}\r\n\r\n/**\r\n * Input for decoding an SNS NFT account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: NftStateParams = { tag: 2, nonce: 0, nameAccount, owner, nftMint };\r\n * ```\r\n */\r\nexport interface NftStateParams {\r\n /** NFT state tag. */\r\n tag: number;\r\n /** NFT record nonce. */\r\n nonce: number;\r\n /** Encoded SNS domain account address. */\r\n nameAccount: Uint8Array;\r\n /** Encoded NFT owner address. */\r\n owner: Uint8Array;\r\n /** Encoded NFT mint address. */\r\n nftMint: Uint8Array;\r\n}\r\n\r\n/** Decoded state of an SNS NFT account. */\r\nexport class NftState {\r\n /** NFT state tag. */\r\n tag: NftTag;\r\n /** NFT record nonce. */\r\n nonce: number;\r\n /** SNS domain account address. */\r\n nameAccount: Address;\r\n /** NFT owner address. */\r\n owner: Address;\r\n /** NFT mint address. */\r\n nftMint: Address;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n nonce: \"u8\",\r\n nameAccount: { array: { type: \"u8\", len: 32 } },\r\n owner: { array: { type: \"u8\", len: 32 } },\r\n nftMint: { array: { type: \"u8\", len: 32 } },\r\n },\r\n };\r\n\r\n // The total length of the struct is calculated as the sum of:\r\n // - `tag`: 1 byte (`u8`)\r\n // - `nonce`: 1 byte (`u8`)\r\n // - `nameAccount`: 32 bytes (array of `u8` with length 32)\r\n // - `owner`: 32 bytes (array of `u8` with length 32)\r\n // - `nftMint`: 32 bytes (array of `u8` with length 32)\r\n static LEN = 1 + 1 + 32 + 32 + 32;\r\n\r\n constructor(obj: NftStateParams) {\r\n this.tag = obj.tag as NftTag;\r\n this.nonce = obj.nonce;\r\n this.nameAccount = addressCodec.decode(obj.nameAccount);\r\n this.owner = addressCodec.decode(obj.owner);\r\n this.nftMint = addressCodec.decode(obj.nftMint);\r\n }\r\n\r\n static deserialize(data: Uint8Array): NftState {\r\n try {\r\n return new NftState(deserialize(this.schema, data) as any);\r\n } catch {\r\n throw new InvalidSerializedDataError(\r\n \"Failed to deserialize NftState data\"\r\n );\r\n }\r\n }\r\n\r\n static async retrieve(\r\n rpc: Rpc<GetAccountInfoApi>,\r\n address: Address\r\n ): Promise<NftState> {\r\n const nftAccount = await fetchEncodedAccount(rpc, address);\r\n if (!nftAccount.exists) {\r\n throw new NftAccountNotFoundError(`NFT not found: ${address}`);\r\n }\r\n return this.deserialize(nftAccount.data);\r\n }\r\n\r\n static async retrieveFromMint(\r\n rpc: Rpc<GetProgramAccountsApi>,\r\n mint: Address\r\n ): Promise<NftState> {\r\n const data = await rpc\r\n .getProgramAccounts(NAME_TOKENIZER_ADDRESS, {\r\n encoding: \"base64\",\r\n filters: [\r\n { dataSize: BigInt(NftState.LEN) },\r\n {\r\n memcmp: {\r\n offset: BigInt(0),\r\n bytes: \"3\" as Base58EncodedBytes,\r\n encoding: \"base58\",\r\n },\r\n },\r\n {\r\n memcmp: {\r\n offset: BigInt(1 + 1 + 32 + 32),\r\n bytes: mint as string as Base58EncodedBytes,\r\n encoding: \"base58\",\r\n },\r\n },\r\n ],\r\n })\r\n .send();\r\n\r\n if (data.length !== 1) {\r\n throw new NftAccountNotFoundError(`NFT not found: ${mint}`);\r\n }\r\n\r\n return this.deserialize(\r\n base64Codec.encode(data[0].account.data[0]) as Uint8Array\r\n );\r\n }\r\n\r\n static async getAddress(domainAddress: Address): Promise<Address> {\r\n const [address] = await getProgramDerivedAddress({\r\n programAddress: NAME_TOKENIZER_ADDRESS,\r\n seeds: [\r\n utf8Codec.encode(\"nft_record\"),\r\n addressCodec.encode(domainAddress),\r\n ],\r\n });\r\n\r\n return address;\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;AAeA;IACY;AAAZ,CAAA,UAAY,MAAM,EAAA;AAChB,IAAA,MAAA,CAAA,MAAA,CAAA,eAAA,CAAA,GAAA,CAAA,CAAA,GAAA,eAAiB;AACjB,IAAA,MAAA,CAAA,MAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAgB;AAChB,IAAA,MAAA,CAAA,MAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAgB;AAChB,IAAA,MAAA,CAAA,MAAA,CAAA,gBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,gBAAkB;AACpB,CAAC,EALW,MAAM,KAAN,MAAM,GAAA,EAAA,CAAA,CAAA;AA4BlB;MACa,QAAQ,CAAA;;AAEnB,IAAA,GAAG;;AAEH,IAAA,KAAK;;AAEL,IAAA,WAAW;;AAEX,IAAA,KAAK;;AAEL,IAAA,OAAO;IAEP,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,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AAE,sBAAsB;AACtC,YAAA,KAAK,EAAE;AACL,gBAAA,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC;AAC9B,gBAAA,YAAY,CAAC,MAAM,CAAC,aAAa,CAAC;AACnC,aAAA;AACF,SAAA,CAAC;AAEF,QAAA,OAAO,OAAO;IAChB;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primaryDomain.mjs","sources":["../../../src/states/primaryDomain.ts"],"sourcesContent":["import {\r\n Address,\r\n GetAccountInfoApi,\r\n GetMultipleAccountsApi,\r\n Rpc,\r\n fetchEncodedAccount,\r\n fetchEncodedAccounts,\r\n getProgramDerivedAddress,\r\n} from \"@solana/kit\";\r\nimport { deserialize } from \"borsh\";\r\n\r\nimport { addressCodec, utf8Codec } from \"../codecs\";\r\nimport {\r\n InvalidSerializedDataError,\r\n PrimaryDomainNotFoundError,\r\n} from \"../errors\";\r\n\r\n/**\r\n * Input for decoding an SNS primary-domain account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: PrimaryDomainStateParams = { tag: 0, nameAccount };\r\n * ```\r\n */\r\nexport interface PrimaryDomainStateParams {\r\n /** Account state tag. */\r\n tag: number;\r\n /** Encoded primary domain account address. */\r\n nameAccount: Uint8Array;\r\n}\r\n\r\n/** Decoded state of an SNS primary-domain account. */\r\nexport class PrimaryDomainState {\r\n /** Account state tag. */\r\n tag: number;\r\n /** Primary domain account address. */\r\n nameAccount: Address;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n nameAccount: { array: { type: \"u8\", len: 32 } },\r\n },\r\n };\r\n\r\n constructor(obj: PrimaryDomainStateParams) {\r\n this.tag = obj.tag;\r\n this.nameAccount = addressCodec.decode(obj.nameAccount);\r\n }\r\n\r\n static deserialize(data: Uint8Array): PrimaryDomainState {\r\n try {\r\n return new PrimaryDomainState(deserialize(this.schema, data) as any);\r\n } catch {\r\n throw new InvalidSerializedDataError(\r\n \"Failed to deserialize PrimaryDomainState data\"\r\n );\r\n }\r\n }\r\n\r\n static async retrieve(rpc: Rpc<GetAccountInfoApi>, address: Address) {\r\n const primaryDomainAccount = await fetchEncodedAccount(rpc, address);\r\n if (!primaryDomainAccount.exists) {\r\n throw new PrimaryDomainNotFoundError(\r\n \"The favourite account does not exist\"\r\n );\r\n }\r\n return this.deserialize(primaryDomainAccount.data);\r\n }\r\n\r\n static async _retrieveBatch(\r\n rpc: Rpc<GetMultipleAccountsApi>,\r\n primaryAddresses: Address[]\r\n ): Promise<(PrimaryDomainState | undefined)[]> {\r\n const domainAccounts = await fetchEncodedAccounts(rpc, primaryAddresses);\r\n\r\n return domainAccounts.map((account) =>\r\n account.exists ? this.deserialize(account.data) : undefined\r\n );\r\n }\r\n\r\n public static async retrieveBatch(\r\n rpc: Rpc<GetMultipleAccountsApi>,\r\n primaryAddresses: Address[]\r\n ): Promise<(PrimaryDomainState | undefined)[]> {\r\n const result: (PrimaryDomainState | undefined)[] = [];\r\n const addresses = [...primaryAddresses];\r\n while (addresses.length > 0) {\r\n result.push(\r\n ...(await this._retrieveBatch(rpc, addresses.splice(0, 100)))\r\n );\r\n }\r\n\r\n return result;\r\n }\r\n\r\n static async getAddress(programAddress: Address, walletAddress: Address) {\r\n const [address] = await getProgramDerivedAddress({\r\n programAddress,\r\n seeds: [\r\n utf8Codec.encode(\"favourite_domain\"),\r\n addressCodec.encode(walletAddress),\r\n ],\r\n });\r\n\r\n return address;\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;AAgCA;MACa,kBAAkB,CAAA;;AAE7B,IAAA,GAAG;;AAEH,IAAA,WAAW;IAEX,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,WAAW,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE;AAChD,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAA6B,EAAA;AACvC,QAAA,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG;QAClB,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC
|
|
1
|
+
{"version":3,"file":"primaryDomain.mjs","sources":["../../../src/states/primaryDomain.ts"],"sourcesContent":["import {\r\n Address,\r\n GetAccountInfoApi,\r\n GetMultipleAccountsApi,\r\n Rpc,\r\n fetchEncodedAccount,\r\n fetchEncodedAccounts,\r\n getProgramDerivedAddress,\r\n} from \"@solana/kit\";\r\nimport { deserialize } from \"borsh\";\r\n\r\nimport { addressCodec, utf8Codec } from \"../codecs\";\r\nimport {\r\n InvalidSerializedDataError,\r\n PrimaryDomainNotFoundError,\r\n} from \"../errors\";\r\n\r\n/**\r\n * Input for decoding an SNS primary-domain account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: PrimaryDomainStateParams = { tag: 0, nameAccount };\r\n * ```\r\n */\r\nexport interface PrimaryDomainStateParams {\r\n /** Account state tag. */\r\n tag: number;\r\n /** Encoded primary domain account address. */\r\n nameAccount: Uint8Array;\r\n}\r\n\r\n/** Decoded state of an SNS primary-domain account. */\r\nexport class PrimaryDomainState {\r\n /** Account state tag. */\r\n tag: number;\r\n /** Primary domain account address. */\r\n nameAccount: Address;\r\n\r\n static schema = {\r\n struct: {\r\n tag: \"u8\",\r\n nameAccount: { array: { type: \"u8\", len: 32 } },\r\n },\r\n };\r\n\r\n constructor(obj: PrimaryDomainStateParams) {\r\n this.tag = obj.tag;\r\n this.nameAccount = addressCodec.decode(obj.nameAccount);\r\n }\r\n\r\n static deserialize(data: Uint8Array): PrimaryDomainState {\r\n try {\r\n return new PrimaryDomainState(deserialize(this.schema, data) as any);\r\n } catch {\r\n throw new InvalidSerializedDataError(\r\n \"Failed to deserialize PrimaryDomainState data\"\r\n );\r\n }\r\n }\r\n\r\n static async retrieve(rpc: Rpc<GetAccountInfoApi>, address: Address) {\r\n const primaryDomainAccount = await fetchEncodedAccount(rpc, address);\r\n if (!primaryDomainAccount.exists) {\r\n throw new PrimaryDomainNotFoundError(\r\n \"The favourite account does not exist\"\r\n );\r\n }\r\n return this.deserialize(primaryDomainAccount.data);\r\n }\r\n\r\n static async _retrieveBatch(\r\n rpc: Rpc<GetMultipleAccountsApi>,\r\n primaryAddresses: Address[]\r\n ): Promise<(PrimaryDomainState | undefined)[]> {\r\n const domainAccounts = await fetchEncodedAccounts(rpc, primaryAddresses);\r\n\r\n return domainAccounts.map((account) =>\r\n account.exists ? this.deserialize(account.data) : undefined\r\n );\r\n }\r\n\r\n public static async retrieveBatch(\r\n rpc: Rpc<GetMultipleAccountsApi>,\r\n primaryAddresses: Address[]\r\n ): Promise<(PrimaryDomainState | undefined)[]> {\r\n const result: (PrimaryDomainState | undefined)[] = [];\r\n const addresses = [...primaryAddresses];\r\n while (addresses.length > 0) {\r\n result.push(\r\n ...(await this._retrieveBatch(rpc, addresses.splice(0, 100)))\r\n );\r\n }\r\n\r\n return result;\r\n }\r\n\r\n static async getAddress(programAddress: Address, walletAddress: Address) {\r\n const [address] = await getProgramDerivedAddress({\r\n programAddress,\r\n seeds: [\r\n utf8Codec.encode(\"favourite_domain\"),\r\n addressCodec.encode(walletAddress),\r\n ],\r\n });\r\n\r\n return address;\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;AAgCA;MACa,kBAAkB,CAAA;;AAE7B,IAAA,GAAG;;AAEH,IAAA,WAAW;IAEX,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,WAAW,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE;AAChD,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAA6B,EAAA;AACvC,QAAA,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG;QAClB,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CA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