Progetto token TypeScript impalcato per ERC-1155

Blockchain App Builder prende l'input dal file di specifica del token e genera un progetto di codice concatenato impalcato completamente funzionale.

Il progetto genera automaticamente classi e funzioni del ciclo di vita dei token, inclusi i metodi CRUD e non CRUD. La convalida degli argomenti, il marshalling/unmarshalling e la capacità di persistenza trasparente sono tutti supportati automaticamente.

Per informazioni sul progetto e sui metodi scaffolded non direttamente correlati ai token, vedere Progetto Chaincode TypeScript in grassetto.

Modello

Ogni classe di modello tokenizzata estende la classe OchainModel. La funzionalità di persistenza trasparente o ORM semplificato viene acquisita nella classe OchainModel. Il seguente modello mostra un token intero non fungibile.

import * as yup from "yup";
import { Id, Mandatory, Validate, Default, Embedded, Derived, ReadOnly } from "../../lib/decorators";
import { OchainModel } from "../../lib/ochain-model";
import { STRATEGY } from "../../lib/utils";
import { EmbeddedModel } from "../../lib/ochain-embedded-model";

export class ArtCollectionMetadata extends EmbeddedModel<ArtCollectionMetadata> {
  @Validate(yup.string())
  public painting_name: string;

  @Validate(yup.string())
  public description: string;

  @Validate(yup.string())
  public image: string;

  @Validate(yup.string())
  public painter_name: string;

}
    
@Id("tokenId")
export class ArtCollection extends OchainModel<ArtCollection> {
  public readonly assetType = "otoken";

  @Mandatory()
  @Validate(
    yup
      .string()
      .required()
      .matches(/^[A-Za-z0-9][A-Za-z0-9_-]*$/)
      .max(16)
  )
  public tokenId: string;

  @ReadOnly("artcollection")
  public tokenName: string;

  @Validate(yup.string().trim().max(256))
  public tokenDesc: string;


  @ReadOnly("erc1155+")
  public tokenStandard: string;

  @ReadOnly("nonfungible")
  public tokenType: string;

  @ReadOnly("whole")
  public tokenUnit: string;

  @ReadOnly(["indivisible","singleton","mintable","transferable","burnable","roles"])
  public behaviors: string[];

  @ReadOnly({ minter_role_name: "minter" })
  public roles: object;

  @ReadOnly({ max_mint_quantity: 20000 })
  public mintable: object;

  @Validate(yup.string())
  public owner: string;

  @Validate(yup.string())
  public createdBy: string;

  @Validate(yup.string())
  public transferredBy: string;

  @Validate(yup.string())
  public creationDate: string;

  @Validate(yup.string())
  public transferredDate: string;

  @Validate(yup.bool())
  public isBurned: boolean;

  @Validate(yup.string())
  public burnedBy: string;

  @Validate(yup.string())
  public burnedDate: string;

  @Mandatory()
  @Validate(yup.string().required().max(2000)) 
  public tokenUri: string;

  @Embedded(ArtCollectionMetadata)
  public tokenMetadata: ArtCollectionMetadata;

  @Validate(yup.number())
  public price: number;
  
  @Validate(yup.boolean())
  public on_sale_flag: boolean;
  
}

@Id("tokenId")
export class Loyalty extends OchainModel<Loyalty> {
  public readonly assetType = "otoken";

  @Mandatory()
  @Validate(
    yup
      .string()
      .required()
      .matches(/^[A-Za-z0-9][A-Za-z0-9_-]*$/)
      .max(16)
  )
  public tokenId: string;

  @ReadOnly("loyalty")
  public tokenName: string;

  @Validate(yup.string().trim().max(256))
  public tokenDesc: string;

  @ReadOnly("erc1155+")
  public tokenStandard: string;

  @ReadOnly("fungible")
  public tokenType: string;

  @ReadOnly("fractional")
  public tokenUnit: string;

  @ReadOnly(["divisible","mintable","transferable","burnable","roles"])
  public behaviors: string[];

  @ReadOnly({ minter_role_name: "minter" })
  public roles: object;

  @ReadOnly({ max_mint_quantity: 10000 })
  public mintable: object;

  @ReadOnly({ decimal: 2 })
  public divisible: object;

  @Validate(yup.string())
  public currency_name: string;
  
  @Validate(yup.number())
  public token_to_currency_ratio: number;
  
}
Il modello seguente mostra un token frazionario non fungibile.
export class RealEstatePropertyMetadata extends EmbeddedModel<RealEstatePropertyMetadata> {
  @Validate(yup.string())
  public propertyType: string;
  
  @Validate(yup.string())
  public propertyName: string;
  
  @Validate(yup.string())
  public propertyAddress: string;
  
  @Validate(yup.string())
  public propertyImage: string;
  
}
    
@Id("tokenId")
export class RealEstateProperty extends OchainModel<RealEstateProperty> {
  public readonly assetType = "otoken";

  @Mandatory()
  @Validate(
    yup
      .string()
      .required()
      .matches(/^[A-Za-z0-9][A-Za-z0-9_-]*$/)
      .max(16)
  )
  public tokenId: string;

  @ReadOnly("realestateproperty")
  public tokenName: string;

  @Validate(yup.string().trim().max(256))
  public tokenDesc: string;

  @ReadOnly("erc1155+")
  public tokenStandard: string;

  @ReadOnly("nonfungible")
  public tokenType: string;

  @ReadOnly("fractional")
  public tokenUnit: string;

  @ReadOnly(["divisible","mintable","transferable","roles"])
  public behaviors: string[];

  @ReadOnly({ minter_role_name: "minter" })
  public roles: object;

  @ReadOnly({ max_mint_quantity: 0 })
  public mintable: object;

  @Validate(yup.number().positive())
  public quantity: number;

  @Validate(yup.string())
  public createdBy: string;

  @Validate(yup.string())
  public creationDate: string;

  @ReadOnly({ decimal: 0 })
  public divisible: object;

  @Validate(yup.bool())
  public isBurned: boolean;

  @Mandatory()
  @Validate(yup.string().required().max(2000))
  public tokenUri: string;

  @Embedded(RealEstatePropertyMetadata)
  public tokenMetadata: RealEstatePropertyMetadata;

  @Validate(yup.number())
  public propertySellingPrice: number;
  
  @Validate(yup.number())
  public propertyRentingPrice: number;
  
}

Controllore

La classe controller principale estende la classe OchainController. C'è un solo controller principale.

export class DigiCurrCCController extends OchainController{

È possibile creare un numero qualsiasi di classi, funzioni o file, ma è possibile richiamare solo i metodi definiti all'interno della classe controller principale. Gli altri metodi sono nascosti.

È possibile utilizzare i metodi SDK token per scrivere metodi personalizzati per l'applicazione business.

Metodi token generati automaticamente

Blockchain App Builder genera automaticamente metodi per supportare i token e i cicli di vita dei token. È possibile utilizzare questi metodi per inizializzare i token, gestire ruoli e account e completare altri task del ciclo di vita dei token senza alcuna codifica aggiuntiva. I metodi controller devono disporre di un decorator @Validator(...params) per poter essere richiamati.

Metodi per la gestione del controllo dell'accesso

isTokenAdmin
Questo metodo restituisce il valore booleano true se il chiamante della funzione è un valore Token Admin, altrimenti restituisce false. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.
@GetMethod()
@Validator(yup.string(), yup.string())
public async getAccountDetailsByUser(orgId: string, userId: string) {
  const userAccountId = this.Ctx.ERC1155Account.generateAccountId(orgId, userId, ACCOUNT_TYPE.USER_ACCOUNT);
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ACCOUNT.getAccountDetailsByUser", "TOKEN", {
    accountId: userAccountId,
  });
  return await this.Ctx.ERC1155Account.getAccountDetailsByUser(orgId, userId);
}
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
Restituisce:
  • Il metodo restituisce true se il chiamante è un Token Admin, altrimenti restituisce false.
Esempio di valore restituito:
{"result": true}
addTokenAdmin
Questo metodo aggiunge un utente come Token Admin del codice concatenato. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.
@Validator(yup.string(), yup.string())
public async addTokenAdmin(orgId: string, userId: string) {
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ADMIN.addAdmin", "TOKEN");
  return await this.Ctx.ERC1155Admin.addAdmin(orgId, userId);
}
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
Restituisce:
  • In caso di operazione riuscita, un messaggio che include i dettagli dell'utente aggiunto come Token Admin del codice concatenato.
Esempio di valore restituito:
{"msg":"Successfully added Admin (OrgId: appDev, UserId: user1)"}
removeTokenAdmin
Questo metodo rimuove un utente come Token Admin del codice concatenato. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato. Impossibile rimuovere se stesso come Token Admin.
@Validator(yup.string(), yup.string())
public async removeTokenAdmin(orgId: string, userId: string) {
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ADMIN.removeAdmin", "TOKEN");
  return await this.Ctx.ERC1155Admin.removeAdmin(orgId, userId);
}
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
Restituisce:
  • In caso di operazione riuscita, un messaggio che include i dettagli dell'utente rimosso come Token Admin del codice concatenato.
Esempio di valore restituito:
{"msg": "Successfully removed Admin (OrgId: appDev, UserId: user1)"}
getAllTokenAdmins
Questo metodo restituisce un elenco di tutti gli utenti che sono un Token Admin del codice concatenato. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.
@GetMethod()
@Validator()
public async getAllTokenAdmins() {
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ADMIN.getAllAdmins", "TOKEN");
  return await this.Ctx.ERC1155Admin.getAllAdmins();
}
Parametri:
  • nessuno
Restituisce:
  • In caso di operazione riuscita, un array admins in formato JSON contenente gli oggetti orgId e userId.
Esempio di valore restituito:
{
  "admins": [
    {
      "orgId": "appdev",
      "userId": "user2"
    },
    {
      "orgId": "appdev",
      "userId": "user1"
    }
  ]
}

Metodi per la gestione della configurazione dei token

init
Questo metodo viene chiamato quando viene creata un'istanza del codice concatenato. Ogni Token Admin viene identificato dalle informazioni userId e orgId nel parametro adminList. userId è il nome utente o l'ID di posta elettronica del proprietario dell'istanza o dell'utente che ha eseguito il login all'istanza. orgId è l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione di rete corrente. Il parametro adminList è obbligatorio la prima volta che si distribuisce il codice concatenato. Se si sta aggiornando il codice concatenato, passare una lista vuota ([]). Se si è l'utente che ha inizialmente distribuito il codice concatenato, è inoltre possibile specificare nuovi amministratori nel parametro adminList durante l'aggiornamento del codice concatenato. Qualsiasi altra informazione nel parametro adminList viene ignorata durante gli aggiornamenti.
@Validator(yup.array().of(yup.object()).nullable())
public async init(adminList: ERC1155TokenAdminAsset[]) {
  await this.Ctx.ERC1155Admin.initAdmin(adminList);
  await this.Ctx.ERC1155Token.saveClassInfo(<1st NFT Token Name>);
  await this.Ctx.ERC1155Token.saveClassInfo(<2nd NFT Token Name>);
  .
  .
  await this.Ctx.ERC1155Token.saveClassInfo(<nth NFT Token Name>);
  // await this.Ctx.ERC1155Token.saveDeleteTransactionInfo();
  return;
}
Parametri:
  • adminList array: un array di informazioni {orgId, userId} che specifica la lista degli amministratori di token. L'array adminList è un parametro obbligatorio.
create<Token Name>Token
Questo metodo crea i token. Ogni token definito ha il proprio metodo di creazione. Per i token fungibili, questo metodo può essere chiamato solo da un Token Admin del codice concatenato. Per i token non fungibili, se il ruolo minter è definito nel file di specifica, qualsiasi utente con il ruolo minter può chiamare questo metodo per creare un NFT. Se il ruolo minter non è definito, qualsiasi utente può utilizzare questo metodo per creare (con menta) NFT. L'utente che chiama questo metodo diventa il proprietario dell'NFT.
Gettoni fungibili:
@Validator(<Token Class>)
public async create<Token Name>Token(tokenAsset: <Token Class>) {
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155TOKEN.save", "TOKEN");
  return await this.Ctx.ERC1155Token.save(tokenAsset);
}
Token non fungibili:
@Validator(<Token Class>, yup.number())
public async create<Token Name>Token(tokenAsset: <Token Class>, quantity: number) {
  return await this.Ctx.ERC1155Token.save(tokenAsset, quantity);
}
Parametri:
  • tokenAsset: <Token Class>: l'asset token. Le proprietà dell'asset sono definite nel file modello.
  • quantity: number: solo per i token non fungibili, il numero di token da coniare. L'unico valore supportato per questo parametro è 1.
Restituisce:
  • In caso di operazione riuscita, l'asset token in formato JSON, che include le informazioni riportate di seguito, a seconda del tipo di token.
  • tokenMetadata: informazioni JSON che descrivono il token.
  • createdBy: l'ID account del chiamante, che è l'utente che convoca il token. Proprietà non modificabile.
  • creationDate: l'indicatore orario della transazione di conio. Proprietà non modificabile.
  • isBurned: questa proprietà indica se il token è stato masterizzato. Proprietà non modificabile.
  • tokenName: il nome del token. Proprietà non modificabile.
  • tokenDesc: la descrizione del token.
  • symbol: il simbolo del token. Proprietà non modificabile.
  • tokenStandard: lo standard del token. Proprietà non modificabile.
  • tokenType: il tipo di token (fungibile o non fungibile). Proprietà non modificabile.
  • tokenUnit: l'unità del token (intero o frazionario). Proprietà non modificabile.
  • behaviors: lista dei comportamenti dei token. Proprietà non modificabile.
  • mintable: le proprietà relative al conio. Il valore max_mint_quantity definisce il numero massimo di token che è possibile creare per la classe di token.
  • owner: l'ID account del proprietario corrente, che è il chiamante del metodo.
  • tokenUri: l'URI del token.
  • quantity: la quantità del token.
Esempio di valore restituito (NFT intera):
{
    "tokenMetadata": {
        "paintingName": "monalisa",
        "description": "monalisa painting",
        "image": "image link",
        "painterName": "Leonardo da Vinci"
    },
    "assetType": "otoken",
    "quantity": 1,
    "tokenId": "artnft",
    "tokenName": "artcollection",
    "tokenDesc": "artcollection nft",
    "tokenStandard": "erc1155+",
    "tokenType": "nonfungible",
    "tokenUnit": "whole",
    "behaviors": [
        "indivisible",
        "singleton",
        "mintable",
        "transferable",
        "burnable",
        "roles"
    ],
    "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
    },
    "mintable": {
        "max_mint_quantity": 500
    },
    "owner": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
    "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
    "creationDate": "2022-12-29T04:08:35.000Z",
    "isBurned": false,
    "tokenUri": "tu",
    "price": 10000,
    "onSaleFlag": false
}
Esempio di valore restituito (token fungibile):
{
    "assetType": "otoken",
    "tokenId": "Loyalty",
    "tokenName": "loyalty",
    "tokenDesc": "Token Description",
    "tokenStandard": "erc1155+",
    "tokenType": "fungible",
    "tokenUnit": "fractional",
    "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "burnable",
        "roles"
    ],
    "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
    },
    "mintable": {
        "max_mint_quantity": 10000
    },
    "divisible": {
        "decimal": 2
    },
    "currency_name": "Dollar"
}
Esempio di valore restituito (NFT frazionale):
{
    "tokenMetadata": {
        "painting_name": "paint",
        "description": "Painting Description"
    },
    "assetType": "otoken",
    "tokenId": "realEstate",
    "tokenName": "realestate",
    "tokenDesc": "Token Description",
    "tokenStandard": "erc1155+",
    "tokenType": "nonfungible",
    "tokenUnit": "fractional",
    "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "burnable",
        "roles"
    ],
    "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
    },
    "mintable": {
        "max_mint_quantity": 20000
    },
    "quantity": 100,
    "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
    "creationDate": "2023-06-14T04:20:14.000Z",
    "divisible": {
        "decimal": 2
    },
    "isBurned": false,
    "tokenUri": "www.realestate.example.com",
    "price": 1000,
    "on_sale_flag": true
}
update<Token Name>Token
Questo metodo aggiorna i token. Ogni token definito ha un proprio metodo di aggiornamento. Impossibile aggiornare i metadati del token o l'URI del token dei token non fungibili. Per i token fungibili, questo metodo può essere chiamato solo da un Token Admin del codice concatenato. Per i token non fungibili, questo metodo può essere chiamato solo dal proprietario del token.
Gettoni fungibili:
@Validator(<Token Class>)
public async update<Token Name>Token(tokenAsset: <Token Class>) {
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155TOKEN.update", "TOKEN");
  return await this.Ctx.ERC1155Token.update(tokenAsset);
}
Token non fungibili:
@Validator(<Token Class>)
public async update<Token Name>Token(tokenAsset: <Token Class>) {
  return await this.Ctx.ERC1155Token.update(tokenAsset);
}
Parametri:
  • tokenAsset: <Token Class>: l'asset token. Le proprietà dell'asset sono definite nel file modello.
Restituisce:
  • In caso di operazione riuscita, l'asset token aggiornato in formato JSON.
Esempio di valore restituito (NFT intera):
{
    "tokenMetadata": {
        "paintingName": "monalisa",
        "description": "monalisa painting",
        "image": "image link",
        "painterName": "Leonardo da Vinci"
    },
    "assetType": "otoken",
    "quantity": 1,
    "tokenId": "artnft",
    "tokenName": "artcollection",
    "tokenDesc": "artcollection nft",
    "tokenStandard": "erc1155+",
    "tokenType": "nonfungible",
    "tokenUnit": "whole",
    "behaviors": [
        "indivisible",
        "singleton",
        "mintable",
        "transferable",
        "burnable",
        "roles"
    ],
    "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
    },
    "mintable": {
        "max_mint_quantity": 500
    },
    "owner": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
    "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
    "creationDate": "2022-12-29T04:08:35.000Z",
    "isBurned": false,
    "tokenUri": "tu",
    "price": 10000,
    "onSaleFlag": false
}
getTokenHistory
Questo metodo restituisce la cronologia per un ID token specificato. Chiunque può chiamare questo metodo.
@GetMethod()
@Validator(yup.string())
public async getTokenHistory(tokenId: string) {
  return await this.Ctx.ERC1155Token.getTokenHistory(tokenId);
}
Parametri:
  • tokenId: string: l'ID del token.
Restituisce:
  • In caso di operazione riuscita, un array JSON contenente la cronologia dei token.
