@interest-protocol/vortex-sdk 7.3.0 → 7.5.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/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.js +21 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -8
- package/dist/index.mjs.map +1 -1
- package/dist/utils/decrypt.d.ts.map +1 -1
- package/dist/vortex-api.d.ts +2 -1
- package/dist/vortex-api.d.ts.map +1 -1
- package/dist/vortex-api.types.d.ts +25 -8
- package/dist/vortex-api.types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/constants.ts +1 -1
- package/src/utils/decrypt.ts +5 -2
- package/src/vortex-api.ts +24 -6
- package/src/vortex-api.types.ts +26 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decrypt.d.ts","sourceRoot":"","sources":["../../src/utils/decrypt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,UAAU,mBAAmB;IAC3B,gBAAgB,EAAE,eAAe,CAAC;IAClC,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC;CACjC;AAED,eAAO,MAAM,eAAe,GAAU,6DAKnC,mBAAmB,oBAkCrB,CAAC;AAEF,UAAU,0BAA0B;IAClC,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC;CACjC;AAED,eAAO,MAAM,sBAAsB,GAAU,wDAK1C,0BAA0B,
|
|
1
|
+
{"version":3,"file":"decrypt.d.ts","sourceRoot":"","sources":["../../src/utils/decrypt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,UAAU,mBAAmB;IAC3B,gBAAgB,EAAE,eAAe,CAAC;IAClC,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC;CACjC;AAED,eAAO,MAAM,eAAe,GAAU,6DAKnC,mBAAmB,oBAkCrB,CAAC;AAEF,UAAU,0BAA0B;IAClC,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC;CACjC;AAED,eAAO,MAAM,sBAAsB,GAAU,wDAK1C,0BAA0B,oBA2C5B,CAAC"}
|
package/dist/vortex-api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VortexAPIConstructorArgs, HealthResponse, AccountsResponse, CreateAccountRequest, AccountResponse, PoolsResponse, GetPoolsArgs, CommitmentsResponse, GetCommitmentsArgs, MerklePathRequest, MerklePathResponse, ExecuteTransactionRequest, TransactionResponse, RelayerResponse } from './vortex-api.types';
|
|
1
|
+
import { VortexAPIConstructorArgs, HealthResponse, AccountsResponse, CreateAccountRequest, AccountResponse, PoolsResponse, GetPoolsArgs, Commitment, CommitmentsResponse, GetCommitmentsArgs, MerklePathRequest, MerklePathResponse, ExecuteTransactionRequest, TransactionResponse, RelayerResponse } from './vortex-api.types';
|
|
2
2
|
export declare class VortexAPI {
|
|
3
3
|
#private;
|
|
4
4
|
constructor({ apiUrl }?: VortexAPIConstructorArgs);
|
|
@@ -7,6 +7,7 @@ export declare class VortexAPI {
|
|
|
7
7
|
createAccount(args: CreateAccountRequest): Promise<AccountResponse>;
|
|
8
8
|
getPools(args?: GetPoolsArgs): Promise<PoolsResponse>;
|
|
9
9
|
getCommitments(args: GetCommitmentsArgs): Promise<CommitmentsResponse>;
|
|
10
|
+
getAllCommitments(args: Omit<GetCommitmentsArgs, 'page'>): Promise<Commitment[]>;
|
|
10
11
|
getMerklePath(args: MerklePathRequest): Promise<MerklePathResponse>;
|
|
11
12
|
executeTransaction(args: ExecuteTransactionRequest): Promise<TransactionResponse>;
|
|
12
13
|
getRelayer(): Promise<RelayerResponse>;
|
package/dist/vortex-api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vortex-api.d.ts","sourceRoot":"","sources":["../src/vortex-api.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EAExB,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,mBAAmB,EACnB,eAAe,EAGhB,MAAM,oBAAoB,CAAC;AAE5B,qBAAa,SAAS;;gBAGR,EAAE,MAAuB,EAAE,GAAE,wBAA6B;IAIhE,MAAM,IAAI,OAAO,CAAC,cAAc,CAAC;IAQjC,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAY5D,aAAa,CAAC,IAAI,EAAE,oBAAoB,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,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkBnE,kBAAkB,CACtB,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,mBAAmB,CAAC;IAczB,UAAU,IAAI,OAAO,CAAC,eAAe,CAAC;CA4C7C;AAED,eAAO,MAAM,SAAS,WAAkB,CAAC"}
|
|
@@ -3,18 +3,27 @@ export declare const VORTEX_API_URL = "https://api.vortexfi.xyz";
|
|
|
3
3
|
export interface VortexAPIConstructorArgs {
|
|
4
4
|
apiUrl?: string;
|
|
5
5
|
}
|
|
6
|
+
export type ServiceStatus = 'healthy' | 'unhealthy';
|
|
6
7
|
export interface HealthStatus {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
status: 'healthy' | 'degraded';
|
|
9
|
+
services: {
|
|
10
|
+
mongodb: ServiceStatus;
|
|
11
|
+
redis: ServiceStatus;
|
|
12
|
+
sui: ServiceStatus;
|
|
13
|
+
};
|
|
14
|
+
timestamp: string;
|
|
10
15
|
}
|
|
11
16
|
export interface HealthResponse {
|
|
12
17
|
success: true;
|
|
13
18
|
data: HealthStatus;
|
|
14
19
|
}
|
|
15
20
|
export interface Account {
|
|
16
|
-
|
|
21
|
+
id: string;
|
|
22
|
+
objectId: string;
|
|
17
23
|
hashedSecret: string;
|
|
24
|
+
owner: string;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
txDigest: string;
|
|
18
27
|
}
|
|
19
28
|
export interface AccountsResponse {
|
|
20
29
|
success: true;
|
|
@@ -29,10 +38,13 @@ export interface AccountResponse {
|
|
|
29
38
|
data: Account;
|
|
30
39
|
}
|
|
31
40
|
export interface Pool {
|
|
41
|
+
id: string;
|
|
32
42
|
objectId: string;
|
|
33
43
|
coinType: string;
|
|
34
|
-
|
|
35
|
-
|
|
44
|
+
digest: string;
|
|
45
|
+
sender: string;
|
|
46
|
+
checkpoint: number;
|
|
47
|
+
checkpointTimestampMs: number;
|
|
36
48
|
}
|
|
37
49
|
export interface Pagination {
|
|
38
50
|
page: number;
|
|
@@ -55,10 +67,15 @@ export interface GetPoolsArgs {
|
|
|
55
67
|
coinType?: string;
|
|
56
68
|
}
|
|
57
69
|
export interface Commitment {
|
|
58
|
-
|
|
70
|
+
id: string;
|
|
59
71
|
index: number;
|
|
72
|
+
commitment: string;
|
|
60
73
|
coinType: string;
|
|
61
|
-
encryptedOutput:
|
|
74
|
+
encryptedOutput: number[];
|
|
75
|
+
digest: string;
|
|
76
|
+
sender: string;
|
|
77
|
+
checkpoint: number;
|
|
78
|
+
checkpointTimestampMs: number;
|
|
62
79
|
}
|
|
63
80
|
export interface CommitmentsResponse {
|
|
64
81
|
success: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vortex-api.types.d.ts","sourceRoot":"","sources":["../src/vortex-api.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,eAAO,MAAM,cAAc,6BAA6B,CAAC;AAEzD,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,
|
|
1
|
+
{"version":3,"file":"vortex-api.types.d.ts","sourceRoot":"","sources":["../src/vortex-api.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,eAAO,MAAM,cAAc,6BAA6B,CAAC;AAEzD,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,CAAC;AAEpD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,SAAS,GAAG,UAAU,CAAC;IAC/B,QAAQ,EAAE;QACR,OAAO,EAAE,aAAa,CAAC;QACvB,KAAK,EAAE,aAAa,CAAC;QACrB,GAAG,EAAE,aAAa,CAAC;KACpB,CAAC;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AW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interest-protocol/vortex-sdk",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"rimraf": "^6.0.1",
|
|
38
38
|
"ts-jest": "^29.1.1",
|
|
39
39
|
"tsup": "^8.3.5",
|
|
40
|
-
"@interest-protocol/
|
|
41
|
-
"@interest-protocol/
|
|
40
|
+
"@interest-protocol/prettier-config": "1.0.0",
|
|
41
|
+
"@interest-protocol/typescript-config": "1.0.0"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public",
|
package/src/constants.ts
CHANGED
|
@@ -93,7 +93,7 @@ export const LSK_FETCH_OFFSET = 'fetch_offset';
|
|
|
93
93
|
|
|
94
94
|
export const LSK_ENCRYPTED_OUTPUTS = 'encrypted_outputs';
|
|
95
95
|
|
|
96
|
-
export const VORTEX_SIGNATURE_DOMAIN = '
|
|
96
|
+
export const VORTEX_SIGNATURE_DOMAIN = 'https://kage.money/'.toUpperCase();
|
|
97
97
|
|
|
98
98
|
export const TREASURY_ADDRESS =
|
|
99
99
|
'0x894261575b948c035d002adc3ca4d73c683c01a1bfafac183870940bf9afef1a';
|
package/src/utils/decrypt.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Commitment } from '../vortex-api.types';
|
|
|
4
4
|
import { UtxoPayload } from '../entities/keypair';
|
|
5
5
|
import { VortexKeypair } from '../entities/keypair';
|
|
6
6
|
import { Utxo } from '../entities/utxo';
|
|
7
|
-
import { normalizeStructTag } from '@mysten/sui/utils';
|
|
7
|
+
import { normalizeStructTag, toHex } from '@mysten/sui/utils';
|
|
8
8
|
import { Vortex } from '../vortex';
|
|
9
9
|
import { VortexPool } from '../vortex.types';
|
|
10
10
|
import invariant from 'tiny-invariant';
|
|
@@ -81,7 +81,10 @@ export const getUnspentUtxosWithApi = async ({
|
|
|
81
81
|
'Commitment coin type does not match vortex pool coin type'
|
|
82
82
|
);
|
|
83
83
|
try {
|
|
84
|
-
const
|
|
84
|
+
const encryptedOutputHex = toHex(
|
|
85
|
+
Uint8Array.from(commitment.encryptedOutput)
|
|
86
|
+
);
|
|
87
|
+
const utxo = vortexKeypair.decryptUtxo(encryptedOutputHex);
|
|
85
88
|
allUtxos.push(utxo);
|
|
86
89
|
} catch {
|
|
87
90
|
// Do nothing
|
package/src/vortex-api.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
AccountResponse,
|
|
9
9
|
PoolsResponse,
|
|
10
10
|
GetPoolsArgs,
|
|
11
|
+
Commitment,
|
|
11
12
|
CommitmentsResponse,
|
|
12
13
|
GetCommitmentsArgs,
|
|
13
14
|
MerklePathRequest,
|
|
@@ -60,15 +61,15 @@ export class VortexAPI {
|
|
|
60
61
|
async getPools(args: GetPoolsArgs = {}): Promise<PoolsResponse> {
|
|
61
62
|
const params = new URLSearchParams();
|
|
62
63
|
|
|
63
|
-
if (args.page
|
|
64
|
+
if (args.page) {
|
|
64
65
|
params.set('page', args.page.toString());
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
if (args.limit
|
|
68
|
+
if (args.limit) {
|
|
68
69
|
params.set('limit', args.limit.toString());
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
if (args.coinType
|
|
72
|
+
if (args.coinType) {
|
|
72
73
|
params.set('coin_type', args.coinType);
|
|
73
74
|
}
|
|
74
75
|
|
|
@@ -88,15 +89,15 @@ export class VortexAPI {
|
|
|
88
89
|
index: args.index.toString(),
|
|
89
90
|
});
|
|
90
91
|
|
|
91
|
-
if (args.op
|
|
92
|
+
if (args.op) {
|
|
92
93
|
params.set('op', args.op);
|
|
93
94
|
}
|
|
94
95
|
|
|
95
|
-
if (args.page
|
|
96
|
+
if (args.page) {
|
|
96
97
|
params.set('page', args.page.toString());
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
if (args.limit
|
|
100
|
+
if (args.limit) {
|
|
100
101
|
params.set('limit', args.limit.toString());
|
|
101
102
|
}
|
|
102
103
|
|
|
@@ -109,6 +110,23 @@ export class VortexAPI {
|
|
|
109
110
|
return response;
|
|
110
111
|
}
|
|
111
112
|
|
|
113
|
+
async getAllCommitments(
|
|
114
|
+
args: Omit<GetCommitmentsArgs, 'page'>
|
|
115
|
+
): Promise<Commitment[]> {
|
|
116
|
+
const allCommitments: Commitment[] = [];
|
|
117
|
+
let page = 1;
|
|
118
|
+
let hasNext = true;
|
|
119
|
+
|
|
120
|
+
while (hasNext) {
|
|
121
|
+
const response = await this.getCommitments({ ...args, page });
|
|
122
|
+
allCommitments.push(...response.data.items);
|
|
123
|
+
hasNext = response.data.pagination.hasNext;
|
|
124
|
+
page++;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return allCommitments;
|
|
128
|
+
}
|
|
129
|
+
|
|
112
130
|
async getMerklePath(args: MerklePathRequest): Promise<MerklePathResponse> {
|
|
113
131
|
const response = await this.#post<MerklePathResponse>(
|
|
114
132
|
'/api/v1/merkle/path',
|
package/src/vortex-api.types.ts
CHANGED
|
@@ -6,10 +6,16 @@ export interface VortexAPIConstructorArgs {
|
|
|
6
6
|
apiUrl?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
export type ServiceStatus = 'healthy' | 'unhealthy';
|
|
10
|
+
|
|
9
11
|
export interface HealthStatus {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
status: 'healthy' | 'degraded';
|
|
13
|
+
services: {
|
|
14
|
+
mongodb: ServiceStatus;
|
|
15
|
+
redis: ServiceStatus;
|
|
16
|
+
sui: ServiceStatus;
|
|
17
|
+
};
|
|
18
|
+
timestamp: string;
|
|
13
19
|
}
|
|
14
20
|
|
|
15
21
|
export interface HealthResponse {
|
|
@@ -18,8 +24,12 @@ export interface HealthResponse {
|
|
|
18
24
|
}
|
|
19
25
|
|
|
20
26
|
export interface Account {
|
|
21
|
-
|
|
27
|
+
id: string;
|
|
28
|
+
objectId: string;
|
|
22
29
|
hashedSecret: string;
|
|
30
|
+
owner: string;
|
|
31
|
+
createdAt: string;
|
|
32
|
+
txDigest: string;
|
|
23
33
|
}
|
|
24
34
|
|
|
25
35
|
export interface AccountsResponse {
|
|
@@ -38,10 +48,13 @@ export interface AccountResponse {
|
|
|
38
48
|
}
|
|
39
49
|
|
|
40
50
|
export interface Pool {
|
|
51
|
+
id: string;
|
|
41
52
|
objectId: string;
|
|
42
53
|
coinType: string;
|
|
43
|
-
|
|
44
|
-
|
|
54
|
+
digest: string;
|
|
55
|
+
sender: string;
|
|
56
|
+
checkpoint: number;
|
|
57
|
+
checkpointTimestampMs: number;
|
|
45
58
|
}
|
|
46
59
|
|
|
47
60
|
export interface Pagination {
|
|
@@ -68,10 +81,15 @@ export interface GetPoolsArgs {
|
|
|
68
81
|
}
|
|
69
82
|
|
|
70
83
|
export interface Commitment {
|
|
71
|
-
|
|
84
|
+
id: string;
|
|
72
85
|
index: number;
|
|
86
|
+
commitment: string;
|
|
73
87
|
coinType: string;
|
|
74
|
-
encryptedOutput:
|
|
88
|
+
encryptedOutput: number[];
|
|
89
|
+
digest: string;
|
|
90
|
+
sender: string;
|
|
91
|
+
checkpoint: number;
|
|
92
|
+
checkpointTimestampMs: number;
|
|
75
93
|
}
|
|
76
94
|
|
|
77
95
|
export interface CommitmentsResponse {
|