@pratikgohil.dev/stackos-v2contract-package

2.4.5 • Public • Published

stackos-v2contract-package

This package only functions with stackos-v2-contracts and is intended for usage in react projects.

Usage/Examples

// initialization
await init(web3, addresses, window.ethereum.selectedAddress);

// for using supported functions from this package
await Stack.balanceOf(window.ethereum.selectedAddress);

// to access a contract instance directly, use myContract.contractInstance ()
// eg.
const StackContractInstance = Stack.contractInstance();
await StackContractInstance.methods
  .balanceOf(window.ethereum.selectedAddress)
  .call();
import Web3 from "web3";
import { init, Stack } from "@pratikgohil.dev/stackos-v2contract-package";

const App = () => {
  const addresses = {
    deployer: "0x...........................xyz",
    xct: "0x...........................xyz",
    stack: "0x...........................xyz",
    nftToken: "0x...........................xyz",
    Registration: "0x...........................xyz",
    appNFT: "0x...........................xyz",
    RoleControl: "0x...........................xyz",
    SubscriptionBalanceCalculator: "0x...........................xyz",
    SubscriptionBalance: "0x...........................xyz",
    SubnetDAODistributor: "0x...........................xyz",
    Subscription: "0x...........................xyz",
    xctMinter: "0x...........................xyz",
    ContractBasedDeployment: "0x...........................xyz",
  };

  useEffect(() => {
    (async () => {
      let provider = window.ethereum;
      const web3 = new Web3(provider);
      await init(web3, addresses, window.ethereum.selectedAddress);
      // try
      await Stack.balanceOf(window.ethereum.selectedAddress);
    })();
  }, []);

  return <></>;
};

Contracts

  • AppNFT
  • AppNFTMinter
  • DarkMatterNFT
  • Stack
  • XCT
  • ContractBasedDeployment
  • Registration
  • Subscription
  • SubscriptionBalance
  • SubscriptionBalanceCalculator
  • SubnetDAODistributor
  • XCTMinter
  • Other Functions
    • setDefaultOptions
    • getDefaultOptions
  • decryptApp
    • login
    • signUserForDecryption
    • decryptFromCreatorSK
    • decryptFromUrsula
    • decryptAppData
    • decryptUrsulaPayload
    • decryptUrsulaBatchPayload
    • decryptAppDataBatch
  • encryptApp
    • encryptForSubnetsAndReader
    • encryptKfragsUsingUrsula
    • createAppData
    • encryptApp
  • ipfs
    • initIPFS
    • getIpfsInstance
    • createIPFSDir
    • setDataIntoCache
    • getDataFromCache
    • readFileWithInfura
    • readFile
    • setEncryptedDataToCache
    • setAppDataToCache
    • getEncryptedDataFromCache
    • getAppDataFromCache
    • addAppToCache
    • deleteAppFromCache
    • fetchIPFSSubFilesInBulk
    • getDataFromIPFS
    • uploadIpfsDataIntoCache
    • sendToIPFS
  • libUtils
    • getUmbral
    • initAppCrypto
    • convertIntoUmbralPublicKey
    • convertIntoUmbralSecretKey
    • convertIntoUmbralCapsule
    • convertIntoUmbralCipher
    • convertIntoUmbralVerifiedCfrag
    • decryptCreatorSecretKey
    • encrypt
    • customPromiseRace
  • utils
    • convertCommaStringToArray
    • readByte32
    • deployerByte32
    • accessManagerByte32
    • billingManagerByte32
    • contractBasedDeploymentByte32
    • parse
      • getSubnetAttributes
      • getAllSubnetNamesAndIDs
      • getClusterAttributes
      • getSubscribedSubnetsOfNFT
      • getApp
    • toBytes32
    • hexToString
    • verifyModVariables
    • replaceVar
    • replaceModVariable

Package Sidebar

Install

npm i @pratikgohil.dev/stackos-v2contract-package

Weekly Downloads

0

Version

2.4.5

License

ISC

Unpacked Size

314 kB

Total Files

21

Last publish

Collaborators

  • pratikgohil.dev