Skip to content

Commit 8ffa668

Browse files
author
DESKTOP\Kostadin
committed
add samo new endpoints and improvements
1 parent fc561bd commit 8ffa668

File tree

109 files changed

+5258
-31
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+5258
-31
lines changed

README.md

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ $allCurrentRatesInExchange = $instance->allCurrentRatesInExchange()->get();
146146
*/
147147
$arbitrage = $instance->arbitrage()->get();
148148

149+
/*
150+
* https://docs.cryptoapis.io/rest-apis/crypto-market-data-apis/index#order-book-snapshot-by-symbol
151+
*/
152+
$arbitrage = $instance->snapshotBySymbol()->get('SYMBOL_ID_STRING');
153+
149154
/*
150155
* https://docs.cryptoapis.io/#btc-blockchain-chain-endpoint
151156
*/
@@ -187,6 +192,18 @@ $info = $instance->blockChainApiBtcChain()->get(Constants::$BTC_TESTNET);
187192
* $result = $instance->addressApiBtcAddressTransactions()->get(Constants::$BTC_TESTNET,'mtFYoSowT3i649wnBDYjCjewenh8AuofQb');
188193
*/
189194

195+
/*
196+
* https://docs.cryptoapis.io/#btc-address-transactions-endpoint
197+
*
198+
* $addresses = [
199+
"2MuLVwmhmxM6RzNBZ347sW9xyRtJoHf8v77",
200+
"n3jYBjCzgGNydQwf83Hz6GBzGBhMkKfgL1",
201+
"2NDhzMt2D9ZxXapbuq567WGeWP7NuDN81cg"
202+
]
203+
*
204+
*
205+
* $result = $instance->addressApiBtcMultipleAddressesInfo()->get(Constants::$BTC_TESTNET, $addresses);
206+
*/
190207

191208

192209
/*
@@ -229,6 +246,26 @@ $info = $instance->blockChainApiBtcChain()->get(Constants::$BTC_TESTNET);
229246
* $result = $instance->walletApiBtcDeleteWallet()->deleteHd(Constants::$BTC_TESTNET,'testWalletName');
230247
*/
231248

249+
/*
250+
* https://docs.cryptoapis.io/rest-apis/blockchain-as-a-service-apis/btc/index#btc-create-xpub-endpoint
251+
* $result = $instance->walletApiBtcCreateXPub()->create(Constants::$BTC_TESTNET, $password);
252+
*/
253+
254+
/*
255+
* https://docs.cryptoapis.io/rest-apis/blockchain-as-a-service-apis/btc/index#btc-get-pub-addresses-endpoint
256+
* $result = $instance->walletApiBtcGetPublicExtendedKeyAddresses()->get($network, $xpub, $index, $limit, $type, $script);
257+
*/
258+
259+
/*
260+
* https://docs.cryptoapis.io/rest-apis/blockchain-as-a-service-apis/btc/index#btc-get-pub-addresses-transactions-endpoint
261+
* $result = $instance->walletApiBtcGetExtendedPublicKeyTxs()->get($network, $xpub, $index, $limit, $type, $script);
262+
*/
263+
264+
/*
265+
* https://docs.cryptoapis.io/rest-apis/blockchain-as-a-service-apis/btc/index#btc-wallet-import-wallet-endpoint
266+
* $result = $instance->walletApiBtcImportAddressAsWallet()->import($network, $walletName, $password, $privateKey, $address);
267+
*/
268+
232269
/*
233270
* https://docs.cryptoapis.io/#btc-transactions-transaction-txid-endpoint
234271
* $result = $instance->transactionApiBtcTransactionsTxid()->get(Constants::$BTC_TESTNET,'e9ec71e8c695e900942cafb98647862abca10275057f71ea76b464aa6a05c720');
@@ -318,6 +355,35 @@ $result = $instance->transactionApiBtcNewTransactionHdWallet()->create(Constants
318355
* $result = $instance->transactionApiBtcNewTransactionFee()->get(Constants::$BTC_TESTNET);
319356
*/
320357

