https://github.com/fukaoi/stellar-tutorial
Custom token(asset) issue example code
https://github.com/fukaoi/stellar-tutorial
asset js sdk stellar token
Last synced: 9 months ago
JSON representation
Custom token(asset) issue example code
- Host: GitHub
- URL: https://github.com/fukaoi/stellar-tutorial
- Owner: fukaoi
- Created: 2018-09-04T13:52:12.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-03-08T18:23:30.000Z (11 months ago)
- Last Synced: 2025-03-30T09:31:32.752Z (10 months ago)
- Topics: asset, js, sdk, stellar, token
- Language: JavaScript
- Homepage:
- Size: 219 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# stellar-tutorial
This tutorial code is a sample of a series article ([Japanese only](https://crypto.watch.impress.co.jp/docs/serial/dmmcourse/1159808.html))this tutorial file
For creating and sending custom asset(token).The original code is [official page](https://www.stellar.org/developers/js-stellar-base/reference/base-examples.html), but the orginal code is written in Promise/Then, unfortunately I can not see it. Therefore, I coded it with Await/Async.
## Operation check
* Node.js version: 8.9.0, 10.14.2(Operation check OK)
* OS version: Ubuntu, MacOSX(no check windows os)
* js-stellar-sdk version: 5.0.1(latest version 2020/05/10)
## Install
```bash
$ npm install
```
## Pre-work
create config.js
```json
exports.config = {
publicKey: 'Your public key',
secretKey: 'Your secret key',
}
```
and
## Usage
```bash
node my_token_send.js
```
* Issue custom asset
```js
const StellarSdk = require('stellar-sdk')
const MyToken = require('./lib/token.js')
const config = require('./config.js').config
const asset = new StellarSdk.Asset(
'OREORE',
config.publicKey
);
const obj = new MyToken()
obj.createTransaction(
'GBY4J7D4ERYAVD2IXTIFS6SSSSG343LNF5B57F4BJL5IIEKGUBEBYC37',
asset,
100
).then((txBuild) => {
const tx = txBuild.build()
obj.send(tx)
}).catch((ex) => console.error(ex))
```