You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 21, 2021. It is now read-only.
DataUnion is now an object which we can operate on. To get an instance of DU object, call client.getDataUnion(contractAddress). As the object encapsulates the contract address, we don't need to specify it when we access the DU methods.
Some methods that need a member address were previously optional, and the default value for those were the currently authenticated user. Now we need to be more explicit about the parameter and the member address is always required. Also previously there was a dataUnion client option which was a default value for some DU actions. That is no longer supported.
There is a new config option factorySidechainAddress. Users don't need to specify this as it has default value in test and will have a default value in production once we know the address.
Member join functions:
- renamed joinDataUnion() -> join(secret?), if secret is given this will wait until the automatic join request has been processed
- added isMember(memberAddress), returns true if the member is an active member
- hasJoined() removed
Withdraw functions renamed to have word "all" if the amount is not specified:
- withdrawAll(options?)
- withdrawAllTo(recipient, options?)
- signWithdrawAllTo(recipientAddress)
- signWithdrawAmountTo(recipientAddress, amountTokenWei)
- admin: withdrawFor() -> withdrawAllToMember(memberAddress, options?)
- admin: withdrawAllToSigned(memberAddress, recipientAddress, signature, options?)
- removed methods that returned the raw withdraw transactions removed: getWithdrawTx(), getWithdrawTxTo(), getWithdrawTxFor()
Public query functions:
- renamed getDataUnionStats() -> getStats()
- getMemberStats(memberAddress)
- removed getMembers as it is not supported in DU v2
- renamed getBalance() -> getWithdrawableEarnings(memberAddress)
- getAdminFee()
- getAdminAddress()
- getVersion()
Admin functions:
- client.deployDataUnion(options), waits until the deployment is ready, supports new options: confirmations and gasPrice
- createSecret(name?)
- addMembers(memberAddressList, options?)
- renamed kick() -> removeMembers(memberAddressList, options?)
- setAdminFee(newFeeFraction)
Other functions:
- not related to DU: client.getTokenBalance()
Public accessors for DataUnion objects:
- getAddress(), returns string
- getSidechainAddress(), returns string
Internal functions:
- client._getDataUnionFromName({ dataUnionName, deployerAddress }), returns DataUnion
- dataUnion._getContract(), returns Promise
Future refactoring, should be done after this PR is in 5.x:
- Move many DataUnionEndpoints.ts functions to DataUnion class (and inline DataUnion methods that just call an endpoint methods)
- Move getTokenBalance to a separate class as it is not DU-related
- Remove caching from fetchDataUnionMainnetAddress
Copy file name to clipboardExpand all lines: README.md
+27-39Lines changed: 27 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -324,37 +324,28 @@ All the below functions return a Promise which gets resolved with the result.
324
324
325
325
## Data Unions
326
326
327
-
This library provides functions for working with Data Unions.
327
+
This library provides functions for working with Data Unions. To get a DataUnion instance, call `client.getDataUnion(address)`. To deploy a new DataUnion, call `deployDataUnion(options)`
328
328
329
-
TODO: check all this documentation before merging/publishing, probably some of it is out of date (DU1 era)
330
-
331
-
Data union functions take a third parameter, `options`, which are either overrides to options given in the constructor, or optional arguments to the function.
329
+
TODO: All `options`-parameters should be documented (see TypeScript interfaces for the definitions)
332
330
331
+
These DataUnion-specific options are used from `StreamrClient` options:
|joinDataUnion(options) | JoinRequest| Join a Data Union|
375
-
|hasJoined(\[memberAddress], options) | -| Wait until member has been accepted|
376
-
|withdraw(options) | Transaction receipt | Withdraw funds from Data Union |
377
-
|withdrawTo(recipientAddress, dataUnionContractAddress, options)| Transaction receipt | Donate/move your earnings to recipientAddress instead of your memberAddress |
378
-
|signWithdrawTo(recipientAddress, options)| Signature (string) | Signature that can be used to withdraw tokens to given recipientAddress |
379
-
| signWithdrawAmountTo(recipientAddress, amountTokenWei, options)| Signature (string) | Signature that can be used to withdraw tokens to given recipientAddress |
365
+
|join(\[secret]) | JoinRequest | Join the Data Union (if a valid secret is given, the promise waits until the automatic join request has been processed)|
366
+
|isMember(memberAddress) | boolean||
367
+
|withdrawAll(\[options])| Transaction receipt | Withdraw funds from Data Union |
368
+
|withdrawAllTo(recipientAddress, \[options]) | Transaction receipt | Donate/move your earnings to recipientAddress instead of your memberAddress |
369
+
|signWithdrawAllTo(recipientAddress) | Signature (string) | Signature that can be used to withdraw tokens to given recipientAddress |
370
+
| signWithdrawAmountTo(recipientAddress, amountTokenWei) | Signature (string) | Signature that can be used to withdraw tokens to given recipientAddress |
380
371
381
372
Here's an example how to sign off on a withdraw to (any) recipientAddress:
382
373
@@ -386,7 +377,7 @@ const client = new StreamrClient({
| StreamrClient.generateEthereumAccount() | Generates a random Ethereum private key and returns an object with fields `address` and privateKey. Note that this private key can be used to authenticate to the Streamr API by passing it in the authentication options, as described earlier in this document. |
411
+
| getTokenBalance(address) |`BigNumber`| Mainnet DATA token balance |
0 commit comments