difftreelog
Fix total pieces tests
in: master
6 files changed
tests/src/createItem.test.tsdiffbeforeafterboth--- a/tests/src/createItem.test.ts
+++ b/tests/src/createItem.test.ts
@@ -118,8 +118,7 @@
}
const totalPieces = (await api.rpc.unique.tokenData(collectionId, tokenId, [])).pieces;
- expect(totalPieces.isSome).to.be.true;
- expect(totalPieces.unwrap().toBigInt()).to.be.eq(amountPieces);
+ expect(totalPieces.toBigInt()).to.be.eq(amountPieces);
});
});
@@ -143,8 +142,7 @@
}
const totalPieces = (await api.rpc.unique.tokenData(collectionId, tokenId, [])).pieces;
- expect(totalPieces.isSome).to.be.true;
- expect(totalPieces.unwrap().toBigInt()).to.be.eq(amountPieces);
+ expect(totalPieces.toBigInt()).to.be.eq(amountPieces);
});
});
@@ -169,8 +167,7 @@
}
const totalPieces = (await api.rpc.unique.tokenData(collectionId, tokenId, [])).pieces;
- expect(totalPieces.isSome).to.be.true;
- expect(totalPieces.unwrap().toBigInt()).to.be.eq(amountPieces);
+ expect(totalPieces.toBigInt()).to.be.eq(amountPieces);
});
});
});
@@ -255,7 +252,7 @@
const invalidTokenId = 1000_000;
expect((await api.rpc.unique.totalPieces(collectionId, invalidTokenId)).isNone).to.be.true;
- expect((await api.rpc.unique.tokenData(collectionId, invalidTokenId, [])).pieces.isNone).to.be.true;
+ expect((await api.rpc.unique.tokenData(collectionId, invalidTokenId, [])).pieces.toBigInt()).to.be.eq(0n);
});
});
@@ -266,7 +263,7 @@
const invalidTokenId = 1000_000;
expect((await api.rpc.unique.totalPieces(collectionId, invalidTokenId)).isNone).to.be.true;
- expect((await api.rpc.unique.tokenData(collectionId, invalidTokenId, [])).pieces.isNone).to.be.true;
+ expect((await api.rpc.unique.tokenData(collectionId, invalidTokenId, [])).pieces.toBigInt()).to.be.eq(0n);
});
});
@@ -277,7 +274,7 @@
const invalidTokenId = 1000_000;
expect((await api.rpc.unique.totalPieces(collectionId, invalidTokenId)).isNone).to.be.true;
- expect((await api.rpc.unique.tokenData(collectionId, invalidTokenId, [])).pieces.isNone).to.be.true;
+ expect((await api.rpc.unique.tokenData(collectionId, invalidTokenId, [])).pieces.toBigInt()).to.be.eq(0n);
});
});
});
tests/src/interfaces/augment-api-events.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-events.ts
+++ b/tests/src/interfaces/augment-api-events.ts
@@ -13,45 +13,45 @@
/**
* A balance was set by root.
**/
- BalanceSet: AugmentedEvent<ApiType, [AccountId32, u128, u128]>;
+ BalanceSet: AugmentedEvent<ApiType, [who: AccountId32, free: u128, reserved: u128], { who: AccountId32, free: u128, reserved: u128 }>;
/**
* Some amount was deposited (e.g. for transaction fees).
**/
- Deposit: AugmentedEvent<ApiType, [AccountId32, u128]>;
+ Deposit: AugmentedEvent<ApiType, [who: AccountId32, amount: u128], { who: AccountId32, amount: u128 }>;
/**
* An account was removed whose balance was non-zero but below ExistentialDeposit,
* resulting in an outright loss.
**/
- DustLost: AugmentedEvent<ApiType, [AccountId32, u128]>;
+ DustLost: AugmentedEvent<ApiType, [account: AccountId32, amount: u128], { account: AccountId32, amount: u128 }>;
/**
* An account was created with some free balance.
**/
- Endowed: AugmentedEvent<ApiType, [AccountId32, u128]>;
+ Endowed: AugmentedEvent<ApiType, [account: AccountId32, freeBalance: u128], { account: AccountId32, freeBalance: u128 }>;
/**
* Some balance was reserved (moved from free to reserved).
**/
- Reserved: AugmentedEvent<ApiType, [AccountId32, u128]>;
+ Reserved: AugmentedEvent<ApiType, [who: AccountId32, amount: u128], { who: AccountId32, amount: u128 }>;
/**
* Some balance was moved from the reserve of the first account to the second account.
* Final argument indicates the destination balance type.
**/
- ReserveRepatriated: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128, FrameSupportTokensMiscBalanceStatus]>;
+ ReserveRepatriated: AugmentedEvent<ApiType, [from: AccountId32, to: AccountId32, amount: u128, destinationStatus: FrameSupportTokensMiscBalanceStatus], { from: AccountId32, to: AccountId32, amount: u128, destinationStatus: FrameSupportTokensMiscBalanceStatus }>;
/**
* Some amount was removed from the account (e.g. for misbehavior).
**/
- Slashed: AugmentedEvent<ApiType, [AccountId32, u128]>;
+ Slashed: AugmentedEvent<ApiType, [who: AccountId32, amount: u128], { who: AccountId32, amount: u128 }>;
/**
* Transfer succeeded.
**/
- Transfer: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>;
+ Transfer: AugmentedEvent<ApiType, [from: AccountId32, to: AccountId32, amount: u128], { from: AccountId32, to: AccountId32, amount: u128 }>;
/**
* Some balance was unreserved (moved from reserved to free).
**/
- Unreserved: AugmentedEvent<ApiType, [AccountId32, u128]>;
+ Unreserved: AugmentedEvent<ApiType, [who: AccountId32, amount: u128], { who: AccountId32, amount: u128 }>;
/**
* Some amount was withdrawn from the account (e.g. for transaction fees).
**/
- Withdraw: AugmentedEvent<ApiType, [AccountId32, u128]>;
+ Withdraw: AugmentedEvent<ApiType, [who: AccountId32, amount: u128], { who: AccountId32, amount: u128 }>;
/**
* Generic event
**/
@@ -167,27 +167,27 @@
/**
* Downward message executed with the given outcome.
**/
- ExecutedDownward: AugmentedEvent<ApiType, [U8aFixed, XcmV2TraitsOutcome]>;
+ ExecutedDownward: AugmentedEvent<ApiType, [messageId: U8aFixed, outcome: XcmV2TraitsOutcome], { messageId: U8aFixed, outcome: XcmV2TraitsOutcome }>;
/**
* Downward message is invalid XCM.
**/
- InvalidFormat: AugmentedEvent<ApiType, [U8aFixed]>;
+ InvalidFormat: AugmentedEvent<ApiType, [messageId: U8aFixed], { messageId: U8aFixed }>;
/**
* Downward message is overweight and was placed in the overweight queue.
**/
- OverweightEnqueued: AugmentedEvent<ApiType, [U8aFixed, u64, u64]>;
+ OverweightEnqueued: AugmentedEvent<ApiType, [messageId: U8aFixed, overweightIndex: u64, requiredWeight: u64], { messageId: U8aFixed, overweightIndex: u64, requiredWeight: u64 }>;
/**
* Downward message from the overweight queue was executed.
**/
- OverweightServiced: AugmentedEvent<ApiType, [u64, u64]>;
+ OverweightServiced: AugmentedEvent<ApiType, [overweightIndex: u64, weightUsed: u64], { overweightIndex: u64, weightUsed: u64 }>;
/**
* Downward message is unsupported version of XCM.
**/
- UnsupportedVersion: AugmentedEvent<ApiType, [U8aFixed]>;
+ UnsupportedVersion: AugmentedEvent<ApiType, [messageId: U8aFixed], { messageId: U8aFixed }>;
/**
* The weight limit for handling downward messages was reached.
**/
- WeightExhausted: AugmentedEvent<ApiType, [U8aFixed, u64, u64]>;
+ WeightExhausted: AugmentedEvent<ApiType, [messageId: U8aFixed, remainingWeight: u64, requiredWeight: u64], { messageId: U8aFixed, remainingWeight: u64, requiredWeight: u64 }>;
/**
* Generic event
**/
@@ -241,19 +241,19 @@
/**
* Downward messages were processed using the given weight.
**/
- DownwardMessagesProcessed: AugmentedEvent<ApiType, [u64, H256]>;
+ DownwardMessagesProcessed: AugmentedEvent<ApiType, [weightUsed: u64, dmqHead: H256], { weightUsed: u64, dmqHead: H256 }>;
/**
* Some downward messages have been received and will be processed.
**/
- DownwardMessagesReceived: AugmentedEvent<ApiType, [u32]>;
+ DownwardMessagesReceived: AugmentedEvent<ApiType, [count: u32], { count: u32 }>;
/**
* An upgrade has been authorized.
**/
- UpgradeAuthorized: AugmentedEvent<ApiType, [H256]>;
+ UpgradeAuthorized: AugmentedEvent<ApiType, [codeHash: H256], { codeHash: H256 }>;
/**
* The validation function was applied as of the contained relay chain block number.
**/
- ValidationFunctionApplied: AugmentedEvent<ApiType, [u32]>;
+ ValidationFunctionApplied: AugmentedEvent<ApiType, [relayChainBlockNum: u32], { relayChainBlockNum: u32 }>;
/**
* The relay-chain aborted the upgrade process.
**/
@@ -390,29 +390,29 @@
[key: string]: AugmentedEvent<ApiType>;
};
rmrkCore: {
- CollectionCreated: AugmentedEvent<ApiType, [AccountId32, u32]>;
- CollectionDestroyed: AugmentedEvent<ApiType, [AccountId32, u32]>;
- CollectionLocked: AugmentedEvent<ApiType, [AccountId32, u32]>;
- IssuerChanged: AugmentedEvent<ApiType, [AccountId32, AccountId32, u32]>;
- NFTAccepted: AugmentedEvent<ApiType, [AccountId32, RmrkTraitsNftAccountIdOrCollectionNftTuple, u32, u32]>;
- NFTBurned: AugmentedEvent<ApiType, [AccountId32, u32]>;
- NftMinted: AugmentedEvent<ApiType, [AccountId32, u32, u32]>;
- NFTRejected: AugmentedEvent<ApiType, [AccountId32, u32, u32]>;
- NFTSent: AugmentedEvent<ApiType, [AccountId32, RmrkTraitsNftAccountIdOrCollectionNftTuple, u32, u32, bool]>;
- PrioritySet: AugmentedEvent<ApiType, [u32, u32]>;
- PropertySet: AugmentedEvent<ApiType, [u32, Option<u32>, Bytes, Bytes]>;
- ResourceAccepted: AugmentedEvent<ApiType, [u32, u32]>;
- ResourceAdded: AugmentedEvent<ApiType, [u32, u32]>;
- ResourceRemoval: AugmentedEvent<ApiType, [u32, u32]>;
- ResourceRemovalAccepted: AugmentedEvent<ApiType, [u32, u32]>;
+ CollectionCreated: AugmentedEvent<ApiType, [issuer: AccountId32, collectionId: u32], { issuer: AccountId32, collectionId: u32 }>;
+ CollectionDestroyed: AugmentedEvent<ApiType, [issuer: AccountId32, collectionId: u32], { issuer: AccountId32, collectionId: u32 }>;
+ CollectionLocked: AugmentedEvent<ApiType, [issuer: AccountId32, collectionId: u32], { issuer: AccountId32, collectionId: u32 }>;
+ IssuerChanged: AugmentedEvent<ApiType, [oldIssuer: AccountId32, newIssuer: AccountId32, collectionId: u32], { oldIssuer: AccountId32, newIssuer: AccountId32, collectionId: u32 }>;
+ NFTAccepted: AugmentedEvent<ApiType, [sender: AccountId32, recipient: RmrkTraitsNftAccountIdOrCollectionNftTuple, collectionId: u32, nftId: u32], { sender: AccountId32, recipient: RmrkTraitsNftAccountIdOrCollectionNftTuple, collectionId: u32, nftId: u32 }>;
+ NFTBurned: AugmentedEvent<ApiType, [owner: AccountId32, nftId: u32], { owner: AccountId32, nftId: u32 }>;
+ NftMinted: AugmentedEvent<ApiType, [owner: AccountId32, collectionId: u32, nftId: u32], { owner: AccountId32, collectionId: u32, nftId: u32 }>;
+ NFTRejected: AugmentedEvent<ApiType, [sender: AccountId32, collectionId: u32, nftId: u32], { sender: AccountId32, collectionId: u32, nftId: u32 }>;
+ NFTSent: AugmentedEvent<ApiType, [sender: AccountId32, recipient: RmrkTraitsNftAccountIdOrCollectionNftTuple, collectionId: u32, nftId: u32, approvalRequired: bool], { sender: AccountId32, recipient: RmrkTraitsNftAccountIdOrCollectionNftTuple, collectionId: u32, nftId: u32, approvalRequired: bool }>;
+ PrioritySet: AugmentedEvent<ApiType, [collectionId: u32, nftId: u32], { collectionId: u32, nftId: u32 }>;
+ PropertySet: AugmentedEvent<ApiType, [collectionId: u32, maybeNftId: Option<u32>, key: Bytes, value: Bytes], { collectionId: u32, maybeNftId: Option<u32>, key: Bytes, value: Bytes }>;
+ ResourceAccepted: AugmentedEvent<ApiType, [nftId: u32, resourceId: u32], { nftId: u32, resourceId: u32 }>;
+ ResourceAdded: AugmentedEvent<ApiType, [nftId: u32, resourceId: u32], { nftId: u32, resourceId: u32 }>;
+ ResourceRemoval: AugmentedEvent<ApiType, [nftId: u32, resourceId: u32], { nftId: u32, resourceId: u32 }>;
+ ResourceRemovalAccepted: AugmentedEvent<ApiType, [nftId: u32, resourceId: u32], { nftId: u32, resourceId: u32 }>;
/**
* Generic event
**/
[key: string]: AugmentedEvent<ApiType>;
};
rmrkEquip: {
- BaseCreated: AugmentedEvent<ApiType, [AccountId32, u32]>;
- EquippablesUpdated: AugmentedEvent<ApiType, [u32, u32]>;
+ BaseCreated: AugmentedEvent<ApiType, [issuer: AccountId32, baseId: u32], { issuer: AccountId32, baseId: u32 }>;
+ EquippablesUpdated: AugmentedEvent<ApiType, [baseId: u32, slotId: u32], { baseId: u32, slotId: u32 }>;
/**
* Generic event
**/
@@ -422,19 +422,19 @@
/**
* The call for the provided hash was not found so the task has been aborted.
**/
- CallLookupFailed: AugmentedEvent<ApiType, [ITuple<[u32, u32]>, Option<U8aFixed>, FrameSupportScheduleLookupError]>;
+ CallLookupFailed: AugmentedEvent<ApiType, [task: ITuple<[u32, u32]>, id: Option<U8aFixed>, error: FrameSupportScheduleLookupError], { task: ITuple<[u32, u32]>, id: Option<U8aFixed>, error: FrameSupportScheduleLookupError }>;
/**
* Canceled some task.
**/
- Canceled: AugmentedEvent<ApiType, [u32, u32]>;
+ Canceled: AugmentedEvent<ApiType, [when: u32, index: u32], { when: u32, index: u32 }>;
/**
* Dispatched some task.
**/
- Dispatched: AugmentedEvent<ApiType, [ITuple<[u32, u32]>, Option<U8aFixed>, Result<Null, SpRuntimeDispatchError>]>;
+ Dispatched: AugmentedEvent<ApiType, [task: ITuple<[u32, u32]>, id: Option<U8aFixed>, result: Result<Null, SpRuntimeDispatchError>], { task: ITuple<[u32, u32]>, id: Option<U8aFixed>, result: Result<Null, SpRuntimeDispatchError> }>;
/**
* Scheduled some task.
**/
- Scheduled: AugmentedEvent<ApiType, [u32, u32]>;
+ Scheduled: AugmentedEvent<ApiType, [when: u32, index: u32], { when: u32, index: u32 }>;
/**
* Generic event
**/
@@ -454,15 +454,15 @@
/**
* The \[sudoer\] just switched identity; the old key is supplied if one existed.
**/
- KeyChanged: AugmentedEvent<ApiType, [Option<AccountId32>]>;
+ KeyChanged: AugmentedEvent<ApiType, [oldSudoer: Option<AccountId32>], { oldSudoer: Option<AccountId32> }>;
/**
* A sudo just took place. \[result\]
**/
- Sudid: AugmentedEvent<ApiType, [Result<Null, SpRuntimeDispatchError>]>;
+ Sudid: AugmentedEvent<ApiType, [sudoResult: Result<Null, SpRuntimeDispatchError>], { sudoResult: Result<Null, SpRuntimeDispatchError> }>;
/**
* A sudo just took place. \[result\]
**/
- SudoAsDone: AugmentedEvent<ApiType, [Result<Null, SpRuntimeDispatchError>]>;
+ SudoAsDone: AugmentedEvent<ApiType, [sudoResult: Result<Null, SpRuntimeDispatchError>], { sudoResult: Result<Null, SpRuntimeDispatchError> }>;
/**
* Generic event
**/
@@ -476,23 +476,23 @@
/**
* An extrinsic failed.
**/
- ExtrinsicFailed: AugmentedEvent<ApiType, [SpRuntimeDispatchError, FrameSupportWeightsDispatchInfo]>;
+ ExtrinsicFailed: AugmentedEvent<ApiType, [dispatchError: SpRuntimeDispatchError, dispatchInfo: FrameSupportWeightsDispatchInfo], { dispatchError: SpRuntimeDispatchError, dispatchInfo: FrameSupportWeightsDispatchInfo }>;
/**
* An extrinsic completed successfully.
**/
- ExtrinsicSuccess: AugmentedEvent<ApiType, [FrameSupportWeightsDispatchInfo]>;
+ ExtrinsicSuccess: AugmentedEvent<ApiType, [dispatchInfo: FrameSupportWeightsDispatchInfo], { dispatchInfo: FrameSupportWeightsDispatchInfo }>;
/**
* An account was reaped.
**/
- KilledAccount: AugmentedEvent<ApiType, [AccountId32]>;
+ KilledAccount: AugmentedEvent<ApiType, [account: AccountId32], { account: AccountId32 }>;
/**
* A new account was created.
**/
- NewAccount: AugmentedEvent<ApiType, [AccountId32]>;
+ NewAccount: AugmentedEvent<ApiType, [account: AccountId32], { account: AccountId32 }>;
/**
* On on-chain remark happened.
**/
- Remarked: AugmentedEvent<ApiType, [AccountId32, H256]>;
+ Remarked: AugmentedEvent<ApiType, [sender: AccountId32, hash_: H256], { sender: AccountId32, hash_: H256 }>;
/**
* Generic event
**/
@@ -502,31 +502,31 @@
/**
* Some funds have been allocated.
**/
- Awarded: AugmentedEvent<ApiType, [u32, u128, AccountId32]>;
+ Awarded: AugmentedEvent<ApiType, [proposalIndex: u32, award: u128, account: AccountId32], { proposalIndex: u32, award: u128, account: AccountId32 }>;
/**
* Some of our funds have been burnt.
**/
- Burnt: AugmentedEvent<ApiType, [u128]>;
+ Burnt: AugmentedEvent<ApiType, [burntFunds: u128], { burntFunds: u128 }>;
/**
* Some funds have been deposited.
**/
- Deposit: AugmentedEvent<ApiType, [u128]>;
+ Deposit: AugmentedEvent<ApiType, [value: u128], { value: u128 }>;
/**
* New proposal.
**/
- Proposed: AugmentedEvent<ApiType, [u32]>;
+ Proposed: AugmentedEvent<ApiType, [proposalIndex: u32], { proposalIndex: u32 }>;
/**
* A proposal was rejected; funds were slashed.
**/
- Rejected: AugmentedEvent<ApiType, [u32, u128]>;
+ Rejected: AugmentedEvent<ApiType, [proposalIndex: u32, slashed: u128], { proposalIndex: u32, slashed: u128 }>;
/**
* Spending has finished; this is the amount that rolls over until next spend.
**/
- Rollover: AugmentedEvent<ApiType, [u128]>;
+ Rollover: AugmentedEvent<ApiType, [rolloverBalance: u128], { rolloverBalance: u128 }>;
/**
* We have ended a spend period and will now allocate funds.
**/
- Spending: AugmentedEvent<ApiType, [u128]>;
+ Spending: AugmentedEvent<ApiType, [budgetRemaining: u128], { budgetRemaining: u128 }>;
/**
* Generic event
**/
@@ -629,15 +629,15 @@
/**
* Claimed vesting.
**/
- Claimed: AugmentedEvent<ApiType, [AccountId32, u128]>;
+ Claimed: AugmentedEvent<ApiType, [who: AccountId32, amount: u128], { who: AccountId32, amount: u128 }>;
/**
* Added new vesting schedule.
**/
- VestingScheduleAdded: AugmentedEvent<ApiType, [AccountId32, AccountId32, OrmlVestingVestingSchedule]>;
+ VestingScheduleAdded: AugmentedEvent<ApiType, [from: AccountId32, to: AccountId32, vestingSchedule: OrmlVestingVestingSchedule], { from: AccountId32, to: AccountId32, vestingSchedule: OrmlVestingVestingSchedule }>;
/**
* Updated vesting schedules.
**/
- VestingSchedulesUpdated: AugmentedEvent<ApiType, [AccountId32]>;
+ VestingSchedulesUpdated: AugmentedEvent<ApiType, [who: AccountId32], { who: AccountId32 }>;
/**
* Generic event
**/
tests/src/interfaces/augment-api-rpc.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-rpc.ts
+++ b/tests/src/interfaces/augment-api-rpc.ts
@@ -717,6 +717,10 @@
**/
topmostTokenOwner: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<PalletEvmAccountBasicCrossAccountIdRepr>>>;
/**
+ * Get total pieces of token
+ **/
+ totalPieces: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<u128>>>;
+ /**
* Get amount of unique collection tokens
**/
totalSupply: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u32>>;
tests/src/interfaces/default/types.tsdiffbeforeafterboth--- a/tests/src/interfaces/default/types.ts
+++ b/tests/src/interfaces/default/types.ts
@@ -2561,6 +2561,7 @@
export interface UpDataStructsTokenData extends Struct {
readonly properties: Vec<UpDataStructsProperty>;
readonly owner: Option<PalletEvmAccountBasicCrossAccountIdRepr>;
+ readonly pieces: u128;
}
/** @name XcmDoubleEncoded */
tests/src/interfaces/lookup.tsdiffbeforeafterboth2859 **/2859 **/2860 UpDataStructsTokenData: {2860 UpDataStructsTokenData: {2861 properties: 'Vec<UpDataStructsProperty>',2861 properties: 'Vec<UpDataStructsProperty>',2862 owner: 'Option<PalletEvmAccountBasicCrossAccountIdRepr>'2862 owner: 'Option<PalletEvmAccountBasicCrossAccountIdRepr>',2863 pieces: 'u128'2863 },2864 },2864 /**2865 /**2865 * Lookup376: up_data_structs::RpcCollection<sp_core::crypto::AccountId32>2866 * Lookup376: up_data_structs::RpcCollection<sp_core::crypto::AccountId32>tests/src/interfaces/types-lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/types-lookup.ts
+++ b/tests/src/interfaces/types-lookup.ts
@@ -2977,6 +2977,7 @@
export interface UpDataStructsTokenData extends Struct {
readonly properties: Vec<UpDataStructsProperty>;
readonly owner: Option<PalletEvmAccountBasicCrossAccountIdRepr>;
+ readonly pieces: u128;
}
/** @name UpDataStructsRpcCollection (376) */