@triadxyz/triad-protocol 0.7.5-beta.devnet → 0.7.6-beta.devnet
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 +7 -1
- package/dist/index.js +9 -11
- package/dist/local-test.js +26 -98
- package/dist/stake.d.ts +4 -4
- package/dist/stake.js +12 -68
- package/dist/trade.d.ts +66 -16
- package/dist/trade.js +101 -47
- package/dist/types/idl_triad_protocol.json +61 -72
- package/dist/types/trade.d.ts +12 -0
- package/dist/types/triad_protocol.d.ts +61 -101
- package/dist/utils/sendTransactionWithOptions.d.ts +3 -0
- package/dist/utils/sendTransactionWithOptions.js +14 -0
- package/dist/utils/sendVersionedTransaction.d.ts +5 -0
- package/dist/utils/sendVersionedTransaction.js +29 -0
- package/package.json +1 -1
|
@@ -569,75 +569,6 @@ export type TriadProtocol = {
|
|
|
569
569
|
name: 'market';
|
|
570
570
|
writable: true;
|
|
571
571
|
},
|
|
572
|
-
{
|
|
573
|
-
name: 'mint';
|
|
574
|
-
writable: true;
|
|
575
|
-
},
|
|
576
|
-
{
|
|
577
|
-
name: 'marketVault';
|
|
578
|
-
writable: true;
|
|
579
|
-
pda: {
|
|
580
|
-
seeds: [
|
|
581
|
-
{
|
|
582
|
-
kind: 'account';
|
|
583
|
-
path: 'market';
|
|
584
|
-
},
|
|
585
|
-
{
|
|
586
|
-
kind: 'account';
|
|
587
|
-
path: 'tokenProgram';
|
|
588
|
-
},
|
|
589
|
-
{
|
|
590
|
-
kind: 'account';
|
|
591
|
-
path: 'mint';
|
|
592
|
-
}
|
|
593
|
-
];
|
|
594
|
-
program: {
|
|
595
|
-
kind: 'const';
|
|
596
|
-
value: [
|
|
597
|
-
140,
|
|
598
|
-
151,
|
|
599
|
-
37,
|
|
600
|
-
143,
|
|
601
|
-
78,
|
|
602
|
-
36,
|
|
603
|
-
137,
|
|
604
|
-
241,
|
|
605
|
-
187,
|
|
606
|
-
61,
|
|
607
|
-
16,
|
|
608
|
-
41,
|
|
609
|
-
20,
|
|
610
|
-
142,
|
|
611
|
-
13,
|
|
612
|
-
131,
|
|
613
|
-
11,
|
|
614
|
-
90,
|
|
615
|
-
19,
|
|
616
|
-
153,
|
|
617
|
-
218,
|
|
618
|
-
255,
|
|
619
|
-
16,
|
|
620
|
-
132,
|
|
621
|
-
4,
|
|
622
|
-
142,
|
|
623
|
-
123,
|
|
624
|
-
216,
|
|
625
|
-
219,
|
|
626
|
-
233,
|
|
627
|
-
248,
|
|
628
|
-
89
|
|
629
|
-
];
|
|
630
|
-
};
|
|
631
|
-
};
|
|
632
|
-
},
|
|
633
|
-
{
|
|
634
|
-
name: 'tokenProgram';
|
|
635
|
-
address: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
|
|
636
|
-
},
|
|
637
|
-
{
|
|
638
|
-
name: 'associatedTokenProgram';
|
|
639
|
-
address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
|
|
640
|
-
},
|
|
641
572
|
{
|
|
642
573
|
name: 'systemProgram';
|
|
643
574
|
address: '11111111111111111111111111111111';
|
|
@@ -1639,6 +1570,10 @@ export type TriadProtocol = {
|
|
|
1639
1570
|
{
|
|
1640
1571
|
name: 'questionUpdate';
|
|
1641
1572
|
discriminator: [110, 108, 240, 86, 176, 226, 54, 113];
|
|
1573
|
+
},
|
|
1574
|
+
{
|
|
1575
|
+
name: 'stakeRewards';
|
|
1576
|
+
discriminator: [236, 217, 227, 239, 6, 129, 188, 218];
|
|
1642
1577
|
}
|
|
1643
1578
|
];
|
|
1644
1579
|
errors: [
|
|
@@ -1714,133 +1649,133 @@ export type TriadProtocol = {
|
|
|
1714
1649
|
},
|
|
1715
1650
|
{
|
|
1716
1651
|
code: 6014;
|
|
1717
|
-
name: 'stakeVaultLocked';
|
|
1718
|
-
msg: 'Stake vault locked';
|
|
1719
|
-
},
|
|
1720
|
-
{
|
|
1721
|
-
code: 6015;
|
|
1722
1652
|
name: 'stakeLocked';
|
|
1723
1653
|
msg: 'Stake is locked';
|
|
1724
1654
|
},
|
|
1725
1655
|
{
|
|
1726
|
-
code:
|
|
1656
|
+
code: 6015;
|
|
1727
1657
|
name: 'stakeVaultFull';
|
|
1728
1658
|
msg: 'Stake vault full';
|
|
1729
1659
|
},
|
|
1730
1660
|
{
|
|
1731
|
-
code:
|
|
1661
|
+
code: 6016;
|
|
1732
1662
|
name: 'invalidMint';
|
|
1733
1663
|
msg: 'Invalid mint';
|
|
1734
1664
|
},
|
|
1735
1665
|
{
|
|
1736
|
-
code:
|
|
1666
|
+
code: 6017;
|
|
1737
1667
|
name: 'invalidStakeVaultWeek';
|
|
1738
1668
|
msg: 'Invalid stake vault week';
|
|
1739
1669
|
},
|
|
1740
1670
|
{
|
|
1741
|
-
code:
|
|
1671
|
+
code: 6018;
|
|
1742
1672
|
name: 'rewardsAlreadyClaimed';
|
|
1743
1673
|
msg: 'Rewards already claimed';
|
|
1744
1674
|
},
|
|
1745
1675
|
{
|
|
1746
|
-
code:
|
|
1676
|
+
code: 6019;
|
|
1747
1677
|
name: 'stakeOverflow';
|
|
1748
1678
|
msg: 'Stake overflow';
|
|
1749
1679
|
},
|
|
1750
1680
|
{
|
|
1751
|
-
code:
|
|
1681
|
+
code: 6020;
|
|
1752
1682
|
name: 'swapsReachedLimit';
|
|
1753
1683
|
msg: 'Swaps reached limit';
|
|
1754
1684
|
},
|
|
1755
1685
|
{
|
|
1756
|
-
code:
|
|
1686
|
+
code: 6021;
|
|
1757
1687
|
name: 'insufficientFunds';
|
|
1758
1688
|
msg: 'Insufficient funds';
|
|
1759
1689
|
},
|
|
1760
1690
|
{
|
|
1761
|
-
code:
|
|
1691
|
+
code: 6022;
|
|
1762
1692
|
name: 'noRewardsAvailable';
|
|
1763
1693
|
msg: 'No rewards available';
|
|
1764
1694
|
},
|
|
1765
1695
|
{
|
|
1766
|
-
code:
|
|
1696
|
+
code: 6023;
|
|
1767
1697
|
name: 'invalidPrice';
|
|
1768
1698
|
msg: 'Invalid price';
|
|
1769
1699
|
},
|
|
1770
1700
|
{
|
|
1771
|
-
code:
|
|
1701
|
+
code: 6024;
|
|
1772
1702
|
name: 'invalidOrderSize';
|
|
1773
1703
|
msg: 'Invalid order size';
|
|
1774
1704
|
},
|
|
1775
1705
|
{
|
|
1776
|
-
code:
|
|
1706
|
+
code: 6025;
|
|
1777
1707
|
name: 'maxOpenOrdersReached';
|
|
1778
1708
|
msg: 'Maximum number of open orders reached';
|
|
1779
1709
|
},
|
|
1780
1710
|
{
|
|
1781
|
-
code:
|
|
1711
|
+
code: 6026;
|
|
1782
1712
|
name: 'noAvailableOrderSlot';
|
|
1783
1713
|
msg: 'No available order slot';
|
|
1784
1714
|
},
|
|
1785
1715
|
{
|
|
1786
|
-
code:
|
|
1716
|
+
code: 6027;
|
|
1787
1717
|
name: 'marketInactive';
|
|
1788
1718
|
msg: 'Market is inactive';
|
|
1789
1719
|
},
|
|
1790
1720
|
{
|
|
1791
|
-
code:
|
|
1721
|
+
code: 6028;
|
|
1792
1722
|
name: 'invalidOrderType';
|
|
1793
1723
|
msg: 'Invalid order type';
|
|
1794
1724
|
},
|
|
1795
1725
|
{
|
|
1796
|
-
code:
|
|
1726
|
+
code: 6029;
|
|
1797
1727
|
name: 'invalidOrderDirection';
|
|
1798
1728
|
msg: 'Invalid order direction';
|
|
1799
1729
|
},
|
|
1800
1730
|
{
|
|
1801
|
-
code:
|
|
1731
|
+
code: 6030;
|
|
1802
1732
|
name: 'orderNotFound';
|
|
1803
1733
|
msg: 'Order not found';
|
|
1804
1734
|
},
|
|
1805
1735
|
{
|
|
1806
|
-
code:
|
|
1736
|
+
code: 6031;
|
|
1807
1737
|
name: 'invalidOrderStatus';
|
|
1808
1738
|
msg: 'Invalid order status';
|
|
1809
1739
|
},
|
|
1810
1740
|
{
|
|
1811
|
-
code:
|
|
1741
|
+
code: 6032;
|
|
1812
1742
|
name: 'arithmeticOverflow';
|
|
1813
1743
|
msg: 'Arithmetic overflow';
|
|
1814
1744
|
},
|
|
1815
1745
|
{
|
|
1816
|
-
code:
|
|
1746
|
+
code: 6033;
|
|
1817
1747
|
name: 'orderSizeTooLarge';
|
|
1818
1748
|
msg: 'Order size too large';
|
|
1819
1749
|
},
|
|
1820
1750
|
{
|
|
1821
|
-
code:
|
|
1751
|
+
code: 6034;
|
|
1822
1752
|
name: 'questionPeriodNotEnded';
|
|
1823
1753
|
msg: 'Question period not ended';
|
|
1824
1754
|
},
|
|
1825
1755
|
{
|
|
1826
|
-
code:
|
|
1756
|
+
code: 6035;
|
|
1827
1757
|
name: 'invalidStartTime';
|
|
1828
1758
|
msg: 'Invalid start time';
|
|
1829
1759
|
},
|
|
1830
1760
|
{
|
|
1831
|
-
code:
|
|
1761
|
+
code: 6036;
|
|
1832
1762
|
name: 'invalidEndTime';
|
|
1833
1763
|
msg: 'Invalid end time';
|
|
1834
1764
|
},
|
|
1835
1765
|
{
|
|
1836
|
-
code:
|
|
1766
|
+
code: 6037;
|
|
1837
1767
|
name: 'questionPeriodNotStarted';
|
|
1838
1768
|
msg: 'Question period not started';
|
|
1839
1769
|
},
|
|
1840
1770
|
{
|
|
1841
|
-
code:
|
|
1771
|
+
code: 6038;
|
|
1842
1772
|
name: 'questionPeriodEnded';
|
|
1843
1773
|
msg: 'Question period ended';
|
|
1774
|
+
},
|
|
1775
|
+
{
|
|
1776
|
+
code: 6039;
|
|
1777
|
+
name: 'stakeVaultLocked';
|
|
1778
|
+
msg: 'Stake vault is locked';
|
|
1844
1779
|
}
|
|
1845
1780
|
];
|
|
1846
1781
|
types: [
|
|
@@ -2095,9 +2030,6 @@ export type TriadProtocol = {
|
|
|
2095
2030
|
},
|
|
2096
2031
|
{
|
|
2097
2032
|
name: 'currentQuestionStart';
|
|
2098
|
-
docs: [
|
|
2099
|
-
'Start timestamp of the current week if 7 days have passed since the start of the week'
|
|
2100
|
-
];
|
|
2101
2033
|
type: 'i64';
|
|
2102
2034
|
},
|
|
2103
2035
|
{
|
|
@@ -2588,6 +2520,34 @@ export type TriadProtocol = {
|
|
|
2588
2520
|
];
|
|
2589
2521
|
};
|
|
2590
2522
|
},
|
|
2523
|
+
{
|
|
2524
|
+
name: 'stakeRewards';
|
|
2525
|
+
type: {
|
|
2526
|
+
kind: 'struct';
|
|
2527
|
+
fields: [
|
|
2528
|
+
{
|
|
2529
|
+
name: 'user';
|
|
2530
|
+
type: 'pubkey';
|
|
2531
|
+
},
|
|
2532
|
+
{
|
|
2533
|
+
name: 'mint';
|
|
2534
|
+
type: 'pubkey';
|
|
2535
|
+
},
|
|
2536
|
+
{
|
|
2537
|
+
name: 'amount';
|
|
2538
|
+
type: 'u64';
|
|
2539
|
+
},
|
|
2540
|
+
{
|
|
2541
|
+
name: 'timestamp';
|
|
2542
|
+
type: 'i64';
|
|
2543
|
+
},
|
|
2544
|
+
{
|
|
2545
|
+
name: 'rank';
|
|
2546
|
+
type: 'u16';
|
|
2547
|
+
}
|
|
2548
|
+
];
|
|
2549
|
+
};
|
|
2550
|
+
},
|
|
2591
2551
|
{
|
|
2592
2552
|
name: 'stakeTokenArgs';
|
|
2593
2553
|
type: {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
4
|
+
const sendTransactionWithOptions = (method, options) => {
|
|
5
|
+
if (options === null || options === void 0 ? void 0 : options.microLamports) {
|
|
6
|
+
method.postInstructions([
|
|
7
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
|
|
8
|
+
microLamports: options.microLamports
|
|
9
|
+
})
|
|
10
|
+
]);
|
|
11
|
+
}
|
|
12
|
+
return method.rpc({ skipPreflight: options === null || options === void 0 ? void 0 : options.skipPreflight });
|
|
13
|
+
};
|
|
14
|
+
exports.default = sendTransactionWithOptions;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TransactionInstruction } from '@solana/web3.js';
|
|
2
|
+
import { RpcOptions } from '../types';
|
|
3
|
+
import { Provider } from '@coral-xyz/anchor';
|
|
4
|
+
declare const sendVersionedTransaction: (provider: Provider, ixs: TransactionInstruction[], options?: RpcOptions) => Promise<string>;
|
|
5
|
+
export default sendVersionedTransaction;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
13
|
+
const sendVersionedTransaction = (provider, ixs, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
+
if (options === null || options === void 0 ? void 0 : options.microLamports) {
|
|
15
|
+
ixs.push(web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({
|
|
16
|
+
microLamports: options.microLamports
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
const { blockhash } = yield provider.connection.getLatestBlockhash();
|
|
20
|
+
return provider.sendAndConfirm(new web3_js_1.VersionedTransaction(new web3_js_1.TransactionMessage({
|
|
21
|
+
instructions: ixs,
|
|
22
|
+
recentBlockhash: blockhash,
|
|
23
|
+
payerKey: provider.publicKey
|
|
24
|
+
}).compileToV0Message()), [], {
|
|
25
|
+
skipPreflight: options === null || options === void 0 ? void 0 : options.skipPreflight,
|
|
26
|
+
commitment: 'confirmed'
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
exports.default = sendVersionedTransaction;
|