@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.
@@ -1,5 +1,4 @@
1
1
  import type { provider } from 'web3-core';
2
- import type { SolanaWeb3Config } from './services/solana';
3
2
  import { HedgehogConfig } from './services/hedgehog';
4
3
  import type { Hedgehog as HedgehogBase } from '@audius/hedgehog';
5
4
  import { CreatorNode, CreatorNodeConfig } from './services/creatorNode';
@@ -14,6 +13,7 @@ import { EthWeb3Config, EthWeb3Manager } from './services/ethWeb3Manager';
14
13
  import { Comstock } from './services/comstock';
15
14
  import { IdentityService } from './services/identity';
16
15
  import { EthContracts } from './services/ethContracts';
16
+ import { SolanaWeb3Manager, SolanaUtils, SolanaWeb3Config } from './services/solana';
17
17
  import { AudiusContracts } from './services/dataContracts';
18
18
  import { Account } from './api/Account';
19
19
  import { Users } from './api/Users';
@@ -29,6 +29,9 @@ declare type LibsIdentityServiceConfig = {
29
29
  useHedgehogLocalStorage: boolean;
30
30
  };
31
31
  declare type LibsHedgehogConfig = Omit<HedgehogConfig, 'identityService' | 'localStorage'>;
32
+ declare type LibsSolanaWeb3Config = SolanaWeb3Config & {
33
+ feePayerSecretKeys?: Uint8Array[];
34
+ };
32
35
  declare type LibsDiscoveryProviderConfig = Omit<DiscoveryProviderConfig, 'userStateManager' | 'ethContracts' | 'web3Manager'>;
