Description

Allows to specify static data related to contracts (i.e., script and entrypoints) avoiding Taquito to fetch them from the network.

Example

import { ContractsLibrary } from '@taquito/contracts-library';
import { TezosToolkit } from '@taquito/taquito';

const Tezos = new TezosToolkit('rpcUrl');
const contractsLibrary = new ContractsLibrary();

contractsLibrary.addContract({
['contractAddress1']: {
script: script1, // obtained from Tezos.rpc.getContract('contractAddress1').script
entrypoints: entrypoints1 // obtained from Tezos.rpc.getEntrypoints('contractAddress1')
},
// load more contracts
});

Tezos.addExtension(contractsLibrary);

Implements

  • Extension

Constructors

Methods

  • Parameters

    • contract: ContractsData

      is an object where the key is a contract address and the value is an object having a script and an entrypoints properties. Note: the expected format for the script and entrypoints properties are the same as the one respectivlely returned by TezosToolkit.rpc.getContract('contractAddress').script and TezosToolkit.rpc.getEntrypoints

    Returns void

    Description

    Saves one of several contract in the library

    Throws

    InvalidAddressError If the contract address is not valid

    Throws

    InvalidScriptFormatError If the script is not in the expected format

  • Parameters

    • contractAddress: string

    Returns {
        entrypoints: EntrypointsResponse;
        script: ScriptedContracts;
    }

    • entrypoints: EntrypointsResponse
    • script: ScriptedContracts

Generated using TypeDoc