@triadxyz/triad-protocol 2.5.6-beta → 2.5.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/index.d.ts
CHANGED
|
@@ -61,16 +61,7 @@ export default class TriadProtocolClient {
|
|
|
61
61
|
* @param wallet - The wallet address of the customer
|
|
62
62
|
*
|
|
63
63
|
*/
|
|
64
|
-
getCustomerByWallet(wallet: PublicKey): Promise<import("
|
|
65
|
-
bump: number;
|
|
66
|
-
id: number;
|
|
67
|
-
authority: PublicKey;
|
|
68
|
-
name: string;
|
|
69
|
-
feeRecipient: PublicKey;
|
|
70
|
-
feeBps: number;
|
|
71
|
-
isVerified: boolean;
|
|
72
|
-
padding: number[];
|
|
73
|
-
}>>;
|
|
64
|
+
getCustomerByWallet(wallet: PublicKey): Promise<import("./types").Customer>;
|
|
74
65
|
/**
|
|
75
66
|
* Get Refer By Wallet Address
|
|
76
67
|
* @param wallet - The wallet address of the refer
|
|
@@ -337,7 +328,7 @@ export default class TriadProtocolClient {
|
|
|
337
328
|
* @param options - RPC options
|
|
338
329
|
*
|
|
339
330
|
*/
|
|
340
|
-
createCustomer({ id, name, authority, feeRecipient,
|
|
331
|
+
createCustomer({ id, name, authority, feeRecipient, isStaked }: CreateCustomerArgs, options?: RpcOptions): Promise<string>;
|
|
341
332
|
/**
|
|
342
333
|
* Get User Trade Nonce With Slots
|
|
343
334
|
* @param userTrades - User Trades
|
package/dist/index.js
CHANGED
|
@@ -152,7 +152,7 @@ class TriadProtocolClient {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
]);
|
|
155
|
-
return customer;
|
|
155
|
+
return (0, helpers_1.formatCustomer)(customer.account, customer.publicKey);
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
@@ -575,15 +575,15 @@ class TriadProtocolClient {
|
|
|
575
575
|
* @param options - RPC options
|
|
576
576
|
*
|
|
577
577
|
*/
|
|
578
|
-
createCustomer({ id, name, authority, feeRecipient,
|
|
578
|
+
createCustomer({ id, name, authority, feeRecipient, isStaked }, options) {
|
|
579
579
|
return __awaiter(this, void 0, void 0, function* () {
|
|
580
580
|
const ixs = [];
|
|
581
581
|
let stakePDA = null;
|
|
582
|
-
if (
|
|
582
|
+
if (isStaked) {
|
|
583
583
|
stakePDA = (0, stake_2.getStakePDA)(this.program.programId, this.program.provider.publicKey);
|
|
584
584
|
}
|
|
585
585
|
ixs.push(yield this.program.methods
|
|
586
|
-
.createCustomer({ id, name, authority, feeRecipient
|
|
586
|
+
.createCustomer({ id, name, authority, feeRecipient })
|
|
587
587
|
.accounts({
|
|
588
588
|
signer: this.program.provider.publicKey,
|
|
589
589
|
stake: stakePDA
|
package/dist/types/index.d.ts
CHANGED
|
@@ -144,7 +144,7 @@ export type CreateCustomerArgs = {
|
|
|
144
144
|
authority: PublicKey;
|
|
145
145
|
feeRecipient: PublicKey;
|
|
146
146
|
feeBps: number;
|
|
147
|
-
|
|
147
|
+
isStaked: boolean;
|
|
148
148
|
};
|
|
149
149
|
export type OpenOrderArgs = {
|
|
150
150
|
marketId: number;
|
|
@@ -238,3 +238,12 @@ export type Refer = {
|
|
|
238
238
|
feeBps: number;
|
|
239
239
|
feeClaimed: number;
|
|
240
240
|
};
|
|
241
|
+
export type Customer = {
|
|
242
|
+
id: number;
|
|
243
|
+
authority: string;
|
|
244
|
+
name: string;
|
|
245
|
+
feeRecipient: string;
|
|
246
|
+
feeBps: number;
|
|
247
|
+
isVerified: boolean;
|
|
248
|
+
address: string;
|
|
249
|
+
};
|
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { IdlAccounts } from '@coral-xyz/anchor';
|
|
3
3
|
import { Stake, StakeVault, Unstake } from './../types/stake';
|
|
4
|
-
import { Market, Order, OrderDirection, OrderSide, OrderStatus, OrderType, UserTrade, Pool, BookOrder, Refer } from '../types';
|
|
4
|
+
import { Market, Order, OrderDirection, OrderSide, OrderStatus, OrderType, UserTrade, Pool, BookOrder, Refer, Customer } from '../types';
|
|
5
5
|
import { TriadProtocol } from '../types/triad_protocol';
|
|
6
6
|
export declare const encodeString: (value: string, alloc?: number) => number[];
|
|
7
7
|
export declare const decodeString: (bytes: number[]) => string;
|
|
@@ -46,3 +46,4 @@ export declare const getOrderStatus: (status: {
|
|
|
46
46
|
waiting: {};
|
|
47
47
|
}) => OrderStatus;
|
|
48
48
|
export declare const formatRefer: (account: IdlAccounts<TriadProtocol>['refer']) => Refer;
|
|
49
|
+
export declare const formatCustomer: (account: IdlAccounts<TriadProtocol>['customer'], publicKey: PublicKey) => Customer;
|
package/dist/utils/helpers.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatRefer = exports.getOrderStatus = exports.getOrderSide = exports.getOrderType = exports.getOrderSideFromNumber = exports.getOrderDirectionFromNumber = exports.getOrderDirection = exports.getTokenProgram = exports.calculateStakeRewards = exports.formatBookOrder = exports.formatOrder = exports.formatUserTrade = exports.formatMarket = exports.formatPool = exports.formatUnstake = exports.formatStake = exports.formatStakeVault = exports.decodeString = exports.encodeString = void 0;
|
|
3
|
+
exports.formatCustomer = exports.formatRefer = exports.getOrderStatus = exports.getOrderSide = exports.getOrderType = exports.getOrderSideFromNumber = exports.getOrderDirectionFromNumber = exports.getOrderDirection = exports.getTokenProgram = exports.calculateStakeRewards = exports.formatBookOrder = exports.formatOrder = exports.formatUserTrade = exports.formatMarket = exports.formatPool = exports.formatUnstake = exports.formatStake = exports.formatStakeVault = exports.decodeString = exports.encodeString = void 0;
|
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
5
|
const spl_token_1 = require("@solana/spl-token");
|
|
6
6
|
const types_1 = require("../types");
|
|
@@ -235,3 +235,15 @@ const formatRefer = (account) => {
|
|
|
235
235
|
};
|
|
236
236
|
};
|
|
237
237
|
exports.formatRefer = formatRefer;
|
|
238
|
+
const formatCustomer = (account, publicKey) => {
|
|
239
|
+
return {
|
|
240
|
+
id: account.id,
|
|
241
|
+
authority: publicKey.toString(),
|
|
242
|
+
name: account.name,
|
|
243
|
+
feeRecipient: account.feeRecipient.toString(),
|
|
244
|
+
feeBps: account.feeBps,
|
|
245
|
+
isVerified: account.isVerified,
|
|
246
|
+
address: publicKey.toString()
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
exports.formatCustomer = formatCustomer;
|