Skip to content

Commit

Permalink
Merge pull request #1541 from Phala-Network/fix-jssdk-logger-decode-e…
Browse files Browse the repository at this point in the history
…rror

fix(jssdk): the ModuleError not decode as expected in MessageOutput
  • Loading branch information
Leechael authored Mar 2, 2024
2 parents 16d26a5 + de00b00 commit b4da514
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@phala/sdk",
"version": "0.5.9",
"version": "0.5.10",
"description": "Phala Phat Contract JS SDK",
"license": "Apache-2.0",
"author": [
Expand Down
6 changes: 3 additions & 3 deletions frontend/packages/sdk/src/contracts/PinkLoggerContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Keyring } from '@polkadot/api'
import { Abi } from '@polkadot/api-contract'
import type { DecodedEvent } from '@polkadot/api-contract/types'
import type { KeyringPair } from '@polkadot/keyring/types'
import type { Enum, Struct, Text } from '@polkadot/types'
import type { Enum, Struct, Text, U8 } from '@polkadot/types'
import type { AccountId } from '@polkadot/types/interfaces'
import type { Result } from '@polkadot/types-codec'
import { hexAddPrefix, hexToString, hexToU8a, u8aToHex } from '@polkadot/util'
Expand Down Expand Up @@ -171,7 +171,7 @@ interface ContractExecResultOk extends Struct {
}

interface ModuleError extends Struct {
index: number
index: U8
error: Text
}

Expand Down Expand Up @@ -225,7 +225,7 @@ function postProcessLogRecord<TDecodedEvent extends DecodedEvent = DecodedEvent>
if (
execResult.result.isErr &&
execResult.result.asErr.isModule &&
execResult.result.asErr.asModule?.index === 4
execResult.result.asErr.asModule?.index.toNumber() === 4
) {
const err = phalaTypes.createType('ContractError', execResult.result.asErr.asModule.error)
output.result = {
Expand Down

0 comments on commit b4da514

Please sign in to comment.