Skip to content

swap_incoming.ts example is broken #73

@fwiessner

Description

@fwiessner

The example in swap_incoming.ts seems to be broken.

The script successfully sends HTLT order on binance chain, however, the swapid is never known to https://api.data.kava.io/bep3/swap/ and the script fails at that point:

mrjack@cerebellum:~/dev/binance/kava/example$ node swap_incoming.ts
Secret random number: ac0d10d0004de13078e6bf24e64a8f8adecbeeecc0171c7ec7c2ce0f60067265
Expected Bnbchain swap ID: f9e51c1ec03c5fd689c730356e66858c43067a955b8c6d486eacb56e1033c30e
Expected Kava swap ID: 4b959a0f822b5bdb1e42ef2488cb6efbe35bdb81b3283f6f67c4aa793cb0943d

Create swap tx hash (Binance Chain):  27B4B489EC576647E71B43570CDB3B97C68B3A1EA4A448E66819196AFBCD2E07
Waiting for deputy to witness and relay the swap...
(node:4155415) UnhandledPromiseRejectionWarning: Error: Max retries reached:
    error: Error: Request failed with status code 500
    at retry (/home/mrjack/dev/binance/kava/lib/tx/index.js:65:19)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Object.getTx (/home/mrjack/dev/binance/kava/lib/tx/index.js:23:16)
    at async KavaClient.getSwap (/home/mrjack/dev/binance/kava/lib/client/index.js:680:21)
    at async incomingSwap (/home/mrjack/dev/binance/kava/example/swap_incoming.ts:96:3)
    at async main (/home/mrjack/dev/binance/kava/example/swap_incoming.ts:10:3)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:4155415) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
(node:4155415) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.


the function failing is:

await kavaClient.getSwap(expectedKavaSwapID);

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions