git.delta.rocks / unique-network / refs/commits / fb129ad11e28

difftreelog

test createCollectionEx

Yaroslav Bolyukin2022-01-11parent: #e637581.patch.diff
in: master

14 files changed

modifiedtests/package.jsondiffbeforeafterboth
67 "testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",67 "testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",
68 "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",68 "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",
69 "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",69 "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",
70 "polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9933 > src/interfaces/metadata.json",
70 "polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --input src/interfaces/ --package .",71 "polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --input src/interfaces/ --package .",
71 "polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint ws://localhost:9944 --output src/interfaces/ --package .",72 "polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint src/interfaces/metadata.json --output src/interfaces/ --package .",
72 "polkadot-types": "yarn polkadot-types-from-defs && yarn polkadot-types-from-chain"73 "polkadot-types": "yarn polkadot-types-fetch-metadata && yarn polkadot-types-from-defs && yarn polkadot-types-from-chain"
73 },74 },
74 "author": "",75 "author": "",
75 "license": "SEE LICENSE IN ../LICENSE",76 "license": "SEE LICENSE IN ../LICENSE",
modifiedtests/src/check-event/createCollectionEvent.test.tsdiffbeforeafterboth
27 });27 });
28 it('Check event from createCollection(): ', async () => {28 it('Check event from createCollection(): ', async () => {
29 await usingApi(async (api: ApiPromise) => {29 await usingApi(async (api: ApiPromise) => {
30 const tx = api.tx.unique.createCollection([0x31], [0x32], '0x33', 'NFT');30 const tx = api.tx.unique.createCollectionEx({name: [0x31], description: [0x32], tokenPrefix: '0x33', mode: 'NFT'});
31 const events = await submitTransactionAsync(alice, tx);31 const events = await submitTransactionAsync(alice, tx);
32 const msg = JSON.stringify(uniqueEventMessage(events));32 const msg = JSON.stringify(uniqueEventMessage(events));
33 expect(msg).to.be.contain(checkSection);33 expect(msg).to.be.contain(checkSection);
modifiedtests/src/createCollection.test.tsdiffbeforeafterboth
3// file 'LICENSE', which is part of this source code package.3// file 'LICENSE', which is part of this source code package.
4//4//
55
6import chai from 'chai';6import {expect} from 'chai';
7import chaiAsPromised from 'chai-as-promised';7import privateKey from './substrate/privateKey';
8import usingApi, {executeTransaction, submitTransactionAsync} from './substrate/substrate-api';
8import {createCollectionExpectFailure, createCollectionExpectSuccess} from './util/helpers';9import {createCollectionExpectFailure, createCollectionExpectSuccess, getCreateCollectionResult, getDetailedCollectionInfo} from './util/helpers';
9
10chai.use(chaiAsPromised);
1110
12describe('integration test: ext. createCollection():', () => {11describe('integration test: ext. createCollection():', () => {
13 it('Create new NFT collection', async () => {12 it('Create new NFT collection', async () => {
28 it('Create new ReFungible collection', async () => {27 it('Create new ReFungible collection', async () => {
29 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});28 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
30 });29 });
30 it('Create new collection with extra fields', async () => {
31 await usingApi(async api => {
32 const alice = privateKey('//Alice');
33 const bob = privateKey('//Bob');
34 const tx = api.tx.unique.createCollectionEx({
35 mode: {Fungible: 8},
36 access: 'AllowList',
37 name: [1],
38 description: [2],
39 tokenPrefix: '0x000000',
40 offchainSchema: '0x111111',
41 schemaVersion: 'Unique',
42 pendingSponsor: bob.address,
43 limits: {
44 accountTokenOwnershipLimit: 3,
45 },
46 variableOnChainSchema: '0x222222',
47 constOnChainSchema: '0x333333',
48 metaUpdatePermission: 'Admin',
49 });
50 const events = await submitTransactionAsync(alice, tx);
51 const result = getCreateCollectionResult(events);
52
53 const collection = (await getDetailedCollectionInfo(api, result.collectionId))!;
54 expect(collection.owner.toString()).to.equal(alice.address);
55 expect(collection.mode.asFungible.toNumber()).to.equal(8);
56 expect(collection.access.isAllowList).to.be.true;
57 expect(collection.name.map(v => v.toNumber())).to.deep.equal([1]);
58 expect(collection.description.map(v => v.toNumber())).to.deep.equal([2]);
59 expect(collection.tokenPrefix.toString()).to.equal('0x000000');
60 expect(collection.offchainSchema.toString()).to.equal('0x111111');
61 expect(collection.schemaVersion.isUnique).to.be.true;
62 expect(collection.sponsorship.asUnconfirmed.toString()).to.equal(bob.address);
63 expect(collection.limits.accountTokenOwnershipLimit.unwrap().toNumber()).to.equal(3);
64 expect(collection.variableOnChainSchema.toString()).to.equal('0x222222');
65 expect(collection.constOnChainSchema.toString()).to.equal('0x333333');
66 expect(collection.metaUpdatePermission.isAdmin).to.be.true;
67 });
68 });
31});69});
3270
33describe('(!negative test!) integration test: ext. createCollection():', () => {71describe('(!negative test!) integration test: ext. createCollection():', () => {
40 it('(!negative test!) create new NFT collection whith incorrect data (token_prefix)', async () => {78 it('(!negative test!) create new NFT collection whith incorrect data (token_prefix)', async () => {
41 await createCollectionExpectFailure({tokenPrefix: 'A'.repeat(17), mode: {type: 'NFT'}});79 await createCollectionExpectFailure({tokenPrefix: 'A'.repeat(17), mode: {type: 'NFT'}});
42 });80 });
81 it('fails when bad limits are set', async () => {
82 await usingApi(async api => {
83 const alice = privateKey('//Alice');
84 const tx = api.tx.unique.createCollectionEx({mode: 'NFT', limits: {tokenLimit: 0}});
85 await expect(executeTransaction(api, alice, tx)).to.be.rejectedWith(/^common.CollectionTokenLimitExceeded$/);
86 });
87 });
43});88});
4489
addedtests/src/interfaces/.gitignorediffbeforeafterboth

no changes

modifiedtests/src/interfaces/augment-api-consts.tsdiffbeforeafterboth
36 [key: string]: Codec;36 [key: string]: Codec;
37 };37 };
38 inflation: {38 inflation: {
39 /**
40 * Number of blocks that pass between treasury balance updates due to inflation
41 **/
39 inflationBlockInterval: u32 & AugmentedConst<ApiType>;42 inflationBlockInterval: u32 & AugmentedConst<ApiType>;
40 /**43 /**
41 * Generic const44 * Generic const
modifiedtests/src/interfaces/augment-api-errors.tsdiffbeforeafterboth
60 * Tried to approve more than owned60 * Tried to approve more than owned
61 **/61 **/
62 CantApproveMoreThanOwned: AugmentedError<ApiType>;62 CantApproveMoreThanOwned: AugmentedError<ApiType>;
63 /**63 /**
64 * Exceeded max admin amount64 * Exceeded max admin count
65 **/65 **/
66 CollectionAdminAmountExceeded: AugmentedError<ApiType>;66 CollectionAdminCountExceeded: AugmentedError<ApiType>;
67 /**67 /**
68 * Collection description can not be longer than 255 char.68 * Collection description can not be longer than 255 char.
69 **/69 **/
70 CollectionDescriptionLimitExceeded: AugmentedError<ApiType>;70 CollectionDescriptionLimitExceeded: AugmentedError<ApiType>;
71 /**
72 * Collection limit bounds per collection exceeded
73 **/
74 CollectionLimitBoundsExceeded: AugmentedError<ApiType>;
71 /**75 /**
72 * Collection name can not be longer than 63 char.76 * Collection name can not be longer than 63 char.
73 **/77 **/
96 * No permission to perform action100 * No permission to perform action
97 **/101 **/
98 NoPermission: AugmentedError<ApiType>;102 NoPermission: AugmentedError<ApiType>;
103 /**
104 * Tried to enable permissions which are only permitted to be disabled
105 **/
106 OwnerPermissionsCantBeReverted: AugmentedError<ApiType>;
99 /**107 /**
100 * Collection is not in mint mode.108 * Collection is not in mint mode.
101 **/109 **/
227 /**235 /**
228 * Tried to set data for fungible item236 * Tried to set data for fungible item
229 **/237 **/
230 FungibleItemsHaveData: AugmentedError<ApiType>;238 FungibleItemsDontHaveData: AugmentedError<ApiType>;
231 /**239 /**
232 * Not default id passed as TokenId argument240 * Not default id passed as TokenId argument
233 **/241 **/
380 [key: string]: AugmentedError<ApiType>;388 [key: string]: AugmentedError<ApiType>;
381 };389 };
382 system: {390 system: {
391 /**
392 * The origin filter prevent the call to be dispatched.
393 **/
394 CallFiltered: AugmentedError<ApiType>;
383 /**395 /**
384 * Failed to extract the runtime version from the new runtime.396 * Failed to extract the runtime version from the new runtime.
385 * 397 *
432 * Decimal_points parameter must be lower than MAX_DECIMAL_POINTS constant, currently it is 30.444 * Decimal_points parameter must be lower than MAX_DECIMAL_POINTS constant, currently it is 30.
433 **/445 **/
434 CollectionDecimalPointLimitExceeded: AugmentedError<ApiType>;446 CollectionDecimalPointLimitExceeded: AugmentedError<ApiType>;
435 /**
436 * Collection limit bounds per collection exceeded
437 **/
438 CollectionLimitBoundsExceeded: AugmentedError<ApiType>;
439 /**447 /**
440 * This address is not set as sponsor, use setCollectionSponsor first.448 * This address is not set as sponsor, use setCollectionSponsor first.
441 **/449 **/
444 * Length of items properties must be greater than 0.452 * Length of items properties must be greater than 0.
445 **/453 **/
446 EmptyArgument: AugmentedError<ApiType>;454 EmptyArgument: AugmentedError<ApiType>;
447 /**
448 * Tried to enable permissions which are only permitted to be disabled
449 **/
450 OwnerPermissionsCantBeReverted: AugmentedError<ApiType>;
451 /**455 /**
452 * Generic error456 * Generic error
453 **/457 **/
modifiedtests/src/interfaces/augment-api-events.tsdiffbeforeafterboth
2/* eslint-disable */2/* eslint-disable */
33
4import type { EthereumLog, EvmCoreErrorExitReason } from './ethereum';4import type { EthereumLog, EvmCoreErrorExitReason } from './ethereum';
5import type { PalletCommonAccountBasicCrossAccountIdRepr } from './unique';5import type { PalletCommonAccountBasicCrossAccountIdRepr, UpDataStructsAccessMode } from './unique';
6import type { ApiTypes } from '@polkadot/api/types';6import type { ApiTypes } from '@polkadot/api/types';
7import type { Null, Option, Result, U256, U8aFixed, u128, u32, u64, u8 } from '@polkadot/types';7import type { Null, Option, Result, U256, U8aFixed, u128, u32, u64, u8 } from '@polkadot/types';
8import type { AccountId32, H160, H256 } from '@polkadot/types/interfaces/runtime';8import type { AccountId32, H160, H256 } from '@polkadot/types/interfaces/runtime';
11declare module '@polkadot/api/types/events' {11declare module '@polkadot/api/types/events' {
12 export interface AugmentedEvents<ApiType> {12 export interface AugmentedEvents<ApiType> {
13 balances: {13 balances: {
14 /**14 /**
15 * A balance was set by root. \[who, free, reserved\]15 * A balance was set by root.
16 **/16 **/
17 BalanceSet: AugmentedEvent<ApiType, [AccountId32, u128, u128]>;17 BalanceSet: AugmentedEvent<ApiType, [AccountId32, u128, u128]>;
18 /**18 /**
19 * Some amount was deposited into the account (e.g. for transaction fees). \[who,19 * Some amount was deposited (e.g. for transaction fees).
20 * deposit\]20 **/
21 **/
22 Deposit: AugmentedEvent<ApiType, [AccountId32, u128]>;21 Deposit: AugmentedEvent<ApiType, [AccountId32, u128]>;
23 /**22 /**
24 * An account was removed whose balance was non-zero but below ExistentialDeposit,23 * An account was removed whose balance was non-zero but below ExistentialDeposit,
25 * resulting in an outright loss. \[account, balance\]24 * resulting in an outright loss.
26 **/25 **/
27 DustLost: AugmentedEvent<ApiType, [AccountId32, u128]>;26 DustLost: AugmentedEvent<ApiType, [AccountId32, u128]>;
28 /**27 /**
29 * An account was created with some free balance. \[account, free_balance\]28 * An account was created with some free balance.
30 **/29 **/
31 Endowed: AugmentedEvent<ApiType, [AccountId32, u128]>;30 Endowed: AugmentedEvent<ApiType, [AccountId32, u128]>;
32 /**31 /**
33 * Some balance was reserved (moved from free to reserved). \[who, value\]32 * Some balance was reserved (moved from free to reserved).
34 **/33 **/
35 Reserved: AugmentedEvent<ApiType, [AccountId32, u128]>;34 Reserved: AugmentedEvent<ApiType, [AccountId32, u128]>;
36 /**35 /**
37 * Some balance was moved from the reserve of the first account to the second account.36 * Some balance was moved from the reserve of the first account to the second account.
38 * Final argument indicates the destination balance type.37 * Final argument indicates the destination balance type.
39 * \[from, to, balance, destination_status\]38 **/
40 **/
41 ReserveRepatriated: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128, FrameSupportTokensMiscBalanceStatus]>;39 ReserveRepatriated: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128, FrameSupportTokensMiscBalanceStatus]>;
42 /**40 /**
43 * Some amount was removed from the account (e.g. for misbehavior). \[who,41 * Some amount was removed from the account (e.g. for misbehavior).
44 * amount_slashed\]42 **/
45 **/
46 Slashed: AugmentedEvent<ApiType, [AccountId32, u128]>;43 Slashed: AugmentedEvent<ApiType, [AccountId32, u128]>;
47 /**44 /**
48 * Transfer succeeded. \[from, to, value\]45 * Transfer succeeded.
49 **/46 **/
50 Transfer: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>;47 Transfer: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>;
51 /**48 /**
52 * Some balance was unreserved (moved from reserved to free). \[who, value\]49 * Some balance was unreserved (moved from reserved to free).
53 **/50 **/
54 Unreserved: AugmentedEvent<ApiType, [AccountId32, u128]>;51 Unreserved: AugmentedEvent<ApiType, [AccountId32, u128]>;
55 /**52 /**
56 * Some amount was withdrawn from the account (e.g. for transaction fees). \[who, value\]53 * Some amount was withdrawn from the account (e.g. for transaction fees).
57 **/54 **/
58 Withdraw: AugmentedEvent<ApiType, [AccountId32, u128]>;55 Withdraw: AugmentedEvent<ApiType, [AccountId32, u128]>;
59 /**56 /**
60 * Generic event57 * Generic event
86 * * account_id: Collection owner.83 * * account_id: Collection owner.
87 **/84 **/
88 CollectionCreated: AugmentedEvent<ApiType, [u32, u8, AccountId32]>;85 CollectionCreated: AugmentedEvent<ApiType, [u32, u8, AccountId32]>;
86 /**
87 * New collection was destroyed
88 *
89 * # Arguments
90 *
91 * * collection_id: Globally unique identifier of collection.
92 **/
93 CollectionDestroyed: AugmentedEvent<ApiType, [u32]>;
89 /**94 /**
90 * New item was created.95 * New item was created.
91 * 96 *
287 * \[ origin location, id, expected location \]292 * \[ origin location, id, expected location \]
288 **/293 **/
289 InvalidResponder: AugmentedEvent<ApiType, [XcmV1MultiLocation, u64, Option<XcmV1MultiLocation>]>;294 InvalidResponder: AugmentedEvent<ApiType, [XcmV1MultiLocation, u64, Option<XcmV1MultiLocation>]>;
290 /**295 /**
291 * Expected query response has been received but the expected origin location placed in296 * Expected query response has been received but the expected origin location placed in
292 * storate by this runtime previously cannot be decoded. The query remains registered.297 * storage by this runtime previously cannot be decoded. The query remains registered.
293 * 298 *
294 * This is unexpected (since a location placed in storage in a previously executing299 * This is unexpected (since a location placed in storage in a previously executing
295 * runtime should be readable prior to query timeout) and dangerous since the possibly300 * runtime should be readable prior to query timeout) and dangerous since the possibly
296 * valid response will be dropped. Manual governance intervention is probably going to be301 * valid response will be dropped. Manual governance intervention is probably going to be
297 * needed.302 * needed.
298 * 303 *
299 * \[ origin location, id \]304 * \[ origin location, id \]
300 **/305 **/
301 InvalidResponderVersion: AugmentedEvent<ApiType, [XcmV1MultiLocation, u64]>;306 InvalidResponderVersion: AugmentedEvent<ApiType, [XcmV1MultiLocation, u64]>;
302 /**307 /**
303 * Query response has been received and query is removed. The registered notification has308 * Query response has been received and query is removed. The registered notification has
471 **/476 **/
472 [key: string]: AugmentedEvent<ApiType>;477 [key: string]: AugmentedEvent<ApiType>;
473 };478 };
479 unique: {
480 /**
481 * Address was add to allow list
482 *
483 * # Arguments
484 *
485 * * collection_id: Globally unique collection identifier.
486 *
487 * * user: Address.
488 **/
489 AllowListAddressAdded: AugmentedEvent<ApiType, [u32, PalletCommonAccountBasicCrossAccountIdRepr]>;
490 /**
491 * Address was remove from allow list
492 *
493 * # Arguments
494 *
495 * * collection_id: Globally unique collection identifier.
496 *
497 * * user: Address.
498 **/
499 AllowListAddressRemoved: AugmentedEvent<ApiType, [u32, PalletCommonAccountBasicCrossAccountIdRepr]>;
500 /**
501 * Collection admin was added
502 *
503 * # Arguments
504 *
505 * * collection_id: Globally unique collection identifier.
506 *
507 * * admin: Admin address.
508 **/
509 CollectionAdminAdded: AugmentedEvent<ApiType, [u32, PalletCommonAccountBasicCrossAccountIdRepr]>;
510 /**
511 * Collection admin was removed
512 *
513 * # Arguments
514 *
515 * * collection_id: Globally unique collection identifier.
516 *
517 * * admin: Admin address.
518 **/
519 CollectionAdminRemoved: AugmentedEvent<ApiType, [u32, PalletCommonAccountBasicCrossAccountIdRepr]>;
520 /**
521 * Collection limits was set
522 *
523 * # Arguments
524 *
525 * * collection_id: Globally unique collection identifier.
526 **/
527 CollectionLimitSet: AugmentedEvent<ApiType, [u32]>;
528 /**
529 * Collection owned was change
530 *
531 * # Arguments
532 *
533 * * collection_id: Globally unique collection identifier.
534 *
535 * * owner: New owner address.
536 **/
537 CollectionOwnedChanged: AugmentedEvent<ApiType, [u32, AccountId32]>;
538 /**
539 * Collection sponsor was removed
540 *
541 * # Arguments
542 *
543 * * collection_id: Globally unique collection identifier.
544 **/
545 CollectionSponsorRemoved: AugmentedEvent<ApiType, [u32]>;
546 /**
547 * Collection sponsor was set
548 *
549 * # Arguments
550 *
551 * * collection_id: Globally unique collection identifier.
552 *
553 * * owner: New sponsor address.
554 **/
555 CollectionSponsorSet: AugmentedEvent<ApiType, [u32, AccountId32]>;
556 /**
557 * const on chain schema was set
558 *
559 * # Arguments
560 *
561 * * collection_id: Globally unique collection identifier.
562 **/
563 ConstOnChainSchemaSet: AugmentedEvent<ApiType, [u32]>;
564 /**
565 * Mint permission was set
566 *
567 * # Arguments
568 *
569 * * collection_id: Globally unique collection identifier.
570 **/
571 MintPermissionSet: AugmentedEvent<ApiType, [u32]>;
572 /**
573 * Offchain schema was set
574 *
575 * # Arguments
576 *
577 * * collection_id: Globally unique collection identifier.
578 **/
579 OffchainSchemaSet: AugmentedEvent<ApiType, [u32]>;
580 /**
581 * Public access mode was set
582 *
583 * # Arguments
584 *
585 * * collection_id: Globally unique collection identifier.
586 *
587 * * mode: New access state.
588 **/
589 PublicAccessModeSet: AugmentedEvent<ApiType, [u32, UpDataStructsAccessMode]>;
590 /**
591 * Schema version was set
592 *
593 * # Arguments
594 *
595 * * collection_id: Globally unique collection identifier.
596 **/
597 SchemaVersionSet: AugmentedEvent<ApiType, [u32]>;
598 /**
599 * New sponsor was confirm
600 *
601 * # Arguments
602 *
603 * * collection_id: Globally unique collection identifier.
604 *
605 * * sponsor: New sponsor address.
606 **/
607 SponsorshipConfirmed: AugmentedEvent<ApiType, [u32, AccountId32]>;
608 /**
609 * Variable on chain schema was set
610 *
611 * # Arguments
612 *
613 * * collection_id: Globally unique collection identifier.
614 **/
615 VariableOnChainSchemaSet: AugmentedEvent<ApiType, [u32]>;
616 /**
617 * Generic event
618 **/
619 [key: string]: AugmentedEvent<ApiType>;
620 };
474 vesting: {621 vesting: {
475 /**622 /**
476 * Claimed vesting. \[who, locked_amount\]623 * Claimed vesting. \[who, locked_amount\]
modifiedtests/src/interfaces/augment-api-query.tsdiffbeforeafterboth
162 [key: string]: QueryableStorageEntry<ApiType>;162 [key: string]: QueryableStorageEntry<ApiType>;
163 };163 };
164 inflation: {164 inflation: {
165 /**165 /**
166 * Current block inflation166 * Current inflation for `InflationBlockInterval` number of blocks
167 **/167 **/
168 blockInflation: AugmentedQuery<ApiType, () => Observable<u128>, []> & QueryableStorageEntry<ApiType, []>;168 blockInflation: AugmentedQuery<ApiType, () => Observable<u128>, []> & QueryableStorageEntry<ApiType, []>;
169 /**
170 * Next target (relay) block when inflation will be applied
171 **/
172 nextInflationBlock: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
173 /**
174 * Next target (relay) block when inflation is recalculated
175 **/
176 nextRecalculationBlock: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
177 /**
178 * Relay block when inflation has started
179 **/
180 startBlock: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
169 /**181 /**
170 * starting year total issuance182 * starting year total issuance
171 **/183 **/
modifiedtests/src/interfaces/augment-api-tx.tsdiffbeforeafterboth
33
4import type { EthereumTransactionLegacyTransaction } from './ethereum';4import type { EthereumTransactionLegacyTransaction } from './ethereum';
5import type { CumulusPrimitivesParachainInherentParachainInherentData } from './polkadot';5import type { CumulusPrimitivesParachainInherentParachainInherentData } from './polkadot';
6import type { PalletCommonAccountBasicCrossAccountIdRepr, UpDataStructsAccessMode, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCreateItemData, UpDataStructsMetaUpdatePermission, UpDataStructsSchemaVersion } from './unique';6import type { PalletCommonAccountBasicCrossAccountIdRepr, UpDataStructsAccessMode, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCreateCollectionData, UpDataStructsCreateItemData, UpDataStructsMetaUpdatePermission, UpDataStructsSchemaVersion } from './unique';
7import type { ApiTypes, SubmittableExtrinsic } from '@polkadot/api/types';7import type { ApiTypes, SubmittableExtrinsic } from '@polkadot/api/types';
8import type { Bytes, Compact, Option, U256, Vec, bool, u128, u16, u32, u64 } from '@polkadot/types';8import type { Bytes, Compact, Option, U256, Vec, bool, u128, u16, u32, u64 } from '@polkadot/types';
9import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';9import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
10import type { AccountId32, Call, H160, H256, MultiAddress, Perbill } from '@polkadot/types/interfaces/runtime';10import type { AccountId32, Call, H160, H256, MultiAddress, Perbill } from '@polkadot/types/interfaces/runtime';
11import type { SpCoreChangesTrieChangesTrieConfiguration, XcmV1MultiLocation, XcmV2WeightLimit, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from '@polkadot/types/lookup';11import type { XcmV1MultiLocation, XcmV2WeightLimit, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from '@polkadot/types/lookup';
12import type { AnyNumber, ITuple } from '@polkadot/types/types';12import type { AnyNumber, ITuple } from '@polkadot/types/types';
1313
14declare module '@polkadot/api/types/submittable' {14declare module '@polkadot/api/types/submittable' {
29 * Can only be called by ROOT.29 * Can only be called by ROOT.
30 **/30 **/
31 forceUnreserve: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, u128]>;31 forceUnreserve: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, u128]>;
32 /**32 /**
33 * Set the balances of a given account.33 * Set the balances of a given account.
34 * 34 *
35 * This will alter `FreeBalance` and `ReservedBalance` in storage. it will35 * This will alter `FreeBalance` and `ReservedBalance` in storage. it will
36 * also decrease the total issuance of the system (`TotalIssuance`).36 * also decrease the total issuance of the system (`TotalIssuance`).
37 * If the new free or reserved balance is below the existential deposit,37 * If the new free or reserved balance is below the existential deposit,
38 * it will reset the account nonce (`frame_system::AccountNonce`).38 * it will reset the account nonce (`frame_system::AccountNonce`).
39 * 39 *
40 * The dispatch origin for this call is `root`.40 * The dispatch origin for this call is `root`.
41 * 41 **/
42 * # <weight>
43 * - Independent of the arguments.
44 * - Contains a limited number of reads and writes.
45 * ---------------------
46 * - Base Weight:
47 * - Creating: 27.56 µs
48 * - Killing: 35.11 µs
49 * - DB Weight: 1 Read, 1 Write to `who`
50 * # </weight>
51 **/
52 setBalance: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, newFree: Compact<u128> | AnyNumber | Uint8Array, newReserved: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Compact<u128>, Compact<u128>]>;42 setBalance: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, newFree: Compact<u128> | AnyNumber | Uint8Array, newReserved: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Compact<u128>, Compact<u128>]>;
53 /**43 /**
54 * Transfer some liquid free balance to another account.44 * Transfer some liquid free balance to another account.
55 * 45 *
56 * `transfer` will set the `FreeBalance` of the sender and receiver.46 * `transfer` will set the `FreeBalance` of the sender and receiver.
57 * It will decrease the total issuance of the system by the `TransferFee`.47 * It will decrease the total issuance of the system by the `TransferFee`.
58 * If the sender's account is below the existential deposit as a result48 * If the sender's account is below the existential deposit as a result
59 * of the transfer, the account will be reaped.49 * of the transfer, the account will be reaped.
60 * 50 *
61 * The dispatch origin for this call must be `Signed` by the transactor.51 * The dispatch origin for this call must be `Signed` by the transactor.
62 * 52 *
63 * # <weight>53 * # <weight>
64 * - Dependent on arguments but not critical, given proper implementations for input config54 * - Dependent on arguments but not critical, given proper implementations for input config
65 * types. See related functions below.55 * types. See related functions below.
66 * - It contains a limited number of reads and writes internally and no complex56 * - It contains a limited number of reads and writes internally and no complex
67 * computation.57 * computation.
68 * 58 *
69 * Related functions:59 * Related functions:
70 * 60 *
71 * - `ensure_can_withdraw` is always called internally but has a bounded complexity.61 * - `ensure_can_withdraw` is always called internally but has a bounded complexity.
72 * - Transferring balances to accounts that did not exist before will cause62 * - Transferring balances to accounts that did not exist before will cause
73 * `T::OnNewAccount::on_new_account` to be called.63 * `T::OnNewAccount::on_new_account` to be called.
74 * - Removing enough funds from an account will trigger `T::DustRemoval::on_unbalanced`.64 * - Removing enough funds from an account will trigger `T::DustRemoval::on_unbalanced`.
75 * - `transfer_keep_alive` works the same way as `transfer`, but has an additional check65 * - `transfer_keep_alive` works the same way as `transfer`, but has an additional check
76 * that the transfer will not kill the origin account.66 * that the transfer will not kill the origin account.
77 * ---------------------------------67 * ---------------------------------
78 * - Base Weight: 73.64 µs, worst case scenario (account created, account removed)68 * - Origin account is already in memory, so no DB operations for them.
79 * - DB Weight: 1 Read and 1 Write to destination account
80 * - Origin account is already in memory, so no DB operations for them.69 * # </weight>
81 * # </weight>70 **/
82 **/
83 transfer: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Compact<u128>]>;71 transfer: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Compact<u128>]>;
84 /**72 /**
85 * Transfer the entire transferable balance from the caller account.73 * Transfer the entire transferable balance from the caller account.
101 * #</weight>89 * #</weight>
102 **/90 **/
103 transferAll: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, keepAlive: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, bool]>;91 transferAll: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, keepAlive: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, bool]>;
104 /**92 /**
105 * Same as the [`transfer`] call, but with a check that the transfer will not kill the93 * Same as the [`transfer`] call, but with a check that the transfer will not kill the
106 * origin account.94 * origin account.
107 * 95 *
108 * 99% of the time you want [`transfer`] instead.96 * 99% of the time you want [`transfer`] instead.
109 * 97 *
110 * [`transfer`]: struct.Pallet.html#method.transfer98 * [`transfer`]: struct.Pallet.html#method.transfer
111 * # <weight>99 **/
112 * - Cheaper than transfer because account cannot be killed.
113 * - Base Weight: 51.4 µs
114 * - DB Weight: 1 Read and 1 Write to dest (sender is in overlay already)
115 * #</weight>
116 **/
117 transferKeepAlive: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Compact<u128>]>;100 transferKeepAlive: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Compact<u128>]>;
118 /**101 /**
119 * Generic tx102 * Generic tx
196 [key: string]: SubmittableExtrinsicFunction<ApiType>;179 [key: string]: SubmittableExtrinsicFunction<ApiType>;
197 };180 };
198 inflation: {181 inflation: {
182 /**
183 * This method sets the inflation start date. Can be only called once.
184 * Inflation start block can be backdated and will catch up. The method will create Treasury
185 * account if it does not exist and perform the first inflation deposit.
186 *
187 * # Permissions
188 *
189 * * Root
190 *
191 * # Arguments
192 *
193 * * inflation_start_relay_block: The relay chain block at which inflation should start
194 **/
195 startInflation: AugmentedSubmittable<(inflationStartRelayBlock: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
199 /**196 /**
200 * Generic tx197 * Generic tx
201 **/198 **/
374 * - Weight of derivative `call` execution + 10,000.371 * - Weight of derivative `call` execution + 10,000.
375 * # </weight>372 * # </weight>
376 **/373 **/
377 sudo: AugmentedSubmittable<(call: Call) => SubmittableExtrinsic<ApiType>, [Call]>;374 sudo: AugmentedSubmittable<(call: Call | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call]>;
378 /**375 /**
379 * Authenticates the sudo key and dispatches a function call with `Signed` origin from376 * Authenticates the sudo key and dispatches a function call with `Signed` origin from
380 * a given account.377 * a given account.
388 * - Weight of derivative `call` execution + 10,000.385 * - Weight of derivative `call` execution + 10,000.
389 * # </weight>386 * # </weight>
390 **/387 **/
391 sudoAs: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, ) => SubmittableExtrinsic<ApiType>, [MultiAddress, Call]>;388 sudoAs: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, call: Call | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Call]>;
392 /**389 /**
393 * Authenticates the sudo key and dispatches a function call with `Root` origin.390 * Authenticates the sudo key and dispatches a function call with `Root` origin.
394 * This function does not check the weight of the call, and instead allows the391 * This function does not check the weight of the call, and instead allows the
401 * - The weight of this call is defined by the caller.398 * - The weight of this call is defined by the caller.
402 * # </weight>399 * # </weight>
403 **/400 **/
404 sudoUncheckedWeight: AugmentedSubmittable<(call: Call, weight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, u64]>;401 sudoUncheckedWeight: AugmentedSubmittable<(call: Call | string | Uint8Array, weight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, u64]>;
405 /**402 /**
406 * Generic tx403 * Generic tx
407 **/404 **/
412 * A dispatch that will fill the block weight up to the given ratio.409 * A dispatch that will fill the block weight up to the given ratio.
413 **/410 **/
414 fillBlock: AugmentedSubmittable<(ratio: Perbill | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Perbill]>;411 fillBlock: AugmentedSubmittable<(ratio: Perbill | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Perbill]>;
415 /**412 /**
416 * Kill all storage items with a key that starts with the given prefix.413 * Kill all storage items with a key that starts with the given prefix.
417 * 414 *
418 * **NOTE:** We rely on the Root origin to provide us the number of subkeys under415 * **NOTE:** We rely on the Root origin to provide us the number of subkeys under
419 * the prefix we are removing to accurately calculate the weight of this function.416 * the prefix we are removing to accurately calculate the weight of this function.
420 * 417 **/
421 * # <weight>
422 * - `O(P)` where `P` amount of keys with prefix `prefix`
423 * - `P` storage deletions.
424 * - Base Weight: 0.834 * P µs
425 * - Writes: Number of subkeys + 1
426 * # </weight>
427 **/
428 killPrefix: AugmentedSubmittable<(prefix: Bytes | string | Uint8Array, subkeys: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32]>;418 killPrefix: AugmentedSubmittable<(prefix: Bytes | string | Uint8Array, subkeys: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32]>;
429 /**419 /**
430 * Kill some items from storage.420 * Kill some items from storage.
431 * 421 **/
432 * # <weight>
433 * - `O(IK)` where `I` length of `keys` and `K` length of one key
434 * - `I` storage deletions.
435 * - Base Weight: .378 * i µs
436 * - Writes: Number of items
437 * # </weight>
438 **/
439 killStorage: AugmentedSubmittable<(keys: Vec<Bytes> | (Bytes | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Bytes>]>;422 killStorage: AugmentedSubmittable<(keys: Vec<Bytes> | (Bytes | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Bytes>]>;
440 /**423 /**
441 * Make some on-chain remark.424 * Make some on-chain remark.
454 * # </weight>437 * # </weight>
455 **/438 **/
456 remarkWithEvent: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;439 remarkWithEvent: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
457 /**
458 * Set the new changes trie configuration.
459 *
460 * # <weight>
461 * - `O(1)`
462 * - 1 storage write or delete (codec `O(1)`).
463 * - 1 call to `deposit_log`: Uses `append` API, so O(1)
464 * - Base Weight: 7.218 µs
465 * - DB Weight:
466 * - Writes: Changes Trie, System Digest
467 * # </weight>
468 **/
469 setChangesTrieConfig: AugmentedSubmittable<(changesTrieConfig: Option<SpCoreChangesTrieChangesTrieConfiguration> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<SpCoreChangesTrieChangesTrieConfiguration>]>;
470 /**440 /**
471 * Set the new runtime code.441 * Set the new runtime code.
472 * 442 *
494 * block. # </weight>464 * block. # </weight>
495 **/465 **/
496 setCodeWithoutChecks: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;466 setCodeWithoutChecks: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
497 /**467 /**
498 * Set the number of pages in the WebAssembly environment's heap.468 * Set the number of pages in the WebAssembly environment's heap.
499 * 469 **/
500 * # <weight>
501 * - `O(1)`
502 * - 1 storage write.
503 * - Base Weight: 1.405 µs
504 * - 1 write to HEAP_PAGES
505 * - 1 digest item
506 * # </weight>
507 **/
508 setHeapPages: AugmentedSubmittable<(pages: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u64]>;470 setHeapPages: AugmentedSubmittable<(pages: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u64]>;
509 /**471 /**
510 * Set some items of storage.472 * Set some items of storage.
511 * 473 **/
512 * # <weight>
513 * - `O(I)` where `I` length of `items`
514 * - `I` storage writes (`O(1)`).
515 * - Base Weight: 0.568 * i µs
516 * - Writes: Number of items
517 * # </weight>
518 **/
519 setStorage: AugmentedSubmittable<(items: Vec<ITuple<[Bytes, Bytes]>> | ([Bytes | string | Uint8Array, Bytes | string | Uint8Array])[]) => SubmittableExtrinsic<ApiType>, [Vec<ITuple<[Bytes, Bytes]>>]>;474 setStorage: AugmentedSubmittable<(items: Vec<ITuple<[Bytes, Bytes]>> | ([Bytes | string | Uint8Array, Bytes | string | Uint8Array])[]) => SubmittableExtrinsic<ApiType>, [Vec<ITuple<[Bytes, Bytes]>>]>;
520 /**475 /**
521 * Generic tx476 * Generic tx
717 * * mode: [CollectionMode] collection type and type dependent data.672 * * mode: [CollectionMode] collection type and type dependent data.
718 **/673 **/
719 createCollection: AugmentedSubmittable<(collectionName: Vec<u16> | (u16 | AnyNumber | Uint8Array)[], collectionDescription: Vec<u16> | (u16 | AnyNumber | Uint8Array)[], tokenPrefix: Bytes | string | Uint8Array, mode: UpDataStructsCollectionMode | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<u16>, Vec<u16>, Bytes, UpDataStructsCollectionMode]>;674 createCollection: AugmentedSubmittable<(collectionName: Vec<u16> | (u16 | AnyNumber | Uint8Array)[], collectionDescription: Vec<u16> | (u16 | AnyNumber | Uint8Array)[], tokenPrefix: Bytes | string | Uint8Array, mode: UpDataStructsCollectionMode | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<u16>, Vec<u16>, Bytes, UpDataStructsCollectionMode]>;
675 /**
676 * This method creates a collection
677 *
678 * Prefer it to deprecated [`created_collection`] method
679 **/
680 createCollectionEx: AugmentedSubmittable<(data: UpDataStructsCreateCollectionData | { mode?: any; access?: any; name?: any; description?: any; tokenPrefix?: any; offchainSchema?: any; schemaVersion?: any; pendingSponsor?: any; limits?: any; variableOnChainSchema?: any; constOnChainSchema?: any; metaUpdatePermission?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [UpDataStructsCreateCollectionData]>;
720 /**681 /**
721 * This method creates a concrete instance of NFT Collection created with CreateCollection method.682 * This method creates a concrete instance of NFT Collection created with CreateCollection method.
722 * 683 *
modifiedtests/src/interfaces/augment-types.tsdiffbeforeafterboth
33
4import type { EthereumBlock, EthereumLog, EthereumReceipt, EthereumTransactionLegacyTransaction, EvmCoreErrorExitReason, FpRpcTransactionStatus } from './ethereum';4import type { EthereumBlock, EthereumLog, EthereumReceipt, EthereumTransactionLegacyTransaction, EvmCoreErrorExitReason, FpRpcTransactionStatus } from './ethereum';
5import type { CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmpQueueInboundStatus, CumulusPalletXcmpQueueOutboundStatus, CumulusPalletXcmpQueueQueueConfigData, CumulusPrimitivesParachainInherentParachainInherentData, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV1AbridgedHostConfiguration, PolkadotPrimitivesV1PersistedValidationData } from './polkadot';5import type { CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmpQueueInboundStatus, CumulusPalletXcmpQueueOutboundStatus, CumulusPalletXcmpQueueQueueConfigData, CumulusPrimitivesParachainInherentParachainInherentData, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV1AbridgedHostConfiguration, PolkadotPrimitivesV1PersistedValidationData } from './polkadot';
6import type { PalletCommonAccountBasicCrossAccountIdRepr, PalletNonfungibleItemData, PalletRefungibleItemData, PalletUnqSchedulerCallSpec, PalletUnqSchedulerReleases, PalletUnqSchedulerScheduledV2, UpDataStructsAccessMode, UpDataStructsCollection, UpDataStructsCollectionId, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCollectionStats, UpDataStructsCreateItemData, UpDataStructsMetaUpdatePermission, UpDataStructsSchemaVersion, UpDataStructsSponsorshipState, UpDataStructsTokenId } from './unique';6import type { PalletCommonAccountBasicCrossAccountIdRepr, PalletNonfungibleItemData, PalletRefungibleItemData, PalletUnqSchedulerCallSpec, PalletUnqSchedulerReleases, PalletUnqSchedulerScheduledV2, UpDataStructsAccessMode, UpDataStructsCollection, UpDataStructsCollectionId, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCollectionStats, UpDataStructsCreateCollectionData, UpDataStructsCreateItemData, UpDataStructsMetaUpdatePermission, UpDataStructsSchemaVersion, UpDataStructsSponsorshipState, UpDataStructsTokenId } from './unique';
7import type { BitVec, Bool, Bytes, Data, I128, I16, I256, I32, I64, I8, Json, Null, Raw, StorageKey, Text, Type, U128, U16, U256, U32, U64, U8, USize, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types';7import type { BitVec, Bool, Bytes, Data, I128, I16, I256, I32, I64, I8, Json, Null, Raw, StorageKey, Text, Type, U128, U16, U256, U32, U64, U8, USize, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types';
8import type { AssetApproval, AssetApprovalKey, AssetBalance, AssetDestroyWitness, AssetDetails, AssetMetadata, TAssetBalance, TAssetDepositBalance } from '@polkadot/types/interfaces/assets';8import type { AssetApproval, AssetApprovalKey, AssetBalance, AssetDestroyWitness, AssetDetails, AssetMetadata, TAssetBalance, TAssetDepositBalance } from '@polkadot/types/interfaces/assets';
9import type { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/types/interfaces/attestations';9import type { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/types/interfaces/attestations';
1021 UpDataStructsCollectionLimits: UpDataStructsCollectionLimits;1021 UpDataStructsCollectionLimits: UpDataStructsCollectionLimits;
1022 UpDataStructsCollectionMode: UpDataStructsCollectionMode;1022 UpDataStructsCollectionMode: UpDataStructsCollectionMode;
1023 UpDataStructsCollectionStats: UpDataStructsCollectionStats;1023 UpDataStructsCollectionStats: UpDataStructsCollectionStats;
1024 UpDataStructsCreateCollectionData: UpDataStructsCreateCollectionData;
1024 UpDataStructsCreateItemData: UpDataStructsCreateItemData;1025 UpDataStructsCreateItemData: UpDataStructsCreateItemData;
1025 UpDataStructsMetaUpdatePermission: UpDataStructsMetaUpdatePermission;1026 UpDataStructsMetaUpdatePermission: UpDataStructsMetaUpdatePermission;
1026 UpDataStructsSchemaVersion: UpDataStructsSchemaVersion;1027 UpDataStructsSchemaVersion: UpDataStructsSchemaVersion;
modifiedtests/src/interfaces/unique/definitions.tsdiffbeforeafterboth
67 constOnChainSchema: 'Vec<u8>',67 constOnChainSchema: 'Vec<u8>',
68 metaUpdatePermission: 'UpDataStructsMetaUpdatePermission',68 metaUpdatePermission: 'UpDataStructsMetaUpdatePermission',
69 },69 },
70 UpDataStructsCreateCollectionData: {
71 mode: 'UpDataStructsCollectionMode',
72 access: 'Option<UpDataStructsAccessMode>',
73 name: 'Vec<u16>',
74 description: 'Vec<u16>',
75 tokenPrefix: 'Vec<u8>',
76 offchainSchema: 'Vec<u8>',
77 schemaVersion: 'Option<UpDataStructsSchemaVersion>',
78 pendingSponsor: 'Option<AccountId>',
79 limits: 'Option<UpDataStructsCollectionLimits>',
80 variableOnChainSchema: 'Vec<u8>',
81 constOnChainSchema: 'Vec<u8>',
82 metaUpdatePermission: 'Option<UpDataStructsMetaUpdatePermission>',
83 },
70 UpDataStructsCollectionStats: {84 UpDataStructsCollectionStats: {
71 created: 'u32',85 created: 'u32',
72 destroyed: 'u32',86 destroyed: 'u32',
76 UpDataStructsTokenId: 'u32',90 UpDataStructsTokenId: 'u32',
77 PalletNonfungibleItemData: mkDummy('NftItemData'),91 PalletNonfungibleItemData: mkDummy('NftItemData'),
78 PalletRefungibleItemData: mkDummy('RftItemData'),92 PalletRefungibleItemData: mkDummy('RftItemData'),
79 UpDataStructsCollectionMode: mkDummy('CollectionMode'),93 UpDataStructsCollectionMode: {
94 _enum: {
95 NFT: null,
96 Fungible: 'u32',
97 ReFungible: null,
98 },
99 },
80 UpDataStructsCreateItemData: mkDummy('CreateItemData'),100 UpDataStructsCreateItemData: mkDummy('CreateItemData'),
81 UpDataStructsCollectionLimits: {101 UpDataStructsCollectionLimits: {
82 accountTokenOwnershipLimit: 'Option<u32>',102 accountTokenOwnershipLimit: 'Option<u32>',
101 UpDataStructsAccessMode: {121 UpDataStructsAccessMode: {
102 _enum: ['Normal', 'AllowList'],122 _enum: ['Normal', 'AllowList'],
103 },123 },
104 UpDataStructsSchemaVersion: mkDummy('SchemaVersion'),124 UpDataStructsSchemaVersion: {
125 _enum: ['ImageURL', 'Unique'],
126 },
105127
106 PalletUnqSchedulerScheduledV2: mkDummy('ScheduledV2'),128 PalletUnqSchedulerScheduledV2: mkDummy('ScheduledV2'),
107 PalletUnqSchedulerCallSpec: mkDummy('CallSpec'),129 PalletUnqSchedulerCallSpec: mkDummy('CallSpec'),
modifiedtests/src/interfaces/unique/types.tsdiffbeforeafterboth
77}77}
7878
79/** @name UpDataStructsCollectionMode */79/** @name UpDataStructsCollectionMode */
80export interface UpDataStructsCollectionMode extends Struct {80export interface UpDataStructsCollectionMode extends Enum {
81 readonly isNft: boolean;
82 readonly isFungible: boolean;
81 readonly dummyCollectionMode: u32;83 readonly asFungible: u32;
84 readonly isReFungible: boolean;
82}85}
8386
84/** @name UpDataStructsCollectionStats */87/** @name UpDataStructsCollectionStats */
88 readonly alive: u32;91 readonly alive: u32;
89}92}
93
94/** @name UpDataStructsCreateCollectionData */
95export interface UpDataStructsCreateCollectionData extends Struct {
96 readonly mode: UpDataStructsCollectionMode;
97 readonly access: Option<UpDataStructsAccessMode>;
98 readonly name: Vec<u16>;
99 readonly description: Vec<u16>;
100 readonly tokenPrefix: Bytes;
101 readonly offchainSchema: Bytes;
102 readonly schemaVersion: Option<UpDataStructsSchemaVersion>;
103 readonly pendingSponsor: Option<AccountId>;
104 readonly limits: Option<UpDataStructsCollectionLimits>;
105 readonly variableOnChainSchema: Bytes;
106 readonly constOnChainSchema: Bytes;
107 readonly metaUpdatePermission: Option<UpDataStructsMetaUpdatePermission>;
108}
90109
91/** @name UpDataStructsCreateItemData */110/** @name UpDataStructsCreateItemData */
92export interface UpDataStructsCreateItemData extends Struct {111export interface UpDataStructsCreateItemData extends Struct {
101}120}
102121
103/** @name UpDataStructsSchemaVersion */122/** @name UpDataStructsSchemaVersion */
104export interface UpDataStructsSchemaVersion extends Struct {123export interface UpDataStructsSchemaVersion extends Enum {
105 readonly dummySchemaVersion: u32;124 readonly isImageUrl: boolean;
125 readonly isUnique: boolean;
106}126}
107127
108/** @name UpDataStructsSponsorshipState */128/** @name UpDataStructsSponsorshipState */
modifiedtests/src/substrate/substrate-api.tsdiffbeforeafterboth
95 return TransactionStatus.Fail;95 return TransactionStatus.Fail;
96}96}
97
98export function executeTransaction(api: ApiPromise, sender: IKeyringPair, transaction: SubmittableExtrinsic<'promise'>): Promise<EventRecord[]> {
99 return new Promise(async (res, rej) => {
100 try {
101 await transaction.signAndSend(sender, ({events, status}) => {
102 if (!status.isInBlock && !status.isFinalized) return;
103 for (const {event} of events) {
104 if (api.events.system.ExtrinsicSuccess.is(event)) {
105 res(events);
106 } else if (api.events.system.ExtrinsicFailed.is(event)) {
107 const {data: [error]} = event;
108 if (error.isModule) {
109 const decoded = api.registry.findMetaError(error.asModule);
110 const {method, section} = decoded;
111 rej(new Error(`${section}.${method}`));
112 } else {
113 rej(new Error(error.toString()));
114 }
115 }
116 }
117 });
118 } catch (e) {
119 rej(e);
120 }
121 });
122}
97123
98export function124export function
99submitTransactionAsync(sender: IKeyringPair, transaction: SubmittableExtrinsic<ApiTypes>): Promise<EventRecord[]> {125submitTransactionAsync(sender: IKeyringPair, transaction: SubmittableExtrinsic<ApiTypes>): Promise<EventRecord[]> {
modifiedtests/src/util/helpers.tsdiffbeforeafterboth
283 modeprm = {refungible: null};283 modeprm = {refungible: null};
284 }284 }
285285
286 const tx = api.tx.unique.createCollection(strToUTF16(name), strToUTF16(description), strToUTF16(tokenPrefix), modeprm as any);286 const tx = api.tx.unique.createCollectionEx({name: strToUTF16(name), description: strToUTF16(description), tokenPrefix: strToUTF16(tokenPrefix), mode: modeprm as any});
287 const events = await submitTransactionAsync(alicePrivateKey, tx);287 const events = await submitTransactionAsync(alicePrivateKey, tx);
288 const result = getCreateCollectionResult(events);288 const result = getCreateCollectionResult(events);
289289
329329
330 // Run the CreateCollection transaction330 // Run the CreateCollection transaction
331 const alicePrivateKey = privateKey('//Alice');331 const alicePrivateKey = privateKey('//Alice');
332 const tx = api.tx.unique.createCollection(strToUTF16(name), strToUTF16(description), strToUTF16(tokenPrefix), modeprm as any);332 const tx = api.tx.unique.createCollectionEx({name: strToUTF16(name), description: strToUTF16(description), tokenPrefix: strToUTF16(tokenPrefix), mode: modeprm as any});
333 const events = await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;333 const events = await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;
334 const result = getCreateCollectionResult(events);334 const result = getCreateCollectionResult(events);
335335