Skip to content

massalabs/metamask-massa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MetaMask Snap for Massa

Welcome to the MetaMask Snap for Massa! This Snap enables seamless integration of MetaMask with the Massa layer 1 protocol, providing users with convenient access to Massa's features directly through MetaMask.

Powered by

Astro-Devs Labs

Snap Operations

The MetaMask Snap for Massa supports the following operations:

1. Get Balance

Method Parameters Response Param Example Response Example
account.balance
{
  address: string;
}
{
    finalBalance: string,
    candidateBalance: string
}
{
  address: 'AU1234567890abcdef';
}
{
  finalBalance: "100",
  candidateBalance: "200",
}

2. Sign Message

Method Parameters Response Param Example Response Example
account.sign
{
  address: string,<br>data: number[]
}
{
  signature: number[],
  publicKey: string
}
{
    address: "AU1234567890abcdef",
    data: [1, 2, 3]
}
{
  signature: [4, 5, 6],
  publicKey: "Pabcdef1234567890"
}

3. Call Smart Contract

Method Parameters Response Param Example Response Example
account.callSC
{
  nickname: string,
  fee: string,
  functionName: string,
  at: string,
  args: number[],
  coins: string,
  nonPersistentExecution?: {
    isNPE: boolean,
    maxGas: string
  }
}
{
  operationId: string;
}
{
  nickname: "TestContract",
  fee: "100",
  functionName: "transfer",
  at: "ASabcdef1234567890",
  args: [1, 2, 3],
  coins: "Massa"
}
{
  operationId: 'OP1234567890abcdef';
}

4. Send Transaction

Method Parameters Response Param Example Response Example
account.sendTransaction
{
  recipientAddress: string,
  amount: bigint,
  fee: bigint
}
{
  operationId: string;
}
{
  recipientAddress: "AU1234567890abcdef",
  amount: 100,
  fee: 10
}
{
  operationId: 'OP1234567890abcdef';
}

5. Sell Rolls

Method Parameters Response Param Example Response Example
account.sellRolls
{
  fee: string,
  amount: string
}
{
  operationId: string;
}
{
  fee: "100",
  amount: "50"
}
{
  operationId: 'OP1234567890abcdef';
}

6. Buy Rolls

Method Parameters Response Param Example Response Example
account.buyRolls
{
    fee: string,
    amount: string
}
{
  operationId: string;
}
{
  fee: "100",
  amount: "50"
}
{
  operationId: 'OP1234567890abcdef';
}

7. Get Active Account

Method Parameters Response Param Example Response Example
account.getActive
{
  name: string,
  address: string
}
{
  name: "Active Account",
  address: "AU1234567890abcdef"
}

8. Get Node URLs

Method Parameters Response Param Example Response Example
Provider.getNodeUrl string
'https://node1.example.com';

9. Get Active Account

Method Parameters Response Param Example Response Example
account.getActive
{
  name: string,
  address: string
}
{
  name: "Account 0",
  address: "AU12ZDFfdf2Rdf3f4fg"
}

10. Show Account Credentials

Method Parameters Response Param Example Response Example
account.showCredentials
{
  address?: string<br>
}
{
  publicKey: string<br>;
}
{
  address: 'AU1234567890abcdef'<br>;
}
{
  publicKey: 'Pabcdef1234567890'<br>;
}

11. Add Token

Method Parameters Response Param Example Response Example
account.addToken
{
  address: string,
  accountAddress?: string
}
{
  address: string,
  accountAddress: string
}
{
  address: "AU1234567890abcdef",
  accountAddress: "AU1234567890abcdef"
}
{
  address: "AU1234567890abcdef",
  accountAddress: "AU1234567890abcdef"
}

12. Delete Token

Method Parameters Response Param Example Response Example
account.deleteToken
{
  accountAddress?: string,
  address: string
}
{
  response: 'OK' | 'ERROR',
  message?: string
}
{
  address: "AU1234567890abcdef",
  accountAddress: "AU1234567890abcdef"
}
{
  response: 'OK';
}

For detailed information about each operation, including parameters and responses, refer to the corresponding DTOs in the codebase.

Installation

To use the MetaMask Snap for Massa, follow these steps:

  1. Install MetaMask: If you haven't already, install the MetaMask browser extension for your preferred browser.
  2. Add Massa Network: Open MetaMask and add the Massa network to your network list. You'll need to provide the network details including RPC endpoint, chain ID, symbol, and block explorer URL.
  3. Install MetaMask Snap: Install the MetaMask Snap for Massa by visiting the MetaMask Snap Store and searching for "Massa". Click on the Snap and follow the installation prompts.

Contributing

We welcome contributions from the community! If you would like to contribute to the MetaMask Snap for Massa, please checkout our "good first issue" issues and submit a pull request.

License

The MetaMask Snap for Massa is released under the BSL license.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •