Skip to content

Javascript / NPM

npm i @the-registry/tir

Methods

Fetch a PayString async

getPayStringAsync(
    payString: string,
    options?: { chain?: string; environment?: string}
    ): Promise<PaymentInformation | undefined>

Fetch a PayString debounced, result gets returned in the callback

getPayStringDebounce(
  callback: (data: PaymentInformation | undefined) => void,
  payString: string,
  debounceTime = minDebounceTime,
): void

Parse a PayString, throws an error if not parseable by protocol standards

parsePayString(payString: string): string

Parse a PayString url, throws an error if not parseable by protocol standards

parsePayStringUrl(payString: string): URL

Splits the PayString to return the prefix and domain, throws an error if not parseable by protocol standards

splitPayString(payString: string): { prefix: string; domain: string }

Converts the PayString to an URL

convertPayStringToUrl(payString: string): URL

Converts a PayString URL to a PayString

convertUrlToPayString(payStringUrl: string): string

Interfaces

interface PaymentInformation {
    addresses: Address[];
    payId?: string;
    memo?: string;
}
enum AddressDetailsType {
    CryptoAddress = 'CryptoAddressDetails',
    FiatAddress = 'FiatAddressDetails'
}
interface CryptoAddressDetails {
    address: string;
    tag?: string;
}
interface FiatAddressDetails {
    accountNumber: string;
    routingNumber?: string;
}
interface Address {
    paymentNetwork: string;
    environment?: string;
    addressDetailsType: AddressDetailsType;
    addressDetails: CryptoAddressDetails | FiatAddressDetails;
}