-
Notifications
You must be signed in to change notification settings - Fork 0
/
app-fid-registry.ts
36 lines (27 loc) · 991 Bytes
/
app-fid-registry.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { farcaster, provider } from "./common";
import { ethers } from "ethers";
const APP_PRIVATE_KEY = 'PRIVATE KEY';
const wallet = new ethers.Wallet(APP_PRIVATE_KEY, provider);
(async () => {
const price = await farcaster.getPrice(1n);
console.log(`price: ${price.toString()}, ${price.toString().length}`);
const fid = await farcaster.getIdOf(wallet.address)
console.log(`fid: ${fid}`);
if (fid !== 0n) {
return;
}
const recoveryAddress = 'RECOVERY ADDRESS';
const registerFidCalldata = await farcaster.getCalldataRegisterIdGateWay(
recoveryAddress
)
const registerFidTxParam: any = {
from: wallet.address,
to: farcaster.contractAddresses.ID_GATEWAY_ADDRESS,
data: registerFidCalldata.data,
value: price,
}
const tx = await wallet.sendTransaction(registerFidTxParam);
const receipt = await tx.wait();
console.log(receipt);
console.log(registerFidTxParam);
})()