Skip to content

Instantly share code, notes, and snippets.

View zed-wong's full-sized avatar
😵‍💫
Tired

Zed Wong zed-wong

😵‍💫
Tired
View GitHub Profile

单私钥派生多链地址方式表(Universal Key Derivation)

本文档说明如何从一个唯一的 Ed25519 私钥(如 Mixin Bot 私钥),统一派生出多链的地址与私钥,以实现自动化资产管理与跨链操作。


Step 1:主私钥与统一入口

输入

  • Mixin Bot 的 Ed25519 私钥(64字节,Base64或Hex格式)
@zed-wong
zed-wong / 4swap_ccxt.md
Last active November 3, 2024 09:25
The guide of adding a new exchange to ccxt, and how did I add the 4swap

Adding 4swap to CCXT

This is the first time we’re integrating an exchange on the Mixin network into CCXT, but the process is actually more straightforward than expected.

Overview

CCXT started as an SDK to simplify connecting to various centralized exchanges. However, with the recent addition of Hyperliquid—a decentralized exchange on an EVM network—CCXT is expanding its reach, paving the way for more DEX integrations across different networks.

To add a new exchange to CCXT, we create a file under /ts/src/ named [exchange-name].ts. This file defines the methods available when initializing an instance of the exchange. It inherits the base class in /ts/src/base/Exchange.ts, which contains all possible methods for an exchange. We implement only the necessary ones for the new exchange in the new file.

This file has been truncated, but you can view the full file.
{
"code":0,
"success":true,
"message":"",
"data":[
{
"buyMaxInvestment":1,
"buyMaxDelayInvestment":1,
"canBuyInvestment":true,
"canBuyDelayInvestment":true,
@zed-wong
zed-wong / safe-balance.ts
Last active January 9, 2024 01:51
mixin safe get user balance
import axios from "axios";
import { hashMembers } from "@mixin.dev/mixin-node-sdk";
export const mixinAsset = async (asset_id: string) => {
const result = await axios
.get(MIXIN_API_BASE_URL + `/network/assets/${asset_id}`);
return result.data ? result.data.data : {};
}
@zed-wong
zed-wong / crypto-coin-chart.svelte
Last active December 26, 2023 08:12
The most simple version of chart using svelte-lightweight-charts
<script lang="ts">
import clsx from "clsx";
import { _ } from "svelte-i18n";
import { locale } from "svelte-i18n";
import colors from "tailwindcss/colors";
import { ColorType } from "lightweight-charts";
import { Chart, LineSeries } from "svelte-lightweight-charts";
import { ChartPrice, showCoinPrice } from "$lib/stores/market";
let innerWidth = 0,
@zed-wong
zed-wong / sol-inscription.js
Created December 6, 2023 03:28
sol-inscription
// sol inscription
// change secret to yours
// change rpc is needed
// change public key and data
const { Connection, Keypair, PublicKey, sendAndConfirmTransaction, Transaction, TransactionInstruction } = require("@solana/web3.js");
const bs58 = require("bs58");
var secret = ""
@zed-wong
zed-wong / evm-inscription.js
Created December 6, 2023 03:25
evm-inscription
// Change RPC and data for different network and different inscription
// Change privateKey to yours
// data is hex encoded string
// use [email protected]
import { ethers } from "ethers";
import { BigNumber } from "bignumber.js";
// Replace with your own private key
const privateKey = "";
@zed-wong
zed-wong / exinone-token.go
Created September 20, 2023 08:02
exinone sign up
package main
import (
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"fmt"
"time"
"github.com/fox-one/mixin-sdk-go"
@zed-wong
zed-wong / mixin-sign-auth.go
Created September 20, 2023 01:29
mixin-sign-auth.go
package main
import (
"crypto/sha256"
"encoding/hex"
"github.com/dgrijalva/jwt-go"
"golang.org/x/crypto/ed25519"
"github.com/google/uuid"
"encoding/base64"
"fmt"