Skip to content

Commit

Permalink
📦 Yeni build'a doğru
Browse files Browse the repository at this point in the history
  • Loading branch information
KimlikDAO-bot committed Aug 28, 2024
1 parent af171eb commit b567b6d
Show file tree
Hide file tree
Showing 36 changed files with 261 additions and 477 deletions.
24 changes: 8 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,17 @@ jobs:
submodules: recursive

- name: Install bun
uses: oven-sh/setup-bun@v1
uses: oven-sh/setup-bun@v2

- name: Install build tools
run: |
bun i
brew install pngcrush brotli zopfli woff2 webp
pip install fonttools
- name: Build blog index
run: |
make blog/dizin.sayfa
- name: Build prod worker
run: |
make build/blog/sunucu/prod.js
bun lib/birimler/builder.js blog
build-join:
name: Build KimlikDAO join
Expand All @@ -49,21 +45,17 @@ jobs:
submodules: recursive

- name: Install bun
uses: oven-sh/setup-bun@v1
uses: oven-sh/setup-bun@v2

- name: Install build tools
run: |
bun i
brew install pngcrush brotli zopfli woff2 webp
pip install fonttools
- name: Build join page
run: |
make join.sayfa
- name: Build prod worker
- name: Build the worker
run: |
make build/join/prod.js
bun lib/birimler/builder.js join
build-discord:
name: Build KimlikDAO discord worker
Expand All @@ -78,12 +70,12 @@ jobs:
submodules: recursive

- name: Install bun
uses: oven-sh/setup-bun@v1
uses: oven-sh/setup-bun@v2

- name: Install build tools
run: |
bun i
- name: Build discord worker
- name: Build the worker
run: |
make build/discord/prod.js
bun lib/birimler/builder.js discord
19 changes: 0 additions & 19 deletions Makefile

This file was deleted.

1 change: 1 addition & 0 deletions bld
5 changes: 0 additions & 5 deletions blog/Makefile

This file was deleted.

26 changes: 26 additions & 0 deletions blog/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
kök: blog
dizin: "dizin"
sayfalar:
- tr: "eliptik-egriler"
en: "elliptic-curves"

- tr: "eliptik-imza"
en: "ecdsa"

- tr: "2023.12"
en: "2023-12"

- tr: "2024.01"
en: "2024-01"

- tr: "mina-berkeley"
en: "mina_berkeley"
VARSAYILAN_AĞ: "mina:mainnet"

