Cardinal
Search…
Javascript SDK Reference

@cardinal/namespaces

Table of contents

Type aliases

Variables

Functions

Type aliases

AccountData

Ƭ AccountData<T>: Object
Type parameters
Name
T
Type declaration
Name
Type
parsed
T
pubkey
web3.PublicKey
Defined in

ClaimRequestData

Ƭ ClaimRequestData: TypeDef<Namespaces["accounts"][2], IdlTypes<Namespaces>>
Defined in

EntryData

Ƭ EntryData: TypeDef<Namespaces["accounts"][3], IdlTypes<Namespaces>>
Defined in

GlobalContextData

Ƭ GlobalContextData: TypeDef<Namespaces["accounts"][0], IdlTypes<Namespaces>>
Defined in

NamespaceData

Ƭ NamespaceData: TypeDef<Namespaces["accounts"][1], IdlTypes<Namespaces>>
Defined in

Namespaces

Ƭ Namespaces: Object
Type declaration
Name
Type
accounts
[{ name: "globalContext" ; type: { fields: [{ name: "bump" ; type: "u8" }, { name: "updateAuthority" ; type: "publicKey" }, { name: "rentAuthority" ; type: "publicKey" }, { name: "rentPercentage" ; type: "u64" }] ; kind: "struct" } }, { name: "namespace" ; type: { fields: [{ name: "bump" ; type: "u8" }, { name: "name" ; type: "string" }, { name: "updateAuthority" ; type: "publicKey" }, { name: "rentAuthority" ; type: "publicKey" }, { name: "approveAuthority" ; type: { option: "publicKey" } }, { name: "schema" ; type: "u8" }, { name: "paymentAmountDaily" ; type: "u64" }, { name: "paymentMint" ; type: "publicKey" }, { name: "minRentalSeconds" ; type: "i64" }, { name: "maxRentalSeconds" ; type: { option: "i64" } }, { name: "transferableEntries" ; type: "bool" }] ; kind: "struct" } }, { name: "claimRequest" ; type: { fields: [{ name: "bump" ; type: "u8" }, { name: "requestor" ; type: "publicKey" }, { name: "isApproved" ; type: "bool" }, { name: "namespace" ; type: "publicKey" }, { name: "entryName" ; type: "string" }] ; kind: "struct" } }, { name: "entry" ; type: { fields: [{ name: "bump" ; type: "u8" }, { name: "namespace" ; type: "publicKey" }, { name: "name" ; type: "string" }, { name: "data" ; type: { option: "publicKey" } }, { name: "reverseEntry" ; type: { option: "publicKey" } }, { name: "mint" ; type: "publicKey" }, { name: "isClaimed" ; type: "bool" }] ; kind: "struct" } }, { name: "reverseEntry" ; type: { fields: [{ name: "bump" ; type: "u8" }, { name: "entryName" ; type: "string" }, { name: "namespaceName" ; type: "string" }] ; kind: "struct" } }]
errors
[{ code: 300 ; msg: "Owner mint is invalid" ; name: "InvalidOwnerMint" }, { code: 301 ; msg: "Entry has not expired" ; name: "EntryNotExpired" }, { code: 302 ; msg: "Rental duration too small try adding more funds" ; name: "RentalDurationTooSmall" }, { code: 303 ; msg: "Rental duration too large try adding less funds" ; name: "RentalDurationTooLarge" }, { code: 304 ; msg: "Namespace requires duration" ; name: "NamespaceRequiresDuration" }, { code: 305 ; msg: "Authority is invalid" ; name: "InvalidAuthority" }, { code: 306 ; msg: "Invalid authorty token account" ; name: "InvalidAuthorityTokenAccount" }, { code: 307 ; msg: "Invalid namespace payment account" ; name: "InvalidNamespacePaymentAccount" }, { code: 308 ; msg: "Invalid global namespace payment account" ; name: "InvalidGlobalNamespacePaymentAccount" }, { code: 309 ; msg: "Invalid namespace" ; name: "InvalidNamespace" }, { code: 310 ; msg: "Invalid entry" ; name: "InvalidEntry" }, { code: 311 ; msg: "Invalid certificate" ; name: "InvalidCertificate" }, { code: 312 ; msg: "Invalid payment mint" ; name: "InvalidPaymentMint" }, { code: 313 ; msg: "Invalid reverse entry" ; name: "InvalidReverseEntry" }, { code: 314 ; msg: "Claim not allowed" ; name: "ClaimNotAllowed" }, { code: 315 ; msg: "Invalid approve authority" ; name: "InvalidApproveAuthority" }, { code: 316 ; msg: "Namespace requires token" ; name: "NamespaceRequiresToken" }]
instructions
[{ accounts: [{ isMut: true ; isSigner: false ; name: "globalContext" }, { isMut: false ; isSigner: true ; name: "authority" }, { isMut: false ; isSigner: true ; name: "payer" }, { isMut: false ; isSigner: false ; name: "systemProgram" }] ; args: [{ name: "ix" ; type: { defined: "InitializeGlobalNamespaceIx" } }] ; name: "init" }, { accounts: [{ isMut: true ; isSigner: false ; name: "globalContext" }, { isMut: false ; isSigner: true ; name: "updateAuthority" }, { isMut: false ; isSigner: true ; name: "payer" }, { isMut: false ; isSigner: false ; name: "systemProgram" }] ; args: [{ name: "rentPercentage" ; type: "u64" }] ; name: "setRentPercentage" }, { accounts: [{ isMut: true ; isSigner: false ; name: "globalContext" }, { isMut: false ; isSigner: true ; name: "updateAuthority" }, { isMut: false ; isSigner: true ; name: "payer" }, { isMut: false ; isSigner: false ; name: "systemProgram" }] ; args: [{ name: "updateAuthority" ; type: "publicKey" }] ; name: "transferGlobalUpdateAuthority" }, { accounts: [{ isMut: true ; isSigner: false ; name: "globalContext" }, { isMut: false ; isSigner: true ; name: "rentAuthority" }, { isMut: false ; isSigner: true ; name: "payer" }, { isMut: false ; isSigner: false ; name: "systemProgram" }] ; args: [{ name: "rentAuthority" ; type: "publicKey" }] ; name: "transferGlobalRentAuthority" }, { accounts: [{ isMut: true ; isSigner: false ; name: "namespace" }, { isMut: false ; isSigner: false ; name: "authority" }, { isMut: false ; isSigner: true ; name: "payer" }, { isMut: false ; isSigner: false ; name: "systemProgram" }] ; args: [{ name: "ix" ; type: { defined: "CreateNamespaceIx" } }] ; name: "createNamespace" }, { accounts: [{ isMut: true ; isSigner: false ; name: "namespace" }, { isMut: false ; isSigner: true ; name: "updateAuthority" }] ; args: [{ name: "ix" ; type: { defined: "UpdateNamespaceIx" } }] ; name: "updateNamespace" }, { accounts: [{ isMut: false ; isSigner: false ; name: "globalContext" }, { isMut: true ; isSigner: false ; name: "globalNamespacePaymentAccount" }, { isMut: false ; isSigner: false ; name: "namespace" }, { isMut: true ; isSigner: false ; name: "namespacePaymentAccount" }, { isMut: false ; isSigner: true ; name: "rentAuthority" }, { isMut: true ; isSigner: false ; name: "rentAuthorityTokenAccount" }, { isMut: false ; isSigner: false ; name: "tokenProgram" }] ; args: [{ name: "amount" ; type: "u64" }] ; name: "collectNamespaceFunds" }, { accounts: [{ isMut: false ; isSigner: false ; name: "globalContext" }, { isMut: true ; isSigner: false ; name: "globalNamespacePaymentAccount" }, { isMut: false ; isSigner: true ; name: "rentAuthority" }, { isMut: true ; isSigner: false ; name: "authorityTokenAccount" }, { isMut: false ; isSigner: false ; name: "tokenProgram" }] ; args: [{ name: "amount" ; type: "u64" }] ; name: "collectGlobalFunds" }, { accounts: [{ isMut: false ; isSigner: false ; name: "namespace" }, { isMut: true ; isSigner: false ; name: "entry" }, { isMut: true ; isSigner: true ; name: "payer" }, { isMut: true ; isSigner: false ; name: "namespaceCertificateTokenAccount" }, { isMut: true ; isSigner: false ; name: "mintManager" }, { isMut: true ; isSigner: false ; name: "certificateMint" }, { isMut: true ; isSigner: false ; name: "certificateMintMetadata" }, { isMut: false ; isSigner: false ; name: "certificateProgram" }, { isMut: false ; isSigner: false ; name: "tokenMetadataProgram" }, { isMut: false ; isSigner: false ; name: "tokenProgram" }, { isMut: false ; isSigner: false ; name: "associatedToken" }, { isMut: false ; isSigner: false ; name: "rent" }, { isMut: false ; isSigner: false ; name: "systemProgram" }] ; args: [{ name: "ix" ; type: { defined: "InitEntryIx" } }] ; name: "initEntry" }, { accounts: [{ isMut: true ; isSigner: false ; name: "namespace" }, { isMut: true ; isSigner: false ; name: "entry" }, { isMut: true ; isSigner: true ; name: "user" }, { isMut: true ; isSigner: true ; name: "payer" }, { isMut: true ; isSigner: false ; name: "claimRequest" }, { isMut: true ; isSigner: false ; name: "paymentMint" }, { isMut: true ; isSigner: false ; name: "namespaceCertificateTokenAccount" }, { isMut: true ; isSigner: false ; name: "mintManager" }, { isMut: true ; isSigner: false ; name: "certificate" }, { isMut: true ; isSigner: false ; name: "certificateMint" }, { isMut: true ; isSigner: false ; name: "certificateTokenAccount" }, { isMut: true ; isSigner: false ; name: "certificatePaymentTokenAccount" }, { isMut: true ; isSigner: false ; name: "userCertificateTokenAccount" }, { isMut: true ; isSigner: false ; name: "userPaymentTokenAccount" }, { isMut: false ; isSigner: false ; name: "certificateProgram" }, { isMut: false ; isSigner: false ; name: "tokenProgram" }, { isMut: false ; isSigner: false ; name: "associatedToken" }, { isMut: false ; isSigner: false ; name: "rent" }, { isMut: false ; isSigner: false ; name: "systemProgram" }] ; args: [{ name: "ix" ; type: { defined: "ClaimEntryIx" } }] ; name: "claimEntry" }, { accounts: [{ isMut: false ; isSigner: false ; name: "namespace" }, { isMut: true ; isSigner: false ; name: "entry" }, { isMut: false ; isSigner: false ; name: "userCertificateTokenAccount" }, { isMut: false ; isSigner: false ; name: "certificate" }, { isMut: true ; isSigner: true ; name: "user" }, { isMut: false ; isSigner: true ; name: "payer" }, { isMut: false ; isSigner: false ; name: "systemProgram" }] ; args: [{ name: "data" ; type: "publicKey" }] ; name: "setEntryData" }, { accounts: [{ isMut: false ; isSigner: false ; name: "namespace" }, { isMut: true ; isSigner: false ; name: "entry" }, { isMut: true ; isSigner: false ; name: "reverseEntry" }, { isMut: false ; isSigner: false ; name: "userCertificateTokenAccount" }, { isMut: false ; isSigner: false ; name: "certificate" }, { isMut: true ; isSigner: true ; name: "user" }, { isMut: false ; isSigner: true ; name: "payer" }, { isMut: false ; isSigner: false ; name: "systemProgram" }] ; args: [{ name: "reverseEntryBump" ; type: "u8" }] ; name: "setReverseEntry" }, { accounts: [{ isMut: true ; isSigner: false ; name: "namespace" }, { isMut: true ; isSigner: false ; name: "entry" }, { isMut: true ; isSigner: false ; name: "claimRequest" }, { isMut: true ; isSigner: false ; name: "namespaceCertificateTokenAccount" }, { isMut: true ; isSigner: false ; name: "namespacePaymentTokenAccount" }, { isMut: false ; isSigner: true ; name: "invalidator" }, { isMut: true ; isSigner: false ; name: "mintManager" }, { isMut: true ; isSigner: false ; name: "certificate" }, { isMut: true ; isSigner: false ; name: "certificateMint" }, { isMut: true ; isSigner: false ; name: "certificateTokenAccount" }, { isMut: true ; isSigner: false ; name: "certificatePaymentTokenAccount" }, { isMut: true ; isSigner: false ; name: "userCertificateTokenAccount" }, { isMut: true ; isSigner: false ; name: "userPaymentTokenAccount" }, { isMut: false ; isSigner: false ; name: "certificateProgram" }, { isMut: false ; isSigner: false ; name: "tokenProgram" }] ; args: [] ; name: "revokeEntry" }, { accounts: [{ isMut: false ; isSigner: false ; name: "namespace" }, { isMut: false ; isSigner: false ; name: "entry" }, { isMut: true ; isSigner: false ; name: "reverseEntry" }, { isMut: true ; isSigner: false ; name: "claimRequest" }, { isMut: false ; isSigner: true ; name: "invalidator" }] ; args: [] ; name: "revokeReverseEntry" }, { accounts: [{ isMut: false ; isSigner: false ; name: "namespace" }, { isMut: true ; isSigner: false ; name: "entry" }, { isMut: true ; isSigner: false ; name: "namespaceCertificateTokenAccount" }, { isMut: false ; isSigner: true ; name: "invalidator" }] ; args: [] ; name: "invalidateManagedEntry" }, { accounts: [{ isMut: false ; isSigner: false ; name: "namespace" }, { isMut: true ; isSigner: false ; name: "entry" }, { isMut: true ; isSigner: false ; name: "reverseEntry" }, { isMut: true ; isSigner: false ; name: "namespaceCertificateTokenAccount" }, { isMut: false ; isSigner: true ; name: "invalidator" }] ; args: [] ; name: "invalidateManagedReverseEntry" }, { accounts: [{ isMut: false ; isSigner: false ; name: "namespace" }, { isMut: true ; isSigner: false ; name: "entry" }, { isMut: false ; isSigner: false ; name: "certificate" }, { isMut: false ; isSigner: true ; name: "invalidator" }] ; args: [] ; name: "invalidateUnmanagedEntry" }, { accounts: [{ isMut: false ; isSigner: false ; name: "namespace" }, { isMut: true ; isSigner: false ; name: "entry" }, { isMut: true ; isSigner: false ; name: "reverseEntry" }, { isMut: false ; isSigner: false ; name: "certificate" }, { isMut: false ; isSigner: true ; name: "invalidator" }] ; args: [] ; name: "invalidateUnmanagedReverseEntry" }, { accounts: [{ isMut: false ; isSigner: false ; name: "namespace" }, { isMut: true ; isSigner: true ; name: "payer" }, { isMut: true ; isSigner: false ; name: "claimRequest" }, { isMut: false ; isSigner: false ; name: "systemProgram" }] ; args: [{ name: "entryName" ; type: "string" }, { name: "claimRequestBump" ; type: "u8" }, { name: "user" ; type: "publicKey" }] ; name: "createClaimRequest" }, { accounts: [{ isMut: false ; isSigner: false ; name: "namespace" }, { isMut: false ; isSigner: true ; name: "approveAuthority" }, { isMut: true ; isSigner: false ; name: "rentRequest" }] ; args: [{ name: "isApproved" ; type: "bool" }] ; name: "updateClaimRequest" }, { accounts: [{ isMut: false ; isSigner: false ; name: "namespace" }, { isMut: false ; isSigner: false ; name: "entry" }, { isMut: true ; isSigner: false ; name: "certificateMintMetadata" }, { isMut: false ; isSigner: false ; name: "tokenMetadataProgram" }] ; args: [] ; name: "updateEntryMintMetadata" }]
name
"namespaces"
types
[{ name: "ClaimEntryIx" ; type: { fields: [{ name: "duration" ; type: { option: "i64" } }, { name: "certificateBump" ; type: "u8" }] ; kind: "struct" } }, { name: "CreateNamespaceIx" ; type: { fields: [{ name: "bump" ; type: "u8" }, { name: "name" ; type: "string" }, { name: "updateAuthority" ; type: "publicKey" }, { name: "rentAuthority" ; type: "publicKey" }, { name: "approveAuthority" ; type: { option: "publicKey" } }, { name: "schema" ; type: "u8" }, { name: "paymentAmountDaily" ; type: "u64" }, { name: "paymentMint" ; type: "publicKey" }, { name: "minRentalSeconds" ; type: "i64" }, { name: "maxRentalSeconds" ; type: { option: "i64" } }, { name: "transferableEntries" ; type: "bool" }] ; kind: "struct" } }, { name: "InitEntryIx" ; type: { fields: [{ name: "name" ; type: "string" }, { name: "entryBump" ; type: "u8" }, { name: "mintManagerBump" ; type: "u8" }] ; kind: "struct" } }, { name: "InitializeGlobalNamespaceIx" ; type: { fields: [{ name: "rentPercentage" ; type: "u64" }, { name: "bump" ; type: "u8" }] ; kind: "struct" } }, { name: "UpdateNamespaceIx" ; type: { fields: [{ name: "updateAuthority" ; type: "publicKey" }, { name: "rentAuthority" ; type: "publicKey" }, { name: "approveAuthority" ; type: { option: "publicKey" } }, { name: "paymentAmountDaily" ; type: "u64" }, { name: "paymentMint" ; type: "publicKey" }, { name: "minRentalSeconds" ; type: "i64" }, { name: "maxRentalSeconds" ; type: { option: "i64" } }, { name: "transferableEntries" ; type: "bool" }] ; kind: "struct" } }]
version
"0.0.0"
Defined in

