- {chain &&
{chain}
}
+ {chain && (
+
{chain}
+ )}
{clipDecimals(formatEther(balance.balance))} {balance.token}
diff --git a/src/components/navbar.tsx b/src/components/navbar.tsx
index 9c2348c..5042573 100644
--- a/src/components/navbar.tsx
+++ b/src/components/navbar.tsx
@@ -23,6 +23,9 @@ const NavBar = () => {
Transfer
+
+ Docs
+
diff --git a/src/utils/index.tsx b/src/utils/index.tsx
index de621ae..b0bbf37 100644
--- a/src/utils/index.tsx
+++ b/src/utils/index.tsx
@@ -4,23 +4,22 @@ export const clipDecimals = (value: string, decimals: number = 2): string => {
return `${parts[0]}.${parts[1].slice(0, decimals)}`;
};
+import * as chains from "viem/chains";
-import * as chains from 'viem/chains';
-
- /**
- * Gets the chain object for the given chain id.
- * @param chainId - Chain id of the target EVM chain.
- * @returns Viem's chain object.
- */
+/**
+ * Gets the chain object for the given chain id.
+ * @param chainId - Chain id of the target EVM chain.
+ * @returns Viem's chain object.
+ */
export const getChain = (chainId: number) => {
- for (const chain of Object.values(chains)) {
- if ('id' in chain) {
- if (chain.id === chainId) {
- return chain;
- }
- }
+ for (const chain of Object.values(chains)) {
+ if ("id" in chain) {
+ if (chain.id === chainId) {
+ return chain;
+ }
+ }
}
-
+
throw new Error(`Chain with id ${chainId} not found`);
};
diff --git a/src/utils/magic-spend.tsx b/src/utils/magic-spend.tsx
index c507120..671e4cf 100644
--- a/src/utils/magic-spend.tsx
+++ b/src/utils/magic-spend.tsx
@@ -80,10 +80,12 @@ export type PimlicoMagicSpendSchema = [
Method: "pimlico_prepareMagicSpendAllowance";
},
{
- Parameters: [{
- allowance: MagicSpendAllowance;
- signature: Hex;
- }];
+ Parameters: [
+ {
+ allowance: MagicSpendAllowance;
+ signature: Hex;
+ },
+ ];
ReturnType: {
withdrawal: MagicSpendWithdrawal;
signature: Hex;
@@ -91,17 +93,16 @@ export type PimlicoMagicSpendSchema = [
Method: "pimlico_grantMagicSpendAllowance";
},
{
- Parameters: [{
- token: Address;
- recipient: Address;
- amount: string;
- signature: Hex;
- salt: Hex;
- }];
- ReturnType: [
- MagicSpendWithdrawal,
- Hex
+ Parameters: [
+ {
+ token: Address;
+ recipient: Address;
+ amount: string;
+ signature: Hex;
+ salt: Hex;
+ },
];
+ ReturnType: [MagicSpendWithdrawal, Hex];
Method: "pimlico_sponsorMagicSpendWithdrawal";
},
{
@@ -222,17 +223,22 @@ export class MagicSpend {
amount,
signature,
}: {
- token: Address, recipient: Address, amount: string, signature: Hex
+ token: Address;
+ recipient: Address;
+ amount: string;
+ signature: Hex;
}) {
return this.client.request({
method: "pimlico_sponsorMagicSpendWithdrawal",
- params: [{
- token,
- recipient,
- amount,
- signature,
- salt: "0x000000",
- }],
+ params: [
+ {
+ token,
+ recipient,
+ amount,
+ signature,
+ salt: "0x000000",
+ },
+ ],
});
}
}
diff --git a/src/utils/session-key.tsx b/src/utils/session-key.tsx
index 9e539a5..0337819 100644
--- a/src/utils/session-key.tsx
+++ b/src/utils/session-key.tsx
@@ -3,27 +3,27 @@ import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
import { createStorage } from "wagmi";
export class SessionKey {
- private storage: ReturnType
;
+ private storage: ReturnType;
- constructor() {
- this.storage = createStorage({
- storage: localStorage,
- key: 'pimlico-magic-spend'
- });
- }
+ constructor() {
+ this.storage = createStorage({
+ storage: localStorage,
+ key: "pimlico-magic-spend",
+ });
+ }
- async getKey(): Promise {
- // @ts-ignore
- const key = await this.storage.getItem('operator-key');
+ async getKey(): Promise {
+ // @ts-ignore
+ const key = await this.storage.getItem("operator-key");
- if (!key) {
- const newKey = generatePrivateKey();
- // @ts-ignore
- await this.storage.setItem('operator-key', newKey);
+ if (!key) {
+ const newKey = generatePrivateKey();
+ // @ts-ignore
+ await this.storage.setItem("operator-key", newKey);
- return privateKeyToAccount(newKey);
- }
+ return privateKeyToAccount(newKey);
+ }
- return privateKeyToAccount(key as Hex);
- }
-}
\ No newline at end of file
+ return privateKeyToAccount(key as Hex);
+ }
+}