git.delta.rocks / unique-network / refs/commits / 55c4d052d75c

difftreelog

source

tests/src/interfaces/rmrk/definitions.ts3.6 KiBsourcehistory
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import types from '../lookup';1819type RpcParam = {20  name: string;21  type: string;22  isOptional?: true;23};2425const atParam = {name: 'at', type: 'Hash', isOptional: true};26const fn = (description: string, params: RpcParam[], type: string) => ({27    description,28    params: [...params, atParam],29    type,30});3132export default {33    types,34    rpc: {35        lastCollectionIdx: fn('Get the latest created collection id', [], 'u32'),36        collectionById: fn('Get collection by id', [{name: 'id', type: 'u32'}], 'Option<RmrkTypesCollectionInfo>'),37        nftById: fn(38            'Get NFT by collection id and NFT id',39            [40                {name: 'collectionId', type: 'u32'},41                {name: 'nftId', type: 'u32'},42            ],43            'Option<RmrkTypesNftInfo>'44        ),45        accountTokens: fn(46            'Get tokens owned by an account in a collection',47            [48                {name: 'accountId', type: 'AccountId32'},49                {name: 'collectionId', type: 'u32'}50            ],51            'Vec<u32>'52        ),53        nftChildren: fn(54            'Get NFT children',55            [56                {name: 'collectionId', type: 'u32'},57                {name: 'nftId', type: 'u32'},58            ],59            'Vec<RmrkTypesNftChild>'60        ),61        collectionProperties: fn(62            'Get collection properties',63            [{name: 'collectionId', type: 'u32'}],64            'Vec<RmrkTypesPropertyInfo>'65        ),66        nftProperties: fn(67            'Get NFT properties',68            [69                {name: 'collectionId', type: 'u32'},70                {name: 'nftId', type: 'u32'}71            ],72            'Vec<RmrkTypesPropertyInfo>'73        ),74        nftResources: fn(75            'Get NFT resources',76            [77                {name: 'collectionId', type: 'u32'},78                {name: 'nftId', type: 'u32'}79            ],80            'Vec<RmrkTypesResourceInfo>'81        ),82        nftResourcePriorities: fn(83            'Get NFT resource priorities',84            [85                {name: 'collectionId', type: 'u32'},86                {name: 'nftId', type: 'u32'}87            ],88            'Vec<Bytes>'89        ),90        base: fn(91            'Get base info',92            [{name: 'baseId', type: 'u32'}],93            'Option<RmrkTypesBaseInfo>'94        ),95        baseParts: fn(96            'Get all Base\'s parts',97            [{name: 'baseId', type: 'u32'}],98            'Vec<RmrkTypesPartType>'99        ),100        themeNames: fn(101            'Get Base\'s theme names',102            [{name: 'baseId', type: 'u32'}],103            'Vec<Bytes>'104        ),105        themes: fn(106            'Get Theme\'s keys values',107            [108                {name: 'baseId', type: 'u32'},109                {name: 'themeName', type: 'String'},110                {name: 'keys', type: 'Option<Vec<String>>'}111            ],112            'Option<RmrkTypesTheme>'113        )114    }115};