{"id":13453453,"url":"https://github.com/memtrip/eos-swift","last_synced_at":"2026-02-22T15:38:38.483Z","repository":{"id":56931986,"uuid":"163288840","full_name":"memtrip/eos-swift","owner":"memtrip","description":"EOS libraries for Swift, designed primarily for iOS development.","archived":false,"fork":false,"pushed_at":"2020-03-11T19:25:49.000Z","size":309,"stargazers_count":20,"open_issues_count":3,"forks_count":18,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-02T00:21:29.185Z","etag":null,"topics":["eos","eos-swift","eosio","ios","swift"],"latest_commit_sha":null,"homepage":"http://www.memtrip.com","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/memtrip.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":"2018-12-27T11:55:04.000Z","updated_at":"2023-08-12T05:30:33.000Z","dependencies_parsed_at":"2022-08-21T05:50:36.528Z","dependency_job_id":null,"html_url":"https://github.com/memtrip/eos-swift","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/memtrip%2Feos-swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/memtrip%2Feos-swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/memtrip%2Feos-swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/memtrip%2Feos-swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/memtrip","download_url":"https://codeload.github.com/memtrip/eos-swift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245194237,"owners_count":20575726,"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":["eos","eos-swift","eosio","ios","swift"],"created_at":"2024-07-31T08:00:40.211Z","updated_at":"2025-10-23T10:40:45.443Z","avatar_url":"https://github.com/memtrip.png","language":"Swift","funding_links":[],"categories":["Language Support"],"sub_categories":["Swift"],"readme":"# eos-swift\nEOS libraries for swift, designed primarily for iOS development.\n\n## Install with CocoaPods\nTested with pod --version: 1.5.3\n```ruby\nuse_frameworks!\n\ntarget 'YOUR_TARGET_NAME' do\n  pod 'eosswift', '1.5'\nend\n```\nReplace YOUR_TARGET_NAME and then, in the Podfile directory, type:\n```\npod install\n```\n\n### Getting started\nThe `eosswiftTests` directory contains a full suite of integration tests, explore these\ntests to quickly gauge what functionality is provided by the SDK.\n- `eos-chain-actions` tests the highest level of abstraction; pushing transactions composed of actions.\n- `eos-http-rpc` tests the interaction with nodeos HTTP RPC api.\n- `eos-abi-writer` tests the building of local abi bytes\n\n## eos-core\nThe core module contains the core building blocks required to interact with the EOS network.\n\n### Key pairs\nEOS keypairs are generated using the [micro-ecc](https://github.com/kmackay/micro-ecc) lib.\n\nCreate a new keypair:\n```swift\n// new key pair\nlet eosPrivateKey = try! EOSPrivateKey()\nlet eosPublicKey = eosPrivateKey.publicKey\n\n// private key from encoded string\nlet privKey1 = try! EOSPrivateKey(base58: \"5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3\")\n\n// private key from bytes\nlet privKey2 = try! EOSPrivateKey(ecKeyPrivateKey: ECPrivateKey(privKeyData: eosPrivateKey.bytes()))\n```\n\n### Sign bytes with a private key\nWhen a transaction is pushed to the EOS network, the packed transaction bytes must be\nsigned by an EOS private key.\n```swift\nlet bytesToSign = imaginaryAbi.toData()\nlet privateKey = try! EOSPrivateKey()\nlet signature = PrivateKeySigning().sign(digest: bytesToSign, eosPrivateKey: privateKey)\n```\n\n### Block Id details\nExtract the block number and prefix from a block id.\n```swift\nlet blockIdDetails = BlockIdDetails(blockId: \"0000000ac7619ca01df1e0b4964921020e772ceb7343ec51f65537cdbce192d3\")\nlet blockNum = blockIdDetails.blockNum\nlet blockPrefix = blockIdDetails.blockPrefix\n```\n\n## eos-abi-writer\nA local replacement of abi_json_to_bin, the `Encodable` protocol is used with reflection to write struct\nvalues to a byte array.\n\n### Model\nByte writer models are structs that adopt the `Encodable` protocol, the type of the member variable\nis used to determine how the data will be written to the byte array. For more complex types a derivative\nof `AbiTypeWriter` can be used, such as; `AssetWriterValue`, `AccountNameWriter` or `PublicKeyWriter`.\n- [List of complex `AbiTypeWriter` types](https://github.com/memtrip/eos-swift/tree/master/eosswift/eos-abi-writer/types)\n```swift\nstruct TransactionAbi : Encodable {\n    let expiration: TimestampWriterValue\n    let ref_block_num: BlockNumWriterValue\n    let ref_block_prefix: BlockPrefixWriterValue\n    let max_net_usage_words: UInt64\n    let max_cpu_usage_ms: UInt64\n    let delay_sec: UInt64\n    let context_free_actions: [ActionAbi]\n    let actions: [ActionAbi]\n    let transaction_extensions: StringCollectionWriterValue\n}\n```\n\n### Write bytes\nThe `Encodable` protocol has two extension funcs called `toHex()` and `toData()`.\nThe `toData()` function will write the struct values to a byte array. The `toHex()`\nfunction will write the struct values to a byte array and encode the bytes as a hexadecimal string,\nin other words, an `abi_bin`.\n\n```swift\npublic struct TransferArgs : Encodable {\n    let from: AccountNameWriterValue\n    let to: AccountNameWriterValue\n    let quantity: AssetWriterValue\n    let memo: String\n}\n\nlet args = TransferArgs(\n    from: AccountNameWriterValue(name: \"memtripblock\"),\n    to: AccountNameWriterValue(name: \"memtripproxy\"),\n    quantity: AssetWriterValue(asset: \"0.0001 EOS\"),\n    memo: \"memo\"\n)\n\nlet hexValue = args.toHex(AbiEncoder(capacity: 512))\n```\n\n### Examples\nSee the `eos-swiftTests/eos-chain-actions/abihex` test package for abi byte writing examples.\n\n## eos-http-rpc\nA http client used to makes requests to the nodeos RPC HTTP API.\n\n### Factory\nThe http client interfaces can be created using `ChainApiFactory` and `HistoryApiFactory`.\n```swift\nlet chainApi = ChainApiFactory.create(rootUrl: Config.CHAIN_API_BASE_URL)\n```\n\n### ChainApi\nThe `ChainApi` interface contains all the network requests for the `chain/` resource.\ne.g; chain/get_info\n```swift\nchainApi.getInfo().subscribe(onSuccess: { response in\n    let info: Info = response.body!\n}, onError: { error in\n    let httpErrorResponse = error as! HttpErrorResponse\u003cChainError\u003e\n    print(httpErrorResponse.bodyString)\n})\n```\n\nThe `HistoryApi` interface contains all the network requests for the `history/` resource.\ne.g; history/get_transaction\n```swift\nhistoryApi.getTransaction(body: GetTransaction(id: action.action_trace.trx_id)).subscribe(onSuccess: { response in\n     let historicTransaction: HistoricTransaction = response.body!\n }, onError: { error in\n     let httpErrorResponse = error as! HttpErrorResponse\u003cChainError\u003e\n     print(httpErrorResponse.bodyString)\n })\n```\n\n## Credits\n- [Join us on telegram](http://t.me/joinchat/JcIXl0x7wC9cRI5uF_EiQA)\n- [Developed by memtrip.com](http://memtrip.com)\n\n### Vote for memtripblock\nIf you find this SDK useful, please vote for [memtripblock](https://www.memtrip.com/code_of_conduct.html)\nas a block producer. We are committed to open sourcing all the software we develop, let’s build the future of EOS on mobile together!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmemtrip%2Feos-swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmemtrip%2Feos-swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmemtrip%2Feos-swift/lists"}