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

feat: add more address types #119

Merged

Conversation

lgahdl
Copy link
Contributor

@lgahdl lgahdl commented Jul 26, 2024

feat: Adding new address types;

  • Upgrading the @ensdomains/address-encoder to v1.1.2;
  • Adding new address fields (BTC, OPT, ARB1, MATIC);
  • Editing setAddr parameters to decode all addresses, including BTC;
  • Adding new coins in the getEnsDomainsData function(BTC, OPT, ARB1, MATIC);

lgahdl added 5 commits July 24, 2024 17:30
- Upgrading the @ensdomains/address-encoder to v1.1.2;
- Adding new address fields (BTC, OPT, ARB1, MATIC);
- Editing setAddr parameters to decode all addresses, including BTC;
- Adding new coins in the getEnsDomainsData function(BTC, OPT, ARB1, MATIC);
@lgahdl lgahdl requested review from FrancoAguzzi and eduramme July 26, 2024 18:34
Copy link

vercel bot commented Jul 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nameful ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 8, 2024 5:53pm
qa-nameful ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 8, 2024 5:53pm

@lgahdl lgahdl changed the base branch from develop to 91-feat-show-current-records-when-editing July 26, 2024 18:42

const [cryptocurrencyName, address] = Object.entries(addresses)[i];
const cryptocurrencyToCoinTypeEntry:
| [coinName: string, coinType: string]
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this type be defined elsewhere?

lib/utils/blockchain-txs.ts Outdated Show resolved Hide resolved
lib/utils/blockchain-txs.ts Outdated Show resolved Hide resolved
lib/utils/blockchain-txs.ts Show resolved Hide resolved
console.error(`coinType code for ${cryptocurrencyName} not found`);
continue;
}
const coinType = cryptocurrencyToCoinTypeEntry[1];
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't this be a key-value pair?

}
const coinType = cryptocurrencyToCoinTypeEntry[1];
const coder = getCoderByCoinName(cryptocurrencyName.toLocaleLowerCase());
let addressEncoded = fromBytes(coder.decode(address), "hex");
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a var or a const?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

a const

[DomainAddressesSupportedCryptocurrencies.DOGE]: "3",
[DomainAddressesSupportedCryptocurrencies.ETH]: "60",
[DomainAddressesSupportedCryptocurrencies.BNB]: "714",
BTC: "0",
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like the way the redefine multiple times, the word BTC, LTC, etc. across this file.

We should rely to a single definition of these that would be reused across our app.

Can you please provide a solution that achieves this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the enum to avoid double remapping(when you need to access an enum by its value, and then an object by its enum key), that can make the code very dirt, I'll try to find a more concise and sophisticated solution that can avoid double remapping and also make the coin names singular across the codebase. Thanks for the observation

lib/utils/ensData.ts Outdated Show resolved Hide resolved
@FrancoAguzzi
Copy link
Contributor

@lgahdl and @eduramme can you help me understand how we can make this ensData.ts file cleaner?

Co-authored-by: frankind.eth <[email protected]>
…e more concise;

refactor: Moving blockchain-txs.ts types to a different types.ts file;
refactor: Cleaning the setDomainRecords function;
components/02-molecules/edit/FieldsContext.tsx Outdated Show resolved Hide resolved
lib/utils/ensData.ts Show resolved Hide resolved
@lgahdl lgahdl requested a review from eduramme August 8, 2024 13:11
@lgahdl lgahdl changed the title 87 feat add more address types feat: add more address types Aug 8, 2024
lib/utils/types.ts Outdated Show resolved Hide resolved
@lgahdl lgahdl requested a review from FrancoAguzzi August 8, 2024 17:49
@lgahdl lgahdl merged commit 76cf4b4 into 91-feat-show-current-records-when-editing Aug 8, 2024
3 checks passed
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.

Add more address types
3 participants