@awakentax/crypto-tax

中文文档
0.1.3发布于 2025/12/13ISCTypeScriptESM + CJS零依赖近 30 天下载 1.3万

Tax SDK for Awaken

原始使用文档
文档目录12 节
  1. Step 1: Get an API Key
  2. Installation
  3. Usage
  4. Initialize the SDK
  5. Get the Link URL
  6. Open the Link
  7. Complete Example
  8. What It Looks Like
  9. Alternative: Using cURL (Without SDK)
  10. Create Partner Account Link
  11. API Reference
  12. CryptoTaxSDK

@awakentax/crypto-tax

Tax SDK for Awaken - Easily integrate crypto tax calculation links into your application.

Step 1: Get an API Key

To use this SDK, you'll need an API key. Please contact [email protected] to obtain your API key.

Installation

npm install @awakentax/crypto-tax

or with yarn:

yarn add @awakentax/crypto-tax

Usage

Initialize the SDK

First, import and initialize the SDK with your API key:

import { CryptoTaxSDK } from '@awakentax/crypto-tax';

const cryptotax = new CryptoTaxSDK({
  apiKey: 'your-api-key-here'
});

Create a link by providing wallet addresses:

import type { CreateLinkRequest } from '@awakentax/crypto-tax';

const request: CreateLinkRequest = {
  wallets: [
    {
      address: '0x1234567890123456789012345678901234567890',
      name: 'My Main Wallet' // Optional
    },
    {
      address: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd'
    }
  ]
};

const response = await cryptotax.createLink(request);
console.log('Link URL:', response.url);
console.log('Link Code:', response.code);

Once you have the URL, you can open it in a browser or redirect your users:

// In a browser environment
window.location.href = response.url;

// Or open in a new tab/window
window.open(response.url, '_blank');

// In a Node.js environment, you can log it or use a library like 'open'
console.log('Open this URL:', response.url);

Complete Example

import { CryptoTaxSDK } from '@awakentax/crypto-tax';
import type { CreateLinkRequest } from '@awakentax/crypto-tax';

async function createTaxLink() {
  // Initialize SDK
  const cryptotax = new CryptoTaxSDK({
    apiKey: process.env.AWAKEN_API_KEY!,
  });

  // Prepare wallet data
  const request: CreateLinkRequest = {
    wallets: [
      {
        address: '0x1234567890123456789012345678901234567890',
        name: 'My Main Wallet'
      }
    ]
  };

  try {
    // Create the link
    const { url, code } = await cryptotax.createLink(request);
    
    // Open the link (browser example)
    window.location.href = url;
    
    // Or redirect users to the tax calculation page
    // window.open(url, '_blank');
  } catch (error) {
    console.error('Failed to create link:', error);
  }
}

What It Looks Like

Screenshot 2025-12-13 at 12 58 43 AM

When you open up the URL we generate for you, it will look something like this. If the user doesn't have an Awaken account, it will prompt them to create one and then automatically add the wallets for them. If they already have an account, it'll be a one click add for them to link these wallets to their existing Awaken account.

Alternative: Using cURL (Without SDK)

If you prefer not to use the SDK, you can make direct API calls using cURL:

curl -X POST https://api.link.awaken.tax/api/links \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key-here" \
  -d '{
    "wallets": [
      {
        "address": "0x1234567890123456789012345678901234567890",
        "name": "My Wallet"
      },
      {
        "address": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd"
      }
    ]
  }'

Request Body:

  • wallets (array, required): Array of wallet objects
    • address (string, required): Wallet address
    • name (string, optional): Wallet name

Response:

  • Success (201): Returns code and url for the created link
  • Success (200): Returns existing link if wallet hash already exists
  • Error (400): Validation error with details
  • Error (404): Partnership not found
  • Error (500): Internal server error

Example Response:

{
  "code": "abc123xyz",
  "url": "https://awaken.tax/link?code=abc123xyz"
}

API Reference

CryptoTaxSDK

Constructor

new CryptoTaxSDK(options: SDKOptions)

Options:

  • apiKey (string, required): Your API key
  • baseUrl (string, optional): Base URL for the API. Defaults to https://api.link.awaken.tax

Methods

createLink(request: CreateLinkRequest): Promise<CreateLinkResponse>

Creates a new tax calculation link.

Parameters:

  • request.wallets: Array of wallet objects with address (required) and optional name

Returns:

  • code: Unique code for the link
  • url: Full URL to access the tax calculation interface

版本与发布记录

@awakentax/crypto-tax 共发布 4 个版本,首次发布于 2025/12/13;过去 12 个月发布了 4 个版本。

版本发布日期距今
0.1.3latest2025/12/1310 个月前
0.1.22025/12/1310 个月前
0.1.12025/12/1310 个月前
0.1.02025/12/1310 个月前

关于 @awakentax/crypto-tax 的常见问题

@awakentax/crypto-tax 是什么?

Tax SDK for Awaken

如何安装 @awakentax/crypto-tax?

在项目目录运行 npm install @awakentax/crypto-tax,或使用 pnpm add / yarn add / bun add。

@awakentax/crypto-tax 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@awakentax/crypto-tax 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@awakentax/crypto-tax 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@awakentax/crypto-tax 可以商用吗?

@awakentax/crypto-tax 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@awakentax/crypto-tax 的下载量有多少?

根据 npm 官方下载统计,@awakentax/crypto-tax 在 2026/10/07 – 2026/11/05 这 30 天内被下载 13,090 次,日均约 436 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@awakentax/crypto-tax 还在维护吗?

最新版本 0.1.3 发布于 2025/12/13(10 个月前);至今共发布 4 个版本,其中过去 12 个月发布了 4 个;首次发布于 2025/12/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。