Esempio di valore restituito (token fungibile):
[
    {
        "trxId": "ef4af760c3d7ee5e273196231d59fb91cafe6ca0f78c64747e87bc9bcbb3334b",
        "timeStamp": "2023-09-04T02:36:20.000Z",
        "value": {
            "assetType": "otoken",
            "tokenId": "LoyaltyToken",
            "tokenName": "loyalty",
            "tokenDesc": "Updated Fungible Whole",
            "tokenStandard": "erc1155+",
            "tokenType": "fungible",
            "tokenUnit": "fractional",
            "behaviors": [
                "divisible",
                "mintable",
                "transferable",
                "burnable",
                "roles"
            ],
            "roles": {
                "minter_role_name": "minter",
                "burner_role_name": "burner"
            },
            "mintable": {
                "max_mint_quantity": 10000
            },
            "divisible": {
                "decimal": 2
            },
            "currency_name": "Rupees"
        }
    },
    {
        "trxId": "4fb391a8903633a12a545cd2ecfb57f5575241325abf59995e2a4ed96572bb09",
        "timeStamp": "2023-09-04T02:35:07.000Z",
        "value": {
            "assetType": "otoken",
            "tokenId": "LoyaltyToken",
            "tokenName": "loyalty",
            "tokenDesc": "Fungible Whole",
            "tokenStandard": "erc1155+",
            "tokenType": "fungible",
            "tokenUnit": "fractional",
            "behaviors": [
                "divisible",
                "mintable",
                "transferable",
                "burnable",
                "roles"
            ],
            "roles": {
                "minter_role_name": "minter",
                "burner_role_name": "burner"
            },
            "mintable": {
                "max_mint_quantity": 10000
            },
            "divisible": {
                "decimal": 2
            },
            "currency_name": "Dollar"
        }
    }
]
Esempio di valore restituito (NFT frazionale):
[
    {
        "txId": "99bca74f401465206da7499cbf704dd443b3c3d94e348b1d6682ab5ee1864a08",
        "timestamp": "2023-06-20T01:09:18.000Z",
        "value": {
            "assetType": "otoken",
            "tokenId": "FNFT",
            "tokenName": "realestate",
            "tokenStandard": "erc1155+",
            "tokenType": "nonfungible",
            "tokenUnit": "fractional",
            "behaviors": [
                "divisible",
                "mintable",
                "transferable",
                "burnable",
                "roles"
            ],
            "roles": {
                "minter_role_name": "minter",
                "burner_role_name": "burner"
            },
            "mintable": {
                "max_mint_quantity": 20000
            },
            "quantity": 100,
            "createdBy": "oaccount~87bcb699d507368ee3966cd03ee6d7736ffc55dde8c0f0e16b14866334ac504a",
            "creationDate": "2023-06-20T00:53:13.000Z",
            "divisible": {
                "decimal": 2
            },
            "isBurned": false,
            "tokenUri": "www.FNFT.example.com",
            "price": 2000,
            "on_sale_flag": true,
            "owners": [
                {
                    "accountId": "oaccount~87bcb699d507368ee3966cd03ee6d7736ffc55dde8c0f0e16b14866334ac504a",
                    "tokenShare": 90
                },
                {
                    "accountId": "oaccount~3cddfdaa855900579d963aa6f755a4aed1f3a474a2462c1b45bd7f36df673224",
                    "tokenShare": 10
                }
            ]
        }
    },
    {
        "txId": "d517c61f40e7d6af2f04fe6d337b3e5108eb57030c9dc823793498fd4fed671b",
        "timestamp": "2023-06-20T00:53:13.000Z",
        "value": {
            "assetType": "otoken",
            "tokenId": "FNFT",
            "tokenName": "realestate",
            "tokenStandard": "erc1155+",
            "tokenType": "nonfungible",
            "tokenUnit": "fractional",
            "behaviors": [
                "divisible",
                "mintable",
                "transferable",
                "burnable",
                "roles"
            ],
            "roles": {
                "minter_role_name": "minter",
                "burner_role_name": "burner"
            },
            "mintable": {
                "max_mint_quantity": 20000
            },
            "quantity": 100,
            "createdBy": "oaccount~87bcb699d507368ee3966cd03ee6d7736ffc55dde8c0f0e16b14866334ac504a",
            "creationDate": "2023-06-20T00:53:13.000Z",
            "divisible": {
                "decimal": 2
            },
            "isBurned": false,
            "tokenUri": "www.FNFT.example.com",
            "price": 2000,
            "on_sale_flag": true,
            "owners": [
                {
                    "accountId": "oaccount~87bcb699d507368ee3966cd03ee6d7736ffc55dde8c0f0e16b14866334ac504a",
                    "tokenShare": 100
                }
            ]
        }
    }
]
Esempio di valore restituito (NFT intera):
[
    {
        "trxId": "92ac6b56112acdba724dd49924d2420a7899c013c61aa40d272e8ab391a65e0f",
        "timeStamp": "2023-09-04T02:28:48.000Z",
        "value": {
            "tokenMetadata": {
                "painting_name": "monalisa",
                "description": "monalisa painting",
                "image": "image link",
                "painter_name": "Leonardo da Vinci"
            },
            "assetType": "otoken",
            "tokenId": "artnft",
            "tokenName": "artcollection",
            "tokenDesc": "Updated Token Description",
            "tokenStandard": "erc1155+",
            "tokenType": "nonfungible",
            "tokenUnit": "whole",
            "behaviors": [
                "indivisible",
                "mintable",
                "transferable",
                "burnable",
                "roles"
            ],
            "roles": {
                "minter_role_name": "minter",
                "burner_role_name": "burner"
            },
            "mintable": {
                "max_mint_quantity": 20000
            },
            "quantity": 1,
            "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
            "creationDate": "2023-09-04T02:27:19.000Z",
            "owner": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
            "isBurned": false,
            "tokenUri": "www.FNFT.example.com",
            "price": 10000,
            "on_sale_flag": true
        }
    },
    {
        "trxId": "27697dd4a8dba53bad073aa95587cd1ef173b02fd95d771a60273d301fd3bcbe",
        "timeStamp": "2023-09-04T02:27:19.000Z",
        "value": {
            "tokenMetadata": {
                "painting_name": "monalisa",
                "description": "monalisa painting",
                "image": "image link",
                "painter_name": "Leonardo da Vinci"
            },
            "assetType": "otoken",
            "tokenId": "artnft",
            "tokenName": "artcollection",
            "tokenDesc": "artcollection nft",
            "tokenStandard": "erc1155+",
            "tokenType": "nonfungible",
            "tokenUnit": "whole",
            "behaviors": [
                "indivisible",
                "mintable",
                "transferable",
                "burnable",
                "roles"
            ],
            "roles": {
                "minter_role_name": "minter",
                "burner_role_name": "burner"
            },
            "mintable": {
                "max_mint_quantity": 20000
            },
            "quantity": 1,
            "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
            "creationDate": "2023-09-04T02:27:19.000Z",
            "owner": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
            "isBurned": false,
            "tokenUri": "www.FNFT.example.com",
            "price": 10000,
            "on_sale_flag": true
        }
    }
]
[
    {
        "trxId": "ebda1f31543f8906b7ec50a631afff6b8318a3d63c84f3e73be6785cc2ff31ff",
        "timeStamp": "2023-06-20T01:14:08.000Z",
        "value": {
            "assetType": "otoken",
            "tokenId": "NFT",
            "tokenName": "artcollection",
            "tokenStandard": "erc1155+",
            "tokenType": "nonfungible",
            "tokenUnit": "whole",
            "behaviors": [
                "indivisible",
                "singleton",
                "mintable",
                "transferable",
                "roles"
            ],
            "roles": {
                "minter_role_name": "minter",
                "burner_role_name": "burner"
            },
            "mintable": {
                "max_mint_quantity": 20000
            },
            "quantity": 1,
            "createdBy": "oaccount~87bcb699d507368ee3966cd03ee6d7736ffc55dde8c0f0e16b14866334ac504a",
            "creationDate": "2023-06-20T01:14:08.000Z",
            "owner": "oaccount~87bcb699d507368ee3966cd03ee6d7736ffc55dde8c0f0e16b14866334ac504a",
            "isBurned": false,
            "tokenUri": "www.NFT.example.com",
            "price": 2000,
            "on_sale_flag": true
        }
    }
]
getAllTokens
Questo metodo restituisce tutti gli asset token salvati nel database di stato. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato. Questo metodo utilizza query rich SQL di Berkeley DB e può essere richiamato solo quando si è connessi alla rete remota di Oracle Blockchain Platform.
@GetMethod()
@Validator(yup.string())
public async getTokenHistory(tokenId: string) {
  return await this.Ctx.ERC1155Token.getTokenHistory(tokenId);
}
Parametri:
  • nessuno
Restituisce:
  • Lista di tutti gli asset token in formato JSON.
Esempio di valore restituito:
[
  {
    "key": "tokenOne",
    "valueJson": {
      "assetType": "otoken",
      "tokenId": "tokenOne",
      "tokenName": "moneytok",
      "tokenStandard": "erc1155+",
      "tokenType": "fungible",
      "tokenUnit": "fractional",
      "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "roles"
      ],
      "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
      },
      "mintable": {
        "max_mint_quantity": 1000
      },
      "divisible": {
        "decimal": 2
      }
    }
  },
  {
    "key": "tokenTwo",
    "valueJson": {
      "assetType": "otoken",
      "tokenId": "tokenTwo",
      "tokenName": "moneytok",
      "tokenStandard": "erc1155+",
      "tokenType": "fungible",
      "tokenUnit": "fractional",
      "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "roles"
      ],
      "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
      },
      "mintable": {
        "max_mint_quantity": 1000
      },
      "divisible": {
        "decimal": 2
      }
    }
  },
  {
    "key": "art",
    "valueJson": {
      "assetType": "otoken",
      "quantity": 1,
      "tokenId": "art",
      "tokenName": "artcollection",
      "tokenStandard": "erc1155+",
      "tokenType": "nonfungible",
      "tokenUnit": "whole",
      "behaviors": [
        "indivisible",
        "singleton",
        "mintable",
        "transferable",
        "burnable",
        "roles"
      ],
      "roles": {
        "minter_role_name": "minter"
      },
      "mintable": {
        "max_mint_quantity": 20000
      },
      "owner": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
      "createdBy": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
      "creationDate": "2022-12-08T08:52:57.000Z",
      "isBurned": true,
      "tokenUri": "art.example.com",
      "transferredBy": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc",
      "transferredDate": "2022-12-08T08:59:17.000Z",
      "burnedBy": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
      "burnedDate": "2022-12-08T09:01:28.000Z"
    }
  },
  {
    "key": "FNFT",
    "valueJson": {
        "assetType": "otoken",
        "tokenId": "FNFT",
        "tokenName": "realestate",
        "tokenStandard": "erc1155+",
        "tokenType": "nonfungible",
        "tokenUnit": "fractional",
        "behaviors": [
            "divisible",
            "mintable",
            "transferable",
            "burnable",
            "roles"
        ],
        "roles": {
            "minter_role_name": "minter",
            "burner_role_name": "burner"
        },
        "mintable": {
            "max_mint_quantity": 20000
        },
        "quantity": 100,
        "createdBy": "oaccount~87bcb699d507368ee3966cd03ee6d7736ffc55dde8c0f0e16b14866334ac504a",
        "creationDate": "2023-06-20T00:53:13.000Z",
        "divisible": {
            "decimal": 2
        },
        "isBurned": false,
        "tokenUri": "www.FNFT.example.com",
        "price": 2000,
        "on_sale_flag": true
    }
  }
]
getTokenById
Questo metodo restituisce un oggetto token se il token è presente nel database di stato. Per gli NFT frazionari, viene restituito anche l'elenco dei proprietari. Questo metodo può essere chiamato solo da un Token Admin del codice concatenato o dal proprietario del token.
@GetMethod()
@Validator(yup.string())
public async getTokenById(tokenId: string) {
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155TOKEN.getTokenById", "TOKEN", { tokenId });
  return await this.Ctx.ERC1155Token.getTokenById(tokenId);
}
Parametri:
  • tokenId: string: l'ID del token da ottenere.
Esempio di valore restituito (NFT intera):
{
  "assetType": "otoken",
  "quantity": 1,
  "tokenId": "art",
  "tokenName": "artcollection",
  "tokenStandard": "erc1155+",
  "tokenType": "nonfungible",
  "tokenUnit": "whole",
  "behaviors": [
    "indivisible",
    "singleton",
    "mintable",
    "transferable",
    "burnable",
    "roles"
  ],
  "roles": {
    "minter_role_name": "minter"
  },
  "mintable": {
    "max_mint_quantity": 20000
  },
  "owner": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
  "createdBy": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
  "creationDate": "2022-12-08T08:52:57.000Z",
  "isBurned": true,
  "tokenUri": "art.example.com",
  "transferredBy": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc",
  "transferredDate": "2022-12-08T08:59:17.000Z",
  "burnedBy": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
  "burnedDate": "2022-12-08T09:01:28.000Z"
}
Esempio di valore restituito (token fungibile):
{
    "assetType": "otoken",
    "tokenId": "Loyalty",
    "tokenName": "loyalty",
    "tokenDesc": "Token Description",
    "tokenStandard": "erc1155+",
    "tokenType": "fungible",
    "tokenUnit": "fractional",
    "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "burnable",
        "roles"
    ],
    "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
    },
    "mintable": {
        "max_mint_quantity": 10000
    },
    "divisible": {
        "decimal": 2
    },
    "currency_name": "Dollar"
}
Esempio di valore restituito (NFT frazionale):
{
    "tokenMetadata": {
        "painting_name": "paint",
        "description": "Painting Description"
    },
    "assetType": "otoken",
    "tokenId": "realEstate",
    "tokenName": "realestate",
    "tokenDesc": "Token Description",
    "tokenStandard": "erc1155+",
    "tokenType": "nonfungible",
    "tokenUnit": "fractional",
    "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "burnable",
        "roles"
    ],
    "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
    },
    "mintable": {
        "max_mint_quantity": 20000
    },
    "quantity": 100,
    "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
    "creationDate": "2023-06-14T04:20:14.000Z",
    "divisible": {
        "decimal": 2
    },
    "isBurned": false,
    "tokenUri": "www.realestate.example.com",
    "price": 1000,
    "on_sale_flag": true,
    "owners": [
        {
            "accountId": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
            "tokenShare": 100
        }
    ]
}
getAllTokensByUser
Questo metodo restituisce tutti gli asset token di proprietà di un utente specificato. Questo metodo utilizza query rich SQL di Berkeley DB e può essere richiamato solo quando si è connessi alla rete remota di Oracle Blockchain Platform. Questo metodo può essere chiamato solo da un Token Admin del codice concatenato o dal proprietario del conto.
@GetMethod()
@Validator(yup.string(), yup.string())
public async getAllTokensByUser(orgId: string, userId: string) {
  const accountId = this.Ctx.ERC1155Account.generateAccountId(orgId, userId, ACCOUNT_TYPE.USER_ACCOUNT);
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155TOKEN.getAllTokensByUser", "TOKEN", { accountId });
  return await this.Ctx.ERC1155Token.getAllTokensByUser(accountId);
}
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
Esempio di valore restituito:
[
  {
    "key": "tokenOne",
    "valueJson": {
      "assetType": "otoken",
      "tokenId": "tokenOne",
      "tokenName": "moneytok",
      "tokenStandard": "erc1155+",
      "tokenType": "fungible",
      "tokenUnit": "fractional",
      "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "roles"
      ],
      "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
      },
      "mintable": {
        "max_mint_quantity": 1000
      },
      "divisible": {
        "decimal": 2
      }
    }
  },
  {
    "key": "nftToken",
    "valueJson": {
      "assetType": "otoken",
      "quantity": 1,
      "tokenId": "nftToken",
      "tokenName": "artcollection",
      "tokenStandard": "erc1155+",
      "tokenType": "nonfungible",
      "tokenUnit": "whole",
      "behaviors": [
        "indivisible",
        "singleton",
        "mintable",
        "transferable",
        "burnable",
        "roles"
      ],
      "roles": {
        "minter_role_name": "minter"
      },
      "mintable": {
        "max_mint_quantity": 20000
      },
      "owner": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
      "createdBy": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
      "creationDate": "2022-12-08T09:10:21.000Z",
      "isBurned": false,
      "tokenUri": "example.com"
    }
  }
]
ownerOf
Questo metodo restituisce l'ID account, l'ID organizzazione e l'ID utente del proprietario dell'ID token specificato. Chiunque può chiamare questo metodo.
@GetMethod()
@Validator(yup.string())
public async ownerOf(tokenId: string) {
  return await this.Ctx.ERC1155Token.ownerOf(tokenId);
}
Parametri:
  • tokenId: string: l'ID del token.
Esempio di valore restituito (NFT intera):
{
    "accountId": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
    "orgId": "appdev",
    "userId": "idcqa"
}
Esempio di valore restituito (NFT frazionale):
[
    {
        "accountId": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
        "orgId": "Org1MSP",
        "userId": "admin"
    },
    {
        "accountId": "oaccount~74108eca702bab6d8548e740254f2cc7955d886885251d52d065042172a59db0",
        "orgId": "Org1MSP",
        "userId": "user"
    }
]
URI
Questo metodo restituisce l'URI di un token specificato. Chiunque può chiamare questo metodo.
@GetMethod()
@Validator(yup.string())
public async URI(tokenId: string) {
  return await this.Ctx.ERC1155Token.tokenURI(tokenId);
}
Parametri:
  • tokenId: string: l'ID del token.
Esempio di valore restituito:
{
    "tokenUri": "example.com"
}
name
Questo metodo restituisce il nome della classe di token. Chiunque può chiamare questo metodo.
@GetMethod()
@Validator(yup.string())
public async name(tokenId: string) {
  return await this.Ctx.ERC1155Token.name(tokenId);
}
Parametri:
  • tokenId: string: l'ID del token.
Esempio di valore restituito:
{"tokenName": "artcollection"}
totalSupply
Questo metodo restituisce il numero totale di token coniati. I token fungibili sono specificati dall'ID token. I token non fungibili sono specificati dal nome del token. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.
@GetMethod()
@Validator(yup.object())
public async totalSupply(tokenDetail: TokenDetail) {
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155TOKEN.totalSupply", "TOKEN");
  const token = await this.Ctx.ERC1155Token.getTokenByIdOrName(tokenDetail);
  return await this.Ctx.ERC1155Token.totalSupply(token);
}
Parametri:
  • tokenDetails: TokenDetail: i dettagli che specificano il token. Per i token fungibili, utilizzare il seguente formato:
    {"tokenId":"token1"}
    Per i token non fungibili, utilizzare il seguente formato:
    {"tokenName":"artCollection"}
