@triadxyz/triad-protocol 3.3.9-beta → 3.4.1-beta

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.d.ts CHANGED
@@ -398,9 +398,8 @@ export default class TriadProtocol {
398
398
  * @param args.orders.bidOrderId - The ID of the Bid Order
399
399
  * @param args.orders.userNonce - The nonce of the user
400
400
  * @param args.orderDirection - The direction of the Order
401
- * @param args.isTrdPayout - Whether to payout in TRD or not
402
401
  */
403
- marketAskOrder({ marketId, orders, orderDirection, isTrdPayout }: MarketAskOrderArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
402
+ marketAskOrder({ marketId, orders, orderDirection }: MarketAskOrderArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
404
403
  /**
405
404
  * Get Orders By Market ID
406
405
  * @param marketId - Market ID
package/dist/index.js CHANGED
@@ -1025,9 +1025,8 @@ class TriadProtocol {
1025
1025
  * @param args.orders.bidOrderId - The ID of the Bid Order
1026
1026
  * @param args.orders.userNonce - The nonce of the user
1027
1027
  * @param args.orderDirection - The direction of the Order
1028
- * @param args.isTrdPayout - Whether to payout in TRD or not
1029
1028
  */
1030
- marketAskOrder({ marketId, orders, orderDirection, isTrdPayout }) {
1029
+ marketAskOrder({ marketId, orders, orderDirection }) {
1031
1030
  return __awaiter(this, void 0, void 0, function* () {
1032
1031
  const marketPDA = (0, pda_1.getMarketPDA)(this.program.programId, marketId);
1033
1032
  const ixs = [];
@@ -1076,21 +1075,6 @@ class TriadProtocol {
1076
1075
  .instruction());
1077
1076
  }
1078
1077
  }
1079
- if (isTrdPayout) {
1080
- const { setupInstructions, swapIxs, addressLookupTableAccounts: swapAddressLookupTableAccounts } = yield (0, swap_1.swap)({
1081
- connection: this.program.provider.connection,
1082
- wallet: this.program.provider.publicKey.toBase58(),
1083
- inToken: constants_1.USDC_MINT.toBase58(),
1084
- outToken: constants_1.TRD_MINT.toString(),
1085
- amount: amountOfUSDC.toNumber() / Math.pow(10, 6),
1086
- payer: this.rpcOptions.payer.toBase58()
1087
- });
1088
- if (swapIxs.length > 0) {
1089
- ixs.push(...setupInstructions);
1090
- ixs.push(...swapIxs);
1091
- addressLookupTableAccounts.push(...swapAddressLookupTableAccounts);
1092
- }
1093
- }
1094
1078
  if (ixs.length === 0) {
1095
1079
  throw new Error('No matching orders found to fill the requested amount');
1096
1080
  }
package/dist/stake.d.ts CHANGED
@@ -64,4 +64,8 @@ export default class Stake {
64
64
  * Claim Stake Rewards
65
65
  */
66
66
  claimStakeRewards(): Promise<string | import("@solana/web3.js").VersionedTransaction>;
67
+ /**
68
+ * Migrate Stake
69
+ */
70
+ migrateStake(users: PublicKey[]): Promise<string | import("@solana/web3.js").VersionedTransaction>;
67
71
  }
package/dist/stake.js CHANGED
@@ -81,6 +81,7 @@ class Stake {
81
81
  amount: new anchor_1.BN(amount * Math.pow(10, 6))
82
82
  })
83
83
  .accounts({
84
+ signer: this.program.provider.publicKey,
84
85
  mint: constants_1.TRD_MINT
85
86
  })
86
87
  .instruction()
@@ -98,6 +99,7 @@ class Stake {
98
99
  yield this.program.methods
99
100
  .addStakeVaultRewards(new anchor_1.BN(amount * Math.pow(10, 6)))
100
101
  .accounts({
102
+ signer: this.program.provider.publicKey,
101
103
  mint: constants_1.TRD_MINT
102
104
  })
103
105
  .instruction()
@@ -114,6 +116,9 @@ class Stake {
114
116
  const ixs = [
115
117
  yield this.program.methods
116
118
  .updateStakeVaultIsLocked(isLocked)
119
+ .accounts({
120
+ signer: this.program.provider.publicKey
121
+ })
117
122
  .instruction()
118
123
  ];
119
124
  return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
@@ -176,5 +181,24 @@ class Stake {
176
181
  return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
177
182
  });
178
183
  }
184
+ /**
185
+ * Migrate Stake
186
+ */
187
+ migrateStake(users) {
188
+ return __awaiter(this, void 0, void 0, function* () {
189
+ const ixs = [];
190
+ for (const user of users) {
191
+ ixs.push(yield this.program.methods
192
+ .migrateStake()
193
+ .accounts({
194
+ signer: this.program.provider.publicKey,
195
+ user: user,
196
+ mint: constants_1.TRD_MINT
197
+ })
198
+ .instruction());
199
+ }
200
+ return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
201
+ });
202
+ }
179
203
  }
180
204
  exports.default = Stake;
@@ -1601,6 +1601,128 @@
1601
1601
  }
1602
1602
  ]
1603
1603
  },
