Skip to content

Commit

Permalink
CreateAccount with role
Browse files Browse the repository at this point in the history
  • Loading branch information
stivens13 committed Jul 11, 2018
1 parent c5d2f75 commit 4e83f50
Show file tree
Hide file tree
Showing 478 changed files with 6,974 additions and 7,078 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ NOTE: this changelog represents the changes that are associated with the librar

- build: _BREAKING CHANGE_: A transaction built and signed using the `build` package no longer default to the test network.

[Unreleased]: https://github.com/stellar/go/commits/master
[Unreleased]: https://github.com/stivens13/go/commits/master
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM golang:1.9
RUN bash -c "curl https://glide.sh/get | sh"
WORKDIR /go/src/github.com/stellar/go
WORKDIR /go/src/github.com/stivens13/go

COPY glide.lock /go/src/github.com/stellar/go
COPY glide.yaml /go/src/github.com/stellar/go
COPY glide.lock /go/src/github.com/stivens13/go
COPY glide.yaml /go/src/github.com/stivens13/go
RUN glide install

COPY . .
RUN go install github.com/stellar/go/tools/...
RUN go install github.com/stellar/go/services/...
RUN go install github.com/stivens13/go/tools/...
RUN go install github.com/stivens13/go/services/...
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Stellar Go
[![Build Status](https://travis-ci.org/stellar/go.svg?branch=master)](https://travis-ci.org/stellar/go)
[![GoDoc](https://godoc.org/github.com/stellar/go?status.svg)](https://godoc.org/github.com/stellar/go)
[![Go Report Card](https://goreportcard.com/badge/github.com/stellar/go)](https://goreportcard.com/report/github.com/stellar/go)
[![GoDoc](https://godoc.org/github.com/stivens13/go?status.svg)](https://godoc.org/github.com/stivens13/go)
[![Go Report Card](https://goreportcard.com/badge/github.com/stivens13/go)](https://goreportcard.com/report/github.com/stivens13/go)

This repo is the home for all of the public go code produced by SDF. In addition to various tools and services, this repository is the SDK from which you may develop your own applications that integrate with the stellar network.

## Dependencies

This repository depends upon a [number of external dependencies](./glide.yaml), and we use [Glide](https://glide.sh/) to manage them. Glide is used to populate the [vendor directory](http://glide.readthedocs.io/en/latest/vendor/), ensuring that builds are reproducible even as upstream dependencies are changed. Please see the [Glide](http://glide.sh/) website for installation instructions.

You can use Glide yourself in your project and add stellar go as a vendor'd dependency, or you can just drop this repos as `$GOPATH/src/github.com/stellar/go` to import it the canonical way (you still need to run `glide install`).
You can use Glide yourself in your project and add stellar go as a vendor'd dependency, or you can just drop this repos as `$GOPATH/src/github.com/stivens13/go` to import it the canonical way (you still need to run `glide install`).

When creating this project, we had to decide whether or not we committed our external dependencies to the repo. We decided that we would not, by default, do so. This lets us avoid the diff churn associated with updating dependencies while allowing an acceptable path to get reproducible builds. To do so, simply install glide and run `glide install` in your checkout of the code. We realize this is a judgement call; Please feel free to open an issue if you would like to make a case that we change this policy.

Expand All @@ -30,7 +30,7 @@ Each of these directories have their own README file that explain further the na

### Other packages

In addition to the packages described above, this repository contains various packages related to working with the Stellar network from a go program. It's recommended that you use [godoc](https://godoc.org/github.com/stellar/go#pkg-subdirectories) to browse the documentation for each.
In addition to the packages described above, this repository contains various packages related to working with the Stellar network from a go program. It's recommended that you use [godoc](https://godoc.org/github.com/stivens13/go#pkg-subdirectories) to browse the documentation for each.


## Package source layout
Expand Down
2 changes: 1 addition & 1 deletion address/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"

"github.com/asaskevich/govalidator"
"github.com/stellar/go/support/errors"
"github.com/stivens13/go/support/errors"
)

// Separator seperates the name and domain portions of an address
Expand Down
2 changes: 1 addition & 1 deletion address/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package address
import (
"testing"

"github.com/stellar/go/support/errors"
"github.com/stivens13/go/support/errors"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions amount/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"math/big"
"strconv"

"github.com/stellar/go/support/errors"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/support/errors"
"github.com/stivens13/go/xdr"
)

// One is the value of one whole unit of currency. Stellar uses 7 fixed digits
Expand Down
4 changes: 2 additions & 2 deletions amount/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"testing"

"github.com/stellar/go/amount"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/amount"
"github.com/stivens13/go/xdr"
)

var Tests = []struct {
Expand Down
4 changes: 2 additions & 2 deletions build/account_merge.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package build

import (
"github.com/stellar/go/support/errors"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/support/errors"
"github.com/stivens13/go/xdr"
)

// AccountMerge groups the creation of a new AccountMergeBuilder with a call to
Expand Down
2 changes: 1 addition & 1 deletion build/account_merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package build
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/xdr"
)

var _ = Describe("AccountMergeBuilder Mutators", func() {
Expand Down
4 changes: 2 additions & 2 deletions build/allow_trust.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package build

import (
"github.com/stellar/go/support/errors"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/support/errors"
"github.com/stivens13/go/xdr"
)

// AllowTrust groups the creation of a new AllowTrustBuilder with a call to Mutate.
Expand Down
2 changes: 1 addition & 1 deletion build/allow_trust_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package build
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/xdr"
)

var _ = Describe("AllowTrustBuilder Mutators", func() {
Expand Down
4 changes: 2 additions & 2 deletions build/asset.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package build

import (
"github.com/stellar/go/support/errors"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/support/errors"
"github.com/stivens13/go/xdr"
)

// MustXDR is the panicky version of ToXDR
Expand Down
2 changes: 1 addition & 1 deletion build/asset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package build
import (
"testing"

"github.com/stellar/go/xdr"
"github.com/stivens13/go/xdr"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
6 changes: 3 additions & 3 deletions build/change_trust.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package build

import (
"github.com/stellar/go/amount"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/amount"
"github.com/stivens13/go/support/errors"
"github.com/stivens13/go/xdr"
)

// ChangeTrust groups the creation of a new ChangeTrustBuilder with a call to Mutate.
Expand Down
2 changes: 1 addition & 1 deletion build/change_trust_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package build
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/xdr"
)

var _ = Describe("ChangeTrustBuilder Mutators", func() {
Expand Down
21 changes: 18 additions & 3 deletions build/create_account.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package build

import (
"github.com/stellar/go/amount"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/amount"
"github.com/stivens13/go/support/errors"
"github.com/stivens13/go/xdr"
)

// CreateAccount groups the creation of a new CreateAccountBuilder with a call
Expand All @@ -18,6 +18,7 @@ func CreateAccount(muts ...interface{}) (result CreateAccountBuilder) {
// specify how they modify an xdr.PaymentOp object
type CreateAccountMutator interface {
MutateCreateAccount(*xdr.CreateAccountOp) error
//SetAccountType(*xdr.CreateAccountOp)
}

// CreateAccountBuilder helps to build CreateAccountOp structs.
Expand All @@ -34,6 +35,7 @@ func (b *CreateAccountBuilder) Mutate(muts ...interface{}) {
switch mut := m.(type) {
case CreateAccountMutator:
err = mut.MutateCreateAccount(&b.CA)
//err = SetAccountType(&b.CA)
case OperationMutator:
err = mut.MutateOperation(&b.O)
default:
Expand All @@ -47,6 +49,17 @@ func (b *CreateAccountBuilder) Mutate(muts ...interface{}) {
}
}

// SetAccountType sets AccType
//func (n AccountType) SetAccountType(op *xdr.CreateAccountOp) error {
// op.AccType = xdr.Uint32(n)
// return
//}

func (m AccountType) MutateCreateAccount(o *xdr.CreateAccountOp) (err error) {
o.AccType = xdr.Uint32(m.Type)
return
}

// MutateCreateAccount for Destination sets the CreateAccountOp's Destination
// field
func (m Destination) MutateCreateAccount(o *xdr.CreateAccountOp) error {
Expand All @@ -57,5 +70,7 @@ func (m Destination) MutateCreateAccount(o *xdr.CreateAccountOp) error {
// StartingBalance field
func (m NativeAmount) MutateCreateAccount(o *xdr.CreateAccountOp) (err error) {
o.StartingBalance, err = amount.Parse(m.Amount)

return
}

2 changes: 1 addition & 1 deletion build/create_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package build
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/xdr"
)

var _ = Describe("CreateAccountBuilder Mutators", func() {
Expand Down
4 changes: 2 additions & 2 deletions build/inflation.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package build

import (
"github.com/stellar/go/support/errors"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/support/errors"
"github.com/stivens13/go/xdr"
)

// Inflation groups the creation of a new InflationBuilder with a call to Mutate.
Expand Down
2 changes: 1 addition & 1 deletion build/inflation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package build
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/xdr"
)

var _ = Describe("InflationBuilder Mutators", func() {
Expand Down
20 changes: 17 additions & 3 deletions build/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ package build
import (
"math"

"github.com/stellar/go/amount"
"github.com/stellar/go/network"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/amount"
"github.com/stivens13/go/network"
"github.com/stivens13/go/xdr"
)

const (
Expand Down Expand Up @@ -140,6 +140,20 @@ type NativeAmount struct {
Amount string
}

// Account type that defines account role in the BONEX system
// FOUNDATION 0
// VENDOR 1
// MERCHANT 2
// CLIENT 3
//type AccountType struct {
// accType AccountType
// //accType uint32
//}
type AccountType struct {
Type uint32
}


// OfferID is a mutator that sets offer ID on offer operations
type OfferID uint64

Expand Down
2 changes: 1 addition & 1 deletion build/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func TestBuild(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Package: github.com/stellar/go/build")
RunSpecs(t, "Package: github.com/stivens13/go/build")
}

// ExampleTransactionBuilder creates and signs a simple transaction, and then
Expand Down
4 changes: 2 additions & 2 deletions build/manage_data.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package build

import (
"github.com/stellar/go/support/errors"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/support/errors"
"github.com/stivens13/go/xdr"
)

// ClearData removes a key/value pair associated with the source account
Expand Down
2 changes: 1 addition & 1 deletion build/manage_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/xdr"
)

var _ = Describe("ClearData", func() {
Expand Down
8 changes: 4 additions & 4 deletions build/manage_offer.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package build

import (
"github.com/stellar/go/amount"
"github.com/stellar/go/price"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/amount"
"github.com/stivens13/go/price"
"github.com/stivens13/go/support/errors"
"github.com/stivens13/go/xdr"
)

// CreateOffer creates a new offer
Expand Down
2 changes: 1 addition & 1 deletion build/manage_offer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package build
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/xdr"
)

var _ = Describe("ManageOffer", func() {
Expand Down
2 changes: 1 addition & 1 deletion build/operation.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package build

import (
"github.com/stellar/go/xdr"
"github.com/stivens13/go/xdr"
)

// OperationMutator is a interface that wraps the MutateOperation operation.
Expand Down
6 changes: 3 additions & 3 deletions build/payment.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package build

import (
"github.com/stellar/go/amount"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/amount"
"github.com/stivens13/go/support/errors"
"github.com/stivens13/go/xdr"
)

// Payment groups the creation of a new PaymentBuilder with a call to Mutate.
Expand Down
2 changes: 1 addition & 1 deletion build/payment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package build
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/xdr"
)

var _ = Describe("Payment Mutators", func() {
Expand Down
4 changes: 2 additions & 2 deletions build/set_options.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package build

import (
"github.com/stellar/go/support/errors"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/support/errors"
"github.com/stivens13/go/xdr"
)

// SetOptions groups the creation of a new SetOptions with a call to Mutate.
Expand Down
2 changes: 1 addition & 1 deletion build/set_options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/stellar/go/xdr"
"github.com/stivens13/go/xdr"
"github.com/stretchr/testify/assert"
)

Expand Down
Loading

0 comments on commit 4e83f50

Please sign in to comment.