@typus/typus-perp-sdk 1.2.0 → 1.2.1

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.
@@ -1,7 +1,6 @@
1
1
  import { SuiGraphQLClient } from "@mysten/sui/graphql";
2
2
  import { SuiGrpcClient } from "@mysten/sui/grpc";
3
3
  import { PythClient, TypusConfig } from "@typus/typus-sdk/dist/src/utils";
4
- import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
5
4
  import { SuiClientTypes } from "@mysten/sui/client";
6
5
  export type Network = "MAINNET" | "TESTNET";
7
6
  export declare class TypusClient {
@@ -9,7 +8,7 @@ export declare class TypusClient {
9
8
  graphQLClient: SuiGraphQLClient;
10
9
  pythClient: PythClient;
11
10
  config: TypusConfig;
12
- constructor(config: TypusConfig, grpcTransport?: RpcTransport);
11
+ constructor(config: TypusConfig);
13
12
  getCoins(params: SuiClientTypes.ListCoinsOptions): Promise<SuiClientTypes.ListCoinsResponse>;
14
13
  getObject(params: SuiClientTypes.GetObjectOptions): Promise<SuiClientTypes.GetObjectResponse<{}>>;
15
14
  getOwnedObjects(params: SuiClientTypes.ListOwnedObjectsOptions): Promise<SuiClientTypes.ListOwnedObjectsResponse<{}>>;
@@ -9,7 +9,7 @@ const jsonRpc_1 = require("@mysten/sui/jsonRpc");
9
9
  class TypusClient {
10
10
  // user: string;
11
11
  // mvr?: Experimental_SuiClientTypes.MvrOptions
12
- constructor(config, grpcTransport) {
12
+ constructor(config) {
13
13
  this.config = config;
14
14
  const network = config.network.toLowerCase();
15
15
  const mvr = {
@@ -81,8 +81,8 @@ function zeroCoin(tx, typeArgs) {
81
81
  });
82
82
  }
83
83
  async function cancelTradingOrder(client, tx, input) {
84
- let cToken = "0x" + input.order.collateral_token.name;
85
- let BASE_TOKEN = "0x" + input.order.symbol.base_token.name;
84
+ let cToken = (0, utils_3.normalizeStructTag)(input.order.collateral_token.name);
85
+ let BASE_TOKEN = (0, utils_3.normalizeStructTag)(input.order.symbol.base_token.name);
86
86
  let coin = tx.add((0, trading_1.cancelTradingOrder)({
87
87
  arguments: {
88
88
  version: __1.PERP_VERSION,
@@ -177,7 +177,7 @@ async function unstakeRedeem(client, tx, input) {
177
177
  }));
178
178
  let balance = tx.moveCall({
179
179
  target: `0x2::coin::into_balance`,
180
- typeArguments: [input.lpPool.lp_token_type.name],
180
+ typeArguments: [lpToken],
181
181
  arguments: [lpCoin],
182
182
  });
183
183
  tx.add((0, lp_pool_1.redeem)({
@@ -187,7 +187,7 @@ async function unstakeRedeem(client, tx, input) {
187
187
  index: BigInt(input.stakePool.pool_info.index),
188
188
  balance,
189
189
  },
190
- typeArguments: [input.lpPool.lp_token_type.name],
190
+ typeArguments: [lpToken],
191
191
  }));
192
192
  return tx;
193
193
  }
@@ -310,7 +310,7 @@ async function swap(client, tx, input) {
310
310
  return tx;
311
311
  }
312
312
  async function harvestStakeReward(client, tx, input) {
313
- let iTokens = input.stakePool.incentives.map((i) => i.token_type.name);
313
+ let iTokens = input.stakePool.incentives.map((i) => (0, utils_1.normalizeStructTag)(i.token_type.name));
314
314
  snapshot(client, tx, { perpIndex: input.stakePool.pool_info.index });
315
315
  for (let iToken of iTokens) {
316
316
  // console.log(iToken);
package/package.json CHANGED
@@ -1,42 +1,41 @@
1
1
  {
2
- "name": "@typus/typus-perp-sdk",
3
- "version": "1.2.0",
4
- "repository": "https://github.com/Typus-Lab/typus-perp-sdk.git",
5
- "author": "Typus",
6
- "description": "typus perp sdk",
7
- "license": "MIT",
8
- "dependencies": {
9
- "@mysten/bcs": "2.0.3",
10
- "@mysten/sui": "2.13.2",
11
- "@typus/typus-sdk": "1.9.0"
12
- },
13
- "resolutions": {
14
- "@mysten/bcs": "2.0.3",
15
- "@mysten/sui": "2.13.2",
16
- "@pythnetwork/pyth-sui-js": "2.3.0"
17
- },
18
- "devDependencies": {
19
- "@types/node": "^25.6.0",
20
- "bignumber.js": "9.1.2",
21
- "prettier": "^3.0.0",
22
- "ts-node": "^10.9.2",
23
- "tsc-alias": "^1.8.10",
24
- "tsconfig-paths": "^4.2.0",
25
- "tslint": "^6.1.3",
26
- "tslint-config-prettier": "^1.18.0",
27
- "typescript": "^5.1.6"
28
- },
29
- "main": "dist/src/index.js",
30
- "types": "dist/src/index.d.ts",
31
- "files": [
32
- "dist"
33
- ],
34
- "scripts": {
35
- "build": "rm -rf dist && tsc -p tsconfig.build.json && tsc-alias"
36
- },
37
- "bugs": {
38
- "url": "https://github.com/Typus-Lab/typus-perp-sdk/issues"
39
- },
40
- "homepage": "https://github.com/Typus-Lab/typus-perp-sdk#readme",
41
- "packageManager": "yarn@4.10.3+sha512.c38cafb5c7bb273f3926d04e55e1d8c9dfa7d9c3ea1f36a4868fa028b9e5f72298f0b7f401ad5eb921749eb012eb1c3bb74bf7503df3ee43fd600d14a018266f"
42
- }
2
+ "name": "@typus/typus-perp-sdk",
3
+ "version": "1.2.1",
4
+ "repository": "https://github.com/Typus-Lab/typus-perp-sdk.git",
5
+ "author": "Typus",
6
+ "description": "typus perp sdk",
7
+ "license": "MIT",
8
+ "dependencies": {
9
+ "@mysten/bcs": "2.0.3",
10
+ "@mysten/sui": "2.13.2",
11
+ "@typus/typus-sdk": "1.9.0",
12
+ "dotenv": "^17.4.2"
13
+ },
14
+ "resolutions": {
15
+ "@pythnetwork/pyth-sui-js": "2.3.0"
16
+ },
17
+ "devDependencies": {
18
+ "@types/node": "^25.6.0",
19
+ "axios": "1.13.2",
20
+ "bignumber.js": "9.1.2",
21
+ "prettier": "^3.0.0",
22
+ "ts-node": "^10.9.2",
23
+ "tsc-alias": "^1.8.10",
24
+ "tsconfig-paths": "^4.2.0",
25
+ "tslint": "^6.1.3",
26
+ "tslint-config-prettier": "^1.18.0",
27
+ "typescript": "^5.1.6"
28
+ },
29
+ "main": "dist/src/index.js",
30
+ "types": "dist/src/index.d.ts",
31
+ "files": [
32
+ "dist"
33
+ ],
34
+ "bugs": {
35
+ "url": "https://github.com/Typus-Lab/typus-perp-sdk/issues"
36
+ },
37
+ "homepage": "https://github.com/Typus-Lab/typus-perp-sdk#readme",
38
+ "scripts": {
39
+ "build": "rm -rf dist && tsc -p tsconfig.build.json && tsc-alias"
40
+ }
41
+ }