1604
+ {
1605
+ "name": "migrate_stake",
1606
+ "discriminator": [178, 5, 26, 85, 56, 20, 153, 160],
1607
+ "accounts": [
1608
+ {
1609
+ "name": "signer",
1610
+ "writable": true,
1611
+ "signer": true
1612
+ },
1613
+ {
1614
+ "name": "user",
1615
+ "writable": true
1616
+ },
1617
+ {
1618
+ "name": "stake_vault",
1619
+ "writable": true,
1620
+ "pda": {
1621
+ "seeds": [
1622
+ {
1623
+ "kind": "const",
1624
+ "value": [115, 116, 97, 107, 101, 95, 118, 97, 117, 108, 116]
1625
+ },
1626
+ {
1627
+ "kind": "const",
1628
+ "value": [
1629
+ 84, 114, 105, 97, 100, 32, 83, 104, 97, 114, 101, 32, 49
1630
+ ]
1631
+ }
1632
+ ]
1633
+ }
1634
+ },
1635
+ {
1636
+ "name": "stake",
1637
+ "writable": true,
1638
+ "pda": {
1639
+ "seeds": [
1640
+ {
1641
+ "kind": "const",
1642
+ "value": [115, 116, 97, 107, 101, 95, 118, 51]
1643
+ },
1644
+ {
1645
+ "kind": "account",
1646
+ "path": "user"
1647
+ }
1648
+ ]
1649
+ }
1650
+ },
1651
+ {
1652
+ "name": "mint",
1653
+ "writable": true
1654
+ },
1655
+ {
1656
+ "name": "stake_vault_ata",
1657
+ "writable": true,
1658
+ "pda": {
1659
+ "seeds": [
1660
+ {
1661
+ "kind": "account",
1662
+ "path": "stake_vault"
1663
+ },
1664
+ {
1665
+ "kind": "account",
1666
+ "path": "token_program"
1667
+ },
1668
+ {
1669
+ "kind": "account",
1670
+ "path": "mint"
1671
+ }
1672
+ ],
1673
+ "program": {
1674
+ "kind": "const",
1675
+ "value": [
1676
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
1677
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
1678
+ 219, 233, 248, 89
1679
+ ]
1680
+ }
1681
+ }
1682
+ },
1683
+ {
1684
+ "name": "stake_ata",
1685
+ "writable": true,
1686
+ "pda": {
1687
+ "seeds": [
1688
+ {
1689
+ "kind": "account",
1690
+ "path": "stake"
1691
+ },
1692
+ {
1693
+ "kind": "account",
1694
+ "path": "token_program"
1695
+ },
1696
+ {
1697
+ "kind": "account",
1698
+ "path": "mint"
1699
+ }
1700
+ ],
1701
+ "program": {
1702
+ "kind": "const",
1703
+ "value": [
1704
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
1705
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
1706
+ 219, 233, 248, 89
1707
+ ]
1708
+ }
1709
+ }
1710
+ },
1711
+ {
1712
+ "name": "token_program",
1713
+ "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
1714
+ },
1715
+ {
1716
+ "name": "associated_token_program",
1717
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
1718
+ },
1719
+ {
1720
+ "name": "system_program",
1721
+ "address": "11111111111111111111111111111111"
1722
+ }
1723
+ ],
1724
+ "args": []
1725
+ },
1604
1726
  {
1605
1727
  "name": "open_order",
1606
1728
  "discriminator": [206, 88, 88, 143, 38, 136, 50, 224],
@@ -2156,13 +2278,13 @@
2156
2278
  }
2157
2279
  },
