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

How to build RevokeSponsorshipOp on txbuild? #3001

Closed
abuiles opened this issue Sep 11, 2020 · 4 comments
Closed

How to build RevokeSponsorshipOp on txbuild? #3001

abuiles opened this issue Sep 11, 2020 · 4 comments

Comments

@abuiles
Copy link
Contributor

abuiles commented Sep 11, 2020

RevokeSponsorshipOp requires users to build a LedgerKey or a struct for signers sponsorships. We need to expose a helper or helpers to make it easy for users to create such operation.

A possible approach could be to add functions for each ledger key. For example:

func RevokeTrustLineSponsorshipOp(account string, asset txnbuild.Asset)
func RevokeAccountSponsorshipOp(account string)
func RevokeSignerSponsorshipOp(account string, signer string) // optionally it could receive a txnbuild.Account instead of a string
...
@2opremio
Copy link
Contributor

2opremio commented Sep 15, 2020

That's one good option.

Alternatively we could reuse the xdr.RevokeSponsorshipOp or, if we want to hide the ledger key, we could create a union type similar to to xdr.LedgerKey, extended with a signer option. Something like:

func RevokeTrustLineSponsorshipOp(SponsorshipRevocationTarget)

type SponsorshipRevocationTargetType  int

const (
	SponsorshipRevocationTargetTypeAccount          SponsorshipRevocationTargetType = iota
	SponsorshipRevocationTargetTypeTrustline        SponsorshipRevocationTargetType
	SponsorshipRevocationTargetTypeOffer            SponsorshipRevocationTargetType
	SponsorshipRevocationTargetTypeData             SponsorshipRevocationTargetType
	SponsorshipRevocationTargetTypeBalance          SponsorshipRevocationTargetType
	SponsorshipRevocationTargetTypeSigner           SponsorshipRevocationTargetType
)

type SponsorshipRevocationTarget struct {
	Type             SponsorshipRevocationTargetType
	Account          *string
	TrustLine        *SponsorshipRevocationTargetTrustLine
	Offer            *SponsorshipRevocationTargetOffer
	Data             *SponsorshipRevocationTargetData
	ClaimableBalance *SponsorshipRevocationTargetClaimableBalance
	Signer           *SponsorshipRevocationTargetSigner
}

type SponsorshipRevocationTargetTrustLine  {
	AccountId string
	Asset     Asset
}

[...]

@2opremio
Copy link
Contributor

2opremio commented Sep 17, 2020

@abuiles are you taking up this one? (i.e. implementing the RevokeSponsorship in txnbuild). I need it for integration tests.

@abuiles
Copy link
Contributor Author

abuiles commented Sep 17, 2020

@2opremio no. I thought you were doing it as part of the integration test work. Let's do the implementation first in the internal txnbuild and we can work on the official one next week.

@2opremio
Copy link
Contributor

Sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants