@carrot-protocol/boost-http-client 0.2.3-withdraw-jlp-dev-6a31381 → 0.2.3-withdraw-jlp-dev-6905a38
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.js +1 -5
- package/dist/types.d.ts +0 -1
- package/dist/utils.d.ts +1 -2
- package/dist/utils.js +0 -10
- package/package.json +1 -1
- package/src/index.ts +1 -6
- package/src/types.ts +0 -1
- package/src/utils.ts +0 -8
package/dist/index.js
CHANGED
|
@@ -21,7 +21,6 @@ exports.Client = void 0;
|
|
|
21
21
|
const axios_1 = __importDefault(require("axios"));
|
|
22
22
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
23
23
|
const bs58_1 = __importDefault(require("bs58"));
|
|
24
|
-
const utils_1 = require("./utils");
|
|
25
24
|
// Re-export types
|
|
26
25
|
__exportStar(require("./types"), exports);
|
|
27
26
|
__exportStar(require("./utils"), exports);
|
|
@@ -143,8 +142,6 @@ class Client {
|
|
|
143
142
|
closeBalance = Boolean(event.closeBalance);
|
|
144
143
|
}
|
|
145
144
|
// parse amount
|
|
146
|
-
const amount = event.amount ? new anchor_1.BN(event.amount, "hex") : null;
|
|
147
|
-
const amountUi = amount !== null ? (0, utils_1.amountToUi)(amount, 6) : null;
|
|
148
145
|
const clendAccountEvent = {
|
|
149
146
|
txSig: event.txSig,
|
|
150
147
|
eventIndex: event.eventIndex,
|
|
@@ -156,8 +153,7 @@ class Client {
|
|
|
156
153
|
clendGroup: new anchor_1.web3.PublicKey(event.clendGroup),
|
|
157
154
|
bank: event.bank ? new anchor_1.web3.PublicKey(event.bank) : null,
|
|
158
155
|
mint: event.mint ? new anchor_1.web3.PublicKey(event.mint) : null,
|
|
159
|
-
amount,
|
|
160
|
-
amountUi,
|
|
156
|
+
amount: event.amount ? new anchor_1.BN(event.amount, "hex") : null,
|
|
161
157
|
closeBalance,
|
|
162
158
|
};
|
|
163
159
|
events.push(clendAccountEvent);
|
package/dist/types.d.ts
CHANGED
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { web3 } from "@coral-xyz/anchor";
|
|
2
2
|
import { ClendAccount } from "./types";
|
|
3
|
-
export declare function amountToUi(amount: BN | number, decimals: number): number;
|
|
4
3
|
export declare function netValueInToken(clendAccount: ClendAccount, tokenMint: web3.PublicKey): number;
|
package/dist/utils.js
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.amountToUi = amountToUi;
|
|
4
3
|
exports.netValueInToken = netValueInToken;
|
|
5
|
-
const anchor_1 = require("@coral-xyz/anchor");
|
|
6
|
-
function amountToUi(amount, decimals) {
|
|
7
|
-
if (amount instanceof anchor_1.BN) {
|
|
8
|
-
return Number(amount.toNumber() / 10 ** decimals);
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
return Number(amount / 10 ** decimals);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
4
|
// returns the net value of the clend account in a given tokens price
|
|
15
5
|
function netValueInToken(clendAccount, tokenMint) {
|
|
16
6
|
const clendAccountTokenBalance = clendAccount.balances.find((balance) => balance.mint.equals(tokenMint));
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
GetUserRequest,
|
|
20
20
|
} from "./types";
|
|
21
21
|
import encode from "bs58";
|
|
22
|
-
import { amountToUi } from "./utils";
|
|
23
22
|
|
|
24
23
|
// Re-export types
|
|
25
24
|
export * from "./types";
|
|
@@ -178,9 +177,6 @@ export class Client {
|
|
|
178
177
|
}
|
|
179
178
|
|
|
180
179
|
// parse amount
|
|
181
|
-
const amount = event.amount ? new BN(event.amount, "hex") : null;
|
|
182
|
-
const amountUi = amount !== null ? amountToUi(amount, 6) : null;
|
|
183
|
-
|
|
184
180
|
const clendAccountEvent: ClendAccountEvent = {
|
|
185
181
|
txSig: event.txSig,
|
|
186
182
|
eventIndex: event.eventIndex,
|
|
@@ -192,8 +188,7 @@ export class Client {
|
|
|
192
188
|
clendGroup: new web3.PublicKey(event.clendGroup),
|
|
193
189
|
bank: event.bank ? new web3.PublicKey(event.bank) : null,
|
|
194
190
|
mint: event.mint ? new web3.PublicKey(event.mint) : null,
|
|
195
|
-
amount,
|
|
196
|
-
amountUi,
|
|
191
|
+
amount: event.amount ? new BN(event.amount, "hex") : null,
|
|
197
192
|
closeBalance,
|
|
198
193
|
};
|
|
199
194
|
events.push(clendAccountEvent);
|
package/src/types.ts
CHANGED
package/src/utils.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { BN, web3 } from "@coral-xyz/anchor";
|
|
2
2
|
import { ClendAccount } from "./types";
|
|
3
3
|
|
|
4
|
-
export function amountToUi(amount: BN | number, decimals: number): number {
|
|
5
|
-
if (amount instanceof BN) {
|
|
6
|
-
return Number(amount.toNumber() / 10 ** decimals);
|
|
7
|
-
} else {
|
|
8
|
-
return Number(amount / 10 ** decimals);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
4
|
// returns the net value of the clend account in a given tokens price
|
|
13
5
|
export function netValueInToken(
|
|
14
6
|
clendAccount: ClendAccount,
|