Skip to content

Commit

Permalink
add enqueueSnackbar
Browse files Browse the repository at this point in the history
  • Loading branch information
daoauth committed Oct 12, 2024
1 parent a2d9e8c commit 55f25c6
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/ptb-builder/src/Components/Code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const Code = ({
onMouseDown={(e) => e.preventDefault()}
onClick={handleExcuteTransaction}
>
Excute Transaction
Excute
</button>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useCallback, useEffect } from 'react';

import { Transaction } from '@mysten/sui/transactions';
import { Node } from '@xyflow/react';
import { enqueueSnackbar } from 'notistack';

import { type NodeProp } from '..';
import { PtbHandle, PtbHandleArray, PtbHandleProcess } from '../handles';
Expand Down Expand Up @@ -37,6 +38,9 @@ export const MergeCoins = ({ id, data }: NodeProp) => {
destination = destNode.source.data.value as string;
} else {
// TODO
enqueueSnackbar(`not support - ${destNode.source.type}`, {
variant: 'warning',
});
}
}

Expand All @@ -53,6 +57,9 @@ export const MergeCoins = ({ id, data }: NodeProp) => {
temp && sources.push(temp.value);
} else {
// TODO
enqueueSnackbar(`not support - ${inputs.source.type}`, {
variant: 'warning',
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
} from '@mysten/sui/client';
import { Transaction } from '@mysten/sui/transactions';
import { Node, useReactFlow, useUpdateNodeInternals } from '@xyflow/react';
import { enqueueSnackbar } from 'notistack';

import { type NodeProp } from '..';
import { useStateContext } from '../../../Provider';
Expand Down Expand Up @@ -197,15 +198,21 @@ export const MoveCall = ({ id, data }: NodeProp) => {
results: { id: string; value: any }[],
): { transaction: Transaction; result: any } | undefined => {
// const params = args.map((item) => (item ? item.name : undefined));
/*
const result = transaction.moveCall({
package: packageId,
module: selectedModule,
function: selectedFunction,
// arguments: [...params],
});
return { transaction, result };
*/
enqueueSnackbar(`not support - MoveCall`, {
variant: 'warning',
});
return undefined;
},
[packageId, selectedFunction, selectedModule],
[],
);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useCallback, useEffect } from 'react';

import { Transaction } from '@mysten/sui/transactions';
import { Node } from '@xyflow/react';
import { enqueueSnackbar } from 'notistack';

import { type NodeProp } from '..';
import { useStateContext } from '../../../Provider';
Expand Down Expand Up @@ -36,6 +37,9 @@ export const SplitCoins = ({ id, data }: NodeProp) => {
coin = transaction.object(coinObject.source.data.value as string);
} else {
// TODO
enqueueSnackbar(`not support - ${coinObject.source.type}`, {
variant: 'warning',
});
}
}
const inputs = params.find((item) => item.target === 'amounts:number[]');
Expand All @@ -44,6 +48,9 @@ export const SplitCoins = ({ id, data }: NodeProp) => {
amounts.push(...(inputs.source.data.value as number[]));
} else {
// TODO
enqueueSnackbar(`not support - ${inputs.source.type}`, {
variant: 'warning',
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useCallback, useEffect } from 'react';

import { Transaction } from '@mysten/sui/transactions';
import { Node } from '@xyflow/react';
import { enqueueSnackbar } from 'notistack';

import { type NodeProp } from '..';
import { PtbHandle, PtbHandleArray, PtbHandleProcess } from '../handles';
Expand Down Expand Up @@ -33,6 +34,9 @@ export const TransferObjects = ({ id, data }: NodeProp) => {
address = addressNode.source.data.value as string;
} else {
// TODO
enqueueSnackbar(`not support - ${addressNode.source.type}`, {
variant: 'warning',
});
}
}

Expand All @@ -49,6 +53,9 @@ export const TransferObjects = ({ id, data }: NodeProp) => {
temp && objects.push(temp.value);
} else {
// TODO
enqueueSnackbar(`not support - ${inputs.source.type}`, {
variant: 'warning',
});
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ProgrammableTransaction, SuiTransaction } from '@mysten/sui/client';
import { Edge, Node } from '@xyflow/react';
import { enqueueSnackbar } from 'notistack';

export const mergeCoins = (
index: number,
Expand Down Expand Up @@ -33,6 +34,9 @@ export const mergeCoins = (
});
} else {
// TODO
enqueueSnackbar(`not support - ${JSON.stringify(destination)}`, {
variant: 'warning',
});
}
}

Expand Down
7 changes: 7 additions & 0 deletions packages/ptb-builder/src/utils/move/transactions/moveCall.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ProgrammableTransaction, SuiTransaction } from '@mysten/sui/client';
import { Edge, Node } from '@xyflow/react';
import { enqueueSnackbar } from 'notistack';

interface MoveCallHandle {
id: string;
Expand Down Expand Up @@ -145,6 +146,9 @@ export const moveCall = (
id: `${PREFIX}${i}`,
type: undefined,
});
enqueueSnackbar(`not support - ${JSON.stringify(item)}`, {
variant: 'warning',
});
}
}
} else {
Expand All @@ -153,6 +157,9 @@ export const moveCall = (
id: `${PREFIX}${i}`,
type: undefined,
});
enqueueSnackbar(`not support - ${JSON.stringify(item)}`, {
variant: 'warning',
});
}
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ProgrammableTransaction, SuiTransaction } from '@mysten/sui/client';
import { Edge, Node } from '@xyflow/react';
import { enqueueSnackbar } from 'notistack';

export const splitCoins = (
index: number,
Expand Down Expand Up @@ -33,6 +34,9 @@ export const splitCoins = (
});
} else {
// TODO
enqueueSnackbar(`not support - ${JSON.stringify(coin)}`, {
variant: 'warning',
});
}

const arg1: number[] = [];
Expand Down

0 comments on commit 55f25c6

Please sign in to comment.