Esempio di valore restituito:
{"totalSupply": 110}
totalNetSupply
Questo metodo restituisce il numero totale di token coniati meno il numero di token bruciati. I token fungibili sono specificati dall'ID token. I token non fungibili sono specificati dal nome del token. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.
@GetMethod()
@Validator(yup.object())
public async totalNetSupply(tokenDetail: TokenDetail) {
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155TOKEN.totalNetSupply", "TOKEN");
  const token = await this.Ctx.ERC1155Token.getTokenByIdOrName(tokenDetail);
  return await this.Ctx.ERC1155Token.totalNetSupply(token);
}
Parametri:
  • tokenDetails: TokenDetail: i dettagli che specificano il token. Per i token fungibili, utilizzare il seguente formato:
    {"tokenId":"token1"}
    Per i token non fungibili, utilizzare il seguente formato:
    {"tokenName":"artCollection"}
Esempio di valore restituito:
{"totalNetSupply": 105}
getTokensByName
Questo metodo restituisce tutti gli asset token per un nome token specificato. Questo metodo utilizza query rich SQL di Berkeley DB e può essere richiamato solo quando si è connessi alla rete remota di Oracle Blockchain Platform. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.
@GetMethod()
@Validator(yup.string())
public async getTokensByName(tokenName: string) {
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155TOKEN.getTokensByName", "TOKEN");
  return await this.Ctx.ERC1155Token.getTokensByName(tokenName);
}
Parametri:
  • tokenName: string: il nome del token.
Esempio di valore restituito:
[
  {
    "key": "tokenOne",
    "valueJson": {
      "assetType": "otoken",
      "tokenId": "tokenOne",
      "tokenName": "moneytok",
      "tokenStandard": "erc1155+",
      "tokenType": "fungible",
      "tokenUnit": "fractional",
      "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "roles"
      ],
      "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
      },
      "mintable": {
        "max_mint_quantity": 1000
      },
      "divisible": {
        "decimal": 2
      }
    }
  },
  {
    "key": "tokenTwo",
    "valueJson": {
      "assetType": "otoken",
      "tokenId": "tokenTwo",
      "tokenName": "moneytok",
      "tokenStandard": "erc1155+",
      "tokenType": "fungible",
      "tokenUnit": "fractional",
      "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "roles"
      ],
      "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
      },
      "mintable": {
        "max_mint_quantity": 1000
      },
      "divisible": {
        "decimal": 2
      }
    }
  }
]
getTokenDecimal
Questo metodo restituisce il numero di posizioni decimali per un token specificato. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.
@GetMethod()
@Validator(yup.string())
public async getTokenDecimal(tokenId: string) {
  const token = await this.Ctx.ERC1155Token.get(tokenId);
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155TOKEN.getDecimals", "TOKEN");
  return {
    msg: `Token Id: ${tokenId} has ${this.Ctx.ERC1155Token.getDecimals(token)} decimal places.`,
  };
}
Parametri:
  • tokenId: string: l'ID del token.
Esempio di valore restituito:
{
    "msg": "Token Id: tokenOne has 2 decimal places."
}

Metodi per la gestione degli account

createAccount
Questo metodo crea un account per un utente specificato e gli account token associati per token fungibili o non fungibili. È necessario creare un account per qualsiasi utente che avrà token in qualsiasi momento. L'account utente tiene traccia dell'account NFT e degli account token fungibili detenuti da un utente. Per completare le operazioni relative ai token, gli utenti devono disporre di account nella rete. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.

Un account utente dispone di un ID univoco, formato da un hash SHA-256 del parametro orgId e del parametro userId.

Un utente può avere più account token fungibili con ID account univoci. Gli ID account token fungibili sono formati da un hash SHA-256 del parametro orgId, dal parametro userId, dalla stringa costante ft separata dal simbolo tilde (~) e da un numero di contatore che indica l'indice del conto fungibile creato separato dal simbolo tilde (~).

Un utente può avere un solo account token non fungibile. Gli ID account token non fungibili sono univoci e sono formati da un hash SHA-256 del parametro orgId, del parametro userId e della stringa costante nft separati dal simbolo tilde (~). Tutti i token non fungibili di proprietà di un utente, sia interi che frazionari, sono collegati a questo account.

Gli ID account utente iniziano con ouaccount~. Gli ID account token iniziano con oaccount~.

@Validator(yup.string(), yup.string(), yup.boolean(), yup.boolean())
public async createAccount(orgId: string, userId: string, ftAccount: boolean, nftAccount: boolean) {
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ACCOUNT.createAccount", "TOKEN");
  return await this.Ctx.ERC1155Account.createAccount(orgId, userId, ftAccount, nftAccount);
}
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
  • ftAccount: boolean: se true, viene creato un account token fungibile associato all'account utente.
  • nftAccount: boolean: se true, viene creato un account token non fungibile associato all'account utente.
Restituisce:
  • In caso di operazione riuscita, un oggetto JSON dell'account creato.
Esempio di valore restituito:
{
  "assetType": "ouaccount",
  "accountId": "ouaccount~cf20877546f52687f387e7c91d88b9722c97e1a456cc0484f40c747f7804feae",
  "userId": "user1",
  "orgId": "appdev",
  "totalAccounts": 2,
  "totalFtAccounts": 1,
  "associatedFtAccounts": [
    {
      "accountId": "oaccount~60bb20c14a83f6e426e1437c479c5891e1c6477dfd7ad18b73acac5d80bc504b",
      "tokenId": ""
    }
  ],
  "associatedNftAccount": "oaccount~73c3e835dac6d0a56ca9d8def08269f83cefd59b9d297fe2cdc5a9083828fa58"
}
createUserAccount
Questo metodo crea un account per un utente specificato. È necessario creare un account per qualsiasi utente che avrà token in qualsiasi momento. L'account utente tiene traccia dell'account NFT e degli account token fungibili di cui dispone un utente. Per completare le operazioni relative ai token, gli utenti devono disporre di account nella rete.

Un ID account è un hash SHA-256 del parametro orgId e del parametro userId. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.

@Validator(yup.string(), yup.string())
  public async createUserAccount(orgId: string, userId: string) {
    await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ACCOUNT.createUserAccount", "TOKEN");
    return await this.Ctx.ERC1155Account.createUserAccount(orgId, userId);
  }
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
Restituisce:
  • In caso di operazione riuscita, un oggetto JSON dell'account utente creato.
Esempio di valore restituito:
{
  "assetType": "ouaccount",
  "accountId": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc",
  "userId": "user2",
  "orgId": "appdev",
  "totalAccounts": 0,
  "totalFtAccounts": 0,
  "associatedFtAccounts": [],
  "associatedNftAccount": ""
}
createTokenAccount
Questo metodo crea un account token fungibile o non fungibile da associare a un account utente.

Un utente può avere più account token fungibili con ID account univoci. Gli ID account token fungibili sono formati da un hash SHA-256 del parametro orgId, dal parametro userId, dalla stringa costante ft separata dal simbolo tilde (~) e da un numero di contatore che indica l'indice del conto fungibile creato separato dal simbolo tilde (~).

Un utente può avere un solo account token non fungibile. Gli ID account token non fungibili sono univoci e sono formati da un hash SHA-256 del parametro orgId, del parametro userId e della stringa costante nft separati dal simbolo tilde (~). Tutti i token non fungibili di proprietà di un utente, sia interi che frazionari, sono collegati a questo account.

Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.

@Validator(yup.string(), yup.string(), yup.string())
  public async createTokenAccount(orgId: string, userId: string, tokenType: TokenType) {
    await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ACCOUNT.createTokenAccount", "TOKEN");
    return await this.Ctx.ERC1155Account.createTokenAccount(orgId, userId, tokenType);
  }
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
  • tokenType: TokenType: il tipo di account token da creare. Gli unici tipi di token supportati sono nonfungible e fungible.
Restituisce:
  • In caso di operazione riuscita, un oggetto JSON dell'account token creato.
Esempio di valore restituito:
{
  "assetType": "ouaccount",
  "accountId": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc",
  "userId": "user2",
  "orgId": "appdev",
  "totalAccounts": 1,
  "totalFtAccounts": 1,
  "associatedFtAccounts": [
    {
      "accountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a",
      "tokenId": ""
    }
  ],
  "associatedNftAccount": ""
}
associateFungibleTokenAccount
Questo metodo associa l'account token fungibile di un utente a un token fungibile particolare.

Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.

@Validator(yup.string(), yup.string(), yup.string())
public async associateFungibleTokenToAccount(orgId: string, userId: string, tokenId: string) {
  const accountId = this.Ctx.ERC1155Account.generateAccountId(orgId, userId, ACCOUNT_TYPE.USER_ACCOUNT);
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ACCOUNT.associateFungibleTokenToAccount", "TOKEN", { accountId });
  return await this.Ctx.ERC1155Account.associateTokenToToken(accountId, tokenId);
}
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
  • tokenId: string: l'ID del token.
Restituisce:
  • In caso di operazione riuscita, un oggetto JSON dell'account utente, che mostra che il token fungibile è stato associato all'account token. Nell'esempio seguente, ad esempio, il primo oggetto dell'array associatedFtAccounts mostra che sono associati l'ID account token fungibile e l'ID token.
Esempio di valore restituito:
{
  "assetType": "ouaccount",
  "accountId": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc",
  "userId": "user2",
  "orgId": "appdev",
  "totalAccounts": 1,
  "totalFtAccounts": 1,
  "associatedFtAccounts": [
    {
      "accountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a",
      "tokenId": "tokenOne"
    }
  ],
  "associatedNftAccount": ""
}
getAccountHistory
Questo metodo restituisce la cronologia per un account token specificato. Si tratta di un metodo asincrono. Questo metodo può essere chiamato solo da un Token Admin del codice concatenato o dal proprietario del conto.
@GetMethod()
@Validator(yup.string(), yup.string(), yup.string())
public async getAccountHistory(orgId: string, userId: string, tokenId?: string) {
  const userAccountId = await this.Ctx.ERC1155Account.generateAccountId(orgId, userId, ACCOUNT_TYPE.USER_ACCOUNT);
  const userAccount = await this.Ctx.ERC1155Account.getAccount(userAccountId, tokenId);
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ACCOUNT.history", "TOKEN", { accountId: userAccountId });
  return await this.Ctx.ERC1155Account.getAccountHistory(userAccount.accountId);
}
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
  • tokenId?: string: per un account token non fungibile, una stringa vuota. Per un account token fungibile, l'ID token.
Restituisce:
  • In caso di operazione riuscita, un array di oggetti JSON che descrive la cronologia dell'account.
Esempio di valore restituito:
[
  {
    "trxId": "89f462697f3c988024b2c248cbda21f9eb7e96567e56dd8db64ada96a4845a7f",
    "timeStamp": "2022-12-08T07:15:10.000Z",
    "value": {
      "assetType": "oaccount",
      "bapAccountVersion": 1,
      "accountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a",
      "userId": "user2",
      "orgId": "appdev",
      "tokenType": "fungible",
      "tokenId": "tokenOne",
      "tokenName": "moneytok",
      "balance": 110
    }
  },
  {
    "trxId": "30dd4fe0746350c85a5000996974487010a0a8fee73d6b2e480c3ca330a6d31f",
    "timeStamp": "2022-12-08T06:43:10.000Z",
    "value": {
      "assetType": "oaccount",
      "bapAccountVersion": 0,
      "accountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a",
      "userId": "user2",
      "orgId": "appdev",
      "tokenType": "fungible",
      "tokenId": "tokenOne",
      "tokenName": "moneytok",
      "balance": 0
    }
  },
  {
    "trxId": "6226c0455cc3a4f99c3fd7ed8b1d36b8e93f863e42ab61a9b0d399f2d69d2f3d",
    "timeStamp": "2022-12-08T06:41:51.000Z",
    "value": {
      "assetType": "oaccount",
      "bapAccountVersion": 0,
      "accountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a",
      "userId": "user2",
      "orgId": "appdev",
      "tokenType": "fungible",
      "tokenId": "",
      "balance": 0
    }
  }
]
getAccount
Questo metodo restituisce i dettagli dell'account token per un utente specificato. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato o dall'Account Owner dell'account.
@GetMethod()
@Validator(yup.string(), yup.string(), yup.string())
public async getAccount(orgId: string, userId: string, tokenId?: string) {
  const userAccountId = this.Ctx.ERC1155Account.generateAccountId(orgId, userId, ACCOUNT_TYPE.USER_ACCOUNT);
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ACCOUNT.getAccount", "TOKEN", { accountId: userAccountId });
  return await this.Ctx.ERC1155Account.getAccountWithStatus(userAccountId, tokenId);
}
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
  • tokenId?: string: per un account token non fungibile, una stringa vuota. Per un account token fungibile, l'ID token.
Restituisce:
  • In caso di operazione riuscita, un oggetto JSON che include i dettagli dell'account token. Il parametro bapAccountVersion viene definito nell'oggetto conto per uso interno.
Esempio di valore restituito (account token non fungibile):
{
  "assetType": "oaccount",
  "bapAccountVersion": 1,
  "status": "active",
  "accountId": "oaccount~cc301bee057f14236a97d434909ec1084970921b008f6baab09c2a0f5f419a9a",
  "userId": "idcqa",
  "orgId": "appdev",
  "tokenType": "nonfungible",
  "noOfNfts": 1
}
Esempio di valore restituito (account token fungibile):
{
  "bapAccountVersion": 0,
  "assetType": "oaccount",
  "status": "active",
  "accountId": "oaccount~2de8db6b91964f8c9009136831126d3cfa94e1d00c4285c1ea3e6d1f36479ed4",
  "userId": "idcqa",
  "orgId": "appdev",
  "tokenType": "fungible",
  "tokenId": "t1",
  "tokenName": "loyalty",
  "balance": 100
}
getAllAccounts
Questo metodo restituisce i dettagli di tutti gli account utente. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.
@GetMethod()
@Validator()
public async getAllAccounts() {
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ACCOUNT.getAllAccounts", "TOKEN");
  return await this.Ctx.ERC1155Account.getAllAccounts();
}
Parametri:
  • nessuno
Restituisce:
  • In caso di operazione riuscita, un array JSON di tutti gli account.
Esempio di valore restituito:
[
        {
            "assetType": "ouaccount",
            "accountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
            "userId": "idcqa",
            "orgId": "appdev",
            "totalAccounts": 2,
            "totalFtAccounts": 1,
            "associatedFtAccounts": [
                {
                    "accountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e",
                    "tokenId": "loy1"
                }
            ],
            "associatedNftAccount": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371"
        },
        {
            "assetType": "ouaccount",
            "accountId": "ouaccount~9501bb774c156eb8354dfe489250ea91f757523d70f08ee494bda98bb352003b",
            "userId": "user1_minter",
            "orgId": "appdev",
            "totalAccounts": 2,
            "totalFtAccounts": 1,
            "associatedFtAccounts": [
                {
                    "accountId": "oaccount~1089ee5122f367ee0ca38c6660298f4b81f199627e4f67f3691c0f628237974c",
                    "tokenId": "loy1"
                }
            ],
            "associatedNftAccount": "oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446"
        },
    ]
getAccountDetailsByUser
Questo metodo restituisce un riepilogo dell'account per un utente specificato e i dettagli dei token fungibili e non fungibili associati all'utente. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato o dall'Account Owner dell'account.
@GetMethod()
@Validator(yup.string(), yup.string())
public async getAccountDetailsByUser(orgId: string, userId: string) {
  const userAccountId = this.Ctx.ERC1155Account.generateAccountId(orgId, userId, ACCOUNT_TYPE.USER_ACCOUNT);
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ACCOUNT.getAccountDetailsByUser", "TOKEN", {
    accountId: userAccountId,
  });
  return await this.Ctx.ERC1155Account.getAccountDetailsByUser(orgId, userId);
}
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
Restituisce:
  • In caso di operazione riuscita, un oggetto account JSON che include e riepiloga l'account per l'utente specificato e i dettagli dei token fungibili e non fungibili associati all'utente. Per i token non fungibili frazionari, la proprietà tokenShare nella sezione associatedNFTs mostra la condivisione di proprietà dell'utente.
Esempio di valore restituito:
{
    "userAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
    "associatedFTAccounts": [
        {
            "accountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e",
            "tokenId": "FT",
            "balance": 50
        }
    ],
    "associatedNFTAccount": {
        "accountId": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371",
        "associatedNFTs": [
            {
                "nftTokenId": "FNFT",
                "tokenShare": 100
            },
            {
                "nftTokenId": "FNFT2",
                "tokenShare": 110
            },
            {
                "nftTokenId": "NFT"
            }
        ]
    }
}
getUserByAccountId
Questo metodo restituisce i dettagli utente di un ID account specificato. Questo metodo può essere chiamato da qualsiasi utente.
@GetMethod()
@Validator(yup.string())
public async getUserByAccountId(accountId: string) {
  return await this.Ctx.ERC1155Account.getUserByAccountId(accountId);
}
Parametri:
  • accountId: string: l'ID dell'account.
Restituisce:
  • In caso di operazione riuscita, un oggetto JSON dei dettagli utente (orgId e userId).
Esempio di valore restituito:
{
  "orgId": "appdev"
  "userId": "user2",
}

Metodi per la gestione dei ruoli

addRole
Questo metodo aggiunge un ruolo a un utente e a un token specificati. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato. I token fungibili sono specificati dall'ID token. I token non fungibili sono specificati dal nome del token. L'utente specificato deve disporre di un account token associato al token fungibile o di un account token non fungibile per i ruoli NFT. Il ruolo specificato deve esistere nel file di specifica per il token.
@Validator(yup.string(), yup.string(), yup.string(), yup.object())
public async addRole(orgId: string, userId: string, role: string, tokenDetail: TokenDetail) {
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155TOKEN.addRoleMember", "TOKEN");
  const userAccountId = this.Ctx.ERC1155Account.generateAccountId(orgId, userId, ACCOUNT_TYPE.USER_ACCOUNT);
  const token = await this.Ctx.ERC1155Token.getTokenByIdOrName(tokenDetail);
  return await this.Ctx.ERC1155Token.addRoleMember(role, userAccountId, token);
}
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
  • role: string: il nome del ruolo da aggiungere all'utente specificato.
  • tokenDetails: TokenDetail: i dettagli che specificano il token. Per i token fungibili, utilizzare il seguente formato:
    {"tokenId":"token1"}
    Per i token non fungibili, utilizzare il seguente formato:
    {"tokenName":"artCollection"}
