Skip to content

Commit ac50fe8

Browse files
committed
chore: remove types using proposal with bytes32
### Summary - removed vote2Types, voteArray2Types, and voteString2Types
1 parent 481e7d6 commit ac50fe8

File tree

2 files changed

+4
-47
lines changed

2 files changed

+4
-47
lines changed

src/sign/index.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ import {
2525
voteTypes,
2626
voteArrayTypes,
2727
voteStringTypes,
28-
vote2Types,
29-
voteArray2Types,
30-
voteString2Types,
3128
followTypes,
3229
subscribeTypes,
3330
unfollowTypes,
@@ -169,15 +166,14 @@ export default class Client {
169166
if (!message.reason) message.reason = '';
170167
if (!message.app) message.app = '';
171168
if (!message.metadata) message.metadata = '{}';
172-
const type2 = message.proposal.startsWith('0x');
173-
let type = type2 ? vote2Types : voteTypes;
169+
let type = voteTypes;
174170
if (['approval', 'ranked-choice'].includes(message.type))
175-
type = type2 ? voteArray2Types : voteArrayTypes;
171+
type = voteArrayTypes;
176172
if (!isShutter && ['quadratic', 'weighted'].includes(message.type)) {
177-
type = type2 ? voteString2Types : voteStringTypes;
173+
type = voteStringTypes;
178174
message.choice = JSON.stringify(message.choice);
179175
}
180-
if (isShutter) type = type2 ? voteString2Types : voteStringTypes;
176+
if (isShutter) type = voteStringTypes;
181177
delete message.privacy;
182178
// @ts-ignore
183179
delete message.type;

src/sign/types.ts

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -240,45 +240,6 @@ export const voteStringTypes = {
240240
]
241241
};
242242

243-
export const vote2Types = {
244-
Vote: [
245-
{ name: 'from', type: 'string' },
246-
{ name: 'space', type: 'string' },
247-
{ name: 'timestamp', type: 'uint64' },
248-
{ name: 'proposal', type: 'bytes32' },
249-
{ name: 'choice', type: 'uint32' },
250-
{ name: 'reason', type: 'string' },
251-
{ name: 'app', type: 'string' },
252-
{ name: 'metadata', type: 'string' }
253-
]
254-
};
255-
256-
export const voteArray2Types = {
257-
Vote: [
258-
{ name: 'from', type: 'string' },
259-
{ name: 'space', type: 'string' },
260-
{ name: 'timestamp', type: 'uint64' },
261-
{ name: 'proposal', type: 'bytes32' },
262-
{ name: 'choice', type: 'uint32[]' },
263-
{ name: 'reason', type: 'string' },
264-
{ name: 'app', type: 'string' },
265-
{ name: 'metadata', type: 'string' }
266-
]
267-
};
268-
269-
export const voteString2Types = {
270-
Vote: [
271-
{ name: 'from', type: 'string' },
272-
{ name: 'space', type: 'string' },
273-
{ name: 'timestamp', type: 'uint64' },
274-
{ name: 'proposal', type: 'bytes32' },
275-
{ name: 'choice', type: 'string' },
276-
{ name: 'reason', type: 'string' },
277-
{ name: 'app', type: 'string' },
278-
{ name: 'metadata', type: 'string' }
279-
]
280-
};
281-
282243
export const followTypes = {
283244
Follow: [
284245
{ name: 'from', type: 'address' },

0 commit comments

Comments
 (0)