ckb-cell / rgbpp-sdk

Utilities for Bitcoin and RGB++ asset integration
ISC License
53 stars 16 forks source link

refactor(service|btc): use org mempool api #138

Closed ShookLyngs closed 4 months ago

ShookLyngs commented 4 months ago

Changes

  1. Use cell.mempool.space as the Mempool API hostname
  2. Allow some btc/service tests to retry more times: 3 -> 5 times
  3. Updated some tests to prevent using the Mempool API too much
ShookLyngs commented 4 months ago

The 503 error still exists after the changes, it may require more effort to resolve the issue. I also updated some tests to avoid accessing the Mempool API, or just give it more tries when failed.

ahonn commented 4 months ago

Maybe you can consider using https://vitest.dev/guide/mocking.html#modules to mock @mempool/mempool.js, and then wait for the Assets API https://github.com/ckb-cell/btc-assets-api/pull/96.

vi.mock('@mempool/mempool.js', async (importOriginal) => {
  const Mempool = importOriginal('@mempool/mempool.js')
  return (config) => {
    const mempool = Mempool(config);
    mempool.bitcoin.fees.getFeesRecommended = vi.fn().mockResolvedValue({ ... });
    return mempool;
  }
})
ShookLyngs commented 4 months ago

Closing the PR, the PR can be replaced by #148 because it's a more reliable update.