Skip to content

Commit

Permalink
Ⓜ️ Mina Berkeley testnet ekle
Browse files Browse the repository at this point in the history
  • Loading branch information
KimlikDAO-bot committed Jan 30, 2024
1 parent f844f1e commit 25b5ae6
Show file tree
Hide file tree
Showing 26 changed files with 248 additions and 58 deletions.
1 change: 1 addition & 0 deletions al/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ build/al/sayfa-%.js: al/sayfa.js \
lib/crypto/primes.js lib/crypto/wesolowski.js \
lib/did/*.js \
lib/ethereum/*.js \
lib/mina/*.d.js \
lib/node/*.d.js \
lib/node/ipfs.js lib/node/network.js \
lib/util/dom.js lib/util/çevir.js \
Expand Down
2 changes: 1 addition & 1 deletion al/imeceİptal/birim.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { AğBilgileri, AğBilgisi } from "/birim/ağlar/birim";
import Cüzdan from "/birim/cüzdan/birim";
import { ChainId } from "/lib/crosschain/chainId";
import { ChainId } from "/lib/crosschain/chains";
import TCKT from "/lib/ethereum/TCKT";
import evm from "/lib/ethereum/evm";
import dom from "/lib/util/dom";
Expand Down
2 changes: 1 addition & 1 deletion 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/chainId";
import { 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
1 change: 1 addition & 0 deletions ana/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ build/ana/sayfa-%.js: ana/sayfa.js \
lib/did/*.d.js \
lib/ethereum/*.d.js \
lib/ethereum/provider.js lib/ethereum/TCKTLite.js \
lib/mina/*.d.js \
lib/node/*.d.js lib/node/ipfs.js \
lib/util/dom.js lib/util/çevir.js
mkdir -p $(dir $@)
Expand Down
2 changes: 1 addition & 1 deletion ana/sayfa.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
katıl</a>
<a class=bae href="//discord.gg/H2wg6pcWXG" target="_blank" rel="noreferrer">Discord</a>
<birim:dil />
<birim:cüzdan data-chains="0x1|0xa4b1,Ana ağ,Signal chain,default|0xa86a,Önerilir,Recommended|0x89|0x38|0xfa" />
<birim:cüzdan data-chains="0x1|0xa4b1,Ana ağ,Signal chain,default|0xa86a,Önerilir,Recommended|0x89|0x38|m:berkeley" />
<a id="bal" data-en-href="/mint" href="/al" class="btn act"><span data-phantom data-en="Mint TCKT">Hemen TCKT
al</span><img src="/ana/ok.svg" data-inline>
</a>
Expand Down
6 changes: 4 additions & 2 deletions birim/ağlar/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ AĞLAR_SVGS := $(basename $(notdir $(wildcard birim/ağlar/*.svg)))
AĞLAR_REQUEST_SVGS := $(addsuffix .svg,$(addprefix build/birim/ağlar/, $(AĞLAR_SVGS)))
AĞLAR_INLINE_SVGS := $(addsuffix .isvg,$(addprefix build/birim/ağlar/, $(AĞLAR_SVGS)))

build/birim/ağlar/birim.keymap: $(call compressions, $(AĞLAR_REQUEST_SVGS))
build/birim/ağlar/birim.keymap: $(call compressions, $(AĞLAR_REQUEST_SVGS)) \
build/birim/ağlar/mina.webp
mkdir -p $(dir $@)
bun lib/birimler/hasher.js $@ $(AĞLAR_REQUEST_SVGS)
bun lib/birimler/hasher.js $@ $(AĞLAR_REQUEST_SVGS) build/birim/ağlar/mina.webp
sed -i.bak 's#mina.webp#mina.png#' $@

birim/ağlar.birim: build/birim/ağlar/birim.keymap $(AĞLAR_INLINE_SVGS)
3 changes: 2 additions & 1 deletion birim/ağlar/adlar.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export const Adlar = {
"0x38": "BNB Chain",
"0x406": "Conflux eSpace",
"0xfa": "Fantom",
"0x144": "zkSync Era"
"0x144": "zkSync Era",
"m:berkeley": "Mina Berkeley",
};
9 changes: 8 additions & 1 deletion birim/ağlar/birim.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId } from "/lib/crosschain/chainId";
import { ChainId } from "/lib/crosschain/chains";
import dom from "/lib/util/dom";

/**
Expand Down Expand Up @@ -88,6 +88,13 @@ const AğBilgileri = {
token: "ether",
tokenEki: dom.TR ? ["’den", "’e"] : [],
rpcUrl: "mainnet.era.zksync.io"
},
"m:berkeley": {
ad: "Mina Berkeley",
izleyici: "berkeley.minaexplorer.com/",
tokenKodu: "tMINA",
tokenEki: dom.TR ? ["’dan", "’ya"] : [],
rpcUrl: "proxy.berkeley.minaexplorer.com"
}
}

Expand Down
Binary file added birim/ağlar/mina.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion birim/başlık/birim.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<div id="baf">
<birim:dil data-inherit="piggyback" />
<birim:cüzdan data-inherit="chains,piggyback"
data-chains="0x1|0xa4b1,Ana ağ,Signal chain,default|0xa86a,Önerilir,Recommended|0x89|0x38|0xfa" />
data-chains="0x1|0xa4b1,Ana ağ,Signal chain,default|0xa86a,Önerilir,Recommended|0x89|0x38|m:berkeley" />
</div>
</div>
21 changes: 14 additions & 7 deletions birim/cüzdan/ağDüğmesi.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import { readFileSync } from "fs";
import { optimize } from "svgo";
import svgoConfig from "../../lib/birimler/svgoInlineConfig";
import { ChainId } from "../../lib/crosschain/chains";
import { Adlar } from "../ağlar/adlar";

let out = "";

export const üret = (değerler) => {
/**
* @param {ChainId} chainId
*/
const resimAdı = (ağAdı) => "birim/ağlar/" +
(ağAdı.startsWith("m:")
? "mina.png"
: Adlar[ağAdı].replaceAll(" ", "").toLowerCase() + ".svg");

