Skip to content

Commit

Permalink
refactor: move the proposal start and end time to Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Dec 3, 2024
1 parent 43dfcb2 commit 44ea912
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
6 changes: 6 additions & 0 deletions apps/ui/src/composables/useActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ export function useActions() {
choices: string[],
labels: string[],
app: string,
start: number,
min_end: number,
max_end: number,
executions: ExecutionInfo[] | null
) {
if (!web3.value.account) {
Expand All @@ -309,6 +312,9 @@ export function useActions() {
choices,
labels,
app,
start,
min_end,
max_end,
executions
)
);
Expand Down
3 changes: 3 additions & 0 deletions apps/ui/src/networks/evm/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ export function createActions(
choices: string[],
labels: string[],
app: string,
start: number,
min_end: number,
max_end: number,
executions: ExecutionInfo[] | null
) => {
await verifyNetwork(web3, chainId);
Expand Down
11 changes: 6 additions & 5 deletions apps/ui/src/networks/offchain/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@ export function createActions(
choices: string[],
labels: string[],
app: string,
start: number,
min_end: number,
max_end: number,
executions: ExecutionInfo[]
) {
const currentTime = Math.floor(Date.now() / 1000);
const startTime = currentTime + space.voting_delay;
const provider = getProvider(space.snapshot_chain_id as number);

const plugins = await getPlugins(executions);
Expand All @@ -147,12 +148,12 @@ export function createActions(
discussion,
choices,
labels,
start: startTime,
end: startTime + space.min_voting_period,
start,
end: min_end,
snapshot: (await provider.getBlockNumber()) - EDITOR_SNAPSHOT_OFFSET,
plugins: JSON.stringify(plugins),
app: app || EDITOR_APP_NAME,
timestamp: currentTime
timestamp: Math.floor(Date.now() / 1000)
};

return client.propose({ signer: web3.getSigner(), data });
Expand Down
3 changes: 3 additions & 0 deletions apps/ui/src/networks/starknet/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ export function createActions(
choices: string[],
labels: string[],
app: string,
start: number,
min_end: number,
max_end: number,
executions: ExecutionInfo[] | null
) => {
const executionInfo = executions?.[0];
Expand Down
3 changes: 3 additions & 0 deletions apps/ui/src/networks/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ export type ReadOnlyNetworkActions = {
choices: string[],
labels: string[],
app: string,
start: number,
min_end: number,
max_end: number,
executions: ExecutionInfo[] | null
): Promise<any>;
updateProposal(
Expand Down

0 comments on commit 44ea912

Please sign in to comment.