Skip to content

Commit

Permalink
🐭 MINA testnet birleştirmeyi tamamla
Browse files Browse the repository at this point in the history
  • Loading branch information
KimlikDAO-bot committed Jan 31, 2024
1 parent 572ae44 commit fbd14be
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 54 deletions.
4 changes: 2 additions & 2 deletions al/sayfa.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const tcktYarat = (adres, açıkTckt) => {

/** @const {string} */
const telefonMetni = imzaMetni(["personInfo"]);
Telefon.kutuGöster(telefonMetni.slice(0, 25) +
telefonMetni.slice(35, dom.TR ? 161 : 173), dom.TR ? "İmzala" : "Sign"
Telefon.kutuGöster(telefonMetni.slice(0, dom.TR ? 25 : 35) +
telefonMetni.slice(35, dom.TR ? 161 : 193), dom.TR ? "İmzala" : "Sign"
);

/** @const {!Promise<!did.DecryptedSections>} */
Expand Down
4 changes: 0 additions & 4 deletions al/tanışma/birim.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
position: relative;
}

#taa {
cursor: default;
}

#tada {
outline: 1px dashed #c2c2c2;
border-radius: 5px;
Expand Down
13 changes: 12 additions & 1 deletion al/tanışma/birim.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Cüzdan from "/birim/cüzdan/birim";
import Tckt from "/birim/tckt/birim";
import { ChainId } from "/lib/crosschain/chains";
import { keccak256Uint8 } from "/lib/crypto/sha3";
import { combineMultiple } from "/lib/did/decryptedSections";
import network from "/lib/node/network";
Expand Down Expand Up @@ -94,6 +96,14 @@ const açıkTcktAlVe = (adres, sonra) => {
/** @const {Element} */
const kutu = dom.adla("ta");

if (Cüzdan.() == ChainId.MinaBerkeley) {
eDevletDüğmesi.innerText = "Proceed with test data (Berkeley)";
eDevletDüğmesi.onclick = () =>
window.location.href = "//mock-edevlet-kapisi.kimlikdao.net/auth?" +
"response_type=code&client_id=F5CAA82F-E2CF-4F21-A745-471ABE3CE7F8&" +
"redirect_uri=https://kimlikdao.org/mint"
}

kutu.classList.remove("disabled");

/** @type {!URLSearchParams} */
Expand All @@ -109,7 +119,7 @@ const açıkTcktAlVe = (adres, sonra) => {
dom.gizle(eDevletDüğmesi);
nkoDüğmesi.href = "javascript:";
nkoDüğmesi.classList.remove("act");
nkoDüğmesi.innerText = dom.TR ? "E-devlet’ten bilgileriniz alındı ✓" : "We got your info ✓";
nkoDüğmesi.innerText = dom.TR ? "VerifiableID’leriniz heaplanıyor ⏳" : "Computing your VerifiableIDs ⏳";
dom.düğmeDurdur(nkoDüğmesi);
/** @const {number} */
const istemciAn = Date.now() / 1000 | 0;
Expand All @@ -127,6 +137,7 @@ const açıkTcktAlVe = (adres, sonra) => {
`${base64(new Uint8Array(taahhüt))}&ts=${istemciAn}&oauth_code=${code}`))
.then((/** @type {!Response} */ res) => res.json())
.then((/** @type {!did.DecryptedSections} */ açıkTckt) => {
nkoDüğmesi.innerText = dom.TR ? "Bilgileriniz alındı ✓" : "We got your info ✓";
Tckt.açıkTcktGöster(açıkTckt);
kutu.classList.add("done");
sonra(adres, açıkTckt);
Expand Down
3 changes: 3 additions & 0 deletions al/ödeme/birim.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
<li id="odd0x144">
<span class="ods" data-en="0.0006">0,0006</span><span class="odp">ETH</span><img src="/birim/paralar/ETH.svg" height=32 width=32>
</li>
<li id="oddm:berkeley">
<span class="ods">1</span><span class="odp">tMINA</span><img src="/birim/paralar/MINA.png" height=32 width=32>
</li>
</ul>
</div>
</div>
98 changes: 66 additions & 32 deletions al/ödeme/birim.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AğBilgileri, AğBilgisi } from "/birim/ağlar/birim";
import Cüzdan from "/birim/cüzdan/birim";
import Telefon from "/birim/telefon/birim";
import { ChainId } from "/lib/crosschain/chains";
import { ChainGroup, ChainId } from "/lib/crosschain/chains";
import TCKT from "/lib/ethereum/TCKT";
import { whenMined } from "/lib/ethereum/transaction";
import dom from "/lib/util/dom";
Expand Down Expand Up @@ -185,40 +185,74 @@ const öde = (cidSözü, adresAğırlığı, eşik) => {
dom.adla("oda").onclick = () => {
/** @const {ChainId} */
const = Cüzdan.();
/** @const {!eth.Provider} */
const provider = /** @type {!eth.Provider} */(Cüzdan.bağlantı().provider);
/** @const {string} */
const adres = /** @type {string} */(Cüzdan.adres()).toLowerCase();
/** @const {!Promise<string>} */
const sonuç = para == 0
? cidSözü.then((cid) =>
TCKT.createWithRevokers(, adres, cid, eşik, adresAğırlığı))
: TCKT.isTokenERC20Permit(, para)
? Promise.all([cidSözü, TCKT.getPermitFor(, adres, para, iptalli)])
.then(birazBekle)
.then((/** @type {!Array<string>} */[cid, imza]) =>
TCKT.createWithRevokersWithTokenPermit(, adres, cid, eşik, adresAğırlığı, imza)
)
: Promise.all([cidSözü, TCKT.getApprovalFor(, adres, para)])
.then(birazBekle)
.then(([/** @type {string} */ cid, _]) =>
TCKT.createWithRevokersWithTokenPayment(, adres, cid, eşik, adresAğırlığı, para));
sonuç
.then((txHash) => {
/** @const {string} */
const hash = window.location.hash;
/** @const {string} */
const sonra = dom.TR
? hash.length >= 7
? decodeURIComponent(hash.slice("#sonra=".length)) : "/tcktm"
: hash.length >= 6
? decodeURIComponent(hash.slice("#then=".length)) : "/my-tckt";
Telefon.nftGeriAl();
window.localStorage.removeItem(adres + "nko_r");
whenMined(provider, txHash, () => window.location.href = sonra);
})
.catch(console.log);

const zincireYazılınca = () => {
/** @const {string} */
const hash = window.location.hash;
/** @const {string} */
const sonra = dom.TR
? hash.length >= 7
? decodeURIComponent(hash.slice("#sonra=".length)) : "/tcktm"
: hash.length >= 6
? decodeURIComponent(hash.slice("#then=".length)) : "/my-tckt";
window.localStorage.removeItem(adres + "nko_r");
window.location.href = sonra;
}

if (.startsWith(ChainGroup.MINA))
return cidSözü.then((cid) => inscribeOnMina(
/** @type {!mina.Provider} */(Cüzdan.bağlantı().provider), adres, cid, eşik, adresAğırlığı))
.then(zincireYazılınca);
else {
(para == 0
? cidSözü.then((cid) =>
TCKT.createWithRevokers(, adres, cid, eşik, adresAğırlığı))
: TCKT.isTokenERC20Permit(, para)
? Promise.all([cidSözü, TCKT.getPermitFor(, adres, para, iptalli)])
.then(birazBekle)
.then((/** @type {!Array<string>} */[cid, imza]) =>
TCKT.createWithRevokersWithTokenPermit(, adres, cid, eşik, adresAğırlığı, imza)
)
: Promise.all([cidSözü, TCKT.getApprovalFor(, adres, para)])
.then(birazBekle)
.then(([/** @type {string} */ cid, _]) =>
TCKT.createWithRevokersWithTokenPayment(, adres, cid, eşik, adresAğırlığı, para)))
.then((txHash) => {
Telefon.nftGeriAl();
const provider = /** @type {!eth.Provider} */(Cüzdan.bağlantı().provider);
whenMined(provider, txHash, zincireYazılınca);
});
}
};
}

/**
* @param {!mina.Provider} provider
* @param {string} address
* @param {string} cid
* @param {number} threshold
* @param {!Object<string, number>} weightByRevoker
* @return {!Promise<void>}
*/
const inscribeOnMina = (provider, address, cid, threshold, weightByRevoker) =>
provider.signJsonMessage({
message: [{
label: "Address",
value: address
}, {
label: "IPFS hash",
value: cid
}]
}).then((/** @type {!mina.SignedData} */ signedData) => fetch("//demo-mapping.kimlikdao.org", {
method: "PUT",
body: JSON.stringify({
"address": address,
"cid": cid,
"sig-s": signedData.signature.scalar,
"sig-f": signedData.signature.field
})
}));

export { Kök, öde };
11 changes: 8 additions & 3 deletions birim/cüzdan/birim.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ const AdresButonu = /** @type {!Element} */(dom.adla("cua"));
const AğButonu = /** @type {!Element} */(dom.adla("cuc"));
/** @const {!Element} */
const Menü = /** @type {!Element} */(dom.adla("cub"));
/** @const {!Element} */
const DebankLinki = /** @type {!Element} */(dom.adla("cude"));
/** @const {string} */
const BağlaMetni = AdresButonu.innerText;
/** @type {!Array<function(?string)>} */
Expand Down Expand Up @@ -231,6 +233,7 @@ const adresDeğişti = (adresler) => {
});
tcktDeğişti();
if (!eskiAdres) {
dom.gösterGizle(DebankLinki, .startsWith(ChainGroup.EVM));
bağlantıSeçiciGizle();
dom.adlaGöster("cue");
}
Expand Down Expand Up @@ -300,12 +303,14 @@ const bağlantıSeçildi = (bağlantıAdı, bağlantı) => {
});
}