const üret = (değerler) => {
if (!("chains" in değerler)) return "";
/** @const {!Array<string>} */
const chains = değerler.chains.split("|");
Expand All @@ -14,12 +23,10 @@ export const üret = (değerler) => {

for (const chain of chains) {
const parts = chain.split(",");
if (parts.length > 3) {
return out = optimize(
readFileSync(`birim/ağlar/${Adlar[parts[0]].replaceAll(" ", "").toLowerCase()}.svg`),
svgoConfig
).data;
}
if (parts.length > 3)
return out = optimize(readFileSync(resimAdı(parts[0])), svgoConfig).data;
}
return out;
}

export { resimAdı, üret };
9 changes: 7 additions & 2 deletions birim/cüzdan/ağListesi.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Adlar } from "../ağlar/adlar";
import { resimAdı } from "./ağDüğmesi";

export const üret = (değerler) => {
const üret = (değerler) => {
if (!("chains" in değerler)) return "";
/** @const {!Array<string>} */
const chains = değerler.chains.split("|");
Expand All @@ -12,10 +13,14 @@ export const üret = (değerler) => {
return `\n<li id="cud${parts[0]}"${selected ? ' class=sel' : ""}>` +
(selected
? "<span></span>"
: `<img src="/birim/ağlar/${Adlar[parts[0]].toLowerCase().replaceAll(" ", "")}.svg" width="32" height="32">`) +
: `<img src="/${resimAdı(parts[0])}" width="32" height="32">`) +
(parts.length > 1
? ` <div>${Adlar[parts[0]]}<div class=cuo>${parts[1 + (değerler.dil == "en")]}</div></div>`
: ` ${Adlar[parts[0]]}`) +
"</li>"
}).join("");
}

export {
üret
};
10 changes: 5 additions & 5 deletions birim/cüzdan/birim.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
right: 0;
}

