Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .yarn/install-state.gz
Binary file not shown.
52 changes: 52 additions & 0 deletions packages/ui/src/Common/Toast/Toast.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,58 @@ Warning.args = {
onClose: () => console.log("Toast closed"),
};

export const ErrorWithEnhancedDetails = SingleToastTemplate.bind({});
ErrorWithEnhancedDetails.args = {
id: "enhanced-error",
type: "error",
title: "Contract Error",
message:
"The slippage exceeds the allowable limit. In Phase 1 of the launch, it's capped at 1%. Please try to swap a lower amount of tokens.",
onClose: () => console.log("Toast closed"),
// Simulate enhanced error object from the new error resolver
error: {
message: "Transaction simulation failed: HostError: Error(Contract, #300)",
userFriendlyMessage:
"The slippage exceeds the allowable limit. In Phase 1 of the launch, it's capped at 1%. Please try to swap a lower amount of tokens.",
errorCode: 300,
contractType: "pair",
stack:
"Error: Transaction simulation failed: HostError: Error(Contract, #300)\n at PhoenixPairContract.swap (contract.js:123:15)\n at executeContractTransaction (useContractTransaction.tsx:45:20)",
},
};

export const ErrorWithStakeContract = SingleToastTemplate.bind({});
ErrorWithStakeContract.args = {
id: "stake-error",
type: "error",
title: "Staking Error",
message: "Insufficient staking balance",
onClose: () => console.log("Toast closed"),
error: {
message: "Error(Contract, #503)",
userFriendlyMessage: "Insufficient staking balance",
errorCode: 503,
contractType: "stake",
},
};

export const ErrorWithUnknownCode = SingleToastTemplate.bind({});
ErrorWithUnknownCode.args = {
id: "unknown-error",
type: "error",
title: "Unknown Contract Error",
message:
"Contract error occurred (code: 999). Please try again or contact support.",
onClose: () => console.log("Toast closed"),
error: {
message: "Error(Contract, #999)",
userFriendlyMessage:
"Contract error occurred (code: 999). Please try again or contact support.",
errorCode: 999,
contractType: null,
},
};

export const Info = SingleToastTemplate.bind({});
Info.args = {
id: "4",
Expand Down
Loading
Loading