Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WyvernProtocol

Hierarchy

  • WyvernProtocol

Index

Constructors

constructor

  • new WyvernProtocol(provider: Web3JsProvider, config: WyvernProtocolConfig): WyvernProtocol
  • Parameters

    • provider: Web3JsProvider
    • config: WyvernProtocolConfig

    Returns WyvernProtocol

Properties

Private _abiDecoder

_abiDecoder: any

Private _provider

_provider: any

Private _web3Wrapper

_web3Wrapper: any

wyvernAtomicizer

wyvernAtomicizer: WyvernAtomicizerContract

wyvernDAO

wyvernDAO: WyvernDAOContract

wyvernExchange

wyvernExchange: WyvernExchangeContract

wyvernProxyRegistry

wyvernProxyRegistry: WyvernProxyRegistryContract

wyvernToken

wyvernToken: WyvernTokenContract

Static MAX_UINT_256

MAX_UINT_256: BigNumber

Static NULL_ADDRESS

NULL_ADDRESS: string

Static encodeAtomicizedReplacementPattern

encodeAtomicizedReplacementPattern: AtomicizedReplacementEncoder

Encodes the atomicized replacementPattern for a supplied ABI and replace kind

param abis

array of AnnotatedFunctionABI

param replaceKind

Parameter kind to replace

returns

The resulting encoded replacementPattern

Static encodeReplacementPattern

encodeReplacementPattern: ReplacementEncoder

Encodes the replacementPattern for a supplied ABI and replace kind

param abi

AnnotatedFunctionABI

param replaceKind

Parameter kind to replace

returns

The resulting encoded replacementPattern

Static generateDefaultValue

generateDefaultValue: (type: string) => any

Type declaration

    • (type: string): any
    • Computes the default value for a type

      Parameters

      • type: string

        The ABI type to calculate a default value for

      Returns any

      The default value for that type

Methods

awaitTransactionMinedAsync

  • awaitTransactionMinedAsync(txHash: string, pollingIntervalMs?: number, timeoutMs?: number): Promise<TransactionReceiptWithDecodedLogs>
  • Waits for a transaction to be mined and returns the transaction receipt.

    Parameters

    • txHash: string

      Transaction hash

    • Optional pollingIntervalMs: number

      How often (in ms) should we check if the transaction is mined.

    • Optional timeoutMs: number

      How long (in ms) to poll for transaction mined until aborting.

    Returns Promise<TransactionReceiptWithDecodedLogs>

    Transaction receipt with decoded log args.

getAuthenticatedProxy

  • getAuthenticatedProxy(accountAddress: string): Promise<AuthenticatedProxyContract>
  • Gets the authenticated proxy contract for a specific account address

    Parameters

    • accountAddress: string

      address to retrieve the proxy contract from

    Returns Promise<AuthenticatedProxyContract>

getAvailableAddressesAsync

  • getAvailableAddressesAsync(): Promise<string[]>
  • Get user Ethereum addresses available through the supplied web3 provider available for sending transactions.

    Returns Promise<string[]>

    An array of available user Ethereum addresses.

setProvider

  • setProvider(provider: Web3JsProvider, networkId: number): void
  • Sets a new web3 provider for wyvernProtocol.js. Updating the provider will stop all subscriptions so you will need to re-subscribe to all events relevant to your app after this call.

    Parameters

    • provider: Web3JsProvider

      The Web3Provider you would like the wyvernProtocol.js library to use from now on.

    • networkId: number

      The id of the network your provider is connected to

    Returns void

signOrderHashAsync

  • signOrderHashAsync(orderHash: string, signerAddress: string): Promise<ECSignature>
  • Signs an orderHash and returns its elliptic curve signature. This method currently supports TestRPC, Geth and Parity above and below V1.6.6

    Parameters

    • orderHash: string

      Hex encoded orderHash to sign.

    • signerAddress: string

      The hex encoded Ethereum address you wish to sign it with. This address must be available via the Web3.Provider supplied to wyvernProtocol.js.

    Returns Promise<ECSignature>

    An object containing the Elliptic curve signature parameters generated by signing the orderHash.

Static generatePseudoRandomSalt

  • generatePseudoRandomSalt(): BigNumber
  • Generates a pseudo-random 256-bit salt. The salt can be included in an 0x order, ensuring that the order generates a unique orderHash and will not collide with other outstanding orders that are identical in all other parameters.

    Returns BigNumber

    A pseudo-random 256-bit number that can be used as a salt.

Static getAssetHashHex

  • getAssetHashHex(assetHash: string, schema: string): string
  • Computes the assetHash for a supplied asset.

    Parameters

    • assetHash: string
    • schema: string

    Returns string

Static getAtomicizerContractAddress

  • getAtomicizerContractAddress(network: Network): string
  • Parameters

    Returns string

Static getDAOContractAddress

  • getDAOContractAddress(network: Network): string
  • Parameters

    Returns string

Static getExchangeContractAddress

  • getExchangeContractAddress(network: Network): string
  • Parameters

    Returns string

Static getOrderHashHex

  • getOrderHashHex(order: Order | SignedOrder): string
  • Computes the orderHash for a supplied order.

    Parameters

    • order: Order | SignedOrder

      An object that conforms to the Order or SignedOrder interface definitions.

    Returns string

    The resulting orderHash from hashing the supplied order.

Static getProxyRegistryContractAddress

  • getProxyRegistryContractAddress(network: Network): string
  • Parameters

    Returns string

Static getTokenContractAddress

  • getTokenContractAddress(network: Network): string
  • Parameters

    Returns string

Static getTokenTransferProxyAddress

  • getTokenTransferProxyAddress(network: Network): string
  • Parameters

    Returns string

Static isValidOrderHash

  • isValidOrderHash(orderHash: string): boolean
  • Checks if the supplied hex encoded order hash is valid. Note: Valid means it has the expected format, not that an order with the orderHash exists. Use this method when processing orderHashes submitted as user input.

    Parameters

    • orderHash: string

      Hex encoded orderHash.

    Returns boolean

    Whether the supplied orderHash has the expected format.

Static isValidSignature

  • isValidSignature(data: string, signature: ECSignature, signerAddress: string): boolean
  • Verifies that the elliptic curve signature signature was generated by signing data with the private key corresponding to the signerAddress address.

    Parameters

    • data: string

      The hex encoded data signed by the supplied signature.

    • signature: ECSignature

      An object containing the elliptic curve signature parameters.

    • signerAddress: string

      The hex encoded address that signed the data, producing the supplied signature.

    Returns boolean

    Whether the signature is valid for the supplied signerAddress and data.

Static toBaseUnitAmount

  • toBaseUnitAmount(amount: BigNumber, decimals: number): BigNumber
  • A baseUnit is defined as the smallest denomination of a token. An amount expressed in baseUnits is the amount expressed in the smallest denomination. E.g: 1 unit of a token with 18 decimal places is expressed in baseUnits as 1000000000000000000

    Parameters

    • amount: BigNumber

      The amount of units that you would like converted to baseUnits.

    • decimals: number

      The number of decimal places the unit amount has.

    Returns BigNumber

    The amount in baseUnits.

Static toUnitAmount

  • toUnitAmount(amount: BigNumber, decimals: number): BigNumber
  • A unit amount is defined as the amount of a token above the specified decimal places (integer part). E.g: If a currency has 18 decimal places, 1e18 or one quintillion of the currency is equivalent to 1 unit.

    Parameters

    • amount: BigNumber

      The amount in baseUnits that you would like converted to units.

    • decimals: number

      The number of decimal places the unit amount has.

    Returns BigNumber

    The amount in units.

Generated using TypeDoc