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

fix(types): simplify types for init functions, cleanup contructors #345

Merged
merged 4 commits into from
Jan 15, 2025

Conversation

dtfiedler
Copy link
Collaborator

@dtfiedler dtfiedler commented Jan 15, 2025

I introduced a bug when adding arweave as an optional type in #337. It's easy to overlook what our overloaded init functions expect. This hopefully introduces new types that can be extended if/when necessary. Additionally, i've added e2e tests validating the instance types returned for all major classes. We can look to leverage unit tests more to avoid the entire docker setup when doing these simple type validations/checks.

@dtfiedler dtfiedler requested a review from a team as a code owner January 15, 2025 06:23
@@ -126,7 +126,7 @@
"dependencies": {
"@dha-team/arbundles": "^1.0.1",
"@permaweb/aoconnect": "^0.0.57",
"arweave": "1.14.4",
"arweave": "1.15.5",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this always makes me nervous. will do some validations across our clients (observer, ar-io-node, network-portal, arns.app) to validate if it causes any issues

Copy link
Contributor

Choose a reason for hiding this comment

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

minor version bump -- "Drop Node 16 Support". that semantic versioning 😂

Comment on lines +56 to +64
it.skip('should be able to instantiate ARIO with a process and arweave', async () => {
const ario = ARIO.init({
process: new AOProcess({
processId,
}),
arweave,
});
assert(ario instanceof ARIOReadable);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

is this meant to be removed or unskipped?

dtfiedler added 3 commits January 15, 2025 09:38
The init overloads can be hard to parse. This hopefully introduces new types that can be extended if/when necessary. Addittionally adds e2e tests validating the instance types returned for all major classes. We can look to leverage unit tests more to avoid the entire docker setup when doing this simple type validations/checks.
Comment on lines 721 to 733
it('should be able to get a specific vault', async () => {
const { items: vaults } = await ario.getVaults();
if (vaults.length > 0) {
const vault = await ario.getVault({
address: vaults[0].address,
vaultId: vaults[0].vaultId,
});
assert.deepEqual(vault, {
balance: 1,
startTimestamp: 1729962428678,
endTimestamp: 1731172028678,
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this doesn't seem stable. that vault will end at 1731172028678. maybe just assert the types?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes - good catch

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, 1731172028678 is actually in GMT: Saturday, November 9, 2024 5:07:08.678 PM

I'm guessing this is just getting no vaults atm

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fedellen
fedellen previously approved these changes Jan 15, 2025
Copy link
Contributor

@fedellen fedellen left a comment

Choose a reason for hiding this comment

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

looks good besides the test nits -- can iterate

@dtfiedler dtfiedler merged commit 287bf41 into alpha Jan 15, 2025
13 checks passed
@dtfiedler
Copy link
Collaborator Author

🎉 This PR is included in version 3.3.0-alpha.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants