UNPKG

@openocean.finance/widget-sdk

Version:

OpenOcean Any-to-Any Cross-Chain-Swap SDK

64 lines 2.37 kB
const processMessages = { TOKEN_ALLOWANCE: { STARTED: 'Setting token allowance', PENDING: 'Waiting for token allowance', DONE: 'Token allowance set', }, SWITCH_CHAIN: { ACTION_REQUIRED: 'Chain switch required', PENDING: 'Waiting for chain switch', DONE: 'Chain switched', }, SWAP: { STARTED: 'Preparing swap transaction', ACTION_REQUIRED: 'Please sign the transaction', PENDING: 'Waiting for swap transaction', DONE: 'Swap completed', }, CROSS_CHAIN: { STARTED: 'Preparing bridge transaction', ACTION_REQUIRED: 'Please sign the transaction', PENDING: 'Waiting for bridge transaction', DONE: 'Bridge transaction confirmed', }, RECEIVING_CHAIN: { PENDING: 'Waiting for destination chain', DONE: 'Bridge completed', }, PERMIT: { STARTED: 'Preparing transaction', ACTION_REQUIRED: 'Sign permit message', PENDING: 'Waiting for permit message', DONE: 'Permit message signed', }, TRANSACTION: {}, }; const substatusMessages = { PENDING: { BRIDGE_NOT_AVAILABLE: 'Bridge communication is temporarily unavailable.', CHAIN_NOT_AVAILABLE: 'RPC communication is temporarily unavailable.', UNKNOWN_ERROR: 'An unexpected error occurred. Please seek assistance in the OpenOcean discord server.', WAIT_SOURCE_CONFIRMATIONS: 'The bridge deposit has been received. The bridge is waiting for more confirmations to start the off-chain logic.', WAIT_DESTINATION_TRANSACTION: 'The bridge off-chain logic is being executed. Wait for the transaction to appear on the destination chain.', }, DONE: { PARTIAL: 'Some of the received tokens are not the requested destination tokens.', REFUNDED: 'The tokens were refunded to the sender address.', COMPLETED: 'The transfer is complete.', }, FAILED: {}, INVALID: {}, NOT_FOUND: {}, }; export function getProcessMessage(type, status) { const processMessage = processMessages[type][status]; return processMessage; } export function getSubstatusMessage(status, substatus) { if (!substatus) { return; } const message = substatusMessages[status][substatus]; return message; } //# sourceMappingURL=processMessages.js.map