{"id":14971428,"url":"https://github.com/thlorenz/phan-wallet-mock","last_synced_at":"2025-09-13T19:32:18.948Z","repository":{"id":46080126,"uuid":"426294195","full_name":"thlorenz/phan-wallet-mock","owner":"thlorenz","description":"🪙 Mock version of Phantom Wallet. ONLY USE FOR TESTING!!!","archived":false,"fork":false,"pushed_at":"2021-11-24T13:23:40.000Z","size":894,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-02T11:51:31.612Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://thlorenz.github.io/phan-wallet-mock/docs/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thlorenz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-09T16:02:20.000Z","updated_at":"2024-11-04T09:58:57.000Z","dependencies_parsed_at":"2022-09-26T18:30:36.276Z","dependency_job_id":null,"html_url":"https://github.com/thlorenz/phan-wallet-mock","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fphan-wallet-mock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fphan-wallet-mock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fphan-wallet-mock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fphan-wallet-mock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thlorenz","download_url":"https://codeload.github.com/thlorenz/phan-wallet-mock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232905678,"owners_count":18594792,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T13:45:11.445Z","updated_at":"2025-01-07T16:31:16.339Z","avatar_url":"https://github.com/thlorenz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# phan-wallet-mock [![Build and Test](https://github.com/thlorenz/phan-wallet-mock/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/thlorenz/phan-wallet-mock/actions/workflows/build-and-test.yml)\n\nMock version of Phantom Wallet. **ONLY USE FOR TESTING!!!**\n\n```ts\nexport async function setupWithPayer(\n  payer = Keypair.generate(),\n  net = LOCALNET\n): Promise\u003c{ payer: Keypair; wallet: PhantomWalletMock }\u003e {\n  const wallet = PhantomWalletMock.create(net, payer, 'confirmed')\n\n  // NOTE: no user approval needed\n  await wallet.connect()\n  const signature = await wallet.connection.requestAirdrop(\n    payer.publicKey,\n    LAMPORTS_PER_SOL * 5\n  )\n  // NOTE: no user approval needed here either\n  await wallet.connection.confirmTransaction(signature)\n\n  return { payer, wallet }\n}\n\nconst { wallet, payer } = await setupWithPayer()\n\n// NOTE: this only works when no actual Phantom extension is present as then `window.solana`\n// cannot be overwritten\nwindow.solana = wallet\n```\n\n![assets/cypress.png](assets/cypress.png)\n\n## API\n\n[API documentation](https://thlorenz.github.io/phan-wallet-mock/docs/index.html)\n\n## How it Works\n\nUnlike with real wallets `phan-wallet-mock` requires the user to provide a full `Keypair` which\nit uses under the hood to sign transactions and messages.\n\nTo do that it never requires the user's approval like the original does in order to ease\ntesting.\n\n**THEREFORE MAKE SURE TO ONLY USE THIS WHILE RUNNING TESTS WITH FRESHLY GENERATED KEYPAIRS!!!**\n\n## Apps using phan-wallet-mock\n\n- [example app based on phantom wallet\n  sandbox](https://github.com/thlorenz/phan-wallet-mock-react-example)\n\n## LICENSE\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthlorenz%2Fphan-wallet-mock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthlorenz%2Fphan-wallet-mock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthlorenz%2Fphan-wallet-mock/lists"}