StarkWare Provider
⚠️ The StarkWare provider is in alpha
Heads up! The StarkWare provider is currently only available for Ropsten testnet and not feature complete yet.
Getting started
Install authereum@next
version:
Instantiate the Authereum SDK and get StarkWare provider:
Methods
These are the methods available under the Authereum StarkWare provider:
getStarkKey():Promise<string>
getStarkKey():Promise<string>
Returns the Stark key.
Arguments:
none
Returns:
Promise<string>
: Returns a promise with stark key string.
Example:
getPublicKey():Promise<string>
getPublicKey():Promise<string>
Returns the Stark public key.
Arguments:
none
Returns:
Promise<string>
: Returns a promise with stark public key string.
Example:
setContractAddress(contractAddress):Promise<void>
setContractAddress(contractAddress):Promise<void>
Sets the StarkEx contract address to use for the provider.
Arguments:
Returns:
Promise<void>
Example:
getContractAddress():Promise<string>
getContractAddress():Promise<string>
Returns the StarkEx contract address.
Arguments:
none
Returns:
Promise<string>
: Returns a promise with contract address.
Example:
registerUser(ethKey, operatorSignature):Promise<string>
registerUser(ethKey, operatorSignature):Promise<string>
Submits a transaction to register the Stark key.
Arguments:
Returns:
Promise<string>:
Returns a promise with transaction hash.
Example:
depositEth(vaultId, amount, quantum):Promise<string>
depositEth(vaultId, amount, quantum):Promise<string>
Submits a transaction to deposit ETH to vault.
Arguments:
Returns:
Promise<string>:
Returns a promise with transaction hash.
Example:
depositErc20(vaultId, amount, quantum, token):Promise<string>
depositErc20(vaultId, amount, quantum, token):Promise<string>
Submits a transaction to deposit ERC20 token to vault.
Arguments:
Returns:
Promise<>:
Returns a promise with transaction hash.
Example:
depositErc721(vaultId, tokenId, token):Promise<string>
depositErc721(vaultId, tokenId, token):Promise<string>
Submits a transaction to deposit ERC721 NFT to vault.
Arguments:
Returns:
Promise<string>:
Returns a promise with transaction hash.
Example:
cancelDeposit(vaultId, assetType):Promise<string>
cancelDeposit(vaultId, assetType):Promise<string>
Submits transaction to cancel deposit.
Arguments:
Returns:
Promise<string>:
Returns a promise with transaction hash.
Example:
reclaimDeposit(vaultId, assetType):Promise<string>
reclaimDeposit(vaultId, assetType):Promise<string>
Submits transaction to reclaim deposit after cancelling deposit.
Arguments:
Returns:
Promise<string>:
Returns a promise with transaction hash.
Example:
withdrawEth(quantum, recipient?):Promise<string>
withdrawEth(quantum, recipient?):Promise<string>
Submits transaction to withdraw ETH from vault.
Arguments:
Returns:
Promise<string>:
Returns a promise with transaction hash.
Example:
withdrawErc20(quantum, token, recipient?):Promise<string>
withdrawErc20(quantum, token, recipient?):Promise<string>
Submits transaction to withdraw ERC20 token from vault.
Arguments:
Returns:
Promise<string>:
Returns a promise with transaction hash.
Example:
withdrawErc721(tokenId, token, recipient?):Promise<string>
withdrawErc721(tokenId, token, recipient?):Promise<string>
Submits transaction to withdraw ERC721 NFT from vault.
Arguments:
Returns:
Promise<string>:
Returns a promise with transaction hash.
Example:
fullWithdrawalRequest(vaultId):Promise<string>
fullWithdrawalRequest(vaultId):Promise<string>
Submits transaction to do a request to withdraw all tokens from vault.
Arguments:
Returns:
Promise<string>:
Returns a promise with transaction hash.
Example:
freezeRequest(vaultId):Promise<string>
freezeRequest(vaultId):Promise<string>
Submits transaction to freeze vault.
Arguments:
Returns:
Promise<string>:
Returns a promise with transaction hash.
Example:
escape(vaultId, assetType, quantizedAmount):Promise<string>
escape(vaultId, assetType, quantizedAmount):Promise<string>
Submits transaction to request escape from frozen contract.
Arguments:
Returns:
Promise<string>:
Returns a promise with object containing transaction hash.
Example:
transfer({object}):Promise<string>
transfer({object}):Promise<string>
Transfer ETH, ERC20, or ERC721 to a stark account. Returns signature.
Arguments:
Object parameters:
Asset
AssetData
TransferParams
Returns:
Promise<string>:
Returns a promise with transfer stark signature.
Example:
transferEth({object}):Promise<string>
transferEth({object}):Promise<string>
Transfer ETH to a stark account. Returns signature.
Arguments:
Object parameters:
Returns:
Promise<string>:
Returns a promise with transfer stark signature.
Example:
transferErc20({object}):Promise<string>
transferErc20({object}):Promise<string>
Transfer ERC20 token to a stark account. Returns signature.
Arguments:
Object parameters:
Returns:
Promise<string>:
Returns a promise with transfer stark signature.
Example:
transferErc721({object}):Promise<string>
transferErc721({object}):Promise<string>
Transfer ERC721 token to a stark account. Returns signature.
Arguments:
Object parameters:
Returns:
Promise<string>:
Returns a promise with transfer stark signature.
Example:
createOrder({object}):Promise<string>
createOrder({object}):Promise<string>
Create a buy or sell limit order. Returns a signature
Arguments:
Object parameters:
OrderParams
AssetData
Returns:
Promise<string>:
Returns a promise with transfer stark signature.
Example
deserializeSignature(signature)
Returns the
r
ands
values of serialized signature.
Arguments:
Returns:
Promise<{r, s, recoveryParam?}>:
Returns object
Example:
serializeSignature({r, s, recoveryParam?}):string
Returns the serialized signature.
Arguments:
Returns:
Promise<string>: Returns serialized signature as hex string.
Example:
send(method, params):Promise<object>
send(method, params):Promise<object>
Call StarkWare JSON RPC method with payload.
Arguments:
Returns:
Promise<{id, result}>:
Returns promise with object containing response result.
Example:
getAssetType({assetStandard, assetContractAddress?, quantum?, amount?}):Promise<string>
getAssetType({assetStandard, assetContractAddress?, quantum?, amount?}):Promise<string>
Returns asset type hash.
TODO
starkSignMessage(msg):Promise<string>
starkSignMessage(msg):Promise<string>
Signs message with stark key.
TODO
signMessage(msg):Promise<string>
signMessage(msg):Promise<string>
Signs message with ethereum key.
TODO
signPersonalMessage(msg):Promise<string>
signPersonalMessage(msg):Promise<string>
Signs personal message with ethereum key.
TODO
signTransaction(tx):Promise<string>
signTransaction(tx):Promise<string>
Sign transaction.
TODO
sendTransaction(tx):Promise<string>
sendTransaction(tx):Promise<string>
Send transaction.
TODO
estimateGas(tx):Promise<string>
estimateGas(tx):Promise<string>
Estimate gas.
TODO
Additional information
Please refer to the StarkWare JSON RPC specification for example inputs.
You can test out StarkWare methods in the Authereum Ropsten Kitchen Sink.
Last updated