import { Keypair } from '@stellar/stellar-sdk'; import { Replacement } from './replacement'; /** * The type of the Stellar URI. */ export declare enum StellarUriType { Transaction = "tx", Pay = "pay" } /** * A base class for parsing or constructing SEP-0007 style Stellar URIs. * * @see https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0007.md */ export declare abstract class StellarUri { protected uri: URL; constructor(uri: URL | string); /** * Creates a deep clone of the StellarUri. */ abstract clone(): StellarUri; /** * Gets the operation type of the URI. * */ get operation(): StellarUriType; /** * Gets the callback for this URI. * * Note: This returns the callback *without* the 'url:' prefix that may be present in the callback. * * Optional. */ get callback(): string | undefined; /** * Sets the callback for this URI. * * Note: You may set it with or without the 'url:' prefix. If the prefix is not present it will added in the final URI string. * * Optional. */ set callback(callback: string | undefined); /** * Gets the network passphrase of the Stellar network to use for this request. * * If this is not set, the Stellar public network should be assumed. * * Optional. */ get networkPassphrase(): string | undefined; /** * Sets the network passphrase of the Stellar network to use for this request. * * Optional. */ set networkPassphrase(networkPassphrase: string | undefined); /** * Returns whether or not the network_passphase for this URI indicates that it is on the public network. * * This is true if network_passphrase is not set or if it's set to the public network's passphrase. */ get isPublicNetwork(): boolean; /** * Sets the network_passphrase to be the passphrase of the public network. */ usePublicNetwork(): void; /** * Returns whether or not the network_passphase for this URI indicates that it is on the test network. */ get isTestNetwork(): boolean; /** * Sets the network_passphrase to be the passphrase of the test network. */ useTestNetwork(): void; /** * Gets which public key you want the URI handler to sign for. * * Optional. */ get pubkey(): string | undefined; /** * Sets which public key you want the URI handler to sign for. * * Optional. */ set pubkey(pubkey: string | undefined); /** * Gets the message to show to the user. * * Optional. */ get msg(): string | undefined; /** * Sets the message to show to the user. * This must be 300 characters or less. * * Optional. */ set msg(msg: string | undefined); /** * Gets the fully qualified domain name that specifies the originating domain of the URI request. * * Wallets must validate the URI request against the included signature before they display the origin_domain to the user. */ get originDomain(): string | undefined; /** * Sets the fully qualified domain name that specifies the originating domain of the URI request. */ set originDomain(originDomain: string | undefined); /** * A signature of the hash of the URI request (excluding the signature field and value itself). * * Wallets should use the URI_REQUEST_SIGNING_KEY specified in the domain's stellar.toml file to validate this signature. * If the verification fails, wallets must alert the user. * * @see https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0007.md#request-signing */ get signature(): string | undefined; /** * Signs the URI with the given keypair. * This should be the last step done before generating the URI string, otherwise the signature will be invalid for the URI. * * @param keypair The keypair (including secret key), used to sign the request. This should be the keypair found in the URI_REQUEST_SIGNING_KEY field of the origin domains' stellar.toml. */ addSignature(keypair: Keypair): string; /** * Verifies a that the signature added to the URI is valid. * * Returns true if the signature is valid for the current URI and origin domain, or if there is no origin domain and signature. * Returns false if signature verification fails, or if there is a problem looking up the stellar.toml associated with the origin domain. */ verifySignature(): Promise; /** * Sets the "replace" key, which is a list of fields in the transaction that needs to be replaced. * * @param replacements A list of replacements to set. */ setReplacements(replacements: Replacement[]): void; /** * Gets a list of fields in the transaction that need to be replaced. */ getReplacements(): { id: string; path: string; hint: string; }[]; /** * Adds an additional replacement. * * @param replacement The replacement to add. */ addReplacement(replacement: Replacement): void; /** * Removes all replacements with the given identifier. * * @param id The identifier to remove. */ removeReplacement(id: string): void; /** * Returns the URI as a string. */ toString(): string; protected getParam(key: string): string | undefined; protected setParam(key: string, value?: string): void; private createSignaturePayload; }