Loopring Dev Docs
  • Introduction
  • Endpoints
  • SDK
    • SDK Guides
    • Test Mock Data
      • Mock Account
      • Mock provider
      • Mock ERC20 Token Map
      • Mock AMM MAP
      • Mock EIP712 Typed Data
      • Mock Generate eddsaKey
  • Glossary
  • 🗳️Loopring Account
    • Introduction
    • SDK Guides
      • Setup a Loopring Account
      • Unlock Account (Login)
    • API References
      • Get Account info
        • Sample code
      • Update EddsaKey
        • Sample code
      • Get apiKey
        • Sample code
      • Update apiKey
        • Sample code
  • 🎨CounterFactual NFT
    • Introduction
      • Compute NFT Address API
      • When to deploy counterfactual NFT contracts?
    • SDK Guides
      • Deposit NFT
      • Create Collection
      • Mint Counterfactual NFT
      • Transfer NFT
      • Deploy NFT
      • Withdraw NFT
      • Trade NFT
        • Validate NFT Order
      • Meta & IPFS
    • API References
      • NFT Collection
        • Create collection
          • Sample code
        • Edit collection
          • Sample code
        • Delete collection
          • Sample code
        • List owned collections
          • Sample code
        • List user's NFTs under one collection
          • Sample code
        • List user's NFT balances group by Collection ID
          • Sample code
        • List all NFTs of a collection
          • Sample code
        • Get collection by Collection ID
          • Sample code
        • Get collections by contract address
          • Sample code
      • Get NFT Assets
        • Sample code
      • Get NFT Balances
        • Sample code
      • Mint NFT
        • Sample code
      • Transfer NFT
        • Sample code
      • Validate NFT Order
        • Sample code
      • Trade NFT
        • Sample code
      • Deploy NFT TokenAddress
        • Sample code
      • Withdraw NFT
        • Sample code
      • Get NFT Transactions
        • Sample code
      • Get NFT Trade History
        • Sample code
      • Get AvailableBroker
        • Sample code
      • Get NFT Info
        • Sample code
      • Get NFT Data
        • Sample code
      • Get NFT Holders
        • Sample code
  • 🪙ERC20 Tokens
    • Introduction
    • SDK Guides
      • Transfer ERC20
      • Withdraw ERC20
      • Deposit ERC20
      • Order ERC20
    • API References
      • Get Assets
        • Sample code
      • Transfer
        • Sample code
      • Submit Order
        • Sample code
      • Cancel Order
        • Sample code
      • Withdraw
        • Sample code
      • Get Transactions
        • Sample code
      • Get Orders
        • Sample code
      • Get Trade History
        • Sample code
  • 🔬Resources
    • Advanced
      • UpdateAccount with custom seed
      • Pay payee updateAccount fee
      • Common error and solutions
      • Submit erc20 order
    • Common Info
      • Get relayer current time
        • Sample code
      • Get exchange info
        • Sample code
      • Get token info
        • Sample code
      • Get markets info
        • Sample code
    • Error codes
    • Fees
      • GET ERC20 Offchain Fee
        • Sample code
      • GET ERC20 Order Fee
        • Sample code
      • GET NFT Offchain Fee
        • Sample code
      • GET NFT Order Fee
        • Sample code
      • SDK Fees
    • Layer 2 block info
      • Get pending transactions
    • Request signing
      • Special API Request Signatures
      • Off-chain Request Signatures
      • Extra ECDSA authentic in header
    • Signature
      • ECDSA signature
        • ECDSA key generation
        • ECDSA sign
        • ECDSA verify signature
      • EdDSA signature
        • EdDSA key generation
        • EdDSA sign
        • EdDSA verify signature
      • SDK Signature
        • Mock Signature
    • Smart Contracts
    • Storage Id
      • Sample code
    • WebSocket
      • Account Notification
      • Order Notification
      • Orderbook Notification
      • Trade Notification
      • Ticker Notification
      • Candlestick Notification
      • AMM Pool Snapshot Notification
      • Block Generation Notification
    • Loopring Smart Wallet
      • Signature and verification
