0.0.15 • Published 2 years ago

@agreewe/revenue-splitter-eth-sdk v0.0.15

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Deploying Rev Splitter contract.

ethersjs

Installation instructions

First, install this package via the command below.

npm i @agreewe/revenue-splitter-eth-sdk

Get Deployment Cost

import { getDeploymentCostEstimate, DeploymentArgs } from '@agreewe/revenue-splitter-eth-sdk';

const params: DeploymentArgs = {
  members: [
    "ETH_WALLET_ADDRESS_MEMBER_1",
    "ETH_WALLET_ADDRESS_MEMBER_2",
  ],
  shares: [50, 50],
  uuid: '697b36a1-864c-4f7c-b76a-91d44bfa0928'
};


/**
 * @param provider - connected wallet provider
 * @param params - deploymentArgs used to deploy the contract, instance of 
 * DeploymentArgs
 */

const feeEstimate = await getDeploymentCostEstimate(
    deploymentWallet,
    params
);

Deploy Transaction

import { deployContract, DeploymentArgs } from '@agreewe/revenue-splitter-eth-sdk';

const params: DeploymentArgs = {
  members: [
    "ETH_WALLET_ADDRESS_MEMBER_1",
    "ETH_WALLET_ADDRESS_MEMBER_2",
  ],
  shares: [50, 50],
  uuid: '697b36a1-864c-4f7c-b76a-91d44bfa0928'
};

// // use ethers.js to create a wallet instance or pass injected wallet instance
// const deploymentWallet = new ethers.Wallet(
//   "PRIVATE_KEY",
//   new ethers.providers.JsonRpcProvider("http://localhost:8545")
// );

const txHash= 
  await deployContract(
    provider, 
    params
    )

Interact with contract

import { RevenueSplitter } from '@agreewe/revenue-splitter-eth-sdk';

/*
    * @param contractAddress - Address of the deployed contract
    * @param deploymentWallet - Wallet instance used to interact with the contract
*/
const revSplitterInstance = new RevenueSplitter(
    contractAddress,
    deploymentWallet
);

const provider = new ethers.providers.Web3Provider(window.ethereum);
const balance = await provider.getBalance(contractAddress);
const balanceETH = ethers.utils.formatEther(balance);

//distribute all
const distributeTx = await revSplitterInstance.distributeAll();
console.log(distributeTx);
0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago