Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

[PAY-598] Prepopulate TransactionDetails after purchasing $AUDIO #1832

Merged
merged 15 commits into from
Sep 1, 2022

Conversation

rickyrombo
Copy link
Contributor

@rickyrombo rickyrombo commented Aug 31, 2022

Description

Populate the TransactionDetails for the just-completed transaction at the end of the BuyAudio modal so that "Review Transaction" can work without a query to Discovery/Identity

  • Changes the TransactionDetails type to be more strict
  • Updates transaction fee calculation to use fancy Transaction.getEstimatedFee() method and have a default of 5000 Lamports if that fails (for some reason, swaps sometimes don't have estimates?)
  • Updates usage of u64 to BN where possible
  • Updates the BuyAudio modal success page to use the transaction details to get the AUDIO change and new balance

Dragons

Is there anything the reviewer should be on the lookout for? Are there any dangerous changes?

  • Uses estimated USD from the modal for now as the "usd" amount of the transaction.
  • Also uses the client dayjs date for the prepopulation of the TransactionDetails, but should take note in identity to ignore that and use a created_at instead. (blocktime doesn't seem to be available right away so this avoids the 'undefined' case - also since this doesn't have to be tied to one particular userbank tx this seems ok)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide repro instructions & any configuration.

Tested E2E using phantom to mock Coinbase Pay

How will this change be monitored?

For features that are critical or could fail silently please describe the monitoring/alerting being added.

Feature Flags

Are all new features properly feature flagged? Describe added feature flags.

Only entry point is currently behind the BUY_AUDIO_ENABLED feature flag

- Wire up transaction details at the end of the purchase saga
- Update fee calculation to use fancy helper method on Transaction
- Add default fee if fee calculation fails of 5000 Lamports
- Replace u64 with BN
@audius-infra
Copy link
Collaborator

@audius-infra
Copy link
Collaborator

@pull-request-size pull-request-size bot added size/XL and removed size/L labels Sep 1, 2022
balance: StringAudio
metadata: InAppAudioPurchaseMetadata | undefined
}
export type TransactionDetails =
Copy link
Contributor

Choose a reason for hiding this comment

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

niceeee

return libs().solanaWeb3Manager.solanaWeb3.Keypair.fromSeed(
libs().Account.hedgehog.wallet.getPrivateKey()
) as Keypair
return libs().solanaWeb3Manager!.solanaWeb3.Keypair.fromSeed(
Copy link
Contributor

Choose a reason for hiding this comment

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

Howcome we need !?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

all the services are nullable :(

data: InAppAudioPurchaseMetadata
) => {
await waitForLibsInit()
// return await libs().identityService!.saveUserBankTransactionMetadata(data)
Copy link
Contributor

Choose a reason for hiding this comment

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

intentional comment?

Copy link
Contributor

Choose a reason for hiding this comment

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

ah just saw the commit msg

@audius-infra
Copy link
Collaborator

@rickyrombo rickyrombo merged commit 3c90d3f into main Sep 1, 2022
@rickyrombo rickyrombo deleted the mjp-transaction-details-modal-wired branch September 1, 2022 23:03
audius-infra pushed a commit that referenced this pull request Sep 3, 2022
[6eeb9d4] [PAY-605][PAY-601][PAY-548] Buy Audio modal design changes (#1846) Marcus Pasell
[436cd27] [C-963] Migrate wallet sagas (#1857) Sebastian Klingler
[238d729] [C-959] Migrate tipping sagas (#1852) Sebastian Klingler
[1561728] Bump SDK to v1.0.1 (#1842) Dheeraj Manjunath
[a331f3d] Add reordering to new tables for playlists (#1845) Kyle Shanks
[3c90d3f] [PAY-598] Prepopulate TransactionDetails after purchasing $AUDIO (#1832) Marcus Pasell
[b11a686] [C-957] Fix autocomplete when signed out (#1844) Sebastian Klingler
[3315c27] Make tooltips use updated colors when theme is applied (#1843) Sebastian Klingler
[76395d5] [PAY-591] Improve supporter count visibility (#1841) Reed
[779d9e9] [PAY-507] Fix feed tip tile tip button resizing (#1837) Reed
[f4160e9] [C-939] Refactor discord modal (#1838) Dylan Jeffers
[b76854f] Update deactivate copy (#1840) Raymond Jacobson
[2085ffc] [Stems] Don't rewrite to /index.html on stems.audius.co (#1836) Marcus Pasell
[14aa5ac] [C-836] Fix enter on search (#1835) Dylan Jeffers
[d644cc1] [C-703] Fix segmented control font color (#1833) Dylan Jeffers
[d2c0dca] [C-934] Migrate user-list sagas to common (#1829) Dylan Jeffers
[1321a57] [C-919] Migrate profile sagas to common (#1826) Sebastian Klingler
[aad5c6a] [PAY-594] Edit 'not enough SOL' error message (#1827) Reed
[af61aab] [C-930] Move social sagas to common (#1822) Raymond Jacobson
[33a1403] [C-928] Migrate saved sagas to common (#1821) Dylan Jeffers
[64d45f3] [PAY-544] Add Transaction Details Modal (#1806) Marcus Pasell
[20cfc9f] Add Transaction Details to Store (#1804) Marcus Pasell
[5b8a4f0] [C-926] Migrate explore sagas to common (#1818) Dylan Jeffers
[6047185] Follow up fix for track removal from playlist with entity manager (#1817) Isaac Solo
[1b2638c] Fix track removal from playlist with entity manager (#1815) Isaac Solo
[c854f66] [C-918] Move trending saga to common (#1814) Dylan Jeffers
[6f24724] Fix lineup types in mobile build (#1812) Dylan Jeffers
[27cf13a] Update @audius/sdk to 1.0.0 (#1813) Reed
[c10ef33] Only enable external sourcemaps for prod builds (#1811) Sebastian Klingler
[67e9c2d] [PAY-479] Check recipient wallet SOL before send (#1779) Reed
@AudiusProject AudiusProject deleted a comment from linear bot Sep 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants