@triadxyz/triad-protocol 0.1.0 → 0.1.1-alpha.2
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/README.md +27 -0
- package/dist/index.d.ts +36 -3
- package/dist/index.js +30 -11
- package/dist/ticker.d.ts +34 -0
- package/dist/ticker.js +51 -0
- package/dist/types/triad_protocol.d.ts +555 -21
- package/dist/types/triad_protocol.js +555 -21
- package/dist/utils/constants.d.ts +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/helpers.d.ts +6 -1
- package/dist/utils/helpers.js +57 -4
- package/dist/vault.d.ts +75 -0
- package/dist/vault.js +161 -0
- package/package.json +4 -3
|
@@ -5,6 +5,32 @@ exports.IDL = {
|
|
|
5
5
|
version: '0.1.0',
|
|
6
6
|
name: 'triad_protocol',
|
|
7
7
|
instructions: [
|
|
8
|
+
{
|
|
9
|
+
name: 'createUserPosition',
|
|
10
|
+
accounts: [
|
|
11
|
+
{
|
|
12
|
+
name: 'signer',
|
|
13
|
+
isMut: true,
|
|
14
|
+
isSigner: true
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'ticker',
|
|
18
|
+
isMut: true,
|
|
19
|
+
isSigner: false
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'userPosition',
|
|
23
|
+
isMut: true,
|
|
24
|
+
isSigner: false
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'systemProgram',
|
|
28
|
+
isMut: false,
|
|
29
|
+
isSigner: false
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
args: []
|
|
33
|
+
},
|
|
8
34
|
{
|
|
9
35
|
name: 'createTicker',
|
|
10
36
|
accounts: [
|
|
@@ -18,28 +44,252 @@ exports.IDL = {
|
|
|
18
44
|
isMut: true,
|
|
19
45
|
isSigner: false
|
|
20
46
|
},
|
|
47
|
+
{
|
|
48
|
+
name: 'vault',
|
|
49
|
+
isMut: true,
|
|
50
|
+
isSigner: false
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'payerTokenMint',
|
|
54
|
+
isMut: false,
|
|
55
|
+
isSigner: false
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'tokenAccount',
|
|
59
|
+
isMut: true,
|
|
60
|
+
isSigner: false
|
|
61
|
+
},
|
|
21
62
|
{
|
|
22
63
|
name: 'systemProgram',
|
|
23
64
|
isMut: false,
|
|
24
65
|
isSigner: false
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'tokenProgram',
|
|
69
|
+
isMut: false,
|
|
70
|
+
isSigner: false
|
|
25
71
|
}
|
|
26
72
|
],
|
|
27
73
|
args: [
|
|
28
74
|
{
|
|
29
|
-
name: '
|
|
75
|
+
name: 'args',
|
|
30
76
|
type: {
|
|
31
77
|
defined: 'CreateTickerArgs'
|
|
32
78
|
}
|
|
33
79
|
}
|
|
34
80
|
]
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'updateTickerPrice',
|
|
84
|
+
accounts: [
|
|
85
|
+
{
|
|
86
|
+
name: 'signer',
|
|
87
|
+
isMut: true,
|
|
88
|
+
isSigner: true
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'ticker',
|
|
92
|
+
isMut: true,
|
|
93
|
+
isSigner: false
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'systemProgram',
|
|
97
|
+
isMut: false,
|
|
98
|
+
isSigner: false
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
args: [
|
|
102
|
+
{
|
|
103
|
+
name: 'args',
|
|
104
|
+
type: {
|
|
105
|
+
defined: 'UpdateTickerPriceArgs'
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'openPosition',
|
|
112
|
+
accounts: [
|
|
113
|
+
{
|
|
114
|
+
name: 'signer',
|
|
115
|
+
isMut: true,
|
|
116
|
+
isSigner: true
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'ticker',
|
|
120
|
+
isMut: true,
|
|
121
|
+
isSigner: false
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: 'vault',
|
|
125
|
+
isMut: true,
|
|
126
|
+
isSigner: false
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'userPosition',
|
|
130
|
+
isMut: true,
|
|
131
|
+
isSigner: false
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: 'vaultTokenAccount',
|
|
135
|
+
isMut: true,
|
|
136
|
+
isSigner: false
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: 'userTokenAccount',
|
|
140
|
+
isMut: true,
|
|
141
|
+
isSigner: false
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'systemProgram',
|
|
145
|
+
isMut: false,
|
|
146
|
+
isSigner: false
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: 'tokenProgram',
|
|
150
|
+
isMut: false,
|
|
151
|
+
isSigner: false
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
args: [
|
|
155
|
+
{
|
|
156
|
+
name: 'args',
|
|
157
|
+
type: {
|
|
158
|
+
defined: 'OpenPositionArgs'
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: 'closePosition',
|
|
165
|
+
accounts: [
|
|
166
|
+
{
|
|
167
|
+
name: 'signer',
|
|
168
|
+
isMut: true,
|
|
169
|
+
isSigner: true
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: 'ticker',
|
|
173
|
+
isMut: true,
|
|
174
|
+
isSigner: false
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: 'vault',
|
|
178
|
+
isMut: true,
|
|
179
|
+
isSigner: false
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: 'userPosition',
|
|
183
|
+
isMut: true,
|
|
184
|
+
isSigner: false
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: 'vaultTokenAccount',
|
|
188
|
+
isMut: true,
|
|
189
|
+
isSigner: false
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: 'userTokenAccount',
|
|
193
|
+
isMut: true,
|
|
194
|
+
isSigner: false
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: 'systemProgram',
|
|
198
|
+
isMut: false,
|
|
199
|
+
isSigner: false
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: 'tokenProgram',
|
|
203
|
+
isMut: false,
|
|
204
|
+
isSigner: false
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
args: [
|
|
208
|
+
{
|
|
209
|
+
name: 'args',
|
|
210
|
+
type: {
|
|
211
|
+
defined: 'ClosePositionArgs'
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
]
|
|
35
215
|
}
|
|
36
216
|
],
|
|
37
217
|
accounts: [
|
|
218
|
+
{
|
|
219
|
+
name: 'userPosition',
|
|
220
|
+
type: {
|
|
221
|
+
kind: 'struct',
|
|
222
|
+
fields: [
|
|
223
|
+
{
|
|
224
|
+
name: 'ts',
|
|
225
|
+
docs: ['timestamp'],
|
|
226
|
+
type: 'i64'
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
name: 'bump',
|
|
230
|
+
docs: ['bump seed'],
|
|
231
|
+
type: 'u8'
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: 'totalDeposited',
|
|
235
|
+
docs: ['total deposited'],
|
|
236
|
+
type: 'u64'
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
name: 'totalWithdrawn',
|
|
240
|
+
docs: ['total withdrawn'],
|
|
241
|
+
type: 'u64'
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: 'lpShare',
|
|
245
|
+
docs: ['total liquidity provided'],
|
|
246
|
+
type: 'u64'
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: 'totalPositions',
|
|
250
|
+
docs: ['total positions'],
|
|
251
|
+
type: 'u16'
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
name: 'ticker',
|
|
255
|
+
docs: ['ticker account'],
|
|
256
|
+
type: 'publicKey'
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
name: 'authority',
|
|
260
|
+
docs: ["user's authority"],
|
|
261
|
+
type: 'publicKey'
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
name: 'positions',
|
|
265
|
+
docs: ["user's position"],
|
|
266
|
+
type: {
|
|
267
|
+
array: [
|
|
268
|
+
{
|
|
269
|
+
defined: 'Position'
|
|
270
|
+
},
|
|
271
|
+
3
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
]
|
|
276
|
+
}
|
|
277
|
+
},
|
|
38
278
|
{
|
|
39
279
|
name: 'ticker',
|
|
40
280
|
type: {
|
|
41
281
|
kind: 'struct',
|
|
42
282
|
fields: [
|
|
283
|
+
{
|
|
284
|
+
name: 'initTs',
|
|
285
|
+
docs: ['timestamp of the creation of the ticker'],
|
|
286
|
+
type: 'i64'
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
name: 'updatedTs',
|
|
290
|
+
docs: ['timestamp of the last update of the ticker'],
|
|
291
|
+
type: 'i64'
|
|
292
|
+
},
|
|
43
293
|
{
|
|
44
294
|
name: 'bump',
|
|
45
295
|
docs: ['The bump for the ticker pda'],
|
|
@@ -53,25 +303,140 @@ exports.IDL = {
|
|
|
53
303
|
{
|
|
54
304
|
name: 'name',
|
|
55
305
|
docs: ['name of the ticekt'],
|
|
56
|
-
type:
|
|
57
|
-
|
|
58
|
-
|
|
306
|
+
type: 'string'
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
name: 'protocolProgramId',
|
|
310
|
+
docs: [
|
|
311
|
+
'protocol program id like dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH to get data info'
|
|
312
|
+
],
|
|
313
|
+
type: 'publicKey'
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
name: 'price',
|
|
317
|
+
docs: ['ticker price'],
|
|
318
|
+
type: 'u64'
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
name: 'vault',
|
|
322
|
+
docs: ['Vault PDA'],
|
|
323
|
+
type: 'publicKey'
|
|
324
|
+
}
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
name: 'vault',
|
|
330
|
+
type: {
|
|
331
|
+
kind: 'struct',
|
|
332
|
+
fields: [
|
|
333
|
+
{
|
|
334
|
+
name: 'bump',
|
|
335
|
+
docs: ['The bump for the vault pda'],
|
|
336
|
+
type: 'u8'
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
name: 'authority',
|
|
340
|
+
docs: ['authority for the vault'],
|
|
341
|
+
type: 'publicKey'
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
name: 'name',
|
|
345
|
+
docs: ['name of the vault'],
|
|
346
|
+
type: 'string'
|
|
59
347
|
},
|
|
60
348
|
{
|
|
61
349
|
name: 'tokenAccount',
|
|
62
|
-
docs: ['token account for the
|
|
350
|
+
docs: ['token account for the vault e.g. tDRIFT'],
|
|
351
|
+
type: 'publicKey'
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
name: 'tickerAddress',
|
|
355
|
+
docs: ['ticker address'],
|
|
63
356
|
type: 'publicKey'
|
|
64
357
|
},
|
|
358
|
+
{
|
|
359
|
+
name: 'totalDeposited',
|
|
360
|
+
docs: ['lifetime total deposited'],
|
|
361
|
+
type: 'u64'
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
name: 'totalWithdrawn',
|
|
365
|
+
docs: ['lifetime total withdrawn'],
|
|
366
|
+
type: 'u64'
|
|
367
|
+
},
|
|
65
368
|
{
|
|
66
369
|
name: 'initTs',
|
|
67
|
-
docs: ['timestamp
|
|
370
|
+
docs: ['timestamp vault initialized'],
|
|
68
371
|
type: 'i64'
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
name: 'netDeposits',
|
|
375
|
+
docs: ['lifetime net deposits'],
|
|
376
|
+
type: 'u128'
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
name: 'netWithdraws',
|
|
380
|
+
docs: ['lifetime net withdraws'],
|
|
381
|
+
type: 'u128'
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
name: 'longBalance',
|
|
385
|
+
docs: ['Long bet balance'],
|
|
386
|
+
type: 'u64'
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
name: 'shortBalance',
|
|
390
|
+
docs: ['Short bet balance'],
|
|
391
|
+
type: 'u64'
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
name: 'longPositionsOpened',
|
|
395
|
+
docs: ['Opened long positions'],
|
|
396
|
+
type: 'u64'
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
name: 'shortPositionsOpened',
|
|
400
|
+
docs: ['Opened short positions'],
|
|
401
|
+
type: 'u64'
|
|
69
402
|
}
|
|
70
403
|
]
|
|
71
404
|
}
|
|
72
405
|
}
|
|
73
406
|
],
|
|
74
407
|
types: [
|
|
408
|
+
{
|
|
409
|
+
name: 'Position',
|
|
410
|
+
type: {
|
|
411
|
+
kind: 'struct',
|
|
412
|
+
fields: [
|
|
413
|
+
{
|
|
414
|
+
name: 'amount',
|
|
415
|
+
type: 'u64'
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
name: 'entryPrice',
|
|
419
|
+
type: 'u64'
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
name: 'ts',
|
|
423
|
+
type: 'i64'
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
name: 'isLong',
|
|
427
|
+
type: 'bool'
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
name: 'isOpen',
|
|
431
|
+
type: 'bool'
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
name: 'pnl',
|
|
435
|
+
type: 'i64'
|
|
436
|
+
}
|
|
437
|
+
]
|
|
438
|
+
}
|
|
439
|
+
},
|
|
75
440
|
{
|
|
76
441
|
name: 'CreateTickerArgs',
|
|
77
442
|
type: {
|
|
@@ -79,52 +444,221 @@ exports.IDL = {
|
|
|
79
444
|
fields: [
|
|
80
445
|
{
|
|
81
446
|
name: 'name',
|
|
82
|
-
type:
|
|
83
|
-
|
|
84
|
-
|
|
447
|
+
type: 'string'
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
name: 'protocolProgramId',
|
|
451
|
+
type: 'publicKey'
|
|
85
452
|
}
|
|
86
453
|
]
|
|
87
454
|
}
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
name: 'UpdateTickerPriceArgs',
|
|
458
|
+
type: {
|
|
459
|
+
kind: 'struct',
|
|
460
|
+
fields: [
|
|
461
|
+
{
|
|
462
|
+
name: 'price',
|
|
463
|
+
type: 'u64'
|
|
464
|
+
}
|
|
465
|
+
]
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
name: 'OpenPositionArgs',
|
|
470
|
+
type: {
|
|
471
|
+
kind: 'struct',
|
|
472
|
+
fields: [
|
|
473
|
+
{
|
|
474
|
+
name: 'amount',
|
|
475
|
+
type: 'u64'
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
name: 'isLong',
|
|
479
|
+
type: 'bool'
|
|
480
|
+
}
|
|
481
|
+
]
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
name: 'ClosePositionArgs',
|
|
486
|
+
type: {
|
|
487
|
+
kind: 'struct',
|
|
488
|
+
fields: [
|
|
489
|
+
{
|
|
490
|
+
name: 'positionIndex',
|
|
491
|
+
type: 'u8'
|
|
492
|
+
}
|
|
493
|
+
]
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
],
|
|
497
|
+
events: [
|
|
498
|
+
{
|
|
499
|
+
name: 'OpenPositionRecord',
|
|
500
|
+
fields: [
|
|
501
|
+
{
|
|
502
|
+
name: 'amount',
|
|
503
|
+
type: 'u64',
|
|
504
|
+
index: false
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
name: 'ticker',
|
|
508
|
+
type: 'publicKey',
|
|
509
|
+
index: false
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
name: 'entryPrice',
|
|
513
|
+
type: 'u64',
|
|
514
|
+
index: false
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
name: 'ts',
|
|
518
|
+
type: 'i64',
|
|
519
|
+
index: false
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
name: 'isLong',
|
|
523
|
+
type: 'bool',
|
|
524
|
+
index: false
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
name: 'user',
|
|
528
|
+
type: 'publicKey',
|
|
529
|
+
index: false
|
|
530
|
+
}
|
|
531
|
+
]
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
name: 'ClosePositionRecord',
|
|
535
|
+
fields: [
|
|
536
|
+
{
|
|
537
|
+
name: 'amount',
|
|
538
|
+
type: 'u64',
|
|
539
|
+
index: false
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
name: 'ticker',
|
|
543
|
+
type: 'publicKey',
|
|
544
|
+
index: false
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
name: 'closePrice',
|
|
548
|
+
type: 'u64',
|
|
549
|
+
index: false
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
name: 'ts',
|
|
553
|
+
type: 'i64',
|
|
554
|
+
index: false
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
name: 'isLong',
|
|
558
|
+
type: 'bool',
|
|
559
|
+
index: false
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
name: 'pnl',
|
|
563
|
+
type: 'i64',
|
|
564
|
+
index: false
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
name: 'user',
|
|
568
|
+
type: 'publicKey',
|
|
569
|
+
index: false
|
|
570
|
+
}
|
|
571
|
+
]
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
name: 'TickerPriceUpdateRecord',
|
|
575
|
+
fields: [
|
|
576
|
+
{
|
|
577
|
+
name: 'price',
|
|
578
|
+
type: 'u64',
|
|
579
|
+
index: false
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
name: 'ts',
|
|
583
|
+
type: 'i64',
|
|
584
|
+
index: false
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
name: 'ticker',
|
|
588
|
+
type: 'publicKey',
|
|
589
|
+
index: false
|
|
590
|
+
}
|
|
591
|
+
]
|
|
88
592
|
}
|
|
89
593
|
],
|
|
90
594
|
errors: [
|
|
91
595
|
{
|
|
92
596
|
code: 6000,
|
|
93
|
-
name: '
|
|
94
|
-
msg: '
|
|
597
|
+
name: 'UnauthorizedToDeleteProject',
|
|
598
|
+
msg: 'Unauthorized to delete the project'
|
|
95
599
|
},
|
|
96
600
|
{
|
|
97
601
|
code: 6001,
|
|
98
|
-
name: '
|
|
99
|
-
msg: '
|
|
602
|
+
name: 'InvalidShadowAccount',
|
|
603
|
+
msg: 'Invalid shadow account'
|
|
100
604
|
},
|
|
101
605
|
{
|
|
102
606
|
code: 6002,
|
|
103
|
-
name: '
|
|
104
|
-
msg: 'Invalid
|
|
607
|
+
name: 'InvalidAccount',
|
|
608
|
+
msg: 'Invalid account'
|
|
105
609
|
},
|
|
106
610
|
{
|
|
107
611
|
code: 6003,
|
|
108
|
-
name: '
|
|
109
|
-
msg: '
|
|
612
|
+
name: 'Unauthorized',
|
|
613
|
+
msg: 'Unauthorized access'
|
|
110
614
|
},
|
|
111
615
|
{
|
|
112
616
|
code: 6004,
|
|
113
|
-
name: '
|
|
114
|
-
msg: '
|
|
617
|
+
name: 'AlphaVantageApiError',
|
|
618
|
+
msg: 'Failed to get data from Vybe Network'
|
|
115
619
|
},
|
|
116
620
|
{
|
|
117
621
|
code: 6005,
|
|
622
|
+
name: 'DepositFailed',
|
|
623
|
+
msg: 'Failed to deposit'
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
code: 6006,
|
|
627
|
+
name: 'InvalidOwnerAuthority',
|
|
628
|
+
msg: 'Invalid Owner authority'
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
code: 6007,
|
|
632
|
+
name: 'InvalidPosition',
|
|
633
|
+
msg: 'Invalid Position'
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
code: 6008,
|
|
637
|
+
name: 'InvalidTickerPosition',
|
|
638
|
+
msg: 'Invalid Ticker position'
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
code: 6009,
|
|
642
|
+
name: 'NoFreePositionSlot',
|
|
643
|
+
msg: 'No free position slot'
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
code: 6010,
|
|
647
|
+
name: 'InvalidMintAddress',
|
|
648
|
+
msg: 'Invalid Mint address'
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
code: 6011,
|
|
118
652
|
name: 'InvalidProfitShare',
|
|
119
653
|
msg: 'Invalid Profit Share'
|
|
120
654
|
},
|
|
121
655
|
{
|
|
122
|
-
code:
|
|
656
|
+
code: 6012,
|
|
123
657
|
name: 'InvalidDepositAmount',
|
|
124
658
|
msg: 'Invalid Deposit Amount'
|
|
125
659
|
},
|
|
126
660
|
{
|
|
127
|
-
code:
|
|
661
|
+
code: 6013,
|
|
128
662
|
name: 'InvalidWithdrawAmount',
|
|
129
663
|
msg: 'Invalid Withdraw Amount'
|
|
130
664
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const TRIAD_PROTOCOL_PROGRAM_ID = "
|
|
1
|
+
export declare const TRIAD_PROTOCOL_PROGRAM_ID = "TRDwq3BN4mP3m9KsuNUWSN6QDff93VKGSwE95Jbr9Ss";
|
package/dist/utils/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TRIAD_PROTOCOL_PROGRAM_ID = void 0;
|
|
4
|
-
exports.TRIAD_PROTOCOL_PROGRAM_ID = '
|
|
4
|
+
exports.TRIAD_PROTOCOL_PROGRAM_ID = 'TRDwq3BN4mP3m9KsuNUWSN6QDff93VKGSwE95Jbr9Ss';
|
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
|
2
|
-
|
|
2
|
+
import BN from 'bn.js';
|
|
3
|
+
export declare const getTickerAddressSync: (programId: PublicKey, tickerName: string) => PublicKey;
|
|
3
4
|
export declare const encodeString: (value: string) => number[];
|
|
4
5
|
export declare const decodeString: (bytes: number[]) => string;
|
|
6
|
+
export declare const getVaultAddressSync: (programId: PublicKey, tickerAddress: PublicKey) => PublicKey;
|
|
7
|
+
export declare const getTokenVaultAddressSync: (programId: PublicKey, vault: PublicKey) => PublicKey;
|
|
8
|
+
export declare function getUserPositionAddressSync(programId: PublicKey, authority: PublicKey, ticker: PublicKey): PublicKey;
|
|
9
|
+
export declare const formatNumber: (number: bigint | BN, decimals?: number) => number;
|