@triadxyz/triad-protocol 4.2.2 → 4.2.3
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/predictor.d.ts +9 -9
- package/dist/predictor.js +12 -13
- package/dist/trade.js +4 -4
- package/dist/types/idl_triad_protocol.json +24 -0
- package/dist/types/predictor.d.ts +4 -4
- package/dist/types/triad_protocol.d.ts +24 -0
- package/package.json +1 -1
package/dist/predictor.d.ts
CHANGED
|
@@ -10,39 +10,39 @@ export default class Predictor {
|
|
|
10
10
|
/**
|
|
11
11
|
* Get predictor
|
|
12
12
|
* @param authority - Authority public key
|
|
13
|
-
* @param customerId - Customer ID
|
|
13
|
+
* @param customerId - Customer ID
|
|
14
14
|
*/
|
|
15
|
-
getPredictor(authority: PublicKey, customerId
|
|
15
|
+
getPredictor(authority: PublicKey, customerId: number): Promise<PredictorType>;
|
|
16
16
|
/**
|
|
17
17
|
* Get User Orders
|
|
18
18
|
* @param wallet - User wallet PublicKey
|
|
19
19
|
*/
|
|
20
|
-
getUserOrders(wallet: PublicKey, customerId
|
|
20
|
+
getUserOrders(wallet: PublicKey, customerId: number): Promise<import("./types").PredictorOrder[]>;
|
|
21
21
|
/**
|
|
22
22
|
* Get User Orders By Market ID
|
|
23
23
|
* @param wallet - User wallet PublicKey
|
|
24
24
|
* @param marketId - The ID of the market
|
|
25
25
|
*/
|
|
26
|
-
getUserOrdersByMarketId(wallet: PublicKey, marketId: number, customerId
|
|
26
|
+
getUserOrdersByMarketId(wallet: PublicKey, marketId: number, customerId: number): Promise<import("./types").PredictorOrder[]>;
|
|
27
27
|
/**
|
|
28
28
|
* Get all User Book Orders
|
|
29
29
|
* @param wallet - User wallet PublicKey
|
|
30
30
|
* @param customerId - User Customer ID
|
|
31
31
|
*/
|
|
32
|
-
getUserBookOrders(wallet: PublicKey, customerId
|
|
32
|
+
getUserBookOrders(wallet: PublicKey, customerId: number): Promise<import("./types").BookOrder[]>;
|
|
33
33
|
/**
|
|
34
34
|
* Get User Book Orders By Market ID
|
|
35
35
|
* @param wallet - User wallet PublicKey
|
|
36
36
|
* @param marketId - The ID of the market
|
|
37
37
|
* @param customerId - User Customer ID
|
|
38
38
|
*/
|
|
39
|
-
getUserBookOrdersByMarketId(wallet: PublicKey, marketId: number, customerId
|
|
39
|
+
getUserBookOrdersByMarketId(wallet: PublicKey, marketId: number, customerId: number): Promise<import("./types").BookOrder[]>;
|
|
40
40
|
/**
|
|
41
41
|
* Deposit
|
|
42
42
|
* @param args.authority - Authority of the deposit
|
|
43
43
|
* @param args.amount - Amount to deposit
|
|
44
|
-
* @param args.refer - Referral public key
|
|
45
|
-
* @param args.customerId - Customer ID
|
|
44
|
+
* @param args.refer - Referral public key
|
|
45
|
+
* @param args.customerId - Customer ID
|
|
46
46
|
*/
|
|
47
47
|
deposit({ authority, amount, refer, customerId }: DepositArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
48
48
|
/**
|
|
@@ -56,7 +56,7 @@ export default class Predictor {
|
|
|
56
56
|
* Collect Rewards
|
|
57
57
|
* Claims accumulated TRIAD token rewards for the predictor.
|
|
58
58
|
* @param args.authority - Authority of the predictor
|
|
59
|
-
* @param args.customerId - Customer ID
|
|
59
|
+
* @param args.customerId - Customer ID
|
|
60
60
|
*/
|
|
61
61
|
collectRewards({ authority, customerId }: CollectRewardsArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
62
62
|
}
|
package/dist/predictor.js
CHANGED
|
@@ -12,7 +12,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
16
15
|
const bn_js_1 = __importDefault(require("bn.js"));
|
|
17
16
|
const constants_1 = require("./utils/constants");
|
|
18
17
|
const sendVersionedTransaction_1 = __importDefault(require("./utils/sendVersionedTransaction"));
|
|
@@ -26,9 +25,9 @@ class Predictor {
|
|
|
26
25
|
/**
|
|
27
26
|
* Get predictor
|
|
28
27
|
* @param authority - Authority public key
|
|
29
|
-
* @param customerId - Customer ID
|
|
28
|
+
* @param customerId - Customer ID
|
|
30
29
|
*/
|
|
31
|
-
getPredictor(authority, customerId
|
|
30
|
+
getPredictor(authority, customerId) {
|
|
32
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
32
|
const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, authority, customerId);
|
|
34
33
|
try {
|
|
@@ -52,7 +51,7 @@ class Predictor {
|
|
|
52
51
|
* Get User Orders
|
|
53
52
|
* @param wallet - User wallet PublicKey
|
|
54
53
|
*/
|
|
55
|
-
getUserOrders(wallet, customerId
|
|
54
|
+
getUserOrders(wallet, customerId) {
|
|
56
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
56
|
const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, wallet, customerId);
|
|
58
57
|
const orders = yield this.program.account.predictorOrder.all([
|
|
@@ -71,7 +70,7 @@ class Predictor {
|
|
|
71
70
|
* @param wallet - User wallet PublicKey
|
|
72
71
|
* @param marketId - The ID of the market
|
|
73
72
|
*/
|
|
74
|
-
getUserOrdersByMarketId(wallet, marketId, customerId
|
|
73
|
+
getUserOrdersByMarketId(wallet, marketId, customerId) {
|
|
75
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
75
|
const orders = yield this.getUserOrders(wallet, customerId);
|
|
77
76
|
return orders.filter((order) => order.marketId === marketId.toString());
|
|
@@ -82,7 +81,7 @@ class Predictor {
|
|
|
82
81
|
* @param wallet - User wallet PublicKey
|
|
83
82
|
* @param customerId - User Customer ID
|
|
84
83
|
*/
|
|
85
|
-
getUserBookOrders(wallet, customerId
|
|
84
|
+
getUserBookOrders(wallet, customerId) {
|
|
86
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87
86
|
const orderbooks = yield this.program.account.orderBook.all();
|
|
88
87
|
const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, wallet, customerId);
|
|
@@ -101,7 +100,7 @@ class Predictor {
|
|
|
101
100
|
* @param marketId - The ID of the market
|
|
102
101
|
* @param customerId - User Customer ID
|
|
103
102
|
*/
|
|
104
|
-
getUserBookOrdersByMarketId(wallet, marketId, customerId
|
|
103
|
+
getUserBookOrdersByMarketId(wallet, marketId, customerId) {
|
|
105
104
|
return __awaiter(this, void 0, void 0, function* () {
|
|
106
105
|
const orderBook = yield this.program.account.orderBook.fetch((0, pda_1.getOrderBookPDA)(this.program.programId, marketId), this.rpcOptions.commitment);
|
|
107
106
|
const orders = [...orderBook.hypeOrders, ...orderBook.flopOrders];
|
|
@@ -116,10 +115,10 @@ class Predictor {
|
|
|
116
115
|
* Deposit
|
|
117
116
|
* @param args.authority - Authority of the deposit
|
|
118
117
|
* @param args.amount - Amount to deposit
|
|
119
|
-
* @param args.refer - Referral public key
|
|
120
|
-
* @param args.customerId - Customer ID
|
|
118
|
+
* @param args.refer - Referral public key
|
|
119
|
+
* @param args.customerId - Customer ID
|
|
121
120
|
*/
|
|
122
|
-
deposit({ authority, amount, refer
|
|
121
|
+
deposit({ authority, amount, refer, customerId }) {
|
|
123
122
|
return __awaiter(this, void 0, void 0, function* () {
|
|
124
123
|
const ixs = [];
|
|
125
124
|
const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, authority, customerId);
|
|
@@ -154,7 +153,7 @@ class Predictor {
|
|
|
154
153
|
* @param args.amount - Amount to deposit
|
|
155
154
|
* @param args.customerId - Customer ID (optional) defaults to 7 from Triadmarkets
|
|
156
155
|
*/
|
|
157
|
-
withdraw({ authority, amount, customerId
|
|
156
|
+
withdraw({ authority, amount, customerId }) {
|
|
158
157
|
return __awaiter(this, void 0, void 0, function* () {
|
|
159
158
|
const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, authority, customerId);
|
|
160
159
|
const ixs = [
|
|
@@ -173,9 +172,9 @@ class Predictor {
|
|
|
173
172
|
* Collect Rewards
|
|
174
173
|
* Claims accumulated TRIAD token rewards for the predictor.
|
|
175
174
|
* @param args.authority - Authority of the predictor
|
|
176
|
-
* @param args.customerId - Customer ID
|
|
175
|
+
* @param args.customerId - Customer ID
|
|
177
176
|
*/
|
|
178
|
-
collectRewards({ authority, customerId
|
|
177
|
+
collectRewards({ authority, customerId }) {
|
|
179
178
|
return __awaiter(this, void 0, void 0, function* () {
|
|
180
179
|
const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, authority, customerId);
|
|
181
180
|
const ixs = [
|
package/dist/trade.js
CHANGED
|
@@ -67,7 +67,7 @@ class Trade {
|
|
|
67
67
|
* @param args.orders.price - The price of the Order
|
|
68
68
|
* @param args.orders.orderDirection - The direction of the Order
|
|
69
69
|
*/
|
|
70
|
-
placeBidOrder({ orders, customerId
|
|
70
|
+
placeBidOrder({ orders, customerId }) {
|
|
71
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
72
|
const ixs = [];
|
|
73
73
|
const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, this.program.provider.publicKey, customerId);
|
|
@@ -100,7 +100,7 @@ class Trade {
|
|
|
100
100
|
* @param args.orders.marketId - The Id from the market
|
|
101
101
|
* @param args.orders.orderDirection - The direction of the Order
|
|
102
102
|
*/
|
|
103
|
-
placeAskOrder({ orders, customerId
|
|
103
|
+
placeAskOrder({ orders, customerId }) {
|
|
104
104
|
return __awaiter(this, void 0, void 0, function* () {
|
|
105
105
|
const ixs = [];
|
|
106
106
|
const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, this.program.provider.publicKey, customerId);
|
|
@@ -129,7 +129,7 @@ class Trade {
|
|
|
129
129
|
* @param args.orders.marketId - The ID of the Market
|
|
130
130
|
* @param args.orders.orderDirection - The direction of the Order
|
|
131
131
|
*/
|
|
132
|
-
cancelBidOrder({ orders, customerId
|
|
132
|
+
cancelBidOrder({ orders, customerId }) {
|
|
133
133
|
return __awaiter(this, void 0, void 0, function* () {
|
|
134
134
|
const ixs = [];
|
|
135
135
|
for (const order of orders) {
|
|
@@ -157,7 +157,7 @@ class Trade {
|
|
|
157
157
|
* @param args.orders.bookOrderId - The ID of the Book Order
|
|
158
158
|
* @param args.orders.orderDirection - The direction of the Order
|
|
159
159
|
*/
|
|
160
|
-
cancelAskOrder({ orders, customerId
|
|
160
|
+
cancelAskOrder({ orders, customerId }) {
|
|
161
161
|
return __awaiter(this, void 0, void 0, function* () {
|
|
162
162
|
const ixs = [];
|
|
163
163
|
const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, this.program.provider.publicKey, customerId);
|
|
@@ -872,6 +872,22 @@
|
|
|
872
872
|
"writable": true,
|
|
873
873
|
"signer": true
|
|
874
874
|
},
|
|
875
|
+
{
|
|
876
|
+
"name": "customer",
|
|
877
|
+
"writable": true,
|
|
878
|
+
"pda": {
|
|
879
|
+
"seeds": [
|
|
880
|
+
{
|
|
881
|
+
"kind": "const",
|
|
882
|
+
"value": [99, 117, 115, 116, 111, 109, 101, 114]
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
"kind": "arg",
|
|
886
|
+
"path": "args.customer_id"
|
|
887
|
+
}
|
|
888
|
+
]
|
|
889
|
+
}
|
|
890
|
+
},
|
|
875
891
|
{
|
|
876
892
|
"name": "predictor",
|
|
877
893
|
"writable": true,
|
|
@@ -2958,6 +2974,10 @@
|
|
|
2958
2974
|
"name": "predictor",
|
|
2959
2975
|
"type": "pubkey"
|
|
2960
2976
|
},
|
|
2977
|
+
{
|
|
2978
|
+
"name": "customer_id",
|
|
2979
|
+
"type": "u16"
|
|
2980
|
+
},
|
|
2961
2981
|
{
|
|
2962
2982
|
"name": "amount",
|
|
2963
2983
|
"type": "u64"
|
|
@@ -4216,6 +4236,10 @@
|
|
|
4216
4236
|
"name": "predictor",
|
|
4217
4237
|
"type": "pubkey"
|
|
4218
4238
|
},
|
|
4239
|
+
{
|
|
4240
|
+
"name": "customer_id",
|
|
4241
|
+
"type": "u16"
|
|
4242
|
+
},
|
|
4219
4243
|
{
|
|
4220
4244
|
"name": "amount",
|
|
4221
4245
|
"type": "u64"
|
|
@@ -11,15 +11,15 @@ export type Predictor = {
|
|
|
11
11
|
export type DepositArgs = {
|
|
12
12
|
authority: PublicKey;
|
|
13
13
|
amount: number;
|
|
14
|
-
refer
|
|
15
|
-
customerId
|
|
14
|
+
refer: PublicKey;
|
|
15
|
+
customerId: number;
|
|
16
16
|
};
|
|
17
17
|
export type WithdrawArgs = {
|
|
18
18
|
authority: PublicKey;
|
|
19
19
|
amount: number;
|
|
20
|
-
customerId
|
|
20
|
+
customerId: number;
|
|
21
21
|
};
|
|
22
22
|
export type CollectRewardsArgs = {
|
|
23
23
|
authority: PublicKey;
|
|
24
|
-
customerId
|
|
24
|
+
customerId: number;
|
|
25
25
|
};
|
|
@@ -1133,6 +1133,22 @@ export type TriadProtocol = {
|
|
|
1133
1133
|
writable: true;
|
|
1134
1134
|
signer: true;
|
|
1135
1135
|
},
|
|
1136
|
+
{
|
|
1137
|
+
name: 'customer';
|
|
1138
|
+
writable: true;
|
|
1139
|
+
pda: {
|
|
1140
|
+
seeds: [
|
|
1141
|
+
{
|
|
1142
|
+
kind: 'const';
|
|
1143
|
+
value: [99, 117, 115, 116, 111, 109, 101, 114];
|
|
1144
|
+
},
|
|
1145
|
+
{
|
|
1146
|
+
kind: 'arg';
|
|
1147
|
+
path: 'args.customer_id';
|
|
1148
|
+
}
|
|
1149
|
+
];
|
|
1150
|
+
};
|
|
1151
|
+
},
|
|
1136
1152
|
{
|
|
1137
1153
|
name: 'predictor';
|
|
1138
1154
|
writable: true;
|
|
@@ -3582,6 +3598,10 @@ export type TriadProtocol = {
|
|
|
3582
3598
|
name: 'predictor';
|
|
3583
3599
|
type: 'pubkey';
|
|
3584
3600
|
},
|
|
3601
|
+
{
|
|
3602
|
+
name: 'customerId';
|
|
3603
|
+
type: 'u16';
|
|
3604
|
+
},
|
|
3585
3605
|
{
|
|
3586
3606
|
name: 'amount';
|
|
3587
3607
|
type: 'u64';
|
|
@@ -4840,6 +4860,10 @@ export type TriadProtocol = {
|
|
|
4840
4860
|
name: 'predictor';
|
|
4841
4861
|
type: 'pubkey';
|
|
4842
4862
|
},
|
|
4863
|
+
{
|
|
4864
|
+
name: 'customerId';
|
|
4865
|
+
type: 'u16';
|
|
4866
|
+
},
|
|
4843
4867
|
{
|
|
4844
4868
|
name: 'amount';
|
|
4845
4869
|
type: 'u64';
|