Skip to content

Commit 2dc2e34

Browse files
authored
Trustline transaction specialization (keybase#18067)
* protocol * trustline transactions * add stories * yarn test Storyshots * a space * ternaries instead of spaces * update stories
1 parent 0bcecbf commit 2dc2e34

17 files changed

Lines changed: 80947 additions & 11210 deletions

File tree

‎go/protocol/stellar1/local.go‎

Lines changed: 56 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎go/protocol/stellar1/remote.go‎

Lines changed: 24 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎go/stellar/transform.go‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,15 @@ func transformPaymentStellar(mctx libkb.MetaContext, acctID stellar1.AccountID,
117117
}
118118
}
119119

120-
if p.Asset.IsEmpty() && !p.Asset.IsNativeXLM() {
121-
// Asset is also expected to be missing.
122-
loc.IssuerDescription = FormatAssetIssuerString(p.Asset)
123-
issuerAcc := stellar1.AccountID(p.Asset.Issuer)
120+
asset := p.Asset // p.Asset is also expected to be missing.
121+
if p.Trustline != nil && asset.IsEmpty() {
122+
asset = p.Trustline.Asset
123+
}
124+
if !asset.IsEmpty() && !asset.IsNativeXLM() {
125+
loc.IssuerDescription = FormatAssetIssuerString(asset)
126+
issuerAcc := stellar1.AccountID(asset.Issuer)
124127
loc.IssuerAccountID = &issuerAcc
125128
}
126-
127129
} else {
128130
loc, err = newPaymentCommonLocal(mctx, p.TxID, p.Ctime, p.Amount, p.Asset)
129131
if err != nil {
@@ -159,6 +161,7 @@ func transformPaymentStellar(mctx libkb.MetaContext, acctID stellar1.AccountID,
159161
loc.IsAdvanced = p.IsAdvanced
160162
loc.SummaryAdvanced = p.SummaryAdvanced
161163
loc.Operations = p.Operations
164+
loc.Trustline = p.Trustline
162165

163166
return loc, nil
164167
}

‎protocol/avdl/stellar1/local.avdl‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ protocol local {
146146
boolean fromAirdrop; // true if payment pertains to a keybase airdrop
147147
boolean isInflation; // true if payment from known inflation source
148148
union { null, string } inflationSource; // name of inflation source
149+
150+
union { null, PaymentTrustlineLocal } trustline; // this tx is only a trust line change.
149151
}
150152

151153
// Details of a payment.
@@ -163,6 +165,11 @@ protocol local {
163165
string feeChargedDescription; // "0.0000100 XLM" the actual fee that was charged for this tx (formatted)
164166
}
165167

168+
record PaymentTrustlineLocal {
169+
Asset asset;
170+
boolean remove;
171+
}
172+
166173
// accountID should be the accountID that you want the details for.
167174
// This is used for formatting the `amountDescription` to know if it
168175
// is a payment that increases or decreases the balance.

‎protocol/avdl/stellar1/remote.avdl‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ protocol remote {
111111
boolean isAdvanced; // true for non-payment transactions
112112
string summaryAdvanced; // one-line summary of the advanced tx
113113
array<string> operations; // string representations of each operation in the tx
114+
union { null, PaymentTrustlineLocal } trustline; // this tx is only a trust line change.
114115
}
115116

116117
record PaymentSummaryDirect {

‎protocol/json/stellar1/local.json‎

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎protocol/json/stellar1/remote.json‎

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)