-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat: show tlv records in transaction popup #365
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
33a5714
feat: show tlv records in transaction popup
im-adithya 832bbf4
chore: add podcastinginfo component
im-adithya 10afe14
chore: remove ? in podcasting info component
im-adithya 65e6752
Merge branch 'master' into task-tlv-records
im-adithya 308e4ff
chore: decode tlv record values in backend
im-adithya 185895f
chore: add backup for tx description
im-adithya eb84d63
feat: add boostagram column and use jsonb in metadata
im-adithya a6406a8
chore: do not modify metadata while parsing
im-adithya 25064af
chore: combine boostagram and metadata migration
im-adithya d9d99c0
feat: extract description from custom records
im-adithya 178410f
chore: fix keysend tests
im-adithya 4ee56dc
chore: change metadata param type in makeinvoice
im-adithya 41c290b
chore: fix make invoice tests
im-adithya e12433e
chore: metadata fixes
im-adithya 168d7cf
Merge remote-tracking branch 'origin/master' into task-tlv-records
rolznz 3b96728
fix: boostragram and metadata migration
rolznz 7c29b25
chore: set metadata json column to null if empty
im-adithya 8760830
fix: remove jsonb from migration
im-adithya fe59323
chore: code cleanup, rename api models, fix metadata usage
rolznz 662c01d
fix: metadata format
rolznz fb30ae6
chore: remove unused contant
rolznz e6d9930
fix: tests
rolznz 268b69a
chore: improve tests
rolznz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
db/migrations/202408061737_add_boostagrams_and_use_json.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package migrations | ||
|
||
import ( | ||
_ "embed" | ||
|
||
"github.com/go-gormigrate/gormigrate/v2" | ||
"gorm.io/gorm" | ||
) | ||
|
||
// This migration adds boostagram column to transactions | ||
var _202408061737_add_boostagrams_and_use_json = &gormigrate.Migration{ | ||
ID: "202408061737_add_boostagrams_and_use_json", | ||
Migrate: func(db *gorm.DB) error { | ||
err := db.Transaction(func(tx *gorm.DB) error { | ||
return tx.Exec(` | ||
ALTER TABLE transactions ADD COLUMN boostagram JSON; | ||
ALTER TABLE transactions ADD COLUMN metadata_temp JSON; | ||
UPDATE transactions SET metadata_temp = json(metadata) where metadata != ""; | ||
rolznz marked this conversation as resolved.
Show resolved
Hide resolved
im-adithya marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ALTER TABLE transactions DROP COLUMN metadata; | ||
ALTER TABLE transactions RENAME COLUMN metadata_temp TO metadata; | ||
`).Error | ||
}) | ||
|
||
return err | ||
}, | ||
Rollback: func(tx *gorm.DB) error { | ||
return nil | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Boostagram } from "src/types"; | ||
|
||
function PodcastingInfo({ boost }: { boost: Boostagram }) { | ||
return ( | ||
<> | ||
{boost.message && ( | ||
<div className="mt-6"> | ||
<p>Message</p> | ||
<p className="text-muted-foreground break-all">{boost.message}</p> | ||
</div> | ||
)} | ||
{boost.podcast && ( | ||
<div className="mt-6"> | ||
<p>Podcast</p> | ||
<p className="text-muted-foreground break-all">{boost.podcast}</p> | ||
</div> | ||
)} | ||
{boost.episode && ( | ||
<div className="mt-6"> | ||
<p>Episode</p> | ||
<p className="text-muted-foreground break-all">{boost.episode}</p> | ||
</div> | ||
)} | ||
{boost.action && ( | ||
<div className="mt-6"> | ||
<p>Action</p> | ||
<p className="text-muted-foreground break-all">{boost.action}</p> | ||
</div> | ||
)} | ||
{boost.ts && ( | ||
<div className="mt-6"> | ||
<p>Timestamp</p> | ||
<p className="text-muted-foreground break-all">{boost.ts}</p> | ||
</div> | ||
)} | ||
{boost.valueMsatTotal && ( | ||
<div className="mt-6"> | ||
<p>Total amount</p> | ||
<p className="text-muted-foreground break-all"> | ||
{new Intl.NumberFormat(undefined, {}).format( | ||
Math.floor(boost.valueMsatTotal / 1000) | ||
)}{" "} | ||
{Math.floor(boost.valueMsatTotal / 1000) == 1 ? "sat" : "sats"} | ||
</p> | ||
</div> | ||
)} | ||
{boost.senderName && ( | ||
<div className="mt-6"> | ||
<p>Sender</p> | ||
<p className="text-muted-foreground break-all">{boost.senderName}</p> | ||
</div> | ||
)} | ||
{boost.appName && ( | ||
<div className="mt-6"> | ||
<p>App</p> | ||
<p className="text-muted-foreground break-all">{boost.appName}</p> | ||
</div> | ||
)} | ||
</> | ||
); | ||
} | ||
|
||
export default PodcastingInfo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@im-adithya why do some have omitempty others not? is it required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took this from LBE repo here, whereever we have
?:
in the Boostagram type there, I've omittedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it looks completely arbitrary and doesn't seem to follow the spec - https://github.com/lightning/blips/blob/master/blip-0010.md#fields