@thewarp/pft-nostr-snap
v1.1.1
Published
Post Fiat Nostr Snap - MetaMask Extension for PFTL wallets with Nostr identity support
Readme
Overview
The PFT Ledger for MetaMask is an extension that allows users to interact with the PFT Ledger (PFTL) directly from their MetaMask wallet. This Snap introduces support for PFTL, enabling users to manage PFT and other tokens on the PFTL, perform transactions, and interact with PFTL-based decentralized applications (DApps).
PFTL for MetaMask Original Features
PFTL Integration: Manage PFT and PFTL tokens within MetaMask.
Transaction Support: Send and receive PFT and other PFTL tokens.
DApp Interaction: Use PFTL-based DApps seamlessly.
Account Management: View account balances, transaction history, and other details.
Secure and User-Controlled: Full control over your PFTL keys and permissions.
The Post Fiat SNAP Expanded Features
Multiple PFTL Wallet Support: Import and manage mutltiple PFTL wallets from family seeds.
Site Feature Expansion: Memo transactions, Import Wallet, Switch Wallet, Trust Lines.
Usage
To use the PFT Ledger, first install it by following these steps:
- Open MetaMask: Ensure you have the latest version of the MetaMask extension installed in your browser.
- Navigate to Settings: Click on the MetaMask icon, go to settings, and look for the Snaps section.
- Add PFT Ledger: In the Snaps section, add the PFT Ledger by providing its URL or selecting it from the Snap store.
- Install Snap: Click on the PFT Ledger and follow the prompts to add it to your MetaMask wallet.
- Enable Snap: Once installed, enable the Snap and grant necessary permissions.
Development
Here’s a basic guide to get started:
Prerequisites
- Node.js
- MetaMask
Installation
yarnRunning
yarn start- To only start the UI, navigate to
packages/siteand start from there. The same applies to the snap inpackages/snap. - If you make changes to the snap, first remove the previously installed version to see the changes.
- Enable the MetaMask in your extensions.
API
Installation
Use the following request to install the Snap:
provider.request({
method: 'wallet_requestSnaps',
params: {
['npm:PFTL-snap']: {},
},
});For developing the snap, change the request to:
params: {
["local:http://localhost:8080"]: {},
},Interact with the Snap
To make requests using the RPC, use the following code:
provider.request({
method: 'wallet_invokeSnap',
params: {
snapId: 'npm:PFTL-snap',
request: {
method: 'PFTL_request',
params: { command: 'account_info', account: 'rBg...' },
},
},
});Account
Get current account:
provider.request({
method: 'wallet_invokeSnap',
params: {
snapId: 'npm:PFTL-snap',
request: {
method: 'PFTL_getAccount',
},
},
});Network
- Get supported networks:
provider.request({
method: 'wallet_invokeSnap',
params: {
snapId: 'npm:PFTL-snap',
request: {
method: 'PFTL_getStoredNetworks',
},
},
});- Get current network:
provider.request({
method: 'wallet_invokeSnap',
params: {
snapId: 'npm:PFTL-snap',
request: {
method: 'PFTL_getActiveNetwork',
},
},
});- Change the selected network:
provider.request({
method: 'wallet_invokeSnap',
params: {
snapId: 'npm:PFTL-snap',
request: {
method: 'PFTL_changeNetwork',
params: { chainId: 1 }, // Example chainId
},
},
});Signing and submitting transactions
To sign and submit transactions
provider.request({
method: 'wallet_invokeSnap',
params: {
snapId: 'npm:PFTL-snap',
request: {
method: 'PFTL_signAndSubmit',
params: {
TransactionType: 'Payment',
Account: 'rBg...',
Destination: 'rPT...',
Amount: '1000000', // Amount in drops
},
},
},
});- If you only want to sign the transaction use
PFTL_sign.
Support
For support and further information, refer to the following resources:
- Documentation: https://docs.PFTLsnap.com/
- MetaMask Snaps Documentation: MetaMask Snaps
Contributing
We welcome contributions to the PFT Ledger project. To contribute, please follow these steps:
- Fork the Repository: Fork the PFT Ledger repository on GitHub.
- Create a Branch: Create a new branch for your feature or bugfix.
- Submit a Pull Request: Submit a pull request with a detailed description of your changes.
License
This project is licensed under the MIT License. See the LICENSE file for details.
