@typus/typus-perp-sdk 1.1.32-codegen-exp10 → 1.1.32-codegen-exp12
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 +1 -2
- package/dist/src/fetch.js +39 -45
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.js +1 -7
- package/package.json +1 -1
package/dist/src/client.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { SuiGraphQLClient } from "@mysten/sui/graphql";
|
|
|
2
2
|
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
|
-
import type { Experimental_SuiClientTypes } from "@mysten/sui/experimental";
|
|
6
5
|
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
|
|
7
6
|
export type Network = "MAINNET" | "TESTNET";
|
|
8
7
|
export declare class TypusClient {
|
|
@@ -25,5 +24,5 @@ export declare class TypusClient {
|
|
|
25
24
|
batchGetObjectsBcs(objectIds: string[]): Promise<(Uint8Array<ArrayBufferLike> | undefined)[]>;
|
|
26
25
|
getDynamicFieldsBcs(parent: string): Promise<Uint8Array<ArrayBufferLike>[]>;
|
|
27
26
|
getDynamicObjectFieldsBcs(parent: string): Promise<Uint8Array<ArrayBufferLike>[]>;
|
|
28
|
-
simulateTransaction(transactionBcs: Uint8Array<ArrayBufferLike>): Promise<Experimental_SuiClientTypes.DryRunTransactionResponse>;
|
|
27
|
+
simulateTransaction(transactionBcs: Uint8Array<ArrayBufferLike>): Promise<import("@mysten/sui/dist/cjs/experimental").Experimental_SuiClientTypes.DryRunTransactionResponse>;
|
|
29
28
|
}
|
package/dist/src/fetch.js
CHANGED
|
@@ -36,59 +36,53 @@ async function getLpPools(client) {
|
|
|
36
36
|
// lpPools.push(lpPool);
|
|
37
37
|
// }
|
|
38
38
|
// return lpPools.sort((a, b) => Number(a.index) - Number(b.index));
|
|
39
|
-
const bcsData = await client.getDynamicObjectFieldsBcs(_1.LIQUIDITY_POOL);
|
|
40
|
-
const parsedBcsData = bcsData.map((x) => lp_pool_2.LiquidityPool.parse(x));
|
|
41
|
-
const sortedParsedBcsData = parsedBcsData.sort((a, b) => Number(a.index) - Number(b.index));
|
|
42
|
-
console.log(bcsData, parsedBcsData, sortedParsedBcsData, "in perp sdk");
|
|
43
39
|
return (await client.getDynamicObjectFieldsBcs(_1.LIQUIDITY_POOL).then((x) => x.map((x) => lp_pool_2.LiquidityPool.parse(x)))).sort((a, b) => Number(a.index) - Number(b.index));
|
|
44
40
|
}
|
|
45
41
|
async function getLpPool(client, objectId) {
|
|
46
|
-
const data = await client.getObject({
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
if (data.data?.bcs?.dataType !== "moveObject") {
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
// console.log(data.data.bcs.bcsBytes);
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
|
|
42
|
+
// const data = await client.getObject({
|
|
43
|
+
// id: objectId,
|
|
44
|
+
// options: {
|
|
45
|
+
// // request the bcs data when loading your object
|
|
46
|
+
// showBcs: true,
|
|
47
|
+
// },
|
|
48
|
+
// });
|
|
49
|
+
// if (data.data?.bcs?.dataType !== "moveObject") {
|
|
50
|
+
// throw new Error("Expected a move object");
|
|
51
|
+
// }
|
|
52
|
+
// // console.log(data.data.bcs.bcsBytes);
|
|
53
|
+
// return LiquidityPool.fromBase64(data.data.bcs.bcsBytes);
|
|
54
|
+
const bcs = await client.getObjectBcs(objectId);
|
|
55
|
+
return lp_pool_2.LiquidityPool.parse(bcs);
|
|
60
56
|
}
|
|
61
57
|
// getLpPool(client).then((x) => console.log(x));
|
|
62
58
|
async function getStakePools(client) {
|
|
63
|
-
let dynamicFields = await client.getDynamicFields({
|
|
64
|
-
|
|
65
|
-
});
|
|
66
|
-
let stakePools = [];
|
|
67
|
-
for (const field of dynamicFields.data) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
return stakePools.sort((a, b) => Number(a.pool_info.index) - Number(b.pool_info.index));
|
|
73
|
-
|
|
74
|
-
// (a, b) => Number(a.pool_info.index) - Number(b.pool_info.index)
|
|
75
|
-
// );
|
|
59
|
+
// let dynamicFields = await client.getDynamicFields({
|
|
60
|
+
// parentId: STAKE_POOL,
|
|
61
|
+
// });
|
|
62
|
+
// let stakePools: (typeof StakePool.$inferType)[] = [];
|
|
63
|
+
// for (const field of dynamicFields.data) {
|
|
64
|
+
// let stakePool = await getStakePool(client, field.objectId);
|
|
65
|
+
// // console.log(stakePool);
|
|
66
|
+
// stakePools.push(stakePool);
|
|
67
|
+
// }
|
|
68
|
+
// return stakePools.sort((a, b) => Number(a.pool_info.index) - Number(b.pool_info.index));
|
|
69
|
+
return (await client.getDynamicObjectFieldsBcs(_1.STAKE_POOL).then((x) => x.map((x) => stake_pool_1.StakePool.parse(x)))).sort((a, b) => Number(a.pool_info.index) - Number(b.pool_info.index));
|
|
76
70
|
}
|
|
77
71
|
async function getStakePool(client, objectId) {
|
|
78
|
-
const data = await client.getObject({
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
});
|
|
85
|
-
if (data.data?.bcs?.dataType !== "moveObject") {
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
// console.log(data.data.bcs.bcsBytes);
|
|
89
|
-
return
|
|
90
|
-
|
|
91
|
-
|
|
72
|
+
// const data = await client.getObject({
|
|
73
|
+
// id: objectId,
|
|
74
|
+
// options: {
|
|
75
|
+
// // request the bcs data when loading your object
|
|
76
|
+
// showBcs: true,
|
|
77
|
+
// },
|
|
78
|
+
// });
|
|
79
|
+
// if (data.data?.bcs?.dataType !== "moveObject") {
|
|
80
|
+
// throw new Error("Expected a move object");
|
|
81
|
+
// }
|
|
82
|
+
// // console.log(data.data.bcs.bcsBytes);
|
|
83
|
+
// return StakePool.fromBase64(data.data.bcs.bcsBytes);
|
|
84
|
+
const bcs = await client.getObjectBcs(objectId);
|
|
85
|
+
return stake_pool_1.StakePool.parse(bcs);
|
|
92
86
|
}
|
|
93
87
|
/**
|
|
94
88
|
* @returns [Markets, SymbolMarket[]][]
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,9 +2,7 @@ export * from "./fetch";
|
|
|
2
2
|
export * from "./user";
|
|
3
3
|
export declare const NETWORK: string;
|
|
4
4
|
export declare const PERP_PACKAGE_ID: string;
|
|
5
|
-
export declare const PERP_PUBLISHED_AT: string;
|
|
6
5
|
export declare const STAKE_PACKAGE_ID: string;
|
|
7
|
-
export declare const STAKE_PUBLISHED_AT: string;
|
|
8
6
|
export declare const LP_POOL: string;
|
|
9
7
|
export declare const LIQUIDITY_POOL: string;
|
|
10
8
|
export declare const MARKET: string;
|
package/dist/src/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.COMPETITION_CONFIG = exports.STAKE_POOL_VERSION = exports.STAKE_POOL = exports.TLP_TREASURY_CAP = exports.PERP_VERSION = exports.MARKET = exports.LIQUIDITY_POOL = exports.LP_POOL = exports.
|
|
20
|
+
exports.COMPETITION_CONFIG = exports.STAKE_POOL_VERSION = exports.STAKE_POOL = exports.TLP_TREASURY_CAP = exports.PERP_VERSION = exports.MARKET = exports.LIQUIDITY_POOL = exports.LP_POOL = exports.STAKE_PACKAGE_ID = exports.PERP_PACKAGE_ID = exports.NETWORK = void 0;
|
|
21
21
|
__exportStar(require("./fetch"), exports);
|
|
22
22
|
__exportStar(require("./user"), exports);
|
|
23
23
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
@@ -28,15 +28,9 @@ exports.NETWORK = process.env.NEXT_PUBLIC_CLUSTER == "testnet" ? "TESTNET" : "MA
|
|
|
28
28
|
exports.PERP_PACKAGE_ID = exports.NETWORK == "MAINNET"
|
|
29
29
|
? "0xe27969a70f93034de9ce16e6ad661b480324574e68d15a64b513fd90eb2423e5"
|
|
30
30
|
: "0x94cd358f552e9dd5df837de85939a9d1d682e97480740a203121e6f4c0078853";
|
|
31
|
-
exports.PERP_PUBLISHED_AT = exports.NETWORK == "MAINNET"
|
|
32
|
-
? "0x9eda9afa0b42bf908766c42d02a549c271d7d0ae02c8c58c5075858f8f4d3b69"
|
|
33
|
-
: "0x7adddfb77658ff43ad0281e264fdb43403a1b97bc2f6328b55279dfb4253e1e0";
|
|
34
31
|
exports.STAKE_PACKAGE_ID = exports.NETWORK == "MAINNET"
|
|
35
32
|
? "0xc427209145715a00a93d7e674a95c556a7147d79fda1bbaeb1a1cac5f9923966"
|
|
36
33
|
: "0x02b94b340a8810f6c451bc244dc2dd8d9d50cf86d727798969ca2c287c3186aa";
|
|
37
|
-
exports.STAKE_PUBLISHED_AT = exports.NETWORK == "MAINNET"
|
|
38
|
-
? "0xdf96424bc1ba70a6e53c07b2b55c597eccb8a21f722a917a5b4c9d8514b2d858"
|
|
39
|
-
: "0x02b94b340a8810f6c451bc244dc2dd8d9d50cf86d727798969ca2c287c3186aa";
|
|
40
34
|
// lp_pool::Registry
|
|
41
35
|
exports.LP_POOL = exports.NETWORK == "MAINNET"
|
|
42
36
|
? "0xfee68e535bf24702be28fa38ea2d5946e617e0035027d5ca29dbed99efd82aaa"
|