Restituisce:
  • In caso di operazione riuscita, un messaggio con i dettagli dell'account.
Esempio di valore restituito:
{
  "msg": "Successfully added role 'minter' to Account Id: oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a (Org-Id: appdev, User-Id: idcqa)"
}
isInRole
Questo metodo restituisce un valore booleano per indicare se un utente dispone di un ruolo specificato. I token fungibili sono specificati dall'ID token. I token non fungibili sono specificati dal nome del token. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato o dall'Account Owner dell'account. L'utente specificato deve disporre di un account token associato al token fungibile o di un account token non fungibile per i ruoli NFT. Il ruolo specificato deve esistere nel file di specifica per il token.
@GetMethod()
@Validator(yup.string(), yup.string(), yup.string(), yup.object())
public async isInRole(orgId: string, userId: string, role: string, tokenDetail: TokenDetail) {
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155TOKEN.removeRoleMember", "TOKEN");
  const userAccountId = this.Ctx.ERC1155Account.generateAccountId(orgId, userId, ACCOUNT_TYPE.USER_ACCOUNT);
  const token = await this.Ctx.ERC1155Token.getTokenByIdOrName(tokenDetail);
  return await this.Ctx.ERC1155Token.isInRole(role, userAccountId, token);
}
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
  • role: string: il nome del ruolo da cercare.
  • tokenDetails: TokenDetail: i dettagli che specificano il token. Per i token fungibili, utilizzare il seguente formato:
    {"tokenId":"token1"}
    Per i token non fungibili, utilizzare il seguente formato:
    {"tokenName":"artCollection"}
Esempio di valore restituito:
{
    "result": true,
    "msg": "Account Id oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a (Org-Id: appdev, User-Id: idcqa) has minter role"
}
removeRole
Questo metodo rimuove un ruolo da un utente e un token specificati. I token fungibili sono specificati dall'ID token. I token non fungibili sono specificati dal nome del token. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato. L'utente specificato deve disporre di un account token associato al token fungibile o di un account token non fungibile per i ruoli NFT. Il ruolo specificato deve esistere nel file di specifica per il token.
@Validator(yup.string(), yup.string(), yup.string(), yup.object())
public async removeRole(orgId: string, userId: string, role: string, tokenDetail: TokenDetail) {
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155TOKEN.removeRoleMember", "TOKEN");
  const userAccountId = this.Ctx.ERC1155Account.generateAccountId(orgId, userId, ACCOUNT_TYPE.USER_ACCOUNT);
  const token = await this.Ctx.ERC1155Token.getTokenByIdOrName(tokenDetail);
  return await this.Ctx.ERC1155Token.removeRoleMember(role, userAccountId, token);
}
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
  • role: string: il nome del ruolo da rimuovere dall'utente specificato.
  • tokenDetails: TokenDetail: i dettagli che specificano il token. Per i token fungibili, utilizzare il seguente formato:
    {"tokenId":"token1"}
    Per i token non fungibili, utilizzare il seguente formato:
    {"tokenName":"artCollection"}
Esempio di valore restituito:
{
  "msg": "Successfully removed role 'minter' from Account Id: oaccount~60bb20c14a83f6e426e1437c479c5891e1c6477dfd7ad18b73acac5d80bc504b (Org-Id: appdev, User-Id: user1)"
}
getAccountsByRole
Questo metodo restituisce un elenco di tutti gli ID account per un ruolo e un token specificati. I token fungibili sono specificati dall'ID token. I token non fungibili sono specificati dal nome del token. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.
@GetMethod()
@Validator(yup.string(), yup.object())
public async getAccountsByRole(role: string, tokenDetail: TokenDetail) {
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ROLE.getAccountsByRole", "TOKEN");
  const token = await this.Ctx.ERC1155Token.getTokenByIdOrName(tokenDetail);
  return await this.Ctx.ERC1155Token.getAccountsByRole(role, token);
}
Parametri:
  • role: string: il nome del ruolo da cercare.
  • tokenDetails: TokenDetail: i dettagli che specificano il token. Per i token fungibili, utilizzare il seguente formato:
    {"tokenId":"token1"}
    Per i token non fungibili, utilizzare il seguente formato:
    {"tokenName":"artCollection"}
Esempio di valore restituito:
{
  "accounts": [
    "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a",
    "oaccount~60bb20c14a83f6e426e1437c479c5891e1c6477dfd7ad18b73acac5d80bc504b"
  ]
}
getUsersByRole
Questo metodo restituisce una lista di tutti gli utenti per un ruolo e un token specificati. I token fungibili sono specificati dall'ID token. I token non fungibili sono specificati dal nome del token. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.
@GetMethod()
@Validator(yup.string(), yup.object())
public async getUsersByRole(role: string, tokenDetail: TokenDetail) {
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ROLE.getUsersByRole", "TOKEN");
  const token = await this.Ctx.ERC1155Token.getTokenByIdOrName(tokenDetail);
  return await this.Ctx.ERC1155Token.getUsersByRole(role, token);
}
Parametri:
  • role: string: il nome del ruolo da cercare.
  • tokenDetails: TokenDetail: i dettagli che specificano il token. Per i token fungibili, utilizzare il seguente formato:
    {"tokenId":"token1"}
    Per i token non fungibili, utilizzare il seguente formato:
    {"tokenName":"artCollection"}
Esempio di valore restituito:
{
    "users": [
        {
            "accountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a",
            "orgId": "appdev",
            "userId": "user2"
        },
        {
            "accountId": "oaccount~60bb20c14a83f6e426e1437c479c5891e1c6477dfd7ad18b73acac5d80bc504b",
            "orgId": "appdev",
            "userId": "user1"
        }
    ]
}

Metodi per la gestione della cronologia delle transazioni

getAccountTransactionHistory
Questo metodo restituisce la cronologia delle transazioni del conto. Questo metodo può essere chiamato solo da un Token Admin del codice concatenato o dal proprietario del conto. Per i token non fungibili, questo metodo può essere richiamato solo quando è connesso alla rete remota di Oracle Blockchain Platform.
@GetMethod()
@Validator(yup.string(), yup.string(), yup.string())
public async getAccountTransactionHistory(orgId: string, userId: string, tokenId?: string) {
  const userAccountId = await this.Ctx.ERC1155Account.generateAccountId(orgId, userId, ACCOUNT_TYPE.USER_ACCOUNT);
  await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ACCOUNT.getAccountTransactionHistory", "TOKEN", {
    accountId: userAccountId,
  });
  const account = await this.Ctx.ERC1155Account.getAccount(userAccountId, tokenId);
  return await this.Ctx.ERC1155Account.getAccountTransactionHistory(account.accountId);
}
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
  • tokenId?: string: per un account token non fungibile, una stringa vuota. Per un account token fungibile, l'ID token.
Esempio di valore restituito:
[
    {
        "transactionId": "otransaction~3a6b23c3003626f3947e990eddbd7ac23398d2200e2eb3eac745e6ddfae140bc~7c88c736df38d5622512f1e8dcdd50710eb47c953f1ecb24ac44790a9e2f475b",
        "timestamp": "2023-06-06T14:48:08.000Z",
        "tokenId": "FNFT",
        "transactedAmount": 10,
        "triggeredByUserAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
        "transactedAccount": "oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446",
        "transactionType": "DEBIT",
        "balance": 90
    },
    {
        "transactionId": "otransaction~3a6b23c3003626f3947e990eddbd7ac23398d2200e2eb3eac745e6ddfae140bc~178e3730bc5bee50d02f1464a4eebf733a051905f651e5789039adb4a3edc114",
        "timestamp": "2023-06-06T14:48:08.000Z",
        "tokenId": "NFT",
        "triggeredByUserAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
        "transactedAccount": "oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446",
        "transactionType": "DEBIT"
    },
    {
        "transactionId": "otransaction~c369929e28e78de06c72d020f1418c9a154a7dd280b2e22ebb4ea4485e249124~a7cefb22ff39ee7e36967be71de27da6798548c872061a62dabc56d88d50b930",
        "timestamp": "2023-06-06T14:47:08.000Z",
        "tokenId": "NFT",
        "triggeredByUserAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
        "transactedAccount": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371",
        "transactionType": "MINT"
    },
    {
        "transactionId": "otransaction~114a1bc78d04be48ee6dc140c32c042ee9481cb118959626f090eec744522422~e4eb15d9354f694230df8835ade012100d82aa43672896a2c7125a86e3048f9f",
        "timestamp": "2023-06-05T17:17:57.000Z",
        "tokenId": "FNFT",
        "transactedAmount": 100,
        "triggeredByUserAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
        "transactedAccount": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371",
        "transactionType": "MINT",
        "balance": 100
    }
]
getTransactionById
Questo metodo restituisce i dettagli della transazione per un ID transazione specificato. Chiunque può chiamare questo metodo.
@GetMethod()
@Validator(yup.string())
public async getTransactionById(transactionId: string) {
  return await this.Ctx.ERC1155Transaction.getTransactionById(transactionId);
}
Parametri:
  • transactionId: string: l'ID della transazione.
Esempio di valore restituito:
{
  "transactionId": "otransaction~9ea7b05ab099f7ff4db8342b8c3609031f1d54f11205906e7f1fe88661fe3cbe~33b59ce0c89e96c1e16449f24301581e8e71954f38ad977c7eb6f065e87f2a53",
  "history": [
    {
      "trxId": "9ea7b05ab099f7ff4db8342b8c3609031f1d54f11205906e7f1fe88661fe3cbe",
      "timeStamp": "2022-12-08T09:01:28.000Z",
      "value": {
        "assetType": "otransaction",
        "transactionId": "otransaction~9ea7b05ab099f7ff4db8342b8c3609031f1d54f11205906e7f1fe88661fe3cbe~33b59ce0c89e96c1e16449f24301581e8e71954f38ad977c7eb6f065e87f2a53",
        "tokenId": "tokenOne",
        "fromAccountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a",
        "toAccountId": "",
        "transactionType": "BURN",
        "amount": 5,
        "timestamp": "2022-12-08T09:01:28.000Z",
        "triggeredByUserAccountId": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc"
      }
    }
  ]
}
deleteHistoricalTransactions
Questo metodo elimina le transazioni prima di un indicatore orario specificato dal database di stato. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.
@Validator(yup.date())
public async deleteHistoricalTransactions(time_to_expiration: Date) {
  await this.Ctx.ERC1155Auth.checkAuthorization("TRANSACTION.deleteTransactions", "TOKEN");
  return await this.Ctx.ERC1155Transaction.deleteTransactions(time_to_expiration);
}
Parametri:
  • timestamp: string: tutte le transazioni precedenti a questo indicatore orario verranno eliminate.
Esempio di valore restituito:
{
  "msg": "Successfuly deleted transaction older than date: Thu Apr 07 2022 21:18:59 GMT+0000 (Coordinated Universal Time).",
  "transactions": [
    "otransaction~30513757d8b647fffaafac440d743635f5c1b2e41b25ebd6b70b5bbf78a2643f",
    "otransaction~ac0e908c735297941ba58bb208ee61ff4816a1e54c090d68024f82adf743892b"
  ]
}

Metodi per la gestione del comportamento dei token - Funzionamento minimo

mintBatch
Questo metodo crea (mint) più token in un'operazione batch. Questo metodo crea solo token fungibili o token non fungibili frazionari.

Per i token fungibili, se il ruolo minter è definito nel file di specifica, qualsiasi utente con il ruolo minter può chiamare questo metodo. In caso contrario, qualsiasi utente può utilizzare questo metodo per coniare i token. Impossibile coniare più della proprietà max_mint_quantity del token se tale proprietà è stata specificata al momento della creazione o dell'aggiornamento del token.

Per i token non fungibili, se il ruolo minter è definito nel file di specifica, qualsiasi utente con il ruolo minter può chiamare questo metodo. In caso contrario, qualsiasi utente può utilizzare questo metodo per coniare i token. Inoltre, il chiamante deve essere anche il creatore del token. Non esiste un limite massimo per la quantità di token frazionari non fungibili che possono essere coniati.

Impossibile utilizzare questo metodo per coniare un token non fungibile intero.

@Validator(yup.string(), yup.string(), yup.array().of(yup.string()), yup.array().of(yup.number()))
public async mintBatch(orgId: string, userId: string, tokenIds: string[], quantity: number[]) {
  const accountId = this.Ctx.ERC1155Account.generateAccountId(orgId, userId, ACCOUNT_TYPE.USER_ACCOUNT);
  return await this.Ctx.ERC1155Token.mintBatch(accountId, tokenIds, quantity);
}
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
  • tokenIds: string[]: la lista degli ID token per i quali creare i token.
  • quantity: number[]: la lista delle quantità di token da coniare, corrispondente all'array ID token.
Restituisce:
  • In caso di operazione riuscita, un oggetto JSON che include dettagli sui token coniati.
Esempio di valore restituito:
{
    "msg": "Successfully minted batch of tokens for User-Account-Id ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38 (Org-Id: appdev, User-Id: idcqa).",
    "details": [
        {
            "msg": "Successfully minted 100 tokens of fractional tokenId: plot55 to Org-Id: appdev, User-Id: idcqa"
        },
        {
            "msg": "Successfully minted 100 tokens of tokenId: loyalty to Token-Account-Id oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e"
        }
    ]
}

Metodi per la gestione del comportamento dei token - Funzionamento trasferibile

batchTransferFrom
Questo metodo completa un'operazione batch che trasferisce i token specificati in una lista di ID token da un utente a un altro utente.

Per gli NFT, poiché il metodo trasferisce la proprietà dell'NFT, il mittente dell'NFT deve possedere il token.

Per gli NFT frazionari, se un utente (incluso il creatore del token) trasferisce tutte le azioni di cui è proprietario, perde la proprietà del token. Se una qualsiasi parte di un token viene trasferita a un utente, tale utente diventa automaticamente uno dei proprietari dell'NFT frazionario.

Questo metodo non verifica che il chiamante del metodo sia il mittente specificato. Questo metodo può essere chiamato da qualsiasi utente.

@Validator(yup.string(), yup.string(), yup.string(), yup.string(), yup.array().of(yup.string()), yup.array().of(yup.number()))
public async batchTransferFrom(
  fromOrgId: string,
  fromUserId: string,
  toOrgId: string,
  toUserId: string,
  tokenIds: string[],
  quantity: number[]
) {
  const fromAccountId = this.Ctx.ERC1155Account.generateAccountId(fromOrgId, fromUserId, ACCOUNT_TYPE.USER_ACCOUNT);
  const toAccountId = this.Ctx.ERC1155Account.generateAccountId(toOrgId, toUserId, ACCOUNT_TYPE.USER_ACCOUNT);
  return await this.Ctx.ERC1155Token.batchTransferFrom(fromAccountId, toAccountId, tokenIds, quantity);
}
Parametri:
  • fromOrgId: string: l'ID del provider di servizi di appartenenza (MSP) del mittente e del proprietario del token nell'organizzazione corrente.
  • fromUserId: string: il nome utente o l'ID di posta elettronica del mittente e del proprietario del token.
  • toOrgId: string: l'ID del provider di servizi di appartenenza (MSP) del destinatario nell'organizzazione corrente.
  • toUserId: string: il nome utente o l'ID e-mail del destinatario.
  • tokenIds: string[]: lista di ID token per i token da trasferire.
  • quantity: number[]: la lista delle quantità di token da trasferire, corrispondente all'array ID token.
Restituisce:
  • In caso di operazione riuscita, viene visualizzato un messaggio con i dettagli per ogni trasferimento di token.
Esempio di valore restituito:
[
    {
        "msg": "Successfully transferred NFT token: 'FNFT' of '10' quantity from Account-Id: oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371 (Org-Id: appdev, User-Id: idcqa) to Account-Id: oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446 (Org-Id: appdev, User-Id: user1_minter)"
    },
    {
        "msg": "Successfully transferred 10 FT token: 'FT' from Account-Id: oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e (Org-Id: appdev, User-Id: idcqa) to Account-Id: oaccount~1089ee5122f367ee0ca38c6660298f4b81f199627e4f67f3691c0f628237974c (Org-Id: appdev, User-Id: user1_minter)"
    },
    {
        "msg": "Successfully transferred NFT token: 'NFT' from Account-Id: oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371 (Org-Id: appdev, User-Id: idcqa) to Account-Id: oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446 (Org-Id: appdev, User-Id: user1_minter)"
    }
]
safeBatchTransferFrom
Questo metodo completa un'operazione batch che trasferisce i token specificati in una lista di ID token da un utente a un altro utente.

Per gli NFT, poiché il metodo trasferisce la proprietà dell'NFT, il mittente dell'NFT deve possedere il token.

Per gli NFT frazionari, se un utente (incluso il creatore del token) trasferisce tutte le azioni di cui è proprietario, perde la proprietà del token. Se una qualsiasi parte di un token viene trasferita a un utente, tale utente diventa automaticamente uno dei proprietari dell'NFT frazionario.

Il chiamante del metodo deve essere il mittente specificato. Questo metodo può essere chiamato da qualsiasi utente.

@Validator(yup.string(), yup.string(), yup.string(), yup.string(), yup.array().of(yup.string()), yup.array().of(yup.number()))
public async safeBatchTransferFrom(
  fromOrgId: string,
  fromUserId: string,
  toOrgId: string,
  toUserId: string,
  tokenIds: string[],
  quantity: number[]
) {
  const fromAccountId = this.Ctx.ERC1155Account.generateAccountId(fromOrgId, fromUserId, ACCOUNT_TYPE.USER_ACCOUNT);
  const toAccountId = this.Ctx.ERC1155Account.generateAccountId(toOrgId, toUserId, ACCOUNT_TYPE.USER_ACCOUNT);
  return await this.Ctx.ERC1155Token.safeBatchTransferFrom(fromAccountId, toAccountId, tokenIds, quantity);
}
Parametri:
  • fromOrgId: string: l'ID del provider di servizi di appartenenza (MSP) del mittente e del proprietario del token nell'organizzazione corrente.
  • fromUserId: string: il nome utente o l'ID di posta elettronica del mittente e del proprietario del token.
  • toOrgId: string: l'ID del provider di servizi di appartenenza (MSP) del destinatario nell'organizzazione corrente.
  • toUserId: string: il nome utente o l'ID e-mail del destinatario.
  • tokenIds: string[]: lista di ID token per i token da trasferire.
  • quantity: number[]: la lista delle quantità di token da trasferire, corrispondente all'array ID token.
