@megatao/sdk 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,9 +13,9 @@ npm install @megatao/sdk
13
13
  ## Quick Start
14
14
 
15
15
  ```typescript
16
- import { AlphaFuturesClient, parseEther } from '@megatao/sdk';
16
+ import { MegaTAOClient, parseEther } from '@megatao/sdk';
17
17
 
18
- const client = new AlphaFuturesClient('localhost', {
18
+ const client = new MegaTAOClient('localhost', {
19
19
  rpcUrl: 'http://localhost:8545',
20
20
  privateKey: '0x...',
21
21
  });
@@ -34,7 +34,7 @@ await alpha.openMarketPosition(
34
34
 
35
35
  ## Architecture
36
36
 
37
- `AlphaFuturesClient` creates viem clients internally and exposes two contract wrappers:
37
+ `MegaTAOClient` creates viem clients internally and exposes two contract wrappers:
38
38
 
39
39
  - **`client.getAlpha()`** → `AlphaViem` — all trading, margin, positions, orders, vault, and market operations
40
40
  - **`client.oracle`** → `PriceOracleViem` — price feeds from the on-chain oracle
@@ -7,7 +7,7 @@ import { Command } from 'commander';
7
7
  import chalk from 'chalk';
8
8
  import ora from 'ora';
9
9
  import Table from 'cli-table3';
10
- import { AlphaFuturesClient } from '../../src';
10
+ import { MegaTAOClient } from '../../src';
11
11
  import { formatUSD, formatTAO, formatPercentage } from '../../src/utils';
12
12
  import {
13
13
  getClient,
@@ -6,7 +6,7 @@ import { Command } from 'commander';
6
6
  import chalk from 'chalk';
7
7
  import ora from 'ora';
8
8
  import Table from 'cli-table3';
9
- import { AlphaFuturesClient } from '../../src';
9
+ import { MegaTAOClient } from '../../src';
10
10
  import { formatUSD, formatPercentage, formatNumber, formatTAO } from '../../src/utils';
11
11
  import {
12
12
  getClient,
@@ -7,7 +7,7 @@ import { parseEther } from 'viem';
7
7
  import chalk from 'chalk';
8
8
  import ora from 'ora';
9
9
  import Table from 'cli-table3';
10
- import { AlphaFuturesClient } from '../../src';
10
+ import { MegaTAOClient } from '../../src';
11
11
  import { formatUSD, formatTAO, formatPercentage } from '../../src/utils';
12
12
  import { calculateMaintenanceMargin } from '../../src/utils/calculations';
13
13
  import { getClient, handleError, validateMarketAddresses, getMarketAddress } from '../utils/client';
@@ -7,7 +7,7 @@ import { parseEther } from 'viem';
7
7
  import chalk from 'chalk';
8
8
  import ora from 'ora';
9
9
  import inquirer from 'inquirer';
10
- import { AlphaFuturesClient } from '../../src';
10
+ import { MegaTAOClient } from '../../src';
11
11
  import { formatUSD, formatTAO, formatPercentage } from '../../src/utils';
12
12
  import { getClient, handleError, getMarketAddress } from '../utils/client';
13
13
  import { confirmAction, validateDirection } from '../utils/prompts';
@@ -7,7 +7,7 @@ import { parseEther } from 'viem';
7
7
  import chalk from 'chalk';
8
8
  import ora from 'ora';
9
9
  import Table from 'cli-table3';
10
- import { AlphaFuturesClient } from '../../src';
10
+ import { MegaTAOClient } from '../../src';
11
11
  import { formatUSD, formatTAO, formatPercentage, formatNumber } from '../../src/utils';
12
12
  import { getClient, handleError } from '../utils/client';
13
13
 
@@ -8,7 +8,7 @@ import chalk from 'chalk';
8
8
  import inquirer from 'inquirer';
9
9
  import ora from 'ora';
10
10
  import { parseEther } from 'viem';
11
- import { AlphaFuturesClient } from '../src';
11
+ import { MegaTAOClient } from '../src';
12
12
  import { formatUSD, formatTAO, formatPercentage } from '../src/utils';
13
13
  import { getClient, handleError } from './utils/client';
14
14
  import { displayPositionDetails, displayMarketSummary } from './utils/display';
@@ -24,7 +24,7 @@ export async function startInteractiveMode(options: InteractiveOptions) {
24
24
  console.log(chalk.cyan.bold('🚀 Alpha Futures Interactive Trading Mode'));
25
25
  console.log(chalk.gray('Type "help" for available commands or "exit" to quit\n'));
26
26
 
27
- let client: AlphaFuturesClient;
27
+ let client: MegaTAOClient;
28
28
  let running = true;
29
29
 
30
30
  // Initialize client
@@ -150,7 +150,7 @@ function showHelp() {
150
150
  console.log();
151
151
  }
152
152
 
153
- async function showBalance(client: AlphaFuturesClient) {
153
+ async function showBalance(client: MegaTAOClient) {
154
154
  const spinner = ora('Loading balance...').start();
155
155
 
156
156
  try {
@@ -172,7 +172,7 @@ async function showBalance(client: AlphaFuturesClient) {
172
172
  }
173
173
  }
174
174
 
175
- async function showPositions(client: AlphaFuturesClient) {
175
+ async function showPositions(client: MegaTAOClient) {
176
176
  const spinner = ora('Loading positions...').start();
177
177
 
178
178
  try {
@@ -221,7 +221,7 @@ async function showPositions(client: AlphaFuturesClient) {
221
221
  }
222
222
  }
223
223
 
224
- async function showMarket(client: AlphaFuturesClient, asset?: string) {
224
+ async function showMarket(client: MegaTAOClient, asset?: string) {
225
225
  if (!asset) {
226
226
  console.log(chalk.yellow('Usage: market <asset>'));
227
227
  return;
@@ -248,7 +248,7 @@ async function showMarket(client: AlphaFuturesClient, asset?: string) {
248
248
  }
249
249
  }
250
250
 
251
- async function executeTrade(client: AlphaFuturesClient) {
251
+ async function executeTrade(client: MegaTAOClient) {
252
252
  try {
253
253
  const address = await client.getSignerAddress();
254
254
  const addressTyped = address as `0x${string}`;
@@ -342,7 +342,7 @@ async function executeTrade(client: AlphaFuturesClient) {
342
342
  }
343
343
  }
344
344
 
345
- async function quickOpen(client: AlphaFuturesClient, args: string[]) {
345
+ async function quickOpen(client: MegaTAOClient, args: string[]) {
346
346
  if (args.length < 4) {
347
347
  console.log(chalk.yellow('Usage: open <asset> <long/short> <margin> <leverage>'));
348
348
  console.log(chalk.gray('Example: open ALPHA long 100 3'));
@@ -406,7 +406,7 @@ Example: 0x00000000000000000000000000000001`);
406
406
  }
