Skip to content

Commit

Permalink
Sync updates from internal repository (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffsmale90 authored Oct 24, 2024
2 parents 720f9f2 + 39de222 commit 4c2ce5c
Show file tree
Hide file tree
Showing 14 changed files with 785 additions and 466 deletions.
2 changes: 2 additions & 0 deletions .env.local.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# only include NEXT_PUBLIC_PAYMASTER_POLICY_ID if you require a paymaster policy
NEXT_PUBLIC_PAYMASTER_POLICY_ID=
NEXT_PUBLIC_PAYMASTER_API_KEY=
NEXT_PUBLIC_BUNDLER_URL=
NEXT_PUBLIC_WEB3_CLIENT_ID=
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hello Gator 🐊

Easily get up-to-speed with (and integrate) the MetaMask Delegation Toolkit with this demonstration. It includes examples for all the core elements including Delegator Account (ERC-4337) creation, sending User Operations, and the Delegation lifecycle. Example code is provided utilising the DeleGator Core [Viem](https://viem.sh/) client.
Easily get up-to-speed with (and integrate) the MetaMask Delegation Toolkit with this demonstration. It includes examples for all the core elements including Delegator Account (ERC-4337) creation, sending User Operations, and the Delegation lifecycle. Example code is provided utilising the Delegator Smart Account.

Note: this template is also designed to complement the [documentation](https://docs.gator.metamask.io).

Expand Down
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
"lint": "next lint"
},
"dependencies": {
"@codefi/delegator-core-viem": "0.1.1",
"@codefi/delegator-core-viem": "0.4.0",
"@web3auth/base": "^8.12.2",
"@web3auth/ethereum-provider": "^8.12.3",
"@web3auth/modal": "^8.12.3",
"next": "13.5.3",
"next": "14.2.10",
"permissionless": "^0.2.10",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"viem": "latest"
Expand Down
24 changes: 7 additions & 17 deletions src/app/examples/index.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
const examples = [
// {
// "name": "Delegation Lifecycle",
// "path": "delegations",
// "description": "Create, sign, and redeem delegations."
// },
const examples = Object.freeze([
{
"name": "Custom Signers",
"path": "signers",
"description": "See the various signer options in action."
},
{
"name": "Enable and Disable Delegations",
"path": "toggle-delegation",
"description": "Toggle the ability to redeem a delegation."
},
// {
// "name": "Storage API",
// "path": "storage",
// "description": "Use the Delegation Storage client to store and retrieve delegations."
// },
// {
// "name": "Revoke Delegations",
// "path": "revoke",
// "description": "See how to revoke existing delegations."
// },
]
]);

export default examples;
4 changes: 2 additions & 2 deletions src/app/examples/signers/SignatoryTypes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Signatory, WalletClientAccount } from "@codefi/delegator-core-viem";
import { HybridSignatoryConfig } from "@codefi/delegator-core-viem";
import { OPENLOGIN_NETWORK_TYPE } from "@web3auth/base";
import { Address, Chain } from "viem";

Expand All @@ -10,7 +10,7 @@ export type SignatoryFactoryConfig = {
};

export type SignatoryLoginFunction = () => Promise<{
signatory: Signatory | WalletClientAccount;
signatory: HybridSignatoryConfig;
owner: Address;
}>;

Expand Down
6 changes: 3 additions & 3 deletions src/app/examples/signers/burnerSignatoryFactory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export const createBurnerSignatoryFactory: SignatoryFactoryConfigurator = (
return {
login: async () => {
const privateKey = generatePrivateKey();
const owner = privateKeyToAccount(privateKey);
const account = privateKeyToAccount(privateKey);

return {
signatory: owner,
owner: owner.address,
signatory: { account },
owner: account.address,
};
},
canLogout: () => false,
Expand Down
4 changes: 2 additions & 2 deletions src/app/examples/signers/injectedProviderSignatoryFactory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ export const createInjectedProviderSignatoryFactory: SignatoryFactoryConfigurato
method: "eth_requestAccounts",
})) as Address[];

const signatory = createWalletClient({
const walletClient = createWalletClient({
chain,
transport: custom(provider),
account: owner,
});

return {
owner,
signatory,
signatory: { walletClient},
};
};

Expand Down
Loading

0 comments on commit 4c2ce5c

Please sign in to comment.