Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • DataUnion

Index

Properties

Private client

client: default

Private contractAddress

contractAddress: string

Private sidechainAddress

sidechainAddress: string

Methods

Private _executeWithdraw

  • _executeWithdraw(getWithdrawTxFunc: () => Promise<ContractTransaction>, recipientAddress: string, options?: DataUnionWithdrawOptions): Promise<null | string | ContractReceipt>
  • Template for withdraw functions

    Parameters

    • getWithdrawTxFunc: () => Promise<ContractTransaction>
        • (): Promise<ContractTransaction>
        • Returns Promise<ContractTransaction>

    • recipientAddress: string
    • options: DataUnionWithdrawOptions = {}

    Returns Promise<null | string | ContractReceipt>

    the sidechain withdraw transaction receipt IF called with sendToMainnet=false, ELSE the message hash IF called with payForTransport=false and waitUntilTransportIsComplete=false, ELSE the mainnet AMB signature execution transaction receipt IF we did the transport ourselves, ELSE null IF transport to mainnet was done by someone else (in which case the receipt is lost)

addMembers

  • addMembers(memberAddressList: string[]): Promise<ContractReceipt>

createSecret

  • createSecret(name?: string): Promise<string>

getAddress

  • getAddress(): string

getAdminAddress

  • getAdminAddress(): Promise<string>

getAdminFee

  • getAdminFee(): Promise<number>
  • Get data union admin fee fraction (between 0.0 and 1.0) that admin gets from each revenue event Version 2.2: admin fee is collected in DataUnionSidechain Version 2.0: admin fee was collected in DataUnionMainnet

    Returns Promise<number>

Private getContracts

  • getContracts(): default

getMemberStats

  • getMemberStats(memberAddress: string): Promise<MemberStats>

getSidechainAddress

  • getSidechainAddress(): string

getStats

  • Get stats for the Data Union (version 2). Most of the interface has remained stable, but getStats has been implemented in functions that return a different number of stats, hence the need for the more complex and very manually decoded query.

    Returns Promise<DataUnionStats>

getVersion

  • getVersion(): Promise<number>

Private getWithdrawAllToMemberTx

  • getWithdrawAllToMemberTx(memberAddress: string, sendToMainnet?: boolean): Promise<ContractTransaction>
  • Admin: get the tx promise for withdrawing all earnings on behalf of a member

    Parameters

    • memberAddress: string

      the other member who gets their tokens out of the Data Union

    • sendToMainnet: boolean = true

    Returns Promise<ContractTransaction>

    await on call .wait to actually send the tx

Private getWithdrawAllToSignedTx

  • getWithdrawAllToSignedTx(memberAddress: string, recipientAddress: string, signature: string, sendToMainnet?: boolean): Promise<any>
  • Admin: Withdraw a member's earnings to another address, signed by the member

    Parameters

    • memberAddress: string

      the member whose earnings are sent out

    • recipientAddress: string

      the address to receive the tokens in mainnet

    • signature: string

      from member, produced using signWithdrawAllTo

    • sendToMainnet: boolean = true

      false = send to sidechain address

    Returns Promise<any>

    await on call .wait to actually send the tx

Private getWithdrawAllToTx

  • getWithdrawAllToTx(recipientAddress: string, sendToMainnet?: boolean): Promise<ContractTransaction>
  • Withdraw earnings and "donate" them to the given address

    Parameters

    • recipientAddress: string

      the address to receive the tokens

    • sendToMainnet: boolean = true

    Returns Promise<ContractTransaction>

    await on call .wait to actually send the tx

Private getWithdrawAllTx

  • getWithdrawAllTx(sendToMainnet?: boolean): Promise<ContractTransaction>
  • Get the tx promise for withdrawing all your earnings

    Parameters

    • sendToMainnet: boolean = true

    Returns Promise<ContractTransaction>

    await on call .wait to actually send the tx

