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.
<!-- This stuff REALLY isn't for those who use our infrastructure, neither DU admins nor DU client devs. It's only relevant if you're setting up your own sidechain.
361
361
These DataUnion-specific options can be given to `new StreamrClient` options:
| dataUnion.minimumWithdrawTokenWei | 1000000 | Threshold value set in AMB configs, smallest token amount that can pass over the bridge |
366
+
| dataUnion.payForTransport| true| true = client does the transport as self-service and pays the mainnet gas costs |
367
+
| | | false = someone else pays for the gas when transporting the withdraw tx to mainnet |
368
368
-->
369
369
370
370
### Admin Functions
@@ -375,8 +375,10 @@ These DataUnion-specific options can be given to `new StreamrClient` options:
375
375
| setAdminFee(newFeeFraction) | Transaction receipt |`newFeeFraction` is a `Number` between 0.0 and 1.0 (inclusive) |
376
376
| addMembers(memberAddressList) | Transaction receipt | Add members |
377
377
| removeMembers(memberAddressList) | Transaction receipt | Remove members from Data Union |
378
-
| withdrawAllToMember(memberAddress\[, [options](#withdraw-options)\]) | Transaction receipt | Send all withdrawable earnings to the member's address |
379
-
| withdrawAllToSigned(memberAddress, recipientAddress, signature\[, [options](#withdraw-options)\]) | Transaction receipt | Send all withdrawable earnings to the address signed off by the member (see [example below](#member-functions)) |
378
+
| withdrawAllToMember(memberAddress\[, [options](#withdraw-options)\]) | Transaction receipt `*`| Send all withdrawable earnings to the member's address |
379
+
| withdrawAllToSigned(memberAddress, recipientAddress, signature\[, [options](#withdraw-options)\]) | Transaction receipt `*`| Send all withdrawable earnings to the address signed off by the member (see [example below](#member-functions)) |
380
+
381
+
`*` The return value type may vary depending on [the given options](#withdraw-options) that describe the use case.
380
382
381
383
Here's how to deploy a Data Union contract with 30% Admin fee and add some members:
| join(\[secret]) | JoinRequest | Join the Data Union (if a valid secret is given, the promise waits until the automatic join request has been processed) |
405
-
| isMember(memberAddress) | boolean ||
406
-
| withdrawAll(\[[options](#withdraw-options)\]) | Transaction receipt | Withdraw funds from Data Union |
407
-
| withdrawAllTo(recipientAddress\[, [options](#withdraw-options)\]) | Transaction receipt | Donate/move your earnings to recipientAddress instead of your memberAddress |
408
-
| signWithdrawAllTo(recipientAddress) | Signature (string) | Signature that can be used to withdraw all available tokens to given recipientAddress |
409
-
| signWithdrawAmountTo(recipientAddress, amountTokenWei) | Signature (string) | Signature that can be used to withdraw a specific amount of tokens to given recipientAddress |
| join(\[secret]) | JoinRequest | Join the Data Union (if a valid secret is given, the promise waits until the automatic join request has been processed) |
407
+
| isMember(memberAddress) | boolean ||
408
+
| withdrawAll(\[[options](#withdraw-options)\]) | Transaction receipt `*`| Withdraw funds from Data Union |
409
+
| withdrawAllTo(recipientAddress\[, [options](#withdraw-options)\]) | Transaction receipt `*`| Donate/move your earnings to recipientAddress instead of your memberAddress |
410
+
| signWithdrawAllTo(recipientAddress) | Signature (string) | Signature that can be used to withdraw all available tokens to given recipientAddress |
411
+
| signWithdrawAmountTo(recipientAddress, amountTokenWei) | Signature (string) | Signature that can be used to withdraw a specific amount of tokens to given recipientAddress |
412
+
| transportMessage(messageHash[, pollingIntervalMs[, retryTimeoutMs]]) | Transaction receipt | Send the mainnet transaction to withdraw tokens from the sidechain |
413
+
414
+
`*` The return value type may vary depending on [the given options](#withdraw-options) that describe the use case.
410
415
411
416
Here's an example on how to sign off on a withdraw to (any) recipientAddress (NOTE: this requires no gas!)
The `messageHash` argument to `transportMessage` will come from the withdraw function with the specific options. The following is equivalent to the above withdraw line:
The functions `withdrawAll`, `withdrawAllTo`, `withdrawAllToMember`, `withdrawAllToSigned` all can take an extra "options" argument. It's an object that can contain the following parameters:
| sendToMainnet | true | Whether to send the withdrawn DATA tokens to mainnet address (or sidechain address) |
480
+
| payForTransport | true | Whether to pay for the withdraw transaction signature transport to mainnet over the bridge |
481
+
| waitUntilTransportIsComplete | true | Whether to wait until the withdrawn DATA tokens are visible in mainnet |
482
+
| pollingIntervalMs | 1000 (1 second) | How often requests are sent to find out if the withdraw has completed |
483
+
| retryTimeoutMs | 60000 (1 minute) | When to give up when waiting for the withdraw to complete |
484
+
485
+
These withdraw transactions are sent to the sidechain, so gas price shouldn't be manually set (fees will hopefully stay very low),
486
+
but a little bit of [sidechain native token](https://www.xdaichain.com/for-users/get-xdai-tokens) is nonetheless required.
487
+
488
+
The return values from the withdraw functions also depend on the options.
489
+
490
+
If `sendToMainnet: false`, other options don't apply at all, and **sidechain transaction receipt** is returned as soon as the withdraw transaction is done. This should be fairly quick in the sidechain.
491
+
492
+
The use cases corresponding to the different combinations of the boolean flags:
468
493
469
-
These withdraw transactions are sent to the sidechain, so gas price shouldn't be manually set (fees will hopefully stay very low), but a little bit of [sidechain native token](https://www.xdaichain.com/for-users/get-xdai-tokens) is nonetheless required.
494
+
|`transport`|`wait`| Returns | Effect |
495
+
| :---------- | :------ | :------ | :----- |
496
+
|`true`|`true`| Transaction receipt |*(default)* Self-service bridge to mainnet, client pays for mainnet gas |
497
+
|`true`|`false`| Transaction receipt | Self-service bridge to mainnet (but **skip** the wait that double-checks the withdraw succeeded and tokens arrived to destination) |
498
+
|`false`|`true`|`null`| Someone else pays for the mainnet gas automatically, e.g. the bridge operator (in this case the transaction receipt can't be returned) |
499
+
|`false`|`false`| AMB message hash | Someone else pays for the mainnet gas, but we need to give them the message hash first |
0 commit comments