@wormhole-foundation/connect-sdk
Advanced tools
Comparing version 0.4.0-beta.5 to 0.4.0-beta.6
@@ -1,4 +0,3 @@ | ||
import { Network } from "@wormhole-foundation/sdk-base"; | ||
import { Amount, Network } from "@wormhole-foundation/sdk-base"; | ||
import { ChainAddress, ChainContext, TokenId } from "@wormhole-foundation/sdk-definitions"; | ||
import { Amount } from "@wormhole-foundation/sdk-base"; | ||
import { TransferQuote } from "../types"; | ||
@@ -5,0 +4,0 @@ import { Wormhole } from "../wormhole"; |
@@ -5,4 +5,2 @@ "use strict"; | ||
const sdk_base_1 = require("@wormhole-foundation/sdk-base"); | ||
const sdk_definitions_1 = require("@wormhole-foundation/sdk-definitions"); | ||
const sdk_base_2 = require("@wormhole-foundation/sdk-base"); | ||
const token_1 = require("./token"); | ||
@@ -25,3 +23,3 @@ class RouteTransferRequest { | ||
parseAmount(amt) { | ||
return (0, sdk_base_2.parseAmount)(amt, this.source.decimals); | ||
return (0, sdk_base_1.parseAmount)(amt, this.source.decimals); | ||
} | ||
@@ -43,8 +41,5 @@ amountFromBaseUnits(amt) { | ||
if (quote.relayFee) { | ||
let amount = (0, sdk_definitions_1.isSameToken)(quote.relayFee.token, quote.sourceToken.token) | ||
? (0, sdk_base_1.displayAmount)((0, sdk_base_1.amountFromBaseUnits)(quote.sourceToken.amount, this.source.decimals)) | ||
: (0, sdk_base_1.displayAmount)((0, sdk_base_1.amountFromBaseUnits)(quote.destinationToken.amount, this.destination.decimals)); | ||
dq.relayFee = { | ||
token: quote.relayFee.token, | ||
amount, | ||
amount: (0, sdk_base_1.displayAmount)((0, sdk_base_1.amountFromBaseUnits)(quote.relayFee.amount, this.source.decimals)), | ||
}; | ||
@@ -51,0 +46,0 @@ } |
@@ -86,3 +86,6 @@ "use strict"; | ||
if ((0, sdk_base_1.baseUnits)(amount) < minAmount) { | ||
throw new Error(`Minimum amount is ${(0, sdk_base_1.displayAmount)(amount)}`); | ||
throw new Error(`Minimum amount is ${(0, sdk_base_1.displayAmount)({ | ||
amount: minAmount.toString(), | ||
decimals: amount.decimals, | ||
})}`); | ||
} | ||
@@ -89,0 +92,0 @@ const transferableAmount = (0, sdk_base_1.baseUnits)(amount) - fee; |
@@ -1,4 +0,3 @@ | ||
import { Network } from "@wormhole-foundation/sdk-base"; | ||
import { Amount, Network } from "@wormhole-foundation/sdk-base"; | ||
import { ChainAddress, ChainContext, TokenId } from "@wormhole-foundation/sdk-definitions"; | ||
import { Amount } from "@wormhole-foundation/sdk-base"; | ||
import { TransferQuote } from "../types"; | ||
@@ -5,0 +4,0 @@ import { Wormhole } from "../wormhole"; |
@@ -1,4 +0,2 @@ | ||
import { amountFromBaseUnits, displayAmount } from "@wormhole-foundation/sdk-base"; | ||
import { isSameToken, } from "@wormhole-foundation/sdk-definitions"; | ||
import { parseAmount } from "@wormhole-foundation/sdk-base"; | ||
import { amountFromBaseUnits, displayAmount, parseAmount, } from "@wormhole-foundation/sdk-base"; | ||
import { getTokenDetails } from "./token"; | ||
@@ -38,8 +36,5 @@ export class RouteTransferRequest { | ||
if (quote.relayFee) { | ||
let amount = isSameToken(quote.relayFee.token, quote.sourceToken.token) | ||
? displayAmount(amountFromBaseUnits(quote.sourceToken.amount, this.source.decimals)) | ||
: displayAmount(amountFromBaseUnits(quote.destinationToken.amount, this.destination.decimals)); | ||
dq.relayFee = { | ||
token: quote.relayFee.token, | ||
amount, | ||
amount: displayAmount(amountFromBaseUnits(quote.relayFee.amount, this.source.decimals)), | ||
}; | ||
@@ -46,0 +41,0 @@ } |
@@ -83,3 +83,6 @@ import { contracts, baseUnits, amountFromBaseUnits, displayAmount, } from "@wormhole-foundation/sdk-base"; | ||
if (baseUnits(amount) < minAmount) { | ||
throw new Error(`Minimum amount is ${displayAmount(amount)}`); | ||
throw new Error(`Minimum amount is ${displayAmount({ | ||
amount: minAmount.toString(), | ||
decimals: amount.decimals, | ||
})}`); | ||
} | ||
@@ -86,0 +89,0 @@ const transferableAmount = baseUnits(amount) - fee; |
{ | ||
"name": "@wormhole-foundation/connect-sdk", | ||
"version": "0.4.0-beta.5", | ||
"version": "0.4.0-beta.6", | ||
"repository": { | ||
@@ -48,5 +48,5 @@ "type": "git", | ||
"axios": "^1.4.0", | ||
"@wormhole-foundation/sdk-base": "^0.4.0-beta.5", | ||
"@wormhole-foundation/sdk-definitions": "^0.4.0-beta.5" | ||
"@wormhole-foundation/sdk-base": "^0.4.0-beta.6", | ||
"@wormhole-foundation/sdk-definitions": "^0.4.0-beta.6" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1369680
14231