Skip to content

Instantly share code, notes, and snippets.

use bip32::{Language, Mnemonic};
use cardano_message_signing as ms;
use cardano_serialization_lib as csl;
use cardano_serialization_lib::address::NetworkInfo;
use csl::{
address::{Address, BaseAddress, StakeCredential},
crypto::{Bip32PrivateKey, Bip32PublicKey},
};
use ms::{builders::AlgorithmId, Label};
[package]
name = "gdext_lib"
version = "0.1.0"
edition = "2021"

[lib]
crate-type = ["cdylib"]

[dependencies]
@mikekeke
mikekeke / main.rs
Last active May 20, 2024 13:05
Example of Carano CIP-30 and CIP-0008 message signing with Emurgo `message-signing` library
use bip32::{Language, Mnemonic};
use cardano_message_signing as ms;
use cardano_serialization_lib as csl;
use cardano_serialization_lib::address::NetworkInfo;
use csl::{
address::{Address, BaseAddress, StakeCredential},
crypto::{Bip32PrivateKey, Bip32PublicKey},
};
use ms::{builders::AlgorithmId, Label};
@mikekeke
mikekeke / calc.ts
Last active September 26, 2023 07:50
calculations
const base = 1200;
const total = 7100 + 1250 + 400 + 70.183;
const MihaR = base;
const Costya = base - 400;
const LyohaM = base - 70.183;
const Antoha = base;
const DimanK = base - 1250;
const DimanV = base;
const Me = base;
@mikekeke
mikekeke / radix.sql
Last active September 13, 2023 14:00
radix
with token_res_id as (select id
from entities
where address = ?),
current_state as (select entity_id,
max(from_state_version) as state
from entity_resource_aggregated_vaults_history,
token_res_id
where resource_entity_id = token_res_id.id
and from_state_version <= ? -- 3293441 -- 3297103
group by entity_id)
@mikekeke
mikekeke / promise-then.js
Created May 24, 2023 11:22
promise-then
async function deploy() {
contract.setContractHash("hash-2131266e1784f2f1bd9061f579f4a55ef04b40d1e11ad7dc12dd9597d3870f05");
provider.getActivePublicKey()
.then(pubKeyHex => {
console.log("PK hex: " + pubKeyHex);
const pubKey = CLPublicKey.fromHex(pubKeyHex);
const deploy = contract.callEntrypoint(
"counter_inc",
RuntimeArgs.fromMap({}),
diff --git a/tests/Cargo.lock b/tests/Cargo.lock
index 3feacfe..635bbcf 100644
--- a/tests/Cargo.lock
+++ b/tests/Cargo.lock
@@ -98,9 +98,9 @@ dependencies = [
[[package]]
name = "bumpalo"
-version = "3.12.2"
+version = "3.12.1"
@mikekeke
mikekeke / embedano-demo-snippets.md
Last active March 20, 2023 14:25
embedano-demo-snippets

Code snippets

Run Nix with flake

nix develop --extra-experimental-features 'flakes nix-command'

Links

@mikekeke
mikekeke / custodial-scrip-design.md
Last active February 6, 2023 16:01
seath design

Design with custodial script

The idea is that participants submit action UTXOs and then single "batcher" (as referred in some DEXes) runs those "actions" by submitting transactions that can spend state UTXO. The difference form existing batchers is that batcher - is leader picked among participants in trustless manner.

Step 1

Each participant builds and submits "action" transaction that creates UTXO at custodial script address.

flowchart LR