.orders
Provides methods to manage orders within the Northstake system. This includes creating new orders, retrieving order details, cancelling orders, and listing all orders.
cancelOrderById(id: string)**:
Cancels a submitted order
const orderId= 'eaed56eb-0913-4893-9890-f81f49e475f0'
await api.orders.cancelOrderById(orderId)
createNewOrder({orderType:OrderTypeEnum.Stake, asset: string, amount: number, targetWallet: string })**:
Create a new order
const newOrder: Order = {
orderType: 'stake',
asset: 'ETH',
amount: 32,
}
const {body:order} = await api.orders.createNewOrder(newOrder)
console.log(`New ${newOrder.orderType} order id: ${order.orderId}`)
See these recipes to learn more about creating orders via the Northstake SDK
๐๏ธ
Depositing and staking an asset
Open Recipe
๐๏ธ
Staking ETH with own/pregenerated validator key
Open Recipe
getOrderDetailsById(id:string)**:
Get order details by order ID
const orderId = '2134-4321-3345-34222'
const {body:orderDetails} = await api.orders.getOrderDetailsById(orderId)
console.log(`
Order details:
id: ${orderDetails.orderId}
type: ${orderDetails.type}
asset: ${orderDetails.token}
amount: ${orderDetails.amount}
status: ${order.status}
`)
listAllOrders()**:
Get a list of all orders
const {body:orders} = await api.orders.listAllOrders()
for (const order of orders) {
console.log(`
Order details:
id: ${order.orderId}
type: ${order.type}
asset: ${order.token}
amount: ${order.amount}
status: ${order.status}
`)
Updated 5 months ago