Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
dfstio committed Nov 27, 2024
1 parent 4c7c1c4 commit 2c69375
Show file tree
Hide file tree
Showing 36 changed files with 2,448 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

node_modules
.yarn
.DS_Store
.editorconfig
env.json
.env
.env.test
.env.local
.DS_Store
yarn-error.log
node_modules/
.pnp.cjs
.pnp.loader.mjs
.vscode/
.zkcloudworker/

# Swap the comments on the following lines if you wish to use zero-installs
# In that case, don't forget to run `yarn config set enableGlobalCache false`!
# Documentation here: https://yarnpkg.com/features/caching#zero-installs

#!.yarn/cache
.pnp.*


1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org/
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
101 changes: 101 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# MinaTokens

## MinaTokens API Documentation

Welcome to the MinaTokens API documentation! This API enables developers to easily create and manage custom tokens on the MINA blockchain using zkCloudWorker technology.

Explore our comprehensive API documentation and try out live API endpoints at [docs.minatokens.com](https://docs.minatokens.com)

To obtain an API key, visit [minatokens.com/api](https://minatokens.com/api)

## Overview

MinaTokens is a no-code custom token launchpad that simplifies the creation and management of MINA custom tokens. Our API provides developers with programmatic access to token operations, allowing seamless integration into your applications.

### Key Features

- **Token Creation**: Launch custom tokens with configurable parameters
- **Token Management**: Mint, transfer, and manage token distributions
- **Batch Operations**: Perform batch mints and transfers for airdrops
- **Transaction Building**: Automated transaction building and proving
- **Monitoring**: Track token statistics and transaction status

## Getting Started

### Authentication

All API requests require authentication using an API key. Include your API key in the request headers:

'x-api-key': 'your-api-key'

To obtain an API key, visit [minatokens.com/api](https://minatokens.com/api)

### Base URLs

- Devnet: `https://minatokens.com/api/v1/`
- Zeko: `https://zekotokens.com/api/v1/`

## Quick Start Guide

### 1. Deploy a New Token

```javascript
const response = await fetch("https://minatokens.com/api/v1/deploy", {
method: "POST",
headers: {
"x-api-key": "your-api-key",
"Content-Type": "application/json",
},
body: JSON.stringify({
adminAddress: "B62...",
symbol: "TEST",
decimals: 9,
uri: "https://minatokens.com",
}),
});
```

### 2. Get Token Information

```typescript
const response = await fetch("https://minatokens.com/api/v1/info", {
method: "POST",
headers: {
"x-api-key": "your-api-key",
"Content-Type": "application/json",
},
body: JSON.stringify({
tokenAddress: "B62qpFzLKkGKMZcmY6wrbyn8Sf9sWUT1HG4omSbvFKH2nXSNjCoQ6Xs",
}),
});
```

See the complete examples at https://github.com/zkcloudworker/tokens-api-example

## Core Concepts

### Token Types

MinaTokens supports two categories of tokens:

1. **Regular Tokens**: Can be freely created and transferred by any user
2. **Whitelisted Tokens**: Created with MDA (Mina Developers Alliance) endorsement, enabling additional features like buying and selling

### Transaction Flow

1. **Build**: Create a transaction using `/transaction` endpoint
2. **Prove**: Submit the transaction for proving using `/prove` endpoint
3. **Monitor**: Track transaction status using `/tx-status` endpoint

## Security Considerations

- All sensitive operations require proper authentication
- Whitelisted tokens require MDA member endorsement
- Transaction proving occurs in secure cloud environment
- Wallet signatures are required for all transactions

## Support

For technical support or questions:

- Email: [email protected]
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"author": "DFST",
"license": "Apache-2.0",
"description": "MinaTokens Library",
"workspaces": [
"packages/*"
],
"scripts": {
"build": "yarn workspace @minatokens/api build",
"login": "npm login",
"publish:api": "cd packages/api && npm publish --access public && cd ../.."
},
"packageManager": "[email protected]"
}
1 change: 1 addition & 0 deletions packages/api/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
101 changes: 101 additions & 0 deletions packages/api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# MinaTokens API

## MinaTokens API Documentation

Welcome to the MinaTokens API documentation! This API enables developers to easily create and manage custom tokens on the MINA blockchain using zkCloudWorker technology.

Explore our comprehensive API documentation and try out live API endpoints at [docs.minatokens.com](https://docs.minatokens.com)

To obtain an API key, visit [minatokens.com/api](https://minatokens.com/api)

## Overview

MinaTokens is a no-code custom token launchpad that simplifies the creation and management of MINA custom tokens. Our API provides developers with programmatic access to token operations, allowing seamless integration into your applications.

### Key Features

- **Token Creation**: Launch custom tokens with configurable parameters
- **Token Management**: Mint, transfer, and manage token distributions
- **Batch Operations**: Perform batch mints and transfers for airdrops
- **Transaction Building**: Automated transaction building and proving
- **Monitoring**: Track token statistics and transaction status

## Getting Started

### Authentication

All API requests require authentication using an API key. Include your API key in the request headers:

'x-api-key': 'your-api-key'

To obtain an API key, visit [minatokens.com/api](https://minatokens.com/api)

### Base URLs

- Devnet: `https://minatokens.com/api/v1/`
- Zeko: `https://zekotokens.com/api/v1/`

## Quick Start Guide

### 1. Deploy a New Token

```javascript
const response = await fetch("https://minatokens.com/api/v1/deploy", {
method: "POST",
headers: {
"x-api-key": "your-api-key",
"Content-Type": "application/json",
},
body: JSON.stringify({
adminAddress: "B62...",
symbol: "TEST",
decimals: 9,
uri: "https://minatokens.com",
}),
});
```

### 2. Get Token Information

```typescript
const response = await fetch("https://minatokens.com/api/v1/info", {
method: "POST",
headers: {
"x-api-key": "your-api-key",
"Content-Type": "application/json",
},
body: JSON.stringify({
tokenAddress: "B62qpFzLKkGKMZcmY6wrbyn8Sf9sWUT1HG4omSbvFKH2nXSNjCoQ6Xs",
}),
});
```

See the complete examples at https://github.com/zkcloudworker/tokens-api-example

## Core Concepts

### Token Types

MinaTokens supports two categories of tokens:

1. **Regular Tokens**: Can be freely created and transferred by any user
2. **Whitelisted Tokens**: Created with MDA (Mina Developers Alliance) endorsement, enabling additional features like buying and selling

### Transaction Flow

1. **Build**: Create a transaction using `/transaction` endpoint
2. **Prove**: Submit the transaction for proving using `/prove` endpoint
3. **Monitor**: Track transaction status using `/tx-status` endpoint

## Security Considerations

- All sensitive operations require proper authentication
- Whitelisted tokens require MDA member endorsement
- Transaction proving occurs in secure cloud environment
- Wallet signatures are required for all transactions

## Support

For technical support or questions:

- Email: [email protected]
57 changes: 57 additions & 0 deletions packages/api/build-cjs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import * as esbuild from "esbuild";
import path from "node:path";
import { platform } from "node:process";

const entry = "./src/index.ts";

let jsEntry = path.resolve(
"dist/node",
path.basename(entry).replace(".ts", ".js")
);
let outfile = jsEntry.replace(".js", ".cjs");

await esbuild.build({
entryPoints: ["./dist/node/index.js"],
bundle: true,
platform: "node",
format: "cjs",
target: "es2021",
resolveExtensions: [".node.js", ".ts", ".js"],
allowOverwrite: true,
plugins: [makeNodeModulesExternal(), makeJsooExternal()],
allowOverwrite: true,
outfile,
dropLabels: ["ESM"],
minify: false,
});

function makeNodeModulesExternal() {
let isNodeModule = /^[^./\\]|^\.[^./\\]|^\.\.[^/\\]/;
return {
name: "plugin-external",
setup(build) {
build.onResolve({ filter: isNodeModule }, ({ path }) => ({
path,
external: !(platform === "win32" && path.endsWith("index.js")),
}));
},
};
}

function makeJsooExternal() {
let isJsoo = /(bc.cjs|plonk_wasm.cjs)$/;
return {
name: "plugin-external",
setup(build) {
build.onResolve({ filter: isJsoo }, ({ path: filePath, resolveDir }) => ({
path:
"./" +
path.relative(
path.resolve(".", "dist/node"),
path.resolve(resolveDir, filePath)
),
external: true,
}));
},
};
}
25 changes: 25 additions & 0 deletions packages/api/dist/node/api.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { DeployTokenParams, DeployTransaction, JobId, ProveTokenTransaction, TokenTransaction, JobResult, TransactionTokenParams, FaucetParams, FaucetResponse, TransactionStatusParams, TransactionStatus, TokenState, NFTRequestAnswer, NFTRequestParams, BalanceResponse, BalanceRequestParams } from "./types.js";
export declare class MinaTokensAPI {
readonly chain: "mainnet" | "devnet" | "zeko" | "local";
readonly apiKey: string;
constructor(params: {
apiKey: string;
chain?: "mainnet" | "devnet" | "zeko" | "local";
});
getTokenInfo(tokenAddress: string): Promise<TokenState>;
getBalance(params: BalanceRequestParams): Promise<BalanceResponse>;
getNFTInfo(params: NFTRequestParams): Promise<NFTRequestAnswer>;
buildDeployTokenTransaction(params: DeployTokenParams): Promise<DeployTransaction>;
tokenTransaction(params: TransactionTokenParams): Promise<TokenTransaction>;
proveTokenTransaction(params: ProveTokenTransaction): Promise<JobId>;
proveJobResult(params: JobId): Promise<JobResult>;
faucet(params: FaucetParams): Promise<FaucetResponse>;
txStatus(params: TransactionStatusParams): Promise<TransactionStatus>;
waitForJobResult(jobId: string): Promise<string | undefined>;
waitForTransaction(hash: string, timeout?: number): Promise<void>;
apiCall<TParams, TResponse>(params: {
endpoint: string;
callParams: TParams;
}): Promise<TResponse>;
sleep(ms: number): Promise<unknown>;
}
Loading

0 comments on commit 2c69375

Please sign in to comment.