33
36
  declare type LibsComstockConfig = {
34
37
  url: string;
@@ -112,9 +115,8 @@ export declare class AudiusLibs {
112
115
  static configWormhole(): {};
113
116
  /**
114
117
  * Configures a solana web3
115
- * This is a stubbed version for native
116
118
  */
117
- static configSolanaWeb3(): {};
119
+ static configSolanaWeb3({ solanaClusterEndpoint, mintAddress, solanaTokenAddress, claimableTokenPDA, feePayerAddress, claimableTokenProgramAddress, rewardsManagerProgramId, rewardsManagerProgramPDA, rewardsManagerTokenPDA, useRelay, feePayerSecretKeys, confirmationTimeout, audiusDataAdminStorageKeypairPublicKey, audiusDataProgramId, audiusDataIdl }: LibsSolanaWeb3Config): SolanaWeb3Config;
118
120
  /**
119
121
  * Configures a solana audius-data
120
122
  * This is a stubbed version for native
@@ -140,6 +142,7 @@ export declare class AudiusLibs {
140
142
  ethWeb3Manager: Nullable<EthWeb3Manager>;
141
143
  ethContracts: Nullable<EthContracts>;
142
144
  web3Manager: Nullable<Web3Manager>;
145
+ solanaWeb3Manager: Nullable<SolanaWeb3Manager>;
143
146
  contracts: Nullable<AudiusContracts>;
144
147
  creatorNode: Nullable<CreatorNode>;
145
148
  captcha: Nullable<Captcha>;
@@ -170,5 +173,6 @@ export declare class AudiusLibs {
170
173
  /** Init services based on presence of a relevant config. */
171
174
  init(): Promise<void>;
172
175
  }
176
+ export { SolanaUtils };
173
177
  export { Utils } from './utils';
174
178
  export { SanityChecks } from './sanityChecks';
@@ -1,5 +1,5 @@
1
1
  import { Base } from './base';
2
- import { Nullable } from '../utils';
2
+ import type { Nullable } from '../utils';
3
3
  export declare enum Action {
4
4
  CREATE = "Create",
5
5
  UPDATE = "Update",
@@ -17,22 +17,40 @@ export interface PlaylistOperationResponse {
17
17
  * Block number of playlist transaction
18
18
  */
19
19
  blockNumber: Nullable<number>;
20
- /**
21
- * ID of playlist being modified
22
- */
23
- playlistId: Nullable<number>;
24
20
  /**
25
21
  * String error message returned
26
22
  */
27
23
  error: Nullable<string>;
28
24
  }
25
+ declare type PlaylistTrack = {
26
+ time: number;
27
+ metadata_time?: number;
28
+ track: number;
29
+ };
30
+ declare type PlaylistParam = {
31
+ playlist_id: number;
32
+ playlist_name: string;
33
+ artwork?: {
34
+ file?: File;
35
+ url?: string;
36
+ };
37
+ playlist_contents: {
38
+ track_ids: PlaylistTrack[];
39
+ };
40
+ cover_art_sizes: string;
41
+ description: string;
42
+ is_private: boolean;
43
+ is_album: boolean;
44
+ };
29
45
  export declare class EntityManager extends Base {
30
46
  /**
31
47
  * Generate random integer between two known values
32
48
  */
33
49
  getRandomInt(min: number, max: number): number;
34
- getFullPlaylist(playlistId: number, userId: number): Promise<any>;
35
- mapAddedTimestamps(addedTimestamps: any): any;
50
+ mapTimestamps(addedTimestamps: PlaylistTrack[]): {
51
+ track: number;
52
+ time: number;
53
+ }[];
36
54
  /**
37
55
  * Playlist default response values
38
56
  */
@@ -40,58 +58,15 @@ export declare class EntityManager extends Base {
40
58
  /**
41
59
  * Create a playlist using updated data contracts flow
42
60
  */
43
- createPlaylist({ playlistId, playlistName, trackIds, description, isAlbum, isPrivate, coverArt, logger }: {
44
- playlistId: number;
45
- playlistName: string;
46
- trackIds: number[];
47
- description: string;
48
- isAlbum: boolean;
49
- isPrivate: boolean;
50
- coverArt: string;
51
- logger: Console;
52
- }): Promise<PlaylistOperationResponse>;
61
+ createPlaylist(playlist: PlaylistParam): Promise<PlaylistOperationResponse>;
53
62
  /**
54
63
  * Delete a playlist using updated data contracts flow
55
64
  */
56
- deletePlaylist({ playlistId, logger }: {
57
- playlistId: number;
58
- logger: any;
59
- }): Promise<{
60
- blockHash: any;
61
- blockNumber: any;
62
- }>;
65
+ deletePlaylist(playlistId: number): Promise<PlaylistOperationResponse>;
63
66
  /**
64
67
  * Update a playlist using updated data contracts flow
65
- **/
66
- editPlaylist({ playlistId, playlistName, description, isAlbum, isPrivate, coverArt, logger }: {
67
- playlistId: number;
68
- playlistName: Nullable<string>;
69
- description: Nullable<string>;
70
- isAlbum: Nullable<boolean>;
71
- isPrivate: Nullable<boolean>;
72
- coverArt: Nullable<string>;
73
- logger: Console;
74
- }): Promise<PlaylistOperationResponse>;
75
- addPlaylistTrack({ playlistId, trackId, timestamp, logger }: {
76
- playlistId: number;
77
- trackId: number;
78
- timestamp: number;
79
- logger: Console;
80
- }): Promise<PlaylistOperationResponse>;
81
- deletePlaylistTrack({ playlistId, trackId, timestamp, logger }: {
82
- playlistId: number;
83
- trackId: number;
84
- timestamp: number;
85
- logger: Console;
86
- }): Promise<PlaylistOperationResponse>;
87
- /**
88
- * Update a playlist using updated data contracts flow
89
- **/
90
- orderPlaylist({ playlistId, trackIds, logger }: {
91
- playlistId: number;
92
- trackIds: number[];
93
- logger: Console;
94
- }): Promise<PlaylistOperationResponse>;
68
+ */
69
+ updatePlaylist(playlist: PlaylistParam): Promise<PlaylistOperationResponse>;
95
70
  /**
96
71
  * Manage an entity with the updated data contract flow
97
72
  * Leveraged to manipulate User/Track/Playlist/+ other entities
@@ -110,3 +85,4 @@ export declare class EntityManager extends Base {
110
85
  error: string;
111
86
  }>;
112
87
  }
88
+ export {};