@renec-foundation/escrow-sdk
Advanced tools
Comparing version 7.0.3-alpha to 7.0.4-alpha
@@ -9,3 +9,2 @@ /// <reference types="bn.js" /> | ||
import { TransactionBuilder } from "@orca-so/common-sdk"; | ||
import Decimal from "decimal.js"; | ||
export declare class EscrowRouter { | ||
@@ -49,3 +48,3 @@ pubkeyV0?: PublicKey; | ||
* @param bondType type of bond. Can either be Spl or Native. Use "BondType" value from sdk | ||
* @param minTradeSize minimum size of trade can be created from the offer. Should be between "0.2" and "1" | ||
* @param minTradeSize minimum size of trade can be created from the offer (in spl raw amount) | ||
* @param tokenAmount total amount of token that user want to create offer with | ||
@@ -55,3 +54,3 @@ * @param fiatAmount equivalent number of fiat amount | ||
*/ | ||
makeOffer(wallet: Wallet, tokenMint: PublicKey, side: object, bondType: object, minTradeSize: Decimal, tokenAmount: BN, rate: number, fiatCurrency: string, paymentMethod: string | null, encryptedPaymentInfoData: string | null, nonce: string | null): Promise<{ | ||
makeOffer(wallet: Wallet, tokenMint: PublicKey, side: object, bondType: object, minTradeSize: BN, tokenAmount: BN, rate: number, fiatCurrency: string, paymentMethod: string | null, encryptedPaymentInfoData: string | null, nonce: string | null): Promise<{ | ||
tx: TransactionBuilder; | ||
@@ -58,0 +57,0 @@ id: BN; |
@@ -233,3 +233,3 @@ "use strict"; | ||
* @param bondType type of bond. Can either be Spl or Native. Use "BondType" value from sdk | ||
* @param minTradeSize minimum size of trade can be created from the offer. Should be between "0.2" and "1" | ||
* @param minTradeSize minimum size of trade can be created from the offer (in spl raw amount) | ||
* @param tokenAmount total amount of token that user want to create offer with | ||
@@ -242,4 +242,3 @@ * @param fiatAmount equivalent number of fiat amount | ||
console.log(`Version: ${types_1.Version.V1} --> Make offer`); | ||
const minTradeSizeU64 = (0, index_1.getMinTradeSize)(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, paymentMethod, encryptedPaymentInfoData, nonce); | ||
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, minTradeSize, tokenAmount, rate, fiatCurrency, paymentMethod, encryptedPaymentInfoData, nonce); | ||
}); | ||
@@ -246,0 +245,0 @@ } |
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": "7.0.3-alpha", | ||
"version": "7.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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
578639
13715