diff --git a/.circleci/config.yml b/.circleci/config.yml index a0e62aa..952c64e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,7 +37,6 @@ jobs: - checkout - setup_remote_docker: docker_layer_caching: true - version: 20.10.7 - run: command: | /scripts/build-image.sh web3f/polkadot-watcher-transaction . diff --git a/charts/polkadot-watcher-transaction/Chart.yaml b/charts/polkadot-watcher-transaction/Chart.yaml index 2d340ac..4a2cbbf 100644 --- a/charts/polkadot-watcher-transaction/Chart.yaml +++ b/charts/polkadot-watcher-transaction/Chart.yaml @@ -1,5 +1,5 @@ description: Polkadot Watcher name: polkadot-watcher-transaction -version: v1.4.0 -appVersion: v1.4.0 +version: v1.4.1 +appVersion: v1.4.1 apiVersion: v2 diff --git a/package.json b/package.json index bf50bd7..f7098c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "polkadot-watcher-transaction", - "version": "1.4.0", + "version": "1.4.1", "description": "Monitor events on Polkadot networks, specifically transactions", "repository": "git@github.com:w3f/polkadot-watcher-csv-exporter.git", "author": "W3F Infrastructure Team ", diff --git a/src/constants.ts b/src/constants.ts index ceb4151..463afd8 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -80,6 +80,7 @@ export const parachainNames = { "2119": "Bajun Network", "2239": "Acurast", "2241": "krest", + "2281": "Kreivo", "3339": "Curio", "3344": "Xode" } diff --git a/src/transfers.ts b/src/transfers.ts index 1f4bb5e..9321fc1 100644 --- a/src/transfers.ts +++ b/src/transfers.ts @@ -80,26 +80,18 @@ function extractTransferInfoFromXcmEvent(event: XcmSentEvent, chainInfo: ChainIn destination = depositRA.dest; } } - if (!beneficiaryInstruction) { - throw new Error(`XCM. No beneficiary instructions found. Block: ${blockNumber}`); - } - const destinationAddress = getLocation(beneficiaryInstruction.beneficiary, chainInfo, blockNumber) + const destinationAddress = getLocation(beneficiaryInstruction?.beneficiary, chainInfo, blockNumber) // 3. Get assets information const assetInstruction = findInstruction(message, 'ReserveAssetDeposited') || - findInstruction(message, 'ReceiveTeleportedAsset'); + findInstruction(message, 'ReceiveTeleportedAsset') || []; - if (!assetInstruction) { - throw new Error(`XCM. No assets instructions found. Block: ${blockNumber}`); - } const destChain = getLocation(destination, chainInfo, blockNumber) const transfers = getTokenAmountFromAsset( assetInstruction, chainInfo, blockNumber ) - if (transfers.length === 0) { - throw new Error(`XCM. No assets found inside of instruction. Block: ${blockNumber}`); - } + // TODO: AssetHub monitoring. The list of assets should be returned instead. const [token, amount] = transfers[0] return { @@ -159,7 +151,7 @@ function getTokenAmountFromAsset(assets: StagingXcmV4Asset[], chainInfo: ChainIn } result.push([token, amount]) } - return result + return result.length > 0 ? result : [['Unknown', 'Unknown']] } export const isBalancesTransferEvent = (event: Event): boolean => { diff --git a/src/types.ts b/src/types.ts index cb47c30..c1ad304 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3,7 +3,6 @@ import { Balance, Event, CodecHash, EventRecord } from '@polkadot/types/interfac import { DeriveAccountRegistration } from '@polkadot/api-derive/accounts/types'; import { StagingXcmV4Location, StagingXcmV4Xcm, StagingXcmV4Asset } from '@polkadot/types/lookup'; import { TypeRegistry } from '@polkadot/types'; -import { string } from 'yaml/dist/schema/common/string'; export type ChainId = 'polkadot' | 'kusama' diff --git a/test/integration/xcmData.ts b/test/integration/xcmData.ts index 35f9cfc..513c654 100644 --- a/test/integration/xcmData.ts +++ b/test/integration/xcmData.ts @@ -17,6 +17,23 @@ export const xcmTests = { token: "KSM", amount: "0.0250" }, + { + description: "Pallet XCM. Call send. Unknown asset instruction", + link: "https://kusama.subscan.io/event?extrinsic=24673667-2", + messageId: "0xf10ffef1fc2e8cf440808ce6684d556ad01b0f96ce90f7a266c87a2f30873c94", + block: 24673667, + eventIndex: 54, + origin: { + address: "HCksmaxivAsisGDkWtm5dhdAt3Ti2e5P2Gt7JXZYFiEHMSH", + chain: "Kusama" + }, + destination: { + address: "HCksmaxivAsisGDkWtm5dhdAt3Ti2e5P2Gt7JXZYFiEHMSH", + chain: "Kreivo" + }, + token: "Unknown", + amount: "Unknown" + }, ], polkadot: [ {