fkwallet
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

NodeJS FKWallet API

license npm downloads GitHub last commit

📦 Установка

yarn add fkwallet

🛠️ Использование

import 'dotenv/config';
import { ApiClient, CryptoType } from 'fkwallet';

const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));

const main = async () => {
  const api = new ApiClient(
    process.env.WALLET_PROVIDER_FKWALLET_SHOP_ID!,
    process.env.WALLET_PROVIDER_FKWALLET_API_KEY!,
  );

  let time = Date.now();
  const balance = await api.getBalance();
  console.log('balance', balance);
  console.log(`Time: ${Date.now() - time} ms`);

  await sleep(1e3);
  time = Date.now();
  const btcAddressNew = await api.createCryptoAddress(CryptoType.BTC);
  console.log('btcAddressNew', btcAddressNew);
  console.log(`Time: ${Date.now() - time} ms`);

  await sleep(1e3);
  time = Date.now();
  const btcAddress = await api.getCryptoAddress(CryptoType.BTC);
  console.log('btcAddress', btcAddress);
  console.log(`Time: ${Date.now() - time} ms`);

  await sleep(1e3);
  time = Date.now();
  const paymentStatus = await api.getPaymentStatus({ payment_id: 22664540 });
  console.log('paymentStatus', paymentStatus.data.payment_id);
  console.log(`Time: ${Date.now() - time} ms`);
};
main().then();

Readme

Keywords

Package Sidebar

Install

npm i fkwallet

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

45.8 kB

Total Files

16

Last publish

Collaborators

  • xtcry