Skip to content

Commit

Permalink
use clientwithaccount instead of walletclient
Browse files Browse the repository at this point in the history
  • Loading branch information
TateB committed Feb 20, 2024
1 parent b104a83 commit b29d4b3
Show file tree
Hide file tree
Showing 40 changed files with 140 additions and 129 deletions.
2 changes: 1 addition & 1 deletion docs/dns/function.importDnsName.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const hash = await importDnsName(wallet, {

| Parameter | Type | Description |
| :----------- | :-------------------------------------------------------------------- | :---------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `ImportDnsNameParameters`\< `TChain`, `TAccount`, `TChainOverride` \> | ImportDnsNameParameters |

## Returns
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.clearRecords.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const hash = await clearRecords(wallet, {

| Parameter | Type | Description |
| :--------------------------- | :--------------- | :---------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | ClearRecordsParameters |
| `parameters.name` | `string` | The name to clear records for |
| `parameters.resolverAddress` | \`0x$\{string}\` | The resolver address to use |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.commitName.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const hash = await commitName(wallet, {

| Parameter | Type | Description |
| :---------------------------- | :---------------------------- | :---------------------------------------------------------------------- | -------------------------------------------------------------- | ------------------------------ | -------------------------- | ------------- | -------------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | CommitNameParameters |
| `parameters.duration` | `number` | Duration of registration |
| `parameters.fuses`? | `EncodeChildFusesInputObject` | Fuses to set upon registration |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.createSubname.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const hash = await createSubname(wallet, {

| Parameter | Type | Description |
| :----------- | :-------------------------------------------------------------------- | :---------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `CreateSubnameParameters`\< `TChain`, `TAccount`, `TChainOverride` \> | CreateSubnameParameters |

## Returns
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.deleteSubname.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const hash = await deleteSubname(wallet, {

| Parameter | Type | Description |
| :-------------------- | :------------------------------ | :--------------------------------------------------------------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | DeleteSubnameParameters |
| `parameters.asOwner`? | `boolean` | If true, deletes via owner methods, otherwise will delete via parent owner methods |
| `parameters.contract` | `"nameWrapper"` \| `"registry"` | Contract to delete subname on |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.registerName.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const hash = await registerName(wallet, { ...params, value })

| Parameter | Type | Description |
| :---------------------------- | :---------------------------- | :---------------------------------------------------------------------- | -------------------------------------------------------------- | ------------------------------ | -------------------------- | ------------- | -------------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | RegisterNameParameters |
| `parameters.duration` | `number` | Duration of registration |
| `parameters.fuses`? | `EncodeChildFusesInputObject` | Fuses to set upon registration |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.renewNames.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const hash = await renewNames(wallet, {

| Parameter | Type | Description |
| :----------------------- | :--------------------- | :---------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | RenewNamesParameters |
| `parameters.duration` | `number` \| `bigint` | Duration to renew name(s) for |
| `parameters.nameOrNames` | `string` \| `string`[] | Name or names to renew |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setAbiRecord.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const hash = await setAbiRecord(wallet, {

| Parameter | Type | Description |
| :--------------------------- | :--------------------- | :----------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | SetAbiRecordParameters |
| `parameters.encodedAbi` | `null` \| `EncodedAbi` | Encoded ABI data to set |
| `parameters.name` | `string` | Name to set ABI for |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setAddressRecord.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const hash = await setAddressRecord(wallet, {

| Parameter | Type | Description |
| :--------------------------- | :------------------- | :---------------------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | SetAddressRecordParameters |
| `parameters.coin` | `string` \| `number` | Coin ticker or ID to set |
| `parameters.name` | `string` | Name to set address record for |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setChildFuses.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const hash = await setChildFuses(wallet, {

| Parameter | Type | Description |
| :------------------- | :----------------------- | :------------------------------------ |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | SetChildFusesParameters |
| `parameters.expiry`? | `number` \| `bigint` | Expiry to set for fuses |
| `parameters.fuses` | `EncodeFusesInputObject` | Fuse object or number value to set to |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setContentHashRecord.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const hash = await setContentHashRecord(wallet, {

| Parameter | Type | Description |
| :--------------------------- | :----------------- | :-------------------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | SetContentHashRecordParameters |
| `parameters.contentHash` | `null` \| `string` | Content hash value |
| `parameters.name` | `string` | Name to set content hash for |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setFuses.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const hash = await setFuses(wallet, {

| Parameter | Type | Description |
| :----------------- | :---------------------------- | :-------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | SetFusesParameters |
| `parameters.fuses` | `EncodeChildFusesInputObject` | Fuse object to set to |
| `parameters.name` | `string` | Name to set fuses for |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setPrimaryName.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const hash = await setPrimaryName(wallet, {

| Parameter | Type | Description |
| :----------- | :--------------------------------------------------------------------- | :----------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `SetPrimaryNameParameters`\< `TChain`, `TAccount`, `TChainOverride` \> | SetPrimaryNameParameters |

## Returns
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setRecords.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const hash = await setRecords(wallet, {

| Parameter | Type | Description |
| :--------------------------- | :---------------------------------------------------- | :------------------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | SetRecordsParameters |
| `parameters.abi`? | `Omit`\< `EncodeSetAbiParameters`, `"namehash"` \> | ABI value |
| `parameters.clearRecords`? | `boolean` | Clears all current records |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setResolver.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const hash = await setResolver(wallet, {

| Parameter | Type | Description |
| :--------------------------- | :------------------------------ | :-------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | SetResolverParameters |
| `parameters.contract` | `"nameWrapper"` \| `"registry"` | Contract to set resolver on |
| `parameters.name` | `string` | Name to set resolver for |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setTextRecord.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const hash = await setTextRecord(wallet, {

| Parameter | Type | Description |
| :--------------------------- | :----------------- | :-------------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | SetTextRecordParameters |
| `parameters.key` | `string` | The text record key to set |
| `parameters.name` | `string` | The name to set a text record for |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.transferName.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const hash = await transferName(wallet, {

| Parameter | Type | Description |
| :----------- | :------------------------------------------------------------------- | :--------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `TransferNameParameters`\< `TChain`, `TAccount`, `TChainOverride` \> | TransferNameParameters |

## Returns
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.unwrapName.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const hash = await unwrapName(wallet, {

| Parameter | Type | Description |
| :----------- | :-------------------------------------------------------------------------- | :------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `UnwrapNameParameters`\< `TName`, `TChain`, `TAccount`, `TChainOverride` \> | UnwrapNameParameters |

## Returns
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.wrapName.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const hash = await wrapName(wallet, {

| Parameter | Type | Description |
| :---------------------------- | :----------------------------------------------------------------------------------------- | :---------------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | WrapNameParameters |
| `parameters.fuses`? | `GetNameType`\< `TName` \> _extends_ `"eth-2ld"` ? `EncodeChildFusesInputObject` : `never` | Fuses to set on wrap (eth-2ld only) |
| `parameters.name` | `TName` | The name to wrap |
Expand Down
13 changes: 3 additions & 10 deletions packages/ensjs/src/contracts/consts.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import type {
Account,
Address,
Chain,
Client,
Transport,
WalletClient,
} from 'viem'
import type { Account, Address, Chain, Client, Transport } from 'viem'
import type { Assign, Prettify } from '../types.js'

type ChainContract = {
Expand Down Expand Up @@ -240,8 +233,8 @@ export type ClientWithEns<
TChain extends ChainWithEns = ChainWithEns,
> = Client<TTransport, TChain>

export type WalletWithEns<
export type ClientWithAccount<
TTransport extends Transport = Transport,
TChain extends ChainWithEns = ChainWithEns,
TAccount extends Account | undefined = Account | undefined,
> = WalletClient<TTransport, TChain, TAccount>
> = Client<TTransport, TChain, TAccount>
2 changes: 1 addition & 1 deletion packages/ensjs/src/contracts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export {
supportedContracts,
type ChainWithEns,
type CheckedChainWithEns,
type ClientWithAccount,
type ClientWithEns,
type SupportedChain,
type SupportedContract,
type WalletWithEns,
} from './consts.js'
export {
dnsRegistrarErrors,
Expand Down
12 changes: 6 additions & 6 deletions packages/ensjs/src/functions/dns/importDnsName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
type Hash,
type SendTransactionParameters,
type Transport,
type WalletClient,
} from 'viem'
import type { ChainWithEns, WalletWithEns } from '../../contracts/consts.js'
import { sendTransaction } from 'viem/actions'
import type { ChainWithEns, ClientWithAccount } from '../../contracts/consts.js'
import {
dnsRegistrarProveAndClaimSnippet,
dnsRegistrarProveAndClaimWithResolverSnippet,
Expand Down Expand Up @@ -64,7 +64,7 @@ export const makeFunctionData = <
TChain extends ChainWithEns,
TAccount extends Account | undefined,
>(
wallet: WalletClient<Transport, TChain, TAccount>,
wallet: ClientWithAccount<Transport, TChain, TAccount>,
{
name,
dnsImportData,
Expand Down Expand Up @@ -112,7 +112,7 @@ export const makeFunctionData = <

/**
* Creates a transaction to import a DNS name to ENS.
* @param wallet - {@link WalletWithEns}
* @param wallet - {@link ClientWithAccount}
* @param parameters - {@link ImportDnsNameParameters}
* @returns A transaction hash. {@link ImportDnsNameReturnType}
*
Expand Down Expand Up @@ -144,7 +144,7 @@ async function importDnsName<
TAccount extends Account | undefined,
TChainOverride extends ChainWithEns | undefined = ChainWithEns,
>(
wallet: WalletWithEns<Transport, TChain, TAccount>,
wallet: ClientWithAccount<Transport, TChain, TAccount>,
{
name,
address,
Expand All @@ -163,7 +163,7 @@ async function importDnsName<
...data,
...txArgs,
} as SendTransactionParameters<TChain, TAccount, TChainOverride>
return wallet.sendTransaction(writeArgs)
return sendTransaction(wallet, writeArgs)
}

importDnsName.makeFunctionData = makeFunctionData
Expand Down
11 changes: 6 additions & 5 deletions packages/ensjs/src/functions/wallet/clearRecords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import type {
SendTransactionParameters,
Transport,
} from 'viem'
import type { ChainWithEns, WalletWithEns } from '../../contracts/consts.js'
import { sendTransaction } from 'viem/actions'
import type { ChainWithEns, ClientWithAccount } from '../../contracts/consts.js'
import type {
Prettify,
SimpleTransactionRequest,
Expand Down Expand Up @@ -38,7 +39,7 @@ export const makeFunctionData = <
TChain extends ChainWithEns,
TAccount extends Account | undefined,
>(
_wallet: WalletWithEns<Transport, TChain, TAccount>,
_wallet: ClientWithAccount<Transport, TChain, TAccount>,
{ name, resolverAddress }: ClearRecordsDataParameters,
): ClearRecordsDataReturnType => {
return {
Expand All @@ -49,7 +50,7 @@ export const makeFunctionData = <

/**
* Clears the records for a name on a resolver.
* @param wallet - {@link WalletWithEns}
* @param wallet - {@link ClientWithAccount}
* @param parameters - {@link ClearRecordsParameters}
* @returns Transaction hash. {@link ClearRecordsReturnType}
*
Expand All @@ -74,7 +75,7 @@ async function clearRecords<
TAccount extends Account | undefined,
TChainOverride extends ChainWithEns | undefined = ChainWithEns,
>(
wallet: WalletWithEns<Transport, TChain, TAccount>,
wallet: ClientWithAccount<Transport, TChain, TAccount>,
{
name,
resolverAddress,
Expand All @@ -89,7 +90,7 @@ async function clearRecords<
...data,
...txArgs,
} as SendTransactionParameters<TChain, TAccount, TChainOverride>
return wallet.sendTransaction(writeArgs)
return sendTransaction(wallet, writeArgs)
}

clearRecords.makeFunctionData = makeFunctionData
Expand Down
Loading

0 comments on commit b29d4b3

Please sign in to comment.