Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
218 changes: 217 additions & 1 deletion packages/common/src/models/Analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { Nullable } from '~/utils/typeUtils'

import { Chain } from './Chain'
import { LaunchCoinResponse, LaunchpadFormValues } from './Launchpad'
import { PlaylistLibraryKind } from './PlaylistLibrary'
import { PurchaseMethod } from './PurchaseContent'
import { AccessConditions, TrackAccessType } from './Track'
Expand Down Expand Up @@ -589,7 +590,37 @@ export enum Name {
// Android App Lifecycle
ANDROID_APP_RESTART_HEARTBEAT = 'Android App: Restart Due to Heartbeat',
ANDROID_APP_RESTART_STALE = 'Android App: Restart Due to Stale Time',
ANDROID_APP_RESTART_FORCE_QUIT = 'Android App: Restart Due to Force Quit'
ANDROID_APP_RESTART_FORCE_QUIT = 'Android App: Restart Due to Force Quit',

// Artist Coin Launchpad
LAUNCHPAD_SPLASH_GET_STARTED = 'Launchpad: Get Started Clicked',
LAUNCHPAD_SPLASH_LEARN_MORE_CLICKED = 'Launchpad: Learn More Clicked',
LAUNCHPAD_WALLET_CONNECT_SUCCESS = 'Launchpad: Wallet Connect Success',
LAUNCHPAD_WALLET_CONNECT_ERROR = 'Launchpad: Wallet Connect Error',
LAUNCHPAD_WALLET_INSUFFICIENT_BALANCE = 'Launchpad: Wallet Insufficient Balance',
LAUNCHPAD_SETUP_CONTINUE = 'Launchpad: Setup Continue',
LAUNCHPAD_FORM_BACK = 'Launchpad: Back To Previous Step',
LAUNCHPAD_FORM_INPUT_CHANGE = 'Launchpad: Form Input Change',
LAUNCHPAD_REVIEW_CONTINUE = 'Launchpad: Review Continue',
LAUNCHPAD_COIN_CREATION_STARTED = 'Launchpad: Coin Creation Started',
LAUNCHPAD_COIN_CREATION_SUCCESS = 'Launchpad: Coin Creation Success',
LAUNCHPAD_COIN_CREATION_FAILURE = 'Launchpad: Coin Creation Failure',
LAUNCHPAD_FIRST_BUY_STARTED = 'Launchpad: First Buy Started',
LAUNCHPAD_FIRST_BUY_SUCCESS = 'Launchpad: First Buy Success',
LAUNCHPAD_FIRST_BUY_FAILURE = 'Launchpad: First Buy Failure',
LAUNCHPAD_FIRST_BUY_RETRY = 'Launchpad: First Buy Retry',
LAUNCHPAD_FIRST_BUY_MAX_BUTTON = 'Launchpad: First Buy Max Button Clicked',
LAUNCHPAD_FIRST_BUY_QUOTE_RECEIVED = 'Launchpad: First Buy Quote Received',
LAUNCHPAD_BUY_MODAL_OPEN = 'Launchpad: Buy Audio Modal Open',
LAUNCHPAD_BUY_MODAL_CLOSE = 'Launchpad: Buy Audio Modal Close',
LAUNCHPAD_BUY_MODAL_SUBMIT = 'Launchpad: Buy Audio Modal Submit',
LAUNCHPAD_BUY_MODAL_SUCCESS = 'Launchpad: Buy Audio Modal Success',
LAUNCHPAD_BUY_MODAL_FAILURE = 'Launchpad: Buy Audio Modal Failure',
LAUNCHPAD_BUY_MODAL_CHANGE_CURRENCY = 'Launchpad: Buy Audio Modal Change Currency',
LAUNCHPAD_BUY_MODAL_FORM_CHANGE = 'Launchpad: Buy Audio Modal Form Change',
LAUNCHPAD_BUY_MODAL_MAX_BUTTON = 'Launchpad: Buy Audio Modal Max Button Clicked',
LAUNCHPAD_BUY_MODAL_CONTINUE = 'Launchpad: Buy Audio Modal Continue Clicked',
LAUNCHPAD_BUY_MODAL_BACK = 'Launchpad: Buy Audio Modal Back Clicked'
}