ReverseEntryData

Ƭ ReverseEntryData: TypeDef<Namespaces["accounts"][4], IdlTypes<Namespaces>>
Defined in

Variables

CLAIM_REQUEST_SEED

CLAIM_REQUEST_SEED: "rent-request"
Defined in

ENTRY_SEED

ENTRY_SEED: "entry"
Defined in

GLOBAL_CONTEXT_SEED

GLOBAL_CONTEXT_SEED: "context"
Defined in

GLOBAL_RENTAL_PERCENTAGE

GLOBAL_RENTAL_PERCENTAGE: 0.2
Defined in

IDL

IDL: Namespaces
Defined in

NAMESPACES_IDL

NAMESPACES_IDL: Namespaces = IDL
Defined in

NAMESPACES_PROGRAM_ID

NAMESPACES_PROGRAM_ID: PublicKey
Defined in

NAMESPACE_SEED

NAMESPACE_SEED: "namespace"
Defined in

REVERSE_ENTRY_SEED

REVERSE_ENTRY_SEED: "reverse-entry"
Defined in

Functions

breakName

breakName(fullName): [string, string]
Parameters
Name
Type
fullName
string
Returns
[string, string]
Defined in

claimRequestId

claimRequestId(namespaceName, entryName, user): Promise<[PublicKey, number]>
Parameters
Name
Type
namespaceName
string
entryName
string
user
PublicKey
Returns
Promise<[PublicKey, number]>
Defined in

