diff --git a/package.json b/package.json index 8016a35..97fac59 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "polymesh-subquery", - "version": "16.0.1", + "version": "16.1.0", "author": "Polymesh Association", "license": "Apache-2.0", "description": "A Polymesh Chain Indexer, providing a GraphQL interface", @@ -31,7 +31,7 @@ "dependencies": { "@polkadot/api": "^11.2.1", "@polkadot/types-support": "^11.2.1", - "@polymeshassociation/polymesh-types": "^5.9.0", + "@polymeshassociation/polymesh-types": "^5.14.0", "@subql/cli": "4.14.0", "@subql/types": "3.6.1", "@subql/types-core": "^0.7.0", diff --git a/project.ts b/project.ts index 06db161..98c6352 100644 --- a/project.ts +++ b/project.ts @@ -46,6 +46,7 @@ const filters = { AssetMediatorsAdded: ['handleAssetMediatorsAdded'], AssetMediatorsRemoved: ['handleAssetMediatorsRemoved'], TickerLinkedToAsset: ['handleTickerLinkedToAsset'], + TickerUnlinkedFromAsset: ['handleTickerUnlinkedFromAsset'], }, balances: { AccountBalanceBurned: ['handleBalanceBurned'], diff --git a/schema.graphql b/schema.graphql index 9b9c4d6..1002730 100644 --- a/schema.graphql +++ b/schema.graphql @@ -357,6 +357,7 @@ enum EventIdEnum { AssetMediatorsAdded SetAssetMediators # This can be removed, `AssetMediatorsAdded` is emitted instead AssetMediatorsRemoved + TickerUnlinkedFromAsset ## capitaldistribution ## Created @@ -869,6 +870,7 @@ enum CallIdEnum { join_identity reject remove_admin_via_admin + remove_admin remove_multisig_signers_via_admin remove_multisig_signers remove_payer @@ -1027,6 +1029,7 @@ enum CallIdEnum { add_mandatory_mediators remove_mandatory_mediators link_ticker_to_asset_id + unlink_ticker_from_asset_id ## capitaldistribution ## distribute diff --git a/src/mappings/entities/assets/mapAsset.ts b/src/mappings/entities/assets/mapAsset.ts index 9321ccc..0319241 100644 --- a/src/mappings/entities/assets/mapAsset.ts +++ b/src/mappings/entities/assets/mapAsset.ts @@ -188,7 +188,7 @@ export const handleAssetCreated = async (event: SubstrateEvent): Promise = } await Asset.create({ - id: getAssetId(rawAssetId, block), + id: await getAssetId(rawAssetId, block), ticker, name, type: assetType, @@ -212,7 +212,7 @@ export const handleAssetRenamed = async (event: SubstrateEvent): Promise = const { params, blockId, block } = extractArgs(event); const [, rawAssetId, rawName] = params; - const assetId = getAssetId(rawAssetId, block); + const assetId = await getAssetId(rawAssetId, block); const asset = await getAsset(assetId); asset.name = bytesToString(rawName); @@ -225,7 +225,7 @@ export const handleFundingRoundSet = async (event: SubstrateEvent): Promise const { params, blockId, block } = extractArgs(event); const [, rawAssetId, rawDocId, rawDoc] = params; - const assetId = getAssetId(rawAssetId, block); + const assetId = await getAssetId(rawAssetId, block); const documentId = getNumberValue(rawDocId); const docDetails = getDocValue(rawDoc); @@ -259,7 +259,7 @@ export const handleDocumentRemoved = async (event: SubstrateEvent): Promise => { params; const issuerDid = getTextValue(rawBeneficiaryDid); - const assetId = getAssetId(rawAssetId, block); + const assetId = await getAssetId(rawAssetId, block); const issuedAmount = getBigIntValue(rawAmount); const fundingRound = bytesToString(rawFundingRound); const totalFundingAmount = getBigIntValue(rawTotalFundingAmount); @@ -347,7 +347,7 @@ export const handleRedeemed = async (event: SubstrateEvent): Promise => { const [, rawAssetId, rawBeneficiaryDid, rawAmount] = params; const issuerDid = getTextValue(rawBeneficiaryDid); - const assetId = getAssetId(rawAssetId, block); + const assetId = await getAssetId(rawAssetId, block); const issuedAmount = getBigIntValue(rawAmount); const asset = await getAsset(assetId); @@ -367,7 +367,7 @@ export const handleFrozen = async (event: SubstrateEvent): Promise => { const { params, blockId, block } = extractArgs(event); const [, rawAssetId] = params; - const assetId = getAssetId(rawAssetId, block); + const assetId = await getAssetId(rawAssetId, block); const asset = await getAsset(assetId); asset.isFrozen = true; @@ -380,7 +380,7 @@ export const handleUnfrozen = async (event: SubstrateEvent): Promise => { const { params, blockId, block } = extractArgs(event); const [, rawAssetId] = params; - const assetId = getAssetId(rawAssetId, block); + const assetId = await getAssetId(rawAssetId, block); const asset = await getAsset(assetId); asset.isFrozen = false; @@ -394,7 +394,7 @@ export const handleAssetOwnershipTransferred = async (event: SubstrateEvent): Pr const [to, rawAssetId] = params; - const assetId = getAssetId(rawAssetId, block); + const assetId = await getAssetId(rawAssetId, block); const asset = await getAsset(assetId); asset.ownerId = getTextValue(to); @@ -408,7 +408,7 @@ export const handleAssetTransfer = async (event: SubstrateEvent): Promise const [, rawAssetId, rawFromPortfolio, rawToPortfolio, rawAmount] = params; const { identityId: fromDid, number: fromPortfolioNumber } = getPortfolioValue(rawFromPortfolio); const { identityId: toDid, number: toPortfolioNumber } = getPortfolioValue(rawToPortfolio); - const assetId = getAssetId(rawAssetId, block); + const assetId = await getAssetId(rawAssetId, block); const transferAmount = getBigIntValue(rawAmount); let fromPortfolioId = `${fromDid}/${fromPortfolioNumber}`; @@ -483,7 +483,7 @@ export const handleAssetBalanceUpdated = async (event: SubstrateEvent): Promise< let fromPortfolioNumber: number, toPortfolioNumber: number; - const assetId = getAssetId(rawAssetId, block); + const assetId = await getAssetId(rawAssetId, block); const asset = await getAsset(assetId); let fromPortfolioId: string; @@ -593,7 +593,7 @@ export const handleAssetBalanceUpdated = async (event: SubstrateEvent): Promise< export const handleAssetMediatorsAdded = async (event: SubstrateEvent): Promise => { const { params, blockId, block } = extractArgs(event); const addedById = getTextValue(params[0]); - const assetId = getAssetId(params[1], block); + const assetId = await getAssetId(params[1], block); const mediators = getStringArrayValue(params[2]); const createPromises = mediators.map(mediator => @@ -612,7 +612,7 @@ export const handleAssetMediatorsAdded = async (event: SubstrateEvent): Promise< export const handleAssetMediatorsRemoved = async (event: SubstrateEvent): Promise => { const { params, block } = extractArgs(event); - const assetId = getAssetId(params[1], block); + const assetId = await getAssetId(params[1], block); const mediators = getStringArrayValue(params[2]); await Promise.all( @@ -623,7 +623,7 @@ export const handleAssetMediatorsRemoved = async (event: SubstrateEvent): Promis export const handlePreApprovedAsset = async (event: SubstrateEvent): Promise => { const { params, blockId, block } = extractArgs(event); const identityId = getTextValue(params[0]); - const assetId = getAssetId(params[1], block); + const assetId = await getAssetId(params[1], block); await AssetPreApproval.create({ id: `${assetId}/${identityId}`, @@ -638,7 +638,7 @@ export const handleRemovePreApprovedAsset = async (event: SubstrateEvent): Promi const { params, block } = extractArgs(event); const identityId = getTextValue(params[0]); - const assetId = getAssetId(params[1], block); + const assetId = await getAssetId(params[1], block); await AssetPreApproval.remove(`${assetId}/${identityId}`); }; @@ -648,7 +648,7 @@ export const handleTickerLinkedToAsset = async (event: SubstrateEvent): Promise< const [, rawTicker, rawAssetId] = params; const ticker = serializeTicker(rawTicker); - const assetId = rawAssetId.toString(); + const assetId = getTextValue(rawAssetId); const asset = await getAsset(assetId); asset.ticker = ticker; @@ -656,3 +656,18 @@ export const handleTickerLinkedToAsset = async (event: SubstrateEvent): Promise< await asset.save(); }; + +export const handleTickerUnlinkedFromAsset = async (event: SubstrateEvent): Promise => { + const { params, blockId } = extractArgs(event); + + const [, rawTicker, rawAssetId] = params; + const ticker = serializeTicker(rawTicker); + const assetId = getTextValue(rawAssetId); + const asset = await getAsset(assetId); + + if (asset.ticker === ticker) { + asset.ticker = undefined; + asset.updatedBlockId = blockId; + await asset.save(); + } +}; diff --git a/src/mappings/entities/assets/mapCompliance.ts b/src/mappings/entities/assets/mapCompliance.ts index 2f89aab..ce22702 100644 --- a/src/mappings/entities/assets/mapCompliance.ts +++ b/src/mappings/entities/assets/mapCompliance.ts @@ -14,7 +14,7 @@ export const handleAssetCompliancePaused = async (event: SubstrateEvent): Promis const { params, blockId, block } = extractArgs(event); const [, rawAssetId] = params; - const assetId = getAssetId(rawAssetId, block); + const assetId = await getAssetId(rawAssetId, block); const asset = await getAsset(assetId); asset.isCompliancePaused = true; @@ -27,7 +27,7 @@ export const handleAssetComplianceResumed = async (event: SubstrateEvent): Promi const { params, blockId, block } = extractArgs(event); const [, rawAssetId] = params; - const assetId = getAssetId(rawAssetId, block); + const assetId = await getAssetId(rawAssetId, block); const asset = await getAsset(assetId); asset.isCompliancePaused = false; @@ -40,7 +40,7 @@ export const handleComplianceReset = async (event: SubstrateEvent): Promise const [, rawClaimantDid, rawCaId, , rawAmount, rawTax] = params; const targetId = getTextValue(rawClaimantDid); - const { localId, assetId } = getCaIdValue(rawCaId, block); + const { localId, assetId } = await getCaIdValue(rawCaId, block); const amount = getBigIntValue(rawAmount); const tax = getBigIntValue(rawTax); @@ -67,7 +67,7 @@ export const handleReclaimed = async (event: SubstrateEvent): Promise => { const [rawEventDid, rawCaId, rawAmount] = params; const targetId = getTextValue(rawEventDid); - const { localId, assetId } = getCaIdValue(rawCaId, block); + const { localId, assetId } = await getCaIdValue(rawCaId, block); const amount = getBigIntValue(rawAmount); await DistributionPayment.create({ diff --git a/src/mappings/entities/assets/mapNfts.ts b/src/mappings/entities/assets/mapNfts.ts index 0ff38f7..b3e0805 100644 --- a/src/mappings/entities/assets/mapNfts.ts +++ b/src/mappings/entities/assets/mapNfts.ts @@ -40,7 +40,7 @@ export const getNftHolder = async ( export const handleNftCollectionCreated = async (event: SubstrateEvent): Promise => { const { params, blockId, block } = extractArgs(event); const [, rawAssetId] = params; - const assetId = getAssetId(rawAssetId, block); + const assetId = await getAssetId(rawAssetId, block); const asset = await getAsset(assetId); asset.isNftCollection = true; @@ -71,7 +71,7 @@ export const handleNftPortfolioUpdates = async (event: SubstrateEvent): Promise< const reason = getFirstKeyFromJson(rawUpdateReason); const value = getFirstValueFromJson(rawUpdateReason); - const { assetId, ids } = getNftId(rawNftId, block); + const { assetId, ids } = await getNftId(rawNftId, block); const asset = await getAsset(assetId); asset.updatedBlockId = blockId; diff --git a/src/mappings/entities/assets/mapStatistics.ts b/src/mappings/entities/assets/mapStatistics.ts index 8b0ed41..43ccf09 100644 --- a/src/mappings/entities/assets/mapStatistics.ts +++ b/src/mappings/entities/assets/mapStatistics.ts @@ -19,7 +19,10 @@ import { } from '../../../utils'; import { Attributes, extractArgs } from '../common'; -export const getAssetIdForStatisticsEvent = (item: Codec, block: SubstrateBlock): string => { +export const getAssetIdForStatisticsEvent = ( + item: Codec, + block: SubstrateBlock +): Promise => { let assetId: string; if (block.specVersion < 7000000) { const scope = JSON.parse(item.toString()); @@ -186,7 +189,7 @@ export const handleStatTypeAdded = async (event: SubstrateEvent): Promise const [, rawStatisticsScope, rawStatType] = params; - const assetId = getAssetIdForStatisticsEvent(rawStatisticsScope, block); + const assetId = await getAssetIdForStatisticsEvent(rawStatisticsScope, block); const statTypes = getStatTypes(rawStatType, block); const promises = []; @@ -205,7 +208,7 @@ export const handleStatTypeRemoved = async (event: SubstrateEvent): Promise => { const { params, blockId, eventIdx, block } = extractArgs(event); const callerId = getTextValue(params[0]); - const assetId = getAssetId(params[1], block); + const assetId = await getAssetId(params[1], block); await TickerExternalAgent.create({ id: `${assetId}/${callerId}`, @@ -22,6 +22,6 @@ export const handleExternalAgentAdded = async (event: SubstrateEvent): Promise => { const { params, block } = extractArgs(event); const agent = params[2].toString(); - const assetId = getAssetId(params[1], block); + const assetId = await getAssetId(params[1], block); await TickerExternalAgent.remove(`${assetId}/${agent}`); }; diff --git a/src/mappings/entities/externalAgents/mapExternalAgentAction.ts b/src/mappings/entities/externalAgents/mapExternalAgentAction.ts index 624aa71..a8f478a 100644 --- a/src/mappings/entities/externalAgents/mapExternalAgentAction.ts +++ b/src/mappings/entities/externalAgents/mapExternalAgentAction.ts @@ -152,7 +152,7 @@ class ExternalAgentEventsManager { .add( ModuleIdEnum.statistics, [EventIdEnum.AssetStatsUpdated, EventIdEnum.StatTypesAdded, EventIdEnum.StatTypesRemoved], - async (params, block) => getAssetIdForStatisticsEvent(params[1], block) + async (params, block) => await getAssetIdForStatisticsEvent(params[1], block) ) .add( ModuleIdEnum.statistics, @@ -160,7 +160,7 @@ class ExternalAgentEventsManager { EventIdEnum.TransferConditionExemptionsAdded, EventIdEnum.TransferConditionExemptionsRemoved, ], - async (params, block) => getExemptKeyValue(params[1], block).assetId + async (params, block) => (await getExemptKeyValue(params[1], block)).assetId ) .add( ModuleIdEnum.corporateaction, diff --git a/src/mappings/entities/externalAgents/mapExternalAgentHistory.ts b/src/mappings/entities/externalAgents/mapExternalAgentHistory.ts index 535216d..b372dcd 100644 --- a/src/mappings/entities/externalAgents/mapExternalAgentHistory.ts +++ b/src/mappings/entities/externalAgents/mapExternalAgentHistory.ts @@ -12,7 +12,7 @@ export const handleGroupCreated = async (event: SubstrateEvent): Promise = const group = params[2].toJSON(); const permissions = JSON.stringify(params[3].toJSON()); - const assetId = getAssetId(params[1], block); + const assetId = await getAssetId(params[1], block); await AgentGroupEntity.create({ id: `${assetId}/${group}`, @@ -27,7 +27,7 @@ export const handleGroupPermissionsUpdated = async (event: SubstrateEvent): Prom const group = params[2].toJSON(); const permissions = JSON.stringify(params[3].toJSON()); - const assetId = getAssetId(params[1], block); + const assetId = await getAssetId(params[1], block); const ag = await AgentGroupEntity.get(`${assetId}/${group}`); ag.permissions = permissions; @@ -57,7 +57,7 @@ export const handleAgentAdded = async (event: SubstrateEvent): Promise => const { params, blockId, eventIdx, block } = extractArgs(event); const did = params[0].toString(); - const assetId = getAssetId(params[1], block); + const assetId = await getAssetId(params[1], block); const group = params[2].toJSON() as AgentGroup; @@ -77,7 +77,7 @@ export const handleGroupChanged = async (event: SubstrateEvent): Promise = const did = params[2].toString(); const group = params[3].toJSON() as AgentGroup; - const assetId = getAssetId(params[1], block); + const assetId = await getAssetId(params[1], block); const promises = [ removeMember(did, assetId), @@ -102,7 +102,7 @@ export const handleGroupChanged = async (event: SubstrateEvent): Promise = export async function handleAgentRemoved(event: SubstrateEvent): Promise { const { params, blockId, eventIdx, block } = extractArgs(event); const did = params[2].toString(); - const assetId = getAssetId(params[1], block); + const assetId = await getAssetId(params[1], block); const promises = [ removeMember(did, assetId), diff --git a/src/mappings/entities/identities/mapClaim.ts b/src/mappings/entities/identities/mapClaim.ts index 08ca6e1..e40cf70 100644 --- a/src/mappings/entities/identities/mapClaim.ts +++ b/src/mappings/entities/identities/mapClaim.ts @@ -158,7 +158,7 @@ export const handleDidRegistered = async (event: SubstrateEvent): Promise const { params, blockId, block } = extractArgs(event); const target = getTextValue(params[0]); - const assetId = getAssetId(params[1], block); + const assetId = await getAssetId(params[1], block); await handleScopes(blockId, target, assetId); }; diff --git a/src/mappings/entities/identities/mapPortfolio.ts b/src/mappings/entities/identities/mapPortfolio.ts index d0de7c3..e103e91 100644 --- a/src/mappings/entities/identities/mapPortfolio.ts +++ b/src/mappings/entities/identities/mapPortfolio.ts @@ -15,7 +15,6 @@ import { getPortfolioValue, getSignerAddress, getTextValue, - hexToString, } from '../../../utils'; import { Attributes, extractArgs } from '../common'; import { createIdentityIfNotExists } from './mapIdentities'; @@ -160,7 +159,7 @@ export const handlePortfolioMovement = async (event: SubstrateEvent): Promise BigInt(id)); - assetId = hexToString(description.ticker ?? description.assetId); + assetId = await getAssetId(description.ticker ?? description.assetId, block); type = PortfolioMovementTypeEnum.NonFungible; } diff --git a/src/mappings/entities/stos/mapSto.ts b/src/mappings/entities/stos/mapSto.ts index 6c7fa2d..11e3166 100644 --- a/src/mappings/entities/stos/mapSto.ts +++ b/src/mappings/entities/stos/mapSto.ts @@ -43,7 +43,7 @@ export const handleStoClosed = async (event: SubstrateEvent): Promise => { const handleFundraiserStatus = async (event: SubstrateEvent, status: StoStatus): Promise => { const { params, extrinsic, block, blockId } = extractArgs(event); const [, rawStoId] = params; - const offeringAssetId = getAssetId(extrinsic.extrinsic.args[0], block); + const offeringAssetId = await getAssetId(extrinsic.extrinsic.args[0], block); const stoId = getNumberValue(rawStoId); const sto = await Sto.get(`${offeringAssetId}/${stoId}`); @@ -66,7 +66,7 @@ const handleFundraiserStatus = async (event: SubstrateEvent, status: StoStatus): export const handleFundraiserWindowModified = async (event: SubstrateEvent): Promise => { const { params, extrinsic, blockId, block } = extractArgs(event); const [, rawStoId, , , rawStart, rawEnd] = params; - const offeringAssetId = getAssetId(extrinsic.extrinsic.args[0], block); + const offeringAssetId = await getAssetId(extrinsic.extrinsic.args[0], block); const stoId = getNumberValue(rawStoId); const sto = await Sto.get(`${offeringAssetId}/${stoId}`); diff --git a/src/utils/assets.ts b/src/utils/assets.ts index 0f50dec..600a73a 100644 --- a/src/utils/assets.ts +++ b/src/utils/assets.ts @@ -1,8 +1,8 @@ import { Codec } from '@polkadot/types/types'; -import { hexAddPrefix, hexStripPrefix, stringToHex, hexHasPrefix } from '@polkadot/util'; -import { blake2AsHex } from '@polkadot/util-crypto'; +import { hexAddPrefix, hexHasPrefix, hexStripPrefix, stringToHex, u8aToHex } from '@polkadot/util'; +import { blake2AsU8a } from '@polkadot/util-crypto'; import { SubstrateBlock } from '@subql/types'; -import { Asset, AssetDocument, SecurityIdentifier } from '../types'; +import { Asset, AssetDocument, Block, SecurityIdentifier } from '../types'; import { coerceHexToString, extractString, @@ -84,22 +84,41 @@ export const getSecurityIdentifiers = (item: Codec): SecurityIdentifier[] => { }); }; -export const getAssetIdForLegacyTicker = (ticker: Codec | string): string => { +let genesisHash: string; +export const getAssetIdForLegacyTicker = async (ticker: Codec | string): Promise => { const getHexTicker = (value: string) => { if (hexHasPrefix(value)) { return value; } return stringToHex(value.padEnd(12, '\0')); }; + const hexTicker = typeof ticker === 'string' ? getHexTicker(ticker) : ticker.toString(); const assetComponents = [stringToHex('legacy_ticker'), hexTicker]; const data = hexAddPrefix(assetComponents.map(e => hexStripPrefix(e)).join('')); - return blake2AsHex(data, 128); + const rawBytes = blake2AsU8a(data, 128); + + if (!genesisHash) { + ({ hash: genesisHash } = await Block.get('0')); + } + + // Current staging chain already migrated the old ticker into asset IDs without the valid UUID logic + if (genesisHash !== '0x3c3183f6d701500766ff7d147b79c4f10014a095eaaa98e960dcef6b3ead50ee') { + // Version 8. + rawBytes[6] = (rawBytes[6] & 0x0f) | 0x80; + // Standard RFC4122 variant (bits 10xx) + rawBytes[8] = (rawBytes[8] & 0x3f) | 0x80; + } + + return u8aToHex(rawBytes); }; -export const getAssetId = (assetId: string | Codec, block: SubstrateBlock): string => { +export const getAssetId = async ( + assetId: string | Codec, + block: SubstrateBlock +): Promise => { const { specVersion } = block; const specName = api.runtimeVersion.specName.toString(); @@ -110,10 +129,13 @@ export const getAssetId = (assetId: string | Codec, block: SubstrateBlock): stri return getAssetIdForLegacyTicker(assetId); }; -export const getNftId = (nft: Codec, block: SubstrateBlock): { assetId: string; ids: number[] } => { +export const getNftId = async ( + nft: Codec, + block: SubstrateBlock +): Promise<{ assetId: string; ids: number[] }> => { const { ticker: rawTicker, assetId: rawAssetId, ids } = nft.toJSON() as any; - return { assetId: getAssetId(rawTicker ?? rawAssetId, block), ids }; + return { assetId: await getAssetId(rawTicker ?? rawAssetId, block), ids }; }; export const getAssetIdWithTicker = async ( @@ -132,7 +154,7 @@ export const getAssetIdWithTicker = async ( typeof assetIdOrTicker === 'string' ? coerceHexToString(assetIdOrTicker) : serializeTicker(assetIdOrTicker); - assetId = getAssetIdForLegacyTicker(assetIdOrTicker); + assetId = await getAssetIdForLegacyTicker(assetIdOrTicker); } return { diff --git a/src/utils/portfolios.ts b/src/utils/portfolios.ts index a2ba47a..fe669e0 100644 --- a/src/utils/portfolios.ts +++ b/src/utils/portfolios.ts @@ -36,13 +36,13 @@ export const getPortfolioId = ({ number, }: Pick): string => `${identityId}/${number}`; -export const getCaIdValue = ( +export const getCaIdValue = async ( item: Codec, block: SubstrateBlock -): Pick => { +): Promise> => { const caId = JSON.parse(item.toString()); return { localId: extractNumber(caId, 'local_id'), - assetId: getAssetId(caId.ticker ?? caId.assetId, block), + assetId: await getAssetId(caId.ticker ?? caId.assetId, block), }; }; diff --git a/src/utils/stos.ts b/src/utils/stos.ts index cd04892..12702e5 100644 --- a/src/utils/stos.ts +++ b/src/utils/stos.ts @@ -40,7 +40,7 @@ export const getFundraiserDetails = async ( end: getDateValue(end), tiers, minimumInvestment: extractBigInt(rest, 'minimum_investment'), - offeringAssetId: getAssetId(extractString(rest, 'offering_asset'), block), + offeringAssetId: await getAssetId(extractString(rest, 'offering_asset'), block), offeringPortfolioId: getPortfolioId(offeringPortfolio), raisingAssetId, raisingTicker, diff --git a/src/utils/transferManagers.ts b/src/utils/transferManagers.ts index 6ead86e..d5c5563 100644 --- a/src/utils/transferManagers.ts +++ b/src/utils/transferManagers.ts @@ -63,10 +63,10 @@ export const getTransferManagerValue = ( throw new Error('Unknown transfer restriction type found'); }; -export const getExemptKeyValue = ( +export const getExemptKeyValue = async ( item: Codec, block: SubstrateBlock -): Omit, 'exemptedEntityId'> => { +): Promise, 'exemptedEntityId'>> => { const exemptKey = JSON.parse(item.toString()); const { op, operationType, claimType: claimTypeValue } = exemptKey; @@ -89,7 +89,7 @@ export const getExemptKeyValue = ( } return { - assetId: getAssetId(assetId, block), + assetId: await getAssetId(assetId, block), opType, claimType, }; diff --git a/yarn.lock b/yarn.lock index d25b03a..7b6048c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4748,10 +4748,10 @@ tar "^6.1.13" tslib "^1" -"@polymeshassociation/polymesh-types@^5.9.0": - version "5.9.0" - resolved "https://registry.yarnpkg.com/@polymeshassociation/polymesh-types/-/polymesh-types-5.9.0.tgz#26d16613959909198e5233db35e57e8cdf55e6c4" - integrity sha512-kSJJAeC0mGiZpKWoYLu3TouzX9mgamb/Sp9AAlLjV8qncvmCZjVG4Yb+6TT7GC/79qjoegFzrIBf7euo0/AMiw== +"@polymeshassociation/polymesh-types@^5.14.0": + version "5.14.0" + resolved "https://registry.yarnpkg.com/@polymeshassociation/polymesh-types/-/polymesh-types-5.14.0.tgz#f503ba81a0b9623b358b6aeb0c387737dd49bb22" + integrity sha512-7J3XamLzNLtMlZ21o6o7HdD7ts3fCz6J8hwh3L4b7fqTi1QyJeqep6HnguDwW3NksSrJ4clrKrSnMtxv9OnwHQ== "@protobuf-ts/grpc-transport@^2.8.2": version "2.9.1" @@ -15337,7 +15337,16 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -15422,7 +15431,7 @@ stringify-object@^3.3.0: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -15450,6 +15459,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -16761,7 +16777,7 @@ wordwrapjs@^4.0.0: reduce-flatten "^2.0.0" typical "^5.2.0" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -16788,6 +16804,15 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"