@unchainedshop/plugins
Version:
Because of a Typescript issue with upstream "postfinancecheckout", the Postfinance plugin has been disabled from transpilation, import the source ts files from src and enable node_module tsc or copy over the src/payment/postfinance-checkout to your projec
28 lines • 1.11 kB
JavaScript
import { WorkerEventTypes } from '@unchainedshop/core-worker';
import { WorkerAdapter, WorkerDirector } from '@unchainedshop/core';
import { subscribe } from '@unchainedshop/events';
export const ExportTokenWorker = {
...WorkerAdapter,
key: 'shop.unchained.worker-plugin.export-token',
label: 'External worker to hold the state of the minting/export process of tokens',
version: '1.0.0',
type: 'EXPORT_TOKEN',
external: true,
async doWork() {
throw new Error('Cannot do work for external workers');
},
};
export const configureExportToken = (unchainedAPI) => {
subscribe(WorkerEventTypes.FINISHED, async ({ payload: work }) => {
if (work.type === 'EXPORT_TOKEN' && work.success) {
await unchainedAPI.modules.warehousing.updateTokenOwnership({
tokenId: work.input.token._id,
userId: null,
walletAddress: work.input.recipientWalletAddress,
});
}
});
};
export default configureExportToken;
WorkerDirector.registerAdapter(ExportTokenWorker);
//# sourceMappingURL=export-token.js.map