{"id":18956489,"url":"https://github.com/ankitboghra/openapi-watchgod-merger","last_synced_at":"2026-05-09T09:43:02.292Z","repository":{"id":38307318,"uuid":"444398200","full_name":"ankitboghra/openapi-watchgod-merger","owner":"ankitboghra","description":"Merge OpenAPI and Watchgod responses to track latest status of a deposit/withdraw transaction on Ethereum Chain and Polygon Chain.","archived":false,"fork":false,"pushed_at":"2022-06-07T13:48:55.000Z","size":79,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T19:56:06.468Z","etag":null,"topics":["ethereum","openapi","polygon","watchgod","web3"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ankitboghra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-04T11:44:21.000Z","updated_at":"2022-02-03T18:33:29.000Z","dependencies_parsed_at":"2022-09-15T18:00:37.552Z","dependency_job_id":null,"html_url":"https://github.com/ankitboghra/openapi-watchgod-merger","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitboghra%2Fopenapi-watchgod-merger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitboghra%2Fopenapi-watchgod-merger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitboghra%2Fopenapi-watchgod-merger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitboghra%2Fopenapi-watchgod-merger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ankitboghra","download_url":"https://codeload.github.com/ankitboghra/openapi-watchgod-merger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239954469,"owners_count":19724247,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ethereum","openapi","polygon","watchgod","web3"],"created_at":"2024-11-08T13:52:38.412Z","updated_at":"2026-03-31T13:30:17.518Z","avatar_url":"https://github.com/ankitboghra.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# openapi-watchgod-merger\n\nMerge OpenAPI and Watchgod responses to track latest status of a deposit/withdraw transaction on Ethereum Chain and Polygon Chain.\n\n## Usage\n\n### Installation\n\n```\nnpm i openapi-watchgod-merger\n```\n\n```js script\nimport openapiWatchgodMerge from openapi-watchgod-merger\n\n// Folllowing variables represent data\n// from OpenAPI and Watchgod API\nconst openApiDepositResponse = []\nconst openApiWithdrawResponse = []\nconst openApiBurnResponse = []\nconst watchGodResponse = []\n\n// below given function expects all 4 arguments\n// and in same order\nconst mergedData = openapiWatchgodMerge(\n    openApiDepositResponse,\n    openApiWithdrawResponse,\n    openApiBurnResponse,\n    watchGodResponse\n);\n```\n\n## Detailed Explanation\n\nFor now, it is not giving out exact intelligent status of a transaction. It just merges all related transactions into one and appends some additional information based on below given priority.\n\nA merged transaction will have all the undisturbed response with some additional fields added.\n\n\u003e NOTE: All fields added by this library starts with an underscore(e.g. `_latestStatus`)\n\n## Deposits\n\nDeposit transactions can be tracked via 2 places with below mentioned priorities\n\n### Priority for Deposit Txs(Highest to Lowest)\n\n- OpenAPI\n- Watchgod\n\n### Additional fields\n\n- `_txType`\n- `_txSource`\n- `_openapiTxStatus`\n- `_watchgodTxStatus`\n- `_latestStatus`\n\n## Withdraw\n\nWithdraw transactions consists of 2 parts(i.e. withdraw init/burn and exit). Withdraw transactions can be tracked via 2 places with below mentioned priorities\n\n### Priority for Withdraw+Exit Txs(Highest to Lowest)\n\n- OpenAPI Exit\n- Watchgod Exit\n- OpenAPI Withdraw\n- Watchgod Withdraw\n\n### Additional fields\n\n- `_txType`\n- `_txSource`\n- `_burnTxHash`\n- `_exitTxHash`\n- `_openapiExitTxStatus`\n- `_watchgodExitTxStatus`\n- `_openapiBurnTxStatus`\n- `_watchgodBurnTxStatus`\n- `_latestStatus`\n\n## Interface\n\nSince different APIs uses their own names for naming a variable(e.g. openapi:`transactionHash`, watchgod:`hash`), to avoid juggling between 2 naming conventions we will be parsing some common variable names.\n\n### Interface\n\n```\namount\nblockNumber\ndata\nfrom\nnetwork\nrootToken\ntimestamp\nto\ntxBurnHash\ntxHash\ntxStatus\ntxType\n_txSource\n_txType\n_depositTxHash\n_burnTxHash\n_exitTxHash\n_openapiExitTxStatus\n_watchgodExitTxStatus\n_openapiBurnTxStatus\n_watchgodBurnTxStatus\n_latestStatus\n```\n\nIf required, to parse and unparse you can use the util methods provided by this library.\n\n- `convertOpenapiToInterface(openapiTx)`\n- `convertWatchgodToInterface(watchgodTx)`\n- `(watchgodTx)`\n\n### Usage\n\n```js script\nimport {\n  convertOpenapiToInterface,\n  convertWatchgodToInterface,\n  convertInterfaceToWatchgod,\n} from \"openapi-watchgod-merger\";\n\nconst openapiTx = {\n  /*...*/\n};\nconst watchgodTx = {\n  /*...*/\n};\n\nconst parsedOpenapiTx = convertOpenapiToInterface(openapiTx);\nconst parsedWatchgodTx = convertWatchgodToInterface(openapiTx);\n\nconst unparsedWatchgodTx = convertInterfaceToWatchgod(parsedWatchgodTx);\n```\n\n\u003e Note: `convertInterfaceToWatchgod` will still have the additional fields added by library\n\n### OpenAPI mapping\n\n| OpenAPI               | Interface    |\n| --------------------- | ------------ |\n| `transactionHash`     | `txHash`     |\n| `transactionStatus`   | `txStatus`   |\n| `depositor`           | `from`       |\n| `isPos`               | `isPoS`      |\n| `burnTransactionHash` | `txBurnHash` |\n\n### Watchgod mapping\n\n| Watchgod       | Interface    |\n| -------------- | ------------ |\n| `hash`         | `txHash`     |\n| `status`       | `txStatus`   |\n| `isPos`        | `isPoS`      |\n| `prevBurnHash` | `txBurnHash` |\n\n## Other helpful constants\n\nConstants can also be imported for use\n\n- `TX_SOURCE` can be used with `_txSource`\n- `TX_TYPE` can be used with `_txType`\n\n```js script\nimport { TX_SOURCE, TX_TYPE } from \"openapi-watchgod-merger\";\n\nconst depositTxs = (mergedTransactions) =\u003e\n  mergedTransactions.filter((tx) =\u003e TX_TYPE.DEPOSIT === tx._txType);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankitboghra%2Fopenapi-watchgod-merger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankitboghra%2Fopenapi-watchgod-merger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankitboghra%2Fopenapi-watchgod-merger/lists"}