@typus/typus-perp-sdk 1.1.32-codegen-exp4 → 1.1.32-codegen-exp7
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/dist/src/client.d.ts +2 -1
- package/dist/src/client.js +7 -2
- package/dist/src/fetch.d.ts +5 -45
- package/dist/src/fetch.js +4 -3
- package/package.json +3 -3
package/dist/src/client.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
|
3
3
|
import { DevInspectTransactionBlockParams, ExecuteTransactionBlockParams, GetCoinsParams, GetDynamicFieldsParams, GetObjectParams, GetOwnedObjectsParams, MultiGetObjectsParams, QueryEventsParams, SuiClient } from "@mysten/sui/client";
|
|
4
4
|
import { PythClient, TypusConfig } from "@typus/typus-sdk/dist/src/utils";
|
|
5
5
|
import type { Experimental_SuiClientTypes } from "@mysten/sui/experimental";
|
|
6
|
+
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
|
|
6
7
|
export type Network = "MAINNET" | "TESTNET";
|
|
7
8
|
export declare class TypusClient {
|
|
8
9
|
jsonRpcClient: SuiClient;
|
|
@@ -10,7 +11,7 @@ export declare class TypusClient {
|
|
|
10
11
|
graphQLClient: SuiGraphQLClient;
|
|
11
12
|
pythClient: PythClient;
|
|
12
13
|
config: TypusConfig;
|
|
13
|
-
constructor(config: TypusConfig);
|
|
14
|
+
constructor(config: TypusConfig, grpcTransport?: RpcTransport);
|
|
14
15
|
getCoins(params: GetCoinsParams): Promise<import("@mysten/sui/client").PaginatedCoins>;
|
|
15
16
|
getObject(params: GetObjectParams): Promise<import("@mysten/sui/client").SuiObjectResponse>;
|
|
16
17
|
getOwnedObjects(params: GetOwnedObjectsParams): Promise<import("@mysten/sui/client").PaginatedObjectsResponse>;
|
package/dist/src/client.js
CHANGED
|
@@ -6,10 +6,11 @@ const grpc_1 = require("@mysten/sui/grpc");
|
|
|
6
6
|
const client_1 = require("@mysten/sui/client");
|
|
7
7
|
const utils_1 = require("@typus/typus-sdk/dist/src/utils");
|
|
8
8
|
const src_1 = require("../src");
|
|
9
|
+
const grpcweb_transport_1 = require("@protobuf-ts/grpcweb-transport");
|
|
9
10
|
class TypusClient {
|
|
10
11
|
// user: string;
|
|
11
12
|
// mvr?: Experimental_SuiClientTypes.MvrOptions
|
|
12
|
-
constructor(config) {
|
|
13
|
+
constructor(config, grpcTransport) {
|
|
13
14
|
this.config = config;
|
|
14
15
|
const network = config.network.toLowerCase();
|
|
15
16
|
const mvr = {
|
|
@@ -31,7 +32,11 @@ class TypusClient {
|
|
|
31
32
|
});
|
|
32
33
|
this.gRpcClient = new grpc_1.SuiGrpcClient({
|
|
33
34
|
network: network,
|
|
34
|
-
|
|
35
|
+
transport: grpcTransport ??
|
|
36
|
+
new grpcweb_transport_1.GrpcWebFetchTransport({
|
|
37
|
+
baseUrl: `https://fullnode.${network}.sui.io:443`,
|
|
38
|
+
// Additional transport options
|
|
39
|
+
}),
|
|
35
40
|
});
|
|
36
41
|
this.graphQLClient = new graphql_1.SuiGraphQLClient({
|
|
37
42
|
network: network,
|
package/dist/src/fetch.d.ts
CHANGED
|
@@ -349,54 +349,14 @@ export declare function getUserOrders(client: TypusClient, input: {
|
|
|
349
349
|
user: string;
|
|
350
350
|
indexes: string[];
|
|
351
351
|
}): Promise<TradingOrderWithMarketIndex[]>;
|
|
352
|
+
export type Position = (typeof Position.$inferType);
|
|
353
|
+
export type PositionWithMarketIndex = Position & {
|
|
354
|
+
marketIndex: number;
|
|
355
|
+
};
|
|
352
356
|
export declare function getUserPositions(client: TypusClient, input: {
|
|
353
357
|
user: string;
|
|
354
358
|
indexes: string[];
|
|
355
|
-
}): Promise<
|
|
356
|
-
id: {
|
|
357
|
-
id: string;
|
|
358
|
-
};
|
|
359
|
-
create_ts_ms: string;
|
|
360
|
-
position_id: string;
|
|
361
|
-
linked_order_ids: string[];
|
|
362
|
-
linked_order_prices: string[];
|
|
363
|
-
user: string;
|
|
364
|
-
is_long: boolean;
|
|
365
|
-
size: string;
|
|
366
|
-
size_decimal: string;
|
|
367
|
-
collateral_token: {
|
|
368
|
-
name: string;
|
|
369
|
-
};
|
|
370
|
-
collateral_token_decimal: string;
|
|
371
|
-
symbol: {
|
|
372
|
-
base_token: {
|
|
373
|
-
name: string;
|
|
374
|
-
};
|
|
375
|
-
quote_token: {
|
|
376
|
-
name: string;
|
|
377
|
-
};
|
|
378
|
-
};
|
|
379
|
-
collateral_amount: string;
|
|
380
|
-
reserve_amount: string;
|
|
381
|
-
average_price: string;
|
|
382
|
-
entry_borrow_index: string;
|
|
383
|
-
entry_funding_rate_index_sign: boolean;
|
|
384
|
-
entry_funding_rate_index: string;
|
|
385
|
-
unrealized_loss: string;
|
|
386
|
-
unrealized_funding_sign: boolean;
|
|
387
|
-
unrealized_funding_fee: string;
|
|
388
|
-
unrealized_trading_fee: string;
|
|
389
|
-
unrealized_borrow_fee: string;
|
|
390
|
-
unrealized_rebate: string;
|
|
391
|
-
option_collateral_info: {
|
|
392
|
-
index: string;
|
|
393
|
-
bid_token: {
|
|
394
|
-
name: string;
|
|
395
|
-
};
|
|
396
|
-
bid_receipts_bcs: number[][];
|
|
397
|
-
} | null;
|
|
398
|
-
u64_padding: string[];
|
|
399
|
-
}[]>;
|
|
359
|
+
}): Promise<PositionWithMarketIndex[]>;
|
|
400
360
|
export declare function parseOptionBidReceipts(positions: (typeof Position.$inferType)[]): ({
|
|
401
361
|
id: {
|
|
402
362
|
id: string;
|
package/dist/src/fetch.js
CHANGED
|
@@ -170,9 +170,10 @@ async function getUserPositions(client, input) {
|
|
|
170
170
|
let length = reader.readULEB();
|
|
171
171
|
let bytes = reader.readBytes(length);
|
|
172
172
|
let position = position_1.Position.parse(bytes);
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
positions.push({
|
|
174
|
+
...position,
|
|
175
|
+
marketIndex: x,
|
|
176
|
+
});
|
|
176
177
|
});
|
|
177
178
|
}
|
|
178
179
|
// let positions: Position[] = readVecPosition(Uint8Array.from(returnValues));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typus/typus-perp-sdk",
|
|
3
|
-
"version": "1.1.32-codegen-
|
|
3
|
+
"version": "1.1.32-codegen-exp7",
|
|
4
4
|
"repository": "https://github.com/Typus-Lab/typus-perp-sdk.git",
|
|
5
5
|
"author": "Typus",
|
|
6
6
|
"description": "typus perp sdk",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"url": "https://github.com/Typus-Lab/typus-perp-sdk/issues"
|
|
44
44
|
},
|
|
45
45
|
"homepage": "https://github.com/Typus-Lab/typus-perp-sdk#readme",
|
|
46
|
-
"packageManager": "yarn@4.10.3
|
|
47
|
-
}
|
|
46
|
+
"packageManager": "yarn@4.10.3"
|
|
47
|
+
}
|