@pontem/liquidswap-sdk
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -96,7 +96,10 @@ "use strict"; | ||
} | ||
const { modules } = this.sdk.networkOptions; | ||
const isUnchecked = params.version === constants_1.VERSION_0 && | ||
const { moduleAccountV05, moduleAccount } = this.sdk.networkOptions; | ||
const { version = constants_1.VERSION_0 } = params; | ||
const isUnchecked = version === constants_1.VERSION_0 && | ||
params.curveType === 'stable' && | ||
params.stableSwapType === 'normal'; | ||
const functionName = (0, utils_1.composeType)(modules.Scripts, isUnchecked | ||
const scriptsVersion = (0, contracts_1.getScriptsFor)(version); | ||
const moduleAcc = version === constants_1.VERSION_0_5 ? moduleAccountV05 : moduleAccount; | ||
const functionName = (0, utils_1.composeType)(moduleAcc, scriptsVersion, isUnchecked | ||
? 'swap_unchecked' | ||
@@ -106,3 +109,3 @@ : params.interactiveToken === 'from' | ||
: 'swap_into'); | ||
const curve = (0, contracts_1.getCurve)(params.curveType, curves, params.version); | ||
const curve = (0, contracts_1.getCurve)(params.curveType, curves, version); | ||
const typeArguments = [params.fromToken, params.toToken, curve]; | ||
@@ -109,0 +112,0 @@ const fromAmount = params.interactiveToken === 'from' |
{ | ||
"name": "@pontem/liquidswap-sdk", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "SDK to use LiquidSwap functions", | ||
@@ -5,0 +5,0 @@ "author": "Igor Demko <igor@pontem.network>", |
import Decimal from 'decimal.js'; | ||
import {SDK} from '../sdk'; | ||
import {IModule} from '../interfaces/IModule'; | ||
import {AptosCoinInfoResource, AptosPoolResource, AptosResourceType, CurveType, TAptosTxPayload,} from '../types/aptos'; | ||
import { SDK } from '../sdk'; | ||
import { IModule } from '../interfaces/IModule'; | ||
import { AptosCoinInfoResource, AptosPoolResource, AptosResourceType, CurveType, TAptosTxPayload } from '../types/aptos'; | ||
import { | ||
@@ -18,3 +18,3 @@ composeType, | ||
import { VERSION_0, VERSION_0_5 } from "../constants"; | ||
import { getCurve } from "../utils/contracts"; | ||
import { getCurve, getScriptsFor } from "../utils/contracts"; | ||
@@ -171,14 +171,16 @@ export type CalculateRatesParams = { | ||
const { modules } = this.sdk.networkOptions; | ||
const { moduleAccountV05, moduleAccount } = this.sdk.networkOptions; | ||
const { version = VERSION_0 } = params; | ||
const isUnchecked = | ||
params.version === VERSION_0 && | ||
version === VERSION_0 && | ||
params.curveType === 'stable' && | ||
params.stableSwapType === 'normal'; | ||
const scriptsVersion = getScriptsFor(version); | ||
const moduleAcc = version === VERSION_0_5 ? moduleAccountV05 : moduleAccount; | ||
const functionName = composeType( | ||
modules.Scripts, | ||
moduleAcc, | ||
scriptsVersion, | ||
isUnchecked | ||
@@ -191,3 +193,3 @@ ? 'swap_unchecked' | ||
const curve = getCurve(params.curveType, curves, params.version); | ||
const curve = getCurve(params.curveType, curves, version); | ||
@@ -194,0 +196,0 @@ const typeArguments = [params.fromToken, params.toToken, curve]; |
@@ -107,3 +107,3 @@ import { | ||
function: | ||
'0x190d44266241744264b964a37b8f09863167a12d3e70cda39376cfb4e3561e12::scripts_v2::swap', | ||
'0x163df34fccbf003ce219d3f1d9e70d140b60622cb9dd47599c25fb2f797ba6e::scripts::swap', | ||
type_arguments: [TOKENS_MAPPING.USDT, TOKENS_MAPPING.WETH, curves.stableV05], | ||
@@ -130,3 +130,3 @@ arguments: ['150000', '145'], | ||
function: | ||
'0x190d44266241744264b964a37b8f09863167a12d3e70cda39376cfb4e3561e12::scripts_v2::swap', | ||
'0x163df34fccbf003ce219d3f1d9e70d140b60622cb9dd47599c25fb2f797ba6e::scripts::swap', | ||
type_arguments: [TOKENS_MAPPING.USDT, TOKENS_MAPPING.WETH, curves.stableV05], | ||
@@ -133,0 +133,0 @@ arguments: ['150000', '145'], |
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
239394
3796