@renec-foundation/escrow-sdk
Advanced tools
Comparing version
@@ -122,3 +122,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let tradeVersion = (0, helpers_1.getVersionFromOfferId)(tradeId, version); | ||
let tradeVersion = (0, helpers_1.getVersionFromTradeId)(tradeId, version); | ||
if ((0, lodash_1.isEqual)(tradeVersion, types_1.Version.V0) && this.fetcherV0) { | ||
@@ -242,3 +242,3 @@ yield this.fetcherV0.refreshAll(); | ||
console.log(`Version: ${types_1.Version.V1} --> Make offer`); | ||
const minTradeSizeU64 = (0, index_1.getMinTradeSize)(minTradeSize); | ||
const minTradeSizeU64 = (0, index_1.getMinTradeSize)(tokenAmount, minTradeSize); | ||
return yield index_1.OfferClient.makeOffer((0, utils_1.getContextV1)(this.fetcherV1.connection, wallet, this.pubkeyV1), this.marketIdV1, this.configIdV1, side, wallet.publicKey, tokenMint, bondType, minTradeSizeU64, tokenAmount, rate, fiatCurrency, encryptedBankName, encryptedAccountNumber, encryptedAccountName, nonce); | ||
@@ -245,0 +245,0 @@ }); |
@@ -5,4 +5,4 @@ "use strict"; | ||
const anchor_1 = require("@project-serum/anchor"); | ||
exports.START_OFFER_ID = new anchor_1.BN(1000); | ||
exports.START_TRADE_ID = new anchor_1.BN(1500); | ||
exports.START_OFFER_ID = new anchor_1.BN(11000); | ||
exports.START_TRADE_ID = new anchor_1.BN(9000); | ||
exports.SCALE_EXPO = 9; // using for rate and fiat amount |
import Decimal from "decimal.js"; | ||
import { u64 } from "@solana/spl-token"; | ||
export declare const getMinTradeSize: (minTradeSize: Decimal) => u64; | ||
import { BN } from "@project-serum/anchor"; | ||
export declare const getMinTradeSize: (totalAmount: BN, minTradeSizeInPercentage: Decimal) => u64; |
@@ -6,6 +6,8 @@ "use strict"; | ||
const common_sdk_1 = require("@orca-so/common-sdk"); | ||
const getMinTradeSize = (minTradeSize) => { | ||
const mulipliedTradesize = minTradeSize.mul(_1.DENOMINATOR); | ||
return common_sdk_1.DecimalUtil.toU64(mulipliedTradesize); | ||
const anchor_1 = require("@project-serum/anchor"); | ||
const getMinTradeSize = (totalAmount, minTradeSizeInPercentage) => { | ||
const multipliedTradeSizeInPercentage = common_sdk_1.DecimalUtil.toU64(minTradeSizeInPercentage.mul(_1.DENOMINATOR)); | ||
const denominatorBN = new anchor_1.BN(_1.DENOMINATOR); | ||
return totalAmount.mul(multipliedTradeSizeInPercentage).div(denominatorBN); | ||
}; | ||
exports.getMinTradeSize = getMinTradeSize; |
{ | ||
"name": "@renec-foundation/escrow-sdk", | ||
"version": "5.0.3-alpha", | ||
"version": "5.0.4-alpha", | ||
"description": "Typescript SDK to interact with Escrow program.", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
Sorry, the diff of this file is not supported yet
582039
0.05%13826
0.02%