Skip to content

Commit

Permalink
update imports
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed Nov 7, 2024
1 parent 2096820 commit 1694d69
Show file tree
Hide file tree
Showing 18 changed files with 21 additions and 1,201 deletions.
2 changes: 2 additions & 0 deletions packages/entrykit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@
"@latticexyz/common": "workspace:*",
"@latticexyz/config": "workspace:*",
"@latticexyz/explorer": "workspace:*",
"@latticexyz/paymaster": "workspace:*",
"@latticexyz/protocol-parser": "workspace:*",
"@latticexyz/store": "workspace:*",
"@latticexyz/wiresaw": "workspace:*",
"@latticexyz/world": "workspace:*",
"@latticexyz/world-modules": "workspace:*",
"@noble/curves": "^1.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/entrykit/src/createWagmiConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { WalletList, connectorsForWallets, getDefaultWallets } from "@rainbow-me
import { Config, CreateConfigParameters, createConfig } from "wagmi";
import { passkeyWallet } from "./passkey/passkeyWallet";
import { mapObject } from "@latticexyz/common/utils";
import { wiresaw } from "./transports/wiresaw";
import { wiresaw } from "@latticexyz/wiresaw/internal";

export type CreateWagmiConfigOptions<
chains extends readonly [Chain, ...Chain[]] = readonly [Chain, ...Chain[]],
Expand Down
3 changes: 0 additions & 3 deletions packages/entrykit/src/exports/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,5 @@ export { createWagmiConfig, type CreateWagmiConfigOptions } from "../createWagmi
// And some additional internal things
export * from "../passkey/passkeyWallet";
export * from "../passkey/passkeyConnector";
export * from "../smart-account/toCoinbaseSmartAccount";
export * from "../smart-account/isCoinbaseSmartAccount";
export * from "../getConnectors";
export * from "../getWallets";
export * from "../transports/wiresaw";
10 changes: 5 additions & 5 deletions packages/entrykit/src/getBundlerTransport.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { transactionQueue } from "@latticexyz/common/actions";
import { Chain, createClient, fallback, http, webSocket } from "viem";
import { privateKeyToAccount, generatePrivateKey } from "viem/accounts";
import { userOpExecutor } from "./transports/userOpExecutor";
import { gasEstimator } from "./transports/gasEstimator";
import { wiresaw } from "./transports/wiresaw";
import { wiresaw } from "@latticexyz/wiresaw/internal";
import { gasEstimator, userOpExecutor } from "@latticexyz/paymaster/internal";

export function getBundlerTransport(chain: Chain) {
const bundlerHttpUrl = chain.rpcUrls.bundler?.http[0];
const bundlerTransport = chain.rpcUrls.bundler?.http[0]
? wiresaw(gasEstimator(http(bundlerHttpUrl)))
// TODO: bundler websocket
const bundlerTransport = bundlerHttpUrl
? gasEstimator(wiresaw(http(bundlerHttpUrl)))
: chain.id === 31337
? userOpExecutor({
executor: createClient({
Expand Down
4 changes: 2 additions & 2 deletions packages/entrykit/src/getSessionAccount.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Address, Chain, Client, Transport } from "viem";
import { getSessionSigner } from "./getSessionSigner";
import { toCoinbaseSmartAccount } from "./smart-account/toCoinbaseSmartAccount";
import { SmartAccount } from "viem/account-abstraction";
import { toCoinbaseSmartAccount } from "@latticexyz/common/accounts";
import { getSessionSigner } from "./getSessionSigner";

export async function getSessionAccount<chain extends Chain>({
client,
Expand Down
13 changes: 3 additions & 10 deletions packages/entrykit/src/onboarding/useClaimGasPass.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Address } from "viem";
import { useEntryKitConfig } from "../EntryKitConfigProvider";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { quarryPassIssuer } from "../transports/quarryPassIssuer";
import { claimGasPass } from "@latticexyz/paymaster/internal";

export function useClaimGasPass() {
const queryClient = useQueryClient();
Expand All @@ -12,16 +12,9 @@ export function useClaimGasPass() {
mutationKey,
onError: (error) => console.error(error),
mutationFn: async (userAddress: Address) => {
const transport = quarryPassIssuer()({ chain });
// TODO: handle case where you already have a pass?
await transport.request({
method: "quarry_issuePass",
params: ["0x01", userAddress],
});
await transport.request({
method: "quarry_claimAllowance",
params: ["0x01", userAddress],
});
// TODO: get returned tx hashes to check if success
await claimGasPass({ chain, userAddress });

await Promise.all([
queryClient.invalidateQueries({ queryKey: ["getAllowance"] }),
Expand Down
2 changes: 1 addition & 1 deletion packages/entrykit/src/passkey/getAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Client } from "viem";
import { toWebAuthnAccount } from "viem/account-abstraction";
import { cache } from "./cache";
import { P256Credential } from "webauthn-p256";
import { toCoinbaseSmartAccount, ToCoinbaseSmartAccountReturnType } from "../smart-account/toCoinbaseSmartAccount";
import { toCoinbaseSmartAccount, ToCoinbaseSmartAccountReturnType } from "@latticexyz/common/accounts";

export async function getAccount(client: Client, id: P256Credential["id"]): Promise<ToCoinbaseSmartAccountReturnType> {
const { publicKeys } = cache.getState();
Expand Down
2 changes: 1 addition & 1 deletion packages/entrykit/src/passkey/passkeyConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { createBundlerClient } from "../createBundlerClient";
import { observer } from "@latticexyz/explorer/observer";
import { getPaymasterAddress } from "../getPaymasterAddress";
import { getBundlerTransport } from "../getBundlerTransport";
import { wiresaw } from "../transports/wiresaw";
import { wiresaw } from "@latticexyz/wiresaw/internal";

export type PasskeyConnectorOptions = {
// TODO: figure out what we wanna do across chains
Expand Down
6 changes: 0 additions & 6 deletions packages/entrykit/src/smart-account/isCoinbaseSmartAccount.ts

This file was deleted.

Loading

0 comments on commit 1694d69

Please sign in to comment.