Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1 from garyyu/2.0.2-beta.2
Browse files Browse the repository at this point in the history
Relay address query by short 6-code abbreviation/suffix
  • Loading branch information
garyyu authored Aug 17, 2019
2 parents 7b0f22a + 55625d1 commit dc0cb00
Show file tree
Hide file tree
Showing 7 changed files with 431 additions and 305 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ cache:
cargo: true
timeout: 240
directories:
- "$HOME/.cargo" - "$TRAVIS_BUILD_DIR/rust/target"
- "$HOME/.cargo"
- "$TRAVIS_BUILD_DIR/rust/target"

env:
global:
- RUST_BACKTRACE="1"
- RUSTFLAGS="-C debug-assertions"
- OPENSSL_DIR="/usr/local/opt/openssl"

matrix:
include:
Expand Down
82 changes: 39 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,39 @@
# cocoa_grinwallet
IOS Grin Wallet Pod

## How to import this pod

Add one line into your `Podfile`:
```Bash
pod 'cocoa_grinwallet', :git => 'https://github.com/gottstech/cocoa_grinwallet.git', :tag => 'v1.0.4'
```
then run `pod install`

After the pod installation, remember to manually download the libraries to avoid a long building procedure. The libraries can be found in the [release](https://github.com/gottstech/cocoa_grinwallet/releases) page of this repo.

<details>
<summary>download script</summary>

```Bash
#!/bin/bash

version=`grep " pod 'cocoa_grinwallet'" Podfile | sed "s/.*:tag => '\(.*\)'/\1/"`

mkdir -p Pods/cocoa_grinwallet/cocoa_grinwallet/Library && cd Pods/cocoa_grinwallet/cocoa_grinwallet/Library && rm -f libgrinwallet* || exit 1

wget https://github.com/gottstech/cocoa_grinwallet/releases/download/${version}/libgrinwallet_aarch64-apple-ios.a || exit 1

wget https://github.com/gottstech/cocoa_grinwallet/releases/download/${version}/libgrinwallet_armv7s-apple-ios.a || exit 1

wget https://github.com/gottstech/cocoa_grinwallet/releases/download/${version}/libgrinwallet_x86_64-apple-ios.a || exit 1

printf "3 libs have been downloaded successfully\n"

cd - > /dev/null || exit 1
ls -l Pods/cocoa_grinwallet/cocoa_grinwallet/Library
```
</details>

## Build
### Set up the environment

Expand Down Expand Up @@ -33,65 +66,28 @@ cargo install cargo-lipo
```Bash
git clone --recursive https://github.com/gottstech/cocoa_grinwallet.git
cd cocoa_grinwallet/rust
export OPENSSL_DIR="/usr/local/opt/openssl"
cargo lipo --release --targets aarch64-apple-ios,x86_64-apple-ios,armv7s-apple-ios
./copy_libs.sh
```

Note:
- The generated libs are in `Library/` folder.
- If don't have openssl installed, please run:
- For Mac: `brew install openssl`
- For Linux: `sudo apt install libssl-dev`

### On IOS Application Side

Add the following 2 lines into your `Podfile`:
```Bash
pod 'cocoa_grinwallet', :git => 'https://github.com/gottstech/cocoa_grinwallet.git', :tag => 'v1.0.3'
pod 'OpenSSL', '~> 1.0'
```
then run `pod install`

If you have problem for OpenSSL pod installation, please refer to [this post](https://stackoverflow.com/a/57196786/3831478) to solve it.

After the pod installation, remember to manually download the libraries to avoid a long building procedure. The libraries can be found in the [release](https://github.com/gottstech/cocoa_grinwallet/releases) page of this repo.

<details>
<summary>download script</summary>

```Bash
#!/bin/bash

version=`grep " pod 'cocoa_grinwallet'" Podfile | sed "s/.*:tag => '\(.*\)'/\1/"`

mkdir -p Pods/cocoa_grinwallet/cocoa_grinwallet/Library && cd Pods/cocoa_grinwallet/cocoa_grinwallet/Library && rm -f libgrinwallet* || exit 1

wget https://github.com/gottstech/cocoa_grinwallet/releases/download/${version}/libgrinwallet_aarch64-apple-ios.a || exit 1

wget https://github.com/gottstech/cocoa_grinwallet/releases/download/${version}/libgrinwallet_armv7s-apple-ios.a || exit 1

wget https://github.com/gottstech/cocoa_grinwallet/releases/download/${version}/libgrinwallet_x86_64-apple-ios.a || exit 1

printf "3 libs have been downloaded successfully\n"

cd - > /dev/null || exit 1
ls -l Pods/cocoa_grinwallet/cocoa_grinwallet/Library
```
</details>

- The generated libs are in `Library/` folder.

## Document

https://github.com/gottstech/cocoa_grinwallet/wiki

- [[Grin Wallet Cocoa API Guide|Grin-Wallet-Cocoa-API-Guide]]
- [Wallet Address Specification](https://github.com/gigglewallet/grinrelay/wiki/Bech32-Grin-Relay-Address)
- [Wallet Transaction Security on Grin Relay](https://github.com/gigglewallet/grinrelay/wiki/GrinRelay-Security-Specification)

## License

Apache License v2.0.

## Credits

The code was using the [Ironbelly](https://github.com/cyclefortytwo/ironbelly) as the reference.
The code was using the [Ironbelly](https://github.com/cyclefortytwo/ironbelly) as the initial reference.

The related code taken with thanks and respect, with license details in all derived source files.

Expand Down
2 changes: 1 addition & 1 deletion cocoa_grinwallet.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'cocoa_grinwallet'
s.version = '1.0.3'
s.version = '1.0.4'
s.summary = 'Grin Wallet IOS Libs. With embedded Grin Relay service.'

# This description is used to generate tags and improve search results.
Expand Down
20 changes: 19 additions & 1 deletion cocoa_grinwallet/Classes/grinwallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,24 @@

void cstr_free(const char *s);

const char* select_nearest_node(
const char* check_node_api_http_addr,
uint8_t *error
);

const char* grin_check_password(
const char* json_cfg,
const char* password,
uint8_t *error
);

const char* grin_wallet_change_password(
const char* json_cfg,
const char* old_password,
const char* new_password,
uint8_t *error
);

const char* grin_init_wallet_seed(uint8_t *error);

const char* grin_wallet_init(
Expand Down Expand Up @@ -92,8 +104,14 @@ const char* grin_listen(
uint8_t *error
);

const char* grin_relay_addr(
const char* my_grin_relay_addr(
const char* json_cfg,
uint8_t *error
);

const char* grin_relay_addr_query(
const char* json_cfg,
const char* six_code_suffix,
uint8_t *error
);

Expand Down
Loading

0 comments on commit dc0cb00

Please sign in to comment.