-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate to coinbase smart wallet contract
- Loading branch information
1 parent
544181a
commit ac26023
Showing
30 changed files
with
849 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
NEXT_PUBLIC_STACKUP_BUNDLER_API_KEY="" | ||
NEXT_PUBLIC_RPC_ENDPOINT="" | ||
ETHERSCAN_API_KEY="" | ||
NEXT_PUBLIC_FACTORY_CONTRACT_ADDRESS="0xE4e6BF50E1fb02b323ca855dF0d8D76a75290FfC" | ||
NEXT_PUBLIC_FACTORY_CONTRACT_ADDRESS="0x0BA5ED0c6AA8c49038F819E587E2633c4A9F428a" | ||
RELAYER_PRIVATE_KEY="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
import { Hex, stringify } from "viem"; | ||
import { PUBLIC_CLIENT } from "@/constants"; | ||
|
||
export async function GET(_req: Request, { params }: { params: { address: Hex } }) { | ||
const { address } = params; | ||
if (!address) { | ||
return Response.json(JSON.parse(stringify({ error: "address is required" }))); | ||
} | ||
const result = await fetch( | ||
`https://api-sepolia.etherscan.io/api?module=account&action=balance&address=${address}&tag=latest&apikey=${process.env.ETHERSCAN_API_KEY}`, | ||
{ cache: "no-store" }, | ||
); | ||
const resultJSON = await result.json(); | ||
const balance = BigInt(resultJSON?.result || 0); | ||
const balance = await PUBLIC_CLIENT.getBalance({ address }); | ||
|
||
return Response.json(JSON.parse(stringify({ balance }))); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { PUBLIC_CLIENT } from "@/constants"; | ||
import { getSmartWalletAddress } from "@/utils/smartWalletUtils"; | ||
import { Hex, stringify } from "viem"; | ||
|
||
export async function GET(_req: Request, { params }: { params: { pubKey: Hex } }) { | ||
const { pubKey } = params; | ||
if (!pubKey) { | ||
return Response.json(JSON.parse(stringify({ error: "pubkey is required" }))); | ||
} | ||
|
||
const smartWalletAddress = await getSmartWalletAddress({ pubKey }); | ||
|
||
const balance = await PUBLIC_CLIENT.getBalance({ address: smartWalletAddress }); | ||
|
||
const createdUser = { | ||
account: smartWalletAddress, | ||
pubKey, | ||
}; | ||
|
||
return Response.json(JSON.parse(stringify({ ...createdUser, balance }))); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.