Skip to content

Instantly share code, notes, and snippets.

View zed-wong's full-sized avatar
🕌

Zed Wong zed-wong

🕌
View GitHub Profile
@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"
@zed-wong
zed-wong / mixin-unique-conversation-id.go
Created June 29, 2023 03:28
mixin-unique-conversation-id
//https://go.dev/play/
package main
import (
"crypto/md5"
"io"
"strings"
"github.com/gofrs/uuid"
)
@zed-wong
zed-wong / aragon_zh_common.json
Created May 18, 2023 14:54
Chinese translation file for Aragon front end app
{
"testnetIndicator": "测试网激活",
"menu": "菜单",
"navLinks": {
"dashboard": "仪表盘",
"governance": "治理",
"finance": "财务",
"community": "社区",
"explore": "探索",
"learn": "学习",