@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.
- package/dist/NativeAudiusLibs.d.ts +7 -3
- package/dist/api/entityManager.d.ts +30 -54
- package/dist/index.cjs.js +159 -544
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +160 -545
- package/dist/index.esm.js.map +1 -1
- package/dist/legacy.js +159 -544
- package/dist/legacy.js.map +1 -1
- package/dist/native-libs.js +8385 -5047
- package/dist/native-libs.js.map +1 -1
- package/dist/sdk/api/generated/default/models/Track.d.ts +6 -0
- package/dist/sdk/api/generated/full/models/TrackFull.d.ts +6 -0
- package/dist/services/web3Manager/Web3Config.d.ts +1 -0
- package/package.json +3 -2
- package/src/NativeAudiusLibs.ts +69 -7
- package/src/api/entityManager.ts +60 -350
- package/src/sdk/api/generated/default/models/Track.ts +6 -0
- package/src/sdk/api/generated/full/models/TrackFull.ts +6 -0
- package/src/services/solana/SolanaWeb3Manager.ts +4 -5
- package/src/services/web3Manager/Web3Config.ts +1 -0
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audius/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.38",
|
|
4
4
|
"audius": {
|
|
5
|
-
"releaseSHA": "
|
|
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",
|
package/src/NativeAudiusLibs.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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'
|