difftreelog
Style fix
in: master
5 files changed
pallets/unique/src/sponsorship.rsdiffbeforeafterboth29 CollectionId, FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MetaUpdatePermission,29 CollectionId, FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MetaUpdatePermission,30 NFT_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, TokenId,30 NFT_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, TokenId,31};31};32use sp_runtime::traits::Saturating;32use pallet_common::{CollectionHandle};33use pallet_common::{CollectionHandle};33use pallet_evm::account::CrossAccountId;34use pallet_evm::account::CrossAccountId;3435316 {317 {317 let collection = <CollectionHandle<T>>::try_get(collection_id).ok()?;318 let collection = <CollectionHandle<T>>::try_get(collection_id).ok()?;318319 // preliminary sponsoring correctness check320 match collection.sponsorship {319 let _ = collection.sponsorship.sponsor()?;321 SponsorshipState::Disabled | SponsorshipState::Unconfirmed(_) => return None,322 _ => (),323 }324320325 // sponsor timeout321 // sponsor timeout326 let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;322 let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;343 };339 };344340345 if let Some(last_tx_block) = last_tx_block {341 if let Some(last_tx_block) = last_tx_block {346 let timeout = last_tx_block + limit.into();347 if block_number < timeout {348 return Some((timeout - block_number).into());342 return Some(349 }343 last_tx_block350 return Some(0);344 .saturating_add(limit.into())345 .saturating_sub(block_number)346 .into(),347 );351 }348 }352349353 let token_exists = match collection.mode {350 let token_exists = match collection.mode {tests/src/interfaces/augment-api-rpc.tsdiffbeforeafterboth626 /**626 /**627 * nextSponsored transaction627 * nextSponsored transaction628 **/628 **/629 nextSponsored: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, account: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<u64>>>;629 nextSponsored: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, account: AccountId | string | Uint8Array | { Substrate: any } | { Ethereum: any } | string | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<u64>>>;630 };630 };631 web3: {631 web3: {632 /**632 /**tests/src/interfaces/unique/definitions.tsdiffbeforeafterboth55 collectionById: fun('Get collection by specified id', [collectionParam], 'Option<UpDataStructsCollection>'),55 collectionById: fun('Get collection by specified id', [collectionParam], 'Option<UpDataStructsCollection>'),56 collectionStats: fun('Get collection stats', [], 'UpDataStructsCollectionStats'),56 collectionStats: fun('Get collection stats', [], 'UpDataStructsCollectionStats'),57 allowed: fun('Check if user is allowed to use collection', [collectionParam, crossAccountParam()], 'bool'),57 allowed: fun('Check if user is allowed to use collection', [collectionParam, crossAccountParam()], 'bool'),58 nextSponsored: fun('Check if user is allowed to use collection', [collectionParam, crossAccountParam(), tokenParam], 'Option<u64>'),58 nextSponsored: fun('Get number of blocks when sponsored transaction is available', [collectionParam, crossAccountParam(), tokenParam], 'Option<u64>'),59 effectiveCollectionLimits: fun('Get effective collection limits', [collectionParam], 'Option<UpDataStructsCollectionLimits>'),59 effectiveCollectionLimits: fun('Get effective collection limits', [collectionParam], 'Option<UpDataStructsCollectionLimits>'),60 },60 },61};61};tests/src/nextSponsoring.test.tsdiffbeforeafterbothno changes
tests/src/util/helpers.tsdiffbeforeafterboth608 });608 });609}609}610611export async function getNextSponsored(612 api: ApiPromise,613 collectionId: number,614 account: string | CrossAccountId,615 tokenId: number,616): Promise<number> {617 return Number((await api.rpc.unique.nextSponsored(collectionId, account, tokenId)).unwrapOr(-1));618}610619611export async function toggleContractAllowlistExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, value = true) {620export async function toggleContractAllowlistExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, value = true) {612 await usingApi(async (api) => {621 await usingApi(async (api) => {