Docs
Tapp snap
Tapp snap
This is a MetaMask Snap for tapp token.
Features
This project uses @metamask/snaps-sdk
to develop the Snap. The features are:
- Display Token metadata, including images, attributes, and descriptions
- Provide Token-related interactive operations
- Support for multiple chains and contracts
- Build user interface using React JSX syntax
Project Structure
src/
: Source code directorycomponents/
: React componentsActions.tsx
: Button Action page componentHomePage.tsx
: HomePage page componentTokenPage.tsx
: Interactive form component
libs/
: Libraryconstants.ts
: Some consttypes.ts
: Some typesutils.ts
: Some common functions
TokenPage.tsx
: Interactive form componentindex.tsx
: Entry file for the Snapindex.test.tsx
: Test file
tsconfig.json
: TypeScript configuration filepackage.json
: Project dependencies and scripts
Usage
- Run
npm run install
to install dependencies - Use
npm run build
to build the project - Use
npm run start
to start the project, it will run onhttp://localhost:8080
- Use
npm run test
to run tests
Request snap in local
You can use ethereum.request
to invoke this snap in local:
await window.ethereum.request({
method: "wallet_invokeSnap",
params: {
snapId: "local:http://localhost:8080",
request: {
method: "import",
params: YOUR_PARAMS,
},
},
});
The params are:
chain
: ID of the blockchain network.contract
: Address of the token contract.tokenId
: Token ID.
Testing
The project uses @metamask/snaps-jest
for testing. The test file is located at src/index.test.tsx
.
Installation
You can use our AddToSnap button or access MetaMask Snaps Directory to install this snap.