displayAddress

displayAddress(address, shorten?): string
Parameters
Name
Type
Default value
address
string
undefined
shorten
boolean
true
Returns
string
Defined in

formatName

formatName(namespace, name): string
Parameters
Name
Type
namespace
string
name
string
Returns
string
Defined in

getClaimRequest

getClaimRequest(connection, namespaceName, entryName, requestor): Promise<AccountData<ClaimRequestData>>
Parameters
Name
Type
connection
Connection
namespaceName
string
entryName
string
requestor
PublicKey
Returns
Defined in

getNameEntries

getNameEntries(connection, namespaceName, entryNames): Promise<AccountData<EntryData> & { name: string }[]>
Parameters
Name
Type
connection
Connection
namespaceName
string
entryNames
string[]
Returns
Promise<AccountData<EntryData> & { name: string }[]>
Defined in

getNameEntry

getNameEntry(connection, namespaceName, entryName): Promise<AccountData<EntryData>>
Parameters
Name
Type
connection
Connection
namespaceName
string
entryName
string
Returns
Defined in

getNamespace

getNamespace(connection, namespaceName): Promise<AccountData<NamespaceData>>
Parameters
Name
Type
connection
Connection
namespaceName
string
Returns
Defined in

getNamespaces

getNamespaces(connection): Promise<AccountData<NamespaceData>[]>
Parameters
Name
Type
connection
Connection
Returns
Defined in

