Update SDK (#35)

* Update SDK for swap

* Fix web3proxy build

* Update types

* Fix swap

* Send token test and BASE transfer

* fix cache and hook

* Fix send

* Update health check with uiFeereceiver

* Fix sdk

* Fix get positions

* Fix timeoutloop

* Fix open position

* Fix closes positions

* Review
This commit is contained in:
Oda
2025-09-17 14:28:56 +07:00
committed by GitHub
parent 271dd70ad7
commit cee3902a4d
91 changed files with 21375 additions and 2831 deletions

View File

@@ -1,29 +1,30 @@
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'
import {Ticker} from '../../src/generated/ManagingApiTypes.js'
describe('swap tokens implementation', () => {
it('should swap USDC to ETH successfully', async () => {
it('should swap SOL to USDC successfully', async () => {
try {
const testAccount = '0x0AF60B5C1c349744Ef8fa8c4ed78Ee1A0d392Fe9'
const testAccount = '0xbBA4eaA534cbD0EcAed5E2fD6036Aec2E7eE309f'
const sdk = await getClientForAddress(testAccount)
console.log('Account', sdk.account)
const result = await swapGmxTokensImpl(
sdk,
Ticker.SOL, // fromTicker
Ticker.USDC, // toTicker
0.001 // amount
)
const result = await swapGmxTokensImpl(
sdk,
Ticker.PENDLE,
Ticker.USDC,
13.339559522
)
assert.strictEqual(typeof result, 'string')
assert.strictEqual(result, 'swap_order_created')
} catch (error) {
console.log('error', 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)
assert.fail(error.message)
}
})
})