407
407
  }
408
408
 
409
- async function quickClose(client: AlphaFuturesClient, positionId?: string) {
409
+ async function quickClose(client: MegaTAOClient, positionId?: string) {
410
410
  if (!positionId) {
411
411
  console.log(chalk.yellow('Usage: close <positionId>'));
412
412
  console.log(chalk.gray('Example: close 0x00000000000000000000000000000001'));
@@ -447,7 +447,7 @@ async function quickClose(client: AlphaFuturesClient, positionId?: string) {
447
447
  }
448
448
  }
449
449
 
450
- async function deposit(client: AlphaFuturesClient, amount?: string) {
450
+ async function deposit(client: MegaTAOClient, amount?: string) {
451
451
  if (!amount) {
452
452
  console.log(chalk.yellow('Usage: deposit <amount>'));
453
453
  return;
@@ -474,7 +474,7 @@ async function deposit(client: AlphaFuturesClient, amount?: string) {
474
474
  }
475
475
  }
476
476
 
477
- async function withdraw(client: AlphaFuturesClient, amount?: string) {
477
+ async function withdraw(client: MegaTAOClient, amount?: string) {
478
478
  if (!amount) {
479
479
  console.log(chalk.yellow('Usage: withdraw <amount>'));
480
480
  return;
@@ -506,7 +506,7 @@ async function withdraw(client: AlphaFuturesClient, amount?: string) {
506
506
  }
507
507
  }
508
508
 
509
- async function showStats(client: AlphaFuturesClient) {
509
+ async function showStats(client: MegaTAOClient) {
510
510
  const spinner = ora('Loading statistics...').start();
511
511
 
512
512
  try {
@@ -7,7 +7,7 @@
7
7
  import { localhost, mainnet, sepolia } from 'viem/chains';
8
8
 
9
9
  import type { Chain } from 'viem';
10
- import { AlphaFuturesClient, type AlphaClientConfig } from '../../src/AlphaFuturesClient';
10
+ import { MegaTAOClient, type MegaTAOClientConfig } from '../../src/MegaTAOClient';
11
11
  import type { Environment } from '../../src/config/environments';
12
12
  import { NETWORK_CONFIGS } from '../../src/constants/networks';
13
13
  import { SUBNET_MARKETS, getAssetAddress, isSubnetMarket } from '../../src/constants/assets';
@@ -24,7 +24,7 @@ export interface ClientOptions {
24
24
  /**
25
25
  * Initialize and return Alpha Futures client
26
26
  */
27
- export async function getClient(options: ClientOptions): Promise<AlphaFuturesClient> {
27
+ export async function getClient(options: ClientOptions): Promise<MegaTAOClient> {
28
28
  const privateKey = options.key || options.privateKey || process.env.PRIVATE_KEY;
29
29
  const rpcUrl = options.rpc;
30
30
 
@@ -101,7 +101,7 @@ export async function getClient(options: ClientOptions): Promise<AlphaFuturesCli
101
101
  break;
102
102
  }
103
103
 
104
- const config: AlphaClientConfig = {
104
+ const config: MegaTAOClientConfig = {
105
105
  rpcUrl: rpcUrl || chain.rpcUrls.default.http[0],
106
106
  privateKey: privateKey as `0x${string}` | undefined,
107
107
  };
@@ -109,7 +109,7 @@ export async function getClient(options: ClientOptions): Promise<AlphaFuturesCli
109
109
  try {
110
110
  // Map network string to Environment type
111
111
  const environment = network as Environment;
112
- return new AlphaFuturesClient(environment, config);
112
+ return new MegaTAOClient(environment, config);
113
113
  } catch (error: any) {
114
114
  throw new Error(`Failed to initialize client: ${error.message}`);
115
115
  }
@@ -1,24 +1,24 @@
1
1
  /**
2
- * Alpha Futures Client
2
+ * MegaTAO Client
3
3
  * Main client class that provides access to all protocol contracts
4
4
  */
5
5
  import { PriceOracleViem } from './contracts/viem/PriceOracleViem';
6
6
  import { AlphaViem } from './contracts/viem/AlphaViem';
7
7
  import { type Environment } from './config/environments';
8
8
  import { type PublicClient, type WalletClient, type Address } from 'viem';
9
- export interface AlphaClientConfig {
9
+ export interface MegaTAOClientConfig {
10
10
  rpcUrl?: string;
11
11
  privateKey?: `0x${string}`;
12
12
  walletClient?: WalletClient;
13
13
  }
14
- export declare class AlphaFuturesClient {
14
+ export declare class MegaTAOClient {
15
15
  private alphaContract;
16
16
  private oracleContract;
17
17
  private publicClient;
18
18
  private walletClient?;
19
19
  private environment?;
20
20
  readonly oracle: PriceOracleViem;
21
- constructor(environment: Environment, config?: AlphaClientConfig);
21
+ constructor(environment: Environment, config?: MegaTAOClientConfig);
22
22
  getAlpha(): AlphaViem;
23
23
  getPublicClient(): PublicClient;
24
24
  getWalletClient(): WalletClient | undefined;
@@ -31,6 +31,6 @@ export declare class AlphaFuturesClient {
31
31
  * @returns The collateral token contract address
32
32
  */
33
33
  getCollateralTokenAddress(): Address | undefined;
34
- static forEnvironment(environment: Environment, config?: AlphaClientConfig): AlphaFuturesClient;
34
+ static forEnvironment(environment: Environment, config?: MegaTAOClientConfig): MegaTAOClient;
35
35
  }
36
- //# sourceMappingURL=AlphaFuturesClient.d.ts.map
36
+ //# sourceMappingURL=MegaTAOClient.d.ts.map
@@ -0,0 +1 @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alpha Futures Client
3
+ * MegaTAO Client
4
4
  * Main client class that provides access to all protocol contracts
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.AlphaFuturesClient = void 0;
7
+ exports.MegaTAOClient = void 0;
8
8
  const PriceOracleViem_1 = require("./contracts/viem/PriceOracleViem");
9
9
  const AlphaViem_1 = require("./contracts/viem/AlphaViem");
10
10
  const environments_1 = require("./config/environments");
11
11
  const viem_1 = require("viem");
12
12
  const accounts_1 = require("viem/accounts");
13
- class AlphaFuturesClient {
13
+ class MegaTAOClient {
14
14
  constructor(environment, config = {}) {
15
15
  this.environment = environment;
16
16
  const envConfig = (0, environments_1.getEnvironmentConfig)(environment);
@@ -109,8 +109,8 @@ class AlphaFuturesClient {
109
109
  return envConfig.contracts.collateralToken;
110
110
  }
111
111
  static forEnvironment(environment, config = {}) {
112
- return new AlphaFuturesClient(environment, config);
112
+ return new MegaTAOClient(environment, config);
113
113
  }
114
114
  }
115
- exports.AlphaFuturesClient = AlphaFuturesClient;
116
- //# sourceMappingURL=AlphaFuturesClient.js.map
115
+ exports.MegaTAOClient = MegaTAOClient;
116
+ //# sourceMappingURL=MegaTAOClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MegaTAOClient.js","sourceRoot":"","sources":["../src/MegaTAOClient.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,sEAAmE;AACnE,0DAAuD;AACvD,wDAA+E;AAC/E,+BAOc;AACd,4CAAoD;AAQpD,MAAa,aAAa;IAQxB,YAAY,WAAwB,EAAE,SAA8B,EAAE;QACpE,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,MAAM,SAAS,GAAG,IAAA,mCAAoB,EAAC,WAAW,CAAC,CAAC;QAEpD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,CAAC,MAAM,IAAI,uBAAuB,CAAC;QAC5E,kEAAkE;QAClE,MAAM,kBAAkB,GAAG,4CAA4C,CAAC;QAExE,2D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EAAE,OAAO,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACH,yBAAyB;QACvB,IAAI,CAAC,IAAI,CAAC,WAAW;YAAE,OAAO,SAAS,CAAC;QACxC,MAAM,SAAS,GAAG,IAAA,mCAAoB,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACzD,OAAO,SAAS,CAAC,SAAS,CAAC,eAAe,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,cAAc,CACnB,WAAwB,EACxB,SAA8B,EAAE;QAEhC,OAAO,IAAI,aAAa,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;CACF;AArID,sCAqIC"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Alpha Futures SDK
3
- * Main entry point for the Alpha Futures TypeScript SDK
2
+ * MegaTAO SDK
3
+ * Main entry point for the MegaTAO TypeScript SDK
4
4
  */
5
- export { AlphaFuturesClient } from './AlphaFuturesClient';
5
+ export { MegaTAOClient } from './MegaTAOClient';
6
6
  export { AlphaViem, PriceOracleViem } from './contracts/viem';
7
7
  export * from './abi/abis';
8
8
  export * from './types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAG9D,cAAc,YAAY,CAAC;AAG3B,cAAc,SAAS,CAAC;AAGxB,cAAc,UAAU,CAAC;AAGzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAG7C,cAAc,aAAa,CAAC;AAG5B,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,eAAe,EACf,KAAK,iBAAiB,GACvB,MAAM,2BAA2B,CAAC;AACnC,cAAc,uBAAuB,CAAC;AAGtC,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,UAAU,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,IAAI,EACJ,MAAM,EACN,KAAK,KAAK,EACV,KAAK,SAAS,GACf,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAG9D,cAAc,YAAY,CAAC;AAG3B,cAAc,SAAS,CAAC;AAGxB,cAAc,UAAU,CAAC;AAGzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAG7C,cAAc,aAAa,CAAC;AAG5B,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,eAAe,EACf,KAAK,iBAAiB,GACvB,MAAM,2BAA2B,CAAC;AACnC,cAAc,uBAAuB,CAAC;AAGtC,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,UAAU,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,IAAI,EACJ,MAAM,EACN,KAAK,KAAK,EACV,KAAK,SAAS,GACf,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
- * Alpha Futures SDK
4
- * Main entry point for the Alpha Futures TypeScript SDK
3
+ * MegaTAO SDK
4
+ * Main entry point for the MegaTAO TypeScript SDK
5
5
  */
6
6
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
7
  if (k2 === undefined) k2 = k;
@@ -18,10 +18,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
18
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.sepolia = exports.mainnet = exports.custom = exports.http = exports.createWalletClient = exports.createPublicClient = exports.getContract = exports.formatUnits = exports.parseUnits = exports.formatEther = exports.parseEther = exports.contractsConfig = exports.PriceOracleViem = exports.AlphaViem = exports.AlphaFuturesClient = void 0;
21
+ exports.sepolia = exports.mainnet = exports.custom = exports.http = exports.createWalletClient = exports.createPublicClient = exports.getContract = exports.formatUnits = exports.parseUnits = exports.formatEther = exports.parseEther = exports.contractsConfig = exports.PriceOracleViem = exports.AlphaViem = exports.MegaTAOClient = void 0;
22
22
  // Export main client
23
- var AlphaFuturesClient_1 = require("./AlphaFuturesClient");
24
- Object.defineProperty(exports, "AlphaFuturesClient", { enumerable: true, get: function () { return AlphaFuturesClient_1.AlphaFuturesClient; } });
23
+ var MegaTAOClient_1 = require("./MegaTAOClient");
24
+ Object.defineProperty(exports, "MegaTAOClient", { enumerable: true, get: function () { return MegaTAOClient_1.MegaTAOClient; } });
25
25
  // Export Viem contracts
26
26
  var viem_1 = require("./contracts/viem");
27
27
  Object.defineProperty(exports, "AlphaViem", { enumerable: true, get: function () { return viem_1.AlphaViem; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;A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AC3B,6BAiBc;AAXZ,kGAAA,UAAU,OAAA;AACV,mGAAA,WAAW,OAAA;AACX,kGAAA,UAAU,OAAA;AACV,mGAAA,WAAW,OAAA;AACX,mGAAA,WAAW,OAAA;AACX,0GAAA,kBAAkB,OAAA;AAClB,0GAAA,kBAAkB,OAAA;AAClB,4FAAA,IAAI,OAAA;AACJ,8FAAA,MAAM,OAAA;AAKR,sCAA+C;AAAtC,iGAAA,OAAO,OAAA;AAAE,iGAAA,OAAO,OAAA"}
package/docs/api/API.md CHANGED
@@ -27,9 +27,9 @@ npm install @alpha-futures/sdk
27
27
  ### Basic Usage
28
28
 
29
29
  ```typescript
30
- import { AlphaFuturesClient } from '@alpha-futures/sdk';
30
+ import { MegaTAOClient } from '@alpha-futures/sdk';
31
31
 
32
- const client = new AlphaFuturesClient({
32
+ const client = new MegaTAOClient({
33
33
  rpcUrl: 'https://your-rpc-url',
34
34
  privateKey: 'your-private-key',
35
35
  network: 'mainnet'
@@ -38,14 +38,14 @@ const client = new AlphaFuturesClient({
38
38
 
39
39
  ## Client Initialization
40
40
 
41
- ### AlphaFuturesClient
41
+ ### MegaTAOClient
42
42
 
43
43
  The main entry point for interacting with the protocol.
44
44
 
45
45
  #### Constructor
46
46
 
47
47
  ```typescript
48
- new AlphaFuturesClient(config: ClientConfig)
48
+ new MegaTAOClient(config: ClientConfig)
49
49
  ```
50
50
 
51
51
  **Parameters:**
@@ -66,7 +66,7 @@ interface ClientConfig {
66
66
  **Example:**
67
67
  ```typescript
68
68
  // Using RPC URL and private key
69
- const client = new AlphaFuturesClient({
69
+ const client = new MegaTAOClient({
70
70
  rpcUrl: 'https://eth-mainnet.alchemyapi.io/v2/your-api-key',
71
71
  privateKey: '0x...',
72
72
  network: 'mainnet'
@@ -75,7 +75,7 @@ const client = new AlphaFuturesClient({
75
75
  // Using existing provider and signer
76
76
  const provider = new ethers.JsonRpcProvider(rpcUrl);
77
77
  const signer = new ethers.Wallet(privateKey, provider);
78
- const client = new AlphaFuturesClient({
78
+ const client = new MegaTAOClient({
79
79
  provider,
80
80
  signer,
81
81
  network: 'mainnet'
@@ -782,7 +782,7 @@ const customConfig: NetworkConfig = {
782
782
  }
783
783
  };
784
784
 
785
- const client = new AlphaFuturesClient({
785
+ const client = new MegaTAOClient({
786
786
  rpcUrl: customConfig.rpcUrl,
787
787
  privateKey: 'your-private-key',
788
788
  networkConfig: customConfig
@@ -104,11 +104,11 @@ alpha-futures position open --asset ALPHA --size 1000 --leverage 3 --long
104
104
  ### Using the SDK
105
105
 
106
106
  ```typescript
107
- import { AlphaFuturesClient } from '@alpha-futures/sdk';
107
+ import { MegaTAOClient } from '@alpha-futures/sdk';
108
108
 
109
109
  async function openFirstPosition() {
110
110
  // Initialize client
111
- const client = new AlphaFuturesClient({
111
+ const client = new MegaTAOClient({
112
112
  network: 'mainnet',
113
113
  privateKey: process.env.PRIVATE_KEY
114
114
  });
@@ -251,9 +251,9 @@ DEBUG=true alpha-futures position list
251
251
 
252
252
  ```typescript
253
253
  // monitor.ts
254
- import { AlphaFuturesClient } from '@alpha-futures/sdk';
254
+ import { MegaTAOClient } from '@alpha-futures/sdk';
255
255
 
256
- const client = new AlphaFuturesClient({
256
+ const client = new MegaTAOClient({
257
257
  network: 'mainnet',
258
258
  privateKey: process.env.PRIVATE_KEY
259
259
  });
@@ -284,9 +284,9 @@ monitorPositions();
284
284
 
285
285
  ```typescript
286
286
  // funding-collector.ts
287
- import { AlphaFuturesClient } from '@alpha-futures/sdk';
287
+ import { MegaTAOClient } from '@alpha-futures/sdk';
288
288
 
289
- const client = new AlphaFuturesClient({
289
+ const client = new MegaTAOClient({
290
290
  network: 'mainnet',
291
291
  privateKey: process.env.PRIVATE_KEY
292
292
  });
@@ -54,10 +54,10 @@ Perpetual futures are derivative contracts that:
54
54
  ### Step 1: Setup
55
55
 
56
56
  ```typescript
57
- import { AlphaFuturesClient } from '@alpha-futures/sdk';
57
+ import { MegaTAOClient } from '@alpha-futures/sdk';
58
58
  import { ethers } from 'ethers';
59
59
 
60
- const client = new AlphaFuturesClient({
60
+ const client = new MegaTAOClient({
61
61
  rpcUrl: 'https://your-rpc-url',
62
62
  privateKey: 'your-private-key',
63
63
  network: 'mainnet'
@@ -450,7 +450,7 @@ Provide liquidity by maintaining balanced positions:
450
450
 
451
451
  ```typescript
452
452
  class MarketMaker {
453
- private client: AlphaFuturesClient;
453
+ private client: MegaTAOClient;
454
454
  private spread: bigint = 50n; // 0.5% spread
455
455
 
456
456
  async maintainQuotes() {
@@ -58,7 +58,7 @@ pnpm add @alpha-futures/sdk ethers
58
58
  ### Simple Script
59
59
 
60
60
  ```typescript
61
- import { AlphaFuturesClient } from '@alpha-futures/sdk';
61
+ import { MegaTAOClient } from '@alpha-futures/sdk';
62
62
  import { ethers } from 'ethers';
63
63
  import dotenv from 'dotenv';
64
64
 
@@ -66,7 +66,7 @@ dotenv.config();
66
66
 
67
67
  async function main() {
68
68
  // Initialize client
69
- const client = new AlphaFuturesClient({
69
+ const client = new MegaTAOClient({
70
70
  rpcUrl: process.env.RPC_URL!,
71
71
  privateKey: process.env.PRIVATE_KEY!,
72
72
  network: 'mainnet'
@@ -193,14 +193,14 @@ class SecureWalletManager {
193
193
  ### Multi-Signature Integration
194
194
 
195
195
  ```typescript
196
- import { AlphaFuturesClient } from '@alpha-futures/sdk';
196
+ import { MegaTAOClient } from '@alpha-futures/sdk';
197
197
 
198
198
  class MultiSigIntegration {
199
- private client: AlphaFuturesClient;
199
+ private client: MegaTAOClient;
200
200
  private signers: string[];
201
201
  private threshold: number;
202
202
 
203
- constructor(client: AlphaFuturesClient, signers: string[], threshold: number) {
203
+ constructor(client: MegaTAOClient, signers: string[], threshold: number) {
204
204
  this.client = client;
205
205
  this.signers = signers;
206
206
  this.threshold = threshold;
@@ -231,15 +231,15 @@ class MultiSigIntegration {
231
231
  ### Basic Trading Bot Structure
232
232
 
233
233
  ```typescript
234
- import { AlphaFuturesClient } from '@alpha-futures/sdk';
234
+ import { MegaTAOClient } from '@alpha-futures/sdk';
235
235
  import { EventEmitter } from 'events';
236
236
 
237
237
  abstract class TradingBot extends EventEmitter {
238
- protected client: AlphaFuturesClient;
238
+ protected client: MegaTAOClient;
239
239
  protected isRunning: boolean = false;
240
240
  protected config: BotConfig;
241
241
 
242
- constructor(client: AlphaFuturesClient, config: BotConfig) {
242
+ constructor(client: MegaTAOClient, config: BotConfig) {
243
243
  super();
244
244
  this.client = client;
245
245
  this.config = config;
@@ -290,7 +290,7 @@ class GridTradingBot extends TradingBot {
290
290
  private positions: Map<string, GridPosition> = new Map();
291
291
 
292
292
  constructor(
293
- client: AlphaFuturesClient,
293
+ client: MegaTAOClient,
294
294
  config: GridBotConfig
295
295
  ) {
296
296
  super(client, config);
@@ -405,11 +405,11 @@ interface GridPosition {
405
405
  ```typescript
406
406
  // hooks/useAlphaFutures.ts
407
407
  import { useState, useEffect, useCallback } from 'react';
408
- import { AlphaFuturesClient } from '@alpha-futures/sdk';
408
+ import { MegaTAOClient } from '@alpha-futures/sdk';
409
409
  import { ethers } from 'ethers';
410
410
 
411
411
  export function useAlphaFutures() {
412
- const [client, setClient] = useState<AlphaFuturesClient | null>(null);
412
+ const [client, setClient] = useState<MegaTAOClient | null>(null);
413
413
  const [account, setAccount] = useState<string | null>(null);
414
414
  const [isConnected, setIsConnected] = useState(false);
415
415
 
@@ -428,7 +428,7 @@ export function useAlphaFutures() {
428
428
  const signer = await provider.getSigner();
429
429
 
430
430
  // Initialize client
431
- const alphaClient = new AlphaFuturesClient({
431
+ const alphaClient = new MegaTAOClient({
432
432
  provider,
433
433
  signer,
434
434
  network: 'mainnet'
@@ -624,11 +624,11 @@ export function TradingPanel() {
624
624
  ```typescript
625
625
  // composables/useAlphaFutures.ts
626
626
  import { ref, computed, onMounted, onUnmounted } from 'vue';
627
- import { AlphaFuturesClient } from '@alpha-futures/sdk';
627
+ import { MegaTAOClient } from '@alpha-futures/sdk';
628
628
  import { ethers } from 'ethers';
629
629
 
630
630
  export function useAlphaFutures() {
631
- const client = ref<AlphaFuturesClient | null>(null);
631
+ const client = ref<MegaTAOClient | null>(null);
632
632
  const account = ref<string | null>(null);
633
633
  const isConnected = computed(() => !!client.value && !!account.value);
634
634
 
@@ -644,7 +644,7 @@ export function useAlphaFutures() {
644
644
  const provider = new ethers.BrowserProvider(window.ethereum);
645
645
  const signer = await provider.getSigner();
646
646
 
647
- client.value = new AlphaFuturesClient({
647
+ client.value = new MegaTAOClient({
648
648
  provider,
649
649
  signer,
650
650
  network: 'mainnet'
@@ -690,7 +690,7 @@ export function useAlphaFutures() {
690
690
  ```typescript
691
691
  // server.ts
692
692
  import express from 'express';
693
- import { AlphaFuturesClient } from '@alpha-futures/sdk';
693
+ import { MegaTAOClient } from '@alpha-futures/sdk';
694
694
  import { ethers } from 'ethers';
695
695
  import rateLimit from 'express-rate-limit';
696
696
  import helmet from 'helmet';
@@ -707,7 +707,7 @@ const limiter = rateLimit({
707
707
  app.use('/api/', limiter);
708
708
 
709
709
  // Initialize client
710
- const client = new AlphaFuturesClient({
710
+ const client = new MegaTAOClient({
711
711
  rpcUrl: process.env.RPC_URL!,
712
712
  privateKey: process.env.PRIVATE_KEY!,
713
713
  network: 'mainnet'
@@ -978,13 +978,13 @@ export const resolvers = {
978
978
 
979
979
  ```typescript
980
980
  // services/AlphaFuturesService.ts
981
- import { AlphaFuturesClient } from '@alpha-futures/sdk';
981
+ import { MegaTAOClient } from '@alpha-futures/sdk';
982
982
  import { ethers } from 'ethers';
983
983
  import AsyncStorage from '@react-native-async-storage/async-storage';
984
984
  import { WalletConnectProvider } from '@walletconnect/react-native';
985
985
 
986
986
  export class AlphaFuturesService {
987
- private client: AlphaFuturesClient | null = null;
987
+ private client: MegaTAOClient | null = null;
988
988
  private walletConnector: WalletConnectProvider;
989
989
 
990
990
  constructor() {
@@ -1008,7 +1008,7 @@ export class AlphaFuturesService {
1008
1008
  const signer = provider.getSigner();
1009
1009
 
1010
1010
  // Initialize client
1011
- this.client = new AlphaFuturesClient({
1011
+ this.client = new MegaTAOClient({
1012
1012
  provider,
1013
1013
  signer,
1014
1014
  network: 'mainnet'
@@ -1027,7 +1027,7 @@ export class AlphaFuturesService {
1027
1027
  await AsyncStorage.removeItem('walletConnected');
1028
1028
  }
1029
1029
 
1030
- getClient(): AlphaFuturesClient {
1030
+ getClient(): MegaTAOClient {
1031
1031
  if (!this.client) {
1032
1032
  throw new Error('Not connected');
1033
1033
  }
@@ -1099,15 +1099,15 @@ export function useAlphaFutures() {
1099
1099
  ### Real-time Price Feed
1100
1100
 
1101
1101
  ```typescript
1102
- import { AlphaFuturesClient } from '@alpha-futures/sdk';
1102
+ import { MegaTAOClient } from '@alpha-futures/sdk';
1103
1103
  import WebSocket from 'ws';
1104
1104
 
1105
1105
  class RealTimePriceFeed {
1106
- private client: AlphaFuturesClient;
1106
+ private client: MegaTAOClient;
1107
1107
  private ws: WebSocket | null = null;
1108
1108
  private subscribers: Map<string, Set<(price: bigint) => void>> = new Map();
1109
1109
 
1110
- constructor(client: AlphaFuturesClient) {
1110
+ constructor(client: MegaTAOClient) {
1111
1111
  this.client = client;
1112
1112
  }
1113
1113
 
@@ -1181,10 +1181,10 @@ class RealTimePriceFeed {
1181
1181
 
1182
1182
  ```typescript
1183
1183
  class EventStreamer {
1184
- private client: AlphaFuturesClient;
1184
+ private client: MegaTAOClient;
1185
1185
  private eventHandlers: Map<string, Function[]> = new Map();
1186
1186
 
1187
- constructor(client: AlphaFuturesClient) {
1187
+ constructor(client: MegaTAOClient) {
1188
1188
  this.client = client;
1189
1189
  this.setupEventListeners();
1190
1190
  }
@@ -1334,7 +1334,7 @@ class ErrorHandler {
1334
1334
  // Usage
1335
1335
  const errorHandler = new ErrorHandler();
1336
1336
 
1337
- async function safeOpenPosition(client: AlphaFuturesClient, params: any) {
1337
+ async function safeOpenPosition(client: MegaTAOClient, params: any) {
1338
1338
  return errorHandler.handleWithRetry(
1339
1339
  () => client.positionManager.openPosition(params),
1340
1340
  'openPosition'
@@ -1348,13 +1348,13 @@ async function safeOpenPosition(client: AlphaFuturesClient, params: any) {
1348
1348
 
1349
1349
  ```typescript
1350
1350
  // __tests__/integration.test.ts
1351
- import { AlphaFuturesClient } from '@alpha-futures/sdk';
1351
+ import { MegaTAOClient } from '@alpha-futures/sdk';
1352
1352
  import { ethers } from 'ethers';
1353
1353
 
1354
1354
  jest.mock('@alpha-futures/sdk');
1355
1355
 
1356
1356
  describe('Alpha Futures Integration', () => {
1357
- let client: AlphaFuturesClient;
1357
+ let client: MegaTAOClient;
1358
1358
  let mockProvider: any;
1359
1359
  let mockSigner: any;
1360
1360
 
@@ -1367,7 +1367,7 @@ describe('Alpha Futures Integration', () => {
1367
1367
  getAddress: jest.fn().mockResolvedValue('0x123...'),
1368
1368
  };
1369
1369
 
1370
- client = new AlphaFuturesClient({
1370
+ client = new MegaTAOClient({
1371
1371
  provider: mockProvider,
1372
1372
  signer: mockSigner,
1373
1373
  network: 'mainnet'
@@ -1399,15 +1399,15 @@ describe('Alpha Futures Integration', () => {
1399
1399
 
1400
1400
  ```typescript
1401
1401
  // __tests__/e2e.test.ts
1402
- import { AlphaFuturesClient } from '@alpha-futures/sdk';
1402
+ import { MegaTAOClient } from '@alpha-futures/sdk';
1403
1403
  import { ethers } from 'ethers';
1404
1404
 
1405
1405
  describe('E2E Integration Tests', () => {
1406
- let client: AlphaFuturesClient;
1406
+ let client: MegaTAOClient;
1407
1407
 
1408
1408
  beforeAll(async () => {
1409
1409
  // Use test network
1410
- client = new AlphaFuturesClient({
1410
+ client = new MegaTAOClient({
1411
1411
  rpcUrl: process.env.TEST_RPC_URL,
1412
1412
  privateKey: process.env.TEST_PRIVATE_KEY,
1413
1413
  network: 'testnet'
@@ -1461,7 +1461,7 @@ describe('E2E Integration Tests', () => {
1461
1461
  ### Caching Layer
1462
1462
 
1463
1463
  ```typescript
1464
- class CachedAlphaFuturesClient extends AlphaFuturesClient {
1464
+ class CachedMegaTAOClient extends MegaTAOClient {
1465
1465
  private cache: Map<string, { value: any; timestamp: number }> = new Map();
1466
1466
  private cacheTTL: number = 5000; // 5 seconds
1467
1467
 
@@ -1508,7 +1508,7 @@ class CachedAlphaFuturesClient extends AlphaFuturesClient {
1508
1508
 
1509
1509
  ```typescript
1510
1510
  class BatchOperations {
1511
- private client: AlphaFuturesClient;
1511
+ private client: MegaTAOClient;
1512
1512
  private queue: Array<{
1513
1513
  operation: () => Promise<any>;
1514
1514
  resolve: (value: any) => void;
@@ -1516,7 +1516,7 @@ class BatchOperations {
1516
1516
  }> = [];
1517
1517
  private processing: boolean = false;
1518
1518
 
1519
- constructor(client: AlphaFuturesClient) {
1519
+ constructor(client: MegaTAOClient) {
1520
1520
  this.client = client;
1521
1521
  }
1522
1522
 
@@ -1635,7 +1635,7 @@ class RateLimiter {
1635
1635
  ```typescript
1636
1636
  class SecureTransactionManager {
1637
1637
  async sendTransaction(
1638
- client: AlphaFuturesClient,
1638
+ client: MegaTAOClient,
1639
1639
  operation: () => Promise<any>,
1640
1640
  options: {
1641
1641
  maxGasPrice?: bigint;
@@ -30,11 +30,11 @@ TypeError: Cannot read property 'openPosition' of undefined
30
30
  **Solutions:**
31
31
  ```typescript
32
32
  // ❌ Wrong
33
- const client = new AlphaFuturesClient(config);
33
+ const client = new MegaTAOClient(config);
34
34
  client.positionManager.openPosition(...); // May fail
35
35
 
36
36
  // ✅ Correct
37
- const client = new AlphaFuturesClient(config);
37
+ const client = new MegaTAOClient(config);
38
38
  // Wait for any async initialization if needed
39
39
  await client.initialize?.();
40
40
  await client.positionManager.openPosition(...);
@@ -794,7 +794,7 @@ class NetworkMonitor {
794
794
 
795
795
  ```typescript
796
796
  // Use testnet configuration
797
- const client = new AlphaFuturesClient({
797
+ const client = new MegaTAOClient({
798
798
  rpcUrl: 'https://testnet-rpc.bittensor.com',
799
799
  privateKey: process.env.TESTNET_PRIVATE_KEY,
800
800
  network: 'testnet'
@@ -851,7 +851,7 @@ try {
851
851
 
852
852
  ```typescript
853
853
  // Mobile-optimized client
854
- class MobileOptimizedClient extends AlphaFuturesClient {
854
+ class MobileOptimizedClient extends MegaTAOClient {
855
855
  constructor(config: ClientConfig) {
856
856
  super(config);
857
857
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megatao/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "TypeScript SDK for MegaTAO perpetual futures protocol",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Alpha Futures Client
2
+ * MegaTAO Client
3
3
  * Main client class that provides access to all protocol contracts
4
4
  */
5
5
 
@@ -16,13 +16,13 @@ import {
16
16
  } from 'viem';
17
17
  import { privateKeyToAccount } from 'viem/accounts';
18
18
 
19
- export interface AlphaClientConfig {
19
+ export interface MegaTAOClientConfig {
20
20
  rpcUrl?: string;
21
21
  privateKey?: `0x${string}`;
22
22
  walletClient?: WalletClient;
23
23
  }
24
24
 
25
- export class AlphaFuturesClient {
25
+ export class MegaTAOClient {
26
26
  private alphaContract: AlphaViem;
27
27
  private oracleContract: PriceOracleViem;
28
28
  private publicClient: PublicClient;
@@ -30,7 +30,7 @@ export class AlphaFuturesClient {
30
30
  private environment?: Environment;
31
31
  public readonly oracle: PriceOracleViem;
32
32
 
33
- constructor(environment: Environment, config: AlphaClientConfig = {}) {
33
+ constructor(environment: Environment, config: MegaTAOClientConfig = {}) {
34
34
  this.environment = environment;
35
35
  const envConfig = getEnvironmentConfig(environment);
36
36
 
@@ -151,8 +151,8 @@ export class AlphaFuturesClient {
151
151
 
152
152
  static forEnvironment(
153
153
  environment: Environment,
154
- config: AlphaClientConfig = {},
155
- ): AlphaFuturesClient {
156
- return new AlphaFuturesClient(environment, config);
154
+ config: MegaTAOClientConfig = {},
155
+ ): MegaTAOClient {
156
+ return new MegaTAOClient(environment, config);
157
157
  }
158
158
  }
package/src/index.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Alpha Futures SDK
3
- * Main entry point for the Alpha Futures TypeScript SDK
2
+ * MegaTAO SDK
3
+ * Main entry point for the MegaTAO TypeScript SDK
4
4
  */
5
5
 
6
6
  // Export main client
7
- export { AlphaFuturesClient } from './AlphaFuturesClient';
7
+ export { MegaTAOClient } from './MegaTAOClient';
8
8
 
9
9
  // Export Viem contracts
10
10
  export { AlphaViem, PriceOracleViem } from './contracts/viem';
@@ -1 +0,0 @@
1
- {"version":3,"file":"AlphaFuturesClient.d.ts","sourceRoot":"","sources":["../src/AlphaFuturesClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,OAAO,EACb,MAAM,MAAM,CAAC;AAGd,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,KAAK,MAAM,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,YAAY,CAAC,CAAe;IACpC,OAAO,CAAC,WAAW,CAAC,CAAc;IAClC,SAAgB,MAAM,EAAE,eAAe,CAAC;gBAE5B,WAAW,EAAE,WAAW,EAAE,MAAM,GAAE,iBAAsB;IAiFpE,QAAQ,IAAI,SAAS;IAIrB,eAAe,IAAI,YAAY;IAI/B,eAAe,IAAI,YAAY,GAAG,SAAS;IAI3C,cAAc,IAAI,WAAW,GAAG,SAAS;IAIzC,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED,IAAI,WAAW,IAAI,OAAO,CAEzB;IAEK,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