From 9746c682d2a9cc1d04d30331c23425cd12354027 Mon Sep 17 00:00:00 2001 From: devchenyan Date: Wed, 13 Nov 2024 09:56:08 +0800 Subject: [PATCH] feat: handle hash_type:data2 (#3264) --- packages/neuron-ui/src/components/SpecialAssetList/hooks.ts | 2 +- packages/neuron-ui/src/types/Controller/index.d.ts | 2 +- packages/neuron-wallet/src/models/asset-account-info.ts | 1 + packages/neuron-wallet/src/models/chain/live-cell.ts | 1 + packages/neuron-wallet/src/models/chain/script.ts | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/neuron-ui/src/components/SpecialAssetList/hooks.ts b/packages/neuron-ui/src/components/SpecialAssetList/hooks.ts index d1ff65cc43..1e0b9c82cf 100644 --- a/packages/neuron-ui/src/components/SpecialAssetList/hooks.ts +++ b/packages/neuron-ui/src/components/SpecialAssetList/hooks.ts @@ -30,7 +30,7 @@ export interface SpecialAssetCell { lock: { args: string codeHash: string - hashType: 'type' | 'data' + hashType: 'type' | 'data' | 'data1' | 'data2' } lockHash: string multiSignBlake160: string diff --git a/packages/neuron-ui/src/types/Controller/index.d.ts b/packages/neuron-ui/src/types/Controller/index.d.ts index 380129f808..6a1b6f22b2 100644 --- a/packages/neuron-ui/src/types/Controller/index.d.ts +++ b/packages/neuron-ui/src/types/Controller/index.d.ts @@ -215,7 +215,7 @@ declare namespace Controller { interface Response { cellDep: any codeHash: string - hashType: 'data' | 'type' + hashType: 'data' | 'type' | 'data1' | 'data2' } } interface SUDTAccount { diff --git a/packages/neuron-wallet/src/models/asset-account-info.ts b/packages/neuron-wallet/src/models/asset-account-info.ts index b4cb7a8d82..dee91b2426 100644 --- a/packages/neuron-wallet/src/models/asset-account-info.ts +++ b/packages/neuron-wallet/src/models/asset-account-info.ts @@ -401,6 +401,7 @@ function toScriptInfo(sporeConfig: SporeScript): ScriptCellInfo { if (sporeScriptHashType === 'type') return ScriptHashType.Type if (sporeScriptHashType === 'data') return ScriptHashType.Data if (sporeScriptHashType === 'data1') return ScriptHashType.Data1 + if (sporeScriptHashType === 'data2') return ScriptHashType.Data2 throw new Error(`Invalid hash type: ${sporeScriptHashType}`) })() diff --git a/packages/neuron-wallet/src/models/chain/live-cell.ts b/packages/neuron-wallet/src/models/chain/live-cell.ts index 4efc95dd60..4d85cedd47 100644 --- a/packages/neuron-wallet/src/models/chain/live-cell.ts +++ b/packages/neuron-wallet/src/models/chain/live-cell.ts @@ -6,6 +6,7 @@ const LUMOS_HASH_TYPE_MAP: Record = { type: ScriptHashType.Type, data1: ScriptHashType.Data1, data: ScriptHashType.Data, + data2: ScriptHashType.Data2, } export type CellWithOutPoint = Cell & { outPoint: IOutPoint } diff --git a/packages/neuron-wallet/src/models/chain/script.ts b/packages/neuron-wallet/src/models/chain/script.ts index 40034ea46f..03dcc0880c 100644 --- a/packages/neuron-wallet/src/models/chain/script.ts +++ b/packages/neuron-wallet/src/models/chain/script.ts @@ -6,6 +6,7 @@ export enum ScriptHashType { Data = 'data', Type = 'type', Data1 = 'data1', + Data2 = 'data2', } export default class Script {