Restituisce:
  • In caso di operazione riuscita, viene visualizzato un messaggio con i dettagli per ogni trasferimento di token.
Esempio di valore restituito:
[
    {
        "msg": "Successfully transferred NFT token: 'FNFT' of '10' quantity from Account-Id: oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371 (Org-Id: appdev, User-Id: idcqa) to Account-Id: oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446 (Org-Id: appdev, User-Id: user1_minter)"
    },
    {
        "msg": "Successfully transferred 10 FT token: 'FT' from Account-Id: oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e (Org-Id: appdev, User-Id: idcqa) to Account-Id: oaccount~1089ee5122f367ee0ca38c6660298f4b81f199627e4f67f3691c0f628237974c (Org-Id: appdev, User-Id: user1_minter)"
    },
    {
        "msg": "Successfully transferred NFT token: 'NFT' from Account-Id: oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371 (Org-Id: appdev, User-Id: idcqa) to Account-Id: oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446 (Org-Id: appdev, User-Id: user1_minter)"
    }
]
balanceOfBatch
Questo metodo completa un'operazione batch che recupera il saldo dei conti token. I dettagli dell'account sono specificati in tre elenchi separati di ID organizzazione, ID utente e ID token. Questo metodo può essere chiamato solo da un Token Admin del codice concatenato o dai proprietari di account. I proprietari dei conti possono visualizzare i dettagli del saldo solo per i conti di loro proprietà.
@GetMethod()
@Validator(yup.array().of(yup.string()), yup.array().of(yup.string()), yup.array().of(yup.string()))
public async balanceOfBatch(orgIds: string[], userIds: string[], tokenIds: string[]) {
  let callerAccountCheck = false;
  try {
    await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ACCOUNT.balanceOfBatch", "TOKEN");
  } catch (err) {
    callerAccountCheck = true;
  }
  const accountIds = await this.Ctx.ERC1155Account.generateAccountIds(orgIds, userIds, callerAccountCheck);
  return await this.Ctx.ERC1155Account.balanceOfBatch(accountIds, tokenIds);
}
Parametri:
  • orgIds: string[]: elenco degli ID del provider di servizi di appartenenza (MSP) nell'organizzazione corrente.
  • userIds: string[]: elenco del nome utente o degli ID di posta elettronica.
  • tokenIds: string[]: lista degli ID token.
Esempio di valore restituito:

Nell'esempio seguente, l'ID token FNFT rappresenta un token non fungibile frazionario e l'ID token FT rappresenta un token fungibile.

[
    {
        "orgId": "appdev",
        "userId": "idcqa",
        "userAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
        "tokenAccountId": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371",
        "tokenId": "FNFT",
        "balance": 100
    },
    {
        "orgId": "appdev",
        "userId": "idcqa",
        "userAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
        "tokenAccountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e",
        "tokenId": "FT",
        "balance": 50
    },
    {
        "orgId": "appdev",
        "userId": "user1_minter",
        "userAccountId": "ouaccount~9501bb774c156eb8354dfe489250ea91f757523d70f08ee494bda98bb352003b",
        "tokenAccountId": "oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446",
        "tokenId": "FNFT",
        "balance": 10
    }
]
exchangeToken
Questo metodo scambia i token tra i conti specificati. Questo metodo supporta solo lo scambio tra un NFT e un token fungibile o un token fungibile e un NFT. Il NFT può essere intero o frazionario. Questo metodo può essere richiamato solo dal proprietario dell'account.
@Validator(yup.string(), yup.string(), yup.string(), yup.number(), yup.string(), yup.string(), yup.string(), yup.number())
  public async exchangeToken(
    fromTokenId: string,
    fromOrgId: string,
    fromUserId: string,
    fromTokenQuantity: number,
    toTokenId: string,
    toOrgId: string,
    toUserId: string,
    toTokenQuantity: number
  ) {
    const fromUserAccountId = this.Ctx.ERC1155Account.generateAccountId(fromOrgId, fromUserId, ACCOUNT_TYPE.USER_ACCOUNT);
    await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ACCOUNT.exchangeToken", "TOKEN", { accountId: fromUserAccountId });
    const toUserAccountId = this.Ctx.ERC1155Account.generateAccountId(toOrgId, toUserId, ACCOUNT_TYPE.USER_ACCOUNT);
    return await this.Ctx.ERC1155Token.exchangeToken(
      fromTokenId,
      fromUserAccountId,
      fromTokenQuantity,
      toTokenId,
      toUserAccountId,
      toTokenQuantity
    );
  }
Parametri:
  • fromTokenId: string: l'ID del token di proprietà del mittente.
  • fromOrgId: string: l'ID del provider di servizi di appartenenza (MSP) del mittente nell'organizzazione corrente.
  • fromUserId: string: il nome utente o l'ID e-mail del mittente.
  • fromTokenQuantity: number - La quantità di token dal mittente da scambiare con il destinatario.
  • toTokenId: string: l'ID del token di proprietà del destinatario.
  • toOrgId: string: l'ID del provider di servizi di appartenenza (MSP) del destinatario nell'organizzazione corrente.
  • toUserId: string: il nome utente o l'ID e-mail del destinatario.
  • toTokenQuantity: number - La quantità di token dal destinatario da scambiare con il mittente.
Restituisce:
  • In caso di operazione riuscita, un messaggio con i dettagli dello scambio di token.
Esempio di valore restituito:
{
    "msg": "Succesfully exchanged 10 tokens of type nonfungible with tokenId: [r1] from Account oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371 (OrgId: appdev, UserId: idcqa) to 10 tokens of type fungible with tokenId: [loy1] from Account oaccount~1089ee5122f367ee0ca38c6660298f4b81f199627e4f67f3691c0f628237974c (OrgId: appdev, UserId: user1_minter)"
}

Metodi per la gestione del comportamento dei token - Funzionamento attivabile

burnBatch
Questo metodo disattiva o brucia i token fungibili e non fungibili specificati. Qualsiasi utente con il ruolo di bruciatore può chiamare questo metodo.
@Validator(yup.string(), yup.string(), yup.array().of(yup.string()), yup.array().of(yup.number()))
public async burnBatch(orgId: string, userId: string, tokenIds: string[], quantity: number[]) {
    const accountId = this.Ctx.ERC1155Account.generateAccountId(orgId, userId, ACCOUNT_TYPE.USER_ACCOUNT);
    return await this.Ctx.ERC1155Token.burn(accountId, tokenIds, quantity);
}
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail.
  • tokenIds: string[]: la lista degli ID token da masterizzare
  • quantity: number[]: la lista delle quantità di token da masterizzare, corrispondente all'array di ID token.
Restituisce:
  • In caso di successo, un messaggio con i dettagli sulle operazioni di masterizzazione.
Esempio di valore restituito:
[
  {
    "msg": "Successfully burned NFT token: 'art' from Account-Id: oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6 (Org-Id: appdev, User-Id: idcqa)"
  },
  {
    "msg": "Successfully burned 5 tokens of tokenId: tokenOne from Account-ID oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a (Org-Id: appdev, User-Id: idcqa)"
  },
  {
    "msg": "Successfully burned 2 token share of tokenId: FNFT from Account-ID oaccount~87bcb699d507368ee3966cd03ee6d7736ffc55dde8c0f0e16b14866334ac504a (Org-Id: AutoF1377358917, User-Id: idcqa)"
  }
]
burnNFT
Questo metodo disattiva o masterizza il token non fungibile specificato e restituisce un oggetto token e una cronologia token. Qualsiasi utente con il ruolo di bruciatore può chiamare questo metodo.
@Validator(yup.string(), yup.string(), yup.string())
public async burnNFT(orgId: string, userId: string, tokenId: string): Promise<any> {
    const userAccountId = this.Ctx.ERC1155Account.generateAccountId(orgId, userId);
    const token = await this.Ctx.ERC1155Token.get(tokenId);
    if (token.tokenType !== TOKEN_TYPE.NON_FUNGIBLE) {
      
      throw new Error(`The Token with id ${tokenId} is not a nonfungible token`);
    }
    if (token.isBurned === true) {
      throw new Error(`token with tokenId ${tokenId} is already burned`);
    }
    let tokenBurnQuantity = 1;
    const tokenUnit = token.tokenUnit;
    if (tokenUnit === TOKEN_UNIT.FRACTIONAL) {
       const owners = await this.Ctx.ERC1155Token.getFractionalNFTOwners(tokenId);
       if (owners.length !== 1) {
         throw new Error(`Token with tokenId ${tokenId} has multiple owners`);
       }
      tokenBurnQuantity = token.quantity;
    }
    const tokenHistory = await this.Ctx.ERC1155Token.getTokenHistory(tokenId);
    await this.Ctx.ERC1155Token.burn(userAccountId, [tokenId], [tokenBurnQuantity]);
    token.tokenId = parseInt(token.tokenId);
    if(Number.isNaN(token.tokenId)) {
      throw new Error(`tokenId is expected to be integer but found ${tokenId}`)
    }
    token.isBurned = true;
    return {...token, tokenHistory: JSON.stringify(tokenHistory)};
}
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail.
  • tokenId: string: l'ID del token non fungibile da masterizzare
Restituisce:
  • In caso di operazione riuscita, un oggetto token in formato JSON che include informazioni sulla cronologia token.
Esempio di valore restituito:
{
    "assetType": "otoken",
    "tokenId": 1,
    "tokenName": "artcollection",
    "tokenStandard": "erc1155+",
    "tokenType": "nonfungible",
    "tokenUnit": "whole",
    "behaviors": [
        "indivisible",
        "singleton",
        "mintable",
        "transferable",
        "burnable",
        "roles"
    ],
    "roles": {
        "minter_role_name": "minter"
    },
    "mintable": {
        "max_mint_quantity": 20000
    },
    "quantity": 1,
    "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
    "creationDate": "2023-08-22T07:32:40.000Z",
    "owner": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
    "isBurned": true,
    "tokenUri": "example.com",
    "price": 120,
    "onSaleFlag": false,
    "tokenHistory": "[{\"trxId\":\"21a932750f2d4ccffd62eda5678a577cadde0513ed7c7a307f24cd7713a1818b\",\"timeStamp\":\"2023-08-22T07:32:40.000Z\",\"value\":{\"assetType\":\"otoken\",\"tokenId\":\"1\",\"tokenName\":\"artcollection\",\"tokenStandard\":\"erc1155+\",\"tokenType\":\"nonfungible\",\"tokenUnit\":\"whole\",\"behaviors\":[\"indivisible\",\"singleton\",\"mintable\",\"transferable\",\"burnable\",\"roles\"],\"roles\":{\"minter_role_name\":\"minter\"},\"mintable\":{\"max_mint_quantity\":20000},\"quantity\":1,\"createdBy\":\"oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d\",\"creationDate\":\"2023-08-22T07:32:40.000Z\",\"owner\":\"oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d\",\"isBurned\":false,\"tokenUri\":\"example.com\",\"price\":120,\"onSaleFlag\":false}}]"
}

Metodi SDK

Metodi per la gestione del controllo dell'accesso

checkAuthorization
Utilizzare questo metodo per aggiungere un controllo dell'accesso a un'operazione. Questa è una funzione asincrona. Alcuni metodi token possono essere eseguiti solo da Token Admin o AccountOwner del token o da MultipleAccountOwner per gli utenti con più account. Il mapping del controllo dell'accesso viene descritto nel file ../lib/constant.ts. È possibile modificare il controllo dell'accesso modificando il file ../lib/constant.ts. Per utilizzare il proprio controllo dell'accesso o per disabilitare il controllo dell'accesso, rimuovere il codice di controllo dell'accesso dai metodi e dai metodi personalizzati generati automaticamente dal controller.
ADMIN: {
   isUserTokenAdmin: ["Admin"],
   addAdmin: ["Admin"],
   removeAdmin: ["Admin"],
   getAllAdmins: ["Admin"],
 },
 TOKEN: {
   save: ["Admin"],
   getAllTokens: ["Admin"],
   get: ["Admin"],
   update: ["Admin"],
   getDecimals: ["Admin"],
   getTokensByName: ["Admin"],
   addRoleMember: ["Admin"],
   removeRoleMember: ["Admin"],
   isInRole: ["Admin", "AccountOwner"],
   getTotalMintedTokens: ["Admin"],
   getNetTokens: ["Admin"],
   getTokenHistory: ["Admin"],
 },
 ROLE: {
   getAccountsByRole: ["Admin"],
   getUsersByRole: ["Admin"],
 },
 TRANSACTION: {
   deleteTransactions: ["Admin"],
 },
 ACCOUNT: {
   createAccount: ["Admin"],
   associateToken: ["Admin"],
   getAllAccounts: ["Admin"],
   getAccountsByUser: ["Admin", "MultipleAccountOwner"],
   getAccount: ["Admin", "AccountOwner"],
   history: ["Admin", "AccountOwner"],
   getAccountTransactionHistory: ["Admin", "AccountOwner"],
   getAccountTransactionHistoryWithFilters: ["Admin", "AccountOwner"],
   getSubTransactionsById: ["Admin", TRANSACTION_INVOKER],
   getSubTransactionsByIdWithFilters: ["Admin", TRANSACTION_INVOKER],
   getAccountBalance: ["Admin", "AccountOwner"],
   getAccountOnHoldBalance: ["Admin", "AccountOwner"],
   getOnHoldIds: ["Admin", "AccountOwner"],
   getConversionHistory: ["Admin", "AccountOwner"],
 },
 ACCOUNT_STATUS: {
   get: ["Admin", "AccountOwner"],
   history: ["Admin", "AccountOwner"],
   activateAccount: ["Admin"],
   suspendAccount: ["Admin"],
   deleteAccount: ["Admin"],
 },
 TOKEN_CONVERSION: {
   initializeExchangePoolUser: ["Admin"],
   addConversionRate: ["Admin"],
   updateConversionRate: ["Admin"],
   getConversionRate: ["Admin", "AnyAccountOwner"],
   getConversionRateHistory: ["Admin", "AnyAccountOwner"],
   tokenConversion: ["Admin", "AnyAccountOwner"],
   getExchangePoolUser: ["Admin"],
 },
 ERC721ADMIN: {
   isUserTokenAdmin: ["Admin"],
   addAdmin: ["Admin"],
   removeAdmin: ["Admin"],
   getAllAdmins: ["Admin"],
 },
 ERC721TOKEN: {
   getAllTokens: ["Admin"],
   getAllTokensByUser: ["Admin", "AccountOwner"],
   get: ["Admin", TOKEN_OWNER],
   getTokensByName: ["Admin"],
   addRoleMember: ["Admin"],
   removeRoleMember: ["Admin"],
   isInRole: ["Admin", "AccountOwner"],
   totalSupply: ["Admin"],
   totalNetSupply: ["Admin"],
   history: ["Admin"],
 },
 ERC721ROLE: {
   getAccountsByRole: ["Admin"],
   getUsersByRole: ["Admin"],
 },
 ERC721TRANSACTION: {
   deleteTransactions: ["Admin"],
 },
 ERC721ACCOUNT: {
   createAccount: ["Admin"],
   getAllAccounts: ["Admin"],
   getAccountByUser: ["Admin", "MultipleAccountOwner"],
   history: ["Admin", "AccountOwner"],
   getAccountTransactionHistory: ["Admin", "AccountOwner"],
   getAccountTransactionHistoryWithFilters: ["Admin", "AccountOwner"],
   balanceOf: ["Admin", "MultipleAccountOwner"],
 },
 ERC1155ADMIN: {
   isUserTokenAdmin: ["Admin"],
   addAdmin: ["Admin"],
   removeAdmin: ["Admin"],
   getAllAdmins: ["Admin"],
 },
 ERC1155TOKEN: {
   getAllTokens: ["Admin"],
   get: ["Admin", TOKEN_OWNER],
   getAllTokensByUser: ["Admin", "AccountOwner"],
   totalSupply: ["Admin"],
   totalNetSupply: ["Admin"],
   getTokensByName: ["Admin"],
   getDecimals: ["Admin"],
   addRoleMember: ["Admin"],
   removeRoleMember: ["Admin"],
   isInRole: ["Admin", "AccountOwner"],
   save: ["Admin"],
   update: ["Admin"],
 },
 ERC1155ACCOUNT: {
   createAccount: ["Admin"],
   createUserAccount: ["Admin"],
   createTokenAccount: ["Admin"],
   associateFungibleTokenToAccount: ["Admin", "AccountOwner"],
   getAccountsByUser: ["Admin", "AccountOwner"],
   getAccount: ["Admin", "AccountOwner"],
   history: ["Admin", "AccountOwner"],
   getAllAccounts: ["Admin"],
   balanceOfBatch: ["Admin"],
   getAccountTransactionHistory: ["Admin", "AccountOwner"],
   getAccountTransactionHistoryWithFilters: ["Admin", "AccountOwner"],
   exchangeToken: ["AccountOwner"],
   getAccountDetailsByUser: ["Admin", "AccountOwner"],
 },
 ERC1155ROLE: {
   getAccountsByRole: ["Admin"],
   getUsersByRole: ["Admin"],
 },
Ctx.ERC1155Auth.checkAuthorization(classFuncName: string, ...args)
Parametri:
  • classFuncName: string: il valore della mappa tra la classe e i metodi, come descritto nel file ../lib/constant.ts.
  • ...args: un argomento di variabile in cui args[0] accetta la costante 'TOKEN' e args[1] utilizza account_id per aggiungere un controllo di accesso per un AccountOwner. Per aggiungere un controllo dell'accesso per un MultipleAccountOwner, args[1] accetta org_id e args[2] accetta il user_id.
Restituisce:
  • In caso di successo, una promessa. In caso di errore, un rifiuto con un messaggio di errore.
isUserTokenAdmin
Questo metodo restituisce il valore booleano true se l'utente specificato è un Token Admin e false in caso contrario. Il metodo può essere chiamato solo da un Token Admin del codice concatenato del token.
Ctx.ERC1155Auth.isUserTokenAdmin(orgId: string, userId: string)
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
Esempio di valore restituito:
{
  "result": true
}
addAdmin
Questo metodo aggiunge un utente come Token Admin del codice concatenato del token. Il metodo può essere chiamato solo da un Token Admin del codice concatenato del token.
Ctx.ERC1155Admin.addAdmin(orgId: string, userId: string)
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
Restituisce:
  • In caso di operazione riuscita, un messaggio che elenca i dettagli per l'utente aggiunto come Token Admin del codice concatenato del token.
