npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

airdao-node-contracts-dev

v0.0.39

Published

Smart contracts used in Airdao. +Javascript SDK, that can be imported for convenient communication with deployed contracts.

Downloads

47

Readme

Airdao node contracts

Smart contracts used in Airdao.
+Javascript SDK, that can be imported for convenient communication with deployed contracts.

Development

Run npm run test or npm run coverage to test contacts;

// todo add cmd for sourcify

Run make run in amb-node-cluster folder to launch local amb network in your docker;

Deployment

Provide your private key as PRIVATEKEY_OWNER_AMB env var or put it in .env file.

Run npx hardhat run ./scripts/deploy_multisig.ts --network test/amb to deploy masterMultisig contract in testnet network;
Run npx hardhat run ./scripts/deploy_finance.ts --network main/amb to deploy finance contracts (with their multisigs) in mainnet network;
And so on...

SDK

Installing

You must have .npmrc in the same directory as your package.json with following content: @ambrosus:registry=https://npm.pkg.github.com

Now you can do npm install @ambrosus/airdao-node-contracts

Usage

It contains deployed contract addresses for both (testnet and mainnet) networks and convenient methods to use it.
It also contains AmbErrorProvider - use it instead of default provider to get human-readable errors from contracts.

Examples:

import { AmbErrorProviderWeb3, Contracts, ContractNames, Multisig } from "airdao-node-contracts";

const provider = new AmbErrorProviderWeb3(window.ethereum); // for human-readable errors
const signer = provider.getSigner();
const chainId = (await provider.getNetwork()).chainId;

// signer can be undefined, if you dont want to call methods
// chainId must be testnet or mainnet network; Received contract addresses depends on it
const contracts = new Contracts(signer, chainId);
// `contracts` contains all deployed contracts
// you can get contract instance (ethers) via `getContractByName` or `getContractByAddress`,
// but in most cases you doesn't need to use this;
// PLEASE, use `ContractNames` enum for contract names! real value can be changed!

// get all multisig permissions
const { users, groups } = await Multisig.getPermissions(contracts);

// get all transactions
const txs = await Multisig.getTransactionsFromContracts(contracts);

// you can use map like this to display contract names that you want
const contractsNames = {
  [contracts.getContractByName(ContractNames.MasterMultisig).address]: "Permissions",
  [contracts.getContractByName(ContractNames.FinanceRewards).address]: "Finance: Rewards",
};
const nameToDisplay = contractsNames[txs[0].calledContractAddress];

// Create multisig tx, that withdraw 420 amb (wei) from FinanceMaster contract to signer
await Multisig.financeWithdraw(contracts, ContractNames.FinanceMaster, await signer.getAddress(), 420);