This commit is contained in:
2025-09-15 19:57:11 +07:00
parent 67244d9694
commit 271dd70ad7
39 changed files with 19674 additions and 3268 deletions

View File

@@ -1,24 +1,21 @@
import {before, describe, it} from 'node:test'
import {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 testAccount = '0x0AF60B5C1c349744Ef8fa8c4ed78Ee1A0d392Fe9'
const sdk = await getClientForAddress(testAccount)
console.log('Account', sdk.account)
const result = await swapGmxTokensImpl(
sdk,
Ticker.BTC, // fromTicker
Ticker.SOL, // fromTicker
Ticker.USDC, // toTicker
0.000056 // amount
0.001 // amount
)
assert.strictEqual(typeof result, 'string')