import {test} from 'node:test'
import assert from 'node:assert'
import {getClientForAddress, openGmxPositionImpl} from '../../src/plugins/custom/gmx'
import {Ticker, TradeDirection} from '../../src/generated/ManagingApiTypes'

test('GMX Position Opening', async (t) => {
  await t.test('should open a long position for BTC', async () => {
    const sdk = await getClientForAddress('0x0b4A132cb6ed8fa66953bf61a53D0B91DaCaAd78')

    const result = await openGmxPositionImpl(
      sdk,
      Ticker.BTC,
      TradeDirection.Long,
      0.00009129924572776991,
      2,
      111350,
      110000,
      114000
    )
    console.log('Position opening result:', result)
    assert.ok(result, 'Position opening result should be defined')
  })
})

