@audius/sdk 2.0.3-beta.6 → 2.0.3-beta.7
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/dist/api/Account.d.ts +26 -0
- package/dist/api/Users.d.ts +20 -0
- package/dist/core.js +5 -0
- package/dist/core.js.map +1 -1
- package/dist/index.cjs.js +2658 -932
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +2646 -920
- package/dist/index.esm.js.map +1 -1
- package/dist/legacy.js +2656 -929
- package/dist/legacy.js.map +1 -1
- package/dist/native-libs.js +2647 -921
- package/dist/native-libs.js.map +1 -1
- package/dist/services/creatorNode/CreatorNode.d.ts +3 -7
- package/dist/services/dataContracts/IPLDBlacklistFactoryClient.d.ts +17 -0
- package/dist/services/dataContracts/PlaylistFactoryClient.d.ts +22 -0
- package/dist/services/dataContracts/RegistryClient.d.ts +15 -0
- package/dist/services/dataContracts/SocialFeatureFactoryClient.d.ts +11 -0
- package/dist/services/dataContracts/TrackFactoryClient.d.ts +23 -0
- package/dist/services/dataContracts/UserFactoryClient.d.ts +64 -0
- package/dist/services/dataContracts/UserLibraryFactoryClient.d.ts +9 -0
- package/dist/services/dataContracts/UserReplicaSetManagerClient.d.ts +82 -0
- package/dist/services/discoveryProvider/DiscoveryProvider.d.ts +1 -1
- package/dist/services/discoveryProvider/requests.d.ts +2 -1
- package/dist/services/solanaAudiusData/SolanaAudiusData.d.ts +408 -0
- package/dist/services/solanaAudiusData/errors.d.ts +7 -0
- package/dist/services/solanaAudiusData/index.d.ts +2 -0
- package/dist/utils/fileHasher.d.ts +9 -2
- package/dist/utils/types.d.ts +1 -0
- package/dist/utils/utils.d.ts +1 -0
- package/package.json +2 -1
- package/src/api/Account.ts +77 -0
- package/src/api/Users.ts +181 -3
- package/src/eth-contracts/ABIs/Wormhole.json +121 -11
- package/src/services/creatorNode/CreatorNode.ts +9 -0
- package/src/services/discoveryProvider/DiscoveryProvider.ts +4 -2
- package/src/services/discoveryProvider/requests.ts +6 -1
- package/src/services/solana/rewardsAttester.ts +47 -21
- package/src/utils/fileHasher.ts +18 -3
- package/src/utils/types.ts +1 -0
|
@@ -151,13 +151,7 @@ export declare class CreatorNode {
|
|
|
151
151
|
mood: Nullable<string>;
|
|
152
152
|
play_count: number;
|
|
153
153
|
owner_id: number;
|
|
154
|
-
release_date: Nullable<string>;
|
|
155
|
-
* Pulls off the user's clock value from a creator node endpoint and the user's wallet address.
|
|
156
|
-
* @param endpoint content node endpoint
|
|
157
|
-
* @param wallet user wallet address
|
|
158
|
-
* @param timeout max time alloted for clock request
|
|
159
|
-
* @param params optional query string params
|
|
160
|
-
*/
|
|
154
|
+
release_date: Nullable<string>;
|
|
161
155
|
repost_count: number;
|
|
162
156
|
save_count: number;
|
|
163
157
|
tags: Nullable<string>;
|
|
@@ -182,6 +176,8 @@ export declare class CreatorNode {
|
|
|
182
176
|
}>;
|
|
183
177
|
uploadTrackAudioV2(file: File, onProgress: ProgressCB): Promise<any>;
|
|
184
178
|
uploadTrackCoverArtV2(file: File, onProgress: ProgressCB): Promise<any>;
|
|
179
|
+
uploadProfilePictureV2(file: File, onProgress?: ProgressCB): Promise<any>;
|
|
180
|
+
uploadCoverPhotoV2(file: File, onProgress?: ProgressCB): Promise<any>;
|
|
185
181
|
uploadFileV2(file: File, onProgress: ProgressCB, template: 'audio' | 'img_square' | 'img_backdrop'): Promise<any>;
|
|
186
182
|
/**
|
|
187
183
|
* Works for both track transcode and image resize jobs
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ContractClient } from '../contracts/ContractClient';
|
|
2
|
+
import { EIP712TypedData } from 'eth-sig-util';
|
|
3
|
+
declare type GeneratorFn = (chainId: number, contractAddress: string, multihashDigest: string, nonce: string) => EIP712TypedData;
|
|
4
|
+
export declare class IPLDBlacklistFactoryClient extends ContractClient {
|
|
5
|
+
addIPLDToBlacklist(multihashDigest: string, privateKey?: null): Promise<any>;
|
|
6
|
+
/**
|
|
7
|
+
* Gets a nonce and generates a signature for the given function. Private key is optional and
|
|
8
|
+
* will use that private key to create the signature. Otherwise the web3Manager private key
|
|
9
|
+
* will be used.
|
|
10
|
+
* @param generatorFn signature scheme object function
|
|
11
|
+
* @param multihashDigest blockchain userId
|
|
12
|
+
* @param privateKey optional. if this is passed in, the signature will be from
|
|
13
|
+
* this private key. the type is a 64 character hex string
|
|
14
|
+
*/
|
|
15
|
+
getUpdateNonceAndSig(generatorFn: GeneratorFn, multihashDigest: string, privateKey: string | null): Promise<unknown[]>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ContractClient } from '../contracts/ContractClient';
|
|
2
|
+
import type { Web3Manager } from '../web3Manager';
|
|
3
|
+
export declare class PlaylistFactoryClient extends ContractClient {
|
|
4
|
+
web3Manager: Web3Manager;
|
|
5
|
+
createPlaylist(userId: number, playlistName: string, isPrivate: boolean, isAlbum: boolean, trackIds: number[]): Promise<{
|
|
6
|
+
playlistId: number;
|
|
7
|
+
txReceipt: import("web3-core").TransactionReceipt;
|
|
8
|
+
}>;
|
|
9
|
+
deletePlaylist(playlistId: number): Promise<{
|
|
10
|
+
playlistId: number;
|
|
11
|
+
txReceipt: import("web3-core").TransactionReceipt;
|
|
12
|
+
}>;
|
|
13
|
+
addPlaylistTrack(playlistId: number, addedTrackId: number): Promise<import("web3-core").TransactionReceipt>;
|
|
14
|
+
deletePlaylistTrack(playlistId: number, deletedTrackId: number, deletedPlaylistTimestamp: number, retries?: number): Promise<import("web3-core").TransactionReceipt>;
|
|
15
|
+
orderPlaylistTracks(playlistId: number, trackIds: number[], retries?: number): Promise<import("web3-core").TransactionReceipt>;
|
|
16
|
+
updatePlaylistPrivacy(playlistId: number, updatedPlaylistPrivacy: boolean): Promise<import("web3-core").TransactionReceipt>;
|
|
17
|
+
updatePlaylistName(playlistId: number, updatedPlaylistName: string): Promise<import("web3-core").TransactionReceipt>;
|
|
18
|
+
updatePlaylistCoverPhoto(playlistId: number, updatedPlaylistImageMultihashDigest: string): Promise<import("web3-core").TransactionReceipt>;
|
|
19
|
+
updatePlaylistDescription(playlistId: number, updatedPlaylistDescription: string): Promise<import("web3-core").TransactionReceipt>;
|
|
20
|
+
updatePlaylistUPC(playlistId: number, updatedPlaylistUPC: string): Promise<import("web3-core").TransactionReceipt>;
|
|
21
|
+
isTrackInPlaylist(playlistId: number, trackId: number): Promise<any>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ContractABI } from '../../utils';
|
|
2
|
+
import { Web3Manager } from '../web3Manager';
|
|
3
|
+
import { ProviderSelection } from '../contracts/ProviderSelection';
|
|
4
|
+
import type { Contract } from 'web3-eth-contract';
|
|
5
|
+
export declare class RegistryClient {
|
|
6
|
+
web3Manager: Web3Manager;
|
|
7
|
+
contractABI: ContractABI['abi'];
|
|
8
|
+
contractAddress: string;
|
|
9
|
+
Registry: Contract;
|
|
10
|
+
providerSelector: ProviderSelection | null;
|
|
11
|
+
constructor(web3Manager: Web3Manager, contractABI: ContractABI['abi'], contractAddress: string);
|
|
12
|
+
getContract(contractRegistryKey: string): Promise<string | undefined>;
|
|
13
|
+
retryInit(contractRegistryKey: string): Promise<string | undefined>;
|
|
14
|
+
selectNewEndpoint(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ContractClient } from '../contracts/ContractClient';
|
|
2
|
+
import type { Web3Manager } from '../web3Manager';
|
|
3
|
+
export declare class SocialFeatureFactoryClient extends ContractClient {
|
|
4
|
+
web3Manager: Web3Manager;
|
|
5
|
+
addTrackRepost(userId: number, trackId: number): Promise<import("web3-core").TransactionReceipt>;
|
|
6
|
+
deleteTrackRepost(userId: number, trackId: number): Promise<import("web3-core").TransactionReceipt>;
|
|
7
|
+
addPlaylistRepost(userId: number, playlistId: number): Promise<import("web3-core").TransactionReceipt>;
|
|
8
|
+
deletePlaylistRepost(userId: number, playlistId: number): Promise<import("web3-core").TransactionReceipt>;
|
|
9
|
+
addUserFollow(followerUserId: number, followeeUserId: number): Promise<import("web3-core").TransactionReceipt>;
|
|
10
|
+
deleteUserFollow(followerUserId: number, followeeUserId: number): Promise<import("web3-core").TransactionReceipt>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ContractClient } from '../contracts/ContractClient';
|
|
2
|
+
import type { Web3Manager } from '../web3Manager';
|
|
3
|
+
export declare class TrackFactoryClient extends ContractClient {
|
|
4
|
+
web3Manager: Web3Manager;
|
|
5
|
+
getTrack(trackId: string): Promise<any>;
|
|
6
|
+
/** uint _userId, bytes32 _multihashDigest, uint8 _multihashHashFn, uint8 _multihashSize */
|
|
7
|
+
addTrack(userId: number, multihashDigest: string, multihashHashFn: number, multihashSize: number): Promise<{
|
|
8
|
+
trackId: number;
|
|
9
|
+
txReceipt: import("web3-core").TransactionReceipt;
|
|
10
|
+
}>;
|
|
11
|
+
/** uint _trackId, uint _trackOwnerId, bytes32 _multihashDigest, uint8 _multihashHashFn, uint8 _multihashSize */
|
|
12
|
+
updateTrack(trackId: number, trackOwnerId: number, multihashDigest: string, multihashHashFn: number, multihashSize: number): Promise<{
|
|
13
|
+
trackId: number;
|
|
14
|
+
txReceipt: import("web3-core").TransactionReceipt;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* @return deleted trackId from on-chain event log
|
|
18
|
+
*/
|
|
19
|
+
deleteTrack(trackId: number): Promise<{
|
|
20
|
+
trackId: number;
|
|
21
|
+
txReceipt: import("web3-core").TransactionReceipt;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ContractClient } from '../contracts/ContractClient';
|
|
2
|
+
import { Nullable } from '../../utils';
|
|
3
|
+
import { EIP712TypedData } from 'eth-sig-util';
|
|
4
|
+
import type { Web3Manager } from '../web3Manager';
|
|
5
|
+
declare type GeneratorFn = (chainId: number, contractAddress: string, userId: number, newValue: unknown, nonce: string) => EIP712TypedData;
|
|
6
|
+
export declare class UserFactoryClient extends ContractClient {
|
|
7
|
+
web3Manager: Web3Manager;
|
|
8
|
+
getUser(userId: number): Promise<any>;
|
|
9
|
+
/** valid = does not exist and meets handle requirements (defined on chain) */
|
|
10
|
+
handleIsValid(handle: string): Promise<any>;
|
|
11
|
+
addUser(handle: string): Promise<{
|
|
12
|
+
txReceipt: import("web3-core").TransactionReceipt;
|
|
13
|
+
userId: number;
|
|
14
|
+
}>;
|
|
15
|
+
updateMultihash(userId: number, multihashDigest: string): Promise<{
|
|
16
|
+
txReceipt: import("web3-core").TransactionReceipt;
|
|
17
|
+
multihashDigest: any;
|
|
18
|
+
}>;
|
|
19
|
+
updateName(userId: number, name: string): Promise<{
|
|
20
|
+
txReceipt: import("web3-core").TransactionReceipt;
|
|
21
|
+
name: string;
|
|
22
|
+
}>;
|
|
23
|
+
updateLocation(userId: number, location: string): Promise<{
|
|
24
|
+
txReceipt: import("web3-core").TransactionReceipt;
|
|
25
|
+
location: string;
|
|
26
|
+
}>;
|
|
27
|
+
updateBio(userId: number, bio: Nullable<string>): Promise<{
|
|
28
|
+
txReceipt: import("web3-core").TransactionReceipt;
|
|
29
|
+
bio: any;
|
|
30
|
+
}>;
|
|
31
|
+
updateProfilePhoto(userId: number, profilePhotoMultihashDigest: string): Promise<{
|
|
32
|
+
txReceipt: import("web3-core").TransactionReceipt;
|
|
33
|
+
profilePhotoMultihashDigest: any;
|
|
34
|
+
}>;
|
|
35
|
+
updateCoverPhoto(userId: number, coverPhotoMultihashDigest: string): Promise<{
|
|
36
|
+
txReceipt: import("web3-core").TransactionReceipt;
|
|
37
|
+
coverPhotoMultihashDigest: any;
|
|
38
|
+
}>;
|
|
39
|
+
/**
|
|
40
|
+
* This function is called from the identity service, not from the client. As a result,
|
|
41
|
+
* the return properties are different. The web3 sendTransaction() function isn't called, rather
|
|
42
|
+
* the encodedABI and contract address are returned, and the identity service can relay it
|
|
43
|
+
* to the chain on behalf of the user
|
|
44
|
+
* @param userId blockchain userId
|
|
45
|
+
* @param isVerified
|
|
46
|
+
* @param privateKey 64 character hex string
|
|
47
|
+
*/
|
|
48
|
+
updateIsVerified(userId: number, isVerified: boolean, privateKey: string): Promise<any[]>;
|
|
49
|
+
updateCreatorNodeEndpoint(userId: number, creatorNodeEndpoint: string): Promise<{
|
|
50
|
+
txReceipt: import("web3-core").TransactionReceipt;
|
|
51
|
+
creatorNodeEndpoint: any;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* Gets a nonce and generates a signature for the given function. Private key is optional and
|
|
55
|
+
* will use that private key to create the signature. Otherwise the web3Manager private key
|
|
56
|
+
* will be used.
|
|
57
|
+
* @param generatorFn signature scheme object function
|
|
58
|
+
* @param userId blockchain userId
|
|
59
|
+
* @param newValue new value to set
|
|
60
|
+
* @param privateKey 64 character hex string
|
|
61
|
+
*/
|
|
62
|
+
getUpdateNonceAndSig(generatorFn: GeneratorFn, userId: number, newValue: unknown, privateKey?: string): Promise<unknown[]>;
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ContractClient } from '../contracts/ContractClient';
|
|
2
|
+
import type { Web3Manager } from '../web3Manager';
|
|
3
|
+
export declare class UserLibraryFactoryClient extends ContractClient {
|
|
4
|
+
web3Manager: Web3Manager;
|
|
5
|
+
addTrackSave(userId: number, trackId: number): Promise<import("web3-core").TransactionReceipt>;
|
|
6
|
+
deleteTrackSave(userId: number, trackId: number): Promise<import("web3-core").TransactionReceipt>;
|
|
7
|
+
addPlaylistSave(userId: number, playlistId: number): Promise<import("web3-core").TransactionReceipt>;
|
|
8
|
+
deletePlaylistSave(userId: number, playlistId: number): Promise<import("web3-core").TransactionReceipt>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ContractClient } from '../contracts/ContractClient';
|
|
2
|
+
import type { Web3Manager } from '../web3Manager';
|
|
3
|
+
export declare class UserReplicaSetManagerClient extends ContractClient {
|
|
4
|
+
web3Manager: Web3Manager;
|
|
5
|
+
/**
|
|
6
|
+
* Update a user's replica set on the UserReplicaSetManager contract
|
|
7
|
+
* Callable by user wallet, or any node within the user's replica set
|
|
8
|
+
* @param userId
|
|
9
|
+
* @param primary
|
|
10
|
+
* @param secondaries
|
|
11
|
+
*/
|
|
12
|
+
updateReplicaSet(userId: number, primary: number, secondaries: number[]): Promise<import("web3-core").TransactionReceipt>;
|
|
13
|
+
/**
|
|
14
|
+
* Add a new content node to the L2 layer of the protocol
|
|
15
|
+
* Requires signatures from 3 existing nodes on the UserReplicaSetManager contract
|
|
16
|
+
* @param cnodeId
|
|
17
|
+
* @param cnodeOwnerWallets - [0] = incoming delegateOwnerWallet, [1] = incoming ownerWallet
|
|
18
|
+
* @param proposerSpIds
|
|
19
|
+
* @param proposerNonces
|
|
20
|
+
* @param proposer1Sig
|
|
21
|
+
* @param proposer2Sig
|
|
22
|
+
* @param proposer3Sig
|
|
23
|
+
*/
|
|
24
|
+
addOrUpdateContentNode(cnodeId: number, cnodeOwnerWallets: string[], proposerSpIds: number[], proposerNonces: string[], proposer1Sig: string, proposer2Sig: string, proposer3Sig: string): Promise<import("web3-core").TransactionReceipt>;
|
|
25
|
+
/**
|
|
26
|
+
* Generate the relevant data required to propose a new content node
|
|
27
|
+
* Each incoming node requires 3 distinct signatures in order to be added
|
|
28
|
+
* This function will be used by content nodes
|
|
29
|
+
*/
|
|
30
|
+
getProposeAddOrUpdateContentNodeRequestData(cnodeId: number, cnodeDelegateWallet: string, cnodeOwnerWallet: string, proposerSpId: number): Promise<{
|
|
31
|
+
nonce: string;
|
|
32
|
+
signatureData: {
|
|
33
|
+
types: {
|
|
34
|
+
EIP712Domain: {
|
|
35
|
+
name: string;
|
|
36
|
+
type: string;
|
|
37
|
+
}[];
|
|
38
|
+
};
|
|
39
|
+
domain: any;
|
|
40
|
+
primaryType: any;
|
|
41
|
+
message: any;
|
|
42
|
+
};
|
|
43
|
+
sig: unknown;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Returns replica set for requested user at requested blocknumber
|
|
47
|
+
* @param userId
|
|
48
|
+
* @returns replica set info with schema { primaryId: int, secondaryIds: number[] }
|
|
49
|
+
*/
|
|
50
|
+
getUserReplicaSet(userId: number): Promise<{
|
|
51
|
+
primaryId: number;
|
|
52
|
+
secondaryIds: number[];
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* Returns replica set for requested user at requested blocknumber
|
|
56
|
+
* @notice will error if web3 cannot find data for requested blocknumber
|
|
57
|
+
* @returns replica set info with schema { primaryId: int, secondaryIds: int[] }
|
|
58
|
+
*/
|
|
59
|
+
getUserReplicaSetAtBlockNumber(userId: number, blockNumber: number): Promise<{
|
|
60
|
+
primaryId: number;
|
|
61
|
+
secondaryIds: number[];
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* Return the current ownerWallet and delegateOwnerWallet for a given spID
|
|
65
|
+
*/
|
|
66
|
+
getContentNodeWallets(spId: number): Promise<any>;
|
|
67
|
+
/**
|
|
68
|
+
* Return boolean indicating status of URSM seed operation
|
|
69
|
+
* Prior to seed, no replica sets can be written
|
|
70
|
+
*/
|
|
71
|
+
getSeedComplete(): Promise<any>;
|
|
72
|
+
/**
|
|
73
|
+
* Submit update transaction to UserReplicaSetManager to modify a user's replica set
|
|
74
|
+
* Can be sent by user's wallet, or any content node in the replica set
|
|
75
|
+
* @param userId
|
|
76
|
+
* @param primary
|
|
77
|
+
* @param secondaries
|
|
78
|
+
* @param oldPrimary
|
|
79
|
+
* @param oldSecondaries
|
|
80
|
+
*/
|
|
81
|
+
_updateReplicaSet(userId: number, primary: number, secondaries: number[], oldPrimary: number, oldSecondaries: number[]): Promise<import("web3-core").TransactionReceipt>;
|
|
82
|
+
}
|
|
@@ -118,7 +118,7 @@ export declare class DiscoveryProvider {
|
|
|
118
118
|
* await getUsers()
|
|
119
119
|
* await getUsers(100, 0, [3,2,6]) - Invalid user ids will not be accepted
|
|
120
120
|
*/
|
|
121
|
-
getUsers(limit: number | undefined, offset: number | undefined, idsArray: Nullable<number[]>, walletAddress?: Nullable<string>, handle?: Nullable<string>, minBlockNumber?: Nullable<number>): Promise<Nullable<import("../../utils").UserMetadata[]> | undefined>;
|
|
121
|
+
getUsers(limit: number | undefined, offset: number | undefined, idsArray: Nullable<number[]>, walletAddress?: Nullable<string>, handle?: Nullable<string>, minBlockNumber?: Nullable<number>, includeIncomplete?: Nullable<boolean>): Promise<Nullable<import("../../utils").UserMetadata[]> | undefined>;
|
|
122
122
|
/**
|
|
123
123
|
* get tracks with all relevant track data
|
|
124
124
|
* can be filtered by providing an integer array of ids
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Nullable } from '../../utils';
|
|
2
2
|
import type { ResponseType } from 'axios';
|
|
3
|
-
export declare const getUsers: (limit: number | undefined, offset: number | undefined, idsArray: Nullable<number[]>, walletAddress?: Nullable<string> | undefined, handle?: Nullable<string> | undefined, minBlockNumber?: Nullable<number> | undefined) => {
|
|
3
|
+
export declare const getUsers: (limit: number | undefined, offset: number | undefined, idsArray: Nullable<number[]>, walletAddress?: Nullable<string> | undefined, handle?: Nullable<string> | undefined, minBlockNumber?: Nullable<number> | undefined, includeIncomplete?: Nullable<boolean> | undefined) => {
|
|
4
4
|
endpoint: string;
|
|
5
5
|
queryParams: {
|
|
6
6
|
limit: number;
|
|
@@ -9,6 +9,7 @@ export declare const getUsers: (limit: number | undefined, offset: number | unde
|
|
|
9
9
|
wallet?: string | undefined;
|
|
10
10
|
min_block_number?: number | undefined;
|
|
11
11
|
id?: string[] | undefined;
|
|
12
|
+
include_incomplete?: boolean | undefined;
|
|
12
13
|
};
|
|
13
14
|
};
|
|
14
15
|
export declare const getTracks: (limit: number | undefined, offset: number | undefined, idsArray: Nullable<string[]>, targetUserId: Nullable<string>, sort: Nullable<boolean>, minBlockNumber: Nullable<number>, filterDeleted: Nullable<boolean>, withUsers?: boolean) => {
|