Skip to content

Commit

Permalink
[Core] Update minting process
Browse files Browse the repository at this point in the history
  • Loading branch information
saltict committed Nov 21, 2024
1 parent 641ee75 commit 1f326d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import { ConfirmationDefinitions, ConfirmationResult, EvmSendTransactionRequest, ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
import { WC_DEFAULT_CHAIN_ID, WC_USER_REJECT_MESSAGE } from '@subwallet/extension-base/services/wallet-connect-service/constants';
import { BookaSdk } from '@subwallet/extension-koni-ui/connector/booka/sdk';
import { CONFIRMATION_QR_MODAL } from '@subwallet/extension-koni-ui/constants/modal';
import { InjectContext } from '@subwallet/extension-koni-ui/contexts/InjectContext';
import { WalletConnectContext } from '@subwallet/extension-koni-ui/contexts/WalletConnectContext';
Expand Down Expand Up @@ -55,6 +56,8 @@ const handleSignature = async (type: EvmSignatureSupportType, id: string, signat
} as ConfirmationResult<string>);
};

const apiSDK = BookaSdk.instance;

const Component: React.FC<Props> = (props: Props) => {
const { className, extrinsicType, id, payload, txExpirationTime, type } = props;
const { payload: { account, canSign, hashPayload } } = payload;
Expand Down Expand Up @@ -207,6 +210,10 @@ const Component: React.FC<Props> = (props: Props) => {
}, [account.address, chainId, evmWallet, isMessage, onApproveSignature, payload.payload]);

const onConfirmWalletConnect = useCallback(() => {
if (extrinsicType === ExtrinsicType.MINT_NFT) {
apiSDK.nftMintingStart().catch(console.error);
}

let promise: Promise<{ signature: string }>;

if (isMessage) {
Expand Down Expand Up @@ -254,7 +261,7 @@ const Component: React.FC<Props> = (props: Props) => {
.finally(() => {
setLoading(false);
});
}, [isMessage, openWaiting, payload.payload, account.address, chainId, closeWaiting, onApproveSignature, notify, t, onCancel]);
}, [extrinsicType, isMessage, openWaiting, payload.payload, account.address, chainId, closeWaiting, onApproveSignature, onCancel, notify, t]);

const onConfirm = useCallback(() => {
removeTransactionPersist(extrinsicType);
Expand Down
4 changes: 1 addition & 3 deletions packages/extension-koni-ui/src/Popup/Home/Mint/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ const Component = ({ className }: Props): React.ReactElement => {
useEffect(() => {
apiSDK.nftMintingGetLog().then((rs) => {
// todo: remove after debug
console.log('nftMintingGetLog rs', rs);

if (rs) {
if (rs && rs.status === 'success') {
setMintedAddress(rs.address);
setMintSuccess(true);
}
Expand Down

0 comments on commit 1f326d4

Please sign in to comment.