Esempio di valore restituito:
{
  "msg": "Successfully added Admin (OrgId: appDev, UserId: user1)"
}
removeAdmin
Questo metodo rimuove un utente come Token Admin del codice concatenato del token. Il metodo può essere chiamato solo da un Token Admin del codice concatenato del token. Impossibile rimuovere se stesso come Token Admin.
Ctx.ERC1155Admin.removeAdmin(orgId: string, userId: string)
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
Restituisce:
  • In caso di operazione riuscita, un messaggio che elenca i dettagli per l'utente rimosso come Token Admin del codice concatenato del token.
Esempio di valore restituito:
{
  "msg": "Successfully removed Admin (OrgId: appDev, UserId: user1)"
}
getAllAdmins
Questo metodo restituisce un elenco di tutti gli utenti Token Admin.
Ctx.ERC1155Admin.getAllAdmins()
Parametri:
  • nessuno
Restituisce:
  • In caso di operazione riuscita, un elenco di tutti gli utenti Token Admin, identificati in base all'ID organizzazione e all'ID utente.
Esempio di valore restituito:
{
  "admins": [
    {
      "orgId": "appdev",
      "userId": "idcqa"
    },
    {
      "orgId": "appdev",
      "userId": "user1"
    }
  ]
}

Metodi per la gestione della configurazione dei token

save
Questo metodo crea i token. Ogni token definito ha il proprio metodo di creazione. Per i token non fungibili, se il ruolo minter è definito nel file di specifica, qualsiasi utente con il ruolo minter può chiamare questo metodo per creare un NFT. In caso contrario, qualsiasi utente può utilizzare questo metodo per creare (mint) NFT. L'utente che chiama questo metodo diventa il proprietario dell'NFT (intero o frazionario).
Ctx.ERC1155Token.save(tokenAsset: <Token Class>, quantity?: number);
Parametri:
  • tokenAsset: <Token Class>: l'asset token. Le proprietà dell'asset sono definite nel file modello.
  • quantity: number: solo per i token non fungibili, il numero di token da coniare. L'unico valore supportato per questo parametro è 1.
Restituisce:
  • In caso di operazione riuscita, l'asset token in formato JSON, che può includere le informazioni riportate di seguito.
  • tokenMetadata: informazioni JSON che descrivono il token.
  • createdBy: l'ID account del chiamante, che è l'utente che convoca il token. Proprietà non modificabile.
  • creationDate: l'indicatore orario della transazione di conio. Proprietà non modificabile.
  • isBurned: questa proprietà indica se il token è stato masterizzato. Proprietà non modificabile.
  • tokenName: il nome del token. Proprietà non modificabile.
  • tokenDesc: la descrizione del token.
  • symbol: il simbolo del token. Proprietà non modificabile.
  • tokenStandard: lo standard del token. Proprietà non modificabile.
  • tokenType: il tipo di token (fungibile o non fungibile). Proprietà non modificabile.
  • tokenUnit: l'unità del token (intero o frazionario). Proprietà non modificabile.
  • behaviors: lista dei comportamenti dei token. Proprietà non modificabile.
  • mintable: le proprietà relative al conio. Il valore max_mint_quantity definisce il numero massimo di token che è possibile creare per la classe di token.
  • owner: l'ID account del proprietario corrente, che è il chiamante del metodo.
  • tokenUri: l'URI del token.
  • quantity: la quantità del token.
Esempio di valore restituito (NFT intera):
{
    "tokenMetadata": {
        "paintingName": "monalisa",
        "description": "monalisa painting",
        "image": "image link",
        "painterName": "Leonardo da Vinci"
    },
    "assetType": "otoken",
    "quantity": 1,
    "tokenId": "artnft",
    "tokenName": "artcollection",
    "tokenDesc": "artcollection nft",
    "tokenStandard": "erc1155+",
    "tokenType": "nonfungible",
    "tokenUnit": "whole",
    "behaviors": [
        "indivisible",
        "singleton",
        "mintable",
        "transferable",
        "burnable",
        "roles"
    ],
    "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
    },
    "mintable": {
        "max_mint_quantity": 500
    },
    "owner": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
    "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
    "creationDate": "2022-12-29T04:08:35.000Z",
    "isBurned": false,
    "tokenUri": "tu",
    "price": 10000,
    "onSaleFlag": false
}
Esempio di valore restituito (token fungibile):
{
    "assetType": "otoken",
    "tokenId": "Loyalty",
    "tokenName": "loyalty",
    "tokenDesc": "Token Description",
    "tokenStandard": "erc1155+",
    "tokenType": "fungible",
    "tokenUnit": "fractional",
    "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "burnable",
        "roles"
    ],
    "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
    },
    "mintable": {
        "max_mint_quantity": 10000
    },
    "divisible": {
        "decimal": 2
    },
    "currency_name": "Dollar"
}
Esempio di valore restituito (NFT frazionale):
{
    "tokenMetadata": {
        "painting_name": "paint",
        "description": "Painting Description"
    },
    "assetType": "otoken",
    "tokenId": "realEstate",
    "tokenName": "realestate",
    "tokenDesc": "Token Description",
    "tokenStandard": "erc1155+",
    "tokenType": "nonfungible",
    "tokenUnit": "fractional",
    "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "burnable",
        "roles"
    ],
    "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
    },
    "mintable": {
        "max_mint_quantity": 20000
    },
    "quantity": 100,
    "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
    "creationDate": "2023-06-14T04:20:14.000Z",
    "divisible": {
        "decimal": 2
    },
    "isBurned": false,
    "tokenUri": "www.realestate.example.com",
    "price": 1000,
    "on_sale_flag": true
}
update
Questo metodo aggiorna i token. Impossibile aggiornare i metadati del token o l'URI del token dei token non fungibili.
Ctx.ERC1155Token.update(tokenAsset: any);
Parametri:
  • tokenAsset: <Token Class>: l'asset token. Le proprietà dell'asset sono definite nel file modello.
Restituisce:
  • In caso di operazione riuscita, l'asset token aggiornato in formato JSON.
Esempio di valore restituito (NFT intera):
{
    "tokenMetadata": {
        "paintingName": "monalisa",
        "description": "monalisa painting",
        "image": "image link",
        "painterName": "Leonardo da Vinci"
    },
    "assetType": "otoken",
    "quantity": 1,
    "tokenId": "artnft",
    "tokenName": "artcollection",
    "tokenDesc": "artcollection nft",
    "tokenStandard": "erc1155+",
    "tokenType": "nonfungible",
    "tokenUnit": "whole",
    "behaviors": [
        "indivisible",
        "singleton",
        "mintable",
        "transferable",
        "burnable",
        "roles"
    ],
    "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
    },
    "mintable": {
        "max_mint_quantity": 500
    },
    "owner": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
    "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
    "creationDate": "2022-12-29T04:08:35.000Z",
    "isBurned": false,
    "tokenUri": "tu",
    "price": 10000,
    "onSaleFlag": false
}
history (Token)
Questo metodo restituisce la cronologia per un ID token specificato.
Ctx.ERC1155Token.history(tokenId: string)
Parametri:
  • tokenId: string: l'ID del token.
Restituisce:
  • In caso di operazione riuscita, un array JSON contenente la cronologia dei token.
Esempio di valore restituito (token fungibile):
[
    {
        "trxId": "ef4af760c3d7ee5e273196231d59fb91cafe6ca0f78c64747e87bc9bcbb3334b",
        "timeStamp": "2023-09-04T02:36:20.000Z",
        "value": {
            "assetType": "otoken",
            "tokenId": "LoyaltyToken",
            "tokenName": "loyalty",
            "tokenDesc": "Updated Fungible Whole",
            "tokenStandard": "erc1155+",
            "tokenType": "fungible",
            "tokenUnit": "fractional",
            "behaviors": [
                "divisible",
                "mintable",
                "transferable",
                "burnable",
                "roles"
            ],
            "roles": {
                "minter_role_name": "minter",
                "burner_role_name": "burner"
            },
            "mintable": {
                "max_mint_quantity": 10000
            },
            "divisible": {
                "decimal": 2
            },
            "currency_name": "Rupees"
        }
    },
    {
        "trxId": "4fb391a8903633a12a545cd2ecfb57f5575241325abf59995e2a4ed96572bb09",
        "timeStamp": "2023-09-04T02:35:07.000Z",
        "value": {
            "assetType": "otoken",
            "tokenId": "LoyaltyToken",
            "tokenName": "loyalty",
            "tokenDesc": "Fungible Whole",
            "tokenStandard": "erc1155+",
            "tokenType": "fungible",
            "tokenUnit": "fractional",
            "behaviors": [
                "divisible",
                "mintable",
                "transferable",
                "burnable",
                "roles"
            ],
            "roles": {
                "minter_role_name": "minter",
                "burner_role_name": "burner"
            },
            "mintable": {
                "max_mint_quantity": 10000
            },
            "divisible": {
                "decimal": 2
            },
            "currency_name": "Dollar"
        }
    }
]
Esempio di valore restituito (NFT frazionale):
[
    {
        "txId": "99bca74f401465206da7499cbf704dd443b3c3d94e348b1d6682ab5ee1864a08",
        "timestamp": "2023-06-20T01:09:18.000Z",
        "value": {
            "assetType": "otoken",
            "tokenId": "FNFT",
            "tokenName": "realestate",
            "tokenStandard": "erc1155+",
            "tokenType": "nonfungible",
            "tokenUnit": "fractional",
            "behaviors": [
                "divisible",
                "mintable",
                "transferable",
                "burnable",
                "roles"
            ],
            "roles": {
                "minter_role_name": "minter",
                "burner_role_name": "burner"
            },
            "mintable": {
                "max_mint_quantity": 20000
            },
            "quantity": 100,
            "createdBy": "oaccount~87bcb699d507368ee3966cd03ee6d7736ffc55dde8c0f0e16b14866334ac504a",
            "creationDate": "2023-06-20T00:53:13.000Z",
            "divisible": {
                "decimal": 2
            },
            "isBurned": false,
            "tokenUri": "www.FNFT.example.com",
            "price": 2000,
            "on_sale_flag": true,
            "owners": [
                {
                    "accountId": "oaccount~87bcb699d507368ee3966cd03ee6d7736ffc55dde8c0f0e16b14866334ac504a",
                    "tokenShare": 90
                },
                {
                    "accountId": "oaccount~3cddfdaa855900579d963aa6f755a4aed1f3a474a2462c1b45bd7f36df673224",
                    "tokenShare": 10
                }
            ]
        }
    },
    {
        "txId": "d517c61f40e7d6af2f04fe6d337b3e5108eb57030c9dc823793498fd4fed671b",
        "timestamp": "2023-06-20T00:53:13.000Z",
        "value": {
            "assetType": "otoken",
            "tokenId": "FNFT",
            "tokenName": "realestate",
            "tokenStandard": "erc1155+",
            "tokenType": "nonfungible",
            "tokenUnit": "fractional",
            "behaviors": [
                "divisible",
                "mintable",
                "transferable",
                "burnable",
                "roles"
            ],
            "roles": {
                "minter_role_name": "minter",
                "burner_role_name": "burner"
            },
            "mintable": {
                "max_mint_quantity": 20000
            },
            "quantity": 100,
            "createdBy": "oaccount~87bcb699d507368ee3966cd03ee6d7736ffc55dde8c0f0e16b14866334ac504a",
            "creationDate": "2023-06-20T00:53:13.000Z",
            "divisible": {
                "decimal": 2
            },
            "isBurned": false,
            "tokenUri": "www.FNFT.example.com",
            "price": 2000,
            "on_sale_flag": true,
            "owners": [
                {
                    "accountId": "oaccount~87bcb699d507368ee3966cd03ee6d7736ffc55dde8c0f0e16b14866334ac504a",
                    "tokenShare": 100
                }
            ]
        }
    }
]
Esempio di valore restituito (NFT intera):
[
    {
        "trxId": "92ac6b56112acdba724dd49924d2420a7899c013c61aa40d272e8ab391a65e0f",
        "timeStamp": "2023-09-04T02:28:48.000Z",
        "value": {
            "tokenMetadata": {
                "painting_name": "monalisa",
                "description": "monalisa painting",
                "image": "image link",
                "painter_name": "Leonardo da Vinci"
            },
            "assetType": "otoken",
            "tokenId": "artnft",
            "tokenName": "artcollection",
            "tokenDesc": "Updated Token Description",
            "tokenStandard": "erc1155+",
            "tokenType": "nonfungible",
            "tokenUnit": "whole",
            "behaviors": [
                "indivisible",
                "mintable",
                "transferable",
                "burnable",
                "roles"
            ],
            "roles": {
                "minter_role_name": "minter",
                "burner_role_name": "burner"
            },
            "mintable": {
                "max_mint_quantity": 20000
            },
            "quantity": 1,
            "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
            "creationDate": "2023-09-04T02:27:19.000Z",
            "owner": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
            "isBurned": false,
            "tokenUri": "www.FNFT.example.com",
            "price": 10000,
            "on_sale_flag": true
        }
    },
    {
        "trxId": "27697dd4a8dba53bad073aa95587cd1ef173b02fd95d771a60273d301fd3bcbe",
        "timeStamp": "2023-09-04T02:27:19.000Z",
        "value": {
            "tokenMetadata": {
                "painting_name": "monalisa",
                "description": "monalisa painting",
                "image": "image link",
                "painter_name": "Leonardo da Vinci"
            },
            "assetType": "otoken",
            "tokenId": "artnft",
            "tokenName": "artcollection",
            "tokenDesc": "artcollection nft",
            "tokenStandard": "erc1155+",
            "tokenType": "nonfungible",
            "tokenUnit": "whole",
            "behaviors": [
                "indivisible",
                "mintable",
                "transferable",
                "burnable",
                "roles"
            ],
            "roles": {
                "minter_role_name": "minter",
                "burner_role_name": "burner"
            },
            "mintable": {
                "max_mint_quantity": 20000
            },
            "quantity": 1,
            "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
            "creationDate": "2023-09-04T02:27:19.000Z",
            "owner": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
            "isBurned": false,
            "tokenUri": "www.FNFT.example.com",
            "price": 10000,
            "on_sale_flag": true
        }
    }
]
getAllTokens
Questo metodo restituisce tutti gli asset token salvati nel database di stato. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato. Questo metodo utilizza query rich SQL di Berkeley DB e può essere richiamato solo quando si è connessi alla rete remota di Oracle Blockchain Platform.
Ctx.ERC1155Token.getAllTokens()
Parametri:
  • nessuno
Esempio di valore restituito:
[
  {
    "key": "tokenOne",
    "valueJson": {
      "assetType": "otoken",
      "tokenId": "tokenOne",
      "tokenName": "moneytok",
      "tokenStandard": "erc1155+",
      "tokenType": "fungible",
      "tokenUnit": "fractional",
      "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "roles"
      ],
      "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
      },
      "mintable": {
        "max_mint_quantity": 1000
      },
      "divisible": {
        "decimal": 2
      }
    }
  },
  {
    "key": "tokenTwo",
    "valueJson": {
      "assetType": "otoken",
      "tokenId": "tokenTwo",
      "tokenName": "moneytok",
      "tokenStandard": "erc1155+",
      "tokenType": "fungible",
      "tokenUnit": "fractional",
      "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "roles"
      ],
      "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
      },
      "mintable": {
        "max_mint_quantity": 1000
      },
      "divisible": {
        "decimal": 2
      }
    }
  },
  {
    "key": "art",
    "valueJson": {
      "assetType": "otoken",
      "quantity": 1,
      "tokenId": "art",
      "tokenName": "artcollection",
      "tokenStandard": "erc1155+",
      "tokenType": "nonfungible",
      "tokenUnit": "whole",
      "behaviors": [
        "indivisible",
        "singleton",
        "mintable",
        "transferable",
        "burnable",
        "roles"
      ],
      "roles": {
        "minter_role_name": "minter"
      },
      "mintable": {
        "max_mint_quantity": 20000
      },
      "owner": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
      "createdBy": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
      "creationDate": "2022-12-08T08:52:57.000Z",
      "isBurned": true,
      "tokenUri": "art.example.com",
      "transferredBy": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc",
      "transferredDate": "2022-12-08T08:59:17.000Z",
      "burnedBy": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
      "burnedDate": "2022-12-08T09:01:28.000Z"
    }
  },
  {
    "key": "FNFT",
    "valueJson": {
        "assetType": "otoken",
        "tokenId": "FNFT",
        "tokenName": "realestate",
        "tokenStandard": "erc1155+",
        "tokenType": "nonfungible",
        "tokenUnit": "fractional",
        "behaviors": [
            "divisible",
            "mintable",
            "transferable",
            "burnable",
            "roles"
        ],
        "roles": {
            "minter_role_name": "minter",
            "burner_role_name": "burner"
        },
        "mintable": {
            "max_mint_quantity": 20000
        },
        "quantity": 100,
        "createdBy": "oaccount~87bcb699d507368ee3966cd03ee6d7736ffc55dde8c0f0e16b14866334ac504a",
        "creationDate": "2023-06-20T00:53:13.000Z",
        "divisible": {
            "decimal": 2
        },
        "isBurned": false,
        "tokenUri": "www.FNFT.example.com",
        "price": 2000,
        "on_sale_flag": true
    }
  },
]
get (Token)
Questo metodo restituisce un oggetto token se il token è presente nel database di stato. Questo metodo può essere chiamato solo da un Token Admin del codice concatenato o dal proprietario del token.
this.Ctx.ERC1155Token.get(tokenId: string)
Parametri:
  • tokenId: string: l'ID del token da ottenere.
