62 lines
2.0 KiB
Vue
62 lines
2.0 KiB
Vue
<template>
|
|
<needs-signer>
|
|
<phone-card class="tordercard">
|
|
<v-card-title class="big">{{title}}</v-card-title>
|
|
<v-card-subtitle>{{subtitle}}</v-card-subtitle>
|
|
<v-card-item>
|
|
<pair-choice/>
|
|
<div v-if="os.route && !os.routesPending">
|
|
<amount/>
|
|
<slot/>
|
|
</div>
|
|
</v-card-item>
|
|
<v-card-actions class="d-flex justify-space-evenly mb-4">
|
|
<v-btn variant="outlined" color="red" @click="nav('Assets')">Cancel</v-btn>
|
|
<v-btn variant="flat" color="green" :disabled="!valid()" @click="placeOrder">Place Dexorder</v-btn>
|
|
</v-card-actions>
|
|
</phone-card>
|
|
</needs-signer>
|
|
</template>
|
|
|
|
<script setup>
|
|
import {useOrderStore, useStore} from "@/store/store";
|
|
import PhoneCard from "@/components/PhoneCard.vue";
|
|
import Amount from "@/components/Amount.vue"
|
|
// noinspection ES6UnusedImports
|
|
import {nav, SingletonCoroutine, vAutoSelect} from "@/misc.js";
|
|
import {newOrder} from "@/blockchain/orderlib.js";
|
|
import {FixedNumber} from "ethers";
|
|
import {pendOrder} from "@/blockchain/wallet.js";
|
|
import PairChoice from "@/components/PairChoice.vue";
|
|
import NeedsSigner from "@/components/NeedsSigner.vue";
|
|
import {useChartOrderStore} from "@/orderbuild.js";
|
|
|
|
const s = useStore()
|
|
const os = useOrderStore()
|
|
const co = useChartOrderStore()
|
|
const props = defineProps(['title','subtitle','valid','tranches'])
|
|
|
|
function placeOrder() {
|
|
const ta = os.tokenA;
|
|
const tb = os.tokenB;
|
|
const tokenIn = os.buy ? tb.address : ta.address
|
|
const tokenOut = os.buy ? ta.address : tb.address
|
|
const symbol = co.selectedSymbol
|
|
const amt = FixedNumber.fromString(os.totalAmount.toString(), {decimals: os.amountToken.decimals}).value
|
|
const ts = props.tranches()
|
|
console.log('new order', symbol)
|
|
const order = newOrder(tokenIn, tokenOut, symbol.e, symbol.fee, amt, os.amountIsInput, symbol.inverted, ts) // todo: minAmount, outputToOwner, conditionalOrder
|
|
pendOrder(order)
|
|
}
|
|
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
@use "@/styles/vars" as *;
|
|
|
|
.tordercard {
|
|
max-width: $card-maxw;
|
|
}
|
|
|
|
</style>
|