Skip to content

feat/refactor - Osmosis Connector Refactor (and Cosmos Chain Support)#559

Open
chesoft wants to merge 11 commits intohummingbot:developmentfrom
pecuniafinance:development
Open

feat/refactor - Osmosis Connector Refactor (and Cosmos Chain Support)#559
chesoft wants to merge 11 commits intohummingbot:developmentfrom
pecuniafinance:development

Conversation

@chesoft
Copy link
Contributor

@chesoft chesoft commented Nov 29, 2025

A description of the changes proposed in the pull request:

Re-adds Osmosis connector and Cosmos chain. Note that all chain routes go through Osmosis/RPC.

One line change required in HBOT main: hummingbot/connector/gateway/common_types.py
class Chain(Enum):

  • COSMOS = ('cosmos', 'ATOM')

Notable changes (required for cosmjs support):

1/2
tsconfig.json
"target": "ESNext",
"module": "nodenext",
"isolatedModules": true,
"moduleResolution": "nodenext",

For the rest of the project, the only change the above requires is using full relative imports when calling import() within functions eg.
const { quoteSwap } = await import('./quoteSwap.js');
^ Just added ".js" to import string

2/2
For jest, NODE_OPTIONS --experimental-vm-modules (for ESM, added into package.json scripts)

I really tried to find a way to avoid changing these, but cosmjs needs proper ESM support and short of forking cosmjs into my own NPM (again), there's no way to do so. Happy to be shown wrong.

Added packages:

@chain-registry/types @cosmjs/amino @cosmjs/cosmwasm-stargate @osmonauts/math @osmonauts/utils @cosmjs/tendermint-rpc @cosmjs/stargate @cosmjs/encoding @cosmjs/proto-signing@0.32.3 osmojs osmo-query @cosmjs/cosmwasm-stargate bignumber.js

Tests performed by the developer:

Full end to end tests on all functions, plus mocked tests using generated JSON. See attached file (apparently .ts not supported so added into zip)
osmosis.testnojest.zip

Tips for QA testing:

I added example entries for vscode launch.json into README.md for other poor sods who actually debug stuff.

test:cov requires NODE_OPTIONS --max-old-space-size=16000 or higher.

@chesoft
Copy link
Contributor Author

chesoft commented Nov 30, 2025

Failing check comes from tests-that-aren't-mine. I've retested a clean hummingbot/gateway:development branch and am getting the same, so I'm innocent here.

@fengtality Pinging you here

`Summary of all failing tests
FAIL test/connectors/meteora/meteora-sdk-integration.test.ts
● Meteora SDK v1.7.5 Integration › DLMM Pool Creation › should create DLMM pool instance

Unhandled error. (Error: Unexpected server response: 401

  at ClientRequest.<anonymous> (node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ws/lib/websocket.js:913:7)
  at TLSWrap.onStreamRead (node:internal/stream_base_commons:191:23))
  at emitErrorAndClose (node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ws/lib/websocket.js:1041:13)

FAIL test/connectors/pancakeswap/universal-router.test.ts (24.052 s)
● UniversalRouterService › getQuote › should skip gas estimation during quote phase

thrown: "Exceeded timeout of 10000 ms for a test.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

  60 |     });
  61 |
> 62 |     it('should skip gas estimation during quote phase', async () => {
     |     ^
  63 |       // Gas estimation is skipped during quote phase (returns 0)
  64 |       // Actual estimation happens during execution phase
  65 |       const mockContract = {

  at test/connectors/pancakeswap/universal-router.test.ts:62:5
  at test/connectors/pancakeswap/universal-router.test.ts:42:3
  at Object.<anonymous> (test/connectors/pancakeswap/universal-router.test.ts:15:1)

● UniversalRouterService › quote result structure › should return properly structured quote result

thrown: "Exceeded timeout of 10000 ms for a test.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

  100 |
  101 |   describe('quote result structure', () => {
> 102 |     it('should return properly structured quote result', async () => {
      |     ^
  103 |       const amount = CurrencyAmount.fromRawAmount(WBNB, '1000000000000000000');
  104 |       const options = {
  105 |         slippageTolerance: new Percent(1, 100),

  at test/connectors/pancakeswap/universal-router.test.ts:102:5
  at test/connectors/pancakeswap/universal-router.test.ts:101:3
  at Object.<anonymous> (test/connectors/pancakeswap/universal-router.test.ts:15:1)`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant