{"id":17922219,"url":"https://github.com/gre4ixin/exchanger","last_synced_at":"2025-04-03T08:43:51.712Z","repository":{"id":61807409,"uuid":"522891862","full_name":"gre4ixin/Exchanger","owner":"gre4ixin","description":null,"archived":false,"fork":false,"pushed_at":"2022-10-21T14:00:57.000Z","size":127,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T20:18:17.985Z","etag":null,"topics":["1inch-api","blockchain","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/gre4ixin.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-08-09T09:53:15.000Z","updated_at":"2022-09-04T19:17:31.000Z","dependencies_parsed_at":"2022-10-21T14:45:19.590Z","dependency_job_id":null,"html_url":"https://github.com/gre4ixin/Exchanger","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gre4ixin%2FExchanger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gre4ixin%2FExchanger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gre4ixin%2FExchanger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gre4ixin%2FExchanger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gre4ixin","download_url":"https://codeload.github.com/gre4ixin/Exchanger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246970349,"owners_count":20862508,"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":["1inch-api","blockchain","swift"],"created_at":"2024-10-28T20:38:14.061Z","updated_at":"2025-04-03T08:43:51.675Z","avatar_url":"https://github.com/gre4ixin.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Exchange\n\n1Inch exchange api wrapper with async/await swift.\n\n```swift\nlet exchangeFacade: ExchangeFacade = ExchangeService()\n\n// Get tokens info\nTask { \n    let tokens = await exchangeFacade.tokens(blockchain: .polygon)\n    switch tokens {\n    case .success(let tokensDTO):\n        dto.tokens.forEach {\n            print($0.value)\n        }\n    case .failure(let error):\n        print(error.localizedDescription)\n    }\n}\n\n// Generation swap data\nTask { \n    let amount = 1_000_000_000_000_000_000\n    let fromAddress = \"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\"\n    let toAddress = \"0x8f3cf7ad23cd3cadbd9735aff958023239c6a063\"\n    let walletAddress = \"0x**...\" //Your wallet address\n    \n    let response = await exchange.swap(blockchain: .polygon,\n                                       parameters: SwapParameters(fromTokenAddress: fromAddress,\n                                                                  toTokenAddress: toAddress,\n                                                                  amount: \"\\(amount)\",\n                                                                  fromAddress: walletAddress,\n                                                                  slippage: 1))\n    switch response {\n    case .success(let dto):\n        print(dto.tx.data) // Data for sign and push to blockchain\n    case .failure(let error):\n        print(error)\n    }\n}\n```\n\nSupports **Ethereum**, **Binance smart chain**, **Polygon**, **Optimism**, **Arbitrum**, **Gnosis**, **Avalanche**, **Fantom**, **Klayth**, **Aurora**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgre4ixin%2Fexchanger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgre4ixin%2Fexchanger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgre4ixin%2Fexchanger/lists"}