issue(contract, sender, data, currency)

Feature

Return raw operation that issue a new credential. Note : Handler of contract also can execute the function. Credentials with the same credential ID cannot exist in one template.

Parameters

string contract Address,

string sender, object issueData, string currency

Return Value

object issue operation

// [ parameter issueData’s structure ]

{
      holder: string | Address,  // new credential issued to holder
      templateID: string,
      credentialID: string,   // credential ID, must be unique value in a template.
      value: string,
      validFrom: string | number | Big,
      validUntil: string | number | Big,
      did: string,
} 

example

const contractAddress = "0x41EFb6902ADcb1214a7123b01af66b1D13b89864fca";
const sender = "0x4874C17C354c498cf44D2946612DBe47fBcE7E87fca";
const holder = "0x07469989b2562afF5E5C3B116CD3AA5Ef814e5a1fca";
const currencyID = "MCC";
const issueData = {
    holder: holder,
    templateID: "adksjfxeifjkdjf",
    credentialID: "sefthia100",
    value: "sefthia200",
    validFrom: 100,
    validUntil: 200,
    did: "sefthia300",
};

const issuedOperation = mitum.credential.issue(contractAddress, sender, issueData, currencyID);
console.log(issuedOperation);

// output
Operation {
  id: 'mitum',
  fact: IssueFact {
    hint: Hint { s: 'mitum-credential-issue-operation-fact' },
    token: Token { s: '2024-06-27 06:09:26.477 +0000 UTC' },
    _hash: <Buffer 29 01 53 4e 22 ff 55 de 0d 2b a7 22 17 ca 0d 8f 71 ab 1b e4 87 cd 48 df 1a 48 62 54 11 b2 73 61>,
    sender: Address {
      s: '0x4874C17C354c498cf44D2946612DBe47fBcE7E87fca',
      type: 'mitum'
    },
    items: [ [IssueItem] ]
  },
  hint: Hint { s: 'mitum-credential-issue-operation' },
  _factSigns: [],
  _hash: <Buffer >
}

Last updated