How to use the @requestnetwork/smart-contracts.requestHashStorageArtifact function in @requestnetwork/smart-contracts

To help you get started, we’ve selected a few @requestnetwork/smart-contracts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RequestNetwork / requestNetwork / packages / ethereum-storage / src / smart-contract-manager.ts View on Github external
// If networkName is undefined, it means the network doesn't exist
    if (typeof this.networkName === 'undefined') {
      throw Error(`The network id ${web3Connection.networkId} doesn't exist`);
    }

    this.hashStorageAddress = SmartContracts.requestHashStorageArtifact.getAddress(
      this.networkName,
    );

    this.hashSubmitterAddress = SmartContracts.requestHashSubmitterArtifact.getAddress(
      this.networkName,
    );

    // Initialize smart contract instance
    this.requestHashStorage = new this.eth.Contract(
      SmartContracts.requestHashStorageArtifact.getContractAbi(),
      this.hashStorageAddress,
    );
    this.requestHashSubmitter = new this.eth.Contract(
      SmartContracts.requestHashSubmitterArtifact.getContractAbi(),
      this.hashSubmitterAddress,
    );

    this.timeout = web3Connection.timeout || config.getDefaultEthereumProviderTimeout();

    this.creationBlockNumberHashStorage =
      SmartContracts.requestHashStorageArtifact.getCreationBlockNumber(this.networkName) || 0;

    this.ethereumBlocks = new EthereumBlocks(
      this.eth,
      this.creationBlockNumberHashStorage,
      this.retryDelay || config.getEthereumRetryDelay(),
github RequestNetwork / requestNetwork / packages / ethereum-storage / src / smart-contract-manager.ts View on Github external
throw Error(`Can't initialize web3-eth ${error}`);
    }

    // Checks if networkId is defined
    // If not defined we use default value from config
    this.networkName =
      typeof web3Connection.networkId === 'undefined'
        ? config.getDefaultEthereumNetwork()
        : EthereumUtils.getEthereumNetworkNameFromId(web3Connection.networkId);

    // If networkName is undefined, it means the network doesn't exist
    if (typeof this.networkName === 'undefined') {
      throw Error(`The network id ${web3Connection.networkId} doesn't exist`);
    }

    this.hashStorageAddress = SmartContracts.requestHashStorageArtifact.getAddress(
      this.networkName,
    );

    this.hashSubmitterAddress = SmartContracts.requestHashSubmitterArtifact.getAddress(
      this.networkName,
    );

    // Initialize smart contract instance
    this.requestHashStorage = new this.eth.Contract(
      SmartContracts.requestHashStorageArtifact.getContractAbi(),
      this.hashStorageAddress,
    );
    this.requestHashSubmitter = new this.eth.Contract(
      SmartContracts.requestHashSubmitterArtifact.getContractAbi(),
      this.hashSubmitterAddress,
    );

@requestnetwork/smart-contracts

Smart contracts for the Request protocol.

MIT
Latest version published 3 days ago

Package Health Score

82 / 100
Full package analysis