Skip to content

Commit

Permalink
Fix typo in libs solana decimals constants (#6863)
Browse files Browse the repository at this point in the history
  • Loading branch information
dharit-tan authored Dec 5, 2023
1 parent 92dc9bf commit cd431cb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/libs/src/api/Rewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import axios, { AxiosRequestConfig, AxiosResponse } from 'axios'
import BN from 'bn.js'
import { sampleSize } from 'lodash'

import { WAUDIO_DECMIALS } from '../constants'
import { WAUDIO_DECIMALS } from '../constants'
import type { DiscoveryProvider } from '../services/discoveryProvider'
import { RewardsManagerError } from '../services/solana/errors'
import type { AttestationMeta } from '../services/solana/rewards'
Expand Down Expand Up @@ -133,7 +133,7 @@ type CreateSenderPublicConfig = {
}

const AAO_REQUEST_TIMEOUT_MS = 15 * 1000
const WRAPPED_AUDIO_PRECISION = 10 ** WAUDIO_DECMIALS
const WRAPPED_AUDIO_PRECISION = 10 ** WAUDIO_DECIMALS

export class Rewards extends Base {
ServiceProvider: ServiceProvider
Expand Down
4 changes: 2 additions & 2 deletions packages/libs/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const AUDIO_DECMIALS = 18
export const WAUDIO_DECMIALS = 8
export const AUDIO_DECIMALS = 18
export const WAUDIO_DECIMALS = 8
export const CURRENT_USER_EXISTS_LOCAL_STORAGE_KEY = '@audius/libs:found-user'
export enum AuthHeaders {
MESSAGE = 'Encoded-Data-Message',
Expand Down
4 changes: 2 additions & 2 deletions packages/libs/src/services/solana/SolanaUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import BN from 'bn.js'
import keccak256 from 'keccak256'
import secp256k1 from 'secp256k1'

import { WAUDIO_DECMIALS } from '../../constants'
import { WAUDIO_DECIMALS } from '../../constants'

import { padBNToUint8Array } from './padBNToUint8Array'

Expand Down Expand Up @@ -84,7 +84,7 @@ export class SolanaUtils {
* Converts "UI" wAudio (i.e. 5) into properly denominated BN representation - (i.e. 5 * 10 ^ 8)
*/
static uiAudioToBNWaudio(amount: number) {
return new BN(amount * 10 ** WAUDIO_DECMIALS)
return new BN(amount * 10 ** WAUDIO_DECIMALS)
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/libs/src/services/solana/SolanaWeb3Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import solanaWeb3, {
} from '@solana/web3.js'
import BN from 'bn.js'

import { AUDIO_DECMIALS, WAUDIO_DECMIALS } from '../../constants'
import { AUDIO_DECIMALS, WAUDIO_DECIMALS } from '../../constants'
import { Logger, Nullable, Utils } from '../../utils'
import type { IdentityService } from '../identity'
import type { Web3Manager } from '../web3Manager'
Expand Down Expand Up @@ -409,7 +409,7 @@ export class SolanaWeb3Manager {
}

// Multiply by 10^10 to maintain same decimals as eth $AUDIO
const decimals = AUDIO_DECMIALS - WAUDIO_DECMIALS
const decimals = AUDIO_DECIMALS - WAUDIO_DECIMALS
return tokenAccount.amount * BigInt('1'.padEnd(decimals + 1, '0'))
} catch (e) {
return null
Expand Down

0 comments on commit cd431cb

Please sign in to comment.