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:
Value | Type | Definition |
| String | StarkEx contract address |
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:
Value | Type | Definition |
| String | Ethereum EOA and account contract address |
| String | Operator signature required for registration |
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:
Value | Type | Definition |
| String | Vault ID (e.g. |
| String | ETH amount to deposit in wei (e.g. |
| String | Quantum value (e.g. |
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:
Value | Type | Definition |
| String | Vault ID (e.g. |
| String | Token amount to deposit (e.g. if decimals is |
| String | Quantum value (e.g. |
| String | Token contract address |
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:
Value | Definition |
| Vault ID (e.g. |
| Token ID (e.g. |
| NFT contract address |
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:
Value | Type | Definition |
| String | Asset type hash |
| String | Vault ID (e.g. |
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:
Value | Type | Definition |
| String | Asset type hash |
| String | Vault ID (e.g. |
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:
Value | Type | Definition |
| String | Quantum value (e.g. |
| String | (Optional) Recipient address |
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:
Value | Type | Definition |
| String | Quantum value (e.g. |
| String | Token contract address |
| String | (Optional) Recipient address |
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:
Value | Type | Definition |
| String | Quantum value (e.g. |
| String | Token ID (e.g. |
| String | (Optional) Recipient address |
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:
Value | Type | Definition |
| String | Vault ID (e.g. |
Returns:
Promise<string>:
Returns a promise with transaction hash.
Example:
freezeRequest(vaultId):Promise<string>
freezeRequest(vaultId):Promise<string>
Submits transaction to freeze vault.
Arguments:
Value | Type | Definition |
| String | Vault ID (e.g. |
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:
Value | Type | Definition |
| String | Vault ID (e.g. |
| String | Asset type hash |
| String | Quantized amount (e.g. |
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:
Value | Type | Definition |
| TransferParams | Transfer sender params. |
| TransferParams | Transfer recipient params. |
| Asset | Asset to transfer |
| String | Amount |
| String | Nonce |
| String | Expiration timestamp |
| String | (optional) Condition hash (encoded hash of transfer address and fact) |
| String | (optional) Conditional transfer address (not needed if |
| String | (optional) Condition transfer fact (not needed if |
Asset
Value | Type | Definition |
| String | Asset standard (e.g. |
| AssetData | Asset data object |
AssetData
Value | Type | Definition |
| String | Quantum value. Required if asset type is |
| String | Token address. Required if asset type is |
| String | Token ID. Required if asset type is |
TransferParams
Value | Type | Definition |
| String | Vault ID |
| String | Stark key. |
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:
Value | Type | Definition |
| String | Sender vault ID |
| String | Receiver vault ID |
| String | Receiver stark key |
| String | Nonce |
| String | Expiration timestamp |
| String | Conditional transfer hash |
| String | Quantum value |
| String | Amount |
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:
Value | Type | Definition |
| String | Sender vault ID |
| String | Receiver vault ID |
| String | Receiver stark key |
| String | Nonce |
| String | Expiration timestamp |
| String | Conditional transfer hash |
| String | ERC20 contract address |
| String | Quantum value |
| String | Amount |
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:
Value | Type | Definition |
| String | Sender vault ID |
| String | Receiver vault ID |
| String | Receiver stark key |
| String | Nonce |
| String | Expiration timestamp |
| String | Conditional transfer hash |
| String | ERC721 contract address |
| String | Token ID |
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:
Value | Type | Definition |
| OrderParams | Sell order params |
| OrderParams | Buy order params. |
| String | Nonce |
| String | Expiration timestamp |
OrderParams
Value | Type | Definition |
| String | Asset standard (e.g. |
| AssetData | Asset data object |
| String | Amount |
| String | Vault ID |
AssetData
Value | Type | Definition |
| String | Quantum value. Required if asset type is |
| String | Token address. Required if asset type is |
| String | Token ID. Required if asset type is |
Returns:
Promise<string>:
Returns a promise with transfer stark signature.
Example
deserializeSignature(signature)
Returns the
r
ands
values of serialized signature.
Arguments:
Value | Type | Definition |
| String | Signature hex string |
Returns:
Promise<{r, s, recoveryParam?}>:
Returns object
Example:
serializeSignature({r, s, recoveryParam?}):string
Returns the serialized signature.
Arguments:
Value | Type | Definition |
| String | Signature |
| String | Signature |
| Number | (optional) Recovery parameter value |
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:
Value | Type | Definition |
| String | Method name (e.g. |
| Object | Array | Object or array containing parameters |
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