358+
/*
359+
* https://docs.cryptoapis.io/rest-apis/blockchain-as-a-service-apis/btc/index#btc-refund-transaction
360+
* $result = $instance->transactionApiBtcRefundTransaction()->refund(Constants::$BTC_TESTNET, $txId, $wif);
361+
*/
362+
363+
364+
/* Only for ETH
365+
* https://docs.cryptoapis.io/rest-apis/blockchain-as-a-service-apis/eth/index#eth-internal-transactions-endpoint
366+
* $result = $instance->transactionApiEthInternalTransactions()->get(Constants::$ETH_ROPSTEN, $txHash, $limit);
367+
*/
368+
369+
/*BTC based
370+
*https://docs.cryptoapis.io/rest-apis/blockchain-as-a-service-apis/btc/index#btc-transactions-size
371+
372+
373+
374+
$inputs = new \RestApis\Blockchain\BTC\Snippets\Input();
375+
$inputs->add('mtFYoSowT3i649wnBDYjCjewenh8AuofQb', 0.0004);
376+
$inputs->add('mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1',0.00018);
377+
378+
$outputs = new \RestApis\Blockchain\BTC\Snippets\Output();
379+
$outputs->add('mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9', 0.0004);
380+
381+
$fee = new \RestApis\Blockchain\BTC\Snippets\Fee();
382+
$fee->set(0.00023141);
383+
384+
$result = $instance->transactionApiBtcTransactionSize()->calculate(Constants::$BTC_TESTNET, $inputs, $outputs, $fee);
385+
386+
*/
321387

322388
/*
323389
* https://docs.cryptoapis.io/#btc-payment-forwarding-create-payment-endpoint
@@ -370,6 +436,10 @@ $result = $instance->transactionApiBtcNewTransactionHdWallet()->create(Constants
370436
* $result = $instance->webhookBtcDeleteWebhooks()->delete(Constants::$BTC_TESTNET, 'UUID');
371437
*/
372438

439+
/*
440+
* https://docs.cryptoapis.io/rest-apis/blockchain-as-a-service-apis/btc/index#btc-webhooks-delete-all-webhooks-endpoint
441+
* $result = $instance->webhookBtcDeleteAllWebhooks()->delete(Constants::$BTC_TESTNET');
442+
*/
373443

