Add claim test + fix unlisted markets

This commit is contained in:
2025-06-10 18:24:06 +07:00
parent 154755ec8f
commit 5188b5faec
8 changed files with 289 additions and 4 deletions

View File

@@ -0,0 +1,32 @@
import {before, describe, it} from 'node:test'
import assert from 'node:assert'
import {getClientForAddress, swapGmxTokensImpl} from '../../src/plugins/custom/gmx.js'
import {Ticker} from '../../src/generated/ManagingApiTypes'
describe('swap tokens implementation', () => {
let sdk: any
before(async () => {
// Initialize the SDK with a test account
const testAccount = '0xbba4eaa534cbd0ecaed5e2fd6036aec2e7ee309f'
sdk = await getClientForAddress(testAccount)
})
it('should swap USDC to ETH successfully', async () => {
try {
const result = await swapGmxTokensImpl(
sdk,
Ticker.GMX, // fromTicker
Ticker.USDC, // toTicker
2.06 // amount
)
assert.strictEqual(typeof result, 'string')
assert.strictEqual(result, 'swap_order_created')
} catch (error) {
// Test that the error is related to actual execution rather than parameter validation
assert.ok(error instanceof Error)
console.log('Expected error during test execution:', error.message)
}
})
})