Parse a url

Parse a Solana Pay URL.

def parse_url(url: str)
copy

Parameters

url: str

URL to parse.

Returns TransactionRequestURL | TransferRequestURL

Example

from solathon.solana_pay.types import TransferRequestURLParams, TransactionRequestURLParams
from solathon.solana_pay import parse_url
# using encoded transfer request fields
url = "solana:mvines9iiHiQTysrwkJjGf2gb9Ex9jXJX8ns3qwf2kN?amount=1e-09&label=Jungle+Cats+store&message=Jungle+Cats+store+-+your+order+-+%23001234&memo=JC%234098&reference=6DgHPm8gQp2mvQs5wuYTbJCH5KkkdJ7i4P76M31aegCQ"
transfer_fields: TransferRequestURLParams = parse_url(url)
# using encoded transaction request fields
url = "solana:https://example.com?&label=Jungle+Cats+store&message=Jungle+Cats+store+-+your+order+-+%23001234"
transaction_fields: TransactionRequestURLParams = parse_url(url)
copy

The complete example code can be found here.