@blockbee/api
Advanced tools
Comparing version 2.1.0 to 2.1.1
16
index.js
@@ -13,2 +13,8 @@ /** | ||
if (!coin || !callbackUrl) { | ||
throw new Error('Missing required parameters') | ||
} | ||
coin = coin.replace('/', '_') | ||
BlockBee.getSupportedCoins(apiKey).then(validCoins => { | ||
@@ -95,10 +101,6 @@ if ( !validCoins.hasOwnProperty(coin) ) { | ||
if ( response.status === 'success' ) { | ||
const addressIn = response.address_in | ||
const addressIn = response.address_in | ||
this.paymentAddress = addressIn | ||
return addressIn | ||
} | ||
return null | ||
this.paymentAddress = addressIn | ||
return addressIn | ||
} | ||
@@ -105,0 +107,0 @@ |
{ | ||
"name": "@blockbee/api", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "BlockBee's Library for NodeJS", | ||
@@ -34,3 +34,4 @@ "main": "index.js", | ||
"optimism", | ||
"arbitrum" | ||
"arbitrum", | ||
"solana" | ||
], | ||
@@ -37,0 +38,0 @@ "bugs": { |
@@ -327,3 +327,3 @@ [<img src="https://blockbee.io/static/assets/images/blockbee_logo_nospaces.png" width="300"/>](image.png) | ||
```javascript | ||
const coin = 'polygon_matic' | ||
const coin = 'polygon_pol' | ||
@@ -400,3 +400,3 @@ const requests = { | ||
"fee": "0.006", | ||
"coin": "polygon_matic", | ||
"coin": "polygon_pol", | ||
"timestamp": "13/03/2024 17:48:39" | ||
@@ -519,3 +519,3 @@ } | ||
"fee": "0.006", | ||
"coin": "polygon_matic", | ||
"coin": "polygon_pol", | ||
"txid": "0xf9aa1618a7e460f8c68b6a02369b5058282c53a4ee23f967abef0d35203f328c", | ||
@@ -565,5 +565,8 @@ "timestamp": "13/03/2024 18:10:35" | ||
#### 2.1.1 | ||
* Minor improvements | ||
### Breaking Changes | ||
#### 2.0.0 | ||
* `createPayout` parameters were changed and will require you to update your code. | ||
* `createPayout` parameters were changed and will require you to update your code. |
40
test.js
@@ -8,3 +8,2 @@ const BlockBee = require('./index') | ||
const info = await BlockBee.getInfo() | ||
console.log(info) | ||
if (info === null) throw new Error('fail') | ||
@@ -15,3 +14,2 @@ }) | ||
const info = await BlockBee.getInfo('btc') | ||
console.log(info) | ||
if (info === null) throw new Error('fail') | ||
@@ -21,4 +19,3 @@ }) | ||
test('Test requesting supported cryptocurrencies', async (t) => { | ||
const supportedCoins = await BlockBee.getSupportedCoins(apiKey) | ||
console.log(supportedCoins) | ||
const supportedCoins = await BlockBee.getSupportedCoinsTest(apiKey) | ||
if (supportedCoins === null) throw new Error('fail') | ||
@@ -28,3 +25,3 @@ }) | ||
test('Test generating address', async (t) => { | ||
const bb = new BlockBee('polygon_matic', null, 'https://webhook.site/19a994f1-54eb-47dc-8516-4107851f9a5s', { | ||
const bb = new BlockBee('polygon_pol', null, 'https://webhook.site/19a994f1-54eb-47dc-8516-4107851f9a5s', { | ||
order_id: 1235, | ||
@@ -37,3 +34,2 @@ }, { | ||
const address = await bb.getAddress() | ||
console.log(address) | ||
if (address === null) throw new Error('fail') | ||
@@ -43,3 +39,3 @@ }) | ||
test('Test getting logs', async (t) => { | ||
const bb = new BlockBee('polygon_matic', null, 'https://webhook.site/19a994f1-54eb-47dc-8516-4107851f9a5s', { | ||
const bb = new BlockBee('polygon_pol', null, 'https://webhook.site/19a994f1-54eb-47dc-8516-4107851f9a5s', { | ||
order_id: 1235, | ||
@@ -52,3 +48,2 @@ }, { | ||
const logs = await bb.checkLogs() | ||
console.log(logs) | ||
if (logs === null) throw new Error('fail') | ||
@@ -59,3 +54,3 @@ }) | ||
test('Test getting QrCode', async (t) => { | ||
const bb = new BlockBee('polygon_matic', null, 'https://webhook.site/19a994f1-54eb-47dc-8516-4107851f9a5f', {}, { | ||
const bb = new BlockBee('polygon_pol', null, 'https://webhook.site/19a994f1-54eb-47dc-8516-4107851f9a5f', {}, { | ||
convert: 1, | ||
@@ -66,3 +61,2 @@ multi_chain: 1, | ||
const qrCode = await bb.getQrcode(2, 300) | ||
console.log(qrCode) | ||
if (qrCode === null) throw new Error('fail') | ||
@@ -72,3 +66,3 @@ }) | ||
test('Test getting getEstimate', async (t) => { | ||
const estimate = await BlockBee.getEstimate('polygon_matic', apiKey,1, 'default') | ||
const estimate = await BlockBee.getEstimate('polygon_pol', apiKey,1, 'default') | ||
if (estimate === null) throw new Error('fail') | ||
@@ -78,4 +72,3 @@ }) | ||
test('Test getting getConvert', async (t) => { | ||
const convert = await BlockBee.getConvert('polygon_matic', 300,'USD', apiKey) | ||
console.log(convert) | ||
const convert = await BlockBee.getConvert('polygon_pol', 300,'USD', apiKey) | ||
if (convert === null) throw new Error('fail') | ||
@@ -90,4 +83,3 @@ }) | ||
const payout = await BlockBee.createPayout('polygon_matic', requests, apiKey, false) | ||
console.log(payout) | ||
const payout = await BlockBee.createPayout('polygon_pol', requests, apiKey, false) | ||
if (payout === null) throw new Error('fail') | ||
@@ -98,3 +90,2 @@ }) | ||
const payout = await BlockBee.listPayouts('bep20_usdt', 'all', 1, apiKey, true) | ||
console.log(payout) | ||
if (payout === null) throw new Error('fail') | ||
@@ -104,4 +95,3 @@ }) | ||
test('Get Payout Wallet / and balance', async (t) => { | ||
const wallet = await BlockBee.getPayoutWallet('polygon_matic', apiKey, true) | ||
console.log(wallet) | ||
const wallet = await BlockBee.getPayoutWallet('polygon_pol', apiKey, true) | ||
if (wallet === null) throw new Error('fail') | ||
@@ -112,8 +102,6 @@ }) | ||
const ids = [ | ||
'6f84ae0c-e9fd-45d2-9c42-1c8e02e89551', | ||
'372293c6-e841-4dc0-b80d-a41d1971c136' | ||
'b88972c9-058a-47a2-8e5e-8ee601cdb7d8' | ||
] | ||
const payout = await BlockBee.createPayoutByIds(apiKey, ids) | ||
console.log(payout) | ||
if (payout === null) throw new Error('fail') | ||
@@ -124,3 +112,2 @@ }) | ||
const payout = await BlockBee.processPayout(apiKey, '3da6bff6-f0f7-4f93-8512-b4611d80077e') | ||
console.log(payout) | ||
if (payout === null) throw new Error('fail') | ||
@@ -131,3 +118,2 @@ }) | ||
const status = await BlockBee.checkPayoutStatus(apiKey, '3da6bff6-f0f7-4f93-8512-b4611d80077e') | ||
console.log(status) | ||
if (status === null) throw new Error('fail') | ||
@@ -146,3 +132,2 @@ }) | ||
) | ||
console.log(paymentLink) | ||
if (paymentLink === null) throw new Error('fail') | ||
@@ -154,3 +139,2 @@ }) | ||
const paymentLogs = await BlockBee.paymentLogs(token, apiKey) | ||
console.log(paymentLogs) | ||
if (paymentLogs === null) throw new Error('fail') | ||
@@ -161,9 +145,8 @@ }) | ||
const depositLink = await BlockBee.depositRequest( | ||
'https://example.com', | ||
'https://arianoangelo.com/', | ||
apiKey, | ||
{ | ||
deposit_id: 124, | ||
deposit_id: 100, | ||
} | ||
) | ||
console.log(depositLink) | ||
if (depositLink === null) throw new Error('fail') | ||
@@ -175,4 +158,3 @@ }) | ||
const depositLogs = await BlockBee.depositLogs(token, apiKey) | ||
console.log(depositLogs) | ||
if (depositLogs === null) throw new Error('fail') | ||
}) |
569
42462
479