2158
2280
  {
2159
- "name": "stake_vault_ata",
2281
+ "name": "stake_ata",
2160
2282
  "writable": true,
2161
2283
  "pda": {
2162
2284
  "seeds": [
2163
2285
  {
2164
2286
  "kind": "account",
2165
- "path": "stake_vault"
2287
+ "path": "stake"
2166
2288
  },
2167
2289
  {
2168
2290
  "kind": "account",
@@ -2265,19 +2387,17 @@
2265
2387
  "signer": true
2266
2388
  },
2267
2389
  {
2268
- "name": "stake_vault",
2390
+ "name": "stake",
2269
2391
  "writable": true,
2270
2392
  "pda": {
2271
2393
  "seeds": [
2272
2394
  {
2273
2395
  "kind": "const",
2274
- "value": [115, 116, 97, 107, 101, 95, 118, 97, 117, 108, 116]
2396
+ "value": [115, 116, 97, 107, 101, 95, 118, 51]
2275
2397
  },
2276
2398
  {
2277
- "kind": "const",
2278
- "value": [
2279
- 84, 114, 105, 97, 100, 32, 83, 104, 97, 114, 101, 32, 49
2280
- ]
2399
+ "kind": "account",
2400
+ "path": "signer"
2281
2401
  }
2282
2402
  ]
2283
2403
  }
@@ -2291,13 +2411,13 @@
2291
2411
  "writable": true
2292
2412
  },
2293
2413
  {
2294
- "name": "stake_vault_ata",
2414
+ "name": "stake_ata",
2295
2415
  "writable": true,
2296
2416
  "pda": {
2297
2417
  "seeds": [
2298
2418
  {
2299
2419
  "kind": "account",
2300
- "path": "stake_vault"
2420
+ "path": "stake"
2301
2421
  },
2302
2422
  {
2303
2423
  "kind": "account",
@@ -2250,6 +2250,198 @@ export type TriadProtocol = {
2250
2250
  }
2251
2251
  ];
2252
2252
  },
2253
+ {
2254
+ name: 'migrateStake';
2255
+ discriminator: [178, 5, 26, 85, 56, 20, 153, 160];
2256
+ accounts: [
2257
+ {
2258
+ name: 'signer';
2259
+ writable: true;
2260
+ signer: true;
2261
+ },
2262
+ {
2263
+ name: 'user';
2264
+ writable: true;
2265
+ },
2266
+ {
2267
+ name: 'stakeVault';
2268
+ writable: true;
2269
+ pda: {
2270
+ seeds: [
2271
+ {
2272
+ kind: 'const';
2273
+ value: [115, 116, 97, 107, 101, 95, 118, 97, 117, 108, 116];
2274
+ },
2275
+ {
2276
+ kind: 'const';
2277
+ value: [
2278
+ 84,
2279
+ 114,
2280
+ 105,
2281
+ 97,
2282
+ 100,
2283
+ 32,
2284
+ 83,
2285
+ 104,
2286
+ 97,
2287
+ 114,
2288
+ 101,
2289
+ 32,
2290
+ 49
2291
+ ];
2292
+ }
2293
+ ];
2294
+ };
2295
+ },
2296
+ {
2297
+ name: 'stake';
2298
+ writable: true;
2299
+ pda: {
2300
+ seeds: [
2301
+ {
2302
+ kind: 'const';
2303
+ value: [115, 116, 97, 107, 101, 95, 118, 51];
2304
+ },
2305
+ {
2306
+ kind: 'account';
2307
+ path: 'user';
2308
+ }
2309
+ ];
2310
+ };
2311
+ },
2312
+ {
2313
+ name: 'mint';
2314
+ writable: true;
2315
+ },
2316
+ {
2317
+ name: 'stakeVaultAta';
2318
+ writable: true;
2319
+ pda: {
2320
+ seeds: [
2321
+ {
2322
+ kind: 'account';
2323
+ path: 'stakeVault';
2324
+ },
2325
+ {
2326
+ kind: 'account';
2327
+ path: 'tokenProgram';
2328
+ },
2329
+ {
2330
+ kind: 'account';
2331
+ path: 'mint';
2332
+ }
2333
+ ];
2334
+ program: {
2335
+ kind: 'const';
2336
+ value: [
2337
+ 140,
2338
+ 151,
2339
+ 37,
2340
+ 143,
2341
+ 78,
2342
+ 36,
2343
+ 137,
2344
+ 241,
2345
+ 187,
2346
+ 61,
2347
+ 16,
2348
+ 41,
2349
+ 20,
2350
+ 142,
2351
+ 13,
2352
+ 131,
2353
+ 11,
2354
+ 90,
2355
+ 19,
2356
+ 153,
2357
+ 218,
2358
+ 255,
2359
+ 16,
2360
+ 132,
2361
+ 4,
2362
+ 142,
2363
+ 123,
2364
+ 216,
2365
+ 219,
2366
+ 233,
2367
+ 248,
2368
+ 89
2369
+ ];
2370
+ };
2371
+ };
2372
+ },
2373
+ {
2374
+ name: 'stakeAta';
2375
+ writable: true;
2376
+ pda: {
2377
+ seeds: [
2378
+ {
2379
+ kind: 'account';
2380
+ path: 'stake';
2381
+ },
2382
+ {
2383
+ kind: 'account';
2384
+ path: 'tokenProgram';
2385
+ },
2386
+ {
2387
+ kind: 'account';
2388
+ path: 'mint';
2389
+ }
2390
+ ];
2391
+ program: {
2392
+ kind: 'const';
2393
+ value: [
2394
+ 140,
2395
+ 151,
2396
+ 37,
2397
+ 143,
2398
+ 78,
2399
+ 36,
2400
+ 137,
2401
+ 241,
2402
+ 187,
2403
+ 61,
2404
+ 16,
2405
+ 41,
2406
+ 20,
2407
+ 142,
2408
+ 13,
2409
+ 131,
2410
+ 11,
2411
+ 90,
2412
+ 19,
2413
+ 153,
2414
+ 218,
2415
+ 255,
2416
+ 16,
2417
+ 132,
2418
+ 4,
2419
+ 142,
2420
+ 123,
2421
+ 216,
2422
+ 219,
2423
+ 233,
2424
+ 248,
2425
+ 89
2426
+ ];
2427
+ };
2428
+ };
2429
+ },
2430
+ {
2431
+ name: 'tokenProgram';
2432
+ address: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
2433
+ },
2434
+ {
2435
+ name: 'associatedTokenProgram';
2436
+ address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
2437
+ },
2438
+ {
2439
+ name: 'systemProgram';
2440
+ address: '11111111111111111111111111111111';
2441
+ }
2442
+ ];
2443
+ args: [];
2444
+ },
2253
2445
  {
2254
2446
  name: 'openOrder';
2255
2447
  discriminator: [206, 88, 88, 143, 38, 136, 50, 224];
@@ -3032,13 +3224,13 @@ export type TriadProtocol = {
3032
3224
  };
3033
3225
  },
3034
3226
  {
3035
- name: 'stakeVaultAta';
3227
+ name: 'stakeAta';
3036
3228
  writable: true;
3037
3229
  pda: {
3038
3230
  seeds: [
3039
3231
  {
3040
3232
  kind: 'account';
3041
- path: 'stakeVault';
3233
+ path: 'stake';
3042
3234
  },
3043
3235
  {
3044
3236
  kind: 'account';
@@ -3170,31 +3362,17 @@ export type TriadProtocol = {
3170
3362
  signer: true;
3171
3363
  },
3172
3364
  {
3173
- name: 'stakeVault';
3365
+ name: 'stake';
3174
3366
  writable: true;
3175
3367
  pda: {
3176
3368
  seeds: [
3177
3369
  {
3178
3370
  kind: 'const';
3179
- value: [115, 116, 97, 107, 101, 95, 118, 97, 117, 108, 116];
3371
+ value: [115, 116, 97, 107, 101, 95, 118, 51];
3180
3372
  },
3181
3373
  {
3182
- kind: 'const';
3183
- value: [
3184
- 84,
3185
- 114,
3186
- 105,
3187
- 97,
3188
- 100,
3189
- 32,
3190
- 83,
3191
- 104,
3192
- 97,
3193
- 114,
3194
- 101,
3195
- 32,
3196
- 49
3197
- ];
3374
+ kind: 'account';
3375
+ path: 'signer';
3198
3376
  }
3199
3377
  ];
3200
3378
  };
@@ -3208,13 +3386,13 @@ export type TriadProtocol = {
3208
3386
  writable: true;
3209
3387
  },
3210
3388
  {
3211
- name: 'stakeVaultAta';
3389
+ name: 'stakeAta';
3212
3390
  writable: true;
3213
3391
  pda: {
3214
3392
  seeds: [
3215
3393
  {
3216
3394
  kind: 'account';
3217
- path: 'stakeVault';
3395
+ path: 'stake';
3218
3396
  },
3219
3397
  {
3220
3398
  kind: 'account';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "3.3.9-beta",
3
+ "version": "3.4.1-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",