@midnight-ntwrk/midnight-js-contracts v0.2.5 • API
Midnight.js API Reference v0.2.5 / @midnight-ntwrk/midnight-js-contracts / findDeployedContract
Function: findDeployedContract()
findDeployedContract<
PSS
,PSK
,C
>(providers
,options
):Promise
<FoundContract
<PSS
[PSK
],C
>>
Creates an instance of FoundContract 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
FoundContract
.
Type parameters
• PSS extends PrivateStateSchema
• PSK extends string
• C extends Contract
<PSS
[PSK
], Witnesses
<PSS
[PSK
]>>
Parameters
• providers: MidnightProviders
<ImpureCircuitId
<C
>, PSS
>
The providers used to manage the transaction lifecycle.
• options: FindDeployedContractOptions
<PSS
, PSK
, C
>
Configuration.
Returns
Promise
<FoundContract
<PSS
[PSK
], C
>>
Throws
Error No contract state could be found at contractAddress
.
Throws
TypeError Thrown if contractAddress
is not correctly formatted as a contract address.
Throws
ContractTypeError One or more circuits defined on contract
are undefined on the contract
state found at contractAddress
, or have mis-matched verifier keys.