Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

txnbuild: add max limit to change trust #1269

Merged
merged 3 commits into from
May 13, 2019

Conversation

poliha
Copy link
Contributor

@poliha poliha commented May 13, 2019

This PR adds the maximum trustline limit to a change trust operation when no limit is set.
Closes #1265

@poliha poliha added the txnbuild 2nd-generation transaction build library for Go SDK label May 13, 2019
Copy link
Member

@ire-and-curses ire-and-curses left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Just some small changes.

type ChangeTrust struct {
Line Asset
Limit string
SourceAccount Account
}

// MaxTrustlineLimit represents the maximum value that can be passed as trutline Limit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be passed as trutline Limit -> can be set as a trustline limit.

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

// ChangeTrust represents the Stellar change trust operation. See
// https://www.stellar.org/developers/guides/concepts/list-of-operations.html
// https://www.stellar.org/developers/guides/concepts/list-of-operations.html.
// If Limit is omitted, it defaults to txnbuild.MaxTrustlineLimit; the max int64 value.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// If Limit is omitted, it defaults to txnbuild.MaxTrustlineLimit; the max int64 value. -> // If Limit is omitted, it defaults to txnbuild.MaxTrustlineLimit.

type ChangeTrust struct {
Line Asset
Limit string
SourceAccount Account
}

// MaxTrustlineLimit represents the maximum value that can be passed as trutline Limit
var MaxTrustlineLimit = amount.StringFromInt64(math.MaxInt64)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be a const?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope you will get an error because the value is returned from a method

"github.com/stretchr/testify/assert"
)

func TestChangeTrustMaxLimit(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you confirm by looking e.g. in Stellar lab that the limit was set as expected in the XDR? If so this is fine - just include the link to the lab.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep.. will add link

@poliha poliha merged commit 38839a0 into release-txnbuild-v1.2.0 May 13, 2019
@ire-and-curses ire-and-curses added this to the txnbuild v1.2.0 milestone May 13, 2019
@poliha poliha deleted the txnbuild-max-limit branch May 17, 2019 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
txnbuild 2nd-generation transaction build library for Go SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants