@triadxyz/triad-protocol 4.2.9 → 4.3.1

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, CollectRewardsArgs, Predictor as PredictorType } from './types/predictor';
6
6
  export default class Predictor {
7
7
  private program;
8
8
  private rpcOptions;
@@ -53,10 +53,21 @@ export default class Predictor {
53
53
  /**
54
54
  * Withdraw
55
55
  * @param args.authority - Authority of the withdraw
56
+ * @param args.recipient - Recipient of the withdraw
56
57
  * @param args.amount - Amount to deposit
57
58
  * @param args.customerId - Customer ID
58
59
  */
59
- withdraw({ authority, amount, customerId }: WithdrawArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
60
+ withdraw({ authority, recipient, amount, customerId }: WithdrawArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
61
+ /**
62
+ * Deposit Ext
63
+ * Idempotent deposit with an optional external deposit record.
64
+ * @param args.authority - Authority of the deposit
65
+ * @param args.amount - Amount to deposit
66
+ * @param args.refer - Referral public key (used only when creating the predictor)
67
+ * @param args.customerId - Customer ID
68
+ * @param args.depositId - Optional 12-byte deposit ID used as idempotency key
69
+ */
70
+ depositExt({ authority, amount, refer, customerId, depositId }: DepositExtArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
60
71
  /**
61
72
  * Collect Rewards
62
73
  * Claims accumulated TRIAD token rewards for the predictor.
package/dist/predictor.js CHANGED
@@ -162,10 +162,11 @@ class Predictor {
162
162
  /**
163
163
  * Withdraw
164
164
  * @param args.authority - Authority of the withdraw
165
+ * @param args.recipient - Recipient of the withdraw
165
166
  * @param args.amount - Amount to deposit
166
167
  * @param args.customerId - Customer ID
167
168
  */
168
- withdraw({ authority, amount, customerId }) {
169
+ withdraw({ authority, recipient, amount, customerId }) {
169
170
  return __awaiter(this, void 0, void 0, function* () {
170
171
  const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, authority, customerId);
171
172
  const ixs = [
@@ -174,6 +175,7 @@ class Predictor {
174
175
  .accounts({
175
176
  signer: authority,
176
177
  payer: this.rpcOptions.payer,
178
+ recipient,
177
179
  predictor: predictorPDA
178
180
  })
179
181
  .instruction()
@@ -181,6 +183,48 @@ class Predictor {
181
183
  return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
182
184
  });
183
185
  }
186
+ /**
187
+ * Deposit Ext
188
+ * Idempotent deposit with an optional external deposit record.
189
+ * @param args.authority - Authority of the deposit
190
+ * @param args.amount - Amount to deposit
191
+ * @param args.refer - Referral public key (used only when creating the predictor)
192
+ * @param args.customerId - Customer ID
193
+ * @param args.depositId - Optional 12-byte deposit ID used as idempotency key
194
+ */
195
+ depositExt({ authority, amount, refer, customerId, depositId }) {
196
+ return __awaiter(this, void 0, void 0, function* () {
197
+ const ixs = [];
198
+ const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, authority, customerId);
199
+ try {
200
+ yield this.program.account.predictor.fetch(predictorPDA);
201
+ }
202
+ catch (e) {
203
+ ixs.push(yield this.program.methods
204
+ .createPredictor({
205
+ customerId,
206
+ refer
207
+ })
208
+ .accounts({
209
+ signer: authority,
210
+ payer: this.rpcOptions.payer
211
+ })
212
+ .instruction());
213
+ }
214
+ ixs.push(yield this.program.methods
215
+ .depositExt({
216
+ amount: new bn_js_1.default(amount * Math.pow(10, constants_1.BASE_DECIMALS)),
217
+ depositId: Array.from(Buffer.from(depositId, 'hex'))
218
+ })
219
+ .accounts({
220
+ signer: authority,
221
+ predictor: predictorPDA,
222
+ predictorDeposit: (0, pda_1.getPredictorDepositPDA)(this.program.programId, depositId)
223
+ })
224
+ .instruction());
225
+ return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
226
+ });
227
+ }
184
228
  /**
185
229
  * Collect Rewards
186
230
  * 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],
@@ -1785,6 +1873,10 @@
1785
1873
  "writable": true,
1786
1874
  "signer": true
1787
1875
  },
1876
+ {
1877
+ "name": "recipient",
1878
+ "writable": true
1879
+ },
1788
1880
  {
1789
1881
  "name": "central",
1790
1882
  "writable": true,
@@ -1803,6 +1895,23 @@
1803
1895
  ]
1804
1896
  }
1805
1897
  },
1898
+ {
1899
+ "name": "customer",
1900
+ "writable": true,
1901
+ "pda": {
1902
+ "seeds": [
1903
+ {
1904
+ "kind": "const",
1905
+ "value": [99, 117, 115, 116, 111, 109, 101, 114]
1906
+ },
1907
+ {
1908
+ "kind": "account",
1909
+ "path": "predictor.customer_id",
1910
+ "account": "Predictor"
1911
+ }
1912
+ ]
1913
+ }
1914
+ },
1806
1915
  {
1807
1916
  "name": "predictor",
1808
1917
  "writable": true
@@ -1819,7 +1928,7 @@
1819
1928
  "seeds": [
1820
1929
  {
1821
1930
  "kind": "account",
1822
- "path": "signer"
1931
+ "path": "recipient"
1823
1932
  },
1824
1933
  {
1825
1934
  "kind": "account",
@@ -1970,6 +2079,10 @@
1970
2079
  "name": "Predictor",
1971
2080
  "discriminator": [220, 240, 153, 14, 72, 188, 37, 21]
1972
2081
  },
2082
+ {
2083
+ "name": "PredictorDeposit",
2084
+ "discriminator": [181, 63, 111, 19, 93, 19, 107, 21]
2085
+ },
1973
2086
  {
1974
2087
  "name": "PredictorOrder",
1975
2088
  "discriminator": [46, 230, 139, 116, 204, 124, 164, 127]
@@ -2802,10 +2915,14 @@
2802
2915
  "name": "fee_claimed",
2803
2916
  "type": "u64"
2804
2917
  },
2918
+ {
2919
+ "name": "net_cash",
2920
+ "type": "i64"
2921
+ },
2805
2922
  {
2806
2923
  "name": "padding",
2807
2924
  "type": {
2808
- "array": ["u8", 9]
2925
+ "array": ["u8", 1]
2809
2926
  }
2810
2927
  }
2811
2928
  ]
@@ -2828,6 +2945,14 @@
2828
2945
  "name": "customer_id",
2829
2946
  "type": "u16"
2830
2947
  },
2948
+ {
2949
+ "name": "deposit_id",
2950
+ "type": {
2951
+ "option": {
2952
+ "array": ["u8", 12]
2953
+ }
2954
+ }
2955
+ },
2831
2956
  {
2832
2957
  "name": "amount",
2833
2958
  "type": "u64"
@@ -2843,6 +2968,24 @@
2843
2968
  ]
2844
2969
  }
2845
2970
  },
2971
+ {
2972
+ "name": "DepositExtArgs",
2973
+ "type": {
2974
+ "kind": "struct",
2975
+ "fields": [
2976
+ {
2977
+ "name": "amount",
2978
+ "type": "u64"
2979
+ },
2980
+ {
2981
+ "name": "deposit_id",
2982
+ "type": {
2983
+ "array": ["u8", 12]
2984
+ }
2985
+ }
2986
+ ]
2987
+ }
2988
+ },
2846
2989
  {
2847
2990
  "name": "Key",
2848
2991
  "type": {
@@ -3598,6 +3741,13 @@
3598
3741
  ]
3599
3742
  }
3600
3743
  },
3744
+ {
3745
+ "name": "PredictorDeposit",
3746
+ "type": {
3747
+ "kind": "struct",
3748
+ "fields": []
3749
+ }
3750
+ },
3601
3751
  {
3602
3752
  "name": "PredictorOrder",
3603
3753
  "type": {
@@ -4030,6 +4180,10 @@
4030
4180
  "name": "predictor",
4031
4181
  "type": "pubkey"
4032
4182
  },
4183
+ {
4184
+ "name": "recipient",
4185
+ "type": "pubkey"
4186
+ },
4033
4187
  {
4034
4188
  "name": "customer_id",
4035
4189
  "type": "u16"
@@ -16,9 +16,24 @@ export type DepositArgs = {
16
16
  };
17
17
  export type WithdrawArgs = {
18
18
  authority: PublicKey;
19
+ recipient: PublicKey;
19
20
  amount: number;
20
21
  customerId: number;
21
22
  };
23
+ export type DepositExtArgs = {
24
+ authority: PublicKey;
25
+ amount: number;
26
+ refer: PublicKey;
27
+ customerId: number;
28
+ depositId: string;
29
+ };
30
+ export type WithdrawExtArgs = {
31
+ authority: PublicKey;
32
+ amount: number;
33
+ customerId: number;
34
+ key: string;
35
+ extAta: PublicKey;
36
+ };
22
37
  export type CollectRewardsArgs = {
23
38
  authority: PublicKey;
24
39
  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';
@@ -1228,6 +1104,23 @@ export type TriadProtocol = {
1228
1104
  ];
1229
1105
  };
1230
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
+ },
1231
1124
  {
1232
1125
  name: 'predictor';
1233
1126
  writable: true;
@@ -1371,6 +1264,212 @@ export type TriadProtocol = {
1371
1264
  }
1372
1265
  ];
1373
1266
  },
1267
+ {
1268
+ name: 'depositExt';
1269
+ discriminator: [80, 29, 27, 89, 96, 75, 249, 174];
1270
+ accounts: [
1271
+ {
1272
+ name: 'signer';
1273
+ writable: true;
1274
+ signer: true;
1275
+ },
1276
+ {
1277
+ name: 'central';
1278
+ writable: true;
1279
+ pda: {
1280
+ seeds: [
1281
+ {
1282
+ kind: 'const';
1283
+ value: [99, 101, 110, 116, 114, 97, 108];
1284
+ },
1285
+ {
1286
+ kind: 'const';
1287
+ value: [
1288
+ 116,
1289
+ 114,
1290
+ 105,
1291
+ 97,
1292
+ 100,
1293
+ 109,
1294
+ 97,
1295
+ 114,
1296
+ 107,
1297
+ 101,
1298
+ 116,
1299
+ 115
1300
+ ];
1301
+ }
1302
+ ];
1303
+ };
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
+ },
1322
+ {
1323
+ name: 'predictor';
1324
+ writable: true;
1325
+ },
1326
+ {
1327
+ name: 'predictorDeposit';
1328
+ writable: true;
1329
+ },
1330
+ {
1331
+ name: 'mint';
1332
+ writable: true;
1333
+ address: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v';
1334
+ },
1335
+ {
1336
+ name: 'userAta';
1337
+ writable: true;
1338
+ pda: {
1339
+ seeds: [
1340
+ {
1341
+ kind: 'account';
1342
+ path: 'signer';
1343
+ },
1344
+ {
1345
+ kind: 'account';
1346
+ path: 'tokenProgram';
1347
+ },
1348
+ {
1349
+ kind: 'account';
1350
+ path: 'mint';
1351
+ }
1352
+ ];
1353
+ program: {
1354
+ kind: 'const';
1355
+ value: [
1356
+ 140,
1357
+ 151,
1358
+ 37,
1359
+ 143,
1360
+ 78,
1361
+ 36,
1362
+ 137,
1363
+ 241,
1364
+ 187,
1365
+ 61,
1366
+ 16,
1367
+ 41,
1368
+ 20,
1369
+ 142,
1370
+ 13,
1371
+ 131,
1372
+ 11,
1373
+ 90,
1374
+ 19,
1375
+ 153,
1376
+ 218,
1377
+ 255,
1378
+ 16,
1379
+ 132,
1380
+ 4,
1381
+ 142,
1382
+ 123,
1383
+ 216,
1384
+ 219,
1385
+ 233,
1386
+ 248,
1387
+ 89
1388
+ ];
1389
+ };
1390
+ };
1391
+ },
1392
+ {
1393
+ name: 'centralAta';
1394
+ writable: true;
1395
+ pda: {
1396
+ seeds: [
1397
+ {
1398
+ kind: 'account';
1399
+ path: 'central';
1400
+ },
1401
+ {
1402
+ kind: 'account';
1403
+ path: 'tokenProgram';
1404
+ },
1405
+ {
1406
+ kind: 'account';
1407
+ path: 'mint';
1408
+ }
1409
+ ];
1410
+ program: {
1411
+ kind: 'const';
1412
+ value: [
1413
+ 140,
1414
+ 151,
1415
+ 37,
1416
+ 143,
1417
+ 78,
1418
+ 36,
1419
+ 137,
1420
+ 241,
1421
+ 187,
1422
+ 61,
1423
+ 16,
1424
+ 41,
1425
+ 20,
1426
+ 142,
1427
+ 13,
1428
+ 131,
1429
+ 11,
1430
+ 90,
1431
+ 19,
1432
+ 153,
1433
+ 218,
1434
+ 255,
1435
+ 16,
1436
+ 132,
1437
+ 4,
1438
+ 142,
1439
+ 123,
1440
+ 216,
1441
+ 219,
1442
+ 233,
1443
+ 248,
1444
+ 89
1445
+ ];
1446
+ };
1447
+ };
1448
+ },
1449
+ {
1450
+ name: 'tokenProgram';
1451
+ address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
1452
+ },
1453
+ {
1454
+ name: 'associatedTokenProgram';
1455
+ address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
1456
+ },
1457
+ {
1458
+ name: 'systemProgram';
1459
+ address: '11111111111111111111111111111111';
1460
+ }
1461
+ ];
1462
+ args: [
1463
+ {
1464
+ name: 'args';
1465
+ type: {
1466
+ defined: {
1467
+ name: 'depositExtArgs';
1468
+ };
1469
+ };
1470
+ }
1471
+ ];
1472
+ },
1374
1473
  {
1375
1474
  name: 'marketAskOrder';
1376
1475
  discriminator: [189, 66, 162, 254, 3, 85, 152, 54];
@@ -2271,6 +2370,10 @@ export type TriadProtocol = {
2271
2370
  writable: true;
2272
2371
  signer: true;
2273
2372
  },
2373
+ {
2374
+ name: 'recipient';
2375
+ writable: true;
2376
+ },
2274
2377
  {
2275
2378
  name: 'central';
2276
2379
  writable: true;
@@ -2300,6 +2403,23 @@ export type TriadProtocol = {
2300
2403
  ];
2301
2404
  };
2302
2405
  },
2406
+ {
2407
+ name: 'customer';
2408
+ writable: true;
2409
+ pda: {
2410
+ seeds: [
2411
+ {
2412
+ kind: 'const';
2413
+ value: [99, 117, 115, 116, 111, 109, 101, 114];
2414
+ },
2415
+ {
2416
+ kind: 'account';
2417
+ path: 'predictor.customer_id';
2418
+ account: 'predictor';
2419
+ }
2420
+ ];
2421
+ };
2422
+ },
2303
2423
  {
2304
2424
  name: 'predictor';
2305
2425
  writable: true;
@@ -2316,7 +2436,7 @@ export type TriadProtocol = {
2316
2436
  seeds: [
2317
2437
  {
2318
2438
  kind: 'account';
2319
- path: 'signer';
2439
+ path: 'recipient';
2320
2440
  },
2321
2441
  {
2322
2442
  kind: 'account';
@@ -2525,6 +2645,10 @@ export type TriadProtocol = {
2525
2645
  name: 'predictor';
2526
2646
  discriminator: [220, 240, 153, 14, 72, 188, 37, 21];
2527
2647
  },
2648
+ {
2649
+ name: 'predictorDeposit';
2650
+ discriminator: [181, 63, 111, 19, 93, 19, 107, 21];
2651
+ },
2528
2652
  {
2529
2653
  name: 'predictorOrder';
2530
2654
  discriminator: [46, 230, 139, 116, 204, 124, 164, 127];
@@ -3357,10 +3481,14 @@ export type TriadProtocol = {
3357
3481
  name: 'feeClaimed';
3358
3482
  type: 'u64';
3359
3483
  },
3484
+ {
3485
+ name: 'netCash';
3486
+ type: 'i64';
3487
+ },
3360
3488
  {
3361
3489
  name: 'padding';
3362
3490
  type: {
3363
- array: ['u8', 9];
3491
+ array: ['u8', 1];
3364
3492
  };
3365
3493
  }
3366
3494
  ];
@@ -3383,6 +3511,14 @@ export type TriadProtocol = {
3383
3511
  name: 'customerId';
3384
3512
  type: 'u16';
3385
3513
  },
3514
+ {
3515
+ name: 'depositId';
3516
+ type: {
3517
+ option: {
3518
+ array: ['u8', 12];
3519
+ };
3520
+ };
3521
+ },
3386
3522
  {
3387
3523
  name: 'amount';
3388
3524
  type: 'u64';
@@ -3398,6 +3534,24 @@ export type TriadProtocol = {
3398
3534
  ];
3399
3535
  };
3400
3536
  },
3537
+ {
3538
+ name: 'depositExtArgs';
3539
+ type: {
3540
+ kind: 'struct';
3541
+ fields: [
3542
+ {
3543
+ name: 'amount';
3544
+ type: 'u64';
3545
+ },
3546
+ {
3547
+ name: 'depositId';
3548
+ type: {
3549
+ array: ['u8', 12];
3550
+ };
3551
+ }
3552
+ ];
3553
+ };
3554
+ },
3401
3555
  {
3402
3556
  name: 'key';
3403
3557
  type: {
@@ -4153,6 +4307,13 @@ export type TriadProtocol = {
4153
4307
  ];
4154
4308
  };
4155
4309
  },
4310
+ {
4311
+ name: 'predictorDeposit';
4312
+ type: {
4313
+ kind: 'struct';
4314
+ fields: [];
4315
+ };
4316
+ },
4156
4317
  {
4157
4318
  name: 'predictorOrder';
4158
4319
  type: {
@@ -4585,6 +4746,10 @@ export type TriadProtocol = {
4585
4746
  name: 'predictor';
4586
4747
  type: 'pubkey';
4587
4748
  },
4749
+ {
4750
+ name: 'recipient';
4751
+ type: 'pubkey';
4752
+ },
4588
4753
  {
4589
4754
  name: 'customerId';
4590
4755
  type: 'u16';
@@ -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.1",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",