Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add resolver address #16

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions site/docs/cli/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ After finishing the deployment, update content hash of an ENS domain to point to
blumen deploy --ens v1rtl.eth
```

### `resolver-address`

Use a custom ENS Resolver address. Resolvers for mainnet and goerli are set by default.

### `chain`

Default: `mainnet`
Expand Down
4 changes: 4 additions & 0 deletions site/docs/cli/ens.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ blumen ens bafybeibp54tslsez36quqptgzwyda3vo66za3rraujksmsb3d5q247uht4 v1rtl.eth
### `rpc-url`

Use a custom Ethereum RPC for transactions. By default, [Ankr RPCs](https://ankr.com/rpc) are used.

### `resolver-address`

Use a custom ENS Resolver address. Resolvers for mainnet and goerli are set by default.
7 changes: 5 additions & 2 deletions src/actions/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type DeployActionArgs = {
strict: boolean
chain?: ChainName
ens?: string
resolverAddress?: Address
safe?: Address
name?: string
dist?: string
Expand All @@ -25,7 +26,9 @@ type DeployActionArgs = {

export const deployAction = async (
dir: string,
{ strict, ens, chain = 'mainnet', safe, name: customName, dist, verbose, providers: providersList }: DeployActionArgs,
{
strict, ens, chain = 'mainnet', safe, name: customName, dist, verbose, providers: providersList, resolverAddress,
}: DeployActionArgs,
) => {
if (!dir) {
if (await exists('dist')) dir = 'dist'
Expand Down Expand Up @@ -116,6 +119,6 @@ export const deployAction = async (

if (typeof ens === 'string') {
console.log('\n')
await ensAction(cid, ens, { chain, safe })
await ensAction(cid, ens, { chain, safe, resolverAddress })
}
}
6 changes: 3 additions & 3 deletions src/actions/ens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export const ensAction = async (
cid: string,
domain: string,
{
chain: chainName, safe: safeAddress, rpcUrl,
}: { chain: ChainName } & Partial<{ safe: Address | EIP3770Address, rpcUrl: string }>,
chain: chainName, safe: safeAddress, rpcUrl, resolverAddress,
}: { chain: ChainName } & Partial<{ safe: Address | EIP3770Address, rpcUrl: string, resolverAddress: Address }>,
) => {
const chain = chainName === 'mainnet' ? mainnet : goerli

Expand Down Expand Up @@ -77,7 +77,7 @@ export const ensAction = async (

const request = await publicClient.prepareTransactionRequest({
account: from,
to: PUBLIC_RESOLVER_ADDRESS[chain.id as 1 | 5],
to: resolverAddress || PUBLIC_RESOLVER_ADDRESS[chain.id as 1 | 5],
chain,
data: encodeFunctionData({
functionName: 'setContenthash',
Expand Down
2 changes: 2 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ cli
.command('deploy [dir]', 'Deploy a web app on IPFS')
.option('--strict', 'Throw if one of the providers fails', { default: true })
.option('--ens <domain>', 'Update Content-Hash of an ENS domain')
.option('--resolver-address <address>', 'Custom ENS Resolver address')
.option('--chain <chain>', 'Chain to use for ENS', { default: 'mainnet' })
.option('--name <name>', 'Name of the distribution (without file extension)')
.option('--dist <dist>', 'Directory to store the distribution file')
Expand All @@ -37,6 +38,7 @@ cli
.option('--chain <chain>', 'Chain to use', { default: 'mainnet' })
.option('--safe <safe>', 'Deploy using a Safe multisig wallet')
.option('--rpc-url <url>', 'Custom Ethereum RPC')
.option('--resolver-address <address>', 'Custom ENS Resolver address')
.action(ensAction)

cli.help()
Expand Down