Skip to content

Commit

Permalink
docs: AUR installation/pkgbuild, cleanup (#27)
Browse files Browse the repository at this point in the history
* docs: AUR installation, cleanup

Signed-off-by: Kainoa Kanter <[email protected]>

* fix(docs): heading level for homebrew

Signed-off-by: Kainoa Kanter <[email protected]>

* add PKGBUILD

* Add maintainer comment for Di Mei

---------

Signed-off-by: Kainoa Kanter <[email protected]>
  • Loading branch information
ThatOneCalculator authored Dec 4, 2024
1 parent 8dc4b89 commit 0331f30
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 7 deletions.
51 changes: 51 additions & 0 deletions PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Maintainer: Di Mei <[email protected]>
# Maintainer: Kainoa Kanter <[email protected]>

_pkgname=cdpcurl
pkgname="$_pkgname-git"
pkgver=r12.g8dc4b89
pkgrel=2
pkgdesc='CLI for the Coinbase Developer Platform (CDP)'
url='https://github.com/coinbase/cdpcurl'
arch=('aarch64' 'i686' 'x86_64')
license=('custom:none')
depends=('glibc')
makedepends=('git' 'go')
provides=("$_pkgname")
source=("$_pkgname::git+$url")
sha256sums=('SKIP')

pkgver() {
cd "${srcdir}/${_pkgname}" || exit
printf "r%s.g%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
cd "$_pkgname"
go mod download
}

build() {
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
cd "$_pkgname"
go build
}

check() {
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
cd "$_pkgname"
go test ./...
}

package() {
cd "$_pkgname"
install -Dv cdpcurl -t "$pkgdir/usr/bin/"
}
30 changes: 23 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,41 @@

`cdpcurl` is a tool that allows you to make HTTP requests to the Coinbase API with your CDP (Coinbase Developer Platform) API key. It is a wrapper around curl that automatically adds the necessary headers to authenticate your requests.

## Installation via Homebrew
```
## Installation

### Homebrew

```bash
brew tap coinbase/cdpcurl
brew install cdpcurl
```

## Installation via Go
`go install github.com/coinbase/cdpcurl@latest`
### AUR

```bash
yay -S cdpcurl-git
```

### Go

```bash
go install github.com/coinbase/cdpcurl@latest
```

## Example Usage

### Get account balance of BTC with Sign In With Coinbase API
```
```bash
cdpcurl -k ~/Downloads/cdp_api_key.json 'https://api.coinbase.com/v2/accounts/BTC'
```

### Get the latest price of BTC with Advanced Trading API
```
```bash
cdpcurl -k ~/Downloads/cdp_api_key.json 'https://api.coinbase.com/api/v3/brokerage/products/BTC-USDC'
```

### Create a wallet on Base Sepolia with Platform API
```

```bash
cdpcurl -k ~/Downloads/cdp_api_key.json -X POST -d '{"wallet": {"network_id": "base-sepolia"}}' 'https://api.developer.coinbase.com/platform/v1/wallets'
```

0 comments on commit 0331f30

Please sign in to comment.