v1.5.0: Secret NFT, Capsules pallets, TEE, Transmission Protocols pallets
This release aims to bring Ternoa Phase 4 main features:
- Secret NFT🕵
- Capsules 🔮
- Transmission Protocols 🔑
- TEE 🔒
Important note: This release comes with several breaking changes have been implemented in this version
It is strongly recommend to update your application accordingly.
Contributors: @Victor-Salomon @ipapandinas @dhammani
Breaking changes (6)
Pallet Helpers
Account
generateAccount
helper is removed
Marketplace/Auction
buyItNowTx
&buyItNow
require a newnftBuyingPrice
argumentbuyNftTx
&buyNft
require a newnftBuyingPrice
argumentformatMarketplaceFee
renamed =>convertMarketplaceFee
Rent
rentTx
&rent
require a newcontractCreationBlockId
argumentmakeRentOfferTx
&makeRentOffer
require a newcontractCreationBlockId
argument
Types
- SubmitTxBlockingType type now expect a third element : txHash:
0x${string}
in order to fix issue #154.
IPFS
- secretNFTMetadata : improved response object. according to TIPs 520
- capsuleMetadata : according to TIPs 530
- improved response object.
- encryptedMedia renamed => encrypted_media
- publicKey renamed => public_key_of_nft
- Updated Types and Helpers: Removed unnecessary generics types: cf list at the end of the changelog.
MISC
getSignature
renamed =>getSignatureFromKeyring
Features Added (6)
1- NFT Pallet extended with Secret NFT 🕵️
This pallet is a complex module to create and handle secret NFT. The related TIP is TIP-520.
nft/constants:
- getInitialSecretMintFee - Original secret mint fee.
nft/extrinsics:
- createSecretNft - Creates a Secret NFT on chain.
- addSecretToNft - Adds a Secret to an NFT on chain.
nft/storages:
- getSecretNftMintFee - Fee to mint a secret NFT (extra fee on top of the tx fees and basic nft).
- getSecretNftOffchainData - Get the secret offchain data of a Secret NFT.
2- NFT Pallet extended with Caspule NFT 🔮
This pallet is a complex module to create and handle secret NFT. The related TIP is TIP-530.
nft/constants:
- getInitialSecretMintFee - Original secret mint fee.
nft/extrinsics:
- convertNftToCapsule - Convert an existing basic NFT into a Capsule NFT.
- createCapsule - Convert an existing basic NFT into a Capsule NFT.
- revertCapsule - Removes the capsule part of an NFT.
- setCapsuleOffchaindata - Sets the offchain data of a Capsule NFT.
- notifyEnclaveKeyUpdate - Notifies the enclave that capsule owner requests new keys.
nft/storages:
- getCapsuleMintFee - Fee to mint a Capsule. (extra fee on top of the tx fees).
- getCapsuleOffchainData - Get the capsule offchain data.
- notifyEnclaveKeyUpdate - Notifies the enclave that capsule owner requests new keys.
3- Protocols Pallet 🔑
This pallet is a complex module to create and handle secret NFT. The related TIP is TIP-540.
protocols/constants:
- getProtocolsActionsInBlockLimit - Maximum number of actions in one block.
- getSimultaneousTransmissionLimit - Maximum number of simultaneous transmission protocol.
- getMaxConsentListSize - Maximum size for the consent list.
- getMaxBlockDuration - Maximum block duration for a protocol.
protocols/extrinsics:
- setTransmissionProtocol - Adds a transmission protocol to any type of NFT.
- removeTransmissionProtocol - Remove a transmission protocol from an NFT.
- resetTranmissionProtocolTimer - Reset the block execusion of the transmission protocol.
- addConsentToOnConsentProtocol - Adds user consent to transmit the NFT (for users specified in the account list for OnConsent protocol only)
protocols/storages:
- getTransmissionAtBlockFee - Fee to set an AtBlock protocol.
- getTransmissionAtBlockWithResetFee - Fee to set an AtBlockWithReset protocol.
- getTransmissionOnConsentFee - Fee to set an OnConsentFee protocol.
- getTransmissionOnConsentAtBlockFee - Fee to set an OnConsentAtBlockFee protocol.
- getTransmissionAtBlockQueue - Provides the data of a set transmission protocol.
- getTransmissions - Notifies the enclave that capsule owner requests new keys.
- getTransmissionOnConsentData - Provides the list of address that gave their consent to a transmission protocol.
protocols/utils:
- formatAtBlockProtocol - Returns an object according to the atBlock transmission protocol format.
- formatAtBlockWithResetProtocol - Returns an object according to the atBlockWithReset transmission protocol format.
- formatOnConsentProtocol - Returns an object according to the OnConsent transmission protocol format.
- formatOnConsentAtBlockProtocol - Returns an object according to the onConsentAtBlock transmission protocol format.
- formatProtocolCancellation - Returns an object according to the cancellation kind required.
4- TEE Pallet 🔒
Storages needed to proceed to the secret keys upload. The related TIP is TIP-510.
protocols/storages:
- getClusterData - Provides the data related to a cluster.
- getEnclaveData - Provides the data related to an enclave.
5- NFT Pallet extended with Collection off-chain data set 🃏
nft/extrinsics:
- setCollectionOffchaindata - Sets the off-chain data of a Collection..
A new event CollectionOffchainDataSetEvent is available.
6- Rent Pallet ✍️
rent/storage:
- getRentalContractData:
creationBlock
&creationBlockDate
added to RentalContractDataType
Helpers Added (7)
src/helpers/crypto.ts
- getSignatureFromKeyring - Signs data using the keyring.
- getSignatureFromExtension - Signs data using an injector extension. We recommend the Polkadot extension.
- getLastBlock - Retrieve the last block number.
src/helpers/encryption.ts
- generatePGPKeys - Generates a new PGP key pair.
- encryptContent - Encrypts a content (string).
- encryptFile - Encrypts file with the public key.
- decryptFile - Decrypts message with the private key.
src/helpers/nft.ts
- secretNftEncryptAndUploadFile - Encrypts and uploads a file on an IFPS gateway.
- mintSecretNFT - Encrypts your data to create a secret NFT and uploads your key's shards on a TEE.
- viewSecretNFT - Retrieves and decrypts the secret NFT hash.
- mintCapsuleNFT - Create a Capsule NFT and uploads your key's shards on a TEE.
- getCapsuleNFTPrivateKey - Retrieves the capsule NFT private key to decrypt the secret hashes from properties.
- getTemporarySignerKeys - Generates a temporary signer account with soft-derivation.
- prepareAndStoreKeyShares - Splits the private key into shards, and format and send them for upload onto a Tee Cluster.
src/helpers/tee.ts
- generateKeyShares - Generates an array of shares from the incoming parameter string.
- combineKeyShares - Combines an array of shares to reconstruct data.
- getEnclaveHealthStatus - Check that all TEE enclaves from a cluster are ready to be used.
- getTeeEnclavesBaseUrl - Retrieves the TEE enclaves urls stored on-chain.
- getEnclaveSharesAvailablility - Check that an enclave from a cluster have registered a Capsule NFT or a Secret NFT's key shares.
- formatStorePayload - Prepares post request payload to store secret/capsule NFT data into TEE enclaves.
- formatRetrievePayload - Prepares post request payload to retrieve secret/capsule NFT data into TEE enclaves.
- teeUpload - Upload secret payload data to an TEE enclave.
- teeKeySharesStore - Upload secret shares to TEE enclaves with retry.
-sharesAvailableOnTeeCluster - Check that all enclaves from a cluster have registered a the Capsule NFT or a Secret NFT's key shares - teeKeySharesRetrieve - Get secret data shares from TEE enclaves.
- teeKeySharesRemove - Remove the share of a burnt NFT from the enclaves.
src/helpers/utils.ts
- convertFileToBuffer - Converts a File to Buffer.
- retryPost - Retries a function according to the number required.
- ensureHttps - Ensure enclaves starts by 'https://'.
src/helpers/ipfs.ts
- storeSecretNFT
- storeCapsuleNFT
- validateOptionalNFTMetadata
marketplaceIpfsUpload
,nftIpfsUpload
,collectionIpfsUpload
moved to new IPFS Client
src/marketplace/utils.ts
Couple of formatters to configure a Marketplace easily
- convertMarketplaceFee - Checks the type fee and format it accordingly. Numbers are formatted into BN. Percentages are formatted in Permill.
- formatMarketplaceFee - Returns an object representing either the marketplace commission or listing fee in either Flat or Percentage format.
- formatMarketplaceAccountList - Returns an object representing a list of accounts.
- formatMarketplaceOffchainData - Returns the off-chain related marketplace metadata.
- formatMarketplaceCollectionList - Returns an object representing a list of collections of NFT.
Events (2)
- New CollectionOffchainDataSetEvent
creationBlockId
added to ContractCreatedEvent
Fixes (4)
According to issue #154:
submitTxBlocking()
now return a third argument : the submitted transaction hash.submitTxNonBlocking()
now return a third argument : the submitted transaction hash.- SubmitTxBlockingType now expect a third element : txHash:
0x${string}
storeFile()
in IFPS got "form.set" raplaced by "form.append".
Removed generic types (19)
From types:
- NftMetadataType
- MediaMetadataType
- CollectionMetadataType
- MarketplaceMetadataType
- CapsuleMedia
- CapsuleEncryptedMedia
From IPFS helper:
- storeNFT
- storeSecretNFT
- storeCapsuleNFT
- capsuleMedia
- storeCollection
- storeMarketplace
- validateNFTMetadata
- validateOptionalNFTMetadata
- validateCollectionMetadata
- validateMarketplaceMetadata
From NFT helper:
- secretNftEncryptAndUploadFile
- mintSecretNFT
- mintCapsuleNFT
Libraries 📚
openpgp
(5.5.0)buffer
( 6.0.x)sssa-js
(0.0.1)- (+ devDependancies)