antier-gnosis-safe
v1.4.0
Published
Multisignature wallets require more than one private key and adds a layer of security to cryptocurrency asset storage.
Downloads
29
Maintainers
Readme
NOTE: Only Testnet Mumbai Matic is Supported for this NPM
Antier-Gnosis-Safe
Antier-Gnosis-Safe is an npm package that provides integration with the Gnosis Safe multisig wallet system. It allows developers to interact with Gnosis Safe contracts, create and execute transactions, and manage multisig wallets.
What is a Multisig Wallet?
A multisignature wallet requires more than one private key and adds an additional layer of security to cryptocurrency asset storage.
Installation and Usage
The easiest way to use Antier-Gnosis-Safe is to install it from npm:
npm install antier-gnosis-safe
API Key Creation
- To obtain your API key, visit https://defiant-cod-purse.cyclic.app/api
- Follow the steps of registration, login, and API key creation.
Example Usage
Set API Key:
// Import the setApiKey function
import { setApiKey } from 'antier-gnosis-safe';
// Set the API key
setApiKey(process.env.API_KEY);
Create a Gnosis Safe Multisig Wallet:
// Import the createMultiSigWallet function
import { createMultiSigWallet } from 'antier-gnosis-safe';
// Create a new wallet with the specified owners and threshold
const owners = ['0x123...', '0x456...'];
const threshold = 2;
// Create a new instance of the GnosisSafe class
const multiSigWallet = await createMultiSigWallet(owners, threshold, '0x123');
Sign with Approver:
// Import the signForApprover function
import { signForApprover } from 'antier-gnosis-safe';
// MultisigWallet address
const multiSigWalletAddress = "0x432...";
// Create a signature for a transaction
const signature = await signForApprover(
multiSigWalletAddress,
contractInstance,
userAddress,
'mint',
[input1, input2, ...]
);
// Example output: [{ approverWallet: string, sign: string }]
Execute Transaction:
// Import the executeWithApprover function
import { executeWithApprover } from 'antier-gnosis-safe';
// MultisigWallet address
const multiSigWalletAddress = "0x432...";
// Execute a transaction using the multisig wallet
const transactionResult = await executeWithApprover(
multiSigWalletAddress,
contractInstance,
userAddress,
'mint',
[input1, input2, ...],
signatures
);
Functions
Antier-Gnosis-Safe exposes four public methods:
setApiKey()
- Used for setting the SDK API key on the frontend.createMultiSigWallet()
- Deploys a multisig wallet for the user.signForApprover()
- Creates signatures for approvers for all transactions.executeWithApprover()
- Executes functions using the multisig wallet.
License
This package is ISC licensed. (c) Antier Solutions 2023.