cmd

package
v0.0.0-...-8a10f5f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: MPL-2.0 Imports: 14 Imported by: 1

README

Below is the command structure for bat-go microservices using cobra

create a macaroon

# needs an example.yaml file to work
./bat-go macaroon create

with options

MACAROON_SECRET=a9ed2c16-3cf6-446f-8978-e707bead3979 \
./bat-go macaroon create --config "macaroon-config.yaml"

start rewards rest server

./bat-go serve rewards rest

with options

./bat-go serve rewards rest \
  --config "config.yaml" \
  --ratios-token "abc" --ratios-service "123" --environment "local" \
  --base-currency "USD" --address ":4321"

check server fingerprints

./bat-go get-cert-fingerprint "brave.com:443"

paypal settlement

transform

./bat-go settlement paypal transform \
  --input "paypal-settlement-from-antifraud.json" \
  --currency "JPY"

with other options

./bat-go settlement paypal transform \
  --input "paypal-settlement-from-antifraud.json" \
  --currency "JPY" \
  --rate "104.75" \
  --out "paypal-settlement-from-antifraud-complete.json"

complete

./bat-go settlement paypal complete \
  --input "paypal-settlement-from-antifraud.json" \
  --txn-id "30ad1991-b2d3-4897-ae52-09efcd174235"

with output option

./bat-go settlement paypal complete \
  --input "paypal-settlement-from-antifraud.json" \
  --txn-id "30ad1991-b2d3-4897-ae52-09efcd174235" \
  --out   "paypal-settlement-complete.json"

email

./bat-go settlement paypal email \
  --input "paypal-settlement-from-antifraud.json"

gemini settlement

upload

./bat-go settlement gemini upload \
  --input "gemini-contribution-signed.json" \
  --all-txs-input "4ae996f5-679b-46c6-9aea-9892f763ffe6" \
  --sig 0

with output

./bat-go settlement gemini upload \
  --input "gemini-contribution-signed.json" \
  --all-txs-input "4ae996f5-679b-46c6-9aea-9892f763ffe6" \
  --sig 0 \
  --out "gemini-contribution-signed-completed.json"

checkstatus

./bat-go settlement gemini checkstatus \
  --input "gemini-contribution-signed.json" \
  --all-txs-input "4ae996f5-679b-46c6-9aea-9892f763ffe6"

bitflyer settlement

equivalent envs are available as flags ENV_KEY -> --env-key

refresh token

After running the refres token command, you will need to copy the value in the printed auth.access_token field into your .env file and source that file. This can now be used with the other bitflyer commands. The env name should be BITFLYER_TOKEN.

BITFLYER_CLIENT_ID=
BITFLYER_CLIENT_SECRET=
BITFLYER_EXTRA_CLIENT_SECRET=
BITFLYER_SERVER=
./bat-go settlement bitflyer token

at this point, it makes sense to run the sign-settlement command so that transactions are split across multiple files, however this is not strictly necessary to do because we do all of the transforms needed in the upload step.

upload

BITFLYER_SOURCE_FROM=tipping
BITFLYER_SERVER=
# omit to execute
BITFLYER_DRYRUN=1 # seconds to delay
./bat-go bitflyer upload \
  --in "bitflyer-transactions.json" \
  --exclude-limited true # if a transaction ever hits transfer limit, do not send it

checkstatus

BITFLYER_SOURCE_FROM=tipping
BITFLYER_SERVER=
./bat-go bitflyer checkstatus \
  --in "bitflyer-transactions.json"

wallet

create

./bat-go wallet create \
  --provider "uphold" \
  --name "test"

vault create wallet

./bat-go vault create-wallet

create offline

./bat-go vault create-wallet --offline true

transfer funds

with vault inputs

./bat-go wallet transfer-funds \
  --provider "uphold" \
  --from "1234567890" \
  --to "1234567890" \
  --usevault true \ # get secrets from vault
  --value "10.5"

with env inputs

ED25519_PRIVATE_KEY= \
UPHOLD_PROVIDER_ID= \
./bat-go wallet transfer-funds \
  --provider "uphold" \
  --from "1234567890" \
  --to "1234567890" \
  --value "10.5"

vault

init

./bat-go vault init \
  --key-shares 1 \
  --key-threshold 1 \
  ./key.asc

import key

ED25519_PRIVATE_KEY=
ED25519_PUBLIC_KEY=
UPHOLD_PROVIDER_ID=
GEMINI_CLIENT_ID=
GEMINI_CLIENT_KEY=
GEMINI_CLIENT_SECRET=
./bat-go vault import-key \
  --config "config.yaml"

only import a subset of the keys with --wallet-refs

./bat-go vault import-key \
  --config "config.yaml" \
  --wallet-refs "gemini-referral"

sign settlement

uses inputs from vault

./bat-go vault sign-settlement \
  --config "config.yaml" \
  --input "contributions.json" \
  --providers "uphold,gemini"

unseal

unseals vault

gpg -d ./share-0.gpg | ./bat-go vault unseal

generate

json-schema

generates json schemas

go run main.go generate json-schema

with override

go run main.go generate json-schema --overwrite

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServeCmd = &cobra.Command{
	Use:   "serve",
	Short: "entrypoint to serve a micro-service",
}

ServeCmd the serve command

Functions

func SetupJobWorkers

func SetupJobWorkers(ctx context.Context, jobs []srv.Job) error

SetupJobWorkers - setup job workers

func SetupRouter

func SetupRouter(ctx context.Context) *chi.Mux

SetupRouter sets up a router

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL