From 4e4f0910d88c8881b0c5f0679e7d81b09ec0a097 Mon Sep 17 00:00:00 2001 From: loatheb Date: Mon, 21 Oct 2024 18:05:41 +0800 Subject: [PATCH] fix: id duplicate issue (#241) --- .../case/signTypedDataV4/nestedArray.ts | 40 +++++++------------ .../ethereum/case/signTypedDataV4/normal.ts | 2 +- .../case/signTypedDataV4/permitBatch.ts | 2 +- .../case/signTypedDataV4/permitSingle.ts | 2 +- .../permitWitnessTransferFrom.ts | 2 +- 5 files changed, 18 insertions(+), 30 deletions(-) diff --git a/packages/example/components/chains/ethereum/case/signTypedDataV4/nestedArray.ts b/packages/example/components/chains/ethereum/case/signTypedDataV4/nestedArray.ts index 6b7e7834..a4a2aade 100644 --- a/packages/example/components/chains/ethereum/case/signTypedDataV4/nestedArray.ts +++ b/packages/example/components/chains/ethereum/case/signTypedDataV4/nestedArray.ts @@ -10,7 +10,7 @@ export default (params: IEIP712Params) => ({ { name: 'name', type: 'string' }, ], NestedArray: [ - { name: 'nestedItems', type: 'SingleItem[][]' }, + { name: 'items', type: 'SingleItem[][]' }, ], SingleItem: [ { name: 'id', type: 'uint256' }, @@ -25,34 +25,22 @@ export default (params: IEIP712Params) => ({ version: '1', }, message: { - nestedItems: [ + items: [ [ - { - items: [ - { id: 1, value: 'Item1-1' }, - { id: 2, value: 'Item1-2' }, - ], - }, - { - items: [ - { id: 3, value: 'Item2-1' }, - { id: 4, value: 'Item2-2' }, - ], - }, + { id: 1, value: 'Item1-1' }, + { id: 2, value: 'Item1-2' }, ], [ - { - items: [ - { id: 5, value: 'Item3-1' }, - { id: 6, value: 'Item3-2' }, - ], - }, - { - items: [ - { id: 7, value: 'Item4-1' }, - { id: 8, value: 'Item4-2' }, - ], - }, + { id: 3, value: 'Item2-1' }, + { id: 4, value: 'Item2-2' }, + ], + [ + { id: 5, value: 'Item3-1' }, + { id: 6, value: 'Item3-2' }, + ], + [ + { id: 7, value: 'Item4-1' }, + { id: 8, value: 'Item4-2' }, ], ], }, diff --git a/packages/example/components/chains/ethereum/case/signTypedDataV4/normal.ts b/packages/example/components/chains/ethereum/case/signTypedDataV4/normal.ts index ab0e965d..472f9952 100644 --- a/packages/example/components/chains/ethereum/case/signTypedDataV4/normal.ts +++ b/packages/example/components/chains/ethereum/case/signTypedDataV4/normal.ts @@ -1,7 +1,7 @@ import type { IEIP712Params } from '../../types'; export default (params: IEIP712Params) => ({ - id: 'signTypedDataV4', + id: 'signTypedDataV4-normal', name: '默认类型: signTypedDataV4', description: 'SignTypedDataV4 Normal', value: JSON.stringify({ diff --git a/packages/example/components/chains/ethereum/case/signTypedDataV4/permitBatch.ts b/packages/example/components/chains/ethereum/case/signTypedDataV4/permitBatch.ts index e3ff0d79..68c65004 100644 --- a/packages/example/components/chains/ethereum/case/signTypedDataV4/permitBatch.ts +++ b/packages/example/components/chains/ethereum/case/signTypedDataV4/permitBatch.ts @@ -1,7 +1,7 @@ import type { IEIP712Params } from '../../types'; export default (params: IEIP712Params) => ({ - id: 'signTypedDataV4-uniswap-swap', + id: 'signTypedDataV4-permitBatch', name: 'permit2: PermitBatch 代币批量授权', description: 'permit2: PermitBatch 代币批量授权,一次授权两个代币信息', value: JSON.stringify({ diff --git a/packages/example/components/chains/ethereum/case/signTypedDataV4/permitSingle.ts b/packages/example/components/chains/ethereum/case/signTypedDataV4/permitSingle.ts index edc59266..fe88a367 100644 --- a/packages/example/components/chains/ethereum/case/signTypedDataV4/permitSingle.ts +++ b/packages/example/components/chains/ethereum/case/signTypedDataV4/permitSingle.ts @@ -1,7 +1,7 @@ import type { IEIP712Params } from '../../types'; export default (params: IEIP712Params) => ({ - id: 'signTypedDataV4-uniswap-swap', + id: 'signTypedDataV4-permitSingle', name: 'permit2: PermitSingle 方法 Swap USDC => Matic', description: '模仿 UniSwap Swap,数据来自 Polygon USDC => Matic', value: JSON.stringify({ diff --git a/packages/example/components/chains/ethereum/case/signTypedDataV4/permitWitnessTransferFrom.ts b/packages/example/components/chains/ethereum/case/signTypedDataV4/permitWitnessTransferFrom.ts index 65dcd242..449e0f00 100644 --- a/packages/example/components/chains/ethereum/case/signTypedDataV4/permitWitnessTransferFrom.ts +++ b/packages/example/components/chains/ethereum/case/signTypedDataV4/permitWitnessTransferFrom.ts @@ -1,7 +1,7 @@ import type { IEIP712Params } from '../../types'; export default (params: IEIP712Params) => ({ - id: 'signTypedDataV5-permitwitnessTransferFrom', + id: 'signTypedDataV5-permitWitnessTransferFrom', name: '默认类型: PermitWitnessTransferFrom 方法', description: '模仿 UniSwap 现价单,数据来自 ETH 主网 USDC => ETH', value: JSON.stringify({