Esempio di valore restituito (NFT intera):
{
  "assetType": "otoken",
  "quantity": 1,
  "tokenId": "art",
  "tokenName": "artcollection",
  "tokenStandard": "erc1155+",
  "tokenType": "nonfungible",
  "tokenUnit": "whole",
  "behaviors": [
    "indivisible",
    "singleton",
    "mintable",
    "transferable",
    "burnable",
    "roles"
  ],
  "roles": {
    "minter_role_name": "minter"
  },
  "mintable": {
    "max_mint_quantity": 20000
  },
  "owner": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
  "createdBy": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
  "creationDate": "2022-12-08T08:52:57.000Z",
  "isBurned": true,
  "tokenUri": "example.com",
  "transferredBy": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc",
  "transferredDate": "2022-12-08T08:59:17.000Z",
  "burnedBy": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
  "burnedDate": "2022-12-08T09:01:28.000Z"
}
Esempio di valore restituito (token fungibile):
{
    "assetType": "otoken",
    "tokenId": "Loyalty",
    "tokenName": "loyalty",
    "tokenDesc": "Token Description",
    "tokenStandard": "erc1155+",
    "tokenType": "fungible",
    "tokenUnit": "fractional",
    "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "burnable",
        "roles"
    ],
    "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
    },
    "mintable": {
        "max_mint_quantity": 10000
    },
    "divisible": {
        "decimal": 2
    },
    "currency_name": "Dollar"
}
Esempio di valore restituito (NFT frazionale):
{
    "tokenMetadata": {
        "painting_name": "paint",
        "description": "Painting Description"
    },
    "assetType": "otoken",
    "tokenId": "realEstate",
    "tokenName": "realestate",
    "tokenDesc": "Token Description",
    "tokenStandard": "erc1155+",
    "tokenType": "nonfungible",
    "tokenUnit": "fractional",
    "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "burnable",
        "roles"
    ],
    "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
    },
    "mintable": {
        "max_mint_quantity": 20000
    },
    "quantity": 100,
    "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
    "creationDate": "2023-06-14T04:20:14.000Z",
    "divisible": {
        "decimal": 2
    },
    "isBurned": false,
    "tokenUri": "www.realestate.example.com",
    "price": 1000,
    "on_sale_flag": true,
    "owners": [
        {
            "accountId": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
            "tokenShare": 100
        }
    ]
}
getAllTokensByUser
Questo metodo restituisce tutti gli asset token di proprietà di un utente specificato. Questo metodo utilizza query rich SQL di Berkeley DB e può essere richiamato solo quando si è connessi alla rete remota di Oracle Blockchain Platform.
Ctx.ERC1155Token.getAllTokensByUser(accountId: string)
Parametri:
  • accountId: string: l'ID account dell'utente.
Esempio di valore restituito:
[
  {
    "key": "tokenOne",
    "valueJson": {
      "assetType": "otoken",
      "tokenId": "tokenOne",
      "tokenName": "moneytok",
      "tokenStandard": "erc1155+",
      "tokenType": "fungible",
      "tokenUnit": "fractional",
      "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "roles"
      ],
      "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
      },
      "mintable": {
        "max_mint_quantity": 1000
      },
      "divisible": {
        "decimal": 2
      }
    }
  },
  {
    "key": "nftToken",
    "valueJson": {
      "assetType": "otoken",
      "quantity": 1,
      "tokenId": "nftToken",
      "tokenName": "artcollection",
      "tokenStandard": "erc1155+",
      "tokenType": "nonfungible",
      "tokenUnit": "whole",
      "behaviors": [
        "indivisible",
        "singleton",
        "mintable",
        "transferable",
        "burnable",
        "roles"
      ],
      "roles": {
        "minter_role_name": "minter"
      },
      "mintable": {
        "max_mint_quantity": 20000
      },
      "owner": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
      "createdBy": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
      "creationDate": "2022-12-08T09:10:21.000Z",
      "isBurned": false,
      "tokenUri": "example.com"
    }
  }
]
ownerOf
Questo metodo restituisce l'ID account, l'ID organizzazione e l'ID utente del proprietario dell'ID token specificato.
Ctx.ERC1155Token.ownerOf(tokenId: string)
Parametri:
  • tokenId: string: l'ID del token.
Esempio di valore restituito:
{
    "accountId": "oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6",
    "orgId": "appdev",
    "userId": "idcqa"
}
tokenURI
Questo metodo restituisce l'URI di un token specificato. Chiunque può chiamare questo metodo.
Ctx.ERC1155Token.tokenURI(tokenId: string)
Parametri:
  • tokenId: string: l'ID del token.
Esempio di valore restituito:
{
    "tokenUri": "example.com"
}
name
Questo metodo restituisce il nome della classe di token. Chiunque può chiamare questo metodo.
Ctx.ERC1155Token.name(tokenId: string)
Parametri:
  • tokenId: string: l'ID del token.
Esempio di valore restituito:
{"tokenName": "artcollection"}
totalSupply
Questo metodo restituisce il numero totale di token coniati. I token fungibili sono specificati dall'ID token. I token non fungibili sono specificati dal nome del token.
Ctx.ERC1155Token.totalSupply(token: any)
Parametri:
  • token: any: l'asset token.
Esempio di valore restituito:
{"totalSupply": 110}
totalNetSupply
Questo metodo restituisce il numero totale di token coniati meno il numero di token bruciati. I token fungibili sono specificati dall'ID token. I token non fungibili sono specificati dal nome del token.
Ctx.ERC1155Token.totalNetSupply(token: any)
Parametri:
  • token: any: l'asset token.
Esempio di valore restituito:
{"totalNetSupply": 105}
getTokensByName
Questo metodo restituisce tutti gli asset token per un nome token specificato. Questo metodo utilizza query rich SQL di Berkeley DB e può essere richiamato solo quando si è connessi alla rete remota di Oracle Blockchain Platform.
Ctx.ERC1155Token.getTokensByName(tokenName: string)
Parametri:
  • tokenName: string: il nome del token.
Esempio di valore restituito:
[
  {
    "key": "tokenOne",
    "valueJson": {
      "assetType": "otoken",
      "tokenId": "tokenOne",
      "tokenName": "moneytok",
      "tokenStandard": "erc1155+",
      "tokenType": "fungible",
      "tokenUnit": "fractional",
      "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "roles"
      ],
      "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
      },
      "mintable": {
        "max_mint_quantity": 1000
      },
      "divisible": {
        "decimal": 2
      }
    }
  },
  {
    "key": "tokenTwo",
    "valueJson": {
      "assetType": "otoken",
      "tokenId": "tokenTwo",
      "tokenName": "moneytok",
      "tokenStandard": "erc1155+",
      "tokenType": "fungible",
      "tokenUnit": "fractional",
      "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "roles"
      ],
      "roles": {
        "minter_role_name": "minter",
        "burner_role_name": "burner"
      },
      "mintable": {
        "max_mint_quantity": 1000
      },
      "divisible": {
        "decimal": 2
      }
    }
  }
]
getDecimals
Questo metodo restituisce il numero di posizioni decimali per un token specificato. Se il comportamento divisibile non viene specificato per il token, viene restituito il valore predefinito di zero posizioni decimali.
Ctx.ERC1155Token.getDecimals(token)
Parametri:
  • token: any: l'asset token.
Esempio di valore restituito:
2

Metodi per la gestione degli account

createAccount
Questo metodo crea un account per un utente specificato e gli account token associati per token fungibili o non fungibili. È necessario creare un account per qualsiasi utente che avrà token in qualsiasi momento. L'account utente tiene traccia dell'account NFT e degli account token fungibili di cui dispone un utente. Per completare le operazioni relative ai token, gli utenti devono disporre di account nella rete. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.

Un account utente dispone di un ID univoco, formato da un hash SHA-256 del parametro orgId e del parametro userId.

Un utente può avere più account token fungibili con ID account univoci. Gli ID account token fungibili sono formati da un hash SHA-256 del parametro orgId, dal parametro userId, dalla stringa costante ft separata dal simbolo tilde (~) e da un numero di contatore che indica l'indice del conto fungibile creato separato dal simbolo tilde (~).

Un utente può avere un solo account token non fungibile. Gli ID account token non fungibili sono univoci e sono formati da un hash SHA-256 del parametro orgId, del parametro userId e della stringa costante nft separati dal simbolo tilde (~). Tutti i token non fungibili di proprietà di un utente, sia interi che frazionari, sono collegati a questo singolo account token non fungibile.

Ctx.ERC1155Account.createAccount(orgId: string, userId: string, ftAccount: boolean, nftAccount: boolean)
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
  • ftAccount: boolean: se true, viene creato un account token fungibile associato all'account utente.
  • nftAccount: boolean: se true, viene creato un account token non fungibile associato all'account utente.
Restituisce:
  • In caso di operazione riuscita, un oggetto JSON dell'account creato.
Esempio di valore restituito:
{
  "assetType": "ouaccount",
  "accountId": "ouaccount~cf20877546f52687f387e7c91d88b9722c97e1a456cc0484f40c747f7804feae",
  "userId": "user1",
  "orgId": "appdev",
  "totalAccounts": 2,
  "totalFtAccounts": 1,
  "associatedFtAccounts": [
    {
      "accountId": "oaccount~60bb20c14a83f6e426e1437c479c5891e1c6477dfd7ad18b73acac5d80bc504b",
      "tokenId": ""
    }
  ],
  "associatedNftAccount": "oaccount~73c3e835dac6d0a56ca9d8def08269f83cefd59b9d297fe2cdc5a9083828fa58"
}
createUserAccount
Questo metodo crea un account per un utente specificato. È necessario creare un account per qualsiasi utente che avrà token in qualsiasi momento. L'account utente tiene traccia dell'account NFT e degli account token fungibili di cui dispone un utente. Per completare le operazioni relative ai token, gli utenti devono disporre di account nella rete.

Un ID account è un hash SHA-256 del parametro orgId e del parametro userId. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.

Ctx.ERC1155Account.createUserAccount(orgId: string, userId: string)
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
Restituisce:
  • In caso di operazione riuscita, un oggetto JSON dell'account utente creato.
Esempio di valore restituito:
{
  "assetType": "ouaccount",
  "accountId": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc",
  "userId": "idcqa",
  "orgId": "appdev",
  "totalAccounts": 0,
  "totalFtAccounts": 0,
  "associatedFtAccounts": [],
  "associatedNftAccount": ""
}
createTokenAccount
Questo metodo crea un account token fungibile o non fungibile da associare a un account utente.

Un utente può avere più account token fungibili con ID account univoci. Gli ID account token fungibili sono formati da un hash SHA-256 del parametro orgId, dal parametro userId, dalla stringa costante ft separata dal simbolo tilde (~) e da un numero di contatore che indica l'indice del conto fungibile creato separato dal simbolo tilde (~).

Un utente può avere un solo account token non fungibile. Gli ID account token non fungibili sono univoci e sono formati da un hash SHA-256 del parametro orgId, del parametro userId e della stringa costante nft separati dal simbolo tilde (~). Tutti i token non fungibili di proprietà di un utente, sia interi che frazionari, sono collegati a questo singolo account token non fungibile.

Questo metodo può essere richiamato solo da un Token Admin del codice concatenato.

Ctx.ERC1155Account.createTokenAccount(orgId: string, userId: string, tokenType: string)
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
  • tokenType: TokenType: il tipo di account token da creare. Gli unici tipi di token supportati sono nonfungible e fungible.
Restituisce:
  • In caso di operazione riuscita, un oggetto JSON dell'account token creato.
Esempio di valore restituito:
{
  "assetType": "ouaccount",
  "accountId": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc",
  "userId": "idcqa",
  "orgId": "appdev",
  "totalAccounts": 1,
  "totalFtAccounts": 1,
  "associatedFtAccounts": [
    {
      "accountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a",
      "tokenId": ""
    }
  ],
  "associatedNftAccount": ""
}
associateTokenToToken
Questo metodo associa l'account token fungibile di un utente a un token fungibile particolare.
Ctx.ERC1155Account.associateTokenToToken(accountId: string, tokenId: string)
Parametri:
  • accountId: string: l'ID dell'account utente.
  • tokenId: string: l'ID del token.
Restituisce:
  • In caso di operazione riuscita, un oggetto JSON dell'account utente, che mostra che il token fungibile è stato associato all'account token. Nell'esempio seguente, ad esempio, il primo oggetto dell'array associatedFtAccounts mostra che sono associati l'ID account token fungibile e l'ID token.
Esempio di valore restituito:
{
  "assetType": "ouaccount",
  "accountId": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc",
  "userId": "idcqa",
  "orgId": "appdev",
  "totalAccounts": 1,
  "totalFtAccounts": 1,
  "associatedFtAccounts": [
    {
      "accountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a",
      "tokenId": "tokenOne"
    }
  ],
  "associatedNftAccount": ""
}
getAccountHistory
Questo metodo restituisce la cronologia per un account token specificato.
Ctx.ERC1155Account.getAccountHistory(accountId: string)
Parametri:
  • accountId: string: l'ID dell'account utente.
Restituisce:
  • In caso di operazione riuscita, un array di oggetti JSON che descrive la cronologia dell'account.
Esempio di valore restituito:
[
    {
        "trxId": "a2cfc6fc064334d6b9931cdf67193711ec2ff5c50a4714f11855fe7384f00e35",
        "timeStamp": "2023-06-06T14:44:31.000Z",
        "value": {
            "accountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e",
            "assetType": "oaccount",
            "bapAccountVersion": 1,
            "balance": 100,
            "orgId": "appdev",
            "tokenId": "loy1",
            "tokenName": "loyalty",
            "tokenType": "fungible",
            "userId": "idcqa"
        }
    },
    {
        "trxId": "de483cf7505ae4e7018c4b604c3ab9327c2fb1f802d9408e22735667c1d6997f",
        "timeStamp": "2023-06-06T14:43:23.000Z",
        "value": {
            "assetType": "oaccount",
            "bapAccountVersion": 0,
            "accountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e",
            "userId": "idcqa",
            "orgId": "appdev",
            "tokenType": "fungible",
            "tokenId": "loy1",
            "tokenName": "loyalty",
            "balance": 0
        }
    },
    {
        "trxId": "db053e653d3ad9aa5b7b6e04b7cd51aacfbb413272d857a155b60d2a6a12bf4d",
        "timeStamp": "2023-06-05T16:59:08.000Z",
        "value": {
            "assetType": "oaccount",
            "bapAccountVersion": 0,
            "accountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e",
            "userId": "idcqa",
            "orgId": "appdev",
            "tokenType": "fungible",
            "tokenId": "",
            "balance": 0
        }
    }
]
getAccountWithStatus
Questo metodo restituisce i dettagli dell'account token, incluso lo stato dell'account, per un utente specificato. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato o dall'Account Owner dell'account.
Ctx.ERC1155Account.GetAccountWithStatus(accountId, tokenId...)
Parametri:
  • userAccountId: string: l'ID account dell'utente.
  • tokenId?: string: per un account token non fungibile, una stringa vuota. Per un account token fungibile, l'ID token.
Restituisce:
  • In caso di operazione riuscita, un oggetto JSON che include i dettagli dell'account token, incluso lo stato dell'account.
Esempio di valore restituito (account token non fungibile):
{
    "assetType": "oaccount",
    "bapAccountVersion": 1,
    "status": "active",
    "accountId": "oaccount~cc301bee057f14236a97d434909ec1084970921b008f6baab09c2a0f5f419a9a",
    "userId": "idcqa",
    "orgId": "appdev",
    "tokenType": "nonfungible",
    "noOfNfts": 1
  }
Esempio di valore restituito (account token fungibile):
{
  "bapAccountVersion": 0,
  "assetType": "oaccount",
  "status": "active",
  "accountId": "oaccount~2de8db6b91964f8c9009136831126d3cfa94e1d00c4285c1ea3e6d1f36479ed4",
  "userId": "idcqa",
  "orgId": "appdev",
  "tokenType": "fungible",
  "tokenId": "t1",
  "tokenName": "loyalty",
  "balance": 0
}
getAccount
Questo metodo restituisce i dettagli dell'account token per un utente specificato. Questo metodo può essere richiamato solo da un Token Admin del codice concatenato o dall'Account Owner dell'account.
Ctx.ERC1155Account.getAccount(userAccountId: string, tokenId: string)
Parametri:
  • userAccountId: string: l'ID account dell'utente.
  • tokenId?: string: per un account token non fungibile, una stringa vuota. Per un account token fungibile, l'ID token.
Restituisce:
  • In caso di operazione riuscita, un oggetto JSON che include i dettagli dell'account token. Il parametro bapAccountVersion viene definito nell'oggetto conto per uso interno.
Esempio di valore restituito (account token non fungibile):
{
    "assetType": "oaccount",
    "bapAccountVersion": 0,
    "accountId": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371",
    "userId": "idcqa",
    "orgId": "appdev",
    "tokenType": "nonfungible",
    "noOfNfts": 3
}
Esempio di valore restituito (account token fungibile):
{
    "assetType": "oaccount",
    "bapAccountVersion": 0,
    "accountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e",
    "userId": "idcqa",
    "orgId": "appdev",
    "tokenType": "fungible",
    "tokenId": "loy1",
    "tokenName": "loyalty",
    "balance": 50
}
getAllAccounts
Questo metodo restituisce i dettagli di tutti gli account utente.
Ctx.ERC1155Account.getAllAccounts()
Parametri:
  • nessuno
Esempio di valore restituito:
[
        {
            "assetType": "ouaccount",
            "accountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
            "userId": "idcqa",
            "orgId": "appdev",
            "totalAccounts": 2,
            "totalFtAccounts": 1,
            "associatedFtAccounts": [
                {
                    "accountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e",
                    "tokenId": "loy1"
                }
            ],
            "associatedNftAccount": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371"
        },
        {
            "assetType": "ouaccount",
            "accountId": "ouaccount~9501bb774c156eb8354dfe489250ea91f757523d70f08ee494bda98bb352003b",
            "userId": "user1_minter",
            "orgId": "appdev",
            "totalAccounts": 2,
            "totalFtAccounts": 1,
            "associatedFtAccounts": [
                {
                    "accountId": "oaccount~1089ee5122f367ee0ca38c6660298f4b81f199627e4f67f3691c0f628237974c",
                    "tokenId": "loy1"
                }
            ],
            "associatedNftAccount": "oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446"
        },
    ]
getAccountDetailsByUser
Questo metodo restituisce un riepilogo dell'account per un utente specificato e i dettagli dei token fungibili e non fungibili associati all'utente.
Ctx.ERC1155Account.getAccountDetailsByUser(orgId: string, userId: string)
Parametri:
  • orgId: string: l'ID del provider di servizi di appartenenza (MSP) dell'utente nell'organizzazione corrente.
  • userId: string: il nome utente o l'ID e-mail dell'utente.
Restituisce:
  • In caso di operazione riuscita, un oggetto account JSON che include e riepiloga l'account per l'utente specificato e i dettagli dei token fungibili e non fungibili associati all'utente. Per i token non fungibili frazionari, la proprietà tokenShare nella sezione associatedNFTs mostra la condivisione di proprietà dell'utente
Esempio di valore restituito:
{
    "userAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
    "associatedFTAccounts": [
        {
            "accountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e",
            "tokenId": "FT",
            "balance": 50
        }
    ],
    "associatedNFTAccount": {
        "accountId": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371",
        "associatedNFTs": [
            {
                "nftTokenId": "FNFT",
                "tokenShare": 100
            },
            {
                "nftTokenId": "FNFT2",
                "tokenShare": 110
            },
            {
                "nftTokenId": "NFT"
            }
        ]
    }
}
getUserByAccountId
Questo metodo restituisce i dettagli utente di un ID account specificato.
Ctx.ERC1155Account.getUserByAccountId(accountId: string)
Parametri:
  • accountId: string: l'ID dell'account.
