Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PayStellarUri

The pay operation represents a request to pay a specific address with a specific asset, regardless of the source asset used by the payer.

see

https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0007.md#operation-pay

Hierarchy

Index

Constructors

constructor

Properties

Protected uri

uri: URL

Accessors

amount

  • get amount(): undefined | string
  • set amount(amount: undefined | string): void
  • Gets the amount that destination will receive.

    Optional.

    Returns undefined | string

  • Sets the amount that destination will receive.

    Optional.

    Parameters

    • amount: undefined | string

    Returns void

assetCode

  • get assetCode(): undefined | string
  • set assetCode(assetCode: undefined | string): void
  • Gets the asset code the destination will receive.

    Optional.

    Returns undefined | string

  • Sets the asset code the destination will receive.

    Optional.

    Parameters

    • assetCode: undefined | string

    Returns void

assetIssuer

  • get assetIssuer(): undefined | string
  • set assetIssuer(assetIssuer: undefined | string): void
  • Gets the account ID of asset issuer the destination will receive

    Optional.

    Returns undefined | string

  • Sets the account ID of asset issuer the destination will receive

    Optional.

    Parameters

    • assetIssuer: undefined | string

    Returns void

callback

  • get callback(): undefined | string
  • set callback(callback: undefined | string): void
  • Gets the callback for this URI.

    Note: This returns the callback without the 'url:' prefix that may be present in the callback.

    Optional.

    Returns undefined | string

  • 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.

    Parameters

    • callback: undefined | string

    Returns void

destination

  • get destination(): string
  • set destination(destination: string): void
  • Gets the destination of the payment request, which is a valid account ID or payment address.

    Required.

    Returns string

  • Sets the destination of the payment request, which is a valid account ID or payment address.

    Required.

    Parameters

    • destination: string

    Returns void

isPublicNetwork

  • get isPublicNetwork(): boolean
  • 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.

    Returns boolean

isTestNetwork

  • get isTestNetwork(): boolean

memo

  • get memo(): undefined | string
  • set memo(memo: undefined | string): void
  • Gets the memo to be included in the payment / path payment. Memos of type MEMO_HASH and MEMO_RETURN should be base64 encoded.

    Optional.

    Returns undefined | string

  • Sets the memo to be included in the payment / path payment. Memos of type MEMO_HASH and MEMO_RETURN should be base64 encoded.

    Optional.

    Parameters

    • memo: undefined | string

    Returns void

memoType

  • get memoType(): undefined | "id" | "none" | "text" | "hash" | "return"
  • set memoType(memoType: MemoType | undefined): void

msg

  • get msg(): undefined | string
  • set msg(msg: undefined | string): void

networkPassphrase

  • get networkPassphrase(): undefined | string
  • set networkPassphrase(networkPassphrase: undefined | string): void
  • 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.

    Returns undefined | string

  • Sets the network passphrase of the Stellar network to use for this request.

    Optional.

    Parameters

    • networkPassphrase: undefined | string

    Returns void

operation

originDomain

  • get originDomain(): undefined | string
  • set originDomain(originDomain: undefined | string): void
  • 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.

    Returns undefined | string

  • Sets 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.

    Parameters

    • originDomain: undefined | string

    Returns void

pubkey

  • get pubkey(): undefined | string
  • set pubkey(pubkey: undefined | string): void

signature

  • get signature(): undefined | string

Methods

addReplacement

addSignature

  • addSignature(keypair: Keypair): string
  • 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.

    Parameters

    • keypair: 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.

    Returns string

clone

Protected getParam

  • getParam(key: string): string | undefined

getReplacements

  • getReplacements(): object[]

removeReplacement

  • removeReplacement(id: string): void

Protected setParam

  • setParam(key: string, value?: undefined | string): void

setReplacements

toString

  • toString(): string

usePublicNetwork

  • usePublicNetwork(): void

useTestNetwork

  • useTestNetwork(): void

verifySignature

  • verifySignature(): Promise<boolean>
  • 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.

    Returns Promise<boolean>

Static forDestination

  • Creates a PayStellarUri instance and sets the given destination.

    Parameters

    • destination: string

      A valid account ID or payment address.

    Returns PayStellarUri

Generated using TypeDoc