@swapkit/types 1.0.0-rc.31 → 1.0.0-rc.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +35 -32
- package/dist/index.es.js.map +1 -1
- package/package.json +5 -5
- package/src/errors/displayMessages.ts +5 -3
|
@@ -25,6 +25,7 @@ export const ERROR_DISPLAY_MESSAGES: Record<string, string> = {
|
|
|
25
25
|
[ERROR_CODE.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN]:
|
|
26
26
|
'Destination address {0} invalid for buy chain.',
|
|
27
27
|
[ERROR_CODE.PREFERRED_PROVIDER_NOT_SUPPORTED]: 'Preferred provider not supported.',
|
|
28
|
+
[ERROR_CODE.SOURCE_ADDRESS_SMART_CONTRACT]: 'Source address is a smart contract.',
|
|
28
29
|
[ERROR_CODE.DESTINATION_ADDRESS_SMART_CONTRACT]: 'Destination address is a smart contract.',
|
|
29
30
|
[ERROR_CODE.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: 'Buy amount must be a positive integer.',
|
|
30
31
|
[ERROR_CODE.INVALID_PROVIDER]: 'Invalid provider {0}.',
|
|
@@ -60,10 +61,11 @@ export const ERROR_DISPLAY_MESSAGES: Record<string, string> = {
|
|
|
60
61
|
export const getDisplayMessage = (code: ERROR_CODE, displayMessageParams: string[]) => {
|
|
61
62
|
let displayMessage = ERROR_DISPLAY_MESSAGES[code];
|
|
62
63
|
|
|
64
|
+
if (!displayMessage) return '';
|
|
65
|
+
|
|
63
66
|
for (let i = 0; i < displayMessageParams.length; i++) {
|
|
64
|
-
displayMessage = displayMessage
|
|
67
|
+
displayMessage = displayMessage?.replace(`{${i}}`, displayMessageParams[i]) ?? '';
|
|
65
68
|
}
|
|
66
69
|
|
|
67
|
-
|
|
68
|
-
else return displayMessage;
|
|
70
|
+
return displayMessage;
|
|
69
71
|
};
|