🛠️ Developers
API Reference

API Reference

MUWPay is currently supposed to be used through the dApp, at muwp.xyz (opens in a new tab). Although, for transparency, our API is technically public. We strongly recommend scheduling a call with us if you plan on building with MUWP.

💡

The base URL for the api is https://muwp.xyz

Quote

Use this endpoint to retrieve quotes from our system

POST /api/quote

NameTypeRequiredDescription
inputTokensArray<Token>YesArray of input tokens, minimum of 1 required.
outputTokensArray<Token>YesOutput token.
distributionArray<number>YesDistribution of the output token.
inputChainnumberYesInput blockchain identifier.
outputChainnumberYesOutput blockchain identifier.
inputAmountRecord<bigint>YesThe amount of input tokens.
fromAddressAddressYesThe sender's blockchain address.
tempAccountAddressNoTemporary account address (optional).
toAddressAddressNoThe recipient's blockchain address (optional).
optionsRouteOptionsNoOptions for the routing process (optional).

Returns an object containing:

routes (Record<string, Route[]>): Record of possible routes for the transaction. The key is either the input token or output depending if we are in OFA or AFO mode.

tempAccount (Address): The temporary account address, retrieved directly from the input.

validUntil (number): A Unix timestamp specifying when the quote expires. This is typically the current time + (1000 ms * 60 secs * 5 mins).

Initiate

Use this endpoint to initiate a MUWP swap.

POST /api/initiate

NameTypeRequiredDescription
fromRecord<Address, Record<Address, biging>>YesOrigin address of the transaction.
gasPayerAddressYesAddress of the account paying for the gas.
accountAddressYesAccount initiating the transaction.
chainIdnumberYesBlockchain network identifier.
routesArray<Route>YesArray of routes for the transaction.
maxFeePerGasbigintNoMaximum gas fee per transaction (optional).
maxPriorityFeePerGasbigintNoMaximum priority gas fee per transaction (optional).

Returns an object containing:

status (string): Indicates the transaction's status.

address (Address): The account initiating the transaction, retrieved directly from the input.

txn (Transaction): The transaction data.

id (string): The ID of the initiating account.

Receive Funds

Use this endpoint to notify the system that the user has sent his funds, but the transaction hasn't been mined yet.

POST /api/receive-funds

NameTypeRequiredDescription
transactionHashHashYesThe transaction hash of the funds being received.
chainIdnumberYesIdentifier for the blockchain network.
accountAddressAddressYesAddress of the account receiving funds.

Returns an object containing:

status (string): Indicates the status of funds received.

Chain Confirmed

Use this endpoint to notify the system that the transaction has been mined and included in the chain.

POST /api/chain-confirmed

NameTypeRequiredDescription
transactionHashHashYesThe transaction hash of the funds being received.
chainIdnumberYesIdentifier for the blockchain network.
accountAddressAddressYesAddress of the account receiving funds.

Returns an object containing:

status (string): Indicates the status of funds received.