@rarimo/swap
Version:
Internal tools that other Rarimo packages use to swap tokens.
33 lines (32 loc) • 1.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getTransferData", {
enumerable: true,
get: function() {
return getTransferData;
}
});
const _const = require("../../../const");
const _enums = require("../../../enums");
const _payload = require("./payload");
const getTransferData = (_token, receiver = _const.CALLER_ADDRESS)=>{
// If the token wasn't bridged thus transfer to the receiver is required,
// otherwise we will transfer change after swap operation which should be 0
// but better to be sure that all tokens were transferred to the receiver
const command = _token.isNative ? _enums.SwapCommands.TransferNative : _enums.SwapCommands.TransferErc20;
const token = _token.isNative ? [] : [
_token.address
];
// We transfer amount of the tokens that left on the swap-contract balance
// to the receiver to be sure that the contract balance is empty
return [
(0, _payload.buildPayload)(command, [
...token,
receiver,
_const.CONTRACT_BALANCE
])
];
};
//# sourceMappingURL=transfer.js.map