Skip to content

Commit

Permalink
Merge pull request #12 from PolymeshAssociation/master-into-beta
Browse files Browse the repository at this point in the history
Master into beta
  • Loading branch information
polymath-eric authored Mar 11, 2024
2 parents fb8238c + a898d98 commit 8289e4f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
5 changes: 5 additions & 0 deletions src/polkadot/augment-api-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2274,6 +2274,11 @@ declare module '@polkadot/api-base/types/events' {
* Instruction failed execution (did, instruction_id)
**/
InstructionFailed: AugmentedEvent<ApiType, [PolymeshPrimitivesIdentityId, u64]>;
/**
* An instruction with mediators has been created.
* Parameters: [`InstructionId`] of the instruction and the [`IdentityId`] of all mediators.
**/
InstructionMediators: AugmentedEvent<ApiType, [u64, BTreeSet<PolymeshPrimitivesIdentityId>]>;
/**
* An instruction has been rejected (did, instruction_id)
**/
Expand Down
11 changes: 6 additions & 5 deletions src/polkadot/lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1647,6 +1647,7 @@ export default {
'(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityIdPortfolioId,u64)',
MediatorAffirmationReceived: '(PolymeshPrimitivesIdentityId,u64,Option<u64>)',
MediatorAffirmationWithdrawn: '(PolymeshPrimitivesIdentityId,u64)',
InstructionMediators: '(u64,BTreeSet<PolymeshPrimitivesIdentityId>)',
},
},
/**
Expand Down Expand Up @@ -4954,21 +4955,21 @@ export default {
_enum: ['RequireSudo'],
},
/**
* Lookup666: pallet_asset::TickerRegistration<U>
* Lookup666: pallet_asset::types::TickerRegistration<T>
**/
PalletAssetTickerRegistration: {
owner: 'PolymeshPrimitivesIdentityId',
expiry: 'Option<u64>',
},
/**
* Lookup667: pallet_asset::TickerRegistrationConfig<U>
* Lookup667: pallet_asset::types::TickerRegistrationConfig<T>
**/
PalletAssetTickerRegistrationConfig: {
maxTickerLength: 'u8',
registrationLength: 'Option<u64>',
},
/**
* Lookup668: pallet_asset::SecurityToken
* Lookup668: pallet_asset::types::SecurityToken
**/
PalletAssetSecurityToken: {
totalSupply: 'u128',
Expand All @@ -4977,13 +4978,13 @@ export default {
assetType: 'PolymeshPrimitivesAssetAssetType',
},
/**
* Lookup672: pallet_asset::AssetOwnershipRelation
* Lookup672: pallet_asset::types::AssetOwnershipRelation
**/
PalletAssetAssetOwnershipRelation: {
_enum: ['NotOwned', 'TickerOwned', 'AssetOwned'],
},
/**
* Lookup678: pallet_asset::Error<T>
* Lookup678: pallet_asset::error::Error<T>
**/
PalletAssetError: {
_enum: [
Expand Down
5 changes: 4 additions & 1 deletion src/polkadot/types-lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2798,6 +2798,8 @@ declare module '@polkadot/types/lookup' {
>;
readonly isMediatorAffirmationWithdrawn: boolean;
readonly asMediatorAffirmationWithdrawn: ITuple<[PolymeshPrimitivesIdentityId, u64]>;
readonly isInstructionMediators: boolean;
readonly asInstructionMediators: ITuple<[u64, BTreeSet<PolymeshPrimitivesIdentityId>]>;
readonly type:
| 'VenueCreated'
| 'VenueDetailsUpdated'
Expand All @@ -2821,7 +2823,8 @@ declare module '@polkadot/types/lookup' {
| 'FailedToExecuteInstruction'
| 'InstructionAutomaticallyAffirmed'
| 'MediatorAffirmationReceived'
| 'MediatorAffirmationWithdrawn';
| 'MediatorAffirmationWithdrawn'
| 'InstructionMediators';
}

/** @name PolymeshPrimitivesSettlementVenueType (249) */
Expand Down
1 change: 1 addition & 0 deletions src/utils/__tests__/conversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3691,6 +3691,7 @@ describe('nftDispatchErrorToTransferError', () => {
NFTNotFound: { is: jest.fn().mockReturnValue(false) },
InvalidNFTTransferNFTNotOwned: { is: jest.fn().mockReturnValue(false) },
InvalidNFTTransferSamePortfolio: { is: jest.fn().mockReturnValue(false) },
InvalidNFTTransferNFTIsLocked: { is: jest.fn().mockReturnValue(false) },
} as unknown as DecoratedErrors<'promise'>['nft'];

const mockError = dsMockUtils.createMockDispatchResult({
Expand Down
7 changes: 6 additions & 1 deletion src/utils/conversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3263,11 +3263,16 @@ export function nftDispatchErrorToTransferError(
NFTNotFound: notFoundErr,
InvalidNFTTransferNFTNotOwned: notOwnedErr,
InvalidNFTTransferSamePortfolio: samePortfolioErr,
InvalidNFTTransferNFTIsLocked: nftLockedErr,
} = context.polymeshApi.errors.nft;

if (error.isModule) {
const moduleErr = error.asModule;
if ([notOwnedErr, notFoundErr, insufficientErr, duplicateErr].some(err => err.is(moduleErr))) {
if (
[notOwnedErr, notFoundErr, insufficientErr, duplicateErr, nftLockedErr].some(err =>
err.is(moduleErr)
)
) {
return TransferError.InsufficientPortfolioBalance;
} else if (frozenErr.is(moduleErr)) {
return TransferError.TransfersFrozen;
Expand Down

0 comments on commit 8289e4f

Please sign in to comment.