Skip to main content

@midnight-ntwrk/midnight-js-contracts v0.1.15 • API


Midnight.js API Reference v0.1.15 / @midnight-ntwrk/midnight-js-contracts / findDeployedContract

Function: findDeployedContract()

findDeployedContract<PSS, PSK, W, C, ICK>(providers, contractAddress, contract, __namedParameters): Promise<DeployedContract<PSS, PSK, C>>

Creates an instance of DeployedContract given the address of a deployed contract and the private address with an existing private state. The current value at the private address is used as the initialPrivateState value in the finalizedDeployTxData property of the returned DeployedContract.

Type parameters

PSS extends PrivateStateSchema

PSK extends string | number | symbol

W extends Witnesses<StateWithZswap<PSS[PSK]>>

C extends Contract<StateWithZswap<PSS[PSK]>, W>

ICK extends string

Parameters

providers: MidnightProviders<ICK, PSS>

The providers used to manage the transaction lifecycle.

contractAddress: string

The address of a previously deployed contract.

contract: C

The contract to use to execute circuits.

__namedParameters: InitialPrivateStateConfig<PSS, PSK>

Returns

Promise<DeployedContract<PSS, PSK, C>>

Throws

TypeError Thrown if contractAddress is not correctly formatted as a contract address.