StarkWare Provider

⚠️ The StarkWare provider is in alpha

NOTE: The StarkWare provider is currently only available for Ropsten testnet and not feature complete yet.

Getting started

Install authereum@next version:

npm install authereum@next

Instantiate the Authereum SDK and get StarkWare provider:

import Authereum from 'authereum'
const authereum = new Authereum('ropsten')
await authereum.login()
const starkProvider = authereum.getStarkProvider()
const starkPublicKey = await starkProvider.getPublicKey()
console.log(starkPublicKey)

Methods

These are the methods available under the Authereum StarkWare provider:

  • getPublicKey()

    • Returns the Stark public key.

  • setContractAddress(contractAddress)

    • Sets the StarkEx contract address to use.

  • getContractAddress()

    • Returns the StarkEx contract address.

  • register(operatorSignature)

    • Register the Stark key. Returns a transaction hash.

  • deposit(quantizedAmount, token, vaultId)

    • Deposit token to vault. Returns a transaction hash.

  • depositCancel(token, vaultId)

    • Cancel deposit. Returns a transaction hash.

  • depositReclaim(token, vaultId)

    • Reclaim deposit. Returns a transaction hash.

  • transfer(to, vaultId, token, quantizedAmount, nonce, expirationTimestamp)

    • Transfer token to a stark account. Returns signature.

  • createOrder(sell, buy, nonce, expirationTimestamp)

    • Create a buy or sell limit order. Returns a signature.

  • withdraw(token)

    • Withdraw token from vault. Returns a transaction hash.

  • withdrawFull(vaultId)

    • Withdraw all tokens from vault. Returns a transaction hash.

  • freezeVault(vaultId)

    • Freeze vault. Returns a transaction hash.

  • verifyEscape(proof)

    • Provide proof for the escape.

  • escape(vaultId, token, quantizedAmount)

    • Request escape from frozen contract. Returns a transaction hash.

  • deserializeSignature(signature)

    • Returns the r and s values of signature.

  • serializeSignature(signatureParams)

    • Returns the serialized signature.

  • send(method, params)

    • Call StarkWare JSON RPC method with payload.

Please refer to the StarkWare JSON RPC specification for example inputs.

You can test out StarkWare methods in the Authereum Ropsten Kitchen Sink.