Powered by GitBook
On this page
  • EndPoint
  • Header
  • Request
  • Response
  • Model
  • TokenVolume
  • Compute EdDSA hash

Was this helpful?

  1. ERC20 Tokens
  2. API References

Submit Order

Place an order

EndPoint

POST api/v3/order

Header

Field
Description
Example

X-API-KEY

ApiKey

"HlkcGxbqBeaF76j4rvPaOasyfPwnkQ6B6DQ6THZWbvrAGxzEdulXQvOKLrRWZLnN"

Request

Query Param
Description
Example

exchange

accountId

account ID

sellToken

buyToken

storageId

2

validUntil

Timestamp for order to become invalid, seconds

normally current time + 2 months

maxFeeBips

Maximum order fee that the user can accept, value range (in ten thousandths) 1 ~ 5000

10(means 0.1%)

eddsaSignature

fillAmountBOrS

(Optional) Fill size by buy token or by sell token

false

clientOrderId

(Optional) An arbitrary, client-set unique order identifier, max length is 120 bytes

orderType

(Optional) Order types, can be AMM, LIMIT_ORDER, MAKER_ONLY or TAKER_ONLY default is LIMIT_ORDER. If it's AMM, orderType will set to TAKER_ONLY and tradeChannel will set to MIXED

"LIMIT_ORDER"

tradeChannel

(Optional) Order channel, can be ORDER_BOOK, AMM_POOL or MIXED, default is MIXED. If it's AMM_POOL, orderType will set to TAKER_ONLY and tradeChannel will set to MIXED

"MIXED"

poolAddress

(Optional) The AMM pool address if order type is AMM

affiliate

(Optional) An accountID who will receive a share of the fee of this order at the end of monthly distribution. Need contact us to add the accountId in whitelist.

10110

extraOrderType

(Optional) extra type, default is "TRADITIONAL_ORDER", can be "STOP_LIMIT"

STOP_LIMIT

stopPrice

(Optional) stop price

"0.36"

stopSide

(Optional) can be "GREAT_THAN_AND_EQUAL", "LESS_THAN_AND_EQUAL"

"GREAT_THAN_AND_EQUAL"

Response

Field
Description
Example

hash

The hash identifier set by the user at the time of submission, can use this hash to get the order info

"0x1d923ca7834dc90484fa2eb611f0f0bc7e741bb107007ebea19ba8caeab4f9d3"

clientOrderId

The clientOrderId of the submitted order

status

Order status of submit order response Allowable : ['processing', 'processed', 'cancelling', 'cancelled', 'expired', 'failed']

"processing"

isIdempotent

Idempotent of submit transfer response, submit same transfer again idempotent will be true

"false"

Model

TokenVolume

Wrapper object used to describe a token associated with a certain quantity.

Field
Description
Example

tokenId

The Loopring's token identifier.

0

volume

The volume of the token

"100000000000 0"

Compute EdDSA hash

const inputs = [
      orderRequest.exchange,
      orderRequest.storageId,
      orderRequest.accountId,
      orderRequest.sellToken.tokenId,
      orderRequest.buyToken.tokenId,
      orderRequest.sellToken.volume,
      orderRequest.buyToken.volume,
      orderRequest.validUntil,
      orderRequest.maxFeeBips,
      orderRequest.fillAmountBOrS ? 1 : 0,
      orderRequest.taker,
    ];
const hasher = Poseidon.createHash(inputs.length + 1, 6, 53);
const hash = hasher(inputs).toString(10);
PreviousSample codeNextSample code

Last updated 1 year ago

Was this helpful?

exchangeAddress in

,sell tokenId and volume

,buy tokenId and volume

order of , sellTokenId is the tokenId in sellToken

of the

🪙
exchange info
storage Id
tokenVolume
tokenVolume
eddsa signature
eddsa hash