type PageView = {
Expand Down Expand Up @@ -2851,6 +2882,163 @@ export type AndroidAppRestartForceQuit = {
eventName: Name.ANDROID_APP_RESTART_FORCE_QUIT
}

// Artist Coin Launchpad
export type LaunchpadSplashGetStarted = {
eventName: Name.LAUNCHPAD_SPLASH_GET_STARTED
}

export type LaunchpadSplashLearnMoreClicked = {
eventName: Name.LAUNCHPAD_SPLASH_LEARN_MORE_CLICKED
}

export type LaunchpadFormBack = {
eventName: Name.LAUNCHPAD_FORM_BACK
}

export type LaunchpadFormInputChange = {
eventName: Name.LAUNCHPAD_FORM_INPUT_CHANGE
input: string
newValue: string
}

export type LaunchpadWalletConnectSuccess = {
eventName: Name.LAUNCHPAD_WALLET_CONNECT_SUCCESS
walletAddress: string
walletSolBalance: number
}

export type LaunchpadWalletConnectError = {
eventName: Name.LAUNCHPAD_WALLET_CONNECT_ERROR
error: string
}

export type LaunchpadWalletInsufficientBalance = {
eventName: Name.LAUNCHPAD_WALLET_INSUFFICIENT_BALANCE
walletAddress: string
walletSolBalance: number
}

export type LaunchpadSetupContinue = {
eventName: Name.LAUNCHPAD_SETUP_CONTINUE
} & Partial<LaunchpadFormValues>

export type LaunchpadReviewContinue = {
eventName: Name.LAUNCHPAD_REVIEW_CONTINUE
} & Partial<LaunchpadFormValues>

export type LaunchpadCoinCreationStarted = {
eventName: Name.LAUNCHPAD_COIN_CREATION_STARTED
coinName: string
coinSymbol: string
walletAddress: string
initialBuyAmount?: string
}

export type LaunchpadCoinCreationSuccess = {
eventName: Name.LAUNCHPAD_COIN_CREATION_SUCCESS
launchCoinResponse: LaunchCoinResponse
}

export type LaunchpadCoinCreationFailure = {
eventName: Name.LAUNCHPAD_COIN_CREATION_FAILURE
errorState:
| 'poolCreateFailed'
| 'sdkCoinFailed'
| 'firstBuyFailed'
| 'unknownError'
launchCoinResponse: LaunchCoinResponse
}

export type LaunchpadFirstBuyStarted = {
eventName: Name.LAUNCHPAD_FIRST_BUY_STARTED
coinSymbol: string
mintAddress: string
payAmount: string
receiveAmount: string
}

export type LaunchpadFirstBuySuccess = {
eventName: Name.LAUNCHPAD_FIRST_BUY_SUCCESS
coinSymbol: string
mintAddress: string
payAmount: string
receiveAmount: string
}

export type LaunchpadFirstBuyFailure = {
eventName: Name.LAUNCHPAD_FIRST_BUY_FAILURE
coinSymbol: string
mintAddress: string
payAmount: string
error: string
}

export type LaunchpadFirstBuyRetry = {
eventName: Name.LAUNCHPAD_FIRST_BUY_RETRY
launchCoinResponse: LaunchCoinResponse
}

export type LaunchpadFirstBuyMaxButton = {
eventName: Name.LAUNCHPAD_FIRST_BUY_MAX_BUTTON
maxValue?: string
} & Partial<LaunchpadFormValues>

export type LaunchpadFirstBuyQuoteReceived = {
eventName: Name.LAUNCHPAD_FIRST_BUY_QUOTE_RECEIVED
payAmount: string
receiveAmount: string
usdcValue: string
}

export type LaunchpadBuyModalOpen = {
eventName: Name.LAUNCHPAD_BUY_MODAL_OPEN
}

export type LaunchpadBuyModalClose = {
eventName: Name.LAUNCHPAD_BUY_MODAL_CLOSE
}

export type LaunchpadBuyModalContinue = {
eventName: Name.LAUNCHPAD_BUY_MODAL_CONTINUE
}

export type LaunchpadBuyModalBack = {
eventName: Name.LAUNCHPAD_BUY_MODAL_BACK
}

export type LaunchpadBuyModalSubmit = {
eventName: Name.LAUNCHPAD_BUY_MODAL_SUBMIT
inputAmount: string
outputAmount: string
inputTokenSymbol: string
outputTokenSymbol: string
walletAddress: string
}

export type LaunchpadBuyModalSuccess = {
eventName: Name.LAUNCHPAD_BUY_MODAL_SUCCESS
}

export type LaunchpadBuyModalFailure = {
eventName: Name.LAUNCHPAD_BUY_MODAL_FAILURE
error: any
}

export type LaunchpadBuyModalChangeCurrency = {
eventName: Name.LAUNCHPAD_BUY_MODAL_CHANGE_CURRENCY
newCurrencySymbol: string
}

export type LaunchpadBuyModalFormChange = {
eventName: Name.LAUNCHPAD_BUY_MODAL_FORM_CHANGE
inputChanged: string
newValue: string
}

export type LaunchpadBuyModalMaxButton = {
eventName: Name.LAUNCHPAD_BUY_MODAL_MAX_BUTTON
}

export type BaseAnalyticsEvent = { type: typeof ANALYTICS_TRACK_EVENT }

export type AllTrackingEvents =
Expand Down Expand Up @@ -3234,3 +3422,31 @@ export type AllTrackingEvents =
| AndroidAppRestartHeartbeat
| AndroidAppRestartStale
| AndroidAppRestartForceQuit
| LaunchpadSplashGetStarted
| LaunchpadSplashLearnMoreClicked
| LaunchpadWalletConnectSuccess
| LaunchpadWalletInsufficientBalance
| LaunchpadSetupContinue
| LaunchpadReviewContinue
| LaunchpadCoinCreationStarted
| LaunchpadCoinCreationSuccess
| LaunchpadCoinCreationFailure
| LaunchpadFirstBuyStarted
| LaunchpadFirstBuySuccess
| LaunchpadFirstBuyFailure
| LaunchpadFirstBuyRetry
| LaunchpadFormInputChange
| LaunchpadFormBack
| LaunchpadWalletConnectError
| LaunchpadFirstBuyMaxButton
| LaunchpadFirstBuyQuoteReceived
| LaunchpadBuyModalOpen
| LaunchpadBuyModalClose
| LaunchpadBuyModalSubmit
| LaunchpadBuyModalSuccess
| LaunchpadBuyModalFailure
| LaunchpadBuyModalChangeCurrency
| LaunchpadBuyModalFormChange
| LaunchpadBuyModalMaxButton
| LaunchpadBuyModalContinue
| LaunchpadBuyModalBack
40 changes: 40 additions & 0 deletions packages/common/src/models/Launchpad.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Errors here are complicated & a sensitive area for users, so we want to log lots of info
*/
export type LaunchCoinErrorMetadata = {
userId: number
lastStep: string
relayResponseReceived: boolean
poolCreateConfirmed: boolean
sdkCoinAdded: boolean
firstBuyConfirmed: boolean
requestedFirstBuy: boolean
createPoolTx: string
firstBuyTx: string | undefined
initialBuyAmountAudio: string | undefined
coinMetadata: {
mint: string
imageUri: string
name: string
symbol: string
description: string
walletAddress: string
}
}

export type LaunchCoinResponse = {
isError: boolean
errorMetadata: LaunchCoinErrorMetadata
newMint: string
logoUri: string
}

export type LaunchpadFormValues = {
coinName: string
coinSymbol: string
coinImage: File | null
payAmount: string
receiveAmount: string
usdcValue: string
wantsToBuy: 'yes' | 'no'
}
1 change: 1 addition & 0 deletions packages/common/src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ export * from './Search'
export * from './Comment'
export * from './AccessType'
export * from './Event'
export * from './Launchpad'
37 changes: 5 additions & 32 deletions packages/web/src/hooks/useLaunchCoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import {
getUserCreatedCoinsQueryKey,
useQueryContext
} from '@audius/common/api'
import { Feature } from '@audius/common/models'
import {
Feature,
LaunchCoinErrorMetadata,
LaunchCoinResponse
} from '@audius/common/models'
import { Id } from '@audius/sdk'
import type { Provider as SolanaProvider } from '@reown/appkit-adapter-solana/react'
import { PublicKey, VersionedTransaction } from '@solana/web3.js'
Expand All @@ -24,37 +28,6 @@ export type LaunchCoinParams = {
image: Blob
}

/**
* Errors here are complicated & a sensitive area for users, so we want to log lots of info
*/
export type LaunchCoinErrorMetadata = {
userId: number
lastStep: string
relayResponseReceived: boolean
poolCreateConfirmed: boolean
sdkCoinAdded: boolean
firstBuyConfirmed: boolean
requestedFirstBuy: boolean
createPoolTx: string
firstBuyTx: string | undefined
initialBuyAmountAudio: string | undefined
coinMetadata: {
mint: string
imageUri: string
name: string
symbol: string
description: string
walletAddress: string
}
}

export type LaunchCoinResponse = {
isError: boolean
errorMetadata: LaunchCoinErrorMetadata
newMint: string
logoUri: string
}

export const LAUNCHPAD_COIN_DECIMALS = 9 // All our launched coins will have 9 decimals

/**
Expand Down
Loading