Skip to content

Skucode

Skucode class serves as the core interface for interacting with the associated Skucode contract and database 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 Skucode-related workflows and includes access to contract class like SkucodeContract.

Creating Instances

new Skucode(database: Database, id: string)

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

Properties

  • skucode.id ⇒ string
    The unique identifier representing Skucode ID.

  • skucode.database ⇒ Database
    The Database instance associated with the Skucode, enabling interactions with a connected database.

  • skucode.contract ⇒ SkucodeContract | undefined
    The SkucodeContract instance connected to the skucode ID.

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

Static Methods

Skucode.prepareDeployTx(uri: string, address: string, provider: Provider) ⇒ Promise<TxData>

Prepares and returns a transaction for deploying a smart contract.



Skucode.createNew(database: Database, skucodeOptions: SkucodeOptions) ⇒ Promise<Skucode>

Creates a new Skucode by predicting the contract address and storing its information in the database.



Skucode.generateSkucodeHash(brandId: string, itemId: string, unitOfMeasure: string) ⇒ string

Generates a keccak256 hash by concatenating the brand ID, item ID, and unit of measure.

Instance Methods

skucode.prepareDeployTxFromTracker(signer: Signer) ⇒ Promise <TxData >

Prepares a deployment transaction using SKU details fetched from the database and the tracker's information.



skucode.getAllDetails()

Retrieves both private details from the database and public details from the contract for the SKU code.


For more details, visit Method Implementation Reference