Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config quick select tokens for deposit/withdrawal forms #290

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

thanhpn
Copy link
Collaborator

@thanhpn thanhpn commented Dec 16, 2024

No description provided.

@thanhpn thanhpn force-pushed the feat/quick-deposit-tokens branch from d29c142 to 3b24d60 Compare December 16, 2024 09:56
@thanhpn thanhpn requested a review from andrewsoon December 16, 2024 09:56
Comment on lines 483 to 496
"show": "brdg/4b90a8d1225d11ed7af0661ff7309714189a527302892cad03ace7615d417d38",
"real" : "cgt/1"
},
{
"show": "swth",
"real" : "swth"
},
{
"show": "eth.1.2.942d87",
"real" : "eth.1.2.942d87"
},
{
"show": "brdg/a02afc2c1edf77cc023eefa25fc036c184612faf9365cda9c1daa3b1675ebf8f",
"real" : "brdg/a02afc2c1edf77cc023eefa25fc036c184612faf9365cda9c1daa3b1675ebf8f"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

think its just a matter of label and the actual token selected. modify the field to show the label, add icon_denom to fetch the correct icon and add quick_select_denom to link to the intended token after selecting

would be good to add priority to the fields also so the UI can sort by priority

{
  "priority": "1",
  "label": "USDC",
  "icon_denom":  "{any usdc denom that returns the usdc icon}",
  "quick_select_denom": "cgt/1",
}, {
...
}

Comment on lines 433 to 450
const duplicateRealTokens = checkDuplicateEntries(quickSelectTokens.map(token => token.real));
const invalidRealTokens = checkValidEntries(quickSelectTokens.map(token => token.real), denoms);

if (duplicateQuickSelectTokens.status && duplicateQuickSelectTokens.entry) {
let listOfDuplicates: string = duplicateQuickSelectTokens.entry.join(", ");
console.error(`ERROR: ${network}.json has the following duplicated quick select tokens: ${listOfDuplicates}. Please make sure to input each token only once in ${network}`);
return false;
}

if (invalidQuickSelectTokens.status && invalidQuickSelectTokens.entry) {
let listOfInvalidTokens: string = invalidQuickSelectTokens.entry.join(", ");
console.error(`ERROR: ${network}.json has the following invalid quick select token denoms: ${listOfInvalidTokens}. Please make sure to only input valid token denoms in ${network}`);
return false;
}

if (duplicateRealTokens.status && duplicateRealTokens.entry) {
let listOfDuplicates: string = duplicateRealTokens.entry.join(", ");
console.error(`ERROR: ${network}.json has the following duplicated real tokens: ${listOfDuplicates}. Please make sure to input each token only once in ${network}`);
return false;
}

if (invalidRealTokens.status && invalidRealTokens.entry) {
let listOfInvalidTokens: string = invalidRealTokens.entry.join(", ");
console.error(`ERROR: ${network}.json has the following invalid real token denoms: ${listOfInvalidTokens}. Please make sure to only input valid token denoms in ${network}`);
return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think just need to check if quick_select_denom is a valid token should be sufficient. Different tokens can still point to the same selected token
i.e. USDC, axlUSDC can all point to cgt/1

but do check for duplicate labels e.g. cannot have two USDC buttons appearing

Comment on lines 50 to 65
{
"show": "swth",
"real" : "swth"
},
{
"show": "usdc",
"real" : "usdc"
},
{
"show": "eth",
"real" : "eth"
},
{
"show": "dai",
"real" : "dai"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update structs based on comments

Comment on lines 64 to 79
{
"show": "swth",
"real" : "swth"
},
{
"show": "usdc",
"real" : "usdc"
},
{
"show": "eth",
"real" : "eth"
},
{
"show": "dai",
"real" : "dai"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update structs based on comments

Comment on lines 128 to 129
|`real` |`string` |true |The default token will be use to transfer in deposit/withdrawal |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update structs based on comments

Comment on lines 524 to 531
"show": {
"type": "string",
"description": "Token to show on UI"
},
"real": {
"type": "string",
"description": "Token to use in transfer"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update structs based on comments

@thanhpn thanhpn force-pushed the feat/quick-deposit-tokens branch from 33707fa to b950a0d Compare December 17, 2024 12:56
@thanhpn thanhpn force-pushed the feat/quick-deposit-tokens branch from b950a0d to a836a0e Compare December 18, 2024 02:50
@thanhpn thanhpn requested a review from andrewsoon December 18, 2024 02:52
@andrewsoon andrewsoon merged commit 9f4bb85 into master Dec 18, 2024
1 check passed
@andrewsoon andrewsoon deleted the feat/quick-deposit-tokens branch December 18, 2024 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants