@triadxyz/triad-protocol 1.8.6-beta → 1.8.8-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/trade.d.ts +2 -2
- package/dist/trade.js +2 -6
- package/dist/types/idl_triad_protocol.json +8 -53
- package/dist/types/trade.d.ts +1 -2
- package/dist/types/triad_protocol.d.ts +5 -108
- package/dist/utils/helpers.js +0 -1
- package/dist/utils/pda/trade.d.ts +1 -1
- package/dist/utils/pda/trade.js +2 -2
- package/package.json +1 -1
package/dist/trade.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export default class Trade {
|
|
|
50
50
|
authority: PublicKey;
|
|
51
51
|
totalDeposits: BN;
|
|
52
52
|
totalWithdraws: BN;
|
|
53
|
-
|
|
53
|
+
padding2: number[];
|
|
54
54
|
orders: {
|
|
55
55
|
ts: BN;
|
|
56
56
|
orderId: BN;
|
|
@@ -157,7 +157,7 @@ export default class Trade {
|
|
|
157
157
|
* @param options - RPC options
|
|
158
158
|
*
|
|
159
159
|
*/
|
|
160
|
-
createMarket({ marketId, startTime, endTime, question, feeBps,
|
|
160
|
+
createMarket({ marketId, startTime, endTime, question, feeBps, customer, payoutFee, mint }: CreateMarketArgs, options?: RpcOptions): Promise<string>;
|
|
161
161
|
/**
|
|
162
162
|
* Open Order
|
|
163
163
|
* @param args.marketId - The ID of the Market
|
package/dist/trade.js
CHANGED
|
@@ -119,15 +119,11 @@ class Trade {
|
|
|
119
119
|
* @param options - RPC options
|
|
120
120
|
*
|
|
121
121
|
*/
|
|
122
|
-
createMarket({ marketId, startTime, endTime, question, feeBps,
|
|
122
|
+
createMarket({ marketId, startTime, endTime, question, feeBps, customer, payoutFee, mint }, options) {
|
|
123
123
|
return __awaiter(this, void 0, void 0, function* () {
|
|
124
124
|
if (question.length > 80) {
|
|
125
125
|
throw new Error('Question must be less than 80 characters');
|
|
126
126
|
}
|
|
127
|
-
let customerPDA = null;
|
|
128
|
-
if (customerId) {
|
|
129
|
-
customerPDA = (0, trade_2.getCustomerPDA)(this.program.programId, customerId);
|
|
130
|
-
}
|
|
131
127
|
return (0, sendTransactionWithOptions_1.default)(this.program.methods
|
|
132
128
|
.createMarket({
|
|
133
129
|
marketId: new bn_js_1.default(marketId),
|
|
@@ -141,7 +137,7 @@ class Trade {
|
|
|
141
137
|
signer: this.provider.publicKey,
|
|
142
138
|
mint,
|
|
143
139
|
tokenProgram: (0, helpers_1.getTokenProgram)(mint),
|
|
144
|
-
customer
|
|
140
|
+
customer
|
|
145
141
|
}), options);
|
|
146
142
|
});
|
|
147
143
|
}
|
|
@@ -856,7 +856,8 @@
|
|
|
856
856
|
},
|
|
857
857
|
{
|
|
858
858
|
"name": "squads",
|
|
859
|
-
"writable": true
|
|
859
|
+
"writable": true,
|
|
860
|
+
"address": "6fcSf6qfwPNR9AUUNC1UWYZDy5cQ4TzTb2aaipN2zFdq"
|
|
860
861
|
},
|
|
861
862
|
{
|
|
862
863
|
"name": "seller_authority",
|
|
@@ -880,59 +881,11 @@
|
|
|
880
881
|
},
|
|
881
882
|
{
|
|
882
883
|
"name": "user_from_ata",
|
|
883
|
-
"writable": true
|
|
884
|
-
"pda": {
|
|
885
|
-
"seeds": [
|
|
886
|
-
{
|
|
887
|
-
"kind": "account",
|
|
888
|
-
"path": "signer"
|
|
889
|
-
},
|
|
890
|
-
{
|
|
891
|
-
"kind": "account",
|
|
892
|
-
"path": "token_program"
|
|
893
|
-
},
|
|
894
|
-
{
|
|
895
|
-
"kind": "account",
|
|
896
|
-
"path": "mint"
|
|
897
|
-
}
|
|
898
|
-
],
|
|
899
|
-
"program": {
|
|
900
|
-
"kind": "const",
|
|
901
|
-
"value": [
|
|
902
|
-
140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
|
|
903
|
-
13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
|
|
904
|
-
219, 233, 248, 89
|
|
905
|
-
]
|
|
906
|
-
}
|
|
907
|
-
}
|
|
884
|
+
"writable": true
|
|
908
885
|
},
|
|
909
886
|
{
|
|
910
887
|
"name": "market_to_ata",
|
|
911
|
-
"writable": true
|
|
912
|
-
"pda": {
|
|
913
|
-
"seeds": [
|
|
914
|
-
{
|
|
915
|
-
"kind": "account",
|
|
916
|
-
"path": "market"
|
|
917
|
-
},
|
|
918
|
-
{
|
|
919
|
-
"kind": "account",
|
|
920
|
-
"path": "token_program"
|
|
921
|
-
},
|
|
922
|
-
{
|
|
923
|
-
"kind": "account",
|
|
924
|
-
"path": "mint"
|
|
925
|
-
}
|
|
926
|
-
],
|
|
927
|
-
"program": {
|
|
928
|
-
"kind": "const",
|
|
929
|
-
"value": [
|
|
930
|
-
140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
|
|
931
|
-
13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
|
|
932
|
-
219, 233, 248, 89
|
|
933
|
-
]
|
|
934
|
-
}
|
|
935
|
-
}
|
|
888
|
+
"writable": true
|
|
936
889
|
},
|
|
937
890
|
{
|
|
938
891
|
"name": "seller_to_ata",
|
|
@@ -3208,8 +3161,10 @@
|
|
|
3208
3161
|
"type": "u64"
|
|
3209
3162
|
},
|
|
3210
3163
|
{
|
|
3211
|
-
"name": "
|
|
3212
|
-
"type":
|
|
3164
|
+
"name": "padding_2",
|
|
3165
|
+
"type": {
|
|
3166
|
+
"array": ["u8", 8]
|
|
3167
|
+
}
|
|
3213
3168
|
},
|
|
3214
3169
|
{
|
|
3215
3170
|
"name": "orders",
|
package/dist/types/trade.d.ts
CHANGED
|
@@ -33,7 +33,6 @@ export type UserTrade = {
|
|
|
33
33
|
user: string;
|
|
34
34
|
totalDeposits: string;
|
|
35
35
|
totalWithdraws: string;
|
|
36
|
-
openedOrders: string;
|
|
37
36
|
orders: Order[];
|
|
38
37
|
nonce: string;
|
|
39
38
|
poseidon: string;
|
|
@@ -142,7 +141,7 @@ export type CreateMarketArgs = {
|
|
|
142
141
|
endTime: number;
|
|
143
142
|
question: string;
|
|
144
143
|
feeBps: number;
|
|
145
|
-
|
|
144
|
+
customer: PublicKey | null;
|
|
146
145
|
payoutFee: number;
|
|
147
146
|
mint: PublicKey;
|
|
148
147
|
};
|
|
@@ -1182,6 +1182,7 @@ export type TriadProtocol = {
|
|
|
1182
1182
|
{
|
|
1183
1183
|
name: 'squads';
|
|
1184
1184
|
writable: true;
|
|
1185
|
+
address: '6fcSf6qfwPNR9AUUNC1UWYZDy5cQ4TzTb2aaipN2zFdq';
|
|
1185
1186
|
},
|
|
1186
1187
|
{
|
|
1187
1188
|
name: 'sellerAuthority';
|
|
@@ -1206,116 +1207,10 @@ export type TriadProtocol = {
|
|
|
1206
1207
|
{
|
|
1207
1208
|
name: 'userFromAta';
|
|
1208
1209
|
writable: true;
|
|
1209
|
-
pda: {
|
|
1210
|
-
seeds: [
|
|
1211
|
-
{
|
|
1212
|
-
kind: 'account';
|
|
1213
|
-
path: 'signer';
|
|
1214
|
-
},
|
|
1215
|
-
{
|
|
1216
|
-
kind: 'account';
|
|
1217
|
-
path: 'tokenProgram';
|
|
1218
|
-
},
|
|
1219
|
-
{
|
|
1220
|
-
kind: 'account';
|
|
1221
|
-
path: 'mint';
|
|
1222
|
-
}
|
|
1223
|
-
];
|
|
1224
|
-
program: {
|
|
1225
|
-
kind: 'const';
|
|
1226
|
-
value: [
|
|
1227
|
-
140,
|
|
1228
|
-
151,
|
|
1229
|
-
37,
|
|
1230
|
-
143,
|
|
1231
|
-
78,
|
|
1232
|
-
36,
|
|
1233
|
-
137,
|
|
1234
|
-
241,
|
|
1235
|
-
187,
|
|
1236
|
-
61,
|
|
1237
|
-
16,
|
|
1238
|
-
41,
|
|
1239
|
-
20,
|
|
1240
|
-
142,
|
|
1241
|
-
13,
|
|
1242
|
-
131,
|
|
1243
|
-
11,
|
|
1244
|
-
90,
|
|
1245
|
-
19,
|
|
1246
|
-
153,
|
|
1247
|
-
218,
|
|
1248
|
-
255,
|
|
1249
|
-
16,
|
|
1250
|
-
132,
|
|
1251
|
-
4,
|
|
1252
|
-
142,
|
|
1253
|
-
123,
|
|
1254
|
-
216,
|
|
1255
|
-
219,
|
|
1256
|
-
233,
|
|
1257
|
-
248,
|
|
1258
|
-
89
|
|
1259
|
-
];
|
|
1260
|
-
};
|
|
1261
|
-
};
|
|
1262
1210
|
},
|
|
1263
1211
|
{
|
|
1264
1212
|
name: 'marketToAta';
|
|
1265
1213
|
writable: true;
|
|
1266
|
-
pda: {
|
|
1267
|
-
seeds: [
|
|
1268
|
-
{
|
|
1269
|
-
kind: 'account';
|
|
1270
|
-
path: 'market';
|
|
1271
|
-
},
|
|
1272
|
-
{
|
|
1273
|
-
kind: 'account';
|
|
1274
|
-
path: 'tokenProgram';
|
|
1275
|
-
},
|
|
1276
|
-
{
|
|
1277
|
-
kind: 'account';
|
|
1278
|
-
path: 'mint';
|
|
1279
|
-
}
|
|
1280
|
-
];
|
|
1281
|
-
program: {
|
|
1282
|
-
kind: 'const';
|
|
1283
|
-
value: [
|
|
1284
|
-
140,
|
|
1285
|
-
151,
|
|
1286
|
-
37,
|
|
1287
|
-
143,
|
|
1288
|
-
78,
|
|
1289
|
-
36,
|
|
1290
|
-
137,
|
|
1291
|
-
241,
|
|
1292
|
-
187,
|
|
1293
|
-
61,
|
|
1294
|
-
16,
|
|
1295
|
-
41,
|
|
1296
|
-
20,
|
|
1297
|
-
142,
|
|
1298
|
-
13,
|
|
1299
|
-
131,
|
|
1300
|
-
11,
|
|
1301
|
-
90,
|
|
1302
|
-
19,
|
|
1303
|
-
153,
|
|
1304
|
-
218,
|
|
1305
|
-
255,
|
|
1306
|
-
16,
|
|
1307
|
-
132,
|
|
1308
|
-
4,
|
|
1309
|
-
142,
|
|
1310
|
-
123,
|
|
1311
|
-
216,
|
|
1312
|
-
219,
|
|
1313
|
-
233,
|
|
1314
|
-
248,
|
|
1315
|
-
89
|
|
1316
|
-
];
|
|
1317
|
-
};
|
|
1318
|
-
};
|
|
1319
1214
|
},
|
|
1320
1215
|
{
|
|
1321
1216
|
name: 'sellerToAta';
|
|
@@ -3968,8 +3863,10 @@ export type TriadProtocol = {
|
|
|
3968
3863
|
type: 'u64';
|
|
3969
3864
|
},
|
|
3970
3865
|
{
|
|
3971
|
-
name: '
|
|
3972
|
-
type:
|
|
3866
|
+
name: 'padding2';
|
|
3867
|
+
type: {
|
|
3868
|
+
array: ['u8', 8];
|
|
3869
|
+
};
|
|
3973
3870
|
},
|
|
3974
3871
|
{
|
|
3975
3872
|
name: 'orders';
|
package/dist/utils/helpers.js
CHANGED
|
@@ -113,7 +113,6 @@ const formatUserTrade = (account, publicKey) => {
|
|
|
113
113
|
user: publicKey.toString(),
|
|
114
114
|
totalDeposits: account.totalDeposits.toString(),
|
|
115
115
|
totalWithdraws: account.totalWithdraws.toString(),
|
|
116
|
-
openedOrders: account.openedOrders.toString(),
|
|
117
116
|
orders: account.orders.map((order) => (0, exports.formatOrder)(order, account.authority.toString())),
|
|
118
117
|
nonce: account.nonce.toString(),
|
|
119
118
|
poseidon: account.poseidon ? account.poseidon.toString() : '',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
|
2
2
|
export declare const getMarketPDA: (programId: PublicKey, marketId: number) => PublicKey;
|
|
3
|
-
export declare const getCustomerPDA: (programId: PublicKey,
|
|
3
|
+
export declare const getCustomerPDA: (programId: PublicKey, customerId: number) => PublicKey;
|
|
4
4
|
export declare const getUserTradePDA: (programId: PublicKey, wallet: PublicKey) => PublicKey;
|
|
5
5
|
export declare const getSubUserTradePDA: (programId: PublicKey, wallet: PublicKey, nonce: number) => PublicKey;
|
package/dist/utils/pda/trade.js
CHANGED
|
@@ -10,8 +10,8 @@ const getMarketPDA = (programId, marketId) => {
|
|
|
10
10
|
return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('market'), new bn_js_1.default(marketId).toArrayLike(Buffer, 'le', 8)], programId)[0];
|
|
11
11
|
};
|
|
12
12
|
exports.getMarketPDA = getMarketPDA;
|
|
13
|
-
const getCustomerPDA = (programId,
|
|
14
|
-
return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('customer'), new bn_js_1.default(
|
|
13
|
+
const getCustomerPDA = (programId, customerId) => {
|
|
14
|
+
return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('customer'), new bn_js_1.default(customerId).toArrayLike(Buffer, 'le', 8)], programId)[0];
|
|
15
15
|
};
|
|
16
16
|
exports.getCustomerPDA = getCustomerPDA;
|
|
17
17
|
const getUserTradePDA = (programId, wallet) => {
|