Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Latest commit

 

History

History

starkware-abi-encoder

starkware-abi-encoder npm version

Starkware ABI Encoder Library

Getting started

import StarkwareAbiEncoder from '@authereum/starkware-abiEncoder'

const abiEncoder = new StarkwareAbiEncoder()

const encodedData = await abiEncoder.registerUser({
  ethKey,
  starkKey,
  operatorSignature,
})

Examples

Deposit calldata:

const encodedData = await abiEncoder.deposit({
  starkKey,
  assetType,
  vaultId,
})

Deposit NFT calldata:

const encodedData = await abiEncoder.depositNft({
  starkKey,
  assetType,
  vaultId,
  tokenId,
})

Deposit cancel calldata:

const encodedData = await abiEncoder.depositCancel({
  starkKey,
  assetType,
  vaultId,
})

Withdraw calldata:

const encodedData = await abiEncoder.withdrawTo({
  starkKey,
  assetType,
  recipient,
})

Transfer message hash:

const messageHash = await abiEncoder.transfer({
  quantizedAmount,
  nonce,
  senderVaultId,
  assetId,
  targetVaultId,
  targetKey,
  expirationTimestamp,
})

Limit order message hash:

const messageHash = await abiEncoder.createOrder({
  sellVaultId,
  buyVaultId,
  sellQuantizedAmount,
  buyQuantizedAmount,
  sellAssetId,
  buyAssetId,
  nonce,
  expirationTimestamp,
})