374444
/*
375445
* https://docs.cryptoapis.io/rest-apis/trading-apis/exchange-accounts/index#create-account
@@ -448,4 +518,4 @@ $result = $instance->transactionApiBtcNewTransactionHdWallet()->create(Constants
448518

449519
## License
450520

451-
MIT
521+
MIT
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
4+
namespace RestApis\Blockchain\BCH\AddressAPI;
5+
6+
7+
use Common\Response;
8+
use RestApis\Blockchain\BCH\Common;
9+
10+
class MultipleAddresses extends Common
11+
{
12+
protected $network;
13+
14+
/**
15+
* @param $network string
16+
* @param $addresses array
17+
* @return \stdClass
18+
*/
19+
20+
public function get($network, $addresses)
21+
{
22+
$this->network = $network;
23+
24+
$params = [
25+
'addresses' => $addresses
26+
];
27+
return (new Response(
28+
$this->request([
29+
'method' => 'POST',
30+
'params' => $params
31+
])
32+
))->get();
33+
}
34+
35+
protected function getEndPoint()
36+
{
37+
return $this->endpoint . '/' . $this->network . '/address/show-multiple';
38+
}
39+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
4+
namespace RestApis\Blockchain\BCH\TransactionAPI;
5+
6+
7+
use Common\Response;
8+
use RestApis\Blockchain\BCH\Common;
9+
10+
class RefundTransaction extends Common
11+
{
12+
13+
protected $network;
14+
15+
/**
16+
* @param $network string
17+
* @param $txId string
18+
* @param $wif string
19+
* @return \stdClass
20+
*/
21+
22+
public function refund($network, $txId, $wif)
23+
{
24+
$this->network = $network;
25+
26+
$params = [
27+
'txid' => $txId,
28+
'wif' => $wif,
29+
];
30+
31+
return (new Response(
32+
$this->request([
33+
'method' => 'POST',
34+
'params' => $params
35+
])
36+
))->get();
37+
}
38+
39+
protected function getEndPoint()
40+
{
41+
return $this->endpoint . '/' . $this->network . '/txs/refund';
42+
}
43+
44+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
4+
namespace RestApis\Blockchain\BCH\TransactionAPI;
5+
6+
7+
use Common\Response;
8+
use RestApis\Blockchain\BCH\Common;
9+
use RestApis\Blockchain\BCH\Snippets\Fee;
10+
use RestApis\Blockchain\BCH\Snippets\Input;
11+
use RestApis\Blockchain\BCH\Snippets\Output;
12+
13+
class TransactionSize extends Common
14+
{
15+
16+
protected $network;
17+
18+
/**
19+
* @param $network string
20+
* @param $inputs Input
21+
* @param $outputs Output
22+
* @param $fee Fee
23+
* @param $data string
24+
* @param $locktime integer
25+
* @return \stdClass
26+
*/
27+
28+
public function calculate($network, Input $inputs, Output $outputs, Fee $fee, $locktime = null, $data = null)
29+
{
30+
$this->network = $network;
31+
return (new Response(
32+
$this->request([
33+
'method' => 'POST',
34+
'params' => [
35+
'inputs' => $inputs->get(),
36+
'outputs' => $outputs->get(),
37+
'fee' => $fee->get(),
38+
'data' => $data,
39+
'locktime' => $locktime,
40+
]
41+
])
42+
))->get();
43+
}
44+
45+
protected function getEndPoint()
46+
{
47+
return $this->endpoint . '/' . $this->network . '/txs/size';
48+
}
49+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
4+
namespace RestApis\Blockchain\BCH\WalletAPI;
5+
6+
7+
use Common\Response;
8+
use RestApis\Blockchain\BCH\Common;
9+
10+
class CreateXPUB extends Common
11+
{
12+
13+
protected $network;
14+
15+
/**
16+
* @param $network string
17+
* @param $password string
18+
* @return \stdClass
19+
*/
20+
public function create($network, $password)
21+
{
22+
$this->network = $network;
23+
24+
$params = [
25+
'password' => $password
26+
];
27+
28+
return (new Response(
29+
$this->request([
30+
'method' => 'POST',
31+
'params' => $params
32+
])
33+
))->get();
34+
}
35+
36+
protected function getEndPoint()
37+
{
38+
return $this->endpoint . '/' . $this->network . '/wallets/hd/xpub';
39+
}
40+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
4+
namespace RestApis\Blockchain\BCH\WalletAPI;
5+
6+
7+
use Common\Response;
8+
use RestApis\Blockchain\BCH\Common;
9+
10+
class GetExtendedPublicKeyTxs extends Common
11+
{
12+
protected $network;
13+
14+
/**
15+
* @param $network string
16+
* @param $xpub string
17+
* @param $index integer
18+
* @param $limit integer
19+
* @param $type string
20+
* @param $script bool
21+
* @return \stdClass
22+
*/
23+
public function get($network, $xpub, $index = 0, $limit = 100, $type = 'receive', $script = false)
24+
{
25+
$this->network = $network;
26+
27+
$params = [
28+
'xpub' => $xpub,
29+
'index' => $index,
30+
'limit' => $limit,
31+
'type' => $type,
32+
'script' => $script
33+
];
34+
35+
return (new Response(
36+
$this->request([
37+
'method' => 'POST',
38+
'params' => $params
39+
])
40+
))->get();
41+
}
42+
43+
protected function getEndPoint()
44+
{
45+
return $this->endpoint . '/' . $this->network . '/wallets/hd/xpub/addresses/transactions';
46+
}
47+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
4+
namespace RestApis\Blockchain\BCH\WalletAPI;
5+
6+
7+
use Common\Response;
8+
use RestApis\Blockchain\BCH\Common;
9+
use RestApis\Blockchain\Constants;
10+
11+
class GetPublicExtendedKeyAddresses extends Common
12+
{
13+
14+
protected $network;
15+
16+
/**
17+
* @param $network string
18+
* @param $xpub string
19+
* @param $index integer
20+
* @param $limit integer
21+
* @param $type string
22+
* @param $script bool
23+
* @return \stdClass
24+
*/
25+
public function get($network, $xpub, $index = 0, $limit = 100, $type = 'receive', $script = false)
26+
{
27+
$this->network = $network;
28+
29+
$params = [
30+
'xpub' => $xpub,
31+
'index' => $index,
32+
'limit' => $limit,
33+
'type' => $type,
34+
'script' => $script
35+
];
36+
37+
return (new Response(
38+
$this->request([
39+
'method' => 'POST',
40+
'params' => $params
41+
])
42+
))->get();
43+
}
44+
45+
protected function getEndPoint()
46+
{
47+
return $this->endpoint . '/' . $this->network . '/wallets/hd/xpub/addresses';
48+
}
49+
}

0 commit comments

Comments
 (0)