#cuf {
.cuf {
cursor: pointer;
list-style: none;
margin: 0;
Expand All @@ -80,7 +80,7 @@

#cud>li,
#cue>li,
#cuf>li {
.cuf>li {
cursor: pointer;
align-items: center;
border-radius: 8px;
Expand All @@ -91,13 +91,13 @@
padding: 6px 12px;
}

#cuf>li {
.cuf>li {
position: relative;
}

#cud>li:hover,
#cue>li:hover,
#cuf>li:hover {
.cuf>li:hover {
background-color: #f2f2f2;
}

Expand Down Expand Up @@ -162,7 +162,7 @@ li.on>.cust {
background: rgb(241, 29, 29);
position: absolute;
bottom: 14px;
left: 40px;
left: 42px;
}

#cuin,
Expand Down
9 changes: 8 additions & 1 deletion birim/cüzdan/birim.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<button id=cua data-en="Connect wallet">Cüzdan bağla</button>
<div id="cub" style="display:none" tabindex="0">
<ul id="cud" data-generate="ağListesi"></ul>
<ul id="cuf">
<ul id="cuf0x" class="cuf">
<li id="cura">
<img src="/birim/cüzdan/img/rabby.svg" width="32" height="32">
<div class="cust"></div>
Expand All @@ -22,6 +22,13 @@
 MetaMask<span class=cui style="display:none" data-en="GET">İNDİR</span>
</li>
</ul>
<ul id="cufm:" class="cuf" style="display:none">
<li id="cuau">
<img src="/birim/cüzdan/img/auro.svg" width="32" height="32">
<div class="cust"></div>
 Auro Wallet<span class="cui" style="display:none" data-en="GET">İNDİR</span>
</li>
</ul>
<ul id=cue style="display:none">
<div id="cueh">
<img id=cutc height=80 width="80" src="/birim/cüzdan/img/qmark.svg">
Expand Down
83 changes: 53 additions & 30 deletions birim/cüzdan/birim.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CoreBağlantısı, MetaMaskBağlantısı, RabbyBağlantısı } from "./evmBağlantısı";
import { AuroConnection as AuroBağlantısı } from "./minaBağlantısı";
import { AğBilgileri } from "/birim/ağlar/birim";
import { ChainId } from "/lib/crosschain/chainId";
import { ChainGroup, ChainGroups, ChainId } from "/lib/crosschain/chains";
import { Provider } from "/lib/crosschain/provider";
import TCKT from "/lib/ethereum/TCKTLite";
import ipfs from "/lib/node/ipfs";
Expand Down Expand Up @@ -54,7 +55,7 @@ const BoşBağlantı = /** @type {!Provider} */({
* @return {!Promise<void>}
*/
switchChain() {
ağDeğişti()
ağDeğişti();
return Promise.resolve();
},

Expand All @@ -75,14 +76,17 @@ const Bağlantılar = {
"co": CoreBağlantısı,
"ra": RabbyBağlantısı,
"mm": MetaMaskBağlantısı,
"au": AuroBağlantısı,
};

/** @const {Element} */
const AdresButonu = dom.adla("cua");
/** @const {Element} */
const AğButonu = dom.adla("cuc");
/** @const {Element} */
const Menü = dom.adla("cub");
/** @const {!Element} */
const AdresButonu = /** @type {!Element} */(dom.adla("cua"));
/** @const {!Element} */
const AğButonu = /** @type {!Element} */(dom.adla("cuc"));
/** @const {!Element} */
const Menü = /** @type {!Element} */(dom.adla("cub"));
/** @const {string} */
const BağlaMetni = AdresButonu.innerText;
/** @type {!Array<function(?string)>} */
const AdresDeğişince = [];
/** @const {!Array<function()>} */
Expand All @@ -100,8 +104,6 @@ let Adres = null;
/** @type {ChainId} */
let = /** @type {ChainId} */(VARSAYILAN_AĞ);
/** @type {?string} */
let BağlaMetni;
/** @type {?string} */
let TcktYokResmi;

/**
Expand Down Expand Up @@ -151,7 +153,11 @@ const ağDeğişti = (yeniAğ) => {
AğButonu.replaceChild(
dom.adla("cud" + yeniAğ).firstElementChild.cloneNode(true),
AğButonu.firstElementChild);
/** @const {boolean} */
const ağGrubuDeğişti = !.startsWith(yeniAğ.slice(0, 2));
= yeniAğ;
if (ağGrubuDeğişti)
bağlantıSeçiciGöster();
tcktDeğişti();
for (const f of AğDeğişince) f(yeniAğ);
}
Expand Down Expand Up @@ -198,22 +204,25 @@ const tcktDeğişti = () => {
})
}