getPendingClaimRequests

getPendingClaimRequests(connection): Promise<AccountData<ClaimRequestData>[]>
Parameters
Name
Type
connection
Connection
Returns
Defined in

getReverseEntry

getReverseEntry(connection, pubkey): Promise<AccountData<ReverseEntryData>>
Parameters
Name
Type
connection
Connection
pubkey
PublicKey
Returns
Defined in

nameEntryId

nameEntryId(namespaceName, entryName): Promise<[PublicKey, number]>
Parameters
Name
Type
namespaceName
string
entryName
string
Returns
Promise<[PublicKey, number]>
Defined in

nameForDisplay

nameForDisplay(connection, pubkey): Promise<string>
Parameters
Name
Type
connection
Connection
pubkey
PublicKey
Returns
Promise<string>
Defined in

reverseEntryId

Const reverseEntryId(address): Promise<[PublicKey, number]>
Parameters
Name
Type
address
PublicKey
Returns
Promise<[PublicKey, number]>
Defined in

shortenAddress

shortenAddress(address, chars?): string
shorten the checksummed version of the input address to have 4 characters at start and end
Parameters
Name
Type
Default value
address
string
undefined
chars
number
5
Returns
string
Defined in

tryGetName

tryGetName(connection, pubkey): Promise<string | undefined>
Parameters
Name
Type
connection
Connection
pubkey
PublicKey
Returns
Promise<string | undefined>
Defined in

