createListing

Import

import { createListing } from '@arkproject/core'

Usage

import { createListing } from '@arkproject/core'
import { config, parameters } from './config'

await createListing(config, {
  starknetAccount: '0x0...',
  order: {
    brokerId: '0x...',
    tokenAddress: '0x0...',
    tokenId: BigInt(1),
    startAmount: BigInt(1000),
  },
  approveInfo: {
    tokenAddress: '0x0...',
    tokenId: BigInt(1),
  },
})

Parameters

starknetAccount

AccountInterface

The Starknet account used for the transaction.

order

ListingV1

The base order details for the listing, includes:

  • orderHash: bigint
  • tokenAddress: string
  • tokenId: bigint
  • brokerId: string

approveInfo

ApproveErc721Info

Informations about the ERC721 token to approve, includes :

  • tokenAddress: string
  • tokenId: bigint

Function Description

createListing starts by extracting details from the provided parameters, including Starknet account, Arkchain account, base order, and an optional owner. It then sets default values for unspecified fields in the order, retrieves the chain ID, and constructs a complete OrderV1 object. The function then calls internal function createOrder to compile, sign, and execute the transaction. Finally, it returns the hash of the created order, encapsulated in a promise.