This repository was archived by the owner on Dec 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Merged
Streamr Client 5.0.0 #192
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…any files, too slow to use on node_modules.
…tAddress or tokenAddress config.
Typescript tweaks
…improve validation, memberStats format (#206) Split DataUnionEndpoints.ts: move contract handling to Contracts.ts, ABI definitions to abi.ts and inline public methods to DataUnion.ts Smaller changes: - Remove obsolete caching from address fetching - Improve address validation (and add tests) - Split tests, improve test cleanup - Bug fix for payForSignatureTransport option in withdraws: method option overrides client option - Format of getMemberStats() data modified (enum values changed, number values string->BigNumber) - Type annotations for StreamrClientOptions: many of the fields are required, as we apply a default value -> users give options as Partial<StreamrClientOptions> - Id and debug are client properties, not options
Type annotations for authFetch endpoints (and utils.test.ts).
createStream, getStream, getStreamByName and getOrCreateStream reject the promise if there is an API error. To support this functionality, a new errorCode field was added to AuthFetchError. Currently the ErrorCode enum lists the most typical API error codes: VALIDATION_ERROR and NOT_FOUND. Other codes can be added later, if needed.
Types for getAdminAddress, setAdminFee, executeWithdraw. After these modifications, and PR #207 all public methods of DataUnion are annotated with valid types. Remove deployTxReceipt field which was not used
Changed Connection.debug to optional parameter
Better error handling of authFetch errors: added classes ValidationError and NotFoundError. Also smaller changes: - added missing id field to StreamPermission - strict type check of parameter in getOrCreateStream()
Export parameters/return types for objects which are publicly available to the JS-client users. Updated getDataUnionMainnetAddress and getDataUnionSidechainAddress in Contracts.ts to support new DataUnion addresses. BREAKING CHANGE: - moved DataUnion related StreamrClient options into a new dataUnion block: factoryMainnetAddress, - factorySidechainAddress, minimumWithdrawTokenWei - renamed payForSignatureTransport to freeWithdraw and reversed the value - new required options in that block: templateMainnetAddress, templateSidechainAddress
Linting export public types
Hide internal properties and methods from the public classes. Currently the internals are annotated with a weak /** @internal */ . Some of the properties/methods could be marked with TypeScript's private to force the encapsulation. That can be done later, after we have converted all classes to TypeScript and the usage boundaries are clear.
Fetch the account address from MetaMask using request({ method: 'eth_requestAccounts' }). Previously used the deprecated selectedAddress field.
Configure chainId to StreamrClient options. The parameter is required when using MetaMask sidechain signing.
BREAKING CHANGE: client.getAddress() is now async
We could be more explicit about network chainIds. Sidechain chainId could be a required parameter in StreamrClient options and we could also add chainId parameter to options.mainnet definition. The chainId validation can be enhanced in another PR later, if needed.
Note that there are currently no automated tests to check the MetaMask integration.
Define valid types for public API methods Also small bug fix for parsing stream definition options (e.g. when filtering subscriptions with getSubscription(opts))
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is basically a new streamr client with rebuilt internals, including a message subscription “pipeline”, more robust/understandable/consistent connection handling and a lot more tests + reliability around connection & timing issues.
External interface is largely the same, but timings may differ and there may be some edge cases not covered by tests.
This is built on top of, and supersedes changes in #156, #160, #162, #164 & #166
Rough WIP Changelog
subscribe/resendmethods are now async.subscribedevent (subscribe()promise now resolves when this would have fired)no_resendevent, onlyresentwhether there were messages or not.collect()function to subscriptions that collects the results into an array of messages and resolves when the subscription ends, mainly/only useful for resends.onMessagehandler tosubscribe/resend.donewhen it's been disconnected and will not reconnect.connectedonly when it's connected and will not be immediately disconnecting.connect()ordisconnect(). This is because I could not come up a sensible, consistent expected behaviour that combined explicit & automatic connect/disconnect. Can reenable auto behaviour without creating a new client or mutating options usingenableAutoConnect()/enableAutoDisconnect(). This means if youconnectyou mustdisconnectorenableAutoDisconnect()to close the connection.connect()&disconnect()no longer error if already {dis}connecting/{dis}connected. This is basically whatensureConnected/ensureDisconnectedprovided before.ensureConnected/ensureDisconnectedmethods still exist but are now just aliases ofconnect&disconnect.7.0.0to get these fixes + more: Handle multiple gaps streamr-client-protocol-js#46 & Don't break if explicitly marking messages out of order. streamr-client-protocol-js#47dist/report.html. This is downloadable as an artifact in CI buildsasync (done) =>in preparation forjest-circusjest runner being enabled by default in Jest 27+. Enabledjest-circusby default anyway. This fixes an issue where if a test fails asynchronously, theafterEach/afterAllhooks would run unchained i.e.beforeEachfor next test would start beforeafterEachwas complete. This led to some very confusing test results at times.Related: #NET-159