@audius/sdk 3.0.8-beta.12 → 3.0.8-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@audius/sdk",
3
- "version": "3.0.8-beta.12",
3
+ "version": "3.0.8-beta.13",
4
4
  "audius": {
5
- "releaseSHA": "1119e8535700beff7e3bef81d78df65bb3e33b0e"
5
+ "releaseSHA": "473c515045520b748c27a58060a426eba8a3fc19"
6
6
  },
7
7
  "description": "Audius SDK",
8
8
  "keywords": [
@@ -72,8 +72,8 @@
72
72
  "@noble/secp256k1": "1.7.0",
73
73
  "@project-serum/anchor": "0.24.1",
74
74
  "@scure/base": "1.1.1",
75
- "@solana/spl-token": "0.1.8",
76
- "@solana/web3.js": "1.37.1",
75
+ "@solana/spl-token": "0.3.8",
76
+ "@solana/web3.js": "1.78.4",
77
77
  "abi-decoder": "2.4.0",
78
78
  "ajv": "6.12.2",
79
79
  "assert": "2.0.0",
@@ -239,10 +239,7 @@ export class SolanaWeb3Manager {
239
239
  mint?: MintName
240
240
  } = {}) {
241
241
  const userbank = await this.deriveUserBank({ ethAddress, mint })
242
- const tokenAccount = await this.getTokenAccountInfo(
243
- userbank.toString(),
244
- mint
245
- )
242
+ const tokenAccount = await this.getTokenAccountInfo(userbank.toString())
246
243
  return !!tokenAccount
247
244
  }
248
245
 
@@ -292,7 +289,7 @@ export class SolanaWeb3Manager {
292
289
  | { error: string; errorCode: string | number | null }
293
290
  | {
294
291
  didExist: boolean
295
- userbank: solanaWeb3.PublicKey
292
+ userbank: PublicKey
296
293
  }
297
294
  > {
298
295
  const didExist = await this.doesUserbankExist({ ethAddress, mint })
@@ -378,15 +375,10 @@ export class SolanaWeb3Manager {
378
375
  * Gets the info for a user bank/wAudio token account given a spl-token address.
379
376
  * If the address is not a valid token account, returns `null`
380
377
  */
381
- async getTokenAccountInfo(
382
- solanaAddress: string,
383
- mint: MintName = DEFAULT_MINT
384
- ) {
378
+ async getTokenAccountInfo(solanaAddress: string) {
385
379
  try {
386
380
  const res = await getTokenAccountInfo({
387
381
  tokenAccountAddressKey: new PublicKey(solanaAddress),
388
- mintKey: this.mints[mint],
389
- solanaTokenProgramKey: this.solanaTokenKey,
390
382
  connection: this.connection
391
383
  })
392
384
  return res
@@ -418,7 +410,7 @@ export class SolanaWeb3Manager {
418
410
 
419
411
  // Multiply by 10^10 to maintain same decimals as eth $AUDIO
420
412
  const decimals = AUDIO_DECMIALS - WAUDIO_DECMIALS
421
- return tokenAccount.amount.mul(Utils.toBN('1'.padEnd(decimals + 1, '0')))
413
+ return tokenAccount.amount * BigInt('1'.padEnd(decimals + 1, '0'))
422
414
  } catch (e) {
423
415
  return null
424
416
  }
@@ -1,11 +1,11 @@
1
- import { ASSOCIATED_TOKEN_PROGRAM_ID, Token } from '@solana/spl-token'
1
+ import { ASSOCIATED_TOKEN_PROGRAM_ID, getAccount } from '@solana/spl-token'
2
2
  import {
3
3
  PublicKey,
4
4
  SystemProgram,
5
5
  SYSVAR_RENT_PUBKEY,
6
6
  Connection
7
7
  } from '@solana/web3.js'
8
- import { Nullable, randomKeyPair } from '../../utils'
8
+ import type { Nullable } from '../../utils'
9
9
  import type { IdentityService } from '../identity'
10
10
 
11
11
  type FindAssociatedTokenAddressConfig = {
@@ -35,8 +35,6 @@ export async function findAssociatedTokenAddress({
35
35
 
36
36
  type GetTokenAccountInfoConfig = {
37
37
  tokenAccountAddressKey: PublicKey
38
- mintKey: PublicKey
39
- solanaTokenProgramKey: PublicKey
40
38
  connection: Connection
41
39
  }
42
40
 
@@ -45,23 +43,10 @@ type GetTokenAccountInfoConfig = {
45
43
  */
46
44
  export async function getTokenAccountInfo({
47
45
  tokenAccountAddressKey,
48
- mintKey,
49
- solanaTokenProgramKey,
50
46
  connection
51
47
  }: GetTokenAccountInfoConfig) {
52
- const token = new Token(
53
- connection,
54
- mintKey,
55
- solanaTokenProgramKey,
56
- randomKeyPair
57
- )
58
-
59
48
  // Fetch token info with 'processed commitment to get any recently changed amounts.
60
- // NOTE: Our version of spl-token omits the second argument
61
- // in the type definitions even though it's actually available,
62
- // so we suppress error until we can upgrade.
63
- // @ts-expect-error
64
- const info = await token.getAccountInfo(tokenAccountAddressKey, 'processed')
49
+ const info = await getAccount(connection, tokenAccountAddressKey, 'processed')
65
50
  return info
66
51
  }
67
52