This repository has been archived by the owner on Feb 21, 2024. It is now read-only.
/
trustLineXrpBlockchain.php
67 lines (53 loc) · 1.95 KB
/
trustLineXrpBlockchain.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/**
* Copyright (c) 2022-2023 tatum.io
*
* @link https://tatumio.github.io/tatum-php/Api/XRPApi/#trustlinexrpblockchain
* @license MIT
* @author Mark Jivko
*
* SECURITY WARNING
* Execute this file in CLI mode only!
*/
"cli" !== php_sapi_name() && exit();
// Use any PSR-4 autoloader
require_once dirname(__DIR__, 3) . "/autoload.php";
// Set your API Keys 👇 here
$sdk = new \Tatum\Sdk();
// 🐛 Enable debugging on the MainNet
$sdk->mainnet()->config()->setDebug(true);
$arg_trust_line_xrp_blockchain = (new \Tatum\Model\TrustLineXrpBlockchain())
// XRP account address. Must be the one used for generating deposit tags.
->setFromAccount('rPRxSZzTFd6Yez3UMxFUPJvnhUhjewpjfV')
// Blockchain address of the issuer of the assets to create trust line for.
->setIssuerAccount('rsP3mgGb2tcYUrxiLFiHJiQXhsziegtwBc')
// Amount of the assets to be permitted to send over this trust line. 0 means deletion of the trust ...
->setLimit('10000')
// Asset name. Must be 160bit HEX string, e.g. SHA1.
->setToken('DA39A3EE5E6B4B0D3255BFEF95601890AFD80709')
// Secret for account. Secret, or signature Id must be present.
->setFromSecret('snSFTHdvSYQKKkYntvEt8cnmZuPJB')
// (optional) Fee to be paid, in XRP. If omitted, current fee will be calculated.
->setFee('10000');
try {
/**
* POST /v3/xrp/trust
*
* @var \Tatum\Model\TransactionSigned $response
*/
$response = $sdk->mainnet()
->api()
->xRP()
->trustLineXrpBlockchain($arg_trust_line_xrp_blockchain);
var_dump($response);
} catch (\Tatum\Sdk\ApiException $apiExc) {
echo sprintf(
"API Exception when calling api()->xRP()->trustLineXrpBlockchain(): %s\n",
var_export($apiExc->getResponseObject(), true)
);
} catch (\Exception $exc) {
echo sprintf(
"Exception when calling api()->xRP()->trustLineXrpBlockchain(): %s\n",
$exc->getMessage()
);
}