This repository has been archived by the owner on Feb 21, 2024. It is now read-only.
/
erc20Address.php
79 lines (61 loc) · 2.34 KB
/
erc20Address.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
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* Copyright (c) 2022-2023 tatum.io
*
* @link https://tatumio.github.io/tatum-php/Api/BlockchainOperationsApi/#erc20address
* @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);
// Blockchain to work with
$arg_chain = "ETH";
$arg_erc20_address = (new \Tatum\Model\Erc20Address())
// The name of the token; used as an identifier within the Tatum platform and as a currency symbol o...
->setSymbol('MY_TOKEN')
// The supply of the token
->setSupply('1000000.0')
// The number of decimal places that the token has
->setDecimals(8)
// The description of the token; used as a description within the Tatum platform and as a currency n...
->setDescription('My Public Token')
// The blockchain address to be assigned to the virtual account as a deposit address
->setAddress('0x687422eEA2cB73B5d3e242bA5456b782919AFc85')
// The base pair for the virtual currency that represents the token; used to calculate the value of ...
->setBasePair('EUR')
// (optional) The exchange rate for the base pair; one unit of the created virtual currency equals 1 unit of <c...
->setBaseRate(1)
// (optional) \Tatum\Model\CustomerRegistration
->setCustomer(null)
// (optional) AThe ISO 4217 code of the currency in which all transactions for the created virtual account will...
->setAccountingCurrency('USD');
try {
/**
* POST /v3/offchain/token/{chain}
*
* @var \Tatum\Model\Erc20Response $response
*/
$response = $sdk->mainnet()
->api()
->blockchainOperations()
->erc20Address($arg_chain, $arg_erc20_address);
var_dump($response);
} catch (\Tatum\Sdk\ApiException $apiExc) {
echo sprintf(
"API Exception when calling api()->blockchainOperations()->erc20Address(): %s\n",
var_export($apiExc->getResponseObject(), true)
);
} catch (\Exception $exc) {
echo sprintf(
"Exception when calling api()->blockchainOperations()->erc20Address(): %s\n",
$exc->getMessage()
);
}