Major Changes
-
4f924fe: Consolidate Ethereum contract services into a single
EthereumServiceThe individual Ethereum contract client classes (
GovernanceClient,
ClaimsManagerClient,ServiceProviderFactoryClient,
EthRewardsManagerClient,ServiceTypeManagerClient,
TrustedNotifierManagerClient,StakingClient,DelegateManagerClient,
AudiusTokenClient,AudiusWormholeClient,RegistryClient) have been
removed from the SDK'sServicesContainer. They are replaced by a single
EthereumServiceinstance exposed atsdk.services.ethereum, which wraps
each contract as a typed viem contract instance.Before:
await sdk.services.governanceClient.getVotingPeriod(); await sdk.services.claimsManagerClient.getPendingClaim(wallet);
After:
await sdk.services.ethereum.governance.read.getVotingPeriod([]); await sdk.services.ethereum.claimsManager.read.getPendingClaim([wallet]);
Contract instances expose the full viem contract interface (
.read.*,
.simulate.*,.write.*,.watchEvent.*). ABIs and addresses are sourced
from@audius/ethwith optional per-environment overrides via
EthereumServiceConfig. -
383db12: OAuth: rewrite with PKCE, async login, and React Native support
The OAuth service has been fully reworked. It now uses the OAuth 2.0
Authorization Code Flow with PKCE. The implicit flow (Ethereum-signed JWT)
has been removed. Tokens are persisted across sessions by default.sdk.oauthis now always defined — no null check or!assertion needed.React Native / Expo is now supported out of the box. See the React Native / Expo section below.
Breaking changes
Removed APIs
Removed Replacement oauth.init({ successCallback, errorCallback })No replacement — call login()directlyoauth.renderButton(element, options)No replacement — build your own sign-in button LoginSuccessCallbacktypeUse login().then()orawait login()LoginErrorCallbacktypeUse login().catch()or try/catchawait login()ButtonOptionstype— LoginResulttypeCall oauth.getUser()after login insteadwrite_oncescopeUse writescope insteadWriteOnceParamstype— Changed APIs
API Before After login()fire-and-forget, no redirectUriasync, returnsPromise<void>;redirectUrioptional if set in SDK confighasRefreshTokensynchronous getter ( boolean)asyncmethod returningPromise<boolean>Added APIs
Added Description handleRedirect(url?: string)Completes the OAuth flow from the redirect page. On mobile, called automatically inside login().isAuthenticated()asyncmethod returningPromise<boolean>— true if an access token is stored.getUser()Fetches the authenticated user's profile using the stored access token. redirectUriSet
redirectUrionce in the SDK config and it applies to everylogin()call. You can still pass it per-call to override the config value.// Set once: const sdk = audiusSdk({ appName: "My App", apiKey: "YOUR_API_KEY", redirectUri: "https://yourapp.com/callback", }); // Override per-call if needed: await sdk.oauth.login({ scope: "write", redirectUri: "https://yourapp.com/other-callback", });
A
redirectUrimust be available from one of these sources orlogin()will throw.Migration guide
Before
// Once on mount: sdk.oauth!.init({ successCallback: (profile) => setUser(profile), errorCallback: (error) => setError(error.message), }); // On sign-in button click: sdk.oauth!.login({ scope: "write", display: "popup" });
After
// Once at initialization: const sdk = audiusSdk({ appName: "My App", apiKey: "YOUR_API_KEY", redirectUri: "https://yourapp.com/callback", }); // On sign-in button click: try { await sdk.oauth.login({ scope: "write" }); setUser(await sdk.oauth.getUser()); } catch (error) { setError(error.message); }
write_oncescopeReplace
write_oncewithwrite.Callback page (
handleRedirect)On your callback page, call
handleRedirect(). In a popup it forwards the
code to the parent window and closes itself; in a full-page redirect it
performs the token exchange locally:await sdk.oauth.handleRedirect(); // Popup: closes automatically and resolves the parent login() promise // Full-page redirect: token exchange complete — call getUser() next
On mobile (React Native / Expo), the redirect is handled automatically
insidelogin()— no call tohandleRedirect()is needed.Registering a redirect URI
Register your redirect URI(s) at audius.co/settings → Developer Apps.
Mobile — use a custom URL scheme (e.g.
myapp://oauth/callback) and register
the scheme as an intent filter in your app's native config.Local development — register
http://localhost:PORT/callbackfor your dev environment.React Native / Expo
Import from
@audius/sdkon React Native — the native entry point automatically:- Uses
AsyncStoragefor token persistence across app restarts - Uses
expo-web-browser(openAuthSessionAsync) for the OAuth browser session, bypassing universal link interception
No extra configuration is needed.
login()resolves after the browser closes and
the token exchange completes:const sdk = audiusSdk({ appName: "My App", apiKey: "YOUR_API_KEY", redirectUri: "myapp://oauth/callback", }); await sdk.oauth.login({ scope: "write" }); const user = await sdk.oauth.getUser();
- Uses
-
e0e1ecb: Create SDK without services by default in all cases
Updates the
sdk()constructor to create the SDK without the old services and API structure regardless of config. This will align all configurations to have the same API surface that matches existing docs and examples.To maintain compatibility, older legacy apps can use
createSdkWithServices()instead ofsdk()when initting the SDK. This is not advised for third-party apps. -
671fa83: Remove CommonJS build outputs from the SDK. The SDK now only ships ESM (
index.esm.jsandindex.browser.esm.js). Themainfield inpackage.jsonnow points to the ESM output. Consumers that relied onrequire('@audius/sdk')will need to switch to ESM imports.
Minor Changes
-
f79f7df: Generated API updates: track download counts, /me endpoint
- Added
TracksApi.getTrackDownloadCount()andgetTrackDownloadCounts()from swagger - Added
UsersApi.getMe()for the authenticated user endpoint - Fixed generator script (
gen.js→gen.cjs) for ESM compatibility — the SDK package uses"type": "module"which caused Node to treat.jsfiles as ESM, breaking therequire()-based generator
- Added