const bağlantıSeçiciGizle = () => dom.adlaGizle("cuf" + .slice(0, 2));
const bağlantıSeçiciGizle = () => {
for (const grup of ChainGroups)
dom.adlaGizle("cuf" + grup);
}

const bağlantıSeçiciGöster = () => {
/** @const {ChainGroup} */
const ağGrubu = /** @type {ChainGroup} */(.slice(0, 2));
console.log(ağGrubu);
for (const grup of ChainGroups)
dom.adlaGösterGizle("cuf" + grup, grup == ağGrubu)

Expand Down Expand Up @@ -398,7 +403,7 @@ const kur = () => {
const url = `//${AğBilgileri[].izleyici}/${adresEki}/${Adres}`;
window.open(url, "_blank");
}
dom.adla("cude").onclick = () => {
DebankLinki.onclick = () => {
const url = "//debank.com/profile/" + Adres;
window.open(url, "_blank");
}
Expand Down
2 changes: 1 addition & 1 deletion birim/cüzdan/minaBağlantısı.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ const connectWithProvider = (provider, chainId, chainChanged, addressChanged, on
? provider.getAccounts()
.then((addresses) => {
if (!addresses || !addresses.length) return Promise.reject();
addressChanged(addresses);
provider.requestNetwork()
.then((/** @type {!mina.ChainInfoArgs} */ chainInfo) => {
chainChanged(/** @type {ChainId} */("m:" + chainInfo.chainId));
addressChanged(addresses);
provider.on("accountsChanged", addressChanged);
provider.on("chainChanged",
(/** @type {!mina.ChainInfoArgs} */ chainInfo) =>
Expand Down
Binary file added birim/paralar/MINA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions birim/paralar/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ build/birim/paralar/DOBBY.webp: birim/paralar/DOBBY.png
mkdir -p $(dir $@)
cwebp -q 90 $< -o $@

build/birim/paralar/birim.keymap: build/birim/paralar/DOBBY.webp \
$(call compressions, $(BIRIM_PARALAR_SVG_OUT))
build/birim/paralar/birim.keymap: $(call compressions, $(BIRIM_PARALAR_SVG_OUT)) \
build/birim/paralar/DOBBY.webp \
build/birim/paralar/MINA.webp
mkdir -p $(dir $@)
bun lib/birimler/hasher.js $@ $(BIRIM_PARALAR_SVG_OUT) $<
bun lib/birimler/hasher.js $@ $(BIRIM_PARALAR_SVG_OUT) \
build/birim/paralar/DOBBY.webp \
build/birim/paralar/MINA.webp
sed -i.bak 's#.webp#.png#' $@

birim/paralar.birim: build/birim/paralar/birim.keymap
2 changes: 1 addition & 1 deletion birim/tckt/birim.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
display: flex;
height: 100%;
transition: transform 1s;
width: 1250px;
width: 1400px;
}

.tcp {
Expand Down
12 changes: 6 additions & 6 deletions birim/tckt/birim.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
<div class="tcip">
<h7 data-en="CONTACT INFO">İLETİŞİM BİLGİLERİ</h7>
<div class="tcl" data-en="E-mail">E-posta</div>
<div class="tcl" id="tcemail">[email protected]</div>
<div id="tcemail">[email protected]</div>
<div class="tcl" data-en="Phone">Telefon</div>
<div class="tcl" id="tcphone">05555555555</div>
<div id="tcphone">05555555555</div>
</div>
</div>
<div id=tcabp class="tcp" style="display:none">
<div class="tcip">
<h7 data-en="ADDRESS INFO">ADRES BİLGİLERİ</h7>
<div class="tcl tcal" id="tcam">Mahalle</div>
<div class="tcl tcal" id="tcasnd">Sokak No/Daire</div>
<div class="tcl tcal" id="tcaii">İlçe / İl</div>
<div class="tcl tcal" id="tcau">Ülke</div>
<div class="tcal" id="tcam">Mahalle</div>
<div class="tcal" id="tcasnd">Sokak No/Daire</div>
<div class="tcal" id="tcaii">İlçe / İl</div>
<div class="tcal" id="tcau">Ülke</div>
</div>
</div>
<div class="tcp">
Expand Down
2 changes: 1 addition & 1 deletion lib

0 comments on commit fbd14be

Please sign in to comment.