@solana/pay
Version:
`@solana/pay` is a JavaScript library for facilitating commerce on Solana by using a token transfer URL scheme. The URL scheme ensures that no matter the wallet or service used, the payment request must be created and interpreted in one standard way.
38 lines • 2.26 kB
TypeScript
import type { Amount, Label, Memo, Message, Recipient, References, SPLToken } from './types.js';
/**
* Fields of a Solana Pay transaction request URL.
*/
export interface TransactionRequestURLFields {
/** `link` in the [Solana Pay spec](https://github.com/solana-foundation/pay/blob/main/typescript/packages/solana-pay/spec/SPEC.md#link). */
link: URL;
/** `label` in the [Solana Pay spec](https://github.com/solana-foundation/pay/blob/main/typescript/packages/solana-pay/spec/SPEC.md#label-1). */
label?: Label;
/** `message` in the [Solana Pay spec](https://github.com/solana-foundation/pay/blob/main/typescript/packages/solana-pay/spec/SPEC.md#message-1). */
message?: Message;
}
/**
* Fields of a Solana Pay transfer request URL.
*/
export interface TransferRequestURLFields {
/** `recipient` in the [Solana Pay spec](https://github.com/solana-foundation/pay/blob/main/typescript/packages/solana-pay/spec/SPEC.md#recipient). */
recipient: Recipient;
/** `amount` in the [Solana Pay spec](https://github.com/solana-foundation/pay/blob/main/typescript/packages/solana-pay/spec/SPEC.md#amount). */
amount?: Amount;
/** `spl-token` in the [Solana Pay spec](https://github.com/solana-foundation/pay/blob/main/typescript/packages/solana-pay/spec/SPEC.md#spl-token). */
splToken?: SPLToken;
/** `reference` in the [Solana Pay spec](https://github.com/solana-foundation/pay/blob/main/typescript/packages/solana-pay/spec/SPEC.md#reference). */
reference?: References;
/** `label` in the [Solana Pay spec](https://github.com/solana-foundation/pay/blob/main/typescript/packages/solana-pay/spec/SPEC.md#label). */
label?: Label;
/** `message` in the [Solana Pay spec](https://github.com/solana-foundation/pay/blob/main/typescript/packages/solana-pay/spec/SPEC.md#message). */
message?: Message;
/** `memo` in the [Solana Pay spec](https://github.com/solana-foundation/pay/blob/main/typescript/packages/solana-pay/spec/SPEC.md#memo). */
memo?: Memo;
}
/**
* Encode a Solana Pay URL.
*
* @param fields Fields to encode in the URL.
*/
export declare function encodeURL(fields: TransactionRequestURLFields | TransferRequestURLFields): URL;
//# sourceMappingURL=encodeURL.d.ts.map