@triadxyz/triad-protocol 0.7.4-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 +28 -106
- package/dist/stake.d.ts +4 -4
- package/dist/stake.js +12 -68
- package/dist/trade.d.ts +66 -17
- package/dist/trade.js +101 -47
- package/dist/types/idl_triad_protocol.json +195 -35
- package/dist/types/trade.d.ts +12 -0
- package/dist/types/triad_protocol.d.ts +195 -35
- 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
|
@@ -556,6 +556,35 @@ export type TriadProtocol = {
|
|
|
556
556
|
}
|
|
557
557
|
];
|
|
558
558
|
},
|
|
559
|
+
{
|
|
560
|
+
name: 'initializeQuestion';
|
|
561
|
+
discriminator: [245, 151, 106, 188, 88, 44, 65, 212];
|
|
562
|
+
accounts: [
|
|
563
|
+
{
|
|
564
|
+
name: 'signer';
|
|
565
|
+
writable: true;
|
|
566
|
+
signer: true;
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
name: 'market';
|
|
570
|
+
writable: true;
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
name: 'systemProgram';
|
|
574
|
+
address: '11111111111111111111111111111111';
|
|
575
|
+
}
|
|
576
|
+
];
|
|
577
|
+
args: [
|
|
578
|
+
{
|
|
579
|
+
name: 'args';
|
|
580
|
+
type: {
|
|
581
|
+
defined: {
|
|
582
|
+
name: 'initializeQuestionArgs';
|
|
583
|
+
};
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
];
|
|
587
|
+
},
|
|
559
588
|
{
|
|
560
589
|
name: 'openOrder';
|
|
561
590
|
discriminator: [206, 88, 88, 143, 38, 136, 50, 224];
|
|
@@ -759,6 +788,26 @@ export type TriadProtocol = {
|
|
|
759
788
|
];
|
|
760
789
|
args: [];
|
|
761
790
|
},
|
|
791
|
+
{
|
|
792
|
+
name: 'resolveQuestion';
|
|
793
|
+
discriminator: [52, 32, 224, 179, 180, 8, 0, 246];
|
|
794
|
+
accounts: [
|
|
795
|
+
{
|
|
796
|
+
name: 'signer';
|
|
797
|
+
writable: true;
|
|
798
|
+
signer: true;
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
name: 'market';
|
|
802
|
+
writable: true;
|
|
803
|
+
},
|
|
804
|
+
{
|
|
805
|
+
name: 'systemProgram';
|
|
806
|
+
address: '11111111111111111111111111111111';
|
|
807
|
+
}
|
|
808
|
+
];
|
|
809
|
+
args: [];
|
|
810
|
+
},
|
|
762
811
|
{
|
|
763
812
|
name: 'stakeNft';
|
|
764
813
|
discriminator: [38, 27, 66, 46, 69, 65, 151, 219];
|
|
@@ -1521,6 +1570,10 @@ export type TriadProtocol = {
|
|
|
1521
1570
|
{
|
|
1522
1571
|
name: 'questionUpdate';
|
|
1523
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];
|
|
1524
1577
|
}
|
|
1525
1578
|
];
|
|
1526
1579
|
errors: [
|
|
@@ -1596,108 +1649,133 @@ export type TriadProtocol = {
|
|
|
1596
1649
|
},
|
|
1597
1650
|
{
|
|
1598
1651
|
code: 6014;
|
|
1599
|
-
name: 'stakeVaultLocked';
|
|
1600
|
-
msg: 'Stake vault locked';
|
|
1601
|
-
},
|
|
1602
|
-
{
|
|
1603
|
-
code: 6015;
|
|
1604
1652
|
name: 'stakeLocked';
|
|
1605
1653
|
msg: 'Stake is locked';
|
|
1606
1654
|
},
|
|
1607
1655
|
{
|
|
1608
|
-
code:
|
|
1656
|
+
code: 6015;
|
|
1609
1657
|
name: 'stakeVaultFull';
|
|
1610
1658
|
msg: 'Stake vault full';
|
|
1611
1659
|
},
|
|
1612
1660
|
{
|
|
1613
|
-
code:
|
|
1661
|
+
code: 6016;
|
|
1614
1662
|
name: 'invalidMint';
|
|
1615
1663
|
msg: 'Invalid mint';
|
|
1616
1664
|
},
|
|
1617
1665
|
{
|
|
1618
|
-
code:
|
|
1666
|
+
code: 6017;
|
|
1619
1667
|
name: 'invalidStakeVaultWeek';
|
|
1620
1668
|
msg: 'Invalid stake vault week';
|
|
1621
1669
|
},
|
|
1622
1670
|
{
|
|
1623
|
-
code:
|
|
1671
|
+
code: 6018;
|
|
1624
1672
|
name: 'rewardsAlreadyClaimed';
|
|
1625
1673
|
msg: 'Rewards already claimed';
|
|
1626
1674
|
},
|
|
1627
1675
|
{
|
|
1628
|
-
code:
|
|
1676
|
+
code: 6019;
|
|
1629
1677
|
name: 'stakeOverflow';
|
|
1630
1678
|
msg: 'Stake overflow';
|
|
1631
1679
|
},
|
|
1632
1680
|
{
|
|
1633
|
-
code:
|
|
1681
|
+
code: 6020;
|
|
1634
1682
|
name: 'swapsReachedLimit';
|
|
1635
1683
|
msg: 'Swaps reached limit';
|
|
1636
1684
|
},
|
|
1637
1685
|
{
|
|
1638
|
-
code:
|
|
1686
|
+
code: 6021;
|
|
1639
1687
|
name: 'insufficientFunds';
|
|
1640
1688
|
msg: 'Insufficient funds';
|
|
1641
1689
|
},
|
|
1642
1690
|
{
|
|
1643
|
-
code:
|
|
1691
|
+
code: 6022;
|
|
1644
1692
|
name: 'noRewardsAvailable';
|
|
1645
1693
|
msg: 'No rewards available';
|
|
1646
1694
|
},
|
|
1647
1695
|
{
|
|
1648
|
-
code:
|
|
1696
|
+
code: 6023;
|
|
1649
1697
|
name: 'invalidPrice';
|
|
1650
1698
|
msg: 'Invalid price';
|
|
1651
1699
|
},
|
|
1652
1700
|
{
|
|
1653
|
-
code:
|
|
1701
|
+
code: 6024;
|
|
1654
1702
|
name: 'invalidOrderSize';
|
|
1655
1703
|
msg: 'Invalid order size';
|
|
1656
1704
|
},
|
|
1657
1705
|
{
|
|
1658
|
-
code:
|
|
1706
|
+
code: 6025;
|
|
1659
1707
|
name: 'maxOpenOrdersReached';
|
|
1660
1708
|
msg: 'Maximum number of open orders reached';
|
|
1661
1709
|
},
|
|
1662
1710
|
{
|
|
1663
|
-
code:
|
|
1711
|
+
code: 6026;
|
|
1664
1712
|
name: 'noAvailableOrderSlot';
|
|
1665
1713
|
msg: 'No available order slot';
|
|
1666
1714
|
},
|
|
1667
1715
|
{
|
|
1668
|
-
code:
|
|
1716
|
+
code: 6027;
|
|
1669
1717
|
name: 'marketInactive';
|
|
1670
1718
|
msg: 'Market is inactive';
|
|
1671
1719
|
},
|
|
1672
1720
|
{
|
|
1673
|
-
code:
|
|
1721
|
+
code: 6028;
|
|
1674
1722
|
name: 'invalidOrderType';
|
|
1675
1723
|
msg: 'Invalid order type';
|
|
1676
1724
|
},
|
|
1677
1725
|
{
|
|
1678
|
-
code:
|
|
1726
|
+
code: 6029;
|
|
1679
1727
|
name: 'invalidOrderDirection';
|
|
1680
1728
|
msg: 'Invalid order direction';
|
|
1681
1729
|
},
|
|
1682
1730
|
{
|
|
1683
|
-
code:
|
|
1731
|
+
code: 6030;
|
|
1684
1732
|
name: 'orderNotFound';
|
|
1685
1733
|
msg: 'Order not found';
|
|
1686
1734
|
},
|
|
1687
1735
|
{
|
|
1688
|
-
code:
|
|
1736
|
+
code: 6031;
|
|
1689
1737
|
name: 'invalidOrderStatus';
|
|
1690
1738
|
msg: 'Invalid order status';
|
|
1691
1739
|
},
|
|
1692
1740
|
{
|
|
1693
|
-
code:
|
|
1741
|
+
code: 6032;
|
|
1694
1742
|
name: 'arithmeticOverflow';
|
|
1695
1743
|
msg: 'Arithmetic overflow';
|
|
1696
1744
|
},
|
|
1697
1745
|
{
|
|
1698
|
-
code:
|
|
1746
|
+
code: 6033;
|
|
1699
1747
|
name: 'orderSizeTooLarge';
|
|
1700
1748
|
msg: 'Order size too large';
|
|
1749
|
+
},
|
|
1750
|
+
{
|
|
1751
|
+
code: 6034;
|
|
1752
|
+
name: 'questionPeriodNotEnded';
|
|
1753
|
+
msg: 'Question period not ended';
|
|
1754
|
+
},
|
|
1755
|
+
{
|
|
1756
|
+
code: 6035;
|
|
1757
|
+
name: 'invalidStartTime';
|
|
1758
|
+
msg: 'Invalid start time';
|
|
1759
|
+
},
|
|
1760
|
+
{
|
|
1761
|
+
code: 6036;
|
|
1762
|
+
name: 'invalidEndTime';
|
|
1763
|
+
msg: 'Invalid end time';
|
|
1764
|
+
},
|
|
1765
|
+
{
|
|
1766
|
+
code: 6037;
|
|
1767
|
+
name: 'questionPeriodNotStarted';
|
|
1768
|
+
msg: 'Question period not started';
|
|
1769
|
+
},
|
|
1770
|
+
{
|
|
1771
|
+
code: 6038;
|
|
1772
|
+
name: 'questionPeriodEnded';
|
|
1773
|
+
msg: 'Question period ended';
|
|
1774
|
+
},
|
|
1775
|
+
{
|
|
1776
|
+
code: 6039;
|
|
1777
|
+
name: 'stakeVaultLocked';
|
|
1778
|
+
msg: 'Stake vault is locked';
|
|
1701
1779
|
}
|
|
1702
1780
|
];
|
|
1703
1781
|
types: [
|
|
@@ -1807,6 +1885,28 @@ export type TriadProtocol = {
|
|
|
1807
1885
|
];
|
|
1808
1886
|
};
|
|
1809
1887
|
},
|
|
1888
|
+
{
|
|
1889
|
+
name: 'initializeQuestionArgs';
|
|
1890
|
+
type: {
|
|
1891
|
+
kind: 'struct';
|
|
1892
|
+
fields: [
|
|
1893
|
+
{
|
|
1894
|
+
name: 'question';
|
|
1895
|
+
type: {
|
|
1896
|
+
array: ['u8', 80];
|
|
1897
|
+
};
|
|
1898
|
+
},
|
|
1899
|
+
{
|
|
1900
|
+
name: 'startTime';
|
|
1901
|
+
type: 'i64';
|
|
1902
|
+
},
|
|
1903
|
+
{
|
|
1904
|
+
name: 'endTime';
|
|
1905
|
+
type: 'i64';
|
|
1906
|
+
}
|
|
1907
|
+
];
|
|
1908
|
+
};
|
|
1909
|
+
},
|
|
1810
1910
|
{
|
|
1811
1911
|
name: 'market';
|
|
1812
1912
|
type: {
|
|
@@ -1930,9 +2030,6 @@ export type TriadProtocol = {
|
|
|
1930
2030
|
},
|
|
1931
2031
|
{
|
|
1932
2032
|
name: 'currentQuestionStart';
|
|
1933
|
-
docs: [
|
|
1934
|
-
'Start timestamp of the current week if 7 days have passed since the start of the week'
|
|
1935
|
-
];
|
|
1936
2033
|
type: 'i64';
|
|
1937
2034
|
},
|
|
1938
2035
|
{
|
|
@@ -2239,6 +2336,20 @@ export type TriadProtocol = {
|
|
|
2239
2336
|
];
|
|
2240
2337
|
};
|
|
2241
2338
|
},
|
|
2339
|
+
{
|
|
2340
|
+
name: 'questionStatus';
|
|
2341
|
+
type: {
|
|
2342
|
+
kind: 'enum';
|
|
2343
|
+
variants: [
|
|
2344
|
+
{
|
|
2345
|
+
name: 'resolved';
|
|
2346
|
+
},
|
|
2347
|
+
{
|
|
2348
|
+
name: 'unresolved';
|
|
2349
|
+
}
|
|
2350
|
+
];
|
|
2351
|
+
};
|
|
2352
|
+
},
|
|
2242
2353
|
{
|
|
2243
2354
|
name: 'questionUpdate';
|
|
2244
2355
|
type: {
|
|
@@ -2293,16 +2404,24 @@ export type TriadProtocol = {
|
|
|
2293
2404
|
type: 'u64';
|
|
2294
2405
|
},
|
|
2295
2406
|
{
|
|
2296
|
-
name: '
|
|
2407
|
+
name: 'timestamp';
|
|
2408
|
+
type: 'i64';
|
|
2409
|
+
},
|
|
2410
|
+
{
|
|
2411
|
+
name: 'totalHypeShares';
|
|
2412
|
+
type: 'u64';
|
|
2413
|
+
},
|
|
2414
|
+
{
|
|
2415
|
+
name: 'totalFlopShares';
|
|
2416
|
+
type: 'u64';
|
|
2417
|
+
},
|
|
2418
|
+
{
|
|
2419
|
+
name: 'status';
|
|
2297
2420
|
type: {
|
|
2298
2421
|
defined: {
|
|
2299
|
-
name: '
|
|
2422
|
+
name: 'questionStatus';
|
|
2300
2423
|
};
|
|
2301
2424
|
};
|
|
2302
|
-
},
|
|
2303
|
-
{
|
|
2304
|
-
name: 'timestamp';
|
|
2305
|
-
type: 'i64';
|
|
2306
2425
|
}
|
|
2307
2426
|
];
|
|
2308
2427
|
};
|
|
@@ -2366,10 +2485,20 @@ export type TriadProtocol = {
|
|
|
2366
2485
|
docs: ['Final price for Flop outcome at the end of the week'];
|
|
2367
2486
|
type: 'u64';
|
|
2368
2487
|
},
|
|
2488
|
+
{
|
|
2489
|
+
name: 'totalHypeShares';
|
|
2490
|
+
docs: ['Total number of Hype shares issued'];
|
|
2491
|
+
type: 'u64';
|
|
2492
|
+
},
|
|
2493
|
+
{
|
|
2494
|
+
name: 'totalFlopShares';
|
|
2495
|
+
docs: ['Total number of Flop shares issued'];
|
|
2496
|
+
type: 'u64';
|
|
2497
|
+
},
|
|
2369
2498
|
{
|
|
2370
2499
|
name: 'padding';
|
|
2371
2500
|
type: {
|
|
2372
|
-
array: ['u8',
|
|
2501
|
+
array: ['u8', 40];
|
|
2373
2502
|
};
|
|
2374
2503
|
}
|
|
2375
2504
|
];
|
|
@@ -2391,6 +2520,34 @@ export type TriadProtocol = {
|
|
|
2391
2520
|
];
|
|
2392
2521
|
};
|
|
2393
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
|
+
},
|
|
2394
2551
|
{
|
|
2395
2552
|
name: 'stakeTokenArgs';
|
|
2396
2553
|
type: {
|
|
@@ -2682,6 +2839,9 @@ export type TriadProtocol = {
|
|
|
2682
2839
|
type: {
|
|
2683
2840
|
kind: 'enum';
|
|
2684
2841
|
variants: [
|
|
2842
|
+
{
|
|
2843
|
+
name: 'none';
|
|
2844
|
+
},
|
|
2685
2845
|
{
|
|
2686
2846
|
name: 'hype';
|
|
2687
2847
|
},
|
|
@@ -2689,7 +2849,7 @@ export type TriadProtocol = {
|
|
|
2689
2849
|
name: 'flop';
|
|
2690
2850
|
},
|
|
2691
2851
|
{
|
|
2692
|
-
name: '
|
|
2852
|
+
name: 'draw';
|
|
2693
2853
|
}
|
|
2694
2854
|
];
|
|
2695
2855
|
};
|
|
@@ -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;
|