Skip to content

Commit

Permalink
bugfix: MICRO-58 fix teleport attempted handler (#1511)
Browse files Browse the repository at this point in the history
fix teleport handler
  • Loading branch information
justraman authored Jan 19, 2025
1 parent 6da40f0 commit 7d22db7
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/mappings/xcm/events/attempted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import config from '../../../config'

async function getCallData(ctx: CommonContext, call: CallItem) {
if (call.name === 'PolkadotXcm.limited_teleport_assets') {
if (calls.polkadotXcm.limitedTeleportAssets.matrixEnjinV1012.is(call)) {
return calls.polkadotXcm.limitedTeleportAssets.matrixEnjinV1012.decode(call)
}

if (calls.polkadotXcm.limitedTeleportAssets.matrixEnjinV603.is(call)) {
return calls.polkadotXcm.limitedTeleportAssets.matrixEnjinV603.decode(call)
}
Expand All @@ -20,6 +24,10 @@ async function getCallData(ctx: CommonContext, call: CallItem) {
}

if (call.name === 'PolkadotXcm.teleport_assets') {
if (calls.polkadotXcm.teleportAssets.matrixEnjinV1012.is(call)) {
return calls.polkadotXcm.teleportAssets.matrixEnjinV1012.decode(call)
}

if (calls.polkadotXcm.teleportAssets.matrixEnjinV603.is(call)) {
return calls.polkadotXcm.teleportAssets.matrixEnjinV603.decode(call)
}
Expand All @@ -31,6 +39,10 @@ async function getCallData(ctx: CommonContext, call: CallItem) {
}

if (call.name === 'PolkadotXcm.limited_reserve_transfer_assets') {
if (calls.polkadotXcm.limitedReserveTransferAssets.matrixEnjinV1012.is(call)) {
return calls.polkadotXcm.limitedReserveTransferAssets.matrixEnjinV603.decode(call)
}

if (calls.polkadotXcm.limitedReserveTransferAssets.matrixEnjinV603.is(call)) {
return calls.polkadotXcm.limitedReserveTransferAssets.matrixEnjinV603.decode(call)
}
Expand All @@ -46,6 +58,10 @@ async function getCallData(ctx: CommonContext, call: CallItem) {

let callData: any = null

if (data.matrixEnjinV1012.is(call)) {
callData = data.matrixEnjinV1012.decode(call)
}

if (data.matrixEnjinV1005.is(call)) {
callData = data.matrixEnjinV1005.decode(call)
}
Expand Down Expand Up @@ -113,7 +129,7 @@ async function getCallData(ctx: CommonContext, call: CallItem) {
return callData!.call.value
}

return undefined
throw new Error('Unsupported call')
}

throw new UnsupportedCallError(call.name)
Expand Down

0 comments on commit 7d22db7

Please sign in to comment.