Skip to content

Popcode

Popcode class serves as the core interface for interacting with the associated Popcodes, database, and its respective key management modules. It enables a wide range of operations, including managing Popcode instances, retrieving details, and facilitates seamless integration with both on-chain and off-chain data.

It is the core class for managing Popcode-related workflows and includes access to contract classes like PopcodeContract and PopcodeFactoryContract.

Creating Instances

new Popcode( database: Database, id: string )

Creates a new instance of Popcode linked to a specific popcode ID, providing access to the database and contract functionalities.

Properties

  • popcode.id ⇒ string
    The unique identifier representing Popcode ID.

  • popcode.database ⇒ Database
    The SKC CMS Class that implements methods for DB Operations, allowing interaction with a connected database.

  • popcode.contract ⇒ PopcodeContract | undefined
    The PopcodeContract instance connected to the popcode ID.

This property is populated after calling the `connectContract()` method.

  • popcode.arsgateway ⇒ ARSGateway | undefined
    The ARSGateway instance, providing access to methods for interacting with ARS (Address Resolution Service).

This property is populated after calling the `connectArsGateway()` method.

Static Methods

Popcode.createNewTracker ( database: Database, IdPredictionOptions: IdPredictionOptions ) ⇒ Popcode

Creates a new Popcode tracker by predicting the contract address and storing the tracker information in the database.



popcode.prepareDeployTx ( provider: Provider, address: string, IdPredictionOptions: IdPredictionOptions) ⇒ Promise < TxData >

Prepares the transaction data for deployment using the factory contract.



popcode.predictContractAddress ( input: any, factoryAddress: string, salt: string ) ⇒ Promise < string >

Predicts the address of a contract before it is deployed, using the CREATE2 opcode. This method is useful when deploying contracts with a known salt value.



popcode.generateSalt ( offset: string) ⇒ string

Generates a sha256 hash from the provided offset, which is used as a salt in contract address prediction.


For more details, visit Static Method Implementation Reference

Instance Methods

popcode.prepareDeployTxFromTracker ( signer: Signer, factoryAddress: string ) ⇒ Promise < TxData >

Prepares the transaction data for deploying the Popcode contract from the tracker, by generating the required transaction data using the factory contract.



popcode.connectContract ( contractRunner: Signer | Provider ) ⇒ this

Connects the Popcode to the Popcode contract using either a Signer or Provider, allowing further interactions related to smart contract.



popcode.connectArsGateway ( database: Database ) ⇒ this

Connects the Popcode to the Address Resolution Service (ARS) database..



popcode.generateSalt ( input: string) ⇒ string

Generates a sha256 hash from the provided input, which is used as a salt in contract address prediction.



popcode.getAllDetails ()

Fetches all the details of the Popcode from the database, contract, and verifiable sources.



popcode.getVerifiableDetails ()

Fetches verifiable details from the contract for verification purposes.



popcode.getAccessibleDetails ( id: string)

Retrieves and resolves public details from the contract


For more details, visit Instance Method Implementation Reference