|
|
|
@ -25,13 +25,16 @@
|
|
|
|
|
<div>is owned by |
|
|
|
|
<div class="owner-address">you</div> |
|
|
|
|
</div> |
|
|
|
|
<a :href="result.nft_info.explorer_link">View nft</a> |
|
|
|
|
<br/> |
|
|
|
|
<div id="wallet_input" class="rec-field"> |
|
|
|
|
<div style="display: flex; width: 100%"> |
|
|
|
|
<p style="width: 9rem">Wallet:</p> |
|
|
|
|
<contenteditable class="record-inp" tag="div" :no-hl="true" :no-html="true" spellcheck="false" |
|
|
|
|
v-model="wallet_rec"></contenteditable> |
|
|
|
|
<div class="record-submit get_b">Save</div> |
|
|
|
|
<div :class="{'record-submit': true, 'get_b': true, 'inactive': !walletChanged}" @click="saveWallet()"> |
|
|
|
|
Save |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div id="site_input" class="rec-field"> |
|
|
|
@ -39,7 +42,8 @@
|
|
|
|
|
<p style="width: 9rem;">Site:</p> |
|
|
|
|
<contenteditable class="record-inp" tag="div" :no-hl="true" :no-html="true" spellcheck="false" |
|
|
|
|
v-model="site_rec"></contenteditable> |
|
|
|
|
<div class="record-submit get_b">Save</div> |
|
|
|
|
<div :class="{'record-submit': true, 'get_b': true, 'inactive': !siteChanged}" @click="saveSite()">Save |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
@ -62,6 +66,7 @@ import RotateSquare2 from "../components/RotateSquare2.vue";
|
|
|
|
|
import {get_domain_result, get_records} from "../result"; |
|
|
|
|
import {convertAddress} from "../utils"; |
|
|
|
|
import contenteditable from 'vue-contenteditable'; |
|
|
|
|
import {call_api} from "../api"; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
name: "Explore", |
|
|
|
@ -76,7 +81,9 @@ export default {
|
|
|
|
|
result: null, |
|
|
|
|
records: null, |
|
|
|
|
wallet_rec: null, |
|
|
|
|
site_rec: null |
|
|
|
|
site_rec: null, |
|
|
|
|
signingSite: false, |
|
|
|
|
signingWallet: false |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
@ -109,8 +116,75 @@ export default {
|
|
|
|
|
}, |
|
|
|
|
isMine() { |
|
|
|
|
return this.result.owner === this.$store.getters.address; |
|
|
|
|
}, |
|
|
|
|
walletChanged() { |
|
|
|
|
return this.records && this.wallet_rec !== this.records.wallet; |
|
|
|
|
}, |
|
|
|
|
siteChanged() { |
|
|
|
|
return this.records && this.site_rec !== this.records.site; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
async saveWallet() { |
|
|
|
|
if (!this.walletChanged) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// get the message from api at /set-record/site/{site} and sign it with tonconnect (from storage) |
|
|
|
|
let message = await call_api('set-record/wallet/' + this.wallet_rec); |
|
|
|
|
// send the message to tonconnect |
|
|
|
|
let d = new Date(); |
|
|
|
|
let validness = parseInt((d.getTime() / 1000).toFixed(0)) + 360000; |
|
|
|
|
let transaction = { |
|
|
|
|
validUntil: validness, |
|
|
|
|
messages: [ |
|
|
|
|
{ |
|
|
|
|
amount: (0.05 * 1000000000).toString(), |
|
|
|
|
address: this.result.nft_info.address, |
|
|
|
|
payload: message |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}; |
|
|
|
|
this.signingWallet = true; |
|
|
|
|
console.log("Sending transaction", transaction); |
|
|
|
|
const result = await this.$store.state.connector.sendTransaction(transaction); |
|
|
|
|
this.signingWallet = false; |
|
|
|
|
if(!result.boc) { |
|
|
|
|
// todo |
|
|
|
|
} |
|
|
|
|
get_records(this.result.nft_info.address).then(r => { |
|
|
|
|
this.records = r; |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
async saveSite() { |
|
|
|
|
if (!this.siteChanged) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// get the message from api at /set-record/site/{site} and sign it with tonconnect (from storage) |
|
|
|
|
let message = await call_api('set-record/site/' + this.site_rec); |
|
|
|
|
// send the message to tonconnect |
|
|
|
|
let d = new Date(); |
|
|
|
|
let validness = parseInt((d.getTime() / 1000).toFixed(0)) + 360000; |
|
|
|
|
let transaction = { |
|
|
|
|
validUntil: validness, |
|
|
|
|
messages: [ |
|
|
|
|
{ |
|
|
|
|
amount: (0.05 * 1000000000).toString(), |
|
|
|
|
address: this.result.nft_info.address, |
|
|
|
|
payload: message |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}; |
|
|
|
|
this.signingSite = true; |
|
|
|
|
const result = await this.$store.state.connector.sendTransaction(transaction); |
|
|
|
|
this.signingSite = false; |
|
|
|
|
if(!result.boc) { |
|
|
|
|
// todo |
|
|
|
|
} |
|
|
|
|
get_records(this.result.nft_info.address).then(r => { |
|
|
|
|
this.records = r; |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
records: function (val) { |
|
|
|
|
if (val) { |
|
|
|
|