Giter Club home page Giter Club logo

iotex-antenna-swift's Introduction

iotex-antenna-swift

LICENSE

iotex-antenna-swift is our SDK allowing you to interact with a local or remote iotex blockchain node, using gRPC connection. IoTeX is building the next generation of the decentralized network for IoT powered by scalability- and privacy-centric blockchains. Please refer to IoTeX whitepaper for details.

Developing

Update Proto

mkdir protogen
protoc \
proto/api/api.proto proto/api/read_state.proto proto/rpc/rpc.proto \
proto/types/action.proto proto/types/blockchain.proto proto/types/consensus.proto \
proto/types/election.proto proto/types/endorsement.proto proto/types/genesis.proto \
proto/types/node.proto proto/types/receiptstatus.proto proto/types/state_data.proto \
proto/types/transaction_log.proto \
--swift_opt=Visibility=Public \
--swift_out=protogen \
--swiftgrpc_out=Visibility=Public,Client=true,Server=false:./protogen
find protogen -name "*.swift" -exec mv {} Sources/Protogen \;
rm -rf protogen

Install

pod 'iotex-antenna-swift', '~> 0.2.1'
pod 'iotex-antenna-swift', :git => 'https://github.com/iotexproject/iotex-antenna-swift.git', :tag => '0.2.1'

Sample

// create account from private key
let account = try Account(privateKey: "0806c458b262edd333a191e92f561aff338211ee3e18ab315a074a2d82aa343f")
let iotx = try IOTX(provider: "api.testnet.iotex.one:443", secure: true, chainID: 2)

// query account meta
let response = try iotx.currentProvider().getAccount(Iotexapi_GetAccountRequest.with {
    $0.address = account.address
})
print(response)

// transfer IOTX
let hash = try iotx.transfer(TransferRequest(
    nonce: nil, gasLimit: 100000, gasPrice: "10000000000000", account: account,
    recipient: "io13zt8sznez2pf0q0hqdz2hyl938wak2fsjgdeml", amount: "1000000000000000000", payload: "".data(using: .utf8)!
))
print(hash)

iotex-antenna-swift's People

Contributors

ququzone avatar guoxiaopang avatar zhangliugang avatar zanyfly avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.