AudiusProject / audius-protocol

The Audius Protocol - Freedom to share, monetize, and listen to any audio content.
https://docs.audius.org
Other
552 stars 106 forks source link

[PAY-3473] Add packages/eth scaffolding #9958

Open raymondjacobson opened 18 hours ago

raymondjacobson commented 18 hours ago

Description

Add packages/eth to replace the eth contracts interactions in libs for a cleaner, nicer SDK using viem instead of web3

Usage looks like this

import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'
import { ServiceTypeManager } from '@audius/eth'

const client = createPublicClient({
  chain: mainnet,
  transport: http(/* rpc endpoint */)
})

const contract = new ServiceTypeManager(client, {
  address: /* address */
})

await contract.getCurrentVersion({
  serviceType: utfToHex('discovery-node')
})

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide repro instructions & any configuration.

npm run build

and in the branch rj-remove-libs

npm run sdk:config -w packages/sdk

which generates config using this library instead of the old ethweb3manager

changeset-bot[bot] commented 18 hours ago

⚠️ No Changeset found

Latest commit: d4de75275efe279bf5c269927d056168b94ab93d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR