@triadxyz/triad-protocol 4.1.9 → 4.2.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/customer.d.ts +8 -1
- package/dist/customer.js +23 -0
- package/dist/index.d.ts +4 -138
- package/dist/index.js +15 -441
- package/dist/market.d.ts +163 -0
- package/dist/market.js +571 -0
- package/dist/poseidon.d.ts +2 -4
- package/dist/poseidon.js +10 -16
- package/dist/predictor.d.ts +8 -1
- package/dist/predictor.js +34 -14
- package/dist/stake.d.ts +0 -15
- package/dist/stake.js +0 -60
- package/dist/trade.d.ts +7 -6
- package/dist/trade.js +44 -54
- package/dist/types/customer.d.ts +5 -0
- package/dist/types/idl_triad_protocol.json +515 -901
- package/dist/types/index.d.ts +1 -4
- package/dist/types/predictor.d.ts +6 -0
- package/dist/types/trade.d.ts +7 -2
- package/dist/types/triad_protocol.d.ts +623 -1389
- package/dist/utils/feeCalculator.d.ts +0 -8
- package/dist/utils/feeCalculator.js +3 -32
- package/dist/utils/helpers.d.ts +2 -2
- package/dist/utils/helpers.js +6 -7
- package/dist/utils/sendVersionedTransaction.js +3 -11
- package/package.json +1 -1
package/dist/customer.d.ts
CHANGED
|
@@ -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 { CreateCustomerArgs } from './types/customer';
|
|
5
|
+
import { CreateCustomerArgs, UpdateCustomerArgs } from './types/customer';
|
|
6
6
|
export default class Customer {
|
|
7
7
|
private program;
|
|
8
8
|
private rpcOptions;
|
|
@@ -30,4 +30,11 @@ export default class Customer {
|
|
|
30
30
|
* @param args.feeBps - The fee in basis points of the customer
|
|
31
31
|
*/
|
|
32
32
|
createCustomer({ id, name, authority, feeRecipient, feeBps, marketFeeBps, payoutFeeBps }: CreateCustomerArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
33
|
+
/**
|
|
34
|
+
* Update Customer
|
|
35
|
+
* @param args.customerId - The ID of the customer
|
|
36
|
+
* @param args.marketFeeBps - The market fee in basis points of the customer
|
|
37
|
+
* @param args.payoutFeeBps - The payout fee in basis points of the customer
|
|
38
|
+
*/
|
|
39
|
+
updateCustomer({ customerId, marketFeeBps, payoutFeeBps }: UpdateCustomerArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
33
40
|
}
|
package/dist/customer.js
CHANGED
|
@@ -83,5 +83,28 @@ class Customer {
|
|
|
83
83
|
return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Update Customer
|
|
88
|
+
* @param args.customerId - The ID of the customer
|
|
89
|
+
* @param args.marketFeeBps - The market fee in basis points of the customer
|
|
90
|
+
* @param args.payoutFeeBps - The payout fee in basis points of the customer
|
|
91
|
+
*/
|
|
92
|
+
updateCustomer({ customerId, marketFeeBps, payoutFeeBps }) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
const ixs = [
|
|
95
|
+
yield this.program.methods
|
|
96
|
+
.updateCustomer({
|
|
97
|
+
customerId,
|
|
98
|
+
marketFeeBps: marketFeeBps ? marketFeeBps : null,
|
|
99
|
+
payoutFeeBps: payoutFeeBps ? payoutFeeBps : null
|
|
100
|
+
})
|
|
101
|
+
.accounts({
|
|
102
|
+
signer: this.program.provider.publicKey
|
|
103
|
+
})
|
|
104
|
+
.instruction()
|
|
105
|
+
];
|
|
106
|
+
return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
86
109
|
}
|
|
87
110
|
exports.default = Customer;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Connection, PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { AnchorProvider, Program, Wallet } from '@coral-xyz/anchor';
|
|
3
3
|
import { TriadProtocol as TriadProtocolIDL } from './types/triad_protocol';
|
|
4
|
-
import { RpcOptions
|
|
4
|
+
import { RpcOptions } from './types';
|
|
5
5
|
import Stake from './stake';
|
|
6
6
|
import Poseidon from './poseidon';
|
|
7
7
|
import Predictor from './predictor';
|
|
8
8
|
import Trade from './trade';
|
|
9
9
|
import Customer from './customer';
|
|
10
|
+
import Market from './market';
|
|
10
11
|
export * from './types';
|
|
11
12
|
export * from './types/predictor';
|
|
12
13
|
export * from './types/stake';
|
|
@@ -27,17 +28,14 @@ export default class TriadProtocol {
|
|
|
27
28
|
predictor: Predictor;
|
|
28
29
|
trade: Trade;
|
|
29
30
|
customer: Customer;
|
|
31
|
+
market: Market;
|
|
30
32
|
constructor(connection: Connection, wallet: Wallet, rpcOptions: RpcOptions);
|
|
33
|
+
getPriorityFee(): Promise<void>;
|
|
31
34
|
/**
|
|
32
35
|
* Get User Orders
|
|
33
36
|
* @param wallet - User wallet PublicKey
|
|
34
37
|
*/
|
|
35
38
|
getUserOrders(wallet: PublicKey): Promise<import("./types").Order[]>;
|
|
36
|
-
/**
|
|
37
|
-
* Get Orders By Market ID
|
|
38
|
-
* @param marketId - The ID of the market
|
|
39
|
-
*/
|
|
40
|
-
getOrdersByMarketId(marketId: number): Promise<import("./types").Order[]>;
|
|
41
39
|
/**
|
|
42
40
|
* Get User Orders By Market ID
|
|
43
41
|
* @param wallet - User wallet PublicKey
|
|
@@ -53,138 +51,6 @@ export default class TriadProtocol {
|
|
|
53
51
|
* Get User Book Orders By Market ID
|
|
54
52
|
*/
|
|
55
53
|
getUserBookOrdersByMarketId(wallet: PublicKey, marketId: number): Promise<import("./types").BookOrder[]>;
|
|
56
|
-
/**
|
|
57
|
-
* Get All Pools
|
|
58
|
-
*/
|
|
59
|
-
getAllPools(): Promise<import("./types").Pool[]>;
|
|
60
|
-
/**
|
|
61
|
-
* Get All Markets
|
|
62
|
-
*/
|
|
63
|
-
getAllMarkets(): Promise<import("./types").Market[]>;
|
|
64
|
-
/**
|
|
65
|
-
* Get Pool By ID
|
|
66
|
-
* @param poolId - The ID of the pool
|
|
67
|
-
*/
|
|
68
|
-
getPoolById(poolId: number): Promise<import("./types").Pool>;
|
|
69
|
-
/**
|
|
70
|
-
* Get Market By ID
|
|
71
|
-
* @param marketId - The ID of the market
|
|
72
|
-
*/
|
|
73
|
-
getMarketById(marketId: number): Promise<import("./types").Market>;
|
|
74
|
-
/**
|
|
75
|
-
* Get Market By Address
|
|
76
|
-
* @param marketAddress - The address of the market
|
|
77
|
-
*/
|
|
78
|
-
getMarketByAddress(marketAddress: PublicKey): Promise<import("./types").Market>;
|
|
79
|
-
/**
|
|
80
|
-
* Get Current Market ID
|
|
81
|
-
*/
|
|
82
|
-
nextMarketId(): Promise<number>;
|
|
83
|
-
/**
|
|
84
|
-
* Get Next Pool ID
|
|
85
|
-
*/
|
|
86
|
-
nextPoolId(): Promise<number>;
|
|
87
|
-
/**
|
|
88
|
-
* Create Market
|
|
89
|
-
* @param args.markets - Array of markets to create
|
|
90
|
-
* @param args.markets.marketId - Market ID
|
|
91
|
-
* @param args.markets.startTime - start time
|
|
92
|
-
* @param args.markets.endTime - end time
|
|
93
|
-
* @param args.markets.question - question (max 80 characters)
|
|
94
|
-
* @param args.markets.liquidityAtStart - liquidity at start
|
|
95
|
-
* @param args.markets.payoutFee - payout fee (to add affiliate system)
|
|
96
|
-
* @param args.customer - The customer of the market
|
|
97
|
-
* @param args.poolId - The ID of the pool
|
|
98
|
-
*/
|
|
99
|
-
createMarket({ markets, customer, poolId }: CreateMarketArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
100
|
-
/**
|
|
101
|
-
* Create Pool
|
|
102
|
-
* @param poolId - The ID of the pool
|
|
103
|
-
* @param question - The question of the pool
|
|
104
|
-
* @param markets - The markets of the pool
|
|
105
|
-
* @param customer - The customer of the pool
|
|
106
|
-
* @param startTime - The start time of the pool
|
|
107
|
-
* @param endTime - The end time of the pool
|
|
108
|
-
* @param feeBps - The fee in basis points of the pool
|
|
109
|
-
* @param payoutFee - The payout fee of the pool
|
|
110
|
-
* @param isFast - Whether the pool is fast
|
|
111
|
-
* @param isPyth - Whether the pool is pyth
|
|
112
|
-
* @param feedId - The feed ID of the pool
|
|
113
|
-
*/
|
|
114
|
-
createPool({ poolId, question, markets, customer, startTime, endTime, feeBps, payoutFee, isFast, isPyth, feedId }: CreatePoolArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
115
|
-
/**
|
|
116
|
-
* Update Market Winning Direction
|
|
117
|
-
* @param args.marketId - The ID of the Market
|
|
118
|
-
* @param args.winningDirection - The Winning Direction of the Market
|
|
119
|
-
* @param args.poolId - The ID of the Pool
|
|
120
|
-
* @param args.withPayout - Whether to allow the market to payout
|
|
121
|
-
*/
|
|
122
|
-
updateMarketWinningDirection({ markets }: UpdateMarketWinningDirectionArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
123
|
-
/**
|
|
124
|
-
* Update Market Payout
|
|
125
|
-
* @param args.marketId - The ID of the market
|
|
126
|
-
* @param args.allowPayout - Whether to allow the market to payout
|
|
127
|
-
*/
|
|
128
|
-
updateMarketPayout({ marketId, allowPayout }: UpdateMarketPayoutArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
129
|
-
/**
|
|
130
|
-
* Update Market End
|
|
131
|
-
* @param args.marketId - The ID of the market
|
|
132
|
-
* @param args.marketEnd - The end time of the market
|
|
133
|
-
*/
|
|
134
|
-
updateMarketEnd({ marketId, marketEnd }: UpdateMarketEndArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
135
|
-
/**
|
|
136
|
-
* Update Market Question
|
|
137
|
-
* @param args.marketId - The ID of the market
|
|
138
|
-
* @param args.question - The question of the market
|
|
139
|
-
*/
|
|
140
|
-
updateMarketQuestion({ marketId, question }: UpdateMarketQuestionArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
141
|
-
/**
|
|
142
|
-
* Collect Market Fee
|
|
143
|
-
* @param args.markets - The markets to collect the fee from
|
|
144
|
-
* @param args.markets.marketAddress - The address of the market
|
|
145
|
-
* @param args.markets.customerId - The ID of the customer
|
|
146
|
-
* @param args.markets.customerFeeRecipient - The address of the customer fee recipient
|
|
147
|
-
*/
|
|
148
|
-
collectMarketFee(markets: {
|
|
149
|
-
marketAddress: PublicKey;
|
|
150
|
-
customerId: number;
|
|
151
|
-
customerFeeRecipient: PublicKey;
|
|
152
|
-
}[]): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
153
|
-
/**
|
|
154
|
-
* Close Order Book
|
|
155
|
-
* @param markets.id - Market IDs
|
|
156
|
-
* @param markets.authority - The authority of the market
|
|
157
|
-
*/
|
|
158
|
-
closeOrderBook(markets: {
|
|
159
|
-
id: number;
|
|
160
|
-
authority: PublicKey;
|
|
161
|
-
}[]): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
162
|
-
/**
|
|
163
|
-
* Close IDLE Market
|
|
164
|
-
* @param markets.id - Market ID
|
|
165
|
-
* @param markets.authority - Market authority
|
|
166
|
-
* @param markets.mint - Market mint
|
|
167
|
-
*/
|
|
168
|
-
closeIdleMarket(markets: {
|
|
169
|
-
id: number;
|
|
170
|
-
authority: PublicKey;
|
|
171
|
-
mint: PublicKey;
|
|
172
|
-
}[]): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
173
|
-
/**
|
|
174
|
-
* Update Pool Question
|
|
175
|
-
* @param poolId - Pool ID
|
|
176
|
-
* @param question - Question
|
|
177
|
-
*/
|
|
178
|
-
updatePoolQuestion(poolId: number, question: string): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
179
|
-
/**
|
|
180
|
-
* Create Market Pyth
|
|
181
|
-
* @param args.markets - Array of markets to create
|
|
182
|
-
* @param args.markets.marketId - Market ID
|
|
183
|
-
* @param args.markets.resolveIn - Time to add for resolver the market in seconds
|
|
184
|
-
* @param args.customer - The customer of the market
|
|
185
|
-
* @param args.poolId - The ID of the pool
|
|
186
|
-
*/
|
|
187
|
-
createMarketPyth({ markets }: CreateMarketPythArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
188
54
|
/**
|
|
189
55
|
* Burn Triad
|
|
190
56
|
* @param amount - Amount to burn
|