### In your code
-```
+```javascript
const bytom = require('bytom-sdk')
const url = 'http://localhost:9888'
-// access token is required when client is not in same origin with the request bytom node
+// access token is required when client is not in same origin
+// with the request bytom node
const accessToken = ''
const client = new bytom.Client(url, accessToken)
### Step 2: create a account
```javascript
-const accountPromise = keyPromise.then(key => client.accounts.create([key.xpub], 1, 'account'))
+const accountPromise = keyPromise.then(key => {
+ client.accounts.create([key.xpub], 1, 'account')
+})
```
### Step 3: create account address
### Step 4: create asset
```javascript
-const definition = {name: "GOLD", symobol: "GOLD", decimals: 8, description: {}}
+const definition = {
+ name: "GOLD",
+ symobol: "GOLD",
+ decimals: 8,
+ description: {}
+}
const assetPromise = keyPromise.then(key => {
return client.assets.create([key.xpub], 1, 'asset', definition)
})
#### First, build the transaction
```javascript
-const buildPromise = Promise.all([accountPromise, addressPromise, assetPromise]).then(([account, address, asset]) => {
+const buildPromise = Promise.all([
+ accountPromise,
+ addressPromise,
+ assetPromise]
+ ).then(([account, address, asset]) => {
const issueAction = {
amount: 10000000000,
asset_alias: asset.alias,
address: address.address
}
- return client.transactions.build(null, [issueAction, gasAction, controlAction])
+ return client.transactions.build(null,
+ [issueAction, gasAction, controlAction])
})
```