@audius/sdk 0.0.35 → 0.0.38

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.
@@ -114,4 +114,10 @@ export interface Track {
114
114
  * @memberof Track
115
115
  */
116
116
  permalink?: string;
117
+ /**
118
+ *
119
+ * @type {boolean}
120
+ * @memberof Track
121
+ */
122
+ is_streamable?: boolean;
117
123
  }
@@ -120,6 +120,12 @@ export interface TrackFull {
120
120
  * @memberof TrackFull
121
121
  */
122
122
  permalink?: string;
123
+ /**
124
+ *
125
+ * @type {boolean}
126
+ * @memberof TrackFull
127
+ */
128
+ is_streamable?: boolean;
123
129
  /**
124
130
  *
125
131
  * @type {number}
@@ -2,6 +2,7 @@ import type Web3 from 'web3';
2
2
  import type Wallet from 'ethereumjs-wallet';
3
3
  export declare type Web3Config = {
4
4
  registryAddress: string;
5
+ entityManagerAddress: string;
5
6
  useExternalWeb3: boolean;
6
7
  internalWeb3Config: {
7
8
  web3ProviderEndpoints: string[];
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@audius/sdk",
3
- "version": "0.0.35",
3
+ "version": "0.0.38",
4
4
  "audius": {
5
- "releaseSHA": "87ed35aa1374bdcf5632ef58ce55efbdd4031b03"
5
+ "releaseSHA": "74503074cb96dea181ec2b218c5cb6d528c1db86"
6
6
  },
7
7
  "description": "",
8
8
  "main": "dist/index.cjs.js",
@@ -98,6 +98,7 @@
98
98
  "@types/expect": "24.3.0",
99
99
  "@types/form-data": "^2.5.0",
100
100
  "@types/hashids": "2.0.1",
101
+ "@types/lodash": "4.14.149",
101
102
  "@types/mocha": "9.1.0",
102
103
  "@types/node-localstorage": "1.3.0",
103
104
  "@types/pify": "^5.0.1",
@@ -1,7 +1,6 @@
1
1
  import type { provider } from 'web3-core'
2
2
  import Web3 from './LibsWeb3'
3
3
  import { version } from './version'
4
- import type { SolanaWeb3Config } from './services/solana'
5
4
  import { Hedgehog, HedgehogConfig } from './services/hedgehog'
6
5
  import type { Hedgehog as HedgehogBase } from '@audius/hedgehog'
7
6
  import { CreatorNode, CreatorNodeConfig } from './services/creatorNode'
@@ -14,12 +13,19 @@ import { UserStateManager } from './userStateManager'
14
13
  import type { Logger, CaptchaConfig, Nullable } from './utils'
15
14
  import { Captcha, Utils } from './utils'
16
15
 
16
+ import { Keypair, PublicKey } from '@solana/web3.js'
17
+
17
18
  import { getPlatformLocalStorage, LocalStorage } from './utils/localStorage'
18
19
  import { Web3Config, Web3Manager } from './services/web3Manager'
19
20
  import { EthWeb3Config, EthWeb3Manager } from './services/ethWeb3Manager'
20
21
  import { Comstock } from './services/comstock'
21
22
  import { IdentityService } from './services/identity'
22
23
  import { EthContracts } from './services/ethContracts'
24
+ import {
25
+ SolanaWeb3Manager,
26
+ SolanaUtils,
27
+ SolanaWeb3Config
28
+ } from './services/solana'
23
29
  import { AudiusContracts } from './services/dataContracts'
24
30
  import { Account } from './api/Account'
25
31
  import { Users } from './api/Users'
@@ -42,6 +48,11 @@ type LibsHedgehogConfig = Omit<
42
48
  'identityService' | 'localStorage'
43
49
  >
44
50
 
51
+ type LibsSolanaWeb3Config = SolanaWeb3Config & {
52
+ // fee payer secret keys, if client wants to switch between different fee payers during relay
53
+ feePayerSecretKeys?: Uint8Array[]
54
+ }
55
+
45
56
  type LibsDiscoveryProviderConfig = Omit<
46
57
  DiscoveryProviderConfig,
47
58
  'userStateManager' | 'ethContracts' | 'web3Manager'
@@ -217,10 +228,51 @@ export class AudiusLibs {
217
228
 
218
229
  /**
219
230
  * Configures a solana web3
220
- * This is a stubbed version for native
221
231
  */
222
- static configSolanaWeb3() {
223
- return {}
232
+ static configSolanaWeb3({
233
+ solanaClusterEndpoint,
234
+ mintAddress,
235
+ solanaTokenAddress,
236
+ claimableTokenPDA,
237
+ feePayerAddress,
238
+ claimableTokenProgramAddress,
239
+ rewardsManagerProgramId,
240
+ rewardsManagerProgramPDA,
241
+ rewardsManagerTokenPDA,
242
+ useRelay,
243
+ feePayerSecretKeys,
244
+ confirmationTimeout,
245
+ audiusDataAdminStorageKeypairPublicKey,
246
+ audiusDataProgramId,
247
+ audiusDataIdl
248
+ }: LibsSolanaWeb3Config): SolanaWeb3Config {
249
+ if (audiusDataAdminStorageKeypairPublicKey instanceof String) {
250
+ audiusDataAdminStorageKeypairPublicKey = new PublicKey(
251
+ audiusDataAdminStorageKeypairPublicKey
252
+ )
253
+ }
254
+ if (audiusDataProgramId instanceof String) {
255
+ audiusDataProgramId = new PublicKey(audiusDataProgramId)
256
+ }
257
+ return {
258
+ solanaClusterEndpoint,
259
+ mintAddress,
260
+ solanaTokenAddress,
261
+ claimableTokenPDA,
262
+ feePayerAddress,
263
+ claimableTokenProgramAddress,
264
+ rewardsManagerProgramId,
265
+ rewardsManagerProgramPDA,
266
+ rewardsManagerTokenPDA,
267
+ useRelay,
268
+ feePayerKeypairs: feePayerSecretKeys?.map((key) =>
269
+ Keypair.fromSecretKey(key)
270
+ ),
271
+ confirmationTimeout,
272
+ audiusDataAdminStorageKeypairPublicKey,
273
+ audiusDataProgramId,
274
+ audiusDataIdl
275
+ }
224
276
  }
225
277
 
226
278
  /**
@@ -254,7 +306,7 @@ export class AudiusLibs {
254
306
  ethWeb3Manager: Nullable<EthWeb3Manager>
255
307
  ethContracts: Nullable<EthContracts>
256
308
  web3Manager: Nullable<Web3Manager>
257
- // solanaWeb3Manager: Nullable<SolanaWeb3Manager>
309
+ solanaWeb3Manager: Nullable<SolanaWeb3Manager>
258
310
  contracts: Nullable<AudiusContracts>
259
311
  creatorNode: Nullable<CreatorNode>
260
312
  captcha: Nullable<Captcha>
@@ -327,7 +379,7 @@ export class AudiusLibs {
327
379
  this.ethWeb3Manager = null
328
380
  this.ethContracts = null
329
381
  this.web3Manager = null
330
- // this.solanaWeb3Manager = null
382
+ this.solanaWeb3Manager = null
331
383
  this.contracts = null
332
384
  this.creatorNode = null
333
385
  this.captcha = null
@@ -404,6 +456,14 @@ export class AudiusLibs {
404
456
  this.identityService.setWeb3Manager(this.web3Manager)
405
457
  }
406
458
  }
459
+ if (this.solanaWeb3Config) {
460
+ this.solanaWeb3Manager = new SolanaWeb3Manager(
461
+ this.solanaWeb3Config,
462
+ this.identityService,
463
+ this.web3Manager
464
+ )
465
+ await this.solanaWeb3Manager.init()
466
+ }
407
467
 
408
468
  /** Contracts - Eth and Data Contracts */
409
469
  const contractsToInit = []
@@ -489,7 +549,7 @@ export class AudiusLibs {
489
549
  this.contracts,
490
550
  this.ethWeb3Manager,
491
551
  this.ethContracts,
492
- null as any,
552
+ this.solanaWeb3Manager,
493
553
  null as any,
494
554
  null as any,
495
555
  this.creatorNode,
@@ -515,5 +575,7 @@ export class AudiusLibs {
515
575
  }
516
576
  }
517
577
 
578
+ export { SolanaUtils }
579
+
518
580
  export { Utils } from './utils'
519
581
  export { SanityChecks } from './sanityChecks'