@interest-protocol/vortex-sdk 7.4.0 → 7.6.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/index.js +53 -470
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -470
- package/dist/index.mjs.map +1 -1
- package/dist/utils/decrypt.d.ts.map +1 -1
- package/dist/utils/prove.d.ts +2 -2
- package/dist/utils/prove.d.ts.map +1 -1
- package/dist/vortex-B4vJEPJu.js +161 -0
- package/dist/vortex-B4vJEPJu.js.map +1 -0
- package/dist/vortex-CG5eotma.js +315 -0
- package/dist/vortex-CG5eotma.js.map +1 -0
- package/dist/vortex-CqFkd5YM.mjs +158 -0
- package/dist/vortex-CqFkd5YM.mjs.map +1 -0
- 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/dist/vortex-pJNVBvjP.mjs +313 -0
- package/dist/vortex-pJNVBvjP.mjs.map +1 -0
- package/package.json +3 -3
- package/rollup.config.js +6 -2
- package/src/utils/decrypt.ts +5 -2
- package/src/utils/deposit.ts +2 -2
- package/src/utils/prove.ts +32 -10
- package/src/utils/withdraw.ts +2 -2
- package/src/vortex-api.ts +24 -6
- package/src/vortex-api.types.ts +26 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vortex-CqFkd5YM.mjs","sources":["../src/pkg/web/vortex.js"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA,IAAI,IAAI;AAmER,IAAI,eAAe,GAAG,CAAC;AAEvB,IAAI,uBAAuB,GAAG,IAAI;AAElC,SAAS,oBAAoB,GAAA;IAC3B,IACE,uBAAuB,KAAK,IAAI;AAChC,QAAA,uBAAuB,CAAC,UAAU,KAAK,CAAC,EACxC;QACA,uBAAuB,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC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YACR,IAAI,GAAG,CAAC;AACR,YAAA,MAAM,uBAAuB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACvC;QACA,WAAW,GAAG,IAAI;QAClB,WAAW,GAAG,IAAI;AAClB,QAAA,OAAO,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC;IACvC;YAAU;QACR,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC;IACnD;AACF;AAEA;;;;;;;;;;;;AAYG;AACG,SAAU,MAAM,CAAC,UAAU,EAAE,iBAAiB,EAAA;AAClD,IAAA,MAAM,IAAI,GAAG,iBAAiB,CAC5B,UAAU,EACV,IAAI,CAAC,iBAAiB,EACtB,IAAI,CAAC,kBAAkB,CACxB;IACD,MAAM,IAAI,GAAG,eAAe;AAC5B,IAAA,MAAM,IAAI,GAAG,iBAAiB,CAC5B,iBAAiB,EACjB,IAAI,CAAC,iBAAiB,EACtB,IAAI,CAAC,kBAAkB,CACxB;IACD,MAAM,IAAI,GAAG,eAAe;AAC5B,IAAA,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;AAC/C,IAAA,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE;AACV,QAAA,MAAM,uBAAuB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACvC;AACA,IAAA,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;AACrB;;;;"}
|
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,GAAG,OAAO,CAAC,eAAe,CAAC;IAWnE,QAA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AAO,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;IACF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,M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;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"}
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import require$$0 from 'fs';
|
|
2
|
+
|
|
3
|
+
function _mergeNamespaces(n, m) {
|
|
4
|
+
m.forEach(function (e) {
|
|
5
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
6
|
+
if (k !== 'default' && !(k in n)) {
|
|
7
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
8
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return e[k]; }
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
return Object.freeze(n);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
var vortex$1 = {exports: {}};
|
|
19
|
+
|
|
20
|
+
var hasRequiredVortex;
|
|
21
|
+
|
|
22
|
+
function requireVortex () {
|
|
23
|
+
if (hasRequiredVortex) return vortex$1.exports;
|
|
24
|
+
hasRequiredVortex = 1;
|
|
25
|
+
(function (module, exports) {
|
|
26
|
+
/* eslint-disable */
|
|
27
|
+
let imports = {};
|
|
28
|
+
imports['__wbindgen_placeholder__'] = module.exports;
|
|
29
|
+
function debugString(val) {
|
|
30
|
+
// primitive types
|
|
31
|
+
const type = typeof val;
|
|
32
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
33
|
+
return `${val}`;
|
|
34
|
+
}
|
|
35
|
+
if (type == 'string') {
|
|
36
|
+
return `"${val}"`;
|
|
37
|
+
}
|
|
38
|
+
if (type == 'symbol') {
|
|
39
|
+
const description = val.description;
|
|
40
|
+
if (description == null) {
|
|
41
|
+
return 'Symbol';
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return `Symbol(${description})`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (type == 'function') {
|
|
48
|
+
const name = val.name;
|
|
49
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
50
|
+
return `Function(${name})`;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
return 'Function';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// objects
|
|
57
|
+
if (Array.isArray(val)) {
|
|
58
|
+
const length = val.length;
|
|
59
|
+
let debug = '[';
|
|
60
|
+
if (length > 0) {
|
|
61
|
+
debug += debugString(val[0]);
|
|
62
|
+
}
|
|
63
|
+
for (let i = 1; i < length; i++) {
|
|
64
|
+
debug += ', ' + debugString(val[i]);
|
|
65
|
+
}
|
|
66
|
+
debug += ']';
|
|
67
|
+
return debug;
|
|
68
|
+
}
|
|
69
|
+
// Test for built-in
|
|
70
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
71
|
+
let className;
|
|
72
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
73
|
+
className = builtInMatches[1];
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
// Failed to match the standard '[object ClassName]'
|
|
77
|
+
return toString.call(val);
|
|
78
|
+
}
|
|
79
|
+
if (className == 'Object') {
|
|
80
|
+
// we're a user defined class or Object
|
|
81
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
82
|
+
// easier than looping through ownProperties of `val`.
|
|
83
|
+
try {
|
|
84
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
85
|
+
}
|
|
86
|
+
catch (_) {
|
|
87
|
+
return 'Object';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// errors
|
|
91
|
+
if (val instanceof Error) {
|
|
92
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
93
|
+
}
|
|
94
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
95
|
+
return className;
|
|
96
|
+
}
|
|
97
|
+
let WASM_VECTOR_LEN = 0;
|
|
98
|
+
let cachedUint8ArrayMemory0 = null;
|
|
99
|
+
function getUint8ArrayMemory0() {
|
|
100
|
+
if (cachedUint8ArrayMemory0 === null ||
|
|
101
|
+
cachedUint8ArrayMemory0.byteLength === 0) {
|
|
102
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
103
|
+
}
|
|
104
|
+
return cachedUint8ArrayMemory0;
|
|
105
|
+
}
|
|
106
|
+
const cachedTextEncoder = new TextEncoder();
|
|
107
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
108
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
109
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
110
|
+
view.set(buf);
|
|
111
|
+
return {
|
|
112
|
+
read: arg.length,
|
|
113
|
+
written: buf.length,
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
118
|
+
if (realloc === undefined) {
|
|
119
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
120
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
121
|
+
getUint8ArrayMemory0()
|
|
122
|
+
.subarray(ptr, ptr + buf.length)
|
|
123
|
+
.set(buf);
|
|
124
|
+
WASM_VECTOR_LEN = buf.length;
|
|
125
|
+
return ptr;
|
|
126
|
+
}
|
|
127
|
+
let len = arg.length;
|
|
128
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
129
|
+
const mem = getUint8ArrayMemory0();
|
|
130
|
+
let offset = 0;
|
|
131
|
+
for (; offset < len; offset++) {
|
|
132
|
+
const code = arg.charCodeAt(offset);
|
|
133
|
+
if (code > 0x7f)
|
|
134
|
+
break;
|
|
135
|
+
mem[ptr + offset] = code;
|
|
136
|
+
}
|
|
137
|
+
if (offset !== len) {
|
|
138
|
+
if (offset !== 0) {
|
|
139
|
+
arg = arg.slice(offset);
|
|
140
|
+
}
|
|
141
|
+
ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0;
|
|
142
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
143
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
144
|
+
offset += ret.written;
|
|
145
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
146
|
+
}
|
|
147
|
+
WASM_VECTOR_LEN = offset;
|
|
148
|
+
return ptr;
|
|
149
|
+
}
|
|
150
|
+
let cachedDataViewMemory0 = null;
|
|
151
|
+
function getDataViewMemory0() {
|
|
152
|
+
if (cachedDataViewMemory0 === null ||
|
|
153
|
+
cachedDataViewMemory0.buffer.detached === true ||
|
|
154
|
+
(cachedDataViewMemory0.buffer.detached === undefined &&
|
|
155
|
+
cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
156
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
157
|
+
}
|
|
158
|
+
return cachedDataViewMemory0;
|
|
159
|
+
}
|
|
160
|
+
let cachedTextDecoder = new TextDecoder('utf-8', {
|
|
161
|
+
ignoreBOM: true,
|
|
162
|
+
fatal: true,
|
|
163
|
+
});
|
|
164
|
+
cachedTextDecoder.decode();
|
|
165
|
+
function decodeText(ptr, len) {
|
|
166
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
167
|
+
}
|
|
168
|
+
function getStringFromWasm0(ptr, len) {
|
|
169
|
+
ptr = ptr >>> 0;
|
|
170
|
+
return decodeText(ptr, len);
|
|
171
|
+
}
|
|
172
|
+
exports.main = function () {
|
|
173
|
+
wasm.main();
|
|
174
|
+
};
|
|
175
|
+
function takeFromExternrefTable0(idx) {
|
|
176
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
177
|
+
wasm.__externref_table_dealloc(idx);
|
|
178
|
+
return value;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Generates a zero-knowledge proof for a privacy-preserving transaction
|
|
182
|
+
*
|
|
183
|
+
* # Arguments
|
|
184
|
+
* * `input_json` - JSON string containing all circuit inputs
|
|
185
|
+
* * `proving_key_hex` - Hex-encoded proving key (generated during setup)
|
|
186
|
+
*
|
|
187
|
+
* # Returns
|
|
188
|
+
* JSON string containing the proof and public inputs
|
|
189
|
+
*
|
|
190
|
+
* # Example
|
|
191
|
+
* ```javascript
|
|
192
|
+
* const input = {
|
|
193
|
+
* root: "12345...",
|
|
194
|
+
* publicAmount: "1000",
|
|
195
|
+
* // ... other inputs
|
|
196
|
+
* };
|
|
197
|
+
* const proof = prove(JSON.stringify(input), provingKeyHex);
|
|
198
|
+
* const { proofA, proofB, proofC, publicInputs } = JSON.parse(proof);
|
|
199
|
+
* ```
|
|
200
|
+
* @param {string} input_json
|
|
201
|
+
* @param {string} proving_key_hex
|
|
202
|
+
* @returns {string}
|
|
203
|
+
*/
|
|
204
|
+
exports.prove = function (input_json, proving_key_hex) {
|
|
205
|
+
let deferred4_0;
|
|
206
|
+
let deferred4_1;
|
|
207
|
+
try {
|
|
208
|
+
const ptr0 = passStringToWasm0(input_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
209
|
+
const len0 = WASM_VECTOR_LEN;
|
|
210
|
+
const ptr1 = passStringToWasm0(proving_key_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
211
|
+
const len1 = WASM_VECTOR_LEN;
|
|
212
|
+
const ret = wasm.prove(ptr0, len0, ptr1, len1);
|
|
213
|
+
var ptr3 = ret[0];
|
|
214
|
+
var len3 = ret[1];
|
|
215
|
+
if (ret[3]) {
|
|
216
|
+
ptr3 = 0;
|
|
217
|
+
len3 = 0;
|
|
218
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
219
|
+
}
|
|
220
|
+
deferred4_0 = ptr3;
|
|
221
|
+
deferred4_1 = len3;
|
|
222
|
+
return getStringFromWasm0(ptr3, len3);
|
|
223
|
+
}
|
|
224
|
+
finally {
|
|
225
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Verifies a proof (useful for testing before submitting to chain)
|
|
230
|
+
*
|
|
231
|
+
* # Arguments
|
|
232
|
+
* * `proof_json` - JSON string containing proof output from `prove()`
|
|
233
|
+
* * `verifying_key_hex` - Hex-encoded verifying key
|
|
234
|
+
*
|
|
235
|
+
* # Returns
|
|
236
|
+
* "true" if proof is valid, "false" otherwise
|
|
237
|
+
* @param {string} proof_json
|
|
238
|
+
* @param {string} verifying_key_hex
|
|
239
|
+
* @returns {boolean}
|
|
240
|
+
*/
|
|
241
|
+
exports.verify = function (proof_json, verifying_key_hex) {
|
|
242
|
+
const ptr0 = passStringToWasm0(proof_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
243
|
+
const len0 = WASM_VECTOR_LEN;
|
|
244
|
+
const ptr1 = passStringToWasm0(verifying_key_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
245
|
+
const len1 = WASM_VECTOR_LEN;
|
|
246
|
+
const ret = wasm.verify(ptr0, len0, ptr1, len1);
|
|
247
|
+
if (ret[2]) {
|
|
248
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
249
|
+
}
|
|
250
|
+
return ret[0] !== 0;
|
|
251
|
+
};
|
|
252
|
+
exports.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function (arg0, arg1) {
|
|
253
|
+
const ret = debugString(arg1);
|
|
254
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
255
|
+
const len1 = WASM_VECTOR_LEN;
|
|
256
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
257
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
258
|
+
};
|
|
259
|
+
exports.__wbg_error_7534b8e9a36f1ab4 = function (arg0, arg1) {
|
|
260
|
+
let deferred0_0;
|
|
261
|
+
let deferred0_1;
|
|
262
|
+
try {
|
|
263
|
+
deferred0_0 = arg0;
|
|
264
|
+
deferred0_1 = arg1;
|
|
265
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
266
|
+
}
|
|
267
|
+
finally {
|
|
268
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
exports.__wbg_new_8a6f238a6ece86ea = function () {
|
|
272
|
+
const ret = new Error();
|
|
273
|
+
return ret;
|
|
274
|
+
};
|
|
275
|
+
exports.__wbg_stack_0ed75d68575b0f3c = function (arg0, arg1) {
|
|
276
|
+
const ret = arg1.stack;
|
|
277
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
278
|
+
const len1 = WASM_VECTOR_LEN;
|
|
279
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
280
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
281
|
+
};
|
|
282
|
+
exports.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) {
|
|
283
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
284
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
285
|
+
return ret;
|
|
286
|
+
};
|
|
287
|
+
exports.__wbindgen_init_externref_table = function () {
|
|
288
|
+
const table = wasm.__wbindgen_externrefs;
|
|
289
|
+
const offset = table.grow(4);
|
|
290
|
+
table.set(0, undefined);
|
|
291
|
+
table.set(offset + 0, undefined);
|
|
292
|
+
table.set(offset + 1, null);
|
|
293
|
+
table.set(offset + 2, true);
|
|
294
|
+
table.set(offset + 3, false);
|
|
295
|
+
};
|
|
296
|
+
const wasmPath = `${__dirname}/vortex_bg.nodejs.wasm`;
|
|
297
|
+
const wasmBytes = require$$0.readFileSync(wasmPath);
|
|
298
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
299
|
+
const wasm = (exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports);
|
|
300
|
+
wasm.__wbindgen_start();
|
|
301
|
+
|
|
302
|
+
} (vortex$1, vortex$1.exports));
|
|
303
|
+
return vortex$1.exports;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
var vortexExports = requireVortex();
|
|
307
|
+
|
|
308
|
+
var vortex = /*#__PURE__*/_mergeNamespaces({
|
|
309
|
+
__proto__: null
|
|
310
|
+
}, [vortexExports]);
|
|
311
|
+
|
|
312
|
+
export { vortex as v };
|
|
313
|
+
//# sourceMappingURL=vortex-pJNVBvjP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vortex-pJNVBvjP.mjs","sources":["../src/pkg/nodejs/vortex.js"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EACA,IAAI,OAAO,GAAG,EAAE;AAChB,EAAA,OAAO,CAAC,0BAA0B,CAAC,GAAG,MAAM,CAAC,OAAO;EAEpD,SAAS,WAAW,CAAC,GAAG,EAAA;;AAEtB,MAAA,MAAM,IAAI,GAAG,OAAO,GAAG;AACvB,MAAA,IAAI,IAAI,IAAI,QAAQ,IAAI,IAAI,IAAI,SAAS,IAAI,GAAG,IAAI,IAAI,EAAE;UACxD,OAAO,CAAA,EAAG,GAAG,CAAA,CAAE;;AAEjB,MAAA,IAAI,IAAI,IAAI,QAAQ,EAAE;UACpB,OAAO,CAAA,CAAA,EAAI,GAA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C;MAChC,KAAK,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC;MAC3B,KAAK,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC;MAC3B,KAAK,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,CAAC;EAC9B,CAAC;AAED,EAAA,MAAM,QAAQ,GAAG,CAAA,EAAG,SAAS,wBAAwB;AACrD,EAAA,MAAM,SAAS,GAAG,UAAa,CAAC,YAAY,CAAC,QAAQ,CAAC;EACtD,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC;AACpD,EAAA,MAAM,IAAI,IAAI,OAAA,CAAA,MAAA,GAAiB,IAAI,WAAW,CAAC,QAAQ,CACrD,UAAU,EACV,OAAO,CACR,CAAC,OAAO,CAAC;EAEV,IAAI,CAAC,gBAAgB,EAAE;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interest-protocol/vortex-sdk",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.6.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/typescript-config": "1.0.0",
|
|
41
|
+
"@interest-protocol/prettier-config": "1.0.0"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public",
|
package/rollup.config.js
CHANGED
|
@@ -32,14 +32,18 @@ module.exports = {
|
|
|
32
32
|
input: 'src/index.ts',
|
|
33
33
|
output: [
|
|
34
34
|
{
|
|
35
|
-
|
|
35
|
+
dir: 'dist',
|
|
36
36
|
format: 'cjs',
|
|
37
37
|
sourcemap: true,
|
|
38
|
+
entryFileNames: 'index.js',
|
|
39
|
+
chunkFileNames: '[name]-[hash].js',
|
|
38
40
|
},
|
|
39
41
|
{
|
|
40
|
-
|
|
42
|
+
dir: 'dist',
|
|
41
43
|
format: 'esm',
|
|
42
44
|
sourcemap: true,
|
|
45
|
+
entryFileNames: 'index.mjs',
|
|
46
|
+
chunkFileNames: '[name]-[hash].mjs',
|
|
43
47
|
},
|
|
44
48
|
],
|
|
45
49
|
external: allExternalDeps,
|
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/utils/deposit.ts
CHANGED
|
@@ -123,11 +123,11 @@ export const prepareDepositProof = async ({
|
|
|
123
123
|
outputUtxo1,
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
-
const proofJson: string = prove(JSON.stringify(input));
|
|
126
|
+
const proofJson: string = await prove(JSON.stringify(input));
|
|
127
127
|
|
|
128
128
|
const proof: Proof = JSON.parse(proofJson);
|
|
129
129
|
|
|
130
|
-
invariant(verify(proofJson), 'Proof verification failed');
|
|
130
|
+
invariant(await verify(proofJson), 'Proof verification failed');
|
|
131
131
|
|
|
132
132
|
const { extData, tx: tx2 } = vortexSdk.newExtData({
|
|
133
133
|
tx,
|
package/src/utils/prove.ts
CHANGED
|
@@ -1,18 +1,40 @@
|
|
|
1
|
-
import { prove as proveNode, verify as verifyNode } from '../pkg/nodejs/vortex';
|
|
2
|
-
import { prove as proveWeb, verify as verifyWeb } from '../pkg/web/vortex';
|
|
3
1
|
import { getEnv } from './env';
|
|
4
2
|
import { VERIFYING_KEY, PROVING_KEY } from '../keys';
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
// Determine environment once at module load
|
|
5
|
+
const env = getEnv();
|
|
6
|
+
|
|
7
|
+
// Dynamic imports to avoid bundling Node.js-specific code (fs) in browser builds
|
|
8
|
+
const getProveFunction = async () => {
|
|
9
|
+
if (env === 'web') {
|
|
10
|
+
const { prove } = await import('../pkg/web/vortex');
|
|
11
|
+
return prove;
|
|
12
|
+
}
|
|
13
|
+
if (env === 'node') {
|
|
14
|
+
const { prove } = await import('../pkg/nodejs/vortex');
|
|
15
|
+
return prove;
|
|
16
|
+
}
|
|
10
17
|
throw new Error('Unsupported environment');
|
|
11
18
|
};
|
|
12
19
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
const getVerifyFunction = async () => {
|
|
21
|
+
if (env === 'web') {
|
|
22
|
+
const { verify } = await import('../pkg/web/vortex');
|
|
23
|
+
return verify;
|
|
24
|
+
}
|
|
25
|
+
if (env === 'node') {
|
|
26
|
+
const { verify } = await import('../pkg/nodejs/vortex');
|
|
27
|
+
return verify;
|
|
28
|
+
}
|
|
17
29
|
throw new Error('Unsupported environment');
|
|
18
30
|
};
|
|
31
|
+
|
|
32
|
+
export const prove = async (input: string): Promise<string> => {
|
|
33
|
+
const proveFn = await getProveFunction();
|
|
34
|
+
return proveFn(input, PROVING_KEY);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const verify = async (proof: string): Promise<boolean> => {
|
|
38
|
+
const verifyFn = await getVerifyFunction();
|
|
39
|
+
return verifyFn(proof, VERIFYING_KEY);
|
|
40
|
+
};
|
package/src/utils/withdraw.ts
CHANGED
|
@@ -131,11 +131,11 @@ export const prepareWithdraw = async ({
|
|
|
131
131
|
outputUtxo1,
|
|
132
132
|
});
|
|
133
133
|
|
|
134
|
-
const proofJson: string = prove(JSON.stringify(input));
|
|
134
|
+
const proofJson: string = await prove(JSON.stringify(input));
|
|
135
135
|
|
|
136
136
|
const proof: Proof = JSON.parse(proofJson);
|
|
137
137
|
|
|
138
|
-
invariant(verify(proofJson), 'Proof verification failed');
|
|
138
|
+
invariant(await verify(proofJson), 'Proof verification failed');
|
|
139
139
|
|
|
140
140
|
const { extData, tx: tx2 } = vortexSdk.newExtData({
|
|
141
141
|
tx,
|
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',
|