Restituisce:
  • In caso di operazione riuscita, un oggetto JSON dei dettagli utente (orgId e userId).
Esempio di valore restituito:
{
    "orgId": "appdev",
    "userId": "idcqa"
}

Metodi per la gestione dei ruoli

AddRoleMember
Questo metodo aggiunge un ruolo a un utente e a un token specificati. I token fungibili sono specificati dall'ID token. I token non fungibili sono specificati dal nome del token.
Ctx.ERC1155Token.addRoleMember(role: string, userAccountId: string, token: any)
Parametri:
  • userAccountId: string: l'ID account dell'utente.
  • role: string: il nome del ruolo da aggiungere all'utente specificato.
  • token: any: l'asset token.
Restituisce:
  • In caso di operazione riuscita, un messaggio con i dettagli dell'account.
Esempio di valore restituito:
{
  "msg": "Successfully added role 'minter' to Account Id: oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a (Org-Id: appdev, User-Id: idcqa)"
}
isInRole
Questo metodo restituisce un valore booleano per indicare se un utente dispone di un ruolo specificato. I token fungibili sono specificati dall'ID token. I token non fungibili sono specificati dal nome del token.
Ctx.ERC1155Token.isInRole(role: string, userAccountId: string, token: any)
Parametri:
  • userAccountId: string: l'ID account dell'utente.
  • role: string: il nome del ruolo da cercare.
  • token: any: l'asset token.
Esempio di valore restituito:
{
    "result": true,
    "msg": "Account Id oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a (Org-Id: appdev, User-Id: idcqa) has minter role"
}
removeRoleMember
Questo metodo rimuove un ruolo da un utente e un token specificati. I token fungibili sono specificati dall'ID token. I token non fungibili sono specificati dal nome del token.
Ctx.ERC1155Token.removeRoleMember(role: string, userAccountId: string, token: any)
Parametri:
  • userAccountId: string: l'ID account dell'utente.
  • role: string: il nome del ruolo da rimuovere dall'utente specificato.
  • token: any: l'asset token.
Esempio di valore restituito:
{
  "msg": "Successfully removed role 'minter' from Account Id: oaccount~60bb20c14a83f6e426e1437c479c5891e1c6477dfd7ad18b73acac5d80bc504b (Org-Id: appdev, User-Id: user1)"
}
getAccountsByRole
Questo metodo restituisce un elenco di tutti gli ID account per un ruolo e un token specificati. I token fungibili sono specificati dall'ID token. I token non fungibili sono specificati dal nome del token.
Ctx.ERC1155Token.getAccountsByRole(role: string, token: any)
Parametri:
  • role: string: il nome del ruolo da cercare.
  • token: any: l'asset token.
Esempio di valore restituito:
{
  "accounts": [
    "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a",
    "oaccount~60bb20c14a83f6e426e1437c479c5891e1c6477dfd7ad18b73acac5d80bc504b"
  ]
}
getUsersByRole
Questo metodo restituisce una lista di tutti gli utenti per un ruolo e un token specificati. I token fungibili sono specificati dall'ID token. I token non fungibili sono specificati dal nome del token.
Ctx.ERC1155Token.getUsersByRole(role: string, token: any)
Parametri:
  • role: string: il nome del ruolo da cercare.
  • token: any: l'asset token.
Esempio di valore restituito:
{
    "users": [
        {
            "accountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a",
            "orgId": "appdev",
            "userId": "idcqa"
        },
        {
            "accountId": "oaccount~60bb20c14a83f6e426e1437c479c5891e1c6477dfd7ad18b73acac5d80bc504b",
            "orgId": "appdev",
            "userId": "user1"
        }
    ]
}

Metodi per la gestione della cronologia delle transazioni

getAccountTransactionHistory
Questo metodo restituisce la cronologia delle transazioni del conto. Questo metodo può essere chiamato solo da un Token Admin del codice concatenato o dal proprietario del conto. Per i token non fungibili, questo metodo può essere richiamato solo quando è connesso alla rete remota di Oracle Blockchain Platform.
Ctx.ERC1155Account.getAccountTransactionHistory(accountId: string)
Parametri:
  • accountId: string: l'ID account token.
Esempio di valore restituito:
[
    {
        "transactionId": "otransaction~3a6b23c3003626f3947e990eddbd7ac23398d2200e2eb3eac745e6ddfae140bc~7c88c736df38d5622512f1e8dcdd50710eb47c953f1ecb24ac44790a9e2f475b",
        "timestamp": "2023-06-06T14:48:08.000Z",
        "tokenId": "FNFT",
        "transactedAmount": 10,
        "triggeredByUserAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
        "transactedAccount": "oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446",
        "transactionType": "DEBIT",
        "balance": 90
    },
    {
        "transactionId": "otransaction~3a6b23c3003626f3947e990eddbd7ac23398d2200e2eb3eac745e6ddfae140bc~178e3730bc5bee50d02f1464a4eebf733a051905f651e5789039adb4a3edc114",
        "timestamp": "2023-06-06T14:48:08.000Z",
        "tokenId": "NFT",
        "triggeredByUserAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
        "transactedAccount": "oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446",
        "transactionType": "DEBIT"
    },
    {
        "transactionId": "otransaction~c369929e28e78de06c72d020f1418c9a154a7dd280b2e22ebb4ea4485e249124~a7cefb22ff39ee7e36967be71de27da6798548c872061a62dabc56d88d50b930",
        "timestamp": "2023-06-06T14:47:08.000Z",
        "tokenId": "NFT",
        "triggeredByUserAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
        "transactedAccount": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371",
        "transactionType": "MINT"
    },
    {
        "transactionId": "otransaction~114a1bc78d04be48ee6dc140c32c042ee9481cb118959626f090eec744522422~e4eb15d9354f694230df8835ade012100d82aa43672896a2c7125a86e3048f9f",
        "timestamp": "2023-06-05T17:17:57.000Z",
        "tokenId": "FNFT",
        "transactedAmount": 100,
        "triggeredByUserAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
        "transactedAccount": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371",
        "transactionType": "MINT",
        "balance": 100
    }
]
getTransactionById
Questo metodo restituisce i dettagli della transazione per un ID transazione specificato.
Ctx.ERC1155Transaction.getTransactionById(transactionId: string)
Parametri:
  • transactionId: string: l'ID della transazione.
Esempio di valore restituito:
{
  "transactionId": "otransaction~9ea7b05ab099f7ff4db8342b8c3609031f1d54f11205906e7f1fe88661fe3cbe~33b59ce0c89e96c1e16449f24301581e8e71954f38ad977c7eb6f065e87f2a53",
  "history": [
    {
      "trxId": "9ea7b05ab099f7ff4db8342b8c3609031f1d54f11205906e7f1fe88661fe3cbe",
      "timeStamp": "2022-12-08T09:01:28.000Z",
      "value": {
        "assetType": "otransaction",
        "transactionId": "otransaction~9ea7b05ab099f7ff4db8342b8c3609031f1d54f11205906e7f1fe88661fe3cbe~33b59ce0c89e96c1e16449f24301581e8e71954f38ad977c7eb6f065e87f2a53",
        "tokenId": "tokenOne",
        "fromAccountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a",
        "toAccountId": "",
        "transactionType": "BURN",
        "amount": 5,
        "timestamp": "2022-12-08T09:01:28.000Z",
        "triggeredByUserAccountId": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc"
      }
    }
  ]
}
deleteTransactions
Questo metodo elimina le transazioni prima di un indicatore orario specificato dal database di stato.
Ctx.ERC1155Transaction.deleteTransactions(referenceTime: Date)
Parametri:
  • referenceTime: Date: tutte le transazioni precedenti a questo indicatore orario verranno eliminate.
Esempio di valore restituito:
{
  "msg": "Successfuly deleted transaction older than date: Thu Apr 07 2022 21:18:59 GMT+0000 (Coordinated Universal Time).",
  "transactions": [
    "otransaction~30513757d8b647fffaafac440d743635f5c1b2e41b25ebd6b70b5bbf78a2643f",
    "otransaction~ac0e908c735297941ba58bb208ee61ff4816a1e54c090d68024f82adf743892b"
  ]
}

Metodi per la gestione del comportamento dei token - Funzionamento minimo

mintBatch
Questo metodo crea (mint) più token in un'operazione batch. Questo metodo crea solo token fungibili o token non fungibili frazionari.

Per i token fungibili, se il ruolo minter è definito nel file di specifica, qualsiasi utente con il ruolo minter può chiamare questo metodo. In caso contrario, qualsiasi utente può utilizzare questo metodo per coniare i token. Impossibile coniare più della proprietà max_mint_quantity del token se tale proprietà è stata specificata al momento della creazione o dell'aggiornamento del token.

Per i token non fungibili, se il ruolo minter è definito nel file di specifica, qualsiasi utente con il ruolo minter può chiamare questo metodo. In caso contrario, qualsiasi utente può utilizzare questo metodo per coniare i token. Inoltre, il chiamante deve essere anche il creatore del token. Non esiste un limite massimo per la quantità di token frazionari non fungibili che possono essere coniati.

Impossibile utilizzare questo metodo per coniare un token non fungibile intero.

Ctx.ERC1155Token.mintBatch(accountId: string, tokenIds: string[], quantities: number[])
Parametri:
  • accountId: string: l'ID account dell'utente.
  • tokenIds: string[]: la lista degli ID token per i quali creare i token.
  • quantity: number[]: la lista delle quantità di token da coniare, corrispondente all'array ID token.
Restituisce:
  • In caso di operazione riuscita, un oggetto JSON che include dettagli sui token coniati.
Esempio di valore restituito:
{
    "msg": "Successfully minted batch of tokens for User-Account-Id ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38 (Org-Id: appdev, User-Id: idcqa).",
    "details": [
        {
            "msg": "Successfully minted 100 tokens of fractional tokenId: plot55 to Org-Id: appdev, User-Id: idcqa"
        },
        {
            "msg": "Successfully minted 100 tokens of tokenId: loyalty to Token-Account-Id oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e"
        }
    ]
}

Metodi per la gestione del comportamento dei token - Funzionamento trasferibile

batchTransferFrom
Questo metodo completa un'operazione batch che trasferisce i token specificati in una lista di ID token da un utente a un altro utente.

Per gli NFT, poiché il metodo trasferisce la proprietà dell'NFT, il mittente dell'NFT deve possedere il token.

Per gli NFT frazionari, se un utente (incluso il creatore del token) trasferisce tutte le azioni di cui è proprietario, perde la proprietà del token. Se una qualsiasi parte di un token viene trasferita a un utente, tale utente diventa automaticamente uno dei proprietari dell'NFT frazionario.

Questo metodo non verifica che il chiamante del metodo sia il mittente specificato.

Ctx.ERC1155Token.batchTransferFrom(fromUserAccountId: string, toUserAccountId: string, tokenIds: string[], quantities: number[])
Parametri:
  • fromUserAccountId: string: l'ID account del mittente e del proprietario del token nell'organizzazione corrente.
  • toUserAccountId: string: l'ID account del destinatario.
  • tokenIds: string[]: lista di ID token per i token da trasferire.
  • quantity: number[]: la lista delle quantità di token da trasferire, corrispondente all'array ID token.
Restituisce:
  • In caso di operazione riuscita, viene visualizzato un messaggio con i dettagli per ogni trasferimento di token.
Esempio di valore restituito:
[
    {
        "msg": "Successfully transferred NFT token: 'FNFT' of '10' quantity from Account-Id: oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371 (Org-Id: appdev, User-Id: idcqa) to Account-Id: oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446 (Org-Id: appdev, User-Id: user1_minter)"
    },
    {
        "msg": "Successfully transferred 10 FT token: 'FT' from Account-Id: oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e (Org-Id: appdev, User-Id: idcqa) to Account-Id: oaccount~1089ee5122f367ee0ca38c6660298f4b81f199627e4f67f3691c0f628237974c (Org-Id: appdev, User-Id: user1_minter)"
    },
    {
        "msg": "Successfully transferred NFT token: 'NFT' from Account-Id: oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371 (Org-Id: appdev, User-Id: idcqa) to Account-Id: oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446 (Org-Id: appdev, User-Id: user1_minter)"
    }
]
safeBatchtransferFrom
Questo metodo completa un'operazione batch che trasferisce i token specificati in una lista di ID token da un utente a un altro utente.

Per gli NFT, poiché il metodo trasferisce la proprietà dell'NFT, il mittente dell'NFT deve possedere il token.

Per gli NFT frazionari, se un utente (incluso il creatore del token) trasferisce tutte le azioni di cui è proprietario, perde la proprietà del token. Se una qualsiasi parte di un token viene trasferita a un utente, tale utente diventa automaticamente uno dei proprietari dell'NFT frazionario.

Il chiamante del metodo deve essere il mittente specificato.

Ctx.ERC1155Token.safeBatchTransferFrom(fromUserAccountId: string, toUserAccountId: string, tokenIds: string[], quantities: number[])
Parametri:
  • fromUserAccountId: string: l'ID account del mittente e del proprietario del token nell'organizzazione corrente.
  • toUserAccountId: string: l'ID account del destinatario.
  • tokenIds: string[]: lista di ID token per i token da trasferire.
  • quantity: number[]: la lista delle quantità di token da trasferire, corrispondente all'array ID token.
Restituisce:
  • In caso di operazione riuscita, viene visualizzato un messaggio con i dettagli per ogni trasferimento di token.
Esempio di valore restituito:
[
    {
        "msg": "Successfully transferred NFT token: 'FNFT' of '10' quantity from Account-Id: oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371 (Org-Id: appdev, User-Id: idcqa) to Account-Id: oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446 (Org-Id: appdev, User-Id: user1_minter)"
    },
    {
        "msg": "Successfully transferred 10 FT token: 'FT' from Account-Id: oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e (Org-Id: appdev, User-Id: idcqa) to Account-Id: oaccount~1089ee5122f367ee0ca38c6660298f4b81f199627e4f67f3691c0f628237974c (Org-Id: appdev, User-Id: user1_minter)"
    },
    {
        "msg": "Successfully transferred NFT token: 'NFT' from Account-Id: oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371 (Org-Id: appdev, User-Id: idcqa) to Account-Id: oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446 (Org-Id: appdev, User-Id: user1_minter)"
    }
]
balanceOfBatch
Questo metodo completa un'operazione batch che recupera il saldo dei conti token. I dettagli dell'account sono specificati in tre elenchi separati di ID organizzazione, ID utente e ID token. Questo metodo può essere chiamato solo da un Token Admin del codice concatenato o dai proprietari di account. I proprietari dei conti possono visualizzare i dettagli del saldo solo per i conti di loro proprietà.
Ctx.ERC1155Account.balanceOfBatch(accountIds: string[], tokenIds: string[])
Parametri:
  • accountIds: string[]: elenco degli ID degli account utente.
  • tokenIds: string[]: lista degli ID token.
Esempio di valore restituito:
[
    {
        "orgId": "appdev",
        "userId": "idcqa",
        "userAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
        "tokenAccountId": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371",
        "tokenId": "FNFT",
        "balance": 100
    },
    {
        "orgId": "appdev",
        "userId": "idcqa",
        "userAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
        "tokenAccountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e",
        "tokenId": "FT",
        "balance": 50
    },
    {
        "orgId": "appdev",
        "userId": "user1_minter",
        "userAccountId": "ouaccount~9501bb774c156eb8354dfe489250ea91f757523d70f08ee494bda98bb352003b",
        "tokenAccountId": "oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446",
        "tokenId": "FNFT",
        "balance": 10
    }
]
exchangeToken
Questo metodo scambia i token tra i conti specificati. Questo metodo supporta solo lo scambio tra un NFT (intero o frazionario) e un token fungibile o un token fungibile e un NFT (intero o frazionario). Questo metodo può essere richiamato solo dal proprietario dell'account.
Ctx.ERC1155Token.exchangeToken( fromTokenId: string, fromUserAccountId: string, fromTokenQuantity: number, toTokenId: string, toUserAccountId: string, toTokenQuantity: number)
Parametri:
  • fromTokenId: string: l'ID del token di proprietà del mittente.
  • fromUserAccountId: string: l'ID account del mittente.
  • fromTokenQuantity: number - La quantità di token dal mittente da scambiare con il destinatario.
  • toTokenId: string: l'ID del token di proprietà del destinatario.
  • toUserAccountId: string: l'ID account del destinatario.
  • toTokenQuantity: number - La quantità di token dal destinatario da scambiare con il mittente.
Restituisce:
  • In caso di operazione riuscita, un messaggio con i dettagli dello scambio di token.
Esempio di valore restituito:
{
    "msg": "Succesfully exchanged 10 tokens of type nonfungible with tokenId: [r1] from Account oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371 (OrgId: appdev, UserId: idcqa) to 10 tokens of type fungible with tokenId: [loy1] from Account oaccount~1089ee5122f367ee0ca38c6660298f4b81f199627e4f67f3691c0f628237974c (OrgId: appdev, UserId: user1_minter)"
}

Metodi per la gestione del comportamento dei token - Funzionamento attivabile

burn
Questo metodo disattiva o brucia i token fungibili e non fungibili specificati.
Ctx.ERC1155Token.burn(accountId: string, tokenIds: string[], quantities: number[])
Parametri:
  • accountId: string: l'ID account dell'utente.
  • tokenIds: string[]: la lista degli ID token da masterizzare.
  • quantity: number[]: la lista delle quantità di token da masterizzare, corrispondente all'array ID token.
Restituisce:
  • In caso di successo, un messaggio con i dettagli sulle operazioni di masterizzazione.
Esempio di valore restituito:
[
  {
    "msg": "Successfully burned NFT token: 'art' from Account-Id: oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6 (Org-Id: appdev, User-Id: idcqa)"
  },
  {
    "msg": "Successfully burned 5 tokens of tokenId: tokenOne from Account-ID oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a (Org-Id: appdev, User-Id: idcqa)"
  },
  {
    "msg": "Successfully burned 2 token share of tokenId: FNFT from Account-ID oaccount~87bcb699d507368ee3966cd03ee6d7736ffc55dde8c0f0e16b14866334ac504a (Org-Id: AutoF1377358917, User-Id: idcqa)"
  }
]