@triadxyz/triad-protocol 4.2.9 → 4.3.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/market.js CHANGED
@@ -367,9 +367,7 @@ class Market {
367
367
  ixs.push(yield this.program.methods
368
368
  .closeIdleMarket(new bn_js_1.default(market.id))
369
369
  .accounts({
370
- signer: this.program.provider.publicKey,
371
- mint: market.mint,
372
- tokenProgram: (0, helpers_1.getTokenProgram)(market.mint)
370
+ signer: this.program.provider.publicKey
373
371
  })
374
372
  .instruction());
375
373
  }
@@ -2,7 +2,7 @@ import { PublicKey } from '@solana/web3.js';
2
2
  import { Program } from '@coral-xyz/anchor';
3
3
  import { TriadProtocol } from './types/triad_protocol';
4
4
  import { RpcOptions } from './types';
5
- import { DepositArgs, WithdrawArgs, CollectRewardsArgs, Predictor as PredictorType } from './types/predictor';
5
+ import { DepositArgs, DepositExtArgs, WithdrawArgs, WithdrawExtArgs, CollectRewardsArgs, Predictor as PredictorType } from './types/predictor';
6
6
  export default class Predictor {
7
7
  private program;
8
8
  private rpcOptions;
@@ -57,6 +57,26 @@ export default class Predictor {
57
57
  * @param args.customerId - Customer ID
58
58
  */
59
59
  withdraw({ authority, amount, customerId }: WithdrawArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
60
+ /**
61
+ * Deposit Ext
62
+ * Idempotent deposit with an optional external deposit record.
63
+ * @param args.authority - Authority of the deposit
64
+ * @param args.amount - Amount to deposit
65
+ * @param args.refer - Referral public key (used only when creating the predictor)
66
+ * @param args.customerId - Customer ID
67
+ * @param args.depositId - Optional 12-byte deposit ID used as idempotency key
68
+ */
69
+ depositExt({ authority, amount, refer, customerId, depositId }: DepositExtArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
70
+ /**
71
+ * Withdraw Ext
72
+ * Withdraws to an external ATA owned by the caller-provided account.
73
+ * @param args.authority - Authority of the withdraw
74
+ * @param args.amount - Amount to withdraw
75
+ * @param args.customerId - Customer ID
76
+ * @param args.key - External withdraw key (idempotency / off-chain reference)
77
+ * @param args.extAta - External ATA destination
78
+ */
79
+ withdrawExt({ authority, amount, customerId, key, extAta }: WithdrawExtArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
60
80
  /**
61
81
  * Collect Rewards
62
82
  * Claims accumulated TRIAD token rewards for the predictor.
package/dist/predictor.js CHANGED
@@ -181,6 +181,76 @@ class Predictor {
181
181
  return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
182
182
  });
183
183
  }
184
+ /**
185
+ * Deposit Ext
186
+ * Idempotent deposit with an optional external deposit record.
187
+ * @param args.authority - Authority of the deposit
188
+ * @param args.amount - Amount to deposit
189
+ * @param args.refer - Referral public key (used only when creating the predictor)
190
+ * @param args.customerId - Customer ID
191
+ * @param args.depositId - Optional 12-byte deposit ID used as idempotency key
192
+ */
193
+ depositExt({ authority, amount, refer, customerId, depositId }) {
194
+ return __awaiter(this, void 0, void 0, function* () {
195
+ const ixs = [];
196
+ const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, authority, customerId);
197
+ try {
198
+ yield this.program.account.predictor.fetch(predictorPDA);
199
+ }
200
+ catch (e) {
201
+ ixs.push(yield this.program.methods
202
+ .createPredictor({
203
+ customerId,
204
+ refer
205
+ })
206
+ .accounts({
207
+ signer: authority,
208
+ payer: this.rpcOptions.payer
209
+ })
210
+ .instruction());
211
+ }
212
+ ixs.push(yield this.program.methods
213
+ .depositExt({
214
+ amount: new bn_js_1.default(amount * Math.pow(10, constants_1.BASE_DECIMALS)),
215
+ depositId: Array.from(Buffer.from(depositId, 'hex'))
216
+ })
217
+ .accounts({
218
+ signer: authority,
219
+ predictor: predictorPDA,
220
+ predictorDeposit: (0, pda_1.getPredictorDepositPDA)(this.program.programId, depositId)
221
+ })
222
+ .instruction());
223
+ return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
224
+ });
225
+ }
226
+ /**
227
+ * Withdraw Ext
228
+ * Withdraws to an external ATA owned by the caller-provided account.
229
+ * @param args.authority - Authority of the withdraw
230
+ * @param args.amount - Amount to withdraw
231
+ * @param args.customerId - Customer ID
232
+ * @param args.key - External withdraw key (idempotency / off-chain reference)
233
+ * @param args.extAta - External ATA destination
234
+ */
235
+ withdrawExt({ authority, amount, customerId, key, extAta }) {
236
+ return __awaiter(this, void 0, void 0, function* () {
237
+ const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, authority, customerId);
238
+ const ixs = [
239
+ yield this.program.methods
240
+ .withdrawExt({
241
+ amount: new bn_js_1.default(amount * Math.pow(10, constants_1.BASE_DECIMALS)),
242
+ key
243
+ })
244
+ .accounts({
245
+ signer: authority,
246
+ predictor: predictorPDA,
247
+ extAta
248
+ })
249
+ .instruction()
250
+ ];
251
+ return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
252
+ });
253
+ }
184
254
  /**
185
255
  * Collect Rewards
186
256
  * Claims accumulated TRIAD token rewards for the predictor.
@@ -331,65 +331,6 @@
331
331
  ]
332
332
  }
333
333
  },
334
- {
335
- "name": "mint"
336
- },
337
- {
338
- "name": "market_to_ata",
339
- "writable": true,
340
- "pda": {
341
- "seeds": [
342
- {
343
- "kind": "account",
344
- "path": "market"
345
- },
346
- {
347
- "kind": "account",
348
- "path": "token_program"
349
- },
350
- {
351
- "kind": "account",
352
- "path": "mint"
353
- }
354
- ],
355
- "program": {
356
- "kind": "const",
357
- "value": [
358
- 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
359
- 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
360
- 219, 233, 248, 89
361
- ]
362
- }
363
- }
364
- },
365
- {
366
- "name": "squads_ata",
367
- "writable": true,
368
- "pda": {
369
- "seeds": [
370
- {
371
- "kind": "account",
372
- "path": "squads"
373
- },
374
- {
375
- "kind": "account",
376
- "path": "token_program"
377
- },
378
- {
379
- "kind": "account",
380
- "path": "mint"
381
- }
382
- ],
383
- "program": {
384
- "kind": "const",
385
- "value": [
386
- 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
387
- 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
388
- 219, 233, 248, 89
389
- ]
390
- }
391
- }
392
- },
393
334
  {
394
335
  "name": "order_book",
395
336
  "pda": {
@@ -405,13 +346,6 @@
405
346
  ]
406
347
  }
407
348
  },
408
- {
409
- "name": "token_program"
410
- },
411
- {
412
- "name": "associated_token_program",
413
- "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
414
- },
415
349
  {
416
350
  "name": "system_program",
417
351
  "address": "11111111111111111111111111111111"
@@ -956,6 +890,23 @@
956
890
  ]
957
891
  }
958
892
  },
893
+ {
894
+ "name": "customer",
895
+ "writable": true,
896
+ "pda": {
897
+ "seeds": [
898
+ {
899
+ "kind": "const",
900
+ "value": [99, 117, 115, 116, 111, 109, 101, 114]
901
+ },
902
+ {
903
+ "kind": "account",
904
+ "path": "predictor.customer_id",
905
+ "account": "Predictor"
906
+ }
907
+ ]
908
+ }
909
+ },
959
910
  {
960
911
  "name": "predictor",
961
912
  "writable": true
@@ -1041,6 +992,143 @@
1041
992
  }
1042
993
  ]
1043
994
  },
995
+ {
996
+ "name": "deposit_ext",
997
+ "discriminator": [80, 29, 27, 89, 96, 75, 249, 174],
998
+ "accounts": [
999
+ {
1000
+ "name": "signer",
1001
+ "writable": true,
1002
+ "signer": true
1003
+ },
1004
+ {
1005
+ "name": "central",
1006
+ "writable": true,
1007
+ "pda": {
1008
+ "seeds": [
1009
+ {
1010
+ "kind": "const",
1011
+ "value": [99, 101, 110, 116, 114, 97, 108]
1012
+ },
1013
+ {
1014
+ "kind": "const",
1015
+ "value": [
1016
+ 116, 114, 105, 97, 100, 109, 97, 114, 107, 101, 116, 115
1017
+ ]
1018
+ }
1019
+ ]
1020
+ }
1021
+ },
1022
+ {
1023
+ "name": "customer",
1024
+ "writable": true,
1025
+ "pda": {
1026
+ "seeds": [
1027
+ {
1028
+ "kind": "const",
1029
+ "value": [99, 117, 115, 116, 111, 109, 101, 114]
1030
+ },
1031
+ {
1032
+ "kind": "account",
1033
+ "path": "predictor.customer_id",
1034
+ "account": "Predictor"
1035
+ }
1036
+ ]
1037
+ }
1038
+ },
1039
+ {
1040
+ "name": "predictor",
1041
+ "writable": true
1042
+ },
1043
+ {
1044
+ "name": "predictor_deposit",
1045
+ "writable": true
1046
+ },
1047
+ {
1048
+ "name": "mint",
1049
+ "writable": true,
1050
+ "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
1051
+ },
1052
+ {
1053
+ "name": "user_ata",
1054
+ "writable": true,
1055
+ "pda": {
1056
+ "seeds": [
1057
+ {
1058
+ "kind": "account",
1059
+ "path": "signer"
1060
+ },
1061
+ {
1062
+ "kind": "account",
1063
+ "path": "token_program"
1064
+ },
1065
+ {
1066
+ "kind": "account",
1067
+ "path": "mint"
1068
+ }
1069
+ ],
1070
+ "program": {
1071
+ "kind": "const",
1072
+ "value": [
1073
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
1074
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
1075
+ 219, 233, 248, 89
1076
+ ]
1077
+ }
1078
+ }
1079
+ },
1080
+ {
1081
+ "name": "central_ata",
1082
+ "writable": true,
1083
+ "pda": {
1084
+ "seeds": [
1085
+ {
1086
+ "kind": "account",
1087
+ "path": "central"
1088
+ },
1089
+ {
1090
+ "kind": "account",
1091
+ "path": "token_program"
1092
+ },
1093
+ {
1094
+ "kind": "account",
1095
+ "path": "mint"
1096
+ }
1097
+ ],
1098
+ "program": {
1099
+ "kind": "const",
1100
+ "value": [
1101
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
1102
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
1103
+ 219, 233, 248, 89
1104
+ ]
1105
+ }
1106
+ }
1107
+ },
1108
+ {
1109
+ "name": "token_program",
1110
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
1111
+ },
1112
+ {
1113
+ "name": "associated_token_program",
1114
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
1115
+ },
1116
+ {
1117
+ "name": "system_program",
1118
+ "address": "11111111111111111111111111111111"
1119
+ }
1120
+ ],
1121
+ "args": [
1122
+ {
1123
+ "name": "args",
1124
+ "type": {
1125
+ "defined": {
1126
+ "name": "DepositExtArgs"
1127
+ }
1128
+ }
1129
+ }
1130
+ ]
1131
+ },
1044
1132
  {
1045
1133
  "name": "market_ask_order",
1046
1134
  "discriminator": [189, 66, 162, 254, 3, 85, 152, 54],
@@ -1803,6 +1891,23 @@
1803
1891
  ]
1804
1892
  }
1805
1893
  },
1894
+ {
1895
+ "name": "customer",
1896
+ "writable": true,
1897
+ "pda": {
1898
+ "seeds": [
1899
+ {
1900
+ "kind": "const",
1901
+ "value": [99, 117, 115, 116, 111, 109, 101, 114]
1902
+ },
1903
+ {
1904
+ "kind": "account",
1905
+ "path": "predictor.customer_id",
1906
+ "account": "Predictor"
1907
+ }
1908
+ ]
1909
+ }
1910
+ },
1806
1911
  {
1807
1912
  "name": "predictor",
1808
1913
  "writable": true
@@ -1888,6 +1993,115 @@
1888
1993
  }
1889
1994
  ]
1890
1995
  },
1996
+ {
1997
+ "name": "withdraw_ext",
1998
+ "discriminator": [244, 65, 141, 53, 29, 13, 232, 64],
1999
+ "accounts": [
2000
+ {
2001
+ "name": "signer",
2002
+ "writable": true,
2003
+ "signer": true
2004
+ },
2005
+ {
2006
+ "name": "central",
2007
+ "writable": true,
2008
+ "pda": {
2009
+ "seeds": [
2010
+ {
2011
+ "kind": "const",
2012
+ "value": [99, 101, 110, 116, 114, 97, 108]
2013
+ },
2014
+ {
2015
+ "kind": "const",
2016
+ "value": [
2017
+ 116, 114, 105, 97, 100, 109, 97, 114, 107, 101, 116, 115
2018
+ ]
2019
+ }
2020
+ ]
2021
+ }
2022
+ },
2023
+ {
2024
+ "name": "customer",
2025
+ "writable": true,
2026
+ "pda": {
2027
+ "seeds": [
2028
+ {
2029
+ "kind": "const",
2030
+ "value": [99, 117, 115, 116, 111, 109, 101, 114]
2031
+ },
2032
+ {
2033
+ "kind": "account",
2034
+ "path": "predictor.customer_id",
2035
+ "account": "Predictor"
2036
+ }
2037
+ ]
2038
+ }
2039
+ },
2040
+ {
2041
+ "name": "predictor",
2042
+ "writable": true
2043
+ },
2044
+ {
2045
+ "name": "mint",
2046
+ "writable": true,
2047
+ "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
2048
+ },
2049
+ {
2050
+ "name": "ext_ata",
2051
+ "writable": true
2052
+ },
2053
+ {
2054
+ "name": "central_ata",
2055
+ "writable": true,
2056
+ "pda": {
2057
+ "seeds": [
2058
+ {
2059
+ "kind": "account",
2060
+ "path": "central"
2061
+ },
2062
+ {
2063
+ "kind": "account",
2064
+ "path": "token_program"
2065
+ },
2066
+ {
2067
+ "kind": "account",
2068
+ "path": "mint"
2069
+ }
2070
+ ],
2071
+ "program": {
2072
+ "kind": "const",
2073
+ "value": [
2074
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
2075
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
2076
+ 219, 233, 248, 89
2077
+ ]
2078
+ }
2079
+ }
2080
+ },
2081
+ {
2082
+ "name": "token_program",
2083
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
2084
+ },
2085
+ {
2086
+ "name": "associated_token_program",
2087
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
2088
+ },
2089
+ {
2090
+ "name": "system_program",
2091
+ "address": "11111111111111111111111111111111"
2092
+ }
2093
+ ],
2094
+ "args": [
2095
+ {
2096
+ "name": "args",
2097
+ "type": {
2098
+ "defined": {
2099
+ "name": "WithdrawExtArgs"
2100
+ }
2101
+ }
2102
+ }
2103
+ ]
2104
+ },
1891
2105
  {
1892
2106
  "name": "withdraw_poseidon",
1893
2107
  "discriminator": [63, 55, 48, 174, 44, 202, 11, 227],
@@ -1970,6 +2184,10 @@
1970
2184
  "name": "Predictor",
1971
2185
  "discriminator": [220, 240, 153, 14, 72, 188, 37, 21]
1972
2186
  },
2187
+ {
2188
+ "name": "PredictorDeposit",
2189
+ "discriminator": [181, 63, 111, 19, 93, 19, 107, 21]
2190
+ },
1973
2191
  {
1974
2192
  "name": "PredictorOrder",
1975
2193
  "discriminator": [46, 230, 139, 116, 204, 124, 164, 127]
@@ -2802,10 +3020,14 @@
2802
3020
  "name": "fee_claimed",
2803
3021
  "type": "u64"
2804
3022
  },
3023
+ {
3024
+ "name": "net_cash",
3025
+ "type": "i64"
3026
+ },
2805
3027
  {
2806
3028
  "name": "padding",
2807
3029
  "type": {
2808
- "array": ["u8", 9]
3030
+ "array": ["u8", 1]
2809
3031
  }
2810
3032
  }
2811
3033
  ]
@@ -2828,6 +3050,14 @@
2828
3050
  "name": "customer_id",
2829
3051
  "type": "u16"
2830
3052
  },
3053
+ {
3054
+ "name": "deposit_id",
3055
+ "type": {
3056
+ "option": {
3057
+ "array": ["u8", 12]
3058
+ }
3059
+ }
3060
+ },
2831
3061
  {
2832
3062
  "name": "amount",
2833
3063
  "type": "u64"
@@ -2843,6 +3073,24 @@
2843
3073
  ]
2844
3074
  }
2845
3075
  },
3076
+ {
3077
+ "name": "DepositExtArgs",
3078
+ "type": {
3079
+ "kind": "struct",
3080
+ "fields": [
3081
+ {
3082
+ "name": "amount",
3083
+ "type": "u64"
3084
+ },
3085
+ {
3086
+ "name": "deposit_id",
3087
+ "type": {
3088
+ "array": ["u8", 12]
3089
+ }
3090
+ }
3091
+ ]
3092
+ }
3093
+ },
2846
3094
  {
2847
3095
  "name": "Key",
2848
3096
  "type": {
@@ -3598,6 +3846,13 @@
3598
3846
  ]
3599
3847
  }
3600
3848
  },
3849
+ {
3850
+ "name": "PredictorDeposit",
3851
+ "type": {
3852
+ "kind": "struct",
3853
+ "fields": []
3854
+ }
3855
+ },
3601
3856
  {
3602
3857
  "name": "PredictorOrder",
3603
3858
  "type": {
@@ -4034,6 +4289,12 @@
4034
4289
  "name": "customer_id",
4035
4290
  "type": "u16"
4036
4291
  },
4292
+ {
4293
+ "name": "key",
4294
+ "type": {
4295
+ "option": "string"
4296
+ }
4297
+ },
4037
4298
  {
4038
4299
  "name": "amount",
4039
4300
  "type": "u64"
@@ -4048,6 +4309,22 @@
4048
4309
  }
4049
4310
  ]
4050
4311
  }
4312
+ },
4313
+ {
4314
+ "name": "WithdrawExtArgs",
4315
+ "type": {
4316
+ "kind": "struct",
4317
+ "fields": [
4318
+ {
4319
+ "name": "amount",
4320
+ "type": "u64"
4321
+ },
4322
+ {
4323
+ "name": "key",
4324
+ "type": "string"
4325
+ }
4326
+ ]
4327
+ }
4051
4328
  }
4052
4329
  ]
4053
4330
  }
@@ -19,6 +19,20 @@ export type WithdrawArgs = {
19
19
  amount: number;
20
20
  customerId: number;
21
21
  };
22
+ export type DepositExtArgs = {
23
+ authority: PublicKey;
24
+ amount: number;
25
+ refer: PublicKey;
26
+ customerId: number;
27
+ depositId: string;
28
+ };
29
+ export type WithdrawExtArgs = {
30
+ authority: PublicKey;
31
+ amount: number;
32
+ customerId: number;
33
+ key: string;
34
+ extAta: PublicKey;
35
+ };
22
36
  export type CollectRewardsArgs = {
23
37
  authority: PublicKey;
24
38
  customerId: number;
@@ -436,123 +436,6 @@ export type TriadProtocol = {
436
436
  ];
437
437
  };
438
438
  },
439
- {
440
- name: 'mint';
441
- },
442
- {
443
- name: 'marketToAta';
444
- writable: true;
445
- pda: {
446
- seeds: [
447
- {
448
- kind: 'account';
449
- path: 'market';
450
- },
451
- {
452
- kind: 'account';
453
- path: 'tokenProgram';
454
- },
455
- {
456
- kind: 'account';
457
- path: 'mint';
458
- }
459
- ];
460
- program: {
461
- kind: 'const';
462
- value: [
463
- 140,
464
- 151,
465
- 37,
466
- 143,
467
- 78,
468
- 36,
469
- 137,
470
- 241,
471
- 187,
472
- 61,
473
- 16,
474
- 41,
475
- 20,
476
- 142,
477
- 13,
478
- 131,
479
- 11,
480
- 90,
481
- 19,
482
- 153,
483
- 218,
484
- 255,
485
- 16,
486
- 132,
487
- 4,
488
- 142,
489
- 123,
490
- 216,
491
- 219,
492
- 233,
493
- 248,
494
- 89
495
- ];
496
- };
497
- };
498
- },
499
- {
500
- name: 'squadsAta';
501
- writable: true;
502
- pda: {
503
- seeds: [
504
- {
505
- kind: 'account';
506
- path: 'squads';
507
- },
508
- {
509
- kind: 'account';
510
- path: 'tokenProgram';
511
- },
512
- {
513
- kind: 'account';
514
- path: 'mint';
515
- }
516
- ];
517
- program: {
518
- kind: 'const';
519
- value: [
520
- 140,
521
- 151,
522
- 37,
523
- 143,
524
- 78,
525
- 36,
526
- 137,
527
- 241,
528
- 187,
529
- 61,
530
- 16,
531
- 41,
532
- 20,
533
- 142,
534
- 13,
535
- 131,
536
- 11,
537
- 90,
538
- 19,
539
- 153,
540
- 218,
541
- 255,
542
- 16,
543
- 132,
544
- 4,
545
- 142,
546
- 123,
547
- 216,
548
- 219,
549
- 233,
550
- 248,
551
- 89
552
- ];
553
- };
554
- };
555
- },
556
439
  {
557
440
  name: 'orderBook';
558
441
  pda: {
@@ -568,13 +451,6 @@ export type TriadProtocol = {
568
451
  ];
569
452
  };
570
453
  },
571
- {
572
- name: 'tokenProgram';
573
- },
574
- {
575
- name: 'associatedTokenProgram';
576
- address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
577
- },
578
454
  {
579
455
  name: 'systemProgram';
580
456
  address: '11111111111111111111111111111111';
@@ -1181,18 +1057,216 @@ export type TriadProtocol = {
1181
1057
  ];
1182
1058
  args: [
1183
1059
  {
1184
- name: 'args';
1185
- type: {
1186
- defined: {
1187
- name: 'createPredictorArgs';
1188
- };
1189
- };
1060
+ name: 'args';
1061
+ type: {
1062
+ defined: {
1063
+ name: 'createPredictorArgs';
1064
+ };
1065
+ };
1066
+ }
1067
+ ];
1068
+ },
1069
+ {
1070
+ name: 'deposit';
1071
+ discriminator: [242, 35, 198, 137, 82, 225, 242, 182];
1072
+ accounts: [
1073
+ {
1074
+ name: 'signer';
1075
+ writable: true;
1076
+ signer: true;
1077
+ },
1078
+ {
1079
+ name: 'central';
1080
+ writable: true;
1081
+ pda: {
1082
+ seeds: [
1083
+ {
1084
+ kind: 'const';
1085
+ value: [99, 101, 110, 116, 114, 97, 108];
1086
+ },
1087
+ {
1088
+ kind: 'const';
1089
+ value: [
1090
+ 116,
1091
+ 114,
1092
+ 105,
1093
+ 97,
1094
+ 100,
1095
+ 109,
1096
+ 97,
1097
+ 114,
1098
+ 107,
1099
+ 101,
1100
+ 116,
1101
+ 115
1102
+ ];
1103
+ }
1104
+ ];
1105
+ };
1106
+ },
1107
+ {
1108
+ name: 'customer';
1109
+ writable: true;
1110
+ pda: {
1111
+ seeds: [
1112
+ {
1113
+ kind: 'const';
1114
+ value: [99, 117, 115, 116, 111, 109, 101, 114];
1115
+ },
1116
+ {
1117
+ kind: 'account';
1118
+ path: 'predictor.customer_id';
1119
+ account: 'predictor';
1120
+ }
1121
+ ];
1122
+ };
1123
+ },
1124
+ {
1125
+ name: 'predictor';
1126
+ writable: true;
1127
+ },
1128
+ {
1129
+ name: 'mint';
1130
+ writable: true;
1131
+ address: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v';
1132
+ },
1133
+ {
1134
+ name: 'userAta';
1135
+ writable: true;
1136
+ pda: {
1137
+ seeds: [
1138
+ {
1139
+ kind: 'account';
1140
+ path: 'signer';
1141
+ },
1142
+ {
1143
+ kind: 'account';
1144
+ path: 'tokenProgram';
1145
+ },
1146
+ {
1147
+ kind: 'account';
1148
+ path: 'mint';
1149
+ }
1150
+ ];
1151
+ program: {
1152
+ kind: 'const';
1153
+ value: [
1154
+ 140,
1155
+ 151,
1156
+ 37,
1157
+ 143,
1158
+ 78,
1159
+ 36,
1160
+ 137,
1161
+ 241,
1162
+ 187,
1163
+ 61,
1164
+ 16,
1165
+ 41,
1166
+ 20,
1167
+ 142,
1168
+ 13,
1169
+ 131,
1170
+ 11,
1171
+ 90,
1172
+ 19,
1173
+ 153,
1174
+ 218,
1175
+ 255,
1176
+ 16,
1177
+ 132,
1178
+ 4,
1179
+ 142,
1180
+ 123,
1181
+ 216,
1182
+ 219,
1183
+ 233,
1184
+ 248,
1185
+ 89
1186
+ ];
1187
+ };
1188
+ };
1189
+ },
1190
+ {
1191
+ name: 'centralAta';
1192
+ writable: true;
1193
+ pda: {
1194
+ seeds: [
1195
+ {
1196
+ kind: 'account';
1197
+ path: 'central';
1198
+ },
1199
+ {
1200
+ kind: 'account';
1201
+ path: 'tokenProgram';
1202
+ },
1203
+ {
1204
+ kind: 'account';
1205
+ path: 'mint';
1206
+ }
1207
+ ];
1208
+ program: {
1209
+ kind: 'const';
1210
+ value: [
1211
+ 140,
1212
+ 151,
1213
+ 37,
1214
+ 143,
1215
+ 78,
1216
+ 36,
1217
+ 137,
1218
+ 241,
1219
+ 187,
1220
+ 61,
1221
+ 16,
1222
+ 41,
1223
+ 20,
1224
+ 142,
1225
+ 13,
1226
+ 131,
1227
+ 11,
1228
+ 90,
1229
+ 19,
1230
+ 153,
1231
+ 218,
1232
+ 255,
1233
+ 16,
1234
+ 132,
1235
+ 4,
1236
+ 142,
1237
+ 123,
1238
+ 216,
1239
+ 219,
1240
+ 233,
1241
+ 248,
1242
+ 89
1243
+ ];
1244
+ };
1245
+ };
1246
+ },
1247
+ {
1248
+ name: 'tokenProgram';
1249
+ address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
1250
+ },
1251
+ {
1252
+ name: 'associatedTokenProgram';
1253
+ address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
1254
+ },
1255
+ {
1256
+ name: 'systemProgram';
1257
+ address: '11111111111111111111111111111111';
1258
+ }
1259
+ ];
1260
+ args: [
1261
+ {
1262
+ name: 'amount';
1263
+ type: 'u64';
1190
1264
  }
1191
1265
  ];
1192
1266
  },
1193
1267
  {
1194
- name: 'deposit';
1195
- discriminator: [242, 35, 198, 137, 82, 225, 242, 182];
1268
+ name: 'depositExt';
1269
+ discriminator: [80, 29, 27, 89, 96, 75, 249, 174];
1196
1270
  accounts: [
1197
1271
  {
1198
1272
  name: 'signer';
@@ -1228,10 +1302,31 @@ export type TriadProtocol = {
1228
1302
  ];
1229
1303
  };
1230
1304
  },
1305
+ {
1306
+ name: 'customer';
1307
+ writable: true;
1308
+ pda: {
1309
+ seeds: [
1310
+ {
1311
+ kind: 'const';
1312
+ value: [99, 117, 115, 116, 111, 109, 101, 114];
1313
+ },
1314
+ {
1315
+ kind: 'account';
1316
+ path: 'predictor.customer_id';
1317
+ account: 'predictor';
1318
+ }
1319
+ ];
1320
+ };
1321
+ },
1231
1322
  {
1232
1323
  name: 'predictor';
1233
1324
  writable: true;
1234
1325
  },
1326
+ {
1327
+ name: 'predictorDeposit';
1328
+ writable: true;
1329
+ },
1235
1330
  {
1236
1331
  name: 'mint';
1237
1332
  writable: true;
@@ -1366,8 +1461,12 @@ export type TriadProtocol = {
1366
1461
  ];
1367
1462
  args: [
1368
1463
  {
1369
- name: 'amount';
1370
- type: 'u64';
1464
+ name: 'args';
1465
+ type: {
1466
+ defined: {
1467
+ name: 'depositExtArgs';
1468
+ };
1469
+ };
1371
1470
  }
1372
1471
  ];
1373
1472
  },
@@ -2300,6 +2399,23 @@ export type TriadProtocol = {
2300
2399
  ];
2301
2400
  };
2302
2401
  },
2402
+ {
2403
+ name: 'customer';
2404
+ writable: true;
2405
+ pda: {
2406
+ seeds: [
2407
+ {
2408
+ kind: 'const';
2409
+ value: [99, 117, 115, 116, 111, 109, 101, 114];
2410
+ },
2411
+ {
2412
+ kind: 'account';
2413
+ path: 'predictor.customer_id';
2414
+ account: 'predictor';
2415
+ }
2416
+ ];
2417
+ };
2418
+ },
2303
2419
  {
2304
2420
  name: 'predictor';
2305
2421
  writable: true;
@@ -2443,6 +2559,155 @@ export type TriadProtocol = {
2443
2559
  }
2444
2560
  ];
2445
2561
  },
2562
+ {
2563
+ name: 'withdrawExt';
2564
+ discriminator: [244, 65, 141, 53, 29, 13, 232, 64];
2565
+ accounts: [
2566
+ {
2567
+ name: 'signer';
2568
+ writable: true;
2569
+ signer: true;
2570
+ },
2571
+ {
2572
+ name: 'central';
2573
+ writable: true;
2574
+ pda: {
2575
+ seeds: [
2576
+ {
2577
+ kind: 'const';
2578
+ value: [99, 101, 110, 116, 114, 97, 108];
2579
+ },
2580
+ {
2581
+ kind: 'const';
2582
+ value: [
2583
+ 116,
2584
+ 114,
2585
+ 105,
2586
+ 97,
2587
+ 100,
2588
+ 109,
2589
+ 97,
2590
+ 114,
2591
+ 107,
2592
+ 101,
2593
+ 116,
2594
+ 115
2595
+ ];
2596
+ }
2597
+ ];
2598
+ };
2599
+ },
2600
+ {
2601
+ name: 'customer';
2602
+ writable: true;
2603
+ pda: {
2604
+ seeds: [
2605
+ {
2606
+ kind: 'const';
2607
+ value: [99, 117, 115, 116, 111, 109, 101, 114];
2608
+ },
2609
+ {
2610
+ kind: 'account';
2611
+ path: 'predictor.customer_id';
2612
+ account: 'predictor';
2613
+ }
2614
+ ];
2615
+ };
2616
+ },
2617
+ {
2618
+ name: 'predictor';
2619
+ writable: true;
2620
+ },
2621
+ {
2622
+ name: 'mint';
2623
+ writable: true;
2624
+ address: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v';
2625
+ },
2626
+ {
2627
+ name: 'extAta';
2628
+ writable: true;
2629
+ },
2630
+ {
2631
+ name: 'centralAta';
2632
+ writable: true;
2633
+ pda: {
2634
+ seeds: [
2635
+ {
2636
+ kind: 'account';
2637
+ path: 'central';
2638
+ },
2639
+ {
2640
+ kind: 'account';
2641
+ path: 'tokenProgram';
2642
+ },
2643
+ {
2644
+ kind: 'account';
2645
+ path: 'mint';
2646
+ }
2647
+ ];
2648
+ program: {
2649
+ kind: 'const';
2650
+ value: [
2651
+ 140,
2652
+ 151,
2653
+ 37,
2654
+ 143,
2655
+ 78,
2656
+ 36,
2657
+ 137,
2658
+ 241,
2659
+ 187,
2660
+ 61,
2661
+ 16,
2662
+ 41,
2663
+ 20,
2664
+ 142,
2665
+ 13,
2666
+ 131,
2667
+ 11,
2668
+ 90,
2669
+ 19,
2670
+ 153,
2671
+ 218,
2672
+ 255,
2673
+ 16,
2674
+ 132,
2675
+ 4,
2676
+ 142,
2677
+ 123,
2678
+ 216,
2679
+ 219,
2680
+ 233,
2681
+ 248,
2682
+ 89
2683
+ ];
2684
+ };
2685
+ };
2686
+ },
2687
+ {
2688
+ name: 'tokenProgram';
2689
+ address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
2690
+ },
2691
+ {
2692
+ name: 'associatedTokenProgram';
2693
+ address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
2694
+ },
2695
+ {
2696
+ name: 'systemProgram';
2697
+ address: '11111111111111111111111111111111';
2698
+ }
2699
+ ];
2700
+ args: [
2701
+ {
2702
+ name: 'args';
2703
+ type: {
2704
+ defined: {
2705
+ name: 'withdrawExtArgs';
2706
+ };
2707
+ };
2708
+ }
2709
+ ];
2710
+ },
2446
2711
  {
2447
2712
  name: 'withdrawPoseidon';
2448
2713
  discriminator: [63, 55, 48, 174, 44, 202, 11, 227];
@@ -2525,6 +2790,10 @@ export type TriadProtocol = {
2525
2790
  name: 'predictor';
2526
2791
  discriminator: [220, 240, 153, 14, 72, 188, 37, 21];
2527
2792
  },
2793
+ {
2794
+ name: 'predictorDeposit';
2795
+ discriminator: [181, 63, 111, 19, 93, 19, 107, 21];
2796
+ },
2528
2797
  {
2529
2798
  name: 'predictorOrder';
2530
2799
  discriminator: [46, 230, 139, 116, 204, 124, 164, 127];
@@ -3357,10 +3626,14 @@ export type TriadProtocol = {
3357
3626
  name: 'feeClaimed';
3358
3627
  type: 'u64';
3359
3628
  },
3629
+ {
3630
+ name: 'netCash';
3631
+ type: 'i64';
3632
+ },
3360
3633
  {
3361
3634
  name: 'padding';
3362
3635
  type: {
3363
- array: ['u8', 9];
3636
+ array: ['u8', 1];
3364
3637
  };
3365
3638
  }
3366
3639
  ];
@@ -3383,6 +3656,14 @@ export type TriadProtocol = {
3383
3656
  name: 'customerId';
3384
3657
  type: 'u16';
3385
3658
  },
3659
+ {
3660
+ name: 'depositId';
3661
+ type: {
3662
+ option: {
3663
+ array: ['u8', 12];
3664
+ };
3665
+ };
3666
+ },
3386
3667
  {
3387
3668
  name: 'amount';
3388
3669
  type: 'u64';
@@ -3398,6 +3679,24 @@ export type TriadProtocol = {
3398
3679
  ];
3399
3680
  };
3400
3681
  },
3682
+ {
3683
+ name: 'depositExtArgs';
3684
+ type: {
3685
+ kind: 'struct';
3686
+ fields: [
3687
+ {
3688
+ name: 'amount';
3689
+ type: 'u64';
3690
+ },
3691
+ {
3692
+ name: 'depositId';
3693
+ type: {
3694
+ array: ['u8', 12];
3695
+ };
3696
+ }
3697
+ ];
3698
+ };
3699
+ },
3401
3700
  {
3402
3701
  name: 'key';
3403
3702
  type: {
@@ -4153,6 +4452,13 @@ export type TriadProtocol = {
4153
4452
  ];
4154
4453
  };
4155
4454
  },
4455
+ {
4456
+ name: 'predictorDeposit';
4457
+ type: {
4458
+ kind: 'struct';
4459
+ fields: [];
4460
+ };
4461
+ },
4156
4462
  {
4157
4463
  name: 'predictorOrder';
4158
4464
  type: {
@@ -4589,6 +4895,12 @@ export type TriadProtocol = {
4589
4895
  name: 'customerId';
4590
4896
  type: 'u16';
4591
4897
  },
4898
+ {
4899
+ name: 'key';
4900
+ type: {
4901
+ option: 'string';
4902
+ };
4903
+ },
4592
4904
  {
4593
4905
  name: 'amount';
4594
4906
  type: 'u64';
@@ -4603,6 +4915,22 @@ export type TriadProtocol = {
4603
4915
  }
4604
4916
  ];
4605
4917
  };
4918
+ },
4919
+ {
4920
+ name: 'withdrawExtArgs';
4921
+ type: {
4922
+ kind: 'struct';
4923
+ fields: [
4924
+ {
4925
+ name: 'amount';
4926
+ type: 'u64';
4927
+ },
4928
+ {
4929
+ name: 'key';
4930
+ type: 'string';
4931
+ }
4932
+ ];
4933
+ };
4606
4934
  }
4607
4935
  ];
4608
4936
  };
@@ -14,3 +14,4 @@ export declare const getClaimedUserPDA: (programId: PublicKey, claimVault: Publi
14
14
  export declare const getPredictorOrderPDA: (programId: PublicKey, predictor: PublicKey, marketId: number, orderDirection: OrderDirection) => PublicKey;
15
15
  export declare const getPredictorPDA: (programId: PublicKey, authority: PublicKey, customerId: number) => PublicKey;
16
16
  export declare const getCentralPDA: (programId: PublicKey) => PublicKey;
17
+ export declare const getPredictorDepositPDA: (programId: PublicKey, depositId: string) => PublicKey;
package/dist/utils/pda.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getCentralPDA = exports.getPredictorPDA = exports.getPredictorOrderPDA = exports.getClaimedUserPDA = exports.getClaimVaultPDA = exports.getPoseidonPDA = exports.getNftPDA = exports.getCollectionPDA = exports.getStakePDA = exports.getPoolPDA = exports.getCustomerPDA = exports.getOrderBookPDA = exports.getMarketPDA = exports.getTokenATA = void 0;
6
+ exports.getPredictorDepositPDA = exports.getCentralPDA = exports.getPredictorPDA = exports.getPredictorOrderPDA = exports.getClaimedUserPDA = exports.getClaimVaultPDA = exports.getPoseidonPDA = exports.getNftPDA = exports.getCollectionPDA = exports.getStakePDA = exports.getPoolPDA = exports.getCustomerPDA = exports.getOrderBookPDA = exports.getMarketPDA = exports.getTokenATA = void 0;
7
7
  const web3_js_1 = require("@solana/web3.js");
8
8
  const bn_js_1 = __importDefault(require("bn.js"));
9
9
  const spl_token_1 = require("@solana/spl-token");
@@ -76,3 +76,7 @@ const getCentralPDA = (programId) => {
76
76
  return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('central'), Buffer.from('triadmarkets')], programId)[0];
77
77
  };
78
78
  exports.getCentralPDA = getCentralPDA;
79
+ const getPredictorDepositPDA = (programId, depositId) => {
80
+ return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('predictor_deposit'), Buffer.from(depositId, 'hex')], programId)[0];
81
+ };
82
+ exports.getPredictorDepositPDA = getPredictorDepositPDA;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "4.2.9",
3
+ "version": "4.3.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",