worker:
entry: sunucu/worker.js
name: kimlikdao-blog
domain_binding: blog.kimlikdao.org
kvs:
- name: KV
namespace_id: 84ae9125ab654c4ca5511acbe63e269f
19 changes: 5 additions & 14 deletions blog/dizin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,11 @@ build/blog/dizin/sayfa-%.js: blog/dizin/sayfa.js \
lib/mina/*.d.js \
lib/node/*.d.js lib/node/ipfs.js \
lib/util/dom.js lib/util/çevir.js lib/util/base58.js
mkdir -p $(dir $@)
bun google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
--define "TR\$$\$$module\$$lib\$$util\$$dom=$(Lang-$*)" \
--define "KonumTR\$$\$$module\$$birim\$$dil\$$birim=$(blog/dizin-tr)" \
--define "KonumEN\$$\$$module\$$birim\$$dil\$$birim=$(blog/dizin-en)" \
--emit_use_strict \
--module_resolution NODE \
--assume_function_wrapper \
--dependency_mode PRUNE \
--entry_point $< \
--js $^ \
--js_output_file $@
bun uglifyjs $@ -m -c toplevel,unsafe -o $@
wc $@
bun lib/kdjs/kdjs.js $< --define \
"TR\$$\$$module\$$lib\$$util\$$dom=$(Lang-$*)" \
"KonumTR\$$\$$module\$$birim\$$dil\$$birim=$(blog/dizin-tr)" \
"KonumEN\$$\$$module\$$birim\$$dil\$$birim=$(blog/dizin-en)" \
-o $@

build/blog/dizin/sayfa-%.css: blog/dizin/sayfa.css \
birim/lato/l400.css \
Expand Down
4 changes: 2 additions & 2 deletions blog/dizin/sayfa.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@

<body>
<birim:başlık data-title="KimlikDAO blog" data-link="//kimlikdao.org" data-piggyback="//kimlikdao.org/"
data-chains="0x1|0xa4b1,Ana ağ,Signal chain,default|0xa86a,Önerilir,Recommended|0x89|0x38|m:berkeley,Berkeley Testağı,Berkeley Testnet" />
data-chains="0x1|mina:testnet,Yeni ✨,New ✨|0xa4b1,Ana ağ,Signal chain,default|0x89|0xa86a|0x38" />
<div id="diz">
<birim:blog:mina-berkeley data-href="mina-berkeley" data-en-href="mina_berkeley"
data-piggyback="//kimlikdao.org/" />
<birim:blog:eliptik-imza data-href="eliptik-imza" data-en-href="ecdsa" data-piggyback="//kimlikdao.org/" />
<birim:blog:eliptik-egriler data-href="eliptik-egriler" data-en-href="elliptic-curves"
data-piggyback="//kimlikdao.org/" />
<birim:blog:2023.12 data-href="2023.12" data-en-href="2023-12" data-piggyback="//kimlikdao.org/" />
<!--<birim:blog:2024.01 data-href="2024.01" data-en-href="2024-01" data-piggyback="//kimlikdao.org/" />-->
<birim:blog:2024.01 data-href="2024.01" data-en-href="2024-01" data-piggyback="//kimlikdao.org/" />
</div>

<script async type="module" src="/blog/dizin/sayfa.js" data-remove-type></script>
Expand Down
4 changes: 1 addition & 3 deletions blog/dizin/sayfa.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import "/birim/blog/mina-berkeley/birim";
import "/birim/blog/eliptik-egriler/birim";
import "/birim/blog/eliptik-imza/birim";
import "/birim/blog/mina-berkeley/birim";
import "/birim/cüzdan/birim";
import "/birim/dil/birim";
import dom from "/lib/util/dom";

console.log(dom.TR ? "SA" : "HI");
3 changes: 2 additions & 1 deletion blog/mina-berkeley/contracts/Learn2Earn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const MINA = 1e9;
const LEARN2EARN = "B62qnnFm3SEtrMgStoj4SRVxKSTERh8Ho3Y9jCCa8TvgBF1mqa97Sij";

class Learn2EarnContract extends PerHumanIDv1Contract {
@method async claimReward(humanIDv1: HumanIDv1, witness: HumanIDv1Witness) {
@method
async claimReward(humanIDv1: HumanIDv1, witness: HumanIDv1Witness) {
const sender = this.sender.getUnconstrained();
this.acceptHumanIDv1(sender, humanIDv1, witness);
this.send({ to: sender, amount: 10 * MINA });
Expand Down
24 changes: 16 additions & 8 deletions blog/mina-berkeley/contracts/Learn2EarnWorker.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { PublicKey as KPublicKey } from "@kimlikdao/lib/mina/mina";
import {
HumanIDv1,
HumanIDv1Witness,
readPublicKey,
} from "@kimlikdao/sdk/mina/HumanIDv1";
import {
Field,
MerkleTree,
Mina,
Poseidon,
PrivateKey,
PublicKey,
Signature,
Signature
} from "o1js";
import { Learn2Earn, Learn2EarnContract, LEARN2EARN } from "./Learn2Earn";
import { LEARN2EARN, Learn2Earn, Learn2EarnContract } from "./Learn2Earn";

const NODE_HOSTNAME = "mina.kimlikdao.org";

Expand All @@ -25,12 +24,21 @@ const Learn2EarnCompiled = Learn2EarnContract.compile().then(() => {

const Network = Mina.Network("https://api.minascan.io/node/devnet/v1/graphql");
Mina.setActiveInstance(Network);
console.log("Devnet network instance configured.");
console.log("Devnet network instance configured.\nNow compiling the contract");

type Witness = {
isLeft: boolean,
sibling: string | Field
};

const getWitness = (humanIDv1Id: bigint): Promise<HumanIDv1Witness> =>
fetch(`https://${NODE_HOSTNAME}/witness/${LEARN2EARN}/${(humanIDv1Id & 0xffffffffn).toString(16)}`)
.then((res) => res.json())
.then((data) => new HumanIDv1Witness(data));
.then((witness) => {
witness.forEach((w: Witness) => w.sibling = Field(BigInt("0x" + w.sibling)))
console.log(witness);
return new HumanIDv1Witness(witness);
});

const blindingCommit = (sender: PublicKey) => {
const commitmentR = Field.random();
Expand All @@ -53,8 +61,8 @@ const signHumanIDv1 = (humanIDv1Id: bigint, sender: PublicKey): HumanIDv1 => {
};

onmessage = async (event) => {
const sender = readPublicKey(event.data);
const humanIDv1 = signHumanIDv1(100n, sender); // HumanIDv1.fromBytes(event.data.subarray(33));
const sender = PublicKey.from(KPublicKey.fromBytes(event.data));
const humanIDv1 = signHumanIDv1(103n, sender); // HumanIDv1.fromBytes(event.data.subarray(33));
const [witness] = await Promise.all([getWitness(humanIDv1.id.toBigInt()), Learn2EarnCompiled]);

const tx = await Mina.transaction(sender, () =>
Expand Down
14 changes: 14 additions & 0 deletions blog/mina-berkeley/contracts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"scripts": {
"build": "tsc",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
},
"dependencies": {
"@types/jest": "^29.5.12",
"jest": "^29.7.0",
"o1js": "^1.4.0",
"ts-jest": "^29.1.5",
"typescript": "^5.5.3"
},
"type": "module"
}
3 changes: 3 additions & 0 deletions blog/mina-berkeley/sayfa.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#bl {
font-size: 16px;
}
28 changes: 22 additions & 6 deletions blog/mina-berkeley/sayfa.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
</head>

<body>
<birim:başlık data-title="KimlikDAO blog" data-chains="m:devnet,Ödül ağı,Reward chain,default"
<birim:başlık data-title="KimlikDAO blog" data-chains="mina:testnet,Ödül ağı,Reward chain,default"
data-piggyback="//kimlikdao.org/" />
<div id="bl">
<img id=blh src="birim/blog/eliptik-egriler/banner.png" />
<img id=blh src="birim/blog/mina-berkeley/banner.png" width="100%" />
<h1 id=blh1 data-en="Mina Berkeley Upgrade">Mina Berkeley güncellemesi</h1>
<div id="bla">
<svg width="40" height="40">
Expand All @@ -26,19 +26,35 @@ <h1 id=blh1 data-en="Mina Berkeley Upgrade">Mina Berkeley güncellemesi</h1>
</svg>
<b class="blan" data-en="KimlikDAO learn & earn">KimlikDAO öğren & kazan</b>
</div>
Learn about Mina's Berkeley upgrade, interact with your first zkApp and earn 10 MINAs.
In the article we'll learn how to create a Mina wallet and fund it and interact with a zkApp with it.
Each participant will be awarded 10 MINAs.

The countdown to Mina’s major mainnet upgrade is well underway, and will bring three key features to the protocol,
as voted on by the community:
<ul>
<li>Easier zkApp programmability (MIP 4)</li>
<li>Kimchi, a more powerful proof system (MIP 3)</li>
<li>Removal of Supercharged Rewards (MIP 1)</li>
</ul>
<h2>Installing the Auro wallet</h2>
<h2>1) Install the Auro wallet</h2>
Click the link below to download the Auro wallet extension. Once you have the wallet extension,
you need to create an account. Here are the steps to do so:
<br><br>
<a id=mbau href="javascript:" class="act btn" data-en="Get Auro Wallet">Auro Wallet kur</a>
<h2 data-en="Minting your KPass">KPass'ini mintle</h2>
<a id=mbkp href="javascript:" class="act btn" data-en="Mint KPass">KPass al</a>

<h2 data-en="Claim your reward">Ödülünü al</h2>
<h2 data-en="2) Mint your KPass">3) KPass'ini mintle</h2>
Click below and follow the instructions to mint your KPass. Note that you need 1 MINA to be able to
mint your KPass. Fear not; when you mint you KPass, you will claim your reward right away!
<br><br>
<a id=mbkp href="//kimlikdao.org/mint" class="act btn" data-en="Mint KPass">KPass al</a>

<h2 data-en="3) Claim your reward">3) Ödülünü al</h2>
Congratulations! All steps are complete. Now you can claim you reward by presenting the fully
anonymous part of your KPass called HumanIDv1.

We need your HumanIDv1 to ensure that each real person can claim the reward at most once.
<br><br>
<a id=mbcl href="javascript:" class="act btn" data-en="Claim ✨">Ödülünü al ✨</a>
</div>
<script async type="module" src="/blog/mina-berkeley/sayfa.js" data-remove-type></script>
Expand Down
19 changes: 19 additions & 0 deletions blog/mina-berkeley/sayfa.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { PublicKey } from "/lib/mina/mina";

/** @const {!Element} */
const ClaimButton = dom.adla("mbcl");
/** @const {!Element} */
const KPassButton = dom.adla("mbkp");

const Learn2EarnWorker = new Worker(
"/blog/mina-berkeley/contracts/Learn2EarnWorker.ts",
Expand All @@ -21,3 +23,20 @@ ClaimButton.onclick = () => {
window.mina.sendTransaction({ transaction: msg.data })
.then(console.log);
};

/** @type {Promise<!eth.ERC721Unlockable>} */
let DosyaSözü;

/**
* @param {?string} _
* @param {Promise<!EmitHelper.ERC721Unlockable>} dosyaSözü
*/
const kpassDeğişti = (_, dosyaSözü) => {
/** @const {boolean} */
const kpassVar = dosyaSözü != null;
DosyaSözü = dosyaSözü;
}

kpassDeğişti("", null);

Cüzdan.kpassDeğişince(kpassDeğişti);
38 changes: 0 additions & 38 deletions blog/sunucu/Makefile

This file was deleted.

10 changes: 0 additions & 10 deletions blog/sunucu/dev.toml

This file was deleted.

Loading

0 comments on commit b567b6d

Please sign in to comment.