Private getWithdrawAmountToSignedTx

  • getWithdrawAmountToSignedTx(memberAddress: string, recipientAddress: string, amount: BigNumber, signature: string, sendToMainnet?: boolean): Promise<any>
  • Admin: Withdraw a member's earnings to another address, signed by the member

    Parameters

    • memberAddress: string

      the member whose earnings are sent out

    • recipientAddress: string

      the address to receive the tokens in mainnet

    • amount: BigNumber

      in "token wei" to withdraw

    • signature: string

      from member, produced using signWithdrawAllTo

    • sendToMainnet: boolean = true

    Returns Promise<any>

    await on call .wait to actually send the tx

getWithdrawableEarnings

  • getWithdrawableEarnings(memberAddress: string): Promise<BigNumber>

isMember

  • isMember(memberAddress: string): Promise<boolean>

join

part

  • part(): Promise<ContractReceipt>

removeMembers

  • removeMembers(memberAddressList: string[]): Promise<ContractReceipt>

setAdminFee

  • setAdminFee(newFeeFraction: number): Promise<ContractReceipt>
  • Admin: set admin fee (between 0.0 and 1.0) for the data union Version 2.2: admin fee is collected in DataUnionSidechain Version 2.0: admin fee was collected in DataUnionMainnet

    Parameters

    • newFeeFraction: number

    Returns Promise<ContractReceipt>

signSetBinanceRecipient

  • signSetBinanceRecipient(recipientAddress: string): Promise<string>

