{"id":23679013,"url":"https://github.com/uxdprotocol/uxd-evm-client","last_synced_at":"2025-06-13T22:03:19.955Z","repository":{"id":37482783,"uuid":"498588968","full_name":"UXDProtocol/uxd-evm-client","owner":"UXDProtocol","description":"UXD EVM client library","archived":false,"fork":false,"pushed_at":"2023-05-02T05:59:59.000Z","size":1058,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-29T16:59:46.948Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/UXDProtocol.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-06-01T04:22:43.000Z","updated_at":"2022-07-12T06:20:13.000Z","dependencies_parsed_at":"2023-02-17T14:01:09.938Z","dependency_job_id":null,"html_url":"https://github.com/UXDProtocol/uxd-evm-client","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UXDProtocol%2Fuxd-evm-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UXDProtocol%2Fuxd-evm-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UXDProtocol%2Fuxd-evm-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UXDProtocol%2Fuxd-evm-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UXDProtocol","download_url":"https://codeload.github.com/UXDProtocol/uxd-evm-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239720690,"owners_count":19686139,"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":[],"created_at":"2024-12-29T16:59:54.813Z","updated_at":"2025-02-19T19:27:18.350Z","avatar_url":"https://github.com/UXDProtocol.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UXD EVM client (v1)\n\nTypescript library for interacting with the UXD contracts on EVM.\n\n\n## To Build\n\n1. Build the package\n```sh\nnpm run build\n```\n\n2. Generate typing files from contract ABIs\n```sh\nsh ./scripts/generate-types.sh\n```\n\n3. Run the linter to properly format typescript files.\n```sh\nnpm run format\n```\n\n## To use\n\n### Install the library\n\n```javascript\nnpm i \"uxd-evm-client@0.2.3\"\n```\n\n### Generation of ethers-contracts types\n\nhttps://github.com/dethcrypto/TypeChain\n\nRun the following command that will generate typing for contracts:\n\n```\n ./scripts/generate-types.sh\n```\n\n### Import library code\n\nYou need to import the UXDController from the library as well as the ethers library\n\n```typescript\nimport { ethers } from \"ethers\";\nimport { UXDClient } from \"uxd-evm-client\";\n```\n\n### Initialize the client\n\nThe client must be initialized with following parameters:\n\n1. JSON RPC provider pointing to the kovan optimism RPC endpoint.\n2. UXD Controller contract address on kovan optimism.\n3. The address of the depository\n4. UXD token on kovan optimism.\n\nThe provider can be injected when using Metamask or other browser wallet\n\n```typescript\nconst controller = \"...\"; // controller address\nconst depository = \"...\"; // depository address\nconst redeemable = \"...\"; // redeemable address\n\nconst provider = new ethers.providers.JsonRpcProvider(\"https://goerli.optimism.io\");\nconst client = new UXDClient({\n  provider, \n  controller, \n  depository\n  redeemable\n});\n```\n\n### Interact with controller contract\n\nYou can then start calling functions on the controller\n\n#### Get UXD total supply\n\n```typescript\nconst controller = client.controller();\nconst totalSupply = await controller.getRedeemableMintCirculatingSupply();\nconsole.log(\"totalsupply = \", totalSupply);\n```\n\n#### Mint UXD with WETH\n\nTo mint with WETH can call the `mint()` function:\n\n```typescript\nawait controller.mint(\n      ethAmount,\n      targetePrice,\n      signer,\n      collateralAddress\n    )\n```\n\n\u003e Note: The controller must be approved to access the users WETH otherwise the call with revert with an error.\n\nTo approve the controller to spend WETH:\n\n```typescript\nawait controller.approveToken(contractAddress, spender, amount, signer);\n```\n\n#### Mint UXD with ETH\n\n```typescript\nawait controller.mintWithEth(ethAmount, targetPrice, signer);\n```\n\nNo prior approval is required to mint with native ETH.\n\n#### Redeem UXD for ETH\n\n```typescript\nawait controller.redeem(wethAddress, uxdAmount, targetPrice, signer);\n```\n\n#### Redeem UXD for ETH\n\n```typescript\nawait controller.redeemEth(uxdAmount, targetPrice, signer);\n```\n\nCheck [here](https://github.com/UXDProtocol/uxd-evm-client/blob/main/src/lib/controller.ts) to see the list of public functions availale on the controller.\n\n### Version\n\nVersion 1.0.0 has been unpublished.\nCurrent version are tagged as beta 0.0.1-beta.X\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuxdprotocol%2Fuxd-evm-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuxdprotocol%2Fuxd-evm-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuxdprotocol%2Fuxd-evm-client/lists"}