Guides
Dash CoreDash PlatformDash.orgDash User DocsLog In

🚧

New site!

All content has been migrated to docs.dash.org. You will be automatically redirected momentarily.

Usage: client.platform.contracts.create(contractDefinitions, identity)
Description: This method will return a Contract object initialized with the parameters defined and apply to the used identity.

Parameters:

parameterstyperequiredDescription
contractDefinitionsJSONDataContractyesThe defined JSON Application Schema
identityIdentityyesA valid registered application identity

Example:

  const identityId = '';// Your identity identifier.
  
  // Your valid json contract definitions
  const contractDefinitions = {
    note: {
      properties: {
        message: {
          type: "string"
        }
      },
      additionalProperties: false
    }
  };
  const identity = await client.platform.identities.get(identityId);
  const contract = client.platform.contracts.create(contractDefinitions, identity);
  
  // You can use the validate method from DPP to validate the created contract
  const validationResult = client.platform.dpp.dataContract.validate(contract);

Note: When your contract is created, it will only exist locally. Use the publish method to register it.

Returns: Contract.