signWithdrawAllTo

  • signWithdrawAllTo(recipientAddress: string): Promise<string>
  • Member can sign off to "donate" all earnings to another address such that someone else can submit the transaction (and pay for the gas) This signature is only valid until next withdrawal takes place (using this signature or otherwise). Note that while it's a "blank cheque" for withdrawing all earnings at the moment it's used, it's invalidated by the first withdraw after signing it. In other words, any signature can be invalidated by making a "normal" withdraw e.g. await streamrClient.withdrawAll() Admin can execute the withdraw using this signature: ``` await adminStreamrClient.withdrawAllToSigned(memberAddress, recipientAddress, signature)

    ``` @param recipientAddress - the address authorized to receive the tokens @returns signature authorizing withdrawing all earnings to given recipientAddress

    Parameters

    • recipientAddress: string

    Returns Promise<string>

signWithdrawAllToBinance

  • signWithdrawAllToBinance(): Promise<string>

signWithdrawAmountTo

  • signWithdrawAmountTo(recipientAddress: string, amountTokenWei: string | number | BigNumber): Promise<string>
  • Member can sign off to "donate" specific amount of earnings to another address such that someone else can submit the transaction (and pay for the gas) This signature is only valid until next withdrawal takes place (using this signature or otherwise).

    Parameters

    • recipientAddress: string

      the address authorized to receive the tokens

    • amountTokenWei: string | number | BigNumber

      that the signature is for (can't be used for less or for more)

    Returns Promise<string>

    signature authorizing withdrawing all earnings to given recipientAddress

transferToMemberInContract

  • transferToMemberInContract(memberAddress: string, amountTokenWei: string | number | BigNumber): Promise<ContractReceipt>
  • Transfer amount to specific member in DataunionSidechain

    Parameters

    • memberAddress: string

      target member who gets the tokens added to their earnings in the the Data Union

    • amountTokenWei: string | number | BigNumber

      the amount that want to add to the member

    Returns Promise<ContractReceipt>

    receipt once transfer transaction is confirmed

transferWithinContract

  • transferWithinContract(memberAddress: string, amountTokenWei: string | number | BigNumber): Promise<ContractReceipt>
  • Transfer an amount of earnings to another member in DataunionSidechain

    Parameters

    • memberAddress: string

      the other member who gets their tokens out of the Data Union

    • amountTokenWei: string | number | BigNumber

      the amount that want to add to the member

    Returns Promise<ContractReceipt>

    receipt once transfer transaction is confirmed

transportMessage

  • transportMessage(messageHash: string, pollingIntervalMs?: number, retryTimeoutMs?: number, ethersOptions?: Overrides): Promise<null | ContractReceipt>
  • Parameters

    • messageHash: string
    • pollingIntervalMs: number = 1000
    • retryTimeoutMs: number = 300000
    • ethersOptions: Overrides = {}

    Returns Promise<null | ContractReceipt>

    null if message was already transported, ELSE the mainnet AMB signature execution transaction receipt

withdrawAll

  • Withdraw all your earnings

    Parameters

    Returns Promise<null | string | ContractReceipt>

    the sidechain withdraw transaction receipt IF called with sendToMainnet=false, ELSE the message hash IF called with payForTransport=false and waitUntilTransportIsComplete=false, ELSE the mainnet AMB signature execution transaction receipt IF we did the transport ourselves, ELSE null IF transport to mainnet was done by someone else (in which case the receipt is lost)

withdrawAllTo

  • Withdraw earnings and "donate" them to the given address

    Parameters

    Returns Promise<null | string | ContractReceipt>

    the sidechain withdraw transaction receipt IF called with sendToMainnet=false, ELSE the message hash IF called with payForTransport=false and waitUntilTransportIsComplete=false, ELSE the mainnet AMB signature execution transaction receipt IF we did the transport ourselves, ELSE null IF transport to mainnet was done by someone else (in which case the receipt is lost)

withdrawAllToBinance

withdrawAllToMember

  • withdrawAllToMember(memberAddress: string, options?: DataUnionWithdrawOptions): Promise<null | string | ContractReceipt>
  • Admin: withdraw earnings (pay gas) on behalf of a member TODO: add test

    Parameters

    • memberAddress: string

      the other member who gets their tokens out of the Data Union

    • Optional options: DataUnionWithdrawOptions

    Returns Promise<null | string | ContractReceipt>

    the sidechain withdraw transaction receipt IF called with sendToMainnet=false, ELSE the message hash IF called with payForTransport=false and waitUntilTransportIsComplete=false, ELSE the mainnet AMB signature execution transaction receipt IF we did the transport ourselves, ELSE null IF transport to mainnet was done by someone else (in which case the receipt is lost)

withdrawAllToSigned

  • withdrawAllToSigned(memberAddress: string, recipientAddress: string, signature: string, options?: DataUnionWithdrawOptions): Promise<null | string | ContractReceipt>
  • Admin: Withdraw a member's earnings to another address, signed by the member

    Parameters

    • memberAddress: string

      the member whose earnings are sent out

    • recipientAddress: string

      the address to receive the tokens in mainnet

    • signature: string

      from member, produced using signWithdrawAllTo

    • Optional options: DataUnionWithdrawOptions

    Returns Promise<null | string | ContractReceipt>

    the sidechain withdraw transaction receipt IF called with sendToMainnet=false, ELSE the message hash IF called with payForTransport=false and waitUntilTransportIsComplete=false, ELSE the mainnet AMB signature execution transaction receipt IF we did the transport ourselves, ELSE null IF transport to mainnet was done by someone else (in which case the receipt is lost)

withdrawAmountToSigned

  • withdrawAmountToSigned(memberAddress: string, recipientAddress: string, amountTokenWei: string | number | BigNumber, signature: string, options?: DataUnionWithdrawOptions): Promise<null | string | ContractReceipt>
  • Admin: Withdraw a specific amount member's earnings to another address, signed by the member

    Parameters

    • memberAddress: string

      the member whose earnings are sent out

    • recipientAddress: string

      the address to receive the tokens in mainnet

    • amountTokenWei: string | number | BigNumber
    • signature: string

      from member, produced using signWithdrawAllTo

    • Optional options: DataUnionWithdrawOptions

    Returns Promise<null | string | ContractReceipt>

    the sidechain withdraw transaction receipt IF called with sendToMainnet=false, ELSE the message hash IF called with payForTransport=false and waitUntilTransportIsComplete=false, ELSE the mainnet AMB signature execution transaction receipt IF we did the transport ourselves, ELSE null IF transport to mainnet was done by someone else (in which case the receipt is lost)

Static getVersion

  • getVersion(contractAddress: string, client: default): Promise<number>
  • Figure out if given mainnet address is old DataUnion (v 1.0) or current 2.0 NOTE: Current version of streamr-client-javascript can only handle current version!

    Parameters

    • contractAddress: string
    • client: default

    Returns Promise<number>

Generated using TypeDoc