@plutohq/pluto-js
Advanced tools
Comparing version 1.6.7 to 1.6.8
@@ -57,7 +57,7 @@ "use strict"; | ||
var contracts_1 = __importDefault(require("./constants/contracts")); | ||
var currencies_1 = __importDefault(require("lib/constants/currencies")); | ||
var multitransfer_json_1 = require("lib/constants/abi/multitransfer.json"); | ||
var multitransfer_json_1 = require("./constants/multitransfer.json"); | ||
var calculate_amounts_1 = __importDefault(require("./helpers/calculate-amounts")); | ||
var to_number_string_1 = __importDefault(require("./helpers/to-number-string")); | ||
var erc20_json_1 = require("lib/constants/abi/erc20.json"); | ||
var erc20_json_1 = require("./constants/erc20.json"); | ||
var currencies_1 = __importDefault(require("./constants/currencies")); | ||
var PlutoJS = /** @class */ (function () { | ||
@@ -172,3 +172,3 @@ function PlutoJS(apiKey, options) { | ||
throw new Error('No signer present'); | ||
currency = currencies_1.default.find(function (c) { return c.chain === paymentIntent.chain && c.code === paymentIntent.currency; }); | ||
currency = (0, currencies_1.default)(paymentIntent.chain, paymentIntent.currency, this.env, this.env === 'dev' ? 'dev' : 'stg'); | ||
if (!currency) | ||
@@ -175,0 +175,0 @@ throw new Error('Unexpected currency'); |
{ | ||
"name": "@plutohq/pluto-js", | ||
"version": "1.6.7", | ||
"version": "1.6.8", | ||
"description": "JS Library for Pluto", | ||
@@ -17,4 +17,3 @@ "main": "dist/index.js", | ||
"ethers": "^5.6.8", | ||
"qs": "^6.10.5", | ||
"lib": "./packages/lib" | ||
"qs": "^6.10.5" | ||
}, | ||
@@ -21,0 +20,0 @@ "devDependencies": { |
@@ -1,16 +0,16 @@ | ||
import { Account, Fee, PaymentIntent, Pluto, PlutoOptions, Transfer, Wallet } from '@plutohq/pluto-node'; | ||
import { Contract, Signer } from 'ethers'; | ||
import {Account, Fee, PaymentIntent, Pluto, PlutoOptions, Transfer, Wallet} from '@plutohq/pluto-node'; | ||
import {Contract, Signer} from 'ethers'; | ||
import qs from 'qs'; | ||
import { Connection, PublicKey, SystemProgram, Transaction } from '@solana/web3.js'; | ||
import {Connection, PublicKey, SystemProgram, Transaction} from '@solana/web3.js'; | ||
import contracts from './constants/contracts'; | ||
import currencies from 'lib/constants/currencies'; | ||
import { abi } from 'lib/constants/abi/multitransfer.json'; | ||
import {abi} from './constants/multitransfer.json'; | ||
import Contracts from './types/contracts'; | ||
import calculateAmounts from './helpers/calculate-amounts'; | ||
import toNumberString from './helpers/to-number-string'; | ||
import { abi as erc20ABI } from 'lib/constants/abi/erc20.json'; | ||
import {abi as erc20ABI} from './constants/erc20.json'; | ||
import getCurrency from "./constants/currencies"; | ||
export type PlutoJSOptions = PlutoOptions & { | ||
ethSigner?: Signer | null; | ||
solWallet?: any | null; // TODO: Find a better type than `any`. Currently can't use type from Solana wallet adapter, the types are incompatible with multiple implementations | ||
solWallet?: any | null; | ||
solConnection?: Connection | null; | ||
@@ -80,3 +80,2 @@ plutoAccount?: string; | ||
async confirmPayment(paymentIntentId: string): Promise<{ hash: string } | undefined> { | ||
@@ -113,3 +112,8 @@ const paymentIntent = await this.pluto.paymentIntents.retrieve( | ||
const currency = currencies.find((c) => c.chain === paymentIntent.chain && c.code === paymentIntent.currency); | ||
const currency = getCurrency( | ||
paymentIntent.chain, | ||
paymentIntent.currency, | ||
this.env as keyof object, | ||
this.env === 'dev' ? 'dev' : 'stg' | ||
); | ||
if (!currency) throw new Error('Unexpected currency'); | ||
@@ -116,0 +120,0 @@ |
Sorry, the diff of this file is not supported yet
55428
4
38
1617
- Removedlib@./packages/lib