@solana-name-service/sns-sdk-kit 1.0.1 → 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 +28 -15
- 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":"setRecordRoaVerifierInstruction.cjs","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":["addressCodec","serialize","AccountRole"],"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,GAAGA,mBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC
|
|
1
|
+
{"version":3,"file":"setRecordRoaVerifierInstruction.cjs","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":["addressCodec","serialize","AccountRole"],"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,GAAGA,mBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAChD;IAEA,SAAS,GAAA;QACP,OAAOC,eAAS,CAAC,+BAA+B,CAAC,MAAM,EAAE,IAAI,CAAC;IAChE;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,EAAEC,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,qBAAqB;gBAC9B,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,QAAQ;gBACjB,IAAI,EAAEA,eAAW,CAAC,eAAe;AAClC,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,MAAM;gBACf,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,MAAM;gBACf,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAEA,eAAW,CAAC,eAAe;AAClC,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,YAAY;gBACrB,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;SACF;QAED,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transferInstruction.cjs","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":["addressCodec","serialize","AccountRole","DEFAULT_ADDRESS"],"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,GAAGA,mBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC
|
|
1
|
+
{"version":3,"file":"transferInstruction.cjs","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":["addressCodec","serialize","AccountRole","DEFAULT_ADDRESS"],"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,GAAGA,mBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IACjE;IAEA,SAAS,GAAA;QACP,OAAOC,eAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC;IACpD;IAEA,cAAc,CACZ,cAAuB,EACvB,aAAsB,EACtB,YAAqB,EACrB,YAAsB,EACtB,aAAuB,EACvB,WAAqB,EAAA;AAErB,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE;AAE7B,QAAA,MAAM,QAAQ,GAAkB;AAC9B,YAAA;AACE,gBAAA,OAAO,EAAE,aAAa;gBACtB,IAAI,EAAEC,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;gBACE,OAAO,EAAE,WAAW,GAAG,WAAW,GAAG,YAAY;gBACjD,IAAI,EAAEA,eAAW,CAAC,eAAe;AAClC,aAAA;SACF;QAED,IAAI,YAAY,EAAE;YAChB,QAAQ,CAAC,IAAI,CAAC;AACZ,gBAAA,OAAO,EAAE,YAAY;gBACrB,IAAI,EAAEA,eAAW,CAAC,eAAe;AAClC,aAAA,CAAC;QACJ;AAEA,QAAA,IAAI,WAAW,IAAI,aAAa,EAAE;YAChC,IAAI,CAAC,YAAY,EAAE;gBACjB,QAAQ,CAAC,IAAI,CAAC;AACZ,oBAAA,OAAO,EAAEC,yBAAe;oBACxB,IAAI,EAAED,eAAW,CAAC,QAAQ;AAC3B,iBAAA,CAAC;YACJ;YAEA,QAAQ,CAAC,IAAI,CAAC;AACZ,gBAAA,OAAO,EAAE,aAAa;gBACtB,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA,CAAC;QACJ;QAEA,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateNameRegistryInstruction.cjs","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":["serialize","AccountRole"],"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.cjs","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":["serialize","AccountRole"],"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,OAAOA,eAAS,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,EAAEC,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,MAAM;gBACf,IAAI,EAAEA,eAAW,CAAC,eAAe;AAClC,aAAA;SACF;QAED,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateRecordInstruction.cjs","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":["serialize","AccountRole"],"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.cjs","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":["serialize","AccountRole"],"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,OAAOA,eAAS,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,EAAEC,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,qBAAqB;gBAC9B,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,QAAQ;gBACjB,IAAI,EAAEA,eAAW,CAAC,eAAe;AAClC,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,MAAM;gBACf,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,MAAM;gBACf,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAEA,eAAW,CAAC,eAAe;AAClC,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,YAAY;gBACrB,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;SACF;QAED,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateEthereumSignatureInstruction.cjs","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":["serialize","AccountRole"],"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.cjs","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":["serialize","AccountRole"],"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,OAAOA,eAAS,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,EAAEC,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,qBAAqB;gBAC9B,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,QAAQ;gBACjB,IAAI,EAAEA,eAAW,CAAC,eAAe;AAClC,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,MAAM;gBACf,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,MAAM;gBACf,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAEA,eAAW,CAAC,eAAe;AAClC,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,YAAY;gBACrB,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;SACF;QAED,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateSolanaSignatureInstruction.cjs","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":["serialize","AccountRole"],"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.cjs","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":["serialize","AccountRole"],"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;IAChC;IAEA,SAAS,GAAA;QACP,OAAOA,eAAS,CAAC,kCAAkC,CAAC,MAAM,EAAE,IAAI,CAAC;IACnE;AAEA,IAAA,cAAc,CACZ,cAAuB,EACvB,aAAsB,EACtB,qBAA8B,EAC9B,QAAiB,EACjB,MAAe,EACf,MAAe,EACf,WAAoB,EACpB,YAAqB,EACrB,QAAiB,EAAA;AAEjB,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE;AAE7B,QAAA,MAAM,QAAQ,GAAkB;AAC9B,YAAA;AACE,gBAAA,OAAO,EAAE,aAAa;gBACtB,IAAI,EAAEC,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,qBAAqB;gBAC9B,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,QAAQ;gBACjB,IAAI,EAAEA,eAAW,CAAC,eAAe;AAClC,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,MAAM;gBACf,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,MAAM;gBACf,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,YAAY;gBACrB,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,QAAQ;gBACjB,IAAI,EAAEA,eAAW,CAAC,eAAe;AAClC,aAAA;SACF;QAED,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;IACH;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSnsNftMint.cjs","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":["utf8Codec","getProgramDerivedAddress","NAME_TOKENIZER_ADDRESS","addressCodec"],"mappings":";;;;;;;;AAkBA,MAAM,WAAW,GAAGA,gBAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC;AAEtD;;;;;;;;;;;AAWG;
|
|
1
|
+
{"version":3,"file":"getSnsNftMint.cjs","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":["utf8Codec","getProgramDerivedAddress","NAME_TOKENIZER_ADDRESS","addressCodec"],"mappings":";;;;;;;;AAkBA,MAAM,WAAW,GAAGA,gBAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC;AAEtD;;;;;;;;;;;AAWG;AACI,MAAM,aAAa,GAAG,OAAO,EAAE,aAAa,EAAuB,KAAI;AAC5E,IAAA,MAAM,CAAC,IAAI,CAAC,GAAG,MAAMC,4BAAwB,CAAC;AAC5C,QAAA,cAAc,EAAEC,gCAAsB;QACtC,KAAK,EAAE,CAAC,WAAW,EAAEC,mBAAY,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;AACzD,KAAA,CAAC;AACF,IAAA,OAAO,IAAI;AACb;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSnsNftOwner.cjs","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":["getSnsNftMint","fetchEncodedAccount","tokenCodec","isSolanaError","SOLANA_ERROR__JSON_RPC__INVALID_PARAMS"],"mappings":";;;;;;;;AA4BA;;;;;;;;;;;;AAYG;AACI,MAAM,cAAc,GAAG,OAAO,EACnC,GAAG,EACH,aAAa,GACQ,KAA6B;AAClD,IAAA,IAAI;QACF,MAAM,IAAI,GAAG,MAAMA,2BAAa,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.cjs","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":["getSnsNftMint","fetchEncodedAccount","tokenCodec","isSolanaError","SOLANA_ERROR__JSON_RPC__INVALID_PARAMS"],"mappings":";;;;;;;;AA4BA;;;;;;;;;;;;AAYG;AACI,MAAM,cAAc,GAAG,OAAO,EACnC,GAAG,EACH,aAAa,GACQ,KAA6B;AAClD,IAAA,IAAI;QACF,MAAM,IAAI,GAAG,MAAMA,2BAAa,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,MAAMC,uBAAmB,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,GAAGC,iBAAU,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,IAAIC,iBAAa,CAAC,GAAG,EAAEC,0CAAsC,CAAC,EAAE;AAC9D,YAAA,OAAO,IAAI;QACb;AACA,QAAA,MAAM,GAAG;IACX;AACF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRecordV1Address.cjs","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":["record","getSnsDomainAddress","RecordVersion"],"mappings":";;;;;;;AAkBA;;;;;;;;;;;;;;AAcG;AACI,MAAM,kBAAkB,GAAG,OAAO,EACvC,MAAM,UACNA,QAAM,GACmB,KAAI;AAC7B,IAAA,MAAM,EAAE,aAAa,EAAE,GAAG,MAAMC,uCAAmB,CAAC;AAClD,QAAA,MAAM,EAAED,QAAM,GAAG,GAAG,GAAG,MAAM;QAC7B,MAAM,EAAEE,oBAAa,CAAC,EAAE;AACzB,KAAA,CAAC;AAEF,IAAA,OAAO,aAAa;AACtB
|
|
1
|
+
{"version":3,"file":"getRecordV1Address.cjs","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":["record","getSnsDomainAddress","RecordVersion"],"mappings":";;;;;;;AAkBA;;;;;;;;;;;;;;AAcG;AACI,MAAM,kBAAkB,GAAG,OAAO,EACvC,MAAM,UACNA,QAAM,GACmB,KAAI;AAC7B,IAAA,MAAM,EAAE,aAAa,EAAE,GAAG,MAAMC,uCAAmB,CAAC;AAClD,QAAA,MAAM,EAAED,QAAM,GAAG,GAAG,GAAG,MAAM;QAC7B,MAAM,EAAEE,oBAAa,CAAC,EAAE;AACzB,KAAA,CAAC;AAEF,IAAA,OAAO,aAAa;AACtB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRecordV2Address.cjs","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":["getSnsDomainAddress","_deriveAddress","CENTRAL_STATE_DOMAIN_RECORDS"],"mappings":";;;;;;;;AAsBA;;;;;;;;;;;;AAYG;AACI,MAAM,kBAAkB,GAAG,OAAO,EACvC,MAAM,EACN,MAAM,GACmB,KAAsB;IAC/C,MAAM,EAAE,aAAa,EAAE,GAAG,MAAMA,uCAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE/D,OAAO,MAAMC,4BAAc,CACzB,
|
|
1
|
+
{"version":3,"file":"getRecordV2Address.cjs","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":["getSnsDomainAddress","_deriveAddress","CENTRAL_STATE_DOMAIN_RECORDS"],"mappings":";;;;;;;;AAsBA;;;;;;;;;;;;AAYG;AACI,MAAM,kBAAkB,GAAG,OAAO,EACvC,MAAM,EACN,MAAM,GACmB,KAAsB;IAC/C,MAAM,EAAE,aAAa,EAAE,GAAG,MAAMA,uCAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE/D,OAAO,MAAMC,4BAAc,CACzB,CAAA,IAAA,EAAO,MAAM,CAAA,CAAE,EACf,aAAa,EACbC,sCAA4B,CAC7B;AACH;;"}
|
|
@@ -8,7 +8,7 @@ const errors = require('../errors.cjs');
|
|
|
8
8
|
const getRecordV2Address = require('./getRecordV2Address.cjs');
|
|
9
9
|
const record = require('../states/record.cjs');
|
|
10
10
|
const validation = require('../types/validation.cjs');
|
|
11
|
-
const
|
|
11
|
+
const parseSnsDomain = require('../utils/parseSnsDomain.cjs');
|
|
12
12
|
const uint8ArraysEqual = require('../utils/uint8Array/uint8ArraysEqual.cjs');
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -65,7 +65,7 @@ const _verifyRoaSync = ({ record, state, verifier, }) => {
|
|
|
65
65
|
* Verifies a record's Right of Association validation.
|
|
66
66
|
*
|
|
67
67
|
* @param rpc RPC client implementing account and token-largest-account APIs
|
|
68
|
-
* @param domain Full
|
|
68
|
+
* @param domain Full `.sns` domain name
|
|
69
69
|
* @param record Record type to verify
|
|
70
70
|
* @param verifier Optional verifier for the record. If omitted, a default verifier is derived
|
|
71
71
|
* @returns True if the association is valid, false otherwise.
|
|
@@ -77,7 +77,7 @@ const _verifyRoaSync = ({ record, state, verifier, }) => {
|
|
|
77
77
|
* ```
|
|
78
78
|
*/
|
|
79
79
|
const verifyRecordRightOfAssociation = async (rpc, domain, record$1, verifier) => {
|
|
80
|
-
const
|
|
80
|
+
const trimmedDomain = parseSnsDomain._parseSnsDomain(domain);
|
|
81
81
|
const address = await getRecordV2Address.getRecordV2Address({
|
|
82
82
|
domain: trimmedDomain,
|
|
83
83
|
record: record$1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyRecordRightOfAssociation.cjs","sources":["../../../src/record/verifyRecordRightOfAssociation.ts"],"sourcesContent":["import {\r\n GetAccountInfoApi,\r\n
|
|
1
|
+
{"version":3,"file":"verifyRecordRightOfAssociation.cjs","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":["SELF_SIGNED_RECORDS","GUARDIANS","addressCodec","validation","ETH_ROA_RECORDS","Validation","uint8ArraysEqual","record","_parseSnsDomain","getRecordV2Address","RecordState","MissingVerifierError"],"mappings":";;;;;;;;;;;;;AAqBA;;;;;;;;;;;;AAYG;AACI,MAAM,mBAAmB,GAAG,CAAC,EAClC,MAAM,EACN,KAAK,GAIN,KAAI;AACH,IAAA,IAAIA,2BAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;AACnC,QAAA,OAAO,KAAK,CAAC,UAAU,EAAE;IAC3B;SAAO;QACL,MAAM,QAAQ,GAAGC,iBAAS,CAAC,GAAG,CAAC,MAAM,CAAC;QACtC,IAAI,QAAQ,EAAE;AACZ,YAAA,OAAOC,mBAAY,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,MAAMC,YAAU,GAAGC,uBAAe,CAAC,GAAG,CAAC,MAAM;UACzCC,qBAAU,CAAC;AACb,UAAEA,qBAAU,CAAC,MAAM;AAErB,IAAA,QACEC,iCAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC;AACjC,QAAA,KAAK,CAAC,MAAM,CAAC,4BAA4B,KAAKH,YAAU;AAE5D;AAEA;;;;;;;;;;;;;;AAcG;AACI,MAAM,8BAA8B,GAAG,OAC5C,GAAwD,EACxD,MAAc,EACdI,QAAc,EACd,QAA6B,KAC3B;AACF,IAAA,MAAM,aAAa,GAAGC,8BAAe,CAAC,MAAM,CAAC;AAC7C,IAAA,MAAM,OAAO,GAAG,MAAMC,qCAAkB,CAAC;AACvC,QAAA,MAAM,EAAE,aAAa;gBACrBF,QAAM;AACP,KAAA,CAAC;IACF,MAAM,KAAK,GAAG,MAAMG,kBAAW,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IAEtD,QAAQ,GAAG,QAAQ,IAAI,mBAAmB,CAAC,UAAEH,QAAM,EAAE,KAAK,EAAE,CAAC;IAC7D,IAAI,CAAC,QAAQ,EAAE;AACb,QAAA,MAAM,IAAII,2BAAoB,CAAC,+BAA+B,CAAC;IACjE;IAEA,OAAO,cAAc,CAAC,UAAEJ,QAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACpD;;;;"}
|
|
@@ -7,7 +7,7 @@ const getSnsDomainOwner = require('../domain/getSnsDomainOwner.cjs');
|
|
|
7
7
|
const getRecordV2Address = require('./getRecordV2Address.cjs');
|
|
8
8
|
const record = require('../states/record.cjs');
|
|
9
9
|
const validation = require('../types/validation.cjs');
|
|
10
|
-
const
|
|
10
|
+
const parseSnsDomain = require('../utils/parseSnsDomain.cjs');
|
|
11
11
|
const uint8ArraysEqual = require('../utils/uint8Array/uint8ArraysEqual.cjs');
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -33,7 +33,7 @@ const _verifyStalenessSync = ({ domainOwner, state, }) => {
|
|
|
33
33
|
*
|
|
34
34
|
* @param params Staleness verification parameters
|
|
35
35
|
* @param params.rpc RPC client implementing account and token-largest-account APIs
|
|
36
|
-
* @param params.domain Full
|
|
36
|
+
* @param params.domain Full `.sns` domain name
|
|
37
37
|
* @param params.record Record type to verify
|
|
38
38
|
* @returns True if the record's staleness validation passes, false otherwise.
|
|
39
39
|
*
|
|
@@ -43,7 +43,7 @@ const _verifyStalenessSync = ({ domainOwner, state, }) => {
|
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
45
|
const verifyRecordStaleness = async ({ rpc, domain, record: record$1, }) => {
|
|
46
|
-
const
|
|
46
|
+
const trimmedDomain = parseSnsDomain._parseSnsDomain(domain);
|
|
47
47
|
const [domainOwner, state] = await Promise.all([
|
|
48
48
|
getSnsDomainOwner._getSnsDomainOwner({ rpc, domain: trimmedDomain }),
|
|
49
49
|
getRecordV2Address.getRecordV2Address({ domain: trimmedDomain, record: record$1 }).then((address) => record.RecordState.retrieve(rpc, address)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyRecordStaleness.cjs","sources":["../../../src/record/verifyRecordStaleness.ts"],"sourcesContent":["import {\r\n Address,\r\n GetAccountInfoApi,\r\n
|
|
1
|
+
{"version":3,"file":"verifyRecordStaleness.cjs","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":["uint8ArraysEqual","addressCodec","Validation","record","_parseSnsDomain","_getSnsDomainOwner","getRecordV2Address","RecordState"],"mappings":";;;;;;;;;;;;AAgBA;;;;;;;;;;;;AAYG;AACI,MAAM,oBAAoB,GAAG,CAAC,EACnC,WAAW,EACX,KAAK,GAIN,KAAI;AACH,IAAA,MAAM,WAAW,GAAG,KAAK,CAAC,cAAc,EAAE;IAE1C,QACEA,iCAAgB,CAACC,mBAAY,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;QAC/D,KAAK,CAAC,MAAM,CAAC,mBAAmB,KAAKC,qBAAU,CAAC,MAAM;AAE1D;AAuBA;;;;;;;;;;;;;AAaG;AACI,MAAM,qBAAqB,GAAG,OAAO,EAC1C,GAAG,EACH,MAAM,UACNC,QAAM,GACsB,KAAsB;AAClD,IAAA,MAAM,aAAa,GAAGC,8BAAe,CAAC,MAAM,CAAC;IAC7C,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC7CC,oCAAkB,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;QAClDC,qCAAkB,CAAC,EAAE,MAAM,EAAE,aAAa,UAAEH,QAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,KACjEI,kBAAW,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,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const serializers = require('@metaplex-foundation/umi/serializers');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Creates the serializer for one Token-2022 additional metadata entry.
|
|
9
|
+
*
|
|
10
|
+
* @returns A serializer for encoding and decoding additional metadata entries.
|
|
11
|
+
*/
|
|
12
|
+
function getAdditionalMetadataSerializer() {
|
|
13
|
+
return serializers.struct([
|
|
14
|
+
["label", serializers.string()],
|
|
15
|
+
["value", serializers.string()],
|
|
16
|
+
], { description: "AdditionalMetadata" });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.getAdditionalMetadataSerializer = getAdditionalMetadataSerializer;
|
|
20
|
+
//# sourceMappingURL=additional-metadata.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"additional-metadata.cjs","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":["struct","string"],"mappings":";;;;;;AAYA;;;;AAIG;SACa,+BAA+B,GAAA;AAI7C,IAAA,OAAOA,kBAAM,CACX;AACE,QAAA,CAAC,OAAO,EAAEC,kBAAM,EAAE,CAAC;AACnB,QAAA,CAAC,OAAO,EAAEA,kBAAM,EAAE,CAAC;AACpB,KAAA,EACD,EAAE,WAAW,EAAE,oBAAoB,EAAE,CACoB;AAC7D;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const serializers = require('@metaplex-foundation/umi/serializers');
|
|
6
|
+
const additionalMetadata = require('./additional-metadata.cjs');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Creates the serializer for the Token-2022 Metadata extension format used by
|
|
10
|
+
* SRS records.
|
|
11
|
+
*
|
|
12
|
+
* The serializer uses the same wire format as the JS SDK and defaults an
|
|
13
|
+
* omitted symbol to `"SRS"` when encoding metadata.
|
|
14
|
+
*
|
|
15
|
+
* @returns A serializer for encoding and decoding SRS metadata.
|
|
16
|
+
*/
|
|
17
|
+
function getMetadataSerializer() {
|
|
18
|
+
return serializers.mapSerializer(serializers.struct([
|
|
19
|
+
["name", serializers.string()],
|
|
20
|
+
["symbol", serializers.string()],
|
|
21
|
+
["uri", serializers.string()],
|
|
22
|
+
["additionalMetadata", serializers.array(additionalMetadata.getAdditionalMetadataSerializer())],
|
|
23
|
+
], { description: "Metadata" }), (value) => ({ ...value, symbol: value.symbol ?? "SRS" }));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.getMetadataSerializer = getMetadataSerializer;
|
|
27
|
+
//# sourceMappingURL=metadata.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.cjs","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":["mapSerializer","struct","string","array","getAdditionalMetadataSerializer"],"mappings":";;;;;;;AA8BA;;;;;;;;AAQG;SACa,qBAAqB,GAAA;IACnC,OAAOA,yBAAa,CAClBC,kBAAM,CACJ;AACE,QAAA,CAAC,MAAM,EAAEC,kBAAM,EAAE,CAAC;AAClB,QAAA,CAAC,QAAQ,EAAEA,kBAAM,EAAE,CAAC;AACpB,QAAA,CAAC,KAAK,EAAEA,kBAAM,EAAE,CAAC;AACjB,QAAA,CAAC,oBAAoB,EAAEC,iBAAK,CAACC,kDAA+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.cjs","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":["NftTag","addressCodec","deserialize","InvalidSerializedDataError","fetchEncodedAccount","NftAccountNotFoundError","NAME_TOKENIZER_ADDRESS","base64Codec","getProgramDerivedAddress","utf8Codec"],"mappings":";;;;;;;;;;AAeA;AACYA;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,EALWA,cAAM,KAANA,cAAM,
|
|
1
|
+
{"version":3,"file":"nft.cjs","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":["NftTag","addressCodec","deserialize","InvalidSerializedDataError","fetchEncodedAccount","NftAccountNotFoundError","NAME_TOKENIZER_ADDRESS","base64Codec","getProgramDerivedAddress","utf8Codec"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primaryDomain.cjs","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":["addressCodec","deserialize","InvalidSerializedDataError","fetchEncodedAccount","PrimaryDomainNotFoundError","fetchEncodedAccounts","getProgramDerivedAddress","utf8Codec"],"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,GAAGA,mBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC
|
|
1
|
+
{"version":3,"file":"primaryDomain.cjs","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":["addressCodec","deserialize","InvalidSerializedDataError","fetchEncodedAccount","PrimaryDomainNotFoundError","fetchEncodedAccounts","getProgramDerivedAddress","utf8Codec"],"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,GAAGA,mBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC;IACzD;IAEA,OAAO,WAAW,CAAC,IAAgB,EAAA;AACjC,QAAA,IAAI;AACF,YAAA,OAAO,IAAI,kBAAkB,CAACC,iBAAW,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAQ,CAAC;QACtE;AAAE,QAAA,MAAM;AACN,YAAA,MAAM,IAAIC,iCAA0B,CAClC,+CAA+C,CAChD;QACH;IACF;AAEA,IAAA,aAAa,QAAQ,CAAC,GAA2B,EAAE,OAAgB,EAAA;QACjE,MAAM,oBAAoB,GAAG,MAAMC,uBAAmB,CAAC,GAAG,EAAE,OAAO,CAAC;AACpE,QAAA,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE;AAChC,YAAA,MAAM,IAAIC,iCAA0B,CAClC,sCAAsC,CACvC;QACH;QACA,OAAO,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC;IACpD;AAEA,IAAA,aAAa,cAAc,CACzB,GAAgC,EAChC,gBAA2B,EAAA;QAE3B,MAAM,cAAc,GAAG,MAAMC,wBAAoB,CAAC,GAAG,EAAE,gBAAgB,CAAC;AAExE,QAAA,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,KAChC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAC5D;IACH;AAEO,IAAA,aAAa,aAAa,CAC/B,GAAgC,EAChC,gBAA2B,EAAA;QAE3B,MAAM,MAAM,GAAuC,EAAE;AACrD,QAAA,MAAM,SAAS,GAAG,CAAC,GAAG,gBAAgB,CAAC;AACvC,QAAA,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,MAAM,CAAC,IAAI,CACT,IAAI,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAC9D;QACH;AAEA,QAAA,OAAO,MAAM;IACf;AAEA,IAAA,aAAa,UAAU,CAAC,cAAuB,EAAE,aAAsB,EAAA;AACrE,QAAA,MAAM,CAAC,OAAO,CAAC,GAAG,MAAMC,4BAAwB,CAAC;YAC/C,cAAc;AACd,YAAA,KAAK,EAAE;AACL,gBAAAC,gBAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC;AACpC,gBAAAP,mBAAY,CAAC,MAAM,CAAC,aAAa,CAAC;AACnC,aAAA;AACF,SAAA,CAAC;AAEF,QAAA,OAAO,OAAO;IAChB;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.cjs","sources":["../../../src/states/record.ts"],"sourcesContent":["import {\r\n Address,\r\n GetAccountInfoApi,\r\n GetMultipleAccountsApi,\r\n Rpc,\r\n fetchEncodedAccount,\r\n fetchEncodedAccounts,\r\n} from \"@solana/kit\";\r\nimport { Schema, deserialize } from \"borsh\";\r\n\r\nimport {\r\n InvalidSerializedDataError,\r\n InvalidValidationError,\r\n NoRecordDataError,\r\n} from \"../errors\";\r\nimport { Validation } from \"../types/validation\";\r\n\r\n/** Byte length of the common SNS name-registry account header. */\r\nexport const NAME_REGISTRY_LEN = 96;\r\n\r\n/**\r\n * Returns the byte length of an identifier encoded for a validation mode.\r\n *\r\n * @example\r\n * ```ts\r\n * const length = getValidationLength(Validation.Solana);\r\n * ```\r\n */\r\nexport const getValidationLength = (validation: Validation) => {\r\n switch (validation) {\r\n case Validation.None:\r\n return 0;\r\n case Validation.Ethereum:\r\n return 20;\r\n case Validation.Solana:\r\n return 32;\r\n case Validation.UnverifiedSolana:\r\n return 32;\r\n default:\r\n throw new InvalidValidationError(\"Invalid validation enum\");\r\n }\r\n};\r\n\r\n/**\r\n * Input for decoding an SNS V2 record header.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: RecordHeaderStateParams = { stalenessValidation: 0, rightOfAssociationValidation: 0, contentLength: 0 };\r\n * ```\r\n */\r\nexport interface RecordHeaderStateParams {\r\n /** Staleness validation mode. */\r\n stalenessValidation: number;\r\n /** Right of Association validation mode. */\r\n rightOfAssociationValidation: number;\r\n /** Record content length in bytes. */\r\n contentLength: number;\r\n}\r\n\r\n/** Decoded header of an SNS V2 record account. */\r\nexport class RecordHeaderState {\r\n /** Staleness validation mode. */\r\n stalenessValidation: number;\r\n /** Right of Association validation mode. */\r\n rightOfAssociationValidation: number;\r\n /** Record content length in bytes. */\r\n contentLength: number;\r\n\r\n static schema: Schema = {\r\n struct: {\r\n stalenessValidation: \"u16\",\r\n rightOfAssociationValidation: \"u16\",\r\n contentLength: \"u32\",\r\n },\r\n };\r\n\r\n // The total length of the struct is calculated as the sum of:\r\n // - `stalenessValidation`: 2 bytes (`u16`)\r\n // - `rightOfAssociationValidation`: 2 bytes (`u16`)\r\n // - `contentLength`: 4 bytes (`u32`)\r\n static LEN = 8;\r\n\r\n constructor(obj: RecordHeaderStateParams) {\r\n this.stalenessValidation = obj.stalenessValidation;\r\n this.rightOfAssociationValidation = obj.rightOfAssociationValidation;\r\n this.contentLength = obj.contentLength;\r\n }\r\n\r\n static deserialize(data: Uint8Array): RecordHeaderState {\r\n return new RecordHeaderState(deserialize(this.schema, data, true) as any);\r\n }\r\n\r\n static async retrieve(\r\n rpc: Rpc<GetAccountInfoApi>,\r\n address: Address\r\n ): Promise<RecordHeaderState> {\r\n const recordAccount = await fetchEncodedAccount(rpc, address);\r\n\r\n if (!recordAccount.exists) {\r\n throw new NoRecordDataError(\"Record account not found\");\r\n }\r\n\r\n return this.deserialize(\r\n recordAccount.data.slice(NAME_REGISTRY_LEN, NAME_REGISTRY_LEN + this.LEN)\r\n );\r\n }\r\n}\r\n\r\n/** Decoded SNS V2 record account, including its validation data and content. */\r\nexport class RecordState {\r\n /** Decoded record header. */\r\n header: RecordHeaderState;\r\n /** Validation identifiers and record content. */\r\n data: Uint8Array;\r\n\r\n constructor(header: RecordHeaderState, data: Uint8Array) {\r\n this.data = data;\r\n this.header = header;\r\n }\r\n\r\n static deserialize(data: Uint8Array): RecordState {\r\n const offset = NAME_REGISTRY_LEN;\r\n const header = RecordHeaderState.deserialize(\r\n data.slice(offset, offset + RecordHeaderState.LEN)\r\n );\r\n\r\n return new RecordState(header, data.slice(offset + RecordHeaderState.LEN));\r\n }\r\n\r\n static async retrieve(\r\n rpc: Rpc<GetAccountInfoApi>,\r\n address: Address\r\n ): Promise<RecordState> {\r\n const recordAccount = await fetchEncodedAccount(rpc, address);\r\n if (!recordAccount.exists) {\r\n throw new NoRecordDataError(\"Record account not found\");\r\n }\r\n\r\n return this.deserialize(recordAccount.data);\r\n }\r\n\r\n static async retrieveBatch(\r\n rpc: Rpc<GetMultipleAccountsApi>,\r\n addresses: Address[]\r\n ): Promise<(RecordState | undefined)[]> {\r\n const recordAccounts = await fetchEncodedAccounts(rpc, addresses);\r\n\r\n return recordAccounts.map((account) =>\r\n account.exists ? this.deserialize(account.data) : undefined\r\n );\r\n }\r\n\r\n getContent(): Uint8Array {\r\n const startOffset =\r\n getValidationLength(this.header.stalenessValidation) +\r\n getValidationLength(this.header.rightOfAssociationValidation);\r\n const endOffset = startOffset + this.header.contentLength;\r\n if (endOffset > this.data.length) {\r\n throw new InvalidSerializedDataError(\r\n \"Record content length exceeds account data\"\r\n );\r\n }\r\n\r\n return this.data.slice(startOffset, endOffset);\r\n }\r\n\r\n getStalenessId(): Uint8Array {\r\n const endOffset = getValidationLength(this.header.stalenessValidation);\r\n\r\n return this.data.slice(0, endOffset);\r\n }\r\n\r\n getRoAId(): Uint8Array {\r\n const startOffset = getValidationLength(this.header.stalenessValidation);\r\n const endOffset =\r\n startOffset +\r\n getValidationLength(this.header.rightOfAssociationValidation);\r\n\r\n return this.data.slice(startOffset, endOffset);\r\n }\r\n}\r\n"],"names":["validation","Validation","InvalidValidationError","deserialize","fetchEncodedAccount","NoRecordDataError","fetchEncodedAccounts","InvalidSerializedDataError"],"mappings":";;;;;;;;;AAiBA;AACO,MAAM,iBAAiB,GAAG;AAEjC;;;;;;;AAOG;
|
|
1
|
+
{"version":3,"file":"record.cjs","sources":["../../../src/states/record.ts"],"sourcesContent":["import {\r\n Address,\r\n GetAccountInfoApi,\r\n GetMultipleAccountsApi,\r\n Rpc,\r\n fetchEncodedAccount,\r\n fetchEncodedAccounts,\r\n} from \"@solana/kit\";\r\nimport { Schema, deserialize } from \"borsh\";\r\n\r\nimport {\r\n InvalidSerializedDataError,\r\n InvalidValidationError,\r\n NoRecordDataError,\r\n} from \"../errors\";\r\nimport { Validation } from \"../types/validation\";\r\n\r\n/** Byte length of the common SNS name-registry account header. */\r\nexport const NAME_REGISTRY_LEN = 96;\r\n\r\n/**\r\n * Returns the byte length of an identifier encoded for a validation mode.\r\n *\r\n * @example\r\n * ```ts\r\n * const length = getValidationLength(Validation.Solana);\r\n * ```\r\n */\r\nexport const getValidationLength = (validation: Validation) => {\r\n switch (validation) {\r\n case Validation.None:\r\n return 0;\r\n case Validation.Ethereum:\r\n return 20;\r\n case Validation.Solana:\r\n return 32;\r\n case Validation.UnverifiedSolana:\r\n return 32;\r\n default:\r\n throw new InvalidValidationError(\"Invalid validation enum\");\r\n }\r\n};\r\n\r\n/**\r\n * Input for decoding an SNS V2 record header.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: RecordHeaderStateParams = { stalenessValidation: 0, rightOfAssociationValidation: 0, contentLength: 0 };\r\n * ```\r\n */\r\nexport interface RecordHeaderStateParams {\r\n /** Staleness validation mode. */\r\n stalenessValidation: number;\r\n /** Right of Association validation mode. */\r\n rightOfAssociationValidation: number;\r\n /** Record content length in bytes. */\r\n contentLength: number;\r\n}\r\n\r\n/** Decoded header of an SNS V2 record account. */\r\nexport class RecordHeaderState {\r\n /** Staleness validation mode. */\r\n stalenessValidation: number;\r\n /** Right of Association validation mode. */\r\n rightOfAssociationValidation: number;\r\n /** Record content length in bytes. */\r\n contentLength: number;\r\n\r\n static schema: Schema = {\r\n struct: {\r\n stalenessValidation: \"u16\",\r\n rightOfAssociationValidation: \"u16\",\r\n contentLength: \"u32\",\r\n },\r\n };\r\n\r\n // The total length of the struct is calculated as the sum of:\r\n // - `stalenessValidation`: 2 bytes (`u16`)\r\n // - `rightOfAssociationValidation`: 2 bytes (`u16`)\r\n // - `contentLength`: 4 bytes (`u32`)\r\n static LEN = 8;\r\n\r\n constructor(obj: RecordHeaderStateParams) {\r\n this.stalenessValidation = obj.stalenessValidation;\r\n this.rightOfAssociationValidation = obj.rightOfAssociationValidation;\r\n this.contentLength = obj.contentLength;\r\n }\r\n\r\n static deserialize(data: Uint8Array): RecordHeaderState {\r\n return new RecordHeaderState(deserialize(this.schema, data, true) as any);\r\n }\r\n\r\n static async retrieve(\r\n rpc: Rpc<GetAccountInfoApi>,\r\n address: Address\r\n ): Promise<RecordHeaderState> {\r\n const recordAccount = await fetchEncodedAccount(rpc, address);\r\n\r\n if (!recordAccount.exists) {\r\n throw new NoRecordDataError(\"Record account not found\");\r\n }\r\n\r\n return this.deserialize(\r\n recordAccount.data.slice(NAME_REGISTRY_LEN, NAME_REGISTRY_LEN + this.LEN)\r\n );\r\n }\r\n}\r\n\r\n/** Decoded SNS V2 record account, including its validation data and content. */\r\nexport class RecordState {\r\n /** Decoded record header. */\r\n header: RecordHeaderState;\r\n /** Validation identifiers and record content. */\r\n data: Uint8Array;\r\n\r\n constructor(header: RecordHeaderState, data: Uint8Array) {\r\n this.data = data;\r\n this.header = header;\r\n }\r\n\r\n static deserialize(data: Uint8Array): RecordState {\r\n const offset = NAME_REGISTRY_LEN;\r\n const header = RecordHeaderState.deserialize(\r\n data.slice(offset, offset + RecordHeaderState.LEN)\r\n );\r\n\r\n return new RecordState(header, data.slice(offset + RecordHeaderState.LEN));\r\n }\r\n\r\n static async retrieve(\r\n rpc: Rpc<GetAccountInfoApi>,\r\n address: Address\r\n ): Promise<RecordState> {\r\n const recordAccount = await fetchEncodedAccount(rpc, address);\r\n if (!recordAccount.exists) {\r\n throw new NoRecordDataError(\"Record account not found\");\r\n }\r\n\r\n return this.deserialize(recordAccount.data);\r\n }\r\n\r\n static async retrieveBatch(\r\n rpc: Rpc<GetMultipleAccountsApi>,\r\n addresses: Address[]\r\n ): Promise<(RecordState | undefined)[]> {\r\n const recordAccounts = await fetchEncodedAccounts(rpc, addresses);\r\n\r\n return recordAccounts.map((account) =>\r\n account.exists ? this.deserialize(account.data) : undefined\r\n );\r\n }\r\n\r\n getContent(): Uint8Array {\r\n const startOffset =\r\n getValidationLength(this.header.stalenessValidation) +\r\n getValidationLength(this.header.rightOfAssociationValidation);\r\n const endOffset = startOffset + this.header.contentLength;\r\n if (endOffset > this.data.length) {\r\n throw new InvalidSerializedDataError(\r\n \"Record content length exceeds account data\"\r\n );\r\n }\r\n\r\n return this.data.slice(startOffset, endOffset);\r\n }\r\n\r\n getStalenessId(): Uint8Array {\r\n const endOffset = getValidationLength(this.header.stalenessValidation);\r\n\r\n return this.data.slice(0, endOffset);\r\n }\r\n\r\n getRoAId(): Uint8Array {\r\n const startOffset = getValidationLength(this.header.stalenessValidation);\r\n const endOffset =\r\n startOffset +\r\n getValidationLength(this.header.rightOfAssociationValidation);\r\n\r\n return this.data.slice(startOffset, endOffset);\r\n }\r\n}\r\n"],"names":["validation","Validation","InvalidValidationError","deserialize","fetchEncodedAccount","NoRecordDataError","fetchEncodedAccounts","InvalidSerializedDataError"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.cjs","sources":["../../../src/states/registry.ts"],"sourcesContent":["import {\r\n Address,\r\n GetAccountInfoApi,\r\n GetMultipleAccountsApi,\r\n Rpc,\r\n fetchEncodedAccount,\r\n fetchEncodedAccounts,\r\n} from \"@solana/kit\";\r\nimport { deserialize } from \"borsh\";\r\n\r\nimport { addressCodec } from \"../codecs\";\r\nimport {\r\n AccountDoesNotExistError,\r\n InvalidSerializedDataError,\r\n} from \"../errors\";\r\n\r\n/**\r\n * Input for decoding an SNS name-registry account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: RegistryStateParams = { parentName, owner, class: classAddress };\r\n * ```\r\n */\r\nexport interface RegistryStateParams {\r\n /** Encoded parent registry address. */\r\n parentName: Uint8Array;\r\n /** Encoded registry owner address. */\r\n owner: Uint8Array;\r\n /** Encoded registry class address. */\r\n class: Uint8Array;\r\n}\r\n\r\n/** Decoded state of an SNS name-registry account. */\r\nexport class RegistryState {\r\n /** Parent registry address. */\r\n parentName: Address;\r\n /** Registry owner address. */\r\n owner: Address;\r\n /** Registry class address. */\r\n class: Address;\r\n /** Registry data after the fixed header. */\r\n data: Uint8Array | undefined;\r\n\r\n static schema = {\r\n struct: {\r\n parentName: { array: { type: \"u8\", len: 32 } },\r\n owner: { array: { type: \"u8\", len: 32 } },\r\n class: { array: { type: \"u8\", len: 32 } },\r\n },\r\n };\r\n\r\n // The total length is calculated as the sum of:\r\n // - `parentName`: 32 bytes (array of `u8` with length 32)\r\n // - `owner`: 32 bytes (array of `u8` with length 32)\r\n // - `class`: 32 bytes (array of `u8` with length 32)\r\n static HEADER_LEN = 96;\r\n\r\n constructor(obj: RegistryStateParams) {\r\n this.parentName = addressCodec.decode(obj.parentName);\r\n this.owner = addressCodec.decode(obj.owner);\r\n this.class = addressCodec.decode(obj.class);\r\n }\r\n\r\n static deserialize(data: Uint8Array): RegistryState {\r\n try {\r\n const res = new RegistryState(deserialize(this.schema, data) as any);\r\n res.data = data?.slice(this.HEADER_LEN);\r\n\r\n return res;\r\n } catch {\r\n throw new InvalidSerializedDataError(\r\n \"Failed to deserialize RegistryState 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<RegistryState> {\r\n const domainAccount = await fetchEncodedAccount(rpc, address);\r\n if (!domainAccount.exists) {\r\n throw new AccountDoesNotExistError(\"The domain account does not exist\");\r\n }\r\n\r\n return this.deserialize(domainAccount.data);\r\n }\r\n\r\n static async _retrieveBatch(\r\n rpc: Rpc<GetMultipleAccountsApi>,\r\n domainAddresses: Address[]\r\n ): Promise<(RegistryState | undefined)[]> {\r\n const domainAccounts = await fetchEncodedAccounts(rpc, domainAddresses);\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 domainAddresses: Address[]\r\n ): Promise<(RegistryState | undefined)[]> {\r\n const result: (RegistryState | undefined)[] = [];\r\n const addresses = [...domainAddresses];\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"],"names":["addressCodec","deserialize","InvalidSerializedDataError","fetchEncodedAccount","AccountDoesNotExistError","fetchEncodedAccounts"],"mappings":";;;;;;;;;AAiCA;MACa,aAAa,CAAA;;AAExB,IAAA,UAAU;;AAEV,IAAA,KAAK;;AAEL,IAAA,KAAK;;AAEL,IAAA,IAAI;IAEJ,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,UAAU,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE;AAC9C,YAAA,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE;AACzC,YAAA,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE;AAC1C,SAAA;KACF;;;;;AAMD,IAAA,OAAO,UAAU,GAAG,EAAE;AAEtB,IAAA,WAAA,CAAY,GAAwB,EAAA;QAClC,IAAI,CAAC,UAAU,GAAGA,mBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC;QACrD,IAAI,CAAC,KAAK,GAAGA,mBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;QAC3C,IAAI,CAAC,KAAK,GAAGA,mBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC
|
|
1
|
+
{"version":3,"file":"registry.cjs","sources":["../../../src/states/registry.ts"],"sourcesContent":["import {\r\n Address,\r\n GetAccountInfoApi,\r\n GetMultipleAccountsApi,\r\n Rpc,\r\n fetchEncodedAccount,\r\n fetchEncodedAccounts,\r\n} from \"@solana/kit\";\r\nimport { deserialize } from \"borsh\";\r\n\r\nimport { addressCodec } from \"../codecs\";\r\nimport {\r\n AccountDoesNotExistError,\r\n InvalidSerializedDataError,\r\n} from \"../errors\";\r\n\r\n/**\r\n * Input for decoding an SNS name-registry account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: RegistryStateParams = { parentName, owner, class: classAddress };\r\n * ```\r\n */\r\nexport interface RegistryStateParams {\r\n /** Encoded parent registry address. */\r\n parentName: Uint8Array;\r\n /** Encoded registry owner address. */\r\n owner: Uint8Array;\r\n /** Encoded registry class address. */\r\n class: Uint8Array;\r\n}\r\n\r\n/** Decoded state of an SNS name-registry account. */\r\nexport class RegistryState {\r\n /** Parent registry address. */\r\n parentName: Address;\r\n /** Registry owner address. */\r\n owner: Address;\r\n /** Registry class address. */\r\n class: Address;\r\n /** Registry data after the fixed header. */\r\n data: Uint8Array | undefined;\r\n\r\n static schema = {\r\n struct: {\r\n parentName: { array: { type: \"u8\", len: 32 } },\r\n owner: { array: { type: \"u8\", len: 32 } },\r\n class: { array: { type: \"u8\", len: 32 } },\r\n },\r\n };\r\n\r\n // The total length is calculated as the sum of:\r\n // - `parentName`: 32 bytes (array of `u8` with length 32)\r\n // - `owner`: 32 bytes (array of `u8` with length 32)\r\n // - `class`: 32 bytes (array of `u8` with length 32)\r\n static HEADER_LEN = 96;\r\n\r\n constructor(obj: RegistryStateParams) {\r\n this.parentName = addressCodec.decode(obj.parentName);\r\n this.owner = addressCodec.decode(obj.owner);\r\n this.class = addressCodec.decode(obj.class);\r\n }\r\n\r\n static deserialize(data: Uint8Array): RegistryState {\r\n try {\r\n const res = new RegistryState(deserialize(this.schema, data) as any);\r\n res.data = data?.slice(this.HEADER_LEN);\r\n\r\n return res;\r\n } catch {\r\n throw new InvalidSerializedDataError(\r\n \"Failed to deserialize RegistryState 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<RegistryState> {\r\n const domainAccount = await fetchEncodedAccount(rpc, address);\r\n if (!domainAccount.exists) {\r\n throw new AccountDoesNotExistError(\"The domain account does not exist\");\r\n }\r\n\r\n return this.deserialize(domainAccount.data);\r\n }\r\n\r\n static async _retrieveBatch(\r\n rpc: Rpc<GetMultipleAccountsApi>,\r\n domainAddresses: Address[]\r\n ): Promise<(RegistryState | undefined)[]> {\r\n const domainAccounts = await fetchEncodedAccounts(rpc, domainAddresses);\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 domainAddresses: Address[]\r\n ): Promise<(RegistryState | undefined)[]> {\r\n const result: (RegistryState | undefined)[] = [];\r\n const addresses = [...domainAddresses];\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"],"names":["addressCodec","deserialize","InvalidSerializedDataError","fetchEncodedAccount","AccountDoesNotExistError","fetchEncodedAccounts"],"mappings":";;;;;;;;;AAiCA;MACa,aAAa,CAAA;;AAExB,IAAA,UAAU;;AAEV,IAAA,KAAK;;AAEL,IAAA,KAAK;;AAEL,IAAA,IAAI;IAEJ,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,UAAU,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE;AAC9C,YAAA,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE;AACzC,YAAA,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE;AAC1C,SAAA;KACF;;;;;AAMD,IAAA,OAAO,UAAU,GAAG,EAAE;AAEtB,IAAA,WAAA,CAAY,GAAwB,EAAA;QAClC,IAAI,CAAC,UAAU,GAAGA,mBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC;QACrD,IAAI,CAAC,KAAK,GAAGA,mBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;QAC3C,IAAI,CAAC,KAAK,GAAGA,mBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;IAC7C;IAEA,OAAO,WAAW,CAAC,IAAgB,EAAA;AACjC,QAAA,IAAI;AACF,YAAA,MAAM,GAAG,GAAG,IAAI,aAAa,CAACC,iBAAW,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAQ,CAAC;YACpE,GAAG,CAAC,IAAI,GAAG,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;AAEvC,YAAA,OAAO,GAAG;QACZ;AAAE,QAAA,MAAM;AACN,YAAA,MAAM,IAAIC,iCAA0B,CAClC,0CAA0C,CAC3C;QACH;IACF;AAEA,IAAA,aAAa,QAAQ,CACnB,GAA2B,EAC3B,OAAgB,EAAA;QAEhB,MAAM,aAAa,GAAG,MAAMC,uBAAmB,CAAC,GAAG,EAAE,OAAO,CAAC;AAC7D,QAAA,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;AACzB,YAAA,MAAM,IAAIC,+BAAwB,CAAC,mCAAmC,CAAC;QACzE;QAEA,OAAO,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC;IAC7C;AAEA,IAAA,aAAa,cAAc,CACzB,GAAgC,EAChC,eAA0B,EAAA;QAE1B,MAAM,cAAc,GAAG,MAAMC,wBAAoB,CAAC,GAAG,EAAE,eAAe,CAAC;AAEvE,QAAA,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,KAChC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAC5D;IACH;AAEO,IAAA,aAAa,aAAa,CAC/B,GAAgC,EAChC,eAA0B,EAAA;QAE1B,MAAM,MAAM,GAAkC,EAAE;AAChD,QAAA,MAAM,SAAS,GAAG,CAAC,GAAG,eAAe,CAAC;AACtC,QAAA,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,MAAM,CAAC,IAAI,CACT,IAAI,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAC9D;QACH;AAEA,QAAA,OAAO,MAAM;IACf;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.cjs","sources":["../../../src/types/record.ts"],"sourcesContent":["/**\r\n * Supported SNS record identifiers.\r\n */\r\nexport enum Record {\r\n IPFS = \"IPFS\",\r\n ARWV = \"ARWV\",\r\n SOL = \"SOL\",\r\n ETH = \"ETH\",\r\n BTC = \"BTC\",\r\n LTC = \"LTC\",\r\n DOGE = \"DOGE\",\r\n Email = \"email\",\r\n Url = \"url\",\r\n Discord = \"discord\",\r\n Github = \"github\",\r\n Reddit = \"reddit\",\r\n Twitter = \"twitter\",\r\n Telegram = \"telegram\",\r\n Pic = \"pic\",\r\n SHDW = \"SHDW\",\r\n POINT = \"POINT\",\r\n BSC = \"BSC\",\r\n Injective = \"INJ\",\r\n Backpack = \"backpack\",\r\n A = \"A\",\r\n AAAA = \"AAAA\",\r\n CNAME = \"CNAME\",\r\n TXT = \"TXT\",\r\n Background = \"background\",\r\n BASE = \"BASE\",\r\n IPNS = \"IPNS\",\r\n Bio = \"bio\",\r\n}\r\n\r\n/** Fixed content sizes, in bytes, for V1 record types. */\r\nexport const RECORD_V1_SIZE: Map<Record, number> = new Map([\r\n [Record.SOL, 96],\r\n [Record.ETH, 20],\r\n [Record.BSC, 20],\r\n [Record.Injective, 20],\r\n [Record.A, 4],\r\n [Record.AAAA, 16],\r\n [Record.Background, 32],\r\n]);\r\n\r\n/** Versions of the SNS record account layout. */\r\nexport enum RecordVersion {\r\n V1 = 1,\r\n V2 = 2,\r\n}\r\n"],"names":["Record","RecordVersion"],"mappings":";;;;AAAA;;AAEG;AACSA;AAAZ,CAAA,UAAY,MAAM,EAAA;AAChB,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,MAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,MAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,MAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,MAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,WAAA,CAAA,GAAA,KAAiB;AACjB,IAAA,MAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,MAAA,CAAA,GAAA,CAAA,GAAA,GAAO;AACP,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACb,CAAC,EA7BWA,cAAM,KAANA,cAAM,
|
|
1
|
+
{"version":3,"file":"record.cjs","sources":["../../../src/types/record.ts"],"sourcesContent":["/**\r\n * Supported SNS record identifiers.\r\n */\r\nexport enum Record {\r\n IPFS = \"IPFS\",\r\n ARWV = \"ARWV\",\r\n SOL = \"SOL\",\r\n ETH = \"ETH\",\r\n BTC = \"BTC\",\r\n LTC = \"LTC\",\r\n DOGE = \"DOGE\",\r\n Email = \"email\",\r\n Url = \"url\",\r\n Discord = \"discord\",\r\n Github = \"github\",\r\n Reddit = \"reddit\",\r\n Twitter = \"twitter\",\r\n Telegram = \"telegram\",\r\n Pic = \"pic\",\r\n SHDW = \"SHDW\",\r\n POINT = \"POINT\",\r\n BSC = \"BSC\",\r\n Injective = \"INJ\",\r\n Backpack = \"backpack\",\r\n A = \"A\",\r\n AAAA = \"AAAA\",\r\n CNAME = \"CNAME\",\r\n TXT = \"TXT\",\r\n Background = \"background\",\r\n BASE = \"BASE\",\r\n IPNS = \"IPNS\",\r\n Bio = \"bio\",\r\n}\r\n\r\n/** Fixed content sizes, in bytes, for V1 record types. */\r\nexport const RECORD_V1_SIZE: Map<Record, number> = new Map([\r\n [Record.SOL, 96],\r\n [Record.ETH, 20],\r\n [Record.BSC, 20],\r\n [Record.Injective, 20],\r\n [Record.A, 4],\r\n [Record.AAAA, 16],\r\n [Record.Background, 32],\r\n]);\r\n\r\n/** Versions of the SNS record account layout. */\r\nexport enum RecordVersion {\r\n V1 = 1,\r\n V2 = 2,\r\n}\r\n"],"names":["Record","RecordVersion"],"mappings":";;;;AAAA;;AAEG;AACSA;AAAZ,CAAA,UAAY,MAAM,EAAA;AAChB,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,MAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,MAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,MAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,MAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,WAAA,CAAA,GAAA,KAAiB;AACjB,IAAA,MAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,MAAA,CAAA,GAAA,CAAA,GAAA,GAAO;AACP,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACb,CAAC,EA7BWA,cAAM,KAANA,cAAM,GAAA,EAAA,CAAA,CAAA;AA+BlB;AACO,MAAM,cAAc,GAAwB,IAAI,GAAG,CAAC;AACzD,IAAA,CAACA,cAAM,CAAC,GAAG,EAAE,EAAE,CAAC;AAChB,IAAA,CAACA,cAAM,CAAC,GAAG,EAAE,EAAE,CAAC;AAChB,IAAA,CAACA,cAAM,CAAC,GAAG,EAAE,EAAE,CAAC;AAChB,IAAA,CAACA,cAAM,CAAC,SAAS,EAAE,EAAE,CAAC;AACtB,IAAA,CAACA,cAAM,CAAC,CAAC,EAAE,CAAC,CAAC;AACb,IAAA,CAACA,cAAM,CAAC,IAAI,EAAE,EAAE,CAAC;AACjB,IAAA,CAACA,cAAM,CAAC,UAAU,EAAE,EAAE,CAAC;AACxB,CAAA;AAED;AACYC;AAAZ,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,aAAA,CAAA,IAAA,CAAA,GAAA,CAAA,CAAA,GAAA,IAAM;AACN,IAAA,aAAA,CAAA,aAAA,CAAA,IAAA,CAAA,GAAA,CAAA,CAAA,GAAA,IAAM;AACR,CAAC,EAHWA,qBAAa,KAAbA,qBAAa,GAAA,EAAA,CAAA,CAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.cjs","sources":["../../../src/types/validation.ts"],"sourcesContent":["/** Validation modes encoded in an SNS record header. */\r\nexport enum Validation {\r\n None = 0,\r\n Solana = 1,\r\n Ethereum = 2,\r\n UnverifiedSolana = 3,\r\n}\r\n"],"names":["Validation"],"mappings":";;;;AAAA;AACYA;AAAZ,CAAA,UAAY,UAAU,EAAA;AACpB,IAAA,UAAA,CAAA,UAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ;AACR,IAAA,UAAA,CAAA,UAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAU;AACV,IAAA,UAAA,CAAA,UAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAY;AACZ,IAAA,UAAA,CAAA,UAAA,CAAA,kBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,kBAAoB;AACtB,CAAC,EALWA,kBAAU,KAAVA,kBAAU,
|
|
1
|
+
{"version":3,"file":"validation.cjs","sources":["../../../src/types/validation.ts"],"sourcesContent":["/** Validation modes encoded in an SNS record header. */\r\nexport enum Validation {\r\n None = 0,\r\n Solana = 1,\r\n Ethereum = 2,\r\n UnverifiedSolana = 3,\r\n}\r\n"],"names":["Validation"],"mappings":";;;;AAAA;AACYA;AAAZ,CAAA,UAAY,UAAU,EAAA;AACpB,IAAA,UAAA,CAAA,UAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ;AACR,IAAA,UAAA,CAAA,UAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAU;AACV,IAAA,UAAA,CAAA,UAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAY;AACZ,IAAA,UAAA,CAAA,UAAA,CAAA,kBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,kBAAoB;AACtB,CAAC,EALWA,kBAAU,KAAVA,kBAAU,GAAA,EAAA,CAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.cjs","sources":["../../../src/utils/check.ts"],"sourcesContent":["import { SNSError } from \"../errors\";\r\n\r\n/**\r\n * Internal assertion helper that throws the provided error when a condition is false.\r\n *\r\n * @template T Type of error to throw\r\n * @param bool Boolean condition to check\r\n * @param error Error to throw when the condition is false\r\n * @throws The provided error if the condition is false.\r\n */\r\n/** Implementation helper that throws `error` when a validation condition fails. */\r\nexport const _check = <T extends SNSError>(bool: boolean, error: T) => {\r\n if (!bool) {\r\n throw error;\r\n }\r\n};\r\n"],"names":[],"mappings":";;;;AAEA;;;;;;;AAOG;AACH;MACa,MAAM,GAAG,CAAqB,IAAa,EAAE,KAAQ,KAAI;IACpE,IAAI,CAAC,IAAI,EAAE;AACT,QAAA,MAAM,KAAK;;
|
|
1
|
+
{"version":3,"file":"check.cjs","sources":["../../../src/utils/check.ts"],"sourcesContent":["import { SNSError } from \"../errors\";\r\n\r\n/**\r\n * Internal assertion helper that throws the provided error when a condition is false.\r\n *\r\n * @template T Type of error to throw\r\n * @param bool Boolean condition to check\r\n * @param error Error to throw when the condition is false\r\n * @throws The provided error if the condition is false.\r\n */\r\n/** Implementation helper that throws `error` when a validation condition fails. */\r\nexport const _check = <T extends SNSError>(bool: boolean, error: T) => {\r\n if (!bool) {\r\n throw error;\r\n }\r\n};\r\n"],"names":[],"mappings":";;;;AAEA;;;;;;;AAOG;AACH;MACa,MAAM,GAAG,CAAqB,IAAa,EAAE,KAAQ,KAAI;IACpE,IAAI,CAAC,IAAI,EAAE;AACT,QAAA,MAAM,KAAK;IACb;AACF;;"}
|