UNPKG

@swaptoshi/dex-module

Version:

Klayr decentralized exchange (dex) on-chain module

23 lines 849 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isSwapByTransfer = isSwapByTransfer; const codec_1 = require("@klayr/codec"); const pool_1 = require("../../stores/pool"); const schema_1 = require("../../schema"); async function isSwapByTransfer(context, transaction) { if (transaction.module === 'token' && transaction.command === 'transfer') { const params = codec_1.codec.decode(schema_1.tokenTransferParamsSchema, transaction.params); const poolStore = this.stores.get(pool_1.PoolStore); if (await poolStore.has(context, params.recipientAddress)) { return { status: true, payload: params, }; } } return { status: false, payload: undefined, }; } //# sourceMappingURL=isSwapByTransfer.js.map