const koptu = () => {
Adres = null;
AdresButonu.innerText = BağlaMetni;
bağlantıSeçildi("", BoşBağlantı);
dom.adlaGizle("cue");
bağlantıSeçiciGöster();
for (const f of Kopunca) f();
}

/**
* @param {!Array<string>} adresler cüzdandan gelen adresler dizisi.
*/
const adresDeğişti = (adresler) => {
if (!adresler || !adresler.length) {
Adres = null;
AdresButonu.innerText = BağlaMetni;
bağlantıSeçildi("", BoşBağlantı);
dom.adlaGizle("cue");
bağlantıSeçiciGöster();
for (const f of Kopunca) f();
} else if (adresler[0] != Adres) {
if (!adresler || !adresler.length)
koptu();
else if (adresler[0] != Adres) {
/** @const {?string} */
const eskiAdres = Adres;
Adres = adresler[0];
BağlaMetni ||= AdresButonu.innerText;
dom.adla("cuad").firstElementChild.innerText =
AdresButonu.innerText = hızlıArabirimAdı(Adres);

Expand All @@ -222,11 +231,11 @@ const adresDeğişti = (adresler) => {
});
tcktDeğişti();
if (!eskiAdres) {
dom.adlaGizle("cuf");
bağlantıSeçiciGizle();
dom.adlaGöster("cue");
}
for (const f of AdresDeğişince) f(Adres);
}
for (const f of AdresDeğişince) f(Adres);
}

/**
Expand Down Expand Up @@ -263,7 +272,12 @@ const bağlantıDeğişince = (f) => BağlantıDeğişince.push(f);
/**
* @param {ChainId} ağ
*/
const ağSeçildi = () => Bağlı.switchChain()
const ağSeçildi = () => {
if (.slice(0, 2) != .slice(0, 2))
koptu();

Bağlı.switchChain();
}

/**
* @param {string} bağlantıAdı
Expand All @@ -286,10 +300,18 @@ 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çiciGöster = () => {
/** @const {Element} */
const seçici = dom.adla("cuf");
dom.göster(seçici);
/** @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)

/** @const {!Element} */
const seçici = /** @type {!Element} */(dom.adla("cuf" + ağGrubu));

/** @const {!NodeList<!Element>} */
const satırlar = seçici.children;
for (const satır of satırlar) {
Expand Down Expand Up @@ -342,9 +364,9 @@ const aç = () => {

const kur = () => {
/** @const {Element} */
const anaAğ = dom.adla("cud" + VARSAYILAN_AĞ);
anaAğ.replaceChild(AğButonu.firstElementChild.cloneNode(true),
anaAğ.firstElementChild);
const seçiliAğ = dom.adla("cud" + VARSAYILAN_AĞ);
seçiliAğ.replaceChild(AğButonu.firstElementChild.cloneNode(true),
seçiliAğ.firstElementChild);
AdresButonu.onclick = AğButonu.onclick = ;
Menü.onblur = () => {
dom.gizle(Menü);
Expand All @@ -368,11 +390,12 @@ const kur = () => {
window.location.href = dom.TR ? "//kimlikdao.org/oyla" : "//kimlikdao.org/vote";
düğmeler[4].onclick = () =>
window.location.href = "//kimlikdao.org" + (dom.TR ? "/iptal" : "/revoke");
düğmeler[5].onclick = () => adresDeğişti([]);
düğmeler[5].onclick = () => koptu();

dom.adla("cuad").onclick = () => navigator.clipboard.writeText(/** @type {string} */(Adres));
dom.adla("cuex").onclick = () => {
const url = `//${AğBilgileri[].izleyici}/address/${Adres}`;
const adresEki = .startsWith("m:") ? "wallet" : "address";
const url = `//${AğBilgileri[].izleyici}/${adresEki}/${Adres}`;
window.open(url, "_blank");
}
dom.adla("cude").onclick = () => {
Expand Down
Loading

0 comments on commit 25b5ae6

Please sign in to comment.