Closed foreseaz closed 9 months ago
@TateB @LeonmanRolls , could you please give an example of a complete flow on how to use ENS
to setRecord
with input a JsonRpcProvider
?
And from ens app v3, https://github.com/ensdomains/ens-app-v3/blob/dev/src/transaction-flow/transaction/updateProfile.ts#L22
ens.setRecords.populateTransaction(data.name, {
records: data.records,
resolverAddress: data.resolver,
signer,
})
Could you add an example of this to the current document?
the example from ens-app-v3 you're referencing is passing a signer in which comes from useSigner, you could do the same. in a react app you'd probably also want to use EnsProvider
const signer = useSigner();
const { setRecord } = useEns();
const test = async (ensName: string) => {
const record = {
type: 'contentHash',
record: 'ipns://k51qzi5uqu5dgox2z23r6e99oqency055a6xt92xzmyvpz8mwz5ycjavm0u150',
signer,
}
const tx = await setRecord(ensName, record as any);
}
in the current version of wagmi it should be something like:
const { data: signer } = useSigner();
const { setRecord } = useEns();
const test = async (ensName: string) => {
const record = {
type: 'contentHash',
record: 'ipns://k51qzi5uqu5dgox2z23r6e99oqency055a6xt92xzmyvpz8mwz5ycjavm0u150',
signer: signer as ethers.providers.JsonRpcSigner,
}
const tx = await setRecord(ensName, record as any);
}
Hi ens devs, I'm currently using ensjs-v3 with
wagmi
(andrainbowkit
). The question is when I try tosetRecord
using the following flow, the error showsUnhandled Runtime Error TypeError: thisRef.provider?.getSigner is not a function
:Since the
setProvider
param isethers.providers.JsonRpcProvider
instead ofethers.providers.web3Provider
, the current way for ENS instance gets the Signer is fromJsonRpcProvider.getSigner
method. Could it be possible for ENS add an API like:So that it will be more flexible to add external signer instead of getting from
JsonRpcProvider
? Or do you have any suggestion for my case using ENSjsV3 withwagmi
(andrainbowkit
)?Thanks in advance for the reply!