difftreelog
Update custom types
in: master
2 files changed
README.mddiffbeforeafterboth--- a/README.md
+++ b/README.md
@@ -122,6 +122,15 @@
"Owner": "AccountId",
"Data": "Vec<u8>"
},
+ "Ownership": {
+ "owner": "AccountId",
+ "fraction": "u128"
+ },
+ "ReFungibleItemType": {
+ "Collection": u64,
+ "Owner": "Vec<Ownership<AccountId>>",
+ "Data": "Vec<u8>",
+ },
"CollectionType": {
"Owner": "AccountId",
"Mode": "CollectionMode",
doc/application_development.mddiffbeforeafterboth1# Building an NFT Application23## Architecture45Both centralized and serverless architectures are supported and application creator can decide which one to use depending on how much logic and data they intend to manage off-chain and off-line.67### Server-based architecture89In server-based architecture the application creator manually creates NFT collections and authorizes server to perform operations on each collection. See NFT palette methods that have admin permission level to understand better what server (or administrators) can do.10111213### Serverless architecture1415In serverless architecture the application creator does all initialization and token distribution manually. Alternatively, smart contracts may be used in order to implement some distribution mechanics such as token sales or claiming. The dApp has access to all properties of an NFT token, but it does not have any elevated permissions, since it resides on user site. All operations happen on user's behalf signed by user's private key.16171819## Custom Types for JS API2021```22{23 "Schedule": {24 "version": "u32",25 "put_code_per_byte_cost": "Gas",26 "grow_mem_cost": "Gas",27 "regular_op_cost": "Gas",28 "return_data_per_byte_cost": "Gas",29 "event_data_per_byte_cost": "Gas",30 "event_per_topic_cost": "Gas",31 "event_base_cost": "Gas",32 "call_base_cost": "Gas",33 "instantiate_base_cost": "Gas",34 "dispatch_base_cost": "Gas",35 "sandbox_data_read_cost": "Gas",36 "sandbox_data_write_cost": "Gas",37 "transfer_cost": "Gas",38 "instantiate_cost": "Gas",39 "max_event_topics": "u32",40 "max_stack_height": "u32",41 "max_memory_pages": "u32",42 "max_table_size": "u32",43 "enable_println": "bool",44 "max_subject_len": "u32"45 },46 "NftItemType": {47 "Collection": "u64",48 "Owner": "AccountId",49 "Data": "Vec<u8>"50 },51 "CollectionType": {52 "Owner": "AccountId",53 "NextItemId": "u64",54 "Name": "Vec<u16>",55 "Description": "Vec<u16>",56 "TokenPrefix": "Vec<u8>",57 "CustomDataSize": "u32",58 "Sponsor": "AccountId",59 "UnconfirmedSponsor": "AccountId"60 },61 "Address": "AccountId",62 "LookupSource": "AccountId",63 "Weight": "u64"64}65```6667## NFT Palette Methods6869### Collection Management7071#### CreateCollection7273##### Description74This method creates a Collection of NFTs. Each Token may have multiple properties encoded as an array of bytes of certain length. The initial owner and admin of the collection are set to the address that signed the transaction. Both addresses can be changed later.7576##### Permissions77Anyone7879##### Parameters80customDataSz: Size of NFT properties data.8182##### Events83CollectionCreated84CollectionID: Globally unique identifier of newly created collection.85Owner: Collection owner8687#### ChangeCollectionOwner8889##### Description90Change the owner of the collection9192##### Permissions93Collection Owner9495##### Parameters96CollectionId9798#### DestroyCollection99100##### Description101DANGEROUS: Destroys collection and all NFTs within this collection. Users irrecoverably lose their assets and may lose real money.102103##### Permissions104Collection Owner105106##### Parameters107CollectionId108109#### CreateItem110111##### Description112This method creates a concrete instance of NFT Collection created with CreateCollection method.113114##### Permissions115Collection Owner116Collection Admin117118##### Parameters119CollectionID: ID of the collection120Properties: Array of bytes that contains NFT properties. Since NFT Module is agnostic of properties’ meaning, it is treated purely as an array of bytes121Owner: Address, initial owner of the NFT122123##### Events124ItemCreated125ItemId: Identifier of newly created NFT, which is unique within the Collection, so the NFT is uniquely identified with a pair of values: CollectionId and ItemId.126127#### BurnItem128129##### Description130This method destroys a concrete instance of NFT.131132##### Permissions133Collection Owner134Collection Admin135Current NFT Owner136137##### Parameters138CollectionID: ID of the collection139ItemID: ID of NFT to burn140141##### Events142ItemDestroyed143CollectionID144ItemId: Identifier of burned NFT145146147#### AddCollectionAdmin148149##### Description150NFT Collection can be controlled by multiple admin addresses (some which can also be servers, for example). Admins can issue and burn NFTs, as well as add and remove other admins, but cannot change NFT or Collection ownership.151152This method adds an admin of the Collection.153154##### Permissions155Collection Owner156Collection Admin157158##### Parameters159CollectionID: ID of the Collection to add admin for160Admin: Address of new admin to add161162#### RemoveCollectionAdmin163164##### Description165Remove admin address of the Collection. An admin address can remove itself. List of admins may become empty, in which case only Collection Owner will be able to add an Admin.166167##### Permissions168Collection Owner169Collection Admin170171##### Parameters172CollectionID: ID of the Collection to remove admin for173Admin: Address of admin to remove174175### Item Ownership and Transfers176This group of methods allows managing NFT ownership.177178#### GetOwner179180##### Description181Return the address of the NFT owner. 182183##### Permissions184Anyone185186##### Parameters187CollectionId188ItemId: ID of the NFT189190##### Returns191Owner address192193#### BalanceOf194195##### Description196This method is included for compatibility with ERC-721. Return the total count of NFTs of a given Collection that belong to a given address. 197198##### Permissions199Anyone200201##### Parameters202CollectionId203Address to count NFTs for204205##### Returns206Total count of NFTs for Address207208209#### Transfer210211##### Description212Change ownership of the NFT.213214##### Permissions215Collection Owner216Collection Admin217Current NFT owner218219##### Parameters220Recipient: Address of token recipient221ClassId: ID of item class222ItemId: ID of the item223224#### TransferFrom225226##### Description227Change ownership of a NFT on behalf of the owner. See Approve method for additional information. After this method executes, the approval is removed so that the approved address will not be able to transfer this NFT again from this owner.228229##### Permissions230Collection Owner231Collection Admin232Current NFT owner233Address approved by current NFT owner234235##### Parameters236Recipient: Address of token recipient237ClassId: ID of item class238ItemId: ID of the item239240241#### Approve242243##### Description244Set, change, or remove approved address to transfer the ownership of the NFT.245246##### Permissions247Collection Owner248Collection Admin249Current NFT owner250251##### Parameters252Approved: Address that is approved to transfer this NFT or zero (if needed to remove approval)253ClassId: ID of item class254ItemId: ID of the item255256#### GetApproved257258##### Description259Get the approved address for a single NFT.260261##### Permissions262Anyone263264##### Parameters265ClassId: ID of item class266ItemId: ID of the item267268##### Returns269Approved address1# Building an NFT Application23## Architecture45Both centralized and serverless architectures are supported and application creator can decide which one to use depending on how much logic and data they intend to manage off-chain and off-line.67### Server-based architecture89In server-based architecture the application creator manually creates NFT collections and authorizes server to perform operations on each collection. See NFT palette methods that have admin permission level to understand better what server (or administrators) can do.10111213### Serverless architecture1415In serverless architecture the application creator does all initialization and token distribution manually. Alternatively, smart contracts may be used in order to implement some distribution mechanics such as token sales or claiming. The dApp has access to all properties of an NFT token, but it does not have any elevated permissions, since it resides on user site. All operations happen on user's behalf signed by user's private key.16171819## Custom Types for JS API2021See in root README2223## NFT Palette Methods2425### Collection Management2627#### CreateCollection2829##### Description30This method creates a Collection of NFTs. Each Token may have multiple properties encoded as an array of bytes of certain length. The initial owner and admin of the collection are set to the address that signed the transaction. Both addresses can be changed later.3132##### Permissions33Anyone3435##### Parameters36customDataSz: Size of NFT properties data.3738##### Events39CollectionCreated40CollectionID: Globally unique identifier of newly created collection.41Owner: Collection owner4243#### ChangeCollectionOwner4445##### Description46Change the owner of the collection4748##### Permissions49Collection Owner5051##### Parameters52CollectionId5354#### DestroyCollection5556##### Description57DANGEROUS: Destroys collection and all NFTs within this collection. Users irrecoverably lose their assets and may lose real money.5859##### Permissions60Collection Owner6162##### Parameters63CollectionId6465#### CreateItem6667##### Description68This method creates a concrete instance of NFT Collection created with CreateCollection method.6970##### Permissions71Collection Owner72Collection Admin7374##### Parameters75CollectionID: ID of the collection76Properties: Array of bytes that contains NFT properties. Since NFT Module is agnostic of properties’ meaning, it is treated purely as an array of bytes77Owner: Address, initial owner of the NFT7879##### Events80ItemCreated81ItemId: Identifier of newly created NFT, which is unique within the Collection, so the NFT is uniquely identified with a pair of values: CollectionId and ItemId.8283#### BurnItem8485##### Description86This method destroys a concrete instance of NFT.8788##### Permissions89Collection Owner90Collection Admin91Current NFT Owner9293##### Parameters94CollectionID: ID of the collection95ItemID: ID of NFT to burn9697##### Events98ItemDestroyed99CollectionID100ItemId: Identifier of burned NFT101102103#### AddCollectionAdmin104105##### Description106NFT Collection can be controlled by multiple admin addresses (some which can also be servers, for example). Admins can issue and burn NFTs, as well as add and remove other admins, but cannot change NFT or Collection ownership.107108This method adds an admin of the Collection.109110##### Permissions111Collection Owner112Collection Admin113114##### Parameters115CollectionID: ID of the Collection to add admin for116Admin: Address of new admin to add117118#### RemoveCollectionAdmin119120##### Description121Remove admin address of the Collection. An admin address can remove itself. List of admins may become empty, in which case only Collection Owner will be able to add an Admin.122123##### Permissions124Collection Owner125Collection Admin126127##### Parameters128CollectionID: ID of the Collection to remove admin for129Admin: Address of admin to remove130131### Item Ownership and Transfers132This group of methods allows managing NFT ownership.133134#### GetOwner135136##### Description137Return the address of the NFT owner. 138139##### Permissions140Anyone141142##### Parameters143CollectionId144ItemId: ID of the NFT145146##### Returns147Owner address148149#### BalanceOf150151##### Description152This method is included for compatibility with ERC-721. Return the total count of NFTs of a given Collection that belong to a given address. 153154##### Permissions155Anyone156157##### Parameters158CollectionId159Address to count NFTs for160161##### Returns162Total count of NFTs for Address163164165#### Transfer166167##### Description168Change ownership of the NFT.169170##### Permissions171Collection Owner172Collection Admin173Current NFT owner174175##### Parameters176Recipient: Address of token recipient177ClassId: ID of item class178ItemId: ID of the item179180#### TransferFrom181182##### Description183Change ownership of a NFT on behalf of the owner. See Approve method for additional information. After this method executes, the approval is removed so that the approved address will not be able to transfer this NFT again from this owner.184185##### Permissions186Collection Owner187Collection Admin188Current NFT owner189Address approved by current NFT owner190191##### Parameters192Recipient: Address of token recipient193ClassId: ID of item class194ItemId: ID of the item195196197#### Approve198199##### Description200Set, change, or remove approved address to transfer the ownership of the NFT.201202##### Permissions203Collection Owner204Collection Admin205Current NFT owner206207##### Parameters208Approved: Address that is approved to transfer this NFT or zero (if needed to remove approval)209ClassId: ID of item class210ItemId: ID of the item211212#### GetApproved213214##### Description215Get the approved address for a single NFT.216217##### Permissions218Anyone219220##### Parameters221ClassId: ID of item class222ItemId: ID of the item223224##### Returns225Approved address