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 @fuel-ts/utils/assets-utils package #1703

Closed
wants to merge 3 commits into from

Conversation

Dhaiwat10
Copy link
Member

Closes #1541

@Dhaiwat10 Dhaiwat10 added the feat Issue is a feature label Feb 1, 2024
@Dhaiwat10 Dhaiwat10 self-assigned this Feb 1, 2024
return CHAIN_IDS.eth.sepolia;
}
if (networkType === 'fuel') {
return CHAIN_IDS.fuel.beta4;
Copy link
Member

Choose a reason for hiding this comment

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

This PR should probably target beta5 already.

Comment on lines +28 to +31
"./assets-utils": {
"require": "./dist/assets-utils.js",
"import": "./dist/assets-utils.mjs",
"types": "./dist/assets-utils.d.ts"
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if it should be inside the new account package, following the Provider route:

cc @Torres-ssf

Copy link
Member Author

Choose a reason for hiding this comment

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

@arboleya Makes sense. Do you believe I should wait for that PR to be merged, or can I work on this in parallel?

Copy link
Member

Choose a reason for hiding this comment

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

There are things you could do ahead of time, or you could also branch off of that branch/PR.

That's entirely up to you.

Copy link
Contributor

Choose a reason for hiding this comment

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

@arboleya I agree, this can be part of the account package.

Copy link
Member

@arboleya arboleya Feb 2, 2024

Choose a reason for hiding this comment

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

Maybe it could even go inside providers:

  • account/src/providers/chains.ts
  • account/src/providers/assets/index.ts
  • account/src/providers/assets/icons/..

Copy link
Contributor

@LuizAsFight LuizAsFight Feb 4, 2024

Choose a reason for hiding this comment

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

why inside providers ? assets has nothing to do with network/account... they can be even from other chain

I may lack some context here but @fuel-ts/assets feels good to me cc @arboleya

Copy link
Member

Choose a reason for hiding this comment

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

I agree; however, over-categorizing small chunks of code led us to have dozens of packages flattened out in the repo root without an apparent relationship between them, which created a maintenance burden we are trying to reduce by re-grouping things in this PR as an attempt to defrag the list of packages. Things might not look perfect and are subject to change, but we must start somewhere, and flexibility is required to get things moving.

Nevertheless, everything will still be available from fuels.


export const assets = assetList;

export default resolveIconPath(process.env.BASE_URL || './', assetList);
Copy link
Member

Choose a reason for hiding this comment

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

I usually dislike export default since it can result in inconsistent nomenclatures.

Copy link
Member Author

@Dhaiwat10 Dhaiwat10 Feb 2, 2024

Choose a reason for hiding this comment

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

Agreed, and I don't think we use default exports anywhere at all. I kept it there because for now I just copy pasted all the source from the old repo, but happy to make this change

"@fuel-ts/utils": minor
---

add @fuel-ts/utils/assets-utils package
Copy link
Member

Choose a reason for hiding this comment

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

It looks more like a directory/script. 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm.. thought of it as a package/mini-package since I put it under a separate export path.

Directory makes sense tho lol!

Copy link
Member

Choose a reason for hiding this comment

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

After you move it around, the description may naturally morph with it.

### Usage

```ts
import assets from "@fuel-ts/utils/assets-utils";
Copy link
Member

Choose a reason for hiding this comment

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

We might not need an entry point, even if we don't move assets inside account.

import { assets } from "@fuel-ts/utils";

Copy link
Member Author

Choose a reason for hiding this comment

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

Cool, will remove it

Copy link
Contributor

@LuizAsFight LuizAsFight left a comment

Choose a reason for hiding this comment

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

friendly reminder to add index file under utils directory, just like this pr -> https://github.com/FuelLabs/fuels-npm-packs/pull/41/files

@Dhaiwat10
Copy link
Member Author

Closing this in favor of #1730. The new PR is based off of #1675

@Dhaiwat10 Dhaiwat10 closed this Feb 7, 2024
@arboleya arboleya deleted the dp/assets-network-interface branch February 26, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Issue is a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export Asset/Networks Config Interface
4 participants