tryGetReverseEntry

tryGetReverseEntry(connection, pubkey): Promise<AccountData<ReverseEntryData>>
Parameters
Name
Type
connection
Connection
pubkey
PublicKey
Returns
Defined in

withClaimEntry

withClaimEntry(connection, wallet, namespaceName, entryName, certificateMintId, duration, transaction): Promise<web3.Transaction>
Parameters
Name
Type
connection
Connection
wallet
Wallet
namespaceName
string
entryName
string
certificateMintId
PublicKey
duration
number
transaction
Transaction
Returns
Promise<web3.Transaction>
Defined in

withCreateClaimRequest

withCreateClaimRequest(connection, wallet, namespaceName, entryName, user, transaction): Promise<web3.Transaction>
Parameters
Name
Type
connection
Connection
wallet
Wallet
namespaceName
string
entryName
string
user
PublicKey
transaction
Transaction
Returns
Promise<web3.Transaction>
Defined in

withCreateNamespace

withCreateNamespace(connection, wallet, name, updateAuthority, rentAuthority, approveAuthority, schema, paymentAmountDaily, paymentMint, minRentalSeconds, maxRentalSeconds, transferableEntries, transaction): Promise<web3.Transaction>
Parameters
Name
Type
connection
Connection
wallet
Wallet
name
string
updateAuthority
PublicKey
rentAuthority
PublicKey
approveAuthority
PublicKey
schema
number
paymentAmountDaily
BN
paymentMint
PublicKey
minRentalSeconds
BN
maxRentalSeconds
BN
transferableEntries
boolean
transaction
Transaction
Returns
Promise<web3.Transaction>
Defined in

withInit

</